Igosuki / binance-rs-async

Async client for the Binance APIs
https://crates.io/crates/binance-rs-async
Other
171 stars 114 forks source link

Signature for this request in not valid #89

Closed yash261 closed 1 year ago

yash261 commented 1 year ago
let account: Account = Binance::new_with_env(&Config::testnet());
    let limit_buy = OrderRequest {
            symbol: "BTCUSDT".to_string(),
            quantity: Some(0.01),
            price: Some(40000.0),
            order_type: OrderType::Limit,
            side: OrderSide::Buy,
            time_in_force: Some(TimeInForce::FOK),
            ..OrderRequest::default()
        };
    match account.place_order(limit_buy).await {
        Ok(answer) => println!("{:?}", answer),
        Err(e) => println!("Error: {e}"),
    }

This is my code and output is

Error: code: -1022, msg: Signature for this request is not valid.
YeahNotSewerSide commented 1 year ago

Hi @yash261, could you please try to initialize account this way? let account = binance::account::Account::new_with_config(Some(api_key), Some(secret_key), &Config::testnet()); Where api_key and secret_key are Strings. Will be waiting for your response.

yash261 commented 1 year ago

It worked. Thanks a lot.