bmoscon / cryptofeed

Cryptocurrency Exchange Websocket Data Feed Handler
Other
2.19k stars 679 forks source link

BITDOTCOM missing BTC-USDT-PERP #908

Open weaming opened 1 year ago

weaming commented 1 year ago

Is your feature request related to a problem? Please describe. no

Describe the solution you'd like add endpoints described in page https://www.bit.com/docs/en-us/linear_futures.html

Describe alternatives you've considered none

Additional context

Try this demo, the commented line will not run successfully

from decimal import Decimal

from cryptofeed import FeedHandler
from cryptofeed.defines import BITDOTCOM, TICKER

async def ticker(t, receipt_timestamp):
    if t.timestamp is not None:
        assert isinstance(t.timestamp, float)
    assert isinstance(t.exchange, str)
    assert isinstance(t.bid, Decimal)
    assert isinstance(t.ask, Decimal)
    print(f'Ticker received at {receipt_timestamp}: {t}')

def main():
    f = FeedHandler()
    # f.add_feed(BITDOTCOM, channels=[TICKER], symbols=['FIL-USDT-PERP'], callbacks={TICKER: ticker})
    f.add_feed(BITDOTCOM, channels=[TICKER], symbols=['BTC-USD-PERP'], callbacks={TICKER: ticker})
    f.run()

if __name__ == '__main__':
    main()
weaming commented 1 year ago

And, there are two instrument will generate same symbol BTC-USD-PERP, but one is inverse perpetual.

I suggest the inverse one use the symbol format BTC-PERP, the other one use BTC-USD-PERP which use USD as margin.