Before you start · The four weeks · Course map · The project · What it uses · Series front page
Four weeks from your first line of code to a month-end portfolio review you run yourself.
On day one you store a bond: its ticker, its coupon, its maturity. Four weeks later a month-end holdings extract arrives that does not tie to its cover note. You find what is wrong with it, fix it, state every decision, and write up what the book holds and how it differs from its benchmark. The project gives you the questions. The code and the conclusion are yours.
That is the course: from storing one bond to reviewing a whole book on your own.
Every skill is taught on the job it does on a desk. Loops total a portfolio. Joins attach issuers and ratings to positions, with a check on the row count and the face amount around each one. Charts show where the spread and the duration sit. Your first time series is Treasury yields since 2015. Your first text analysis is on FOMC statements.
Two habits run through all of it.
| Habit | What it means |
|---|---|
| The Excel bridge | Every new idea sits beside the formula you would write today, so you are translating something you know. |
| Check before you trust | You work out what the answer should be before you rely on code, yours or an AI assistant's. Each day ends with code that runs cleanly and is wrong, and you find the bug. |
You need no coding experience. You do need to know what a coupon, a spread, and a duration are. This is the first course in Python for Fixed Income.
Status: 21 of 21 notebooks are ready, and so is the course project.
This course is educational content created in a personal capacity. Nothing here is investment advice or a recommendation to buy or sell any security. All portfolio data is synthetic.
Setup is on the series front page. Pick one of two ways to run the notebooks.
| Way | What to do |
|---|---|
| Google Colab, nothing to install | Open any notebook in the course map and click the Open in Colab badge at the top. |
| Your own Windows machine | Follow the three steps on the front page. The install line for this course is below. |
python -m pip install -r course1_python_foundations\requirements.txtEach day's folder holds three files with the same name: the notebook, a short overview PDF to read first, and a solutions notebook. How a day works explains the pattern.
| Week | Theme | By the end you can |
|---|---|---|
| 1 | Python foundations | Write variables, loops, functions, and a class, read an error, and turn an email of holdings into a table |
| 2 | NumPy and pandas | Hold a portfolio in a table, filter and group it, and join it to issuer and rating tables with checks around each join |
| 3 | Visualization and exploratory data analysis | Draw finished charts, test a new file before trusting it, and work with a time series |
| 4 | Consumer credit, text, and the project | Analyze a yes or no outcome, turn text into numbers, keep your work in a file you can run again, and report on a month-end extract on your own |
| Day | Notebook | You learn | Status |
|---|---|---|---|
| 00 | Setup: Python, VS Code, and Colab | Step by step, with a screenshot of each step: install Python and VS Code, get the course, make the course environment, and use Colab | Ready |
| 0 | Start Here: Python, Notebooks, and Libraries | Ground zero, for someone who has never opened a notebook: what Python is, notebooks and their code and markdown cells, .py files, and libraries |
Ready |
| 1 | Introduction to Python | Variables, f-strings, lists, dictionaries, conditions, loops, and functions, on four bonds | Ready |
| 2 | Files and Folders | Finding, creating, writing, and reading the desk's holdings file | Ready |
| 3 | Debugging | Reading an error, the common error types, bugs that raise no error, and checks that stop the run with assert |
Ready |
| 4 | Classes: A Bond Object | A bond that carries its own data and calculations | Ready |
| 5 | Case Study: Organizing a Small Portfolio | One job from start to finish: an email of holdings becomes a table | Ready |
| Day | Notebook | You learn | Status |
|---|---|---|---|
| 1 | NumPy | Arrays, arithmetic on a whole portfolio at once, and pricing a bond from its cash flows | Ready |
| 2 | pandas: Series and DataFrames | Tables with names, selecting, filtering, and sorting 200 holdings | Ready |
| 3 | pandas: Combining and Loading | Joining tables, reading and saving CSV files and Excel workbooks, summaries, and dates | Ready |
| 4 | Case Study: A First Look at the Data | Three linked tables: positions, issuers, and ratings, checked before any join | Ready |
| 5 | Case Study: Joining the Tables | Joining the three tables, checking each join, and answering the desk's questions from the result | Ready |
| Day | Notebook | You learn | Status |
|---|---|---|---|
| 1 | Visualization | Histograms, box plots, bar charts, line plots, scatter plots, pair plots, and heatmaps, on the 200 holdings | Ready |
| 2 | More Visualization | Regression plots, joint plots, violin, strip and swarm plots, interactive and 3D charts with plotly, and customizing a chart | Ready |
| 3 | Exploratory Data Analysis | Sanity checks, missing values, distributions, outliers, and relationships, on a holdings file with problems planted in it | Ready |
| 4 | Case Study: Treasury Yields | A first time series: Treasury par yields by tenor and year, a spread between two tenors, and daily changes | Ready |
| 5 | Case Study: A Trade Blotter | The week's capstone: a month of trades checked, summarized, joined to the holdings, and reported | Ready |
| Day | Notebook | You learn | Status |
|---|---|---|---|
| 1 | Case Study: Consumer Credit | A full analysis of a public credit card default dataset: 30,000 accounts, a yes or no outcome, and rates with their counts | Ready |
| 2 | Analyzing Text | Regular expressions, cleaning, stopwords, stemming, and turning text into numbers, on FOMC statements | Ready |
| 3 | Case Study: Statement Sentiment | Turning the wording of FOMC statements into a score with three word lists, and how far to trust it | Ready |
| 4 | From Notebook to Module | Putting the cleaning and checking steps into a .py file, importing it, and running the same lines on a second file |
Ready |
| 5 | Course Project | A new month-end extract, answered on your own, ending in a written picture of the book. A worked version sits beside it | Ready |
Day 5 of week 4 is yours, and it is more than one sitting: plan on two or three. A new month-end extract arrives with a cover note, and 43 questions take you from the structure of the file to a written picture of the book. Nothing tells you what is wrong with the extract. You test it against the cover note and the desk's rules, fix what is an error, flag what you cannot fix, and keep what is real.
You hand in four things: a cleaning function with checks that stop the run, an Excel workbook with the cleaned book and its summary, a short log of any AI assistant use, and a written conclusion.
| File | What it is |
|---|---|
course1_project.ipynb |
The brief, the questions, and a check cell for every answer that can be checked. A check says correct or not yet, and never shows the answer |
course1_project_overview.pdf |
The brief as slides: the scenario, the files, the rules, and how the checks work |
course1_project_solutions.ipynb |
The worked version, with every decision stated. Open it after you finish |
The conclusion you write describes the data. It never recommends, ranks, or forecasts a bond, an issuer, or a sector.
| Library | Used for | First appears |
|---|---|---|
| NumPy | Arithmetic on whole columns at once | Week 2, Day 1 |
| pandas | Tables: loading, filtering, grouping, joining | Week 2, Day 2 |
| openpyxl | Reading and writing Excel workbooks from pandas | Week 2, Day 3 |
| matplotlib and seaborn | Charts | Week 3, Day 1 |
| plotly | Interactive and 3D charts | Week 3, Day 2 |
| nltk | Stopwords, stemming, and a published sentiment word list | Week 4, Day 2 |
Exact versions are pinned in requirements.txt.
| Data | Kind | Used in |
|---|---|---|
| The desk's portfolio: holdings, benchmark, issuers, ratings, trades, and the project extract | Invented for this course | Weeks 1 to 3, Week 4, Day 4, and the project |
| U.S. Treasury daily par yield curve rates | Real, public | Week 3, Day 4 and Week 4, Day 3 |
| UCI Default of Credit Card Clients | Real, public, CC BY 4.0 | Week 4, Day 1 |
| FOMC post-meeting statements | Real, public | Week 4, Days 2 and 3 |
Sources and terms for every file are in the data page.
Course 2 is Bond Math: three weeks on pricing, yield, accrued interest, duration, convexity, and spread, built by hand and checked against Excel.
Created by Jeff Lenamon