Financial Modelling with Python
Python, a versatile and powerful programming language, has made significant inroads into the financial industry in recent years. Its simplicity, readability, and extensive libraries have made it a preferred tool among financial analysts and quantitative researchers. Personally, I have dedicated thousands of hours to using Python for both individual projects and institutional applications.
Through this experience, I’ve developed a solid understanding of designing financially sophisticated models and algorithms, focusing on creating structures that are robust, effective, and easily maintainable. Maintaining models, ensuring they handle new data effectively, and adapting them to changing situations are areas where I’ve made mistakes and learned valuable lessons. These pages aim to share my knowledge and experience, helping you learn from my journey and potentially avoid similar pitfalls.
This financial modeling guide provides information on getting started with Python, setting up a project, and structuring, building, and testing a model. Here, I share practices that have proven effective, drawing from my experiences across various roles. You can navigate the content using the sidebar or the cards below.
Getting Started with Python
New to Python? Start here. Learn the basics, set up Jupyter Notebooks, and work toward your first project with practical tips on coding tools, Git, and building financial models from scratch.
Setting up your Project
Master the essentials of project setup: directory structure, dependency management with uv, Git workflows, linters, and the configuration files that keep your model maintainable for years.
Structure your Model
Apply the Model-View-Controller (MVC) pattern to financial models. Understand the data, visualization, and control layers and why separating concerns is critical for maintainable code.
Build your Model
Write clean, consistent, professional-grade Python. Covers PEP 8 styling, naming conventions, docstrings, type annotations, and the coding patterns that make models easy to read and collaborate on.
Test your Model
Use Pytest to build a robust test suite that mirrors your model structure. Record expected outputs to CSV and automatically detect regressions whenever the underlying calculations change.
Have suggestions? This entire website is open-source, so feel free to contribute here!