stocks_api

CI

Retrieve finance data using YahooFinanceAPI

Examples

Get a single quote

```rust use stocks_api::YahooFinanceAPI; use tokio::runtime::Runtime;

fn main() { let rt = Runtime::new().unwrap(); let api = YahooFinanceAPI::new(); let quote = rt.blockon(api.getquote("AAPL")).unwrap(); print!("Current AAPL price: {}", quote.regularmarketprice) } ```

Search for symbols

```rust use stocks_api::YahooFinanceAPI; use tokio::runtime::Runtime;

fn main() { let rt = Runtime::new().unwrap(); let api = YahooFinanceAPI::new(); let symbols = rt.blockon(api.searchsymbols("Microsoft")).unwrap(); println!("Search results for: Microsoft"); println!( "{}", symbols .into_iter() .map(|symbol| symbol.symbol) .collect::>() .join(",") ); } ```