Week 1: Git, GitHub, and Virtual Environments#
- What Is This Course About? Why Data Pipelines?
- What are Reproducible Analytical Pipelines?
- Case Study: Is There A Reproducibility Crisis In Finance?
- Virtual Environments
- Introduction to WRDS
- Example: Connecting to the WRDS Platform With Python
- Env Files, Secrets, and the Separations of Settings from Code
- From Mean-Variance to the CAPM
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/andenv_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#
Know what this course is and where it fits: What is this course about? and the course map, which shows the job postings behind the skills and the schedule of papers.
Be able to say what a reproducible analytical pipeline is and why it is the organizing idea of the course: Reproducible Analytical Pipelines.
Understand the stakes: Is There a Reproducibility Crisis in Finance?
Use Git and GitHub for the course’s workflow: clone, branch, commit, push, and read a pull request.
Create and pin a virtual environment, and explain why an analysis that runs on your laptop and nowhere else is not a result.
Connect to WRDS and pull CRSP data: Introduction to WRDS and WRDS Web Queries, then automate it with the WRDS Python package.
Keep credentials out of Git: Env Files.
State what the CAPM claims and what the market portfolio is in practice.
Agenda#
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.
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.
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.
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, andpixi. Create thefinmenvironment 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.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.pgpassfile so the pulls authenticate without prompting is covered in that notebook, and HW 1 needs it.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.
Launch HW 1. Clone it, build the environment, put credentials in
.env, rundoit, runpytest, watch it fail, and start filling incalc_CRSP_indices.pytogether.
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.