A small FastAPI service that exposes commonly used yfinance endpoints (ticker info, history, bulk downloads, financial statements, holders, options, news) as a JSON API.
- FastAPI + automatic Swagger docs at
/docs - CORS enabled (default:
*) for easy dashboard/browser use - Single-ticker and multi-ticker historical data
- Fundamentals (financial statements, holders), options chain, news
- Python 3.10+ recommended
- Dependencies are listed in
requirements.txt
- Install deps:
pip install -r requirements.txt- Start dev server:
uvicorn main:app --reload- Open docs:
- Swagger UI:
http://127.0.0.1:8000/docs - Root:
http://127.0.0.1:8000/
This repo includes render.yaml. Render will:
- install:
pip install -r requirements.txt - start:
gunicorn main:app
If you deploy manually, use:
gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:appRoot
GET /→ welcome message
Ticker data
GET /ticker/{ticker}/infoGET /ticker/{ticker}/history?period=1y&interval=1dGET /ticker/{ticker}/actionsGET /ticker/{ticker}/calendar
Bulk data
GET /download/{tickers}?start=2020-01-01&end=2026-01-01&interval=1dtickersis comma-separated (e.g.AAPL,MSFT,GOOGL)
Fundamentals
GET /ticker/{ticker}/financials?statement_type=all&frequency=annualstatement_type:income | balance_sheet | cashflow | allfrequency:annual | quarterly
GET /ticker/{ticker}/holders?holder_type=allholder_type:institutional | mutualfund | major | all
Analyst / options / news
GET /ticker/{ticker}/recommendationsGET /ticker/{ticker}/optionsGET /ticker/{ticker}/option_chain?date=YYYY-MM-DDGET /ticker/{ticker}/news
Ticker info:
curl "http://127.0.0.1:8000/ticker/AAPL/info"Historical candles:
curl "http://127.0.0.1:8000/ticker/AAPL/history?period=6mo&interval=1d"Bulk download:
curl "http://127.0.0.1:8000/download/AAPL,MSFT?start=2023-01-01&end=2024-01-01&interval=1d"Options chain:
curl "http://127.0.0.1:8000/ticker/AAPL/option_chain?date=2026-03-20"- Data quality/availability depends on Yahoo Finance and
yfinance; some tickers may not return all fields. - The service returns
404when data is unavailable and500on unexpected errors. - CORS is currently wide open (
allow_origins=["*"]). Restrict it for production if needed.
Add a license file if you intend to publish this publicly.