
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
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.
To use KiteConnect api
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).unwrap();
To start KiteTicker Websocket connection
use zrsclient::ticker::{KiteTicker, KiteTickerHandler, WebSocketHandler};
fn main() {
#[derive(Debug)]
pub struct CustomHandler {
tokens: Vec<u32>,
mode: String,
_count: u32,
}
impl KiteTickerHandler for CustomHandler {
fn on_open<T>(&mut self, _ws: &mut WebSocketHandler<T>)
where T: KiteTickerHandler {
// Subscribe to a list of tokens on opening the websocket connection
_ws.subscribe(self.tokens.clone()).unwrap();
_ws.set_mode(&self.mode, self.tokens.clone()).unwrap();
// println("Fellow on_open callback");
}
fn on_ticks<T>(&mut self, _ws: &mut WebSocketHandler<T>, tick: Vec<serde_json::Value>)
where T: KiteTickerHandler {
println!("{:?}", tick);
// println("Fellow on_ticks callback");
}
fn on_close<T>(&mut self, _ws: &mut WebSocketHandler<T>)
where T: KiteTickerHandler {
println!("Fellow on_close callback");
}
fn on_error<T>(&mut self, _ws: &mut WebSocketHandler<T>)
where T: KiteTickerHandler {
println!("Fellow on_error callback");
}
}
let tokens: Vec<u32> = vec![256265, 260105];
let mut ticker = KiteTicker::new("<API_KEY>", "<ACCESS_TOKEN>");
let handler = CustomHandler{tokens: tokens, mode: "ltp".to_string(), _count: 10};
ticker.connect(handler, None).unwrap();
loop {}
}
To run integration tests which are immutable run the following command
cargo test immutable -- --ignored
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
From Version 0.2.0, All API calls returns Wrapped Result<()>. Refer Example code for more details.
Added Virtual_contract_note new feature.
Added Kiteticker supports websocket streaming.
FAQs
Unknown package
We found that zrsclient demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.