1. Setting up your environment: Python and its tools
Level 2: Python from Scratch for Finance
Python is, today, the default language of quantitative finance. It is not the fastest, but it has the largest ecosystem of libraries for data, statistics and machine learning, and it is the one almost any quantitative team expects you to know.
It is a high-level, interpreted, dynamically typed language: you do not have to declare a variable's type before using it, nor compile the code before running it — you write a line and you run it. That makes it far quicker to learn than languages such as C++ or Java, at the cost of being slower at runtime. For almost everything you will do in this course, that speed difference does not matter: Python's scientific libraries (NumPy, pandas) are written in C underneath, so vectorized code runs almost as fast as C even though you write it in Python.
To set up your working environment you need three things: Python itself, a package manager to install libraries, and somewhere to write and run the code.
The simplest route in 2026 is to install Python 3 directly from python.org (avoid any tutorial that still talks about Python 2 — it has been discontinued since 2020 and should no longer be used for anything new), and to use pip, the package manager that comes bundled with it, to install the libraries you are going to need:
pip install numpy pandas matplotlib yfinance jupyterThat gives you access to NumPy (numerical computation), pandas (handling data tables), matplotlib (charts), yfinance (to download real prices for free) and Jupyter (the interactive notebook where you will write most of this course's code).
A Jupyter Notebook is a document where you can mix Python code, its output and explanatory text on the same screen, split into cells that you run one at a time. It is the standard working format of any quantitative analyst: it lets you test an idea, see the result instantly, and document why you did it, all in one place. To open one, from the terminal:
jupyter notebookThis opens a tab in your browser from which you can create new notebooks. Alternatively, editors such as VS Code have native support for .ipynb files, so you can work with notebooks without leaving your usual editor.
If you would rather not manage any of this yourself, the Anaconda distribution installs Python together with the most common scientific libraries already set up, at the cost of taking up considerably more disk space. For this course, either path — pip by hand or Anaconda — leaves you in exactly the same place.
One last practical recommendation: use a virtual environment per project (python -m venv environment_name) instead of installing everything globally on your system. Over time you will accumulate projects that need different versions of the same library, and a virtual environment stops them from stepping on each other.