TypeError: float() argument must be a string or a real number, not 'NoneType' in ZMQ Callback For Binance OrderInfo #1062
Unanswered
leoleung1998
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am encountering an issue when using the OrderInfoZMQ callback in a live trading environment with Binance. The error seems to arise when processing NoneType values in the OrderInfo object, and I'm not sure how to properly handle these None values before conversion. Here is the traceback and the relevant code I'm using.
2024-10-09 18:47:02,286 : ERROR : BINANCE.ws.7: encountered an exception, reconnecting in 1.0 seconds Traceback (most recent call last): File "/path/to/cryptofeed/connection_handler.py", line 69, in _create_connection await self._handler(connection, self.handler) File "/path/to/cryptofeed/connection_handler.py", line 119, in _handler await handler(message, connection, self.conn.last_message) File "/path/to/cryptofeed/exchanges/binance.py", line 508, in message_handler await self._order_update(msg, timestamp) File "/path/to/cryptofeed/exchanges/binance.py", line 497, in _order_update await self.callback(ORDER_INFO, oi, timestamp) File "/path/to/cryptofeed/feed.py", line 258, in callback await cb(obj, receipt_timestamp) File "/path/to/cryptofeed/backends/backend.py", line 93, in __call__ data = dtype.to_dict(numeric_type=self.numeric_type, none_to=self.none_to) File "cryptofeed/types.pyx", line 576, in cryptofeed.types.OrderInfo.to_dict File "cryptofeed/types.pyx", line 580, in cryptofeed.types.OrderInfo.to_dict TypeError: float() argument must be a string or a real number, not 'NoneType'
The zmq callback works perfectly fine for L2_BOOK, TICKER and CANDLE but not for orderinfo
Here is how i did it
`
from cryptofeed.backends.zmq import BookZMQ,TickerZMQ,CandlesZMQ,OrderInfoZMQ,FillsZMQ,TradeZMQ
private_channels_cp = {ORDER_INFO:OrderInfoZMQ(port=5678}
new_private_feed = Binance(config=self.config, subscription={ORDER_INFO:['SOL-USDT']}, timeout=-1, callbacks=
private_channels_cp)
feedhandler.add_feed(new_feed)
`
Question:
How to solve this issue?
Beta Was this translation helpful? Give feedback.
All reactions