How to start using Github Repositories

How to start using Github Repositories

In this blog post, we'll explore GitHub and Jupyter notebook, demonstrating how you can easily clone a repository and start practicing with it in your own environment. This article is specifically written for finance professionals new to coding.

In the world of software, cloning is a practical and essential process that fosters efficient coding practices and collaboration. Open source libraries for example allow you to import code that has already been built into your projects, and build a specific algorithm much faster than you would be able to if you were starting completely from scratch. 

Table of Contents

 

Accessing Python Code & Financial Github Repositories

For novice finance professionals venturing into the world of financial coding, one fundamental skill is learning how to effectively retrieve Python code from GitHub repositories. GitHub is a widely-used platform that hosts a plethora of open-source projects and code samples, including those related to finance. By accessing these repositories, you gain access to real-world financial examples, best practices, and collaborative coding projects that can significantly contribute to your professional finance career..

 

 

To get started:

  1. simply navigate to the desired GitHub repository,
  2. click on the "Code" button,
  3. select the "Download ZIP" option.

Once downloaded, you can extract the contents and explore the code. If you are working with a  .py file, you can use your preferred code editor or notepad to modify the existing code.

If you are working with an .ipynb file (like in the example below), that’s the format for Jupyter Notebook. You can follow the next section below to open Ipynb files with Jupyter Notebook and start executing as well as editing financial Python scripts. This process is an essential step in acquiring practical coding experience and enhancing your financial programming skills.

 

Opening ipynb files with Jupyter Notebook

Using Jupyter Notebooks is important for finance professionals who are starting to code. Jupyter provides a helpful way to write and run code, especially for financial tasks. It lets you break down your code into steps and see results right away. This is very handy for understanding and visualizing data, which is essential in finance.

Jupyter Notebooks provide an interactive and user-friendly environment that seamlessly integrates code, visualizations, and explanatory text. To start Jupyter:

  • First make sure the Jupyter package is installed.

If you are using Mac, Windows or even Linux; you can install Jupyter using the Anaconda Installer. Anaconda is a big package that automatically installs many packages you may need when coding with Python including Jupyter Notebook.

Alternatively on Mac, if you’d like to only install Jupyter, you can use HomeBrew package manager. Another alternative method which can be used in all operating systems is to use pip. You can simple use the pip package manager and run the following command to install Jupyter Notebook. There are various package managers out there that can be used to get the same job done but Anaconda will eventually be the most straightforward approach to install a bundle of Python-related development tools if you are a novice programmer.

 

pip install jupyter
  • Launch Jupyter Notebook from your terminal (or through clicking its icon).

  • Jupyter will start in a new tab in your browser. 
  • Click Upload and navigate to the directory where you downloaded your ipynb file in the previous step.

 

 

  • Inside the notebook, you can input and execute Python code cells individually, making it easier to understand each step and its outcomes.

 

Running code in Jupyter

Interactive cell compatibility aspect of Jupyter Notebook proves invaluable for financial tasks as you can visualize data, create charts, and annotate your code with explanations. Combining the power of Python with the versatility of Jupyter Notebooks empowers you to not only comprehend financial coding concepts but also communicate your analyses effectively.    

Once you have the code opened in Jupyter, don’t be afraid to edit it and experiment with it. This attitude is crucial for a successful learning journey. If things get out of control, you can always download a fresh copy and start from the beginning.

Now let’s take a look at the code and make some additions as we desire.

When I open the Black_Schole_model.ipynb file, (You can find out more about the Black and Scholes Python script we created in another financial Python tutorial.) I can see the content of the Python script which is option price calculation with Nvidia shares as underlying asset and expiry date of 20-10-2023.

Let’s say I’m interested in similar options for my hedge fund’s investment committee meeting this afternoon.

Here, I simply copied and pasted the last Python code cell and edited it slightly to get the option prices for a different underlying asset (AMD in the new example).

And we get new output from OpenBB with updated AMD option prices!

 

 

When I was editing the code I chose AMD because using OpenBB terminal AMD was a close relationship stock to Nvidia based on the clustering results with TSNE algorithm. You can see more about this technical approach in the “How to Use OpenBB Financial Terminal” post.

 

 

Summary

Getting started with Python is incredibly easy with vast code repositories available for you on GitHub and beginner friendly environments like Jupyter notebook that allow you to start running code immediately. It’s one of the easiest languages to learn and the most popular language in the world of finance. With Excel’s recent announcement integrating Python into workbooks, and JP Morgan recently stating that all of their incoming associates and analysts would be trained in Python, jumping in and getting your hands dirty is a great way to stand out in your career and unlock the strongest opportunities. 

 

Written by Umut Sagir, MSc Finance

Back to blog