pub struct TradingHours {
pub sessions: Vec<Session>,
pub extended_sessions: Vec<ExtendedSession>,
pub timezone: Tz,
}Expand description
One or more sessions per trading day, all in the same local timezone.
Fields§
§sessions: Vec<Session>§extended_sessions: Vec<ExtendedSession>§timezone: TzImplementations§
Source§impl TradingHours
impl TradingHours
Sourcepub fn new(open: NaiveTime, close: NaiveTime, timezone: Tz) -> Self
pub fn new(open: NaiveTime, close: NaiveTime, timezone: Tz) -> Self
Single regular session (open and close on the trading day).
pub fn from_sessions(sessions: Vec<Session>, timezone: Tz) -> Self
pub fn with_extended_sessions( self, extended_sessions: Vec<ExtendedSession>, ) -> Self
Sourcepub fn forex_24x5() -> Self
pub fn forex_24x5() -> Self
Convenience: 24-hour-a-day, 5-day-a-week (open prev 17:00, close 17:00 NY).
Sourcepub fn crypto_24x7() -> Self
pub fn crypto_24x7() -> Self
24x7 always-open marker (UTC, single full-day session).
Sourcepub fn contains_local_time(&self, instant: DateTime<Utc>) -> bool
pub fn contains_local_time(&self, instant: DateTime<Utc>) -> bool
True iff instant falls within at least one session. The caller must
ensure the relevant trading day is itself a business day; this method
scans a 3-day window so cross-midnight sessions still resolve.
Trait Implementations§
Source§impl Clone for TradingHours
impl Clone for TradingHours
Source§fn clone(&self) -> TradingHours
fn clone(&self) -> TradingHours
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TradingHours
impl RefUnwindSafe for TradingHours
impl Send for TradingHours
impl Sync for TradingHours
impl Unpin for TradingHours
impl UnsafeUnpin for TradingHours
impl UnwindSafe for TradingHours
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
Mutably borrows from an owned value. Read more