bmoscon / cryptofeed

Cryptocurrency Exchange Websocket Data Feed Handler
Other
2.14k stars 666 forks source link

BYBIT liquidation side data seems to be inverted in respect to other exchanges #985

Open gigitalz opened 12 months ago

gigitalz commented 12 months ago

Describe the bug BYBIT liquidation data seems to be inverted in respect to other exchanges like BINANCE_FUTURES or BITMEX, when the liquidation are SELL for these exchanges on BYBIT they are sent as side BUY.

To Reproduce

from multiprocessing import Process, freeze_support

from cryptofeed import FeedHandler
from cryptofeed.backends.socket import LiquidationsSocket
from cryptofeed.defines import LIQUIDATIONS
from cryptofeed.exchanges import EXCHANGE_MAP

def writer(addr, port):
    f = FeedHandler()
    configured = []
    exchanges = {'BINANCE_FUTURES', 'BITMEX', 'BYBIT'}

    print("Querying exchange metadata...")
    for exchange_string, exchange_class in EXCHANGE_MAP.items():
        if exchange_string in exchanges:
            if LIQUIDATIONS in exchange_class.info()['channels']['websocket']:
                configured.append(exchange_string)
                print(exchange_string)
                symbols = [sym for sym in exchange_class.symbols() if 'PINDEX' not in sym]
                f.add_feed(exchange_class(subscription={LIQUIDATIONS: symbols}, callbacks={LIQUIDATIONS: LiquidationsSocket(addr, port=port)}), timeout=600)

    print("Starting feedhandler for exchanges:", ', '.join(configured))
    f.run()

if __name__ == '__main__':
    freeze_support()
    p = Process(target=writer, args=('udp://127.0.0.1', 12345))
    p.start()

Expected behavior I expect liquidation side to be coherent for all exchanges

Operating System: Windows 10

Cryptofeed Version 2.3.2