pub struct ExchangeSessionProvider { /* private fields */ }Expand description
Daily session provider for an exchange: a day starts at each session open of its trading hours, in its time zone, so bars outside the hours stay with the session before them. Without trading hours a day starts at midnight in the time zone.
Implementations§
Source§impl ExchangeSessionProvider
impl ExchangeSessionProvider
Sourcepub fn new(time_zone: TimezoneId, session: Option<Session>) -> Self
pub fn new(time_zone: TimezoneId, session: Option<Session>) -> Self
Days of session, or calendar days without one, in time_zone.
Sourcepub fn local(session: Option<Session>) -> Self
pub fn local(session: Option<Session>) -> Self
Calendar sessions in the system’s local zone when no exchange zone is known.
Sourcepub fn with_timeframe(self, timeframe: Timeframe) -> Self
pub fn with_timeframe(self, timeframe: Timeframe) -> Self
Draw week boundaries on daily bars, month boundaries on multi-day and weekly bars, and year boundaries on monthly bars shorter than a year. Yearly and longer bars have no dividers.
Sourcepub fn trading_date(&self, time: DateTime<Utc>) -> NaiveDate
pub fn trading_date(&self, time: DateTime<Utc>) -> NaiveDate
The trading date containing time, using the earliest window of that date for intraday
bars. Daily and longer bars carry their trading date in UTC, or in their clock’s calendar
or session zone when they open at its first instant of the date or at session midnight.
Sourcepub fn is_extended(&self, time: DateTime<Utc>) -> bool
pub fn is_extended(&self, time: DateTime<Utc>) -> bool
Whether time lies in extended hours and outside regular hours.
Sourcepub fn is_open(&self, time: DateTime<Utc>, extended_hours: bool) -> bool
pub fn is_open(&self, time: DateTime<Utc>, extended_hours: bool) -> bool
Whether the exchange is open, optionally including extended windows.
Sourcepub fn session_close(
&self,
time: DateTime<Utc>,
extended: bool,
) -> Option<DateTime<Utc>>
pub fn session_close( &self, time: DateTime<Utc>, extended: bool, ) -> Option<DateTime<Utc>>
Closing instant of the active trading window. Outside trading hours, including holidays,
returns None. Continuous sessions end at the next local midnight.
Extended windows participate only when requested.
Sourcepub fn bar_session_close(
&self,
open: DateTime<Utc>,
timeframe: Timeframe,
extended: bool,
) -> Option<DateTime<Utc>>
pub fn bar_session_close( &self, open: DateTime<Utc>, timeframe: Timeframe, extended: bool, ) -> Option<DateTime<Utc>>
Close of the last trading window in a daily, weekly or monthly bar. Daily and longer
bars are dated as trading_date dates them; intraday bars use their
active exchange window.
Trait Implementations§
Source§impl Clone for ExchangeSessionProvider
impl Clone for ExchangeSessionProvider
Source§fn clone(&self) -> ExchangeSessionProvider
fn clone(&self) -> ExchangeSessionProvider
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExchangeSessionProvider
impl Debug for ExchangeSessionProvider
impl Eq for ExchangeSessionProvider
Source§impl PartialEq for ExchangeSessionProvider
impl PartialEq for ExchangeSessionProvider
Source§impl SessionProvider for ExchangeSessionProvider
impl SessionProvider for ExchangeSessionProvider
Source§fn session_breaks(&self, bars: &[Bar]) -> Vec<(usize, SessionBreak)>
fn session_breaks(&self, bars: &[Bar]) -> Vec<(usize, SessionBreak)>
Finds the session opens around the bars’ days once and places each bar among them.
Source§fn session_break_between(
&self,
from: &DateTime<Utc>,
to: &DateTime<Utc>,
) -> Option<SessionBreak>
fn session_break_between( &self, from: &DateTime<Utc>, to: &DateTime<Utc>, ) -> Option<SessionBreak>
Source§fn session_breaks_in_range(
&self,
start: &DateTime<Utc>,
end: &DateTime<Utc>,
) -> Vec<SessionBreak>
fn session_breaks_in_range( &self, start: &DateTime<Utc>, end: &DateTime<Utc>, ) -> Vec<SessionBreak>
end; an empty or reversed range has no breaks.impl StructuralPartialEq for ExchangeSessionProvider
Auto Trait Implementations§
impl Freeze for ExchangeSessionProvider
impl RefUnwindSafe for ExchangeSessionProvider
impl Send for ExchangeSessionProvider
impl Sync for ExchangeSessionProvider
impl Unpin for ExchangeSessionProvider
impl UnsafeUnpin for ExchangeSessionProvider
impl UnwindSafe for ExchangeSessionProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more