Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Closed
#432 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
api

Research direction

Start with the reproduced user_data_stream subscription and inspect websocket_streams/models/user_data_stream_events_response.py, where UserDataStreamEventsResponse is defined. Trigger a create-order or cancel-order event and compare the received model with its one-of schemas. Done means the corresponding event is represented by a populated actual_instance instead of None.

Written by the indexing model from the issue text.

Description

Answered
    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: <class 'binance_sdk_derivatives_trading_usds_futures.websocket_streams.models.user_data_stream_events_response.UserDataStreamEventsResponse'>,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={}

Dominant language
Python
Stars
2.9k
Forks
707
Avg merge
2h 17m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from binance/binance-connector-python

All issues in binance/binance-connector-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.