# rustyfinance
`rustyfinance` is a Rust implementation inspired by and transformed from the Python project [`ranaroussi/yfinance`](https://github.com/ranaroussi/yfinance.git).
## Origin
- Source project: https://github.com/ranaroussi/yfinance.git
- This repository ports core Yahoo Finance data access ideas/APIs to Rust.
- The Python source snapshot is kept under `python-yfinance/` for migration reference.
## Install
```bash
cargo add rustyfinance
```
## Usage
### Get historical price data
```rust
use rustyfinance::ticker::HistoryParams;
use rustyfinance::Ticker;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let ticker = Ticker::new("AAPL");
let bars = ticker.history(HistoryParams::default())?;
println!("bars: {}", bars.len());
Ok(())
}
```
### Search symbols/news
```rust
use rustyfinance::Search;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut search = Search::new("apple");
search.fetch()?;
println!("quotes: {}", search.quotes().len());
println!("news: {}", search.news().len());
Ok(())
}
```
### Batch download
```rust
use rustyfinance::ticker::HistoryParams;
use rustyfinance::download;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let out = download(&["AAPL", "MSFT"], HistoryParams::default(), true)?;
println!("symbols: {}", out.len());
Ok(())
}
```
## Notes
- Yahoo Finance endpoints are unofficial and can change.
- Some behavior may differ from Python `yfinance` while migration is ongoing.