Week 1: Git, GitHub, and Virtual Environments

Week 1: Git, GitHub, and Virtual Environments#

The paper this week is Sharpe (1964) and the object is the CAPM’s market portfolio. The tools are the three that everything else in the course sits on: Git, GitHub, and a pinned environment. By the end of class you will have cloned a repository, built its environment, connected to WRDS, and pulled your first data.

Announcements#

  • Apply for your WRDS account today. Approval takes several days and HW 1 cannot run without it. The registration link and the UChicago contact are in Getting Set Up.

  • Complete the GitHub username survey on Canvas today. Your private copy of HW 1 is created from your answer, so you have no repository to work in until it is in. GitHub then emails you an invitation to the hw-finm-32800 organization. Accept it within seven days, after which it expires.

  • HW 0 is ungraded and due to nobody, but do it now. It sets up your machine and walks the full cycle every later assignment repeats: clone, install, run, edit, test, push. HW 1 assumes all of it works.

  • HW 1 launches today and is due Tuesday, October 20, at the start of the week 4 session. Aim to be done by October 13, when HW 2 launches. The third week is slack, not the plan.

  • Clone the in-class examples repo: finm-32800/inclass_examples. It holds the small, self-contained demos we draw on all quarter (environments, env vars, PyDoit, SQL, LaTeX, Polars, Sphinx). We use software_environments/ and env_vars/ tonight.

  • Watch the course website repository so you get discussion-board posts: finm-32800/finm-32800.github.io. Ask questions on the discussion board rather than by email.

  • Start thinking about a final-project group. Projects are done in groups of four. The project list and the preference survey go out in week 2.

Objectives#

Agenda#

  1. Introduction. Who I am, and the syllabus. Walk the course map: who the course is for, the postings behind its skills, and the nine papers.

  2. What we are building all quarter. What is this course about?, Reproducible Analytical Pipelines, and the reproducibility case study. Then the final project in outline, so you know what you are working toward.

  3. Git and GitHub, by doing. Clone HW 0, make a change, commit, push. This is also how every assignment is submitted. Point at the three GitHub Skills tutorials that are HW 1 Part A: introduction to GitHub, communicate using Markdown, and introduction to Git.

  4. Virtual environments. Virtual Environments, worked through software_environments/ in the in-class repo, which builds the same small app four ways: conda, conda + pip, uv, and pixi. Create the finm environment now; every repo this quarter installs into it. Why we care: you will be handed a series of repositories, each with pinned dependencies, and the pinning is the only reason my results and yours agree.

  5. First contact with WRDS. WRDS and web queries to explore CRSP by hand, so the automated pull is not a black box. Then the WRDS Python package notebook to automate the same query, and Env Files plus env_vars/ in the in-class repo for where the credentials live. Creating a .pgpass file so the pulls authenticate without prompting is covered in that notebook, and HW 1 needs it.

  6. The CAPM, and what the market portfolio is in practice. The theory says market beta is the only priced risk. The practical object is a value-weighted index of everything, which is what CRSP publishes and what you are about to rebuild. This is the framing for HW 1’s first half; the alphas the CAPM leaves behind are next week’s problem. For how the CAPM follows from the HW 0 tangency portfolio, see From Mean-Variance to the CAPM.

  7. Launch HW 1. Clone it, build the environment, put credentials in .env, run doit, run pytest, watch it fail, and start filling in calc_CRSP_indices.py together.

Homework#

HW 1 launches today and is due Tuesday, October 20, though you should aim to finish it by October 13, when HW 2 launches. It is one assignment covering two papers. This week’s half rebuilds the CRSP value-weighted and equal-weighted market indices and reconstructs the S&P 500 from its constituents:

Next week’s half merges CRSP with Compustat and replicates Fama and French (1993). You do not need to wait for it to start Parts A to C.

The way to work is the same in every assignment: run doit so the data is pulled, then run pytest, read the failing test, and write the code that passes it. Do not edit the test files.

Looking ahead to Week 2#

Once you have a pull you trust, the next question is how to make a dozen of them run in the right order with one command. That is the PyDoit task runner, and the case study is the Fama-French 1993 replication that completes HW 1. Week 2 is also when the final-project list and the group-preference survey go out.