// learn · Data & tools
Yahoo Finance + Python (yfinance)
You can pull real market data with a few lines of Python. The yfinance library wraps Yahoo Finance, no API key, ideal for learning and simple tools.
Install
One command: pip install yfinance pandas. That's it, no account, no key.
The three things you'll use
- Price history,
yf.Ticker("AAPL").history(period="6mo")returns a pandas dataframe of OHLCV you can chart or feed into indicators. - Fundamentals,
.infogives P/E, margins, growth, debt (the same fields our stock guide reads). It's the slowest call, fetch it sparingly. - Batch,
yf.download(["AAPL","MSFT"], period="1y")pulls many tickers at once.
The one caveat: rate limits. Yahoo throttles heavy use. Don't loop
.info over hundreds of tickers on every run, cache slow, rarely-changing data (fundamentals update quarterly) and only refetch prices. It's exactly what Peaky Radar does under the hood.Where to go next
Compute the indicators we use on the price dataframe, and you've got the core of a scanner. From there, the bot design guide shows how to turn signals into safe execution.
Educational market information, not financial advice. Markets carry risk of loss, do your own research.