Member-only story
12 Python Libraries for Free Market Data That Changed How I Work
I’ve been writing about tech for a decade now, and nothing gets me more excited than finding tools that make life easier — especially when they’re free. Back when I started dabbling in market data, I was stuck scraping websites or begging for pricey subscriptions. Then I found these Python libraries, and it was like someone handed me the keys to a financial candy store. Today, I’m sharing 12 of them that I’ve used in real projects — some for fun, some for profit.
1. yfinance
Pulls stock data — historical, intraday, even fundamentals — from Yahoo Finance. Forex and crypto too.
It’s my lazy-day go-to when I just need data fast.
A couple of years back, I was curious if Apple’s stock dipped every time they launched a new iPhone. With yfinance, I grabbed the numbers in minutes:
import yfinance as yf
apple = yf.Ticker("AAPL")
data = apple.history(period="1mo")
print(data.tail())
Open High Low Close Volume Dividends Stock Splits
Date
2025-03-14 185.23 187.45 184.12 186.78 52345600 0.0 0.0
2025-03-17 186.90 188.23 185.67 187.45 45678900 0.0 0.0
2025-03-18 187.56 189.01 186.34 188.67 48912300 0.0 0.0
2025-03-19 188.89 190.23 187.45 189.12 51234500 0.0 0.0
2025-03-20 189.34 191.56 188.01 190.45 47890100 0.0 0.0
I ran this during the last iPhone hype and spotted a tiny dip — nothing wild, but it scratched my itch.
2. pandas-datareader
Fetches data into pandas from Yahoo, FRED, and more. It split off from pandas, which I still find oddly satisfying.
Perfect when I’m chasing economic trends.
Once, I bet a friend Tesla’s stock tracked gas prices. I used this to pull both:
import yfinance as yf
import datetime
start = datetime.datetime(2022, 1, 1)
end = datetime.datetime(2022, 12, 31)
tesla =…