Getting Started - PM's Jupyter Notebook

Published in Beginner's Series
October 01, 2023
Getting Started - PM's Jupyter Notebook

Welcome to The Portfolio Manager’s Guide to Python, your comprehensive resource for mastering Python in the financial world. Our goal is to accelerate your Python journey, enabling you to leverage its power in your portfolio management strategies. Our subscription offers a triad of specialized services:

  • The PM Guide: This isn’t just another Python newsletter. Each issue is a deep dive into real-world financial scenarios, teaching Python concepts through practical applications. Crafted by Portfolio Manager Jason Chen to resonate with finance professionals.
  • JupyterLab Cloud Environment: Say goodbye to tedious setup processes. Your subscription gives you access to a fully-configured JupyterLab instance in the cloud, complete with 10GB of storage and pre-installed extensions for code formatting, Language Server Protocol, and data visualization.
  • AzonicLab Finance Python Distribution: Purpose-built for the finance sector, this Python distribution comes with all the bells and whistles. It is continuously updated and compatibility-tested by Azonic Lab, letting you focus on innovation rather than software maintenance.

Why JupyterLab?

JupyterLab isn’t just an IDE; it’s a workspace that brings your financial models to life. Built atop the IPython kernel, JupyterLab supports multiple languages including R, Julia, and Haskell, via additional kernels. The platform seamlessly blends code execution with data visualization and documentation, making it an indispensable tool for data-driven portfolio management.

Exclusive to PM’s Guide Subscribers

As a PM’s Guide subscriber, every lesson and code snippet is available directly within JupyterLab. No more passive learning from static web pages. Feel free to experiment with the code, modify it, and integrate it into your trading algorithms. To begin, simply navigate to any article on PM’s Guide and click “Open in JupyterLab” to load the lesson in your cloud-based JupyterLab environment.

Quick Start with JupyterLab

To get you up and running, here are some simple steps:

  1. Log in to your JupyterLab environment at Azonic Lab.
  2. On the JupyterLab dashboard, click the ”+” symbol and select the “Python 3” icon under the “Notebook” section to create a new Python notebook.
  3. A new notebook will open containing a single executable cell. Enter your code here and execute it by clicking the “Run” button or pressing Shift+Enter.

Now you’re all set to commence your Python journey in the realm of portfolio management!

1. Get Microsoft’s Historical Prices in a DataFrame

import datetime import yfinance as yf msft = yf.Ticker("MSFT") df_prices = msft.history(start=datetime.date.today() - datetime.timedelta(days = 365), end=datetime.date.today()) df_prices.head() # Show the first five rows of the DataFrame 

01-Getting-Started-img1

2. Plot a Candlestick Chart using Plotly

from datetime import datetime import pandas as pd import plotly.graph_objects as go df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv') fig = go.Figure(data=[go.Candlestick( x=df['Date'], open=df['AAPL.Open'], high=df['AAPL.High'], low=df['AAPL.Low'], close=df['AAPL.Close'])]) fig.update_layout(title='AAPL Candlestick Chart', width=300) fig.show() 

01-Getting-Started-img2

AzonicLab Finance Distribution: Your Personalized Finance Toolkit

Our JupyterLab environment is not just another coding interface—it’s a window into the real-world tools and techniques employed by Portfolio Manager Jason Chen. Think of it as a virtual apprenticeship in finance, where you gain access not just to a rich set of libraries, but also to Jason’s proprietary code snippets and tools that are used for daily portfolio management tasks.

The Power of Real-world Tools

What sets our JupyterLab environment apart is its focus on practical, industry-relevant tools. Every line of code, every pre-installed package, and even the structure of the environment is optimized for the specific needs of financial portfolio management.

Quick Code Snippets: ADX Trend Strength Indicator

For example, you can quickly generate the ADX Trend Strength Indicator, a commonly used technical analysis indicator, using pre-loaded code snippets. The ADX indicator is crucial for understanding market conditions and can be pivotal in your trading decisions.

import pandas_ta df_signals = df_prices.ta.adx() df_signals.tail() # show the last five rows 

01-Getting-Started-img3

This content is for subscribers only. Please sign in to read more.

Sign In