From 25233687f80beb15e4e663aa299d7090dbe26171 Mon Sep 17 00:00:00 2001 From: Hibzbod Date: Wed, 23 Oct 2024 14:16:20 +0200 Subject: [PATCH] [RFC] Update API docs and specs --- artifacts/apidocs/market_data_streams.md | 96 ++++++--- .../schemas/api_cancel_order_response.md | 11 +- .../schemas/api_create_order_request.md | 11 +- .../schemas/api_create_order_response.md | 11 +- .../apidocs/schemas/api_get_order_response.md | 11 +- .../schemas/api_open_orders_response.md | 11 +- .../schemas/api_order_history_response.md | 11 +- .../schemas/api_order_state_response.md | 11 +- ...internal_pre_order_margin_check_request.md | 22 ++ ...nternal_pre_order_margin_check_response.md | 4 + artifacts/apidocs/schemas/jsonrpc_response.md | 1 + artifacts/apidocs/schemas/order.md | 11 +- artifacts/apidocs/schemas/order_state.md | 11 +- artifacts/apidocs/schemas/order_state_feed.md | 11 +- artifacts/apidocs/schemas/order_status.md | 10 +- artifacts/apidocs/schemas/stream_reference.md | 5 + .../apidocs/schemas/ws_list_streams_params.md | 5 + .../apidocs/schemas/ws_list_streams_result.md | 11 + .../apidocs/schemas/ws_order_feed_data_v1.md | 11 +- .../schemas/ws_order_state_feed_data_v1.md | 11 +- .../schemas/ws_unsubscribe_all_params.md | 5 + .../schemas/ws_unsubscribe_all_result.md | 11 + artifacts/apidocs/trading_api.md | 24 ++- artifacts/apidocs/trading_streams.md | 96 ++++++--- artifacts/pysdk/grvt_raw_types.py | 60 +++++- src/codegen/apispec.json | 192 +++++++++++++++++- 26 files changed, 527 insertions(+), 147 deletions(-) create mode 100644 artifacts/apidocs/schemas/internal_pre_order_margin_check_request.md create mode 100644 artifacts/apidocs/schemas/internal_pre_order_margin_check_response.md create mode 100644 artifacts/apidocs/schemas/stream_reference.md create mode 100644 artifacts/apidocs/schemas/ws_list_streams_params.md create mode 100644 artifacts/apidocs/schemas/ws_list_streams_result.md create mode 100644 artifacts/apidocs/schemas/ws_unsubscribe_all_params.md create mode 100644 artifacts/apidocs/schemas/ws_unsubscribe_all_result.md diff --git a/artifacts/apidocs/market_data_streams.md b/artifacts/apidocs/market_data_streams.md index 9477bb4..7b0545d 100644 --- a/artifacts/apidocs/market_data_streams.md +++ b/artifacts/apidocs/market_data_streams.md @@ -44,7 +44,8 @@ STREAM: v1.mini.s "num_snapshots": [10], "first_sequence_number": [872634876] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Unsubscribe" @@ -68,7 +69,8 @@ STREAM: v1.mini.s "stream": "v1.mini.s", "unsubs": ["BTC_USDT_Perp@500"] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Legacy Subscribe" @@ -167,7 +169,8 @@ STREAM: v1.mini.s "code": 1002, "message": "Internal Server Error" }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` **Lite Error Response** @@ -178,7 +181,8 @@ STREAM: v1.mini.s "c": 1002, "m": "Internal Server Error" }, - "i": 123 + "i": 123, + "m": "subscribe" } ``` **Legacy Error Response** @@ -599,7 +603,8 @@ STREAM: v1.mini.d "num_snapshots": [10], "first_sequence_number": [872634876] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Unsubscribe" @@ -623,7 +628,8 @@ STREAM: v1.mini.d "stream": "v1.mini.d", "unsubs": ["BTC_USDT_Perp@500"] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Legacy Subscribe" @@ -722,7 +728,8 @@ STREAM: v1.mini.d "code": 1002, "message": "Internal Server Error" }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` **Lite Error Response** @@ -733,7 +740,8 @@ STREAM: v1.mini.d "c": 1002, "m": "Internal Server Error" }, - "i": 123 + "i": 123, + "m": "subscribe" } ``` **Legacy Error Response** @@ -1154,7 +1162,8 @@ STREAM: v1.ticker.s "num_snapshots": [10], "first_sequence_number": [872634876] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Unsubscribe" @@ -1178,7 +1187,8 @@ STREAM: v1.ticker.s "stream": "v1.ticker.s", "unsubs": ["BTC_USDT_Perp@500"] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Legacy Subscribe" @@ -1303,7 +1313,8 @@ STREAM: v1.ticker.s "code": 1002, "message": "Internal Server Error" }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` **Lite Error Response** @@ -1314,7 +1325,8 @@ STREAM: v1.ticker.s "c": 1002, "m": "Internal Server Error" }, - "i": 123 + "i": 123, + "m": "subscribe" } ``` **Legacy Error Response** @@ -1735,7 +1747,8 @@ STREAM: v1.ticker.d "num_snapshots": [10], "first_sequence_number": [872634876] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Unsubscribe" @@ -1759,7 +1772,8 @@ STREAM: v1.ticker.d "stream": "v1.ticker.d", "unsubs": ["BTC_USDT_Perp@500"] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Legacy Subscribe" @@ -1884,7 +1898,8 @@ STREAM: v1.ticker.d "code": 1002, "message": "Internal Server Error" }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` **Lite Error Response** @@ -1895,7 +1910,8 @@ STREAM: v1.ticker.d "c": 1002, "m": "Internal Server Error" }, - "i": 123 + "i": 123, + "m": "subscribe" } ``` **Legacy Error Response** @@ -2317,7 +2333,8 @@ STREAM: v1.book.s "num_snapshots": [10], "first_sequence_number": [872634876] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Unsubscribe" @@ -2341,7 +2358,8 @@ STREAM: v1.book.s "stream": "v1.book.s", "unsubs": ["BTC_USDT_Perp@500-50"] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Legacy Subscribe" @@ -2443,7 +2461,8 @@ STREAM: v1.book.s "code": 1002, "message": "Internal Server Error" }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` **Lite Error Response** @@ -2454,7 +2473,8 @@ STREAM: v1.book.s "c": 1002, "m": "Internal Server Error" }, - "i": 123 + "i": 123, + "m": "subscribe" } ``` **Legacy Error Response** @@ -2875,7 +2895,8 @@ STREAM: v1.book.d "num_snapshots": [10], "first_sequence_number": [872634876] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Unsubscribe" @@ -2899,7 +2920,8 @@ STREAM: v1.book.d "stream": "v1.book.d", "unsubs": ["BTC_USDT_Perp@500"] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Legacy Subscribe" @@ -3000,7 +3022,8 @@ STREAM: v1.book.d "code": 1002, "message": "Internal Server Error" }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` **Lite Error Response** @@ -3011,7 +3034,8 @@ STREAM: v1.book.d "c": 1002, "m": "Internal Server Error" }, - "i": 123 + "i": 123, + "m": "subscribe" } ``` **Legacy Error Response** @@ -3433,7 +3457,8 @@ STREAM: v1.trade "num_snapshots": [10], "first_sequence_number": [872634876] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Unsubscribe" @@ -3457,7 +3482,8 @@ STREAM: v1.trade "stream": "v1.trade", "unsubs": ["BTC_USDT_Perp@500"] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Legacy Subscribe" @@ -3556,7 +3582,8 @@ STREAM: v1.trade "code": 1002, "message": "Internal Server Error" }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` **Lite Error Response** @@ -3567,7 +3594,8 @@ STREAM: v1.trade "c": 1002, "m": "Internal Server Error" }, - "i": 123 + "i": 123, + "m": "subscribe" } ``` **Legacy Error Response** @@ -3989,7 +4017,8 @@ STREAM: v1.candle "num_snapshots": [10], "first_sequence_number": [872634876] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Unsubscribe" @@ -4013,7 +4042,8 @@ STREAM: v1.candle "stream": "v1.candle", "unsubs": ["BTC_USDT_Perp@CI_1_M-TRADE"] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Legacy Subscribe" @@ -4110,7 +4140,8 @@ STREAM: v1.candle "code": 1002, "message": "Internal Server Error" }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` **Lite Error Response** @@ -4121,7 +4152,8 @@ STREAM: v1.candle "c": 1002, "m": "Internal Server Error" }, - "i": 123 + "i": 123, + "m": "subscribe" } ``` **Legacy Error Response** diff --git a/artifacts/apidocs/schemas/api_cancel_order_response.md b/artifacts/apidocs/schemas/api_cancel_order_response.md index d6cc72e..2a2cf83 100644 --- a/artifacts/apidocs/schemas/api_cancel_order_response.md +++ b/artifacts/apidocs/schemas/api_cancel_order_response.md @@ -61,14 +61,15 @@ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs| |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs| |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds| + |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs| ??? info "[OrderStatus](/../../schemas/order_status)" |Value| Description | |-|-| - |`PENDING` = 1|Order is waiting for Trigger Condition to be hit| - |`OPEN` = 2|Order is actively matching on the orderbook, could be unfilled or partially filled| - |`FILLED` = 3|Order is fully filled and hence closed| - |`REJECTED` = 4|Order is rejected by GRVT Backend since if fails a particular check (See OrderRejectReason)| - |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason)| + |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.| + |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.| + |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.| + |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.| + |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.| ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)" |Value| Description | |-|-| diff --git a/artifacts/apidocs/schemas/api_create_order_request.md b/artifacts/apidocs/schemas/api_create_order_request.md index 42ca545..e379a9b 100644 --- a/artifacts/apidocs/schemas/api_create_order_request.md +++ b/artifacts/apidocs/schemas/api_create_order_request.md @@ -63,14 +63,15 @@ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs| |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs| |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds| + |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs| ??? info "[OrderStatus](/../../schemas/order_status)" |Value| Description | |-|-| - |`PENDING` = 1|Order is waiting for Trigger Condition to be hit| - |`OPEN` = 2|Order is actively matching on the orderbook, could be unfilled or partially filled| - |`FILLED` = 3|Order is fully filled and hence closed| - |`REJECTED` = 4|Order is rejected by GRVT Backend since if fails a particular check (See OrderRejectReason)| - |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason)| + |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.| + |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.| + |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.| + |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.| + |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.| ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)" |Value| Description | |-|-| diff --git a/artifacts/apidocs/schemas/api_create_order_response.md b/artifacts/apidocs/schemas/api_create_order_response.md index bbedd45..69ab2a7 100644 --- a/artifacts/apidocs/schemas/api_create_order_response.md +++ b/artifacts/apidocs/schemas/api_create_order_response.md @@ -61,14 +61,15 @@ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs| |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs| |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds| + |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs| ??? info "[OrderStatus](/../../schemas/order_status)" |Value| Description | |-|-| - |`PENDING` = 1|Order is waiting for Trigger Condition to be hit| - |`OPEN` = 2|Order is actively matching on the orderbook, could be unfilled or partially filled| - |`FILLED` = 3|Order is fully filled and hence closed| - |`REJECTED` = 4|Order is rejected by GRVT Backend since if fails a particular check (See OrderRejectReason)| - |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason)| + |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.| + |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.| + |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.| + |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.| + |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.| ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)" |Value| Description | |-|-| diff --git a/artifacts/apidocs/schemas/api_get_order_response.md b/artifacts/apidocs/schemas/api_get_order_response.md index 8c4f278..195062b 100644 --- a/artifacts/apidocs/schemas/api_get_order_response.md +++ b/artifacts/apidocs/schemas/api_get_order_response.md @@ -61,14 +61,15 @@ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs| |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs| |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds| + |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs| ??? info "[OrderStatus](/../../schemas/order_status)" |Value| Description | |-|-| - |`PENDING` = 1|Order is waiting for Trigger Condition to be hit| - |`OPEN` = 2|Order is actively matching on the orderbook, could be unfilled or partially filled| - |`FILLED` = 3|Order is fully filled and hence closed| - |`REJECTED` = 4|Order is rejected by GRVT Backend since if fails a particular check (See OrderRejectReason)| - |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason)| + |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.| + |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.| + |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.| + |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.| + |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.| ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)" |Value| Description | |-|-| diff --git a/artifacts/apidocs/schemas/api_open_orders_response.md b/artifacts/apidocs/schemas/api_open_orders_response.md index 3efdb4d..3069ab9 100644 --- a/artifacts/apidocs/schemas/api_open_orders_response.md +++ b/artifacts/apidocs/schemas/api_open_orders_response.md @@ -63,14 +63,15 @@ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs| |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs| |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds| + |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs| ??? info "[OrderStatus](/../../schemas/order_status)" |Value| Description | |-|-| - |`PENDING` = 1|Order is waiting for Trigger Condition to be hit| - |`OPEN` = 2|Order is actively matching on the orderbook, could be unfilled or partially filled| - |`FILLED` = 3|Order is fully filled and hence closed| - |`REJECTED` = 4|Order is rejected by GRVT Backend since if fails a particular check (See OrderRejectReason)| - |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason)| + |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.| + |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.| + |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.| + |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.| + |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.| ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)" |Value| Description | |-|-| diff --git a/artifacts/apidocs/schemas/api_order_history_response.md b/artifacts/apidocs/schemas/api_order_history_response.md index c046349..1eb3d6c 100644 --- a/artifacts/apidocs/schemas/api_order_history_response.md +++ b/artifacts/apidocs/schemas/api_order_history_response.md @@ -62,14 +62,15 @@ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs| |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs| |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds| + |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs| ??? info "[OrderStatus](/../../schemas/order_status)" |Value| Description | |-|-| - |`PENDING` = 1|Order is waiting for Trigger Condition to be hit| - |`OPEN` = 2|Order is actively matching on the orderbook, could be unfilled or partially filled| - |`FILLED` = 3|Order is fully filled and hence closed| - |`REJECTED` = 4|Order is rejected by GRVT Backend since if fails a particular check (See OrderRejectReason)| - |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason)| + |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.| + |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.| + |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.| + |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.| + |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.| ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)" |Value| Description | |-|-| diff --git a/artifacts/apidocs/schemas/api_order_state_response.md b/artifacts/apidocs/schemas/api_order_state_response.md index e7925ab..235cef2 100644 --- a/artifacts/apidocs/schemas/api_order_state_response.md +++ b/artifacts/apidocs/schemas/api_order_state_response.md @@ -10,14 +10,15 @@ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs| |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs| |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds| + |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs| ??? info "[OrderStatus](/../../schemas/order_status)" |Value| Description | |-|-| - |`PENDING` = 1|Order is waiting for Trigger Condition to be hit| - |`OPEN` = 2|Order is actively matching on the orderbook, could be unfilled or partially filled| - |`FILLED` = 3|Order is fully filled and hence closed| - |`REJECTED` = 4|Order is rejected by GRVT Backend since if fails a particular check (See OrderRejectReason)| - |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason)| + |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.| + |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.| + |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.| + |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.| + |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.| ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)" |Value| Description | |-|-| diff --git a/artifacts/apidocs/schemas/internal_pre_order_margin_check_request.md b/artifacts/apidocs/schemas/internal_pre_order_margin_check_request.md new file mode 100644 index 0000000..8716cdf --- /dev/null +++ b/artifacts/apidocs/schemas/internal_pre_order_margin_check_request.md @@ -0,0 +1,22 @@ +!!! info "[InternalPreOrderMarginCheckRequest](/../../schemas/internal_pre_order_margin_check_request)" + Pre-order margin check to determine if a new order can be created for a given sub-account
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |sub_account_id
`sa` |string|True|The sub-account for which the order is being evaluated| + |open_order_legs
`oo` |[OrderLeg]|True|Open orders created by this sub-account| + |new_order_legs
`no` |[OrderLeg]|True|New orders this sub-account is attempting to create| + ??? info "[OrderLeg](/../../schemas/order_leg)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |instrument
`i` |string|True|The instrument to trade in this leg| + |size
`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.| + |limit_price
`lp` |string|False
`0`|The limit price of the order leg, expressed in `9` decimals.
This is the number of quote currency units to pay/receive for this leg.
This should be `null/0` if the order is a market order| + |is_buying_asset
`ib` |boolean|True|Specifies if the order leg is a buy or sell| + ??? info "[OrderLeg](/../../schemas/order_leg)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |instrument
`i` |string|True|The instrument to trade in this leg| + |size
`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.| + |limit_price
`lp` |string|False
`0`|The limit price of the order leg, expressed in `9` decimals.
This is the number of quote currency units to pay/receive for this leg.
This should be `null/0` if the order is a market order| + |is_buying_asset
`ib` |boolean|True|Specifies if the order leg is a buy or sell| diff --git a/artifacts/apidocs/schemas/internal_pre_order_margin_check_response.md b/artifacts/apidocs/schemas/internal_pre_order_margin_check_response.md new file mode 100644 index 0000000..3b2aab7 --- /dev/null +++ b/artifacts/apidocs/schemas/internal_pre_order_margin_check_response.md @@ -0,0 +1,4 @@ +!!! info "[InternalPreOrderMarginCheckResponse](/../../schemas/internal_pre_order_margin_check_response)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |result
`r` |boolean|True|True if the new order can be placed, false otherwise| diff --git a/artifacts/apidocs/schemas/jsonrpc_response.md b/artifacts/apidocs/schemas/jsonrpc_response.md index bac5830..05dc32f 100644 --- a/artifacts/apidocs/schemas/jsonrpc_response.md +++ b/artifacts/apidocs/schemas/jsonrpc_response.md @@ -7,6 +7,7 @@ |result
`r` |object|False
`null`|The result for the request| |error
`e` |Error|False
`null`|The error for the request| |id
`i` |integer|False
`0`|Optional Field which is used to match the response by the client.
If not passed, this field will not be returned| + |method
`m` |string|True|The method used in the request for this response (eg: `subscribe` / `unsubscribe` / `v1/instrument` )| ??? info "[Error](/../../schemas/error)" An error response
diff --git a/artifacts/apidocs/schemas/order.md b/artifacts/apidocs/schemas/order.md index 471c177..ff1b219 100644 --- a/artifacts/apidocs/schemas/order.md +++ b/artifacts/apidocs/schemas/order.md @@ -57,14 +57,15 @@ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs| |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs| |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds| + |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs| ??? info "[OrderStatus](/../../schemas/order_status)" |Value| Description | |-|-| - |`PENDING` = 1|Order is waiting for Trigger Condition to be hit| - |`OPEN` = 2|Order is actively matching on the orderbook, could be unfilled or partially filled| - |`FILLED` = 3|Order is fully filled and hence closed| - |`REJECTED` = 4|Order is rejected by GRVT Backend since if fails a particular check (See OrderRejectReason)| - |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason)| + |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.| + |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.| + |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.| + |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.| + |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.| ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)" |Value| Description | |-|-| diff --git a/artifacts/apidocs/schemas/order_state.md b/artifacts/apidocs/schemas/order_state.md index 5b1b90d..da14c22 100644 --- a/artifacts/apidocs/schemas/order_state.md +++ b/artifacts/apidocs/schemas/order_state.md @@ -6,14 +6,15 @@ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs| |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs| |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds| + |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs| ??? info "[OrderStatus](/../../schemas/order_status)" |Value| Description | |-|-| - |`PENDING` = 1|Order is waiting for Trigger Condition to be hit| - |`OPEN` = 2|Order is actively matching on the orderbook, could be unfilled or partially filled| - |`FILLED` = 3|Order is fully filled and hence closed| - |`REJECTED` = 4|Order is rejected by GRVT Backend since if fails a particular check (See OrderRejectReason)| - |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason)| + |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.| + |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.| + |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.| + |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.| + |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.| ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)" |Value| Description | |-|-| diff --git a/artifacts/apidocs/schemas/order_state_feed.md b/artifacts/apidocs/schemas/order_state_feed.md index c176bf6..b047983 100644 --- a/artifacts/apidocs/schemas/order_state_feed.md +++ b/artifacts/apidocs/schemas/order_state_feed.md @@ -12,14 +12,15 @@ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs| |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs| |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds| + |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs| ??? info "[OrderStatus](/../../schemas/order_status)" |Value| Description | |-|-| - |`PENDING` = 1|Order is waiting for Trigger Condition to be hit| - |`OPEN` = 2|Order is actively matching on the orderbook, could be unfilled or partially filled| - |`FILLED` = 3|Order is fully filled and hence closed| - |`REJECTED` = 4|Order is rejected by GRVT Backend since if fails a particular check (See OrderRejectReason)| - |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason)| + |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.| + |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.| + |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.| + |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.| + |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.| ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)" |Value| Description | |-|-| diff --git a/artifacts/apidocs/schemas/order_status.md b/artifacts/apidocs/schemas/order_status.md index 33c306c..998aa7c 100644 --- a/artifacts/apidocs/schemas/order_status.md +++ b/artifacts/apidocs/schemas/order_status.md @@ -1,8 +1,8 @@ !!! info "[OrderStatus](/../../schemas/order_status)" |Value| Description | |-|-| - |`PENDING` = 1|Order is waiting for Trigger Condition to be hit| - |`OPEN` = 2|Order is actively matching on the orderbook, could be unfilled or partially filled| - |`FILLED` = 3|Order is fully filled and hence closed| - |`REJECTED` = 4|Order is rejected by GRVT Backend since if fails a particular check (See OrderRejectReason)| - |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason)| + |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.| + |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.| + |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.| + |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.| + |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.| diff --git a/artifacts/apidocs/schemas/stream_reference.md b/artifacts/apidocs/schemas/stream_reference.md new file mode 100644 index 0000000..75dc903 --- /dev/null +++ b/artifacts/apidocs/schemas/stream_reference.md @@ -0,0 +1,5 @@ +!!! info "[StreamReference](/../../schemas/stream_reference)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |stream
`s` |string|True|The channel to subscribe to (eg: ticker.s / ticker.d)| + |selectors
`s1` |[string]|True|The list of selectors for the stream| diff --git a/artifacts/apidocs/schemas/ws_list_streams_params.md b/artifacts/apidocs/schemas/ws_list_streams_params.md new file mode 100644 index 0000000..b103006 --- /dev/null +++ b/artifacts/apidocs/schemas/ws_list_streams_params.md @@ -0,0 +1,5 @@ +!!! info "[WSListStreamsParams](/../../schemas/ws_list_streams_params)" + List down all the streams this connection has connected to.
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| diff --git a/artifacts/apidocs/schemas/ws_list_streams_result.md b/artifacts/apidocs/schemas/ws_list_streams_result.md new file mode 100644 index 0000000..a02e7cb --- /dev/null +++ b/artifacts/apidocs/schemas/ws_list_streams_result.md @@ -0,0 +1,11 @@ +!!! info "[WSListStreamsResult](/../../schemas/ws_list_streams_result)" + Returns a list of all rooms the client has subscribed to.
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |stream_reference
`sr` |[StreamReference]|True|The list of stream references the connection is connected to| + ??? info "[StreamReference](/../../schemas/stream_reference)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |stream
`s` |string|True|The channel to subscribe to (eg: ticker.s / ticker.d)| + |selectors
`s1` |[string]|True|The list of selectors for the stream| diff --git a/artifacts/apidocs/schemas/ws_order_feed_data_v1.md b/artifacts/apidocs/schemas/ws_order_feed_data_v1.md index b6e4676..f2eac92 100644 --- a/artifacts/apidocs/schemas/ws_order_feed_data_v1.md +++ b/artifacts/apidocs/schemas/ws_order_feed_data_v1.md @@ -64,14 +64,15 @@ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs| |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs| |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds| + |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs| ??? info "[OrderStatus](/../../schemas/order_status)" |Value| Description | |-|-| - |`PENDING` = 1|Order is waiting for Trigger Condition to be hit| - |`OPEN` = 2|Order is actively matching on the orderbook, could be unfilled or partially filled| - |`FILLED` = 3|Order is fully filled and hence closed| - |`REJECTED` = 4|Order is rejected by GRVT Backend since if fails a particular check (See OrderRejectReason)| - |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason)| + |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.| + |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.| + |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.| + |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.| + |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.| ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)" |Value| Description | |-|-| diff --git a/artifacts/apidocs/schemas/ws_order_state_feed_data_v1.md b/artifacts/apidocs/schemas/ws_order_state_feed_data_v1.md index 2891f21..f0c6b90 100644 --- a/artifacts/apidocs/schemas/ws_order_state_feed_data_v1.md +++ b/artifacts/apidocs/schemas/ws_order_state_feed_data_v1.md @@ -19,14 +19,15 @@ |book_size
`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs| |traded_size
`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs| |update_time
`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds| + |avg_fill_price
`af` |[string]|True|The average fill price of the order. Sorted in same order as Order.Legs| ??? info "[OrderStatus](/../../schemas/order_status)" |Value| Description | |-|-| - |`PENDING` = 1|Order is waiting for Trigger Condition to be hit| - |`OPEN` = 2|Order is actively matching on the orderbook, could be unfilled or partially filled| - |`FILLED` = 3|Order is fully filled and hence closed| - |`REJECTED` = 4|Order is rejected by GRVT Backend since if fails a particular check (See OrderRejectReason)| - |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason)| + |`PENDING` = 1|Order has been sent to the matching engine and is pending a transition to open/filled/rejected.| + |`OPEN` = 2|Order is actively matching on the matching engine, could be unfilled or partially filled.| + |`FILLED` = 3|Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.| + |`REJECTED` = 4|Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.| + |`CANCELLED` = 5|Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.| ??? info "[OrderRejectReason](/../../schemas/order_reject_reason)" |Value| Description | |-|-| diff --git a/artifacts/apidocs/schemas/ws_unsubscribe_all_params.md b/artifacts/apidocs/schemas/ws_unsubscribe_all_params.md new file mode 100644 index 0000000..1e1636d --- /dev/null +++ b/artifacts/apidocs/schemas/ws_unsubscribe_all_params.md @@ -0,0 +1,5 @@ +!!! info "[WSUnsubscribeAllParams](/../../schemas/ws_unsubscribe_all_params)" + All V1 Websocket Unsubscription Request to unsubscribe from all active websocket streams.
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| diff --git a/artifacts/apidocs/schemas/ws_unsubscribe_all_result.md b/artifacts/apidocs/schemas/ws_unsubscribe_all_result.md new file mode 100644 index 0000000..aae2c8e --- /dev/null +++ b/artifacts/apidocs/schemas/ws_unsubscribe_all_result.md @@ -0,0 +1,11 @@ +!!! info "[WSUnsubscribeAllResult](/../../schemas/ws_unsubscribe_all_result)" + Returns a list of all rooms the client has unsubscribed from.
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |stream_reference
`sr` |[StreamReference]|True|The list of stream references unsubscribed from| + ??? info "[StreamReference](/../../schemas/stream_reference)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |stream
`s` |string|True|The channel to subscribe to (eg: ticker.s / ticker.d)| + |selectors
`s1` |[string]|True|The list of selectors for the stream| diff --git a/artifacts/apidocs/trading_api.md b/artifacts/apidocs/trading_api.md index 7952603..6bcaf5e 100644 --- a/artifacts/apidocs/trading_api.md +++ b/artifacts/apidocs/trading_api.md @@ -114,7 +114,8 @@ LITE ENDPOINT: lite/v1/create_order "reject_reason": "CLIENT_CANCEL", "book_size": ["10.5"], "traded_size": ["1.5"], - "update_time": "1697788800000000000" + "update_time": "1697788800000000000", + "avg_fill_price": ["60000.4"] } } } @@ -152,7 +153,8 @@ LITE ENDPOINT: lite/v1/create_order "rr": "CLIENT_CANCEL", "bs": ["10.5"], "ts": ["1.5"], - "ut": "1697788800000000000" + "ut": "1697788800000000000", + "af": ["60000.4"] } } } @@ -1560,7 +1562,8 @@ LITE ENDPOINT: lite/v1/order "reject_reason": "CLIENT_CANCEL", "book_size": ["10.5"], "traded_size": ["1.5"], - "update_time": "1697788800000000000" + "update_time": "1697788800000000000", + "avg_fill_price": ["60000.4"] } } } @@ -1598,7 +1601,8 @@ LITE ENDPOINT: lite/v1/order "rr": "CLIENT_CANCEL", "bs": ["10.5"], "ts": ["1.5"], - "ut": "1697788800000000000" + "ut": "1697788800000000000", + "af": ["60000.4"] } } } @@ -1954,7 +1958,8 @@ LITE ENDPOINT: lite/v1/open_orders "reject_reason": "CLIENT_CANCEL", "book_size": ["10.5"], "traded_size": ["1.5"], - "update_time": "1697788800000000000" + "update_time": "1697788800000000000", + "avg_fill_price": ["60000.4"] } }] } @@ -1992,7 +1997,8 @@ LITE ENDPOINT: lite/v1/open_orders "rr": "CLIENT_CANCEL", "bs": ["10.5"], "ts": ["1.5"], - "ut": "1697788800000000000" + "ut": "1697788800000000000", + "af": ["60000.4"] } }] } @@ -2370,7 +2376,8 @@ LITE ENDPOINT: lite/v1/order_history "reject_reason": "CLIENT_CANCEL", "book_size": ["10.5"], "traded_size": ["1.5"], - "update_time": "1697788800000000000" + "update_time": "1697788800000000000", + "avg_fill_price": ["60000.4"] } }], "next": "Qw0918=" @@ -2409,7 +2416,8 @@ LITE ENDPOINT: lite/v1/order_history "rr": "CLIENT_CANCEL", "bs": ["10.5"], "ts": ["1.5"], - "ut": "1697788800000000000" + "ut": "1697788800000000000", + "af": ["60000.4"] } }], "n": "Qw0918=" diff --git a/artifacts/apidocs/trading_streams.md b/artifacts/apidocs/trading_streams.md index d8773e5..45a2633 100644 --- a/artifacts/apidocs/trading_streams.md +++ b/artifacts/apidocs/trading_streams.md @@ -44,7 +44,8 @@ STREAM: v1.order "num_snapshots": [10], "first_sequence_number": [872634876] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Unsubscribe" @@ -68,7 +69,8 @@ STREAM: v1.order "stream": "v1.order", "unsubs": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Legacy Subscribe" @@ -136,7 +138,8 @@ STREAM: v1.order "reject_reason": "CLIENT_CANCEL", "book_size": ["10.5"], "traded_size": ["1.5"], - "update_time": "1697788800000000000" + "update_time": "1697788800000000000", + "avg_fill_price": ["60000.4"] } } } @@ -177,7 +180,8 @@ STREAM: v1.order "rr": "CLIENT_CANCEL", "bs": ["10.5"], "ts": ["1.5"], - "ut": "1697788800000000000" + "ut": "1697788800000000000", + "af": ["60000.4"] } } } @@ -208,7 +212,8 @@ STREAM: v1.order "code": 1000, "message": "You need to authenticate prior to using this functionality" }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` **Lite Error Response** @@ -219,7 +224,8 @@ STREAM: v1.order "c": 1000, "m": "You need to authenticate prior to using this functionality" }, - "i": 123 + "i": 123, + "m": "subscribe" } ``` **Legacy Error Response** @@ -665,7 +671,8 @@ STREAM: v1.state "num_snapshots": [10], "first_sequence_number": [872634876] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Unsubscribe" @@ -689,7 +696,8 @@ STREAM: v1.state "stream": "v1.state", "unsubs": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Legacy Subscribe" @@ -735,7 +743,8 @@ STREAM: v1.state "reject_reason": "CLIENT_CANCEL", "book_size": ["10.5"], "traded_size": ["1.5"], - "update_time": "1697788800000000000" + "update_time": "1697788800000000000", + "avg_fill_price": ["60000.4"] } } } @@ -754,7 +763,8 @@ STREAM: v1.state "rr": "CLIENT_CANCEL", "bs": ["10.5"], "ts": ["1.5"], - "ut": "1697788800000000000" + "ut": "1697788800000000000", + "af": ["60000.4"] } } } @@ -785,7 +795,8 @@ STREAM: v1.state "code": 1000, "message": "You need to authenticate prior to using this functionality" }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` **Lite Error Response** @@ -796,7 +807,8 @@ STREAM: v1.state "c": 1000, "m": "You need to authenticate prior to using this functionality" }, - "i": 123 + "i": 123, + "m": "subscribe" } ``` **Legacy Error Response** @@ -1243,7 +1255,8 @@ STREAM: v1.fill "num_snapshots": [10], "first_sequence_number": [872634876] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Unsubscribe" @@ -1267,7 +1280,8 @@ STREAM: v1.fill "stream": "v1.fill", "unsubs": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Legacy Subscribe" @@ -1381,7 +1395,8 @@ STREAM: v1.fill "code": 1000, "message": "You need to authenticate prior to using this functionality" }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` **Lite Error Response** @@ -1392,7 +1407,8 @@ STREAM: v1.fill "c": 1000, "m": "You need to authenticate prior to using this functionality" }, - "i": 123 + "i": 123, + "m": "subscribe" } ``` **Legacy Error Response** @@ -1838,7 +1854,8 @@ STREAM: v1.position "num_snapshots": [10], "first_sequence_number": [872634876] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Unsubscribe" @@ -1862,7 +1879,8 @@ STREAM: v1.position "stream": "v1.position", "unsubs": ["'$GRVT_SUB_ACCOUNT_ID'-BTC_USDT_Perp"] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Legacy Subscribe" @@ -1966,7 +1984,8 @@ STREAM: v1.position "code": 1000, "message": "You need to authenticate prior to using this functionality" }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` **Lite Error Response** @@ -1977,7 +1996,8 @@ STREAM: v1.position "c": 1000, "m": "You need to authenticate prior to using this functionality" }, - "i": 123 + "i": 123, + "m": "subscribe" } ``` **Legacy Error Response** @@ -2424,7 +2444,8 @@ STREAM: v1.deposit "num_snapshots": [10], "first_sequence_number": [872634876] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Unsubscribe" @@ -2448,7 +2469,8 @@ STREAM: v1.deposit "stream": "v1.deposit", "unsubs": ["'$GRVT_MAIN_ACCOUNT_ID'"] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Legacy Subscribe" @@ -2530,7 +2552,8 @@ STREAM: v1.deposit "code": 1001, "message": "You are not authorized to access this functionality" }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` **Lite Error Response** @@ -2541,7 +2564,8 @@ STREAM: v1.deposit "c": 1001, "m": "You are not authorized to access this functionality" }, - "i": 123 + "i": 123, + "m": "subscribe" } ``` **Legacy Error Response** @@ -2987,7 +3011,8 @@ STREAM: v1.transfer "num_snapshots": [10], "first_sequence_number": [872634876] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Unsubscribe" @@ -3011,7 +3036,8 @@ STREAM: v1.transfer "stream": "v1.transfer", "unsubs": ["'$GRVT_MAIN_ACCOUNT_ID'-'$GRVT_SUB_ACCOUNT_ID'"] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Legacy Subscribe" @@ -3114,7 +3140,8 @@ STREAM: v1.transfer "code": 1001, "message": "You are not authorized to access this functionality" }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` **Lite Error Response** @@ -3125,7 +3152,8 @@ STREAM: v1.transfer "c": 1001, "m": "You are not authorized to access this functionality" }, - "i": 123 + "i": 123, + "m": "subscribe" } ``` **Legacy Error Response** @@ -3571,7 +3599,8 @@ STREAM: v1.withdrawal "num_snapshots": [10], "first_sequence_number": [872634876] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Unsubscribe" @@ -3595,7 +3624,8 @@ STREAM: v1.withdrawal "stream": "v1.withdrawal", "unsubs": ["'$GRVT_MAIN_ACCOUNT_ID'"] }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` ??? question "Legacy Subscribe" @@ -3693,7 +3723,8 @@ STREAM: v1.withdrawal "code": 1001, "message": "You are not authorized to access this functionality" }, - "id": 123 + "id": 123, + "method": "subscribe" } ``` **Lite Error Response** @@ -3704,7 +3735,8 @@ STREAM: v1.withdrawal "c": 1001, "m": "You are not authorized to access this functionality" }, - "i": 123 + "i": 123, + "m": "subscribe" } ``` **Legacy Error Response** diff --git a/artifacts/pysdk/grvt_raw_types.py b/artifacts/pysdk/grvt_raw_types.py index 9695b0c..331c4b1 100644 --- a/artifacts/pysdk/grvt_raw_types.py +++ b/artifacts/pysdk/grvt_raw_types.py @@ -162,15 +162,15 @@ class OrderRejectReason(Enum): class OrderStatus(Enum): - # Order is waiting for Trigger Condition to be hit + # Order has been sent to the matching engine and is pending a transition to open/filled/rejected. PENDING = "PENDING" - # Order is actively matching on the orderbook, could be unfilled or partially filled + # Order is actively matching on the matching engine, could be unfilled or partially filled. OPEN = "OPEN" - # Order is fully filled and hence closed + # Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open. FILLED = "FILLED" - # Order is rejected by GRVT Backend since if fails a particular check (See OrderRejectReason) + # Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected. REJECTED = "REJECTED" - # Order is cancelled by the user using one of the supported APIs (See OrderRejectReason) + # Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled. CANCELLED = "CANCELLED" @@ -982,6 +982,8 @@ class JSONRPCResponse: # The JSON RPC version to use for the request jsonrpc: str + # The method used in the request for this response (eg: `subscribe` / `unsubscribe` / `v1/instrument` ) + method: str # The result for the request result: Any | None = None # The error for the request @@ -1250,6 +1252,36 @@ class WSCandlestickFeedDataV1: feed: Candlestick +@dataclass +class WSUnsubscribeAllParams: + pass + + +@dataclass +class StreamReference: + # The channel to subscribe to (eg: ticker.s / ticker.d) + stream: str + # The list of selectors for the stream + selectors: list[str] + + +@dataclass +class WSUnsubscribeAllResult: + # The list of stream references unsubscribed from + stream_reference: list[StreamReference] + + +@dataclass +class WSListStreamsParams: + pass + + +@dataclass +class WSListStreamsResult: + # The list of stream references the connection is connected to + stream_reference: list[StreamReference] + + @dataclass class ApiGetAllInstrumentsRequest: # Fetch only active instruments @@ -1334,6 +1366,8 @@ class OrderState: traded_size: list[str] # Time at which the order was updated by GRVT, expressed in unix nanoseconds update_time: str + # The average fill price of the order. Sorted in same order as Order.Legs + avg_fill_price: list[str] @dataclass @@ -1542,6 +1576,22 @@ class ApiGetOrderResponse: result: Order +@dataclass +class InternalPreOrderMarginCheckRequest: + # The sub-account for which the order is being evaluated + sub_account_id: str + # Open orders created by this sub-account + open_order_legs: list[OrderLeg] + # New orders this sub-account is attempting to create + new_order_legs: list[OrderLeg] + + +@dataclass +class InternalPreOrderMarginCheckResponse: + # True if the new order can be placed, false otherwise + result: bool + + @dataclass class ApiGetUserEcosystemPointRequest: # The off chain account id diff --git a/src/codegen/apispec.json b/src/codegen/apispec.json index 705dd4b..e7b0cf5 100644 --- a/src/codegen/apispec.json +++ b/src/codegen/apispec.json @@ -4985,6 +4985,19 @@ "Optional Field which is used to match the response by the client.", "If not passed, this field will not be returned" ] + }, + { + "name": "method", + "lite_name": "m", + "semantic_type": "string", + "json_type": "string", + "index": 4, + "array_depth": 0, + "optional": false, + "example": "'subscribe'", + "comment": [ + "The method used in the request for this response (eg: `subscribe` / `unsubscribe` / `v1/instrument` )" + ] } ], "comment": [ @@ -5891,6 +5904,97 @@ ], "comment": [] }, + { + "name": "WSUnsubscribeAllParams", + "is_root": true, + "fields": [], + "comment": [ + "All V1 Websocket Unsubscription Request to unsubscribe from all active websocket streams." + ] + }, + { + "name": "StreamReference", + "is_root": false, + "fields": [ + { + "name": "stream", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "'v1.ticker.d'", + "comment": [ + "The channel to subscribe to (eg: ticker.s / ticker.d)" + ] + }, + { + "name": "selectors", + "lite_name": "s1", + "semantic_type": "string", + "json_type": "string", + "index": 1, + "array_depth": 1, + "optional": false, + "example": "['BTC_USDT_Perp', 'ETH_USDT_Perp']", + "comment": [ + "The list of selectors for the stream" + ] + } + ], + "comment": [] + }, + { + "name": "WSUnsubscribeAllResult", + "is_root": true, + "fields": [ + { + "name": "stream_reference", + "lite_name": "sr", + "semantic_type": "StreamReference", + "json_type": "StreamReference", + "index": 0, + "array_depth": 1, + "optional": false, + "comment": [ + "The list of stream references unsubscribed from" + ] + } + ], + "comment": [ + "Returns a list of all rooms the client has unsubscribed from." + ] + }, + { + "name": "WSListStreamsParams", + "is_root": true, + "fields": [], + "comment": [ + "List down all the streams this connection has connected to." + ] + }, + { + "name": "WSListStreamsResult", + "is_root": true, + "fields": [ + { + "name": "stream_reference", + "lite_name": "sr", + "semantic_type": "StreamReference", + "json_type": "StreamReference", + "index": 0, + "array_depth": 1, + "optional": false, + "comment": [ + "The list of stream references the connection is connected to" + ] + } + ], + "comment": [ + "Returns a list of all rooms the client has subscribed to." + ] + }, { "name": "ApiGetAllInstrumentsRequest", "is_root": true, @@ -6195,6 +6299,19 @@ "comment": [ "Time at which the order was updated by GRVT, expressed in unix nanoseconds" ] + }, + { + "name": "avg_fill_price", + "lite_name": "af", + "semantic_type": "string", + "json_type": "string", + "index": 5, + "array_depth": 1, + "optional": false, + "example": "['60000.4']", + "comment": [ + "The average fill price of the order. Sorted in same order as Order.Legs" + ] } ], "comment": [] @@ -6978,6 +7095,71 @@ ], "comment": [] }, + { + "name": "InternalPreOrderMarginCheckRequest", + "is_root": true, + "fields": [ + { + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", + "json_type": "string", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "'$GRVT_SUB_ACCOUNT_ID'", + "comment": [ + "The sub-account for which the order is being evaluated" + ] + }, + { + "name": "open_order_legs", + "lite_name": "oo", + "semantic_type": "OrderLeg", + "json_type": "OrderLeg", + "index": 1, + "array_depth": 1, + "optional": false, + "comment": [ + "Open orders created by this sub-account" + ] + }, + { + "name": "new_order_legs", + "lite_name": "no", + "semantic_type": "OrderLeg", + "json_type": "OrderLeg", + "index": 2, + "array_depth": 1, + "optional": false, + "comment": [ + "New orders this sub-account is attempting to create" + ] + } + ], + "comment": [ + "Pre-order margin check to determine if a new order can be created for a given sub-account" + ] + }, + { + "name": "InternalPreOrderMarginCheckResponse", + "is_root": true, + "fields": [ + { + "name": "result", + "lite_name": "r", + "semantic_type": "bool", + "json_type": "boolean", + "index": 0, + "array_depth": 0, + "optional": false, + "comment": [ + "True if the new order can be placed, false otherwise" + ] + } + ], + "comment": [] + }, { "name": "ApiGetUserEcosystemPointRequest", "is_root": true, @@ -11291,35 +11473,35 @@ "name": "PENDING", "value": 1, "comment": [ - "Order is waiting for Trigger Condition to be hit" + "Order has been sent to the matching engine and is pending a transition to open/filled/rejected." ] }, { "name": "OPEN", "value": 2, "comment": [ - "Order is actively matching on the orderbook, could be unfilled or partially filled" + "Order is actively matching on the matching engine, could be unfilled or partially filled." ] }, { "name": "FILLED", "value": 3, "comment": [ - "Order is fully filled and hence closed" + "Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open." ] }, { "name": "REJECTED", "value": 4, "comment": [ - "Order is rejected by GRVT Backend since if fails a particular check (See OrderRejectReason)" + "Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected." ] }, { "name": "CANCELLED", "value": 5, "comment": [ - "Order is cancelled by the user using one of the supported APIs (See OrderRejectReason)" + "Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled." ] } ],