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

Missing bids in order book depth futures stream #232

Closed ghost closed 2 years ago

ghost commented 2 years ago

I could be doing something wrong but only the asks are being streamed when using the below code.

when using spot everything works perfectly but maybe an issue?

It could be very likely be something im doing wrong as i have very little experience.

ubwa = unicorn_binance_websocket_api.BinanceWebSocketApiManager(exchange="binance.com-futures") ubwa.create_stream(['depth'], ['btcusdt'], output='UnicornFy')

oliver-zehentleitner commented 2 years ago

Does it work without output='UnicornFy'?

ghost commented 2 years ago

No doesn't work

oliver-zehentleitner commented 2 years ago

I tested it.

With unicorn-fy:

{'stream_type': 'btcusdt@depth', 'event_type': 'depthUpdate', 'event_time': 1644317875542, 'symbol': 'BTCUSDT',
 'first_update_id_in_event': 1191341927307, 'final_update_id_in_event': 1191341934159,
 'asks': [['43890.56', '0.000'], ['43899.91', '0.000'], ['43900.01', '0.000'], ['43901.26', '0.000'],
          ['43901.38', '0.000'], ['43901.92', '0.000'], ['43901.93', '0.000'], ['43901.94', '0.000'],
          ['43901.95', '0.000'], ['43901.96', '0.000'], ['43902.71', '0.000'], ['43902.73', '0.839'],
          ['43903.00', '0.000'], ['43903.06', '0.000'], ['43903.07', '0.000'], ['43903.08', '3.559'],
          ['43904.40', '0.000'], ['43904.80', '0.126'], ['43904.84', '0.000'], ['43904.85', '0.000'],
          ['43904.99', '0.066'], ['43907.27', '0.000'], ['43908.26', '0.001'], ['43908.61', '0.000'],
          ['43908.70', '0.000'], ['43909.41', '0.114'], ['43909.42', '0.080'], ['43909.43', '0.000'],
          ['43910.45', '0.023'], ['43910.49', '0.000'], ['43911.41', '0.000'], ['43912.27', '0.000'],
          ['43913.10', '0.000'], ['43913.13', '0.000'], ['43913.22', '0.000'], ['43913.63', '0.000'],
          ['43913.64', '0.000'], ['43913.69', '0.000'], ['43914.63', '0.000'], ['43914.64', '0.153'],
          ['43914.71', '0.000'], ['43914.75', '0.000'], ['43914.78', '0.000'], ['43914.81', '0.000'],
          ['43915.03', '2.000'], ['43915.72', '0.000'], ['43915.81', '0.005'], ['43918.05', '0.000'],
          ['43918.44', '0.028'], ['43919.50', '0.000'], ['43919.69', '0.000'], ['43919.73', '0.000'],
          ['43921.71', '0.000'], ['43921.76', '0.450'], ['43921.81', '0.000'], ['43921.96', '0.000'],
          ['43922.06', '0.050'], ['43922.26', '0.000'], ['43922.67', '0.120'], ['43922.71', '0.000'],
          ['43923.32', '0.040'], ['43923.37', '0.000'], ['43923.83', '0.000'], ['43923.84', '2.989'],
          ['43924.69', '0.080'], ['43924.83', '0.114'], ['43924.88', '0.000'], ['43925.42', '1.004'],
          ['43925.46', '0.000'], ['43925.47', '0.000'], ['43925.57', '0.020'], ['43925.75', '0.000'],
          ['43926.18', '0.006'], ['43928.03', '0.000'], ['43928.56', '0.000'], ['43930.23', '0.040'],
          ['43936.97', '0.000'], ['43937.42', '0.010'], ['43951.58', '0.637'], ['43955.57', '0.000'],
          ['43957.01', '0.733'], ['43968.57', '0.000'], ['43970.96', '0.000'], ['43972.50', '0.000'],
          ['44000.89', '0.010'], ['44003.24', '0.000'], ['44055.00', '1.138'], ['44100.00', '26.397'],
          ['44127.00', '0.002'], ['44253.95', '0.011'], ['44637.25', '0.233'], ['48290.01', '0.000'],
          ['55124.51', '0.001']], 'unicorn_fied': ['binance.com-futures', '0.11.0']}

Without unicorn-fy:

{"stream": "btcusdt@depth",
 "data": {"e": "depthUpdate", "E": 1644317711965, "T": 1644317711959, "s": "BTCUSDT", "U": 1191336415513,
          "u": 1191336420539, "pu": 1191336415381,
          "b": [["39057.62", "0.135"], ["39469.31", "0.000"], ["41650.28", "0.001"], ["42308.13", "0.000"],
                ["42548.50", "0.000"], ["43384.29", "0.000"], ["43389.59", "0.000"], ["43390.26", "0.000"],
                ["43399.46", "0.000"], ["43425.62", "1.380"], ["43636.30", "0.000"], ["43636.53", "0.000"],
                ["43765.06", "0.628"], ["43775.33", "0.000"], ["43815.50", "0.050"], ["43816.36", "0.000"],
                ["43816.37", "0.000"], ["43816.88", "0.056"], ["43817.18", "3.774"], ["43823.00", "0.300"],
                ["43823.75", "0.151"], ["43824.82", "0.133"], ["43830.23", "0.504"], ["43830.80", "0.300"],
                ["43834.18", "0.001"], ["43840.08", "0.341"], ["43842.29", "0.000"], ["43842.53", "0.092"],
                ["43842.65", "1.143"], ["43842.87", "1.223"], ["43844.33", "0.070"], ["43844.57", "0.000"],
                ["43844.63", "0.000"], ["43844.64", "0.000"], ["43845.98", "0.000"], ["43846.31", "0.001"],
                ["43847.81", "0.000"], ["43848.01", "0.009"], ["43848.21", "0.000"], ["43850.13", "0.000"],
                ["43850.14", "0.204"], ["45828.27", "0.000"]],
          "a": [["43854.45", "0.000"], ["43854.80", "4.920"], ["43857.29", "0.066"], ["43858.02", "0.132"],
                ["43858.03", "0.470"], ["43858.25", "0.000"], ["43858.64", "0.000"], ["43858.90", "0.001"],
                ["43860.16", "0.000"], ["43861.55", "0.150"], ["43861.96", "0.000"], ["43863.41", "0.001"],
                ["43863.90", "0.051"], ["43864.00", "2.000"], ["43864.13", "0.000"], ["43864.35", "0.045"],
                ["43864.62", "0.000"], ["43864.80", "0.000"], ["43865.01", "0.037"], ["43866.66", "0.126"],
                ["43867.32", "0.000"], ["43868.17", "1.623"], ["43869.72", "0.000"], ["43870.49", "0.029"],
                ["43871.24", "0.051"], ["43872.43", "1.113"], ["43872.68", "0.000"], ["43872.89", "0.000"],
                ["43874.59", "0.890"], ["43875.58", "0.321"], ["43875.77", "0.001"], ["43887.85", "0.000"],
                ["43901.82", "0.637"], ["43903.27", "0.000"], ["43960.79", "3.435"], ["43969.70", "0.000"],
                ["43980.00", "1.415"], ["44073.39", "0.451"], ["44073.62", "0.000"], ["44242.89", "2.934"],
                ["44444.00", "20.633"], ["45411.62", "0.000"], ["48240.28", "0.000"], ["54818.49", "7.776"],
                ["54821.62", "0.000"]]}}

So this is a bug of unicorn-fy!

Thaks for reporting! I post an info here as soon its fixed.

oliver-zehentleitner commented 2 years ago

Its released just update unicorn-fy: pip install unicorn-fy==0.11.1 --upgrade