sammchardy / python-binance

Binance Exchange API python implementation for automated trading
https://python-binance.readthedocs.io/en/latest/
MIT License
5.88k stars 2.2k forks source link

Differentiate between spot/margin/isolated accounts on user data streams. #1377

Open alxspectrum opened 7 months ago

alxspectrum commented 7 months ago
    def start_user_socket(self, callback: Callable) -> str:
        return self._start_async_socket(
            callback=callback,
            socket_name='user_socket',
            params={}
        )

    def start_margin_socket(self, callback: Callable) -> str:
        return self._start_async_socket(
            callback=callback,
            socket_name='margin_socket',
            params={}
        )

Subscribing to these 2 websockets as an example, both give this response:

{
  "e": "outboundAccountPosition", //Event type
  "E": 1564034571105,             //Event Time
  "u": 1564034571073,             //Time of last account update
  "B": [                          //Balances Array
      {
        "a": "ETH",                 //Asset
        "f": "10000.000000",        //Free
        "l": "0.000000"             //Locked
      }
  ]
}

Is it possible to know for which account this change corresponds to ?