nardew / cryptoxlib-aio

cryptoxlib-aio - asynchronous python client for various crypto exchanges with full REST API and websocket support. Supported exchanges: AAX, Bibox, BiboxEurope, Binance (spot, margin, USDS-M futures, COIN-M futures, BLVT, BSwap), Bitforex, BitpandaPro, Bitvavo, BTSE, Coinmate, Eterbase, HitBTC, Liquid.
https://pypi.org/project/cryptoxlib-aio/
MIT License
133 stars 36 forks source link

Binance Margin (cross/isolated) WS channel has different listen-key #59

Closed xiandong79 closed 3 years ago

xiandong79 commented 3 years ago

https://binance-docs.github.io/apidocs/spot/cn/#payload

if Binance Margin (cross/isolated) WS private channel is supported, please provide an example.

I think it is not supported yet, as it need a different API path than spot to get_listen_key()

    async def get_listen_key(self):
        return await self._create_post("userDataStream", headers = self._get_header(), api_variable_path = BinanceClient.API_V3)

so, in order to subscribe the Margin (cross/isolated) WS private channel, AccountSubscription needs 3 different get_listen_key() for each type

from cryptoxlib.clients.binance.BinanceWebsocket import AccountSubscription

need to be updared into

from cryptoxlib.clients.binance.BinanceWebsocket import SpotAccountSubscription
from cryptoxlib.clients.binance.BinanceWebsocket import CrossMarginAccountSubscription
from cryptoxlib.clients.binance.BinanceWebsocket import IsolatedMarginAccountSubscription
nardew commented 3 years ago

Delivered in 5.1.3.

nardew commented 3 years ago

Thanks @xiandong79 for pointing this out.