Python for Finance

February 22, 2018

Download and Install Jupyter Notebooks

1) Go to https://www.anaconda.com/download/

Anaconda produces several programs that are used with the Python language. Downloading Anaconda installs Python on your computer.

2) Download Python 3.7. Download the appropriate 32 or 64 bit package.

For more information:

Windows Support

Mac Support

3) Run the installer and follow the directions. It should be straightforward, but in case there are issues: click here for the official installation docs.

Opening Jupyter Notebooks

1) Open the Anaconda Navigator. It will be installed on your computer from the installation.

2) There will be several programs you can choose from. Under Jupyter, you may need to click "Install". Otherwise you can click "Launch". This will open the program.

Open the Python Basics file:

1) Once Jupyter is opened, click the upload button.

2) Select the Python Basics file, which can be downloaded by clicking here. (You might need to right click and hit "Save Link As...")

3) Click the blue upload button next to the file.

4) Click the file which will be in the list.

Executing commands in the Jupyter Notebook

1) Each cell is an executable as Python code.

2) To run the code, highlight the cell and press SHIFT+ENTER.

3) You can modify the code in the cells as you would normal text.

4) Press the [+] button at the top of the document to add more cells.


An Introduction to Python

Get the Jupyter Notebook here

Introduction to Numpy (Matrix Algebra) in Python

Get the Jupyter Notebook here

Functions in Python

Get the Jupyter Notebook here

Optimization in Python

Get the Jupyter Notebook here

Download Data and Estimate Beta

Get the .py script here