#!/usr/bin/env python # coding: utf-8 # # Market Performance Visualization # --- # In[1]: # # Install libraries - uncomment if running on a new environment (e.g., Colab) # !pip install --upgrade capon themes # In[2]: import capon import themes from capon.datasets import load_stock_indexes themes.register(enable="capon") # ## The Data # In[3]: indices_tickers = load_stock_indexes().query("country_code=='US'") indices_tickers # In[4]: indices = capon.stocks( indices_tickers["symbol"], start="2019-10-01", end="2025-01-01", interval="1d", n_jobs=-1, ) indices # ## Plot # In[5]: capon.plot(indices) # In[6]: capon.plot(indices, normalize="2020-01-01", title="Market Indices Change") # (Under the hood, [`capon`](https://github.com/gialdetti/capon) used the [`altair`](https://altair-viz.github.io) visualization library here)