Home

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.

Agenda

  1. Before class: Install starter tools: Anaconda, Atom, and GitHub. When in doubt, accept the default installation locations.
    1. Install Anaconda if you don't already have it. We prefer the 3.6 edition of Python, and recommend the graphical installer.
    2. Install the Atom text editor.
    3. Create a GitHub account with a professional username.
    4. 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.
  2. Brief overview of your online employment portfolio:
    1. Your U of M home page.
    2. resume
    3. 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.
    4. 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.
  3. Getting started with GitHub
    1. 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\'.
    2. 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."
    3. 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.
    4. 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.
  4. Creating your GitHub home page
    1. Go to GitHub Pages, and follow the directions to create your website hosted at yourusername.github.io.
    2. 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.
    3. 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.
  5. Getting started with Jupyter and Python
    1. 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 Quant-python directory.
    2. Launch Anaconda->Jupyter Notebook, and navigate to your Quant-python directory.
    3. simple data types: int, float, boolean, string
    4. control structures: for loops, if/else
    5. collection data types: lists, dictionaries
    6. for loops with collections
    7. functions
    8. commit your work in GitHub Desktop, and sync.
    9. 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.
  6. Additional Python practice
    1. As before, we will start with a stubbed notebook, python-secret-notebook-empty.ipynb. Save 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.
    2. Other practice problems...
      1. HackerRank
      2. Codility
      3. Leet Code
      4. Google Code Jam
      5. Programming Praxis
  7. Day 3
    1. warmup: individually, solve interview problem 8.6 (the clock problem). In informal teams, work on interview problem 8.5 (the 7 boxes problem).
    2. Python applied to interview questions
      1. As before, we will start with a stubbed notebook, python-interview-notebook-empty.ipynb. Save it in your Quant-python directory.
      2. Solve interview problems 1.1, 3.1, 3.8, 3.10, 3.11
      3. commit your work via GitHub Desktop, and sync. Add a link to the notebook from your GitHub home page.
  8. Day 4
    1. warmup: individually, solve interview problem 1.11.
    2. In python-interview-notebook.ipynb, simulate the two coins problem, plot the distribution of winnings, and compute the mean.
    3. warmup: In informal teams, work on interview problem 3.12 (flipping two coins problem).
    4. 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.
    5. Discuss the Princeton Quant Trading Conference in Chicago on Oct 23rd.
    6. Introduction to modeling market risk.
  9. Day 5
    1. warmup: individually, solve interview problem 1.9.
    2. warmup: In informal teams, work on interview problem 8.15 (the dark and rainy night, looking for a road).
    3. Create python-hackerrank-notebook.ipynb in your Quant-python repo, and solve the balanced brackets problem. Push your changes to your GitHub repo.
    4. Survey: are you interested in attending the Princeton Quant Trading Conference in Chicago on Oct 23rd?
    5. Continuing to modeling market risk.
      1. Create a portfolio of 100 shares of AMZN stock, and compute 5%-quantile VaR.
      2. For the portfolio of 100 shares of AMZN stock, compute 5%-quantile Expected Shortfall (aka average VaR or conditional VaR).
      3. Begin simulation of 3 stocks (AMZN, GOOG, and AAPL).
  10. Day 6
    1. warmup: individually, solve interview problem 3.4. Compare your answer with others.
    2. warmup: In informal teams, work on interview problem 3.14 (the Monte Hall problem).
    3. Class discussion: Russell 3000 covariance matrix.
    4. Back to modeling market risk.
        Simulation of 3 stocks (AMZN, GOOG, and AAPL)
      1. Create a CSV or tab-delimited file similar to your Amazon file, but add columns for the closing prices of Google and Apple.
      2. In Python, create a PriceSeries class.
      3. In Python, figure out how to read the prices from your file, and create PriceSeries objects for each of the three stocks.
      4. Modify your PriceSeries class so that it also caches the log returns.
      5. Class discussion: How Monte Carlo (simulation of returns) is done using the RiskMetrics model.
      6. Begin building simulation of the 3 stocks in Python.
  11. Last day of boot camp!
    1. The Day 6 work (ThreeStockMonteCarlo) is available for download from GitHub.
    2. warmup: individually, solve interview problem 1.7. Compare your answer with others.
    3. warmup: In informal teams, work on interview problem 8.12 (37 racehorses).
    4. Discussion: what is your best solution to interview problem 8.15 (the dark and rainy night, looking for a road)?
    5. Complete 3-stock simulation.
      1. Python: Add log returns to price series.
      2. Discussion: Multi-factor simulation, and EWMA.
      3. Python: Create Scenario class that contains weights for returns.
      4. Python: Create Position class with Price Series, and # shares.
      5. Python: Create Portfolo class with positions.
      6. Python: Generate 100,000 Scenarios, and simulate PnL on portfolio.