wisespace-io / binance-rs

Rust Library for the Binance API
Other
649 stars 295 forks source link

WebSocket @trade not supported #69

Closed arekbal closed 3 years ago

arekbal commented 3 years ago

Thank you for your work, overall.

But ;) I couldn't receive any Trade events.

I found this part in websocket processing(stream to events):

} else if msg.find(AGGREGATED_TRADE) != None {
            let trade: TradesEvent = from_str(msg)?;
            (self.handler)(WebsocketEvent::Trade(trade))?

Its wrong, according to this: https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-streams.md#trade-streams

aggrTrade only happens when you subscribe to @aggrTrade. 'trade' is the one it should respect - @trade.

EDIT: Upon review... the @trade just wasn't supported and Trade meant AggrTrades. This PR enables the @trade stream.

PR: https://github.com/wisespace-io/binance-rs/pull/70