Reporting annual cumulative returns on multiple assets in Python

Learn how to process multiple financial assets and include them in a report highlighting each asset's annual performance.

When comparing the performance of financial assets like Bitcoin, ETFs, and stocks, which was the most profitable asset since 2010?

Annual performance comparison of various financial assets since 2010
F1. Annual performance of financial assets since 2010

In this tutorial, we explain how to download, process, and report on the performance of financial assets using Python.

The report is inspired by Charlie Bilello’s analyses.


We define the list of tickers for the assets to analyze.

tickers = ['BTC-USD', 'QQQ', 'IWF', 'SPY', ...]

We download daily historical price movements using the yfinance library, which downloads data from Yahoo Finance.

import yfinance as yf
df =
Daily historical price chart for Bitcoin, ETFs, and stocks
F2. Daily historical prices of financial assets


  1. How to download historical price data for multiple financial assets?
  2. How to calculate the annual cumulative return of each asset?
  3. Why is it necessary to group data for cumulative calculations?
  4. How to select the last day of cumulative return in each year?
  5. How to identify the maximum and minimum return values in each year?
  6. How to calculate the percentage of positive returns for each asset?

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to datons.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.