更新文档,添加和修改多个API接口的描述,确保文档内容的准确性和完整性,提升开发者使用体验。

This commit is contained in:
discountry
2025-09-27 02:10:28 +08:00
parent 2c62d2ed3e
commit 64640f4494
297 changed files with 33451 additions and 5 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+4
View File
@@ -0,0 +1,4 @@
!!! info "[Ack](/../../schemas/ack)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|ack<br>`a` |boolean|True|Gravity has acknowledged that the request has been successfully received and it will process it in the backend|
+10
View File
@@ -0,0 +1,10 @@
!!! info "[AckResponse](/../../schemas/ack_response)"
Used to acknowledge a request has been received and will be processed<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |Ack|True|The Ack Object|
??? info "[Ack](/../../schemas/ack)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|ack<br>`a` |boolean|True|Gravity has acknowledged that the request has been successfully received and it will process it in the backend|
@@ -0,0 +1,21 @@
!!! info "[AggregatedAccountSummary](/../../schemas/aggregated_account_summary)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|main_account_id<br>`ma` |string|True|The main account ID of the account to which the summary belongs|
|total_equity<br>`te` |string|True|Total equity of the main (+ sub) account, denominated in USD|
|spot_balances<br>`sb` |[SpotBalance]|True|The list of spot assets owned by this main (+ sub) account, and their balances|
|vault_investments<br>`vi` |[VaultInvestment]|True|The list of vault investments held by this main account|
??? info "[SpotBalance](/../../schemas/spot_balance)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|currency<br>`c` |string|True|The currency you hold a spot balance in|
|balance<br>`b` |string|True|This currency's balance in this trading account.|
|index_price<br>`ip` |string|True|The index price of this currency. (reported in `USD`)|
??? info "[VaultInvestment](/../../schemas/vault_investment)"
Summarizes a vault investment held by a funding account<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|vault_id<br>`vi` |string|True|The trading account ID of the vault invested in.|
|num_lp_tokens<br>`nl` |string|True|The number of shares held by the investor.|
|share_price<br>`sp` |string|True|The current share price (in USD) of this vault investment.|
@@ -0,0 +1,27 @@
!!! info "[ApiAggregatedAccountSummaryResponse](/../../schemas/api_aggregated_account_summary_response)"
The aggregated account summary, that reports the total equity and spot balances of a funding (main) account, and its constituent trading (sub) accounts<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |AggregatedAccountSummary|True|The aggregated account summary|
??? info "[AggregatedAccountSummary](/../../schemas/aggregated_account_summary)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|main_account_id<br>`ma` |string|True|The main account ID of the account to which the summary belongs|
|total_equity<br>`te` |string|True|Total equity of the main (+ sub) account, denominated in USD|
|spot_balances<br>`sb` |[SpotBalance]|True|The list of spot assets owned by this main (+ sub) account, and their balances|
|vault_investments<br>`vi` |[VaultInvestment]|True|The list of vault investments held by this main account|
??? info "[SpotBalance](/../../schemas/spot_balance)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|currency<br>`c` |string|True|The currency you hold a spot balance in|
|balance<br>`b` |string|True|This currency's balance in this trading account.|
|index_price<br>`ip` |string|True|The index price of this currency. (reported in `USD`)|
??? info "[VaultInvestment](/../../schemas/vault_investment)"
Summarizes a vault investment held by a funding account<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|vault_id<br>`vi` |string|True|The trading account ID of the vault invested in.|
|num_lp_tokens<br>`nl` |string|True|The number of shares held by the investor.|
|share_price<br>`sp` |string|True|The current share price (in USD) of this vault investment.|
@@ -0,0 +1,18 @@
!!! info "[ApiCancelAllOrdersRequest](/../../schemas/api_cancel_all_orders_request)"
Cancel all orders on the orderbook for this trading account. This may not match new orders in flight.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|sub_account_id<br>`sa` |string|True|The subaccount ID cancelling all orders|
|kind<br>`k` |[Kind]|False<br>`all`|The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be cancelled|
|base<br>`b` |[string]|False<br>`all`|The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be cancelled|
|quote<br>`q` |[string]|False<br>`all`|The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be cancelled|
??? info "[Kind](/../../schemas/kind)"
The list of asset kinds that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`PERPETUAL` = 1|the perpetual asset kind|
|`FUTURE` = 2|the future asset kind|
|`CALL` = 3|the call option asset kind|
|`PUT` = 4|the put option asset kind|
@@ -0,0 +1,4 @@
!!! info "[ApiCancelAllOrdersResponse](/../../schemas/api_cancel_all_orders_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |integer|True|The number of orders cancelled|
@@ -0,0 +1,7 @@
!!! info "[ApiCancelOnDisconnectRequest](/../../schemas/api_cancel_on_disconnect_request)"
Auto-Cancel All Open Orders when the countdown time hits zero.<br><br>Market Maker inputs a countdown time parameter in milliseconds (e.g. 120000 for 120s) rounded down to the smallest second follows the following logic:<br> - Market Maker initially entered a value between 0 -> 1000, which is rounded to 0: will result in termination of their COD<br> - Market Maker initially entered a value between 1001 -> 300_000, which is rounded to the nearest second: will result in refresh of their COD<br> - Market Maker initially entered a value bigger than 300_000, which will result in error (upper bound)<br>Market Maker will send a heartbeat message by calling the endpoint at specific intervals (ex. every 30 seconds) to the server to refresh the count down.<br><br>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.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|sub_account_id<br>`sa` |string|True|The subaccount ID cancelling the orders for|
|countdown_time<br>`ct` |string|False<br>`1000`|Countdown time in milliseconds (ex. 120000 for 120s).<br><br>0 to disable the timer.<br><br>Does not accept negative values.<br><br>Minimum acceptable value is 1,000.<br><br>Maximum acceptable value is 300,000|
@@ -0,0 +1,9 @@
!!! info "[ApiCancelOrderRequest](/../../schemas/api_cancel_order_request)"
Cancel an order on the orderbook for this trading account. Either `order_id` or `client_order_id` must be provided.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|sub_account_id<br>`sa` |string|True|The subaccount ID cancelling the order|
|order_id<br>`oi` |string|False<br>`0`|Cancel the order with this `order_id`|
|client_order_id<br>`co` |string|False<br>`0`|Cancel the order with this `client_order_id`|
|time_to_live_ms<br>`tt` |string|False<br>`100`|Specifies the time-to-live (in milliseconds) for this cancellation.<br>During this period, any order creation with a matching `client_order_id` will be cancelled and not be added to the GRVT matching engine.<br>This mechanism helps mitigate time-of-flight issues where cancellations might arrive before the corresponding orders.<br>Hence, cancellation by `order_id` ignores this field as the exchange can only assign `order_id`s to already-processed order creations.<br>The duration cannot be negative, is rounded down to the nearest 100ms (e.g., `'670'` -> `'600'`, `'30'` -> `'0'`) and capped at 5 seconds (i.e., `'5000'`).<br>Value of `'0'` or omission results in the default time-to-live value being applied.<br>If the caller requests multiple successive cancellations for a given order, such that the time-to-live windows overlap, only the first request will be considered.<br>|
@@ -0,0 +1,147 @@
!!! info "[ApiCancelOrderResponse](/../../schemas/api_cancel_order_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |Order|True|The cancelled order|
??? info "[Order](/../../schemas/order)"
Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.<br>GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.<br>This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.<br>Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.<br><br>All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.<br>This minimizes the amount of trust users have to offer to GRVT<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|order_id<br>`oi` |string|False<br>`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
|sub_account_id<br>`sa` |string|True|The subaccount initiating the order|
|is_market<br>`im` |boolean|False<br>`false`|If the order is a market order<br>Market Orders do not have a limit price, and are always executed according to the maker order price.<br>Market Orders must always be taker orders|
|time_in_force<br>`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:<ul><br><li>PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg</li><br><li>FULL EXECUTION = AON / FOK - only allows full size execution on all legs</li><br><li>TAKER ONLY = IOC / FOK - only allows taker orders</li><br><li>MAKER OR TAKER = GTT / AON - allows maker or taker orders</li><br></ul>Exchange only supports (GTT, IOC, FOK)<br>RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
|post_only<br>`po` |boolean|False<br>`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.<br>If False, Order can be either a maker or taker order. <b>In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.</b><br><br>| | Must Fill All | Can Fill Partial |<br>| - | - | - |<br>| Must Be Taker | FOK + False | IOC + False |<br>| Can Be Either | AON + False | GTC + False |<br>| Must Be Maker | AON + True | GTC + True |<br>|
|reduce_only<br>`ro` |boolean|False<br>`false`|If True, Order must reduce the position size, or be cancelled|
|legs<br>`l` |[OrderLeg]|True|The legs present in this order<br>The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
|signature<br>`s` |Signature|True|The signature approving this order|
|metadata<br>`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
|state<br>`s1` |OrderState|False<br>`''`|[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 |
<br>
|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<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The instrument to trade in this leg|
|size<br>`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
|limit_price<br>`lp` |string|False<br>`0`|The limit price of the order leg, expressed in `9` decimals.<br>This is the number of quote currency units to pay/receive for this leg.<br>This should be `null/0` if the order is a market order|
|is_buying_asset<br>`ib` |boolean|True|Specifies if the order leg is a buy or sell|
??? info "[Signature](/../../schemas/signature)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|signer<br>`s` |string|True|The address (public key) of the wallet signing the payload|
|r<br>`r` |string|True|Signature R|
|s<br>`s1` |string|True|Signature S|
|v<br>`v` |integer|True|Signature V|
|expiration<br>`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
|nonce<br>`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.<br>ie. You can send the same exact instruction twice with different nonces.<br>When the same nonce is used, the same payload will generate the same signature.<br>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.<br>Hence, fields in here are never signed, and is never transmitted to the smart contract.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|client_order_id<br>`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client<br>This is used to identify the order in the client's system<br>This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer<br>This field will not be propagated to the smart contract, and should not be signed by the client<br>This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected<br>Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]<br>To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]<br><br>When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time<br>`ct` |string|False<br>`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
|trigger<br>`t` |TriggerOrderMetadata|False<br>``|Trigger fields are used to support any type of trigger order such as TP/SL|
|broker<br>`b` |BrokerTag|False<br>``|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).<br><br>Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_type<br>`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
|tpsl<br>`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.<br><br>|
??? info "[TriggerType](/../../schemas/trigger_type)"
Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.<br><br>Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.<br><br><br>
|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.<br><br>### Fields:<br>- **triggerBy**: Defines the price type that activates the order (e.g., index price).<br>- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_by<br>`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
|trigger_price<br>`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.<br><br>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.<br><br><br>
|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.<br>
|Value| Description |
|-|-|
|`UNSPECIFIED` = 0||
|`COIN_ROUTES` = 1|CoinRoutes|
|`ALERTATRON` = 2|Alertatron|
|`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|status<br>`s` |OrderStatus|True|The status of the order|
|reject_reason<br>`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
|book_size<br>`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
|traded_size<br>`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
|update_time<br>`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
|avg_fill_price<br>`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|
@@ -0,0 +1,40 @@
!!! info "[ApiCandlestickRequest](/../../schemas/api_candlestick_request)"
Kline/Candlestick bars for an instrument. Klines are uniquely identified by their instrument, type, interval, and open time.<br><br>Pagination works as follows:<ul><li>We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.</li><li>The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.</li><li>If a `cursor` is provided, it will be used to fetch results from that point onwards.</li><li>Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.</li></ul><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The readable instrument name:<ul><li>Perpetual: `ETH_USDT_Perp`</li><li>Future: `BTC_USDT_Fut_20Oct23`</li><li>Call: `ETH_USDT_Call_20Oct23_2800`</li><li>Put: `ETH_USDT_Put_20Oct23_2800`</li></ul>|
|interval<br>`i1` |CandlestickInterval|True|The interval of each candlestick|
|type<br>`t` |CandlestickType|True|The type of candlestick data to retrieve|
|start_time<br>`st` |string|False<br>`0`|Start time of kline data in unix nanoseconds|
|end_time<br>`et` |string|False<br>`now()`|End time of kline data in unix nanoseconds|
|limit<br>`l` |integer|False<br>`500`|The limit to query for. Defaults to 500; Max 1000|
|cursor<br>`c` |string|False<br>`''`|The cursor to indicate when to start the query from|
??? info "[CandlestickInterval](/../../schemas/candlestick_interval)"
|Value| Description |
|-|-|
|`CI_1_M` = 1|1 minute|
|`CI_3_M` = 2|3 minutes|
|`CI_5_M` = 3|5 minutes|
|`CI_15_M` = 4|15 minutes|
|`CI_30_M` = 5|30 minutes|
|`CI_1_H` = 6|1 hour|
|`CI_2_H` = 7|2 hour|
|`CI_4_H` = 8|4 hour|
|`CI_6_H` = 9|6 hour|
|`CI_8_H` = 10|8 hour|
|`CI_12_H` = 11|12 hour|
|`CI_1_D` = 12|1 day|
|`CI_3_D` = 13|3 days|
|`CI_5_D` = 14|5 days|
|`CI_1_W` = 15|1 week|
|`CI_2_W` = 16|2 weeks|
|`CI_3_W` = 17|3 weeks|
|`CI_4_W` = 18|4 weeks|
??? info "[CandlestickType](/../../schemas/candlestick_type)"
|Value| Description |
|-|-|
|`TRADE` = 1|Tracks traded prices|
|`MARK` = 2|Tracks mark prices|
|`INDEX` = 3|Tracks index prices|
|`MID` = 4|Tracks book mid prices|
@@ -0,0 +1,20 @@
!!! info "[ApiCandlestickResponse](/../../schemas/api_candlestick_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |[Candlestick]|True|The candlestick result set for given interval|
|next<br>`n` |string|False<br>`''`|The cursor to indicate when to start the next query from|
??? info "[Candlestick](/../../schemas/candlestick)"
<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|open_time<br>`ot` |string|True|Open time of kline bar in unix nanoseconds|
|close_time<br>`ct` |string|True|Close time of kline bar in unix nanosecond|
|open<br>`o` |string|True|The open price, expressed in underlying currency resolution units|
|close<br>`c` |string|True|The close price, expressed in underlying currency resolution units|
|high<br>`h` |string|True|The high price, expressed in underlying currency resolution units|
|low<br>`l` |string|True|The low price, expressed in underlying currency resolution units|
|volume_b<br>`vb` |string|True|The underlying volume transacted, expressed in base asset decimal units|
|volume_q<br>`vq` |string|True|The quote volume transacted, expressed in quote asset decimal units|
|trades<br>`t` |integer|True|The number of trades transacted|
|instrument<br>`i` |string|True|The readable instrument name:<ul><li>Perpetual: `ETH_USDT_Perp`</li><li>Future: `BTC_USDT_Fut_20Oct23`</li><li>Call: `ETH_USDT_Call_20Oct23_2800`</li><li>Put: `ETH_USDT_Put_20Oct23_2800`</li></ul>|
@@ -0,0 +1,5 @@
!!! info "[ApiCategoryAffinityScoreRequest](/../../schemas/api_category_affinity_score_request)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|start_time<br>`st` |string|True|The start time of query. Can leave empty to query from the beginning|
|end_time<br>`et` |string|True|The end time of query. Can leave empty to query until now|
@@ -0,0 +1,12 @@
!!! info "[ApiCategoryAffinityScoreResponse](/../../schemas/api_category_affinity_score_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |[UserCategoryAffinityScore]|True|The list of categoryAffinities score|
??? info "[UserCategoryAffinityScore](/../../schemas/user_category_affinity_score)"
<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|account_id<br>`ai` |string|True|The off chain account id|
|category_id<br>`ci` |string|True|target category|
|affinity_score<br>`as` |number|True|affinity score|
@@ -0,0 +1,149 @@
!!! info "[ApiCreateBulkOrdersRequest](/../../schemas/api_create_bulk_orders_request)"
Create multiple orders simultaneously for this trading account.<br><br>This endpoint supports the following order scenarios:<br>- One-Cancels-Other (OCO) orders combining TP/SL<br>- One-Sends-Other (OSO) orders<br><br>Usage:<br>- For OCO (TP/SL pair): Send exactly 2 orders in the same request - one Take Profit and one Stop Loss order<br>- For OSO: Send exactly one main order and one contingent order (TP and/or SL)<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|orders<br>`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.<br>GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.<br>This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.<br>Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.<br><br>All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.<br>This minimizes the amount of trust users have to offer to GRVT<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|order_id<br>`oi` |string|False<br>`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
|sub_account_id<br>`sa` |string|True|The subaccount initiating the order|
|is_market<br>`im` |boolean|False<br>`false`|If the order is a market order<br>Market Orders do not have a limit price, and are always executed according to the maker order price.<br>Market Orders must always be taker orders|
|time_in_force<br>`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:<ul><br><li>PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg</li><br><li>FULL EXECUTION = AON / FOK - only allows full size execution on all legs</li><br><li>TAKER ONLY = IOC / FOK - only allows taker orders</li><br><li>MAKER OR TAKER = GTT / AON - allows maker or taker orders</li><br></ul>Exchange only supports (GTT, IOC, FOK)<br>RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
|post_only<br>`po` |boolean|False<br>`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.<br>If False, Order can be either a maker or taker order. <b>In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.</b><br><br>| | Must Fill All | Can Fill Partial |<br>| - | - | - |<br>| Must Be Taker | FOK + False | IOC + False |<br>| Can Be Either | AON + False | GTC + False |<br>| Must Be Maker | AON + True | GTC + True |<br>|
|reduce_only<br>`ro` |boolean|False<br>`false`|If True, Order must reduce the position size, or be cancelled|
|legs<br>`l` |[OrderLeg]|True|The legs present in this order<br>The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
|signature<br>`s` |Signature|True|The signature approving this order|
|metadata<br>`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
|state<br>`s1` |OrderState|False<br>`''`|[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 |
<br>
|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<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The instrument to trade in this leg|
|size<br>`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
|limit_price<br>`lp` |string|False<br>`0`|The limit price of the order leg, expressed in `9` decimals.<br>This is the number of quote currency units to pay/receive for this leg.<br>This should be `null/0` if the order is a market order|
|is_buying_asset<br>`ib` |boolean|True|Specifies if the order leg is a buy or sell|
??? info "[Signature](/../../schemas/signature)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|signer<br>`s` |string|True|The address (public key) of the wallet signing the payload|
|r<br>`r` |string|True|Signature R|
|s<br>`s1` |string|True|Signature S|
|v<br>`v` |integer|True|Signature V|
|expiration<br>`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
|nonce<br>`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.<br>ie. You can send the same exact instruction twice with different nonces.<br>When the same nonce is used, the same payload will generate the same signature.<br>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.<br>Hence, fields in here are never signed, and is never transmitted to the smart contract.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|client_order_id<br>`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client<br>This is used to identify the order in the client's system<br>This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer<br>This field will not be propagated to the smart contract, and should not be signed by the client<br>This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected<br>Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]<br>To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]<br><br>When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time<br>`ct` |string|False<br>`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
|trigger<br>`t` |TriggerOrderMetadata|False<br>``|Trigger fields are used to support any type of trigger order such as TP/SL|
|broker<br>`b` |BrokerTag|False<br>``|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).<br><br>Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_type<br>`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
|tpsl<br>`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.<br><br>|
??? info "[TriggerType](/../../schemas/trigger_type)"
Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.<br><br>Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.<br><br><br>
|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.<br><br>### Fields:<br>- **triggerBy**: Defines the price type that activates the order (e.g., index price).<br>- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_by<br>`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
|trigger_price<br>`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.<br><br>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.<br><br><br>
|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.<br>
|Value| Description |
|-|-|
|`UNSPECIFIED` = 0||
|`COIN_ROUTES` = 1|CoinRoutes|
|`ALERTATRON` = 2|Alertatron|
|`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|status<br>`s` |OrderStatus|True|The status of the order|
|reject_reason<br>`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
|book_size<br>`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
|traded_size<br>`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
|update_time<br>`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
|avg_fill_price<br>`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|
@@ -0,0 +1,147 @@
!!! info "[ApiCreateBulkOrdersResponse](/../../schemas/api_create_bulk_orders_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`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.<br>GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.<br>This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.<br>Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.<br><br>All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.<br>This minimizes the amount of trust users have to offer to GRVT<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|order_id<br>`oi` |string|False<br>`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
|sub_account_id<br>`sa` |string|True|The subaccount initiating the order|
|is_market<br>`im` |boolean|False<br>`false`|If the order is a market order<br>Market Orders do not have a limit price, and are always executed according to the maker order price.<br>Market Orders must always be taker orders|
|time_in_force<br>`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:<ul><br><li>PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg</li><br><li>FULL EXECUTION = AON / FOK - only allows full size execution on all legs</li><br><li>TAKER ONLY = IOC / FOK - only allows taker orders</li><br><li>MAKER OR TAKER = GTT / AON - allows maker or taker orders</li><br></ul>Exchange only supports (GTT, IOC, FOK)<br>RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
|post_only<br>`po` |boolean|False<br>`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.<br>If False, Order can be either a maker or taker order. <b>In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.</b><br><br>| | Must Fill All | Can Fill Partial |<br>| - | - | - |<br>| Must Be Taker | FOK + False | IOC + False |<br>| Can Be Either | AON + False | GTC + False |<br>| Must Be Maker | AON + True | GTC + True |<br>|
|reduce_only<br>`ro` |boolean|False<br>`false`|If True, Order must reduce the position size, or be cancelled|
|legs<br>`l` |[OrderLeg]|True|The legs present in this order<br>The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
|signature<br>`s` |Signature|True|The signature approving this order|
|metadata<br>`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
|state<br>`s1` |OrderState|False<br>`''`|[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 |
<br>
|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<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The instrument to trade in this leg|
|size<br>`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
|limit_price<br>`lp` |string|False<br>`0`|The limit price of the order leg, expressed in `9` decimals.<br>This is the number of quote currency units to pay/receive for this leg.<br>This should be `null/0` if the order is a market order|
|is_buying_asset<br>`ib` |boolean|True|Specifies if the order leg is a buy or sell|
??? info "[Signature](/../../schemas/signature)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|signer<br>`s` |string|True|The address (public key) of the wallet signing the payload|
|r<br>`r` |string|True|Signature R|
|s<br>`s1` |string|True|Signature S|
|v<br>`v` |integer|True|Signature V|
|expiration<br>`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
|nonce<br>`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.<br>ie. You can send the same exact instruction twice with different nonces.<br>When the same nonce is used, the same payload will generate the same signature.<br>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.<br>Hence, fields in here are never signed, and is never transmitted to the smart contract.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|client_order_id<br>`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client<br>This is used to identify the order in the client's system<br>This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer<br>This field will not be propagated to the smart contract, and should not be signed by the client<br>This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected<br>Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]<br>To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]<br><br>When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time<br>`ct` |string|False<br>`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
|trigger<br>`t` |TriggerOrderMetadata|False<br>``|Trigger fields are used to support any type of trigger order such as TP/SL|
|broker<br>`b` |BrokerTag|False<br>``|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).<br><br>Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_type<br>`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
|tpsl<br>`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.<br><br>|
??? info "[TriggerType](/../../schemas/trigger_type)"
Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.<br><br>Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.<br><br><br>
|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.<br><br>### Fields:<br>- **triggerBy**: Defines the price type that activates the order (e.g., index price).<br>- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_by<br>`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
|trigger_price<br>`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.<br><br>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.<br><br><br>
|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.<br>
|Value| Description |
|-|-|
|`UNSPECIFIED` = 0||
|`COIN_ROUTES` = 1|CoinRoutes|
|`ALERTATRON` = 2|Alertatron|
|`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|status<br>`s` |OrderStatus|True|The status of the order|
|reject_reason<br>`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
|book_size<br>`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
|traded_size<br>`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
|update_time<br>`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
|avg_fill_price<br>`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|
@@ -0,0 +1,160 @@
!!! info "[ApiCreateOrderRequest](/../../schemas/api_create_order_request)"
Create an order on the orderbook for this trading account.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|order<br>`o` |Order|True|The order to create|
??? info "[Order](/../../schemas/order)"
Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.<br>GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.<br>This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.<br>Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.<br><br>All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.<br>This minimizes the amount of trust users have to offer to GRVT<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|order_id<br>`oi` |string|False<br>`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
|sub_account_id<br>`sa` |string|True|The subaccount initiating the order|
|is_market<br>`im` |boolean|False<br>`false`|If the order is a market order<br>Market Orders do not have a limit price, and are always executed according to the maker order price.<br>Market Orders must always be taker orders|
|time_in_force<br>`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:<ul><br><li>PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg</li><br><li>FULL EXECUTION = AON / FOK - only allows full size execution on all legs</li><br><li>TAKER ONLY = IOC / FOK - only allows taker orders</li><br><li>MAKER OR TAKER = GTT / AON - allows maker or taker orders</li><br></ul>Exchange only supports (GTT, IOC, FOK)<br>RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
|post_only<br>`po` |boolean|False<br>`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.<br>If False, Order can be either a maker or taker order. <b>In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.</b><br><br>| | Must Fill All | Can Fill Partial |<br>| - | - | - |<br>| Must Be Taker | FOK + False | IOC + False |<br>| Can Be Either | AON + False | GTC + False |<br>| Must Be Maker | AON + True | GTC + True |<br>|
|reduce_only<br>`ro` |boolean|False<br>`false`|If True, Order must reduce the position size, or be cancelled|
|legs<br>`l` |[OrderLeg]|True|The legs present in this order<br>The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
|signature<br>`s` |Signature|True|The signature approving this order|
|metadata<br>`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
|state<br>`s1` |OrderState|False<br>`''`|[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 |
<br>
|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|
|`RETAIL_PRICE_IMPROVEMENT` = 5|RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users.|
??? info "[OrderLeg](/../../schemas/order_leg)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The instrument to trade in this leg|
|size<br>`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
|limit_price<br>`lp` |string|False<br>`0`|The limit price of the order leg, expressed in `9` decimals.<br>This is the number of quote currency units to pay/receive for this leg.<br>This should be `null/0` if the order is a market order|
|is_buying_asset<br>`ib` |boolean|True|Specifies if the order leg is a buy or sell|
??? info "[Signature](/../../schemas/signature)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|signer<br>`s` |string|True|The address (public key) of the wallet signing the payload|
|r<br>`r` |string|True|Signature R|
|s<br>`s1` |string|True|Signature S|
|v<br>`v` |integer|True|Signature V|
|expiration<br>`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
|nonce<br>`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.<br>ie. You can send the same exact instruction twice with different nonces.<br>When the same nonce is used, the same payload will generate the same signature.<br>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.<br>Hence, fields in here are never signed, and is never transmitted to the smart contract.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|client_order_id<br>`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client<br>This is used to identify the order in the client's system<br>This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer<br>This field will not be propagated to the smart contract, and should not be signed by the client<br>This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected<br>Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]<br>To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]<br><br>When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time<br>`ct` |string|False<br>`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
|trigger<br>`t` |TriggerOrderMetadata|False<br>``|Trigger fields are used to support any type of trigger order such as TP/SL|
|broker<br>`b` |BrokerTag|False<br>``|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).<br><br>Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_type<br>`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
|tpsl<br>`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.<br><br>|
??? info "[TriggerType](/../../schemas/trigger_type)"
Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.<br><br>Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.<br><br><br>
|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.<br><br>### Fields:<br>- **triggerBy**: Defines the price type that activates the order (e.g., index price).<br>- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_by<br>`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
|trigger_price<br>`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
|close_position<br>`cp` |boolean|True|If True, the order will close the position when the trigger price is reached|
??? info "[TriggerBy](/../../schemas/trigger_by)"
Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.<br><br>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.<br><br><br>
|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|
|`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
|`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
??? info "[BrokerTag](/../../schemas/broker_tag)"
BrokerTag is a tag for the broker that the order is sent from.<br>
|Value| Description |
|-|-|
|`UNSPECIFIED` = 0||
|`COIN_ROUTES` = 1|CoinRoutes|
|`ALERTATRON` = 2|Alertatron|
|`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|status<br>`s` |OrderStatus|True|The status of the order|
|reject_reason<br>`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
|book_size<br>`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
|traded_size<br>`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
|update_time<br>`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
|avg_fill_price<br>`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|
|`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
|`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
|`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
|`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
|`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
|`INVALID_ORDER_TYPE` = 36|the order type is invalid|
|`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
@@ -0,0 +1,158 @@
!!! info "[ApiCreateOrderResponse](/../../schemas/api_create_order_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |Order|True|The created order|
??? info "[Order](/../../schemas/order)"
Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.<br>GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.<br>This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.<br>Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.<br><br>All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.<br>This minimizes the amount of trust users have to offer to GRVT<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|order_id<br>`oi` |string|False<br>`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
|sub_account_id<br>`sa` |string|True|The subaccount initiating the order|
|is_market<br>`im` |boolean|False<br>`false`|If the order is a market order<br>Market Orders do not have a limit price, and are always executed according to the maker order price.<br>Market Orders must always be taker orders|
|time_in_force<br>`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:<ul><br><li>PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg</li><br><li>FULL EXECUTION = AON / FOK - only allows full size execution on all legs</li><br><li>TAKER ONLY = IOC / FOK - only allows taker orders</li><br><li>MAKER OR TAKER = GTT / AON - allows maker or taker orders</li><br></ul>Exchange only supports (GTT, IOC, FOK)<br>RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
|post_only<br>`po` |boolean|False<br>`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.<br>If False, Order can be either a maker or taker order. <b>In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.</b><br><br>| | Must Fill All | Can Fill Partial |<br>| - | - | - |<br>| Must Be Taker | FOK + False | IOC + False |<br>| Can Be Either | AON + False | GTC + False |<br>| Must Be Maker | AON + True | GTC + True |<br>|
|reduce_only<br>`ro` |boolean|False<br>`false`|If True, Order must reduce the position size, or be cancelled|
|legs<br>`l` |[OrderLeg]|True|The legs present in this order<br>The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
|signature<br>`s` |Signature|True|The signature approving this order|
|metadata<br>`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
|state<br>`s1` |OrderState|False<br>`''`|[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 |
<br>
|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|
|`RETAIL_PRICE_IMPROVEMENT` = 5|RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users.|
??? info "[OrderLeg](/../../schemas/order_leg)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The instrument to trade in this leg|
|size<br>`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
|limit_price<br>`lp` |string|False<br>`0`|The limit price of the order leg, expressed in `9` decimals.<br>This is the number of quote currency units to pay/receive for this leg.<br>This should be `null/0` if the order is a market order|
|is_buying_asset<br>`ib` |boolean|True|Specifies if the order leg is a buy or sell|
??? info "[Signature](/../../schemas/signature)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|signer<br>`s` |string|True|The address (public key) of the wallet signing the payload|
|r<br>`r` |string|True|Signature R|
|s<br>`s1` |string|True|Signature S|
|v<br>`v` |integer|True|Signature V|
|expiration<br>`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
|nonce<br>`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.<br>ie. You can send the same exact instruction twice with different nonces.<br>When the same nonce is used, the same payload will generate the same signature.<br>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.<br>Hence, fields in here are never signed, and is never transmitted to the smart contract.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|client_order_id<br>`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client<br>This is used to identify the order in the client's system<br>This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer<br>This field will not be propagated to the smart contract, and should not be signed by the client<br>This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected<br>Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]<br>To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]<br><br>When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time<br>`ct` |string|False<br>`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
|trigger<br>`t` |TriggerOrderMetadata|False<br>``|Trigger fields are used to support any type of trigger order such as TP/SL|
|broker<br>`b` |BrokerTag|False<br>``|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).<br><br>Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_type<br>`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
|tpsl<br>`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.<br><br>|
??? info "[TriggerType](/../../schemas/trigger_type)"
Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.<br><br>Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.<br><br><br>
|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.<br><br>### Fields:<br>- **triggerBy**: Defines the price type that activates the order (e.g., index price).<br>- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_by<br>`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
|trigger_price<br>`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
|close_position<br>`cp` |boolean|True|If True, the order will close the position when the trigger price is reached|
??? info "[TriggerBy](/../../schemas/trigger_by)"
Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.<br><br>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.<br><br><br>
|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|
|`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
|`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
??? info "[BrokerTag](/../../schemas/broker_tag)"
BrokerTag is a tag for the broker that the order is sent from.<br>
|Value| Description |
|-|-|
|`UNSPECIFIED` = 0||
|`COIN_ROUTES` = 1|CoinRoutes|
|`ALERTATRON` = 2|Alertatron|
|`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|status<br>`s` |OrderStatus|True|The status of the order|
|reject_reason<br>`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
|book_size<br>`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
|traded_size<br>`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
|update_time<br>`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
|avg_fill_price<br>`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|
|`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
|`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
|`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
|`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
|`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
|`INVALID_ORDER_TYPE` = 36|the order type is invalid|
|`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
@@ -0,0 +1,11 @@
!!! info "[ApiDepositHistoryRequest](/../../schemas/api_deposit_history_request)"
The request to get the historical deposits of an account<br>The history is returned in reverse chronological order<br><br>Pagination works as follows:<ul><li>We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.</li><li>The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.</li><li>If a `cursor` is provided, it will be used to fetch results from that point onwards.</li><li>Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.</li></ul><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|currency<br>`c` |[string]|True|The token currency to query for, if nil or empty, return all deposits. Otherwise, only entries matching the filter will be returned|
|start_time<br>`st` |string|False<br>`0`|The start time to query for in unix nanoseconds|
|end_time<br>`et` |string|False<br>`now()`|The end time to query for in unix nanoseconds|
|limit<br>`l` |integer|False<br>`500`|The limit to query for. Defaults to 500; Max 1000|
|cursor<br>`c1` |string|False<br>`''`|The cursor to indicate when to start the next query from|
|main_account_id<br>`ma` |string|False<br>``|Main account ID being queried. By default, applies the requestor's main account ID.|
@@ -0,0 +1,16 @@
!!! info "[ApiDepositHistoryResponse](/../../schemas/api_deposit_history_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |[DepositHistory]|True|The deposit history matching the request account|
|next<br>`n` |string|False<br>`''`|The cursor to indicate when to start the next query from|
??? info "[DepositHistory](/../../schemas/deposit_history)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|l_1_hash<br>`l1` |string|True|The L1 txHash of the deposit|
|l_2_hash<br>`l2` |string|True|The L2 txHash of the deposit|
|to_account_id<br>`ta` |string|True|The account to deposit into|
|currency<br>`c` |string|True|The token currency to deposit|
|num_tokens<br>`nt` |string|True|The number of tokens to deposit|
|initiated_time<br>`it` |string|True|The timestamp when the deposit was initiated on L1 in unix nanoseconds|
|confirmed_time<br>`ct` |string|True|The timestamp when the deposit was confirmed on L2 in unix nanoseconds|
|from_address<br>`fa` |string|True|The address of the sender|
+18
View File
@@ -0,0 +1,18 @@
!!! info "[ApiDepositRequest](/../../schemas/api_deposit_request)"
GRVT runs on a ZKSync Hyperchain which settles directly onto Ethereum.<br>To Deposit funds from your L1 wallet into a GRVT SubAccount, you will be required to submit a deposit transaction directly to Ethereum.<br>GRVT's bridge verifier will scan Ethereum from time to time. Once it receives proof that your deposit has been confirmed on Ethereum, it will initiate the deposit process.<br><br>This current payload is used for alpha testing only.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|to_account_id<br>`ta` |string|True|The main account to deposit into|
|currency<br>`c` |Currency|True|The token currency to deposit|
|num_tokens<br>`nt` |string|True|The number of tokens to deposit, quoted in token_currency decimals|
??? info "[Currency](/../../schemas/currency)"
The list of Currencies that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`USD` = 1|the USD fiat currency|
|`USDC` = 2|the USDC token|
|`USDT` = 3|the USDT token|
|`ETH` = 4|the ETH token|
|`BTC` = 5|the BTC token|
@@ -0,0 +1,4 @@
!!! info "[ApiDropClientWsRequest](/../../schemas/api_drop_client_ws_request)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|main_account_id<br>`ma` |string|True||
@@ -0,0 +1,4 @@
!!! info "[ApiDropClientWsResponse](/../../schemas/api_drop_client_ws_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|num_dropped<br>`nd` |integer|True||
@@ -0,0 +1,22 @@
!!! info "[ApiFillHistoryRequest](/../../schemas/api_fill_history_request)"
Query for all historical fills made by a single account. A single order can be matched multiple times, hence there is no real way to uniquely identify a trade.<br><br>Pagination works as follows:<ul><li>We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.</li><li>The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.</li><li>If a `cursor` is provided, it will be used to fetch results from that point onwards.</li><li>Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.</li></ul><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|sub_account_id<br>`sa` |string|True|The sub account ID to request for|
|kind<br>`k` |[Kind]|False<br>`all`|The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned|
|base<br>`b` |[string]|False<br>`all`|The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned|
|quote<br>`q` |[string]|False<br>`all`|The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned|
|start_time<br>`st` |string|False<br>`0`|The start time to apply in unix nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned|
|end_time<br>`et` |string|False<br>`now()`|The end time to apply in unix nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned|
|limit<br>`l` |integer|False<br>`500`|The limit to query for. Defaults to 500; Max 1000|
|cursor<br>`c` |string|False<br>`''`|The cursor to indicate when to start the query from|
??? info "[Kind](/../../schemas/kind)"
The list of asset kinds that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`PERPETUAL` = 1|the perpetual asset kind|
|`FUTURE` = 2|the future asset kind|
|`CALL` = 3|the call option asset kind|
|`PUT` = 4|the put option asset kind|
@@ -0,0 +1,45 @@
!!! info "[ApiFillHistoryResponse](/../../schemas/api_fill_history_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |[Fill]|True|The private trades matching the request asset|
|next<br>`n` |string|True|The cursor to indicate when to start the query from|
??? info "[Fill](/../../schemas/fill)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|event_time<br>`et` |string|True|Time at which the event was emitted in unix nanoseconds|
|sub_account_id<br>`sa` |string|True|The sub account ID that participated in the trade|
|instrument<br>`i` |string|True|The instrument being represented|
|is_buyer<br>`ib` |boolean|True|The side that the subaccount took on the trade|
|is_taker<br>`it` |boolean|True|The role that the subaccount took on the trade|
|size<br>`s` |string|True|The number of assets being traded, expressed in base asset decimal units|
|price<br>`p` |string|True|The traded price, expressed in `9` decimals|
|mark_price<br>`mp` |string|True|The mark price of the instrument at point of trade, expressed in `9` decimals|
|index_price<br>`ip` |string|True|The index price of the instrument at point of trade, expressed in `9` decimals|
|interest_rate<br>`ir` |string|True|The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)|
|forward_price<br>`fp` |string|True|[Options] The forward price of the option at point of trade, expressed in `9` decimals|
|realized_pnl<br>`rp` |string|True|The realized PnL of the trade, expressed in quote asset decimal units (0 if increasing position size)|
|fee<br>`f` |string|True|The fees paid on the trade, expressed in quote asset decimal unit (negative if maker rebate applied)|
|fee_rate<br>`fr` |string|True|The fee rate paid on the trade|
|trade_id<br>`ti` |string|True|A trade identifier, globally unique, and monotonically increasing (not by `1`).<br>All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.<br>`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`.|
|order_id<br>`oi` |string|True|An order identifier|
|venue<br>`v` |Venue|True|The venue where the trade occurred|
|client_order_id<br>`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client<br>This is used to identify the order in the client's system<br>This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer<br>This field will not be propagated to the smart contract, and should not be signed by the client<br>This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected<br>Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]<br>To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]<br><br>When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|signer<br>`s1` |string|True|The address (public key) of the wallet signing the payload|
|broker<br>`b` |BrokerTag|False<br>``|Specifies the broker who brokered the order|
|is_rpi<br>`ir1` |boolean|True|If the trade is a RPI trade|
??? info "[Venue](/../../schemas/venue)"
The list of Trading Venues that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`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.<br>
|Value| Description |
|-|-|
|`UNSPECIFIED` = 0||
|`COIN_ROUTES` = 1|CoinRoutes|
|`ALERTATRON` = 2|Alertatron|
|`ORIGAMI` = 3|Origami|
@@ -0,0 +1,17 @@
!!! info "[ApiFindEcosystemEpochMetricResponse](/../../schemas/api_find_ecosystem_epoch_metric_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|metric<br>`m` |EcosystemMetric|True|The epoch metric|
|rank<br>`r` |integer|True|The rank of the account in the ecosystem|
|total<br>`t` |integer|True|The total number of accounts in the ecosystem|
|last_calculated_at<br>`lc` |string|True|The time when the ecosystem points were last calculated|
|total_direct_invite_count<br>`td` |integer|True|Direct invite count without relying on epochs|
|total_indirect_invite_count<br>`ti` |integer|True|Indirect invite count without relying on epochs|
??? info "[EcosystemMetric](/../../schemas/ecosystem_metric)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|direct_invite_count<br>`di` |integer|True|Direct invite count|
|indirect_invite_count<br>`ii` |integer|True|Indirect invite count|
|direct_invite_trading_volume<br>`di1` |string|True|Direct invite trading volume|
|indirect_invite_trading_volume<br>`ii1` |string|True|Indirect invite trading volume|
|total_point<br>`tp` |string|True|Total ecosystem point of this epoch/phase|
@@ -0,0 +1,11 @@
!!! info "[ApiFindEcosystemLeaderboardResponse](/../../schemas/api_find_ecosystem_leaderboard_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|users<br>`u` |[EcosystemLeaderboardUser]|True|The list of ecosystem leaderboard users|
??? info "[EcosystemLeaderboardUser](/../../schemas/ecosystem_leaderboard_user)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|account_id<br>`ai` |string|True|The off chain account id|
|rank<br>`r` |integer|True|The rank of the account in the ecosystem|
|total_point<br>`tp` |string|True|Total ecosystem point|
|twitter_username<br>`tu` |string|True|The twitter username of the account|
@@ -0,0 +1,25 @@
!!! info "[ApiFindFirstEpochMetricResponse](/../../schemas/api_find_first_epoch_metric_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|phase_zero_metric<br>`pz` |EcosystemMetric|True|Phase zero metric|
|phase_one_metric<br>`po` |EcosystemMetric|True|Phase one metric|
|rank<br>`r` |integer|True|The rank of the account in the ecosystem|
|total<br>`t` |integer|True|The total number of accounts in the ecosystem|
|total_point<br>`tp` |string|True|Total ecosystem point of the first epoch|
|last_calculated_at<br>`lc` |string|True|The time when the ecosystem points were last calculated|
??? info "[EcosystemMetric](/../../schemas/ecosystem_metric)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|direct_invite_count<br>`di` |integer|True|Direct invite count|
|indirect_invite_count<br>`ii` |integer|True|Indirect invite count|
|direct_invite_trading_volume<br>`di1` |string|True|Direct invite trading volume|
|indirect_invite_trading_volume<br>`ii1` |string|True|Indirect invite trading volume|
|total_point<br>`tp` |string|True|Total ecosystem point of this epoch/phase|
??? info "[EcosystemMetric](/../../schemas/ecosystem_metric)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|direct_invite_count<br>`di` |integer|True|Direct invite count|
|indirect_invite_count<br>`ii` |integer|True|Indirect invite count|
|direct_invite_trading_volume<br>`di1` |string|True|Direct invite trading volume|
|indirect_invite_trading_volume<br>`ii1` |string|True|Indirect invite trading volume|
|total_point<br>`tp` |string|True|Total ecosystem point of this epoch/phase|
@@ -0,0 +1,12 @@
!!! info "[ApiFindTraderEpochMetricResponse](/../../schemas/api_find_trader_epoch_metric_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|metric<br>`m` |TraderMetric|True|Phase zero metric|
|rank<br>`r` |integer|True|The rank of the account in the trader|
|total<br>`t` |integer|True|The total number of accounts in the trader|
|last_calculated_at<br>`lc` |string|True|The time when the trader points were last calculated|
??? info "[TraderMetric](/../../schemas/trader_metric)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|total_fee<br>`tf` |string|True|Total fee paid|
|total_point<br>`tp` |number|True|Total trader point of this epoch/phase|
@@ -0,0 +1,11 @@
!!! info "[ApiFindTraderLeaderboardResponse](/../../schemas/api_find_trader_leaderboard_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|users<br>`u` |[TraderLeaderboardUser]|True|The list of trader leaderboard users|
??? info "[TraderLeaderboardUser](/../../schemas/trader_leaderboard_user)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|account_id<br>`ai` |string|True|The off chain account id|
|rank<br>`r` |integer|True|The rank of the account in the Trader|
|total_point<br>`tp` |number|True|Total Trader point|
|twitter_username<br>`tu` |string|True|The twitter username of the account|
@@ -0,0 +1,38 @@
!!! info "[ApiFundingAccountSummaryResponse](/../../schemas/api_funding_account_summary_response)"
The funding account summary, that reports the total equity and spot balances of a funding (main) account<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |FundingAccountSummary|True|The funding account summary|
|tier<br>`t` |ClientTier|True|Client fee tier at the time of query|
??? info "[FundingAccountSummary](/../../schemas/funding_account_summary)"
The funding account summary, that reports the total equity and spot balances of a funding (main) account<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|main_account_id<br>`ma` |string|True|The main account ID of the account to which the summary belongs|
|total_equity<br>`te` |string|True|Total equity of the main account, denominated in USD|
|spot_balances<br>`sb` |[SpotBalance]|True|The list of spot assets owned by this main account, and their balances|
|vault_investments<br>`vi` |[VaultInvestment]|True|The list of vault investments held by this main account|
??? info "[SpotBalance](/../../schemas/spot_balance)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|currency<br>`c` |string|True|The currency you hold a spot balance in|
|balance<br>`b` |string|True|This currency's balance in this trading account.|
|index_price<br>`ip` |string|True|The index price of this currency. (reported in `USD`)|
??? info "[VaultInvestment](/../../schemas/vault_investment)"
Summarizes a vault investment held by a funding account<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|vault_id<br>`vi` |string|True|The trading account ID of the vault invested in.|
|num_lp_tokens<br>`nl` |string|True|The number of shares held by the investor.|
|share_price<br>`sp` |string|True|The current share price (in USD) of this vault investment.|
??? info "[ClientTier](/../../schemas/client_tier)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|tier<br>`t` |integer|True||
|futures_taker_fee<br>`ft` |integer|True||
|futures_maker_fee<br>`fm` |integer|True||
|options_taker_fee<br>`ot` |integer|True||
|options_maker_fee<br>`om` |integer|True||
@@ -0,0 +1,11 @@
!!! info "[ApiFundingPaymentHistoryRequest](/../../schemas/api_funding_payment_history_request)"
Query for all historical funding payments made by a single account.<br><br>Pagination works as follows:<ul><li>We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.</li><li>The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.</li><li>If a `cursor` is provided, it will be used to fetch results from that point onwards.</li><li>Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.</li></ul><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|sub_account_id<br>`sa` |string|True|The sub account ID to request for|
|instrument<br>`i` |string|False<br>`all`|The perpetual instrument to filter for|
|start_time<br>`st` |string|False<br>`0`|The start time to apply in unix nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned|
|end_time<br>`et` |string|False<br>`now()`|The end time to apply in unix nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned|
|limit<br>`l` |integer|False<br>`500`|The limit to query for. Defaults to 500; Max 1000|
|cursor<br>`c` |string|False<br>`''`|The cursor to indicate when to start the query from|
@@ -0,0 +1,14 @@
!!! info "[ApiFundingPaymentHistoryResponse](/../../schemas/api_funding_payment_history_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |[FundingPayment]|True|The funding payments matching the request asset|
|next<br>`n` |string|True|The cursor to indicate when to start the query from|
??? info "[FundingPayment](/../../schemas/funding_payment)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|event_time<br>`et` |string|True|Time at which the event was emitted in unix nanoseconds|
|sub_account_id<br>`sa` |string|True|The sub account ID that made the funding payment|
|instrument<br>`i` |string|True|The perpetual instrument being funded|
|currency<br>`c` |string|True|The currency of the funding payment|
|amount<br>`a` |string|True|The amount of the funding payment. Positive if paid, negative if received|
|tx_id<br>`ti` |string|True|The transaction ID of the funding payment.<br>Funding payments can be triggered by a trade, transfer, or liquidation.<br>The `tx_id` will match the corresponding `trade_id` or `tx_id`.|
@@ -0,0 +1,10 @@
!!! info "[ApiFundingRateRequest](/../../schemas/api_funding_rate_request)"
Lookup the historical funding rate of a perpetual future.<br><br>Pagination works as follows:<ul><li>We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.</li><li>The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.</li><li>If a `cursor` is provided, it will be used to fetch results from that point onwards.</li><li>Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.</li></ul><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The readable instrument name:<ul><li>Perpetual: `ETH_USDT_Perp`</li><li>Future: `BTC_USDT_Fut_20Oct23`</li><li>Call: `ETH_USDT_Call_20Oct23_2800`</li><li>Put: `ETH_USDT_Put_20Oct23_2800`</li></ul>|
|start_time<br>`st` |string|False<br>`0`|Start time of funding rate in unix nanoseconds|
|end_time<br>`et` |string|False<br>`now()`|End time of funding rate in unix nanoseconds|
|limit<br>`l` |integer|False<br>`500`|The limit to query for. Defaults to 500; Max 1000|
|cursor<br>`c` |string|False<br>`''`|The cursor to indicate when to start the query from|
@@ -0,0 +1,13 @@
!!! info "[ApiFundingRateResponse](/../../schemas/api_funding_rate_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |[FundingRate]|True|The funding rate result set for given interval|
|next<br>`n` |string|False<br>`''`|The cursor to indicate when to start the next query from|
??? info "[FundingRate](/../../schemas/funding_rate)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The readable instrument name:<ul><li>Perpetual: `ETH_USDT_Perp`</li><li>Future: `BTC_USDT_Fut_20Oct23`</li><li>Call: `ETH_USDT_Call_20Oct23_2800`</li><li>Put: `ETH_USDT_Put_20Oct23_2800`</li></ul>|
|funding_rate<br>`fr` |string|True|The funding rate of the instrument, expressed in percentage points|
|funding_time<br>`ft` |string|True|The funding timestamp of the funding rate, expressed in unix nanoseconds|
|mark_price<br>`mp` |string|True|The mark price of the instrument at funding timestamp, expressed in `9` decimals|
|funding_rate_8_h_avg<br>`fr1` |string|True|The 8h average funding rate of the instrument, expressed in percentage points|
@@ -0,0 +1,6 @@
!!! info "[ApiGetAllInitialLeverageRequest](/../../schemas/api_get_all_initial_leverage_request)"
The request to get the initial leverage of a sub account<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|sub_account_id<br>`sa` |string|True|The sub account ID to get the leverage for|
@@ -0,0 +1,13 @@
!!! info "[ApiGetAllInitialLeverageResponse](/../../schemas/api_get_all_initial_leverage_response)"
The response to get the initial leverage of a sub account<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|results<br>`r` |[InitialLeverageResult]|True|The initial leverage of the sub account|
??? info "[InitialLeverageResult](/../../schemas/initial_leverage_result)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The instrument to get the leverage for|
|leverage<br>`l` |string|True|The initial leverage of the sub account|
|min_leverage<br>`ml` |string|True|The min leverage this sub account can set|
|max_leverage<br>`ml1` |string|True|The max leverage this sub account can set|
@@ -0,0 +1,6 @@
!!! info "[ApiGetAllInstrumentsRequest](/../../schemas/api_get_all_instruments_request)"
Fetch all instruments<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|is_active<br>`ia` |boolean|False<br>`false`|Fetch only active instruments|
@@ -0,0 +1,44 @@
!!! info "[ApiGetAllInstrumentsResponse](/../../schemas/api_get_all_instruments_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |[Instrument]|True|List of instruments|
??? info "[Instrument](/../../schemas/instrument)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The readable instrument name:<ul><li>Perpetual: `ETH_USDT_Perp`</li><li>Future: `BTC_USDT_Fut_20Oct23`</li><li>Call: `ETH_USDT_Call_20Oct23_2800`</li><li>Put: `ETH_USDT_Put_20Oct23_2800`</li></ul>|
|instrument_hash<br>`ih` |string|True|The asset ID used for instrument signing.|
|base<br>`b` |string|True|The base currency|
|quote<br>`q` |string|True|The quote currency|
|kind<br>`k` |Kind|True|The kind of instrument|
|venues<br>`v` |[Venue]|True|Venues that this instrument can be traded at|
|settlement_period<br>`sp1` |InstrumentSettlementPeriod|True|The settlement period of the instrument|
|base_decimals<br>`bd` |integer|True|The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)|
|quote_decimals<br>`qd` |integer|True|The smallest denomination of the quote asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)|
|tick_size<br>`ts` |string|True|The size of a single tick, expressed in price decimal units|
|min_size<br>`ms` |string|True|The minimum contract size, expressed in base asset decimal units|
|create_time<br>`ct` |string|True|Creation time in unix nanoseconds|
|max_position_size<br>`mp` |string|True|The maximum position size, expressed in base asset decimal units|
??? info "[Kind](/../../schemas/kind)"
The list of asset kinds that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`PERPETUAL` = 1|the perpetual asset kind|
|`FUTURE` = 2|the future asset kind|
|`CALL` = 3|the call option asset kind|
|`PUT` = 4|the put option asset kind|
??? info "[Venue](/../../schemas/venue)"
The list of Trading Venues that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
|`RFQ` = 2|the trade is cleared on the RFQ venue|
??? info "[InstrumentSettlementPeriod](/../../schemas/instrument_settlement_period)"
|Value| Description |
|-|-|
|`PERPETUAL` = 1|Instrument settles through perpetual funding cycles|
|`DAILY` = 2|Instrument settles at an expiry date, marked as a daily instrument|
|`WEEKLY` = 3|Instrument settles at an expiry date, marked as a weekly instrument|
|`MONTHLY` = 4|Instrument settles at an expiry date, marked as a monthly instrument|
|`QUARTERLY` = 5|Instrument settles at an expiry date, marked as a quarterly instrument|
@@ -0,0 +1,5 @@
!!! info "[ApiGetCurrencyRequest](/../../schemas/api_get_currency_request)"
Fetch all currencies<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
@@ -0,0 +1,13 @@
!!! info "[ApiGetCurrencyResponse](/../../schemas/api_get_currency_response)"
The list of currencies<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |[CurrencyDetail]|True|The list of currencies|
??? info "[CurrencyDetail](/../../schemas/currency_detail)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|id<br>`i` |integer|True|The integer value of the currency|
|symbol<br>`s` |string|True|The name of the currency|
|balance_decimals<br>`bd` |integer|True|The balance decimals of the currency|
|quantity_multiplier<br>`qm` |string|True|The quantity multiplier of the currency|
@@ -0,0 +1,5 @@
!!! info "[ApiGetEcosystemLeaderboardRequest](/../../schemas/api_get_ecosystem_leaderboard_request)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|calculate_from<br>`cf` |string|True|Start time of the epoch - phase|
|limit<br>`l` |integer|True|The number of accounts to return|
@@ -0,0 +1,25 @@
!!! info "[ApiGetEcosystemLeaderboardResponse](/../../schemas/api_get_ecosystem_leaderboard_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|points<br>`p` |[EcosystemPoint]|True|The list of ecosystem points|
??? info "[EcosystemPoint](/../../schemas/ecosystem_point)"
<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|account_id<br>`ai` |string|True|The off chain account id|
|main_account_id<br>`ma` |string|True|The main account id|
|total_point<br>`tp` |string|True|Total ecosystem point|
|direct_invite_count<br>`di` |integer|True|Direct invite count|
|indirect_invite_count<br>`ii` |integer|True|Indirect invite count|
|direct_invite_trading_volume<br>`di1` |string|True|Direct invite trading volume|
|indirect_invite_trading_volume<br>`ii1` |string|True|Indirect invite trading volume|
|calculate_at<br>`ca` |string|True|The time when the ecosystem point is calculated|
|calculate_from<br>`cf` |string|True|Start time of the epoch - phase|
|calculate_to<br>`ct` |string|True|End time of the epoch - phase|
|rank<br>`r` |integer|True|The rank of the account in the ecosystem|
|epoch<br>`e` |integer|True|The epoch number of the ecosystem point|
|brokered_trading_volume<br>`bt` |string|True|Brokered trading volume|
|brokered_trading_point<br>`bt1` |string|True|Brokered trading point|
|referee_kyc_point<br>`rk` |string|True|Referee KYC point|
|referrer_kyc_point<br>`rk1` |string|True|Referrer KYC point|
@@ -0,0 +1,7 @@
!!! info "[ApiGetEcosystemReferralStatResponse](/../../schemas/api_get_ecosystem_referral_stat_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|direct_invite_count<br>`di` |integer|True|Direct invite count|
|indirect_invite_count<br>`ii` |integer|True|Indirect invite count|
|direct_invite_trading_volume<br>`di1` |string|True|Total volume traded by direct invites multiple by 1e9|
|indirect_invite_trading_volume<br>`ii1` |string|True|Total volume traded by indirect invites multiple by 1e9|
@@ -0,0 +1,19 @@
!!! info "[ApiGetFilteredInstrumentsRequest](/../../schemas/api_get_filtered_instruments_request)"
Fetch a list of instruments based on the filters provided<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|kind<br>`k` |[Kind]|False<br>`all`|The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned|
|base<br>`b` |[string]|False<br>`all`|The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned|
|quote<br>`q` |[string]|False<br>`all`|The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned|
|is_active<br>`ia` |boolean|False<br>`false`|Request for active instruments only|
|limit<br>`l` |integer|False<br>`500`|The limit to query for. Defaults to 500; Max 100000|
??? info "[Kind](/../../schemas/kind)"
The list of asset kinds that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`PERPETUAL` = 1|the perpetual asset kind|
|`FUTURE` = 2|the future asset kind|
|`CALL` = 3|the call option asset kind|
|`PUT` = 4|the put option asset kind|
@@ -0,0 +1,44 @@
!!! info "[ApiGetFilteredInstrumentsResponse](/../../schemas/api_get_filtered_instruments_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |[Instrument]|True|The instruments matching the request filter|
??? info "[Instrument](/../../schemas/instrument)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The readable instrument name:<ul><li>Perpetual: `ETH_USDT_Perp`</li><li>Future: `BTC_USDT_Fut_20Oct23`</li><li>Call: `ETH_USDT_Call_20Oct23_2800`</li><li>Put: `ETH_USDT_Put_20Oct23_2800`</li></ul>|
|instrument_hash<br>`ih` |string|True|The asset ID used for instrument signing.|
|base<br>`b` |string|True|The base currency|
|quote<br>`q` |string|True|The quote currency|
|kind<br>`k` |Kind|True|The kind of instrument|
|venues<br>`v` |[Venue]|True|Venues that this instrument can be traded at|
|settlement_period<br>`sp1` |InstrumentSettlementPeriod|True|The settlement period of the instrument|
|base_decimals<br>`bd` |integer|True|The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)|
|quote_decimals<br>`qd` |integer|True|The smallest denomination of the quote asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)|
|tick_size<br>`ts` |string|True|The size of a single tick, expressed in price decimal units|
|min_size<br>`ms` |string|True|The minimum contract size, expressed in base asset decimal units|
|create_time<br>`ct` |string|True|Creation time in unix nanoseconds|
|max_position_size<br>`mp` |string|True|The maximum position size, expressed in base asset decimal units|
??? info "[Kind](/../../schemas/kind)"
The list of asset kinds that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`PERPETUAL` = 1|the perpetual asset kind|
|`FUTURE` = 2|the future asset kind|
|`CALL` = 3|the call option asset kind|
|`PUT` = 4|the put option asset kind|
??? info "[Venue](/../../schemas/venue)"
The list of Trading Venues that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
|`RFQ` = 2|the trade is cleared on the RFQ venue|
??? info "[InstrumentSettlementPeriod](/../../schemas/instrument_settlement_period)"
|Value| Description |
|-|-|
|`PERPETUAL` = 1|Instrument settles through perpetual funding cycles|
|`DAILY` = 2|Instrument settles at an expiry date, marked as a daily instrument|
|`WEEKLY` = 3|Instrument settles at an expiry date, marked as a weekly instrument|
|`MONTHLY` = 4|Instrument settles at an expiry date, marked as a monthly instrument|
|`QUARTERLY` = 5|Instrument settles at an expiry date, marked as a quarterly instrument|
@@ -0,0 +1,6 @@
!!! info "[ApiGetInstrumentRequest](/../../schemas/api_get_instrument_request)"
Fetch a single instrument by supplying the asset or instrument name<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The readable instrument name:<ul><li>Perpetual: `ETH_USDT_Perp`</li><li>Future: `BTC_USDT_Fut_20Oct23`</li><li>Call: `ETH_USDT_Call_20Oct23_2800`</li><li>Put: `ETH_USDT_Put_20Oct23_2800`</li></ul>|
@@ -0,0 +1,44 @@
!!! info "[ApiGetInstrumentResponse](/../../schemas/api_get_instrument_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |Instrument|True|The instrument matching the request asset|
??? info "[Instrument](/../../schemas/instrument)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The readable instrument name:<ul><li>Perpetual: `ETH_USDT_Perp`</li><li>Future: `BTC_USDT_Fut_20Oct23`</li><li>Call: `ETH_USDT_Call_20Oct23_2800`</li><li>Put: `ETH_USDT_Put_20Oct23_2800`</li></ul>|
|instrument_hash<br>`ih` |string|True|The asset ID used for instrument signing.|
|base<br>`b` |string|True|The base currency|
|quote<br>`q` |string|True|The quote currency|
|kind<br>`k` |Kind|True|The kind of instrument|
|venues<br>`v` |[Venue]|True|Venues that this instrument can be traded at|
|settlement_period<br>`sp1` |InstrumentSettlementPeriod|True|The settlement period of the instrument|
|base_decimals<br>`bd` |integer|True|The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)|
|quote_decimals<br>`qd` |integer|True|The smallest denomination of the quote asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)|
|tick_size<br>`ts` |string|True|The size of a single tick, expressed in price decimal units|
|min_size<br>`ms` |string|True|The minimum contract size, expressed in base asset decimal units|
|create_time<br>`ct` |string|True|Creation time in unix nanoseconds|
|max_position_size<br>`mp` |string|True|The maximum position size, expressed in base asset decimal units|
??? info "[Kind](/../../schemas/kind)"
The list of asset kinds that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`PERPETUAL` = 1|the perpetual asset kind|
|`FUTURE` = 2|the future asset kind|
|`CALL` = 3|the call option asset kind|
|`PUT` = 4|the put option asset kind|
??? info "[Venue](/../../schemas/venue)"
The list of Trading Venues that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`ORDERBOOK` = 1|the trade is cleared on the orderbook venue|
|`RFQ` = 2|the trade is cleared on the RFQ venue|
??? info "[InstrumentSettlementPeriod](/../../schemas/instrument_settlement_period)"
|Value| Description |
|-|-|
|`PERPETUAL` = 1|Instrument settles through perpetual funding cycles|
|`DAILY` = 2|Instrument settles at an expiry date, marked as a daily instrument|
|`WEEKLY` = 3|Instrument settles at an expiry date, marked as a weekly instrument|
|`MONTHLY` = 4|Instrument settles at an expiry date, marked as a monthly instrument|
|`QUARTERLY` = 5|Instrument settles at an expiry date, marked as a quarterly instrument|
@@ -0,0 +1,45 @@
!!! info "[ApiGetLatestLPSnapshotRequest](/../../schemas/api_get_latest_lp_snapshot_request)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|kind<br>`k` |Kind|False<br>`0`|The kind filter to apply|
|base<br>`b` |Currency|False<br>`0`|The base filter to apply|
??? info "[Kind](/../../schemas/kind)"
The list of asset kinds that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`PERPETUAL` = 1|the perpetual asset kind|
|`FUTURE` = 2|the future asset kind|
|`CALL` = 3|the call option asset kind|
|`PUT` = 4|the put option asset kind|
??? info "[Currency](/../../schemas/currency)"
The list of Currencies that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`USD` = 1|the USD fiat currency|
|`USDC` = 2|the USDC token|
|`USDT` = 3|the USDT token|
|`ETH` = 4|the ETH token|
|`BTC` = 5|the BTC token|
|`SOL` = 6|the SOL token|
|`ARB` = 7|the ARB token|
|`BNB` = 8|the BNB token|
|`ZK` = 9|the ZK token|
|`POL` = 10|the POL token|
|`OP` = 11|the OP token|
|`ATOM` = 12|the ATOM token|
|`KPEPE` = 13|the 1000PEPE token|
|`TON` = 14|the TON token|
|`XRP` = 15|the XRP token|
|`TRUMP` = 20|the TRUMP token|
|`SUI` = 21|the SUI token|
|`LINK` = 25|the LINK token|
|`JUP` = 27|the JUP token|
|`FARTCOIN` = 28|the FARTCOIN token|
|`ENA` = 29|the ENA token|
|`DOGE` = 30|the DOGE token|
|`ADA` = 33|the ADA token|
|`AAVE` = 34|the AAVE token|
|`BERA` = 35|the BERA token|
|`IP` = 40|the IP token|
@@ -0,0 +1,14 @@
!!! info "[ApiGetLatestLPSnapshotResponse](/../../schemas/api_get_latest_lp_snapshot_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|snapshot<br>`s` |ApproximateLPSnapshot|True|The latest LP snapshot|
??? info "[ApproximateLPSnapshot](/../../schemas/approximate_lp_snapshot)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|main_account_id<br>`ma` |string|True|The main account id|
|underlying_multiplier<br>`um` |string|True|Underlying multiplier|
|market_share_multiplier<br>`ms` |string|True|Market share multiplier|
|bid_fast_market_multiplier<br>`bf` |integer|True|Fast market multiplier|
|ask_fast_market_multiplier<br>`af` |integer|True|Fast market multiplier|
|liquidity_score<br>`ls` |string|True|Liquidity score|
|calculate_at<br>`ca` |string|True|The time when the snapshot was calculated|
@@ -0,0 +1,54 @@
!!! info "[ApiGetListEpochBadgeResponse](/../../schemas/api_get_list_epoch_badge_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |[EpochBadge]|True|The list of epoch badges|
??? info "[EpochBadge](/../../schemas/epoch_badge)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|account_id<br>`ai` |string|True|The off chain account id|
|main_account_id<br>`ma` |string|True|The account ID|
|type<br>`t` |RewardProgramType|True|The type of the reward program|
|epoch<br>`e` |integer|True|The epoch number|
|epoch_start_time<br>`es` |string|True|The start time of the epoch|
|epoch_end_time<br>`ee` |string|True|The end time of the epoch|
|badge<br>`b` |EpochBadgeType|True|The type of the badge|
|distributed_badges<br>`db` |[EpochBadgeType]|True|The distributed badges|
|total_point<br>`tp` |string|True|Total point|
|rank<br>`r` |integer|True|Rank|
|claimed_at<br>`ca` |string|True|The time when the badge was claimed, or the epoch end time if the user has already completed the KYC process|
??? info "[RewardProgramType](/../../schemas/reward_program_type)"
|Value| Description |
|-|-|
|`ECOSYSTEM` = 1||
|`TRADER` = 2||
|`LP` = 3||
??? info "[EpochBadgeType](/../../schemas/epoch_badge_type)"
|Value| Description |
|-|-|
|`CHAMPION` = 1|Champion|
|`LEGEND` = 2|Legend|
|`VETERAN` = 3|Veteran|
|`ELITE` = 4|Elite|
|`MASTER` = 5|Master|
|`EXPERT` = 6|Expert|
|`WARRIOR` = 7|Warrior|
|`SERGEANT` = 8|Sergeant|
|`RANGER` = 9|Ranger|
|`CHALLENGER` = 10|Challenger|
|`APPRENTICE` = 11|Apprentice|
|`ROOKIE` = 12|Rookie|
??? info "[EpochBadgeType](/../../schemas/epoch_badge_type)"
|Value| Description |
|-|-|
|`CHAMPION` = 1|Champion|
|`LEGEND` = 2|Legend|
|`VETERAN` = 3|Veteran|
|`ELITE` = 4|Elite|
|`MASTER` = 5|Master|
|`EXPERT` = 6|Expert|
|`WARRIOR` = 7|Warrior|
|`SERGEANT` = 8|Sergeant|
|`RANGER` = 9|Ranger|
|`CHALLENGER` = 10|Challenger|
|`APPRENTICE` = 11|Apprentice|
|`ROOKIE` = 12|Rookie|
@@ -0,0 +1,9 @@
!!! info "[ApiGetListFlatReferralRequest](/../../schemas/api_get_list_flat_referral_request)"
startTime and endTime are optional parameters. The semantics of these parameters are as follows:<ul><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|referral_id<br>`ri` |string|True|The off chain referrer account id to get all flat referrals|
|start_time<br>`st` |string|False<br>`0`|Optional. Start time in unix nanoseconds|
|end_time<br>`et` |string|False<br>`now()`|Optional. End time in unix nanoseconds|
|account_id<br>`ai` |string|True|The off chain account id to get all user's referrers|
@@ -0,0 +1,20 @@
!!! info "[ApiGetListFlatReferralResponse](/../../schemas/api_get_list_flat_referral_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|flat_referrals<br>`fr` |[FlatReferral]|True|The list of flat referrals|
??? info "[FlatReferral](/../../schemas/flat_referral)"
<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|account_id<br>`ai` |string|True|The off chain account id|
|referrer_id<br>`ri` |string|True|The off chain referrer account id|
|referrer_level<br>`rl` |integer|True|The referrer level; 1: direct referrer, 2: indirect referrer|
|account_create_time<br>`ac` |string|True|The account creation time|
|main_account_id<br>`ma` |string|True|The main account id|
|referrer_main_account_id<br>`rm` |string|True|The referrer main account id|
|is_business<br>`ib` |boolean|True|The account is a business account or not|
|is_kyc_completed<br>`ik` |boolean|True|The account is KYC verified or not|
|kyc_completed_at<br>`kc` |string|True|The KYC completed time|
|kyc_type<br>`kt` |string|True|The KYC type, can be 'individual' or 'business'|
|kyc_first_completed_at<br>`kf` |string|True|The first KYC completed time|
@@ -0,0 +1,31 @@
!!! info "[ApiGetListRewardEpochResponse](/../../schemas/api_get_list_reward_epoch_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|ecosystem_epochs<br>`ee` |[RewardEpochInfo]|True|The list of epoch for ecosystem reward|
|trading_epochs<br>`te` |[RewardEpochInfo]|True|The list of epoch for trader reward and lp reward|
??? info "[RewardEpochInfo](/../../schemas/reward_epoch_info)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|epoch<br>`e` |integer|True|The epoch number|
|epoch_start_time<br>`es` |string|True|The start time of the epoch|
|epoch_end_time<br>`ee` |string|True|The end time of the epoch|
|status<br>`s` |RewardEpochStatus|True|The status of the epoch|
??? info "[RewardEpochStatus](/../../schemas/reward_epoch_status)"
|Value| Description |
|-|-|
|`PAST` = 1|Past|
|`CURRENT` = 2|Current|
|`FUTURE` = 3|Future|
??? info "[RewardEpochInfo](/../../schemas/reward_epoch_info)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|epoch<br>`e` |integer|True|The epoch number|
|epoch_start_time<br>`es` |string|True|The start time of the epoch|
|epoch_end_time<br>`ee` |string|True|The end time of the epoch|
|status<br>`s` |RewardEpochStatus|True|The status of the epoch|
??? info "[RewardEpochStatus](/../../schemas/reward_epoch_status)"
|Value| Description |
|-|-|
|`PAST` = 1|Past|
|`CURRENT` = 2|Current|
|`FUTURE` = 3|Future|
@@ -0,0 +1,24 @@
!!! info "[ApiGetLPConfigRequest](/../../schemas/api_get_lp_config_request)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|kind<br>`k` |Kind|True|The kind filter to apply|
|base<br>`b` |Currency|True|The base filter to apply|
??? info "[Kind](/../../schemas/kind)"
The list of asset kinds that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`PERPETUAL` = 1|the perpetual asset kind|
|`FUTURE` = 2|the future asset kind|
|`CALL` = 3|the call option asset kind|
|`PUT` = 4|the put option asset kind|
??? info "[Currency](/../../schemas/currency)"
The list of Currencies that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`USD` = 1|the USD fiat currency|
|`USDC` = 2|the USDC token|
|`USDT` = 3|the USDT token|
|`ETH` = 4|the ETH token|
|`BTC` = 5|the BTC token|
@@ -0,0 +1,7 @@
!!! info "[ApiGetLPConfigResponse](/../../schemas/api_get_lp_config_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|spread_score_multiplier<br>`ss` |string|True|The spread score multiplier|
|depth_score_multiplier<br>`ds` |string|True|The depth score multiplier|
|market_share_multiplier<br>`ms` |string|True|The market share multiplier|
|is_lp_maker<br>`il` |boolean|True|Is LP maker|
@@ -0,0 +1,45 @@
!!! info "[ApiGetLPInfoRequest](/../../schemas/api_get_lp_info_request)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|kind<br>`k` |Kind|True|The kind filter to apply|
|base<br>`b` |Currency|False<br>`0`|The base filter to apply|
??? info "[Kind](/../../schemas/kind)"
The list of asset kinds that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`PERPETUAL` = 1|the perpetual asset kind|
|`FUTURE` = 2|the future asset kind|
|`CALL` = 3|the call option asset kind|
|`PUT` = 4|the put option asset kind|
??? info "[Currency](/../../schemas/currency)"
The list of Currencies that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`USD` = 1|the USD fiat currency|
|`USDC` = 2|the USDC token|
|`USDT` = 3|the USDT token|
|`ETH` = 4|the ETH token|
|`BTC` = 5|the BTC token|
|`SOL` = 6|the SOL token|
|`ARB` = 7|the ARB token|
|`BNB` = 8|the BNB token|
|`ZK` = 9|the ZK token|
|`POL` = 10|the POL token|
|`OP` = 11|the OP token|
|`ATOM` = 12|the ATOM token|
|`KPEPE` = 13|the 1000PEPE token|
|`TON` = 14|the TON token|
|`XRP` = 15|the XRP token|
|`TRUMP` = 20|the TRUMP token|
|`SUI` = 21|the SUI token|
|`LINK` = 25|the LINK token|
|`JUP` = 27|the JUP token|
|`FARTCOIN` = 28|the FARTCOIN token|
|`ENA` = 29|the ENA token|
|`DOGE` = 30|the DOGE token|
|`ADA` = 33|the ADA token|
|`AAVE` = 34|the AAVE token|
|`BERA` = 35|the BERA token|
|`IP` = 40|the IP token|
@@ -0,0 +1,11 @@
!!! info "[ApiGetLPInfoResponse](/../../schemas/api_get_lp_info_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|is_lp_maker<br>`il` |boolean|True|Is LP maker|
|spread_score_value_multiplier<br>`ss` |string|True|The spread score value multiplier|
|depth_score_value_multiplier<br>`ds` |string|True|The depth score value multiplier|
|market_share_value_multiplier<br>`ms` |string|True|The market share value multiplier|
|underlying_multiplier<br>`um` |string|True|Underlying multiplier|
|market_share_multiplier<br>`ms1` |string|True|The market share multiplier, equal to the maker trading volume in the past 2 hours|
|ask_fast_market_multiplier<br>`af` |integer|True|Ask fast market multiplier|
|bid_fast_market_multiplier<br>`bf` |integer|True|Bid fast market multiplier|
@@ -0,0 +1,47 @@
!!! info "[ApiGetLPLeaderboardRequest](/../../schemas/api_get_lp_leaderboard_request)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|epoch<br>`e` |integer|False<br>`0`|The epoch to filter|
|limit<br>`l` |integer|True|The number of accounts to return|
|kind<br>`k` |Kind|True|The kind filter to apply|
|base<br>`b` |Currency|True|The base filter to apply|
??? info "[Kind](/../../schemas/kind)"
The list of asset kinds that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`PERPETUAL` = 1|the perpetual asset kind|
|`FUTURE` = 2|the future asset kind|
|`CALL` = 3|the call option asset kind|
|`PUT` = 4|the put option asset kind|
??? info "[Currency](/../../schemas/currency)"
The list of Currencies that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`USD` = 1|the USD fiat currency|
|`USDC` = 2|the USDC token|
|`USDT` = 3|the USDT token|
|`ETH` = 4|the ETH token|
|`BTC` = 5|the BTC token|
|`SOL` = 6|the SOL token|
|`ARB` = 7|the ARB token|
|`BNB` = 8|the BNB token|
|`ZK` = 9|the ZK token|
|`POL` = 10|the POL token|
|`OP` = 11|the OP token|
|`ATOM` = 12|the ATOM token|
|`KPEPE` = 13|the 1000PEPE token|
|`TON` = 14|the TON token|
|`XRP` = 15|the XRP token|
|`TRUMP` = 20|the TRUMP token|
|`SUI` = 21|the SUI token|
|`LINK` = 25|the LINK token|
|`JUP` = 27|the JUP token|
|`FARTCOIN` = 28|the FARTCOIN token|
|`ENA` = 29|the ENA token|
|`DOGE` = 30|the DOGE token|
|`ADA` = 33|the ADA token|
|`AAVE` = 34|the AAVE token|
|`BERA` = 35|the BERA token|
|`IP` = 40|the IP token|
@@ -0,0 +1,10 @@
!!! info "[ApiGetLPLeaderboardResponse](/../../schemas/api_get_lp_leaderboard_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|points<br>`p` |[ApproximateLPPoint]|True|The list of LP points|
??? info "[ApproximateLPPoint](/../../schemas/approximate_lp_point)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|off_chain_account_id<br>`oc` |string|True|The off chain account id|
|liquidity_score<br>`ls` |string|True|Liquidity score|
|rank<br>`r` |integer|True|The rank of user in the LP leaderboard|
@@ -0,0 +1,46 @@
!!! info "[ApiGetLPPointRequest](/../../schemas/api_get_lp_point_request)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|epoch<br>`e` |integer|False<br>`0`|The epoch to filter|
|kind<br>`k` |Kind|False<br>`0`|Optional. The kind filter to apply|
|base<br>`b` |Currency|False<br>`0`|Optional. The base filter to apply|
??? info "[Kind](/../../schemas/kind)"
The list of asset kinds that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`PERPETUAL` = 1|the perpetual asset kind|
|`FUTURE` = 2|the future asset kind|
|`CALL` = 3|the call option asset kind|
|`PUT` = 4|the put option asset kind|
??? info "[Currency](/../../schemas/currency)"
The list of Currencies that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`USD` = 1|the USD fiat currency|
|`USDC` = 2|the USDC token|
|`USDT` = 3|the USDT token|
|`ETH` = 4|the ETH token|
|`BTC` = 5|the BTC token|
|`SOL` = 6|the SOL token|
|`ARB` = 7|the ARB token|
|`BNB` = 8|the BNB token|
|`ZK` = 9|the ZK token|
|`POL` = 10|the POL token|
|`OP` = 11|the OP token|
|`ATOM` = 12|the ATOM token|
|`KPEPE` = 13|the 1000PEPE token|
|`TON` = 14|the TON token|
|`XRP` = 15|the XRP token|
|`TRUMP` = 20|the TRUMP token|
|`SUI` = 21|the SUI token|
|`LINK` = 25|the LINK token|
|`JUP` = 27|the JUP token|
|`FARTCOIN` = 28|the FARTCOIN token|
|`ENA` = 29|the ENA token|
|`DOGE` = 30|the DOGE token|
|`ADA` = 33|the ADA token|
|`AAVE` = 34|the AAVE token|
|`BERA` = 35|the BERA token|
|`IP` = 40|the IP token|
@@ -0,0 +1,11 @@
!!! info "[ApiGetLPPointResponse](/../../schemas/api_get_lp_point_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|point<br>`p` |LPPoint|True|LP points of user|
|maker_count<br>`mc` |integer|True|The number of maker|
??? info "[LPPoint](/../../schemas/lp_point)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|main_account_id<br>`ma` |string|True|The main account id|
|liquidity_score<br>`ls` |string|True|Liquidity score|
|rank<br>`r` |integer|True|The rank of user in the LP leaderboard|
@@ -0,0 +1,14 @@
!!! info "[ApiGetMarginTiersResponse](/../../schemas/api_get_margin_tiers_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|results<br>`r` |[AssetMarginTierResponse]|True||
??? info "[AssetMarginTierResponse](/../../schemas/asset_margin_tier_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|asset<br>`a` |string|True||
|tiers<br>`t` |[MarginTierResponse]|True||
??? info "[MarginTierResponse](/../../schemas/margin_tier_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|lower_bound<br>`lb` |string|True||
|rate<br>`r` |string|True||
@@ -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.<br><br>helping to identify TP/SL pairs or other order relationships within the account.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|sub_account_id<br>`sa` |string|True|The subaccount ID for which the order groups should be retrieved.|
@@ -0,0 +1,12 @@
!!! info "[ApiGetOrderGroupResponse](/../../schemas/api_get_order_group_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |[ClientOrderIDsByGroup]|True|A list of client orders grouped by their associated order group.<br>Each entry in the list contains a `groupID` and the corresponding `clientOrderID`s<br>that belong to that group.|
??? info "[ClientOrderIDsByGroup](/../../schemas/client_order_i_ds_by_group)"
Grouping for the client order id and their associated groups.<br><br>This is used to define TP/SL pairs or other order groupings after loading the list of Open Orders.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|group_id<br>`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<br>`co` |[string]|True|List of client order IDs in the group|
|sub_account_id<br>`sa` |string|True|The sub account ID that these orders belong to|
@@ -0,0 +1,8 @@
!!! info "[ApiGetOrderRequest](/../../schemas/api_get_order_request)"
Retrieve the order for the account. Either `order_id` or `client_order_id` must be provided.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|sub_account_id<br>`sa` |string|True|The subaccount ID to filter by|
|order_id<br>`oi` |string|False<br>`0`|Filter for `order_id`|
|client_order_id<br>`co` |string|False<br>`0`|Filter for `client_order_id`|
+158
View File
@@ -0,0 +1,158 @@
!!! info "[ApiGetOrderResponse](/../../schemas/api_get_order_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |Order|True|The order object for the requested filter|
??? info "[Order](/../../schemas/order)"
Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.<br>GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.<br>This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.<br>Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.<br><br>All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.<br>This minimizes the amount of trust users have to offer to GRVT<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|order_id<br>`oi` |string|False<br>`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
|sub_account_id<br>`sa` |string|True|The subaccount initiating the order|
|is_market<br>`im` |boolean|False<br>`false`|If the order is a market order<br>Market Orders do not have a limit price, and are always executed according to the maker order price.<br>Market Orders must always be taker orders|
|time_in_force<br>`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:<ul><br><li>PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg</li><br><li>FULL EXECUTION = AON / FOK - only allows full size execution on all legs</li><br><li>TAKER ONLY = IOC / FOK - only allows taker orders</li><br><li>MAKER OR TAKER = GTT / AON - allows maker or taker orders</li><br></ul>Exchange only supports (GTT, IOC, FOK)<br>RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
|post_only<br>`po` |boolean|False<br>`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.<br>If False, Order can be either a maker or taker order. <b>In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.</b><br><br>| | Must Fill All | Can Fill Partial |<br>| - | - | - |<br>| Must Be Taker | FOK + False | IOC + False |<br>| Can Be Either | AON + False | GTC + False |<br>| Must Be Maker | AON + True | GTC + True |<br>|
|reduce_only<br>`ro` |boolean|False<br>`false`|If True, Order must reduce the position size, or be cancelled|
|legs<br>`l` |[OrderLeg]|True|The legs present in this order<br>The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
|signature<br>`s` |Signature|True|The signature approving this order|
|metadata<br>`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
|state<br>`s1` |OrderState|False<br>`''`|[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 |
<br>
|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|
|`RETAIL_PRICE_IMPROVEMENT` = 5|RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users.|
??? info "[OrderLeg](/../../schemas/order_leg)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The instrument to trade in this leg|
|size<br>`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
|limit_price<br>`lp` |string|False<br>`0`|The limit price of the order leg, expressed in `9` decimals.<br>This is the number of quote currency units to pay/receive for this leg.<br>This should be `null/0` if the order is a market order|
|is_buying_asset<br>`ib` |boolean|True|Specifies if the order leg is a buy or sell|
??? info "[Signature](/../../schemas/signature)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|signer<br>`s` |string|True|The address (public key) of the wallet signing the payload|
|r<br>`r` |string|True|Signature R|
|s<br>`s1` |string|True|Signature S|
|v<br>`v` |integer|True|Signature V|
|expiration<br>`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
|nonce<br>`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.<br>ie. You can send the same exact instruction twice with different nonces.<br>When the same nonce is used, the same payload will generate the same signature.<br>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.<br>Hence, fields in here are never signed, and is never transmitted to the smart contract.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|client_order_id<br>`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client<br>This is used to identify the order in the client's system<br>This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer<br>This field will not be propagated to the smart contract, and should not be signed by the client<br>This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected<br>Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]<br>To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]<br><br>When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time<br>`ct` |string|False<br>`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
|trigger<br>`t` |TriggerOrderMetadata|False<br>``|Trigger fields are used to support any type of trigger order such as TP/SL|
|broker<br>`b` |BrokerTag|False<br>``|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).<br><br>Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_type<br>`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
|tpsl<br>`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.<br><br>|
??? info "[TriggerType](/../../schemas/trigger_type)"
Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.<br><br>Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.<br><br><br>
|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.<br><br>### Fields:<br>- **triggerBy**: Defines the price type that activates the order (e.g., index price).<br>- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_by<br>`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
|trigger_price<br>`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
|close_position<br>`cp` |boolean|True|If True, the order will close the position when the trigger price is reached|
??? info "[TriggerBy](/../../schemas/trigger_by)"
Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.<br><br>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.<br><br><br>
|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|
|`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
|`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
??? info "[BrokerTag](/../../schemas/broker_tag)"
BrokerTag is a tag for the broker that the order is sent from.<br>
|Value| Description |
|-|-|
|`UNSPECIFIED` = 0||
|`COIN_ROUTES` = 1|CoinRoutes|
|`ALERTATRON` = 2|Alertatron|
|`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|status<br>`s` |OrderStatus|True|The status of the order|
|reject_reason<br>`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
|book_size<br>`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
|traded_size<br>`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
|update_time<br>`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
|avg_fill_price<br>`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|
|`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
|`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
|`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
|`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
|`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
|`INVALID_ORDER_TYPE` = 36|the order type is invalid|
|`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
@@ -0,0 +1,4 @@
!!! info "[ApiGetTraderStatResponse](/../../schemas/api_get_trader_stat_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|total_fee<br>`tf` |string|True|Total fee paid|
@@ -0,0 +1,6 @@
!!! info "[ApiGetUserEcosystemPointRequest](/../../schemas/api_get_user_ecosystem_point_request)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|account_id<br>`ai` |string|True|The off chain account id|
|calculate_from<br>`cf` |string|True|Start time of the epoch - phase|
|include_user_rank<br>`iu` |boolean|True|Include user rank in the response|
@@ -0,0 +1,25 @@
!!! info "[ApiGetUserEcosystemPointResponse](/../../schemas/api_get_user_ecosystem_point_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|points<br>`p` |[EcosystemPoint]|True|The list of ecosystem points|
??? info "[EcosystemPoint](/../../schemas/ecosystem_point)"
<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|account_id<br>`ai` |string|True|The off chain account id|
|main_account_id<br>`ma` |string|True|The main account id|
|total_point<br>`tp` |string|True|Total ecosystem point|
|direct_invite_count<br>`di` |integer|True|Direct invite count|
|indirect_invite_count<br>`ii` |integer|True|Indirect invite count|
|direct_invite_trading_volume<br>`di1` |string|True|Direct invite trading volume|
|indirect_invite_trading_volume<br>`ii1` |string|True|Indirect invite trading volume|
|calculate_at<br>`ca` |string|True|The time when the ecosystem point is calculated|
|calculate_from<br>`cf` |string|True|Start time of the epoch - phase|
|calculate_to<br>`ct` |string|True|End time of the epoch - phase|
|rank<br>`r` |integer|True|The rank of the account in the ecosystem|
|epoch<br>`e` |integer|True|The epoch number of the ecosystem point|
|brokered_trading_volume<br>`bt` |string|True|Brokered trading volume|
|brokered_trading_point<br>`bt1` |string|True|Brokered trading point|
|referee_kyc_point<br>`rk` |string|True|Referee KYC point|
|referrer_kyc_point<br>`rk1` |string|True|Referrer KYC point|
@@ -0,0 +1,5 @@
!!! info "[ApiGetVerifiedEcosystemLeaderboardRequest](/../../schemas/api_get_verified_ecosystem_leaderboard_request)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|calculate_from<br>`cf` |string|True|Start time of the epoch|
|completed_kyc_before<br>`ck` |string|True|Completed KYC before this time|
@@ -0,0 +1,6 @@
!!! info "[ApiLatestSnapSubAccountsRequest](/../../schemas/api_latest_snap_sub_accounts_request)"
The request to get the latest snapshot of list sub account<br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|sub_account_i_ds<br>`sa` |[string]|True|The list of sub account ids to query|
@@ -0,0 +1,110 @@
!!! info "[ApiLatestSnapSubAccountsResponse](/../../schemas/api_latest_snap_sub_accounts_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |[SubAccount]|True|The sub account history matching the request sub account|
??? info "[SubAccount](/../../schemas/sub_account)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|event_time<br>`et` |string|True|Time at which the event was emitted in unix nanoseconds|
|sub_account_id<br>`sa` |string|True|The sub account ID this entry refers to|
|margin_type<br>`mt` |MarginType|True|The type of margin algorithm this subaccount uses|
|settle_currency<br>`sc` |Currency|True|The settlement, margin, and reporting currency of this account.<br>This subaccount can only open positions quoted in this currency<br><br>In the future, when users select a Multi-Currency Margin Type, this will be USD<br>All other assets are converted to this currency for the purpose of calculating margin|
|unrealized_pnl<br>`up` |string|True|The total unrealized PnL of all positions owned by this subaccount, denominated in quote currency decimal units.<br>`unrealized_pnl = sum(position.unrealized_pnl * position.quote_index_price) / settle_index_price`|
|total_equity<br>`te` |string|True|The notional value of your account if all positions are closed, excluding trading fees (reported in `settle_currency`).<br>`total_equity = sum(spot_balance.balance * spot_balance.index_price) / settle_index_price + unrealized_pnl`|
|initial_margin<br>`im` |string|True|The `total_equity` required to open positions in the account (reported in `settle_currency`).<br>Computation is different depending on account's `margin_type`|
|maintenance_margin<br>`mm` |string|True|The `total_equity` required to avoid liquidation of positions in the account (reported in `settle_currency`).<br>Computation is different depending on account's `margin_type`|
|available_balance<br>`ab` |string|True|The notional value available to transfer out of the trading account into the funding account (reported in `settle_currency`).<br>`available_balance = total_equity - initial_margin - min(unrealized_pnl, 0)`|
|spot_balances<br>`sb` |[SpotBalance]|True|The list of spot assets owned by this sub account, and their balances|
|positions<br>`p` |[Positions]|True|The list of positions owned by this sub account|
|settle_index_price<br>`si` |string|True|The index price of the settle currency. (reported in `USD`)|
??? info "[MarginType](/../../schemas/margin_type)"
|Value| Description |
|-|-|
|`SIMPLE_CROSS_MARGIN` = 2|Simple Cross Margin Mode: all assets have a predictable margin impact, the whole subaccount shares a single margin|
|`PORTFOLIO_CROSS_MARGIN` = 3|Portfolio Cross Margin Mode: asset margin impact is analysed on portfolio level, the whole subaccount shares a single margin|
??? info "[Currency](/../../schemas/currency)"
The list of Currencies that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`USD` = 1|the USD fiat currency|
|`USDC` = 2|the USDC token|
|`USDT` = 3|the USDT token|
|`ETH` = 4|the ETH token|
|`BTC` = 5|the BTC token|
|`SOL` = 6|the SOL token|
|`ARB` = 7|the ARB token|
|`BNB` = 8|the BNB token|
|`ZK` = 9|the ZK token|
|`POL` = 10|the POL token|
|`OP` = 11|the OP token|
|`ATOM` = 12|the ATOM token|
|`KPEPE` = 13|the 1000PEPE token|
|`TON` = 14|the TON token|
|`XRP` = 15|the XRP token|
|`TRUMP` = 20|the TRUMP token|
|`SUI` = 21|the SUI token|
|`LINK` = 25|the LINK token|
|`JUP` = 27|the JUP token|
|`FARTCOIN` = 28|the FARTCOIN token|
|`ENA` = 29|the ENA token|
|`DOGE` = 30|the DOGE token|
|`ADA` = 33|the ADA token|
|`AAVE` = 34|the AAVE token|
|`BERA` = 35|the BERA token|
|`IP` = 40|the IP token|
??? info "[SpotBalance](/../../schemas/spot_balance)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|currency<br>`c` |Currency|True|The currency you hold a spot balance in|
|balance<br>`b` |string|True|This currency's balance in this trading account.|
|index_price<br>`ip` |string|True|The index price of this currency. (reported in `USD`)|
??? info "[Currency](/../../schemas/currency)"
The list of Currencies that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`USD` = 1|the USD fiat currency|
|`USDC` = 2|the USDC token|
|`USDT` = 3|the USDT token|
|`ETH` = 4|the ETH token|
|`BTC` = 5|the BTC token|
|`SOL` = 6|the SOL token|
|`ARB` = 7|the ARB token|
|`BNB` = 8|the BNB token|
|`ZK` = 9|the ZK token|
|`POL` = 10|the POL token|
|`OP` = 11|the OP token|
|`ATOM` = 12|the ATOM token|
|`KPEPE` = 13|the 1000PEPE token|
|`TON` = 14|the TON token|
|`XRP` = 15|the XRP token|
|`TRUMP` = 20|the TRUMP token|
|`SUI` = 21|the SUI token|
|`LINK` = 25|the LINK token|
|`JUP` = 27|the JUP token|
|`FARTCOIN` = 28|the FARTCOIN token|
|`ENA` = 29|the ENA token|
|`DOGE` = 30|the DOGE token|
|`ADA` = 33|the ADA token|
|`AAVE` = 34|the AAVE token|
|`BERA` = 35|the BERA token|
|`IP` = 40|the IP token|
??? info "[Positions](/../../schemas/positions)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|event_time<br>`et` |string|True|Time at which the event was emitted in unix nanoseconds|
|sub_account_id<br>`sa` |string|True|The sub account ID that participated in the trade|
|instrument<br>`i` |string|True|The instrument being represented|
|size<br>`s` |string|True|The size of the position, expressed in base asset decimal units. Negative for short positions|
|notional<br>`n` |string|True|The notional value of the position, negative for short assets, expressed in quote asset decimal units|
|entry_price<br>`ep` |string|True|The entry price of the position, expressed in `9` decimals<br>Whenever increasing the size of a position, the entry price is updated to the new average entry price<br>`new_entry_price = (old_entry_price * old_size + trade_price * trade_size) / (old_size + trade_size)`|
|exit_price<br>`ep1` |string|True|The exit price of the position, expressed in `9` decimals<br>Whenever decreasing the size of a position, the exit price is updated to the new average exit price<br>`new_exit_price = (old_exit_price * old_exit_trade_size + trade_price * trade_size) / (old_exit_trade_size + trade_size)`|
|mark_price<br>`mp` |string|True|The mark price of the position, expressed in `9` decimals|
|unrealized_pnl<br>`up` |string|True|The unrealized PnL of the position, expressed in quote asset decimal units<br>`unrealized_pnl = (mark_price - entry_price) * size`|
|realized_pnl<br>`rp` |string|True|The realized PnL of the position, expressed in quote asset decimal units<br>`realized_pnl = (exit_price - entry_price) * exit_trade_size`|
|total_pnl<br>`tp` |string|True|The total PnL of the position, expressed in quote asset decimal units<br>`total_pnl = realized_pnl + unrealized_pnl`|
|roi<br>`r` |string|True|The ROI of the position, expressed as a percentage<br>`roi = (total_pnl / (entry_price * abs(size))) * 100^`|
|quote_index_price<br>`qi` |string|True|The index price of the quote currency. (reported in `USD`)|
|est_liquidation_price<br>`el` |string|True|The estimated liquidation price|
|leverage<br>`l` |string|True|The current leverage value for this position|
@@ -0,0 +1,4 @@
!!! info "[ApiListAggregatedAccountSummaryRequest](/../../schemas/api_list_aggregated_account_summary_request)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|main_account_ids<br>`ma` |[unknown]|True|The list of main account ID to request for|
@@ -0,0 +1,53 @@
!!! info "[ApiListAggregatedAccountSummaryResponse](/../../schemas/api_list_aggregated_account_summary_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|account_summaries<br>`as` |[ApiAggregatedAccountSummaryResponse]|True|The list of aggregated account summaries of requested main accounts|
??? info "[ApiAggregatedAccountSummaryResponse](/../../schemas/api_aggregated_account_summary_response)"
The aggregated account summary, that reports the total equity and spot balances of a funding (main) account, and its constituent trading (sub) accounts<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |AggregatedAccountSummary|True|The aggregated account summary|
??? info "[AggregatedAccountSummary](/../../schemas/aggregated_account_summary)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|main_account_id<br>`ma` |string|True|The main account ID of the account to which the summary belongs|
|total_equity<br>`te` |string|True|Total equity of the main (+ sub) account, denominated in USD|
|spot_balances<br>`sb` |[SpotBalance]|True|The list of spot assets owned by this main (+ sub) account, and their balances|
??? info "[SpotBalance](/../../schemas/spot_balance)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|currency<br>`c` |Currency|True|The currency you hold a spot balance in|
|balance<br>`b` |string|True|This currency's balance in this trading account.|
|index_price<br>`ip` |string|True|The index price of this currency. (reported in `USD`)|
??? info "[Currency](/../../schemas/currency)"
The list of Currencies that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`USD` = 1|the USD fiat currency|
|`USDC` = 2|the USDC token|
|`USDT` = 3|the USDT token|
|`ETH` = 4|the ETH token|
|`BTC` = 5|the BTC token|
|`SOL` = 6|the SOL token|
|`ARB` = 7|the ARB token|
|`BNB` = 8|the BNB token|
|`ZK` = 9|the ZK token|
|`POL` = 10|the POL token|
|`OP` = 11|the OP token|
|`ATOM` = 12|the ATOM token|
|`KPEPE` = 13|the 1000PEPE token|
|`TON` = 14|the TON token|
|`XRP` = 15|the XRP token|
|`TRUMP` = 20|the TRUMP token|
|`SUI` = 21|the SUI token|
|`LINK` = 25|the LINK token|
|`JUP` = 27|the JUP token|
|`FARTCOIN` = 28|the FARTCOIN token|
|`ENA` = 29|the ENA token|
|`DOGE` = 30|the DOGE token|
|`ADA` = 33|the ADA token|
|`AAVE` = 34|the AAVE token|
|`BERA` = 35|the BERA token|
|`IP` = 40|the IP token|
@@ -0,0 +1,6 @@
!!! info "[ApiMiniTickerRequest](/../../schemas/api_mini_ticker_request)"
Retrieves a single mini ticker value for a single instrument. Please do not use this to repeatedly poll for data -- a websocket subscription is much more performant, and useful.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The readable instrument name:<ul><li>Perpetual: `ETH_USDT_Perp`</li><li>Future: `BTC_USDT_Fut_20Oct23`</li><li>Call: `ETH_USDT_Call_20Oct23_2800`</li><li>Put: `ETH_USDT_Put_20Oct23_2800`</li></ul>|
@@ -0,0 +1,18 @@
!!! info "[ApiMiniTickerResponse](/../../schemas/api_mini_ticker_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |MiniTicker|True|The mini ticker matching the request asset|
??? info "[MiniTicker](/../../schemas/mini_ticker)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|event_time<br>`et` |string|False<br>`None`|Time at which the event was emitted in unix nanoseconds|
|instrument<br>`i` |string|False<br>`None`|The readable instrument name:<ul><li>Perpetual: `ETH_USDT_Perp`</li><li>Future: `BTC_USDT_Fut_20Oct23`</li><li>Call: `ETH_USDT_Call_20Oct23_2800`</li><li>Put: `ETH_USDT_Put_20Oct23_2800`</li></ul>|
|mark_price<br>`mp` |string|False<br>`None`|The mark price of the instrument, expressed in `9` decimals|
|index_price<br>`ip` |string|False<br>`None`|The index price of the instrument, expressed in `9` decimals|
|last_price<br>`lp` |string|False<br>`None`|The last traded price of the instrument (also close price), expressed in `9` decimals|
|last_size<br>`ls` |string|False<br>`None`|The number of assets traded in the last trade, expressed in base asset decimal units|
|mid_price<br>`mp1` |string|False<br>`None`|The mid price of the instrument, expressed in `9` decimals|
|best_bid_price<br>`bb` |string|False<br>`None`|The best bid price of the instrument, expressed in `9` decimals|
|best_bid_size<br>`bb1` |string|False<br>`None`|The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units|
|best_ask_price<br>`ba` |string|False<br>`None`|The best ask price of the instrument, expressed in `9` decimals|
|best_ask_size<br>`ba1` |string|False<br>`None`|The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units|
@@ -0,0 +1,16 @@
!!! info "[ApiOpenOrdersRequest](/../../schemas/api_open_orders_request)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|sub_account_id<br>`sa` |string|True|The subaccount ID to filter by|
|kind<br>`k` |[Kind]|False<br>`all`|The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned|
|base<br>`b` |[string]|False<br>`all`|The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned|
|quote<br>`q` |[string]|False<br>`all`|The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned|
??? info "[Kind](/../../schemas/kind)"
The list of asset kinds that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`PERPETUAL` = 1|the perpetual asset kind|
|`FUTURE` = 2|the future asset kind|
|`CALL` = 3|the call option asset kind|
|`PUT` = 4|the put option asset kind|
@@ -0,0 +1,160 @@
!!! info "[ApiOpenOrdersResponse](/../../schemas/api_open_orders_response)"
Retrieves all open orders for the account. This may not match new orders in flight.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |[Order]|True|The Open Orders matching the request filter|
??? info "[Order](/../../schemas/order)"
Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.<br>GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.<br>This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.<br>Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.<br><br>All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.<br>This minimizes the amount of trust users have to offer to GRVT<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|order_id<br>`oi` |string|False<br>`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
|sub_account_id<br>`sa` |string|True|The subaccount initiating the order|
|is_market<br>`im` |boolean|False<br>`false`|If the order is a market order<br>Market Orders do not have a limit price, and are always executed according to the maker order price.<br>Market Orders must always be taker orders|
|time_in_force<br>`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:<ul><br><li>PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg</li><br><li>FULL EXECUTION = AON / FOK - only allows full size execution on all legs</li><br><li>TAKER ONLY = IOC / FOK - only allows taker orders</li><br><li>MAKER OR TAKER = GTT / AON - allows maker or taker orders</li><br></ul>Exchange only supports (GTT, IOC, FOK)<br>RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
|post_only<br>`po` |boolean|False<br>`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.<br>If False, Order can be either a maker or taker order. <b>In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.</b><br><br>| | Must Fill All | Can Fill Partial |<br>| - | - | - |<br>| Must Be Taker | FOK + False | IOC + False |<br>| Can Be Either | AON + False | GTC + False |<br>| Must Be Maker | AON + True | GTC + True |<br>|
|reduce_only<br>`ro` |boolean|False<br>`false`|If True, Order must reduce the position size, or be cancelled|
|legs<br>`l` |[OrderLeg]|True|The legs present in this order<br>The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
|signature<br>`s` |Signature|True|The signature approving this order|
|metadata<br>`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
|state<br>`s1` |OrderState|False<br>`''`|[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 |
<br>
|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|
|`RETAIL_PRICE_IMPROVEMENT` = 5|RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users.|
??? info "[OrderLeg](/../../schemas/order_leg)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The instrument to trade in this leg|
|size<br>`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
|limit_price<br>`lp` |string|False<br>`0`|The limit price of the order leg, expressed in `9` decimals.<br>This is the number of quote currency units to pay/receive for this leg.<br>This should be `null/0` if the order is a market order|
|is_buying_asset<br>`ib` |boolean|True|Specifies if the order leg is a buy or sell|
??? info "[Signature](/../../schemas/signature)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|signer<br>`s` |string|True|The address (public key) of the wallet signing the payload|
|r<br>`r` |string|True|Signature R|
|s<br>`s1` |string|True|Signature S|
|v<br>`v` |integer|True|Signature V|
|expiration<br>`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
|nonce<br>`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.<br>ie. You can send the same exact instruction twice with different nonces.<br>When the same nonce is used, the same payload will generate the same signature.<br>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.<br>Hence, fields in here are never signed, and is never transmitted to the smart contract.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|client_order_id<br>`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client<br>This is used to identify the order in the client's system<br>This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer<br>This field will not be propagated to the smart contract, and should not be signed by the client<br>This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected<br>Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]<br>To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]<br><br>When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time<br>`ct` |string|False<br>`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
|trigger<br>`t` |TriggerOrderMetadata|False<br>``|Trigger fields are used to support any type of trigger order such as TP/SL|
|broker<br>`b` |BrokerTag|False<br>``|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).<br><br>Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_type<br>`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
|tpsl<br>`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.<br><br>|
??? info "[TriggerType](/../../schemas/trigger_type)"
Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.<br><br>Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.<br><br><br>
|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.<br><br>### Fields:<br>- **triggerBy**: Defines the price type that activates the order (e.g., index price).<br>- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_by<br>`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
|trigger_price<br>`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
|close_position<br>`cp` |boolean|True|If True, the order will close the position when the trigger price is reached|
??? info "[TriggerBy](/../../schemas/trigger_by)"
Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.<br><br>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.<br><br><br>
|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|
|`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
|`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
??? info "[BrokerTag](/../../schemas/broker_tag)"
BrokerTag is a tag for the broker that the order is sent from.<br>
|Value| Description |
|-|-|
|`UNSPECIFIED` = 0||
|`COIN_ROUTES` = 1|CoinRoutes|
|`ALERTATRON` = 2|Alertatron|
|`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|status<br>`s` |OrderStatus|True|The status of the order|
|reject_reason<br>`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
|book_size<br>`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
|traded_size<br>`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
|update_time<br>`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
|avg_fill_price<br>`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|
|`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
|`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
|`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
|`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
|`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
|`INVALID_ORDER_TYPE` = 36|the order type is invalid|
|`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
@@ -0,0 +1,22 @@
!!! info "[ApiOrderHistoryRequest](/../../schemas/api_order_history_request)"
Retrieves the order history for the account.<br><br>Pagination works as follows:<ul><li>We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.</li><li>The lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.</li><li>If a `cursor` is provided, it will be used to fetch results from that point onwards.</li><li>Pagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.</li></ul><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|sub_account_id<br>`sa` |string|True|The subaccount ID to filter by|
|kind<br>`k` |[Kind]|False<br>`all`|The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned|
|base<br>`b` |[string]|False<br>`all`|The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned|
|quote<br>`q` |[string]|False<br>`all`|The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned|
|start_time<br>`st` |string|False<br>`0`|The start time to apply in nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned|
|end_time<br>`et` |string|False<br>`now()`|The end time to apply in nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned|
|limit<br>`l` |integer|False<br>`500`|The limit to query for. Defaults to 500; Max 1000|
|cursor<br>`c` |string|False<br>`''`|The cursor to indicate when to start the query from|
??? info "[Kind](/../../schemas/kind)"
The list of asset kinds that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`PERPETUAL` = 1|the perpetual asset kind|
|`FUTURE` = 2|the future asset kind|
|`CALL` = 3|the call option asset kind|
|`PUT` = 4|the put option asset kind|
@@ -0,0 +1,159 @@
!!! info "[ApiOrderHistoryResponse](/../../schemas/api_order_history_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |[Order]|True|The Open Orders matching the request filter|
|next<br>`n` |string|True|The cursor to indicate when to start the query from|
??? info "[Order](/../../schemas/order)"
Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.<br>GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.<br>This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.<br>Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.<br><br>All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.<br>This minimizes the amount of trust users have to offer to GRVT<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|order_id<br>`oi` |string|False<br>`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
|sub_account_id<br>`sa` |string|True|The subaccount initiating the order|
|is_market<br>`im` |boolean|False<br>`false`|If the order is a market order<br>Market Orders do not have a limit price, and are always executed according to the maker order price.<br>Market Orders must always be taker orders|
|time_in_force<br>`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:<ul><br><li>PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg</li><br><li>FULL EXECUTION = AON / FOK - only allows full size execution on all legs</li><br><li>TAKER ONLY = IOC / FOK - only allows taker orders</li><br><li>MAKER OR TAKER = GTT / AON - allows maker or taker orders</li><br></ul>Exchange only supports (GTT, IOC, FOK)<br>RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
|post_only<br>`po` |boolean|False<br>`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.<br>If False, Order can be either a maker or taker order. <b>In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.</b><br><br>| | Must Fill All | Can Fill Partial |<br>| - | - | - |<br>| Must Be Taker | FOK + False | IOC + False |<br>| Can Be Either | AON + False | GTC + False |<br>| Must Be Maker | AON + True | GTC + True |<br>|
|reduce_only<br>`ro` |boolean|False<br>`false`|If True, Order must reduce the position size, or be cancelled|
|legs<br>`l` |[OrderLeg]|True|The legs present in this order<br>The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
|signature<br>`s` |Signature|True|The signature approving this order|
|metadata<br>`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
|state<br>`s1` |OrderState|False<br>`''`|[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 |
<br>
|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|
|`RETAIL_PRICE_IMPROVEMENT` = 5|RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users.|
??? info "[OrderLeg](/../../schemas/order_leg)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The instrument to trade in this leg|
|size<br>`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
|limit_price<br>`lp` |string|False<br>`0`|The limit price of the order leg, expressed in `9` decimals.<br>This is the number of quote currency units to pay/receive for this leg.<br>This should be `null/0` if the order is a market order|
|is_buying_asset<br>`ib` |boolean|True|Specifies if the order leg is a buy or sell|
??? info "[Signature](/../../schemas/signature)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|signer<br>`s` |string|True|The address (public key) of the wallet signing the payload|
|r<br>`r` |string|True|Signature R|
|s<br>`s1` |string|True|Signature S|
|v<br>`v` |integer|True|Signature V|
|expiration<br>`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
|nonce<br>`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.<br>ie. You can send the same exact instruction twice with different nonces.<br>When the same nonce is used, the same payload will generate the same signature.<br>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.<br>Hence, fields in here are never signed, and is never transmitted to the smart contract.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|client_order_id<br>`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client<br>This is used to identify the order in the client's system<br>This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer<br>This field will not be propagated to the smart contract, and should not be signed by the client<br>This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected<br>Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]<br>To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]<br><br>When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time<br>`ct` |string|False<br>`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
|trigger<br>`t` |TriggerOrderMetadata|False<br>``|Trigger fields are used to support any type of trigger order such as TP/SL|
|broker<br>`b` |BrokerTag|False<br>``|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).<br><br>Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_type<br>`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
|tpsl<br>`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.<br><br>|
??? info "[TriggerType](/../../schemas/trigger_type)"
Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.<br><br>Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.<br><br><br>
|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.<br><br>### Fields:<br>- **triggerBy**: Defines the price type that activates the order (e.g., index price).<br>- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_by<br>`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
|trigger_price<br>`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.|
|close_position<br>`cp` |boolean|True|If True, the order will close the position when the trigger price is reached|
??? info "[TriggerBy](/../../schemas/trigger_by)"
Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.<br><br>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.<br><br><br>
|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|
|`MID` = 3|MID - Order is activated when the mid price reaches the trigger price|
|`MARK` = 4|MARK - Order is activated when the mark price reaches the trigger price|
??? info "[BrokerTag](/../../schemas/broker_tag)"
BrokerTag is a tag for the broker that the order is sent from.<br>
|Value| Description |
|-|-|
|`UNSPECIFIED` = 0||
|`COIN_ROUTES` = 1|CoinRoutes|
|`ALERTATRON` = 2|Alertatron|
|`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|status<br>`s` |OrderStatus|True|The status of the order|
|reject_reason<br>`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
|book_size<br>`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
|traded_size<br>`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
|update_time<br>`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
|avg_fill_price<br>`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|
|`REDUCE_ONLY_LIMIT` = 31|the remaining order size was cancelled because it exceeded current position size|
|`CLIENT_REPLACE` = 32|the order was replaced by a client replace request|
|`DERISK_MUST_BE_IOC` = 33|the derisk order must be an IOC order|
|`DERISK_MUST_BE_REDUCE_ONLY` = 34|the derisk order must be a reduce-only order|
|`DERISK_NOT_SUPPORTED` = 35|derisk is not supported|
|`INVALID_ORDER_TYPE` = 36|the order type is invalid|
|`CURRENCY_NOT_DEFINED` = 37|the currency is not defined|
@@ -0,0 +1,8 @@
!!! info "[ApiOrderStateRequest](/../../schemas/api_order_state_request)"
Retrieve the order state for the account. Either `order_id` or `client_order_id` must be provided.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|sub_account_id<br>`sa` |string|True|The subaccount ID to filter by|
|order_id<br>`oi` |string|False<br>`0`|Filter for `order_id`|
|client_order_id<br>`co` |string|False<br>`0`|Filter for `client_order_id`|
@@ -0,0 +1,55 @@
!!! info "[ApiOrderStateResponse](/../../schemas/api_order_state_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|state<br>`s` |OrderState|True|The order state for the requested filter|
??? info "[OrderState](/../../schemas/order_state)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|status<br>`s` |OrderStatus|True|The status of the order|
|reject_reason<br>`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
|book_size<br>`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
|traded_size<br>`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
|update_time<br>`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
|avg_fill_price<br>`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|
@@ -0,0 +1,7 @@
!!! info "[ApiOrderbookLevelsRequest](/../../schemas/api_orderbook_levels_request)"
Retrieves aggregated price depth for a single instrument, with a maximum depth of 10 levels. Do not use this to poll for data -- a websocket subscription is much more performant, and useful.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The readable instrument name:<ul><li>Perpetual: `ETH_USDT_Perp`</li><li>Future: `BTC_USDT_Fut_20Oct23`</li><li>Call: `ETH_USDT_Call_20Oct23_2800`</li><li>Put: `ETH_USDT_Put_20Oct23_2800`</li></ul>|
|depth<br>`d` |integer|True|Depth of the order book to be retrieved (10, 50, 100, 500)|
@@ -0,0 +1,23 @@
!!! info "[ApiOrderbookLevelsResponse](/../../schemas/api_orderbook_levels_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |OrderbookLevels|True|The orderbook levels objects matching the request asset|
??? info "[OrderbookLevels](/../../schemas/orderbook_levels)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|event_time<br>`et` |string|True|Time at which the event was emitted in unix nanoseconds|
|instrument<br>`i` |string|True|The readable instrument name:<ul><li>Perpetual: `ETH_USDT_Perp`</li><li>Future: `BTC_USDT_Fut_20Oct23`</li><li>Call: `ETH_USDT_Call_20Oct23_2800`</li><li>Put: `ETH_USDT_Put_20Oct23_2800`</li></ul>|
|bids<br>`b` |[OrderbookLevel]|True|The list of best bids up till query depth|
|asks<br>`a` |[OrderbookLevel]|True|The list of best asks up till query depth|
??? info "[OrderbookLevel](/../../schemas/orderbook_level)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|price<br>`p` |string|True|The price of the level, expressed in `9` decimals|
|size<br>`s` |string|True|The number of assets offered, expressed in base asset decimal units|
|num_orders<br>`no` |integer|True|The number of open orders at this level|
??? info "[OrderbookLevel](/../../schemas/orderbook_level)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|price<br>`p` |string|True|The price of the level, expressed in `9` decimals|
|size<br>`s` |string|True|The number of assets offered, expressed in base asset decimal units|
|num_orders<br>`no` |integer|True|The number of open orders at this level|
@@ -0,0 +1,18 @@
!!! info "[ApiPositionsRequest](/../../schemas/api_positions_request)"
Query the positions of a sub account<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|sub_account_id<br>`sa` |string|True|The sub account ID to request for|
|kind<br>`k` |[Kind]|False<br>`all`|The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned|
|base<br>`b` |[string]|False<br>`all`|The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned|
|quote<br>`q` |[string]|False<br>`all`|The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned|
??? info "[Kind](/../../schemas/kind)"
The list of asset kinds that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`PERPETUAL` = 1|the perpetual asset kind|
|`FUTURE` = 2|the future asset kind|
|`CALL` = 3|the call option asset kind|
|`PUT` = 4|the put option asset kind|
@@ -0,0 +1,22 @@
!!! info "[ApiPositionsResponse](/../../schemas/api_positions_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|result<br>`r` |[Positions]|True|The positions matching the request filter|
??? info "[Positions](/../../schemas/positions)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|event_time<br>`et` |string|True|Time at which the event was emitted in unix nanoseconds|
|sub_account_id<br>`sa` |string|True|The sub account ID that participated in the trade|
|instrument<br>`i` |string|True|The instrument being represented|
|size<br>`s` |string|True|The size of the position, expressed in base asset decimal units. Negative for short positions|
|notional<br>`n` |string|True|The notional value of the position, negative for short assets, expressed in quote asset decimal units|
|entry_price<br>`ep` |string|True|The entry price of the position, expressed in `9` decimals<br>Whenever increasing the size of a position, the entry price is updated to the new average entry price<br>`new_entry_price = (old_entry_price * old_size + trade_price * trade_size) / (old_size + trade_size)`|
|exit_price<br>`ep1` |string|True|The exit price of the position, expressed in `9` decimals<br>Whenever decreasing the size of a position, the exit price is updated to the new average exit price<br>`new_exit_price = (old_exit_price * old_exit_trade_size + trade_price * trade_size) / (old_exit_trade_size + trade_size)`|
|mark_price<br>`mp` |string|True|The mark price of the position, expressed in `9` decimals|
|unrealized_pnl<br>`up` |string|True|The unrealized PnL of the position, expressed in quote asset decimal units<br>`unrealized_pnl = (mark_price - entry_price) * size`|
|realized_pnl<br>`rp` |string|True|The realized PnL of the position, expressed in quote asset decimal units<br>`realized_pnl = (exit_price - entry_price) * exit_trade_size`|
|total_pnl<br>`tp` |string|True|The total PnL of the position, expressed in quote asset decimal units<br>`total_pnl = realized_pnl + unrealized_pnl`|
|roi<br>`r` |string|True|The ROI of the position, expressed as a percentage<br>`roi = (total_pnl / (entry_price * abs(size))) * 100^`|
|quote_index_price<br>`qi` |string|True|The index price of the quote currency. (reported in `USD`)|
|est_liquidation_price<br>`el` |string|True|The estimated liquidation price|
|leverage<br>`l` |string|True|The current leverage value for this position|
@@ -0,0 +1,42 @@
!!! info "[ApiPreDepositCheckRequest](/../../schemas/api_pre_deposit_check_request)"
UI only for bridge deposits through non native bridge. Currently only supports XY Finance bridge account.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|currency<br>`c` |Currency|True|The currency you hold the deposit in|
|bridge<br>`b` |BridgeType|True|The bridge type to conduct checks for|
??? info "[Currency](/../../schemas/currency)"
The list of Currencies that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`USD` = 1|the USD fiat currency|
|`USDC` = 2|the USDC token|
|`USDT` = 3|the USDT token|
|`ETH` = 4|the ETH token|
|`BTC` = 5|the BTC token|
|`SOL` = 6|the SOL token|
|`ARB` = 7|the ARB token|
|`BNB` = 8|the BNB token|
|`ZK` = 9|the ZK token|
|`POL` = 10|the POL token|
|`OP` = 11|the OP token|
|`ATOM` = 12|the ATOM token|
|`KPEPE` = 13|the 1000PEPE token|
|`TON` = 14|the TON token|
|`XRP` = 15|the XRP token|
|`TRUMP` = 20|the TRUMP token|
|`SUI` = 21|the SUI token|
|`LINK` = 25|the LINK token|
|`JUP` = 27|the JUP token|
|`FARTCOIN` = 28|the FARTCOIN token|
|`ENA` = 29|the ENA token|
|`DOGE` = 30|the DOGE token|
|`ADA` = 33|the ADA token|
|`AAVE` = 34|the AAVE token|
|`BERA` = 35|the BERA token|
|`IP` = 40|the IP token|
??? info "[BridgeType](/../../schemas/bridge_type)"
|Value| Description |
|-|-|
|`XY` = 1|XY Bridge type|
@@ -0,0 +1,36 @@
!!! info "[ApiPreDepositCheckResponse](/../../schemas/api_pre_deposit_check_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|max_deposit_limit<br>`md` |string|True|Max Deposit Limit reported for the Bridge Account reported in the currency balance|
|currency<br>`c` |Currency|True|The currency you hold the deposit in|
??? info "[Currency](/../../schemas/currency)"
The list of Currencies that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`USD` = 1|the USD fiat currency|
|`USDC` = 2|the USDC token|
|`USDT` = 3|the USDT token|
|`ETH` = 4|the ETH token|
|`BTC` = 5|the BTC token|
|`SOL` = 6|the SOL token|
|`ARB` = 7|the ARB token|
|`BNB` = 8|the BNB token|
|`ZK` = 9|the ZK token|
|`POL` = 10|the POL token|
|`OP` = 11|the OP token|
|`ATOM` = 12|the ATOM token|
|`KPEPE` = 13|the 1000PEPE token|
|`TON` = 14|the TON token|
|`XRP` = 15|the XRP token|
|`TRUMP` = 20|the TRUMP token|
|`SUI` = 21|the SUI token|
|`LINK` = 25|the LINK token|
|`JUP` = 27|the JUP token|
|`FARTCOIN` = 28|the FARTCOIN token|
|`ENA` = 29|the ENA token|
|`DOGE` = 30|the DOGE token|
|`ADA` = 33|the ADA token|
|`AAVE` = 34|the AAVE token|
|`BERA` = 35|the BERA token|
|`IP` = 40|the IP token|
@@ -0,0 +1,150 @@
!!! info "[ApiPreOrderCheckRequest](/../../schemas/api_pre_order_check_request)"
Get pre-order check information for a new order<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|sub_account_id<br>`sa` |string|True|The subaccount ID of orders to query|
|orders<br>`o` |[Order]|True|The order to do pre-order check|
??? info "[Order](/../../schemas/order)"
Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.<br>GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.<br>This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.<br>Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.<br><br>All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.<br>This minimizes the amount of trust users have to offer to GRVT<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|order_id<br>`oi` |string|False<br>`0`|[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend|
|sub_account_id<br>`sa` |string|True|The subaccount initiating the order|
|is_market<br>`im` |boolean|False<br>`false`|If the order is a market order<br>Market Orders do not have a limit price, and are always executed according to the maker order price.<br>Market Orders must always be taker orders|
|time_in_force<br>`ti` |TimeInForce|True|Four supported types of orders: GTT, IOC, AON, FOK:<ul><br><li>PARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg</li><br><li>FULL EXECUTION = AON / FOK - only allows full size execution on all legs</li><br><li>TAKER ONLY = IOC / FOK - only allows taker orders</li><br><li>MAKER OR TAKER = GTT / AON - allows maker or taker orders</li><br></ul>Exchange only supports (GTT, IOC, FOK)<br>RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)|
|post_only<br>`po` |boolean|False<br>`false`|If True, Order must be a maker order. It has to fill the orderbook instead of match it.<br>If False, Order can be either a maker or taker order. <b>In this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.</b><br><br>| | Must Fill All | Can Fill Partial |<br>| - | - | - |<br>| Must Be Taker | FOK + False | IOC + False |<br>| Can Be Either | AON + False | GTC + False |<br>| Must Be Maker | AON + True | GTC + True |<br>|
|reduce_only<br>`ro` |boolean|False<br>`false`|If True, Order must reduce the position size, or be cancelled|
|legs<br>`l` |[OrderLeg]|True|The legs present in this order<br>The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice|
|signature<br>`s` |Signature|True|The signature approving this order|
|metadata<br>`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client|
|state<br>`s1` |OrderState|False<br>`''`|[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 |
<br>
|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<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|instrument<br>`i` |string|True|The instrument to trade in this leg|
|size<br>`s` |string|True|The total number of assets to trade in this leg, expressed in base asset decimal units.|
|limit_price<br>`lp` |string|False<br>`0`|The limit price of the order leg, expressed in `9` decimals.<br>This is the number of quote currency units to pay/receive for this leg.<br>This should be `null/0` if the order is a market order|
|is_buying_asset<br>`ib` |boolean|True|Specifies if the order leg is a buy or sell|
??? info "[Signature](/../../schemas/signature)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|signer<br>`s` |string|True|The address (public key) of the wallet signing the payload|
|r<br>`r` |string|True|Signature R|
|s<br>`s1` |string|True|Signature S|
|v<br>`v` |integer|True|Signature V|
|expiration<br>`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days|
|nonce<br>`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.<br>ie. You can send the same exact instruction twice with different nonces.<br>When the same nonce is used, the same payload will generate the same signature.<br>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.<br>Hence, fields in here are never signed, and is never transmitted to the smart contract.<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|client_order_id<br>`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client<br>This is used to identify the order in the client's system<br>This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer<br>This field will not be propagated to the smart contract, and should not be signed by the client<br>This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected<br>Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]<br>To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]<br><br>When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId|
|create_time<br>`ct` |string|False<br>`0`|[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds|
|trigger<br>`t` |TriggerOrderMetadata|False<br>``|Trigger fields are used to support any type of trigger order such as TP/SL|
|broker<br>`b` |BrokerTag|False<br>``|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).<br><br>Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_type<br>`tt` |TriggerType|True|Type of the trigger order. eg: Take Profit, Stop Loss, etc|
|tpsl<br>`t` |TPSLOrderMetadata|True|Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.<br><br>|
??? info "[TriggerType](/../../schemas/trigger_type)"
Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.<br><br>Trigger orders allow execution based on pre-defined price conditions rather than immediate market conditions.<br><br><br>
|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.<br><br>### Fields:<br>- **triggerBy**: Defines the price type that activates the order (e.g., index price).<br>- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.<br><br><br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trigger_by<br>`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order|
|trigger_price<br>`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.<br><br>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.<br><br><br>
|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.<br>
|Value| Description |
|-|-|
|`UNSPECIFIED` = 0||
|`COIN_ROUTES` = 1|CoinRoutes|
|`ALERTATRON` = 2|Alertatron|
|`ORIGAMI` = 3|Origami|
??? info "[OrderState](/../../schemas/order_state)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|status<br>`s` |OrderStatus|True|The status of the order|
|reject_reason<br>`rr` |OrderRejectReason|True|The reason for rejection or cancellation|
|book_size<br>`bs` |[string]|True|The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs|
|traded_size<br>`ts` |[string]|True|The total number of assets traded. Sorted in same order as Order.Legs|
|update_time<br>`ut` |string|True|Time at which the order was updated by GRVT, expressed in unix nanoseconds|
|avg_fill_price<br>`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|
@@ -0,0 +1,49 @@
!!! info "[ApiPreOrderCheckResponse](/../../schemas/api_pre_order_check_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|results<br>`r` |[PreOrderCheckResult]|True|Pre order check for each new order in the request|
??? info "[PreOrderCheckResult](/../../schemas/pre_order_check_result)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|max_qty<br>`mq` |[AssetMaxQty]|True|The maximum quantity for each leg|
|margin_required<br>`mr` |string|True|The margin required for the order (reported in `settle_currency`)|
|order_valid<br>`ov` |boolean|True|Whether the order is valid|
|reason<br>`r` |string|True|The reason the order is invalid, if any|
|settle_currency<br>`sc` |Currency|True|The subAccount settle currency|
??? info "[AssetMaxQty](/../../schemas/asset_max_qty)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|asset<br>`a` |string|True|The asset associated with the max quantity|
|max_buy_qty<br>`mb` |string|True|The maximum buy quantity|
|max_sell_qty<br>`ms` |string|True|The maximum sell quantity|
??? info "[Currency](/../../schemas/currency)"
The list of Currencies that are supported on the GRVT exchange<br>
|Value| Description |
|-|-|
|`USD` = 1|the USD fiat currency|
|`USDC` = 2|the USDC token|
|`USDT` = 3|the USDT token|
|`ETH` = 4|the ETH token|
|`BTC` = 5|the BTC token|
|`SOL` = 6|the SOL token|
|`ARB` = 7|the ARB token|
|`BNB` = 8|the BNB token|
|`ZK` = 9|the ZK token|
|`POL` = 10|the POL token|
|`OP` = 11|the OP token|
|`ATOM` = 12|the ATOM token|
|`KPEPE` = 13|the 1000PEPE token|
|`TON` = 14|the TON token|
|`XRP` = 15|the XRP token|
|`TRUMP` = 20|the TRUMP token|
|`SUI` = 21|the SUI token|
|`LINK` = 25|the LINK token|
|`JUP` = 27|the JUP token|
|`FARTCOIN` = 28|the FARTCOIN token|
|`ENA` = 29|the ENA token|
|`DOGE` = 30|the DOGE token|
|`ADA` = 33|the ADA token|
|`AAVE` = 34|the AAVE token|
|`BERA` = 35|the BERA token|
|`IP` = 40|the IP token|
@@ -0,0 +1,6 @@
!!! info "[ApiQueryFlatReferralStatRequest](/../../schemas/api_query_flat_referral_stat_request)"
Query flat referral stats<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|account_id<br>`ai` |string|True|The off chain account id to get referral stats|
@@ -0,0 +1,5 @@
!!! info "[ApiQueryFlatReferralStatResponse](/../../schemas/api_query_flat_referral_stat_response)"
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|direct_invite_count<br>`di` |integer|True|Direct invite count|
|indirect_invite_count<br>`ii` |integer|True|Indirect invite count|
@@ -0,0 +1,7 @@
!!! info "[ApiQueryTradingPerformanceRequest](/../../schemas/api_query_trading_performance_request)"
Request to retrieve the trading volume<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|sub_account_id<br>`sa` |string|False<br>`all`|Optional: The subaccount ID to filter by|
|asset<br>`a` |unknown|True|The asset to filter by|
@@ -0,0 +1,7 @@
!!! info "[ApiQueryTradingPerformanceResponse](/../../schemas/api_query_trading_performance_response)"
Response to retrieve the trading volume<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|trading_volume<br>`tv` |string|True|Trading volume in USDT|
|realized_pnl<br>`rp` |string|True|Realized PnL in USDT|
@@ -0,0 +1,7 @@
!!! info "[ApiQueryVaultManagerInvestorHistoryRequest](/../../schemas/api_query_vault_manager_investor_history_request)"
Request for the manager to retrieve the vault investor history for their vault<br>
|Name<br>`Lite`|Type|Required<br>`Default`| Description |
|-|-|-|-|
|vault_id<br>`vi` |string|True|The unique identifier of the vault to filter by|
|only_own_investments<br>`oo` |boolean|True|Whether to only return investments made by the manager|

Some files were not shown because too many files have changed in this diff Show More