yfinance-rs
An ergonomic, async-first Rust client for the unofficial Yahoo Finance API.
This crate provides a simple and efficient way to fetch financial data from Yahoo Finance.
It is designed to feel familiar to users of the popular Python yfinance library, but
leverages Rust's powerful type system and async capabilities for performance and safety.
Features
- Historical Data: Fetch daily, weekly, or monthly OHLCV data.
- Multi-Symbol Downloads: Concurrently download historical data for many symbols at once.
- Real-time Streaming: Get live quote updates using WebSockets (with an HTTP polling fallback).
- Company Profiles: Retrieve detailed information about companies, ETFs, and funds.
- Options Chains: Fetch expiration dates and full option chains (calls and puts).
- Financials: Access income statements, balance sheets, and cash flow statements (annual & quarterly).
- Analyst Ratings: Get price targets, recommendations, and upgrade/downgrade history.
- Holder Information: Get major, institutional, and mutual fund holder data.
- ESG Scores: Fetch detailed Environmental, Social, and Governance ratings.
- News: Retrieve the latest articles and press releases for a ticker.
- Search: Find tickers by name or keyword.
- Async API: Built on
tokioandreqwestfor non-blocking I/O. - High-Level
TickerInterface: A convenient, yfinance-like struct for accessing all data for a single symbol. - Builder Pattern: Fluent builders for constructing complex queries.
- Configurable Retries: Automatic retries with exponential backoff for transient network errors.
Quick Start
To get started, add yfinance-rs to your Cargo.toml:
[]
= "0.1.0"
= { = "1", = ["full"] }
Then, create a YfClient and use a Ticker to fetch data.
use ;
async
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue.