roq-kucoin#
Links#
Purpose#
Maintain network connectivity with the KuCoin exchange
Route exchange updates to connected clients
Route client requests to the relevant exchange accounts
Stream all messages to an event-log
Overview#
Spot |
✓ |
Futures |
|
Options |
Reference Data |
✓ |
Market Status |
✓ |
Top of Book |
✓ |
Market by Price (L2) |
✓ |
Market by Order (L3) |
|
Trade Summary |
✓ |
Statistics |
✓ |
Create |
✓ |
Modify |
|
Cancel |
✓ |
Cancel All |
✓ |
Auto Cancellation |
Positions |
|
Funds |
✓ |
Data center located in … (to be confirmed)
No test environment
Conda#
$ mamba install \
--channel https://roq-trading.com/conda/stable \
roq-kucoin
$ cp $CONDA_PREFIX/share/roq-kucoin/config.toml $CONFIG_FILE_PATH
# Then modify $CONFIG_FILE_PATH to match your specific configuration
$ roq-kucoin \
--name "kucoin" \
--config_file "$CONFIG_FILE_PATH" \
--client_listen_address "$UNIX_SOCKET_PATH" \
--service_listen_address "$TCP_LISTEN_PORT" \
--flagfile "$FLAG_FILE"
Config#
Flags#
$ roq-kucoin --help
--exchange
(kucoin
)exchange identifier (string)
--request_limit
(80
)request limit per interval
--request_limit_interval
(10s
)request limit monitor interval
--self_trade_prevention
(CN
)self-trade prevention: CN, CO, CB, DC
--encode_buffer_size
(1048576
)encode buffer size
--decode_buffer_size
(10485760
)decode buffer size
--mbp_allow_price_inversion
(false
)allow price inversion?
--rest_uri
(https://openapi-sandbox.kucoin.com
)REST end-point (URI)
--rest_proxy
proxy end-point (URI)
--rest_ping_freq
(5s
)ping frequency
--rest_ping_path
(/api/v1/status
)URI path used for REST connection keep-alive messages
--rest_request_timeout
(30s
)request: timeout
--rest_download_delay
(333ms
)download throttling
--rest_download_orders_page_size
(500
)page size used when downloading orders
--rest_download_orders_begin
(24h
)download orders since (now - begin)
--rest_download_orders_inactive
(false
)download inactive orders?
--rest_download_fills_page_size
(500
)page size used when downloading fills
--rest_download_fills_begin
(24h
)download fills since (now - begin)
--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
(100
)max symbols per connection (count)
--ws_mbp_request_delay
(500ms
)request delay
--ws_mbp_request_max_retries
(0
)request max retries
Environments#
$ $CONDA_PREFIX/share/roq-kucoin/flags
# flagfile for the roq-kucoin gateway
--rest_uri=https://api.kucoin.com
# flagfile for the roq-kucoin gateway
--rest_uri=https://openapi-sandbox.kucoin.com
Market Data#
Event |
Stream |
Messages |
Comments |
---|---|---|---|
MarketData |
/market/snapshot |
||
MarketData |
/market/ticker |
||
MarketData |
/market/level2 |
||
MarketData |
/market/match |
||
MarketData |
/market/snapshot |
Event |
Stream |
Messages |
Comments |
---|---|---|---|
Rest |
/api/v1/symbols |
||
Rest |
/api/v1/symbols |
||
Rest |
/api/v3/market/orderbook/level2 |
||
Statistics#
Type |
Comments |
---|---|
|
(snapshot) |
|
(instrument) |
|
(instrument) |
|
(instrument) |
|
(instrument) |
Order Management#
Event |
Stream |
Messages |
Comments |
---|---|---|---|
DropCopy |
/spotMarket/tradeOrders |
||
Event |
Stream |
Messages |
Comments |
---|---|---|---|
Event |
Stream |
Messages |
Comments |
---|---|---|---|
OrderEntry |
POST /api/v1/orders |
||
OrderEntry |
DELETE /api/v1/orders/{order-id} |
||
OrderEntry |
DELETE /api/v1/orders |
Event |
Stream |
Messages |
Comments |
---|---|---|---|
Order Types#
Type |
Comments |
---|---|
|
Mapped to |
|
Mapped to |
Time in Force#
Type |
Comments |
---|---|
|
Mapped to |
|
Mapped to |
|
Mapped to |
Position Effect#
Note
Not supported
Execution Instructions#
Type |
Comments |
---|---|
|
Mapped to |
Account Management#
Event |
Stream |
Messages |
Comments |
---|---|---|---|
DropCopy |
/account/balance |
Event |
Stream |
Messages |
Comments |
---|---|---|---|
OrderEntry |
GET /api/v1/accounts |
Streams#
Type |
Comments |
---|---|
REST |
Primary purpose
|
Type |
Comments |
---|---|
WebSocket |
Primary purpose
Each connection
|
Type |
Comments |
---|---|
REST |
Primary purpose
|
Type |
Comments |
---|---|
WebSocket |
Primary purpose
|
Constraints#
The gateway requires a master account definition (API key) to be functional. The reason is that requesting L2 snapshots will require authentication.
The exchange API does not allow order cancelation prior to an ack or update being received by the client. (Other exchanges normally allow cancelation using a client order id.) An
roq::OrderAck
withroq::Error::UNKNOWN_EXTERNAL_ORDER_ID
is the response if aroq::CancelOrder
request is sent “too early”.There are no options to instruct the exchange to auto-cancel orders on disconnect.
Comments#
There is currently no implementation to refresh the token for the private connection. A received token should be valid for 24 hours and dialy restarts should therefore be planned.
The KuCoin sandbox environment does not work with IP restriction. This was confirmed by KuCoin support.