From f6adbaf94d046f91feb00f5b8a99b9ddbeb07b53 Mon Sep 17 00:00:00 2001 From: keithang-grvt Date: Mon, 24 Feb 2025 11:41:23 +0800 Subject: [PATCH 1/2] [RFC] Update API docs and specs --- .../schemas/api_cancel_order_request.md | 2 +- artifacts/apidocs/trading_api.md | 36 +++++++++---------- artifacts/pysdk/grvt_raw_types.py | 5 +-- src/codegen/apispec.json | 9 ++--- 4 files changed, 27 insertions(+), 25 deletions(-) diff --git a/artifacts/apidocs/schemas/api_cancel_order_request.md b/artifacts/apidocs/schemas/api_cancel_order_request.md index 49be94f..44cce7d 100644 --- a/artifacts/apidocs/schemas/api_cancel_order_request.md +++ b/artifacts/apidocs/schemas/api_cancel_order_request.md @@ -6,4 +6,4 @@ |sub_account_id
`sa` |string|True|The subaccount ID cancelling the order| |order_id
`oi` |string|False
`0`|Cancel the order with this `order_id`| |client_order_id
`co` |string|False
`0`|Cancel the order with this `client_order_id`| - |time_to_live_ms
`tt` |string|False
`500`|Specifies the time-to-live (in milliseconds) for this cancellation.
During this period, any order creation with a matching `client_order_id` will also be cancelled.
This mechanism helps mitigate time-of-flight issues where cancellations might arrive before the corresponding orders.
Hence, cancellation by `order_id` ignores this field as the exchange can only assign `order_id`s to already-processed order creations.
The duration cannot be negative, is rounded down to the nearest 100ms (e.g., `670` -> `600`, `30` -> `0`) and capped at 5 seconds (i.e., `5000`).
Value of `0` or omission disables the TTL mechanism, so only orders already existing in matcher state at request time will be searched.
| + |time_to_live_ms
`tt` |string|False
`'0'`|Specifies the time-to-live (in milliseconds) for this cancellation.
During this period, any order creation with a matching `client_order_id` will also be cancelled.
This mechanism helps mitigate time-of-flight issues where cancellations might arrive before the corresponding orders.
Hence, cancellation by `order_id` ignores this field as the exchange can only assign `order_id`s to already-processed order creations.
The duration cannot be negative, is rounded down to the nearest 100ms (e.g., `'670'` -> `'600'`, `'30'` -> `'0'`) and capped at 5 seconds (i.e., `'5000'`).
Value of `'0'` or omission disables the TTL mechanism, so only orders already existing in matcher state at request time will be searched.
If the caller requests multiple successive cancellations for a given order, such that the time-to-live windows overlap, only the first request will be considered.
| diff --git a/artifacts/apidocs/trading_api.md b/artifacts/apidocs/trading_api.md index 67893b9..dde1684 100644 --- a/artifacts/apidocs/trading_api.md +++ b/artifacts/apidocs/trading_api.md @@ -866,7 +866,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "order_id": "0x1028403", "client_order_id": "23042", - "time_to_live_ms": `500` + "time_to_live_ms": "500" } ``` **Lite Request** @@ -875,7 +875,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sa": "'$GRVT_SUB_ACCOUNT_ID'", "oi": "0x1028403", "co": "23042", - "tt": `500` + "tt": "500" } ``` @@ -951,7 +951,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "order_id": "0x1028403", "client_order_id": "23042", - "time_to_live_ms": `500` + "time_to_live_ms": "500" } ' ``` @@ -968,7 +968,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "order_id": "0x1028403", "client_order_id": "23042", - "time_to_live_ms": `500` + "time_to_live_ms": "500" }, "id": 123 } @@ -985,7 +985,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sa": "'$GRVT_SUB_ACCOUNT_ID'", "oi": "0x1028403", "co": "23042", - "tt": `500` + "tt": "500" } ' ``` @@ -1002,7 +1002,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sa": "'$GRVT_SUB_ACCOUNT_ID'", "oi": "0x1028403", "co": "23042", - "tt": `500` + "tt": "500" }, "i": 123 } @@ -1020,7 +1020,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "order_id": "0x1028403", "client_order_id": "23042", - "time_to_live_ms": `500` + "time_to_live_ms": "500" } ' ``` @@ -1037,7 +1037,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "order_id": "0x1028403", "client_order_id": "23042", - "time_to_live_ms": `500` + "time_to_live_ms": "500" }, "id": 123 } @@ -1054,7 +1054,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sa": "'$GRVT_SUB_ACCOUNT_ID'", "oi": "0x1028403", "co": "23042", - "tt": `500` + "tt": "500" } ' ``` @@ -1071,7 +1071,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sa": "'$GRVT_SUB_ACCOUNT_ID'", "oi": "0x1028403", "co": "23042", - "tt": `500` + "tt": "500" }, "i": 123 } @@ -1089,7 +1089,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "order_id": "0x1028403", "client_order_id": "23042", - "time_to_live_ms": `500` + "time_to_live_ms": "500" } ' ``` @@ -1106,7 +1106,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "order_id": "0x1028403", "client_order_id": "23042", - "time_to_live_ms": `500` + "time_to_live_ms": "500" }, "id": 123 } @@ -1123,7 +1123,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sa": "'$GRVT_SUB_ACCOUNT_ID'", "oi": "0x1028403", "co": "23042", - "tt": `500` + "tt": "500" } ' ``` @@ -1140,7 +1140,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sa": "'$GRVT_SUB_ACCOUNT_ID'", "oi": "0x1028403", "co": "23042", - "tt": `500` + "tt": "500" }, "i": 123 } @@ -1158,7 +1158,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "order_id": "0x1028403", "client_order_id": "23042", - "time_to_live_ms": `500` + "time_to_live_ms": "500" } ' ``` @@ -1175,7 +1175,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "order_id": "0x1028403", "client_order_id": "23042", - "time_to_live_ms": `500` + "time_to_live_ms": "500" }, "id": 123 } @@ -1192,7 +1192,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sa": "'$GRVT_SUB_ACCOUNT_ID'", "oi": "0x1028403", "co": "23042", - "tt": `500` + "tt": "500" } ' ``` @@ -1209,7 +1209,7 @@ LITE ENDPOINT: lite/v1/cancel_order "sa": "'$GRVT_SUB_ACCOUNT_ID'", "oi": "0x1028403", "co": "23042", - "tt": `500` + "tt": "500" }, "i": 123 } diff --git a/artifacts/pysdk/grvt_raw_types.py b/artifacts/pysdk/grvt_raw_types.py index 6e5335c..8c3cfd6 100644 --- a/artifacts/pysdk/grvt_raw_types.py +++ b/artifacts/pysdk/grvt_raw_types.py @@ -1810,8 +1810,9 @@ class ApiCancelOrderRequest: During this period, any order creation with a matching `client_order_id` will also be cancelled. This mechanism helps mitigate time-of-flight issues where cancellations might arrive before the corresponding orders. Hence, cancellation by `order_id` ignores this field as the exchange can only assign `order_id`s to already-processed order creations. - The duration cannot be negative, is rounded down to the nearest 100ms (e.g., `670` -> `600`, `30` -> `0`) and capped at 5 seconds (i.e., `5000`). - Value of `0` or omission disables the TTL mechanism, so only orders already existing in matcher state at request time will be searched. + The duration cannot be negative, is rounded down to the nearest 100ms (e.g., `'670'` -> `'600'`, `'30'` -> `'0'`) and capped at 5 seconds (i.e., `'5000'`). + Value of `'0'` or omission disables the TTL mechanism, so only orders already existing in matcher state at request time will be searched. + If the caller requests multiple successive cancellations for a given order, such that the time-to-live windows overlap, only the first request will be considered. """ time_to_live_ms: str | None = None diff --git a/src/codegen/apispec.json b/src/codegen/apispec.json index 2273804..b3d7e59 100644 --- a/src/codegen/apispec.json +++ b/src/codegen/apispec.json @@ -8303,15 +8303,16 @@ "index": 3, "array_depth": 0, "optional": true, - "default": "500", - "example": "`500`", + "default": "'0'", + "example": "'500'", "comment": [ "Specifies the time-to-live (in milliseconds) for this cancellation.", "During this period, any order creation with a matching `client_order_id` will also be cancelled.", "This mechanism helps mitigate time-of-flight issues where cancellations might arrive before the corresponding orders.", "Hence, cancellation by `order_id` ignores this field as the exchange can only assign `order_id`s to already-processed order creations.", - "The duration cannot be negative, is rounded down to the nearest 100ms (e.g., `670` -\u003e `600`, `30` -\u003e `0`) and capped at 5 seconds (i.e., `5000`).", - "Value of `0` or omission disables the TTL mechanism, so only orders already existing in matcher state at request time will be searched.", + "The duration cannot be negative, is rounded down to the nearest 100ms (e.g., `'670'` -\u003e `'600'`, `'30'` -\u003e `'0'`) and capped at 5 seconds (i.e., `'5000'`).", + "Value of `'0'` or omission disables the TTL mechanism, so only orders already existing in matcher state at request time will be searched.", + "If the caller requests multiple successive cancellations for a given order, such that the time-to-live windows overlap, only the first request will be considered.", "" ] } From 537992fac5b51f7e075caab907778c65794abbc2 Mon Sep 17 00:00:00 2001 From: keithang-grvt Date: Mon, 24 Feb 2025 12:08:51 +0800 Subject: [PATCH 2/2] [RFC] Update API docs and specs --- artifacts/apidocs/schemas/api_cancel_order_request.md | 2 +- artifacts/pysdk/grvt_raw_types.py | 4 ++-- src/codegen/apispec.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/artifacts/apidocs/schemas/api_cancel_order_request.md b/artifacts/apidocs/schemas/api_cancel_order_request.md index 44cce7d..4bd4707 100644 --- a/artifacts/apidocs/schemas/api_cancel_order_request.md +++ b/artifacts/apidocs/schemas/api_cancel_order_request.md @@ -6,4 +6,4 @@ |sub_account_id
`sa` |string|True|The subaccount ID cancelling the order| |order_id
`oi` |string|False
`0`|Cancel the order with this `order_id`| |client_order_id
`co` |string|False
`0`|Cancel the order with this `client_order_id`| - |time_to_live_ms
`tt` |string|False
`'0'`|Specifies the time-to-live (in milliseconds) for this cancellation.
During this period, any order creation with a matching `client_order_id` will also be cancelled.
This mechanism helps mitigate time-of-flight issues where cancellations might arrive before the corresponding orders.
Hence, cancellation by `order_id` ignores this field as the exchange can only assign `order_id`s to already-processed order creations.
The duration cannot be negative, is rounded down to the nearest 100ms (e.g., `'670'` -> `'600'`, `'30'` -> `'0'`) and capped at 5 seconds (i.e., `'5000'`).
Value of `'0'` or omission disables the TTL mechanism, so only orders already existing in matcher state at request time will be searched.
If the caller requests multiple successive cancellations for a given order, such that the time-to-live windows overlap, only the first request will be considered.
| + |time_to_live_ms
`tt` |string|False
`'0'`|Specifies the time-to-live (in milliseconds) for this cancellation.
During this period, any order creation with a matching `client_order_id` will be cancelled and not be added to the GRVT matching engine.
This mechanism helps mitigate time-of-flight issues where cancellations might arrive before the corresponding orders.
Hence, cancellation by `order_id` ignores this field as the exchange can only assign `order_id`s to already-processed order creations.
The duration cannot be negative, is rounded down to the nearest 100ms (e.g., `'670'` -> `'600'`, `'30'` -> `'0'`) and capped at 5 seconds (i.e., `'5000'`).
Value of `'0'` or omission disables the TTL mechanism, so only orders already existing in matching engine state at request time will be searched.
If the caller requests multiple successive cancellations for a given order, such that the time-to-live windows overlap, only the first request will be considered.
| diff --git a/artifacts/pysdk/grvt_raw_types.py b/artifacts/pysdk/grvt_raw_types.py index 8c3cfd6..249ad17 100644 --- a/artifacts/pysdk/grvt_raw_types.py +++ b/artifacts/pysdk/grvt_raw_types.py @@ -1807,11 +1807,11 @@ class ApiCancelOrderRequest: client_order_id: str | None = None """ Specifies the time-to-live (in milliseconds) for this cancellation. - During this period, any order creation with a matching `client_order_id` will also be cancelled. + During this period, any order creation with a matching `client_order_id` will be cancelled and not be added to the GRVT matching engine. This mechanism helps mitigate time-of-flight issues where cancellations might arrive before the corresponding orders. Hence, cancellation by `order_id` ignores this field as the exchange can only assign `order_id`s to already-processed order creations. The duration cannot be negative, is rounded down to the nearest 100ms (e.g., `'670'` -> `'600'`, `'30'` -> `'0'`) and capped at 5 seconds (i.e., `'5000'`). - Value of `'0'` or omission disables the TTL mechanism, so only orders already existing in matcher state at request time will be searched. + Value of `'0'` or omission disables the TTL mechanism, so only orders already existing in matching engine state at request time will be searched. If the caller requests multiple successive cancellations for a given order, such that the time-to-live windows overlap, only the first request will be considered. """ diff --git a/src/codegen/apispec.json b/src/codegen/apispec.json index b3d7e59..c8001e5 100644 --- a/src/codegen/apispec.json +++ b/src/codegen/apispec.json @@ -8307,11 +8307,11 @@ "example": "'500'", "comment": [ "Specifies the time-to-live (in milliseconds) for this cancellation.", - "During this period, any order creation with a matching `client_order_id` will also be cancelled.", + "During this period, any order creation with a matching `client_order_id` will be cancelled and not be added to the GRVT matching engine.", "This mechanism helps mitigate time-of-flight issues where cancellations might arrive before the corresponding orders.", "Hence, cancellation by `order_id` ignores this field as the exchange can only assign `order_id`s to already-processed order creations.", "The duration cannot be negative, is rounded down to the nearest 100ms (e.g., `'670'` -\u003e `'600'`, `'30'` -\u003e `'0'`) and capped at 5 seconds (i.e., `'5000'`).", - "Value of `'0'` or omission disables the TTL mechanism, so only orders already existing in matcher state at request time will be searched.", + "Value of `'0'` or omission disables the TTL mechanism, so only orders already existing in matching engine state at request time will be searched.", "If the caller requests multiple successive cancellations for a given order, such that the time-to-live windows overlap, only the first request will be considered.", "" ]