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
677 stars 166 forks source link

Liquidation feed #53

Closed bitog closed 1 year ago

bitog commented 4 years ago

Hi there,

I was just wondering what is the futures liquidation feed?

Thanks for your help!

bitog commented 4 years ago

Is it ['trade', 'forceOrder'], ['btcusdt']?

oliver-zehentleitner commented 4 years ago

Hi dducted!

I never used binance futures I only wrote the implementation and an other user tested the private streams.

But on binance futures docs I found this:

2019-11-29 New websocket streams:

@forceOrderfor liquidation order streams !forceOrder@arr for all market liquidation order streams

I guess <symbol>@forceOrderfor should be working out of the box. Would be cool to get feedback from you.

!forceOrder@arr needs to get implemented. I have time today so I would do the integration within the next hours. Would you be willing to test it before we push it to pypi?

Best regards, Oliver

oliver-zehentleitner commented 4 years ago

Hm, I think it should be already working in 1.12.0!

Just try:

binance_websocket_api_manager.create_stream("forceOrder", "btcusdt")
binance_websocket_api_manager.create_stream("!forceOrder", "arr" )
bitog commented 4 years ago

Hi there,

Just saw your message now. Thanks for the reply. I did try what you asked, using the following code:

from unicorn_binance_websocket_api.unicorn_binance_websocket_api_manager import BinanceWebSocketApiManager
from unicorn_fy.unicorn_fy import UnicornFy

binance_websocket_api_manager = BinanceWebSocketApiManager(exchange="binance.com")
binance_websocket_api_manager.create_stream("forceOrder", "btcusdt")

while True:
    oldest_stream_data_from_stream_buffer = binance_websocket_api_manager.pop_stream_data_from_stream_buffer()
    if oldest_stream_data_from_stream_buffer:
        print(oldest_stream_data_from_stream_buffer)

But I am getting {"result":null,"id":1}

oliver-zehentleitner commented 4 years ago

That's actually not a bad sign... https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/issues/54

It seems to be connected! Oliver Zehentleitner

bitog commented 4 years ago

Not sure if null and none is the same but until not I haven't received any other data than {"result":null,"id":1}. Maybe there just hasn't been any liquidation until now...

img

oliver-zehentleitner commented 4 years ago

That's the point, you are connected. Result null is the confirmation of the subscription. If a liquidation happens, then you will receive the notification.

oliver-zehentleitner commented 4 years ago

If you still need help, please reopen! thanks

Ilocans commented 2 years ago

Hi,

I tried something really similar to the code above `

import unicorn_binance_websocket_api

ubwa = unicorn_binance_websocket_api.BinanceWebSocketApiManager(exchange="binance.com") ubwa.create_stream("forceOrder", "btcusdt")

while True: oldest_data_from_stream_buffer = ubwa.pop_stream_data_from_stream_buffer() if oldest_data_from_stream_buffer: print(oldest_data_from_stream_buffer)

`

I am getting 1 line with {"result":null,"id":1} but after that nothing, no other print is executed. I left it run a long time without seeing anything Any Idea ?

oliver-zehentleitner commented 2 years ago

Do you have a reference to the binance api documentation?

Ilocans commented 2 years ago

Hi

I was searching about binance liquidation and I found this thread. like @bitog , when I run my code (which do the same than the one above) I only get one line with {"result":null,"id":1} It look like jammed or something.

I found this I don't know if it is what your looking for https://binance-docs.github.io/apidocs/futures/en/#liquidation-order-streams https://github.com/Binance-docs/Binance_Futures_python/blob/master/binance_f/model/liquidationorder.py

Also if this can help I found this https://stackoverflow.com/questions/67509891/how-to-view-aggregated-liquidations-for-cryptocurrencies-from-binance The last post is working if it can help you make it work with your websocket

oliver-zehentleitner commented 2 years ago

Hi,

I tried something really similar to the code above `

import unicorn_binance_websocket_api ubwa = unicorn_binance_websocket_api.BinanceWebSocketApiManager(exchange="binance.com") ubwa.create_stream("forceOrder", "btcusdt") while True: oldest_data_from_stream_buffer = ubwa.pop_stream_data_from_stream_buffer() if oldest_data_from_stream_buffer: print(oldest_data_from_stream_buffer)

`

I am getting 1 line with {"result":null,"id":1} but after that nothing, no other print is executed. I left it run a long time without seeing anything Any Idea ?

BinanceWebSocketApiManager(exchange="binance.com-futures")