fyers 0.2.1

Idiomatic async Rust client for the Fyers trading API.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use sha2::{Digest, Sha256};
use url::Url;

pub fn compute_app_id_hash(app_id: &str, app_secret: &str) -> String {
    let input = format!("{app_id}:{app_secret}");

    let mut hasher = Sha256::new();
    hasher.update(input.as_bytes());

    let hash = hasher.finalize();
    hex::encode(hash)
}

pub fn get_query_param(url: &Url, key: &str) -> Option<String> {
    url.query_pairs()
        .find(|(k, _)| k == key)
        .map(|(_, v)| v.into_owned())
}