KiteTickerManager

Struct KiteTickerManager 

Source
pub struct KiteTickerManager { /* private fields */ }
Expand description

High-performance multi-connection WebSocket manager for Kite ticker data

This manager creates 3 independent WebSocket connections and distributes symbols across them using round-robin allocation. Each connection has its own dedicated parser task for maximum performance.

Implementations§

Source§

impl KiteTickerManager

Source

pub fn new( api_key: String, access_token: String, config: KiteManagerConfig, ) -> Self

Creates a new KiteTickerManager instance with the specified configuration

This initializes the manager with the provided API credentials and configuration, but does not start any connections. Call start() to begin operation.

§Arguments
  • api_key - Your Kite Connect API key
  • access_token - Valid access token from Kite Connect
  • config - Manager configuration settings
§Example
use kiteticker_async_manager::{KiteTickerManager, KiteManagerConfig, Mode};

let config = KiteManagerConfig {
    max_connections: 3,
    max_symbols_per_connection: 3000,
    enable_dedicated_parsers: true,
    default_mode: Mode::LTP,
    ..Default::default()
};

let manager = KiteTickerManager::new(
    "your_api_key".to_string(),
    "your_access_token".to_string(),
    config,
);
Source

pub fn with_raw_only(self, raw: bool) -> Self

Set raw-only mode (builder uses this)

Source

pub async fn start(&mut self) -> Result<(), String>

Initialize all connections and start the manager

Source

pub async fn subscribe_symbols( &mut self, symbols: &[u32], mode: Option<Mode>, ) -> Result<(), String>

Subscribe to symbols using round-robin distribution

Source

pub fn get_channel( &mut self, channel_id: ChannelId, ) -> Option<Receiver<TickerMessage>>

Get output channel for a specific connection

Source

pub fn get_all_channels(&mut self) -> Vec<(ChannelId, Receiver<TickerMessage>)>

Get all output channels

Source

pub fn get_raw_frame_channel( &self, channel_id: ChannelId, ) -> Option<Receiver<Bytes>>

Get a raw frame receiver (bytes::Bytes per websocket frame) for a connection. Returns None if the connection is not initialized.

Source

pub fn get_full_raw_subscriber( &self, channel_id: ChannelId, ) -> Option<KiteTickerRawSubscriber184>

Convenience: create a 184-byte Full-tick raw subscriber for a connection. Useful when operating in raw_only mode to consume only depth packets.

Source

pub fn get_all_raw_frame_channels(&self) -> Vec<(ChannelId, Receiver<Bytes>)>

Convenience: get raw frame receivers for all initialized connections. Each item is (ChannelId, broadcast::Receiver<bytes::Bytes>).

Source

pub async fn get_stats(&self) -> Result<ManagerStats, String>

Get manager statistics

Source

pub async fn get_health(&self) -> Result<HealthSummary, String>

Get health summary

Source

pub async fn get_processor_stats(&self) -> Vec<(ChannelId, ProcessorStats)>

Get processor statistics for all channels

Source

pub fn get_symbol_distribution(&self) -> HashMap<ChannelId, Vec<u32>>

Get symbol distribution across connections

Source

pub async fn unsubscribe_symbols( &mut self, symbols: &[u32], ) -> Result<(), String>

Unsubscribe from symbols

Source

pub async fn change_mode( &mut self, symbols: &[u32], mode: Mode, ) -> Result<(), String>

Dynamically change subscription mode for existing symbols

Source

pub async fn stop(&mut self) -> Result<(), String>

Stop the manager and all connections

Trait Implementations§

Source§

impl Debug for KiteTickerManager

Source§

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

Formats the value using the given formatter. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V