Enum Interval

Source
#[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§

Source§

impl Interval

Source

pub fn as_i8(self) -> i8

Get the integer representation of the interval

Source

pub fn from_i8(value: i8) -> Option<Self>

Create an interval from its integer representation

Source

pub fn all() -> Vec<Self>

All available intervals

Trait Implementations§

Source§

impl Clone for Interval

Source§

fn clone(&self) -> Interval

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Interval

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Interval

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Interval

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Interval

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Interval

Source§

fn eq(&self, other: &Interval) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Interval

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Interval

Source§

impl Eq for Interval

Source§

impl StructuralPartialEq for Interval

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,