nautechsystems / nautilus_trader

A high-performance algorithmic trading platform and event-driven backtester
https://nautilustrader.io
GNU Lesser General Public License v3.0
2.07k stars 470 forks source link

Implement Binance TradeLite message support #2008

Open StephenLee2016 opened 2 days ago

StephenLee2016 commented 2 days ago

Bug Report

Expected Behavior

Add here...

Actual Behavior

In live trading, there may be instances where trade_lite cannot be parsed. I noticed that previous submissions have added an “TRADE_LITE” enumeration field, but the parsing function was not found.

Steps to Reproduce the Problem

[ERROR] TESTER-001.ExecClient-BINANCE: Error on handling b'{"stream":"jQ5bcqm7L6JDTIdGPx9NlWtxm2mkzRpVftCnxKrq817NEeDDUfdqHrC6vZck7A1w","data":{"e":"TRADE_LITE","E":1727683915920,"T":1727683915920,"s":"ETHUSDT","q":"0.037","p":"2631.90","m":false,"c":"O-20240930-081155-001-000-29","S":"BUY","L":"2631.90","l":"0.037","t":4467432841,"i":8389765739703625592}}' KeyError(<BinanceFuturesEventType.TRADE_LITE: 'TRADE_LITE'>) Traceback (most recent call last): File "/home/nautilus_trader/nautilus_trader/adapters/binance/futures/execution.py", line 277, in _handle_user_ws_message self._futures_user_ws_handlerswrapper.data.e

Specifications

cjdsellers commented 15 hours ago

Hey @StephenLee2016

Thanks for the report!

I've implemented parsing for this message with this commit ac9dffa216d7cb823c9664de2883340c2df84c21. So when this WS message is received it'll be parsed and delivered into this handler. Thats where the support currently ends though, as it needs to be further parsed into a FillReport.

I'm currently lacking the available bandwidth to continue to that.

Converting this ticket from bug to enhancement request to support the TRADE_LITE feature from Binance. If someone else would like to pick this up then that would be much appreciated :pray:.

For myself, likely to be addressed later when we port this to Rust and implement SBE.