KiteTicker Async Manager
High-performance async WebSocket client for the Kite Connect API with multi-connection support and dynamic subscription management.
π Documentation | π Getting Started | π Examples | π§ API Reference
β¨ Key Features
- π Multi-Connection Support - Utilize all 3 allowed WebSocket connections (9,000 symbol capacity)
- β‘ High Performance - Dedicated parser tasks, optimized buffers, sub-microsecond latency
- π Dynamic Subscriptions - Add/remove symbols at runtime without reconnection
- π Load Balancing - Automatic symbol distribution across connections
- πͺ Production Ready - Comprehensive error handling, health monitoring, reconnection
- π§ Async-First Design - Built with Tokio, follows Rust async best practices
- π§© Zero-Copy Raw Access - Optional, fully safe, endian-correct views over packet bytes
π Quick Start
Installation
Add to your Cargo.toml:
[]
= "0.2.1"
= { = "1.0", = ["full"] }
Basic Usage
use ;
async
π Performance Comparison
| Feature | Single Connection | Multi-Connection Manager | Improvement |
|---|---|---|---|
| Max Symbols | 3,000 | 9,000 | 3x capacity |
| Throughput | Limited by 1 connection | 3 parallel connections | 3x throughput |
| Latency | ~5-10Β΅s | ~1-2Β΅s | 5x faster |
| Resilience | Single point of failure | 3 independent connections | High availability |
| Dynamic Ops | Manual reconnection | Runtime add/remove | Zero downtime |
ποΈ Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β KiteTickerManager β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β π Symbol Distribution (9,000 symbols max) β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β βConnection 1 β βConnection 2 β βConnection 3 β β
β β3,000 symbolsβ β3,000 symbolsβ β3,000 symbolsβ β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β‘ Dedicated Parser Tasks (CPU Optimized) β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Parser 1 β β Parser 2 β β Parser 3 β β
β β ~1Β΅s latencyβ β ~1Β΅s latencyβ β ~1Β΅s latencyβ β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β π‘ Independent Output Channels β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β Channel 1 β β Channel 2 β β Channel 3 β β
β βbroadcast::Rxβ βbroadcast::Rxβ βbroadcast::Rxβ β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Documentation
- π Getting Started - Complete beginner's guide
- π§ API Reference - Detailed API documentation
- π Examples - Practical code examples
- π Dynamic Subscriptions - Runtime symbol management
- β‘ Performance Guide - Optimization techniques
π Examples
π° Basic Examples
- Single Connection - Simple WebSocket usage
- Portfolio Monitor - Track portfolio stocks
- Runtime Subscriptions - Dynamic symbol management
π― Advanced Examples
- Dynamic Demo - Complete dynamic workflow
- Manager Demo - Multi-connection setup
- Market Scanner - High-volume scanning
β‘ Performance Examples
- Performance Demo - Benchmarking
- High Frequency - Maximum throughput
- Raw vs Parsed - Micro-benchmark of raw vs parsed
- Raw Full Peek - Zero-copy field peeking for all packet sizes
π― Use Cases
| Use Case | Configuration | Symbols | Example |
|---|---|---|---|
| Portfolio Monitoring | 1 connection, Quote mode | 10-50 | Track personal investments |
| Algorithmic Trading | 3 connections, Quote mode | 100-1,000 | Trading strategies |
| Market Scanner | 3 connections, LTP mode | 1,000-9,000 | Scan entire market |
| High-Frequency Trading | 3 connections, Full mode | 500-3,000 | Order book analysis |
βοΈ Configuration Presets
Development
let config = KiteManagerConfig ;
Production
let config = KiteManagerConfig ;
π Comparison with Official Library
| Feature | Official kiteconnect-rs | kiteticker-async-manager |
|---|---|---|
| Maintenance | β Unmaintained | β Actively maintained |
| Async Support | β Callback-based | β Full async/await |
| Type Safety | β Untyped JSON | β Fully typed structs |
| Multi-Connection | β Single connection | β Up to 3 connections |
| Dynamic Subscriptions | β Manual reconnection | β Runtime add/remove |
| Performance | β Basic | β High-performance optimized |
| Error Handling | β Limited | β Comprehensive |
π οΈ Development
Prerequisites
# Install Rust and tools
|
Building
# Clone and build
Running Examples
# Set API credentials
# Run examples
Available Tasks
π¦ Features
- Multi-Connection Management - Utilize all 3 WebSocket connections
- Dynamic Subscriptions - Add/remove symbols without reconnection
- Load Balancing - Automatic symbol distribution
- High Performance - Dedicated parsers, optimized buffers
- Type Safety - Fully typed market data structures
- Error Resilience - Comprehensive error handling and recovery
- Health Monitoring - Real-time connection health tracking
- Async-First - Built for modern Rust async ecosystems
π€ Contributing
Contributions are welcome! Please see our contribution guidelines.
Development Setup
Use just to run development tasks:
π License
Licensed under the Apache License, Version 2.0. See LICENSE for details.
π Links
β Star this repository if you find it useful!
π¬ Zero-copy raw access (advanced)
For maximum throughput with minimal allocations, you can work directly with raw WebSocket frame bytes and view packet bodies using endian-safe, zero-copy structs.
Key points:
- Subscribe to raw frames via
subscribe_raw_frames()onKiteTickerAsync, or via the manager usingget_raw_frame_channel(ChannelId)orget_all_raw_frame_channels() - Extract packet bodies using their length prefixes
- Create typed views with
as_tick_raw,as_index_quote_32, oras_inst_header_64 - The returned
zerocopy::Ref<&[u8], T>dereferences to&Tand is valid while the backing bytes live (storeBytesto keep alive)
Example snippet:
use ;
use Bytes;
# async
Safety: All raw structs derive Unaligned and use big-endian wrappers; no unsafe is required.
Manager-level raw frames
use ;
#
# async
Or, if you only want Full depth packets, use the helper:
use ;
#
# async