binance / binance/binance-connector-python

user_data_stream bug? why cant catch the UserDataStreamEventsResponse model,actual_instance is None?

Open
#432 7 comments 0 reactions 0 assignees View on GitHub
Answered
Dominant language
Python
Stars
2.9k
Forks
697
PR merge metrics
No merged PRs in 30d

Description

```
def on_user_data_stream_um(self,data):

print(f"data type: {type(data)},{data}")

async def subscribe_user_data_stream_um(self):
connection = await self.get_um_connection()
try:
resp = await connection.start_user_data_stream()
listen_key = resp.data().result.listen_key
if not listen_key:
raise ValueError("无法获取 listenKey: " + str(resp))
print("listenKey:", listen_key)

ws = self.um_client.websocket_streams
connection = await ws.create_connection()
stream = await ws.user_data(listen_key)

stream.on("message", lambda data: self.on_user_data_stream_um(data))

await asyncio.sleep(1000)

await stream.unsubscribe()

except Exception as e:
logging.error(f"subscribe_user_data_stream_um() error: {e}")
```

the code above when create or cancel order , it dones catch the UserDataStreamEventsResponse model,actual_instance still None

this is the output:

data type: ,oneof_schema_1_validator=None oneof_schema_2_validator=None oneof_schema_3_validator=None oneof_schema_4_validator=None oneof_schema_5_validator=None oneof_schema_6_validator=None oneof_schema_7_validator=None oneof_schema_8_validator=None oneof_schema_9_validator=None actual_instance=None one_of_schemas={'AccountUpdate', 'AccountConfigUpdate', 'GridUpdate', 'ConditionalOrderTriggerReject', 'OrderTradeUpdate', 'Listenkeyexpired', 'MarginCall', 'TradeLite', 'StrategyUpdate'} discriminator_value_class_map={}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.