zrsclient

Crates.iozrsclient
lib.rszrsclient
version0.1.7
sourcesrc
created_at2023-10-29 13:25:43.640577
updated_at2024-10-28 12:42:10.037852
descriptionA Rust client for the Zerodha API
homepage
repository
max_upload_size
id1017546
size139,354
Varun Reddy (Varunreddy2140)

documentation

README

Zrsclient

Warning: This SDK is in active development. Please do not use for live trading

zrsclient is an effort to create a Rust based SDK over the API provided by the indian stock broker Zerodha. We strive to actively maintain this SDK to follow changes that zerodha makes to their APIs.

We have also included retry mechanisms to handle throttling requests on the REST API, to ease the algorithm writer's pain of handling unnecessary panics from recoverable errors.

Example

use zrsclient::connect::KiteConnect
use zrsclient::config::ZrsClientConfig
use serde_json::{Value as JsonValue};

// Create a config struct with proper authorization keys
let config = ZrsClientConfig {
   api_key : Some("API_KEY"),
   access_token : Some("ACCESS_TOKEN"),
   base_url : None
}

// Create a KiteConnect client with config struct
let kite = KiteConnect::new(config);

// Set a count on how many times you want zrsclient to retry before panicking.
// If you set the retry count to 0 the client will not perform any retries on recoverable failures.
let retry_count_from_recoverable_errors = 10;
let data: Value = kite.holdings(retry_count_from_recoverable_errors);

Running Integration Tests

To run integration tests which are immutable run the following command

cargo test immutable -- --ignored

Running Tests with Statistics

run the following command to install the nightly compiler

rustup install nightly

run the following command to set nightly as default compiler

rustup default nightly

To run unit and integration tests which are immutable and get metrics

cargo test -- -Z unstable-options --report-time
Commit count: 0

cargo fmt