wisespace-io / binance-rs

Rust Library for the Binance API
Other
687 stars 305 forks source link

Not handling outboundAccountPosition #253

Open Antifrajz opened 1 month ago

Antifrajz commented 1 month ago

Currently we are not handling outboundAccountPosition event in spot. The reason is that two years ago is commit c4af9a1 this the Event Balance struct is changed from

#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct EventBalance {
    #[serde(rename = "a")]
    pub asset: String,
    #[serde(rename = "f")]
    pub free: String,
    #[serde(rename = "l")]
    pub locked: String,
}

To

#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct EventBalance {
    #[serde(rename = "a")]
    pub asset: String,
    #[serde(rename = "wb")]
    pub wallet_balance: String,
    #[serde(rename = "cw")]
    pub cross_wallet_balance: String,
    #[serde(rename = "bc")]
    pub balance_change: String, // Balance Change except PnL and Commission
}

And therefor we wan't match this kind of event

{
  "e": "outboundAccountPosition", // Event type
  "E": 1564034571105,             // Event Time
  "u": 1564034571073,             // Time of last account update
  "B": [                          // Balances Array
    {
      "a": "ETH",                 // Asset
      "f": "10000.000000",        // Free
      "l": "0.000000"             // Locked
    }
  ]
}

I can fix this but I don't understand for what is the new EventBalance used. Should I add just a new struct to support this again