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)
- 🔑 Multi-API Support - Manage multiple Kite Connect accounts simultaneously (18,000+ symbols)
- ⚡ 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
Multi-API Manager (NEW!)
Manage multiple Kite Connect accounts in a single manager:
use ;
async
📖 Multi-API Guide - Complete multi-API documentation
📊 Performance Comparison
| Feature | Single Connection | Multi-Connection Manager | Multi-API Manager | Improvement |
|---|---|---|---|---|
| Max Symbols | 3,000 | 9,000 | 18,000+ (9K × N APIs) | 6x+ capacity |
| Max API Keys | 1 | 1 | Unlimited | Multi-account |
| Throughput | Limited by 1 connection | 3 parallel connections | 3 × N connections | N × 3x throughput |
| Latency | ~5-10µs | ~1-2µs | ~1-2µs | 5x faster |
| Resilience | Single point of failure | 3 independent connections | Multi-account redundancy | High availability |
| Dynamic Ops | Manual reconnection | Runtime add/remove | 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
- � Multi-API Guide - Manage multiple API keys (NEW!)
- �🔧 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
🔑 Multi-API Examples
- Multi-API Demo - Manage multiple Kite Connect accounts (NEW!)
🚀 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