Skip to content

Commit

Permalink
add currency example and update version and relase notes
Browse files Browse the repository at this point in the history
  • Loading branch information
xemwebe committed Sep 18, 2023
1 parent 955cd7b commit 7652601
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
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."
Expand Down
8 changes: 7 additions & 1 deletion ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Release 2.1.0
+ enable to retreive asset metadata
+ enable to fetch capital gains available on Mutual Funds
+ fix: support quote where firstTradeDate equals null
+ fx rate example added

## Release 2.0.1
re-export the time crate

Expand Down Expand Up @@ -52,4 +58,4 @@ in separate files.
**Note**: Yahoo-Error type has changed. `FetchFailed` has now a string as argument instead of the status code passed over by `reqwest` to decouple the interface from `reqwest`. The former error code `InvalidStatusCode` has been renamed to `InvalidJson`, which a more proper name since this error is returned if the response could not be read as JSON.

# Release 1.0.0
The library is working stable with and without blocking feature enabled.
The library is working stable with and without blocking feature enabled.
24 changes: 24 additions & 0 deletions examples/get_fxrates.rs
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);
}

0 comments on commit 7652601

Please sign in to comment.