cyberapper / cryptofeed

Cryptocurrency Exchange Websocket Data Feed Handler
Other
0 stars 0 forks source link

[Feature] Implement CCXT and CATS exchange adapters #4

Closed petercool closed 5 months ago

petercool commented 6 months ago

Requirement

Market Data

L1_BOOK = 'l1_book' L2_BOOK = 'l2_book' L3_BOOK = 'l3_book' TRADES = 'trades' TICKER = 'ticker' FUNDING = 'funding' OPEN_INTEREST = 'open_interest' LIQUIDATIONS = 'liquidations' INDEX = 'index' UNSUPPORTED = 'unsupported' CANDLES = 'candles'

- Implement configuration loading mechanism following the example below, features available:
```yaml
# Example Config File
log:
    filename: feedhandler.log
    level: WARNING

# Enable UVLoop (if not installed, will not cause errors)
uvloop: True

# Ignore invalid symbols/instruments
ignore_invalid_instruments: False

# Use multiprocessing for backends
backend_multiprocessing: False

# Secrets for exchanges
cats:
    options:
        datafeed_token: null
ccxt:
    id: null
    api_key: null
    secret: null
    password: null
    sandbox: null
binance_futures:
    key_id: null
    key_secret: null
binance_delivery:
    key_id: null
    key_secret: null
bit.com:
    key_id: null
    key_secret: null
bitget:
    key_id: null
    key_secret: null
    key_passphrase: null
bitmex:
    key_id: null
    key_secret: null
bitfinex:
    key_id: null
    key_secret: null
coinbase:
    key_id: null
    key_secret: null
    key_passphrase: null
deribit:
    key_id: null
    key_secret: null
gemini:
    key_id: null
    key_secret: null
    account_name: null   # this is an optional param needed only when using a master api key
kraken:
    key_id: null
    key_secret: null
kucoin:
    key_id: null
    key_secret: null
    key_passphrase: null
okcoin:
    key_id: null
    key_secret: null
    key_passphrase: null
okx:
    key_id: null
    key_secret: null
    key_passphrase: null
poloniex:
    key_id: null
    key_secret: null

An example code for OKX order tracing with authentication showed as below

path_to_config = './config.yaml'
    f = FeedHandler(config=path_to_config)
    f.add_feed(OKX,
               channels=[ORDER_INFO],
               symbols=["ETH-USDT-PERP", "BTC-USDT-PERP"],
               callbacks={ORDER_INFO: OrderInfoCallback(order)},
               timeout=-1)
    f.run()

Reference

https://github.com/cyberapper/cryptofeed/blob/master/cryptofeed/defines.py https://github.com/ccxt/ccxt/blob/master/examples/ccxt.pro/py/binance-watch-ohlcv.py https://github.com/ccxt/ccxt/blob/master/examples/ccxt.pro/py/binance-watch-orderbook-watch-balance.py

linear[bot] commented 6 months ago

DEV-257 [Feature] Implement CCXT and CATS exchange adapters