This Python app reads a list of tickers from a YAML config, fetches monthly percentage growth for the last year from Yahoo Finance, builds a dataset, computes the mean monthly growth across all shares, and produces a chart.
- Ensure Python 3.10+ is installed.
- (Optional) Create a virtual environment.
- Install dependencies.
- Run the app.
# From the repo root
python -m venv .venv; .\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
python .\src\app.pyTickers are defined in config.yaml and this file is ignored by Git. Example:
Tickers:
- POMO4
- MELI34
- CURY3
- TIMS3
- RDOR3
- PSSA3
- CPLE3
- BPAC11
- BDOM11
- GGBR4
- BOVB11The app normalizes B3 tickers to Yahoo Finance by appending .SA when no suffix is present.
You can select a provider in config.yaml:
Provider: yfinance # or brapi or twelvedata
TwelveDataApiKey: "YOUR_API_KEY"
BrapiApiKey: "YOUR_BRAPI_TOKEN" # optional, required for full BRAPI accessyfinance: free, no key, but may fail due to provider limits or network.brapi: Brazil-focused; uses raw B3 tickers likePSSA3(no.SAsuffix). Most tickers require authentication.- Without a token, only a small set of public test tickers (e.g.,
PETR4,VALE3,MGLU3,ITUB4) are available. For production use, setBrapiApiKeyand we will sendAuthorization: Bearer <token>. - When no token is provided, the app requests only the last 3 months of historical prices (
range=3mo) to respect free-plan limits and aggregates them to monthly returns. With a token, it requests 1 year (range=1y).
- Without a token, only a small set of public test tickers (e.g.,
twelvedata: reliable with API key; we use thetime_seriesendpoint withinterval=1month. For B3 tickers we tryTICKER:SAorexchange=B3formats.
Optional proxies:
HTTPProxy: "http://user:pass@proxy:port"
HTTPSProxy: "http://user:pass@proxy:port"- Dataset:
output/monthly_growth.csv - Chart:
output/monthly_growth.png
- Data source: Yahoo Finance via
yfinance. - Monthly growth is computed from adjusted close prices using percentage change per month.