#[repr(i8)]pub enum Interval {
Day = 0,
Minute = 1,
ThreeMinute = 2,
FiveMinute = 3,
TenMinute = 4,
FifteenMinute = 5,
ThirtyMinute = 6,
SixtyMinute = 7,
}
Expand description
Interval types for historical data with dual serialization support
This enum represents time intervals for historical market data requests. Each variant corresponds to a specific time period for OHLCV candles.
§Supported Intervals
- Day: Daily candles (most common for long-term analysis)
- Minute: 1-minute candles (highest resolution intraday)
- Multi-minute: 3, 5, 10, 15, 30, 60 minute candles (various intraday resolutions)
§Data Availability
- Daily data: Several years of history available
- Intraday data: Limited to recent periods (varies by broker)
- Higher frequency: More data points but faster rate limit consumption
§Rate Limiting Considerations
Higher frequency intervals generate more data points and may consume rate limits faster. Consider using appropriate intervals for your use case:
- Backtesting: Daily or hourly data
- Real-time monitoring: 1-5 minute data
- Pattern analysis: 15-30 minute data
§Integer Mapping
For legacy compatibility, intervals map to integers:
- Day = 0
- Minute = 1
- ThreeMinute = 2
- FiveMinute = 3
- TenMinute = 4
- FifteenMinute = 5
- ThirtyMinute = 6
- SixtyMinute = 7
§Examples
use kiteconnect_async_wasm::models::common::Interval;
// Different ways to create intervals
let daily = Interval::Day;
let intraday = Interval::FiveMinute;
// Convert to string for display
println!("Daily interval: {}", daily); // "day"
println!("Intraday: {}", intraday); // "5minute"
// Check if interval is intraday (less than a day)
assert_ne!(daily.to_string(), "minute");
assert_eq!(intraday.to_string(), "5minute");
Variants§
Day = 0
Daily interval (1 day candles)
Most commonly used for long-term analysis, backtesting, and trend identification. Provides good data coverage with minimal API rate limit impact.
Minute = 1
1-minute interval (highest resolution)
Highest available resolution for intraday analysis. Useful for:
- Scalping strategies
- Real-time monitoring
- High-frequency pattern analysis
Note: Consumes rate limits quickly due to large data volumes.
ThreeMinute = 2
3-minute interval
Good balance between resolution and data volume for short-term strategies.
FiveMinute = 3
5-minute interval
Popular choice for intraday trading strategies. Provides good detail while maintaining manageable data volumes.
TenMinute = 4
10-minute interval
Suitable for medium-term intraday analysis with reduced noise.
FifteenMinute = 5
15-minute interval
Common choice for swing trading and pattern recognition. Good balance of detail and broader market perspective.
ThirtyMinute = 6
30-minute interval
Used for identifying medium-term trends within trading sessions. Filters out short-term noise while maintaining intraday perspective.
SixtyMinute = 7
60-minute (1-hour) interval
Bridge between intraday and daily analysis. Useful for:
- Multi-session analysis
- Identifying major support/resistance levels
- Trend confirmation
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Interval
impl<'de> Deserialize<'de> for Interval
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>,
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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.