diff --git a/artifacts/apidocs/trading_api.md b/artifacts/apidocs/trading_api.md index 7d45758..f100e21 100644 --- a/artifacts/apidocs/trading_api.md +++ b/artifacts/apidocs/trading_api.md @@ -36,7 +36,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, "metadata": { "client_order_id": "23042", "create_time": "1697788800000000000" @@ -66,7 +66,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, "m": { "co": "23042", "ct": "1697788800000000000" @@ -262,7 +262,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, "metadata": { "client_order_id": "23042", "create_time": "1697788800000000000" @@ -300,7 +300,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, "metadata": { "client_order_id": "23042", "create_time": "1697788800000000000" @@ -338,7 +338,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, "m": { "co": "23042", "ct": "1697788800000000000" @@ -376,7 +376,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, "m": { "co": "23042", "ct": "1697788800000000000" @@ -415,7 +415,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, "metadata": { "client_order_id": "23042", "create_time": "1697788800000000000" @@ -453,7 +453,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, "metadata": { "client_order_id": "23042", "create_time": "1697788800000000000" @@ -491,7 +491,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, "m": { "co": "23042", "ct": "1697788800000000000" @@ -529,7 +529,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, "m": { "co": "23042", "ct": "1697788800000000000" @@ -568,7 +568,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, "metadata": { "client_order_id": "23042", "create_time": "1697788800000000000" @@ -606,7 +606,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, "metadata": { "client_order_id": "23042", "create_time": "1697788800000000000" @@ -644,7 +644,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, "m": { "co": "23042", "ct": "1697788800000000000" @@ -682,7 +682,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, "m": { "co": "23042", "ct": "1697788800000000000" @@ -721,7 +721,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, "metadata": { "client_order_id": "23042", "create_time": "1697788800000000000" @@ -759,7 +759,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, "metadata": { "client_order_id": "23042", "create_time": "1697788800000000000" @@ -797,7 +797,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, "m": { "co": "23042", "ct": "1697788800000000000" @@ -835,7 +835,7 @@ LITE ENDPOINT: lite/v1/create_order "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, "m": { "co": "23042", "ct": "1697788800000000000" @@ -3865,739 +3865,6 @@ LITE ENDPOINT: lite/v1/pre_order_check ```
-### Cancel Trigger Order -``` -FULL ENDPOINT: full/v1/cancel_trigger_order -LITE ENDPOINT: lite/v1/cancel_trigger_order -``` - -=== "Request" -
- -8<- "docs/schemas/api_cancel_order_request.md" -
-
- !!! question "Query" - **Full Request** - ``` { .json .copy } - { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "order_id": "0x1028403", - "client_order_id": "23042", - "time_to_live_ms": `500` - } - ``` - **Lite Request** - ``` { .json .copy } - { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "oi": "0x1028403", - "co": "23042", - "tt": `500` - } - ``` -
-=== "Response" -
- -8<- "docs/schemas/ack_response.md" -
-
- !!! success - **Full Response** - ``` { .json .copy } - { - "result": { - "ack": "true" - } - } - ``` - **Lite Response** - ``` { .json .copy } - { - "r": { - "a": "true" - } - } - ``` -
-=== "Errors" -
- !!! info "Error Codes" - |Code|HttpStatus| Description | - |-|-|-| - |1000|401|You need to authenticate prior to using this functionality| - |1001|403|You are not authorized to access this functionality| - |1002|500|Internal Server Error| - |1003|400|Request could not be processed due to malformed syntax| - |1006|429|You have surpassed the allocated rate limit for your tier| - |1008|401|Your IP has not been whitelisted for access| - |3021|400|Either order ID or client order ID must be supplied| -
-
- !!! failure - **Full Error Response** - ``` { .json .copy } - { - "request_id":1, - "code":1000, - "message":"You need to authenticate prior to using this functionality", - "status":401 - } - ``` - **Lite Error Response** - ``` { .json .copy } - { - "ri":1, - "c":1000, - "m":"You need to authenticate prior to using this functionality", - "s":401 - } - ``` -
-=== "Try it out" - -8<- "sections/auth_closed.md" - === "DEV" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/cancel_trigger_order' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "order_id": "0x1028403", - "client_order_id": "23042", - "time_to_live_ms": `500` - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/cancel_trigger_order", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "order_id": "0x1028403", - "client_order_id": "23042", - "time_to_live_ms": `500` - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/cancel_trigger_order' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "oi": "0x1028403", - "co": "23042", - "tt": `500` - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/cancel_trigger_order", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "oi": "0x1028403", - "co": "23042", - "tt": `500` - }, - "i": 123 - } - ' -w 360 - ``` -
- === "STAGING" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/cancel_trigger_order' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "order_id": "0x1028403", - "client_order_id": "23042", - "time_to_live_ms": `500` - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/cancel_trigger_order", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "order_id": "0x1028403", - "client_order_id": "23042", - "time_to_live_ms": `500` - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/cancel_trigger_order' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "oi": "0x1028403", - "co": "23042", - "tt": `500` - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/cancel_trigger_order", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "oi": "0x1028403", - "co": "23042", - "tt": `500` - }, - "i": 123 - } - ' -w 360 - ``` -
- === "TESTNET" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/cancel_trigger_order' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "order_id": "0x1028403", - "client_order_id": "23042", - "time_to_live_ms": `500` - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/cancel_trigger_order", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "order_id": "0x1028403", - "client_order_id": "23042", - "time_to_live_ms": `500` - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/cancel_trigger_order' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "oi": "0x1028403", - "co": "23042", - "tt": `500` - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/cancel_trigger_order", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "oi": "0x1028403", - "co": "23042", - "tt": `500` - }, - "i": 123 - } - ' -w 360 - ``` -
- === "PROD" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/cancel_trigger_order' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "order_id": "0x1028403", - "client_order_id": "23042", - "time_to_live_ms": `500` - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/cancel_trigger_order", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "order_id": "0x1028403", - "client_order_id": "23042", - "time_to_live_ms": `500` - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/cancel_trigger_order' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "oi": "0x1028403", - "co": "23042", - "tt": `500` - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/cancel_trigger_order", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "oi": "0x1028403", - "co": "23042", - "tt": `500` - }, - "i": 123 - } - ' -w 360 - ``` -
-
-### Cancel All Trigger Orders -``` -FULL ENDPOINT: full/v1/cancel_all_trigger_orders -LITE ENDPOINT: lite/v1/cancel_all_trigger_orders -``` - -=== "Request" -
- -8<- "docs/schemas/api_cancel_all_orders_request.md" -
-
- !!! question "Query" - **Full Request** - ``` { .json .copy } - { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] - } - ``` - **Lite Request** - ``` { .json .copy } - { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] - } - ``` -
-=== "Response" -
- -8<- "docs/schemas/ack_response.md" -
-
- !!! success - **Full Response** - ``` { .json .copy } - { - "result": { - "ack": "true" - } - } - ``` - **Lite Response** - ``` { .json .copy } - { - "r": { - "a": "true" - } - } - ``` -
-=== "Errors" -
- !!! info "Error Codes" - |Code|HttpStatus| Description | - |-|-|-| - |1000|401|You need to authenticate prior to using this functionality| - |1001|403|You are not authorized to access this functionality| - |1002|500|Internal Server Error| - |1003|400|Request could not be processed due to malformed syntax| - |1006|429|You have surpassed the allocated rate limit for your tier| - |1008|401|Your IP has not been whitelisted for access| -
-
- !!! failure - **Full Error Response** - ``` { .json .copy } - { - "request_id":1, - "code":1000, - "message":"You need to authenticate prior to using this functionality", - "status":401 - } - ``` - **Lite Error Response** - ``` { .json .copy } - { - "ri":1, - "c":1000, - "m":"You need to authenticate prior to using this functionality", - "s":401 - } - ``` -
-=== "Try it out" - -8<- "sections/auth_closed.md" - === "DEV" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/cancel_all_trigger_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/cancel_all_trigger_orders", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/cancel_all_trigger_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/cancel_all_trigger_orders", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] - }, - "i": 123 - } - ' -w 360 - ``` -
- === "STAGING" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/cancel_all_trigger_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/cancel_all_trigger_orders", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/cancel_all_trigger_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/cancel_all_trigger_orders", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] - }, - "i": 123 - } - ' -w 360 - ``` -
- === "TESTNET" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/cancel_all_trigger_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/cancel_all_trigger_orders", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/cancel_all_trigger_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/cancel_all_trigger_orders", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] - }, - "i": 123 - } - ' -w 360 - ``` -
- === "PROD" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/cancel_all_trigger_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/cancel_all_trigger_orders", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/cancel_all_trigger_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/cancel_all_trigger_orders", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] - }, - "i": 123 - } - ' -w 360 - ``` -
-
## Execution ### Fill History ``` diff --git a/src/codegen/apidocs/apidocs.py b/src/codegen/apidocs/apidocs.py index 1d475a9..7e6b49a 100644 --- a/src/codegen/apidocs/apidocs.py +++ b/src/codegen/apidocs/apidocs.py @@ -38,7 +38,11 @@ "broker", ] -IGNORE_RPCS: list[str] = ["RPCDedustPositionV1"] +IGNORE_RPCS: list[str] = [ + "RPCDedustPositionV1", + "RPCCancelTriggerOrderV1", + "RPCCancelAllTriggerOrdersV1", +] IGNORE_ENUM_VALUES: dict[str, list[str]] = { "Currency": [ @@ -654,21 +658,21 @@ def write_struct_example_with_generics( field_path = field_path + [struct.name] - fields_skipped = 0 - for i, field in enumerate(struct.fields): - if ( - field.name in IGNORE_FIELDS_ANY_PATH - or field_path + [field.name] in IGNORE_FIELD_PATHS - ): - fields_skipped += 1 for i, field in enumerate(struct.fields): if ( field.name in IGNORE_FIELDS_ANY_PATH or field_path + [field.name] in IGNORE_FIELD_PATHS ): continue + fields_after = 0 + for j in range(i + 1, len(struct.fields)): + if not ( + struct.fields[j].name in IGNORE_FIELDS_ANY_PATH + or field_path + [struct.fields[j].name] in IGNORE_FIELD_PATHS + ): + fields_after += 1 fn = field.name if is_full else field.lite_name - comma = "," if i < len(struct.fields) - fields_skipped - 1 else "" + comma = "," if fields_after > 0 else "" md.write(f'"{fn}": ') for _ in range(field.array_depth): md.write("[")