roq-kucoin-futures#

Supports#

Products

Spot

Futures

Options

Combos

Market Data

Reference Data

Market Status

Top of Book

Market by Price

Market by Order

Trade Summary

Statistics

Order Management

Create

Modify

Cancel

Cancel All

Auto-Cancel

Account Management

Positions

Funds

Installing#

$ mamba install \
      --channel https://roq-trading.com/conda/stable \
      roq-kucoin-futures
$ mamba install \
      --channel https://roq-trading.com/conda/unstable \
      roq-kucoin-futures

Using#

$ roq-kucoin-futures \
      --name "kucoin-futures" \
      --config_file $CONFIG_FILE_PATH \
      --client_listen_address $UNIX_SOCKET_PATH \
      --flagfile $ENVIRONMENT_FLAGFILE

Flags#

$ roq-kucoin-futures --help
--exchange (kucoin-futures)

Exchange identifier

--api (v1)

API (v1 or v2)

--rest_uri (https://api-sandbox-futures.kucoin.com)

Exchange end-point

--rest_proxy

Proxy end-point

--rest_ping_freq (5s)

Ping frequency

--rest_ping_path (/api/v1/status)

Ping path

--rest_request_timeout (30s)

Request timeout

--rest_token_refresh_freq (8h)

Token refresh frequency

--ws_ping_freq (5s)

Ping frequency

--ws_request_timeout (15s)

Request timeout

--ws_max_subscriptions_per_stream (16)

Maximum number of symbols per connection

--ws_subscribe_ticker_v2 (false)

Subscribe ticker v2?

--ws_mbp_request_delay (500ms)

Request delay

--ws_mbp_request_max_retries (0)

Request max retries

--mbp_allow_price_inversion (false)

Allow price inversion?

--request_limit (100)

Maximum number of requests per interval

--request_limit_interval (10s)

Monitor interval

--encode_buffer_size (1048576)

Encode buffer size

--decode_buffer_size (10485760)

Decode buffer size

Environments#

$ $CONDA_PREFIX/share/roq-kucoin-futures/flags/prod/flags.cfg
# flagfile for the roq-kucoin-futures gateway

--rest_uri=https://api-futures.kucoin.com
$ $CONDA_PREFIX/share/roq-kucoin-futures/flags/test/flags.cfg
# flagfile for the roq-kucoin-futures gateway

--rest_uri=https://api-sandbox-futures.kucoin.com

Configuration#

$ $CONDA_PREFIX/share/roq-kucoin-futures/config.toml

Important

The template will be replaced when the software is upgraded. Make a copy and modify to your needs.

symbols = [
  "^ETHUSD[A-Z]M$",
  "^XBTUSD[A-Z]M$"
]

[accounts]

  [accounts.A1]
  master = true
  login = "YOUR_KUCOIN_FUTURES_API_KEY_GOES_HERE"
  password = "YOUR_KUCOIN_FUTURES_PASSPHRASE_GOES_HERE"
  secret = "YOUR_KUCOIN_FUTURES_SECRET_GOES_HERE"
  symbols = [ ".*" ]

[users]

  [users.test]
  password = "1234"
  symbols = ".*"

  [users.trader]
  password = "secret"
  accounts = [ "A1" ]
  symbols = [ ".*BTC.*", ".*ETH.*" ]

[rate_limits]

  [rate_limits.global]
    type = "ORDER_ACTION"
    aggregate = true
    request_limit = 100
    monitor_period = "10s"
    ban_period = "5m"

Market Data#

Event

Stream

Messages

Comments

roq::ReferenceData

MarketData

/contract/instrument

roq::MarketStatus

MarketData

/contract/instrument

roq::TopOfBook

MarketData

/contractMarket/tickerV2 or /contractMarket/ticker

roq::MarketByPriceUpdate

MarketData

/contractMarket/level2

roq::MarketByOrderUpdate

roq::TradeSummary

MarketData

/contractMarket/execution

roq::StatisticsUpdate

MarketData

/contract/announcement

Event

Stream

Messages

Comments

roq::ReferenceData

Rest

/api/v1/contracts/active

roq::MarketStatus

Rest

/api/v1/contracts/active

roq::TopOfBook

roq::MarketByPriceUpdate

Rest

/api/v1/level2/snapshot

roq::MarketByOrderUpdate

roq::TradeSummary

roq::StatisticsUpdate

Statistics#

Type

Comments

SETTLEMENT_PRICE

mark_index_price.mark_price

INDEX_VALUE

mark_index_price.index_value

FUNDING_RATE

funding_rate.funding_rate

FUNDING_RATE_PREDICTION

funding_begin.funding_rate

TRADE_VOLUME

snapshot_24h.volume

Order Management#

Event

Stream

Messages

Comments

roq::OrderUpdate

DropCopy

/contractMarket/tradeOrders

roq::TradeUpdate

Event

Stream

Messages

Comments

roq::OrderUpdate

OrderEntry

GET /api/v1/orders

It’s only possible to poll?

roq::TradeUpdate

OrderEntry

GET /api/v1/fills

It’s only possible to poll?

Event

Stream

Messages

Comments

roq::CreateOrder

OrderEntry

POST /api/v1/orders

roq::ModifyOrder

roq::CancelOrder

OrderEntry

DELETE /api/v1/orders/{order-id}

roq::CancelAllOrders

OrderEntry

DELETE /api/v1/orders

Event

Stream

Messages

Comments

roq::OrderAck

Order Types#

TBD

Time in Force#

TBD

Position Effect#

TBD

Execution Instructions#

TBD

Account Management#

Event

Stream

Messages

Comments

roq::PositionUpdate

DropCopy

/contract/position:{symbol}

roq::FundsUpdate

DropCopy

/contractAccount/wallet

Event

Stream

Messages

Comments

roq::PositionUpdate

OrderEntry

GET /api/v1/position

roq::FundsUpdate

Streams#

Type

Comments

REST

Primary purpose

  • download reference data and L2 snapshot

Type

Comments

WebSocket

Primary purpose

  • live market data

  • reference data and market status

Each connection

  • supports a slice of the symbols

Constraints#

  • It does not appear to be possible to subscribe all symbols more than once per IP address.

Comments#

  • Orders can NOT be canceled by client order id.

  • Fills are not communicated in real-time (only indirectly through order updates).

  • There are no options to instruct the exchange to auto-cancel orders on disconnect.

  • API v2 has been announced. As of 2022-07-01, it is unclear when this new API will be released to production. However, it sounds like it will be a change with no transition period with support for both API’s.