KiteConnect Async WASM v1.0.6
โ ๏ธ IMPORTANT DISCLAIMER โ ๏ธ
๐ค AI-GENERATED CODE - USE AT YOUR OWN RISK
This entire codebase has been generated using artificial intelligence and automated tools. While comprehensive testing has been performed, users should:
- Thoroughly test all functionality in their specific use cases
- Review and validate code before production use
- Use at their own risk and responsibility
- Not rely on this for critical financial operations without extensive validation
The maintainers provide no warranties or guarantees regarding the correctness, reliability, or suitability of this AI-generated code.
Modern async Rust client for KiteConnect REST APIs with dual API support, enhanced error handling, and WASM compatibility
A production-ready, high-performance Rust library for KiteConnect API integration featuring both legacy and strongly-typed APIs.
๐ Features v1.0.6
- โ
Robust Historical Data API - Enhanced
Candle
deserialization with support for multiple API response formats - โ Environment Variable Integration - All examples use secure environment variables for API credentials
- โ Enhanced Error Handling - Improved handling of missing metadata and OI fields
- โ Timezone-Aware Parsing - Support for +0530 timezone and various date formats
- โ Production-Ready Examples - Tested examples that work with real KiteConnect API
- โ
Enhanced Historical Data API - New
HistoricalDataRequest
struct withNaiveDateTime
precision - โ Dual Serde Support - Flexible Interval enum accepting both strings and integers
- โ Organized Enum System - Modular enum structure for better maintainability
- โ Dual API Support - Legacy JSON + new strongly-typed APIs
- โ Automatic Retry Logic with exponential backoff
- โ Response Caching for performance optimization
- โ Full WASM Compatibility for web applications
- โ Thread-Safe Design with connection pooling
- โ Comprehensive Documentation with migration guide
- โ Backward Compatibility - all existing code continues to work
- โ Professional Code Quality - Clippy optimized and formatted
๐ What's New in v1.0.6
๐ง Enhanced Historical Data Reliability
The v1.0.6 release focuses on making historical data fetching production-ready and robust:
use KiteConnect;
use HistoricalDataRequest;
use Interval;
use NaiveDateTime;
use env;
async
Key Improvements:
- โ Custom Candle Deserializer - Handles both array and object formats from KiteConnect API
- โ Metadata Synthesis - Generates metadata when API doesn't provide it
- โ Timezone Support - Proper parsing of +0530 timezone and various date formats
- โ Missing Field Handling - Graceful handling when Open Interest (OI) data is unavailable
- โ Environment Variables - All examples use secure credential management
- โ Real API Testing - Examples tested with actual KiteConnect API responses
๐ฏ Quick Start
Installation
[]
= "1.0.9"
# For WASM targets
# kiteconnect-async-wasm = "1.0.9", features = ["wasm"] }
Basic Usage (Legacy API - Backward Compatible)
use KiteConnect;
async
New Typed API (Recommended for v1.0.2)
use KiteConnect;
use *;
async
Enhanced Historical Data API (v1.0.3)
use KiteConnect;
use HistoricalDataRequest;
use Interval;
use NaiveDateTime;
async
Flexible Interval Usage (v1.0.3)
use Interval;
// Accepts both string and integer formats
let from_string: Interval = from_str.unwrap;
let from_integer: Interval = from_str.unwrap; // 0 = Day
// Always serializes as strings
assert_eq!;
assert_eq!;
Running Examples
KiteConnect REST API sample
โ Completed Features
-
โ Comprehensive serializer structs for all KiteConnect data structures
- Full typed models for all API responses (see
/src/models/
) - Dual API support: Legacy
JsonValue
+ new strongly-typed APIs - Type-safe access to holdings, orders, positions, market data, etc.
- Full typed models for all API responses (see
-
โ Advanced reconnection mechanism with intelligent retry logic
- Automatic retry with exponential backoff
- Configurable retry attempts and delays
- Built-in rate limiting respecting official API limits
- Connection pooling and automatic error recovery
Attribution
Current Maintainer: SPRAGE shauna.pai@gmail.com
This project was originally created by Joe Paul and other contributors. The current version has been significantly rewritten and modernized with:
- Complete async/await implementation
- WASM compatibility
- Enhanced feature flags system
- Comprehensive documentation
- Modern CI/CD pipeline
License
This software is released into the public domain under The Unlicense. See the LICENSE file for details.
No warranties provided - This software is provided "as is" without warranty of any kind.
๐ Performance Features
Automatic Caching
// Instruments data is automatically cached for 1 hour
let instruments1 = client.instruments.await?; // API call
let instruments2 = client.instruments.await?; // Cached response (fast!)
Intelligent Retry Logic
// All typed methods automatically retry with exponential backoff
let holdings = client.holdings_typed.await?; // Retries on network errors
Concurrent Operations
use try_join;
// Fetch multiple endpoints concurrently
let = try_join!?;
๐ง Advanced Configuration
use ;
use Duration;
let config = KiteConnectConfig ;
let client = with_config;
๐ WebAssembly Support
use *;
use KiteConnect;
pub async
๐ API Coverage
โ Complete API Support
Module | Legacy Methods | Typed Methods | Status |
---|---|---|---|
Authentication | โ | โ | Complete |
Portfolio | โ | โ | Complete |
Orders | โ | โ | Complete |
Market Data | โ | โ | Complete |
Mutual Funds | โ | โ | Complete |
Key Methods Available
Portfolio APIs:
holdings()
/holdings_typed()
- Get stock holdingspositions()
/positions_typed()
- Get trading positionsauctions()
/auctions_typed()
- Get auction instruments
Order Management:
orders()
/orders_typed()
- Get all ordersplace_order()
/place_order_typed()
- Place new ordersmodify_order()
/modify_order_typed()
- Modify existing orderscancel_order()
- Cancel orderstrades()
/trades_typed()
- Get trade history
Market Data:
instruments()
- Get instrument master (cached)quote()
/quote_typed()
- Get real-time quotesohlc()
/ohlc_typed()
- Get OHLC dataltp()
/ltp_typed()
- Get last traded pricehistorical_data()
/historical_data_typed()
- Get historical candles
Mutual Funds:
mf_orders()
/mf_orders_typed()
- Get MF ordersplace_mf_order()
/place_mf_order_typed()
- Place MF ordersmf_sips()
/mf_sips_typed()
- Get SIP detailsplace_mf_sip()
/place_mf_sip_typed()
- Create SIPsmf_holdings()
/mf_holdings_typed()
- Get MF holdings
๐ Migration from v0.x
All existing code continues to work without changes! For new projects, use the typed APIs:
// Old way (still works)
let holdings = client.holdings.await?;
let first_isin = holdings.as_str.unwrap;
// New way (recommended)
let holdings = client.holdings_typed.await?;
let first_isin = &holdings.isin; // Type-safe access
See MIGRATION_GUIDE.md for detailed migration instructions.
๐ ๏ธ Error Handling
v1.0.0 provides comprehensive error types:
use KiteError;
match client.place_order_typed.await
๐ Examples
Check out the examples directory:
- Basic Usage: Simple API calls and authentication
- Portfolio Tracker: Real-time portfolio monitoring
- Order Management: Placing and managing orders
- Market Data: Fetching quotes and historical data
- WASM Integration: Using in web applications
๐งช Testing
# Run all tests
# Run with specific features
# Run integration tests (requires network)
๐ Requirements
- Rust: 1.70.0 or later
- Tokio: For async runtime (native)
- Valid KiteConnect API credentials
๐ค Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Automated Release Process
This repository uses automated releases:
- Version Management: Use
./scripts/bump-version.sh [patch|minor|major|VERSION]
to create release branches - Automated Publishing: When PRs are merged to
main
, GitHub Actions automatically:- Creates git tags
- Publishes to crates.io
- Generates GitHub releases
- Documentation: See
AUTOMATED_RELEASES.md
for detailed workflow information
# Example: Bump to next patch version
# Example: Bump to specific version
๐ License
This project is released under the Unlicense - see the LICENSE file for details.
โ ๏ธ Disclaimer
This is an unofficial library. Use at your own risk. Not affiliated with Zerodha or KiteConnect.
๐ Links
Built with โค๏ธ in Rust for the trading community