pub enum RateLimitCategory {
Quote,
Historical,
Orders,
Standard,
}
Expand description
Rate limit categories based on official KiteConnect API documentation
KiteConnect API enforces different rate limits for different types of operations to ensure fair usage and system stability. Understanding these categories is crucial for building responsive applications that don’t hit rate limits.
§Category Details
- Quote: Real-time market data (most restrictive at 1 req/sec)
- Historical: Historical market data (3 req/sec)
- Orders: Trading operations (10 req/sec)
- Standard: General operations (3 req/sec)
§Rate Limit Enforcement
Rate limits are enforced using a token bucket algorithm where:
- Each category has a bucket with a specific capacity
- Tokens are consumed for each request
- Tokens are refilled at the category’s rate
- Requests wait when no tokens are available
§Example
use kiteconnect_async_wasm::connect::endpoints::RateLimitCategory;
let category = RateLimitCategory::Quote;
assert_eq!(category.requests_per_second(), 1);
let category = RateLimitCategory::Orders;
assert_eq!(category.requests_per_second(), 10);
Variants§
Quote
Quote endpoints: 1 request/second
Includes real-time market data endpoints like quotes, LTP, and OHLC. These have the most restrictive limits due to the high-frequency nature of market data and server load considerations.
Historical
Historical candle endpoints: 3 requests/second
Includes historical OHLC data endpoints. These limits balance the need for historical analysis with server resource management.
Orders
Order placement endpoints: 10 requests/second
Includes order placement, modification, and cancellation endpoints. Higher limits support active trading while preventing system abuse.
Standard
All other endpoints: 3 requests/second
Default category for portfolio, profile, and other general operations. Provides good throughput for typical application usage patterns.
Implementations§
Source§impl RateLimitCategory
impl RateLimitCategory
Sourcepub fn requests_per_second(&self) -> u32
pub fn requests_per_second(&self) -> u32
Get the rate limit for this category (requests per second)
§Returns
The maximum number of requests allowed per second for this category
§Example
use kiteconnect_async_wasm::connect::endpoints::RateLimitCategory;
assert_eq!(RateLimitCategory::Quote.requests_per_second(), 1);
assert_eq!(RateLimitCategory::Historical.requests_per_second(), 3);
assert_eq!(RateLimitCategory::Orders.requests_per_second(), 10);
assert_eq!(RateLimitCategory::Standard.requests_per_second(), 3);
Trait Implementations§
Source§impl Clone for RateLimitCategory
impl Clone for RateLimitCategory
Source§fn clone(&self) -> RateLimitCategory
fn clone(&self) -> RateLimitCategory
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for RateLimitCategory
impl Debug for RateLimitCategory
Source§impl Hash for RateLimitCategory
impl Hash for RateLimitCategory
Source§impl PartialEq for RateLimitCategory
impl PartialEq for RateLimitCategory
impl Eq for RateLimitCategory
impl StructuralPartialEq for RateLimitCategory
Auto Trait Implementations§
impl Freeze for RateLimitCategory
impl RefUnwindSafe for RateLimitCategory
impl Send for RateLimitCategory
impl Sync for RateLimitCategory
impl Unpin for RateLimitCategory
impl UnwindSafe for RateLimitCategory
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.