Quant boot camp
Below is the agenda we follow to build a University web page and personal website, and learn some financial concepts while developing Python programming skills. Not necessarily in that order.
- Before class: Install starter tools: Anaconda, Atom, and GitHub. When in doubt, accept the default installation locations.
- Install Anaconda if you don't already have it. We prefer the 3.6 edition of Python, and recommend the graphical installer.
- Install the Atom text editor.
- Create a GitHub account with a professional username.
- Install GitHub Desktop. NOTE: if you are running Linux, there is no desktop client as of this writing. When it is time to work with git (coming up later in the agenda), follow the
instructions at github.
- Brief overview of your online employment portfolio:
- Your U of M home page.
- LinkedIn page. Sign up if you haven't already. Be professional. Send an invite to Pete, and join the University of Michigan Quant Finance group.
- personal website hosted with GitHub Pages. You'll need to create a free GitHub account. Use an appropriate name for your account, as it will be visible to potential employers.
- Getting started with GitHub
- From GitHub Desktop, click on the '+' in the upper left to create a new repository, create a GitHub repository named
Quant-python. For Windows, I suggest using the Local Path 'C:\Users\yourUserName\Documents\GitHub\'.
- Launch Atom (on Windows, you can launch it from GitHub Desktop via the icon in the upper right). Create a README.md file using Atom in your
Quant-python directory. Add this text to it: “These are programs I’ve written while learning
Python. The implementation is in Jupyter notebooks."
- In GitHub Desktop, refresh the Changes tab in your
Quant-python project, and Publish. Then commit your changes (set Summary to something like "initial commit"), and sync.
- Log in to GitHub in your browser, and navigate to your
Quant-python repo. You should see your files listed, and your README.md file has been rendered as HTML.
- Creating your GitHub home page
- Go to GitHub Pages, and follow the directions to create your website hosted at yourusername.github.io.
- You could continue to write your own HTML. But we aren't really here to do that, and we want something simple but already designed, so we will use the GitHub Pages templates. Go to GitHub.com,
and go to your yourusername.github.io repository. Click on Settings, and scroll down to the Automatic Page Generator button. Click it.
- Discussion: what should go on your web page? At a minimum, this is a good place to elaborate on your work, fleshing out what you say on your CV and LinkedIn. I recommed the following sections: Education, Skills (starting with Python), Employment.
Upload files, and make good use of links. Add a screenshot of your progress on Project Euler. Perhaps tell a story about the hardest problem you've ever solved, and show some evidence of your work. You can start with this markdown.
- Getting started with Jupyter and Python
- Jupyter runs Python in your browser, using a Jupyter Notebook. The Notebook requires a local server to be running, which you will start using a shell script. Notebooks support Markdown, and python code with full access to everything you got
from Anaconda. We will start by downloading the stubbed notebook python-basics-notebook-empty.ipynb.
Click on the notebook, and you will see it displayed as you will see it in Jupyter. Click on the Raw button, select File->Save as..., change "Save as type:" to "All files" (otherwise you will end up with an unusable text file), and change
the name to "python-basics-notebook.ipynb" before saving in your
- Launch Anaconda->Jupyter Notebook, and navigate to your
- simple data types: int, float, boolean, string
- control structures: for loops, if/else
- collection data types: lists, dictionaries
- for loops with collections
- commit your work in GitHub Desktop, and sync.
- Go to GitHub in your browser, and navigate to
python-basics-notebook-empty.ipynb. You should see your files listed. Copy the URL, and add a link from your GitHub home page to your new notebook.
- Additional Python practice
- As before, we will start with a stubbed notebook,
it in your
Quant-python directory. We'll use it for problems in Project Euler. Commit your work via GitHub Desktop, and sync. Add a link to the notebook from your
GitHub home page.
- Other practice problems...
- Leet Code
- Google Code Jam
- Programming Praxis
- Day 3
- warmup: individually, solve interview problem 8.6 (the clock problem). In informal teams, work on interview problem 8.5 (the 7 boxes problem).
- Python applied to interview questions
- As before, we will start with a stubbed notebook,
Save it in your
- Solve interview problems 1.1, 3.1, 3.8, 3.10, 3.11
- commit your work via GitHub Desktop, and sync. Add a link to the notebook from your GitHub home page.
- Day 4
- warmup: individually, solve interview problem 1.11.
python-interview-notebook.ipynb, simulate the two coins problem, plot the distribution of winnings, and compute the mean.
- warmup: In informal teams, work on interview problem 3.12 (flipping two coins problem).
- Create a GitHub repo called
cv. Add your resume to it, including a pdf version. We will look at two ways to create a link from your U of M site to your resume, using GitHub Pages, and RawGit. The
important thing is that whatever method you use, your URL should take you directly to the pdf of your resume, so that we can reliably retrieve your resume via a script.
- Discuss the Princeton Quant Trading Conference in Chicago on Oct 23rd.
- Introduction to modeling market risk.
- Day 5
- warmup: individually, solve interview problem 1.9.
- warmup: In informal teams, work on interview problem 8.15 (the dark and rainy night, looking for a road).
python-hackerrank-notebook.ipynb in your Quant-python repo, and solve the balanced brackets problem. Push your changes to your GitHub repo.
- Survey: are you interested in attending the Princeton Quant Trading Conference in Chicago on Oct 23rd?
- Continuing to modeling market risk.
- Create a portfolio of 100 shares of AMZN stock, and compute 5%-quantile VaR.
- For the portfolio of 100 shares of AMZN stock, compute 5%-quantile Expected Shortfall (aka average VaR or conditional VaR).
- Begin simulation of 3 stocks (AMZN, GOOG, and AAPL).
- Day 6
- warmup: individually, solve interview problem 3.4. Compare your answer with others.
- warmup: In informal teams, work on interview problem 3.14 (the Monte Hall problem).
- Class discussion: Russell 3000 covariance matrix.
- Back to modeling market risk.
Simulation of 3 stocks (AMZN, GOOG, and AAPL)
- Create a CSV or tab-delimited file similar to your Amazon file, but add columns for the closing prices of Google and Apple.
- In Python, create a PriceSeries class.
- In Python, figure out how to read the prices from your file, and create PriceSeries objects for each of the three stocks.
- Modify your PriceSeries class so that it also caches the log returns.
- Class discussion: How Monte Carlo (simulation of returns) is done using the RiskMetrics model.
- Begin building simulation of the 3 stocks in Python.
- Last day of boot camp!
- The Day 6 work (ThreeStockMonteCarlo) is available for download from GitHub.
- warmup: individually, solve interview problem 1.7. Compare your answer with others.
- warmup: In informal teams, work on interview problem 8.12 (37 racehorses).
- Discussion: what is your best solution to interview problem 8.15 (the dark and rainy night, looking for a road)?
- Complete 3-stock simulation.
- Python: Add log returns to price series.
- Discussion: Multi-factor simulation, and EWMA.
- Python: Create Scenario class that contains weights for returns.
- Python: Create Position class with Price Series, and # shares.
- Python: Create Portfolo class with positions.
- Python: Generate 100,000 Scenarios, and simulate PnL on portfolio.