-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add currency example and update version and relase notes
- Loading branch information
Showing
3 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "yahoo_finance_api" | ||
version = "2.0.1" | ||
version = "2.1.0" | ||
authors = ["Mark Beinker <[email protected]>", "Claus Matzinger <[email protected]>"] | ||
edition = "2018" | ||
description = "A rust adapter for the yahoo! finance API to fetch histories of market data quotes." | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#[cfg(not(feature = "blocking"))] | ||
use tokio_test; | ||
use yahoo_finance_api as yahoo; | ||
|
||
#[cfg(not(feature = "blocking"))] | ||
fn get_history() -> Result<yahoo::YResponse, yahoo::YahooError> { | ||
let provider = yahoo::YahooConnector::new(); | ||
let start = time::OffsetDateTime::UNIX_EPOCH; | ||
let end= time::OffsetDateTime::now_utc(); | ||
tokio_test::block_on(provider.get_quote_history("EUR=x", start, end)) | ||
} | ||
|
||
#[cfg(feature = "blocking")] | ||
fn get_history() -> Result<yahoo::YResponse, yahoo::YahooError> { | ||
let provider = yahoo::YahooConnector::new(); | ||
let start = time::OffsetDateTime::UNIX_EPOCH; | ||
let end= time::OffsetDateTime::now_utc(); | ||
provider.get_quote_history("EUR=x", start, end) | ||
} | ||
|
||
fn main() { | ||
let quote_history = get_history().unwrap(); | ||
println!("Quote history of USD/EUR FX rate:\n{:#?}", quote_history); | ||
} |