Informula

Informula

Share this post

Informula
Informula
How to Build stock comparison line chart with dynamic date range via Python (Plotly & Pandas)?

How to Build stock comparison line chart with dynamic date range via Python (Plotly & Pandas)?

Informula's avatar
Informula
Sep 07, 2023
∙ Paid

Share this post

Informula
Informula
How to Build stock comparison line chart with dynamic date range via Python (Plotly & Pandas)?
Share

You might be familiar with Google's interactive stock comparison chart if you are following the stock market. This is a perfect tool to compare the performance and trend across multiple targets. Sometimes you can also leverage this to discover leading/ lagging indicators and relationships so that you can make investment decisions accordingly. However, the users were only provided with very limited time frames ranging from 1D to 5Y or Max so it is really hard to focus on the specific time frame in the past. Take Micron vs Lam Research as an example, it is difficult for users to draw a correlation during 2000 to 2010.

We are going to discuss how to customize the chart by using Plotly, Pandas and yfinance in Google Colab Notebook.

Step 0: Install all required packages.

pip install plotly
pip install pandas
pip install yfinance

Keep reading with a 7-day free trial

Subscribe to Informula to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Informula
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share