Skip to content

Commit

Permalink
add blocking version
Browse files Browse the repository at this point in the history
  • Loading branch information
7jrxt42BxFZo4iAnN4CX authored and xemwebe committed Jan 16, 2025
1 parent a3a74dd commit 21350d9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/blocking_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,27 @@ impl YahooConnector {
YResponse::from_json(self.send_request(&url)?)
}

/// Retrieve the quote history for the given ticker form date start to end (inclusive) and optionally before and after regular trading hours, if available; specifying the interval of the ticker.
pub fn get_quote_history_interval_prepost(
&self,
ticker: &str,
start: OffsetDateTime,
end: OffsetDateTime,
interval: &str,
prepost: bool,
) -> Result<YResponse, YahooError> {
let url = format!(
YCHART_PERIOD_QUERY_PRE_POST!(),
url = self.url,
symbol = ticker,
start = start.unix_timestamp(),
end = end.unix_timestamp(),
interval = interval,
prepost = prepost,
);
YResponse::from_json(self.send_request(&url)?)
}

/// Retrieve the quote history for the given ticker for a given period and ticker interval and optionally before and after regular trading hours
pub fn get_quote_period_interval(
&self,
Expand Down

0 comments on commit 21350d9

Please sign in to comment.