Crate zrsclient

source ·
Expand description

§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 serde_json::{Value as JsonValue};
use zrsclient::config::ZrsClientConfig;
fn main(){
    // Create a KiteConnect client. Place your credentials in ~/.zrsclient folder
    let config = ZrsClientConfig{
        access_token:Some(""),
        api_key:Some("x"),
        base_url: Some("ycs".to_string())
    };
    let connect = KiteConnect::new(Some(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: JsonValue = connect.holdings(retry_count_from_recoverable_errors);
}

§Credentials file

For the SDK to detect credentials. Place your credentials in the path ~/.zrsclient/credentials

Modules§