From 21350d9baf75efaa3389fb0d6fc62fcf3ce10eb8 Mon Sep 17 00:00:00 2001 From: 7jrxt42BxFZo4iAnN4CX <1> Date: Thu, 16 Jan 2025 16:14:42 +0300 Subject: [PATCH] add blocking version --- src/blocking_impl.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/blocking_impl.rs b/src/blocking_impl.rs index b384d3a..63bba3f 100644 --- a/src/blocking_impl.rs +++ b/src/blocking_impl.rs @@ -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 { + 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,