yfinance-pl documentation#

Download Market Data with Polars DataFrames#

yfinance-pl is a Python wrapper for yfinance-rs using PyO3 and Polars.

Get stock market data with a yfinance-compatible API, but with Polars DataFrames instead of pandas.

Features#

  • yfinance-compatible API - Familiar interface for yfinance users

  • Polars DataFrames - Returns pl.DataFrame instead of pd.DataFrame

  • Rust backend - Fast data fetching powered by yfinance-rs

  • Type-safe API - IDE autocompletion for period, interval, and return types

Install#

$ pip install yfinance-pl

Quick Start#

import yfinance_pl as yf

ticker = yf.Ticker("AAPL")

# Get price history
history = ticker.history(period="1mo")
print(history)

# Get company info
info = ticker.info

# Get financial statements
income = ticker.income_stmt
balance = ticker.balance_sheet

# Get analyst recommendations
recommendations = ticker.recommendations

# Get options data (US stocks only)
if ticker.options:
    chain = ticker.option_chain(ticker.options[0])
    print(chain.calls)
    print(chain.puts)

Differences from yfinance#

Aspect

yfinance

yfinance-pl

DataFrame type

pd.DataFrame

pl.DataFrame

Backend

Python

Rust (yfinance-rs)

Series type

pd.Series

pl.DataFrame

License#

MIT License