LUCIT-Systems-and-Development / unicorn-binance-websocket-api

A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a simple, fast, flexible, robust and fully-featured way.
https://unicorn-binance-websocket-api.docs.lucit.tech/
Other
692 stars 164 forks source link

Adding new endpoint wss://dstream.binance.com - perpetual coin futures #134

Open oliver-zehentleitner opened 3 years ago

oliver-zehentleitner commented 3 years ago

The base endpoint is: wss://dstream.binance.com

https://binance-docs.github.io/apidocs/delivery/en/#change-log

Special handling for userData streams

Websocket Request for user data:
    <listenKey>@account request for user's account information
    <listenKey>@balance request for user's account balance
    <listenKey>@balance request for user's position information
oliver-zehentleitner commented 3 years ago

Request: User's Position <listenKey>@position

coinabc123 commented 3 years ago

Hi, any updates?

xiandong79 commented 3 years ago

any updates?

oliver-zehentleitner commented 3 years ago

No :/

M3tz3l commented 3 years ago

What's the exact problem here @oliver-zehentleitner with the listenkey handling?

oliver-zehentleitner commented 3 years ago

Its not a problem, its just not the same as the other private channels.

Now there are 3 types, the handling has to get extended.

M3tz3l commented 3 years ago

I tested a little and by just changing the futures websocket baseurl to dstream and the enpoint to dapi I can receive the update events just like with USDT margined futures. The new streams are just optional. For me personally, this would be enough for now and should only be small effort. I could open a PR for that if you agree.

M3tz3l commented 3 years ago

One can then receive all market data streams and update events via user data stream and extend with support for user data requests later.

oliver-zehentleitner commented 3 years ago

@M3tz3l yes that would be great! could you please also provide an example file with tests what is working and what not?

Docs: https://binance-docs.github.io/apidocs/delivery/en/#websocket-market-streams

For example "btcusd_200925@depth" or "btcusd_200925@aggTrade" does a subscription to it work?

M3tz3l commented 3 years ago

@oliver-zehentleitner done

oliver-zehentleitner commented 3 years ago

could you provide a list of what is not covered from you PR? So we know what we have to finish later.

oliver-zehentleitner commented 3 years ago

There is also a testnet: wss://dstream.binancefuture.com'

M3tz3l commented 3 years ago

What is missing are the websocket user data requests and coin-m futures testnet support. Would it make sense to create separate issues?

oliver-zehentleitner commented 3 years ago

Cool, the public streams are all supported? Generated payloads are all working?

I think one thread/issue is enough.

jackisdesigning commented 3 years ago

Any thought on the coin-m futures websocket user data requests and the testnet support?

Indiana3714 commented 3 years ago

does the stream 'aggTrade' seem to work for anyone?

I tried this from the example ".create_stream(['aggTrade'], {'btcusd_perp', 'ethusd_perp', 'bnbusd_perp'})" together with "BinanceWebSocketApiManager(exchange="binance.com-coin-futures")"

but have never gotten back any valid response from the stream buffer.

jlixfeld commented 3 years ago

Here's a supported example you can try.

https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/blob/master/example_binance_coin_futures.py

Indiana3714 commented 3 years ago

Thanks for the example but I've run it, commented out all the lines after "aggTrade" and this is my output: 2021-10-18 14_43_16-Cmder

oliver-zehentleitner commented 3 years ago

@Indiana3714 I recommend starting a new issue! This topic does not have anything to do with adding the new endpoints :)

And I would need the infos that we ask on a new bug report.... for example: which websockets version do you use and which ubwa version?

Indiana3714 commented 3 years ago

@Indiana3714 I recommend starting a new issue! This topic does not have anything to do with adding the new endpoints :)

And I would need the infos that we ask on a new bug report.... for example: which websockets version do you use and which ubwa version?

Okay thanks oliver, I've made one here https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/issues/208