roq-kucoin-futures

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

Supports

Products

Spot

Futures

Swap

Option

Account

Funds

Position

Note

✅ = Available.

❎ = Not implemented.

❌ = Unavailable.

❶ The exchange protocol does not support streaming updates for reference data and market status.

Using

$ roq-bitget [FLAGS]

Flags

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

Exchange identifier

--margin_mode

Default margin_mode (when CreateOrder doesn’t explicitly specify)

--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_uri (wss://wsapi.kucoin.com/v1/private)

Exchange end-point

--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

--test_wsapi (false)

Test WSAPI for order actions

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
--ws_uri=wss://wsapi.kucoin.com/v1/private
$ $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

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

# config template for the roq-kucoin-futures gateway

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

Inbound

Message

Field

Value

Contracts

status

Open

OPEN

Event

Field

mark.index.price

markPrice

SETTLEMENT_PRICE

mark.index.price

indexPrice

INDEX_VALUE

funding.rate

fundingRate

FUNDING_RATE

funding.begin

fundingRate

FUNDING_RATE_PREDICTION

snapshot.24h

highPrice

HIGHEST_TRADED_PRICE

snapshot.24h

lowPrice

LOWEST_TRADED_PRICE

snapshot.24h

volume

TRADE_VOLUME

Order Management

Inbound

Enum

market

MARKET

limit

LIMIT

Enum

GTC

GTC

type

remainSize

status

open

match

== 0

COMPLETED

update

filled

canceled

CANCELED

open

WORKING

match

WORKING

done

COMPLETED

Outbound

order_type

execution_instructions

price

stop_price

type

price

reduceOnly

MARKET

NaN

NaN

market

MARKET

NaN

LIMIT

NaN

limit

LIMIT

TBD

TBD

TBD

Comments

  • The default margin mode may have to be configured (flag) if not specified when creating orders. This is due to Kucoin always defaulting to the isolated margin mode.

  • No support for stop orders. This is due to Roq not currently supporting a stop “direction”.

  • Downloaded fills don’t have the clientOid field. The implication is that we can’t correctly persist historical fills.

References

Common

Exchange