Stock Tracking¶
FinanceLib provides real-time stock data from Yahoo Finance with special support for BIST (Borsa Istanbul), NASDAQ, and NYSE markets.
Searching Stocks¶
from financelib import Stock
# Search by symbol
result = Stock.search_stock("THYAO")
# Search by company name
result = Stock.search_stock("Garanti BBVA")
Real-Time Price Display¶
# Colored terminal output with price change indicators
Stock.get_live_stock_state("THYAO.IS")
# Output:
# THYAO.IS - 14:30:25
# Price: 172.45 TRY
# Change: ▲ 2.45 (1.44%)
# Volume: 24,532,100
Historical Data¶
stock = Stock("THYAO.IS")
df = stock.get_historical_data(period="6mo", interval="1d")
# Returns a pandas DataFrame with Open, High, Low, Close, Volume
Supported periods: 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, max
Supported intervals: 1m, 5m, 15m, 1h, 1d, 1wk, 1mo
Common BIST Stocks¶
# Built-in dictionary of major Turkish stocks
for symbol, name in Stock.COMMON_STOCKS.items():
print(f"{symbol}: {name}")
Includes: THYAO, GARAN, ASELS, SASA, KCHOL, AKBNK, EREGL, BIMAS, TUPRS, YKBNK, PGSUS, TAVHL, SAHOL, TOASO, FROTO.