pub enum CandleInterval {
Show 16 variants
Sec1,
Min1,
Min3,
Min5,
Min15,
Min30,
Hour1,
Hour2,
Hour4,
Hour6,
Hour8,
Hour12,
Day1,
Day3,
Week1,
Month1,
}Expand description
Candle interval/resolution, shared across every venue that produces candles.
This is the venue-agnostic union of all supported candle resolutions — it
is deliberately not gated to any one exchange’s capabilities. Per-venue
support rules (e.g. Hyperliquid rejecting Sec1/Hour6) live in the exchange
layer, not on this enum (separation of concerns). Because the enum is a union,
each venue’s interval guard must be re-reviewed whenever a variant is added.
§String form
as_str is the single source of truth for every string
representation: Display, Serialize, FromStr and Deserialize all
delegate to it (or its inverse), so there is exactly one place mapping
variant↔string. The strings match Binance’s kline interval parameter exactly
and are case-sensitive — note Month1 → "1M" (uppercase) vs Min1 → "1m".
§Ordering
Variants are declared in ascending duration order. Ord/PartialOrd exist
only as a compile requirement (the type embeds in
Candles, which must stay Ord to
preserve the derived Ord on Subscription); the chronological declaration
order makes the derived order at least sensible. Nothing currently sorts
intervals semantically.
Variants§
Sec1
1 second
Min1
1 minute
Min3
3 minutes
Min5
5 minutes
Min15
15 minutes
Min30
30 minutes
Hour1
1 hour
Hour2
2 hours
Hour4
4 hours
Hour6
6 hours
Hour8
8 hours
Hour12
12 hours
Day1
1 day
Day3
3 days
Week1
1 week
Month1
1 month
Implementations§
Source§impl CandleInterval
impl CandleInterval
Sourcepub const ALL: [CandleInterval; 16]
pub const ALL: [CandleInterval; 16]
Every CandleInterval variant, in ascending-duration declaration order.
Lets variant-exhaustive tests (round-trip, channel-suffix drift guards) iterate without hand-listing the variants.
When adding a CandleInterval variant, add it here too: the length
literal and the candle_interval_all_covers_every_variant_in_ascending_order
test pin ALL’s length to the variant count, but full coverage is not
compile-enforced — the exhaustive matches elsewhere are the compile gate.
Sourcepub fn as_str(&self) -> &'static str
pub fn as_str(&self) -> &'static str
The exchange string form of this interval (e.g. "1m", "6h", "1M").
The single source of truth for all string representations — Display,
Serialize, FromStr and Deserialize all key off this. Case-sensitive:
Month1 → "1M", every other variant lowercase.
Sourcepub fn to_step(self) -> IntervalStep
pub fn to_step(self) -> IntervalStep
Map this interval to the shared IntervalStep used to compute a candle’s
exclusive close_time boundary via close_time_from_open. All intervals
are fixed-length except 1M, which is a calendar month.
Trait Implementations§
Source§impl Clone for CandleInterval
impl Clone for CandleInterval
Source§fn clone(&self) -> CandleInterval
fn clone(&self) -> CandleInterval
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CandleInterval
Source§impl Debug for CandleInterval
impl Debug for CandleInterval
Source§impl<'de> Deserialize<'de> for CandleInterval
impl<'de> Deserialize<'de> for CandleInterval
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Display for CandleInterval
impl Display for CandleInterval
impl Eq for CandleInterval
Source§impl FromStr for CandleInterval
impl FromStr for CandleInterval
Source§impl Hash for CandleInterval
impl Hash for CandleInterval
Source§impl Ord for CandleInterval
impl Ord for CandleInterval
Source§fn cmp(&self, other: &CandleInterval) -> Ordering
fn cmp(&self, other: &CandleInterval) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for CandleInterval
impl PartialEq for CandleInterval
Source§fn eq(&self, other: &CandleInterval) -> bool
fn eq(&self, other: &CandleInterval) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for CandleInterval
impl PartialOrd for CandleInterval
Source§impl Serialize for CandleInterval
impl Serialize for CandleInterval
impl StructuralPartialEq for CandleInterval
Auto Trait Implementations§
impl Freeze for CandleInterval
impl RefUnwindSafe for CandleInterval
impl Send for CandleInterval
impl Sync for CandleInterval
impl Unpin for CandleInterval
impl UnsafeUnpin for CandleInterval
impl UnwindSafe for CandleInterval
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.