yahoo! finance API
This project provides a set of functions to receive data from the the yahoo! finance website via their API. This project is licensed under Apache 2.0 or MIT license (see files LICENSE-Apache2.0 and LICENSE-MIT).
Since version 0.3 and the upgrade to reqwest 0.10, all requests to the yahoo API return futures, using async features.
Therefore, the functions need to be called from within another async function with .await or via functions like block_on. The examples are based on the tokio runtime applying the tokio-test crate.
Use the blocking feature to get the previous behavior back: i.e. yahoo_finance_api = {"version": "1.0", features = ["blocking"]}.
Get the latest available quote:
use yahoo_finance_api as yahoo;
use ;
use *;
use tokio_test;
//! Get history of quotes for given time period:
use yahoo_finance_api as yahoo;
use ;
use ;
use tokio_test;
Another method to retrieve a range of quotes is by requesting the quotes for a given period and lookup frequency. Here is an example retrieving the daily quotes for the last month:
use yahoo_finance_api as yahoo;
use ;
use ;
use tokio_test;