Via placing and canceling orders through the API, we provide a toolkit to count the time (in milliseconds) of order placement, order cancellation, and Websocket push according to the timestamp in the responses. See details in the table below:
| Type Field | Details | Tips |
|---|---|---|
| DateTime | The time of measurement occurred | |
| GetSysTime | Time consuming of Rest gateway RTT | This request doesn’t go through our backend system/modules. It is returned from the gateway directly. |
| LimitOrder | Time consuming of limit order RTT | Record the start time before placing an order, and record an end time after the order is returned, end time - start time |
| CancelOrder | Time consuming of cancel order RTT | Record the start time before placing an order, and record an end time after the order is returned, end time - start time |
| LimitOrderWs | Time taken from placing a Rest order to receiving Websocket tradeOrders push | Record the start time before placing an order, and record the end time when the tradeOrders push status is open, end time - start time |
| LimitOrderWsMsgTs | Before placing an order, record the start time and end time. The time is the ts in the Websocket push msg. | This time difference indicates the time difference between when the customer places an order and when it is consumed. |
| LimitOrderTime | Before placing an order, record the start time and end time. The orderTime in the Websocket push msg is used. | orderTime is generated by the gateway, so the time difference is the time it takes for the users to place an order to the trading gateway. |
| CancelOrderWs | Same as limitOrderWs, but only for order cancellation scenarios | |
| CancelOrderWsMsgTs | Same as LimitOrderWsMsgTs, but for order cancellation scenarios | |
| LimitOrderSrvRTT | The RTT time of placing a limit order at the gateway level | |
| CancelOrderSrvRTT | The RTT time of order cancellation seen by the gateway | |
| WsLat | The latency from the client to pushgw is measured via the websocket pingpong protocol as the latency benchmark for websocket. |
The measurement tool can generate the measurement fields in the above table. The operation method is as follows:
- Copy
kucoin_futures_lat.pyandfutures_coreto your colo machine - Run:
python3 kucoin_futures_lat.py - Run the program for 5 ~ 10 minutes and 2 CSV files (
order_data.csv,websocket_pub.csv) will be generated which record the latency for order placement and cancelling.
- Copy
kucoin_spot_lat.pyandspot_coreto your colo machine - Run:
python3 kucoin_spot_lat.py - Run the program for 5 ~ 10 minutes and 2 CSV files (
spot_order_data.csvandspot_websocket_pub.csv) will be generated which record the latency for order placement and cancelling.