pub enum Interval {
Minute,
Hour,
Day,
Week,
}Expand description
Candle aggregation interval.
Represents the time granularity of OHLCV candles used for backtesting, data collection, and strategy execution.
Variants§
Minute
1-minute candles.
Hour
1-hour candles.
Day
1-day (daily) candles.
Week
1-week (weekly) candles.
Implementations§
Source§impl Interval
impl Interval
Sourcepub fn periods_per_year(&self, is_crypto: bool) -> u32
pub fn periods_per_year(&self, is_crypto: bool) -> u32
Number of periods per year for annualization (#1530).
Crypto markets trade 24/7 (365 days, 8760 hours). Traditional equity markets trade ~252 days/year, ~6.5 hours/day.
Used by Sharpe, Sortino, annualized return, CAGR calculations.
Sourcepub fn lower_intervals(&self) -> &'static [Interval]
pub fn lower_intervals(&self) -> &'static [Interval]
Returns lower intervals that can be aggregated into this one, ordered by preference.
For example, Day returns [Hour, Minute] — try hourly first, then minute.
Minute returns [] — nothing can be aggregated into minute candles.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Interval
impl<'de> Deserialize<'de> for Interval
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Interval
impl Eq for Interval
impl StructuralPartialEq for Interval
Auto Trait Implementations§
impl Freeze for Interval
impl RefUnwindSafe for Interval
impl Send for Interval
impl Sync for Interval
impl Unpin for Interval
impl UnsafeUnpin for Interval
impl UnwindSafe for Interval
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