diff --git a/artifacts/apidocs/schemas/api_cancel_order_response.md b/artifacts/apidocs/schemas/api_cancel_order_response.md
index e967957..b2d6913 100644
--- a/artifacts/apidocs/schemas/api_cancel_order_response.md
+++ b/artifacts/apidocs/schemas/api_cancel_order_response.md
@@ -53,6 +53,46 @@
|-|-|-|-|
|client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|True|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name
`Lite`|Type|Required
`Default`| Description |
|-|-|-|-|
@@ -103,3 +143,4 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/schemas/api_create_bulk_orders_request.md b/artifacts/apidocs/schemas/api_create_bulk_orders_request.md
new file mode 100644
index 0000000..7a47e14
--- /dev/null
+++ b/artifacts/apidocs/schemas/api_create_bulk_orders_request.md
@@ -0,0 +1,148 @@
+!!! info "[ApiCreateBulkOrdersRequest](/../../schemas/api_create_bulk_orders_request)"
+ Create multiple orders simultaneously for this trading account.
This endpoint supports the following order scenarios:
- One-Cancels-Other (OCO) orders combining TP/SL
- One-Sends-Other (OSO) orders
Usage:
- For OCO (TP/SL pair): Send exactly 2 orders in the same request - one Take Profit and one Stop Loss order
- For OSO: Send exactly one main order and one contingent order (TP and/or SL)
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |orders
`o` |[Order]|True|The orders to create|
+ ??? info "[Order](/../../schemas/order)"
+ Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.
GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.
This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.
Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.
All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.
This minimizes the amount of trust users have to offer to GRVT
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order_id
`oi` |string|False
`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |sub_account_id
`sa` |string|True|The subaccount initiating the order|
+ |is_market
`im` |boolean|False
`false`|If the order is a market order
Market Orders do not have a limit price, and are always executed according to the maker order price.
Market Orders must always be taker orders|
+ |time_in_force
`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:
- PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg
- FULL EXECUTION = AON / FOK - only allows full size execution on all legs
- TAKER ONLY = IOC / FOK - only allows taker orders
- MAKER OR TAKER = GTT / AON - allows maker or taker orders
Exchange only supports (GTT, IOC, FOK)
RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
+ |post_only
`po` |boolean|False
`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.
If False, Order can be either a maker or taker order.
| | Must Fill All | Can Fill Partial |
| - | - | - |
| Must Be Taker | FOK + False | IOC + False |
| Can Be Either | AON + False | GTC + False |
| Must Be Maker | AON + True | GTC + True |
|
+ |reduce_only
`ro` |boolean|False
`false`|If True, Order must reduce the position size, or be cancelled|
+ |legs
`l` |[OrderLeg]|True|The legs present in this order
The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
+ |signature
`s` |Signature|True|The signature approving this order|
+ |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
+ |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client|
+ ??? info "[TimeInForce](/../../schemas/time_in_force)"
+ | | Must Fill All | Can Fill Partial |
+ | - | - | - |
+ | Must Fill Immediately | FOK | IOC |
+ | Can Fill Till Time | AON | GTC |
+
+
+ |Value| Description |
+ |-|-|
+ |`GOOD_TILL_TIME` = 1|GTT - Remains open until it is cancelled, or expired|
+ |`ALL_OR_NONE` = 2|AON - Either fill the whole order or none of it (Block Trades Only)|
+ |`IMMEDIATE_OR_CANCEL` = 3|IOC - Fill the order as much as possible, when hitting the orderbook. Then cancel it|
+ |`FILL_OR_KILL` = 4|FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it|
+ ??? 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 "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[OrderMetadata](/../../schemas/order_metadata)"
+ Metadata fields are used to support Backend only operations. These operations are not trustless by nature.
Hence, fields in here are never signed, and is never transmitted to the smart contract.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|True|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |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 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 |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/schemas/api_create_bulk_orders_response.md b/artifacts/apidocs/schemas/api_create_bulk_orders_response.md
new file mode 100644
index 0000000..fda025e
--- /dev/null
+++ b/artifacts/apidocs/schemas/api_create_bulk_orders_response.md
@@ -0,0 +1,146 @@
+!!! info "[ApiCreateBulkOrdersResponse](/../../schemas/api_create_bulk_orders_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[Order]|True|The created orders in same order as requested|
+ ??? info "[Order](/../../schemas/order)"
+ Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.
GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.
This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.
Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.
All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.
This minimizes the amount of trust users have to offer to GRVT
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |order_id
`oi` |string|False
`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
+ |sub_account_id
`sa` |string|True|The subaccount initiating the order|
+ |is_market
`im` |boolean|False
`false`|If the order is a market order
Market Orders do not have a limit price, and are always executed according to the maker order price.
Market Orders must always be taker orders|
+ |time_in_force
`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:
- PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg
- FULL EXECUTION = AON / FOK - only allows full size execution on all legs
- TAKER ONLY = IOC / FOK - only allows taker orders
- MAKER OR TAKER = GTT / AON - allows maker or taker orders
Exchange only supports (GTT, IOC, FOK)
RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
+ |post_only
`po` |boolean|False
`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.
If False, Order can be either a maker or taker order.
| | Must Fill All | Can Fill Partial |
| - | - | - |
| Must Be Taker | FOK + False | IOC + False |
| Can Be Either | AON + False | GTC + False |
| Must Be Maker | AON + True | GTC + True |
|
+ |reduce_only
`ro` |boolean|False
`false`|If True, Order must reduce the position size, or be cancelled|
+ |legs
`l` |[OrderLeg]|True|The legs present in this order
The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
+ |signature
`s` |Signature|True|The signature approving this order|
+ |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
+ |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client|
+ ??? info "[TimeInForce](/../../schemas/time_in_force)"
+ | | Must Fill All | Can Fill Partial |
+ | - | - | - |
+ | Must Fill Immediately | FOK | IOC |
+ | Can Fill Till Time | AON | GTC |
+
+
+ |Value| Description |
+ |-|-|
+ |`GOOD_TILL_TIME` = 1|GTT - Remains open until it is cancelled, or expired|
+ |`ALL_OR_NONE` = 2|AON - Either fill the whole order or none of it (Block Trades Only)|
+ |`IMMEDIATE_OR_CANCEL` = 3|IOC - Fill the order as much as possible, when hitting the orderbook. Then cancel it|
+ |`FILL_OR_KILL` = 4|FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it|
+ ??? 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 "[Signature](/../../schemas/signature)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |signer
`s` |string|True|The address (public key) of the wallet signing the payload|
+ |r
`r` |string|True|Signature R|
+ |s
`s1` |string|True|Signature S|
+ |v
`v` |integer|True|Signature V|
+ |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
+ |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.|
+ ??? info "[OrderMetadata](/../../schemas/order_metadata)"
+ Metadata fields are used to support Backend only operations. These operations are not trustless by nature.
Hence, fields in here are never signed, and is never transmitted to the smart contract.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
+ |create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|True|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
+ ??? info "[OrderState](/../../schemas/order_state)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |status
`s` |OrderStatus|True|The status of the order|
+ |reject_reason
`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
+ |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 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 |
+ |-|-|
+ |`UNSPECIFIED` = 0|order is not cancelled or rejected|
+ |`CLIENT_CANCEL` = 1|client called a Cancel API|
+ |`CLIENT_BULK_CANCEL` = 2|client called a Bulk Cancel API|
+ |`CLIENT_SESSION_END` = 3|client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'|
+ |`MARKET_CANCEL` = 4|the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons|
+ |`IOC_CANCEL` = 5|the IOC order was cancelled after no/partial fill|
+ |`AON_CANCEL` = 6|the AON order was cancelled as it could not be fully matched|
+ |`FOK_CANCEL` = 7|the FOK order was cancelled as it could not be fully matched|
+ |`EXPIRED` = 8|the order was cancelled as it has expired|
+ |`FAIL_POST_ONLY` = 9|the post-only order could not be posted into the orderbook|
+ |`FAIL_REDUCE_ONLY` = 10|the reduce-only order would have caused position size to increase|
+ |`MM_PROTECTION` = 11|the order was cancelled due to market maker protection trigger|
+ |`SELF_TRADE_PROTECTION` = 12|the order was cancelled due to self-trade protection trigger|
+ |`SELF_MATCHED_SUBACCOUNT` = 13|the order matched with another order from the same sub account|
+ |`OVERLAPPING_CLIENT_ORDER_ID` = 14|an active order on your sub account shares the same clientOrderId|
+ |`BELOW_MARGIN` = 15|the order will bring the sub account below initial margin requirement|
+ |`LIQUIDATION` = 16|the sub account is liquidated (and all open orders are cancelled by Gravity)|
+ |`INSTRUMENT_INVALID` = 17|instrument is invalid or not found on Gravity|
+ |`INSTRUMENT_DEACTIVATED` = 18|instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)|
+ |`SYSTEM_FAILOVER` = 19|system failover resulting in loss of order state|
+ |`UNAUTHORISED` = 20|the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action|
+ |`SESSION_KEY_EXPIRED` = 21|the session key used to sign the order expired|
+ |`SUB_ACCOUNT_NOT_FOUND` = 22|the subaccount does not exist|
+ |`NO_TRADE_PERMISSION` = 23|the signature used to sign the order has no trade permission|
+ |`UNSUPPORTED_TIME_IN_FORCE` = 24|the order payload does not contain a supported TimeInForce value|
+ |`MULTI_LEGGED_ORDER` = 25|the order has multiple legs, but multiple legs are not supported by this venue|
+ |`EXCEED_MAX_POSITION_SIZE` = 26|the order would have caused the subaccount to exceed the max position size|
+ |`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
+ |`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
+ |`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/schemas/api_create_order_request.md b/artifacts/apidocs/schemas/api_create_order_request.md
index 3f557d4..77402c4 100644
--- a/artifacts/apidocs/schemas/api_create_order_request.md
+++ b/artifacts/apidocs/schemas/api_create_order_request.md
@@ -55,6 +55,46 @@
|-|-|-|-|
|client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|True|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name
`Lite`|Type|Required
`Default`| Description |
|-|-|-|-|
@@ -105,3 +145,4 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/schemas/api_create_order_response.md b/artifacts/apidocs/schemas/api_create_order_response.md
index 362e43b..9b8ef77 100644
--- a/artifacts/apidocs/schemas/api_create_order_response.md
+++ b/artifacts/apidocs/schemas/api_create_order_response.md
@@ -53,6 +53,46 @@
|-|-|-|-|
|client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|True|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name
`Lite`|Type|Required
`Default`| Description |
|-|-|-|-|
@@ -103,3 +143,4 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/schemas/api_fill_history_response.md b/artifacts/apidocs/schemas/api_fill_history_response.md
index 324b7c7..89dcb83 100644
--- a/artifacts/apidocs/schemas/api_fill_history_response.md
+++ b/artifacts/apidocs/schemas/api_fill_history_response.md
@@ -25,6 +25,7 @@
|venue
`v` |Venue|True|The venue where the trade occurred|
|client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|signer
`s1` |string|True|The address (public key) of the wallet signing the payload|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
??? info "[Venue](/../../schemas/venue)"
The list of Trading Venues that are supported on the GRVT exchange
@@ -32,3 +33,11 @@
|-|-|
|`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
|`RFQ` = 2|the trade is cleared on the RFQ venue|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
diff --git a/artifacts/apidocs/schemas/api_get_ecosystem_leaderboard_response.md b/artifacts/apidocs/schemas/api_get_ecosystem_leaderboard_response.md
index 4e64a5b..d634da8 100644
--- a/artifacts/apidocs/schemas/api_get_ecosystem_leaderboard_response.md
+++ b/artifacts/apidocs/schemas/api_get_ecosystem_leaderboard_response.md
@@ -18,3 +18,4 @@
|calculate_from
`cf` |string|True|Start time of the epoch - phase|
|calculate_to
`ct` |string|True|End time of the epoch - phase|
|rank
`r` |integer|True|The rank of the account in the ecosystem|
+ |epoch
`e` |integer|True|The epoch number of the ecosystem point|
diff --git a/artifacts/apidocs/schemas/api_get_order_group_request.md b/artifacts/apidocs/schemas/api_get_order_group_request.md
new file mode 100644
index 0000000..455548f
--- /dev/null
+++ b/artifacts/apidocs/schemas/api_get_order_group_request.md
@@ -0,0 +1,6 @@
+!!! info "[ApiGetOrderGroupRequest](/../../schemas/api_get_order_group_request)"
+ Retrieves the grouping of non-cancelled, non-filled client orders for a given subaccount when the grouping exist.
helping to identify TP/SL pairs or other order relationships within the account.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID for which the order groups should be retrieved.|
diff --git a/artifacts/apidocs/schemas/api_get_order_group_response.md b/artifacts/apidocs/schemas/api_get_order_group_response.md
new file mode 100644
index 0000000..026f886
--- /dev/null
+++ b/artifacts/apidocs/schemas/api_get_order_group_response.md
@@ -0,0 +1,12 @@
+!!! info "[ApiGetOrderGroupResponse](/../../schemas/api_get_order_group_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[ClientOrderIDsByGroup]|True|A list of client orders grouped by their associated order group.
Each entry in the list contains a `groupID` and the corresponding `clientOrderID`s
that belong to that group.|
+ ??? info "[ClientOrderIDsByGroup](/../../schemas/client_order_i_ds_by_group)"
+ Grouping for the client order id and their associated groups.
This is used to define TP/SL pairs or other order groupings after loading the list of Open Orders.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |group_id
`gi` |string|True|The group this order belongs to. It can be used to define TP/SL pairs or other order groupings|
+ |client_order_id
`co` |[string]|True|List of client order IDs in the group|
+ |sub_account_id
`sa` |string|True|The sub account ID that these orders belong to|
diff --git a/artifacts/apidocs/schemas/api_get_order_response.md b/artifacts/apidocs/schemas/api_get_order_response.md
index d859544..af5d91d 100644
--- a/artifacts/apidocs/schemas/api_get_order_response.md
+++ b/artifacts/apidocs/schemas/api_get_order_response.md
@@ -53,6 +53,46 @@
|-|-|-|-|
|client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|True|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name
`Lite`|Type|Required
`Default`| Description |
|-|-|-|-|
@@ -103,3 +143,4 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/schemas/api_get_user_ecosystem_point_response.md b/artifacts/apidocs/schemas/api_get_user_ecosystem_point_response.md
index 7e355ca..3c13b88 100644
--- a/artifacts/apidocs/schemas/api_get_user_ecosystem_point_response.md
+++ b/artifacts/apidocs/schemas/api_get_user_ecosystem_point_response.md
@@ -18,3 +18,4 @@
|calculate_from
`cf` |string|True|Start time of the epoch - phase|
|calculate_to
`ct` |string|True|End time of the epoch - phase|
|rank
`r` |integer|True|The rank of the account in the ecosystem|
+ |epoch
`e` |integer|True|The epoch number of the ecosystem point|
diff --git a/artifacts/apidocs/schemas/api_open_orders_response.md b/artifacts/apidocs/schemas/api_open_orders_response.md
index c36cd86..992eb47 100644
--- a/artifacts/apidocs/schemas/api_open_orders_response.md
+++ b/artifacts/apidocs/schemas/api_open_orders_response.md
@@ -55,6 +55,46 @@
|-|-|-|-|
|client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|True|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name
`Lite`|Type|Required
`Default`| Description |
|-|-|-|-|
@@ -105,3 +145,4 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/schemas/api_order_history_response.md b/artifacts/apidocs/schemas/api_order_history_response.md
index 153d886..b3d777e 100644
--- a/artifacts/apidocs/schemas/api_order_history_response.md
+++ b/artifacts/apidocs/schemas/api_order_history_response.md
@@ -54,6 +54,46 @@
|-|-|-|-|
|client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|True|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name
`Lite`|Type|Required
`Default`| Description |
|-|-|-|-|
@@ -104,3 +144,4 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/schemas/api_order_state_response.md b/artifacts/apidocs/schemas/api_order_state_response.md
index 2744a2f..05407ad 100644
--- a/artifacts/apidocs/schemas/api_order_state_response.md
+++ b/artifacts/apidocs/schemas/api_order_state_response.md
@@ -52,3 +52,4 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/schemas/api_pre_order_check_request.md b/artifacts/apidocs/schemas/api_pre_order_check_request.md
index 2065c6a..38cb85d 100644
--- a/artifacts/apidocs/schemas/api_pre_order_check_request.md
+++ b/artifacts/apidocs/schemas/api_pre_order_check_request.md
@@ -56,6 +56,46 @@
|-|-|-|-|
|client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|True|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name
`Lite`|Type|Required
`Default`| Description |
|-|-|-|-|
@@ -106,3 +146,4 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/schemas/api_sub_account_trade_aggregation_request.md b/artifacts/apidocs/schemas/api_sub_account_trade_aggregation_request.md
index ecac4c1..5067d4d 100644
--- a/artifacts/apidocs/schemas/api_sub_account_trade_aggregation_request.md
+++ b/artifacts/apidocs/schemas/api_sub_account_trade_aggregation_request.md
@@ -12,6 +12,7 @@
|is_maker
`im` |boolean|True|Filter on the maker of the trade|
|is_taker
`it` |boolean|True|Filter on the taker of the trade|
|cursor
`c` |string|False
``|The cursor to indicate when to start the next query from|
+ |group_by_signer
`gb` |boolean|True|Whether to group trades by signer per sub account|
??? info "[SubAccountTradeInterval](/../../schemas/sub_account_trade_interval)"
|Value| Description |
|-|-|
diff --git a/artifacts/apidocs/schemas/api_sub_account_trade_aggregation_response.md b/artifacts/apidocs/schemas/api_sub_account_trade_aggregation_response.md
index 7740ace..bcf19f4 100644
--- a/artifacts/apidocs/schemas/api_sub_account_trade_aggregation_response.md
+++ b/artifacts/apidocs/schemas/api_sub_account_trade_aggregation_response.md
@@ -13,3 +13,4 @@
|total_trade_volume
`tt` |string|True|Total volume traded|
|num_traded
`nt` |string|True|Number of trades|
|positive_fee
`pf` |string|True|Total positive fee paid by user|
+ |signer
`s` |string|True|The signer of the trade|
diff --git a/artifacts/apidocs/schemas/broker_tag.md b/artifacts/apidocs/schemas/broker_tag.md
index c5532c0..a57cd82 100644
--- a/artifacts/apidocs/schemas/broker_tag.md
+++ b/artifacts/apidocs/schemas/broker_tag.md
@@ -1,3 +1,8 @@
!!! info "[BrokerTag](/../../schemas/broker_tag)"
BrokerTag is a tag for the broker that the order is sent from.
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
diff --git a/artifacts/apidocs/schemas/cancel_status.md b/artifacts/apidocs/schemas/cancel_status.md
index 4c19353..9a82da9 100644
--- a/artifacts/apidocs/schemas/cancel_status.md
+++ b/artifacts/apidocs/schemas/cancel_status.md
@@ -2,3 +2,4 @@
|Value| Description |
|-|-|
|`EXPIRED` = 1|Cancellation has expired because corresponding order had not arrived within the defined time-to-live window.|
+ |`DROPPED_DUPLICATE` = 2|This cancellation request was dropped because its TTL window overlaps with another cancellation request for the same order.|
diff --git a/artifacts/apidocs/schemas/cancel_status_feed.md b/artifacts/apidocs/schemas/cancel_status_feed.md
index f0e5279..e36c34f 100644
--- a/artifacts/apidocs/schemas/cancel_status_feed.md
+++ b/artifacts/apidocs/schemas/cancel_status_feed.md
@@ -40,7 +40,9 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
??? info "[CancelStatus](/../../schemas/cancel_status)"
|Value| Description |
|-|-|
|`EXPIRED` = 1|Cancellation has expired because corresponding order had not arrived within the defined time-to-live window.|
+ |`DROPPED_DUPLICATE` = 2|This cancellation request was dropped because its TTL window overlaps with another cancellation request for the same order.|
diff --git a/artifacts/apidocs/schemas/client_order_i_ds_by_group.md b/artifacts/apidocs/schemas/client_order_i_ds_by_group.md
new file mode 100644
index 0000000..44b94b0
--- /dev/null
+++ b/artifacts/apidocs/schemas/client_order_i_ds_by_group.md
@@ -0,0 +1,8 @@
+!!! info "[ClientOrderIDsByGroup](/../../schemas/client_order_i_ds_by_group)"
+ Grouping for the client order id and their associated groups.
This is used to define TP/SL pairs or other order groupings after loading the list of Open Orders.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |group_id
`gi` |string|True|The group this order belongs to. It can be used to define TP/SL pairs or other order groupings|
+ |client_order_id
`co` |[string]|True|List of client order IDs in the group|
+ |sub_account_id
`sa` |string|True|The sub account ID that these orders belong to|
diff --git a/artifacts/apidocs/schemas/ecosystem_point.md b/artifacts/apidocs/schemas/ecosystem_point.md
index 8318444..179508d 100644
--- a/artifacts/apidocs/schemas/ecosystem_point.md
+++ b/artifacts/apidocs/schemas/ecosystem_point.md
@@ -14,3 +14,4 @@
|calculate_from
`cf` |string|True|Start time of the epoch - phase|
|calculate_to
`ct` |string|True|End time of the epoch - phase|
|rank
`r` |integer|True|The rank of the account in the ecosystem|
+ |epoch
`e` |integer|True|The epoch number of the ecosystem point|
diff --git a/artifacts/apidocs/schemas/epoch.md b/artifacts/apidocs/schemas/epoch.md
new file mode 100644
index 0000000..dda79fb
--- /dev/null
+++ b/artifacts/apidocs/schemas/epoch.md
@@ -0,0 +1,6 @@
+!!! info "[Epoch](/../../schemas/epoch)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |epoch
`e` |integer|True|The epoch number|
+ |start_time
`st` |string|True|The start time of the epoch|
+ |end_time
`et` |string|True|The end time of the epoch|
diff --git a/artifacts/apidocs/schemas/fill.md b/artifacts/apidocs/schemas/fill.md
index a6f4359..157972d 100644
--- a/artifacts/apidocs/schemas/fill.md
+++ b/artifacts/apidocs/schemas/fill.md
@@ -20,6 +20,7 @@
|venue
`v` |Venue|True|The venue where the trade occurred|
|client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|signer
`s1` |string|True|The address (public key) of the wallet signing the payload|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
??? info "[Venue](/../../schemas/venue)"
The list of Trading Venues that are supported on the GRVT exchange
@@ -27,3 +28,11 @@
|-|-|
|`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
|`RFQ` = 2|the trade is cleared on the RFQ venue|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
diff --git a/artifacts/apidocs/schemas/order.md b/artifacts/apidocs/schemas/order.md
index 094afb7..b3d0897 100644
--- a/artifacts/apidocs/schemas/order.md
+++ b/artifacts/apidocs/schemas/order.md
@@ -49,6 +49,46 @@
|-|-|-|-|
|client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|True|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name
`Lite`|Type|Required
`Default`| Description |
|-|-|-|-|
@@ -99,3 +139,4 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/schemas/order_metadata.md b/artifacts/apidocs/schemas/order_metadata.md
index 9ddd4b7..5d46f22 100644
--- a/artifacts/apidocs/schemas/order_metadata.md
+++ b/artifacts/apidocs/schemas/order_metadata.md
@@ -5,3 +5,43 @@
|-|-|-|-|
|client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|True|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
diff --git a/artifacts/apidocs/schemas/order_reject_reason.md b/artifacts/apidocs/schemas/order_reject_reason.md
index 93bb9d3..efa0bbf 100644
--- a/artifacts/apidocs/schemas/order_reject_reason.md
+++ b/artifacts/apidocs/schemas/order_reject_reason.md
@@ -31,3 +31,4 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/schemas/order_state.md b/artifacts/apidocs/schemas/order_state.md
index a3c24c7..73b9d1f 100644
--- a/artifacts/apidocs/schemas/order_state.md
+++ b/artifacts/apidocs/schemas/order_state.md
@@ -48,3 +48,4 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/schemas/order_state_feed.md b/artifacts/apidocs/schemas/order_state_feed.md
index 3d25347..0fbb189 100644
--- a/artifacts/apidocs/schemas/order_state_feed.md
+++ b/artifacts/apidocs/schemas/order_state_feed.md
@@ -54,3 +54,4 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/schemas/query_find_epoch_request.md b/artifacts/apidocs/schemas/query_find_epoch_request.md
new file mode 100644
index 0000000..9c9f837
--- /dev/null
+++ b/artifacts/apidocs/schemas/query_find_epoch_request.md
@@ -0,0 +1,7 @@
+!!! info "[QueryFindEpochRequest](/../../schemas/query_find_epoch_request)"
+ Query epoch by time or epoch number
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |time
`t` |string|False
`0`|The time to query the epoch|
+ |epoch
`e` |integer|False
`0`|The epoch number|
diff --git a/artifacts/apidocs/schemas/query_find_epoch_response.md b/artifacts/apidocs/schemas/query_find_epoch_response.md
new file mode 100644
index 0000000..2cae015
--- /dev/null
+++ b/artifacts/apidocs/schemas/query_find_epoch_response.md
@@ -0,0 +1,10 @@
+!!! info "[QueryFindEpochResponse](/../../schemas/query_find_epoch_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |epoch
`e` |Epoch|True|The epoch|
+ ??? info "[Epoch](/../../schemas/epoch)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |epoch
`e` |integer|True|The epoch number|
+ |start_time
`st` |string|True|The start time of the epoch|
+ |end_time
`et` |string|True|The end time of the epoch|
diff --git a/artifacts/apidocs/schemas/query_get_list_epoch_request.md b/artifacts/apidocs/schemas/query_get_list_epoch_request.md
new file mode 100644
index 0000000..aa8fe38
--- /dev/null
+++ b/artifacts/apidocs/schemas/query_get_list_epoch_request.md
@@ -0,0 +1,4 @@
+!!! info "[QueryGetListEpochRequest](/../../schemas/query_get_list_epoch_request)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |limit
`l` |integer|False
`0`|The limit to query for|
diff --git a/artifacts/apidocs/schemas/query_get_list_epoch_response.md b/artifacts/apidocs/schemas/query_get_list_epoch_response.md
new file mode 100644
index 0000000..5dd59fe
--- /dev/null
+++ b/artifacts/apidocs/schemas/query_get_list_epoch_response.md
@@ -0,0 +1,10 @@
+!!! info "[QueryGetListEpochResponse](/../../schemas/query_get_list_epoch_response)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |result
`r` |[Epoch]|True|The list of epochs|
+ ??? info "[Epoch](/../../schemas/epoch)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |epoch
`e` |integer|True|The epoch number|
+ |start_time
`st` |string|True|The start time of the epoch|
+ |end_time
`et` |string|True|The end time of the epoch|
diff --git a/artifacts/apidocs/schemas/sub_account_trade_aggregation.md b/artifacts/apidocs/schemas/sub_account_trade_aggregation.md
index 268c60f..e6ab414 100644
--- a/artifacts/apidocs/schemas/sub_account_trade_aggregation.md
+++ b/artifacts/apidocs/schemas/sub_account_trade_aggregation.md
@@ -8,3 +8,4 @@
|total_trade_volume
`tt` |string|True|Total volume traded|
|num_traded
`nt` |string|True|Number of trades|
|positive_fee
`pf` |string|True|Total positive fee paid by user|
+ |signer
`s` |string|True|The signer of the trade|
diff --git a/artifacts/apidocs/schemas/tpsl_order_metadata.md b/artifacts/apidocs/schemas/tpsl_order_metadata.md
index 5de5d5e..0b760a8 100644
--- a/artifacts/apidocs/schemas/tpsl_order_metadata.md
+++ b/artifacts/apidocs/schemas/tpsl_order_metadata.md
@@ -5,3 +5,11 @@
|-|-|-|-|
|trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
|trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
diff --git a/artifacts/apidocs/schemas/trigger_order_metadata.md b/artifacts/apidocs/schemas/trigger_order_metadata.md
index e69de29..4a97256 100644
--- a/artifacts/apidocs/schemas/trigger_order_metadata.md
+++ b/artifacts/apidocs/schemas/trigger_order_metadata.md
@@ -0,0 +1,30 @@
+!!! info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
diff --git a/artifacts/apidocs/schemas/trigger_type.md b/artifacts/apidocs/schemas/trigger_type.md
index 9407e67..581ff4e 100644
--- a/artifacts/apidocs/schemas/trigger_type.md
+++ b/artifacts/apidocs/schemas/trigger_type.md
@@ -1,3 +1,8 @@
!!! info "[TriggerType](/../../schemas/trigger_type)"
Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
diff --git a/artifacts/apidocs/schemas/ws_cancel_feed_data_v1.md b/artifacts/apidocs/schemas/ws_cancel_feed_data_v1.md
index 63080e4..fb5a7d4 100644
--- a/artifacts/apidocs/schemas/ws_cancel_feed_data_v1.md
+++ b/artifacts/apidocs/schemas/ws_cancel_feed_data_v1.md
@@ -47,7 +47,9 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
??? info "[CancelStatus](/../../schemas/cancel_status)"
|Value| Description |
|-|-|
|`EXPIRED` = 1|Cancellation has expired because corresponding order had not arrived within the defined time-to-live window.|
+ |`DROPPED_DUPLICATE` = 2|This cancellation request was dropped because its TTL window overlaps with another cancellation request for the same order.|
diff --git a/artifacts/apidocs/schemas/ws_fill_feed_data_v1.md b/artifacts/apidocs/schemas/ws_fill_feed_data_v1.md
index bb1c270..0d46e7a 100644
--- a/artifacts/apidocs/schemas/ws_fill_feed_data_v1.md
+++ b/artifacts/apidocs/schemas/ws_fill_feed_data_v1.md
@@ -27,6 +27,7 @@
|venue
`v` |Venue|True|The venue where the trade occurred|
|client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|signer
`s1` |string|True|The address (public key) of the wallet signing the payload|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
??? info "[Venue](/../../schemas/venue)"
The list of Trading Venues that are supported on the GRVT exchange
@@ -34,3 +35,11 @@
|-|-|
|`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
|`RFQ` = 2|the trade is cleared on the RFQ venue|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
diff --git a/artifacts/apidocs/schemas/ws_order_feed_data_v1.md b/artifacts/apidocs/schemas/ws_order_feed_data_v1.md
index 63252a8..4c1d9a3 100644
--- a/artifacts/apidocs/schemas/ws_order_feed_data_v1.md
+++ b/artifacts/apidocs/schemas/ws_order_feed_data_v1.md
@@ -56,6 +56,46 @@
|-|-|-|-|
|client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]
When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time
`ct` |string|False
`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
+ |trigger
`t` |TriggerOrderMetadata|True|Trigger fields are used to support any type of trigger order such as TP/SL|
+ |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order|
+ ??? info "[TriggerOrderMetadata](/../../schemas/trigger_order_metadata)"
+ Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).
Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_type
`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
+ |tpsl
`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
|
+ ??? info "[TriggerType](/../../schemas/trigger_type)"
+ Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.
Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|Not a trigger order. The order executes normally without any trigger conditions.|
+ |`TAKE_PROFIT` = 1|Take Profit Order - Executes when the price reaches a specified level to secure profits.|
+ |`STOP_LOSS` = 2|Stop Loss Order - Executes when the price reaches a specified level to limit losses.|
+ ??? info "[TPSLOrderMetadata](/../../schemas/tpsl_order_metadata)"
+ Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
### Fields:
- **triggerBy**: Defines the price type that activates the order (e.g., index price).
- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
+ |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
+ ??? info "[TriggerBy](/../../schemas/trigger_by)"
+ Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.
Trigger orders are executed when the selected price type reaches the specified trigger price.Different price types ensure flexibility in executing strategies based on market conditions.
+
+ |Value| Description |
+ |-|-|
+ |`UNSPECIFIED` = 0|no trigger condition|
+ |`INDEX` = 1|INDEX - Order is activated when the index price reaches the trigger price|
+ |`LAST` = 2|LAST - Order is activated when the last trade price reaches the trigger price|
+ ??? info "[BrokerTag](/../../schemas/broker_tag)"
+ BrokerTag is a tag for the broker that the order is sent from.
+
+ |Value| Description |
+ |-|-|
+ |`COIN_ROUTES` = 1|CoinRoutes|
+ |`ALERTATRON` = 2|Alertatron|
+ |`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name
`Lite`|Type|Required
`Default`| Description |
|-|-|-|-|
@@ -106,3 +146,4 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/schemas/ws_order_group_feed_data_v1.md b/artifacts/apidocs/schemas/ws_order_group_feed_data_v1.md
new file mode 100644
index 0000000..447a395
--- /dev/null
+++ b/artifacts/apidocs/schemas/ws_order_group_feed_data_v1.md
@@ -0,0 +1,15 @@
+!!! info "[WSOrderGroupFeedDataV1](/../../schemas/ws_order_group_feed_data_v1)"
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |stream
`s` |string|True|Stream name|
+ |selector
`s1` |string|True|Primary selector|
+ |sequence_number
`sn` |string|True|A running sequence number that determines global message order within the specific stream|
+ |feed
`f` |ClientOrderIDsByGroup|True|The order object being created or updated|
+ ??? info "[ClientOrderIDsByGroup](/../../schemas/client_order_i_ds_by_group)"
+ Grouping for the client order id and their associated groups.
This is used to define TP/SL pairs or other order groupings after loading the list of Open Orders.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |group_id
`gi` |string|True|The group this order belongs to. It can be used to define TP/SL pairs or other order groupings|
+ |client_order_id
`co` |[string]|True|List of client order IDs in the group|
+ |sub_account_id
`sa` |string|True|The sub account ID that these orders belong to|
diff --git a/artifacts/apidocs/schemas/ws_order_group_feed_selector_v1.md b/artifacts/apidocs/schemas/ws_order_group_feed_selector_v1.md
new file mode 100644
index 0000000..fd880b2
--- /dev/null
+++ b/artifacts/apidocs/schemas/ws_order_group_feed_selector_v1.md
@@ -0,0 +1,6 @@
+!!! info "[WSOrderGroupFeedSelectorV1](/../../schemas/ws_order_group_feed_selector_v1)"
+ Subscribes to a feed of order group to get updated when a new group is created for the subAccount specified.
+
+ |Name
`Lite`|Type|Required
`Default`| Description |
+ |-|-|-|-|
+ |sub_account_id
`sa` |string|True|The subaccount ID to filter by|
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 5ad2602..c2165cf 100644
--- a/artifacts/apidocs/schemas/ws_order_state_feed_data_v1.md
+++ b/artifacts/apidocs/schemas/ws_order_state_feed_data_v1.md
@@ -61,3 +61,4 @@
|`EXCEED_MAX_SIGNATURE_EXPIRATION` = 27|the signature supplied is more than 30 days in the future|
|`MARKET_ORDER_WITH_LIMIT_PRICE` = 28|the market order has a limit price set|
|`CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED` = 29|client cancel on disconnect triggered|
+ |`OCO_COUNTER_PART_TRIGGERED` = 30|the OCO counter part order was triggered|
diff --git a/artifacts/apidocs/trading_api.md b/artifacts/apidocs/trading_api.md
index dde1684..50b9e40 100644
--- a/artifacts/apidocs/trading_api.md
+++ b/artifacts/apidocs/trading_api.md
@@ -39,7 +39,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
}
}
}
@@ -69,7 +77,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
}
}
}
@@ -107,7 +123,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
},
"state": {
"status": "PENDING",
@@ -146,7 +170,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
},
"s1": {
"s": "PENDING",
@@ -265,7 +297,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
}
}
}
@@ -303,7 +343,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
}
}
},
@@ -341,7 +389,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
}
}
}
@@ -379,7 +435,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
}
}
},
@@ -418,7 +482,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
}
}
}
@@ -456,7 +528,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
}
}
},
@@ -494,7 +574,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
}
}
}
@@ -532,7 +620,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
}
}
},
@@ -571,7 +667,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
}
}
}
@@ -609,7 +713,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
}
}
},
@@ -647,7 +759,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
}
}
}
@@ -685,7 +805,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
}
}
},
@@ -724,7 +852,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
}
}
}
@@ -762,7 +898,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
}
}
},
@@ -800,7 +944,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
}
}
}
@@ -838,7 +990,15 @@ LITE ENDPOINT: lite/v1/create_order
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
}
}
},
@@ -1644,7 +1804,15 @@ LITE ENDPOINT: lite/v1/order
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
},
"state": {
"status": "PENDING",
@@ -1683,7 +1851,15 @@ LITE ENDPOINT: lite/v1/order
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
},
"s1": {
"s": "PENDING",
@@ -2058,7 +2234,15 @@ LITE ENDPOINT: lite/v1/open_orders
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
},
"state": {
"status": "PENDING",
@@ -2097,7 +2281,15 @@ LITE ENDPOINT: lite/v1/open_orders
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
},
"s1": {
"s": "PENDING",
@@ -2494,7 +2686,15 @@ LITE ENDPOINT: lite/v1/order_history
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
},
"state": {
"status": "PENDING",
@@ -2534,7 +2734,15 @@ LITE ENDPOINT: lite/v1/order_history
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
},
"s1": {
"s": "PENDING",
@@ -2964,7 +3172,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
},
"state": {
"status": "PENDING",
@@ -3004,7 +3220,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
},
"s1": {
"s": "PENDING",
@@ -3124,7 +3348,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
},
"state": {
"status": "PENDING",
@@ -3172,7 +3404,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
},
"state": {
"status": "PENDING",
@@ -3220,7 +3460,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
},
"s1": {
"s": "PENDING",
@@ -3268,7 +3516,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
},
"s1": {
"s": "PENDING",
@@ -3317,7 +3573,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
},
"state": {
"status": "PENDING",
@@ -3365,7 +3629,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
},
"state": {
"status": "PENDING",
@@ -3413,7 +3685,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
},
"s1": {
"s": "PENDING",
@@ -3461,7 +3741,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
},
"s1": {
"s": "PENDING",
@@ -3510,7 +3798,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
},
"state": {
"status": "PENDING",
@@ -3558,7 +3854,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
},
"state": {
"status": "PENDING",
@@ -3606,7 +3910,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
},
"s1": {
"s": "PENDING",
@@ -3654,7 +3966,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
},
"s1": {
"s": "PENDING",
@@ -3703,7 +4023,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
},
"state": {
"status": "PENDING",
@@ -3751,7 +4079,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
},
"state": {
"status": "PENDING",
@@ -3799,7 +4135,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
},
"s1": {
"s": "PENDING",
@@ -3847,7 +4191,15 @@ LITE ENDPOINT: lite/v1/pre_order_check
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
},
"s1": {
"s": "PENDING",
@@ -4196,49 +4548,116 @@ LITE ENDPOINT: lite/v1/cancel_on_disconnect
```
-## Execution
-### Fill History
+### Create Bulk Orders
```
-FULL ENDPOINT: full/v1/fill_history
-LITE ENDPOINT: lite/v1/fill_history
+FULL ENDPOINT: full/v1/create_bulk_orders
+LITE ENDPOINT: lite/v1/create_bulk_orders
```
=== "Request"
- -8<- "docs/schemas/api_fill_history_request.md"
+ -8<- "docs/schemas/api_create_bulk_orders_request.md"
!!! question "Query"
**Full Request**
``` { .json .copy }
{
- "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
- "kind": ["PERPETUAL"],
- "base": ["BTC", "ETH"],
- "quote": ["USDT", "USDC"],
- "start_time": "1697788800000000000",
- "end_time": "1697788800000000000",
- "limit": 500,
- "cursor": ""
+ "orders": [{
+ "order_id": "0x1234567890abcdef",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
+ },
+ "state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }]
}
```
**Lite Request**
``` { .json .copy }
{
- "sa": "'$GRVT_SUB_ACCOUNT_ID'",
- "k": ["PERPETUAL"],
- "b": ["BTC", "ETH"],
- "q": ["USDT", "USDC"],
- "st": "1697788800000000000",
- "et": "1697788800000000000",
- "l": 500,
- "c": ""
+ "o": [{
+ "oi": "0x1234567890abcdef",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
+ },
+ "s1": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }]
}
```
=== "Response"
- -8<- "docs/schemas/api_fill_history_response.md"
+ -8<- "docs/schemas/api_create_bulk_orders_response.md"
!!! success
@@ -4246,25 +4665,1450 @@ LITE ENDPOINT: lite/v1/fill_history
``` { .json .copy }
{
"result": [{
- "event_time": "1697788800000000000",
+ "order_id": "0x1234567890abcdef",
"sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
- "instrument": "BTC_USDT_Perp",
- "is_buyer": true,
- "is_taker": true,
- "size": "0.30",
- "price": "65038.01",
- "mark_price": "65038.01",
- "index_price": "65038.01",
- "interest_rate": 0.0003,
- "forward_price": "65038.01",
- "realized_pnl": "2400.50",
- "fee": "9.75",
- "fee_rate": 0.0003,
- "trade_id": "209358-2",
- "order_id": "0x10000101000203040506",
- "venue": "ORDERBOOK",
- "client_order_id": "23042",
- "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
+ },
+ "state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }]
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "oi": "0x1234567890abcdef",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
+ },
+ "s1": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }]
+ }
+ ```
+
+=== "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|
+ |1004|404|Data Not Found|
+ |1005|500|Unknown Error|
+ |1006|429|You have surpassed the allocated rate limit for your tier|
+ |1008|401|Your IP has not been whitelisted for access|
+ |1400|403|Signer does not have trade permission|
+ |1009|503|We are temporarily deactivating this API endpoint, please try again later|
+ |2000|403|Order signature is from an unauthorized signer|
+ |2001|403|Order signature has expired|
+ |2002|403|Order signature does not match payload|
+ |2003|403|Order sub account does not match logged in user|
+ |2004|403|Order signature is from an expired session key|
+ |2006|403|Order signature R/S must have exactly 64 characters long without 0x prefix|
+ |2005|403|Order signature V must be 27/28|
+ |2007|403|Order signature S must be in the lower half of the curve|
+ |2010|400|Order ID should be empty when creating an order|
+ |2011|400|Client Order ID should be supplied when creating an order|
+ |2012|400|Client Order ID overlaps with existing active order|
+ |2030|400|Orderbook Orders must have a TimeInForce of GTT/IOC/FOK|
+ |2031|400|RFQ Orders must have a TimeInForce of GTT/AON/IOC/FOK|
+ |2032|400|Post Only can only be set to true for GTT/AON orders|
+ |2020|400|Market Order must always be supplied without a limit price|
+ |2021|400|Limit Order must always be supplied with a limit price|
+ |2040|400|Order must contain at least one leg|
+ |2041|400|Order Legs must be sorted by Derivative.Instrument/Underlying/BaseCurrency/Expiration/StrikePrice|
+ |2042|400|Orderbook Orders must contain only one leg|
+ |2050|400|Order state must be empty upon creation|
+ |2051|400|Order execution metadata must be empty upon creation|
+ |2060|400|Order Legs contain one or more inactive derivative|
+ |2061|400|Unsupported Instrument Requested|
+ |2062|400|Order size smaller than min size|
+ |2063|400|Order size smaller than min block size in block trade venue|
+ |2064|400|Invalid limit price tick|
+ |2065|400|Order size too granular|
+ |2070|400|Liquidation Order is not supported|
+ |2080|400|Insufficient margin to create order|
+ |2081|400|Order Fill would result in exceeding maximum position size|
+ |2082|400|Pre-order check failed|
+ |2083|400|Order Fill would result in exceeding maximum position size under current configurable leverage tier|
+ |2090|429|Max open orders exceeded|
+ |2110|400|Invalid trigger by|
+ |2111|400|Unsupported trigger by|
+ |2112|400|Invalid trigger order|
+ |2220|400|No orders provided|
+ |2221|400|Invalid number of orders|
+ |2222|400|Order is not a TPSL order|
+ |2223|400|Unsupported bulk order type|
+
+
+ !!! 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/create_bulk_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "orders": [{
+ "order_id": "0x1234567890abcdef",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
+ },
+ "state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }]
+ }
+ '
+ ```
+ !!! 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/create_bulk_orders",
+ "params": {
+ "orders": [{
+ "order_id": "0x1234567890abcdef",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
+ },
+ "state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/create_bulk_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "o": [{
+ "oi": "0x1234567890abcdef",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
+ },
+ "s1": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }]
+ }
+ '
+ ```
+ !!! 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/create_bulk_orders",
+ "p": {
+ "o": [{
+ "oi": "0x1234567890abcdef",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
+ },
+ "s1": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/create_bulk_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "orders": [{
+ "order_id": "0x1234567890abcdef",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
+ },
+ "state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }]
+ }
+ '
+ ```
+ !!! 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/create_bulk_orders",
+ "params": {
+ "orders": [{
+ "order_id": "0x1234567890abcdef",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
+ },
+ "state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/create_bulk_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "o": [{
+ "oi": "0x1234567890abcdef",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
+ },
+ "s1": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }]
+ }
+ '
+ ```
+ !!! 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/create_bulk_orders",
+ "p": {
+ "o": [{
+ "oi": "0x1234567890abcdef",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
+ },
+ "s1": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/create_bulk_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "orders": [{
+ "order_id": "0x1234567890abcdef",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
+ },
+ "state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }]
+ }
+ '
+ ```
+ !!! 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/create_bulk_orders",
+ "params": {
+ "orders": [{
+ "order_id": "0x1234567890abcdef",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
+ },
+ "state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/create_bulk_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "o": [{
+ "oi": "0x1234567890abcdef",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
+ },
+ "s1": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }]
+ }
+ '
+ ```
+ !!! 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/create_bulk_orders",
+ "p": {
+ "o": [{
+ "oi": "0x1234567890abcdef",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
+ },
+ "s1": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/create_bulk_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "orders": [{
+ "order_id": "0x1234567890abcdef",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
+ },
+ "state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }]
+ }
+ '
+ ```
+ !!! 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/create_bulk_orders",
+ "params": {
+ "orders": [{
+ "order_id": "0x1234567890abcdef",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "is_market": false,
+ "time_in_force": "GOOD_TILL_TIME",
+ "post_only": false,
+ "reduce_only": false,
+ "legs": [{
+ "instrument": "BTC_USDT_Perp",
+ "size": "10.5",
+ "limit_price": "65038.01",
+ "is_buying_asset": true
+ }],
+ "signature": {
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "expiration": "1697788800000000000",
+ "nonce": 1234567890
+ },
+ "metadata": {
+ "client_order_id": "23042",
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
+ },
+ "state": {
+ "status": "PENDING",
+ "reject_reason": "CLIENT_CANCEL",
+ "book_size": ["10.5"],
+ "traded_size": ["1.5"],
+ "update_time": "1697788800000000000",
+ "avg_fill_price": ["60000.4"]
+ }
+ }]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/create_bulk_orders' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "o": [{
+ "oi": "0x1234567890abcdef",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
+ },
+ "s1": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }]
+ }
+ '
+ ```
+ !!! 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/create_bulk_orders",
+ "p": {
+ "o": [{
+ "oi": "0x1234567890abcdef",
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "im": false,
+ "ti": "GOOD_TILL_TIME",
+ "po": false,
+ "ro": false,
+ "l": [{
+ "i": "BTC_USDT_Perp",
+ "s": "10.5",
+ "lp": "65038.01",
+ "ib": true
+ }],
+ "s": {
+ "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8",
+ "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d",
+ "v": 28,
+ "e": "1697788800000000000",
+ "n": 1234567890
+ },
+ "m": {
+ "co": "23042",
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
+ },
+ "s1": {
+ "s": "PENDING",
+ "rr": "CLIENT_CANCEL",
+ "bs": ["10.5"],
+ "ts": ["1.5"],
+ "ut": "1697788800000000000",
+ "af": ["60000.4"]
+ }
+ }]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+### Get Order Group
+```
+FULL ENDPOINT: full/v1/order_group
+LITE ENDPOINT: lite/v1/order_group
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_get_order_group_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_get_order_group_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "group_id": "0x10000101000203040506",
+ "client_order_id": ["[23042, 54232]"],
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }]
+ }
+ ```
+ **Lite Response**
+ ``` { .json .copy }
+ {
+ "r": [{
+ "gi": "0x10000101000203040506",
+ "co": ["[23042, 54232]"],
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }]
+ }
+ ```
+
+=== "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|
+ |1004|404|Data Not Found|
+ |3020|400|Sub account ID must be an uint64 integer|
+ |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/order_group' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! 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/order_group",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/order_group' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! 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/order_group",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/full/v1/order_group' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! 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/order_group",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/order_group' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! 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/order_group",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/full/v1/order_group' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! 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/order_group",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.testnet.grvt.io/lite/v1/order_group' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! 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/order_group",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "REST Full"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/full/v1/order_group' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! 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/order_group",
+ "params": {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "REST Lite"
+ ``` { .bash .copy }
+ curl --location 'https://trades.grvt.io/lite/v1/order_group' \
+ --header "Cookie: $GRVT_COOKIE" \
+ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ --data '{
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ '
+ ```
+ !!! 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/order_group",
+ "p": {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+
+
+## Execution
+### Fill History
+```
+FULL ENDPOINT: full/v1/fill_history
+LITE ENDPOINT: lite/v1/fill_history
+```
+
+=== "Request"
+
+ -8<- "docs/schemas/api_fill_history_request.md"
+
+
+ !!! question "Query"
+ **Full Request**
+ ``` { .json .copy }
+ {
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "kind": ["PERPETUAL"],
+ "base": ["BTC", "ETH"],
+ "quote": ["USDT", "USDC"],
+ "start_time": "1697788800000000000",
+ "end_time": "1697788800000000000",
+ "limit": 500,
+ "cursor": ""
+ }
+ ```
+ **Lite Request**
+ ``` { .json .copy }
+ {
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'",
+ "k": ["PERPETUAL"],
+ "b": ["BTC", "ETH"],
+ "q": ["USDT", "USDC"],
+ "st": "1697788800000000000",
+ "et": "1697788800000000000",
+ "l": 500,
+ "c": ""
+ }
+ ```
+
+=== "Response"
+
+ -8<- "docs/schemas/api_fill_history_response.md"
+
+
+ !!! success
+ **Full Response**
+ ``` { .json .copy }
+ {
+ "result": [{
+ "event_time": "1697788800000000000",
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'",
+ "instrument": "BTC_USDT_Perp",
+ "is_buyer": true,
+ "is_taker": true,
+ "size": "0.30",
+ "price": "65038.01",
+ "mark_price": "65038.01",
+ "index_price": "65038.01",
+ "interest_rate": 0.0003,
+ "forward_price": "65038.01",
+ "realized_pnl": "2400.50",
+ "fee": "9.75",
+ "fee_rate": 0.0003,
+ "trade_id": "209358-2",
+ "order_id": "0x10000101000203040506",
+ "venue": "ORDERBOOK",
+ "client_order_id": "23042",
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "broker": "COIN_ROUTES"
}],
"next": "Qw0918="
}
@@ -4291,7 +6135,8 @@ LITE ENDPOINT: lite/v1/fill_history
"oi": "0x10000101000203040506",
"v": "ORDERBOOK",
"co": "23042",
- "s1": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"
+ "s1": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "b": "COIN_ROUTES"
}],
"n": "Qw0918="
}
diff --git a/artifacts/apidocs/trading_streams.md b/artifacts/apidocs/trading_streams.md
index 82a6364..bb1db77 100644
--- a/artifacts/apidocs/trading_streams.md
+++ b/artifacts/apidocs/trading_streams.md
@@ -131,7 +131,15 @@ STREAM: v1.order
},
"metadata": {
"client_order_id": "23042",
- "create_time": "1697788800000000000"
+ "create_time": "1697788800000000000",
+ "trigger": {
+ "trigger_type": "UNSPECIFIED",
+ "tpsl": {
+ "trigger_by": "UNSPECIFIED",
+ "trigger_price": "65038.10"
+ }
+ },
+ "broker": "COIN_ROUTES"
},
"state": {
"status": "PENDING",
@@ -173,7 +181,15 @@ STREAM: v1.order
},
"m": {
"co": "23042",
- "ct": "1697788800000000000"
+ "ct": "1697788800000000000",
+ "t": {
+ "tt": "UNSPECIFIED",
+ "t": {
+ "tb": "UNSPECIFIED",
+ "tp": "65038.10"
+ }
+ },
+ "b": "COIN_ROUTES"
},
"s1": {
"s": "PENDING",
@@ -1861,6 +1877,601 @@ STREAM: v1.cancel
```
+### Order Group
+```
+STREAM: v1.group
+```
+
+=== "Feed Selector"
+
+ -8<- "docs/schemas/ws_order_group_feed_selector_v1.md"
+ ??? info "JSONRPC Wrappers"
+ -8<- "docs/schemas/jsonrpc_request.md"
+ -8<- "docs/schemas/jsonrpc_response.md"
+ -8<- "docs/schemas/ws_subscribe_params.md"
+ -8<- "docs/schemas/ws_subscribe_result.md"
+ -8<- "docs/schemas/ws_unsubscribe_params.md"
+ -8<- "docs/schemas/ws_unsubscribe_result.md"
+ -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md"
+ -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md"
+
+
+ ???+ question "Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "subscribe",
+ "params": {
+ "stream": "v1.group",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.group",
+ "subs": ["'$GRVT_SUB_ACCOUNT_ID'"],
+ "unsubs": [],
+ "num_snapshots": [10],
+ "first_sequence_number": [872634876]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Unsubscribe"
+ **Full Unsubscribe Request**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "method": "unsubscribe",
+ "params": {
+ "stream": "v1.group",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ```
+ **Full Unsubscribe Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "result": {
+ "stream": "v1.group",
+ "unsubs": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ ??? question "Legacy Subscribe"
+ **Full Subscribe Request**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.group",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ```
+ **Full Subscribe Response**
+ ``` { .json .copy }
+ {
+ "request_id":1,
+ "stream":"v1.group",
+ "subs":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "unsubs":[],
+ "num_snapshots":[1],
+ "first_sequence_number":[2813]
+ }
+ ```
+
+=== "Feed Data"
+
+ -8<- "docs/schemas/ws_order_group_feed_data_v1.md"
+
+
+ !!! success
+ **Full Feed Response**
+ ``` { .json .copy }
+ {
+ "stream": "v1.group",
+ "selector": "'$GRVT_SUB_ACCOUNT_ID'",
+ "sequence_number": "872634876",
+ "feed": {
+ "group_id": "0x10000101000203040506",
+ "client_order_id": ["[23042, 54232]"],
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ }
+ ```
+ **Lite Feed Response**
+ ``` { .json .copy }
+ {
+ "s": "v1.group",
+ "s1": "'$GRVT_SUB_ACCOUNT_ID'",
+ "sn": "872634876",
+ "f": {
+ "gi": "0x10000101000203040506",
+ "co": ["[23042, 54232]"],
+ "sa": "'$GRVT_SUB_ACCOUNT_ID'"
+ }
+ }
+ ```
+
+=== "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|
+ |1008|401|Your IP has not been whitelisted for access|
+ |1101|400|Feed Format must be in the format of @|
+ |1102|400|Wrong number of primary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |1103|400|Wrong number of secondary selectors|
+ |3000|400|Instrument is invalid|
+ |3020|400|Sub account ID must be an uint64 integer|
+ -8<- "docs/schemas/jsonrpc_response.md"
+
+
+ !!! failure "Error"
+ **Full Error Response**
+ ``` { .json .copy }
+ {
+ "jsonrpc": "2.0",
+ "error": {
+ "code": 1000,
+ "message": "You need to authenticate prior to using this functionality"
+ },
+ "id": 123,
+ "method": "subscribe"
+ }
+ ```
+ **Lite Error Response**
+ ``` { .json .copy }
+ {
+ "j": "2.0",
+ "e": {
+ "c": 1000,
+ "m": "You need to authenticate prior to using this functionality"
+ },
+ "i": 123,
+ "m": "subscribe"
+ }
+ ```
+ **Legacy Error Response**
+ ``` { .json .copy }
+ {
+ "code":1000,
+ "message":"You need to authenticate prior to using this functionality",
+ "status":401
+ }
+ ```
+
+=== "Try it out"
+ -8<- "sections/auth_closed.md"
+ === "DEV"
+
+ !!! example "Subscribe 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": "subscribe",
+ "params": {
+ "stream": "v1.group",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe 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": "unsubscribe",
+ "params": {
+ "stream": "v1.group",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.group",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe 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": "subscribe",
+ "p": {
+ "s": "v1.group",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe 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": "unsubscribe",
+ "p": {
+ "s": "v1.group",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.dev.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.group",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "STAGING"
+
+ !!! example "Subscribe 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": "subscribe",
+ "params": {
+ "stream": "v1.group",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe 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": "unsubscribe",
+ "params": {
+ "stream": "v1.group",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.group",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe 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": "subscribe",
+ "p": {
+ "s": "v1.group",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe 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": "unsubscribe",
+ "p": {
+ "s": "v1.group",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.staging.gravitymarkets.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.group",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "TESTNET"
+
+ !!! example "Subscribe 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": "subscribe",
+ "params": {
+ "stream": "v1.group",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe 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": "unsubscribe",
+ "params": {
+ "stream": "v1.group",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.group",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe 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": "subscribe",
+ "p": {
+ "s": "v1.group",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe 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": "unsubscribe",
+ "p": {
+ "s": "v1.group",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.testnet.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.group",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+ === "PROD"
+
+ !!! example "Subscribe 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": "subscribe",
+ "params": {
+ "stream": "v1.group",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe 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": "unsubscribe",
+ "params": {
+ "stream": "v1.group",
+ "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "id": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Full"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.group",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":true
+ }
+ ' -w 360
+ ```
+
+
+ !!! example "Subscribe 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": "subscribe",
+ "p": {
+ "s": "v1.group",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Unsubscribe 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": "unsubscribe",
+ "p": {
+ "s": "v1.group",
+ "s1": ["'$GRVT_SUB_ACCOUNT_ID'"]
+ },
+ "i": 123
+ }
+ ' -w 360
+ ```
+ !!! example "Legacy Subscribe Lite"
+ ``` { .bash .copy }
+ wscat -c "wss://trades.grvt.io/ws" \
+ -H "Cookie: $GRVT_COOKIE" \
+ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \
+ -x '
+ {
+ "request_id":1,
+ "stream":"v1.group",
+ "feed":["'$GRVT_SUB_ACCOUNT_ID'"],
+ "method":"subscribe",
+ "is_full":false
+ }
+ ' -w 360
+ ```
+
+
## Execution
### Fill
```
@@ -1988,7 +2599,8 @@ STREAM: v1.fill
"order_id": "0x10000101000203040506",
"venue": "ORDERBOOK",
"client_order_id": "23042",
- "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"
+ "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "broker": "COIN_ROUTES"
}
}
```
@@ -2017,7 +2629,8 @@ STREAM: v1.fill
"oi": "0x10000101000203040506",
"v": "ORDERBOOK",
"co": "23042",
- "s1": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"
+ "s1": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0",
+ "b": "COIN_ROUTES"
}
}
```
diff --git a/artifacts/pysdk/grvt_raw_async.py b/artifacts/pysdk/grvt_raw_async.py
index 69791af..c9e3194 100644
--- a/artifacts/pysdk/grvt_raw_async.py
+++ b/artifacts/pysdk/grvt_raw_async.py
@@ -152,24 +152,6 @@ async def pre_order_check_v1(
return GrvtError(**resp)
return from_dict(types.ApiPreOrderCheckResponse, resp, Config(cast=[Enum]))
- async def cancel_trigger_order_v1(
- self, req: types.ApiCancelOrderRequest
- ) -> types.AckResponse | GrvtError:
- resp = await self._post(True, self.td_rpc + "/full/v1/cancel_trigger_order", req)
- if resp.get("code"):
- return GrvtError(**resp)
- return from_dict(types.AckResponse, resp, Config(cast=[Enum]))
-
- async def cancel_all_trigger_orders_v1(
- self, req: types.ApiCancelAllOrdersRequest
- ) -> types.AckResponse | GrvtError:
- resp = await self._post(
- True, self.td_rpc + "/full/v1/cancel_all_trigger_orders", req
- )
- if resp.get("code"):
- return GrvtError(**resp)
- return from_dict(types.AckResponse, resp, Config(cast=[Enum]))
-
async def dedust_position_v1(
self, req: types.ApiDedustPositionRequest
) -> types.ApiDedustPositionResponse | GrvtError:
@@ -186,6 +168,22 @@ async def cancel_on_disconnect_v1(
return GrvtError(**resp)
return from_dict(types.AckResponse, resp, Config(cast=[Enum]))
+ async def create_bulk_orders_v1(
+ self, req: types.ApiCreateBulkOrdersRequest
+ ) -> types.ApiCreateBulkOrdersResponse | GrvtError:
+ resp = await self._post(True, self.td_rpc + "/full/v1/create_bulk_orders", req)
+ if resp.get("code"):
+ return GrvtError(**resp)
+ return from_dict(types.ApiCreateBulkOrdersResponse, resp, Config(cast=[Enum]))
+
+ async def get_order_group_v1(
+ self, req: types.ApiGetOrderGroupRequest
+ ) -> types.ApiGetOrderGroupResponse | GrvtError:
+ resp = await self._post(True, self.td_rpc + "/full/v1/order_group", req)
+ if resp.get("code"):
+ return GrvtError(**resp)
+ return from_dict(types.ApiGetOrderGroupResponse, resp, Config(cast=[Enum]))
+
async def fill_history_v1(
self, req: types.ApiFillHistoryRequest
) -> types.ApiFillHistoryResponse | GrvtError:
diff --git a/artifacts/pysdk/grvt_raw_sync.py b/artifacts/pysdk/grvt_raw_sync.py
index a5d918d..60b090d 100644
--- a/artifacts/pysdk/grvt_raw_sync.py
+++ b/artifacts/pysdk/grvt_raw_sync.py
@@ -150,22 +150,6 @@ def pre_order_check_v1(
return GrvtError(**resp)
return from_dict(types.ApiPreOrderCheckResponse, resp, Config(cast=[Enum]))
- def cancel_trigger_order_v1(
- self, req: types.ApiCancelOrderRequest
- ) -> types.AckResponse | GrvtError:
- resp = self._post(True, self.td_rpc + "/full/v1/cancel_trigger_order", req)
- if resp.get("code"):
- return GrvtError(**resp)
- return from_dict(types.AckResponse, resp, Config(cast=[Enum]))
-
- def cancel_all_trigger_orders_v1(
- self, req: types.ApiCancelAllOrdersRequest
- ) -> types.AckResponse | GrvtError:
- resp = self._post(True, self.td_rpc + "/full/v1/cancel_all_trigger_orders", req)
- if resp.get("code"):
- return GrvtError(**resp)
- return from_dict(types.AckResponse, resp, Config(cast=[Enum]))
-
def dedust_position_v1(
self, req: types.ApiDedustPositionRequest
) -> types.ApiDedustPositionResponse | GrvtError:
@@ -182,6 +166,22 @@ def cancel_on_disconnect_v1(
return GrvtError(**resp)
return from_dict(types.AckResponse, resp, Config(cast=[Enum]))
+ def create_bulk_orders_v1(
+ self, req: types.ApiCreateBulkOrdersRequest
+ ) -> types.ApiCreateBulkOrdersResponse | GrvtError:
+ resp = self._post(True, self.td_rpc + "/full/v1/create_bulk_orders", req)
+ if resp.get("code"):
+ return GrvtError(**resp)
+ return from_dict(types.ApiCreateBulkOrdersResponse, resp, Config(cast=[Enum]))
+
+ def get_order_group_v1(
+ self, req: types.ApiGetOrderGroupRequest
+ ) -> types.ApiGetOrderGroupResponse | GrvtError:
+ resp = self._post(True, self.td_rpc + "/full/v1/order_group", req)
+ if resp.get("code"):
+ return GrvtError(**resp)
+ return from_dict(types.ApiGetOrderGroupResponse, resp, Config(cast=[Enum]))
+
def fill_history_v1(
self, req: types.ApiFillHistoryRequest
) -> types.ApiFillHistoryResponse | GrvtError:
diff --git a/artifacts/pysdk/grvt_raw_types.py b/artifacts/pysdk/grvt_raw_types.py
index 249ad17..c80b15e 100644
--- a/artifacts/pysdk/grvt_raw_types.py
+++ b/artifacts/pysdk/grvt_raw_types.py
@@ -27,6 +27,8 @@ class BrokerTag(Enum):
class CancelStatus(Enum):
# Cancellation has expired because corresponding order had not arrived within the defined time-to-live window.
EXPIRED = "EXPIRED"
+ # This cancellation request was dropped because its TTL window overlaps with another cancellation request for the same order.
+ DROPPED_DUPLICATE = "DROPPED_DUPLICATE"
class CandlestickInterval(Enum):
@@ -277,6 +279,8 @@ class OrderRejectReason(Enum):
MARKET_ORDER_WITH_LIMIT_PRICE = "MARKET_ORDER_WITH_LIMIT_PRICE"
# client cancel on disconnect triggered
CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED = "CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED"
+ # the OCO counter part order was triggered
+ OCO_COUNTER_PART_TRIGGERED = "OCO_COUNTER_PART_TRIGGERED"
class OrderStatus(Enum):
@@ -2009,6 +2013,30 @@ class ApiDedustPositionResponse:
result: Order
+@dataclass
+class ApiCreateBulkOrdersRequest:
+ """
+ Create multiple orders simultaneously for this trading account.
+
+ This endpoint supports the following order scenarios:
+ - One-Cancels-Other (OCO) orders combining TP/SL
+ - One-Sends-Other (OSO) orders
+
+ Usage:
+ - For OCO (TP/SL pair): Send exactly 2 orders in the same request - one Take Profit and one Stop Loss order
+ - For OSO: Send exactly one main order and one contingent order (TP and/or SL)
+ """
+
+ # The orders to create
+ orders: list[Order]
+
+
+@dataclass
+class ApiCreateBulkOrdersResponse:
+ # The created orders in same order as requested
+ result: list[Order]
+
+
@dataclass
class ApiCancelOnDisconnectRequest:
"""
@@ -2039,6 +2067,45 @@ class ApiCancelOnDisconnectRequest:
countdown_time: str | None = None
+@dataclass
+class ApiGetOrderGroupRequest:
+ """
+ Retrieves the grouping of non-cancelled, non-filled client orders for a given subaccount when the grouping exist.
+
+ helping to identify TP/SL pairs or other order relationships within the account.
+ """
+
+ # The subaccount ID for which the order groups should be retrieved.
+ sub_account_id: str
+
+
+@dataclass
+class ClientOrderIDsByGroup:
+ """
+ Grouping for the client order id and their associated groups.
+
+ This is used to define TP/SL pairs or other order groupings after loading the list of Open Orders.
+ """
+
+ # The group this order belongs to. It can be used to define TP/SL pairs or other order groupings
+ group_id: str
+ # List of client order IDs in the group
+ client_order_id: list[str]
+ # The sub account ID that these orders belong to
+ sub_account_id: str
+
+
+@dataclass
+class ApiGetOrderGroupResponse:
+ """
+ A list of client orders grouped by their associated order group.
+ Each entry in the list contains a `groupID` and the corresponding `clientOrderID`s
+ that belong to that group.
+ """
+
+ result: list[ClientOrderIDsByGroup]
+
+
@dataclass
class ApiGetUserEcosystemPointRequest:
# The off chain account id
@@ -2073,6 +2140,8 @@ class EcosystemPoint:
calculate_to: str
# The rank of the account in the ecosystem
rank: int
+ # The epoch number of the ecosystem point
+ epoch: int
@dataclass
@@ -2189,6 +2258,42 @@ class ApiFindEcosystemLeaderboardResponse:
users: list[EcosystemLeaderboardUser]
+@dataclass
+class QueryFindEpochRequest:
+ # The time to query the epoch
+ time: str | None = None
+ # The epoch number
+ epoch: int | None = None
+
+
+@dataclass
+class Epoch:
+ # The epoch number
+ epoch: int
+ # The start time of the epoch
+ start_time: str
+ # The end time of the epoch
+ end_time: str
+
+
+@dataclass
+class QueryFindEpochResponse:
+ # The epoch
+ epoch: Epoch
+
+
+@dataclass
+class QueryGetListEpochRequest:
+ # The limit to query for
+ limit: int | None = None
+
+
+@dataclass
+class QueryGetListEpochResponse:
+ # The list of epochs
+ result: list[Epoch]
+
+
@dataclass
class QueryEpochBadgeRequest:
# The off chain account id to get referral stats
@@ -2527,6 +2632,8 @@ class ApiSubAccountTradeAggregationRequest:
is_maker: bool
# Filter on the taker of the trade
is_taker: bool
+ # Whether to group trades by signer per sub account
+ group_by_signer: bool
# Optional. Start time in unix nanoseconds
start_time: str | None = None
# Optional. End time in unix nanoseconds
@@ -2547,6 +2654,8 @@ class SubAccountTradeAggregation:
num_traded: str
# Total positive fee paid by user
positive_fee: str
+ # The signer of the trade
+ signer: str
@dataclass
@@ -2901,6 +3010,31 @@ class WSCancelFeedSelectorV1:
sub_account_id: str
+@dataclass
+class WSOrderGroupFeedSelectorV1:
+ """
+ Subscribes to a feed of order group to get updated when a new group is created for the subAccount specified.
+
+ """
+
+ # The subaccount ID to filter by
+ sub_account_id: str
+
+
+@dataclass
+class WSOrderGroupFeedDataV1:
+ # Stream name
+ stream: str
+ # Primary selector
+ selector: str
+ # A running sequence number that determines global message order within the specific stream
+ sequence_number: str
+ # The order object being created or updated
+ feed: ClientOrderIDsByGroup
+ # The previous sequence number that determines global message order within the specific stream
+ prev_sequence_number: str
+
+
@dataclass
class ApiWithdrawalRequest:
"""
diff --git a/src/codegen/apidocs/apidocs.py b/src/codegen/apidocs/apidocs.py
index b4ad87b..dd0f49b 100644
--- a/src/codegen/apidocs/apidocs.py
+++ b/src/codegen/apidocs/apidocs.py
@@ -25,10 +25,6 @@
IGNORE_STRUCTS = [
"ApiDedustPositionRequest",
"ApiDedustPositionResponse",
- "TriggerOrderMetadata",
- "TriggerBy",
- "TriggerType",
- "TPSLOrderMetadata" "BrokerTag",
]
# skip these fields for all structs, at all levels of nesting
@@ -36,14 +32,10 @@
"prev_sequence_number",
"latest_sequence_number",
"use_global_sequence_number",
- "trigger",
- "broker",
]
IGNORE_RPCS: list[str] = [
"RPCDedustPositionV1",
- "RPCCancelTriggerOrderV1",
- "RPCCancelAllTriggerOrdersV1",
]
IGNORE_ENUM_VALUES: dict[str, list[str]] = {
@@ -68,8 +60,6 @@
"PENDLE",
"UXLINK",
],
- "BrokerTag": ["*"],
- "TriggerType": ["*"],
}
diff --git a/src/codegen/apispec.json b/src/codegen/apispec.json
index c8001e5..d7fd543 100644
--- a/src/codegen/apispec.json
+++ b/src/codegen/apispec.json
@@ -1214,13 +1214,13 @@
]
},
{
- "namespace": "Order",
- "name": "RPCCancelTriggerOrderV1",
+ "namespace": "Position",
+ "name": "RPCDedustPositionV1",
"version": 1,
- "route": "/cancel_trigger_order",
+ "route": "/dedust_position",
"auth_required": true,
- "request": "ApiCancelOrderRequest",
- "response": "AckResponse",
+ "request": "ApiDedustPositionRequest",
+ "response": "ApiDedustPositionResponse",
"on_request_errors": [
{
"code": 1000,
@@ -1242,6 +1242,16 @@
"message": "Request could not be processed due to malformed syntax",
"status": 400
},
+ {
+ "code": 1004,
+ "message": "Data Not Found",
+ "status": 404
+ },
+ {
+ "code": 1005,
+ "message": "Unknown Error",
+ "status": 500
+ },
{
"code": 1006,
"message": "You have surpassed the allocated rate limit for your tier",
@@ -1253,19 +1263,194 @@
"status": 401
},
{
- "code": 3021,
- "message": "Either order ID or client order ID must be supplied",
+ "code": 1400,
+ "message": "Signer does not have trade permission",
+ "status": 403
+ },
+ {
+ "code": 1009,
+ "message": "We are temporarily deactivating this API endpoint, please try again later",
+ "status": 503
+ },
+ {
+ "code": 2000,
+ "message": "Order signature is from an unauthorized signer",
+ "status": 403
+ },
+ {
+ "code": 2001,
+ "message": "Order signature has expired",
+ "status": 403
+ },
+ {
+ "code": 2002,
+ "message": "Order signature does not match payload",
+ "status": 403
+ },
+ {
+ "code": 2003,
+ "message": "Order sub account does not match logged in user",
+ "status": 403
+ },
+ {
+ "code": 2004,
+ "message": "Order signature is from an expired session key",
+ "status": 403
+ },
+ {
+ "code": 2010,
+ "message": "Order ID should be empty when creating an order",
+ "status": 400
+ },
+ {
+ "code": 2011,
+ "message": "Client Order ID should be supplied when creating an order",
+ "status": 400
+ },
+ {
+ "code": 2012,
+ "message": "Client Order ID overlaps with existing active order",
+ "status": 400
+ },
+ {
+ "code": 2030,
+ "message": "Orderbook Orders must have a TimeInForce of GTT/IOC/FOK",
+ "status": 400
+ },
+ {
+ "code": 2031,
+ "message": "RFQ Orders must have a TimeInForce of GTT/AON/IOC/FOK",
+ "status": 400
+ },
+ {
+ "code": 2032,
+ "message": "Post Only can only be set to true for GTT/AON orders",
+ "status": 400
+ },
+ {
+ "code": 2020,
+ "message": "Market Order must always be supplied without a limit price",
+ "status": 400
+ },
+ {
+ "code": 2021,
+ "message": "Limit Order must always be supplied with a limit price",
+ "status": 400
+ },
+ {
+ "code": 2040,
+ "message": "Order must contain at least one leg",
+ "status": 400
+ },
+ {
+ "code": 2041,
+ "message": "Order Legs must be sorted by Derivative.Instrument/Underlying/BaseCurrency/Expiration/StrikePrice",
+ "status": 400
+ },
+ {
+ "code": 2042,
+ "message": "Orderbook Orders must contain only one leg",
+ "status": 400
+ },
+ {
+ "code": 2050,
+ "message": "Order state must be empty upon creation",
+ "status": 400
+ },
+ {
+ "code": 2051,
+ "message": "Order execution metadata must be empty upon creation",
+ "status": 400
+ },
+ {
+ "code": 2060,
+ "message": "Order Legs contain one or more inactive derivative",
+ "status": 400
+ },
+ {
+ "code": 2061,
+ "message": "Unsupported Instrument Requested",
+ "status": 400
+ },
+ {
+ "code": 2063,
+ "message": "Order size smaller than min block size in block trade venue",
+ "status": 400
+ },
+ {
+ "code": 2064,
+ "message": "Invalid limit price tick",
+ "status": 400
+ },
+ {
+ "code": 2200,
+ "message": "Order size should exactly tally to the dust portion (i.e., smaller than minimum size) of a position",
+ "status": 400
+ },
+ {
+ "code": 2201,
+ "message": "Order level should match or beat mark price",
+ "status": 400
+ },
+ {
+ "code": 2202,
+ "message": "Cannot dedust position via a market order",
+ "status": 400
+ },
+ {
+ "code": 2203,
+ "message": "Cannot dedust position via a post-only order",
+ "status": 400
+ },
+ {
+ "code": 2204,
+ "message": "Can only dedust position via a fill-or-kill order",
+ "status": 400
+ },
+ {
+ "code": 2205,
+ "message": "Can only dedust position via a reduce-only order",
+ "status": 400
+ },
+ {
+ "code": 2206,
+ "message": "Attempting to trade the wrong buy/sell direction for dedusting position",
+ "status": 400
+ },
+ {
+ "code": 2070,
+ "message": "Liquidation Order is not supported",
+ "status": 400
+ },
+ {
+ "code": 2080,
+ "message": "Insufficient margin to create order",
"status": 400
+ },
+ {
+ "code": 2081,
+ "message": "Order Fill would result in exceeding maximum position size",
+ "status": 400
+ },
+ {
+ "code": 2082,
+ "message": "Pre-order check failed",
+ "status": 400
+ },
+ {
+ "code": 2090,
+ "message": "Max open orders exceeded",
+ "status": 429
}
]
},
{
"namespace": "Order",
- "name": "RPCCancelAllTriggerOrdersV1",
+ "name": "RPCCancelOnDisconnectV1",
"version": 1,
- "route": "/cancel_all_trigger_orders",
+ "route": "/cancel_on_disconnect",
"auth_required": true,
- "request": "ApiCancelAllOrdersRequest",
+ "request": "ApiCancelOnDisconnectRequest",
"response": "AckResponse",
"on_request_errors": [
{
@@ -1297,17 +1482,22 @@
"code": 1008,
"message": "Your IP has not been whitelisted for access",
"status": 401
+ },
+ {
+ "code": 6000,
+ "message": "Countdown time is bigger than 300s supported",
+ "status": 400
}
]
},
{
- "namespace": "Position",
- "name": "RPCDedustPositionV1",
+ "namespace": "Order",
+ "name": "RPCCreateBulkOrdersV1",
"version": 1,
- "route": "/dedust_position",
+ "route": "/create_bulk_orders",
"auth_required": true,
- "request": "ApiDedustPositionRequest",
- "response": "ApiDedustPositionResponse",
+ "request": "ApiCreateBulkOrdersRequest",
+ "response": "ApiCreateBulkOrdersResponse",
"on_request_errors": [
{
"code": 1000,
@@ -1384,6 +1574,21 @@
"message": "Order signature is from an expired session key",
"status": 403
},
+ {
+ "code": 2006,
+ "message": "Order signature R/S must have exactly 64 characters long without 0x prefix",
+ "status": 403
+ },
+ {
+ "code": 2005,
+ "message": "Order signature V must be 27/28",
+ "status": 403
+ },
+ {
+ "code": 2007,
+ "message": "Order signature S must be in the lower half of the curve",
+ "status": 403
+ },
{
"code": 2010,
"message": "Order ID should be empty when creating an order",
@@ -1459,6 +1664,11 @@
"message": "Unsupported Instrument Requested",
"status": 400
},
+ {
+ "code": 2062,
+ "message": "Order size smaller than min size",
+ "status": 400
+ },
{
"code": 2063,
"message": "Order size smaller than min block size in block trade venue",
@@ -1470,75 +1680,85 @@
"status": 400
},
{
- "code": 2200,
- "message": "Order size should exactly tally to the dust portion (i.e., smaller than minimum size) of a position",
+ "code": 2065,
+ "message": "Order size too granular",
"status": 400
},
{
- "code": 2201,
- "message": "Order level should match or beat mark price",
+ "code": 2070,
+ "message": "Liquidation Order is not supported",
"status": 400
},
{
- "code": 2202,
- "message": "Cannot dedust position via a market order",
+ "code": 2080,
+ "message": "Insufficient margin to create order",
"status": 400
},
{
- "code": 2203,
- "message": "Cannot dedust position via a post-only order",
+ "code": 2081,
+ "message": "Order Fill would result in exceeding maximum position size",
"status": 400
},
{
- "code": 2204,
- "message": "Can only dedust position via a fill-or-kill order",
+ "code": 2082,
+ "message": "Pre-order check failed",
"status": 400
},
{
- "code": 2205,
- "message": "Can only dedust position via a reduce-only order",
+ "code": 2083,
+ "message": "Order Fill would result in exceeding maximum position size under current configurable leverage tier",
"status": 400
},
{
- "code": 2206,
- "message": "Attempting to trade the wrong buy/sell direction for dedusting position",
+ "code": 2090,
+ "message": "Max open orders exceeded",
+ "status": 429
+ },
+ {
+ "code": 2110,
+ "message": "Invalid trigger by",
"status": 400
},
{
- "code": 2070,
- "message": "Liquidation Order is not supported",
+ "code": 2111,
+ "message": "Unsupported trigger by",
"status": 400
},
{
- "code": 2080,
- "message": "Insufficient margin to create order",
+ "code": 2112,
+ "message": "Invalid trigger order",
"status": 400
},
{
- "code": 2081,
- "message": "Order Fill would result in exceeding maximum position size",
+ "code": 2220,
+ "message": "No orders provided",
"status": 400
},
{
- "code": 2082,
- "message": "Pre-order check failed",
+ "code": 2221,
+ "message": "Invalid number of orders",
"status": 400
},
{
- "code": 2090,
- "message": "Max open orders exceeded",
- "status": 429
+ "code": 2222,
+ "message": "Order is not a TPSL order",
+ "status": 400
+ },
+ {
+ "code": 2223,
+ "message": "Unsupported bulk order type",
+ "status": 400
}
]
},
{
"namespace": "Order",
- "name": "RPCCancelOnDisconnectV1",
+ "name": "RPCGetOrderGroupV1",
"version": 1,
- "route": "/cancel_on_disconnect",
+ "route": "/order_group",
"auth_required": true,
- "request": "ApiCancelOnDisconnectRequest",
- "response": "AckResponse",
+ "request": "ApiGetOrderGroupRequest",
+ "response": "ApiGetOrderGroupResponse",
"on_request_errors": [
{
"code": 1000,
@@ -1571,8 +1791,18 @@
"status": 401
},
{
- "code": 6000,
- "message": "Countdown time is bigger than 300s supported",
+ "code": 1004,
+ "message": "Data Not Found",
+ "status": 404
+ },
+ {
+ "code": 3020,
+ "message": "Sub account ID must be an uint64 integer",
+ "status": 400
+ },
+ {
+ "code": 3021,
+ "message": "Either order ID or client order ID must be supplied",
"status": 400
}
]
@@ -2405,6 +2635,66 @@
}
]
},
+ {
+ "namespace": "Order",
+ "name": "StreamOrderGroupV1",
+ "channel": "v1.group",
+ "auth_required": true,
+ "feed_selector": "WSOrderGroupFeedSelectorV1",
+ "feed": "WSOrderGroupFeedDataV1",
+ "on_subscribe_errors": [
+ {
+ "code": 1000,
+ "message": "You need to authenticate prior to using this functionality",
+ "status": 401
+ },
+ {
+ "code": 1001,
+ "message": "You are not authorized to access this functionality",
+ "status": 403
+ },
+ {
+ "code": 1002,
+ "message": "Internal Server Error",
+ "status": 500
+ },
+ {
+ "code": 1008,
+ "message": "Your IP has not been whitelisted for access",
+ "status": 401
+ },
+ {
+ "code": 1101,
+ "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e",
+ "status": 400
+ },
+ {
+ "code": 1102,
+ "message": "Wrong number of primary selectors",
+ "status": 400
+ },
+ {
+ "code": 1103,
+ "message": "Wrong number of secondary selectors",
+ "status": 400
+ },
+ {
+ "code": 1103,
+ "message": "Wrong number of secondary selectors",
+ "status": 400
+ },
+ {
+ "code": 3000,
+ "message": "Instrument is invalid",
+ "status": 400
+ },
+ {
+ "code": 3020,
+ "message": "Sub account ID must be an uint64 integer",
+ "status": 400
+ }
+ ]
+ },
{
"namespace": "Execution",
"name": "StreamFillV1",
@@ -9124,6 +9414,54 @@
],
"comment": []
},
+ {
+ "name": "ApiCreateBulkOrdersRequest",
+ "is_root": true,
+ "fields": [
+ {
+ "name": "orders",
+ "lite_name": "o",
+ "semantic_type": "Order",
+ "json_type": "Order",
+ "index": 0,
+ "array_depth": 1,
+ "optional": false,
+ "comment": [
+ "The orders to create"
+ ]
+ }
+ ],
+ "comment": [
+ "Create multiple orders simultaneously for this trading account.",
+ "",
+ "This endpoint supports the following order scenarios:",
+ "- One-Cancels-Other (OCO) orders combining TP/SL",
+ "- One-Sends-Other (OSO) orders",
+ "",
+ "Usage:",
+ "- For OCO (TP/SL pair): Send exactly 2 orders in the same request - one Take Profit and one Stop Loss order",
+ "- For OSO: Send exactly one main order and one contingent order (TP and/or SL)"
+ ]
+ },
+ {
+ "name": "ApiCreateBulkOrdersResponse",
+ "is_root": true,
+ "fields": [
+ {
+ "name": "result",
+ "lite_name": "r",
+ "semantic_type": "Order",
+ "json_type": "Order",
+ "index": 0,
+ "array_depth": 1,
+ "optional": false,
+ "comment": [
+ "The created orders in same order as requested"
+ ]
+ }
+ ],
+ "comment": []
+ },
{
"name": "ApiCancelOnDisconnectRequest",
"is_root": true,
@@ -9176,6 +9514,101 @@
"If the server does not receive a heartbeat message within the countdown time, it will cancel all open orders for the specified Sub Account ID."
]
},
+ {
+ "name": "ApiGetOrderGroupRequest",
+ "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 subaccount ID for which the order groups should be retrieved."
+ ]
+ }
+ ],
+ "comment": [
+ "Retrieves the grouping of non-cancelled, non-filled client orders for a given subaccount when the grouping exist.",
+ "",
+ "helping to identify TP/SL pairs or other order relationships within the account."
+ ]
+ },
+ {
+ "name": "ClientOrderIDsByGroup",
+ "is_root": true,
+ "fields": [
+ {
+ "name": "group_id",
+ "lite_name": "gi",
+ "semantic_type": "uint128",
+ "json_type": "string",
+ "index": 0,
+ "array_depth": 0,
+ "optional": false,
+ "example": "'0x10000101000203040506'",
+ "comment": [
+ "The group this order belongs to. It can be used to define TP/SL pairs or other order groupings"
+ ]
+ },
+ {
+ "name": "client_order_id",
+ "lite_name": "co",
+ "semantic_type": "uint64",
+ "json_type": "string",
+ "index": 1,
+ "array_depth": 1,
+ "optional": false,
+ "example": "'[23042, 54232]'",
+ "comment": [
+ "List of client order IDs in the group"
+ ]
+ },
+ {
+ "name": "sub_account_id",
+ "lite_name": "sa",
+ "semantic_type": "uint64",
+ "json_type": "string",
+ "index": 2,
+ "array_depth": 0,
+ "optional": false,
+ "example": "'$GRVT_SUB_ACCOUNT_ID'",
+ "comment": [
+ "The sub account ID that these orders belong to"
+ ]
+ }
+ ],
+ "comment": [
+ "Grouping for the client order id and their associated groups.",
+ "",
+ "This is used to define TP/SL pairs or other order groupings after loading the list of Open Orders."
+ ]
+ },
+ {
+ "name": "ApiGetOrderGroupResponse",
+ "is_root": true,
+ "fields": [
+ {
+ "name": "result",
+ "lite_name": "r",
+ "semantic_type": "ClientOrderIDsByGroup",
+ "json_type": "ClientOrderIDsByGroup",
+ "index": 0,
+ "array_depth": 1,
+ "optional": false,
+ "comment": [
+ "A list of client orders grouped by their associated order group.",
+ "Each entry in the list contains a `groupID` and the corresponding `clientOrderID`s",
+ "that belong to that group."
+ ]
+ }
+ ],
+ "comment": []
+ },
{
"name": "ApiGetUserEcosystemPointRequest",
"is_root": true,
@@ -9357,16 +9790,29 @@
]
},
{
- "name": "rank",
- "lite_name": "r",
+ "name": "rank",
+ "lite_name": "r",
+ "semantic_type": "uint32",
+ "json_type": "integer",
+ "index": 10,
+ "array_depth": 0,
+ "optional": false,
+ "example": "'52'",
+ "comment": [
+ "The rank of the account in the ecosystem"
+ ]
+ },
+ {
+ "name": "epoch",
+ "lite_name": "e",
"semantic_type": "uint32",
"json_type": "integer",
- "index": 10,
+ "index": 11,
"array_depth": 0,
"optional": false,
- "example": "'52'",
+ "example": "'1'",
"comment": [
- "The rank of the account in the ecosystem"
+ "The epoch number of the ecosystem point"
]
}
],
@@ -9900,6 +10346,145 @@
],
"comment": []
},
+ {
+ "name": "QueryFindEpochRequest",
+ "is_root": true,
+ "fields": [
+ {
+ "name": "time",
+ "lite_name": "t",
+ "semantic_type": "timestamp",
+ "json_type": "string",
+ "index": 0,
+ "array_depth": 0,
+ "optional": true,
+ "default": "0",
+ "example": "1714329600000000000",
+ "comment": [
+ "The time to query the epoch"
+ ]
+ },
+ {
+ "name": "epoch",
+ "lite_name": "e",
+ "semantic_type": "int32",
+ "json_type": "integer",
+ "index": 1,
+ "array_depth": 0,
+ "optional": true,
+ "default": "0",
+ "example": "1",
+ "comment": [
+ "The epoch number"
+ ]
+ }
+ ],
+ "comment": [
+ "Query epoch by time or epoch number"
+ ]
+ },
+ {
+ "name": "Epoch",
+ "is_root": false,
+ "fields": [
+ {
+ "name": "epoch",
+ "lite_name": "e",
+ "semantic_type": "int32",
+ "json_type": "integer",
+ "index": 0,
+ "array_depth": 0,
+ "optional": false,
+ "comment": [
+ "The epoch number"
+ ]
+ },
+ {
+ "name": "start_time",
+ "lite_name": "st",
+ "semantic_type": "timestamp",
+ "json_type": "string",
+ "index": 1,
+ "array_depth": 0,
+ "optional": false,
+ "comment": [
+ "The start time of the epoch"
+ ]
+ },
+ {
+ "name": "end_time",
+ "lite_name": "et",
+ "semantic_type": "timestamp",
+ "json_type": "string",
+ "index": 2,
+ "array_depth": 0,
+ "optional": false,
+ "comment": [
+ "The end time of the epoch"
+ ]
+ }
+ ],
+ "comment": []
+ },
+ {
+ "name": "QueryFindEpochResponse",
+ "is_root": true,
+ "fields": [
+ {
+ "name": "epoch",
+ "lite_name": "e",
+ "semantic_type": "Epoch",
+ "json_type": "Epoch",
+ "index": 0,
+ "array_depth": 0,
+ "optional": false,
+ "comment": [
+ "The epoch"
+ ]
+ }
+ ],
+ "comment": []
+ },
+ {
+ "name": "QueryGetListEpochRequest",
+ "is_root": true,
+ "fields": [
+ {
+ "name": "limit",
+ "lite_name": "l",
+ "semantic_type": "uint32",
+ "json_type": "integer",
+ "index": 0,
+ "array_depth": 0,
+ "optional": true,
+ "default": "0",
+ "example": "100",
+ "comment": [
+ "The limit to query for"
+ ]
+ }
+ ],
+ "comment": []
+ },
+ {
+ "name": "QueryGetListEpochResponse",
+ "is_root": true,
+ "fields": [
+ {
+ "name": "result",
+ "lite_name": "r",
+ "semantic_type": "Epoch",
+ "json_type": "Epoch",
+ "index": 0,
+ "array_depth": 1,
+ "optional": false,
+ "comment": [
+ "The list of epochs"
+ ]
+ }
+ ],
+ "comment": []
+ },
{
"name": "QueryEpochBadgeRequest",
"is_root": true,
@@ -11068,7 +11653,7 @@
{
"name": "epoch",
"lite_name": "e",
- "semantic_type": "uint32",
+ "semantic_type": "int32",
"json_type": "integer",
"index": 0,
"array_depth": 0,
@@ -11147,7 +11732,7 @@
{
"name": "epoch",
"lite_name": "e",
- "semantic_type": "uint32",
+ "semantic_type": "int32",
"json_type": "integer",
"index": 0,
"array_depth": 0,
@@ -11577,6 +12162,19 @@
"comment": [
"The cursor to indicate when to start the next query from"
]
+ },
+ {
+ "name": "group_by_signer",
+ "lite_name": "gb",
+ "semantic_type": "bool",
+ "json_type": "boolean",
+ "index": 9,
+ "array_depth": 0,
+ "optional": false,
+ "example": "true",
+ "comment": [
+ "Whether to group trades by signer per sub account"
+ ]
}
],
"comment": [
@@ -11651,6 +12249,18 @@
"comment": [
"Total positive fee paid by user"
]
+ },
+ {
+ "name": "signer",
+ "lite_name": "s",
+ "semantic_type": "address",
+ "json_type": "string",
+ "index": 5,
+ "array_depth": 0,
+ "optional": false,
+ "comment": [
+ "The signer of the trade"
+ ]
}
],
"comment": [
@@ -13138,6 +13748,101 @@
""
]
},
+ {
+ "name": "WSOrderGroupFeedSelectorV1",
+ "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 subaccount ID to filter by"
+ ],
+ "selector": "primary"
+ }
+ ],
+ "comment": [
+ "Subscribes to a feed of order group to get updated when a new group is created for the subAccount specified.",
+ ""
+ ]
+ },
+ {
+ "name": "WSOrderGroupFeedDataV1",
+ "is_root": true,
+ "fields": [
+ {
+ "name": "stream",
+ "lite_name": "s",
+ "semantic_type": "string",
+ "json_type": "string",
+ "index": 0,
+ "array_depth": 0,
+ "optional": false,
+ "example": "'v1.group'",
+ "comment": [
+ "Stream name"
+ ]
+ },
+ {
+ "name": "selector",
+ "lite_name": "s1",
+ "semantic_type": "string",
+ "json_type": "string",
+ "index": 1,
+ "array_depth": 0,
+ "optional": false,
+ "example": "'$GRVT_SUB_ACCOUNT_ID'",
+ "comment": [
+ "Primary selector"
+ ]
+ },
+ {
+ "name": "sequence_number",
+ "lite_name": "sn",
+ "semantic_type": "uint64",
+ "json_type": "string",
+ "index": 2,
+ "array_depth": 0,
+ "optional": false,
+ "example": "'872634876'",
+ "comment": [
+ "A running sequence number that determines global message order within the specific stream"
+ ]
+ },
+ {
+ "name": "feed",
+ "lite_name": "f",
+ "semantic_type": "ClientOrderIDsByGroup",
+ "json_type": "ClientOrderIDsByGroup",
+ "index": 3,
+ "array_depth": 0,
+ "optional": false,
+ "comment": [
+ "The order object being created or updated"
+ ]
+ },
+ {
+ "name": "prev_sequence_number",
+ "lite_name": "ps",
+ "semantic_type": "uint64",
+ "json_type": "string",
+ "index": 4,
+ "array_depth": 0,
+ "optional": false,
+ "example": "'872634875'",
+ "comment": [
+ "The previous sequence number that determines global message order within the specific stream"
+ ]
+ }
+ ],
+ "comment": []
+ },
{
"name": "ApiWithdrawalRequest",
"is_root": true,
@@ -13966,6 +14671,13 @@
"comment": [
"Cancellation has expired because corresponding order had not arrived within the defined time-to-live window."
]
+ },
+ {
+ "name": "DROPPED_DUPLICATE",
+ "value": 2,
+ "comment": [
+ "This cancellation request was dropped because its TTL window overlaps with another cancellation request for the same order."
+ ]
}
],
"comment": []
@@ -14809,6 +15521,13 @@
"comment": [
"client cancel on disconnect triggered"
]
+ },
+ {
+ "name": "OCO_COUNTER_PART_TRIGGERED",
+ "value": 30,
+ "comment": [
+ "the OCO counter part order was triggered"
+ ]
}
],
"comment": []