From 0c36cc4b604ba271d93744706114366fb534e526 Mon Sep 17 00:00:00 2001 From: Aaron Ong Date: Tue, 13 May 2025 23:55:11 +0800 Subject: [PATCH 1/2] [RFC] Update API docs and specs --- artifacts/apidocs/market_data_api.md | 18 +- artifacts/apidocs/market_data_streams.md | 6 +- .../schemas/api_create_order_request.md | 4 + .../schemas/api_create_order_response.md | 4 + .../schemas/api_fill_history_response.md | 1 + .../api_funding_account_summary_response.md | 45 - .../schemas/api_funding_rate_response.md | 1 + .../apidocs/schemas/api_get_order_response.md | 4 + .../schemas/api_open_orders_response.md | 4 + .../schemas/api_order_history_response.md | 4 + .../schemas/api_trade_history_response.md | 1 + .../apidocs/schemas/api_trade_response.md | 1 + artifacts/apidocs/schemas/api_transfer_ack.md | 5 + .../schemas/api_transfer_history_response.md | 60 - .../apidocs/schemas/api_transfer_request.md | 2 + .../apidocs/schemas/api_transfer_response.md | 11 + .../api_withdrawal_history_response.md | 50 - artifacts/apidocs/schemas/bridge_type.md | 1 + .../apidocs/schemas/cancel_status_feed.md | 2 + artifacts/apidocs/schemas/fill.md | 1 + artifacts/apidocs/schemas/funding_rate.md | 1 + artifacts/apidocs/schemas/order.md | 4 + artifacts/apidocs/schemas/order_metadata.md | 1 + .../apidocs/schemas/order_reject_reason.md | 2 + artifacts/apidocs/schemas/order_state.md | 2 + artifacts/apidocs/schemas/order_state_feed.md | 2 + artifacts/apidocs/schemas/time_in_force.md | 1 + artifacts/apidocs/schemas/time_interval.md | 9 + .../apidocs/schemas/tpsl_order_metadata.md | 1 + artifacts/apidocs/schemas/trade.md | 1 + artifacts/apidocs/schemas/transfer_type.md | 2 + .../apidocs/schemas/trigger_order_metadata.md | 1 + artifacts/apidocs/schemas/vault_type.md | 5 + .../apidocs/schemas/ws_cancel_feed_data_v1.md | 2 + .../apidocs/schemas/ws_fill_feed_data_v1.md | 1 + .../apidocs/schemas/ws_order_feed_data_v1.md | 4 + .../schemas/ws_order_state_feed_data_v1.md | 2 + .../apidocs/schemas/ws_trade_feed_data_v1.md | 1 + .../schemas/ws_transfer_feed_data_v1.md | 60 - artifacts/apidocs/trading_api.md | 5963 ++----- artifacts/apidocs/trading_streams.md | 649 +- artifacts/pysdk/grvt_raw_async.py | 80 +- artifacts/pysdk/grvt_raw_sync.py | 80 +- artifacts/pysdk/grvt_raw_types.py | 1155 +- src/codegen/apispec.json | 14631 +++++----------- 45 files changed, 6076 insertions(+), 16809 deletions(-) create mode 100644 artifacts/apidocs/schemas/api_transfer_ack.md create mode 100644 artifacts/apidocs/schemas/api_transfer_response.md create mode 100644 artifacts/apidocs/schemas/time_interval.md create mode 100644 artifacts/apidocs/schemas/vault_type.md diff --git a/artifacts/apidocs/market_data_api.md b/artifacts/apidocs/market_data_api.md index 92bb6c7..04a289b 100644 --- a/artifacts/apidocs/market_data_api.md +++ b/artifacts/apidocs/market_data_api.md @@ -1964,7 +1964,8 @@ LITE ENDPOINT: lite/v1/trade "interest_rate": 0.0003, "forward_price": "65038.01", "trade_id": "209358-2", - "venue": "ORDERBOOK" + "venue": "ORDERBOOK", + "is_rpi": false }] } ``` @@ -1982,7 +1983,8 @@ LITE ENDPOINT: lite/v1/trade "ir": 0.0003, "fp": "65038.01", "ti": "209358-2", - "v": "ORDERBOOK" + "v": "ORDERBOOK", + "ir1": false }] } ``` @@ -2284,7 +2286,8 @@ LITE ENDPOINT: lite/v1/trade_history "interest_rate": 0.0003, "forward_price": "65038.01", "trade_id": "209358-2", - "venue": "ORDERBOOK" + "venue": "ORDERBOOK", + "is_rpi": false }], "next": "Qw0918=" } @@ -2303,7 +2306,8 @@ LITE ENDPOINT: lite/v1/trade_history "ir": 0.0003, "fp": "65038.01", "ti": "209358-2", - "v": "ORDERBOOK" + "v": "ORDERBOOK", + "ir1": false }], "n": "Qw0918=" } @@ -3053,7 +3057,8 @@ LITE ENDPOINT: lite/v1/funding "instrument": "BTC_USDT_Perp", "funding_rate": 0.0003, "funding_time": "1697788800000000000", - "mark_price": "65038.01" + "mark_price": "65038.01", + "funding_rate_8_h_avg": 0.0003 }], "next": "Qw0918=" } @@ -3065,7 +3070,8 @@ LITE ENDPOINT: lite/v1/funding "i": "BTC_USDT_Perp", "fr": 0.0003, "ft": "1697788800000000000", - "mp": "65038.01" + "mp": "65038.01", + "fr1": 0.0003 }], "n": "Qw0918=" } diff --git a/artifacts/apidocs/market_data_streams.md b/artifacts/apidocs/market_data_streams.md index 463c4dc..235b6ed 100644 --- a/artifacts/apidocs/market_data_streams.md +++ b/artifacts/apidocs/market_data_streams.md @@ -3532,7 +3532,8 @@ STREAM: v1.trade "interest_rate": 0.0003, "forward_price": "65038.01", "trade_id": "209358-2", - "venue": "ORDERBOOK" + "venue": "ORDERBOOK", + "is_rpi": false } } ``` @@ -3553,7 +3554,8 @@ STREAM: v1.trade "ir": 0.0003, "fp": "65038.01", "ti": "209358-2", - "v": "ORDERBOOK" + "v": "ORDERBOOK", + "ir1": false } } ``` diff --git a/artifacts/apidocs/schemas/api_create_order_request.md b/artifacts/apidocs/schemas/api_create_order_request.md index 5cffa3d..e03d2a6 100644 --- a/artifacts/apidocs/schemas/api_create_order_request.md +++ b/artifacts/apidocs/schemas/api_create_order_request.md @@ -32,6 +32,7 @@ |`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
`Lite`|Type|Required
`Default`| Description | |-|-|-|-| @@ -79,6 +80,7 @@ |-|-|-|-| |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order| |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.| + |close_position
`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.

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.


@@ -147,3 +149,5 @@ |`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| diff --git a/artifacts/apidocs/schemas/api_create_order_response.md b/artifacts/apidocs/schemas/api_create_order_response.md index 67e514b..a566135 100644 --- a/artifacts/apidocs/schemas/api_create_order_response.md +++ b/artifacts/apidocs/schemas/api_create_order_response.md @@ -30,6 +30,7 @@ |`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
`Lite`|Type|Required
`Default`| Description | |-|-|-|-| @@ -77,6 +78,7 @@ |-|-|-|-| |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order| |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.| + |close_position
`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.

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.


@@ -145,3 +147,5 @@ |`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| diff --git a/artifacts/apidocs/schemas/api_fill_history_response.md b/artifacts/apidocs/schemas/api_fill_history_response.md index 3b8a06e..65a847a 100644 --- a/artifacts/apidocs/schemas/api_fill_history_response.md +++ b/artifacts/apidocs/schemas/api_fill_history_response.md @@ -26,6 +26,7 @@ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]

When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId| |signer
`s1` |string|True|The address (public key) of the wallet signing the payload| |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order| + |is_rpi
`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
diff --git a/artifacts/apidocs/schemas/api_funding_account_summary_response.md b/artifacts/apidocs/schemas/api_funding_account_summary_response.md index 8ec97c1..58c6872 100644 --- a/artifacts/apidocs/schemas/api_funding_account_summary_response.md +++ b/artifacts/apidocs/schemas/api_funding_account_summary_response.md @@ -4,48 +4,3 @@ |Name
`Lite`|Type|Required
`Default`| Description | |-|-|-|-| |result
`r` |FundingAccountSummary|True|The funding account summary| - ??? info "[FundingAccountSummary](/../../schemas/funding_account_summary)" - The funding account summary, that reports the total equity and spot balances of a funding (main) account
- - |Name
`Lite`|Type|Required
`Default`| Description | - |-|-|-|-| - |main_account_id
`ma` |string|True|The main account ID of the account to which the summary belongs| - |total_equity
`te` |string|True|Total equity of the main account, denominated in USD| - |spot_balances
`sb` |[SpotBalance]|True|The list of spot assets owned by this main account, and their balances| - ??? info "[SpotBalance](/../../schemas/spot_balance)" - |Name
`Lite`|Type|Required
`Default`| Description | - |-|-|-|-| - |currency
`c` |Currency|True|The currency you hold a spot balance in| - |balance
`b` |string|True|This currency's balance in this trading account.| - |index_price
`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
- - |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| diff --git a/artifacts/apidocs/schemas/api_funding_rate_response.md b/artifacts/apidocs/schemas/api_funding_rate_response.md index ba70608..01e2a1c 100644 --- a/artifacts/apidocs/schemas/api_funding_rate_response.md +++ b/artifacts/apidocs/schemas/api_funding_rate_response.md @@ -10,3 +10,4 @@ |funding_rate
`fr` |string|True|The funding rate of the instrument, expressed in percentage points| |funding_time
`ft` |string|True|The funding timestamp of the funding rate, expressed in unix nanoseconds| |mark_price
`mp` |string|True|The mark price of the instrument at funding timestamp, expressed in `9` decimals| + |funding_rate_8_h_avg
`fr1` |string|True|The 8h average funding rate of the instrument, expressed in percentage points| diff --git a/artifacts/apidocs/schemas/api_get_order_response.md b/artifacts/apidocs/schemas/api_get_order_response.md index 86f37bb..66eb23b 100644 --- a/artifacts/apidocs/schemas/api_get_order_response.md +++ b/artifacts/apidocs/schemas/api_get_order_response.md @@ -30,6 +30,7 @@ |`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
`Lite`|Type|Required
`Default`| Description | |-|-|-|-| @@ -77,6 +78,7 @@ |-|-|-|-| |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order| |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.| + |close_position
`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.

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.


@@ -145,3 +147,5 @@ |`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| diff --git a/artifacts/apidocs/schemas/api_open_orders_response.md b/artifacts/apidocs/schemas/api_open_orders_response.md index 8ec0f03..6c60f8c 100644 --- a/artifacts/apidocs/schemas/api_open_orders_response.md +++ b/artifacts/apidocs/schemas/api_open_orders_response.md @@ -32,6 +32,7 @@ |`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
`Lite`|Type|Required
`Default`| Description | |-|-|-|-| @@ -79,6 +80,7 @@ |-|-|-|-| |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order| |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.| + |close_position
`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.

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.


@@ -147,3 +149,5 @@ |`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| diff --git a/artifacts/apidocs/schemas/api_order_history_response.md b/artifacts/apidocs/schemas/api_order_history_response.md index 9a72efd..cb9c57c 100644 --- a/artifacts/apidocs/schemas/api_order_history_response.md +++ b/artifacts/apidocs/schemas/api_order_history_response.md @@ -31,6 +31,7 @@ |`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
`Lite`|Type|Required
`Default`| Description | |-|-|-|-| @@ -78,6 +79,7 @@ |-|-|-|-| |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order| |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.| + |close_position
`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.

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.


@@ -146,3 +148,5 @@ |`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| diff --git a/artifacts/apidocs/schemas/api_trade_history_response.md b/artifacts/apidocs/schemas/api_trade_history_response.md index 634a047..4128825 100644 --- a/artifacts/apidocs/schemas/api_trade_history_response.md +++ b/artifacts/apidocs/schemas/api_trade_history_response.md @@ -19,6 +19,7 @@ |forward_price
`fp` |string|True|[Options] The forward price of the option at point of trade, expressed in `9` decimals| |trade_id
`ti` |string|True|A trade identifier, globally unique, and monotonically increasing (not by `1`).
All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.
`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`.| |venue
`v` |Venue|True|The venue where the trade occurred| + |is_rpi
`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
diff --git a/artifacts/apidocs/schemas/api_trade_response.md b/artifacts/apidocs/schemas/api_trade_response.md index 8e1f882..f16f396 100644 --- a/artifacts/apidocs/schemas/api_trade_response.md +++ b/artifacts/apidocs/schemas/api_trade_response.md @@ -18,6 +18,7 @@ |forward_price
`fp` |string|True|[Options] The forward price of the option at point of trade, expressed in `9` decimals| |trade_id
`ti` |string|True|A trade identifier, globally unique, and monotonically increasing (not by `1`).
All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.
`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`.| |venue
`v` |Venue|True|The venue where the trade occurred| + |is_rpi
`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
diff --git a/artifacts/apidocs/schemas/api_transfer_ack.md b/artifacts/apidocs/schemas/api_transfer_ack.md new file mode 100644 index 0000000..d98ee1d --- /dev/null +++ b/artifacts/apidocs/schemas/api_transfer_ack.md @@ -0,0 +1,5 @@ +!!! info "[ApiTransferAck](/../../schemas/api_transfer_ack)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |ack
`a` |boolean|True|Gravity has acknowledged that the transfer has been successfully processed. If true, a `tx_id` will be returned. If false, an error will be returned.| + |tx_id
`ti` |string|True|The transaction ID of the transfer. This is only returned if the transfer is successful.| diff --git a/artifacts/apidocs/schemas/api_transfer_history_response.md b/artifacts/apidocs/schemas/api_transfer_history_response.md index cbdac79..179cf6f 100644 --- a/artifacts/apidocs/schemas/api_transfer_history_response.md +++ b/artifacts/apidocs/schemas/api_transfer_history_response.md @@ -3,63 +3,3 @@ |-|-|-|-| |result
`r` |[TransferHistory]|True|The transfer history matching the request account| |next
`n` |string|False
`''`|The cursor to indicate when to start the next query from| - ??? info "[TransferHistory](/../../schemas/transfer_history)" - |Name
`Lite`|Type|Required
`Default`| Description | - |-|-|-|-| - |tx_id
`ti` |string|True|The transaction ID of the transfer| - |from_account_id
`fa` |string|True|The account to transfer from| - |from_sub_account_id
`fs` |string|True|The subaccount to transfer from (0 if transferring from main account)| - |to_account_id
`ta` |string|True|The account to deposit into| - |to_sub_account_id
`ts` |string|True|The subaccount to transfer to (0 if transferring to main account)| - |currency
`c` |Currency|True|The token currency to transfer| - |num_tokens
`nt` |string|True|The number of tokens to transfer| - |signature
`s` |Signature|True|The signature of the transfer| - |event_time
`et` |string|True|The timestamp of the transfer in unix nanoseconds| - |transfer_type
`tt` |TransferType|True|The type of transfer| - |transfer_metadata
`tm` |string|True|The metadata of the transfer| - ??? info "[Currency](/../../schemas/currency)" - The list of Currencies that are supported on the GRVT exchange
- - |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 "[Signature](/../../schemas/signature)" - |Name
`Lite`|Type|Required
`Default`| Description | - |-|-|-|-| - |signer
`s` |string|True|The address (public key) of the wallet signing the payload| - |r
`r` |string|True|Signature R| - |s
`s1` |string|True|Signature S| - |v
`v` |integer|True|Signature V| - |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days| - |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.| - ??? info "[TransferType](/../../schemas/transfer_type)" - |Value| Description | - |-|-| - |`STANDARD` = 1|Standard transfer that has nothing to do with bridging| - |`FAST_ARB_DEPOSIT` = 2|Fast Arb Deposit Metadata type| - |`FAST_ARB_WITHDRAWAL` = 3|Fast Arb Withdrawal Metadata type| diff --git a/artifacts/apidocs/schemas/api_transfer_request.md b/artifacts/apidocs/schemas/api_transfer_request.md index 836d0f6..0719169 100644 --- a/artifacts/apidocs/schemas/api_transfer_request.md +++ b/artifacts/apidocs/schemas/api_transfer_request.md @@ -58,3 +58,5 @@ |`STANDARD` = 1|Standard transfer that has nothing to do with bridging| |`FAST_ARB_DEPOSIT` = 2|Fast Arb Deposit Metadata type| |`FAST_ARB_WITHDRAWAL` = 3|Fast Arb Withdrawal Metadata type| + |`NON_NATIVE_BRIDGE_DEPOSIT` = 4|Transfer type for non native bridging deposit| + |`NON_NATIVE_BRIDGE_WITHDRAWAL` = 5|Transfer type for non native bridging withdrawal| diff --git a/artifacts/apidocs/schemas/api_transfer_response.md b/artifacts/apidocs/schemas/api_transfer_response.md new file mode 100644 index 0000000..85fae34 --- /dev/null +++ b/artifacts/apidocs/schemas/api_transfer_response.md @@ -0,0 +1,11 @@ +!!! info "[ApiTransferResponse](/../../schemas/api_transfer_response)" + Used to acknowledge a transfer request outcome
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |result
`r` |ApiTransferAck|True|The Transfer response object| + ??? info "[ApiTransferAck](/../../schemas/api_transfer_ack)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |ack
`a` |boolean|True|Gravity has acknowledged that the transfer has been successfully processed. If true, a `tx_id` will be returned. If false, an error will be returned.| + |tx_id
`ti` |string|True|The transaction ID of the transfer. This is only returned if the transfer is successful.| diff --git a/artifacts/apidocs/schemas/api_withdrawal_history_response.md b/artifacts/apidocs/schemas/api_withdrawal_history_response.md index 6376519..861aa1d 100644 --- a/artifacts/apidocs/schemas/api_withdrawal_history_response.md +++ b/artifacts/apidocs/schemas/api_withdrawal_history_response.md @@ -3,53 +3,3 @@ |-|-|-|-| |result
`r` |[WithdrawalHistory]|True|The withdrawals history matching the request account| |next
`n` |string|False
`''`|The cursor to indicate when to start the next query from| - ??? info "[WithdrawalHistory](/../../schemas/withdrawal_history)" - |Name
`Lite`|Type|Required
`Default`| Description | - |-|-|-|-| - |tx_id
`ti` |string|True|The transaction ID of the withdrawal| - |from_account_id
`fa` |string|True|The subaccount to withdraw from| - |to_eth_address
`te` |string|True|The ethereum address to withdraw to| - |currency
`c` |Currency|True|The token currency to withdraw| - |num_tokens
`nt` |string|True|The number of tokens to withdraw| - |signature
`s` |Signature|True|The signature of the withdrawal| - |event_time
`et` |string|True|The timestamp of the withdrawal in unix nanoseconds| - ??? info "[Currency](/../../schemas/currency)" - The list of Currencies that are supported on the GRVT exchange
- - |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 "[Signature](/../../schemas/signature)" - |Name
`Lite`|Type|Required
`Default`| Description | - |-|-|-|-| - |signer
`s` |string|True|The address (public key) of the wallet signing the payload| - |r
`r` |string|True|Signature R| - |s
`s1` |string|True|Signature S| - |v
`v` |integer|True|Signature V| - |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days| - |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.| diff --git a/artifacts/apidocs/schemas/bridge_type.md b/artifacts/apidocs/schemas/bridge_type.md index 626d2aa..f9749cc 100644 --- a/artifacts/apidocs/schemas/bridge_type.md +++ b/artifacts/apidocs/schemas/bridge_type.md @@ -2,3 +2,4 @@ |Value| Description | |-|-| |`XY` = 1|XY Bridge type| + |`RHINO` = 2|Rhino Bridge type| diff --git a/artifacts/apidocs/schemas/cancel_status_feed.md b/artifacts/apidocs/schemas/cancel_status_feed.md index e36c34f..108c338 100644 --- a/artifacts/apidocs/schemas/cancel_status_feed.md +++ b/artifacts/apidocs/schemas/cancel_status_feed.md @@ -41,6 +41,8 @@ |`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| ??? info "[CancelStatus](/../../schemas/cancel_status)" |Value| Description | |-|-| diff --git a/artifacts/apidocs/schemas/fill.md b/artifacts/apidocs/schemas/fill.md index d5462e4..f0f4482 100644 --- a/artifacts/apidocs/schemas/fill.md +++ b/artifacts/apidocs/schemas/fill.md @@ -21,6 +21,7 @@ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]

When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId| |signer
`s1` |string|True|The address (public key) of the wallet signing the payload| |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order| + |is_rpi
`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
diff --git a/artifacts/apidocs/schemas/funding_rate.md b/artifacts/apidocs/schemas/funding_rate.md index 8f47179..09d883d 100644 --- a/artifacts/apidocs/schemas/funding_rate.md +++ b/artifacts/apidocs/schemas/funding_rate.md @@ -5,3 +5,4 @@ |funding_rate
`fr` |string|True|The funding rate of the instrument, expressed in percentage points| |funding_time
`ft` |string|True|The funding timestamp of the funding rate, expressed in unix nanoseconds| |mark_price
`mp` |string|True|The mark price of the instrument at funding timestamp, expressed in `9` decimals| + |funding_rate_8_h_avg
`fr1` |string|True|The 8h average funding rate of the instrument, expressed in percentage points| diff --git a/artifacts/apidocs/schemas/order.md b/artifacts/apidocs/schemas/order.md index 8a203d1..f999be7 100644 --- a/artifacts/apidocs/schemas/order.md +++ b/artifacts/apidocs/schemas/order.md @@ -26,6 +26,7 @@ |`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
`Lite`|Type|Required
`Default`| Description | |-|-|-|-| @@ -73,6 +74,7 @@ |-|-|-|-| |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order| |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.| + |close_position
`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.

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.


@@ -141,3 +143,5 @@ |`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| diff --git a/artifacts/apidocs/schemas/order_metadata.md b/artifacts/apidocs/schemas/order_metadata.md index 571cd2c..6d45848 100644 --- a/artifacts/apidocs/schemas/order_metadata.md +++ b/artifacts/apidocs/schemas/order_metadata.md @@ -29,6 +29,7 @@ |-|-|-|-| |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order| |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.| + |close_position
`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.

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.


diff --git a/artifacts/apidocs/schemas/order_reject_reason.md b/artifacts/apidocs/schemas/order_reject_reason.md index efa0bbf..9dac95d 100644 --- a/artifacts/apidocs/schemas/order_reject_reason.md +++ b/artifacts/apidocs/schemas/order_reject_reason.md @@ -32,3 +32,5 @@ |`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| diff --git a/artifacts/apidocs/schemas/order_state.md b/artifacts/apidocs/schemas/order_state.md index 73b9d1f..88b4504 100644 --- a/artifacts/apidocs/schemas/order_state.md +++ b/artifacts/apidocs/schemas/order_state.md @@ -49,3 +49,5 @@ |`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| diff --git a/artifacts/apidocs/schemas/order_state_feed.md b/artifacts/apidocs/schemas/order_state_feed.md index 0fbb189..744b2b8 100644 --- a/artifacts/apidocs/schemas/order_state_feed.md +++ b/artifacts/apidocs/schemas/order_state_feed.md @@ -55,3 +55,5 @@ |`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| diff --git a/artifacts/apidocs/schemas/time_in_force.md b/artifacts/apidocs/schemas/time_in_force.md index 22bf1f3..b71f052 100644 --- a/artifacts/apidocs/schemas/time_in_force.md +++ b/artifacts/apidocs/schemas/time_in_force.md @@ -11,3 +11,4 @@ |`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.| diff --git a/artifacts/apidocs/schemas/time_interval.md b/artifacts/apidocs/schemas/time_interval.md new file mode 100644 index 0000000..7929ec0 --- /dev/null +++ b/artifacts/apidocs/schemas/time_interval.md @@ -0,0 +1,9 @@ +!!! info "[TimeInterval](/../../schemas/time_interval)" + Time interval can be used as a filter in metric/portfolio management APIs
+ + |Value| Description | + |-|-| + |`INTERVAL_1_D` = 1|1 day| + |`INTERVAL_7_D` = 2|7 days| + |`INTERVAL_30_D` = 3|30 days| + |`INTERVAL_90_D` = 4|90 days| diff --git a/artifacts/apidocs/schemas/tpsl_order_metadata.md b/artifacts/apidocs/schemas/tpsl_order_metadata.md index 0b760a8..3ce57e0 100644 --- a/artifacts/apidocs/schemas/tpsl_order_metadata.md +++ b/artifacts/apidocs/schemas/tpsl_order_metadata.md @@ -5,6 +5,7 @@ |-|-|-|-| |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order| |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.| + |close_position
`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.

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.


diff --git a/artifacts/apidocs/schemas/trade.md b/artifacts/apidocs/schemas/trade.md index 6958f5e..e41914e 100644 --- a/artifacts/apidocs/schemas/trade.md +++ b/artifacts/apidocs/schemas/trade.md @@ -14,6 +14,7 @@ |forward_price
`fp` |string|True|[Options] The forward price of the option at point of trade, expressed in `9` decimals| |trade_id
`ti` |string|True|A trade identifier, globally unique, and monotonically increasing (not by `1`).
All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.
`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`.| |venue
`v` |Venue|True|The venue where the trade occurred| + |is_rpi
`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
diff --git a/artifacts/apidocs/schemas/transfer_type.md b/artifacts/apidocs/schemas/transfer_type.md index ccce00b..ad56b70 100644 --- a/artifacts/apidocs/schemas/transfer_type.md +++ b/artifacts/apidocs/schemas/transfer_type.md @@ -4,3 +4,5 @@ |`STANDARD` = 1|Standard transfer that has nothing to do with bridging| |`FAST_ARB_DEPOSIT` = 2|Fast Arb Deposit Metadata type| |`FAST_ARB_WITHDRAWAL` = 3|Fast Arb Withdrawal Metadata type| + |`NON_NATIVE_BRIDGE_DEPOSIT` = 4|Transfer type for non native bridging deposit| + |`NON_NATIVE_BRIDGE_WITHDRAWAL` = 5|Transfer type for non native bridging withdrawal| diff --git a/artifacts/apidocs/schemas/trigger_order_metadata.md b/artifacts/apidocs/schemas/trigger_order_metadata.md index 4a97256..ab881b4 100644 --- a/artifacts/apidocs/schemas/trigger_order_metadata.md +++ b/artifacts/apidocs/schemas/trigger_order_metadata.md @@ -20,6 +20,7 @@ |-|-|-|-| |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order| |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.| + |close_position
`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.

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.


diff --git a/artifacts/apidocs/schemas/vault_type.md b/artifacts/apidocs/schemas/vault_type.md new file mode 100644 index 0000000..e49495d --- /dev/null +++ b/artifacts/apidocs/schemas/vault_type.md @@ -0,0 +1,5 @@ +!!! info "[VaultType](/../../schemas/vault_type)" + |Value| Description | + |-|-| + |`PRIME` = 1|Prime vault| + |`LAUNCH_PAD` = 2|Launchpad vault| diff --git a/artifacts/apidocs/schemas/ws_cancel_feed_data_v1.md b/artifacts/apidocs/schemas/ws_cancel_feed_data_v1.md index 2924a18..4e84b87 100644 --- a/artifacts/apidocs/schemas/ws_cancel_feed_data_v1.md +++ b/artifacts/apidocs/schemas/ws_cancel_feed_data_v1.md @@ -48,6 +48,8 @@ |`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| ??? info "[CancelStatus](/../../schemas/cancel_status)" |Value| Description | |-|-| diff --git a/artifacts/apidocs/schemas/ws_fill_feed_data_v1.md b/artifacts/apidocs/schemas/ws_fill_feed_data_v1.md index d78ab8c..c2b42f1 100644 --- a/artifacts/apidocs/schemas/ws_fill_feed_data_v1.md +++ b/artifacts/apidocs/schemas/ws_fill_feed_data_v1.md @@ -28,6 +28,7 @@ |client_order_id
`co` |string|True|A unique identifier for the active order within a subaccount, specified by the client
This is used to identify the order in the client's system
This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer
This field will not be propagated to the smart contract, and should not be signed by the client
This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected
Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]
To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]

When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId| |signer
`s1` |string|True|The address (public key) of the wallet signing the payload| |broker
`b` |BrokerTag|False
``|Specifies the broker who brokered the order| + |is_rpi
`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
diff --git a/artifacts/apidocs/schemas/ws_order_feed_data_v1.md b/artifacts/apidocs/schemas/ws_order_feed_data_v1.md index de7f87a..2c5db71 100644 --- a/artifacts/apidocs/schemas/ws_order_feed_data_v1.md +++ b/artifacts/apidocs/schemas/ws_order_feed_data_v1.md @@ -33,6 +33,7 @@ |`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
`Lite`|Type|Required
`Default`| Description | |-|-|-|-| @@ -80,6 +81,7 @@ |-|-|-|-| |trigger_by
`tb` |TriggerBy|True|Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order| |trigger_price
`tp` |string|True|The Trigger Price of the order, expressed in `9` decimals.| + |close_position
`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.

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.


@@ -148,3 +150,5 @@ |`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| diff --git a/artifacts/apidocs/schemas/ws_order_state_feed_data_v1.md b/artifacts/apidocs/schemas/ws_order_state_feed_data_v1.md index e371c6c..aa4634a 100644 --- a/artifacts/apidocs/schemas/ws_order_state_feed_data_v1.md +++ b/artifacts/apidocs/schemas/ws_order_state_feed_data_v1.md @@ -62,3 +62,5 @@ |`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| diff --git a/artifacts/apidocs/schemas/ws_trade_feed_data_v1.md b/artifacts/apidocs/schemas/ws_trade_feed_data_v1.md index 8328e51..cb587b4 100644 --- a/artifacts/apidocs/schemas/ws_trade_feed_data_v1.md +++ b/artifacts/apidocs/schemas/ws_trade_feed_data_v1.md @@ -21,6 +21,7 @@ |forward_price
`fp` |string|True|[Options] The forward price of the option at point of trade, expressed in `9` decimals| |trade_id
`ti` |string|True|A trade identifier, globally unique, and monotonically increasing (not by `1`).
All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.
`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`.| |venue
`v` |Venue|True|The venue where the trade occurred| + |is_rpi
`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
diff --git a/artifacts/apidocs/schemas/ws_transfer_feed_data_v1.md b/artifacts/apidocs/schemas/ws_transfer_feed_data_v1.md index 0f2328b..21ee028 100644 --- a/artifacts/apidocs/schemas/ws_transfer_feed_data_v1.md +++ b/artifacts/apidocs/schemas/ws_transfer_feed_data_v1.md @@ -7,63 +7,3 @@ |selector
`s1` |string|True|Primary selector| |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.| |feed
`f` |TransferHistory|True|The transfer history matching the requested filters| - ??? info "[TransferHistory](/../../schemas/transfer_history)" - |Name
`Lite`|Type|Required
`Default`| Description | - |-|-|-|-| - |tx_id
`ti` |string|True|The transaction ID of the transfer| - |from_account_id
`fa` |string|True|The account to transfer from| - |from_sub_account_id
`fs` |string|True|The subaccount to transfer from (0 if transferring from main account)| - |to_account_id
`ta` |string|True|The account to deposit into| - |to_sub_account_id
`ts` |string|True|The subaccount to transfer to (0 if transferring to main account)| - |currency
`c` |Currency|True|The token currency to transfer| - |num_tokens
`nt` |string|True|The number of tokens to transfer| - |signature
`s` |Signature|True|The signature of the transfer| - |event_time
`et` |string|True|The timestamp of the transfer in unix nanoseconds| - |transfer_type
`tt` |TransferType|True|The type of transfer| - |transfer_metadata
`tm` |string|True|The metadata of the transfer| - ??? info "[Currency](/../../schemas/currency)" - The list of Currencies that are supported on the GRVT exchange
- - |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 "[Signature](/../../schemas/signature)" - |Name
`Lite`|Type|Required
`Default`| Description | - |-|-|-|-| - |signer
`s` |string|True|The address (public key) of the wallet signing the payload| - |r
`r` |string|True|Signature R| - |s
`s1` |string|True|Signature S| - |v
`v` |integer|True|Signature V| - |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days| - |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.| - ??? info "[TransferType](/../../schemas/transfer_type)" - |Value| Description | - |-|-| - |`STANDARD` = 1|Standard transfer that has nothing to do with bridging| - |`FAST_ARB_DEPOSIT` = 2|Fast Arb Deposit Metadata type| - |`FAST_ARB_WITHDRAWAL` = 3|Fast Arb Withdrawal Metadata type| diff --git a/artifacts/apidocs/trading_api.md b/artifacts/apidocs/trading_api.md index 5e804f0..5313b67 100644 --- a/artifacts/apidocs/trading_api.md +++ b/artifacts/apidocs/trading_api.md @@ -44,7 +44,8 @@ LITE ENDPOINT: lite/v1/create_order "trigger_type": "TAKE_PROFIT", "tpsl": { "trigger_by": "LAST", - "trigger_price": "65038.10" + "trigger_price": "65038.10", + "close_position": false } }, "broker": "BROKER_CODE" @@ -82,7 +83,8 @@ LITE ENDPOINT: lite/v1/create_order "tt": "TAKE_PROFIT", "t": { "tb": "LAST", - "tp": "65038.10" + "tp": "65038.10", + "cp": false } }, "b": "BROKER_CODE" @@ -128,7 +130,8 @@ LITE ENDPOINT: lite/v1/create_order "trigger_type": "TAKE_PROFIT", "tpsl": { "trigger_by": "LAST", - "trigger_price": "65038.10" + "trigger_price": "65038.10", + "close_position": false } }, "broker": "BROKER_CODE" @@ -175,7 +178,8 @@ LITE ENDPOINT: lite/v1/create_order "tt": "TAKE_PROFIT", "t": { "tb": "LAST", - "tp": "65038.10" + "tp": "65038.10", + "cp": false } }, "b": "BROKER_CODE" @@ -243,9 +247,15 @@ LITE ENDPOINT: lite/v1/create_order |2110|400|Invalid trigger by| |2111|400|Unsupported trigger by| |2112|400|Invalid trigger order| + |2113|400|Trigger price must be non-zero| + |2114|400|Invalid position linked TPSL orders, position linked TPSL must be a reduce-only order| + |2115|400|Invalid position linked TPSL orders, position linked TPSL must not have smaller size than the position| + |2116|400|Position linked TPSL order for this asset already exists| |3004|500|Instrument does not have a valid maintenance margin configuration| |3005|500|Instrument's underlying currency does not have a valid balance decimal configuration| |3006|500|Instrument's quote currency does not have a valid balance decimal configuration| + |2400|400|Reduce only order with no position| + |2401|400|Reduce only order must not increase position size|
!!! failure @@ -305,7 +315,8 @@ LITE ENDPOINT: lite/v1/create_order "trigger_type": "TAKE_PROFIT", "tpsl": { "trigger_by": "LAST", - "trigger_price": "65038.10" + "trigger_price": "65038.10", + "close_position": false } }, "broker": "BROKER_CODE" @@ -351,7 +362,8 @@ LITE ENDPOINT: lite/v1/create_order "trigger_type": "TAKE_PROFIT", "tpsl": { "trigger_by": "LAST", - "trigger_price": "65038.10" + "trigger_price": "65038.10", + "close_position": false } }, "broker": "BROKER_CODE" @@ -397,7 +409,8 @@ LITE ENDPOINT: lite/v1/create_order "tt": "TAKE_PROFIT", "t": { "tb": "LAST", - "tp": "65038.10" + "tp": "65038.10", + "cp": false } }, "b": "BROKER_CODE" @@ -443,7 +456,8 @@ LITE ENDPOINT: lite/v1/create_order "tt": "TAKE_PROFIT", "t": { "tb": "LAST", - "tp": "65038.10" + "tp": "65038.10", + "cp": false } }, "b": "BROKER_CODE" @@ -490,7 +504,8 @@ LITE ENDPOINT: lite/v1/create_order "trigger_type": "TAKE_PROFIT", "tpsl": { "trigger_by": "LAST", - "trigger_price": "65038.10" + "trigger_price": "65038.10", + "close_position": false } }, "broker": "BROKER_CODE" @@ -536,7 +551,8 @@ LITE ENDPOINT: lite/v1/create_order "trigger_type": "TAKE_PROFIT", "tpsl": { "trigger_by": "LAST", - "trigger_price": "65038.10" + "trigger_price": "65038.10", + "close_position": false } }, "broker": "BROKER_CODE" @@ -582,7 +598,8 @@ LITE ENDPOINT: lite/v1/create_order "tt": "TAKE_PROFIT", "t": { "tb": "LAST", - "tp": "65038.10" + "tp": "65038.10", + "cp": false } }, "b": "BROKER_CODE" @@ -628,7 +645,8 @@ LITE ENDPOINT: lite/v1/create_order "tt": "TAKE_PROFIT", "t": { "tb": "LAST", - "tp": "65038.10" + "tp": "65038.10", + "cp": false } }, "b": "BROKER_CODE" @@ -675,7 +693,8 @@ LITE ENDPOINT: lite/v1/create_order "trigger_type": "TAKE_PROFIT", "tpsl": { "trigger_by": "LAST", - "trigger_price": "65038.10" + "trigger_price": "65038.10", + "close_position": false } }, "broker": "BROKER_CODE" @@ -721,7 +740,8 @@ LITE ENDPOINT: lite/v1/create_order "trigger_type": "TAKE_PROFIT", "tpsl": { "trigger_by": "LAST", - "trigger_price": "65038.10" + "trigger_price": "65038.10", + "close_position": false } }, "broker": "BROKER_CODE" @@ -767,7 +787,8 @@ LITE ENDPOINT: lite/v1/create_order "tt": "TAKE_PROFIT", "t": { "tb": "LAST", - "tp": "65038.10" + "tp": "65038.10", + "cp": false } }, "b": "BROKER_CODE" @@ -813,7 +834,8 @@ LITE ENDPOINT: lite/v1/create_order "tt": "TAKE_PROFIT", "t": { "tb": "LAST", - "tp": "65038.10" + "tp": "65038.10", + "cp": false } }, "b": "BROKER_CODE" @@ -860,7 +882,8 @@ LITE ENDPOINT: lite/v1/create_order "trigger_type": "TAKE_PROFIT", "tpsl": { "trigger_by": "LAST", - "trigger_price": "65038.10" + "trigger_price": "65038.10", + "close_position": false } }, "broker": "BROKER_CODE" @@ -906,7 +929,8 @@ LITE ENDPOINT: lite/v1/create_order "trigger_type": "TAKE_PROFIT", "tpsl": { "trigger_by": "LAST", - "trigger_price": "65038.10" + "trigger_price": "65038.10", + "close_position": false } }, "broker": "BROKER_CODE" @@ -952,7 +976,8 @@ LITE ENDPOINT: lite/v1/create_order "tt": "TAKE_PROFIT", "t": { "tb": "LAST", - "tp": "65038.10" + "tp": "65038.10", + "cp": false } }, "b": "BROKER_CODE" @@ -998,7 +1023,8 @@ LITE ENDPOINT: lite/v1/create_order "tt": "TAKE_PROFIT", "t": { "tb": "LAST", - "tp": "65038.10" + "tp": "65038.10", + "cp": false } }, "b": "BROKER_CODE" @@ -1812,7 +1838,8 @@ LITE ENDPOINT: lite/v1/order "trigger_type": "TAKE_PROFIT", "tpsl": { "trigger_by": "LAST", - "trigger_price": "65038.10" + "trigger_price": "65038.10", + "close_position": false } }, "broker": "BROKER_CODE" @@ -1859,7 +1886,8 @@ LITE ENDPOINT: lite/v1/order "tt": "TAKE_PROFIT", "t": { "tb": "LAST", - "tp": "65038.10" + "tp": "65038.10", + "cp": false } }, "b": "BROKER_CODE" @@ -2242,7 +2270,8 @@ LITE ENDPOINT: lite/v1/open_orders "trigger_type": "TAKE_PROFIT", "tpsl": { "trigger_by": "LAST", - "trigger_price": "65038.10" + "trigger_price": "65038.10", + "close_position": false } }, "broker": "BROKER_CODE" @@ -2289,7 +2318,8 @@ LITE ENDPOINT: lite/v1/open_orders "tt": "TAKE_PROFIT", "t": { "tb": "LAST", - "tp": "65038.10" + "tp": "65038.10", + "cp": false } }, "b": "BROKER_CODE" @@ -2694,7 +2724,8 @@ LITE ENDPOINT: lite/v1/order_history "trigger_type": "TAKE_PROFIT", "tpsl": { "trigger_by": "LAST", - "trigger_price": "65038.10" + "trigger_price": "65038.10", + "close_position": false } }, "broker": "BROKER_CODE" @@ -2742,7 +2773,8 @@ LITE ENDPOINT: lite/v1/order_history "tt": "TAKE_PROFIT", "t": { "tb": "LAST", - "tp": "65038.10" + "tp": "65038.10", + "cp": false } }, "b": "BROKER_CODE" @@ -3136,3406 +3168,15 @@ LITE ENDPOINT: lite/v1/order_history ```

-### Pre Order Check -``` -FULL ENDPOINT: full/v1/pre_order_check -LITE ENDPOINT: lite/v1/pre_order_check -``` - -=== "Request" -
- -8<- "docs/schemas/api_pre_order_check_request.md" -
-
- !!! question "Query" - **Full Request** - ``` { .json .copy } - { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - } - ``` - **Lite Request** - ``` { .json .copy } - { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - } - ``` -
-=== "Response" -
- -8<- "docs/schemas/api_pre_order_check_response.md" -
-
- !!! success - **Full Response** - ``` { .json .copy } - { - "results": [{ - "max_qty": [{ - "asset": null, - "max_buy_qty": 100.0, - "max_sell_qty": 100.0 - }], - "margin_required": 1000.0, - "order_valid": true, - "reason": "", - "settle_currency": "USDT" - }] - } - ``` - **Lite Response** - ``` { .json .copy } - { - "r": [{ - "mq": [{ - "a": null, - "mb": 100.0, - "ms": 100.0 - }], - "mr": 1000.0, - "ov": true, - "r": "", - "sc": "USDT" - }] - } - ``` -
-=== "Errors" -
- !!! info "Error Codes" - |Code|HttpStatus| Description | - |-|-|-| - |1000|401|You need to authenticate prior to using this functionality| - |1001|403|You are not authorized to access this functionality| - |1002|500|Internal Server Error| - |1003|400|Request could not be processed due to malformed syntax| - |1006|429|You have surpassed the allocated rate limit for your tier| - |1008|401|Your IP has not been whitelisted for access| - |3004|500|Instrument does not have a valid maintenance margin configuration| - |3005|500|Instrument's underlying currency does not have a valid balance decimal configuration| - |3006|500|Instrument's quote currency does not have a valid balance decimal configuration| -
-
- !!! failure - **Full Error Response** - ``` { .json .copy } - { - "request_id":1, - "code":1000, - "message":"You need to authenticate prior to using this functionality", - "status":401 - } - ``` - **Lite Error Response** - ``` { .json .copy } - { - "ri":1, - "c":1000, - "m":"You need to authenticate prior to using this functionality", - "s":401 - } - ``` -
-=== "Try it out" - -8<- "sections/auth_closed.md" - === "DEV" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/pre_order_check' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/pre_order_check", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/pre_order_check' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/pre_order_check", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - }, - "i": 123 - } - ' -w 360 - ``` -
- === "STAGING" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/pre_order_check' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/pre_order_check", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/pre_order_check' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/pre_order_check", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - }, - "i": 123 - } - ' -w 360 - ``` -
- === "TESTNET" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/pre_order_check' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/pre_order_check", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/pre_order_check' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/pre_order_check", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - }, - "i": 123 - } - ' -w 360 - ``` -
- === "PROD" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/pre_order_check' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/pre_order_check", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/pre_order_check' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/pre_order_check", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - }, - "i": 123 - } - ' -w 360 - ``` -
-
-### Cancel On Disconnect -``` -FULL ENDPOINT: full/v1/cancel_on_disconnect -LITE ENDPOINT: lite/v1/cancel_on_disconnect -``` - -=== "Request" -
- -8<- "docs/schemas/api_cancel_on_disconnect_request.md" -
-
- !!! question "Query" - **Full Request** - ``` { .json .copy } - { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "countdown_time": 300 - } - ``` - **Lite Request** - ``` { .json .copy } - { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "ct": 300 - } - ``` -
-=== "Response" -
- -8<- "docs/schemas/ack_response.md" -
-
- !!! success - **Full Response** - ``` { .json .copy } - { - "result": { - "ack": "true" - } - } - ``` - **Lite Response** - ``` { .json .copy } - { - "r": { - "a": "true" - } - } - ``` -
-=== "Errors" -
- !!! info "Error Codes" - |Code|HttpStatus| Description | - |-|-|-| - |1000|401|You need to authenticate prior to using this functionality| - |1001|403|You are not authorized to access this functionality| - |1002|500|Internal Server Error| - |1003|400|Request could not be processed due to malformed syntax| - |1006|429|You have surpassed the allocated rate limit for your tier| - |1008|401|Your IP has not been whitelisted for access| - |6000|400|Countdown time is bigger than 300s supported| -
-
- !!! failure - **Full Error Response** - ``` { .json .copy } - { - "request_id":1, - "code":1000, - "message":"You need to authenticate prior to using this functionality", - "status":401 - } - ``` - **Lite Error Response** - ``` { .json .copy } - { - "ri":1, - "c":1000, - "m":"You need to authenticate prior to using this functionality", - "s":401 - } - ``` -
-=== "Try it out" - -8<- "sections/auth_closed.md" - === "DEV" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/cancel_on_disconnect' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "countdown_time": 300 - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/cancel_on_disconnect", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "countdown_time": 300 - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/cancel_on_disconnect' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "ct": 300 - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/cancel_on_disconnect", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "ct": 300 - }, - "i": 123 - } - ' -w 360 - ``` -
- === "STAGING" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/cancel_on_disconnect' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "countdown_time": 300 - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/cancel_on_disconnect", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "countdown_time": 300 - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/cancel_on_disconnect' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "ct": 300 - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/cancel_on_disconnect", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "ct": 300 - }, - "i": 123 - } - ' -w 360 - ``` -
- === "TESTNET" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/cancel_on_disconnect' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "countdown_time": 300 - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/cancel_on_disconnect", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "countdown_time": 300 - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/cancel_on_disconnect' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "ct": 300 - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/cancel_on_disconnect", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "ct": 300 - }, - "i": 123 - } - ' -w 360 - ``` -
- === "PROD" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/cancel_on_disconnect' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "countdown_time": 300 - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/cancel_on_disconnect", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "countdown_time": 300 - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/cancel_on_disconnect' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "ct": 300 - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/cancel_on_disconnect", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "ct": 300 - }, - "i": 123 - } - ' -w 360 - ``` -
-
-### Create Bulk Orders -``` -FULL ENDPOINT: full/v1/create_bulk_orders -LITE ENDPOINT: lite/v1/create_bulk_orders -``` - -=== "Request" -
- -8<- "docs/schemas/api_create_bulk_orders_request.md" -
-
- !!! question "Query" - **Full Request** - ``` { .json .copy } - { - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - } - ``` - **Lite Request** - ``` { .json .copy } - { - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - } - ``` -
-=== "Response" -
- -8<- "docs/schemas/api_create_bulk_orders_response.md" -
-
- !!! success - **Full Response** - ``` { .json .copy } - { - "result": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - } - ``` - **Lite Response** - ``` { .json .copy } - { - "r": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - } - ``` -
-=== "Errors" -
- !!! info "Error Codes" - |Code|HttpStatus| Description | - |-|-|-| - |1000|401|You need to authenticate prior to using this functionality| - |1001|403|You are not authorized to access this functionality| - |1002|500|Internal Server Error| - |1003|400|Request could not be processed due to malformed syntax| - |1004|404|Data Not Found| - |1005|500|Unknown Error| - |1006|429|You have surpassed the allocated rate limit for your tier| - |1008|401|Your IP has not been whitelisted for access| - |1400|403|Signer does not have trade permission| - |1009|503|We are temporarily deactivating this API endpoint, please try again later| - |2000|403|Order signature is from an unauthorized signer| - |2001|403|Order signature has expired| - |2002|403|Order signature does not match payload| - |2003|403|Order sub account does not match logged in user| - |2004|403|Order signature is from an expired session key| - |2006|403|Order signature R/S must have exactly 64 characters long without 0x prefix| - |2005|403|Order signature V must be 27/28| - |2007|403|Order signature S must be in the lower half of the curve| - |2010|400|Order ID should be empty when creating an order| - |2011|400|Client Order ID should be supplied when creating an order| - |2012|400|Client Order ID overlaps with existing active order| - |2030|400|Orderbook Orders must have a TimeInForce of GTT/IOC/FOK| - |2031|400|RFQ Orders must have a TimeInForce of GTT/AON/IOC/FOK| - |2032|400|Post Only can only be set to true for GTT/AON orders| - |2020|400|Market Order must always be supplied without a limit price| - |2021|400|Limit Order must always be supplied with a limit price| - |2040|400|Order must contain at least one leg| - |2041|400|Order Legs must be sorted by Derivative.Instrument/Underlying/BaseCurrency/Expiration/StrikePrice| - |2042|400|Orderbook Orders must contain only one leg| - |2050|400|Order state must be empty upon creation| - |2051|400|Order execution metadata must be empty upon creation| - |2060|400|Order Legs contain one or more inactive derivative| - |2061|400|Unsupported Instrument Requested| - |2062|400|Order size smaller than min size| - |2063|400|Order size smaller than min block size in block trade venue| - |2064|400|Invalid limit price tick| - |2065|400|Order size too granular| - |2070|400|Liquidation Order is not supported| - |2080|400|Insufficient margin to create order| - |2081|400|Order Fill would result in exceeding maximum position size| - |2082|400|Pre-order check failed| - |2083|400|Order Fill would result in exceeding maximum position size under current configurable leverage tier| - |2090|429|Max open orders exceeded| - |2110|400|Invalid trigger by| - |2111|400|Unsupported trigger by| - |2112|400|Invalid trigger order| - |3004|500|Instrument does not have a valid maintenance margin configuration| - |3005|500|Instrument's underlying currency does not have a valid balance decimal configuration| - |3006|500|Instrument's quote currency does not have a valid balance decimal configuration| - |2220|400|No orders provided| - |2221|400|Invalid number of orders| - |2222|400|Order is not a TPSL order| - |2223|400|Unsupported bulk order type| -
-
- !!! failure - **Full Error Response** - ``` { .json .copy } - { - "request_id":1, - "code":1000, - "message":"You need to authenticate prior to using this functionality", - "status":401 - } - ``` - **Lite Error Response** - ``` { .json .copy } - { - "ri":1, - "c":1000, - "m":"You need to authenticate prior to using this functionality", - "s":401 - } - ``` -
-=== "Try it out" - -8<- "sections/auth_closed.md" - === "DEV" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/create_bulk_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/create_bulk_orders", - "params": { - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/create_bulk_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/create_bulk_orders", - "p": { - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - }, - "i": 123 - } - ' -w 360 - ``` -
- === "STAGING" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/create_bulk_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/create_bulk_orders", - "params": { - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/create_bulk_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/create_bulk_orders", - "p": { - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - }, - "i": 123 - } - ' -w 360 - ``` -
- === "TESTNET" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/create_bulk_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/create_bulk_orders", - "params": { - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/create_bulk_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/create_bulk_orders", - "p": { - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - }, - "i": 123 - } - ' -w 360 - ``` -
- === "PROD" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/create_bulk_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/create_bulk_orders", - "params": { - "orders": [{ - "order_id": "0x1234567890abcdef", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "is_market": false, - "time_in_force": "GOOD_TILL_TIME", - "post_only": false, - "reduce_only": false, - "legs": [{ - "instrument": "BTC_USDT_Perp", - "size": "10.5", - "limit_price": "65038.01", - "is_buying_asset": true - }], - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "metadata": { - "client_order_id": "23042", - "create_time": "1697788800000000000", - "trigger": { - "trigger_type": "TAKE_PROFIT", - "tpsl": { - "trigger_by": "LAST", - "trigger_price": "65038.10" - } - }, - "broker": "BROKER_CODE" - }, - "state": { - "status": "PENDING", - "reject_reason": "CLIENT_CANCEL", - "book_size": ["10.5"], - "traded_size": ["1.5"], - "update_time": "1697788800000000000", - "avg_fill_price": ["60000.4"] - } - }] - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/create_bulk_orders' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/create_bulk_orders", - "p": { - "o": [{ - "oi": "0x1234567890abcdef", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "im": false, - "ti": "GOOD_TILL_TIME", - "po": false, - "ro": false, - "l": [{ - "i": "BTC_USDT_Perp", - "s": "10.5", - "lp": "65038.01", - "ib": true - }], - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "m": { - "co": "23042", - "ct": "1697788800000000000", - "t": { - "tt": "TAKE_PROFIT", - "t": { - "tb": "LAST", - "tp": "65038.10" - } - }, - "b": "BROKER_CODE" - }, - "s1": { - "s": "PENDING", - "rr": "CLIENT_CANCEL", - "bs": ["10.5"], - "ts": ["1.5"], - "ut": "1697788800000000000", - "af": ["60000.4"] - } - }] - }, - "i": 123 - } - ' -w 360 - ``` -
-
-### Get Order Group -``` -FULL ENDPOINT: full/v1/order_group -LITE ENDPOINT: lite/v1/order_group -``` - -=== "Request" -
- -8<- "docs/schemas/api_get_order_group_request.md" -
-
- !!! question "Query" - **Full Request** - ``` { .json .copy } - { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" - } - ``` - **Lite Request** - ``` { .json .copy } - { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" - } - ``` -
-=== "Response" -
- -8<- "docs/schemas/api_get_order_group_response.md" -
-
- !!! success - **Full Response** - ``` { .json .copy } - { - "result": [{ - "group_id": "0x10000101000203040506", - "client_order_id": ["[23042, 54232]"], - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" - }] - } - ``` - **Lite Response** - ``` { .json .copy } - { - "r": [{ - "gi": "0x10000101000203040506", - "co": ["[23042, 54232]"], - "sa": "'$GRVT_SUB_ACCOUNT_ID'" - }] - } - ``` -
-=== "Errors" -
- !!! info "Error Codes" - |Code|HttpStatus| Description | - |-|-|-| - |1000|401|You need to authenticate prior to using this functionality| - |1001|403|You are not authorized to access this functionality| - |1002|500|Internal Server Error| - |1003|400|Request could not be processed due to malformed syntax| - |1006|429|You have surpassed the allocated rate limit for your tier| - |1008|401|Your IP has not been whitelisted for access| - |1004|404|Data Not Found| - |3020|400|Sub account ID must be an uint64 integer| - |3021|400|Either order ID or client order ID must be supplied| -
-
- !!! failure - **Full Error Response** - ``` { .json .copy } - { - "request_id":1, - "code":1000, - "message":"You need to authenticate prior to using this functionality", - "status":401 - } - ``` - **Lite Error Response** - ``` { .json .copy } - { - "ri":1, - "c":1000, - "m":"You need to authenticate prior to using this functionality", - "s":401 - } - ``` -
-=== "Try it out" - -8<- "sections/auth_closed.md" - === "DEV" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/order_group' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/order_group", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/order_group' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/order_group", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" - }, - "i": 123 - } - ' -w 360 - ``` -
- === "STAGING" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/order_group' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/order_group", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/order_group' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/order_group", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" - }, - "i": 123 - } - ' -w 360 - ``` -
- === "TESTNET" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/order_group' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/order_group", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/order_group' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/order_group", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" - }, - "i": 123 - } - ' -w 360 - ``` -
- === "PROD" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/order_group' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/order_group", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/order_group' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/order_group", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" - }, - "i": 123 - } - ' -w 360 - ``` -
-
-## Execution -### Fill History -``` -FULL ENDPOINT: full/v1/fill_history -LITE ENDPOINT: lite/v1/fill_history -``` - -=== "Request" -
- -8<- "docs/schemas/api_fill_history_request.md" -
-
- !!! question "Query" - **Full Request** - ``` { .json .copy } - { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" - } - ``` - **Lite Request** - ``` { .json .copy } - { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" - } - ``` -
-=== "Response" -
- -8<- "docs/schemas/api_fill_history_response.md" -
-
- !!! success - **Full Response** - ``` { .json .copy } - { - "result": [{ - "event_time": "1697788800000000000", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "is_buyer": true, - "is_taker": true, - "size": "0.30", - "price": "65038.01", - "mark_price": "65038.01", - "index_price": "65038.01", - "interest_rate": 0.0003, - "forward_price": "65038.01", - "realized_pnl": "2400.50", - "fee": "9.75", - "fee_rate": 0.0003, - "trade_id": "209358-2", - "order_id": "0x10000101000203040506", - "venue": "ORDERBOOK", - "client_order_id": "23042", - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "broker": "UNSPECIFIED" - }], - "next": "Qw0918=" - } - ``` - **Lite Response** - ``` { .json .copy } - { - "r": [{ - "et": "1697788800000000000", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "ib": true, - "it": true, - "s": "0.30", - "p": "65038.01", - "mp": "65038.01", - "ip": "65038.01", - "ir": 0.0003, - "fp": "65038.01", - "rp": "2400.50", - "f": "9.75", - "fr": 0.0003, - "ti": "209358-2", - "oi": "0x10000101000203040506", - "v": "ORDERBOOK", - "co": "23042", - "s1": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "b": "UNSPECIFIED" - }], - "n": "Qw0918=" - } - ``` -
-=== "Errors" -
- !!! info "Error Codes" - |Code|HttpStatus| Description | - |-|-|-| - |1000|401|You need to authenticate prior to using this functionality| - |1001|403|You are not authorized to access this functionality| - |1002|500|Internal Server Error| - |1003|400|Request could not be processed due to malformed syntax| - |1006|429|You have surpassed the allocated rate limit for your tier| - |1008|401|Your IP has not been whitelisted for access| -
-
- !!! failure - **Full Error Response** - ``` { .json .copy } - { - "request_id":1, - "code":1000, - "message":"You need to authenticate prior to using this functionality", - "status":401 - } - ``` - **Lite Error Response** - ``` { .json .copy } - { - "ri":1, - "c":1000, - "m":"You need to authenticate prior to using this functionality", - "s":401 - } - ``` -
-=== "Try it out" - -8<- "sections/auth_closed.md" - === "DEV" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/fill_history' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/fill_history", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/fill_history' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/fill_history", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" - }, - "i": 123 - } - ' -w 360 - ``` -
- === "STAGING" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/fill_history' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/fill_history", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/fill_history' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/fill_history", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" - }, - "i": 123 - } - ' -w 360 - ``` -
- === "TESTNET" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/fill_history' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/fill_history", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/fill_history' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/fill_history", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" - }, - "i": 123 - } - ' -w 360 - ``` -
- === "PROD" -
- !!! example "REST Full" - ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/fill_history' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" - } - ' - ``` - !!! example "JSONRPC Full" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/fill_history", - "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" - }, - "id": 123 - } - ' -w 360 - ``` -
-
- !!! example "REST Lite" - ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/fill_history' \ - --header "Cookie: $GRVT_COOKIE" \ - --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" - } - ' - ``` - !!! example "JSONRPC Lite" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "v1/fill_history", - "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" - }, - "i": 123 - } - ' -w 360 - ``` -
-
-### Positions +### Cancel On Disconnect ``` -FULL ENDPOINT: full/v1/positions -LITE ENDPOINT: lite/v1/positions +FULL ENDPOINT: full/v1/cancel_on_disconnect +LITE ENDPOINT: lite/v1/cancel_on_disconnect ``` === "Request"
- -8<- "docs/schemas/api_positions_request.md" + -8<- "docs/schemas/api_cancel_on_disconnect_request.md"
!!! question "Query" @@ -6543,69 +3184,37 @@ LITE ENDPOINT: lite/v1/positions ``` { .json .copy } { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] + "countdown_time": 300 } ``` **Lite Request** ``` { .json .copy } { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] + "ct": 300 } ```
=== "Response"
- -8<- "docs/schemas/api_positions_response.md" + -8<- "docs/schemas/ack_response.md"
!!! success **Full Response** ``` { .json .copy } - { - "result": [{ - "event_time": "1697788800000000000", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "size": "2635000.50", - "notional": "2635000.50", - "entry_price": "65038.01", - "exit_price": "65038.01", - "mark_price": "65038.01", - "unrealized_pnl": "135000.50", - "realized_pnl": "-35000.30", - "total_pnl": "100000.20", - "roi": "10.20", - "quote_index_price": "1.0000102", - "est_liquidation_price": 60000.25, - "leverage": "10" - }] - } - ``` - **Lite Response** - ``` { .json .copy } - { - "r": [{ - "et": "1697788800000000000", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "s": "2635000.50", - "n": "2635000.50", - "ep": "65038.01", - "ep1": "65038.01", - "mp": "65038.01", - "up": "135000.50", - "rp": "-35000.30", - "tp": "100000.20", - "r": "10.20", - "qi": "1.0000102", - "el": 60000.25, - "l": "10" - }] + { + "result": { + "ack": "true" + } + } + ``` + **Lite Response** + ``` { .json .copy } + { + "r": { + "a": "true" + } } ```
@@ -6620,6 +3229,7 @@ LITE ENDPOINT: lite/v1/positions |1003|400|Request could not be processed due to malformed syntax| |1006|429|You have surpassed the allocated rate limit for your tier| |1008|401|Your IP has not been whitelisted for access| + |6000|400|Countdown time is bigger than 300s supported|
!!! failure @@ -6648,14 +3258,12 @@ LITE ENDPOINT: lite/v1/positions
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/positions' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/cancel_on_disconnect' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] + "countdown_time": 300 } ' ``` @@ -6667,12 +3275,10 @@ LITE ENDPOINT: lite/v1/positions -x ' { "jsonrpc": "2.0", - "method": "v1/positions", + "method": "v1/cancel_on_disconnect", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] + "countdown_time": 300 }, "id": 123 } @@ -6682,14 +3288,12 @@ LITE ENDPOINT: lite/v1/positions
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/positions' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/cancel_on_disconnect' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] + "ct": 300 } ' ``` @@ -6701,12 +3305,10 @@ LITE ENDPOINT: lite/v1/positions -x ' { "j": "2.0", - "m": "v1/positions", + "m": "v1/cancel_on_disconnect", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] + "ct": 300 }, "i": 123 } @@ -6717,14 +3319,12 @@ LITE ENDPOINT: lite/v1/positions
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/positions' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/cancel_on_disconnect' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] + "countdown_time": 300 } ' ``` @@ -6736,12 +3336,10 @@ LITE ENDPOINT: lite/v1/positions -x ' { "jsonrpc": "2.0", - "method": "v1/positions", + "method": "v1/cancel_on_disconnect", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] + "countdown_time": 300 }, "id": 123 } @@ -6751,14 +3349,12 @@ LITE ENDPOINT: lite/v1/positions
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/positions' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/cancel_on_disconnect' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] + "ct": 300 } ' ``` @@ -6770,12 +3366,10 @@ LITE ENDPOINT: lite/v1/positions -x ' { "j": "2.0", - "m": "v1/positions", + "m": "v1/cancel_on_disconnect", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] + "ct": 300 }, "i": 123 } @@ -6786,14 +3380,12 @@ LITE ENDPOINT: lite/v1/positions
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/positions' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/cancel_on_disconnect' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] + "countdown_time": 300 } ' ``` @@ -6805,12 +3397,10 @@ LITE ENDPOINT: lite/v1/positions -x ' { "jsonrpc": "2.0", - "method": "v1/positions", + "method": "v1/cancel_on_disconnect", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] + "countdown_time": 300 }, "id": 123 } @@ -6820,14 +3410,12 @@ LITE ENDPOINT: lite/v1/positions
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/positions' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/cancel_on_disconnect' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] + "ct": 300 } ' ``` @@ -6839,12 +3427,10 @@ LITE ENDPOINT: lite/v1/positions -x ' { "j": "2.0", - "m": "v1/positions", + "m": "v1/cancel_on_disconnect", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] + "ct": 300 }, "i": 123 } @@ -6855,14 +3441,12 @@ LITE ENDPOINT: lite/v1/positions
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/positions' \ + curl --location 'https://trades.grvt.io/full/v1/cancel_on_disconnect' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] + "countdown_time": 300 } ' ``` @@ -6874,12 +3458,10 @@ LITE ENDPOINT: lite/v1/positions -x ' { "jsonrpc": "2.0", - "method": "v1/positions", + "method": "v1/cancel_on_disconnect", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "kind": ["PERPETUAL"], - "base": ["BTC", "ETH"], - "quote": ["USDT", "USDC"] + "countdown_time": 300 }, "id": 123 } @@ -6889,14 +3471,12 @@ LITE ENDPOINT: lite/v1/positions
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/positions' \ + curl --location 'https://trades.grvt.io/lite/v1/cancel_on_disconnect' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] + "ct": 300 } ' ``` @@ -6908,12 +3488,10 @@ LITE ENDPOINT: lite/v1/positions -x ' { "j": "2.0", - "m": "v1/positions", + "m": "v1/cancel_on_disconnect", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "k": ["PERPETUAL"], - "b": ["BTC", "ETH"], - "q": ["USDT", "USDC"] + "ct": 300 }, "i": 123 } @@ -6921,15 +3499,16 @@ LITE ENDPOINT: lite/v1/positions ```

-### Funding Payment History +## Execution +### Fill History ``` -FULL ENDPOINT: full/v1/funding_payment_history -LITE ENDPOINT: lite/v1/funding_payment_history +FULL ENDPOINT: full/v1/fill_history +LITE ENDPOINT: lite/v1/fill_history ``` === "Request"
- -8<- "docs/schemas/api_funding_payment_history_request.md" + -8<- "docs/schemas/api_fill_history_request.md"
!!! question "Query" @@ -6937,7 +3516,9 @@ LITE ENDPOINT: lite/v1/funding_payment_history ``` { .json .copy } { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, @@ -6948,7 +3529,9 @@ LITE ENDPOINT: lite/v1/funding_payment_history ``` { .json .copy } { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, @@ -6958,7 +3541,7 @@ LITE ENDPOINT: lite/v1/funding_payment_history
=== "Response"
- -8<- "docs/schemas/api_funding_payment_history_response.md" + -8<- "docs/schemas/api_fill_history_response.md"
!!! success @@ -6969,9 +3552,24 @@ LITE ENDPOINT: lite/v1/funding_payment_history "event_time": "1697788800000000000", "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "instrument": "BTC_USDT_Perp", - "currency": "USDT", - "amount": "9.75", - "tx_id": "209358" + "is_buyer": true, + "is_taker": true, + "size": "0.30", + "price": "65038.01", + "mark_price": "65038.01", + "index_price": "65038.01", + "interest_rate": 0.0003, + "forward_price": "65038.01", + "realized_pnl": "2400.50", + "fee": "9.75", + "fee_rate": 0.0003, + "trade_id": "209358-2", + "order_id": "0x10000101000203040506", + "venue": "ORDERBOOK", + "client_order_id": "23042", + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "broker": "UNSPECIFIED", + "is_rpi": false }], "next": "Qw0918=" } @@ -6983,9 +3581,24 @@ LITE ENDPOINT: lite/v1/funding_payment_history "et": "1697788800000000000", "sa": "'$GRVT_SUB_ACCOUNT_ID'", "i": "BTC_USDT_Perp", - "c": "USDT", - "a": "9.75", - "ti": "209358" + "ib": true, + "it": true, + "s": "0.30", + "p": "65038.01", + "mp": "65038.01", + "ip": "65038.01", + "ir": 0.0003, + "fp": "65038.01", + "rp": "2400.50", + "f": "9.75", + "fr": 0.0003, + "ti": "209358-2", + "oi": "0x10000101000203040506", + "v": "ORDERBOOK", + "co": "23042", + "s1": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "b": "UNSPECIFIED", + "ir1": false }], "n": "Qw0918=" } @@ -7030,12 +3643,14 @@ LITE ENDPOINT: lite/v1/funding_payment_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/funding_payment_history' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, @@ -7051,10 +3666,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "jsonrpc": "2.0", - "method": "v1/funding_payment_history", + "method": "v1/fill_history", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, @@ -7068,12 +3685,14 @@ LITE ENDPOINT: lite/v1/funding_payment_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/funding_payment_history' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, @@ -7089,10 +3708,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "j": "2.0", - "m": "v1/funding_payment_history", + "m": "v1/fill_history", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, @@ -7107,12 +3728,14 @@ LITE ENDPOINT: lite/v1/funding_payment_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/funding_payment_history' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, @@ -7128,10 +3751,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "jsonrpc": "2.0", - "method": "v1/funding_payment_history", + "method": "v1/fill_history", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, @@ -7145,12 +3770,14 @@ LITE ENDPOINT: lite/v1/funding_payment_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/funding_payment_history' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, @@ -7166,10 +3793,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "j": "2.0", - "m": "v1/funding_payment_history", + "m": "v1/fill_history", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, @@ -7184,12 +3813,14 @@ LITE ENDPOINT: lite/v1/funding_payment_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/funding_payment_history' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, @@ -7205,10 +3836,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "jsonrpc": "2.0", - "method": "v1/funding_payment_history", + "method": "v1/fill_history", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, @@ -7222,12 +3855,14 @@ LITE ENDPOINT: lite/v1/funding_payment_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/funding_payment_history' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, @@ -7243,10 +3878,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "j": "2.0", - "m": "v1/funding_payment_history", + "m": "v1/fill_history", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, @@ -7261,12 +3898,14 @@ LITE ENDPOINT: lite/v1/funding_payment_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/funding_payment_history' \ + curl --location 'https://trades.grvt.io/full/v1/fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, @@ -7282,10 +3921,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "jsonrpc": "2.0", - "method": "v1/funding_payment_history", + "method": "v1/fill_history", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, @@ -7299,12 +3940,14 @@ LITE ENDPOINT: lite/v1/funding_payment_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/funding_payment_history' \ + curl --location 'https://trades.grvt.io/lite/v1/fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, @@ -7320,10 +3963,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "j": "2.0", - "m": "v1/funding_payment_history", + "m": "v1/fill_history", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, @@ -7335,45 +3980,40 @@ LITE ENDPOINT: lite/v1/funding_payment_history ```

-## Transfer -### Deposit History +### Positions ``` -FULL ENDPOINT: full/v1/deposit_history -LITE ENDPOINT: lite/v1/deposit_history +FULL ENDPOINT: full/v1/positions +LITE ENDPOINT: lite/v1/positions ``` === "Request"
- -8<- "docs/schemas/api_deposit_history_request.md" + -8<- "docs/schemas/api_positions_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] } ``` **Lite Request** ``` { .json .copy } { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] } ```
=== "Response"
- -8<- "docs/schemas/api_deposit_history_response.md" + -8<- "docs/schemas/api_positions_response.md"
!!! success @@ -7381,32 +4021,44 @@ LITE ENDPOINT: lite/v1/deposit_history ``` { .json .copy } { "result": [{ - "l_1_hash": "0x10000101000203040506", - "l_2_hash": "0x10000101000203040506", - "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "currency": "USDT", - "num_tokens": "1500.0", - "initiated_time": "1697788800000000000", - "confirmed_time": "1697788800000000000", - "from_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0" - }], - "next": "Qw0918=" + "event_time": "1697788800000000000", + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "size": "2635000.50", + "notional": "2635000.50", + "entry_price": "65038.01", + "exit_price": "65038.01", + "mark_price": "65038.01", + "unrealized_pnl": "135000.50", + "realized_pnl": "-35000.30", + "total_pnl": "100000.20", + "roi": "10.20", + "quote_index_price": "1.0000102", + "est_liquidation_price": 60000.25, + "leverage": "10" + }] } ``` **Lite Response** ``` { .json .copy } { "r": [{ - "l1": "0x10000101000203040506", - "l2": "0x10000101000203040506", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "c": "USDT", - "nt": "1500.0", - "it": "1697788800000000000", - "ct": "1697788800000000000", - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0" - }], - "n": "Qw0918=" + "et": "1697788800000000000", + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "s": "2635000.50", + "n": "2635000.50", + "ep": "65038.01", + "ep1": "65038.01", + "mp": "65038.01", + "up": "135000.50", + "rp": "-35000.30", + "tp": "100000.20", + "r": "10.20", + "qi": "1.0000102", + "el": 60000.25, + "l": "10" + }] } ```
@@ -7449,16 +4101,14 @@ LITE ENDPOINT: lite/v1/deposit_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/deposit_history' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] } ' ``` @@ -7470,14 +4120,12 @@ LITE ENDPOINT: lite/v1/deposit_history -x ' { "jsonrpc": "2.0", - "method": "v1/deposit_history", + "method": "v1/positions", "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] }, "id": 123 } @@ -7487,16 +4135,14 @@ LITE ENDPOINT: lite/v1/deposit_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/deposit_history' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] } ' ``` @@ -7508,14 +4154,12 @@ LITE ENDPOINT: lite/v1/deposit_history -x ' { "j": "2.0", - "m": "v1/deposit_history", + "m": "v1/positions", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] }, "i": 123 } @@ -7526,16 +4170,14 @@ LITE ENDPOINT: lite/v1/deposit_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/deposit_history' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] } ' ``` @@ -7547,14 +4189,12 @@ LITE ENDPOINT: lite/v1/deposit_history -x ' { "jsonrpc": "2.0", - "method": "v1/deposit_history", + "method": "v1/positions", "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] }, "id": 123 } @@ -7564,16 +4204,14 @@ LITE ENDPOINT: lite/v1/deposit_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/deposit_history' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] } ' ``` @@ -7585,14 +4223,12 @@ LITE ENDPOINT: lite/v1/deposit_history -x ' { "j": "2.0", - "m": "v1/deposit_history", + "m": "v1/positions", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] }, "i": 123 } @@ -7603,16 +4239,14 @@ LITE ENDPOINT: lite/v1/deposit_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/deposit_history' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] } ' ``` @@ -7624,14 +4258,12 @@ LITE ENDPOINT: lite/v1/deposit_history -x ' { "jsonrpc": "2.0", - "method": "v1/deposit_history", + "method": "v1/positions", "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] }, "id": 123 } @@ -7641,16 +4273,14 @@ LITE ENDPOINT: lite/v1/deposit_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/deposit_history' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] } ' ``` @@ -7662,14 +4292,12 @@ LITE ENDPOINT: lite/v1/deposit_history -x ' { "j": "2.0", - "m": "v1/deposit_history", + "m": "v1/positions", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] }, "i": 123 } @@ -7680,16 +4308,14 @@ LITE ENDPOINT: lite/v1/deposit_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/deposit_history' \ + curl --location 'https://trades.grvt.io/full/v1/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] } ' ``` @@ -7698,17 +4324,15 @@ LITE ENDPOINT: lite/v1/deposit_history wscat -c "wss://trades.grvt.io/ws/full" \ -H "Cookie: $GRVT_COOKIE" \ -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "v1/deposit_history", - "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null + -x ' + { + "jsonrpc": "2.0", + "method": "v1/positions", + "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] }, "id": 123 } @@ -7718,16 +4342,14 @@ LITE ENDPOINT: lite/v1/deposit_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/deposit_history' \ + curl --location 'https://trades.grvt.io/lite/v1/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] } ' ``` @@ -7739,14 +4361,12 @@ LITE ENDPOINT: lite/v1/deposit_history -x ' { "j": "2.0", - "m": "v1/deposit_history", + "m": "v1/positions", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] }, "i": 123 } @@ -7754,81 +4374,73 @@ LITE ENDPOINT: lite/v1/deposit_history ```

-### Transfer +### Funding Payment History ``` -FULL ENDPOINT: full/v1/transfer -LITE ENDPOINT: lite/v1/transfer +FULL ENDPOINT: full/v1/funding_payment_history +LITE ENDPOINT: lite/v1/funding_payment_history ``` === "Request"
- -8<- "docs/schemas/api_transfer_request.md" + -8<- "docs/schemas/api_funding_payment_history_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "currency": "USDT", - "num_tokens": "1500.0", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "transfer_type": "STANDARD", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ``` **Lite Request** ``` { .json .copy } { - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "tt": "STANDARD", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" } ```
=== "Response"
- -8<- "docs/schemas/ack_response.md" + -8<- "docs/schemas/api_funding_payment_history_response.md"
!!! success **Full Response** ``` { .json .copy } { - "result": { - "ack": "true" - } + "result": [{ + "event_time": "1697788800000000000", + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "currency": "USDT", + "amount": "9.75", + "tx_id": "209358" + }], + "next": "Qw0918=" } ``` **Lite Response** ``` { .json .copy } { - "r": { - "a": "true" - } + "r": [{ + "et": "1697788800000000000", + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "c": "USDT", + "a": "9.75", + "ti": "209358" + }], + "n": "Qw0918=" } ```
@@ -7843,12 +4455,6 @@ LITE ENDPOINT: lite/v1/transfer |1003|400|Request could not be processed due to malformed syntax| |1006|429|You have surpassed the allocated rate limit for your tier| |1008|401|Your IP has not been whitelisted for access| - |5000|400|Transfer Metadata does not match the expected structure.| - |5001|400|Transfer Provider does not match the expected provider.| - |5002|400|Direction of the transfer does not match the expected direction.| - |5003|400|Endpoint account ID is invalid.| - |5004|400|Funding account does not exist in our system.| - |5005|400|Invalid ChainID for the transfer request.|
!!! failure @@ -7877,26 +4483,16 @@ LITE ENDPOINT: lite/v1/transfer
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/transfer' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/funding_payment_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "currency": "USDT", - "num_tokens": "1500.0", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "transfer_type": "STANDARD", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ' ``` @@ -7908,24 +4504,14 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "jsonrpc": "2.0", - "method": "v1/transfer", + "method": "v1/funding_payment_history", "params": { - "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "currency": "USDT", - "num_tokens": "1500.0", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "transfer_type": "STANDARD", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" }, "id": 123 } @@ -7935,26 +4521,16 @@ LITE ENDPOINT: lite/v1/transfer
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/transfer' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/funding_payment_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "tt": "STANDARD", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" } ' ``` @@ -7966,24 +4542,14 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "j": "2.0", - "m": "v1/transfer", + "m": "v1/funding_payment_history", "p": { - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "tt": "STANDARD", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" }, "i": 123 } @@ -7994,26 +4560,16 @@ LITE ENDPOINT: lite/v1/transfer
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/transfer' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/funding_payment_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "currency": "USDT", - "num_tokens": "1500.0", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "transfer_type": "STANDARD", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ' ``` @@ -8025,24 +4581,14 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "jsonrpc": "2.0", - "method": "v1/transfer", + "method": "v1/funding_payment_history", "params": { - "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "currency": "USDT", - "num_tokens": "1500.0", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "transfer_type": "STANDARD", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" }, "id": 123 } @@ -8052,26 +4598,16 @@ LITE ENDPOINT: lite/v1/transfer
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/transfer' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/funding_payment_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "tt": "STANDARD", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" } ' ``` @@ -8083,24 +4619,14 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "j": "2.0", - "m": "v1/transfer", + "m": "v1/funding_payment_history", "p": { - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "tt": "STANDARD", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" }, "i": 123 } @@ -8111,26 +4637,16 @@ LITE ENDPOINT: lite/v1/transfer
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/transfer' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/funding_payment_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "currency": "USDT", - "num_tokens": "1500.0", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "transfer_type": "STANDARD", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ' ``` @@ -8142,24 +4658,14 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "jsonrpc": "2.0", - "method": "v1/transfer", + "method": "v1/funding_payment_history", "params": { - "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "currency": "USDT", - "num_tokens": "1500.0", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "transfer_type": "STANDARD", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" }, "id": 123 } @@ -8169,26 +4675,16 @@ LITE ENDPOINT: lite/v1/transfer
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/transfer' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/funding_payment_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "tt": "STANDARD", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" } ' ``` @@ -8200,24 +4696,14 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "j": "2.0", - "m": "v1/transfer", + "m": "v1/funding_payment_history", "p": { - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "tt": "STANDARD", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" }, "i": 123 } @@ -8228,26 +4714,16 @@ LITE ENDPOINT: lite/v1/transfer
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/transfer' \ + curl --location 'https://trades.grvt.io/full/v1/funding_payment_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "currency": "USDT", - "num_tokens": "1500.0", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "transfer_type": "STANDARD", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ' ``` @@ -8259,24 +4735,14 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "jsonrpc": "2.0", - "method": "v1/transfer", + "method": "v1/funding_payment_history", "params": { - "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "currency": "USDT", - "num_tokens": "1500.0", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "transfer_type": "STANDARD", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" }, "id": 123 } @@ -8286,26 +4752,16 @@ LITE ENDPOINT: lite/v1/transfer
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/transfer' \ + curl --location 'https://trades.grvt.io/lite/v1/funding_payment_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "tt": "STANDARD", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" } ' ``` @@ -8317,24 +4773,14 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "j": "2.0", - "m": "v1/transfer", + "m": "v1/funding_payment_history", "p": { - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "tt": "STANDARD", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" }, "i": 123 } @@ -8342,15 +4788,16 @@ LITE ENDPOINT: lite/v1/transfer ```

-### Transfer History +## Transfer +### Deposit History ``` -FULL ENDPOINT: full/v1/transfer_history -LITE ENDPOINT: lite/v1/transfer_history +FULL ENDPOINT: full/v1/deposit_history +LITE ENDPOINT: lite/v1/deposit_history ``` === "Request"
- -8<- "docs/schemas/api_transfer_history_request.md" + -8<- "docs/schemas/api_deposit_history_request.md"
!!! question "Query" @@ -8362,7 +4809,6 @@ LITE ENDPOINT: lite/v1/transfer_history "end_time": "1697788800000000000", "limit": 500, "cursor": "", - "tx_id": "1028403", "main_account_id": null } ``` @@ -8374,14 +4820,13 @@ LITE ENDPOINT: lite/v1/transfer_history "et": "1697788800000000000", "l": 500, "c1": "", - "ti": "1028403", "ma": null } ```
=== "Response"
- -8<- "docs/schemas/api_transfer_history_response.md" + -8<- "docs/schemas/api_deposit_history_response.md"
!!! success @@ -8389,24 +4834,14 @@ LITE ENDPOINT: lite/v1/transfer_history ``` { .json .copy } { "result": [{ - "tx_id": "1028403", - "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "l_1_hash": "0x10000101000203040506", + "l_2_hash": "0x10000101000203040506", "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "currency": "USDT", "num_tokens": "1500.0", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "event_time": "1697788800000000000", - "transfer_type": "STANDARD", - "transfer_metadata": null + "initiated_time": "1697788800000000000", + "confirmed_time": "1697788800000000000", + "from_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0" }], "next": "Qw0918=" } @@ -8415,24 +4850,14 @@ LITE ENDPOINT: lite/v1/transfer_history ``` { .json .copy } { "r": [{ - "ti": "1028403", - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", + "l1": "0x10000101000203040506", + "l2": "0x10000101000203040506", "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", "c": "USDT", "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "et": "1697788800000000000", - "tt": "STANDARD", - "tm": null + "it": "1697788800000000000", + "ct": "1697788800000000000", + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0" }], "n": "Qw0918=" } @@ -8477,7 +4902,7 @@ LITE ENDPOINT: lite/v1/transfer_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/transfer_history' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/deposit_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8486,7 +4911,6 @@ LITE ENDPOINT: lite/v1/transfer_history "end_time": "1697788800000000000", "limit": 500, "cursor": "", - "tx_id": "1028403", "main_account_id": null } ' @@ -8499,14 +4923,13 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "jsonrpc": "2.0", - "method": "v1/transfer_history", + "method": "v1/deposit_history", "params": { "currency": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, "cursor": "", - "tx_id": "1028403", "main_account_id": null }, "id": 123 @@ -8517,7 +4940,7 @@ LITE ENDPOINT: lite/v1/transfer_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/transfer_history' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/deposit_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8526,7 +4949,6 @@ LITE ENDPOINT: lite/v1/transfer_history "et": "1697788800000000000", "l": 500, "c1": "", - "ti": "1028403", "ma": null } ' @@ -8539,14 +4961,13 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "j": "2.0", - "m": "v1/transfer_history", + "m": "v1/deposit_history", "p": { "c": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, "c1": "", - "ti": "1028403", "ma": null }, "i": 123 @@ -8558,7 +4979,7 @@ LITE ENDPOINT: lite/v1/transfer_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/transfer_history' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/deposit_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8567,7 +4988,6 @@ LITE ENDPOINT: lite/v1/transfer_history "end_time": "1697788800000000000", "limit": 500, "cursor": "", - "tx_id": "1028403", "main_account_id": null } ' @@ -8580,14 +5000,13 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "jsonrpc": "2.0", - "method": "v1/transfer_history", + "method": "v1/deposit_history", "params": { "currency": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, "cursor": "", - "tx_id": "1028403", "main_account_id": null }, "id": 123 @@ -8598,7 +5017,7 @@ LITE ENDPOINT: lite/v1/transfer_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/transfer_history' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/deposit_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8607,7 +5026,6 @@ LITE ENDPOINT: lite/v1/transfer_history "et": "1697788800000000000", "l": 500, "c1": "", - "ti": "1028403", "ma": null } ' @@ -8620,14 +5038,13 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "j": "2.0", - "m": "v1/transfer_history", + "m": "v1/deposit_history", "p": { "c": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, "c1": "", - "ti": "1028403", "ma": null }, "i": 123 @@ -8639,7 +5056,7 @@ LITE ENDPOINT: lite/v1/transfer_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/transfer_history' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/deposit_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8648,7 +5065,6 @@ LITE ENDPOINT: lite/v1/transfer_history "end_time": "1697788800000000000", "limit": 500, "cursor": "", - "tx_id": "1028403", "main_account_id": null } ' @@ -8661,14 +5077,13 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "jsonrpc": "2.0", - "method": "v1/transfer_history", + "method": "v1/deposit_history", "params": { "currency": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, "cursor": "", - "tx_id": "1028403", "main_account_id": null }, "id": 123 @@ -8679,7 +5094,7 @@ LITE ENDPOINT: lite/v1/transfer_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/transfer_history' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/deposit_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8688,7 +5103,6 @@ LITE ENDPOINT: lite/v1/transfer_history "et": "1697788800000000000", "l": 500, "c1": "", - "ti": "1028403", "ma": null } ' @@ -8701,14 +5115,13 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "j": "2.0", - "m": "v1/transfer_history", + "m": "v1/deposit_history", "p": { "c": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, "c1": "", - "ti": "1028403", "ma": null }, "i": 123 @@ -8720,7 +5133,7 @@ LITE ENDPOINT: lite/v1/transfer_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/transfer_history' \ + curl --location 'https://trades.grvt.io/full/v1/deposit_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8729,7 +5142,6 @@ LITE ENDPOINT: lite/v1/transfer_history "end_time": "1697788800000000000", "limit": 500, "cursor": "", - "tx_id": "1028403", "main_account_id": null } ' @@ -8742,14 +5154,13 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "jsonrpc": "2.0", - "method": "v1/transfer_history", + "method": "v1/deposit_history", "params": { "currency": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, "cursor": "", - "tx_id": "1028403", "main_account_id": null }, "id": 123 @@ -8760,7 +5171,7 @@ LITE ENDPOINT: lite/v1/transfer_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/transfer_history' \ + curl --location 'https://trades.grvt.io/lite/v1/deposit_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8769,7 +5180,6 @@ LITE ENDPOINT: lite/v1/transfer_history "et": "1697788800000000000", "l": 500, "c1": "", - "ti": "1028403", "ma": null } ' @@ -8782,14 +5192,13 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "j": "2.0", - "m": "v1/transfer_history", + "m": "v1/deposit_history", "p": { "c": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, "c1": "", - "ti": "1028403", "ma": null }, "i": 123 @@ -8798,15 +5207,15 @@ LITE ENDPOINT: lite/v1/transfer_history ```

-### Withdrawal +### Transfer ``` -FULL ENDPOINT: full/v1/withdrawal -LITE ENDPOINT: lite/v1/withdrawal +FULL ENDPOINT: full/v1/transfer +LITE ENDPOINT: lite/v1/transfer ``` === "Request"
- -8<- "docs/schemas/api_withdrawal_request.md" + -8<- "docs/schemas/api_transfer_request.md"
!!! question "Query" @@ -8814,7 +5223,9 @@ LITE ENDPOINT: lite/v1/withdrawal ``` { .json .copy } { "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "currency": "USDT", "num_tokens": "1500.0", "signature": { @@ -8824,14 +5235,18 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, + "transfer_type": "STANDARD", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} } ``` **Lite Request** ``` { .json .copy } { "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "fs": "'$GRVT_SUB_ACCOUNT_ID'", + "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "ts": "'$GRVT_SUB_ACCOUNT_ID'", "c": "USDT", "nt": "1500.0", "s": { @@ -8841,13 +5256,15 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, + "tt": "STANDARD", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} } ```
=== "Response"
- -8<- "docs/schemas/ack_response.md" + -8<- "docs/schemas/api_transfer_response.md"
!!! success @@ -8855,7 +5272,8 @@ LITE ENDPOINT: lite/v1/withdrawal ``` { .json .copy } { "result": { - "ack": "true" + "ack": "true", + "tx_id": "1028403" } } ``` @@ -8863,7 +5281,8 @@ LITE ENDPOINT: lite/v1/withdrawal ``` { .json .copy } { "r": { - "a": "true" + "a": "true", + "ti": "1028403" } } ``` @@ -8879,7 +5298,13 @@ LITE ENDPOINT: lite/v1/withdrawal |1003|400|Request could not be processed due to malformed syntax| |1006|429|You have surpassed the allocated rate limit for your tier| |1008|401|Your IP has not been whitelisted for access| - |4010|400|This wallet is not supported. Please try another wallet.| + |5000|400|Transfer Metadata does not match the expected structure.| + |5001|400|Transfer Provider does not match the expected provider.| + |4002|400|Transfer failed with an unrefined failure reason, please report to GRVT| + |5002|400|Direction of the transfer does not match the expected direction.| + |5003|400|Endpoint account ID is invalid.| + |5004|400|Funding account does not exist in our system.| + |5005|400|Invalid ChainID for the transfer request.|
!!! failure @@ -8908,12 +5333,14 @@ LITE ENDPOINT: lite/v1/withdrawal
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/withdrawal' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/transfer' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "currency": "USDT", "num_tokens": "1500.0", "signature": { @@ -8923,7 +5350,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, + "transfer_type": "STANDARD", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} } ' ``` @@ -8935,10 +5364,12 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal", + "method": "v1/transfer", "params": { "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "currency": "USDT", "num_tokens": "1500.0", "signature": { @@ -8948,7 +5379,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, + "transfer_type": "STANDARD", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} }, "id": 123 } @@ -8958,12 +5391,14 @@ LITE ENDPOINT: lite/v1/withdrawal
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/withdrawal' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/transfer' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "fs": "'$GRVT_SUB_ACCOUNT_ID'", + "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "ts": "'$GRVT_SUB_ACCOUNT_ID'", "c": "USDT", "nt": "1500.0", "s": { @@ -8973,7 +5408,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, + "tt": "STANDARD", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} } ' ``` @@ -8985,10 +5422,12 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "j": "2.0", - "m": "v1/withdrawal", + "m": "v1/transfer", "p": { "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "fs": "'$GRVT_SUB_ACCOUNT_ID'", + "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "ts": "'$GRVT_SUB_ACCOUNT_ID'", "c": "USDT", "nt": "1500.0", "s": { @@ -8998,7 +5437,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, + "tt": "STANDARD", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} }, "i": 123 } @@ -9009,12 +5450,14 @@ LITE ENDPOINT: lite/v1/withdrawal
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/withdrawal' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/transfer' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "currency": "USDT", "num_tokens": "1500.0", "signature": { @@ -9024,7 +5467,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, + "transfer_type": "STANDARD", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} } ' ``` @@ -9036,10 +5481,12 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal", + "method": "v1/transfer", "params": { "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "currency": "USDT", "num_tokens": "1500.0", "signature": { @@ -9049,7 +5496,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, + "transfer_type": "STANDARD", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} }, "id": 123 } @@ -9059,12 +5508,14 @@ LITE ENDPOINT: lite/v1/withdrawal
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/withdrawal' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/transfer' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "fs": "'$GRVT_SUB_ACCOUNT_ID'", + "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "ts": "'$GRVT_SUB_ACCOUNT_ID'", "c": "USDT", "nt": "1500.0", "s": { @@ -9074,7 +5525,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, + "tt": "STANDARD", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} } ' ``` @@ -9086,10 +5539,12 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "j": "2.0", - "m": "v1/withdrawal", + "m": "v1/transfer", "p": { "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "fs": "'$GRVT_SUB_ACCOUNT_ID'", + "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "ts": "'$GRVT_SUB_ACCOUNT_ID'", "c": "USDT", "nt": "1500.0", "s": { @@ -9099,7 +5554,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, + "tt": "STANDARD", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} }, "i": 123 } @@ -9110,12 +5567,14 @@ LITE ENDPOINT: lite/v1/withdrawal
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/withdrawal' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/transfer' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "currency": "USDT", "num_tokens": "1500.0", "signature": { @@ -9125,7 +5584,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, + "transfer_type": "STANDARD", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} } ' ``` @@ -9137,10 +5598,12 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal", + "method": "v1/transfer", "params": { "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "currency": "USDT", "num_tokens": "1500.0", "signature": { @@ -9150,7 +5613,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, + "transfer_type": "STANDARD", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} }, "id": 123 } @@ -9160,12 +5625,14 @@ LITE ENDPOINT: lite/v1/withdrawal
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/withdrawal' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/transfer' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "fs": "'$GRVT_SUB_ACCOUNT_ID'", + "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "ts": "'$GRVT_SUB_ACCOUNT_ID'", "c": "USDT", "nt": "1500.0", "s": { @@ -9175,7 +5642,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, + "tt": "STANDARD", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} } ' ``` @@ -9187,10 +5656,12 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "j": "2.0", - "m": "v1/withdrawal", + "m": "v1/transfer", "p": { "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "fs": "'$GRVT_SUB_ACCOUNT_ID'", + "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "ts": "'$GRVT_SUB_ACCOUNT_ID'", "c": "USDT", "nt": "1500.0", "s": { @@ -9200,7 +5671,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, + "tt": "STANDARD", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} }, "i": 123 } @@ -9211,12 +5684,14 @@ LITE ENDPOINT: lite/v1/withdrawal
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/withdrawal' \ + curl --location 'https://trades.grvt.io/full/v1/transfer' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "currency": "USDT", "num_tokens": "1500.0", "signature": { @@ -9226,7 +5701,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, + "transfer_type": "STANDARD", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} } ' ``` @@ -9238,10 +5715,12 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal", + "method": "v1/transfer", "params": { "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "currency": "USDT", "num_tokens": "1500.0", "signature": { @@ -9251,7 +5730,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "expiration": "1697788800000000000", "nonce": 1234567890 - } + }, + "transfer_type": "STANDARD", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} }, "id": 123 } @@ -9261,12 +5742,14 @@ LITE ENDPOINT: lite/v1/withdrawal
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/withdrawal' \ + curl --location 'https://trades.grvt.io/lite/v1/transfer' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "fs": "'$GRVT_SUB_ACCOUNT_ID'", + "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "ts": "'$GRVT_SUB_ACCOUNT_ID'", "c": "USDT", "nt": "1500.0", "s": { @@ -9276,7 +5759,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, + "tt": "STANDARD", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} } ' ``` @@ -9288,10 +5773,12 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "j": "2.0", - "m": "v1/withdrawal", + "m": "v1/transfer", "p": { "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "fs": "'$GRVT_SUB_ACCOUNT_ID'", + "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "ts": "'$GRVT_SUB_ACCOUNT_ID'", "c": "USDT", "nt": "1500.0", "s": { @@ -9301,7 +5788,9 @@ LITE ENDPOINT: lite/v1/withdrawal "v": 28, "e": "1697788800000000000", "n": 1234567890 - } + }, + "tt": "STANDARD", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} }, "i": 123 } @@ -9309,15 +5798,15 @@ LITE ENDPOINT: lite/v1/withdrawal ```

-### Withdrawal History +### Transfer History ``` -FULL ENDPOINT: full/v1/withdrawal_history -LITE ENDPOINT: lite/v1/withdrawal_history +FULL ENDPOINT: full/v1/transfer_history +LITE ENDPOINT: lite/v1/transfer_history ``` === "Request"
- -8<- "docs/schemas/api_withdrawal_history_request.md" + -8<- "docs/schemas/api_transfer_history_request.md"
!!! question "Query" @@ -9329,6 +5818,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history "end_time": "1697788800000000000", "limit": 500, "cursor": "", + "tx_id": "1028403", "main_account_id": null } ``` @@ -9340,57 +5830,28 @@ LITE ENDPOINT: lite/v1/withdrawal_history "et": "1697788800000000000", "l": 500, "c1": "", + "ti": "1028403", "ma": null } ```
=== "Response"
- -8<- "docs/schemas/api_withdrawal_history_response.md" + -8<- "docs/schemas/api_transfer_history_response.md"
!!! success **Full Response** ``` { .json .copy } { - "result": [{ - "tx_id": "1028403", - "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "currency": "USDT", - "num_tokens": "1500.0", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "event_time": "1697788800000000000" - }], + "result": [null], "next": "Qw0918=" } ``` **Lite Response** ``` { .json .copy } { - "r": [{ - "ti": "1028403", - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "et": "1697788800000000000" - }], + "r": [null], "n": "Qw0918=" } ``` @@ -9434,7 +5895,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/withdrawal_history' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/transfer_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -9443,6 +5904,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history "end_time": "1697788800000000000", "limit": 500, "cursor": "", + "tx_id": "1028403", "main_account_id": null } ' @@ -9455,13 +5917,14 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal_history", + "method": "v1/transfer_history", "params": { "currency": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, "cursor": "", + "tx_id": "1028403", "main_account_id": null }, "id": 123 @@ -9472,7 +5935,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/withdrawal_history' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/transfer_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -9481,6 +5944,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history "et": "1697788800000000000", "l": 500, "c1": "", + "ti": "1028403", "ma": null } ' @@ -9493,13 +5957,14 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "j": "2.0", - "m": "v1/withdrawal_history", + "m": "v1/transfer_history", "p": { "c": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, "c1": "", + "ti": "1028403", "ma": null }, "i": 123 @@ -9511,7 +5976,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/withdrawal_history' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/transfer_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -9520,6 +5985,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history "end_time": "1697788800000000000", "limit": 500, "cursor": "", + "tx_id": "1028403", "main_account_id": null } ' @@ -9532,13 +5998,14 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal_history", + "method": "v1/transfer_history", "params": { "currency": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, "cursor": "", + "tx_id": "1028403", "main_account_id": null }, "id": 123 @@ -9549,7 +6016,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/withdrawal_history' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/transfer_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -9558,6 +6025,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history "et": "1697788800000000000", "l": 500, "c1": "", + "ti": "1028403", "ma": null } ' @@ -9570,13 +6038,14 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "j": "2.0", - "m": "v1/withdrawal_history", + "m": "v1/transfer_history", "p": { "c": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, "c1": "", + "ti": "1028403", "ma": null }, "i": 123 @@ -9588,7 +6057,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/withdrawal_history' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/transfer_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -9597,6 +6066,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history "end_time": "1697788800000000000", "limit": 500, "cursor": "", + "tx_id": "1028403", "main_account_id": null } ' @@ -9609,13 +6079,14 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal_history", + "method": "v1/transfer_history", "params": { "currency": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, "cursor": "", + "tx_id": "1028403", "main_account_id": null }, "id": 123 @@ -9626,7 +6097,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/withdrawal_history' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/transfer_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -9635,6 +6106,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history "et": "1697788800000000000", "l": 500, "c1": "", + "ti": "1028403", "ma": null } ' @@ -9647,13 +6119,14 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "j": "2.0", - "m": "v1/withdrawal_history", + "m": "v1/transfer_history", "p": { "c": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, "c1": "", + "ti": "1028403", "ma": null }, "i": 123 @@ -9665,7 +6138,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/withdrawal_history' \ + curl --location 'https://trades.grvt.io/full/v1/transfer_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -9674,6 +6147,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history "end_time": "1697788800000000000", "limit": 500, "cursor": "", + "tx_id": "1028403", "main_account_id": null } ' @@ -9686,13 +6160,14 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal_history", + "method": "v1/transfer_history", "params": { "currency": ["USDT", "USDC"], "start_time": "1697788800000000000", "end_time": "1697788800000000000", "limit": 500, "cursor": "", + "tx_id": "1028403", "main_account_id": null }, "id": 123 @@ -9703,7 +6178,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/withdrawal_history' \ + curl --location 'https://trades.grvt.io/lite/v1/transfer_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -9712,6 +6187,7 @@ LITE ENDPOINT: lite/v1/withdrawal_history "et": "1697788800000000000", "l": 500, "c1": "", + "ti": "1028403", "ma": null } ' @@ -9724,13 +6200,14 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "j": "2.0", - "m": "v1/withdrawal_history", + "m": "v1/transfer_history", "p": { "c": ["USDT", "USDC"], "st": "1697788800000000000", "et": "1697788800000000000", "l": 500, "c1": "", + "ti": "1028403", "ma": null }, "i": 123 @@ -9739,52 +6216,73 @@ LITE ENDPOINT: lite/v1/withdrawal_history ```

-## PreDepositCheck -### Pre Deposit Check +### Withdrawal ``` -FULL ENDPOINT: full/v1/pre_deposit_check -LITE ENDPOINT: lite/v1/pre_deposit_check +FULL ENDPOINT: full/v1/withdrawal +LITE ENDPOINT: lite/v1/withdrawal ``` === "Request"
- -8<- "docs/schemas/api_pre_deposit_check_request.md" + -8<- "docs/schemas/api_withdrawal_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { + "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "currency": "USDT", - "bridge": "XY" + "num_tokens": "1500.0", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890 + } } ``` **Lite Request** ``` { .json .copy } { + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "c": "USDT", - "b": "XY" + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890 + } } ```
=== "Response"
- -8<- "docs/schemas/api_pre_deposit_check_response.md" + -8<- "docs/schemas/ack_response.md"
!!! success **Full Response** ``` { .json .copy } { - "max_deposit_limit": "3945034.23", - "currency": "USDT" + "result": { + "ack": "true" + } } ``` **Lite Response** ``` { .json .copy } { - "md": "3945034.23", - "c": "USDT" + "r": { + "a": "true" + } } ```
@@ -9793,11 +6291,13 @@ LITE ENDPOINT: lite/v1/pre_deposit_check !!! info "Error Codes" |Code|HttpStatus| Description | |-|-|-| + |1000|401|You need to authenticate prior to using this functionality| + |1001|403|You are not authorized to access this functionality| |1002|500|Internal Server Error| |1003|400|Request could not be processed due to malformed syntax| |1006|429|You have surpassed the allocated rate limit for your tier| - |1007|404|The currency you are requesting for is not currently supported| |1008|401|Your IP has not been whitelisted for access| + |4010|400|This wallet is not supported. Please try another wallet.|
!!! failure @@ -9805,18 +6305,18 @@ LITE ENDPOINT: lite/v1/pre_deposit_check ``` { .json .copy } { "request_id":1, - "code":1002, - "message":"Internal Server Error", - "status":500 + "code":1000, + "message":"You need to authenticate prior to using this functionality", + "status":401 } ``` **Lite Error Response** ``` { .json .copy } { "ri":1, - "c":1002, - "m":"Internal Server Error", - "s":500 + "c":1000, + "m":"You need to authenticate prior to using this functionality", + "s":401 } ```
@@ -9826,12 +6326,22 @@ LITE ENDPOINT: lite/v1/pre_deposit_check
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/pre_deposit_check' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/withdrawal' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "currency": "USDT", - "bridge": "XY" + "num_tokens": "1500.0", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890 + } } ' ``` @@ -9843,10 +6353,20 @@ LITE ENDPOINT: lite/v1/pre_deposit_check -x ' { "jsonrpc": "2.0", - "method": "v1/pre_deposit_check", + "method": "v1/withdrawal", "params": { + "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "currency": "USDT", - "bridge": "XY" + "num_tokens": "1500.0", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890 + } }, "id": 123 } @@ -9856,12 +6376,22 @@ LITE ENDPOINT: lite/v1/pre_deposit_check
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/pre_deposit_check' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/withdrawal' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "c": "USDT", - "b": "XY" + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890 + } } ' ``` @@ -9873,10 +6403,20 @@ LITE ENDPOINT: lite/v1/pre_deposit_check -x ' { "j": "2.0", - "m": "v1/pre_deposit_check", + "m": "v1/withdrawal", "p": { + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "c": "USDT", - "b": "XY" + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890 + } }, "i": 123 } @@ -9887,12 +6427,22 @@ LITE ENDPOINT: lite/v1/pre_deposit_check
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/pre_deposit_check' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/withdrawal' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "currency": "USDT", - "bridge": "XY" + "num_tokens": "1500.0", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890 + } } ' ``` @@ -9904,10 +6454,20 @@ LITE ENDPOINT: lite/v1/pre_deposit_check -x ' { "jsonrpc": "2.0", - "method": "v1/pre_deposit_check", + "method": "v1/withdrawal", "params": { + "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "currency": "USDT", - "bridge": "XY" + "num_tokens": "1500.0", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890 + } }, "id": 123 } @@ -9917,12 +6477,22 @@ LITE ENDPOINT: lite/v1/pre_deposit_check
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/pre_deposit_check' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/withdrawal' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "c": "USDT", - "b": "XY" + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890 + } } ' ``` @@ -9934,10 +6504,20 @@ LITE ENDPOINT: lite/v1/pre_deposit_check -x ' { "j": "2.0", - "m": "v1/pre_deposit_check", + "m": "v1/withdrawal", "p": { + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "c": "USDT", - "b": "XY" + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890 + } }, "i": 123 } @@ -9948,12 +6528,22 @@ LITE ENDPOINT: lite/v1/pre_deposit_check
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/pre_deposit_check' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/withdrawal' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "currency": "USDT", - "bridge": "XY" + "num_tokens": "1500.0", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890 + } } ' ``` @@ -9965,10 +6555,20 @@ LITE ENDPOINT: lite/v1/pre_deposit_check -x ' { "jsonrpc": "2.0", - "method": "v1/pre_deposit_check", + "method": "v1/withdrawal", "params": { + "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "currency": "USDT", - "bridge": "XY" + "num_tokens": "1500.0", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890 + } }, "id": 123 } @@ -9978,12 +6578,22 @@ LITE ENDPOINT: lite/v1/pre_deposit_check
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/pre_deposit_check' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/withdrawal' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "c": "USDT", - "b": "XY" + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890 + } } ' ``` @@ -9995,10 +6605,20 @@ LITE ENDPOINT: lite/v1/pre_deposit_check -x ' { "j": "2.0", - "m": "v1/pre_deposit_check", + "m": "v1/withdrawal", "p": { + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "c": "USDT", - "b": "XY" + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890 + } }, "i": 123 } @@ -10009,12 +6629,22 @@ LITE ENDPOINT: lite/v1/pre_deposit_check
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/pre_deposit_check' \ + curl --location 'https://trades.grvt.io/full/v1/withdrawal' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "currency": "USDT", - "bridge": "XY" + "num_tokens": "1500.0", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890 + } } ' ``` @@ -10026,10 +6656,20 @@ LITE ENDPOINT: lite/v1/pre_deposit_check -x ' { "jsonrpc": "2.0", - "method": "v1/pre_deposit_check", + "method": "v1/withdrawal", "params": { + "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "currency": "USDT", - "bridge": "XY" + "num_tokens": "1500.0", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890 + } }, "id": 123 } @@ -10039,12 +6679,22 @@ LITE ENDPOINT: lite/v1/pre_deposit_check
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/pre_deposit_check' \ + curl --location 'https://trades.grvt.io/lite/v1/withdrawal' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "c": "USDT", - "b": "XY" + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890 + } } ' ``` @@ -10056,10 +6706,20 @@ LITE ENDPOINT: lite/v1/pre_deposit_check -x ' { "j": "2.0", - "m": "v1/pre_deposit_check", + "m": "v1/withdrawal", "p": { + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "c": "USDT", - "b": "XY" + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890 + } }, "i": 123 } @@ -10067,114 +6727,59 @@ LITE ENDPOINT: lite/v1/pre_deposit_check ```

-## Account -### Sub Account Summary +### Withdrawal History ``` -FULL ENDPOINT: full/v1/account_summary -LITE ENDPOINT: lite/v1/account_summary +FULL ENDPOINT: full/v1/withdrawal_history +LITE ENDPOINT: lite/v1/withdrawal_history ``` === "Request"
- -8<- "docs/schemas/api_sub_account_summary_request.md" + -8<- "docs/schemas/api_withdrawal_history_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null } ``` **Lite Request** ``` { .json .copy } { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null } ```
=== "Response"
- -8<- "docs/schemas/api_sub_account_summary_response.md" + -8<- "docs/schemas/api_withdrawal_history_response.md"
!!! success **Full Response** ``` { .json .copy } { - "result": { - "event_time": "1697788800000000000", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "margin_type": "SIMPLE_CROSS_MARGIN", - "settle_currency": "USDT", - "unrealized_pnl": "123456.78", - "total_equity": "123456.78", - "initial_margin": "123456.78", - "maintenance_margin": "123456.78", - "available_balance": "123456.78", - "spot_balances": [{ - "currency": "USDT", - "balance": "123456.78", - "index_price": "1.0000102" - }], - "positions": [{ - "event_time": "1697788800000000000", - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "size": "2635000.50", - "notional": "2635000.50", - "entry_price": "65038.01", - "exit_price": "65038.01", - "mark_price": "65038.01", - "unrealized_pnl": "135000.50", - "realized_pnl": "-35000.30", - "total_pnl": "100000.20", - "roi": "10.20", - "quote_index_price": "1.0000102", - "est_liquidation_price": 60000.25, - "leverage": "10" - }], - "settle_index_price": "1.0000102" - } + "result": [null], + "next": "Qw0918=" } ``` **Lite Response** ``` { .json .copy } { - "r": { - "et": "1697788800000000000", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "mt": "SIMPLE_CROSS_MARGIN", - "sc": "USDT", - "up": "123456.78", - "te": "123456.78", - "im": "123456.78", - "mm": "123456.78", - "ab": "123456.78", - "sb": [{ - "c": "USDT", - "b": "123456.78", - "ip": "1.0000102" - }], - "p": [{ - "et": "1697788800000000000", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "s": "2635000.50", - "n": "2635000.50", - "ep": "65038.01", - "ep1": "65038.01", - "mp": "65038.01", - "up": "135000.50", - "rp": "-35000.30", - "tp": "100000.20", - "r": "10.20", - "qi": "1.0000102", - "el": 60000.25, - "l": "10" - }], - "si": "1.0000102" - } + "r": [null], + "n": "Qw0918=" } ```
@@ -10217,11 +6822,16 @@ LITE ENDPOINT: lite/v1/account_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/account_summary' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/withdrawal_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null } ' ``` @@ -10233,9 +6843,14 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/account_summary", + "method": "v1/withdrawal_history", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null }, "id": 123 } @@ -10245,11 +6860,16 @@ LITE ENDPOINT: lite/v1/account_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/account_summary' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/withdrawal_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null } ' ``` @@ -10261,9 +6881,14 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "j": "2.0", - "m": "v1/account_summary", + "m": "v1/withdrawal_history", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null }, "i": 123 } @@ -10274,11 +6899,16 @@ LITE ENDPOINT: lite/v1/account_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/account_summary' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/withdrawal_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null } ' ``` @@ -10290,9 +6920,14 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/account_summary", + "method": "v1/withdrawal_history", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null }, "id": 123 } @@ -10302,11 +6937,16 @@ LITE ENDPOINT: lite/v1/account_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/account_summary' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/withdrawal_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null } ' ``` @@ -10318,9 +6958,14 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "j": "2.0", - "m": "v1/account_summary", + "m": "v1/withdrawal_history", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null }, "i": 123 } @@ -10331,11 +6976,16 @@ LITE ENDPOINT: lite/v1/account_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/account_summary' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/withdrawal_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null } ' ``` @@ -10347,9 +6997,14 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/account_summary", + "method": "v1/withdrawal_history", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null }, "id": 123 } @@ -10359,11 +7014,16 @@ LITE ENDPOINT: lite/v1/account_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/account_summary' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/withdrawal_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null } ' ``` @@ -10375,9 +7035,14 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "j": "2.0", - "m": "v1/account_summary", + "m": "v1/withdrawal_history", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null }, "i": 123 } @@ -10388,11 +7053,16 @@ LITE ENDPOINT: lite/v1/account_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/account_summary' \ + curl --location 'https://trades.grvt.io/full/v1/withdrawal_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null } ' ``` @@ -10404,9 +7074,14 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/account_summary", + "method": "v1/withdrawal_history", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null }, "id": 123 } @@ -10416,11 +7091,16 @@ LITE ENDPOINT: lite/v1/account_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/account_summary' \ + curl --location 'https://trades.grvt.io/lite/v1/withdrawal_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null } ' ``` @@ -10432,9 +7112,14 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "j": "2.0", - "m": "v1/account_summary", + "m": "v1/withdrawal_history", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null }, "i": 123 } @@ -10442,49 +7127,42 @@ LITE ENDPOINT: lite/v1/account_summary ```

-### Sub Account History +## Account +### Sub Account Summary ``` -FULL ENDPOINT: full/v1/account_history -LITE ENDPOINT: lite/v1/account_history +FULL ENDPOINT: full/v1/account_summary +LITE ENDPOINT: lite/v1/account_summary ``` === "Request"
- -8<- "docs/schemas/api_sub_account_history_request.md" + -8<- "docs/schemas/api_sub_account_summary_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ``` **Lite Request** ``` { .json .copy } { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ```
=== "Response"
- -8<- "docs/schemas/api_sub_account_history_response.md" + -8<- "docs/schemas/api_sub_account_summary_response.md"
!!! success **Full Response** ``` { .json .copy } { - "result": [{ + "result": { "event_time": "1697788800000000000", "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", "margin_type": "SIMPLE_CROSS_MARGIN", @@ -10517,14 +7195,13 @@ LITE ENDPOINT: lite/v1/account_history "leverage": "10" }], "settle_index_price": "1.0000102" - }], - "next": "Qw0918=" + } } ``` **Lite Response** ``` { .json .copy } { - "r": [{ + "r": { "et": "1697788800000000000", "sa": "'$GRVT_SUB_ACCOUNT_ID'", "mt": "SIMPLE_CROSS_MARGIN", @@ -10557,8 +7234,7 @@ LITE ENDPOINT: lite/v1/account_history "l": "10" }], "si": "1.0000102" - }], - "n": "Qw0918=" + } } ```
@@ -10601,15 +7277,11 @@ LITE ENDPOINT: lite/v1/account_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/account_history' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -10621,13 +7293,9 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "jsonrpc": "2.0", - "method": "v1/account_history", + "method": "v1/account_summary", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -10637,15 +7305,11 @@ LITE ENDPOINT: lite/v1/account_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/account_history' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -10657,13 +7321,9 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "j": "2.0", - "m": "v1/account_history", + "m": "v1/account_summary", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -10674,15 +7334,11 @@ LITE ENDPOINT: lite/v1/account_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/account_history' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -10694,13 +7350,9 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "jsonrpc": "2.0", - "method": "v1/account_history", + "method": "v1/account_summary", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -10710,15 +7362,11 @@ LITE ENDPOINT: lite/v1/account_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/account_history' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -10730,13 +7378,9 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "j": "2.0", - "m": "v1/account_history", + "m": "v1/account_summary", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -10747,15 +7391,11 @@ LITE ENDPOINT: lite/v1/account_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/account_history' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -10767,13 +7407,9 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "jsonrpc": "2.0", - "method": "v1/account_history", + "method": "v1/account_summary", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -10783,15 +7419,11 @@ LITE ENDPOINT: lite/v1/account_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/account_history' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -10803,13 +7435,9 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "j": "2.0", - "m": "v1/account_history", + "m": "v1/account_summary", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -10820,15 +7448,11 @@ LITE ENDPOINT: lite/v1/account_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/account_history' \ + curl --location 'https://trades.grvt.io/full/v1/account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -10840,13 +7464,9 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "jsonrpc": "2.0", - "method": "v1/account_history", + "method": "v1/account_summary", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -10856,15 +7476,11 @@ LITE ENDPOINT: lite/v1/account_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/account_history' \ + curl --location 'https://trades.grvt.io/lite/v1/account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -10876,13 +7492,9 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "j": "2.0", - "m": "v1/account_history", + "m": "v1/account_summary", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -10890,61 +7502,123 @@ LITE ENDPOINT: lite/v1/account_history ```

-### Aggregated Account Summary +### Sub Account History ``` -FULL ENDPOINT: full/v1/aggregated_account_summary -LITE ENDPOINT: lite/v1/aggregated_account_summary +FULL ENDPOINT: full/v1/account_history +LITE ENDPOINT: lite/v1/account_history ``` === "Request"
- -8<- "docs/schemas/empty_request.md" + -8<- "docs/schemas/api_sub_account_history_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ``` **Lite Request** ``` { .json .copy } { + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" } ```
=== "Response"
- -8<- "docs/schemas/api_aggregated_account_summary_response.md" + -8<- "docs/schemas/api_sub_account_history_response.md"
!!! success **Full Response** ``` { .json .copy } { - "result": { - "main_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "total_equity": "3945034.23", + "result": [{ + "event_time": "1697788800000000000", + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "margin_type": "SIMPLE_CROSS_MARGIN", + "settle_currency": "USDT", + "unrealized_pnl": "123456.78", + "total_equity": "123456.78", + "initial_margin": "123456.78", + "maintenance_margin": "123456.78", + "available_balance": "123456.78", "spot_balances": [{ "currency": "USDT", "balance": "123456.78", "index_price": "1.0000102" - }] - } + }], + "positions": [{ + "event_time": "1697788800000000000", + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "size": "2635000.50", + "notional": "2635000.50", + "entry_price": "65038.01", + "exit_price": "65038.01", + "mark_price": "65038.01", + "unrealized_pnl": "135000.50", + "realized_pnl": "-35000.30", + "total_pnl": "100000.20", + "roi": "10.20", + "quote_index_price": "1.0000102", + "est_liquidation_price": 60000.25, + "leverage": "10" + }], + "settle_index_price": "1.0000102" + }], + "next": "Qw0918=" } ``` **Lite Response** ``` { .json .copy } { - "r": { - "ma": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "3945034.23", + "r": [{ + "et": "1697788800000000000", + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "mt": "SIMPLE_CROSS_MARGIN", + "sc": "USDT", + "up": "123456.78", + "te": "123456.78", + "im": "123456.78", + "mm": "123456.78", + "ab": "123456.78", "sb": [{ "c": "USDT", "b": "123456.78", "ip": "1.0000102" - }] - } + }], + "p": [{ + "et": "1697788800000000000", + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "s": "2635000.50", + "n": "2635000.50", + "ep": "65038.01", + "ep1": "65038.01", + "mp": "65038.01", + "up": "135000.50", + "rp": "-35000.30", + "tp": "100000.20", + "r": "10.20", + "qi": "1.0000102", + "el": 60000.25, + "l": "10" + }], + "si": "1.0000102" + }], + "n": "Qw0918=" } ```
@@ -10953,6 +7627,8 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary !!! info "Error Codes" |Code|HttpStatus| Description | |-|-|-| + |1000|401|You need to authenticate prior to using this functionality| + |1001|403|You are not authorized to access this functionality| |1002|500|Internal Server Error| |1003|400|Request could not be processed due to malformed syntax| |1006|429|You have surpassed the allocated rate limit for your tier| @@ -10964,18 +7640,18 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary ``` { .json .copy } { "request_id":1, - "code":1002, - "message":"Internal Server Error", - "status":500 + "code":1000, + "message":"You need to authenticate prior to using this functionality", + "status":401 } ``` **Lite Error Response** ``` { .json .copy } { "ri":1, - "c":1002, - "m":"Internal Server Error", - "s":500 + "c":1000, + "m":"You need to authenticate prior to using this functionality", + "s":401 } ```
@@ -10985,10 +7661,15 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/aggregated_account_summary' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/account_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ' ``` @@ -11000,8 +7681,13 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/aggregated_account_summary", + "method": "v1/account_history", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" }, "id": 123 } @@ -11011,10 +7697,15 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/aggregated_account_summary' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/account_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" } ' ``` @@ -11026,8 +7717,13 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "j": "2.0", - "m": "v1/aggregated_account_summary", + "m": "v1/account_history", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" }, "i": 123 } @@ -11038,10 +7734,15 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/aggregated_account_summary' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/account_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ' ``` @@ -11053,8 +7754,13 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/aggregated_account_summary", + "method": "v1/account_history", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" }, "id": 123 } @@ -11064,10 +7770,15 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/aggregated_account_summary' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/account_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" } ' ``` @@ -11079,8 +7790,13 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "j": "2.0", - "m": "v1/aggregated_account_summary", + "m": "v1/account_history", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" }, "i": 123 } @@ -11091,10 +7807,15 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/aggregated_account_summary' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/account_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ' ``` @@ -11106,8 +7827,13 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/aggregated_account_summary", + "method": "v1/account_history", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" }, "id": 123 } @@ -11117,10 +7843,15 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/aggregated_account_summary' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/account_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" } ' ``` @@ -11132,8 +7863,13 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "j": "2.0", - "m": "v1/aggregated_account_summary", + "m": "v1/account_history", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" }, "i": 123 } @@ -11144,10 +7880,15 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/aggregated_account_summary' \ + curl --location 'https://trades.grvt.io/full/v1/account_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ' ``` @@ -11159,8 +7900,13 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/aggregated_account_summary", + "method": "v1/account_history", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" }, "id": 123 } @@ -11170,10 +7916,15 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/aggregated_account_summary' \ + curl --location 'https://trades.grvt.io/lite/v1/account_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" } ' ``` @@ -11185,8 +7936,13 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "j": "2.0", - "m": "v1/aggregated_account_summary", + "m": "v1/account_history", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" }, "i": 123 } @@ -11194,10 +7950,10 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary ```

-### Funding Account Summary +### Aggregated Account Summary ``` -FULL ENDPOINT: full/v1/funding_account_summary -LITE ENDPOINT: lite/v1/funding_account_summary +FULL ENDPOINT: full/v1/aggregated_account_summary +LITE ENDPOINT: lite/v1/aggregated_account_summary ``` === "Request" @@ -11219,7 +7975,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary
=== "Response"
- -8<- "docs/schemas/api_funding_account_summary_response.md" + -8<- "docs/schemas/api_aggregated_account_summary_response.md"
!!! success @@ -11257,6 +8013,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary !!! info "Error Codes" |Code|HttpStatus| Description | |-|-|-| + |1001|403|You are not authorized to access this functionality| |1002|500|Internal Server Error| |1003|400|Request could not be processed due to malformed syntax| |1006|429|You have surpassed the allocated rate limit for your tier| @@ -11268,18 +8025,18 @@ LITE ENDPOINT: lite/v1/funding_account_summary ``` { .json .copy } { "request_id":1, - "code":1002, - "message":"Internal Server Error", - "status":500 + "code":1001, + "message":"You are not authorized to access this functionality", + "status":403 } ``` **Lite Error Response** ``` { .json .copy } { "ri":1, - "c":1002, - "m":"Internal Server Error", - "s":500 + "c":1001, + "m":"You are not authorized to access this functionality", + "s":403 } ```
@@ -11289,7 +8046,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/funding_account_summary' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/aggregated_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11304,7 +8061,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/funding_account_summary", + "method": "v1/aggregated_account_summary", "params": { }, "id": 123 @@ -11315,7 +8072,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/funding_account_summary' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/aggregated_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11330,7 +8087,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "j": "2.0", - "m": "v1/funding_account_summary", + "m": "v1/aggregated_account_summary", "p": { }, "i": 123 @@ -11342,7 +8099,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/funding_account_summary' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/aggregated_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11357,7 +8114,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/funding_account_summary", + "method": "v1/aggregated_account_summary", "params": { }, "id": 123 @@ -11368,7 +8125,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/funding_account_summary' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/aggregated_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11383,7 +8140,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "j": "2.0", - "m": "v1/funding_account_summary", + "m": "v1/aggregated_account_summary", "p": { }, "i": 123 @@ -11395,7 +8152,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/funding_account_summary' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/aggregated_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11410,7 +8167,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/funding_account_summary", + "method": "v1/aggregated_account_summary", "params": { }, "id": 123 @@ -11421,7 +8178,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/funding_account_summary' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/aggregated_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11436,7 +8193,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "j": "2.0", - "m": "v1/funding_account_summary", + "m": "v1/aggregated_account_summary", "p": { }, "i": 123 @@ -11448,7 +8205,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/funding_account_summary' \ + curl --location 'https://trades.grvt.io/full/v1/aggregated_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11463,7 +8220,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/funding_account_summary", + "method": "v1/aggregated_account_summary", "params": { }, "id": 123 @@ -11474,7 +8231,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/funding_account_summary' \ + curl --location 'https://trades.grvt.io/lite/v1/aggregated_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11489,7 +8246,7 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "j": "2.0", - "m": "v1/funding_account_summary", + "m": "v1/aggregated_account_summary", "p": { }, "i": 123 @@ -11498,11 +8255,10 @@ LITE ENDPOINT: lite/v1/funding_account_summary ```

-## SocializedLoss -### Socialized Loss Status +### Funding Account Summary ``` -FULL ENDPOINT: full/v1/socialized_loss_status -LITE ENDPOINT: lite/v1/socialized_loss_status +FULL ENDPOINT: full/v1/funding_account_summary +LITE ENDPOINT: lite/v1/funding_account_summary ``` === "Request" @@ -11524,22 +8280,20 @@ LITE ENDPOINT: lite/v1/socialized_loss_status
=== "Response"
- -8<- "docs/schemas/api_socialized_loss_status_response.md" + -8<- "docs/schemas/api_funding_account_summary_response.md"
!!! success **Full Response** ``` { .json .copy } { - "is_active": "false", - "haircut_ratio": "0.34" + "result": null } ``` **Lite Response** ``` { .json .copy } { - "ia": "false", - "hr": "0.34" + "r": null } ```
@@ -11548,6 +8302,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status !!! info "Error Codes" |Code|HttpStatus| Description | |-|-|-| + |1001|403|You are not authorized to access this functionality| |1002|500|Internal Server Error| |1003|400|Request could not be processed due to malformed syntax| |1006|429|You have surpassed the allocated rate limit for your tier| @@ -11559,18 +8314,18 @@ LITE ENDPOINT: lite/v1/socialized_loss_status ``` { .json .copy } { "request_id":1, - "code":1002, - "message":"Internal Server Error", - "status":500 + "code":1001, + "message":"You are not authorized to access this functionality", + "status":403 } ``` **Lite Error Response** ``` { .json .copy } { "ri":1, - "c":1002, - "m":"Internal Server Error", - "s":500 + "c":1001, + "m":"You are not authorized to access this functionality", + "s":403 } ```
@@ -11580,7 +8335,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/socialized_loss_status' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11595,7 +8350,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status -x ' { "jsonrpc": "2.0", - "method": "v1/socialized_loss_status", + "method": "v1/funding_account_summary", "params": { }, "id": 123 @@ -11606,7 +8361,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/socialized_loss_status' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11621,7 +8376,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status -x ' { "j": "2.0", - "m": "v1/socialized_loss_status", + "m": "v1/funding_account_summary", "p": { }, "i": 123 @@ -11633,7 +8388,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/socialized_loss_status' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11648,7 +8403,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status -x ' { "jsonrpc": "2.0", - "method": "v1/socialized_loss_status", + "method": "v1/funding_account_summary", "params": { }, "id": 123 @@ -11659,7 +8414,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/socialized_loss_status' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11674,7 +8429,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status -x ' { "j": "2.0", - "m": "v1/socialized_loss_status", + "m": "v1/funding_account_summary", "p": { }, "i": 123 @@ -11686,7 +8441,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/socialized_loss_status' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11701,7 +8456,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status -x ' { "jsonrpc": "2.0", - "method": "v1/socialized_loss_status", + "method": "v1/funding_account_summary", "params": { }, "id": 123 @@ -11712,7 +8467,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/socialized_loss_status' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11727,7 +8482,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status -x ' { "j": "2.0", - "m": "v1/socialized_loss_status", + "m": "v1/funding_account_summary", "p": { }, "i": 123 @@ -11739,7 +8494,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/socialized_loss_status' \ + curl --location 'https://trades.grvt.io/full/v1/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11754,7 +8509,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status -x ' { "jsonrpc": "2.0", - "method": "v1/socialized_loss_status", + "method": "v1/funding_account_summary", "params": { }, "id": 123 @@ -11765,7 +8520,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/socialized_loss_status' \ + curl --location 'https://trades.grvt.io/lite/v1/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11780,7 +8535,7 @@ LITE ENDPOINT: lite/v1/socialized_loss_status -x ' { "j": "2.0", - "m": "v1/socialized_loss_status", + "m": "v1/funding_account_summary", "p": { }, "i": 123 diff --git a/artifacts/apidocs/trading_streams.md b/artifacts/apidocs/trading_streams.md index c4bd5cd..d576326 100644 --- a/artifacts/apidocs/trading_streams.md +++ b/artifacts/apidocs/trading_streams.md @@ -136,7 +136,8 @@ STREAM: v1.order "trigger_type": "TAKE_PROFIT", "tpsl": { "trigger_by": "LAST", - "trigger_price": "65038.10" + "trigger_price": "65038.10", + "close_position": false } }, "broker": "BROKER_CODE" @@ -186,7 +187,8 @@ STREAM: v1.order "tt": "TAKE_PROFIT", "t": { "tb": "LAST", - "tp": "65038.10" + "tp": "65038.10", + "cp": false } }, "b": "BROKER_CODE" @@ -1877,601 +1879,6 @@ STREAM: v1.cancel ```

-### Order Group -``` -STREAM: v1.group -``` - -=== "Feed Selector" -
- -8<- "docs/schemas/ws_order_group_feed_selector_v1.md" - ??? info "JSONRPC Wrappers" - -8<- "docs/schemas/jsonrpc_request.md" - -8<- "docs/schemas/jsonrpc_response.md" - -8<- "docs/schemas/ws_subscribe_params.md" - -8<- "docs/schemas/ws_subscribe_result.md" - -8<- "docs/schemas/ws_unsubscribe_params.md" - -8<- "docs/schemas/ws_unsubscribe_result.md" - -8<- "docs/schemas/ws_subscribe_request_v1_legacy.md" - -8<- "docs/schemas/ws_subscribe_response_v1_legacy.md" -
-
- ???+ question "Subscribe" - **Full Subscribe Request** - ``` { .json .copy } - { - "jsonrpc": "2.0", - "method": "subscribe", - "params": { - "stream": "v1.group", - "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "id": 123 - } - ``` - **Full Subscribe Response** - ``` { .json .copy } - { - "jsonrpc": "2.0", - "result": { - "stream": "v1.group", - "subs": ["'$GRVT_SUB_ACCOUNT_ID'"], - "unsubs": [], - "num_snapshots": [10], - "first_sequence_number": [872634876] - }, - "id": 123, - "method": "subscribe" - } - ``` - ??? question "Unsubscribe" - **Full Unsubscribe Request** - ``` { .json .copy } - { - "jsonrpc": "2.0", - "method": "unsubscribe", - "params": { - "stream": "v1.group", - "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "id": 123 - } - ``` - **Full Unsubscribe Response** - ``` { .json .copy } - { - "jsonrpc": "2.0", - "result": { - "stream": "v1.group", - "unsubs": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "id": 123, - "method": "subscribe" - } - ``` - ??? question "Legacy Subscribe" - **Full Subscribe Request** - ``` { .json .copy } - { - "request_id":1, - "stream":"v1.group", - "feed":["'$GRVT_SUB_ACCOUNT_ID'"], - "method":"subscribe", - "is_full":true - } - ``` - **Full Subscribe Response** - ``` { .json .copy } - { - "request_id":1, - "stream":"v1.group", - "subs":["'$GRVT_SUB_ACCOUNT_ID'"], - "unsubs":[], - "num_snapshots":[1], - "first_sequence_number":[2813] - } - ``` -
-=== "Feed Data" -
- -8<- "docs/schemas/ws_order_group_feed_data_v1.md" -
-
- !!! success - **Full Feed Response** - ``` { .json .copy } - { - "stream": "v1.group", - "selector": "'$GRVT_SUB_ACCOUNT_ID'", - "sequence_number": "872634876", - "feed": { - "group_id": "0x10000101000203040506", - "client_order_id": ["[23042, 54232]"], - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" - } - } - ``` - **Lite Feed Response** - ``` { .json .copy } - { - "s": "v1.group", - "s1": "'$GRVT_SUB_ACCOUNT_ID'", - "sn": "872634876", - "f": { - "gi": "0x10000101000203040506", - "co": ["[23042, 54232]"], - "sa": "'$GRVT_SUB_ACCOUNT_ID'" - } - } - ``` -
-=== "Errors" -
- !!! info "Error Codes" - |Code|HttpStatus| Description | - |-|-|-| - |1000|401|You need to authenticate prior to using this functionality| - |1001|403|You are not authorized to access this functionality| - |1002|500|Internal Server Error| - |1008|401|Your IP has not been whitelisted for access| - |1101|400|Feed Format must be in the format of @| - |1102|400|Wrong number of primary selectors| - |1103|400|Wrong number of secondary selectors| - |1103|400|Wrong number of secondary selectors| - |3000|400|Instrument is invalid| - |3020|400|Sub account ID must be an uint64 integer| - -8<- "docs/schemas/jsonrpc_response.md" -
-
- !!! failure "Error" - **Full Error Response** - ``` { .json .copy } - { - "jsonrpc": "2.0", - "error": { - "code": 1000, - "message": "You need to authenticate prior to using this functionality" - }, - "id": 123, - "method": "subscribe" - } - ``` - **Lite Error Response** - ``` { .json .copy } - { - "j": "2.0", - "e": { - "c": 1000, - "m": "You need to authenticate prior to using this functionality" - }, - "i": 123, - "m": "subscribe" - } - ``` - **Legacy Error Response** - ``` { .json .copy } - { - "code":1000, - "message":"You need to authenticate prior to using this functionality", - "status":401 - } - ``` -
-=== "Try it out" - -8<- "sections/auth_closed.md" - === "DEV" -
- !!! example "Subscribe Full" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "subscribe", - "params": { - "stream": "v1.group", - "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "id": 123 - } - ' -w 360 - ``` - !!! example "Unsubscribe Full" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "unsubscribe", - "params": { - "stream": "v1.group", - "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "id": 123 - } - ' -w 360 - ``` - !!! example "Legacy Subscribe Full" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "request_id":1, - "stream":"v1.group", - "feed":["'$GRVT_SUB_ACCOUNT_ID'"], - "method":"subscribe", - "is_full":true - } - ' -w 360 - ``` -
-
- !!! example "Subscribe Lite" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "subscribe", - "p": { - "s": "v1.group", - "s1": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "i": 123 - } - ' -w 360 - ``` - !!! example "Unsubscribe Lite" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "unsubscribe", - "p": { - "s": "v1.group", - "s1": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "i": 123 - } - ' -w 360 - ``` - !!! example "Legacy Subscribe Lite" - ``` { .bash .copy } - wscat -c "wss://trades.dev.gravitymarkets.io/ws" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "request_id":1, - "stream":"v1.group", - "feed":["'$GRVT_SUB_ACCOUNT_ID'"], - "method":"subscribe", - "is_full":false - } - ' -w 360 - ``` -
- === "STAGING" -
- !!! example "Subscribe Full" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "subscribe", - "params": { - "stream": "v1.group", - "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "id": 123 - } - ' -w 360 - ``` - !!! example "Unsubscribe Full" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "unsubscribe", - "params": { - "stream": "v1.group", - "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "id": 123 - } - ' -w 360 - ``` - !!! example "Legacy Subscribe Full" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "request_id":1, - "stream":"v1.group", - "feed":["'$GRVT_SUB_ACCOUNT_ID'"], - "method":"subscribe", - "is_full":true - } - ' -w 360 - ``` -
-
- !!! example "Subscribe Lite" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "subscribe", - "p": { - "s": "v1.group", - "s1": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "i": 123 - } - ' -w 360 - ``` - !!! example "Unsubscribe Lite" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "unsubscribe", - "p": { - "s": "v1.group", - "s1": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "i": 123 - } - ' -w 360 - ``` - !!! example "Legacy Subscribe Lite" - ``` { .bash .copy } - wscat -c "wss://trades.staging.gravitymarkets.io/ws" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "request_id":1, - "stream":"v1.group", - "feed":["'$GRVT_SUB_ACCOUNT_ID'"], - "method":"subscribe", - "is_full":false - } - ' -w 360 - ``` -
- === "TESTNET" -
- !!! example "Subscribe Full" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "subscribe", - "params": { - "stream": "v1.group", - "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "id": 123 - } - ' -w 360 - ``` - !!! example "Unsubscribe Full" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "unsubscribe", - "params": { - "stream": "v1.group", - "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "id": 123 - } - ' -w 360 - ``` - !!! example "Legacy Subscribe Full" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "request_id":1, - "stream":"v1.group", - "feed":["'$GRVT_SUB_ACCOUNT_ID'"], - "method":"subscribe", - "is_full":true - } - ' -w 360 - ``` -
-
- !!! example "Subscribe Lite" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "subscribe", - "p": { - "s": "v1.group", - "s1": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "i": 123 - } - ' -w 360 - ``` - !!! example "Unsubscribe Lite" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "unsubscribe", - "p": { - "s": "v1.group", - "s1": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "i": 123 - } - ' -w 360 - ``` - !!! example "Legacy Subscribe Lite" - ``` { .bash .copy } - wscat -c "wss://trades.testnet.grvt.io/ws" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "request_id":1, - "stream":"v1.group", - "feed":["'$GRVT_SUB_ACCOUNT_ID'"], - "method":"subscribe", - "is_full":false - } - ' -w 360 - ``` -
- === "PROD" -
- !!! example "Subscribe Full" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "subscribe", - "params": { - "stream": "v1.group", - "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "id": 123 - } - ' -w 360 - ``` - !!! example "Unsubscribe Full" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/full" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "jsonrpc": "2.0", - "method": "unsubscribe", - "params": { - "stream": "v1.group", - "selectors": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "id": 123 - } - ' -w 360 - ``` - !!! example "Legacy Subscribe Full" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "request_id":1, - "stream":"v1.group", - "feed":["'$GRVT_SUB_ACCOUNT_ID'"], - "method":"subscribe", - "is_full":true - } - ' -w 360 - ``` -
-
- !!! example "Subscribe Lite" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "subscribe", - "p": { - "s": "v1.group", - "s1": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "i": 123 - } - ' -w 360 - ``` - !!! example "Unsubscribe Lite" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws/lite" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "j": "2.0", - "m": "unsubscribe", - "p": { - "s": "v1.group", - "s1": ["'$GRVT_SUB_ACCOUNT_ID'"] - }, - "i": 123 - } - ' -w 360 - ``` - !!! example "Legacy Subscribe Lite" - ``` { .bash .copy } - wscat -c "wss://trades.grvt.io/ws" \ - -H "Cookie: $GRVT_COOKIE" \ - -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ - -x ' - { - "request_id":1, - "stream":"v1.group", - "feed":["'$GRVT_SUB_ACCOUNT_ID'"], - "method":"subscribe", - "is_full":false - } - ' -w 360 - ``` -
-
## Execution ### Fill ``` @@ -2600,7 +2007,8 @@ STREAM: v1.fill "venue": "ORDERBOOK", "client_order_id": "23042", "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "broker": "UNSPECIFIED" + "broker": "UNSPECIFIED", + "is_rpi": false } } ``` @@ -2630,7 +2038,8 @@ STREAM: v1.fill "v": "ORDERBOOK", "co": "23042", "s1": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "b": "UNSPECIFIED" + "b": "UNSPECIFIED", + "ir1": false } } ``` @@ -4419,26 +3828,7 @@ STREAM: v1.transfer "stream": "v1.transfer", "selector": "BTC_USDT_Perp", "sequence_number": "872634876", - "feed": { - "tx_id": "1028403", - "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "currency": "USDT", - "num_tokens": "1500.0", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890 - }, - "event_time": "1697788800000000000", - "transfer_type": "STANDARD", - "transfer_metadata": null - } + "feed": null } ``` **Lite Feed Response** @@ -4447,26 +3837,7 @@ STREAM: v1.transfer "s": "v1.transfer", "s1": "BTC_USDT_Perp", "sn": "872634876", - "f": { - "ti": "1028403", - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890 - }, - "et": "1697788800000000000", - "tt": "STANDARD", - "tm": null - } + "f": null } ```
diff --git a/artifacts/pysdk/grvt_raw_async.py b/artifacts/pysdk/grvt_raw_async.py index c9b143a..2a626a8 100644 --- a/artifacts/pysdk/grvt_raw_async.py +++ b/artifacts/pysdk/grvt_raw_async.py @@ -96,14 +96,6 @@ async def funding_rate_v1( return GrvtError(**resp) return from_dict(types.ApiFundingRateResponse, resp, Config(cast=[Enum])) - async def drop_client_ws( - self, req: types.ApiDropClientWsRequest - ) -> types.ApiDropClientWsResponse | GrvtError: - resp = await self._post(True, self.td_rpc + "/full/v1/drop_client_ws", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiDropClientWsResponse, resp, Config(cast=[Enum])) - async def create_order_v1( self, req: types.ApiCreateOrderRequest ) -> types.ApiCreateOrderResponse | GrvtError: @@ -152,22 +144,6 @@ async def order_history_v1( return GrvtError(**resp) return from_dict(types.ApiOrderHistoryResponse, resp, Config(cast=[Enum])) - async def pre_order_check_v1( - self, req: types.ApiPreOrderCheckRequest - ) -> types.ApiPreOrderCheckResponse | GrvtError: - resp = await self._post(True, self.td_rpc + "/full/v1/pre_order_check", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiPreOrderCheckResponse, resp, Config(cast=[Enum])) - - async def dedust_position_v1( - self, req: types.ApiDedustPositionRequest - ) -> types.ApiDedustPositionResponse | GrvtError: - resp = await self._post(True, self.td_rpc + "/full/v1/dedust_position", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiDedustPositionResponse, resp, Config(cast=[Enum])) - async def cancel_on_disconnect_v1( self, req: types.ApiCancelOnDisconnectRequest ) -> types.AckResponse | GrvtError: @@ -176,22 +152,6 @@ async def cancel_on_disconnect_v1( return GrvtError(**resp) return from_dict(types.AckResponse, resp, Config(cast=[Enum])) - async def create_bulk_orders_v1( - self, req: types.ApiCreateBulkOrdersRequest - ) -> types.ApiCreateBulkOrdersResponse | GrvtError: - resp = await self._post(True, self.td_rpc + "/full/v1/create_bulk_orders", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiCreateBulkOrdersResponse, resp, Config(cast=[Enum])) - - async def get_order_group_v1( - self, req: types.ApiGetOrderGroupRequest - ) -> types.ApiGetOrderGroupResponse | GrvtError: - resp = await self._post(True, self.td_rpc + "/full/v1/order_group", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiGetOrderGroupResponse, resp, Config(cast=[Enum])) - async def fill_history_v1( self, req: types.ApiFillHistoryRequest ) -> types.ApiFillHistoryResponse | GrvtError: @@ -230,11 +190,11 @@ async def deposit_history_v1( async def transfer_v1( self, req: types.ApiTransferRequest - ) -> types.AckResponse | GrvtError: + ) -> types.ApiTransferResponse | GrvtError: resp = await self._post(True, self.td_rpc + "/full/v1/transfer", req) if resp.get("code"): return GrvtError(**resp) - return from_dict(types.AckResponse, resp, Config(cast=[Enum])) + return from_dict(types.ApiTransferResponse, resp, Config(cast=[Enum])) async def transfer_history_v1( self, req: types.ApiTransferHistoryRequest @@ -260,14 +220,6 @@ async def withdrawal_history_v1( return GrvtError(**resp) return from_dict(types.ApiWithdrawalHistoryResponse, resp, Config(cast=[Enum])) - async def pre_deposit_check_v1( - self, req: types.ApiPreDepositCheckRequest - ) -> types.ApiPreDepositCheckResponse | GrvtError: - resp = await self._post(True, self.td_rpc + "/full/v1/pre_deposit_check", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiPreDepositCheckResponse, resp, Config(cast=[Enum])) - async def sub_account_summary_v1( self, req: types.ApiSubAccountSummaryRequest ) -> types.ApiSubAccountSummaryResponse | GrvtError: @@ -308,16 +260,6 @@ async def funding_account_summary_v1( types.ApiFundingAccountSummaryResponse, resp, Config(cast=[Enum]) ) - async def socialized_loss_status_v1( - self, req: types.EmptyRequest - ) -> types.ApiSocializedLossStatusResponse | GrvtError: - resp = await self._post( - True, self.td_rpc + "/full/v1/socialized_loss_status", req - ) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiSocializedLossStatusResponse, resp, Config(cast=[Enum])) - async def get_all_initial_leverage_v1( self, req: types.ApiGetAllInitialLeverageRequest ) -> types.ApiGetAllInitialLeverageResponse | GrvtError: @@ -337,21 +279,3 @@ async def set_initial_leverage_v1( if resp.get("code"): return GrvtError(**resp) return from_dict(types.ApiSetInitialLeverageResponse, resp, Config(cast=[Enum])) - - async def get_margin_tiers_v1( - self, req: types.EmptyRequest - ) -> types.ApiGetMarginTiersResponse | GrvtError: - resp = await self._post(True, self.td_rpc + "/full/v1/get_margin_tiers", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiGetMarginTiersResponse, resp, Config(cast=[Enum])) - - async def query_trading_performance_v1( - self, req: types.ApiQueryTradingPerformanceRequest - ) -> types.ApiQueryTradingPerformanceResponse | GrvtError: - resp = await self._post(True, self.td_rpc + "/full/v1/trading_performance", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict( - types.ApiQueryTradingPerformanceResponse, resp, Config(cast=[Enum]) - ) diff --git a/artifacts/pysdk/grvt_raw_sync.py b/artifacts/pysdk/grvt_raw_sync.py index 7d078f3..61b979c 100644 --- a/artifacts/pysdk/grvt_raw_sync.py +++ b/artifacts/pysdk/grvt_raw_sync.py @@ -94,14 +94,6 @@ def funding_rate_v1( return GrvtError(**resp) return from_dict(types.ApiFundingRateResponse, resp, Config(cast=[Enum])) - def drop_client_ws( - self, req: types.ApiDropClientWsRequest - ) -> types.ApiDropClientWsResponse | GrvtError: - resp = self._post(True, self.td_rpc + "/full/v1/drop_client_ws", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiDropClientWsResponse, resp, Config(cast=[Enum])) - def create_order_v1( self, req: types.ApiCreateOrderRequest ) -> types.ApiCreateOrderResponse | GrvtError: @@ -150,22 +142,6 @@ def order_history_v1( return GrvtError(**resp) return from_dict(types.ApiOrderHistoryResponse, resp, Config(cast=[Enum])) - def pre_order_check_v1( - self, req: types.ApiPreOrderCheckRequest - ) -> types.ApiPreOrderCheckResponse | GrvtError: - resp = self._post(True, self.td_rpc + "/full/v1/pre_order_check", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiPreOrderCheckResponse, resp, Config(cast=[Enum])) - - def dedust_position_v1( - self, req: types.ApiDedustPositionRequest - ) -> types.ApiDedustPositionResponse | GrvtError: - resp = self._post(True, self.td_rpc + "/full/v1/dedust_position", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiDedustPositionResponse, resp, Config(cast=[Enum])) - def cancel_on_disconnect_v1( self, req: types.ApiCancelOnDisconnectRequest ) -> types.AckResponse | GrvtError: @@ -174,22 +150,6 @@ def cancel_on_disconnect_v1( return GrvtError(**resp) return from_dict(types.AckResponse, resp, Config(cast=[Enum])) - def create_bulk_orders_v1( - self, req: types.ApiCreateBulkOrdersRequest - ) -> types.ApiCreateBulkOrdersResponse | GrvtError: - resp = self._post(True, self.td_rpc + "/full/v1/create_bulk_orders", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiCreateBulkOrdersResponse, resp, Config(cast=[Enum])) - - def get_order_group_v1( - self, req: types.ApiGetOrderGroupRequest - ) -> types.ApiGetOrderGroupResponse | GrvtError: - resp = self._post(True, self.td_rpc + "/full/v1/order_group", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiGetOrderGroupResponse, resp, Config(cast=[Enum])) - def fill_history_v1( self, req: types.ApiFillHistoryRequest ) -> types.ApiFillHistoryResponse | GrvtError: @@ -224,11 +184,13 @@ def deposit_history_v1( return GrvtError(**resp) return from_dict(types.ApiDepositHistoryResponse, resp, Config(cast=[Enum])) - def transfer_v1(self, req: types.ApiTransferRequest) -> types.AckResponse | GrvtError: + def transfer_v1( + self, req: types.ApiTransferRequest + ) -> types.ApiTransferResponse | GrvtError: resp = self._post(True, self.td_rpc + "/full/v1/transfer", req) if resp.get("code"): return GrvtError(**resp) - return from_dict(types.AckResponse, resp, Config(cast=[Enum])) + return from_dict(types.ApiTransferResponse, resp, Config(cast=[Enum])) def transfer_history_v1( self, req: types.ApiTransferHistoryRequest @@ -254,14 +216,6 @@ def withdrawal_history_v1( return GrvtError(**resp) return from_dict(types.ApiWithdrawalHistoryResponse, resp, Config(cast=[Enum])) - def pre_deposit_check_v1( - self, req: types.ApiPreDepositCheckRequest - ) -> types.ApiPreDepositCheckResponse | GrvtError: - resp = self._post(True, self.td_rpc + "/full/v1/pre_deposit_check", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiPreDepositCheckResponse, resp, Config(cast=[Enum])) - def sub_account_summary_v1( self, req: types.ApiSubAccountSummaryRequest ) -> types.ApiSubAccountSummaryResponse | GrvtError: @@ -298,14 +252,6 @@ def funding_account_summary_v1( types.ApiFundingAccountSummaryResponse, resp, Config(cast=[Enum]) ) - def socialized_loss_status_v1( - self, req: types.EmptyRequest - ) -> types.ApiSocializedLossStatusResponse | GrvtError: - resp = self._post(True, self.td_rpc + "/full/v1/socialized_loss_status", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiSocializedLossStatusResponse, resp, Config(cast=[Enum])) - def get_all_initial_leverage_v1( self, req: types.ApiGetAllInitialLeverageRequest ) -> types.ApiGetAllInitialLeverageResponse | GrvtError: @@ -323,21 +269,3 @@ def set_initial_leverage_v1( if resp.get("code"): return GrvtError(**resp) return from_dict(types.ApiSetInitialLeverageResponse, resp, Config(cast=[Enum])) - - def get_margin_tiers_v1( - self, req: types.EmptyRequest - ) -> types.ApiGetMarginTiersResponse | GrvtError: - resp = self._post(True, self.td_rpc + "/full/v1/get_margin_tiers", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict(types.ApiGetMarginTiersResponse, resp, Config(cast=[Enum])) - - def query_trading_performance_v1( - self, req: types.ApiQueryTradingPerformanceRequest - ) -> types.ApiQueryTradingPerformanceResponse | GrvtError: - resp = self._post(True, self.td_rpc + "/full/v1/trading_performance", req) - if resp.get("code"): - return GrvtError(**resp) - return from_dict( - types.ApiQueryTradingPerformanceResponse, resp, Config(cast=[Enum]) - ) diff --git a/artifacts/pysdk/grvt_raw_types.py b/artifacts/pysdk/grvt_raw_types.py index 8d3196d..458093f 100644 --- a/artifacts/pysdk/grvt_raw_types.py +++ b/artifacts/pysdk/grvt_raw_types.py @@ -13,6 +13,8 @@ class BridgeType(Enum): # XY Bridge type XY = "XY" + # Rhino Bridge type + RHINO = "RHINO" class BrokerTag(Enum): @@ -286,6 +288,10 @@ class OrderRejectReason(Enum): CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED = "CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED" # the OCO counter part order was triggered OCO_COUNTER_PART_TRIGGERED = "OCO_COUNTER_PART_TRIGGERED" + # the remaining order size was cancelled because it exceeded current position size + REDUCE_ONLY_LIMIT = "REDUCE_ONLY_LIMIT" + # the order was replaced by a client replace request + CLIENT_REPLACE = "CLIENT_REPLACE" class OrderStatus(Enum): @@ -344,6 +350,19 @@ class TimeInForce(Enum): IMMEDIATE_OR_CANCEL = "IMMEDIATE_OR_CANCEL" # FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it FILL_OR_KILL = "FILL_OR_KILL" + # RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users. + RETAIL_PRICE_IMPROVEMENT = "RETAIL_PRICE_IMPROVEMENT" + + +class TimeInterval(Enum): + # 1 day + INTERVAL_1_D = "INTERVAL_1_D" + # 7 days + INTERVAL_7_D = "INTERVAL_7_D" + # 30 days + INTERVAL_30_D = "INTERVAL_30_D" + # 90 days + INTERVAL_90_D = "INTERVAL_90_D" class TransferType(Enum): @@ -353,6 +372,10 @@ class TransferType(Enum): FAST_ARB_DEPOSIT = "FAST_ARB_DEPOSIT" # Fast Arb Withdrawal Metadata type FAST_ARB_WITHDRAWAL = "FAST_ARB_WITHDRAWAL" + # Transfer type for non native bridging deposit + NON_NATIVE_BRIDGE_DEPOSIT = "NON_NATIVE_BRIDGE_DEPOSIT" + # Transfer type for non native bridging withdrawal + NON_NATIVE_BRIDGE_WITHDRAWAL = "NON_NATIVE_BRIDGE_WITHDRAWAL" class TriggerBy(Enum): @@ -389,6 +412,13 @@ class TriggerType(Enum): STOP_LOSS = "STOP_LOSS" +class VaultType(Enum): + # Prime vault + PRIME = "PRIME" + # Launchpad vault + LAUNCH_PAD = "LAUNCH_PAD" + + class Venue(Enum): # the trade is cleared on the orderbook venue ORDERBOOK = "ORDERBOOK" @@ -548,6 +578,8 @@ class Fill: client_order_id: str # The address (public key) of the wallet signing the payload signer: str + # If the trade is a RPI trade + is_rpi: bool # Specifies the broker who brokered the order broker: BrokerTag | None = None @@ -712,23 +744,6 @@ class ApiSubAccountHistoryResponse: next: str -@dataclass -class ApiLatestSnapSubAccountsRequest: - """ - The request to get the latest snapshot of list sub account - - """ - - # The list of sub account ids to query - sub_account_i_ds: list[str] - - -@dataclass -class ApiLatestSnapSubAccountsResponse: - # The sub account history matching the request sub account - result: list[SubAccount] - - @dataclass class AggregatedAccountSummary: # The main account ID of the account to which the summary belongs @@ -745,42 +760,12 @@ class ApiAggregatedAccountSummaryResponse: result: AggregatedAccountSummary -@dataclass -class FundingAccountSummary: - # The main account ID of the account to which the summary belongs - main_account_id: str - # Total equity of the main account, denominated in USD - total_equity: str - # The list of spot assets owned by this main account, and their balances - spot_balances: list[SpotBalance] - - @dataclass class ApiFundingAccountSummaryResponse: # The funding account summary result: FundingAccountSummary -@dataclass -class ApiSocializedLossStatusResponse: - # Whether the socialized loss is active - is_active: bool - # The socialized loss haircut ratio in centi-beeps - haircut_ratio: str - - -@dataclass -class ApiListAggregatedAccountSummaryRequest: - # The list of main account ID to request for - main_account_ids: list[bytes] - - -@dataclass -class ApiListAggregatedAccountSummaryResponse: - # The list of aggregated account summaries of requested main accounts - account_summaries: list[ApiAggregatedAccountSummaryResponse] - - @dataclass class ApiSetInitialLeverageRequest: # The sub account ID to set the leverage for @@ -1015,6 +1000,8 @@ class Trade: trade_id: str # The venue where the trade occurred venue: Venue + # If the trade is a RPI trade + is_rpi: bool @dataclass @@ -1201,6 +1188,8 @@ class FundingRate: funding_time: str # The mark price of the instrument at funding timestamp, expressed in `9` decimals mark_price: str + # The 8h average funding rate of the instrument, expressed in percentage points + funding_rate_8_h_avg: str @dataclass @@ -1211,48 +1200,6 @@ class ApiFundingRateResponse: next: str | None = None -@dataclass -class ApiSettlementPriceRequest: - """ - Lookup the historical settlement price of various pairs. - - Pagination works as follows:
  • We perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.
  • 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.
  • If a `cursor` is provided, it will be used to fetch results from that point onwards.
  • 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.
- """ - - # The base currency to select - base: Currency - # The quote currency to select - quote: Currency - # Start time of settlement price in unix nanoseconds - start_time: str | None = None - # End time of settlement price in unix nanoseconds - end_time: str | None = None - # The limit to query for. Defaults to 500; Max 1000 - limit: int | None = None - # The cursor to indicate when to start the query from - cursor: str | None = None - - -@dataclass -class APISettlementPrice: - # The base currency of the settlement price - base: Currency - # The quote currency of the settlement price - quote: Currency - # The settlement timestamp of the settlement price, expressed in unix nanoseconds - settlement_time: str - # The settlement price, expressed in `9` decimals - settlement_price: str - - -@dataclass -class ApiSettlementPriceResponse: - # The funding rate result set for given interval - result: list[APISettlementPrice] - # The cursor to indicate when to start the next query from - next: str | None = None - - @dataclass class JSONRPCRequest: """ @@ -1547,12 +1494,6 @@ class WSTickerFeedDataV1: prev_sequence_number: str -@dataclass -class ApiTickerFeedDataV1: - # The mini ticker matching the request asset - result: Ticker - - @dataclass class WSTradeFeedSelectorV1: # The readable instrument name:
  • Perpetual: `ETH_USDT_Perp`
  • Future: `BTC_USDT_Fut_20Oct23`
  • Call: `ETH_USDT_Call_20Oct23_2800`
  • Put: `ETH_USDT_Put_20Oct23_2800`
@@ -1660,36 +1601,6 @@ class ApiGetAllInstrumentsResponse: result: list[Instrument] -@dataclass -class SnapFundingAccountSummary: - # Time at which the event was emitted in unix nanoseconds - event_time: str - # The start of the interval in unix nanoseconds - start_interval: str - # The main account ID of the account to which the summary belongs - main_account_id: str - # Total equity of the main account, denominated in USD - total_equity: str - # The list of spot assets owned by this main account, and their balances - spot_balances: list[SpotBalance] - - -@dataclass -class ApiQueryTradingPerformanceRequest: - # The asset to filter by - asset: bytes - # Optional: The subaccount ID to filter by - sub_account_id: str | None = None - - -@dataclass -class ApiQueryTradingPerformanceResponse: - # Trading volume in USDT - trading_volume: str - # Realized PnL in USDT - realized_pnl: str - - @dataclass class OrderLeg: # The instrument to trade in this leg @@ -1743,6 +1654,8 @@ class TPSLOrderMetadata: trigger_by: TriggerBy # The Trigger Price of the order, expressed in `9` decimals. trigger_price: str + # If True, the order will close the position when the trigger price is reached + close_position: bool @dataclass @@ -1900,12 +1813,6 @@ class ApiCancelOrderRequest: time_to_live_ms: str | None = None -@dataclass -class ApiCancelOrderResponse: - # The cancelled order - result: Order - - @dataclass class ApiCancelAllOrdersRequest: # The subaccount ID cancelling all orders @@ -1918,12 +1825,6 @@ class ApiCancelAllOrdersRequest: quote: list[Currency] | None = None -@dataclass -class ApiCancelAllOrdersResponse: - # The number of orders cancelled - result: int - - @dataclass class ApiOpenOrdersRequest: # The subaccount ID to filter by @@ -1993,22 +1894,6 @@ class AckResponse: result: Ack -@dataclass -class ApiOrderStateRequest: - # The subaccount ID to filter by - sub_account_id: str - # Filter for `order_id` - order_id: str | None = None - # Filter for `client_order_id` - client_order_id: str | None = None - - -@dataclass -class ApiOrderStateResponse: - # The order state for the requested filter - state: OrderState - - @dataclass class ApiGetOrderRequest: # The subaccount ID to filter by @@ -2025,96 +1910,6 @@ class ApiGetOrderResponse: result: Order -@dataclass -class ApiPreOrderCheckRequest: - # The subaccount ID of orders to query - sub_account_id: str - # The order to do pre-order check - orders: list[Order] - - -@dataclass -class AssetMaxQty: - # The asset associated with the max quantity - asset: str - # The maximum buy quantity - max_buy_qty: str - # The maximum sell quantity - max_sell_qty: str - - -@dataclass -class PreOrderCheckResult: - # The maximum quantity for each leg - max_qty: list[AssetMaxQty] - # The margin required for the order (reported in `settle_currency`) - margin_required: str - # Whether the order is valid - order_valid: bool - # The reason the order is invalid, if any - reason: str - # The subAccount settle currency - settle_currency: Currency - - -@dataclass -class ApiPreOrderCheckResponse: - # Pre order check for each new order in the request - results: list[PreOrderCheckResult] - - -@dataclass -class ApiPreDepositCheckRequest: - # The currency you hold the deposit in - currency: Currency - # The bridge type to conduct checks for - bridge: BridgeType - - -@dataclass -class ApiPreDepositCheckResponse: - # Max Deposit Limit reported for the Bridge Account reported in the currency balance - max_deposit_limit: str - # The currency you hold the deposit in - currency: Currency - - -@dataclass -class ApiDedustPositionRequest: - # The order to create - order: Order - - -@dataclass -class ApiDedustPositionResponse: - # The created order - result: Order - - -@dataclass -class ApiCreateBulkOrdersRequest: - """ - Create multiple orders simultaneously for this trading account. - - This endpoint supports the following order scenarios: - - One-Cancels-Other (OCO) orders combining TP/SL - - One-Sends-Other (OSO) orders - - Usage: - - For OCO (TP/SL pair): Send exactly 2 orders in the same request - one Take Profit and one Stop Loss order - - For OSO: Send exactly one main order and one contingent order (TP and/or SL) - """ - - # The orders to create - orders: list[Order] - - -@dataclass -class ApiCreateBulkOrdersResponse: - # The created orders in same order as requested - result: list[Order] - - @dataclass class ApiCancelOnDisconnectRequest: """ @@ -2145,661 +1940,6 @@ class ApiCancelOnDisconnectRequest: countdown_time: str | None = None -@dataclass -class ApiGetOrderGroupRequest: - """ - Retrieves the grouping of non-cancelled, non-filled client orders for a given subaccount when the grouping exist. - - helping to identify TP/SL pairs or other order relationships within the account. - """ - - # The subaccount ID for which the order groups should be retrieved. - sub_account_id: str - - -@dataclass -class ClientOrderIDsByGroup: - """ - Grouping for the client order id and their associated groups. - - This is used to define TP/SL pairs or other order groupings after loading the list of Open Orders. - """ - - # The group this order belongs to. It can be used to define TP/SL pairs or other order groupings - group_id: str - # List of client order IDs in the group - client_order_id: list[str] - # The sub account ID that these orders belong to - sub_account_id: str - - -@dataclass -class ApiGetOrderGroupResponse: - """ - A list of client orders grouped by their associated order group. - Each entry in the list contains a `groupID` and the corresponding `clientOrderID`s - that belong to that group. - """ - - result: list[ClientOrderIDsByGroup] - - -@dataclass -class ApiGetUserEcosystemPointRequest: - # The off chain account id - account_id: str - # Start time of the epoch - phase - calculate_from: str - # Include user rank in the response - include_user_rank: bool - - -@dataclass -class EcosystemPoint: - # The off chain account id - account_id: str - # The main account id - main_account_id: str - # Total ecosystem point - total_point: str - # Direct invite count - direct_invite_count: int - # Indirect invite count - indirect_invite_count: int - # Direct invite trading volume - direct_invite_trading_volume: str - # Indirect invite trading volume - indirect_invite_trading_volume: str - # The time when the ecosystem point is calculated - calculate_at: str - # Start time of the epoch - phase - calculate_from: str - # End time of the epoch - phase - calculate_to: str - # The rank of the account in the ecosystem - rank: int - # The epoch number of the ecosystem point - epoch: int - # Brokered trading volume - brokered_trading_volume: str - # Brokered trading point - brokered_trading_point: str - # Referee KYC point - referee_kyc_point: str - # Referrer KYC point - referrer_kyc_point: str - - -@dataclass -class ApiGetUserEcosystemPointResponse: - # The list of ecosystem points - points: list[EcosystemPoint] - - -@dataclass -class ApiGetEcosystemLeaderboardRequest: - # Start time of the epoch - phase - calculate_from: str - # The number of accounts to return - limit: int - - -@dataclass -class ApiGetVerifiedEcosystemLeaderboardRequest: - # Start time of the epoch - calculate_from: str - # Completed KYC before this time - completed_kyc_before: str - - -@dataclass -class ApiGetEcosystemLeaderboardResponse: - # The list of ecosystem points - points: list[EcosystemPoint] - - -@dataclass -class ApiGetEcosystemReferralStatResponse: - # Direct invite count - direct_invite_count: int - # Indirect invite count - indirect_invite_count: int - # Total volume traded by direct invites multiple by 1e9 - direct_invite_trading_volume: str - # Total volume traded by indirect invites multiple by 1e9 - indirect_invite_trading_volume: str - - -@dataclass -class ApiResolveEpochEcosystemMetricResponse: - # The name of the epoch - epoch_name: str - # Ecosystem points up to the most recently calculated time within this epoch - point: int - # The time in unix nanoseconds when the ecosystem points were last calculated - last_calculated_time: str - - -@dataclass -class EcosystemMetric: - # Direct invite count - direct_invite_count: int - # Indirect invite count - indirect_invite_count: int - # Direct invite trading volume - direct_invite_trading_volume: str - # Indirect invite trading volume - indirect_invite_trading_volume: str - # Total ecosystem point of this epoch/phase - total_point: str - - -@dataclass -class ApiFindFirstEpochMetricResponse: - # Phase zero metric - phase_zero_metric: EcosystemMetric - # Phase one metric - phase_one_metric: EcosystemMetric - # The rank of the account in the ecosystem - rank: int - # The total number of accounts in the ecosystem - total: int - # Total ecosystem point of the first epoch - total_point: str - # The time when the ecosystem points were last calculated - last_calculated_at: str - - -@dataclass -class ApiFindEcosystemEpochMetricResponse: - # The epoch metric - metric: EcosystemMetric - # The rank of the account in the ecosystem - rank: int - # The total number of accounts in the ecosystem - total: int - # The time when the ecosystem points were last calculated - last_calculated_at: str - # Direct invite count without relying on epochs - total_direct_invite_count: int - # Indirect invite count without relying on epochs - total_indirect_invite_count: int - - -@dataclass -class EcosystemLeaderboardUser: - # The off chain account id - account_id: str - # The rank of the account in the ecosystem - rank: int - # Total ecosystem point - total_point: str - # The twitter username of the account - twitter_username: str - - -@dataclass -class ApiFindEcosystemLeaderboardResponse: - # The list of ecosystem leaderboard users - users: list[EcosystemLeaderboardUser] - - -@dataclass -class QueryFindEpochRequest: - # The time to query the epoch - time: str | None = None - # The epoch number - epoch: int | None = None - - -@dataclass -class Epoch: - # The epoch number - epoch: int - # The start time of the epoch - start_time: str - # The end time of the epoch - end_time: str - - -@dataclass -class QueryFindEpochResponse: - # The epoch - epoch: Epoch - - -@dataclass -class QueryGetListEpochRequest: - # The limit to query for - limit: int | None = None - - -@dataclass -class QueryGetListEpochResponse: - # The list of epochs - result: list[Epoch] - - -@dataclass -class QueryEpochBadgeRequest: - # The off chain account id to get referral stats - account_id: str | None = None - # The numerical epoch index - epoch: int | None = None - # The type of the reward program - type: RewardProgramType | None = None - # The limit to query for. Defaults to 500; Max 1000 - limit: int | None = None - # The cursor to indicate when to start the query from - cursor: str | None = None - - -@dataclass -class EpochBadge: - # The off chain account id - account_id: str - # The account ID - main_account_id: str - # The type of the reward program - type: RewardProgramType - # The epoch number - epoch: int - # The start time of the epoch - epoch_start_time: str - # The end time of the epoch - epoch_end_time: str - # The type of the badge - badge: EpochBadgeType - # The distributed badges - distributed_badges: list[EpochBadgeType] - # Total point - total_point: str - # Rank - rank: int - # The time when the badge was claimed, or the epoch end time if the user has already completed the KYC process - claimed_at: str - - -@dataclass -class QueryEpochBadgeResponse: - # The list of epoch badges - result: list[EpochBadge] - # The cursor to indicate when to start the query from - next: str - - -@dataclass -class QueryEpochBadgePointDistributionRequest: - # The type of the reward program - type: RewardProgramType - # The numerical epoch index - epoch: int | None = None - - -@dataclass -class EpochBadgePointDistribution: - # The type of the badge - badge: EpochBadgeType - # The epoch number - epoch: int - # The type of the reward program - type: RewardProgramType - # The minimum point to get the badge - min_point: str - # The maximum point to get the badge - max_point: str - # The minimum rank to get the badge - min_rank: int - # The maximum rank to get the badge - max_rank: int - # The total point to get the badge - total_point: str - # The number of users to get the badge - count: int - - -@dataclass -class QueryEpochBadgePointDistributionResponse: - # The list of epoch badges - result: list[EpochBadgePointDistribution] - - -@dataclass -class ApiGetListEpochBadgeResponse: - # The list of epoch badges - result: list[EpochBadge] - - -@dataclass -class GetClaimableEcosystemBadgeResponse: - # The epoch badge - badge: EpochBadge - # Whether the badge is claimable - is_claimable: bool - # The time when the badge is claimable - claimable_until: str - - -@dataclass -class ClaimEcosystemBadgeResponse: - # The epoch badge - badge: EpochBadge - - -@dataclass -class ApiGetListFlatReferralRequest: - # The off chain referrer account id to get all flat referrals - referral_id: str - # The off chain account id to get all user's referrers - account_id: str - # Optional. Start time in unix nanoseconds - start_time: str | None = None - # Optional. End time in unix nanoseconds - end_time: str | None = None - - -@dataclass -class FlatReferral: - # The off chain account id - account_id: str - # The off chain referrer account id - referrer_id: str - # The referrer level; 1: direct referrer, 2: indirect referrer - referrer_level: int - # The account creation time - account_create_time: str - # The main account id - main_account_id: str - # The referrer main account id - referrer_main_account_id: str - # The account is a business account or not - is_business: bool - # The account is KYC verified or not - is_kyc_completed: bool - # The KYC completed time - kyc_completed_at: str - # The KYC type, can be 'individual' or 'business' - kyc_type: str - # The first KYC completed time - kyc_first_completed_at: str - - -@dataclass -class ApiGetListFlatReferralResponse: - # The list of flat referrals - flat_referrals: list[FlatReferral] - - -@dataclass -class ApiQueryFlatReferralStatRequest: - # The off chain account id to get referral stats - account_id: str - - -@dataclass -class ApiQueryFlatReferralStatResponse: - # Direct invite count - direct_invite_count: int - # Indirect invite count - indirect_invite_count: int - - -@dataclass -class LPSnapshot: - # The main account id - main_account_id: str - # The LP Asset - lp_asset: str - # Underlying multiplier - underlying_multiplier: str - # Maker trading volume - maker_trading_volume: str - # Fast market multiplier - bid_fast_market_multiplier: int - # Fast market multiplier - ask_fast_market_multiplier: int - # Liquidity score - liquidity_score: str - # The time when the snapshot was calculated - calculate_at: str - - -@dataclass -class ApproximateLPSnapshot: - # The main account id - main_account_id: str - # Underlying multiplier - underlying_multiplier: str - # Market share multiplier - market_share_multiplier: str - # Fast market multiplier - bid_fast_market_multiplier: int - # Fast market multiplier - ask_fast_market_multiplier: int - # Liquidity score - liquidity_score: str - # The time when the snapshot was calculated - calculate_at: str - - -@dataclass -class LPPoint: - # The main account id - main_account_id: str - # Liquidity score - liquidity_score: str - # The rank of user in the LP leaderboard - rank: int - - -@dataclass -class ApproximateLPPoint: - # The off chain account id - off_chain_account_id: str - # Liquidity score - liquidity_score: str - # The rank of user in the LP leaderboard - rank: int - - -@dataclass -class QueryGetLatestLPSnapshotResponse: - # The latest LP snapshot - snapshot: LPSnapshot - - -@dataclass -class ApiGetLatestLPSnapshotRequest: - # The kind filter to apply - kind: Kind | None = None - # The base filter to apply - base: Currency | None = None - - -@dataclass -class ApiGetLatestLPSnapshotResponse: - # The latest LP snapshot - snapshot: ApproximateLPSnapshot - - -@dataclass -class ApiGetLPLeaderboardRequest: - # The number of accounts to return - limit: int - # The kind filter to apply - kind: Kind - # The base filter to apply - base: Currency - # The epoch to filter - epoch: int | None = None - - -@dataclass -class ApiGetLPLeaderboardResponse: - # The list of LP points - points: list[ApproximateLPPoint] - - -@dataclass -class ApiGetLPPointRequest: - # The epoch to filter - epoch: int | None = None - # Optional. The kind filter to apply - kind: Kind | None = None - # Optional. The base filter to apply - base: Currency | None = None - - -@dataclass -class ApiGetLPPointResponse: - # LP points of user - point: LPPoint - # The number of maker - maker_count: int - - -@dataclass -class ApiGetLPInfoRequest: - # The kind filter to apply - kind: Kind - # The base filter to apply - base: Currency | None = None - - -@dataclass -class ApiGetLPInfoResponse: - # Is LP maker - is_lp_maker: bool - # The spread score value multiplier - spread_score_value_multiplier: str - # The depth score value multiplier - depth_score_value_multiplier: str - # The market share value multiplier - market_share_value_multiplier: str - # Underlying multiplier - underlying_multiplier: str - # The market share multiplier, equal to the maker trading volume in the past 2 hours - market_share_multiplier: str - # Ask fast market multiplier - ask_fast_market_multiplier: int - # Bid fast market multiplier - bid_fast_market_multiplier: int - - -@dataclass -class RewardEpochInfo: - # The epoch number - epoch: int - # The start time of the epoch - epoch_start_time: str - # The end time of the epoch - epoch_end_time: str - # The status of the epoch - status: RewardEpochStatus - - -@dataclass -class ApiGetListRewardEpochResponse: - # The list of epoch for ecosystem reward - ecosystem_epochs: list[RewardEpochInfo] - # The list of epoch for trader reward and lp reward - trading_epochs: list[RewardEpochInfo] - - -@dataclass -class ApiSubAccountTradeAggregationRequest: - # Optional. The limit of the number of results to return - limit: int - # The interval of each sub account trade - interval: SubAccountTradeInterval - # The list of sub account ids to query - sub_account_i_ds: list[str] - # Optional. The starting time in unix nanoseconds of a specific interval to query - start_interval: str - # Filter on the maker of the trade - is_maker: bool - # Filter on the taker of the trade - is_taker: bool - # Whether to group trades by signer per sub account - group_by_signer: bool - # Optional. Start time in unix nanoseconds - start_time: str | None = None - # Optional. End time in unix nanoseconds - end_time: str | None = None - # The cursor to indicate when to start the next query from - cursor: str | None = None - - -@dataclass -class SubAccountTradeAggregation: - # The sub account id - sub_account_id: str - # Total fee paid - total_fee: str - # Total volume traded - total_trade_volume: str - # Number of trades - num_traded: str - # Total positive fee paid by user - positive_fee: str - # The signer of the trade - signer: str - # Realized PnL - realized_pnl: str - - -@dataclass -class ApiSubAccountTradeAggregationResponse: - # The sub account trade aggregation result set for given interval - result: list[SubAccountTradeAggregation] - # The cursor to indicate when to start the next query from - next: str | None = None - - -@dataclass -class ApiGetTraderStatResponse: - # Total fee paid - total_fee: str - - -@dataclass -class TraderMetric: - # Total fee paid - total_fee: str - # Total trader point of this epoch/phase - total_point: float - - -@dataclass -class ApiFindTraderEpochMetricResponse: - # Phase zero metric - metric: TraderMetric - # The rank of the account in the trader - rank: int - # The total number of accounts in the trader - total: int - # The time when the trader points were last calculated - last_calculated_at: str - - -@dataclass -class TraderLeaderboardUser: - # The off chain account id - account_id: str - # The rank of the account in the Trader - rank: int - # Total Trader point - total_point: float - # The twitter username of the account - twitter_username: str - - -@dataclass -class ApiFindTraderLeaderboardResponse: - # The list of trader leaderboard users - users: list[TraderLeaderboardUser] - - @dataclass class WSOrderFeedSelectorV1: """ @@ -2968,32 +2108,6 @@ class WSTransferFeedSelectorV1: sub_account_id: str | None = None -@dataclass -class TransferHistory: - # The transaction ID of the transfer - tx_id: str - # The account to transfer from - from_account_id: str - # The subaccount to transfer from (0 if transferring from main account) - from_sub_account_id: str - # The account to deposit into - to_account_id: str - # The subaccount to transfer to (0 if transferring to main account) - to_sub_account_id: str - # The token currency to transfer - currency: Currency - # The number of tokens to transfer - num_tokens: str - # The signature of the transfer - signature: Signature - # The timestamp of the transfer in unix nanoseconds - event_time: str - # The type of transfer - transfer_type: TransferType - # The metadata of the transfer - transfer_metadata: str - - @dataclass class WSTransferFeedDataV1: # The websocket channel to which the response is sent @@ -3157,167 +2271,6 @@ class WSCancelFeedSelectorV1: sub_account_id: str -@dataclass -class WSOrderGroupFeedSelectorV1: - """ - Subscribes to a feed of order group to get updated when a new group is created for the subAccount specified. - - """ - - # The subaccount ID to filter by - sub_account_id: str - - -@dataclass -class WSOrderGroupFeedDataV1: - # Stream name - stream: str - # Primary selector - selector: str - """ - A sequence number used to determine message order within a stream. - - If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts. - - If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster. - - A single cluster payload can be multiplexed into multiple stream payloads. - - To distinguish each stream payload, a `dedupCounter` is included. - - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`. - """ - sequence_number: str - # The order object being created or updated - feed: ClientOrderIDsByGroup - # The previous sequence number that determines the message order - prev_sequence_number: str - - -@dataclass -class ApiDropClientWsRequest: - main_account_id: str - - -@dataclass -class ApiDropClientWsResponse: - num_dropped: int - - -@dataclass -class MarginTierResponse: - lower_bound: str - rate: str - - -@dataclass -class AssetMarginTierResponse: - asset: str - tiers: list[MarginTierResponse] - - -@dataclass -class ApiGetMarginTiersResponse: - results: list[AssetMarginTierResponse] - - -@dataclass -class SessionInformation: - # country code of user based on IP address - country_code: str - # unique identity of the session generated from client - client_session_id: str - # screen size - device_screen_size: str - # OS of user's device - device_os: str - # OS version of user's device - device_os_version: str - - -@dataclass -class UserVaultCategoryEventPayLoad: - # category ID of event - category_id: str - # vault ID - vault_id: str - # action of event. search/filter/invest... - action: str - # number of bumps in this event. default 1 - num_bumps: str - - -@dataclass -class ApiUserCategoryAffinityScoreRequest: - # The off chain account id - account_id: str - # The start time of query. Can leave empty to query from the beginning - start_time: str - # The end time of query. Can leave empty to query until now - end_time: str - - -@dataclass -class UserCategoryAffinityScore: - # The off chain account id - account_id: str - # target category - category_id: str - # affinity score - affinity_score: float - - -@dataclass -class ApiUserCategoryAffinityScoreResponse: - # The list of categoryAffinities score - result: list[UserCategoryAffinityScore] - - -@dataclass -class ApiCategoryAffinityScoreRequest: - # The start time of query. Can leave empty to query from the beginning - start_time: str - # The end time of query. Can leave empty to query until now - end_time: str - - -@dataclass -class ApiCategoryAffinityScoreResponse: - # The list of categoryAffinities score - result: list[UserCategoryAffinityScore] - - -@dataclass -class UserTrackingEvent: - # uuid for event - event_id: str - # version of tracking - tracking_version: int - # timestamp of event - event_time: str - # event type - event_type: str - # event sub type - event_sub_type: str - # unique identity of the session generated from client - client_session_id: str - # OS of user's device - device_os: str - # OS version of user's device - device_os_version: str - # sub account id - sub_account_id: str - # trading session key - trading_address: str - # screen size - screen_size: str - # event data - event_data: str - # user id - user_id: str - # account id - account_id: str - # auth session hash of the authenticated session on backend - auth_session_hash: str - # country code of user based on IP address - country_code: str - - @dataclass class ApiWithdrawalRequest: """ @@ -3376,6 +2329,20 @@ class ApiTransferRequest: transfer_metadata: str +@dataclass +class ApiTransferAck: + # Gravity has acknowledged that the transfer has been successfully processed. If true, a `tx_id` will be returned. If false, an error will be returned. + ack: bool + # The transaction ID of the transfer. This is only returned if the transfer is successful. + tx_id: str + + +@dataclass +class ApiTransferResponse: + # The Transfer response object + result: ApiTransferAck + + @dataclass class ApiDepositHistoryRequest: """ @@ -3483,24 +2450,6 @@ class ApiWithdrawalHistoryRequest: main_account_id: str | None = None -@dataclass -class WithdrawalHistory: - # The transaction ID of the withdrawal - tx_id: str - # The subaccount to withdraw from - from_account_id: str - # The ethereum address to withdraw to - to_eth_address: str - # The token currency to withdraw - currency: Currency - # The number of tokens to withdraw - num_tokens: str - # The signature of the withdrawal - signature: Signature - # The timestamp of the withdrawal in unix nanoseconds - event_time: str - - @dataclass class ApiWithdrawalHistoryResponse: # The withdrawals history matching the request account diff --git a/src/codegen/apispec.json b/src/codegen/apispec.json index 1cce840..6e935b9 100644 --- a/src/codegen/apispec.json +++ b/src/codegen/apispec.json @@ -701,47 +701,6 @@ } ], "rpcs": [ - { - "namespace": "Admin", - "name": "RPCDropClientWS", - "version": 1, - "route": "/drop_client_ws", - "auth_required": true, - "request": "ApiDropClientWsRequest", - "response": "ApiDropClientWsResponse", - "on_request_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", - "status": 400 - }, - { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - } - ] - }, { "namespace": "Order", "name": "RPCCreateOrderV1", @@ -981,6 +940,26 @@ "message": "Invalid trigger order", "status": 400 }, + { + "code": 2113, + "message": "Trigger price must be non-zero", + "status": 400 + }, + { + "code": 2114, + "message": "Invalid position linked TPSL orders, position linked TPSL must be a reduce-only order", + "status": 400 + }, + { + "code": 2115, + "message": "Invalid position linked TPSL orders, position linked TPSL must not have smaller size than the position", + "status": 400 + }, + { + "code": 2116, + "message": "Position linked TPSL order for this asset already exists", + "status": 400 + }, { "code": 3004, "message": "Instrument does not have a valid maintenance margin configuration", @@ -995,6 +974,16 @@ "code": 3006, "message": "Instrument's quote currency does not have a valid balance decimal configuration", "status": 500 + }, + { + "code": 2400, + "message": "Reduce only order with no position", + "status": 400 + }, + { + "code": 2401, + "message": "Reduce only order must not increase position size", + "status": 400 } ] }, @@ -1230,12 +1219,12 @@ }, { "namespace": "Order", - "name": "RPCPreOrderCheckV1", + "name": "RPCCancelOnDisconnectV1", "version": 1, - "route": "/pre_order_check", + "route": "/cancel_on_disconnect", "auth_required": true, - "request": "ApiPreOrderCheckRequest", - "response": "ApiPreOrderCheckResponse", + "request": "ApiCancelOnDisconnectRequest", + "response": "AckResponse", "on_request_errors": [ { "code": 1000, @@ -1268,30 +1257,61 @@ "status": 401 }, { - "code": 3004, - "message": "Instrument does not have a valid maintenance margin configuration", - "status": 500 + "code": 6000, + "message": "Countdown time is bigger than 300s supported", + "status": 400 + } + ] + }, + { + "namespace": "Execution", + "name": "RPCFillHistoryV1", + "version": 1, + "route": "/fill_history", + "auth_required": true, + "request": "ApiFillHistoryRequest", + "response": "ApiFillHistoryResponse", + "on_request_errors": [ + { + "code": 1000, + "message": "You need to authenticate prior to using this functionality", + "status": 401 }, { - "code": 3005, - "message": "Instrument's underlying currency does not have a valid balance decimal configuration", - "status": 500 + "code": 1001, + "message": "You are not authorized to access this functionality", + "status": 403 }, { - "code": 3006, - "message": "Instrument's quote currency does not have a valid balance decimal configuration", + "code": 1002, + "message": "Internal Server Error", "status": 500 + }, + { + "code": 1003, + "message": "Request could not be processed due to malformed syntax", + "status": 400 + }, + { + "code": 1006, + "message": "You have surpassed the allocated rate limit for your tier", + "status": 429 + }, + { + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 } ] }, { - "namespace": "Position", - "name": "RPCDedustPositionV1", + "namespace": "Execution", + "name": "RPCPositionsV1", "version": 1, - "route": "/dedust_position", + "route": "/positions", "auth_required": true, - "request": "ApiDedustPositionRequest", - "response": "ApiDedustPositionResponse", + "request": "ApiPositionsRequest", + "response": "ApiPositionsResponse", "on_request_errors": [ { "code": 1000, @@ -1314,15 +1334,46 @@ "status": 400 }, { - "code": 1004, - "message": "Data Not Found", - "status": 404 + "code": 1006, + "message": "You have surpassed the allocated rate limit for your tier", + "status": 429 }, { - "code": 1005, - "message": "Unknown Error", + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 + } + ] + }, + { + "namespace": "Execution", + "name": "RPCFundingPaymentHistoryV1", + "version": 1, + "route": "/funding_payment_history", + "auth_required": true, + "request": "ApiFundingPaymentHistoryRequest", + "response": "ApiFundingPaymentHistoryResponse", + "on_request_errors": [ + { + "code": 1000, + "message": "You need to authenticate prior to using this functionality", + "status": 401 + }, + { + "code": 1001, + "message": "You are not authorized to access this functionality", + "status": 403 + }, + { + "code": 1002, + "message": "Internal Server Error", "status": 500 }, + { + "code": 1003, + "message": "Request could not be processed due to malformed syntax", + "status": 400 + }, { "code": 1006, "message": "You have surpassed the allocated rate limit for your tier", @@ -1332,197 +1383,262 @@ "code": 1008, "message": "Your IP has not been whitelisted for access", "status": 401 + } + ] + }, + { + "namespace": "Transfer", + "name": "RPCDepositHistoryV1", + "version": 1, + "route": "/deposit_history", + "auth_required": true, + "request": "ApiDepositHistoryRequest", + "response": "ApiDepositHistoryResponse", + "on_request_errors": [ + { + "code": 1000, + "message": "You need to authenticate prior to using this functionality", + "status": 401 }, { - "code": 1400, - "message": "Signer does not have trade permission", + "code": 1001, + "message": "You are not authorized to access this functionality", "status": 403 }, { - "code": 1009, - "message": "We are temporarily deactivating this API endpoint, please try again later", - "status": 503 + "code": 1002, + "message": "Internal Server Error", + "status": 500 }, { - "code": 2000, - "message": "Order signature is from an unauthorized signer", - "status": 403 + "code": 1003, + "message": "Request could not be processed due to malformed syntax", + "status": 400 }, { - "code": 2001, - "message": "Order signature has expired", - "status": 403 + "code": 1006, + "message": "You have surpassed the allocated rate limit for your tier", + "status": 429 }, { - "code": 2002, - "message": "Order signature does not match payload", - "status": 403 + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 + } + ] + }, + { + "namespace": "Transfer", + "name": "RPCTransferV1", + "version": 1, + "route": "/transfer", + "auth_required": true, + "request": "ApiTransferRequest", + "response": "ApiTransferResponse", + "on_request_errors": [ + { + "code": 1000, + "message": "You need to authenticate prior to using this functionality", + "status": 401 }, { - "code": 2003, - "message": "Order sub account does not match logged in user", + "code": 1001, + "message": "You are not authorized to access this functionality", "status": 403 }, { - "code": 2004, - "message": "Order signature is from an expired session key", - "status": 403 + "code": 1002, + "message": "Internal Server Error", + "status": 500 }, { - "code": 2010, - "message": "Order ID should be empty when creating an order", + "code": 1003, + "message": "Request could not be processed due to malformed syntax", "status": 400 }, { - "code": 2011, - "message": "Client Order ID should be supplied when creating an order", - "status": 400 + "code": 1006, + "message": "You have surpassed the allocated rate limit for your tier", + "status": 429 }, { - "code": 2012, - "message": "Client Order ID overlaps with existing active order", - "status": 400 + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 }, { - "code": 2030, - "message": "Orderbook Orders must have a TimeInForce of GTT/IOC/FOK", + "code": 5000, + "message": "Transfer Metadata does not match the expected structure.", "status": 400 }, { - "code": 2031, - "message": "RFQ Orders must have a TimeInForce of GTT/AON/IOC/FOK", + "code": 5001, + "message": "Transfer Provider does not match the expected provider.", "status": 400 }, { - "code": 2032, - "message": "Post Only can only be set to true for GTT/AON orders", + "code": 4002, + "message": "Transfer failed with an unrefined failure reason, please report to GRVT", "status": 400 }, { - "code": 2020, - "message": "Market Order must always be supplied without a limit price", + "code": 5002, + "message": "Direction of the transfer does not match the expected direction.", "status": 400 }, { - "code": 2021, - "message": "Limit Order must always be supplied with a limit price", + "code": 5003, + "message": "Endpoint account ID is invalid.", "status": 400 }, { - "code": 2040, - "message": "Order must contain at least one leg", + "code": 5004, + "message": "Funding account does not exist in our system.", "status": 400 }, { - "code": 2041, - "message": "Order Legs must be sorted by Derivative.Instrument/Underlying/BaseCurrency/Expiration/StrikePrice", + "code": 5005, + "message": "Invalid ChainID for the transfer request.", "status": 400 - }, + } + ] + }, + { + "namespace": "Transfer", + "name": "RPCTransferHistoryV1", + "version": 1, + "route": "/transfer_history", + "auth_required": true, + "request": "ApiTransferHistoryRequest", + "response": "ApiTransferHistoryResponse", + "on_request_errors": [ { - "code": 2042, - "message": "Orderbook Orders must contain only one leg", - "status": 400 + "code": 1000, + "message": "You need to authenticate prior to using this functionality", + "status": 401 }, { - "code": 2050, - "message": "Order state must be empty upon creation", - "status": 400 + "code": 1001, + "message": "You are not authorized to access this functionality", + "status": 403 }, { - "code": 2051, - "message": "Order execution metadata must be empty upon creation", - "status": 400 + "code": 1002, + "message": "Internal Server Error", + "status": 500 }, { - "code": 2060, - "message": "Order Legs contain one or more inactive derivative", + "code": 1003, + "message": "Request could not be processed due to malformed syntax", "status": 400 }, { - "code": 2061, - "message": "Unsupported Instrument Requested", - "status": 400 + "code": 1006, + "message": "You have surpassed the allocated rate limit for your tier", + "status": 429 }, { - "code": 2063, - "message": "Order size smaller than min block size in block trade venue", - "status": 400 - }, + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 + } + ] + }, + { + "namespace": "Transfer", + "name": "RPCWithdrawalV1", + "version": 1, + "route": "/withdrawal", + "auth_required": true, + "request": "ApiWithdrawalRequest", + "response": "AckResponse", + "on_request_errors": [ { - "code": 2064, - "message": "Invalid limit price tick", - "status": 400 + "code": 1000, + "message": "You need to authenticate prior to using this functionality", + "status": 401 }, { - "code": 2200, - "message": "Order size should exactly tally to the dust portion (i.e., smaller than minimum size) of a position", - "status": 400 + "code": 1001, + "message": "You are not authorized to access this functionality", + "status": 403 }, { - "code": 2201, - "message": "Order level should match or beat mark price", - "status": 400 + "code": 1002, + "message": "Internal Server Error", + "status": 500 }, { - "code": 2202, - "message": "Cannot dedust position via a market order", + "code": 1003, + "message": "Request could not be processed due to malformed syntax", "status": 400 }, { - "code": 2203, - "message": "Cannot dedust position via a post-only order", - "status": 400 + "code": 1006, + "message": "You have surpassed the allocated rate limit for your tier", + "status": 429 }, { - "code": 2204, - "message": "Can only dedust position via a fill-or-kill order", - "status": 400 + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 }, { - "code": 2205, - "message": "Can only dedust position via a reduce-only order", + "code": 4010, + "message": "This wallet is not supported. Please try another wallet.", "status": 400 - }, + } + ] + }, + { + "namespace": "Transfer", + "name": "RPCWithdrawalHistoryV1", + "version": 1, + "route": "/withdrawal_history", + "auth_required": true, + "request": "ApiWithdrawalHistoryRequest", + "response": "ApiWithdrawalHistoryResponse", + "on_request_errors": [ { - "code": 2206, - "message": "Attempting to trade the wrong buy/sell direction for dedusting position", - "status": 400 + "code": 1000, + "message": "You need to authenticate prior to using this functionality", + "status": 401 }, { - "code": 2070, - "message": "Liquidation Order is not supported", - "status": 400 + "code": 1001, + "message": "You are not authorized to access this functionality", + "status": 403 }, { - "code": 2080, - "message": "Insufficient margin to create order", - "status": 400 + "code": 1002, + "message": "Internal Server Error", + "status": 500 }, { - "code": 2081, - "message": "Order Fill would result in exceeding maximum position size", + "code": 1003, + "message": "Request could not be processed due to malformed syntax", "status": 400 }, { - "code": 2082, - "message": "Pre-order check failed", - "status": 400 + "code": 1006, + "message": "You have surpassed the allocated rate limit for your tier", + "status": 429 }, { - "code": 2090, - "message": "Max open orders exceeded", - "status": 429 + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 } ] }, { - "namespace": "Order", - "name": "RPCCancelOnDisconnectV1", + "namespace": "Account", + "name": "RPCSubAccountSummaryV1", "version": 1, - "route": "/cancel_on_disconnect", + "route": "/account_summary", "auth_required": true, - "request": "ApiCancelOnDisconnectRequest", - "response": "AckResponse", + "request": "ApiSubAccountSummaryRequest", + "response": "ApiSubAccountSummaryResponse", "on_request_errors": [ { "code": 1000, @@ -1553,22 +1669,17 @@ "code": 1008, "message": "Your IP has not been whitelisted for access", "status": 401 - }, - { - "code": 6000, - "message": "Countdown time is bigger than 300s supported", - "status": 400 } ] }, { - "namespace": "Order", - "name": "RPCCreateBulkOrdersV1", + "namespace": "Account", + "name": "RPCSubAccountHistoryV1", "version": 1, - "route": "/create_bulk_orders", + "route": "/account_history", "auth_required": true, - "request": "ApiCreateBulkOrdersRequest", - "response": "ApiCreateBulkOrdersResponse", + "request": "ApiSubAccountHistoryRequest", + "response": "ApiSubAccountHistoryResponse", "on_request_errors": [ { "code": 1000, @@ -1590,16 +1701,6 @@ "message": "Request could not be processed due to malformed syntax", "status": 400 }, - { - "code": 1004, - "message": "Data Not Found", - "status": 404 - }, - { - "code": 1005, - "message": "Unknown Error", - "status": 500 - }, { "code": 1006, "message": "You have surpassed the allocated rate limit for your tier", @@ -1609,243 +1710,288 @@ "code": 1008, "message": "Your IP has not been whitelisted for access", "status": 401 - }, - { - "code": 1400, - "message": "Signer does not have trade permission", - "status": 403 - }, - { - "code": 1009, - "message": "We are temporarily deactivating this API endpoint, please try again later", - "status": 503 - }, + } + ] + }, + { + "namespace": "Account", + "name": "RPCAggregatedAccountSummaryV1", + "version": 1, + "route": "/aggregated_account_summary", + "auth_required": true, + "request": "EmptyRequest", + "response": "ApiAggregatedAccountSummaryResponse", + "on_request_errors": [ { - "code": 2000, - "message": "Order signature is from an unauthorized signer", + "code": 1001, + "message": "You are not authorized to access this functionality", "status": 403 }, { - "code": 2001, - "message": "Order signature has expired", - "status": 403 + "code": 1002, + "message": "Internal Server Error", + "status": 500 }, { - "code": 2002, - "message": "Order signature does not match payload", - "status": 403 + "code": 1003, + "message": "Request could not be processed due to malformed syntax", + "status": 400 }, { - "code": 2003, - "message": "Order sub account does not match logged in user", - "status": 403 + "code": 1006, + "message": "You have surpassed the allocated rate limit for your tier", + "status": 429 }, { - "code": 2004, - "message": "Order signature is from an expired session key", - "status": 403 - }, + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 + } + ] + }, + { + "namespace": "Account", + "name": "RPCFundingAccountSummaryV1", + "version": 1, + "route": "/funding_account_summary", + "auth_required": true, + "request": "EmptyRequest", + "response": "ApiFundingAccountSummaryResponse", + "on_request_errors": [ { - "code": 2006, - "message": "Order signature R/S must have exactly 64 characters long without 0x prefix", + "code": 1001, + "message": "You are not authorized to access this functionality", "status": 403 }, { - "code": 2005, - "message": "Order signature V must be 27/28", - "status": 403 + "code": 1002, + "message": "Internal Server Error", + "status": 500 }, { - "code": 2007, - "message": "Order signature S must be in the lower half of the curve", - "status": 403 + "code": 1003, + "message": "Request could not be processed due to malformed syntax", + "status": 400 }, { - "code": 2010, - "message": "Order ID should be empty when creating an order", - "status": 400 + "code": 1006, + "message": "You have surpassed the allocated rate limit for your tier", + "status": 429 }, { - "code": 2011, - "message": "Client Order ID should be supplied when creating an order", - "status": 400 - }, - { - "code": 2012, - "message": "Client Order ID overlaps with existing active order", - "status": 400 - }, + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 + } + ] + }, + { + "namespace": "InitialLeverage", + "name": "RPCGetAllInitialLeverageV1", + "version": 1, + "route": "/get_all_initial_leverage", + "auth_required": true, + "request": "ApiGetAllInitialLeverageRequest", + "response": "ApiGetAllInitialLeverageResponse", + "on_request_errors": [ { - "code": 2030, - "message": "Orderbook Orders must have a TimeInForce of GTT/IOC/FOK", - "status": 400 + "code": 1000, + "message": "You need to authenticate prior to using this functionality", + "status": 401 }, { - "code": 2031, - "message": "RFQ Orders must have a TimeInForce of GTT/AON/IOC/FOK", - "status": 400 + "code": 1001, + "message": "You are not authorized to access this functionality", + "status": 403 }, { - "code": 2032, - "message": "Post Only can only be set to true for GTT/AON orders", - "status": 400 + "code": 1002, + "message": "Internal Server Error", + "status": 500 }, { - "code": 2020, - "message": "Market Order must always be supplied without a limit price", + "code": 1003, + "message": "Request could not be processed due to malformed syntax", "status": 400 }, { - "code": 2021, - "message": "Limit Order must always be supplied with a limit price", - "status": 400 + "code": 1006, + "message": "You have surpassed the allocated rate limit for your tier", + "status": 429 }, { - "code": 2040, - "message": "Order must contain at least one leg", - "status": 400 - }, + "code": 1004, + "message": "Data Not Found", + "status": 404 + } + ] + }, + { + "namespace": "InitialLeverage", + "name": "RPCSetInitialLeverageV1", + "version": 1, + "route": "/set_initial_leverage", + "auth_required": true, + "request": "ApiSetInitialLeverageRequest", + "response": "ApiSetInitialLeverageResponse", + "on_request_errors": [ { - "code": 2041, - "message": "Order Legs must be sorted by Derivative.Instrument/Underlying/BaseCurrency/Expiration/StrikePrice", - "status": 400 + "code": 1000, + "message": "You need to authenticate prior to using this functionality", + "status": 401 }, { - "code": 2042, - "message": "Orderbook Orders must contain only one leg", - "status": 400 + "code": 1001, + "message": "You are not authorized to access this functionality", + "status": 403 }, { - "code": 2050, - "message": "Order state must be empty upon creation", - "status": 400 + "code": 1002, + "message": "Internal Server Error", + "status": 500 }, { - "code": 2051, - "message": "Order execution metadata must be empty upon creation", + "code": 1003, + "message": "Request could not be processed due to malformed syntax", "status": 400 }, { - "code": 2060, - "message": "Order Legs contain one or more inactive derivative", - "status": 400 + "code": 1006, + "message": "You have surpassed the allocated rate limit for your tier", + "status": 429 }, { - "code": 2061, - "message": "Unsupported Instrument Requested", - "status": 400 + "code": 1004, + "message": "Data Not Found", + "status": 404 }, { - "code": 2062, - "message": "Order size smaller than min size", + "code": 2100, + "message": "Invalid initial leverage", "status": 400 - }, + } + ] + } + ], + "streams": [ + { + "namespace": "Order", + "name": "StreamOrderV1", + "channel": "v1.order", + "auth_required": true, + "feed_selector": "WSOrderFeedSelectorV1", + "feed": "WSOrderFeedDataV1", + "on_subscribe_errors": [ { - "code": 2063, - "message": "Order size smaller than min block size in block trade venue", - "status": 400 + "code": 1000, + "message": "You need to authenticate prior to using this functionality", + "status": 401 }, { - "code": 2064, - "message": "Invalid limit price tick", - "status": 400 + "code": 1001, + "message": "You are not authorized to access this functionality", + "status": 403 }, { - "code": 2065, - "message": "Order size too granular", - "status": 400 + "code": 1002, + "message": "Internal Server Error", + "status": 500 }, { - "code": 2070, - "message": "Liquidation Order is not supported", - "status": 400 + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 }, { - "code": 2080, - "message": "Insufficient margin to create order", + "code": 1101, + "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", "status": 400 }, { - "code": 2081, - "message": "Order Fill would result in exceeding maximum position size", + "code": 1102, + "message": "Wrong number of primary selectors", "status": 400 }, { - "code": 2082, - "message": "Pre-order check failed", + "code": 1103, + "message": "Wrong number of secondary selectors", "status": 400 }, { - "code": 2083, - "message": "Order Fill would result in exceeding maximum position size under current configurable leverage tier", + "code": 3000, + "message": "Instrument is invalid", "status": 400 }, { - "code": 2090, - "message": "Max open orders exceeded", - "status": 429 - }, - { - "code": 2110, - "message": "Invalid trigger by", + "code": 3020, + "message": "Sub account ID must be an uint64 integer", "status": 400 - }, + } + ] + }, + { + "namespace": "Order", + "name": "StreamOrderStateV1", + "channel": "v1.state", + "auth_required": true, + "feed_selector": "WSOrderStateFeedSelectorV1", + "feed": "WSOrderStateFeedDataV1", + "on_subscribe_errors": [ { - "code": 2111, - "message": "Unsupported trigger by", - "status": 400 + "code": 1000, + "message": "You need to authenticate prior to using this functionality", + "status": 401 }, { - "code": 2112, - "message": "Invalid trigger order", - "status": 400 + "code": 1001, + "message": "You are not authorized to access this functionality", + "status": 403 }, { - "code": 3004, - "message": "Instrument does not have a valid maintenance margin configuration", + "code": 1002, + "message": "Internal Server Error", "status": 500 }, { - "code": 3005, - "message": "Instrument's underlying currency does not have a valid balance decimal configuration", - "status": 500 + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 }, { - "code": 3006, - "message": "Instrument's quote currency does not have a valid balance decimal configuration", - "status": 500 + "code": 1101, + "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", + "status": 400 }, { - "code": 2220, - "message": "No orders provided", + "code": 1102, + "message": "Wrong number of primary selectors", "status": 400 }, { - "code": 2221, - "message": "Invalid number of orders", + "code": 1103, + "message": "Wrong number of secondary selectors", "status": 400 }, { - "code": 2222, - "message": "Order is not a TPSL order", + "code": 3000, + "message": "Instrument is invalid", "status": 400 }, { - "code": 2223, - "message": "Unsupported bulk order type", + "code": 3020, + "message": "Sub account ID must be an uint64 integer", "status": 400 } ] }, { "namespace": "Order", - "name": "RPCGetOrderGroupV1", - "version": 1, - "route": "/order_group", + "name": "StreamCancelStatusV1", + "channel": "v1.cancel", "auth_required": true, - "request": "ApiGetOrderGroupRequest", - "response": "ApiGetOrderGroupResponse", - "on_request_errors": [ + "feed_selector": "WSCancelFeedSelectorV1", + "feed": "WSCancelFeedDataV1", + "on_subscribe_errors": [ { "code": 1000, "message": "You need to authenticate prior to using this functionality", @@ -1862,46 +2008,45 @@ "status": 500 }, { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 + }, + { + "code": 1101, + "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", "status": 400 }, { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 + "code": 1102, + "message": "Wrong number of primary selectors", + "status": 400 }, { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 + "code": 1103, + "message": "Wrong number of secondary selectors", + "status": 400 }, { - "code": 1004, - "message": "Data Not Found", - "status": 404 + "code": 3000, + "message": "Instrument is invalid", + "status": 400 }, { "code": 3020, "message": "Sub account ID must be an uint64 integer", "status": 400 - }, - { - "code": 3021, - "message": "Either order ID or client order ID must be supplied", - "status": 400 } ] }, { "namespace": "Execution", - "name": "RPCFillHistoryV1", - "version": 1, - "route": "/fill_history", + "name": "StreamFillV1", + "channel": "v1.fill", "auth_required": true, - "request": "ApiFillHistoryRequest", - "response": "ApiFillHistoryResponse", - "on_request_errors": [ + "feed_selector": "WSFillFeedSelectorV1", + "feed": "WSFillFeedDataV1", + "on_subscribe_errors": [ { "code": 1000, "message": "You need to authenticate prior to using this functionality", @@ -1917,73 +2062,46 @@ "message": "Internal Server Error", "status": 500 }, - { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", - "status": 400 - }, - { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 - }, { "code": 1008, "message": "Your IP has not been whitelisted for access", "status": 401 - } - ] - }, - { - "namespace": "Execution", - "name": "RPCPositionsV1", - "version": 1, - "route": "/positions", - "auth_required": true, - "request": "ApiPositionsRequest", - "response": "ApiPositionsResponse", - "on_request_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 }, { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 + "code": 1101, + "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", + "status": 400 }, { - "code": 1002, - "message": "Internal Server Error", - "status": 500 + "code": 1102, + "message": "Wrong number of primary selectors", + "status": 400 }, { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", + "code": 1103, + "message": "Wrong number of secondary selectors", "status": 400 }, { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 + "code": 3000, + "message": "Instrument is invalid", + "status": 400 }, { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 + "code": 3020, + "message": "Sub account ID must be an uint64 integer", + "status": 400 } ] }, { "namespace": "Execution", - "name": "RPCFundingPaymentHistoryV1", - "version": 1, - "route": "/funding_payment_history", + "name": "StreamPositionsV1", + "channel": "v1.position", "auth_required": true, - "request": "ApiFundingPaymentHistoryRequest", - "response": "ApiFundingPaymentHistoryResponse", - "on_request_errors": [ + "feed_selector": "WSPositionsFeedSelectorV1", + "feed": "WSPositionsFeedDataV1", + "on_subscribe_errors": [ { "code": 1000, "message": "You need to authenticate prior to using this functionality", @@ -2000,6164 +2118,218 @@ "status": 500 }, { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 + }, + { + "code": 1101, + "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", "status": 400 }, { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 + "code": 1102, + "message": "Wrong number of primary selectors", + "status": 400 }, { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 + "code": 1103, + "message": "Wrong number of secondary selectors", + "status": 400 + }, + { + "code": 3000, + "message": "Instrument is invalid", + "status": 400 + }, + { + "code": 3020, + "message": "Sub account ID must be an uint64 integer", + "status": 400 } ] }, { "namespace": "Transfer", - "name": "RPCDepositHistoryV1", - "version": 1, - "route": "/deposit_history", + "name": "StreamDepositV1", + "channel": "v1.deposit", "auth_required": true, - "request": "ApiDepositHistoryRequest", - "response": "ApiDepositHistoryResponse", - "on_request_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, + "feed_selector": "WSDepositFeedSelectorV1", + "feed": "WSDepositFeedDataV1", + "on_subscribe_errors": [ { "code": 1001, "message": "You are not authorized to access this functionality", "status": 403 }, { - "code": 1002, - "message": "Internal Server Error", - "status": 500 + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 }, { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", + "code": 1101, + "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", "status": 400 }, { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 + "code": 1102, + "message": "Wrong number of primary selectors", + "status": 400 }, { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 + "code": 1103, + "message": "Wrong number of secondary selectors", + "status": 400 } ] }, { "namespace": "Transfer", - "name": "RPCTransferV1", - "version": 1, - "route": "/transfer", + "name": "StreamTransferV1", + "channel": "v1.transfer", "auth_required": true, - "request": "ApiTransferRequest", - "response": "AckResponse", - "on_request_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, + "feed_selector": "WSTransferFeedSelectorV1", + "feed": "WSTransferFeedDataV1", + "on_subscribe_errors": [ { "code": 1001, "message": "You are not authorized to access this functionality", "status": 403 }, - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", - "status": 400 - }, - { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 - }, { "code": 1008, "message": "Your IP has not been whitelisted for access", "status": 401 }, { - "code": 5000, - "message": "Transfer Metadata does not match the expected structure.", - "status": 400 - }, - { - "code": 5001, - "message": "Transfer Provider does not match the expected provider.", - "status": 400 - }, - { - "code": 5002, - "message": "Direction of the transfer does not match the expected direction.", + "code": 1101, + "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", "status": 400 }, { - "code": 5003, - "message": "Endpoint account ID is invalid.", + "code": 1102, + "message": "Wrong number of primary selectors", "status": 400 }, { - "code": 5004, - "message": "Funding account does not exist in our system.", + "code": 1103, + "message": "Wrong number of secondary selectors", "status": 400 }, { - "code": 5005, - "message": "Invalid ChainID for the transfer request.", + "code": 3020, + "message": "Sub account ID must be an uint64 integer", "status": 400 } ] }, { "namespace": "Transfer", - "name": "RPCTransferHistoryV1", - "version": 1, - "route": "/transfer_history", + "name": "StreamWithdrawalV1", + "channel": "v1.withdrawal", "auth_required": true, - "request": "ApiTransferHistoryRequest", - "response": "ApiTransferHistoryResponse", - "on_request_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, + "feed_selector": "WSWithdrawalFeedSelectorV1", + "feed": "WSWithdrawalFeedDataV1", + "on_subscribe_errors": [ { "code": 1001, "message": "You are not authorized to access this functionality", "status": 403 }, { - "code": 1002, - "message": "Internal Server Error", - "status": 500 + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 }, { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", + "code": 1101, + "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", "status": 400 }, { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 + "code": 1102, + "message": "Wrong number of primary selectors", + "status": 400 }, { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 + "code": 1103, + "message": "Wrong number of secondary selectors", + "status": 400 } ] - }, + } + ] + } + ], + "structs": [ + { + "name": "ApiPositionsRequest", + "is_root": true, + "fields": [ { - "namespace": "Transfer", - "name": "RPCWithdrawalV1", - "version": 1, - "route": "/withdrawal", - "auth_required": true, - "request": "ApiWithdrawalRequest", - "response": "AckResponse", - "on_request_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", - "status": 400 - }, - { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - }, - { - "code": 4010, - "message": "This wallet is not supported. Please try another wallet.", - "status": 400 - } - ] - }, - { - "namespace": "Transfer", - "name": "RPCWithdrawalHistoryV1", - "version": 1, - "route": "/withdrawal_history", - "auth_required": true, - "request": "ApiWithdrawalHistoryRequest", - "response": "ApiWithdrawalHistoryResponse", - "on_request_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", - "status": 400 - }, - { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - } - ] - }, - { - "namespace": "PreDepositCheck", - "name": "RPCPreDepositCheckV1", - "version": 1, - "route": "/pre_deposit_check", - "auth_required": true, - "request": "ApiPreDepositCheckRequest", - "response": "ApiPreDepositCheckResponse", - "on_request_errors": [ - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", - "status": 400 - }, - { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 - }, - { - "code": 1007, - "message": "The currency you are requesting for is not currently supported", - "status": 404 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - } - ] - }, - { - "namespace": "Account", - "name": "RPCSubAccountSummaryV1", - "version": 1, - "route": "/account_summary", - "auth_required": true, - "request": "ApiSubAccountSummaryRequest", - "response": "ApiSubAccountSummaryResponse", - "on_request_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", - "status": 400 - }, - { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - } - ] - }, - { - "namespace": "Account", - "name": "RPCSubAccountHistoryV1", - "version": 1, - "route": "/account_history", - "auth_required": true, - "request": "ApiSubAccountHistoryRequest", - "response": "ApiSubAccountHistoryResponse", - "on_request_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", - "status": 400 - }, - { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - } - ] - }, - { - "namespace": "Account", - "name": "RPCAggregatedAccountSummaryV1", - "version": 1, - "route": "/aggregated_account_summary", - "auth_required": true, - "request": "EmptyRequest", - "response": "ApiAggregatedAccountSummaryResponse", - "on_request_errors": [ - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", - "status": 400 - }, - { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - } - ] - }, - { - "namespace": "Account", - "name": "RPCFundingAccountSummaryV1", - "version": 1, - "route": "/funding_account_summary", - "auth_required": true, - "request": "EmptyRequest", - "response": "ApiFundingAccountSummaryResponse", - "on_request_errors": [ - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", - "status": 400 - }, - { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - } - ] - }, - { - "namespace": "SocializedLoss", - "name": "RPCSocializedLossStatusV1", - "version": 1, - "route": "/socialized_loss_status", - "auth_required": true, - "request": "EmptyRequest", - "response": "ApiSocializedLossStatusResponse", - "on_request_errors": [ - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", - "status": 400 - }, - { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - } - ] - }, - { - "namespace": "InitialLeverage", - "name": "RPCGetAllInitialLeverageV1", - "version": 1, - "route": "/get_all_initial_leverage", - "auth_required": true, - "request": "ApiGetAllInitialLeverageRequest", - "response": "ApiGetAllInitialLeverageResponse", - "on_request_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", - "status": 400 - }, - { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 - }, - { - "code": 1004, - "message": "Data Not Found", - "status": 404 - } - ] - }, - { - "namespace": "InitialLeverage", - "name": "RPCSetInitialLeverageV1", - "version": 1, - "route": "/set_initial_leverage", - "auth_required": true, - "request": "ApiSetInitialLeverageRequest", - "response": "ApiSetInitialLeverageResponse", - "on_request_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", - "status": 400 - }, - { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 - }, - { - "code": 1004, - "message": "Data Not Found", - "status": 404 - }, - { - "code": 2100, - "message": "Invalid initial leverage", - "status": 400 - } - ] - }, - { - "namespace": "Margin", - "name": "RPCGetMarginTiersV1", - "version": 1, - "route": "/get_margin_tiers", - "auth_required": true, - "request": "EmptyRequest", - "response": "ApiGetMarginTiersResponse", - "on_request_errors": [ - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", - "status": 400 - }, - { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - } - ] - }, - { - "namespace": "Order", - "name": "RPCQueryTradingPerformanceV1", - "version": 1, - "route": "/trading_performance", - "auth_required": true, - "request": "ApiQueryTradingPerformanceRequest", - "response": "ApiQueryTradingPerformanceResponse", - "on_request_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1003, - "message": "Request could not be processed due to malformed syntax", - "status": 400 - }, - { - "code": 1006, - "message": "You have surpassed the allocated rate limit for your tier", - "status": 429 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - } - ] - } - ], - "streams": [ - { - "namespace": "Order", - "name": "StreamOrderV1", - "channel": "v1.order", - "auth_required": true, - "feed_selector": "WSOrderFeedSelectorV1", - "feed": "WSOrderFeedDataV1", - "on_subscribe_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - }, - { - "code": 1101, - "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", - "status": 400 - }, - { - "code": 1102, - "message": "Wrong number of primary selectors", - "status": 400 - }, - { - "code": 1103, - "message": "Wrong number of secondary selectors", - "status": 400 - }, - { - "code": 3000, - "message": "Instrument is invalid", - "status": 400 - }, - { - "code": 3020, - "message": "Sub account ID must be an uint64 integer", - "status": 400 - } - ] - }, - { - "namespace": "Order", - "name": "StreamOrderStateV1", - "channel": "v1.state", - "auth_required": true, - "feed_selector": "WSOrderStateFeedSelectorV1", - "feed": "WSOrderStateFeedDataV1", - "on_subscribe_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - }, - { - "code": 1101, - "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", - "status": 400 - }, - { - "code": 1102, - "message": "Wrong number of primary selectors", - "status": 400 - }, - { - "code": 1103, - "message": "Wrong number of secondary selectors", - "status": 400 - }, - { - "code": 3000, - "message": "Instrument is invalid", - "status": 400 - }, - { - "code": 3020, - "message": "Sub account ID must be an uint64 integer", - "status": 400 - } - ] - }, - { - "namespace": "Order", - "name": "StreamCancelStatusV1", - "channel": "v1.cancel", - "auth_required": true, - "feed_selector": "WSCancelFeedSelectorV1", - "feed": "WSCancelFeedDataV1", - "on_subscribe_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - }, - { - "code": 1101, - "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", - "status": 400 - }, - { - "code": 1102, - "message": "Wrong number of primary selectors", - "status": 400 - }, - { - "code": 1103, - "message": "Wrong number of secondary selectors", - "status": 400 - }, - { - "code": 3000, - "message": "Instrument is invalid", - "status": 400 - }, - { - "code": 3020, - "message": "Sub account ID must be an uint64 integer", - "status": 400 - } - ] - }, - { - "namespace": "Order", - "name": "StreamOrderGroupV1", - "channel": "v1.group", - "auth_required": true, - "feed_selector": "WSOrderGroupFeedSelectorV1", - "feed": "WSOrderGroupFeedDataV1", - "on_subscribe_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - }, - { - "code": 1101, - "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", - "status": 400 - }, - { - "code": 1102, - "message": "Wrong number of primary selectors", - "status": 400 - }, - { - "code": 1103, - "message": "Wrong number of secondary selectors", - "status": 400 - }, - { - "code": 1103, - "message": "Wrong number of secondary selectors", - "status": 400 - }, - { - "code": 3000, - "message": "Instrument is invalid", - "status": 400 - }, - { - "code": 3020, - "message": "Sub account ID must be an uint64 integer", - "status": 400 - } - ] - }, - { - "namespace": "Execution", - "name": "StreamFillV1", - "channel": "v1.fill", - "auth_required": true, - "feed_selector": "WSFillFeedSelectorV1", - "feed": "WSFillFeedDataV1", - "on_subscribe_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - }, - { - "code": 1101, - "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", - "status": 400 - }, - { - "code": 1102, - "message": "Wrong number of primary selectors", - "status": 400 - }, - { - "code": 1103, - "message": "Wrong number of secondary selectors", - "status": 400 - }, - { - "code": 3000, - "message": "Instrument is invalid", - "status": 400 - }, - { - "code": 3020, - "message": "Sub account ID must be an uint64 integer", - "status": 400 - } - ] - }, - { - "namespace": "Execution", - "name": "StreamPositionsV1", - "channel": "v1.position", - "auth_required": true, - "feed_selector": "WSPositionsFeedSelectorV1", - "feed": "WSPositionsFeedDataV1", - "on_subscribe_errors": [ - { - "code": 1000, - "message": "You need to authenticate prior to using this functionality", - "status": 401 - }, - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1002, - "message": "Internal Server Error", - "status": 500 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - }, - { - "code": 1101, - "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", - "status": 400 - }, - { - "code": 1102, - "message": "Wrong number of primary selectors", - "status": 400 - }, - { - "code": 1103, - "message": "Wrong number of secondary selectors", - "status": 400 - }, - { - "code": 3000, - "message": "Instrument is invalid", - "status": 400 - }, - { - "code": 3020, - "message": "Sub account ID must be an uint64 integer", - "status": 400 - } - ] - }, - { - "namespace": "Transfer", - "name": "StreamDepositV1", - "channel": "v1.deposit", - "auth_required": true, - "feed_selector": "WSDepositFeedSelectorV1", - "feed": "WSDepositFeedDataV1", - "on_subscribe_errors": [ - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - }, - { - "code": 1101, - "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", - "status": 400 - }, - { - "code": 1102, - "message": "Wrong number of primary selectors", - "status": 400 - }, - { - "code": 1103, - "message": "Wrong number of secondary selectors", - "status": 400 - } - ] - }, - { - "namespace": "Transfer", - "name": "StreamTransferV1", - "channel": "v1.transfer", - "auth_required": true, - "feed_selector": "WSTransferFeedSelectorV1", - "feed": "WSTransferFeedDataV1", - "on_subscribe_errors": [ - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - }, - { - "code": 1101, - "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", - "status": 400 - }, - { - "code": 1102, - "message": "Wrong number of primary selectors", - "status": 400 - }, - { - "code": 1103, - "message": "Wrong number of secondary selectors", - "status": 400 - }, - { - "code": 3020, - "message": "Sub account ID must be an uint64 integer", - "status": 400 - } - ] - }, - { - "namespace": "Transfer", - "name": "StreamWithdrawalV1", - "channel": "v1.withdrawal", - "auth_required": true, - "feed_selector": "WSWithdrawalFeedSelectorV1", - "feed": "WSWithdrawalFeedDataV1", - "on_subscribe_errors": [ - { - "code": 1001, - "message": "You are not authorized to access this functionality", - "status": 403 - }, - { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 - }, - { - "code": 1101, - "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", - "status": 400 - }, - { - "code": 1102, - "message": "Wrong number of primary selectors", - "status": 400 - }, - { - "code": 1103, - "message": "Wrong number of secondary selectors", - "status": 400 - } - ] - } - ] - } - ], - "structs": [ - { - "name": "ApiPositionsRequest", - "is_root": true, - "fields": [ - { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The sub account ID to request for" - ] - }, - { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", - "index": 1, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['PERPETUAL']", - "comment": [ - "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" - ] - }, - { - "name": "base", - "lite_name": "b", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 2, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", - "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" - ] - }, - { - "name": "quote", - "lite_name": "q", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 3, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['USDT', 'USDC']", - "comment": [ - "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" - ] - } - ], - "comment": [ - "Query the positions of a sub account" - ] - }, - { - "name": "Positions", - "is_root": false, - "fields": [ - { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "Time at which the event was emitted in unix nanoseconds" - ] - }, - { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The sub account ID that participated in the trade" - ] - }, - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The instrument being represented" - ] - }, - { - "name": "size", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "'2635000.50'", - "comment": [ - "The size of the position, expressed in base asset decimal units. Negative for short positions" - ] - }, - { - "name": "notional", - "lite_name": "n", - "semantic_type": "string", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'2635000.50'", - "comment": [ - "The notional value of the position, negative for short assets, expressed in quote asset decimal units" - ] - }, - { - "name": "entry_price", - "lite_name": "ep", - "semantic_type": "string", - "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": false, - "example": "'65038.01'", - "comment": [ - "The entry price of the position, expressed in `9` decimals", - "Whenever increasing the size of a position, the entry price is updated to the new average entry price", - "`new_entry_price = (old_entry_price * old_size + trade_price * trade_size) / (old_size + trade_size)`" - ] - }, - { - "name": "exit_price", - "lite_name": "ep1", - "semantic_type": "string", - "json_type": "string", - "index": 6, - "array_depth": 0, - "optional": false, - "example": "'65038.01'", - "comment": [ - "The exit price of the position, expressed in `9` decimals", - "Whenever decreasing the size of a position, the exit price is updated to the new average exit price", - "`new_exit_price = (old_exit_price * old_exit_trade_size + trade_price * trade_size) / (old_exit_trade_size + trade_size)`" - ] - }, - { - "name": "mark_price", - "lite_name": "mp", - "semantic_type": "string", - "json_type": "string", - "index": 7, - "array_depth": 0, - "optional": false, - "example": "'65038.01'", - "comment": [ - "The mark price of the position, expressed in `9` decimals" - ] - }, - { - "name": "unrealized_pnl", - "lite_name": "up", - "semantic_type": "string", - "json_type": "string", - "index": 8, - "array_depth": 0, - "optional": false, - "example": "'135000.50'", - "comment": [ - "The unrealized PnL of the position, expressed in quote asset decimal units", - "`unrealized_pnl = (mark_price - entry_price) * size`" - ] - }, - { - "name": "realized_pnl", - "lite_name": "rp", - "semantic_type": "string", - "json_type": "string", - "index": 9, - "array_depth": 0, - "optional": false, - "example": "'-35000.30'", - "comment": [ - "The realized PnL of the position, expressed in quote asset decimal units", - "`realized_pnl = (exit_price - entry_price) * exit_trade_size`" - ] - }, - { - "name": "total_pnl", - "lite_name": "tp", - "semantic_type": "string", - "json_type": "string", - "index": 10, - "array_depth": 0, - "optional": false, - "example": "'100000.20'", - "comment": [ - "The total PnL of the position, expressed in quote asset decimal units", - "`total_pnl = realized_pnl + unrealized_pnl`" - ] - }, - { - "name": "roi", - "lite_name": "r", - "semantic_type": "string", - "json_type": "string", - "index": 11, - "array_depth": 0, - "optional": false, - "example": "'10.20'", - "comment": [ - "The ROI of the position, expressed as a percentage", - "`roi = (total_pnl / (entry_price * abs(size))) * 100^`" - ] - }, - { - "name": "quote_index_price", - "lite_name": "qi", - "semantic_type": "string", - "json_type": "string", - "index": 12, - "array_depth": 0, - "optional": false, - "example": "'1.0000102'", - "comment": [ - "The index price of the quote currency. (reported in `USD`)" - ] - }, - { - "name": "est_liquidation_price", - "lite_name": "el", - "semantic_type": "string", - "json_type": "string", - "index": 13, - "array_depth": 0, - "optional": false, - "example": "60000.25", - "comment": [ - "The estimated liquidation price" - ] - }, - { - "name": "leverage", - "lite_name": "l", - "semantic_type": "string", - "json_type": "string", - "index": 14, - "array_depth": 0, - "optional": false, - "example": "'10'", - "comment": [ - "The current leverage value for this position" - ] - } - ], - "comment": [] - }, - { - "name": "ApiPositionsResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "Positions", - "json_type": "Positions", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The positions matching the request filter" - ] - } - ], - "comment": [] - }, - { - "name": "ApiFillHistoryRequest", - "is_root": true, - "fields": [ - { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The sub account ID to request for" - ] - }, - { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", - "index": 1, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['PERPETUAL']", - "comment": [ - "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" - ] - }, - { - "name": "base", - "lite_name": "b", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 2, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", - "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" - ] - }, - { - "name": "quote", - "lite_name": "q", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 3, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['USDT', 'USDC']", - "comment": [ - "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" - ] - }, - { - "name": "start_time", - "lite_name": "st", - "semantic_type": "int64", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", - "comment": [ - "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" - ] - }, - { - "name": "end_time", - "lite_name": "et", - "semantic_type": "int64", - "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", - "comment": [ - "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" - ] - }, - { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 6, - "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", - "comment": [ - "The limit to query for. Defaults to 500; Max 1000" - ] - }, - { - "name": "cursor", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", - "index": 7, - "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", - "comment": [ - "The cursor to indicate when to start the query from" - ] - } - ], - "comment": [ - "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.", - "", - "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "Fill", - "is_root": false, - "fields": [ - { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "Time at which the event was emitted in unix nanoseconds" - ] - }, - { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The sub account ID that participated in the trade" - ] - }, - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The instrument being represented" - ] - }, - { - "name": "is_buyer", - "lite_name": "ib", - "semantic_type": "bool", - "json_type": "boolean", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "true", - "comment": [ - "The side that the subaccount took on the trade" - ] - }, - { - "name": "is_taker", - "lite_name": "it", - "semantic_type": "bool", - "json_type": "boolean", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "true", - "comment": [ - "The role that the subaccount took on the trade" - ] - }, - { - "name": "size", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": false, - "example": "'0.30'", - "comment": [ - "The number of assets being traded, expressed in base asset decimal units" - ] - }, - { - "name": "price", - "lite_name": "p", - "semantic_type": "string", - "json_type": "string", - "index": 6, - "array_depth": 0, - "optional": false, - "example": "'65038.01'", - "comment": [ - "The traded price, expressed in `9` decimals" - ] - }, - { - "name": "mark_price", - "lite_name": "mp", - "semantic_type": "string", - "json_type": "string", - "index": 7, - "array_depth": 0, - "optional": false, - "example": "'65038.01'", - "comment": [ - "The mark price of the instrument at point of trade, expressed in `9` decimals" - ] - }, - { - "name": "index_price", - "lite_name": "ip", - "semantic_type": "string", - "json_type": "string", - "index": 8, - "array_depth": 0, - "optional": false, - "example": "'65038.01'", - "comment": [ - "The index price of the instrument at point of trade, expressed in `9` decimals" - ] - }, - { - "name": "interest_rate", - "lite_name": "ir", - "semantic_type": "string", - "json_type": "string", - "index": 9, - "array_depth": 0, - "optional": false, - "example": "0.0003", - "comment": [ - "The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)" - ] - }, - { - "name": "forward_price", - "lite_name": "fp", - "semantic_type": "string", - "json_type": "string", - "index": 10, - "array_depth": 0, - "optional": false, - "example": "'65038.01'", - "comment": [ - "[Options] The forward price of the option at point of trade, expressed in `9` decimals" - ] - }, - { - "name": "realized_pnl", - "lite_name": "rp", - "semantic_type": "string", - "json_type": "string", - "index": 11, - "array_depth": 0, - "optional": false, - "example": "'2400.50'", - "comment": [ - "The realized PnL of the trade, expressed in quote asset decimal units (0 if increasing position size)" - ] - }, - { - "name": "fee", - "lite_name": "f", - "semantic_type": "string", - "json_type": "string", - "index": 12, - "array_depth": 0, - "optional": false, - "example": "'9.75'", - "comment": [ - "The fees paid on the trade, expressed in quote asset decimal unit (negative if maker rebate applied)" - ] - }, - { - "name": "fee_rate", - "lite_name": "fr", - "semantic_type": "string", - "json_type": "string", - "index": 13, - "array_depth": 0, - "optional": false, - "example": "0.0003", - "comment": [ - "The fee rate paid on the trade" - ] - }, - { - "name": "trade_id", - "lite_name": "ti", - "semantic_type": "string", - "json_type": "string", - "index": 14, - "array_depth": 0, - "optional": false, - "example": "'209358-2'", - "comment": [ - "A trade identifier, globally unique, and monotonically increasing (not by `1`).", - "All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.", - "`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`." - ] - }, - { - "name": "order_id", - "lite_name": "oi", - "semantic_type": "uint128", - "json_type": "string", - "index": 15, - "array_depth": 0, - "optional": false, - "example": "'0x10000101000203040506'", - "comment": [ - "An order identifier" - ] - }, - { - "name": "venue", - "lite_name": "v", - "semantic_type": "Venue", - "json_type": "Venue", - "index": 16, - "array_depth": 0, - "optional": false, - "example": "'ORDERBOOK'", - "comment": [ - "The venue where the trade occurred" - ] - }, - { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", - "json_type": "string", - "index": 18, - "array_depth": 0, - "optional": false, - "example": "'23042'", - "comment": [ - "A unique identifier for the active order within a subaccount, specified by the client", - "This is used to identify the order in the client's system", - "This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer", - "This field will not be propagated to the smart contract, and should not be signed by the client", - "This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected", - "Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]", - "To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]", - "", - "When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId" - ] - }, - { - "name": "signer", - "lite_name": "s1", - "semantic_type": "uint256", - "json_type": "string", - "index": 20, - "array_depth": 0, - "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", - "comment": [ - "The address (public key) of the wallet signing the payload" - ] - }, - { - "name": "broker", - "lite_name": "b", - "semantic_type": "BrokerTag", - "json_type": "BrokerTag", - "index": 21, - "array_depth": 0, - "optional": true, - "default": "", - "comment": [ - "Specifies the broker who brokered the order" - ] - } - ], - "comment": [] - }, - { - "name": "ApiFillHistoryResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "Fill", - "json_type": "Fill", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The private trades matching the request asset" - ] - }, - { - "name": "next", - "lite_name": "n", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'Qw0918='", - "comment": [ - "The cursor to indicate when to start the query from" - ] - } - ], - "comment": [] - }, - { - "name": "ApiFundingPaymentHistoryRequest", - "is_root": true, - "fields": [ - { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The sub account ID to request for" - ] - }, - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": true, - "default": "all", - "example": "'BTC_USDT_Perp'", - "comment": [ - "The perpetual instrument to filter for" - ] - }, - { - "name": "start_time", - "lite_name": "st", - "semantic_type": "int64", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", - "comment": [ - "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" - ] - }, - { - "name": "end_time", - "lite_name": "et", - "semantic_type": "int64", - "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", - "comment": [ - "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" - ] - }, - { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 4, - "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", - "comment": [ - "The limit to query for. Defaults to 500; Max 1000" - ] - }, - { - "name": "cursor", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", - "comment": [ - "The cursor to indicate when to start the query from" - ] - } - ], - "comment": [ - "Query for all historical funding payments made by a single account.", - "", - "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "FundingPayment", - "is_root": false, - "fields": [ - { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "Time at which the event was emitted in unix nanoseconds" - ] - }, - { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The sub account ID that made the funding payment" - ] - }, - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The perpetual instrument being funded" - ] - }, - { - "name": "currency", - "lite_name": "c", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "'USDT'", - "comment": [ - "The currency of the funding payment" - ] - }, - { - "name": "amount", - "lite_name": "a", - "semantic_type": "string", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'9.75'", - "comment": [ - "The amount of the funding payment. Positive if paid, negative if received" - ] - }, - { - "name": "tx_id", - "lite_name": "ti", - "semantic_type": "uint64", - "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": false, - "example": "'209358'", - "comment": [ - "The transaction ID of the funding payment.", - "Funding payments can be triggered by a trade, transfer, or liquidation.", - "The `tx_id` will match the corresponding `trade_id` or `tx_id`." - ] - } - ], - "comment": [] - }, - { - "name": "ApiFundingPaymentHistoryResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "FundingPayment", - "json_type": "FundingPayment", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The funding payments matching the request asset" - ] - }, - { - "name": "next", - "lite_name": "n", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'Qw0918='", - "comment": [ - "The cursor to indicate when to start the query from" - ] - } - ], - "comment": [] - }, - { - "name": "ApiSubAccountSummaryRequest", - "is_root": true, - "fields": [ - { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The subaccount ID to filter by" - ] - } - ], - "comment": [] - }, - { - "name": "SpotBalance", - "is_root": false, - "fields": [ - { - "name": "currency", - "lite_name": "c", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'USDT'", - "comment": [ - "The currency you hold a spot balance in" - ] - }, - { - "name": "balance", - "lite_name": "b", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'123456.78'", - "comment": [ - "This currency's balance in this trading account." - ] - }, - { - "name": "index_price", - "lite_name": "ip", - "semantic_type": "string", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'1.0000102'", - "comment": [ - "The index price of this currency. (reported in `USD`)" - ] - } - ], - "comment": [] - }, - { - "name": "SubAccount", - "is_root": false, - "fields": [ - { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "Time at which the event was emitted in unix nanoseconds" - ] - }, - { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The sub account ID this entry refers to" - ] - }, - { - "name": "margin_type", - "lite_name": "mt", - "semantic_type": "MarginType", - "json_type": "MarginType", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'SIMPLE_CROSS_MARGIN'", - "comment": [ - "The type of margin algorithm this subaccount uses" - ] - }, - { - "name": "settle_currency", - "lite_name": "sc", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "'USDT'", - "comment": [ - "The settlement, margin, and reporting currency of this account.", - "This subaccount can only open positions quoted in this currency", - "", - "In the future, when users select a Multi-Currency Margin Type, this will be USD", - "All other assets are converted to this currency for the purpose of calculating margin" - ] - }, - { - "name": "unrealized_pnl", - "lite_name": "up", - "semantic_type": "string", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'123456.78'", - "comment": [ - "The total unrealized PnL of all positions owned by this subaccount, denominated in quote currency decimal units.", - "`unrealized_pnl = sum(position.unrealized_pnl * position.quote_index_price) / settle_index_price`" - ] - }, - { - "name": "total_equity", - "lite_name": "te", - "semantic_type": "string", - "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": false, - "example": "'123456.78'", - "comment": [ - "The notional value of your account if all positions are closed, excluding trading fees (reported in `settle_currency`).", - "`total_equity = sum(spot_balance.balance * spot_balance.index_price) / settle_index_price + unrealized_pnl`" - ] - }, - { - "name": "initial_margin", - "lite_name": "im", - "semantic_type": "string", - "json_type": "string", - "index": 6, - "array_depth": 0, - "optional": false, - "example": "'123456.78'", - "comment": [ - "The `total_equity` required to open positions in the account (reported in `settle_currency`).", - "Computation is different depending on account's `margin_type`" - ] - }, - { - "name": "maintenance_margin", - "lite_name": "mm", - "semantic_type": "string", - "json_type": "string", - "index": 7, - "array_depth": 0, - "optional": false, - "example": "'123456.78'", - "comment": [ - "The `total_equity` required to avoid liquidation of positions in the account (reported in `settle_currency`).", - "Computation is different depending on account's `margin_type`" - ] - }, - { - "name": "available_balance", - "lite_name": "ab", - "semantic_type": "string", - "json_type": "string", - "index": 8, - "array_depth": 0, - "optional": false, - "example": "'123456.78'", - "comment": [ - "The notional value available to transfer out of the trading account into the funding account (reported in `settle_currency`).", - "`available_balance = total_equity - initial_margin - min(unrealized_pnl, 0)`" - ] - }, - { - "name": "spot_balances", - "lite_name": "sb", - "semantic_type": "SpotBalance", - "json_type": "SpotBalance", - "index": 9, - "array_depth": 1, - "optional": false, - "comment": [ - "The list of spot assets owned by this sub account, and their balances" - ] - }, - { - "name": "positions", - "lite_name": "p", - "semantic_type": "Positions", - "json_type": "Positions", - "index": 10, - "array_depth": 1, - "optional": false, - "comment": [ - "The list of positions owned by this sub account" - ] - }, - { - "name": "settle_index_price", - "lite_name": "si", - "semantic_type": "string", - "json_type": "string", - "index": 11, - "array_depth": 0, - "optional": false, - "example": "'1.0000102'", - "comment": [ - "The index price of the settle currency. (reported in `USD`)" - ] - } - ], - "comment": [] - }, - { - "name": "ApiSubAccountSummaryResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "SubAccount", - "json_type": "SubAccount", - "index": 0, - "array_depth": 0, - "optional": false, - "comment": [ - "The sub account matching the request sub account" - ] - } - ], - "comment": [ - "Query for sub-account details, including base currency balance, all derivative positions, margin levels, and P\u0026L." - ] - }, - { - "name": "ApiSubAccountHistoryRequest", - "is_root": true, - "fields": [ - { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The sub account ID to request for" - ] - }, - { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", - "comment": [ - "Start time of sub account history in unix nanoseconds" - ] - }, - { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", - "comment": [ - "End time of sub account history in unix nanoseconds" - ] - }, - { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 3, - "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", - "comment": [ - "The limit to query for. Defaults to 500; Max 1000" - ] - }, - { - "name": "cursor", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", - "comment": [ - "The cursor to indicate when to start the next query from" - ] - } - ], - "comment": [ - "The request to get the history of a sub account", - "SubAccount Summary values are snapshotted once every hour", - "No snapshots are taken if the sub account has no activity in the hourly window", - "History is preserved only for the last 30 days", - "", - "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "ApiSubAccountHistoryResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "SubAccount", - "json_type": "SubAccount", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The sub account history matching the request sub account" - ] - }, - { - "name": "next", - "lite_name": "n", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'Qw0918='", - "comment": [ - "The cursor to indicate when to start the next query from" - ] - } - ], - "comment": [] - }, - { - "name": "ApiLatestSnapSubAccountsRequest", - "is_root": true, - "fields": [ - { - "name": "sub_account_i_ds", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 0, - "array_depth": 1, - "optional": false, - "example": "['2376', '5821']", - "comment": [ - "The list of sub account ids to query" - ] - } - ], - "comment": [ - "The request to get the latest snapshot of list sub account", - "" - ] - }, - { - "name": "ApiLatestSnapSubAccountsResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "SubAccount", - "json_type": "SubAccount", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The sub account history matching the request sub account" - ] - } - ], - "comment": [] - }, - { - "name": "AggregatedAccountSummary", - "is_root": false, - "fields": [ - { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", - "comment": [ - "The main account ID of the account to which the summary belongs" - ] - }, - { - "name": "total_equity", - "lite_name": "te", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'3945034.23'", - "comment": [ - "Total equity of the main (+ sub) account, denominated in USD" - ] - }, - { - "name": "spot_balances", - "lite_name": "sb", - "semantic_type": "SpotBalance", - "json_type": "SpotBalance", - "index": 2, - "array_depth": 1, - "optional": false, - "comment": [ - "The list of spot assets owned by this main (+ sub) account, and their balances" - ] - } - ], - "comment": [] - }, - { - "name": "ApiAggregatedAccountSummaryResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "AggregatedAccountSummary", - "json_type": "AggregatedAccountSummary", - "index": 0, - "array_depth": 0, - "optional": false, - "comment": [ - "The aggregated account summary" - ] - } - ], - "comment": [ - "The aggregated account summary, that reports the total equity and spot balances of a funding (main) account, and its constituent trading (sub) accounts" - ] - }, - { - "name": "FundingAccountSummary", - "is_root": true, - "fields": [ - { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", - "comment": [ - "The main account ID of the account to which the summary belongs" - ] - }, - { - "name": "total_equity", - "lite_name": "te", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'3945034.23'", - "comment": [ - "Total equity of the main account, denominated in USD" - ] - }, - { - "name": "spot_balances", - "lite_name": "sb", - "semantic_type": "SpotBalance", - "json_type": "SpotBalance", - "index": 2, - "array_depth": 1, - "optional": false, - "comment": [ - "The list of spot assets owned by this main account, and their balances" - ] - } - ], - "comment": [ - "The funding account summary, that reports the total equity and spot balances of a funding (main) account" - ] - }, - { - "name": "ApiFundingAccountSummaryResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "FundingAccountSummary", - "json_type": "FundingAccountSummary", - "index": 0, - "array_depth": 0, - "optional": false, - "comment": [ - "The funding account summary" - ] - } - ], - "comment": [ - "The funding account summary, that reports the total equity and spot balances of a funding (main) account" - ] - }, - { - "name": "ApiSocializedLossStatusResponse", - "is_root": true, - "fields": [ - { - "name": "is_active", - "lite_name": "ia", - "semantic_type": "bool", - "json_type": "boolean", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'false'", - "comment": [ - "Whether the socialized loss is active" - ] - }, - { - "name": "haircut_ratio", - "lite_name": "hr", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'0.34'", - "comment": [ - "The socialized loss haircut ratio in centi-beeps" - ] - } - ], - "comment": [ - "The socialized loss status." - ] - }, - { - "name": "ApiListAggregatedAccountSummaryRequest", - "is_root": true, - "fields": [ - { - "name": "main_account_ids", - "lite_name": "ma", - "semantic_type": "[]byte", - "json_type": "unknown", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The list of main account ID to request for" - ] - } - ], - "comment": [] - }, - { - "name": "ApiListAggregatedAccountSummaryResponse", - "is_root": true, - "fields": [ - { - "name": "account_summaries", - "lite_name": "as", - "semantic_type": "ApiAggregatedAccountSummaryResponse", - "json_type": "ApiAggregatedAccountSummaryResponse", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The list of aggregated account summaries of requested main accounts" - ] - } - ], - "comment": [] - }, - { - "name": "ApiSetInitialLeverageRequest", - "is_root": true, - "fields": [ - { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The sub account ID to set the leverage for" - ] - }, - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The instrument to set the leverage for" - ] - }, - { - "name": "leverage", - "lite_name": "l", - "semantic_type": "string", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'10'", - "comment": [ - "The leverage to set for the sub account" - ] - } - ], - "comment": [ - "The request to set the initial leverage of a sub account" - ] - }, - { - "name": "ApiSetInitialLeverageResponse", - "is_root": true, - "fields": [ - { - "name": "success", - "lite_name": "s", - "semantic_type": "bool", - "json_type": "boolean", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'true'", - "comment": [ - "Whether the leverage was set successfully" - ] - } - ], - "comment": [ - "The response to set the initial leverage of a sub account" - ] - }, - { - "name": "ApiGetAllInitialLeverageRequest", - "is_root": true, - "fields": [ - { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The sub account ID to get the leverage for" - ] - } - ], - "comment": [ - "The request to get the initial leverage of a sub account" - ] - }, - { - "name": "InitialLeverageResult", - "is_root": false, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The instrument to get the leverage for" - ] - }, - { - "name": "leverage", - "lite_name": "l", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'10'", - "comment": [ - "The initial leverage of the sub account" - ] - }, - { - "name": "min_leverage", - "lite_name": "ml", - "semantic_type": "string", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'10'", - "comment": [ - "The min leverage this sub account can set" - ] - }, - { - "name": "max_leverage", - "lite_name": "ml1", - "semantic_type": "string", - "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "'50'", - "comment": [ - "The max leverage this sub account can set" - ] - } - ], - "comment": [] - }, - { - "name": "ApiGetAllInitialLeverageResponse", - "is_root": true, - "fields": [ - { - "name": "results", - "lite_name": "r", - "semantic_type": "InitialLeverageResult", - "json_type": "InitialLeverageResult", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The initial leverage of the sub account" - ] - } - ], - "comment": [ - "The response to get the initial leverage of a sub account" - ] - }, - { - "name": "ApiOrderbookLevelsRequest", - "is_root": true, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "depth", - "lite_name": "d", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "50", - "comment": [ - "Depth of the order book to be retrieved (10, 50, 100, 500)" - ] - } - ], - "comment": [ - "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." - ] - }, - { - "name": "OrderbookLevel", - "is_root": false, - "fields": [ - { - "name": "price", - "lite_name": "p", - "semantic_type": "string", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'65038.01'", - "comment": [ - "The price of the level, expressed in `9` decimals" - ] - }, - { - "name": "size", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'3456.78'", - "comment": [ - "The number of assets offered, expressed in base asset decimal units" - ] - }, - { - "name": "num_orders", - "lite_name": "no", - "semantic_type": "uint32", - "json_type": "integer", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'123'", - "comment": [ - "The number of open orders at this level" - ] - } - ], - "comment": [] - }, - { - "name": "OrderbookLevels", - "is_root": false, - "fields": [ - { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "Time at which the event was emitted in unix nanoseconds" - ] - }, - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "bids", - "lite_name": "b", - "semantic_type": "OrderbookLevel", - "json_type": "OrderbookLevel", - "index": 2, - "array_depth": 1, - "optional": false, - "comment": [ - "The list of best bids up till query depth" - ] - }, - { - "name": "asks", - "lite_name": "a", - "semantic_type": "OrderbookLevel", - "json_type": "OrderbookLevel", - "index": 3, - "array_depth": 1, - "optional": false, - "comment": [ - "The list of best asks up till query depth" - ] - } - ], - "comment": [] - }, - { - "name": "ApiOrderbookLevelsResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "OrderbookLevels", - "json_type": "OrderbookLevels", - "index": 0, - "array_depth": 0, - "optional": false, - "comment": [ - "The orderbook levels objects matching the request asset" - ] - } - ], - "comment": [] - }, - { - "name": "ApiMiniTickerRequest", - "is_root": true, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ] - } - ], - "comment": [ - "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." - ] - }, - { - "name": "MiniTicker", - "is_root": false, - "fields": [ - { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": true, - "example": "'1697788800000000000'", - "comment": [ - "Time at which the event was emitted in unix nanoseconds" - ] - }, - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": true, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "mark_price", - "lite_name": "mp", - "semantic_type": "string", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "The mark price of the instrument, expressed in `9` decimals" - ] - }, - { - "name": "index_price", - "lite_name": "ip", - "semantic_type": "string", - "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "The index price of the instrument, expressed in `9` decimals" - ] - }, - { - "name": "last_price", - "lite_name": "lp", - "semantic_type": "string", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "The last traded price of the instrument (also close price), expressed in `9` decimals" - ] - }, - { - "name": "last_size", - "lite_name": "ls", - "semantic_type": "string", - "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": true, - "example": "'123456.78'", - "comment": [ - "The number of assets traded in the last trade, expressed in base asset decimal units" - ] - }, - { - "name": "mid_price", - "lite_name": "mp1", - "semantic_type": "string", - "json_type": "string", - "index": 6, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "The mid price of the instrument, expressed in `9` decimals" - ] - }, - { - "name": "best_bid_price", - "lite_name": "bb", - "semantic_type": "string", - "json_type": "string", - "index": 7, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "The best bid price of the instrument, expressed in `9` decimals" - ] - }, - { - "name": "best_bid_size", - "lite_name": "bb1", - "semantic_type": "string", - "json_type": "string", - "index": 8, - "array_depth": 0, - "optional": true, - "example": "'123456.78'", - "comment": [ - "The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units" - ] - }, - { - "name": "best_ask_price", - "lite_name": "ba", - "semantic_type": "string", - "json_type": "string", - "index": 9, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "The best ask price of the instrument, expressed in `9` decimals" - ] - }, - { - "name": "best_ask_size", - "lite_name": "ba1", - "semantic_type": "string", - "json_type": "string", - "index": 10, - "array_depth": 0, - "optional": true, - "example": "'123456.78'", - "comment": [ - "The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units" - ] - } - ], - "comment": [] - }, - { - "name": "ApiMiniTickerResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "MiniTicker", - "json_type": "MiniTicker", - "index": 0, - "array_depth": 0, - "optional": false, - "comment": [ - "The mini ticker matching the request asset" - ] - } - ], - "comment": [] - }, - { - "name": "ApiTickerRequest", - "is_root": true, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ] - } - ], - "comment": [ - "Retrieves a single 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." - ] - }, - { - "name": "Ticker", - "is_root": false, - "fields": [ - { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": true, - "example": "'1697788800000000000'", - "comment": [ - "Time at which the event was emitted in unix nanoseconds" - ] - }, - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": true, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "mark_price", - "lite_name": "mp", - "semantic_type": "string", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "The mark price of the instrument, expressed in `9` decimals" - ] - }, - { - "name": "index_price", - "lite_name": "ip", - "semantic_type": "string", - "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "The index price of the instrument, expressed in `9` decimals" - ] - }, - { - "name": "last_price", - "lite_name": "lp", - "semantic_type": "string", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "The last traded price of the instrument (also close price), expressed in `9` decimals" - ] - }, - { - "name": "last_size", - "lite_name": "ls", - "semantic_type": "string", - "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": true, - "example": "'123456.78'", - "comment": [ - "The number of assets traded in the last trade, expressed in base asset decimal units" - ] - }, - { - "name": "mid_price", - "lite_name": "mp1", - "semantic_type": "string", - "json_type": "string", - "index": 6, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "The mid price of the instrument, expressed in `9` decimals" - ] - }, - { - "name": "best_bid_price", - "lite_name": "bb", - "semantic_type": "string", - "json_type": "string", - "index": 7, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "The best bid price of the instrument, expressed in `9` decimals" - ] - }, - { - "name": "best_bid_size", - "lite_name": "bb1", - "semantic_type": "string", - "json_type": "string", - "index": 8, - "array_depth": 0, - "optional": true, - "example": "'123456.78'", - "comment": [ - "The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units" - ] - }, - { - "name": "best_ask_price", - "lite_name": "ba", - "semantic_type": "string", - "json_type": "string", - "index": 9, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "The best ask price of the instrument, expressed in `9` decimals" - ] - }, - { - "name": "best_ask_size", - "lite_name": "ba1", - "semantic_type": "string", - "json_type": "string", - "index": 10, - "array_depth": 0, - "optional": true, - "example": "'123456.78'", - "comment": [ - "The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units" - ] - }, - { - "name": "funding_rate_8h_curr", - "lite_name": "fr", - "semantic_type": "string", - "json_type": "string", - "index": 11, - "array_depth": 0, - "optional": true, - "example": "0.0003", - "comment": [ - "The current funding rate of the instrument, expressed in percentage points" - ] - }, - { - "name": "funding_rate_8h_avg", - "lite_name": "fr1", - "semantic_type": "string", - "json_type": "string", - "index": 12, - "array_depth": 0, - "optional": true, - "example": "0.0003", - "comment": [ - "The average funding rate of the instrument (over last 8h), expressed in percentage points" - ] - }, - { - "name": "interest_rate", - "lite_name": "ir", - "semantic_type": "string", - "json_type": "string", - "index": 13, - "array_depth": 0, - "optional": true, - "example": "0.0003", - "comment": [ - "The interest rate of the underlying, expressed in centibeeps (1/100th of a basis point)" - ] - }, - { - "name": "forward_price", - "lite_name": "fp", - "semantic_type": "string", - "json_type": "string", - "index": 14, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "[Options] The forward price of the option, expressed in `9` decimals" - ] - }, - { - "name": "buy_volume_24h_b", - "lite_name": "bv", - "semantic_type": "string", - "json_type": "string", - "index": 15, - "array_depth": 0, - "optional": true, - "example": "'123456.78'", - "comment": [ - "The 24 hour taker buy volume of the instrument, expressed in base asset decimal units" - ] - }, - { - "name": "sell_volume_24h_b", - "lite_name": "sv", - "semantic_type": "string", - "json_type": "string", - "index": 16, - "array_depth": 0, - "optional": true, - "example": "'123456.78'", - "comment": [ - "The 24 hour taker sell volume of the instrument, expressed in base asset decimal units" - ] - }, - { - "name": "buy_volume_24h_q", - "lite_name": "bv1", - "semantic_type": "string", - "json_type": "string", - "index": 17, - "array_depth": 0, - "optional": true, - "example": "'123456.78'", - "comment": [ - "The 24 hour taker buy volume of the instrument, expressed in quote asset decimal units" - ] - }, - { - "name": "sell_volume_24h_q", - "lite_name": "sv1", - "semantic_type": "string", - "json_type": "string", - "index": 18, - "array_depth": 0, - "optional": true, - "example": "'123456.78'", - "comment": [ - "The 24 hour taker sell volume of the instrument, expressed in quote asset decimal units" - ] - }, - { - "name": "high_price", - "lite_name": "hp", - "semantic_type": "string", - "json_type": "string", - "index": 19, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "The 24 hour highest traded price of the instrument, expressed in `9` decimals" - ] - }, - { - "name": "low_price", - "lite_name": "lp1", - "semantic_type": "string", - "json_type": "string", - "index": 20, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "The 24 hour lowest traded price of the instrument, expressed in `9` decimals" - ] - }, - { - "name": "open_price", - "lite_name": "op", - "semantic_type": "string", - "json_type": "string", - "index": 21, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", - "comment": [ - "The 24 hour first traded price of the instrument, expressed in `9` decimals" - ] - }, - { - "name": "open_interest", - "lite_name": "oi", - "semantic_type": "string", - "json_type": "string", - "index": 22, - "array_depth": 0, - "optional": true, - "example": "'123456.78'", - "comment": [ - "The open interest in the instrument, expressed in base asset decimal units" - ] - }, - { - "name": "long_short_ratio", - "lite_name": "ls1", - "semantic_type": "string", - "json_type": "string", - "index": 23, - "array_depth": 0, - "optional": true, - "example": "'0.5'", - "comment": [ - "The ratio of accounts that are net long vs net short on this instrument" - ] - } - ], - "comment": [ - "Derived data such as the below, will not be included by default:", - " - 24 hour volume (`buyVolume + sellVolume`)", - " - 24 hour taker buy/sell ratio (`buyVolume / sellVolume`)", - " - 24 hour average trade price (`volumeQ / volumeU`)", - " - 24 hour average trade volume (`volume / trades`)", - " - 24 hour percentage change (`24hStatChange / 24hStat`)", - " - 48 hour statistics (`2 * 24hStat - 24hStatChange`)", - "", - "To query for an extended ticker payload, leverage the `greeks` and the `derived` flags.", - "Ticker extensions are currently under design to offer you more convenience.", - "These flags are only supported on the `Ticker Snapshot` WS endpoint, and on the `Ticker` API endpoint.", - "" - ] - }, - { - "name": "ApiTickerResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "Ticker", - "json_type": "Ticker", - "index": 0, - "array_depth": 0, - "optional": false, - "comment": [ - "The mini ticker matching the request asset" - ] - } - ], - "comment": [] - }, - { - "name": "ApiTradeRequest", - "is_root": true, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "500", - "comment": [ - "The limit to query for. Defaults to 500; Max 1000" - ] - } - ], - "comment": [ - "Retrieves up to 1000 of the most recent trades in any given instrument. Do not use this to poll for data -- a websocket subscription is much more performant, and useful.", - "This endpoint offers public trading data, use the Trading APIs instead to query for your personalized trade tape." - ] - }, - { - "name": "Trade", - "is_root": false, - "fields": [ - { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "Time at which the event was emitted in unix nanoseconds" - ] - }, - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "is_taker_buyer", - "lite_name": "it", - "semantic_type": "bool", - "json_type": "boolean", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "true", - "comment": [ - "If taker was the buyer on the trade" - ] - }, - { - "name": "size", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "'123456.78'", - "comment": [ - "The number of assets being traded, expressed in base asset decimal units" - ] - }, - { - "name": "price", - "lite_name": "p", - "semantic_type": "string", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'65038.01'", - "comment": [ - "The traded price, expressed in `9` decimals" - ] - }, - { - "name": "mark_price", - "lite_name": "mp", - "semantic_type": "string", - "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": false, - "example": "'65038.01'", - "comment": [ - "The mark price of the instrument at point of trade, expressed in `9` decimals" - ] - }, - { - "name": "index_price", - "lite_name": "ip", - "semantic_type": "string", - "json_type": "string", - "index": 6, - "array_depth": 0, - "optional": false, - "example": "'65038.01'", - "comment": [ - "The index price of the instrument at point of trade, expressed in `9` decimals" - ] - }, - { - "name": "interest_rate", - "lite_name": "ir", - "semantic_type": "string", - "json_type": "string", - "index": 7, - "array_depth": 0, - "optional": false, - "example": "0.0003", - "comment": [ - "The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)" - ] - }, - { - "name": "forward_price", - "lite_name": "fp", - "semantic_type": "string", - "json_type": "string", - "index": 8, - "array_depth": 0, - "optional": false, - "example": "'65038.01'", - "comment": [ - "[Options] The forward price of the option at point of trade, expressed in `9` decimals" - ] - }, - { - "name": "trade_id", - "lite_name": "ti", - "semantic_type": "string", - "json_type": "string", - "index": 9, - "array_depth": 0, - "optional": false, - "example": "'209358-2'", - "comment": [ - "A trade identifier, globally unique, and monotonically increasing (not by `1`).", - "All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.", - "`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`." - ] - }, - { - "name": "venue", - "lite_name": "v", - "semantic_type": "Venue", - "json_type": "Venue", - "index": 10, - "array_depth": 0, - "optional": false, - "comment": [ - "The venue where the trade occurred" - ] - } - ], - "comment": [ - "All private RFQs and Private AXEs will be filtered out from the responses" - ] - }, - { - "name": "ApiTradeResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "Trade", - "json_type": "Trade", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The public trades matching the request asset" - ] - } - ], - "comment": [] - }, - { - "name": "ApiTradeHistoryRequest", - "is_root": true, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "start_time", - "lite_name": "st", - "semantic_type": "int64", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", - "comment": [ - "The start time to apply in nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned" - ] - }, - { - "name": "end_time", - "lite_name": "et", - "semantic_type": "int64", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", - "comment": [ - "The end time to apply in nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned" - ] - }, - { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 3, - "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", - "comment": [ - "The limit to query for. Defaults to 500; Max 1000" - ] - }, - { - "name": "cursor", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", - "comment": [ - "The cursor to indicate when to start the query from" - ] - } - ], - "comment": [ - "Perform historical lookup of public trades in any given instrument.", - "This endpoint offers public trading data, use the Trading APIs instead to query for your personalized trade tape.", - "Only data from the last three months will be retained.", - "", - "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "ApiTradeHistoryResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "Trade", - "json_type": "Trade", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The public trades matching the request asset" - ] - }, - { - "name": "next", - "lite_name": "n", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": true, - "default": "''", - "example": "'Qw0918='", - "comment": [ - "The cursor to indicate when to start the next query from" - ] - } - ], - "comment": [] - }, - { - "name": "ApiGetInstrumentRequest", - "is_root": true, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ] - } - ], - "comment": [ - "Fetch a single instrument by supplying the asset or instrument name" - ] - }, - { - "name": "Instrument", - "is_root": false, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "instrument_hash", - "lite_name": "ih", - "semantic_type": "uint256", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'0x030501'", - "comment": [ - "The asset ID used for instrument signing." - ] - }, - { - "name": "base", - "lite_name": "b", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'BTC'", - "comment": [ - "The base currency" - ] - }, - { - "name": "quote", - "lite_name": "q", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "'USDT'", - "comment": [ - "The quote currency" - ] - }, - { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'PERPETUAL'", - "comment": [ - "The kind of instrument" - ] - }, - { - "name": "venues", - "lite_name": "v", - "semantic_type": "Venue", - "json_type": "Venue", - "index": 7, - "array_depth": 1, - "optional": false, - "example": "['ORDERBOOK']", - "comment": [ - "Venues that this instrument can be traded at" - ] - }, - { - "name": "settlement_period", - "lite_name": "sp1", - "semantic_type": "InstrumentSettlementPeriod", - "json_type": "InstrumentSettlementPeriod", - "index": 8, - "array_depth": 0, - "optional": false, - "example": "'PERPETUAL'", - "comment": [ - "The settlement period of the instrument" - ] - }, - { - "name": "base_decimals", - "lite_name": "bd", - "semantic_type": "int8", - "json_type": "integer", - "index": 9, - "array_depth": 0, - "optional": false, - "example": "3", - "comment": [ - "The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)" - ] - }, - { - "name": "quote_decimals", - "lite_name": "qd", - "semantic_type": "int8", - "json_type": "integer", - "index": 10, - "array_depth": 0, - "optional": false, - "example": "3", - "comment": [ - "The smallest denomination of the quote asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)" - ] - }, - { - "name": "tick_size", - "lite_name": "ts", - "semantic_type": "string", - "json_type": "string", - "index": 11, - "array_depth": 0, - "optional": false, - "example": "'0.01'", - "comment": [ - "The size of a single tick, expressed in price decimal units" - ] - }, - { - "name": "min_size", - "lite_name": "ms", - "semantic_type": "string", - "json_type": "string", - "index": 12, - "array_depth": 0, - "optional": false, - "example": "'0.01'", - "comment": [ - "The minimum contract size, expressed in base asset decimal units" - ] - }, - { - "name": "create_time", - "lite_name": "ct", - "semantic_type": "timestamp", - "json_type": "string", - "index": 14, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "Creation time in unix nanoseconds" - ] - }, - { - "name": "max_position_size", - "lite_name": "mp", - "semantic_type": "string", - "json_type": "string", - "index": 15, - "array_depth": 0, - "optional": false, - "example": "'100.0'", - "comment": [ - "The maximum position size, expressed in base asset decimal units" - ] - } - ], - "comment": [] - }, - { - "name": "ApiGetInstrumentResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "Instrument", - "json_type": "Instrument", - "index": 0, - "array_depth": 0, - "optional": false, - "comment": [ - "The instrument matching the request asset" - ] - } - ], - "comment": [] - }, - { - "name": "ApiGetFilteredInstrumentsRequest", - "is_root": true, - "fields": [ - { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", - "index": 0, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['PERPETUAL']", - "comment": [ - "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" - ] - }, - { - "name": "base", - "lite_name": "b", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 1, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", - "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" - ] - }, - { - "name": "quote", - "lite_name": "q", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 2, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['USDT', 'USDC']", - "comment": [ - "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" - ] - }, - { - "name": "is_active", - "lite_name": "ia", - "semantic_type": "bool", - "json_type": "boolean", - "index": 3, - "array_depth": 0, - "optional": true, - "default": "false", - "example": "true", - "comment": [ - "Request for active instruments only" - ] - }, - { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 4, - "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", - "comment": [ - "The limit to query for. Defaults to 500; Max 100000" - ] - } - ], - "comment": [ - "Fetch a list of instruments based on the filters provided" - ] - }, - { - "name": "ApiGetFilteredInstrumentsResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "Instrument", - "json_type": "Instrument", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The instruments matching the request filter" - ] - } - ], - "comment": [] - }, - { - "name": "ApiCandlestickRequest", - "is_root": true, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "interval", - "lite_name": "i1", - "semantic_type": "CandlestickInterval", - "json_type": "CandlestickInterval", - "index": 1, - "array_depth": 0, - "optional": false, - "comment": [ - "The interval of each candlestick" - ] - }, - { - "name": "type", - "lite_name": "t", - "semantic_type": "CandlestickType", - "json_type": "CandlestickType", - "index": 2, - "array_depth": 0, - "optional": false, - "comment": [ - "The type of candlestick data to retrieve" - ] - }, - { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", - "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", - "comment": [ - "Start time of kline data in unix nanoseconds" - ] - }, - { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", - "comment": [ - "End time of kline data in unix nanoseconds" - ] - }, - { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 5, - "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", - "comment": [ - "The limit to query for. Defaults to 500; Max 1000" - ] - }, - { - "name": "cursor", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", - "index": 6, - "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", - "comment": [ - "The cursor to indicate when to start the query from" - ] - } - ], - "comment": [ - "Kline/Candlestick bars for an instrument. Klines are uniquely identified by their instrument, type, interval, and open time.", - "", - "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "Candlestick", - "is_root": false, - "fields": [ - { - "name": "open_time", - "lite_name": "ot", - "semantic_type": "timestamp", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "Open time of kline bar in unix nanoseconds" - ] - }, - { - "name": "close_time", - "lite_name": "ct", - "semantic_type": "timestamp", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "Close time of kline bar in unix nanosecond" - ] - }, - { - "name": "open", - "lite_name": "o", - "semantic_type": "string", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'123456.78'", - "comment": [ - "The open price, expressed in underlying currency resolution units" - ] - }, - { - "name": "close", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "'123456.78'", - "comment": [ - "The close price, expressed in underlying currency resolution units" - ] - }, - { - "name": "high", - "lite_name": "h", - "semantic_type": "string", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'123456.78'", - "comment": [ - "The high price, expressed in underlying currency resolution units" - ] - }, - { - "name": "low", - "lite_name": "l", - "semantic_type": "string", - "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": false, - "example": "'123456.78'", - "comment": [ - "The low price, expressed in underlying currency resolution units" - ] - }, - { - "name": "volume_b", - "lite_name": "vb", - "semantic_type": "string", - "json_type": "string", - "index": 6, - "array_depth": 0, - "optional": false, - "example": "'123456.78'", - "comment": [ - "The underlying volume transacted, expressed in base asset decimal units" - ] - }, - { - "name": "volume_q", - "lite_name": "vq", - "semantic_type": "string", - "json_type": "string", - "index": 7, - "array_depth": 0, - "optional": false, - "example": "'123456.78'", - "comment": [ - "The quote volume transacted, expressed in quote asset decimal units" - ] - }, - { - "name": "trades", - "lite_name": "t", - "semantic_type": "uint32", - "json_type": "integer", - "index": 8, - "array_depth": 0, - "optional": false, - "example": "123456", - "comment": [ - "The number of trades transacted" - ] - }, - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 9, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ] - } - ], - "comment": [ - "" - ] - }, - { - "name": "ApiCandlestickResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "Candlestick", - "json_type": "Candlestick", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The candlestick result set for given interval" - ] - }, - { - "name": "next", - "lite_name": "n", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": true, - "default": "''", - "example": "'Qw0918='", - "comment": [ - "The cursor to indicate when to start the next query from" - ] - } - ], - "comment": [] - }, - { - "name": "ApiFundingRateRequest", - "is_root": true, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", - "comment": [ - "Start time of funding rate in unix nanoseconds" - ] - }, - { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", - "comment": [ - "End time of funding rate in unix nanoseconds" - ] - }, - { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 3, - "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", - "comment": [ - "The limit to query for. Defaults to 500; Max 1000" - ] - }, - { - "name": "cursor", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", - "comment": [ - "The cursor to indicate when to start the query from" - ] - } - ], - "comment": [ - "Lookup the historical funding rate of a perpetual future.", - "", - "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "FundingRate", - "is_root": false, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "funding_rate", - "lite_name": "fr", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "0.0003", - "comment": [ - "The funding rate of the instrument, expressed in percentage points" - ] - }, - { - "name": "funding_time", - "lite_name": "ft", - "semantic_type": "timestamp", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "The funding timestamp of the funding rate, expressed in unix nanoseconds" - ] - }, - { - "name": "mark_price", - "lite_name": "mp", - "semantic_type": "string", - "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "'65038.01'", - "comment": [ - "The mark price of the instrument at funding timestamp, expressed in `9` decimals" - ] - } - ], - "comment": [] - }, - { - "name": "ApiFundingRateResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "FundingRate", - "json_type": "FundingRate", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The funding rate result set for given interval" - ] - }, - { - "name": "next", - "lite_name": "n", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": true, - "default": "''", - "example": "'Qw0918='", - "comment": [ - "The cursor to indicate when to start the next query from" - ] - } - ], - "comment": [] - }, - { - "name": "ApiSettlementPriceRequest", - "is_root": true, - "fields": [ - { - "name": "base", - "lite_name": "b", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC'", - "comment": [ - "The base currency to select" - ] - }, - { - "name": "quote", - "lite_name": "q", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'USDT'", - "comment": [ - "The quote currency to select" - ] - }, - { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", - "comment": [ - "Start time of settlement price in unix nanoseconds" - ] - }, - { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", - "comment": [ - "End time of settlement price in unix nanoseconds" - ] - }, - { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 4, - "array_depth": 0, - "optional": true, - "default": "30", - "example": "20", - "comment": [ - "The limit to query for. Defaults to 500; Max 1000" - ] - }, - { - "name": "cursor", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", - "comment": [ - "The cursor to indicate when to start the query from" - ] - } - ], - "comment": [ - "Lookup the historical settlement price of various pairs.", - "", - "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "APISettlementPrice", - "is_root": false, - "fields": [ - { - "name": "base", - "lite_name": "b", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC'", - "comment": [ - "The base currency of the settlement price" - ] - }, - { - "name": "quote", - "lite_name": "q", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'USDT'", - "comment": [ - "The quote currency of the settlement price" - ] - }, - { - "name": "settlement_time", - "lite_name": "st", - "semantic_type": "timestamp", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "The settlement timestamp of the settlement price, expressed in unix nanoseconds" - ] - }, - { - "name": "settlement_price", - "lite_name": "sp", - "semantic_type": "string", - "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "'65038.01'", - "comment": [ - "The settlement price, expressed in `9` decimals" - ] - } - ], - "comment": [] - }, - { - "name": "ApiSettlementPriceResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "APISettlementPrice", - "json_type": "APISettlementPrice", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The funding rate result set for given interval" - ] - }, - { - "name": "next", - "lite_name": "n", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": true, - "default": "''", - "example": "'Qw0918='", - "comment": [ - "The cursor to indicate when to start the next query from" - ] - } - ], - "comment": [] - }, - { - "name": "JSONRPCRequest", - "is_root": true, - "fields": [ - { - "name": "jsonrpc", - "lite_name": "j", - "semantic_type": "string", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'2.0'", - "comment": [ - "The JSON RPC version to use for the request" - ] - }, - { - "name": "method", - "lite_name": "m", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'subscribe'", - "comment": [ - "The method to use for the request (eg: `subscribe` / `unsubscribe` / `v1/instrument` )" - ] - }, - { - "name": "params", - "lite_name": "p", - "semantic_type": "any", - "json_type": "object", - "index": 2, - "array_depth": 0, - "optional": false, - "comment": [ - "The parameters for the request" - ] - }, - { - "name": "id", - "lite_name": "i", - "semantic_type": "uint32", - "json_type": "integer", - "index": 3, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "123", - "comment": [ - "Optional Field which is used to match the response by the client.", - "If not passed, this field will not be returned" - ] - } - ], - "comment": [ - "All Websocket JSON RPC Requests are housed in this wrapper. You may specify a stream, and a list of feeds to subscribe to.", - "If a `request_id` is supplied in this JSON RPC request, it will be propagated back to any relevant JSON RPC responses (including error).", - "When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details." - ] - }, - { - "name": "Error", - "is_root": true, - "fields": [ - { - "name": "code", - "lite_name": "c", - "semantic_type": "uint16", - "json_type": "integer", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "123", - "comment": [ - "The error code for the request" - ] - }, - { - "name": "message", - "lite_name": "m", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'An error occurred'", - "comment": [ - "The error message for the request" - ] - } - ], - "comment": [ - "An error response" - ] - }, - { - "name": "JSONRPCResponse", - "is_root": true, - "fields": [ - { - "name": "jsonrpc", - "lite_name": "j", - "semantic_type": "string", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'2.0'", - "comment": [ - "The JSON RPC version to use for the request" - ] - }, - { - "name": "result", - "lite_name": "r", - "semantic_type": "any", - "json_type": "object", - "index": 1, - "array_depth": 0, - "optional": true, - "default": "null", - "comment": [ - "The result for the request" - ] - }, - { - "name": "error", - "lite_name": "e", - "semantic_type": "Error", - "json_type": "Error", - "index": 2, - "array_depth": 0, - "optional": true, - "default": "null", - "comment": [ - "The error for the request" - ] - }, - { - "name": "id", - "lite_name": "i", - "semantic_type": "uint32", - "json_type": "integer", - "index": 3, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "123", - "comment": [ - "Optional Field which is used to match the response by the client.", - "If not passed, this field will not be returned" - ] - }, - { - "name": "method", - "lite_name": "m", - "semantic_type": "string", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'subscribe'", - "comment": [ - "The method used in the request for this response (eg: `subscribe` / `unsubscribe` / `v1/instrument` )" - ] - } - ], - "comment": [ - "All Websocket JSON RPC Responses are housed in this wrapper. It returns a confirmation of the JSON RPC subscribe request.", - "If a `request_id` is supplied in the JSON RPC request, it will be propagated back in this JSON RPC response." - ] - }, - { - "name": "WSSubscribeParams", - "is_root": true, - "fields": [ - { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'v1.ticker.d'", - "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" - ] - }, - { - "name": "selectors", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 1, - "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", - "comment": [ - "The list of feeds to subscribe to" - ] - }, - { - "name": "use_global_sequence_number", - "lite_name": "ug", - "semantic_type": "bool", - "json_type": "boolean", - "index": 2, - "array_depth": 0, - "optional": true, - "default": "false", - "example": "true", - "comment": [ - "Whether to use the global sequence number for the stream" - ] - } - ], - "comment": [ - "All V1 Websocket Subscription Requests are housed in this wrapper. You may specify a stream and a list of feeds to subscribe to.", - "When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details.", - "Sequence numbers can be either gateway-specific or global:", - "- **Gateway Unique Sequence Number**: Increments by one per stream, resets to 0 on gateway restart.", - "- **Global Unique Sequence Number**: A cluster-wide unique number assigned to each cluster payload, does not reset on gateway restarts, and can be used to track and identify message order across streams using `sequence_number` and `prev_sequence_number` in the feed response.", - "Set `useGlobalSequenceNumber = true` if you need a persistent, unique identifier across all streams or ordering across multiple feeds." - ] - }, - { - "name": "WSSubscribeResult", - "is_root": true, - "fields": [ - { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'v1.ticker.d'", - "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" - ] - }, - { - "name": "subs", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 1, - "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", - "comment": [ - "The list of feeds subscribed to" - ] - }, - { - "name": "unsubs", - "lite_name": "u", - "semantic_type": "string", - "json_type": "string", - "index": 2, - "array_depth": 1, - "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", - "comment": [ - "The list of feeds unsubscribed from" - ] - }, - { - "name": "num_snapshots", - "lite_name": "ns", - "semantic_type": "uint32", - "json_type": "integer", - "index": 3, - "array_depth": 1, - "optional": false, - "example": "10", - "comment": [ - "The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs`" - ] - }, - { - "name": "first_sequence_number", - "lite_name": "fs", - "semantic_type": "uint64", - "json_type": "string", - "index": 4, - "array_depth": 1, - "optional": false, - "example": "872634876", - "comment": [ - "The first sequence number to expect for each subscribed feed. Returned in same order as `subs`" - ] - }, - { - "name": "latest_sequence_number", - "lite_name": "ls", - "semantic_type": "uint64", - "json_type": "string", - "index": 5, - "array_depth": 1, - "optional": false, - "example": "872634875", - "comment": [ - "The sequence number of the most recent message in the stream. Next received sequence number must be larger than this one. Returned in same order as `subs`" - ] - } - ], - "comment": [ - "To ensure you always know if you have missed any payloads, GRVT servers apply the following heuristics to sequence numbers:\u003cul\u003e\u003cli\u003eAll snapshot payloads will have a sequence number of `0`. All delta payloads will have a sequence number of `1+`. So its easy to distinguish between snapshots, and deltas\u003c/li\u003e\u003cli\u003eNum snapshots returned in Response (per stream): You can ensure that you received the right number of snapshots\u003c/li\u003e\u003cli\u003eFirst sequence number returned in Response (per stream): You can ensure that you received the first stream, without gaps from snapshots\u003c/li\u003e\u003cli\u003eSequence numbers should always monotonically increase by `1`. If it decreases, or increases by more than `1`. Please reconnect\u003c/li\u003e\u003cli\u003eDuplicate sequence numbers are possible due to network retries. If you receive a duplicate, please ignore it, or idempotently re-update it.\u003c/li\u003e\u003c/ul\u003e", - "When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details." - ] - }, - { - "name": "WSUnsubscribeParams", - "is_root": true, - "fields": [ - { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'v1.ticker.d'", - "comment": [ - "The channel to unsubscribe from (eg: ticker.s / ticker.d)" - ] - }, - { - "name": "selectors", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 1, - "optional": false, - "example": "['BTC_USDT_Perp', 'ETH_USDT_Perp']", - "comment": [ - "The list of feeds to unsubscribe from" - ] - }, - { - "name": "use_global_sequence_number", - "lite_name": "ug", - "semantic_type": "bool", - "json_type": "boolean", - "index": 2, - "array_depth": 0, - "optional": true, - "default": "false", - "example": "true", - "comment": [ - "Whether to use the global sequence number for the stream" - ] - } - ], - "comment": [ - "All V1 Websocket Unsubscription Requests are housed in this wrapper. You may specify a stream, a list of feeds and whether those feeds use global sequence numbers to unsubscribe from." - ] - }, - { - "name": "WSUnsubscribeResult", - "is_root": true, - "fields": [ - { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'v1.ticker.d'", - "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" - ] - }, - { - "name": "unsubs", - "lite_name": "u", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 1, - "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", - "comment": [ - "The list of feeds unsubscribed from" - ] - } - ], - "comment": [ - "Returns a confirmation of all unsubscribes" - ] - }, - { - "name": "WSSubscribeRequestV1Legacy", - "is_root": true, - "fields": [ - { - "name": "request_id", - "lite_name": "ri", - "semantic_type": "uint32", - "json_type": "integer", - "index": 0, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "123", - "comment": [ - "Optional Field which is used to match the response by the client.", - "If not passed, this field will not be returned" - ] - }, - { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'v1.ticker.d'", - "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" - ] - }, - { - "name": "feed", - "lite_name": "f", - "semantic_type": "string", - "json_type": "string", - "index": 2, - "array_depth": 1, - "optional": false, - "example": "['BTC_USDT_Perp', 'ETH_USDT_Perp']", - "comment": [ - "The list of feeds to subscribe to" - ] - }, - { - "name": "method", - "lite_name": "m", - "semantic_type": "string", - "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "'subscribe'", - "comment": [ - "The method to use for the request (eg: subscribe / unsubscribe)" - ] - }, - { - "name": "is_full", - "lite_name": "if", - "semantic_type": "bool", - "json_type": "boolean", - "index": 4, - "array_depth": 0, - "optional": true, - "default": "false", - "example": "true", - "comment": [ - "Whether the request is for full data or lite data" - ] - } - ], - "comment": [ - "All V1 Websocket Requests are housed in this wrapper. You may specify a stream, and a list of feeds to subscribe to.", - "If a `request_id` is supplied in this JSON RPC request, it will be propagated back to any relevant JSON RPC responses (including error).", - "When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details." - ] - }, - { - "name": "WSSubscribeResponseV1Legacy", - "is_root": true, - "fields": [ - { - "name": "request_id", - "lite_name": "ri", - "semantic_type": "uint32", - "json_type": "integer", - "index": 0, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "123", - "comment": [ - "Optional Field which is used to match the response by the client.", - "If not passed, this field will not be returned" - ] - }, - { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'v1.ticker.d'", - "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" - ] - }, - { - "name": "subs", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", - "index": 2, - "array_depth": 1, - "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", - "comment": [ - "The list of feeds subscribed to" - ] - }, - { - "name": "unsubs", - "lite_name": "u", - "semantic_type": "string", - "json_type": "string", - "index": 3, - "array_depth": 1, - "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", - "comment": [ - "The list of feeds unsubscribed from" - ] - }, - { - "name": "num_snapshots", - "lite_name": "ns", - "semantic_type": "uint32", - "json_type": "integer", - "index": 4, - "array_depth": 1, - "optional": false, - "example": "10", - "comment": [ - "The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs`" - ] - }, - { - "name": "first_sequence_number", - "lite_name": "fs", - "semantic_type": "uint64", - "json_type": "string", - "index": 5, - "array_depth": 1, - "optional": false, - "example": "872634876", - "comment": [ - "The first sequence number to expect for each subscribed feed. Returned in same order as `subs`" - ] - }, - { - "name": "latest_sequence_number", - "lite_name": "ls", - "semantic_type": "uint64", - "json_type": "string", - "index": 6, - "array_depth": 1, - "optional": false, - "example": "872634875", - "comment": [ - "The sequence number of the most recent message in the stream. Next received sequence number must be larger than this one. Returned in same order as `subs`" - ] - } - ], - "comment": [ - "All V1 Websocket Responses are housed in this wrapper. It returns a confirmation of the JSON RPC subscribe request.", - "If a `request_id` is supplied in the JSON RPC request, it will be propagated back in this JSON RPC response.", - "To ensure you always know if you have missed any payloads, GRVT servers apply the following heuristics to sequence numbers:\u003cul\u003e\u003cli\u003eAll snapshot payloads will have a sequence number of `0`. All delta payloads will have a sequence number of `1+`. So its easy to distinguish between snapshots, and deltas\u003c/li\u003e\u003cli\u003eNum snapshots returned in Response (per stream): You can ensure that you received the right number of snapshots\u003c/li\u003e\u003cli\u003eFirst sequence number returned in Response (per stream): You can ensure that you received the first stream, without gaps from snapshots\u003c/li\u003e\u003cli\u003eSequence numbers should always monotonically increase by `1`. If it decreases, or increases by more than `1`. Please reconnect\u003c/li\u003e\u003cli\u003eDuplicate sequence numbers are possible due to network retries. If you receive a duplicate, please ignore it, or idempotently re-update it.\u003c/li\u003e\u003c/ul\u003e", - "When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details." - ] - }, - { - "name": "WSOrderbookLevelsFeedSelectorV1", - "is_root": true, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ], - "selector": "primary" - }, - { - "name": "rate", - "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "500", - "comment": [ - "The minimal rate at which we publish feeds (in milliseconds)", - "Delta (50, 100, 500, 1000)", - "Snapshot (500, 1000)" - ], - "selector": "secondary" - }, - { - "name": "depth", - "lite_name": "d", - "semantic_type": "uint32", - "json_type": "integer", - "index": 2, - "array_depth": 0, - "optional": true, - "default": "'0'", - "example": "50", - "comment": [ - "Depth of the order book to be retrieved", - "Delta(0 - `unlimited`)", - "Snapshot(10, 50, 100, 500)" - ], - "selector": "secondary" - } - ], - "comment": [ - "Subscribes to aggregated orderbook updates for a single instrument. The `book.s` channel offers simpler integration. To experience higher publishing rates, please use the `book.d` channel.", - "Unlike the `book.d` channel which publishes an initial snapshot, then only streams deltas after, the `book.s` channel publishes full snapshots at each feed.", - "", - "The Delta feed will work as follows:\u003cul\u003e\u003cli\u003eOn subscription, the server will send a full snapshot of all levels of the Orderbook.\u003c/li\u003e\u003cli\u003eAfter the snapshot, the server will only send levels that have changed in value.\u003c/li\u003e\u003c/ul\u003e", - "", - "Subscription Pattern:\u003cul\u003e\u003cli\u003eDelta - `instrument@rate`\u003c/li\u003e\u003cli\u003eSnapshot - `instrument@rate-depth`\u003c/li\u003e\u003c/ul\u003e", - "", - "Field Semantics:\u003cul\u003e\u003cli\u003e[DeltaOnly] If a level is not updated, level not published\u003c/li\u003e\u003cli\u003eIf a level is updated, {size: '123'}\u003c/li\u003e\u003cli\u003eIf a level is set to zero, {size: '0'}\u003c/li\u003e\u003cli\u003eIncoming levels will be published as soon as price moves\u003c/li\u003e\u003cli\u003eOutgoing levels will be published with `size = 0`\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "WSOrderbookLevelsFeedDataV1", - "is_root": true, - "fields": [ - { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'v1.book.s'", - "comment": [ - "Stream name" - ] - }, - { - "name": "selector", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "Primary selector" - ] - }, - { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'872634876'", - "comment": [ - "A sequence number used to determine message order within a stream.", - "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", - "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", - " - A single cluster payload can be multiplexed into multiple stream payloads.", - " - To distinguish each stream payload, a `dedupCounter` is included.", - " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." - ] - }, - { - "name": "feed", - "lite_name": "f", - "semantic_type": "OrderbookLevels", - "json_type": "OrderbookLevels", - "index": 3, - "array_depth": 0, - "optional": false, - "comment": [ - "An orderbook levels object matching the request filter" - ] - }, - { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'872634875'", - "comment": [ - "The previous sequence number that determines the message order" - ] - } - ], - "comment": [] - }, - { - "name": "WSMiniTickerFeedSelectorV1", - "is_root": true, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ], - "selector": "primary" - }, - { - "name": "rate", - "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "500", - "comment": [ - "The minimal rate at which we publish feeds (in milliseconds)", - "Delta (0 - `raw`, 50, 100, 200, 500, 1000, 5000)", - "Snapshot (200, 500, 1000, 5000)" - ], - "selector": "secondary" - } - ], - "comment": [ - "Subscribes to a mini ticker feed for a single instrument. The `mini.s` channel offers simpler integration. To experience higher publishing rates, please use the `mini.d` channel.", - "Unlike the `mini.d` channel which publishes an initial snapshot, then only streams deltas after, the `mini.s` channel publishes full snapshots at each feed.", - "", - "The Delta feed will work as follows:\u003cul\u003e\u003cli\u003eOn subscription, the server will send a full snapshot of the mini ticker.\u003c/li\u003e\u003cli\u003eAfter the snapshot, the server will only send deltas of the mini ticker.\u003c/li\u003e\u003cli\u003eThe server will send a delta if any of the fields in the mini ticker have changed.\u003c/li\u003e\u003c/ul\u003e", - "", - "Field Semantics:\u003cul\u003e\u003cli\u003e[DeltaOnly] If a field is not updated, {}\u003c/li\u003e\u003cli\u003eIf a field is updated, {field: '123'}\u003c/li\u003e\u003cli\u003eIf a field is set to zero, {field: '0'}\u003c/li\u003e\u003cli\u003eIf a field is set to null, {field: ''}\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "WSMiniTickerFeedDataV1", - "is_root": true, - "fields": [ - { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'v1.mini.s'", - "comment": [ - "Stream name" - ] - }, - { - "name": "selector", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "Primary selector" - ] - }, - { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'872634876'", - "comment": [ - "A sequence number used to determine message order within a stream.", - "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", - "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", - " - A single cluster payload can be multiplexed into multiple stream payloads.", - " - To distinguish each stream payload, a `dedupCounter` is included.", - " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." - ] - }, - { - "name": "feed", - "lite_name": "f", - "semantic_type": "MiniTicker", - "json_type": "MiniTicker", - "index": 3, - "array_depth": 0, - "optional": false, - "comment": [ - "A mini ticker matching the request filter" - ] - }, - { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'872634875'", - "comment": [ - "The previous sequence number that determines the message order" - ] - } - ], - "comment": [] - }, - { - "name": "WSTickerFeedSelectorV1", - "is_root": true, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ], - "selector": "primary" - }, - { - "name": "rate", - "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "500", - "comment": [ - "The minimal rate at which we publish feeds (in milliseconds)", - "Delta (100, 200, 500, 1000, 5000)", - "Snapshot (500, 1000, 5000)" - ], - "selector": "secondary" - } - ], - "comment": [ - "Subscribes to a ticker feed for a single instrument. The `ticker.s` channel offers simpler integration. To experience higher publishing rates, please use the `ticker.d` channel.", - "Unlike the `ticker.d` channel which publishes an initial snapshot, then only streams deltas after, the `ticker.s` channel publishes full snapshots at each feed.", - "", - "The Delta feed will work as follows:\u003cul\u003e\u003cli\u003eOn subscription, the server will send a full snapshot of the ticker.\u003c/li\u003e\u003cli\u003eAfter the snapshot, the server will only send deltas of the ticker.\u003c/li\u003e\u003cli\u003eThe server will send a delta if any of the fields in the ticker have changed.\u003c/li\u003e\u003c/ul\u003e", - "", - "Field Semantics:\u003cul\u003e\u003cli\u003e[DeltaOnly] If a field is not updated, {}\u003c/li\u003e\u003cli\u003eIf a field is updated, {field: '123'}\u003c/li\u003e\u003cli\u003eIf a field is set to zero, {field: '0'}\u003c/li\u003e\u003cli\u003eIf a field is set to null, {field: ''}\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "WSTickerFeedDataV1", - "is_root": true, - "fields": [ - { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'v1.ticker.s'", - "comment": [ - "Stream name" - ] - }, - { - "name": "selector", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "Primary selector" - ] - }, - { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'872634876'", - "comment": [ - "A sequence number used to determine message order within a stream.", - "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", - "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", - " - A single cluster payload can be multiplexed into multiple stream payloads.", - " - To distinguish each stream payload, a `dedupCounter` is included.", - " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." - ] - }, - { - "name": "feed", - "lite_name": "f", - "semantic_type": "Ticker", - "json_type": "Ticker", - "index": 3, - "array_depth": 0, - "optional": false, - "comment": [ - "A ticker matching the request filter" - ] - }, - { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'872634875'", - "comment": [ - "The previous sequence number that determines the message order" - ] - } - ], - "comment": [] - }, - { - "name": "ApiTickerFeedDataV1", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "Ticker", - "json_type": "Ticker", - "index": 0, - "array_depth": 0, - "optional": false, - "comment": [ - "The mini ticker matching the request asset" - ] - } - ], - "comment": [] - }, - { - "name": "WSTradeFeedSelectorV1", - "is_root": true, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ], - "selector": "primary" - }, - { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "500", - "comment": [ - "The limit to query for. Valid values are (50, 200, 500, 1000). Default is 50" - ], - "selector": "secondary" - } - ], - "comment": [ - "Subscribes to a stream of Public Trades for an instrument." - ] - }, - { - "name": "WSTradeFeedDataV1", - "is_root": true, - "fields": [ - { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'v1.trade'", - "comment": [ - "Stream name" - ] - }, - { - "name": "selector", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "Primary selector" - ] - }, - { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'872634876'", - "comment": [ - "A sequence number used to determine message order within a stream.", - "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", - "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", - " - A single cluster payload can be multiplexed into multiple stream payloads.", - " - To distinguish each stream payload, a `dedupCounter` is included.", - " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." - ] - }, - { - "name": "feed", - "lite_name": "f", - "semantic_type": "Trade", - "json_type": "Trade", - "index": 3, - "array_depth": 0, - "optional": false, - "comment": [ - "A public trade matching the request filter" - ] - }, - { - "name": "prev_sequence_number", - "lite_name": "ps", + "name": "sub_account_id", + "lite_name": "sa", "semantic_type": "uint64", "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'872634875'", - "comment": [ - "The previous sequence number that determines the message order" - ] - } - ], - "comment": [] - }, - { - "name": "WSCandlestickFeedSelectorV1", - "is_root": true, - "fields": [ - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" - ], - "selector": "primary" - }, - { - "name": "interval", - "lite_name": "i1", - "semantic_type": "CandlestickInterval", - "json_type": "CandlestickInterval", - "index": 1, - "array_depth": 0, - "optional": false, - "comment": [ - "The interval of each candlestick" - ], - "selector": "secondary" - }, - { - "name": "type", - "lite_name": "t", - "semantic_type": "CandlestickType", - "json_type": "CandlestickType", - "index": 2, - "array_depth": 0, - "optional": false, - "comment": [ - "The type of candlestick data to retrieve" - ], - "selector": "secondary" - } - ], - "comment": [ - "Subscribes to a stream of Kline/Candlestick updates for an instrument. A Kline is uniquely identified by its open time.", - "A new Kline is published every interval (if it exists). Upon subscription, the server will send the 5 most recent Kline for the requested interval." - ] - }, - { - "name": "WSCandlestickFeedDataV1", - "is_root": true, - "fields": [ - { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.candle'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "Stream name" + "The sub account ID to request for" ] }, { - "name": "selector", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", "index": 1, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['PERPETUAL']", "comment": [ - "Primary selector" + "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", - "json_type": "string", + "name": "base", + "lite_name": "b", + "semantic_type": "Currency", + "json_type": "Currency", "index": 2, - "array_depth": 0, - "optional": false, - "example": "'872634876'", - "comment": [ - "A sequence number used to determine message order within a stream.", - "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", - "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", - " - A single cluster payload can be multiplexed into multiple stream payloads.", - " - To distinguish each stream payload, a `dedupCounter` is included.", - " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." - ] - }, - { - "name": "feed", - "lite_name": "f", - "semantic_type": "Candlestick", - "json_type": "Candlestick", - "index": 3, - "array_depth": 0, - "optional": false, - "comment": [ - "A candlestick entry matching the request filters" - ] - }, - { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'872634875'", - "comment": [ - "The previous sequence number that determines the message order" - ] - } - ], - "comment": [] - }, - { - "name": "WSUnsubscribeAllParams", - "is_root": true, - "fields": [], - "comment": [ - "All V1 Websocket Unsubscription Request to unsubscribe from all active websocket streams." - ] - }, - { - "name": "StreamReference", - "is_root": false, - "fields": [ - { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'v1.ticker.d'", - "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" - ] - }, - { - "name": "selectors", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 1, - "optional": false, - "example": "['BTC_USDT_Perp', 'ETH_USDT_Perp']", - "comment": [ - "The list of selectors for the stream" - ] - } - ], - "comment": [] - }, - { - "name": "WSUnsubscribeAllResult", - "is_root": true, - "fields": [ - { - "name": "stream_reference", - "lite_name": "sr", - "semantic_type": "StreamReference", - "json_type": "StreamReference", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The list of stream references unsubscribed from" - ] - } - ], - "comment": [ - "Returns a list of all rooms the client has unsubscribed from." - ] - }, - { - "name": "WSListStreamsParams", - "is_root": true, - "fields": [], - "comment": [ - "List down all the streams this connection has connected to." - ] - }, - { - "name": "WSListStreamsResult", - "is_root": true, - "fields": [ - { - "name": "stream_reference", - "lite_name": "sr", - "semantic_type": "StreamReference", - "json_type": "StreamReference", - "index": 0, "array_depth": 1, - "optional": false, - "comment": [ - "The list of stream references the connection is connected to" - ] - } - ], - "comment": [ - "Returns a list of all rooms the client has subscribed to." - ] - }, - { - "name": "ApiGetAllInstrumentsRequest", - "is_root": true, - "fields": [ - { - "name": "is_active", - "lite_name": "ia", - "semantic_type": "bool", - "json_type": "boolean", - "index": 0, - "array_depth": 0, "optional": true, - "default": "false", - "example": "true", + "default": "all", + "example": "['BTC', 'ETH']", "comment": [ - "Fetch only active instruments" + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" ] - } - ], - "comment": [ - "Fetch all instruments" - ] - }, - { - "name": "ApiGetAllInstrumentsResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "Instrument", - "json_type": "Instrument", - "index": 0, + "name": "quote", + "lite_name": "q", + "semantic_type": "Currency", + "json_type": "Currency", + "index": 3, "array_depth": 1, - "optional": false, + "optional": true, + "default": "all", + "example": "['USDT', 'USDC']", "comment": [ - "List of instruments" + "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" ] } ], - "comment": [] + "comment": [ + "Query the positions of a sub account" + ] }, { - "name": "SnapFundingAccountSummary", - "is_root": true, + "name": "Positions", + "is_root": false, "fields": [ { "name": "event_time", @@ -8173,112 +2345,112 @@ ] }, { - "name": "start_interval", - "lite_name": "si", - "semantic_type": "timestamp", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The start of the interval in unix nanoseconds" + "The sub account ID that participated in the trade" ] }, { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The main account ID of the account to which the summary belongs" + "The instrument being represented" ] }, { - "name": "total_equity", - "lite_name": "te", + "name": "size", + "lite_name": "s", "semantic_type": "string", "json_type": "string", "index": 3, "array_depth": 0, "optional": false, - "example": "'3945034.23'", + "example": "'2635000.50'", "comment": [ - "Total equity of the main account, denominated in USD" + "The size of the position, expressed in base asset decimal units. Negative for short positions" ] }, { - "name": "spot_balances", - "lite_name": "sb", - "semantic_type": "SpotBalance", - "json_type": "SpotBalance", + "name": "notional", + "lite_name": "n", + "semantic_type": "string", + "json_type": "string", "index": 4, - "array_depth": 1, + "array_depth": 0, "optional": false, + "example": "'2635000.50'", "comment": [ - "The list of spot assets owned by this main account, and their balances" + "The notional value of the position, negative for short assets, expressed in quote asset decimal units" ] - } - ], - "comment": [ - "The funding account summary, that reports the total equity and spot balances of a funding (main) account" - ] - }, - { - "name": "ApiQueryTradingPerformanceRequest", - "is_root": true, - "fields": [ + }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "entry_price", + "lite_name": "ep", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 5, "array_depth": 0, - "optional": true, - "default": "all", - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "optional": false, + "example": "'65038.01'", "comment": [ - "Optional: The subaccount ID to filter by" + "The entry price of the position, expressed in `9` decimals", + "Whenever increasing the size of a position, the entry price is updated to the new average entry price", + "`new_entry_price = (old_entry_price * old_size + trade_price * trade_size) / (old_size + trade_size)`" ] }, { - "name": "asset", - "lite_name": "a", - "semantic_type": "[]byte", - "json_type": "unknown", - "index": 1, + "name": "exit_price", + "lite_name": "ep1", + "semantic_type": "string", + "json_type": "string", + "index": 6, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'65038.01'", "comment": [ - "The asset to filter by" + "The exit price of the position, expressed in `9` decimals", + "Whenever decreasing the size of a position, the exit price is updated to the new average exit price", + "`new_exit_price = (old_exit_price * old_exit_trade_size + trade_price * trade_size) / (old_exit_trade_size + trade_size)`" ] - } - ], - "comment": [ - "Request to retrieve the trading volume" - ] - }, - { - "name": "ApiQueryTradingPerformanceResponse", - "is_root": true, - "fields": [ + }, { - "name": "trading_volume", - "lite_name": "tv", - "semantic_type": "uint64", + "name": "mark_price", + "lite_name": "mp", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 7, "array_depth": 0, "optional": false, - "example": "'3456.78'", + "example": "'65038.01'", "comment": [ - "Trading volume in USDT" + "The mark price of the position, expressed in `9` decimals" + ] + }, + { + "name": "unrealized_pnl", + "lite_name": "up", + "semantic_type": "string", + "json_type": "string", + "index": 8, + "array_depth": 0, + "optional": false, + "example": "'135000.50'", + "comment": [ + "The unrealized PnL of the position, expressed in quote asset decimal units", + "`unrealized_pnl = (mark_price - entry_price) * size`" ] }, { @@ -8286,610 +2458,550 @@ "lite_name": "rp", "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 9, "array_depth": 0, "optional": false, - "example": "'9.75'", + "example": "'-35000.30'", "comment": [ - "Realized PnL in USDT" + "The realized PnL of the position, expressed in quote asset decimal units", + "`realized_pnl = (exit_price - entry_price) * exit_trade_size`" ] - } - ], - "comment": [ - "Response to retrieve the trading volume" - ] - }, - { - "name": "OrderLeg", - "is_root": false, - "fields": [ + }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "total_pnl", + "lite_name": "tp", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 10, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'100000.20'", "comment": [ - "The instrument to trade in this leg" + "The total PnL of the position, expressed in quote asset decimal units", + "`total_pnl = realized_pnl + unrealized_pnl`" ] }, { - "name": "size", - "lite_name": "s", + "name": "roi", + "lite_name": "r", "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 11, "array_depth": 0, "optional": false, - "example": "'10.5'", + "example": "'10.20'", "comment": [ - "The total number of assets to trade in this leg, expressed in base asset decimal units." + "The ROI of the position, expressed as a percentage", + "`roi = (total_pnl / (entry_price * abs(size))) * 100^`" ] }, { - "name": "limit_price", - "lite_name": "lp", + "name": "quote_index_price", + "lite_name": "qi", "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 12, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'65038.01'", + "optional": false, + "example": "'1.0000102'", "comment": [ - "The limit price of the order leg, expressed in `9` decimals.", - "This is the number of quote currency units to pay/receive for this leg.", - "This should be `null/0` if the order is a market order" + "The index price of the quote currency. (reported in `USD`)" ] }, { - "name": "is_buying_asset", - "lite_name": "ib", - "semantic_type": "bool", - "json_type": "boolean", - "index": 3, + "name": "est_liquidation_price", + "lite_name": "el", + "semantic_type": "string", + "json_type": "string", + "index": 13, "array_depth": 0, "optional": false, - "example": "true", + "example": "60000.25", "comment": [ - "Specifies if the order leg is a buy or sell" + "The estimated liquidation price" + ] + }, + { + "name": "leverage", + "lite_name": "l", + "semantic_type": "string", + "json_type": "string", + "index": 14, + "array_depth": 0, + "optional": false, + "example": "'10'", + "comment": [ + "The current leverage value for this position" ] } ], "comment": [] }, { - "name": "Signature", - "is_root": false, + "name": "ApiPositionsResponse", + "is_root": true, "fields": [ { - "name": "signer", - "lite_name": "s", - "semantic_type": "uint256", + "name": "result", + "lite_name": "r", + "semantic_type": "Positions", + "json_type": "Positions", + "index": 0, + "array_depth": 1, + "optional": false, + "comment": [ + "The positions matching the request filter" + ] + } + ], + "comment": [] + }, + { + "name": "ApiFillHistoryRequest", + "is_root": true, + "fields": [ + { + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The address (public key) of the wallet signing the payload" + "The sub account ID to request for" ] }, { - "name": "r", - "lite_name": "r", - "semantic_type": "uint256", - "json_type": "string", + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", "index": 1, - "array_depth": 0, - "optional": false, - "example": "'0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8'", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['PERPETUAL']", "comment": [ - "Signature R" + "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "s", - "lite_name": "s1", - "semantic_type": "uint256", - "json_type": "string", + "name": "base", + "lite_name": "b", + "semantic_type": "Currency", + "json_type": "Currency", "index": 2, - "array_depth": 0, - "optional": false, - "example": "'0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d'", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['BTC', 'ETH']", "comment": [ - "Signature S" + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "v", - "lite_name": "v", - "semantic_type": "uint8", - "json_type": "integer", + "name": "quote", + "lite_name": "q", + "semantic_type": "Currency", + "json_type": "Currency", "index": 3, - "array_depth": 0, - "optional": false, - "example": "'28'", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['USDT', 'USDC']", "comment": [ - "Signature V" + "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "expiration", - "lite_name": "e", - "semantic_type": "timestamp", + "name": "start_time", + "lite_name": "st", + "semantic_type": "int64", "json_type": "string", "index": 4, "array_depth": 0, - "optional": false, + "optional": true, + "default": "0", "example": "'1697788800000000000'", "comment": [ - "Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days" + "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" ] }, { - "name": "nonce", - "lite_name": "n", - "semantic_type": "uint32", - "json_type": "integer", + "name": "end_time", + "lite_name": "et", + "semantic_type": "int64", + "json_type": "string", "index": 5, "array_depth": 0, - "optional": false, - "example": "'1234567890'", + "optional": true, + "default": "now()", + "example": "'1697788800000000000'", "comment": [ - "Users can randomly generate this value, used as a signature deconflicting key.", - "ie. You can send the same exact instruction twice with different nonces.", - "When the same nonce is used, the same payload will generate the same signature.", - "Our system will consider the payload a duplicate, and ignore it." + "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" ] - } - ], - "comment": [] - }, - { - "name": "TPSLOrderMetadata", - "is_root": false, - "fields": [ + }, { - "name": "trigger_by", - "lite_name": "tb", - "semantic_type": "TriggerBy", - "json_type": "TriggerBy", - "index": 0, + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", + "index": 6, "array_depth": 0, - "optional": false, - "example": "'LAST'", + "optional": true, + "default": "500", + "example": "500", "comment": [ - "Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order" + "The limit to query for. Defaults to 500; Max 1000" ] }, { - "name": "trigger_price", - "lite_name": "tp", + "name": "cursor", + "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 7, "array_depth": 0, - "optional": false, - "example": "'65038.10'", + "optional": true, + "default": "''", + "example": "''", "comment": [ - "The Trigger Price of the order, expressed in `9` decimals." + "The cursor to indicate when to start the query from" ] } ], "comment": [ - "Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.", - "", - "### Fields:", - "- **triggerBy**: Defines the price type that activates the order (e.g., index price).", - "- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.", + "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.", "", - "" + "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" ] }, { - "name": "TriggerOrderMetadata", + "name": "Fill", "is_root": false, "fields": [ { - "name": "trigger_type", - "lite_name": "tt", - "semantic_type": "TriggerType", - "json_type": "TriggerType", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'TAKE_PROFIT'", + "example": "'1697788800000000000'", "comment": [ - "Type of the trigger order. eg: Take Profit, Stop Loss, etc" + "Time at which the event was emitted in unix nanoseconds" ] }, { - "name": "tpsl", - "lite_name": "t", - "semantic_type": "TPSLOrderMetadata", - "json_type": "TPSLOrderMetadata", - "index": 1, - "array_depth": 0, - "optional": false, - "comment": [ - "Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.", - "", - "" - ] - } - ], - "comment": [ - "Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).", - "", - "Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.", - "", - "" - ] - }, - { - "name": "OrderMetadata", - "is_root": false, - "fields": [ - { - "name": "client_order_id", - "lite_name": "co", + "name": "sub_account_id", + "lite_name": "sa", "semantic_type": "uint64", "json_type": "string", - "index": 0, + "index": 1, "array_depth": 0, "optional": false, - "example": "'23042'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "A unique identifier for the active order within a subaccount, specified by the client", - "This is used to identify the order in the client's system", - "This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer", - "This field will not be propagated to the smart contract, and should not be signed by the client", - "This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected", - "Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]", - "To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]", - "", - "When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId" + "The sub account ID that participated in the trade" ] }, { - "name": "create_time", - "lite_name": "ct", - "semantic_type": "timestamp", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 1, + "index": 2, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds" + "The instrument being represented" ] }, { - "name": "trigger", - "lite_name": "t", - "semantic_type": "TriggerOrderMetadata", - "json_type": "TriggerOrderMetadata", - "index": 2, + "name": "is_buyer", + "lite_name": "ib", + "semantic_type": "bool", + "json_type": "boolean", + "index": 3, "array_depth": 0, - "optional": true, - "default": "", + "optional": false, + "example": "true", "comment": [ - "Trigger fields are used to support any type of trigger order such as TP/SL" + "The side that the subaccount took on the trade" ] }, { - "name": "broker", - "lite_name": "b", - "semantic_type": "BrokerTag", - "json_type": "BrokerTag", - "index": 3, + "name": "is_taker", + "lite_name": "it", + "semantic_type": "bool", + "json_type": "boolean", + "index": 4, "array_depth": 0, - "optional": true, - "default": "", - "example": "'BROKER_CODE'", + "optional": false, + "example": "true", "comment": [ - "Specifies the broker who brokered the order" + "The role that the subaccount took on the trade" ] - } - ], - "comment": [ - "Metadata fields are used to support Backend only operations. These operations are not trustless by nature.", - "Hence, fields in here are never signed, and is never transmitted to the smart contract." - ] - }, - { - "name": "OrderState", - "is_root": false, - "fields": [ + }, { - "name": "status", + "name": "size", "lite_name": "s", - "semantic_type": "OrderStatus", - "json_type": "OrderStatus", - "index": 0, + "semantic_type": "string", + "json_type": "string", + "index": 5, "array_depth": 0, "optional": false, + "example": "'0.30'", "comment": [ - "The status of the order" + "The number of assets being traded, expressed in base asset decimal units" ] }, { - "name": "reject_reason", - "lite_name": "rr", - "semantic_type": "OrderRejectReason", - "json_type": "OrderRejectReason", - "index": 1, + "name": "price", + "lite_name": "p", + "semantic_type": "string", + "json_type": "string", + "index": 6, "array_depth": 0, "optional": false, - "example": "'CLIENT_CANCEL'", + "example": "'65038.01'", "comment": [ - "The reason for rejection or cancellation" + "The traded price, expressed in `9` decimals" ] }, { - "name": "book_size", - "lite_name": "bs", + "name": "mark_price", + "lite_name": "mp", "semantic_type": "string", "json_type": "string", - "index": 2, - "array_depth": 1, + "index": 7, + "array_depth": 0, "optional": false, - "example": "['10.5']", + "example": "'65038.01'", "comment": [ - "The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs" + "The mark price of the instrument at point of trade, expressed in `9` decimals" ] }, { - "name": "traded_size", - "lite_name": "ts", + "name": "index_price", + "lite_name": "ip", "semantic_type": "string", "json_type": "string", - "index": 3, - "array_depth": 1, + "index": 8, + "array_depth": 0, "optional": false, - "example": "['1.5']", + "example": "'65038.01'", "comment": [ - "The total number of assets traded. Sorted in same order as Order.Legs" + "The index price of the instrument at point of trade, expressed in `9` decimals" ] }, { - "name": "update_time", - "lite_name": "ut", - "semantic_type": "timestamp", + "name": "interest_rate", + "lite_name": "ir", + "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 9, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "0.0003", "comment": [ - "Time at which the order was updated by GRVT, expressed in unix nanoseconds" + "The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)" ] }, { - "name": "avg_fill_price", - "lite_name": "af", + "name": "forward_price", + "lite_name": "fp", "semantic_type": "string", "json_type": "string", - "index": 5, - "array_depth": 1, + "index": 10, + "array_depth": 0, "optional": false, - "example": "['60000.4']", + "example": "'65038.01'", "comment": [ - "The average fill price of the order. Sorted in same order as Order.Legs" + "[Options] The forward price of the option at point of trade, expressed in `9` decimals" ] - } - ], - "comment": [] - }, - { - "name": "Order", - "is_root": false, - "fields": [ + }, { - "name": "order_id", - "lite_name": "oi", - "semantic_type": "uint128", + "name": "realized_pnl", + "lite_name": "rp", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 11, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'0x1234567890abcdef'", + "optional": false, + "example": "'2400.50'", "comment": [ - "[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend" + "The realized PnL of the trade, expressed in quote asset decimal units (0 if increasing position size)" ] }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "fee", + "lite_name": "f", + "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 12, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'9.75'", "comment": [ - "The subaccount initiating the order" + "The fees paid on the trade, expressed in quote asset decimal unit (negative if maker rebate applied)" ] }, { - "name": "is_market", - "lite_name": "im", - "semantic_type": "bool", - "json_type": "boolean", - "index": 2, + "name": "fee_rate", + "lite_name": "fr", + "semantic_type": "string", + "json_type": "string", + "index": 13, "array_depth": 0, - "optional": true, - "default": "false", - "example": "false", + "optional": false, + "example": "0.0003", "comment": [ - "If the order is a market order", - "Market Orders do not have a limit price, and are always executed according to the maker order price.", - "Market Orders must always be taker orders" + "The fee rate paid on the trade" ] }, { - "name": "time_in_force", + "name": "trade_id", "lite_name": "ti", - "semantic_type": "TimeInForce", - "json_type": "TimeInForce", - "index": 3, + "semantic_type": "string", + "json_type": "string", + "index": 14, "array_depth": 0, "optional": false, + "example": "'209358-2'", "comment": [ - "Four supported types of orders: GTT, IOC, AON, FOK:\u003cul\u003e", - "\u003cli\u003ePARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg\u003c/li\u003e", - "\u003cli\u003eFULL EXECUTION = AON / FOK - only allows full size execution on all legs\u003c/li\u003e", - "\u003cli\u003eTAKER ONLY = IOC / FOK - only allows taker orders\u003c/li\u003e", - "\u003cli\u003eMAKER OR TAKER = GTT / AON - allows maker or taker orders\u003c/li\u003e", - "\u003c/ul\u003eExchange only supports (GTT, IOC, FOK)", - "RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)" + "A trade identifier, globally unique, and monotonically increasing (not by `1`).", + "All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.", + "`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`." ] }, { - "name": "post_only", - "lite_name": "po", - "semantic_type": "bool", - "json_type": "boolean", - "index": 4, + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", + "json_type": "string", + "index": 15, "array_depth": 0, - "optional": true, - "default": "false", - "example": "false", + "optional": false, + "example": "'0x10000101000203040506'", "comment": [ - "If True, Order must be a maker order. It has to fill the orderbook instead of match it.", - "If False, Order can be either a maker or taker order. \u003cb\u003eIn this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.\u003c/b\u003e", - "", - "| | Must Fill All | Can Fill Partial |", - "| - | - | - |", - "| Must Be Taker | FOK + False | IOC + False |", - "| Can Be Either | AON + False | GTC + False |", - "| Must Be Maker | AON + True | GTC + True |", - "" + "An order identifier" ] }, { - "name": "reduce_only", - "lite_name": "ro", - "semantic_type": "bool", - "json_type": "boolean", - "index": 5, + "name": "venue", + "lite_name": "v", + "semantic_type": "Venue", + "json_type": "Venue", + "index": 16, "array_depth": 0, - "optional": true, - "default": "false", - "example": "false", - "comment": [ - "If True, Order must reduce the position size, or be cancelled" - ] - }, - { - "name": "legs", - "lite_name": "l", - "semantic_type": "OrderLeg", - "json_type": "OrderLeg", - "index": 6, - "array_depth": 1, "optional": false, + "example": "'ORDERBOOK'", "comment": [ - "The legs present in this order", - "The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice" + "The venue where the trade occurred" ] }, { - "name": "signature", - "lite_name": "s", - "semantic_type": "Signature", - "json_type": "Signature", - "index": 7, + "name": "client_order_id", + "lite_name": "co", + "semantic_type": "uint64", + "json_type": "string", + "index": 18, "array_depth": 0, "optional": false, + "example": "'23042'", "comment": [ - "The signature approving this order" + "A unique identifier for the active order within a subaccount, specified by the client", + "This is used to identify the order in the client's system", + "This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer", + "This field will not be propagated to the smart contract, and should not be signed by the client", + "This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected", + "Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]", + "To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]", + "", + "When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId" ] }, { - "name": "metadata", - "lite_name": "m", - "semantic_type": "OrderMetadata", - "json_type": "OrderMetadata", - "index": 8, + "name": "signer", + "lite_name": "s1", + "semantic_type": "uint256", + "json_type": "string", + "index": 20, "array_depth": 0, "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "Order Metadata, ignored by the smart contract, and unsigned by the client" + "The address (public key) of the wallet signing the payload" ] }, { - "name": "state", - "lite_name": "s1", - "semantic_type": "OrderState", - "json_type": "OrderState", - "index": 9, + "name": "broker", + "lite_name": "b", + "semantic_type": "BrokerTag", + "json_type": "BrokerTag", + "index": 21, "array_depth": 0, "optional": true, - "default": "''", - "comment": [ - "[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client" - ] - } - ], - "comment": [ - "Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.", - "GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.", - "This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.", - "Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.", - "", - "All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.", - "This minimizes the amount of trust users have to offer to GRVT" - ] - }, - { - "name": "ApiCreateOrderRequest", - "is_root": true, - "fields": [ + "default": "", + "comment": [ + "Specifies the broker who brokered the order" + ] + }, { - "name": "order", - "lite_name": "o", - "semantic_type": "Order", - "json_type": "Order", - "index": 0, + "name": "is_rpi", + "lite_name": "ir1", + "semantic_type": "bool", + "json_type": "boolean", + "index": 22, "array_depth": 0, "optional": false, + "example": "false", "comment": [ - "The order to create" + "If the trade is a RPI trade" ] } ], - "comment": [ - "Create an order on the orderbook for this trading account." - ] + "comment": [] }, { - "name": "ApiCreateOrderResponse", + "name": "ApiFillHistoryResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "Order", - "json_type": "Order", + "semantic_type": "Fill", + "json_type": "Fill", "index": 0, + "array_depth": 1, + "optional": false, + "comment": [ + "The private trades matching the request asset" + ] + }, + { + "name": "next", + "lite_name": "n", + "semantic_type": "string", + "json_type": "string", + "index": 1, "array_depth": 0, "optional": false, + "example": "'Qw0918='", "comment": [ - "The created order" + "The cursor to indicate when to start the query from" ] } ], "comment": [] }, { - "name": "ApiCancelOrderRequest", + "name": "ApiFundingPaymentHistoryRequest", "is_root": true, "fields": [ { @@ -8902,168 +3014,207 @@ "optional": false, "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The subaccount ID cancelling the order" + "The sub account ID to request for" ] }, { - "name": "order_id", - "lite_name": "oi", - "semantic_type": "uint128", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 1, "array_depth": 0, "optional": true, - "default": "0", - "example": "'0x1028403'", + "default": "all", + "example": "'BTC_USDT_Perp'", "comment": [ - "Cancel the order with this `order_id`" + "The perpetual instrument to filter for" ] }, { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", + "name": "start_time", + "lite_name": "st", + "semantic_type": "int64", "json_type": "string", "index": 2, "array_depth": 0, "optional": true, "default": "0", - "example": "'23042'", + "example": "'1697788800000000000'", "comment": [ - "Cancel the order with this `client_order_id`" + "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" ] }, { - "name": "time_to_live_ms", - "lite_name": "tt", - "semantic_type": "uint64", + "name": "end_time", + "lite_name": "et", + "semantic_type": "int64", "json_type": "string", "index": 3, "array_depth": 0, "optional": true, - "default": "100", - "example": "'500'", + "default": "now()", + "example": "'1697788800000000000'", "comment": [ - "Specifies the time-to-live (in milliseconds) for this cancellation.", - "During this period, any order creation with a matching `client_order_id` will be cancelled and not be added to the GRVT matching engine.", - "This mechanism helps mitigate time-of-flight issues where cancellations might arrive before the corresponding orders.", - "Hence, cancellation by `order_id` ignores this field as the exchange can only assign `order_id`s to already-processed order creations.", - "The duration cannot be negative, is rounded down to the nearest 100ms (e.g., `'670'` -\u003e `'600'`, `'30'` -\u003e `'0'`) and capped at 5 seconds (i.e., `'5000'`).", - "Value of `'0'` or omission results in the default time-to-live value being applied.", - "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.", - "" + "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" + ] + }, + { + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", + "index": 4, + "array_depth": 0, + "optional": true, + "default": "500", + "example": "500", + "comment": [ + "The limit to query for. Defaults to 500; Max 1000" + ] + }, + { + "name": "cursor", + "lite_name": "c", + "semantic_type": "string", + "json_type": "string", + "index": 5, + "array_depth": 0, + "optional": true, + "default": "''", + "example": "''", + "comment": [ + "The cursor to indicate when to start the query from" ] } ], "comment": [ - "Cancel an order on the orderbook for this trading account. Either `order_id` or `client_order_id` must be provided." + "Query for all historical funding payments made by a single account.", + "", + "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" ] }, { - "name": "ApiCancelOrderResponse", - "is_root": true, + "name": "FundingPayment", + "is_root": false, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "Order", - "json_type": "Order", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, + "example": "'1697788800000000000'", "comment": [ - "The cancelled order" + "Time at which the event was emitted in unix nanoseconds" ] - } - ], - "comment": [] - }, - { - "name": "ApiCancelAllOrdersRequest", - "is_root": true, - "fields": [ + }, { "name": "sub_account_id", "lite_name": "sa", "semantic_type": "uint64", "json_type": "string", - "index": 0, + "index": 1, "array_depth": 0, "optional": false, "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The subaccount ID cancelling all orders" + "The sub account ID that made the funding payment" ] }, { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", - "index": 1, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['PERPETUAL']", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", + "index": 2, + "array_depth": 0, + "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be cancelled" + "The perpetual instrument being funded" ] }, { - "name": "base", - "lite_name": "b", + "name": "currency", + "lite_name": "c", "semantic_type": "Currency", "json_type": "Currency", - "index": 2, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", + "index": 3, + "array_depth": 0, + "optional": false, + "example": "'USDT'", "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be cancelled" + "The currency of the funding payment" ] }, { - "name": "quote", - "lite_name": "q", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 3, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['USDT', 'USDC']", + "name": "amount", + "lite_name": "a", + "semantic_type": "string", + "json_type": "string", + "index": 4, + "array_depth": 0, + "optional": false, + "example": "'9.75'", "comment": [ - "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be cancelled" + "The amount of the funding payment. Positive if paid, negative if received" + ] + }, + { + "name": "tx_id", + "lite_name": "ti", + "semantic_type": "uint64", + "json_type": "string", + "index": 5, + "array_depth": 0, + "optional": false, + "example": "'209358'", + "comment": [ + "The transaction ID of the funding payment.", + "Funding payments can be triggered by a trade, transfer, or liquidation.", + "The `tx_id` will match the corresponding `trade_id` or `tx_id`." ] } ], - "comment": [ - "Cancel all orders on the orderbook for this trading account. This may not match new orders in flight." - ] + "comment": [] }, { - "name": "ApiCancelAllOrdersResponse", + "name": "ApiFundingPaymentHistoryResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", + "semantic_type": "FundingPayment", + "json_type": "FundingPayment", "index": 0, + "array_depth": 1, + "optional": false, + "comment": [ + "The funding payments matching the request asset" + ] + }, + { + "name": "next", + "lite_name": "n", + "semantic_type": "string", + "json_type": "string", + "index": 1, "array_depth": 0, "optional": false, - "example": "'52'", + "example": "'Qw0918='", "comment": [ - "The number of orders cancelled" + "The cursor to indicate when to start the query from" ] } ], "comment": [] }, { - "name": "ApiOpenOrdersRequest", + "name": "ApiSubAccountSummaryRequest", "is_root": true, "fields": [ { @@ -9078,278 +3229,249 @@ "comment": [ "The subaccount ID to filter by" ] - }, + } + ], + "comment": [] + }, + { + "name": "SpotBalance", + "is_root": false, + "fields": [ { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", - "index": 1, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['PERPETUAL']", + "name": "currency", + "lite_name": "c", + "semantic_type": "Currency", + "json_type": "Currency", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "'USDT'", "comment": [ - "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" + "The currency you hold a spot balance in" ] }, { - "name": "base", + "name": "balance", "lite_name": "b", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 2, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", + "semantic_type": "string", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'123456.78'", "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" + "This currency's balance in this trading account." ] }, { - "name": "quote", - "lite_name": "q", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 3, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['USDT', 'USDC']", + "name": "index_price", + "lite_name": "ip", + "semantic_type": "string", + "json_type": "string", + "index": 2, + "array_depth": 0, + "optional": false, + "example": "'1.0000102'", "comment": [ - "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" + "The index price of this currency. (reported in `USD`)" ] } ], "comment": [] }, { - "name": "ApiOpenOrdersResponse", - "is_root": true, + "name": "SubAccount", + "is_root": false, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "Order", - "json_type": "Order", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", + "json_type": "string", "index": 0, - "array_depth": 1, + "array_depth": 0, "optional": false, + "example": "'1697788800000000000'", "comment": [ - "The Open Orders matching the request filter" + "Time at which the event was emitted in unix nanoseconds" ] - } - ], - "comment": [ - "Retrieves all open orders for the account. This may not match new orders in flight." - ] - }, - { - "name": "ApiOrderHistoryRequest", - "is_root": true, - "fields": [ + }, { "name": "sub_account_id", "lite_name": "sa", "semantic_type": "uint64", "json_type": "string", - "index": 0, + "index": 1, "array_depth": 0, "optional": false, "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The subaccount ID to filter by" - ] - }, - { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", - "index": 1, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['PERPETUAL']", - "comment": [ - "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" + "The sub account ID this entry refers to" ] }, { - "name": "base", - "lite_name": "b", - "semantic_type": "Currency", - "json_type": "Currency", + "name": "margin_type", + "lite_name": "mt", + "semantic_type": "MarginType", + "json_type": "MarginType", "index": 2, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", + "array_depth": 0, + "optional": false, + "example": "'SIMPLE_CROSS_MARGIN'", "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" + "The type of margin algorithm this subaccount uses" ] }, { - "name": "quote", - "lite_name": "q", + "name": "settle_currency", + "lite_name": "sc", "semantic_type": "Currency", "json_type": "Currency", "index": 3, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['USDT', 'USDC']", + "array_depth": 0, + "optional": false, + "example": "'USDT'", "comment": [ - "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" + "The settlement, margin, and reporting currency of this account.", + "This subaccount can only open positions quoted in this currency", + "", + "In the future, when users select a Multi-Currency Margin Type, this will be USD", + "All other assets are converted to this currency for the purpose of calculating margin" ] }, { - "name": "start_time", - "lite_name": "st", - "semantic_type": "int64", + "name": "unrealized_pnl", + "lite_name": "up", + "semantic_type": "string", "json_type": "string", "index": 4, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "optional": false, + "example": "'123456.78'", "comment": [ - "The start time to apply in nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned" + "The total unrealized PnL of all positions owned by this subaccount, denominated in quote currency decimal units.", + "`unrealized_pnl = sum(position.unrealized_pnl * position.quote_index_price) / settle_index_price`" ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "int64", + "name": "total_equity", + "lite_name": "te", + "semantic_type": "string", "json_type": "string", "index": 5, "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", + "optional": false, + "example": "'123456.78'", "comment": [ - "The end time to apply in nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned" + "The notional value of your account if all positions are closed, excluding trading fees (reported in `settle_currency`).", + "`total_equity = sum(spot_balance.balance * spot_balance.index_price) / settle_index_price + unrealized_pnl`" ] }, { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", + "name": "initial_margin", + "lite_name": "im", + "semantic_type": "string", + "json_type": "string", "index": 6, "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", + "optional": false, + "example": "'123456.78'", "comment": [ - "The limit to query for. Defaults to 500; Max 1000" + "The `total_equity` required to open positions in the account (reported in `settle_currency`).", + "Computation is different depending on account's `margin_type`" ] }, { - "name": "cursor", - "lite_name": "c", + "name": "maintenance_margin", + "lite_name": "mm", "semantic_type": "string", "json_type": "string", "index": 7, "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", - "comment": [ - "The cursor to indicate when to start the query from" - ] - } - ], - "comment": [ - "Retrieves the order history for the account.", - "", - "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "ApiOrderHistoryResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "Order", - "json_type": "Order", - "index": 0, - "array_depth": 1, "optional": false, + "example": "'123456.78'", "comment": [ - "The Open Orders matching the request filter" + "The `total_equity` required to avoid liquidation of positions in the account (reported in `settle_currency`).", + "Computation is different depending on account's `margin_type`" ] }, { - "name": "next", - "lite_name": "n", + "name": "available_balance", + "lite_name": "ab", "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 8, "array_depth": 0, "optional": false, - "example": "'Qw0918='", + "example": "'123456.78'", "comment": [ - "The cursor to indicate when to start the query from" + "The notional value available to transfer out of the trading account into the funding account (reported in `settle_currency`).", + "`available_balance = total_equity - initial_margin - min(unrealized_pnl, 0)`" ] - } - ], - "comment": [] - }, - { - "name": "EmptyRequest", - "is_root": true, - "fields": [], - "comment": [ - "Used for requests that do not require any parameters" - ] - }, - { - "name": "Ack", - "is_root": false, - "fields": [ + }, { - "name": "ack", - "lite_name": "a", - "semantic_type": "bool", - "json_type": "boolean", - "index": 0, + "name": "spot_balances", + "lite_name": "sb", + "semantic_type": "SpotBalance", + "json_type": "SpotBalance", + "index": 9, + "array_depth": 1, + "optional": false, + "comment": [ + "The list of spot assets owned by this sub account, and their balances" + ] + }, + { + "name": "positions", + "lite_name": "p", + "semantic_type": "Positions", + "json_type": "Positions", + "index": 10, + "array_depth": 1, + "optional": false, + "comment": [ + "The list of positions owned by this sub account" + ] + }, + { + "name": "settle_index_price", + "lite_name": "si", + "semantic_type": "string", + "json_type": "string", + "index": 11, "array_depth": 0, "optional": false, - "example": "'true'", + "example": "'1.0000102'", "comment": [ - "Gravity has acknowledged that the request has been successfully received and it will process it in the backend" + "The index price of the settle currency. (reported in `USD`)" ] } ], "comment": [] }, { - "name": "AckResponse", + "name": "ApiSubAccountSummaryResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "Ack", - "json_type": "Ack", + "semantic_type": "SubAccount", + "json_type": "SubAccount", "index": 0, "array_depth": 0, "optional": false, "comment": [ - "The Ack Object" + "The sub account matching the request sub account" ] } ], "comment": [ - "Used to acknowledge a request has been received and will be processed" + "Query for sub-account details, including base currency balance, all derivative positions, margin levels, and P\u0026L." ] }, { - "name": "ApiOrderStateRequest", + "name": "ApiSubAccountHistoryRequest", "is_root": true, "fields": [ { @@ -9362,1573 +3484,1351 @@ "optional": false, "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The subaccount ID to filter by" + "The sub account ID to request for" ] }, { - "name": "order_id", - "lite_name": "oi", - "semantic_type": "uint128", + "name": "start_time", + "lite_name": "st", + "semantic_type": "timestamp", "json_type": "string", "index": 1, "array_depth": 0, "optional": true, "default": "0", - "example": "'0x1028403'", + "example": "'1697788800000000000'", "comment": [ - "Filter for `order_id`" + "Start time of sub account history in unix nanoseconds" ] }, { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", + "name": "end_time", + "lite_name": "et", + "semantic_type": "timestamp", "json_type": "string", "index": 2, "array_depth": 0, "optional": true, - "default": "0", - "example": "'23042'", + "default": "now()", + "example": "'1697788800000000000'", "comment": [ - "Filter for `client_order_id`" + "End time of sub account history in unix nanoseconds" + ] + }, + { + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", + "index": 3, + "array_depth": 0, + "optional": true, + "default": "500", + "example": "500", + "comment": [ + "The limit to query for. Defaults to 500; Max 1000" + ] + }, + { + "name": "cursor", + "lite_name": "c", + "semantic_type": "string", + "json_type": "string", + "index": 4, + "array_depth": 0, + "optional": true, + "default": "''", + "example": "''", + "comment": [ + "The cursor to indicate when to start the next query from" ] } ], "comment": [ - "Retrieve the order state for the account. Either `order_id` or `client_order_id` must be provided." + "The request to get the history of a sub account", + "SubAccount Summary values are snapshotted once every hour", + "No snapshots are taken if the sub account has no activity in the hourly window", + "History is preserved only for the last 30 days", + "", + "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" ] }, { - "name": "ApiOrderStateResponse", + "name": "ApiSubAccountHistoryResponse", "is_root": true, "fields": [ { - "name": "state", - "lite_name": "s", - "semantic_type": "OrderState", - "json_type": "OrderState", + "name": "result", + "lite_name": "r", + "semantic_type": "SubAccount", + "json_type": "SubAccount", "index": 0, + "array_depth": 1, + "optional": false, + "comment": [ + "The sub account history matching the request sub account" + ] + }, + { + "name": "next", + "lite_name": "n", + "semantic_type": "string", + "json_type": "string", + "index": 1, "array_depth": 0, "optional": false, + "example": "'Qw0918='", "comment": [ - "The order state for the requested filter" + "The cursor to indicate when to start the next query from" ] } ], "comment": [] }, { - "name": "ApiGetOrderRequest", - "is_root": true, + "name": "AggregatedAccountSummary", + "is_root": false, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "main_account_id", + "lite_name": "ma", + "semantic_type": "address", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "The subaccount ID to filter by" + "The main account ID of the account to which the summary belongs" ] }, { - "name": "order_id", - "lite_name": "oi", - "semantic_type": "uint128", + "name": "total_equity", + "lite_name": "te", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'0x1028403'", + "optional": false, + "example": "'3945034.23'", "comment": [ - "Filter for `order_id`" + "Total equity of the main (+ sub) account, denominated in USD" ] }, { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", - "json_type": "string", + "name": "spot_balances", + "lite_name": "sb", + "semantic_type": "SpotBalance", + "json_type": "SpotBalance", "index": 2, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "'23042'", + "array_depth": 1, + "optional": false, "comment": [ - "Filter for `client_order_id`" + "The list of spot assets owned by this main (+ sub) account, and their balances" ] } ], - "comment": [ - "Retrieve the order for the account. Either `order_id` or `client_order_id` must be provided." - ] + "comment": [] }, { - "name": "ApiGetOrderResponse", + "name": "ApiAggregatedAccountSummaryResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "Order", - "json_type": "Order", + "semantic_type": "AggregatedAccountSummary", + "json_type": "AggregatedAccountSummary", "index": 0, "array_depth": 0, "optional": false, "comment": [ - "The order object for the requested filter" + "The aggregated account summary" ] } ], - "comment": [] + "comment": [ + "The aggregated account summary, that reports the total equity and spot balances of a funding (main) account, and its constituent trading (sub) accounts" + ] }, { - "name": "ApiPreOrderCheckRequest", + "name": "ApiFundingAccountSummaryResponse", "is_root": true, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "FundingAccountSummary", + "json_type": "FundingAccountSummary", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The subaccount ID of orders to query" - ] - }, - { - "name": "orders", - "lite_name": "o", - "semantic_type": "Order", - "json_type": "Order", - "index": 1, - "array_depth": 1, - "optional": false, "comment": [ - "The order to do pre-order check" + "The funding account summary" ] } ], "comment": [ - "Get pre-order check information for a new order" + "The funding account summary, that reports the total equity and spot balances of a funding (main) account" ] }, { - "name": "AssetMaxQty", - "is_root": false, + "name": "ApiSetInitialLeverageRequest", + "is_root": true, "fields": [ { - "name": "asset", - "lite_name": "a", - "semantic_type": "asset", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The asset associated with the max quantity" + "The sub account ID to set the leverage for" ] }, { - "name": "max_buy_qty", - "lite_name": "mb", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "100.0", + "example": "'BTC_USDT_Perp'", "comment": [ - "The maximum buy quantity" + "The instrument to set the leverage for" ] }, { - "name": "max_sell_qty", - "lite_name": "ms", + "name": "leverage", + "lite_name": "l", "semantic_type": "string", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "100.0", + "example": "'10'", "comment": [ - "The maximum sell quantity" + "The leverage to set for the sub account" ] } ], - "comment": [] + "comment": [ + "The request to set the initial leverage of a sub account" + ] }, { - "name": "PreOrderCheckResult", - "is_root": false, - "fields": [ - { - "name": "max_qty", - "lite_name": "mq", - "semantic_type": "AssetMaxQty", - "json_type": "AssetMaxQty", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The maximum quantity for each leg" - ] - }, - { - "name": "margin_required", - "lite_name": "mr", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "1000.0", - "comment": [ - "The margin required for the order (reported in `settle_currency`)" - ] - }, - { - "name": "order_valid", - "lite_name": "ov", - "semantic_type": "bool", - "json_type": "boolean", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "true", - "comment": [ - "Whether the order is valid" - ] - }, - { - "name": "reason", - "lite_name": "r", - "semantic_type": "string", - "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "''", - "comment": [ - "The reason the order is invalid, if any" - ] - }, - { - "name": "settle_currency", - "lite_name": "sc", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 4, + "name": "ApiSetInitialLeverageResponse", + "is_root": true, + "fields": [ + { + "name": "success", + "lite_name": "s", + "semantic_type": "bool", + "json_type": "boolean", + "index": 0, "array_depth": 0, "optional": false, - "example": "'USDT'", + "example": "'true'", "comment": [ - "The subAccount settle currency" + "Whether the leverage was set successfully" ] } ], - "comment": [] + "comment": [ + "The response to set the initial leverage of a sub account" + ] }, { - "name": "ApiPreOrderCheckResponse", + "name": "ApiGetAllInitialLeverageRequest", "is_root": true, "fields": [ { - "name": "results", - "lite_name": "r", - "semantic_type": "PreOrderCheckResult", - "json_type": "PreOrderCheckResult", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", + "json_type": "string", "index": 0, - "array_depth": 1, + "array_depth": 0, "optional": false, + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "Pre order check for each new order in the request" + "The sub account ID to get the leverage for" ] } ], - "comment": [] + "comment": [ + "The request to get the initial leverage of a sub account" + ] }, { - "name": "ApiPreDepositCheckRequest", - "is_root": true, + "name": "InitialLeverageResult", + "is_root": false, "fields": [ { - "name": "currency", - "lite_name": "c", - "semantic_type": "Currency", - "json_type": "Currency", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'USDT'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The currency you hold the deposit in" + "The instrument to get the leverage for" ] }, { - "name": "bridge", - "lite_name": "b", - "semantic_type": "BridgeType", - "json_type": "BridgeType", + "name": "leverage", + "lite_name": "l", + "semantic_type": "string", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, + "example": "'10'", "comment": [ - "The bridge type to conduct checks for" + "The initial leverage of the sub account" ] - } - ], - "comment": [ - "UI only for bridge deposits through non native bridge. Currently only supports XY Finance bridge account." - ] - }, - { - "name": "ApiPreDepositCheckResponse", - "is_root": true, - "fields": [ + }, { - "name": "max_deposit_limit", - "lite_name": "md", + "name": "min_leverage", + "lite_name": "ml", "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 2, "array_depth": 0, "optional": false, - "example": "'3945034.23'", + "example": "'10'", "comment": [ - "Max Deposit Limit reported for the Bridge Account reported in the currency balance" + "The min leverage this sub account can set" ] }, { - "name": "currency", - "lite_name": "c", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 1, + "name": "max_leverage", + "lite_name": "ml1", + "semantic_type": "string", + "json_type": "string", + "index": 3, "array_depth": 0, "optional": false, - "example": "'USDT'", + "example": "'50'", "comment": [ - "The currency you hold the deposit in" + "The max leverage this sub account can set" ] } ], "comment": [] }, { - "name": "ApiDedustPositionRequest", + "name": "ApiGetAllInitialLeverageResponse", "is_root": true, "fields": [ { - "name": "order", - "lite_name": "o", - "semantic_type": "Order", - "json_type": "Order", + "name": "results", + "lite_name": "r", + "semantic_type": "InitialLeverageResult", + "json_type": "InitialLeverageResult", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, "comment": [ - "The order to create" + "The initial leverage of the sub account" ] } ], "comment": [ - "Remove dust position (i.e., order quantity smaller than minimum required increment) on an account, by matching the specified order against GRVT directly. Limit price should always be better than mark price." + "The response to get the initial leverage of a sub account" ] }, { - "name": "ApiDedustPositionResponse", + "name": "ApiOrderbookLevelsRequest", "is_root": true, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "Order", - "json_type": "Order", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The created order" + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" ] - } - ], - "comment": [] - }, - { - "name": "ApiCreateBulkOrdersRequest", - "is_root": true, - "fields": [ + }, { - "name": "orders", - "lite_name": "o", - "semantic_type": "Order", - "json_type": "Order", - "index": 0, - "array_depth": 1, + "name": "depth", + "lite_name": "d", + "semantic_type": "uint32", + "json_type": "integer", + "index": 1, + "array_depth": 0, "optional": false, + "example": "50", "comment": [ - "The orders to create" + "Depth of the order book to be retrieved (10, 50, 100, 500)" ] } ], "comment": [ - "Create multiple orders simultaneously for this trading account.", - "", - "This endpoint supports the following order scenarios:", - "- One-Cancels-Other (OCO) orders combining TP/SL", - "- One-Sends-Other (OSO) orders", - "", - "Usage:", - "- For OCO (TP/SL pair): Send exactly 2 orders in the same request - one Take Profit and one Stop Loss order", - "- For OSO: Send exactly one main order and one contingent order (TP and/or SL)" + "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." ] }, { - "name": "ApiCreateBulkOrdersResponse", - "is_root": true, + "name": "OrderbookLevel", + "is_root": false, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "Order", - "json_type": "Order", + "name": "price", + "lite_name": "p", + "semantic_type": "string", + "json_type": "string", "index": 0, - "array_depth": 1, + "array_depth": 0, "optional": false, + "example": "'65038.01'", "comment": [ - "The created orders in same order as requested" + "The price of the level, expressed in `9` decimals" ] - } - ], - "comment": [] - }, - { - "name": "ApiCancelOnDisconnectRequest", - "is_root": true, - "fields": [ + }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "size", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 1, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'3456.78'", "comment": [ - "The subaccount ID cancelling the orders for" + "The number of assets offered, expressed in base asset decimal units" ] }, { - "name": "countdown_time", - "lite_name": "ct", - "semantic_type": "uint64", - "json_type": "string", - "index": 1, + "name": "num_orders", + "lite_name": "no", + "semantic_type": "uint32", + "json_type": "integer", + "index": 2, "array_depth": 0, - "optional": true, - "default": "1000", - "example": "300", + "optional": false, + "example": "'123'", "comment": [ - "Countdown time in milliseconds (ex. 120000 for 120s).", - "", - "0 to disable the timer.", - "", - "Does not accept negative values.", - "", - "Minimum acceptable value is 1,000.", - "", - "Maximum acceptable value is 300,000" + "The number of open orders at this level" ] } ], - "comment": [ - "Auto-Cancel All Open Orders when the countdown time hits zero.", - "", - "Market Maker inputs a countdown time parameter in milliseconds (e.g. 120000 for 120s) rounded down to the smallest second follows the following logic:", - " - Market Maker initially entered a value between 0 -\u003e 1000, which is rounded to 0: will result in termination of their COD", - " - Market Maker initially entered a value between 1001 -\u003e 300_000, which is rounded to the nearest second: will result in refresh of their COD", - " - Market Maker initially entered a value bigger than 300_000, which will result in error (upper bound)", - "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.", - "", - "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." - ] + "comment": [] }, { - "name": "ApiGetOrderGroupRequest", - "is_root": true, + "name": "OrderbookLevels", + "is_root": false, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'1697788800000000000'", "comment": [ - "The subaccount ID for which the order groups should be retrieved." + "Time at which the event was emitted in unix nanoseconds" ] - } - ], - "comment": [ - "Retrieves the grouping of non-cancelled, non-filled client orders for a given subaccount when the grouping exist.", - "", - "helping to identify TP/SL pairs or other order relationships within the account." - ] - }, - { - "name": "ClientOrderIDsByGroup", - "is_root": true, - "fields": [ + }, { - "name": "group_id", - "lite_name": "gi", - "semantic_type": "uint128", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 0, + "index": 1, "array_depth": 0, "optional": false, - "example": "'0x10000101000203040506'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The group this order belongs to. It can be used to define TP/SL pairs or other order groupings" + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" ] }, { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", - "json_type": "string", - "index": 1, + "name": "bids", + "lite_name": "b", + "semantic_type": "OrderbookLevel", + "json_type": "OrderbookLevel", + "index": 2, "array_depth": 1, "optional": false, - "example": "'[23042, 54232]'", "comment": [ - "List of client order IDs in the group" + "The list of best bids up till query depth" ] }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 2, - "array_depth": 0, + "name": "asks", + "lite_name": "a", + "semantic_type": "OrderbookLevel", + "json_type": "OrderbookLevel", + "index": 3, + "array_depth": 1, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The sub account ID that these orders belong to" + "The list of best asks up till query depth" ] } ], - "comment": [ - "Grouping for the client order id and their associated groups.", - "", - "This is used to define TP/SL pairs or other order groupings after loading the list of Open Orders." - ] + "comment": [] }, { - "name": "ApiGetOrderGroupResponse", + "name": "ApiOrderbookLevelsResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "ClientOrderIDsByGroup", - "json_type": "ClientOrderIDsByGroup", + "semantic_type": "OrderbookLevels", + "json_type": "OrderbookLevels", "index": 0, - "array_depth": 1, + "array_depth": 0, "optional": false, "comment": [ - "A list of client orders grouped by their associated order group.", - "Each entry in the list contains a `groupID` and the corresponding `clientOrderID`s", - "that belong to that group." + "The orderbook levels objects matching the request asset" ] } ], "comment": [] }, { - "name": "ApiGetUserEcosystemPointRequest", + "name": "ApiMiniTickerRequest", "is_root": true, "fields": [ { - "name": "account_id", - "lite_name": "ai", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'ACC_1234567890'", - "comment": [ - "The off chain account id" - ] - }, - { - "name": "calculate_from", - "lite_name": "cf", - "semantic_type": "timestamp", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "Start time of the epoch - phase" - ] - }, - { - "name": "include_user_rank", - "lite_name": "iu", - "semantic_type": "bool", - "json_type": "boolean", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'true'", + "example": "'BTC_USDT_Perp'", "comment": [ - "Include user rank in the response" + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" ] } ], - "comment": [] + "comment": [ + "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." + ] }, { - "name": "EcosystemPoint", + "name": "MiniTicker", "is_root": false, "fields": [ { - "name": "account_id", - "lite_name": "ai", - "semantic_type": "string", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", "json_type": "string", "index": 0, "array_depth": 0, - "optional": false, - "example": "'ACC_1234567890'", + "optional": true, + "example": "'1697788800000000000'", "comment": [ - "The off chain account id" + "Time at which the event was emitted in unix nanoseconds" ] }, { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "uint256", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 1, "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", + "optional": true, + "example": "'BTC_USDT_Perp'", "comment": [ - "The main account id" + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" ] }, { - "name": "total_point", - "lite_name": "tp", - "semantic_type": "uint64", + "name": "mark_price", + "lite_name": "mp", + "semantic_type": "string", "json_type": "string", "index": 2, "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", + "optional": true, + "example": "'65038.01'", "comment": [ - "Total ecosystem point" + "The mark price of the instrument, expressed in `9` decimals" ] }, { - "name": "direct_invite_count", - "lite_name": "di", - "semantic_type": "uint32", - "json_type": "integer", + "name": "index_price", + "lite_name": "ip", + "semantic_type": "string", + "json_type": "string", "index": 3, "array_depth": 0, - "optional": false, - "example": "'52'", + "optional": true, + "example": "'65038.01'", "comment": [ - "Direct invite count" + "The index price of the instrument, expressed in `9` decimals" ] }, { - "name": "indirect_invite_count", - "lite_name": "ii", - "semantic_type": "uint32", - "json_type": "integer", + "name": "last_price", + "lite_name": "lp", + "semantic_type": "string", + "json_type": "string", "index": 4, "array_depth": 0, - "optional": false, - "example": "'52'", + "optional": true, + "example": "'65038.01'", "comment": [ - "Indirect invite count" + "The last traded price of the instrument (also close price), expressed in `9` decimals" ] }, { - "name": "direct_invite_trading_volume", - "lite_name": "di1", - "semantic_type": "uint256", + "name": "last_size", + "lite_name": "ls", + "semantic_type": "string", "json_type": "string", "index": 5, "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", + "optional": true, + "example": "'123456.78'", "comment": [ - "Direct invite trading volume" + "The number of assets traded in the last trade, expressed in base asset decimal units" ] }, { - "name": "indirect_invite_trading_volume", - "lite_name": "ii1", - "semantic_type": "uint256", + "name": "mid_price", + "lite_name": "mp1", + "semantic_type": "string", "json_type": "string", "index": 6, "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", + "optional": true, + "example": "'65038.01'", "comment": [ - "Indirect invite trading volume" + "The mid price of the instrument, expressed in `9` decimals" ] }, { - "name": "calculate_at", - "lite_name": "ca", - "semantic_type": "timestamp", + "name": "best_bid_price", + "lite_name": "bb", + "semantic_type": "string", "json_type": "string", "index": 7, "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", + "optional": true, + "example": "'65038.01'", "comment": [ - "The time when the ecosystem point is calculated" + "The best bid price of the instrument, expressed in `9` decimals" ] }, { - "name": "calculate_from", - "lite_name": "cf", - "semantic_type": "timestamp", + "name": "best_bid_size", + "lite_name": "bb1", + "semantic_type": "string", "json_type": "string", "index": 8, "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", + "optional": true, + "example": "'123456.78'", "comment": [ - "Start time of the epoch - phase" + "The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units" ] }, { - "name": "calculate_to", - "lite_name": "ct", - "semantic_type": "timestamp", + "name": "best_ask_price", + "lite_name": "ba", + "semantic_type": "string", "json_type": "string", "index": 9, "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "End time of the epoch - phase" - ] - }, - { - "name": "rank", - "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", - "index": 10, - "array_depth": 0, - "optional": false, - "example": "'52'", - "comment": [ - "The rank of the account in the ecosystem" - ] - }, - { - "name": "epoch", - "lite_name": "e", - "semantic_type": "uint32", - "json_type": "integer", - "index": 11, - "array_depth": 0, - "optional": false, - "example": "'1'", - "comment": [ - "The epoch number of the ecosystem point" - ] - }, - { - "name": "brokered_trading_volume", - "lite_name": "bt", - "semantic_type": "uint256", - "json_type": "string", - "index": 12, - "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", - "comment": [ - "Brokered trading volume" - ] - }, - { - "name": "brokered_trading_point", - "lite_name": "bt1", - "semantic_type": "uint64", - "json_type": "string", - "index": 13, - "array_depth": 0, - "optional": false, - "example": "'1000'", + "optional": true, + "example": "'65038.01'", "comment": [ - "Brokered trading point" + "The best ask price of the instrument, expressed in `9` decimals" ] }, { - "name": "referee_kyc_point", - "lite_name": "rk", - "semantic_type": "uint64", + "name": "best_ask_size", + "lite_name": "ba1", + "semantic_type": "string", "json_type": "string", - "index": 14, + "index": 10, "array_depth": 0, - "optional": false, - "example": "'1000'", + "optional": true, + "example": "'123456.78'", "comment": [ - "Referee KYC point" + "The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiMiniTickerResponse", + "is_root": true, + "fields": [ { - "name": "referrer_kyc_point", - "lite_name": "rk1", - "semantic_type": "uint64", - "json_type": "string", - "index": 15, + "name": "result", + "lite_name": "r", + "semantic_type": "MiniTicker", + "json_type": "MiniTicker", + "index": 0, "array_depth": 0, "optional": false, - "example": "'1000'", "comment": [ - "Referrer KYC point" + "The mini ticker matching the request asset" ] } ], - "comment": [ - "" - ] + "comment": [] }, { - "name": "ApiGetUserEcosystemPointResponse", + "name": "ApiTickerRequest", "is_root": true, "fields": [ { - "name": "points", - "lite_name": "p", - "semantic_type": "EcosystemPoint", - "json_type": "EcosystemPoint", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 0, - "array_depth": 1, + "array_depth": 0, "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The list of ecosystem points" + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" ] } ], - "comment": [] + "comment": [ + "Retrieves a single 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." + ] }, { - "name": "ApiGetEcosystemLeaderboardRequest", - "is_root": true, + "name": "Ticker", + "is_root": false, "fields": [ { - "name": "calculate_from", - "lite_name": "cf", + "name": "event_time", + "lite_name": "et", "semantic_type": "timestamp", "json_type": "string", "index": 0, "array_depth": 0, - "optional": false, + "optional": true, "example": "'1697788800000000000'", "comment": [ - "Start time of the epoch - phase" + "Time at which the event was emitted in unix nanoseconds" + ] + }, + { + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": true, + "example": "'BTC_USDT_Perp'", + "comment": [ + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" + ] + }, + { + "name": "mark_price", + "lite_name": "mp", + "semantic_type": "string", + "json_type": "string", + "index": 2, + "array_depth": 0, + "optional": true, + "example": "'65038.01'", + "comment": [ + "The mark price of the instrument, expressed in `9` decimals" ] }, { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, + "name": "index_price", + "lite_name": "ip", + "semantic_type": "string", + "json_type": "string", + "index": 3, "array_depth": 0, - "optional": false, - "example": "500", + "optional": true, + "example": "'65038.01'", "comment": [ - "The number of accounts to return" + "The index price of the instrument, expressed in `9` decimals" ] - } - ], - "comment": [] - }, - { - "name": "ApiGetVerifiedEcosystemLeaderboardRequest", - "is_root": true, - "fields": [ + }, { - "name": "calculate_from", - "lite_name": "cf", - "semantic_type": "timestamp", + "name": "last_price", + "lite_name": "lp", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 4, "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", + "optional": true, + "example": "'65038.01'", "comment": [ - "Start time of the epoch" + "The last traded price of the instrument (also close price), expressed in `9` decimals" ] }, { - "name": "completed_kyc_before", - "lite_name": "ck", - "semantic_type": "timestamp", + "name": "last_size", + "lite_name": "ls", + "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 5, "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "Completed KYC before this time" - ] - } - ], - "comment": [] - }, - { - "name": "ApiGetEcosystemLeaderboardResponse", - "is_root": true, - "fields": [ - { - "name": "points", - "lite_name": "p", - "semantic_type": "EcosystemPoint", - "json_type": "EcosystemPoint", - "index": 0, - "array_depth": 1, - "optional": false, + "optional": true, + "example": "'123456.78'", "comment": [ - "The list of ecosystem points" + "The number of assets traded in the last trade, expressed in base asset decimal units" ] - } - ], - "comment": [] - }, - { - "name": "ApiGetEcosystemReferralStatResponse", - "is_root": true, - "fields": [ + }, { - "name": "direct_invite_count", - "lite_name": "di", - "semantic_type": "uint32", - "json_type": "integer", - "index": 0, + "name": "mid_price", + "lite_name": "mp1", + "semantic_type": "string", + "json_type": "string", + "index": 6, "array_depth": 0, - "optional": false, - "example": "'52'", + "optional": true, + "example": "'65038.01'", "comment": [ - "Direct invite count" + "The mid price of the instrument, expressed in `9` decimals" ] }, { - "name": "indirect_invite_count", - "lite_name": "ii", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, + "name": "best_bid_price", + "lite_name": "bb", + "semantic_type": "string", + "json_type": "string", + "index": 7, "array_depth": 0, - "optional": false, - "example": "'52'", + "optional": true, + "example": "'65038.01'", "comment": [ - "Indirect invite count" + "The best bid price of the instrument, expressed in `9` decimals" ] }, { - "name": "direct_invite_trading_volume", - "lite_name": "di1", - "semantic_type": "uint256", + "name": "best_bid_size", + "lite_name": "bb1", + "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 8, "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", + "optional": true, + "example": "'123456.78'", "comment": [ - "Total volume traded by direct invites multiple by 1e9" + "The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units" ] }, { - "name": "indirect_invite_trading_volume", - "lite_name": "ii1", - "semantic_type": "uint256", + "name": "best_ask_price", + "lite_name": "ba", + "semantic_type": "string", "json_type": "string", - "index": 3, + "index": 9, "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", + "optional": true, + "example": "'65038.01'", "comment": [ - "Total volume traded by indirect invites multiple by 1e9" + "The best ask price of the instrument, expressed in `9` decimals" ] - } - ], - "comment": [] - }, - { - "name": "ApiResolveEpochEcosystemMetricResponse", - "is_root": true, - "fields": [ + }, { - "name": "epoch_name", - "lite_name": "en", + "name": "best_ask_size", + "lite_name": "ba1", "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 10, "array_depth": 0, - "optional": false, - "example": "'Phase 1'", + "optional": true, + "example": "'123456.78'", "comment": [ - "The name of the epoch" + "The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units" ] }, { - "name": "point", - "lite_name": "p", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, + "name": "funding_rate_8h_curr", + "lite_name": "fr", + "semantic_type": "string", + "json_type": "string", + "index": 11, "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", + "optional": true, + "example": "0.0003", "comment": [ - "Ecosystem points up to the most recently calculated time within this epoch" + "The current funding rate of the instrument, expressed in percentage points" ] }, { - "name": "last_calculated_time", - "lite_name": "lc", - "semantic_type": "timestamp", + "name": "funding_rate_8h_avg", + "lite_name": "fr1", + "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 12, "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", + "optional": true, + "example": "0.0003", "comment": [ - "The time in unix nanoseconds when the ecosystem points were last calculated" + "The average funding rate of the instrument (over last 8h), expressed in percentage points" ] - } - ], - "comment": [] - }, - { - "name": "EcosystemMetric", - "is_root": true, - "fields": [ + }, { - "name": "direct_invite_count", - "lite_name": "di", - "semantic_type": "uint32", - "json_type": "integer", - "index": 0, + "name": "interest_rate", + "lite_name": "ir", + "semantic_type": "string", + "json_type": "string", + "index": 13, "array_depth": 0, - "optional": false, - "example": "'52'", + "optional": true, + "example": "0.0003", "comment": [ - "Direct invite count" + "The interest rate of the underlying, expressed in centibeeps (1/100th of a basis point)" ] }, { - "name": "indirect_invite_count", - "lite_name": "ii", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, + "name": "forward_price", + "lite_name": "fp", + "semantic_type": "string", + "json_type": "string", + "index": 14, "array_depth": 0, - "optional": false, - "example": "'52'", + "optional": true, + "example": "'65038.01'", "comment": [ - "Indirect invite count" + "[Options] The forward price of the option, expressed in `9` decimals" ] }, { - "name": "direct_invite_trading_volume", - "lite_name": "di1", - "semantic_type": "uint256", + "name": "buy_volume_24h_b", + "lite_name": "bv", + "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 15, "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", + "optional": true, + "example": "'123456.78'", "comment": [ - "Direct invite trading volume" + "The 24 hour taker buy volume of the instrument, expressed in base asset decimal units" ] }, { - "name": "indirect_invite_trading_volume", - "lite_name": "ii1", - "semantic_type": "uint256", + "name": "sell_volume_24h_b", + "lite_name": "sv", + "semantic_type": "string", "json_type": "string", - "index": 3, + "index": 16, "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", + "optional": true, + "example": "'123456.78'", "comment": [ - "Indirect invite trading volume" + "The 24 hour taker sell volume of the instrument, expressed in base asset decimal units" ] }, { - "name": "total_point", - "lite_name": "tp", - "semantic_type": "uint64", + "name": "buy_volume_24h_q", + "lite_name": "bv1", + "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 17, "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", + "optional": true, + "example": "'123456.78'", "comment": [ - "Total ecosystem point of this epoch/phase" + "The 24 hour taker buy volume of the instrument, expressed in quote asset decimal units" ] - } - ], - "comment": [] - }, - { - "name": "ApiFindFirstEpochMetricResponse", - "is_root": true, - "fields": [ + }, { - "name": "phase_zero_metric", - "lite_name": "pz", - "semantic_type": "EcosystemMetric", - "json_type": "EcosystemMetric", - "index": 0, + "name": "sell_volume_24h_q", + "lite_name": "sv1", + "semantic_type": "string", + "json_type": "string", + "index": 18, "array_depth": 0, - "optional": false, + "optional": true, + "example": "'123456.78'", "comment": [ - "Phase zero metric" + "The 24 hour taker sell volume of the instrument, expressed in quote asset decimal units" ] }, { - "name": "phase_one_metric", - "lite_name": "po", - "semantic_type": "EcosystemMetric", - "json_type": "EcosystemMetric", - "index": 1, + "name": "high_price", + "lite_name": "hp", + "semantic_type": "string", + "json_type": "string", + "index": 19, "array_depth": 0, - "optional": false, + "optional": true, + "example": "'65038.01'", "comment": [ - "Phase one metric" + "The 24 hour highest traded price of the instrument, expressed in `9` decimals" ] }, { - "name": "rank", - "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", - "index": 2, + "name": "low_price", + "lite_name": "lp1", + "semantic_type": "string", + "json_type": "string", + "index": 20, "array_depth": 0, - "optional": false, - "example": "'52'", + "optional": true, + "example": "'65038.01'", "comment": [ - "The rank of the account in the ecosystem" + "The 24 hour lowest traded price of the instrument, expressed in `9` decimals" ] }, { - "name": "total", - "lite_name": "t", - "semantic_type": "uint32", - "json_type": "integer", - "index": 3, + "name": "open_price", + "lite_name": "op", + "semantic_type": "string", + "json_type": "string", + "index": 21, "array_depth": 0, - "optional": false, - "example": "52", + "optional": true, + "example": "'65038.01'", "comment": [ - "The total number of accounts in the ecosystem" + "The 24 hour first traded price of the instrument, expressed in `9` decimals" ] }, { - "name": "total_point", - "lite_name": "tp", - "semantic_type": "uint64", + "name": "open_interest", + "lite_name": "oi", + "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 22, "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", + "optional": true, + "example": "'123456.78'", "comment": [ - "Total ecosystem point of the first epoch" + "The open interest in the instrument, expressed in base asset decimal units" ] }, { - "name": "last_calculated_at", - "lite_name": "lc", - "semantic_type": "timestamp", + "name": "long_short_ratio", + "lite_name": "ls1", + "semantic_type": "string", "json_type": "string", - "index": 5, + "index": 23, "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", + "optional": true, + "example": "'0.5'", "comment": [ - "The time when the ecosystem points were last calculated" + "The ratio of accounts that are net long vs net short on this instrument" ] } ], - "comment": [] + "comment": [ + "Derived data such as the below, will not be included by default:", + " - 24 hour volume (`buyVolume + sellVolume`)", + " - 24 hour taker buy/sell ratio (`buyVolume / sellVolume`)", + " - 24 hour average trade price (`volumeQ / volumeU`)", + " - 24 hour average trade volume (`volume / trades`)", + " - 24 hour percentage change (`24hStatChange / 24hStat`)", + " - 48 hour statistics (`2 * 24hStat - 24hStatChange`)", + "", + "To query for an extended ticker payload, leverage the `greeks` and the `derived` flags.", + "Ticker extensions are currently under design to offer you more convenience.", + "These flags are only supported on the `Ticker Snapshot` WS endpoint, and on the `Ticker` API endpoint.", + "" + ] }, { - "name": "ApiFindEcosystemEpochMetricResponse", + "name": "ApiTickerResponse", "is_root": true, "fields": [ { - "name": "metric", - "lite_name": "m", - "semantic_type": "EcosystemMetric", - "json_type": "EcosystemMetric", - "index": 0, - "array_depth": 0, - "optional": false, - "comment": [ - "The epoch metric" - ] - }, - { - "name": "rank", + "name": "result", "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'52'", - "comment": [ - "The rank of the account in the ecosystem" - ] - }, - { - "name": "total", - "lite_name": "t", - "semantic_type": "uint32", - "json_type": "integer", - "index": 2, + "semantic_type": "Ticker", + "json_type": "Ticker", + "index": 0, "array_depth": 0, "optional": false, - "example": "52", "comment": [ - "The total number of accounts in the ecosystem" + "The mini ticker matching the request asset" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiTradeRequest", + "is_root": true, + "fields": [ { - "name": "last_calculated_at", - "lite_name": "lc", - "semantic_type": "timestamp", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "The time when the ecosystem points were last calculated" - ] - }, - { - "name": "total_direct_invite_count", - "lite_name": "td", - "semantic_type": "uint32", - "json_type": "integer", - "index": 4, + "index": 0, "array_depth": 0, "optional": false, - "example": "'52'", + "example": "'BTC_USDT_Perp'", "comment": [ - "Direct invite count without relying on epochs" + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" ] }, { - "name": "total_indirect_invite_count", - "lite_name": "ti", + "name": "limit", + "lite_name": "l", "semantic_type": "uint32", "json_type": "integer", - "index": 5, + "index": 1, "array_depth": 0, "optional": false, - "example": "'52'", + "example": "500", "comment": [ - "Indirect invite count without relying on epochs" + "The limit to query for. Defaults to 500; Max 1000" ] } ], - "comment": [] + "comment": [ + "Retrieves up to 1000 of the most recent trades in any given instrument. Do not use this to poll for data -- a websocket subscription is much more performant, and useful.", + "This endpoint offers public trading data, use the Trading APIs instead to query for your personalized trade tape." + ] }, { - "name": "EcosystemLeaderboardUser", - "is_root": true, + "name": "Trade", + "is_root": false, "fields": [ { - "name": "account_id", - "lite_name": "ai", - "semantic_type": "string", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'ACC_1234567890'", + "example": "'1697788800000000000'", "comment": [ - "The off chain account id" + "Time at which the event was emitted in unix nanoseconds" ] }, { - "name": "rank", - "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'52'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The rank of the account in the ecosystem" + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" ] }, { - "name": "total_point", - "lite_name": "tp", - "semantic_type": "uint64", - "json_type": "string", + "name": "is_taker_buyer", + "lite_name": "it", + "semantic_type": "bool", + "json_type": "boolean", "index": 2, "array_depth": 0, "optional": false, - "example": "'10000101000203040506'", + "example": "true", "comment": [ - "Total ecosystem point" + "If taker was the buyer on the trade" ] }, { - "name": "twitter_username", - "lite_name": "tu", + "name": "size", + "lite_name": "s", "semantic_type": "string", "json_type": "string", "index": 3, "array_depth": 0, "optional": false, - "example": "'elonmusk'", + "example": "'123456.78'", "comment": [ - "The twitter username of the account" + "The number of assets being traded, expressed in base asset decimal units" ] - } - ], - "comment": [] - }, - { - "name": "ApiFindEcosystemLeaderboardResponse", - "is_root": true, - "fields": [ + }, { - "name": "users", - "lite_name": "u", - "semantic_type": "EcosystemLeaderboardUser", - "json_type": "EcosystemLeaderboardUser", - "index": 0, - "array_depth": 1, + "name": "price", + "lite_name": "p", + "semantic_type": "string", + "json_type": "string", + "index": 4, + "array_depth": 0, "optional": false, + "example": "'65038.01'", "comment": [ - "The list of ecosystem leaderboard users" + "The traded price, expressed in `9` decimals" ] - } - ], - "comment": [] - }, - { - "name": "QueryFindEpochRequest", - "is_root": true, - "fields": [ + }, { - "name": "time", - "lite_name": "t", - "semantic_type": "timestamp", + "name": "mark_price", + "lite_name": "mp", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 5, "array_depth": 0, - "optional": true, - "default": "0", - "example": "1714329600000000000", + "optional": false, + "example": "'65038.01'", "comment": [ - "The time to query the epoch" + "The mark price of the instrument at point of trade, expressed in `9` decimals" ] }, { - "name": "epoch", - "lite_name": "e", - "semantic_type": "int32", - "json_type": "integer", - "index": 1, + "name": "index_price", + "lite_name": "ip", + "semantic_type": "string", + "json_type": "string", + "index": 6, "array_depth": 0, - "optional": true, - "default": "0", - "example": "1", + "optional": false, + "example": "'65038.01'", "comment": [ - "The epoch number" + "The index price of the instrument at point of trade, expressed in `9` decimals" ] - } - ], - "comment": [ - "Query epoch by time or epoch number" - ] - }, - { - "name": "Epoch", - "is_root": false, - "fields": [ + }, { - "name": "epoch", - "lite_name": "e", - "semantic_type": "int32", - "json_type": "integer", - "index": 0, + "name": "interest_rate", + "lite_name": "ir", + "semantic_type": "string", + "json_type": "string", + "index": 7, "array_depth": 0, "optional": false, + "example": "0.0003", "comment": [ - "The epoch number" + "The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)" ] }, { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", + "name": "forward_price", + "lite_name": "fp", + "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 8, "array_depth": 0, "optional": false, + "example": "'65038.01'", "comment": [ - "The start time of the epoch" + "[Options] The forward price of the option at point of trade, expressed in `9` decimals" ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "trade_id", + "lite_name": "ti", + "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 9, "array_depth": 0, "optional": false, + "example": "'209358-2'", "comment": [ - "The end time of the epoch" - ] - } - ], - "comment": [] - }, - { - "name": "QueryFindEpochResponse", - "is_root": true, - "fields": [ + "A trade identifier, globally unique, and monotonically increasing (not by `1`).", + "All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.", + "`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`." + ] + }, { - "name": "epoch", - "lite_name": "e", - "semantic_type": "Epoch", - "json_type": "Epoch", - "index": 0, + "name": "venue", + "lite_name": "v", + "semantic_type": "Venue", + "json_type": "Venue", + "index": 10, "array_depth": 0, "optional": false, "comment": [ - "The epoch" + "The venue where the trade occurred" ] - } - ], - "comment": [] - }, - { - "name": "QueryGetListEpochRequest", - "is_root": true, - "fields": [ + }, { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 0, + "name": "is_rpi", + "lite_name": "ir1", + "semantic_type": "bool", + "json_type": "boolean", + "index": 13, "array_depth": 0, - "optional": true, - "default": "0", - "example": "100", + "optional": false, + "example": "false", "comment": [ - "The limit to query for" + "If the trade is a RPI trade" ] } ], - "comment": [] + "comment": [ + "All private RFQs and Private AXEs will be filtered out from the responses" + ] }, { - "name": "QueryGetListEpochResponse", + "name": "ApiTradeResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "Epoch", - "json_type": "Epoch", + "semantic_type": "Trade", + "json_type": "Trade", "index": 0, "array_depth": 1, "optional": false, "comment": [ - "The list of epochs" + "The public trades matching the request asset" ] } ], "comment": [] }, { - "name": "QueryEpochBadgeRequest", + "name": "ApiTradeHistoryRequest", "is_root": true, "fields": [ { - "name": "account_id", - "lite_name": "ai", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 0, "array_depth": 0, - "optional": true, - "default": "'all'", - "example": "'ACC_1234567890'", + "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The off chain account id to get referral stats" + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" ] }, { - "name": "epoch", - "lite_name": "e", - "semantic_type": "int32", - "json_type": "integer", + "name": "start_time", + "lite_name": "st", + "semantic_type": "int64", + "json_type": "string", "index": 1, "array_depth": 0, "optional": true, - "default": "'all'", - "example": "'1'", + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "The numerical epoch index" + "The start time to apply in nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "type", - "lite_name": "t", - "semantic_type": "RewardProgramType", - "json_type": "RewardProgramType", + "name": "end_time", + "lite_name": "et", + "semantic_type": "int64", + "json_type": "string", "index": 2, "array_depth": 0, "optional": true, - "default": "'all'", - "example": "'trader'", + "default": "now()", + "example": "'1697788800000000000'", "comment": [ - "The type of the reward program" + "The end time to apply in nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned" ] }, { @@ -10939,8 +4839,8 @@ "index": 3, "array_depth": 0, "optional": true, - "default": "'500'", - "example": "'500'", + "default": "500", + "example": "500", "comment": [ "The limit to query for. Defaults to 500; Max 1000" ] @@ -10953,464 +4853,660 @@ "index": 4, "array_depth": 0, "optional": true, - "default": "'all'", - "example": "'Qw0918='", + "default": "''", + "example": "''", "comment": [ "The cursor to indicate when to start the query from" ] } ], "comment": [ - "Query list of epoch badges" + "Perform historical lookup of public trades in any given instrument.", + "This endpoint offers public trading data, use the Trading APIs instead to query for your personalized trade tape.", + "Only data from the last three months will be retained.", + "", + "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" ] }, { - "name": "EpochBadge", - "is_root": false, + "name": "ApiTradeHistoryResponse", + "is_root": true, "fields": [ { - "name": "account_id", - "lite_name": "ai", + "name": "result", + "lite_name": "r", + "semantic_type": "Trade", + "json_type": "Trade", + "index": 0, + "array_depth": 1, + "optional": false, + "comment": [ + "The public trades matching the request asset" + ] + }, + { + "name": "next", + "lite_name": "n", "semantic_type": "string", "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": true, + "default": "''", + "example": "'Qw0918='", + "comment": [ + "The cursor to indicate when to start the next query from" + ] + } + ], + "comment": [] + }, + { + "name": "ApiGetInstrumentRequest", + "is_root": true, + "fields": [ + { + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "'BTC_USDT_Perp'", + "comment": [ + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" + ] + } + ], + "comment": [ + "Fetch a single instrument by supplying the asset or instrument name" + ] + }, + { + "name": "Instrument", + "is_root": false, + "fields": [ + { + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'ACC:10001'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The off chain account id" + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" ] }, { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", + "name": "instrument_hash", + "lite_name": "ih", + "semantic_type": "uint256", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'$GRVT_ACCOUNT_ID'", + "example": "'0x030501'", "comment": [ - "The account ID" + "The asset ID used for instrument signing." ] }, { - "name": "type", - "lite_name": "t", - "semantic_type": "RewardProgramType", - "json_type": "RewardProgramType", + "name": "base", + "lite_name": "b", + "semantic_type": "Currency", + "json_type": "Currency", "index": 2, "array_depth": 0, "optional": false, - "example": "'trader'", + "example": "'BTC'", "comment": [ - "The type of the reward program" + "The base currency" ] }, { - "name": "epoch", - "lite_name": "e", - "semantic_type": "int32", - "json_type": "integer", + "name": "quote", + "lite_name": "q", + "semantic_type": "Currency", + "json_type": "Currency", "index": 3, "array_depth": 0, "optional": false, - "example": "'2'", + "example": "'USDT'", "comment": [ - "The epoch number" + "The quote currency" ] }, { - "name": "epoch_start_time", - "lite_name": "es", - "semantic_type": "timestamp", - "json_type": "string", + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", "index": 4, "array_depth": 0, "optional": false, - "example": "'1726790400000000000'", + "example": "'PERPETUAL'", "comment": [ - "The start time of the epoch" + "The kind of instrument" ] }, { - "name": "epoch_end_time", - "lite_name": "ee", - "semantic_type": "timestamp", - "json_type": "string", - "index": 5, + "name": "venues", + "lite_name": "v", + "semantic_type": "Venue", + "json_type": "Venue", + "index": 7, + "array_depth": 1, + "optional": false, + "example": "['ORDERBOOK']", + "comment": [ + "Venues that this instrument can be traded at" + ] + }, + { + "name": "settlement_period", + "lite_name": "sp1", + "semantic_type": "InstrumentSettlementPeriod", + "json_type": "InstrumentSettlementPeriod", + "index": 8, "array_depth": 0, "optional": false, - "example": "'1726790400000000000'", + "example": "'PERPETUAL'", "comment": [ - "The end time of the epoch" + "The settlement period of the instrument" ] }, { - "name": "badge", - "lite_name": "b", - "semantic_type": "EpochBadgeType", - "json_type": "EpochBadgeType", - "index": 6, + "name": "base_decimals", + "lite_name": "bd", + "semantic_type": "int8", + "json_type": "integer", + "index": 9, "array_depth": 0, "optional": false, - "example": "'champion'", + "example": "3", "comment": [ - "The type of the badge" + "The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)" ] }, { - "name": "distributed_badges", - "lite_name": "db", - "semantic_type": "EpochBadgeType", - "json_type": "EpochBadgeType", - "index": 7, - "array_depth": 1, + "name": "quote_decimals", + "lite_name": "qd", + "semantic_type": "int8", + "json_type": "integer", + "index": 10, + "array_depth": 0, "optional": false, + "example": "3", "comment": [ - "The distributed badges" + "The smallest denomination of the quote asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)" ] }, { - "name": "total_point", - "lite_name": "tp", - "semantic_type": "uint64", + "name": "tick_size", + "lite_name": "ts", + "semantic_type": "string", "json_type": "string", - "index": 8, + "index": 11, "array_depth": 0, "optional": false, - "example": "'10000101000203040506'", + "example": "'0.01'", "comment": [ - "Total point" + "The size of a single tick, expressed in price decimal units" ] }, { - "name": "rank", - "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", - "index": 9, + "name": "min_size", + "lite_name": "ms", + "semantic_type": "string", + "json_type": "string", + "index": 12, "array_depth": 0, "optional": false, - "example": "'10000101000203040506'", + "example": "'0.01'", "comment": [ - "Rank" + "The minimum contract size, expressed in base asset decimal units" ] }, { - "name": "claimed_at", - "lite_name": "ca", + "name": "create_time", + "lite_name": "ct", "semantic_type": "timestamp", "json_type": "string", - "index": 10, + "index": 14, + "array_depth": 0, + "optional": false, + "example": "'1697788800000000000'", + "comment": [ + "Creation time in unix nanoseconds" + ] + }, + { + "name": "max_position_size", + "lite_name": "mp", + "semantic_type": "string", + "json_type": "string", + "index": 15, "array_depth": 0, "optional": false, - "example": "'1726790400000000000'", + "example": "'100.0'", "comment": [ - "The time when the badge was claimed, or the epoch end time if the user has already completed the KYC process" + "The maximum position size, expressed in base asset decimal units" ] } ], "comment": [] }, { - "name": "QueryEpochBadgeResponse", + "name": "ApiGetInstrumentResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "EpochBadge", - "json_type": "EpochBadge", + "semantic_type": "Instrument", + "json_type": "Instrument", "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The list of epoch badges" - ] - }, - { - "name": "next", - "lite_name": "n", - "semantic_type": "string", - "json_type": "string", - "index": 1, "array_depth": 0, "optional": false, - "example": "'Qw0918='", "comment": [ - "The cursor to indicate when to start the query from" + "The instrument matching the request asset" ] } ], "comment": [] }, { - "name": "QueryEpochBadgePointDistributionRequest", + "name": "ApiGetFilteredInstrumentsRequest", "is_root": true, "fields": [ { - "name": "epoch", - "lite_name": "e", - "semantic_type": "int32", - "json_type": "integer", + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": true, - "default": "'all'", - "example": "'1'", + "default": "all", + "example": "['PERPETUAL']", "comment": [ - "The numerical epoch index" + "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "type", - "lite_name": "t", - "semantic_type": "RewardProgramType", - "json_type": "RewardProgramType", + "name": "base", + "lite_name": "b", + "semantic_type": "Currency", + "json_type": "Currency", "index": 1, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['BTC', 'ETH']", + "comment": [ + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" + ] + }, + { + "name": "quote", + "lite_name": "q", + "semantic_type": "Currency", + "json_type": "Currency", + "index": 2, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['USDT', 'USDC']", + "comment": [ + "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" + ] + }, + { + "name": "is_active", + "lite_name": "ia", + "semantic_type": "bool", + "json_type": "boolean", + "index": 3, "array_depth": 0, - "optional": false, - "example": "'trader'", + "optional": true, + "default": "false", + "example": "true", + "comment": [ + "Request for active instruments only" + ] + }, + { + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", + "index": 4, + "array_depth": 0, + "optional": true, + "default": "500", + "example": "500", "comment": [ - "The type of the reward program" + "The limit to query for. Defaults to 500; Max 100000" ] } ], "comment": [ - "Query list of epoch badges" + "Fetch a list of instruments based on the filters provided" ] }, { - "name": "EpochBadgePointDistribution", - "is_root": false, + "name": "ApiGetFilteredInstrumentsResponse", + "is_root": true, "fields": [ { - "name": "badge", - "lite_name": "b", - "semantic_type": "EpochBadgeType", - "json_type": "EpochBadgeType", + "name": "result", + "lite_name": "r", + "semantic_type": "Instrument", + "json_type": "Instrument", + "index": 0, + "array_depth": 1, + "optional": false, + "comment": [ + "The instruments matching the request filter" + ] + } + ], + "comment": [] + }, + { + "name": "ApiCandlestickRequest", + "is_root": true, + "fields": [ + { + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The type of the badge" + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" ] }, { - "name": "epoch", - "lite_name": "e", - "semantic_type": "int32", - "json_type": "integer", + "name": "interval", + "lite_name": "i1", + "semantic_type": "CandlestickInterval", + "json_type": "CandlestickInterval", "index": 1, "array_depth": 0, "optional": false, "comment": [ - "The epoch number" + "The interval of each candlestick" ] }, { "name": "type", "lite_name": "t", - "semantic_type": "RewardProgramType", - "json_type": "RewardProgramType", + "semantic_type": "CandlestickType", + "json_type": "CandlestickType", "index": 2, "array_depth": 0, "optional": false, "comment": [ - "The type of the reward program" + "The type of candlestick data to retrieve" ] }, { - "name": "min_point", - "lite_name": "mp", - "semantic_type": "uint64", + "name": "start_time", + "lite_name": "st", + "semantic_type": "timestamp", "json_type": "string", "index": 3, "array_depth": 0, - "optional": false, + "optional": true, + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "The minimum point to get the badge" + "Start time of kline data in unix nanoseconds" ] }, { - "name": "max_point", - "lite_name": "mp1", - "semantic_type": "uint64", + "name": "end_time", + "lite_name": "et", + "semantic_type": "timestamp", "json_type": "string", "index": 4, "array_depth": 0, - "optional": false, + "optional": true, + "default": "now()", + "example": "'1697788800000000000'", "comment": [ - "The maximum point to get the badge" + "End time of kline data in unix nanoseconds" ] }, { - "name": "min_rank", - "lite_name": "mr", + "name": "limit", + "lite_name": "l", "semantic_type": "uint32", "json_type": "integer", "index": 5, "array_depth": 0, - "optional": false, + "optional": true, + "default": "500", + "example": "500", "comment": [ - "The minimum rank to get the badge" + "The limit to query for. Defaults to 500; Max 1000" ] }, { - "name": "max_rank", - "lite_name": "mr1", - "semantic_type": "uint32", - "json_type": "integer", + "name": "cursor", + "lite_name": "c", + "semantic_type": "string", + "json_type": "string", "index": 6, "array_depth": 0, + "optional": true, + "default": "''", + "example": "''", + "comment": [ + "The cursor to indicate when to start the query from" + ] + } + ], + "comment": [ + "Kline/Candlestick bars for an instrument. Klines are uniquely identified by their instrument, type, interval, and open time.", + "", + "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" + ] + }, + { + "name": "Candlestick", + "is_root": false, + "fields": [ + { + "name": "open_time", + "lite_name": "ot", + "semantic_type": "timestamp", + "json_type": "string", + "index": 0, + "array_depth": 0, "optional": false, + "example": "'1697788800000000000'", "comment": [ - "The maximum rank to get the badge" + "Open time of kline bar in unix nanoseconds" ] }, { - "name": "total_point", - "lite_name": "tp", - "semantic_type": "uint64", + "name": "close_time", + "lite_name": "ct", + "semantic_type": "timestamp", "json_type": "string", - "index": 7, + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'1697788800000000000'", + "comment": [ + "Close time of kline bar in unix nanosecond" + ] + }, + { + "name": "open", + "lite_name": "o", + "semantic_type": "string", + "json_type": "string", + "index": 2, "array_depth": 0, "optional": false, + "example": "'123456.78'", "comment": [ - "The total point to get the badge" + "The open price, expressed in underlying currency resolution units" ] }, { - "name": "count", + "name": "close", "lite_name": "c", - "semantic_type": "uint32", - "json_type": "integer", - "index": 8, + "semantic_type": "string", + "json_type": "string", + "index": 3, "array_depth": 0, "optional": false, + "example": "'123456.78'", "comment": [ - "The number of users to get the badge" + "The close price, expressed in underlying currency resolution units" ] - } - ], - "comment": [] - }, - { - "name": "QueryEpochBadgePointDistributionResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "EpochBadgePointDistribution", - "json_type": "EpochBadgePointDistribution", - "index": 0, - "array_depth": 1, + "name": "high", + "lite_name": "h", + "semantic_type": "string", + "json_type": "string", + "index": 4, + "array_depth": 0, "optional": false, + "example": "'123456.78'", "comment": [ - "The list of epoch badges" + "The high price, expressed in underlying currency resolution units" ] - } - ], - "comment": [] - }, - { - "name": "ApiGetListEpochBadgeResponse", - "is_root": true, - "fields": [ + }, + { + "name": "low", + "lite_name": "l", + "semantic_type": "string", + "json_type": "string", + "index": 5, + "array_depth": 0, + "optional": false, + "example": "'123456.78'", + "comment": [ + "The low price, expressed in underlying currency resolution units" + ] + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "EpochBadge", - "json_type": "EpochBadge", - "index": 0, - "array_depth": 1, + "name": "volume_b", + "lite_name": "vb", + "semantic_type": "string", + "json_type": "string", + "index": 6, + "array_depth": 0, "optional": false, + "example": "'123456.78'", "comment": [ - "The list of epoch badges" + "The underlying volume transacted, expressed in base asset decimal units" ] - } - ], - "comment": [] - }, - { - "name": "GetClaimableEcosystemBadgeResponse", - "is_root": true, - "fields": [ + }, { - "name": "badge", - "lite_name": "b", - "semantic_type": "EpochBadge", - "json_type": "EpochBadge", - "index": 0, + "name": "volume_q", + "lite_name": "vq", + "semantic_type": "string", + "json_type": "string", + "index": 7, "array_depth": 0, "optional": false, + "example": "'123456.78'", "comment": [ - "The epoch badge" + "The quote volume transacted, expressed in quote asset decimal units" ] }, { - "name": "is_claimable", - "lite_name": "ic", - "semantic_type": "bool", - "json_type": "boolean", - "index": 1, + "name": "trades", + "lite_name": "t", + "semantic_type": "uint32", + "json_type": "integer", + "index": 8, "array_depth": 0, "optional": false, + "example": "123456", "comment": [ - "Whether the badge is claimable" + "The number of trades transacted" ] }, { - "name": "claimable_until", - "lite_name": "cu", - "semantic_type": "timestamp", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 2, + "index": 9, "array_depth": 0, "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The time when the badge is claimable" + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" ] } ], - "comment": [] + "comment": [ + "" + ] }, { - "name": "ClaimEcosystemBadgeResponse", + "name": "ApiCandlestickResponse", "is_root": true, "fields": [ { - "name": "badge", - "lite_name": "b", - "semantic_type": "EpochBadge", - "json_type": "EpochBadge", + "name": "result", + "lite_name": "r", + "semantic_type": "Candlestick", + "json_type": "Candlestick", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, "comment": [ - "The epoch badge" + "The candlestick result set for given interval" + ] + }, + { + "name": "next", + "lite_name": "n", + "semantic_type": "string", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": true, + "default": "''", + "example": "'Qw0918='", + "comment": [ + "The cursor to indicate when to start the next query from" ] } ], "comment": [] }, { - "name": "ApiGetListFlatReferralRequest", + "name": "ApiFundingRateRequest", "is_root": true, "fields": [ { - "name": "referral_id", - "lite_name": "ri", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'ACC_1234567890'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The off chain referrer account id to get all flat referrals" + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" ] }, { @@ -11424,7 +5520,7 @@ "default": "0", "example": "'1697788800000000000'", "comment": [ - "Optional. Start time in unix nanoseconds" + "Start time of funding rate in unix nanoseconds" ] }, { @@ -11438,1644 +5534,1888 @@ "default": "now()", "example": "'1697788800000000000'", "comment": [ - "Optional. End time in unix nanoseconds" + "End time of funding rate in unix nanoseconds" + ] + }, + { + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", + "index": 3, + "array_depth": 0, + "optional": true, + "default": "500", + "example": "500", + "comment": [ + "The limit to query for. Defaults to 500; Max 1000" ] }, { - "name": "account_id", - "lite_name": "ai", + "name": "cursor", + "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 3, + "index": 4, "array_depth": 0, - "optional": false, - "example": "'ACC_1234567890'", + "optional": true, + "default": "''", + "example": "''", "comment": [ - "The off chain account id to get all user's referrers" + "The cursor to indicate when to start the query from" ] } ], "comment": [ - "startTime and endTime are optional parameters. The semantics of these parameters are as follows:\u003cul\u003e" + "Lookup the historical funding rate of a perpetual future.", + "", + "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" ] }, { - "name": "FlatReferral", + "name": "FundingRate", "is_root": false, "fields": [ { - "name": "account_id", - "lite_name": "ai", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'ACC_1234567890'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The off chain account id" + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" ] }, { - "name": "referrer_id", - "lite_name": "ri", + "name": "funding_rate", + "lite_name": "fr", "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'ACC_1234567890'", - "comment": [ - "The off chain referrer account id" - ] - }, - { - "name": "referrer_level", - "lite_name": "rl", - "semantic_type": "uint8", - "json_type": "integer", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'1'", + "example": "0.0003", "comment": [ - "The referrer level; 1: direct referrer, 2: indirect referrer" + "The funding rate of the instrument, expressed in percentage points" ] }, { - "name": "account_create_time", - "lite_name": "ac", + "name": "funding_time", + "lite_name": "ft", "semantic_type": "timestamp", "json_type": "string", - "index": 3, + "index": 2, "array_depth": 0, "optional": false, "example": "'1697788800000000000'", "comment": [ - "The account creation time" + "The funding timestamp of the funding rate, expressed in unix nanoseconds" ] }, { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "uint256", + "name": "mark_price", + "lite_name": "mp", + "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 3, "array_depth": 0, "optional": false, - "example": "'10000101000203040506'", + "example": "'65038.01'", "comment": [ - "The main account id" + "The mark price of the instrument at funding timestamp, expressed in `9` decimals" ] }, { - "name": "referrer_main_account_id", - "lite_name": "rm", - "semantic_type": "uint256", + "name": "funding_rate_8_h_avg", + "lite_name": "fr1", + "semantic_type": "string", "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", - "comment": [ - "The referrer main account id" - ] - }, - { - "name": "is_business", - "lite_name": "ib", - "semantic_type": "bool", - "json_type": "boolean", - "index": 6, - "array_depth": 0, - "optional": false, - "example": "true", - "comment": [ - "The account is a business account or not" - ] - }, - { - "name": "is_kyc_completed", - "lite_name": "ik", - "semantic_type": "bool", - "json_type": "boolean", - "index": 7, + "index": 4, "array_depth": 0, "optional": false, - "example": "true", + "example": "0.0003", "comment": [ - "The account is KYC verified or not" + "The 8h average funding rate of the instrument, expressed in percentage points" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiFundingRateResponse", + "is_root": true, + "fields": [ { - "name": "kyc_completed_at", - "lite_name": "kc", - "semantic_type": "timestamp", - "json_type": "string", - "index": 8, - "array_depth": 0, + "name": "result", + "lite_name": "r", + "semantic_type": "FundingRate", + "json_type": "FundingRate", + "index": 0, + "array_depth": 1, "optional": false, - "example": "'1697788800000000000'", "comment": [ - "The KYC completed time" + "The funding rate result set for given interval" ] }, { - "name": "kyc_type", - "lite_name": "kt", + "name": "next", + "lite_name": "n", "semantic_type": "string", "json_type": "string", - "index": 9, - "array_depth": 0, - "optional": false, - "example": "'individual'", - "comment": [ - "The KYC type, can be 'individual' or 'business'" - ] - }, - { - "name": "kyc_first_completed_at", - "lite_name": "kf", - "semantic_type": "timestamp", - "json_type": "string", - "index": 10, + "index": 1, "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", + "optional": true, + "default": "''", + "example": "'Qw0918='", "comment": [ - "The first KYC completed time" + "The cursor to indicate when to start the next query from" ] } ], - "comment": [ - "" - ] + "comment": [] }, { - "name": "ApiGetListFlatReferralResponse", + "name": "JSONRPCRequest", "is_root": true, "fields": [ { - "name": "flat_referrals", - "lite_name": "fr", - "semantic_type": "FlatReferral", - "json_type": "FlatReferral", + "name": "jsonrpc", + "lite_name": "j", + "semantic_type": "string", + "json_type": "string", "index": 0, - "array_depth": 1, + "array_depth": 0, "optional": false, + "example": "'2.0'", "comment": [ - "The list of flat referrals" + "The JSON RPC version to use for the request" ] - } - ], - "comment": [] - }, - { - "name": "ApiQueryFlatReferralStatRequest", - "is_root": true, - "fields": [ + }, { - "name": "account_id", - "lite_name": "ai", + "name": "method", + "lite_name": "m", "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'subscribe'", + "comment": [ + "The method to use for the request (eg: `subscribe` / `unsubscribe` / `v1/instrument` )" + ] + }, + { + "name": "params", + "lite_name": "p", + "semantic_type": "any", + "json_type": "object", + "index": 2, "array_depth": 0, "optional": false, - "example": "'ACC_1234567890'", "comment": [ - "The off chain account id to get referral stats" + "The parameters for the request" + ] + }, + { + "name": "id", + "lite_name": "i", + "semantic_type": "uint32", + "json_type": "integer", + "index": 3, + "array_depth": 0, + "optional": true, + "default": "0", + "example": "123", + "comment": [ + "Optional Field which is used to match the response by the client.", + "If not passed, this field will not be returned" ] } ], "comment": [ - "Query flat referral stats" + "All Websocket JSON RPC Requests are housed in this wrapper. You may specify a stream, and a list of feeds to subscribe to.", + "If a `request_id` is supplied in this JSON RPC request, it will be propagated back to any relevant JSON RPC responses (including error).", + "When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details." ] }, { - "name": "ApiQueryFlatReferralStatResponse", + "name": "Error", "is_root": true, "fields": [ { - "name": "direct_invite_count", - "lite_name": "di", - "semantic_type": "uint32", + "name": "code", + "lite_name": "c", + "semantic_type": "uint16", "json_type": "integer", "index": 0, "array_depth": 0, "optional": false, - "example": "'52'", + "example": "123", "comment": [ - "Direct invite count" + "The error code for the request" ] }, { - "name": "indirect_invite_count", - "lite_name": "ii", - "semantic_type": "uint32", - "json_type": "integer", + "name": "message", + "lite_name": "m", + "semantic_type": "string", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'52'", + "example": "'An error occurred'", "comment": [ - "Indirect invite count" + "The error message for the request" ] } ], - "comment": [] + "comment": [ + "An error response" + ] }, { - "name": "LPSnapshot", + "name": "JSONRPCResponse", "is_root": true, "fields": [ { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "uint256", + "name": "jsonrpc", + "lite_name": "j", + "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'10000101000203040506'", + "example": "'2.0'", "comment": [ - "The main account id" + "The JSON RPC version to use for the request" ] }, { - "name": "lp_asset", - "lite_name": "la", - "semantic_type": "uint64", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "any", + "json_type": "object", "index": 1, "array_depth": 0, - "optional": false, - "example": "'10000'", + "optional": true, + "default": "null", "comment": [ - "The LP Asset" + "The result for the request" ] }, { - "name": "underlying_multiplier", - "lite_name": "um", - "semantic_type": "uint64", - "json_type": "string", + "name": "error", + "lite_name": "e", + "semantic_type": "Error", + "json_type": "Error", "index": 2, "array_depth": 0, - "optional": false, - "example": "'52'", + "optional": true, + "default": "null", "comment": [ - "Underlying multiplier" + "The error for the request" ] }, { - "name": "maker_trading_volume", - "lite_name": "mt", - "semantic_type": "uint256", - "json_type": "string", + "name": "id", + "lite_name": "i", + "semantic_type": "uint32", + "json_type": "integer", "index": 3, "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", + "optional": true, + "default": "0", + "example": "123", "comment": [ - "Maker trading volume" + "Optional Field which is used to match the response by the client.", + "If not passed, this field will not be returned" ] }, { - "name": "bid_fast_market_multiplier", - "lite_name": "bf", - "semantic_type": "uint32", - "json_type": "integer", + "name": "method", + "lite_name": "m", + "semantic_type": "string", + "json_type": "string", "index": 4, "array_depth": 0, "optional": false, - "example": "'52'", + "example": "'subscribe'", "comment": [ - "Fast market multiplier" + "The method used in the request for this response (eg: `subscribe` / `unsubscribe` / `v1/instrument` )" ] - }, + } + ], + "comment": [ + "All Websocket JSON RPC Responses are housed in this wrapper. It returns a confirmation of the JSON RPC subscribe request.", + "If a `request_id` is supplied in the JSON RPC request, it will be propagated back in this JSON RPC response." + ] + }, + { + "name": "WSSubscribeParams", + "is_root": true, + "fields": [ { - "name": "ask_fast_market_multiplier", - "lite_name": "af", - "semantic_type": "uint32", - "json_type": "integer", - "index": 5, + "name": "stream", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", + "index": 0, "array_depth": 0, "optional": false, - "example": "'52'", + "example": "'v1.ticker.d'", "comment": [ - "Fast market multiplier" + "The channel to subscribe to (eg: ticker.s / ticker.d)" ] }, { - "name": "liquidity_score", - "lite_name": "ls", - "semantic_type": "uint256", + "name": "selectors", + "lite_name": "s1", + "semantic_type": "string", "json_type": "string", - "index": 6, - "array_depth": 0, + "index": 1, + "array_depth": 1, "optional": false, - "example": "'10000101000203040506'", + "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", "comment": [ - "Liquidity score" + "The list of feeds to subscribe to" ] }, { - "name": "calculate_at", - "lite_name": "ca", - "semantic_type": "timestamp", - "json_type": "string", - "index": 7, + "name": "use_global_sequence_number", + "lite_name": "ug", + "semantic_type": "bool", + "json_type": "boolean", + "index": 2, "array_depth": 0, - "optional": false, - "example": "'1726790400000000000'", + "optional": true, + "default": "false", + "example": "true", "comment": [ - "The time when the snapshot was calculated" + "Whether to use the global sequence number for the stream" ] } ], - "comment": [] + "comment": [ + "All V1 Websocket Subscription Requests are housed in this wrapper. You may specify a stream and a list of feeds to subscribe to.", + "When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details.", + "Sequence numbers can be either gateway-specific or global:", + "- **Gateway Unique Sequence Number**: Increments by one per stream, resets to 0 on gateway restart.", + "- **Global Unique Sequence Number**: A cluster-wide unique number assigned to each cluster payload, does not reset on gateway restarts, and can be used to track and identify message order across streams using `sequence_number` and `prev_sequence_number` in the feed response.", + "Set `useGlobalSequenceNumber = true` if you need a persistent, unique identifier across all streams or ordering across multiple feeds." + ] }, { - "name": "ApproximateLPSnapshot", + "name": "WSSubscribeResult", "is_root": true, "fields": [ { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "uint256", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'10000101000203040506'", + "example": "'v1.ticker.d'", "comment": [ - "The main account id" + "The channel to subscribe to (eg: ticker.s / ticker.d)" ] }, { - "name": "underlying_multiplier", - "lite_name": "um", - "semantic_type": "uint64", + "name": "subs", + "lite_name": "s1", + "semantic_type": "string", "json_type": "string", "index": 1, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'52'", + "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", "comment": [ - "Underlying multiplier" + "The list of feeds subscribed to" ] }, { - "name": "market_share_multiplier", - "lite_name": "ms", - "semantic_type": "uint64", + "name": "unsubs", + "lite_name": "u", + "semantic_type": "string", "json_type": "string", "index": 2, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'10000101000203040506'", + "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", "comment": [ - "Market share multiplier" + "The list of feeds unsubscribed from" ] }, { - "name": "bid_fast_market_multiplier", - "lite_name": "bf", + "name": "num_snapshots", + "lite_name": "ns", "semantic_type": "uint32", "json_type": "integer", "index": 3, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'52'", + "example": "10", "comment": [ - "Fast market multiplier" + "The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs`" ] }, { - "name": "ask_fast_market_multiplier", - "lite_name": "af", - "semantic_type": "uint32", - "json_type": "integer", + "name": "first_sequence_number", + "lite_name": "fs", + "semantic_type": "uint64", + "json_type": "string", "index": 4, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'52'", + "example": "872634876", "comment": [ - "Fast market multiplier" + "The first sequence number to expect for each subscribed feed. Returned in same order as `subs`" ] }, { - "name": "liquidity_score", + "name": "latest_sequence_number", "lite_name": "ls", - "semantic_type": "uint256", + "semantic_type": "uint64", "json_type": "string", "index": 5, + "array_depth": 1, + "optional": false, + "example": "872634875", + "comment": [ + "The sequence number of the most recent message in the stream. Next received sequence number must be larger than this one. Returned in same order as `subs`" + ] + } + ], + "comment": [ + "To ensure you always know if you have missed any payloads, GRVT servers apply the following heuristics to sequence numbers:\u003cul\u003e\u003cli\u003eAll snapshot payloads will have a sequence number of `0`. All delta payloads will have a sequence number of `1+`. So its easy to distinguish between snapshots, and deltas\u003c/li\u003e\u003cli\u003eNum snapshots returned in Response (per stream): You can ensure that you received the right number of snapshots\u003c/li\u003e\u003cli\u003eFirst sequence number returned in Response (per stream): You can ensure that you received the first stream, without gaps from snapshots\u003c/li\u003e\u003cli\u003eSequence numbers should always monotonically increase by `1`. If it decreases, or increases by more than `1`. Please reconnect\u003c/li\u003e\u003cli\u003eDuplicate sequence numbers are possible due to network retries. If you receive a duplicate, please ignore it, or idempotently re-update it.\u003c/li\u003e\u003c/ul\u003e", + "When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details." + ] + }, + { + "name": "WSUnsubscribeParams", + "is_root": true, + "fields": [ + { + "name": "stream", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", + "index": 0, "array_depth": 0, "optional": false, - "example": "'10000101000203040506'", + "example": "'v1.ticker.d'", "comment": [ - "Liquidity score" + "The channel to unsubscribe from (eg: ticker.s / ticker.d)" ] }, { - "name": "calculate_at", - "lite_name": "ca", - "semantic_type": "timestamp", + "name": "selectors", + "lite_name": "s1", + "semantic_type": "string", "json_type": "string", - "index": 6, - "array_depth": 0, + "index": 1, + "array_depth": 1, "optional": false, - "example": "'1726790400000000000'", + "example": "['BTC_USDT_Perp', 'ETH_USDT_Perp']", + "comment": [ + "The list of feeds to unsubscribe from" + ] + }, + { + "name": "use_global_sequence_number", + "lite_name": "ug", + "semantic_type": "bool", + "json_type": "boolean", + "index": 2, + "array_depth": 0, + "optional": true, + "default": "false", + "example": "true", "comment": [ - "The time when the snapshot was calculated" + "Whether to use the global sequence number for the stream" ] } ], - "comment": [] + "comment": [ + "All V1 Websocket Unsubscription Requests are housed in this wrapper. You may specify a stream, a list of feeds and whether those feeds use global sequence numbers to unsubscribe from." + ] }, { - "name": "LPPoint", + "name": "WSUnsubscribeResult", "is_root": true, "fields": [ { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "uint256", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'10000101000203040506'", + "example": "'v1.ticker.d'", "comment": [ - "The main account id" + "The channel to subscribe to (eg: ticker.s / ticker.d)" ] }, { - "name": "liquidity_score", - "lite_name": "ls", - "semantic_type": "uint256", + "name": "unsubs", + "lite_name": "u", + "semantic_type": "string", "json_type": "string", "index": 1, - "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", - "comment": [ - "Liquidity score" - ] - }, - { - "name": "rank", - "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", - "index": 2, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'52'", + "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", "comment": [ - "The rank of user in the LP leaderboard" + "The list of feeds unsubscribed from" ] } ], - "comment": [] + "comment": [ + "Returns a confirmation of all unsubscribes" + ] }, { - "name": "ApproximateLPPoint", + "name": "WSSubscribeRequestV1Legacy", "is_root": true, "fields": [ { - "name": "off_chain_account_id", - "lite_name": "oc", - "semantic_type": "string", - "json_type": "string", + "name": "request_id", + "lite_name": "ri", + "semantic_type": "uint32", + "json_type": "integer", "index": 0, "array_depth": 0, - "optional": false, - "example": "'ACC:123456'", + "optional": true, + "default": "0", + "example": "123", "comment": [ - "The off chain account id" + "Optional Field which is used to match the response by the client.", + "If not passed, this field will not be returned" ] }, { - "name": "liquidity_score", - "lite_name": "ls", - "semantic_type": "uint256", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'10000101000203040506'", + "example": "'v1.ticker.d'", "comment": [ - "Liquidity score" + "The channel to subscribe to (eg: ticker.s / ticker.d)" ] }, { - "name": "rank", - "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", + "name": "feed", + "lite_name": "f", + "semantic_type": "string", + "json_type": "string", "index": 2, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'52'", + "example": "['BTC_USDT_Perp', 'ETH_USDT_Perp']", "comment": [ - "The rank of user in the LP leaderboard" + "The list of feeds to subscribe to" ] - } - ], - "comment": [] - }, - { - "name": "QueryGetLatestLPSnapshotResponse", - "is_root": true, - "fields": [ + }, { - "name": "snapshot", - "lite_name": "s", - "semantic_type": "LPSnapshot", - "json_type": "LPSnapshot", - "index": 0, + "name": "method", + "lite_name": "m", + "semantic_type": "string", + "json_type": "string", + "index": 3, "array_depth": 0, "optional": false, + "example": "'subscribe'", + "comment": [ + "The method to use for the request (eg: subscribe / unsubscribe)" + ] + }, + { + "name": "is_full", + "lite_name": "if", + "semantic_type": "bool", + "json_type": "boolean", + "index": 4, + "array_depth": 0, + "optional": true, + "default": "false", + "example": "true", "comment": [ - "The latest LP snapshot" + "Whether the request is for full data or lite data" ] } ], - "comment": [] + "comment": [ + "All V1 Websocket Requests are housed in this wrapper. You may specify a stream, and a list of feeds to subscribe to.", + "If a `request_id` is supplied in this JSON RPC request, it will be propagated back to any relevant JSON RPC responses (including error).", + "When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details." + ] }, { - "name": "ApiGetLatestLPSnapshotRequest", + "name": "WSSubscribeResponseV1Legacy", "is_root": true, "fields": [ { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", + "name": "request_id", + "lite_name": "ri", + "semantic_type": "uint32", + "json_type": "integer", "index": 0, "array_depth": 0, "optional": true, "default": "0", - "example": "'PERPETUAL'", + "example": "123", "comment": [ - "The kind filter to apply" + "Optional Field which is used to match the response by the client.", + "If not passed, this field will not be returned" ] }, { - "name": "base", - "lite_name": "b", - "semantic_type": "Currency", - "json_type": "Currency", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", "index": 1, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'BTC'", + "optional": false, + "example": "'v1.ticker.d'", "comment": [ - "The base filter to apply" + "The channel to subscribe to (eg: ticker.s / ticker.d)" ] - } - ], - "comment": [] - }, - { - "name": "ApiGetLatestLPSnapshotResponse", - "is_root": true, - "fields": [ + }, { - "name": "snapshot", - "lite_name": "s", - "semantic_type": "ApproximateLPSnapshot", - "json_type": "ApproximateLPSnapshot", - "index": 0, - "array_depth": 0, + "name": "subs", + "lite_name": "s1", + "semantic_type": "string", + "json_type": "string", + "index": 2, + "array_depth": 1, "optional": false, + "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", "comment": [ - "The latest LP snapshot" + "The list of feeds subscribed to" ] - } - ], - "comment": [] - }, - { - "name": "ApiGetLPLeaderboardRequest", - "is_root": true, - "fields": [ + }, { - "name": "epoch", - "lite_name": "e", - "semantic_type": "int32", - "json_type": "integer", - "index": 0, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "1", + "name": "unsubs", + "lite_name": "u", + "semantic_type": "string", + "json_type": "string", + "index": 3, + "array_depth": 1, + "optional": false, + "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", "comment": [ - "The epoch to filter" + "The list of feeds unsubscribed from" ] }, { - "name": "limit", - "lite_name": "l", + "name": "num_snapshots", + "lite_name": "ns", "semantic_type": "uint32", "json_type": "integer", - "index": 1, - "array_depth": 0, + "index": 4, + "array_depth": 1, "optional": false, - "example": "100", + "example": "10", "comment": [ - "The number of accounts to return" + "The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs`" ] }, { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", - "index": 2, - "array_depth": 0, + "name": "first_sequence_number", + "lite_name": "fs", + "semantic_type": "uint64", + "json_type": "string", + "index": 5, + "array_depth": 1, "optional": false, - "example": "'PERPETUAL'", + "example": "872634876", "comment": [ - "The kind filter to apply" + "The first sequence number to expect for each subscribed feed. Returned in same order as `subs`" ] }, { - "name": "base", - "lite_name": "b", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 3, - "array_depth": 0, + "name": "latest_sequence_number", + "lite_name": "ls", + "semantic_type": "uint64", + "json_type": "string", + "index": 6, + "array_depth": 1, "optional": false, - "example": "'BTC'", + "example": "872634875", "comment": [ - "The base filter to apply" + "The sequence number of the most recent message in the stream. Next received sequence number must be larger than this one. Returned in same order as `subs`" ] } ], - "comment": [] + "comment": [ + "All V1 Websocket Responses are housed in this wrapper. It returns a confirmation of the JSON RPC subscribe request.", + "If a `request_id` is supplied in the JSON RPC request, it will be propagated back in this JSON RPC response.", + "To ensure you always know if you have missed any payloads, GRVT servers apply the following heuristics to sequence numbers:\u003cul\u003e\u003cli\u003eAll snapshot payloads will have a sequence number of `0`. All delta payloads will have a sequence number of `1+`. So its easy to distinguish between snapshots, and deltas\u003c/li\u003e\u003cli\u003eNum snapshots returned in Response (per stream): You can ensure that you received the right number of snapshots\u003c/li\u003e\u003cli\u003eFirst sequence number returned in Response (per stream): You can ensure that you received the first stream, without gaps from snapshots\u003c/li\u003e\u003cli\u003eSequence numbers should always monotonically increase by `1`. If it decreases, or increases by more than `1`. Please reconnect\u003c/li\u003e\u003cli\u003eDuplicate sequence numbers are possible due to network retries. If you receive a duplicate, please ignore it, or idempotently re-update it.\u003c/li\u003e\u003c/ul\u003e", + "When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details." + ] }, { - "name": "ApiGetLPLeaderboardResponse", + "name": "WSOrderbookLevelsFeedSelectorV1", "is_root": true, "fields": [ { - "name": "points", - "lite_name": "p", - "semantic_type": "ApproximateLPPoint", - "json_type": "ApproximateLPPoint", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 0, - "array_depth": 1, + "array_depth": 0, "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The list of LP points" - ] + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" + ], + "selector": "primary" + }, + { + "name": "rate", + "lite_name": "r", + "semantic_type": "uint32", + "json_type": "integer", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "500", + "comment": [ + "The minimal rate at which we publish feeds (in milliseconds)", + "Delta (50, 100, 500, 1000)", + "Snapshot (500, 1000)" + ], + "selector": "secondary" + }, + { + "name": "depth", + "lite_name": "d", + "semantic_type": "uint32", + "json_type": "integer", + "index": 2, + "array_depth": 0, + "optional": true, + "default": "'0'", + "example": "50", + "comment": [ + "Depth of the order book to be retrieved", + "Delta(0 - `unlimited`)", + "Snapshot(10, 50, 100, 500)" + ], + "selector": "secondary" } ], - "comment": [] + "comment": [ + "Subscribes to aggregated orderbook updates for a single instrument. The `book.s` channel offers simpler integration. To experience higher publishing rates, please use the `book.d` channel.", + "Unlike the `book.d` channel which publishes an initial snapshot, then only streams deltas after, the `book.s` channel publishes full snapshots at each feed.", + "", + "The Delta feed will work as follows:\u003cul\u003e\u003cli\u003eOn subscription, the server will send a full snapshot of all levels of the Orderbook.\u003c/li\u003e\u003cli\u003eAfter the snapshot, the server will only send levels that have changed in value.\u003c/li\u003e\u003c/ul\u003e", + "", + "Subscription Pattern:\u003cul\u003e\u003cli\u003eDelta - `instrument@rate`\u003c/li\u003e\u003cli\u003eSnapshot - `instrument@rate-depth`\u003c/li\u003e\u003c/ul\u003e", + "", + "Field Semantics:\u003cul\u003e\u003cli\u003e[DeltaOnly] If a level is not updated, level not published\u003c/li\u003e\u003cli\u003eIf a level is updated, {size: '123'}\u003c/li\u003e\u003cli\u003eIf a level is set to zero, {size: '0'}\u003c/li\u003e\u003cli\u003eIncoming levels will be published as soon as price moves\u003c/li\u003e\u003cli\u003eOutgoing levels will be published with `size = 0`\u003c/li\u003e\u003c/ul\u003e" + ] }, { - "name": "ApiGetLPPointRequest", + "name": "WSOrderbookLevelsFeedDataV1", "is_root": true, "fields": [ { - "name": "epoch", - "lite_name": "e", - "semantic_type": "int32", - "json_type": "integer", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", "index": 0, "array_depth": 0, - "optional": true, - "default": "0", - "example": "1", + "optional": false, + "example": "'v1.book.s'", "comment": [ - "The epoch to filter" + "Stream name" ] }, { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", + "name": "selector", + "lite_name": "s1", + "semantic_type": "string", + "json_type": "string", "index": 1, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'PERPETUAL'", + "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "Optional. The kind filter to apply" + "Primary selector" ] }, { - "name": "base", - "lite_name": "b", - "semantic_type": "Currency", - "json_type": "Currency", + "name": "sequence_number", + "lite_name": "sn", + "semantic_type": "uint64", + "json_type": "string", "index": 2, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'BTC'", + "optional": false, + "example": "'872634876'", "comment": [ - "Optional. The base filter to apply" + "A sequence number used to determine message order within a stream.", + "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", + "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", + " - A single cluster payload can be multiplexed into multiple stream payloads.", + " - To distinguish each stream payload, a `dedupCounter` is included.", + " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." ] - } - ], - "comment": [] - }, - { - "name": "ApiGetLPPointResponse", - "is_root": true, - "fields": [ + }, { - "name": "point", - "lite_name": "p", - "semantic_type": "LPPoint", - "json_type": "LPPoint", - "index": 0, + "name": "feed", + "lite_name": "f", + "semantic_type": "OrderbookLevels", + "json_type": "OrderbookLevels", + "index": 3, "array_depth": 0, "optional": false, "comment": [ - "LP points of user" + "An orderbook levels object matching the request filter" ] }, { - "name": "maker_count", - "lite_name": "mc", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, + "name": "prev_sequence_number", + "lite_name": "ps", + "semantic_type": "uint64", + "json_type": "string", + "index": 4, "array_depth": 0, "optional": false, - "example": "'52'", + "example": "'872634875'", "comment": [ - "The number of maker" + "The previous sequence number that determines the message order" ] } ], "comment": [] }, { - "name": "ApiGetLPInfoRequest", + "name": "WSMiniTickerFeedSelectorV1", "is_root": true, "fields": [ { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'PERPETUAL'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The kind filter to apply" - ] + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" + ], + "selector": "primary" }, { - "name": "base", - "lite_name": "b", - "semantic_type": "Currency", - "json_type": "Currency", + "name": "rate", + "lite_name": "r", + "semantic_type": "uint32", + "json_type": "integer", "index": 1, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'BTC'", + "optional": false, + "example": "500", "comment": [ - "The base filter to apply" - ] + "The minimal rate at which we publish feeds (in milliseconds)", + "Delta (0 - `raw`, 50, 100, 200, 500, 1000, 5000)", + "Snapshot (200, 500, 1000, 5000)" + ], + "selector": "secondary" } ], - "comment": [] + "comment": [ + "Subscribes to a mini ticker feed for a single instrument. The `mini.s` channel offers simpler integration. To experience higher publishing rates, please use the `mini.d` channel.", + "Unlike the `mini.d` channel which publishes an initial snapshot, then only streams deltas after, the `mini.s` channel publishes full snapshots at each feed.", + "", + "The Delta feed will work as follows:\u003cul\u003e\u003cli\u003eOn subscription, the server will send a full snapshot of the mini ticker.\u003c/li\u003e\u003cli\u003eAfter the snapshot, the server will only send deltas of the mini ticker.\u003c/li\u003e\u003cli\u003eThe server will send a delta if any of the fields in the mini ticker have changed.\u003c/li\u003e\u003c/ul\u003e", + "", + "Field Semantics:\u003cul\u003e\u003cli\u003e[DeltaOnly] If a field is not updated, {}\u003c/li\u003e\u003cli\u003eIf a field is updated, {field: '123'}\u003c/li\u003e\u003cli\u003eIf a field is set to zero, {field: '0'}\u003c/li\u003e\u003cli\u003eIf a field is set to null, {field: ''}\u003c/li\u003e\u003c/ul\u003e" + ] }, { - "name": "ApiGetLPInfoResponse", + "name": "WSMiniTickerFeedDataV1", "is_root": true, "fields": [ { - "name": "is_lp_maker", - "lite_name": "il", - "semantic_type": "bool", - "json_type": "boolean", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "true", + "example": "'v1.mini.s'", "comment": [ - "Is LP maker" + "Stream name" ] }, { - "name": "spread_score_value_multiplier", - "lite_name": "ss", - "semantic_type": "uint64", + "name": "selector", + "lite_name": "s1", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'1000000000'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The spread score value multiplier" + "Primary selector" ] }, { - "name": "depth_score_value_multiplier", - "lite_name": "ds", + "name": "sequence_number", + "lite_name": "sn", "semantic_type": "uint64", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "'1000000000'", + "example": "'872634876'", "comment": [ - "The depth score value multiplier" + "A sequence number used to determine message order within a stream.", + "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", + "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", + " - A single cluster payload can be multiplexed into multiple stream payloads.", + " - To distinguish each stream payload, a `dedupCounter` is included.", + " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." ] }, { - "name": "market_share_value_multiplier", - "lite_name": "ms", - "semantic_type": "uint64", - "json_type": "string", + "name": "feed", + "lite_name": "f", + "semantic_type": "MiniTicker", + "json_type": "MiniTicker", "index": 3, "array_depth": 0, "optional": false, - "example": "'1000000000'", "comment": [ - "The market share value multiplier" + "A mini ticker matching the request filter" ] }, { - "name": "underlying_multiplier", - "lite_name": "um", + "name": "prev_sequence_number", + "lite_name": "ps", "semantic_type": "uint64", "json_type": "string", "index": 4, "array_depth": 0, "optional": false, - "example": "'52'", + "example": "'872634875'", "comment": [ - "Underlying multiplier" + "The previous sequence number that determines the message order" ] - }, + } + ], + "comment": [] + }, + { + "name": "WSTickerFeedSelectorV1", + "is_root": true, + "fields": [ { - "name": "market_share_multiplier", - "lite_name": "ms1", - "semantic_type": "uint64", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": false, - "example": "'1000000000'", - "comment": [ - "The market share multiplier, equal to the maker trading volume in the past 2 hours" - ] - }, - { - "name": "ask_fast_market_multiplier", - "lite_name": "af", - "semantic_type": "uint32", - "json_type": "integer", - "index": 6, + "index": 0, "array_depth": 0, "optional": false, - "example": "'100'", + "example": "'BTC_USDT_Perp'", "comment": [ - "Ask fast market multiplier" - ] + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" + ], + "selector": "primary" }, { - "name": "bid_fast_market_multiplier", - "lite_name": "bf", + "name": "rate", + "lite_name": "r", "semantic_type": "uint32", "json_type": "integer", - "index": 7, + "index": 1, "array_depth": 0, "optional": false, - "example": "'100'", + "example": "500", "comment": [ - "Bid fast market multiplier" - ] + "The minimal rate at which we publish feeds (in milliseconds)", + "Delta (100, 200, 500, 1000, 5000)", + "Snapshot (500, 1000, 5000)" + ], + "selector": "secondary" } ], - "comment": [] + "comment": [ + "Subscribes to a ticker feed for a single instrument. The `ticker.s` channel offers simpler integration. To experience higher publishing rates, please use the `ticker.d` channel.", + "Unlike the `ticker.d` channel which publishes an initial snapshot, then only streams deltas after, the `ticker.s` channel publishes full snapshots at each feed.", + "", + "The Delta feed will work as follows:\u003cul\u003e\u003cli\u003eOn subscription, the server will send a full snapshot of the ticker.\u003c/li\u003e\u003cli\u003eAfter the snapshot, the server will only send deltas of the ticker.\u003c/li\u003e\u003cli\u003eThe server will send a delta if any of the fields in the ticker have changed.\u003c/li\u003e\u003c/ul\u003e", + "", + "Field Semantics:\u003cul\u003e\u003cli\u003e[DeltaOnly] If a field is not updated, {}\u003c/li\u003e\u003cli\u003eIf a field is updated, {field: '123'}\u003c/li\u003e\u003cli\u003eIf a field is set to zero, {field: '0'}\u003c/li\u003e\u003cli\u003eIf a field is set to null, {field: ''}\u003c/li\u003e\u003c/ul\u003e" + ] }, { - "name": "RewardEpochInfo", - "is_root": false, + "name": "WSTickerFeedDataV1", + "is_root": true, "fields": [ { - "name": "epoch", - "lite_name": "e", - "semantic_type": "int32", - "json_type": "integer", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'2'", + "example": "'v1.ticker.s'", "comment": [ - "The epoch number" + "Stream name" ] }, { - "name": "epoch_start_time", - "lite_name": "es", - "semantic_type": "timestamp", + "name": "selector", + "lite_name": "s1", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'1726790400000000000'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The start time of the epoch" + "Primary selector" ] }, { - "name": "epoch_end_time", - "lite_name": "ee", - "semantic_type": "timestamp", + "name": "sequence_number", + "lite_name": "sn", + "semantic_type": "uint64", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "'1726790400000000000'", + "example": "'872634876'", "comment": [ - "The end time of the epoch" + "A sequence number used to determine message order within a stream.", + "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", + "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", + " - A single cluster payload can be multiplexed into multiple stream payloads.", + " - To distinguish each stream payload, a `dedupCounter` is included.", + " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." ] }, { - "name": "status", - "lite_name": "s", - "semantic_type": "RewardEpochStatus", - "json_type": "RewardEpochStatus", + "name": "feed", + "lite_name": "f", + "semantic_type": "Ticker", + "json_type": "Ticker", "index": 3, "array_depth": 0, "optional": false, "comment": [ - "The status of the epoch" + "A ticker matching the request filter" + ] + }, + { + "name": "prev_sequence_number", + "lite_name": "ps", + "semantic_type": "uint64", + "json_type": "string", + "index": 4, + "array_depth": 0, + "optional": false, + "example": "'872634875'", + "comment": [ + "The previous sequence number that determines the message order" ] } ], "comment": [] }, { - "name": "ApiGetListRewardEpochResponse", + "name": "WSTradeFeedSelectorV1", "is_root": true, "fields": [ { - "name": "ecosystem_epochs", - "lite_name": "ee", - "semantic_type": "RewardEpochInfo", - "json_type": "RewardEpochInfo", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 0, - "array_depth": 1, + "array_depth": 0, "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The list of epoch for ecosystem reward" - ] + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" + ], + "selector": "primary" }, { - "name": "trading_epochs", - "lite_name": "te", - "semantic_type": "RewardEpochInfo", - "json_type": "RewardEpochInfo", + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", "index": 1, - "array_depth": 1, + "array_depth": 0, "optional": false, + "example": "500", "comment": [ - "The list of epoch for trader reward and lp reward" - ] + "The limit to query for. Valid values are (50, 200, 500, 1000). Default is 50" + ], + "selector": "secondary" } ], - "comment": [] + "comment": [ + "Subscribes to a stream of Public Trades for an instrument." + ] }, { - "name": "ApiSubAccountTradeAggregationRequest", + "name": "WSTradeFeedDataV1", "is_root": true, "fields": [ { - "name": "limit", - "lite_name": "l", - "semantic_type": "int32", - "json_type": "integer", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "100", + "example": "'v1.trade'", "comment": [ - "Optional. The limit of the number of results to return" + "Stream name" ] }, { - "name": "interval", - "lite_name": "i", - "semantic_type": "SubAccountTradeInterval", - "json_type": "SubAccountTradeInterval", + "name": "selector", + "lite_name": "s1", + "semantic_type": "string", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The interval of each sub account trade" + "Primary selector" ] }, { - "name": "sub_account_i_ds", - "lite_name": "sa", + "name": "sequence_number", + "lite_name": "sn", "semantic_type": "uint64", "json_type": "string", "index": 2, - "array_depth": 1, + "array_depth": 0, "optional": false, - "example": "['2376', '5821']", + "example": "'872634876'", "comment": [ - "The list of sub account ids to query" + "A sequence number used to determine message order within a stream.", + "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", + "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", + " - A single cluster payload can be multiplexed into multiple stream payloads.", + " - To distinguish each stream payload, a `dedupCounter` is included.", + " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." ] }, { - "name": "start_interval", - "lite_name": "si", - "semantic_type": "timestamp", - "json_type": "string", + "name": "feed", + "lite_name": "f", + "semantic_type": "Trade", + "json_type": "Trade", "index": 3, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", "comment": [ - "Optional. The starting time in unix nanoseconds of a specific interval to query" + "A public trade matching the request filter" ] }, { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", + "name": "prev_sequence_number", + "lite_name": "ps", + "semantic_type": "uint64", "json_type": "string", "index": 4, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "optional": false, + "example": "'872634875'", "comment": [ - "Optional. Start time in unix nanoseconds" + "The previous sequence number that determines the message order" ] - }, + } + ], + "comment": [] + }, + { + "name": "WSCandlestickFeedSelectorV1", + "is_root": true, + "fields": [ { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", - "comment": [ - "Optional. End time in unix nanoseconds" - ] - }, - { - "name": "is_maker", - "lite_name": "im", - "semantic_type": "bool", - "json_type": "boolean", - "index": 6, + "index": 0, "array_depth": 0, "optional": false, - "example": "true", + "example": "'BTC_USDT_Perp'", "comment": [ - "Filter on the maker of the trade" - ] + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" + ], + "selector": "primary" }, { - "name": "is_taker", - "lite_name": "it", - "semantic_type": "bool", - "json_type": "boolean", - "index": 7, + "name": "interval", + "lite_name": "i1", + "semantic_type": "CandlestickInterval", + "json_type": "CandlestickInterval", + "index": 1, "array_depth": 0, "optional": false, - "example": "true", - "comment": [ - "Filter on the taker of the trade" - ] - }, - { - "name": "cursor", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", - "index": 8, - "array_depth": 0, - "optional": true, - "default": "", - "example": "''", "comment": [ - "The cursor to indicate when to start the next query from" - ] + "The interval of each candlestick" + ], + "selector": "secondary" }, { - "name": "group_by_signer", - "lite_name": "gb", - "semantic_type": "bool", - "json_type": "boolean", - "index": 9, + "name": "type", + "lite_name": "t", + "semantic_type": "CandlestickType", + "json_type": "CandlestickType", + "index": 2, "array_depth": 0, "optional": false, - "example": "true", "comment": [ - "Whether to group trades by signer per sub account" - ] + "The type of candlestick data to retrieve" + ], + "selector": "secondary" } ], "comment": [ - "startTime are optional parameters. The semantics of these parameters are as follows:\u003cul\u003e" + "Subscribes to a stream of Kline/Candlestick updates for an instrument. A Kline is uniquely identified by its open time.", + "A new Kline is published every interval (if it exists). Upon subscription, the server will send the 5 most recent Kline for the requested interval." ] }, { - "name": "SubAccountTradeAggregation", - "is_root": false, + "name": "WSCandlestickFeedDataV1", + "is_root": true, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'v1.candle'", "comment": [ - "The sub account id" + "Stream name" ] }, { - "name": "total_fee", - "lite_name": "tf", - "semantic_type": "int64", + "name": "selector", + "lite_name": "s1", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'10000101000203040506'", + "example": "'BTC_USDT_Perp'", "comment": [ - "Total fee paid" + "Primary selector" ] }, { - "name": "total_trade_volume", - "lite_name": "tt", - "semantic_type": "uint256", + "name": "sequence_number", + "lite_name": "sn", + "semantic_type": "uint64", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "'10000101000203040506'", + "example": "'872634876'", "comment": [ - "Total volume traded" + "A sequence number used to determine message order within a stream.", + "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", + "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", + " - A single cluster payload can be multiplexed into multiple stream payloads.", + " - To distinguish each stream payload, a `dedupCounter` is included.", + " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." ] }, { - "name": "num_traded", - "lite_name": "nt", - "semantic_type": "uint64", - "json_type": "string", + "name": "feed", + "lite_name": "f", + "semantic_type": "Candlestick", + "json_type": "Candlestick", "index": 3, "array_depth": 0, "optional": false, - "example": "100", "comment": [ - "Number of trades" + "A candlestick entry matching the request filters" ] }, { - "name": "positive_fee", - "lite_name": "pf", - "semantic_type": "int64", + "name": "prev_sequence_number", + "lite_name": "ps", + "semantic_type": "uint64", "json_type": "string", "index": 4, "array_depth": 0, "optional": false, - "example": "'10000101000203040506'", + "example": "'872634875'", "comment": [ - "Total positive fee paid by user" + "The previous sequence number that determines the message order" ] - }, + } + ], + "comment": [] + }, + { + "name": "WSUnsubscribeAllParams", + "is_root": true, + "fields": [], + "comment": [ + "All V1 Websocket Unsubscription Request to unsubscribe from all active websocket streams." + ] + }, + { + "name": "StreamReference", + "is_root": false, + "fields": [ { - "name": "signer", + "name": "stream", "lite_name": "s", - "semantic_type": "address", + "semantic_type": "string", "json_type": "string", - "index": 5, + "index": 0, "array_depth": 0, "optional": false, + "example": "'v1.ticker.d'", "comment": [ - "The signer of the trade" + "The channel to subscribe to (eg: ticker.s / ticker.d)" ] }, { - "name": "realized_pnl", - "lite_name": "rp", - "semantic_type": "int64", - "json_type": "string", - "index": 6, - "array_depth": 0, + "name": "selectors", + "lite_name": "s1", + "semantic_type": "string", + "json_type": "string", + "index": 1, + "array_depth": 1, + "optional": false, + "example": "['BTC_USDT_Perp', 'ETH_USDT_Perp']", + "comment": [ + "The list of selectors for the stream" + ] + } + ], + "comment": [] + }, + { + "name": "WSUnsubscribeAllResult", + "is_root": true, + "fields": [ + { + "name": "stream_reference", + "lite_name": "sr", + "semantic_type": "StreamReference", + "json_type": "StreamReference", + "index": 0, + "array_depth": 1, "optional": false, - "example": "'10000101000203040506'", "comment": [ - "Realized PnL" + "The list of stream references unsubscribed from" ] } ], "comment": [ - "Similar to sub-account trade, but not divided by individual assets." + "Returns a list of all rooms the client has unsubscribed from." + ] + }, + { + "name": "WSListStreamsParams", + "is_root": true, + "fields": [], + "comment": [ + "List down all the streams this connection has connected to." ] }, { - "name": "ApiSubAccountTradeAggregationResponse", + "name": "WSListStreamsResult", "is_root": true, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "SubAccountTradeAggregation", - "json_type": "SubAccountTradeAggregation", + "name": "stream_reference", + "lite_name": "sr", + "semantic_type": "StreamReference", + "json_type": "StreamReference", "index": 0, "array_depth": 1, "optional": false, "comment": [ - "The sub account trade aggregation result set for given interval" + "The list of stream references the connection is connected to" ] - }, + } + ], + "comment": [ + "Returns a list of all rooms the client has subscribed to." + ] + }, + { + "name": "ApiGetAllInstrumentsRequest", + "is_root": true, + "fields": [ { - "name": "next", - "lite_name": "n", - "semantic_type": "string", - "json_type": "string", - "index": 1, + "name": "is_active", + "lite_name": "ia", + "semantic_type": "bool", + "json_type": "boolean", + "index": 0, "array_depth": 0, "optional": true, - "default": "''", - "example": "'Qw0918='", + "default": "false", + "example": "true", "comment": [ - "The cursor to indicate when to start the next query from" + "Fetch only active instruments" ] } ], - "comment": [] + "comment": [ + "Fetch all instruments" + ] }, { - "name": "ApiGetTraderStatResponse", + "name": "ApiGetAllInstrumentsResponse", "is_root": true, "fields": [ { - "name": "total_fee", - "lite_name": "tf", - "semantic_type": "int64", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "Instrument", + "json_type": "Instrument", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'10000101000203040506'", "comment": [ - "Total fee paid" + "List of instruments" ] } ], "comment": [] }, { - "name": "TraderMetric", - "is_root": true, + "name": "OrderLeg", + "is_root": false, "fields": [ { - "name": "total_fee", - "lite_name": "tf", - "semantic_type": "int64", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'10000101000203040506'", + "example": "'BTC_USDT_Perp'", "comment": [ - "Total fee paid" + "The instrument to trade in this leg" ] }, { - "name": "total_point", - "lite_name": "tp", - "semantic_type": "float64", - "json_type": "number", + "name": "size", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'10000000.5'", + "example": "'10.5'", + "comment": [ + "The total number of assets to trade in this leg, expressed in base asset decimal units." + ] + }, + { + "name": "limit_price", + "lite_name": "lp", + "semantic_type": "string", + "json_type": "string", + "index": 2, + "array_depth": 0, + "optional": true, + "default": "0", + "example": "'65038.01'", + "comment": [ + "The limit price of the order leg, expressed in `9` decimals.", + "This is the number of quote currency units to pay/receive for this leg.", + "This should be `null/0` if the order is a market order" + ] + }, + { + "name": "is_buying_asset", + "lite_name": "ib", + "semantic_type": "bool", + "json_type": "boolean", + "index": 3, + "array_depth": 0, + "optional": false, + "example": "true", "comment": [ - "Total trader point of this epoch/phase" + "Specifies if the order leg is a buy or sell" ] } ], "comment": [] }, { - "name": "ApiFindTraderEpochMetricResponse", - "is_root": true, + "name": "Signature", + "is_root": false, "fields": [ { - "name": "metric", - "lite_name": "m", - "semantic_type": "TraderMetric", - "json_type": "TraderMetric", + "name": "signer", + "lite_name": "s", + "semantic_type": "uint256", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "Phase zero metric" + "The address (public key) of the wallet signing the payload" ] }, { - "name": "rank", + "name": "r", "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", + "semantic_type": "uint256", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'52'", + "example": "'0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8'", "comment": [ - "The rank of the account in the trader" + "Signature R" ] }, { - "name": "total", - "lite_name": "t", - "semantic_type": "uint32", - "json_type": "integer", + "name": "s", + "lite_name": "s1", + "semantic_type": "uint256", + "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "52", + "example": "'0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d'", + "comment": [ + "Signature S" + ] + }, + { + "name": "v", + "lite_name": "v", + "semantic_type": "uint8", + "json_type": "integer", + "index": 3, + "array_depth": 0, + "optional": false, + "example": "'28'", "comment": [ - "The total number of accounts in the trader" + "Signature V" ] }, { - "name": "last_calculated_at", - "lite_name": "lc", + "name": "expiration", + "lite_name": "e", "semantic_type": "timestamp", "json_type": "string", - "index": 3, + "index": 4, "array_depth": 0, "optional": false, "example": "'1697788800000000000'", "comment": [ - "The time when the trader points were last calculated" + "Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days" + ] + }, + { + "name": "nonce", + "lite_name": "n", + "semantic_type": "uint32", + "json_type": "integer", + "index": 5, + "array_depth": 0, + "optional": false, + "example": "'1234567890'", + "comment": [ + "Users can randomly generate this value, used as a signature deconflicting key.", + "ie. You can send the same exact instruction twice with different nonces.", + "When the same nonce is used, the same payload will generate the same signature.", + "Our system will consider the payload a duplicate, and ignore it." ] } ], "comment": [] }, { - "name": "TraderLeaderboardUser", - "is_root": true, + "name": "TPSLOrderMetadata", + "is_root": false, "fields": [ { - "name": "account_id", - "lite_name": "ai", - "semantic_type": "string", - "json_type": "string", + "name": "trigger_by", + "lite_name": "tb", + "semantic_type": "TriggerBy", + "json_type": "TriggerBy", "index": 0, "array_depth": 0, "optional": false, - "example": "'ACC_1234567890'", + "example": "'LAST'", "comment": [ - "The off chain account id" + "Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order" ] }, { - "name": "rank", - "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", + "name": "trigger_price", + "lite_name": "tp", + "semantic_type": "string", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'52'", + "example": "'65038.10'", "comment": [ - "The rank of the account in the Trader" + "The Trigger Price of the order, expressed in `9` decimals." ] }, { - "name": "total_point", - "lite_name": "tp", - "semantic_type": "float64", - "json_type": "number", + "name": "close_position", + "lite_name": "cp", + "semantic_type": "bool", + "json_type": "boolean", "index": 2, "array_depth": 0, "optional": false, - "example": "'10000000.5'", - "comment": [ - "Total Trader point" - ] - }, - { - "name": "twitter_username", - "lite_name": "tu", - "semantic_type": "string", - "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "'elonmusk'", + "example": "false", "comment": [ - "The twitter username of the account" + "If True, the order will close the position when the trigger price is reached" ] } ], - "comment": [] + "comment": [ + "Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.", + "", + "### Fields:", + "- **triggerBy**: Defines the price type that activates the order (e.g., index price).", + "- **triggerPrice**: The price at which the order is triggered, expressed in `9` decimal precision.", + "", + "" + ] }, { - "name": "ApiFindTraderLeaderboardResponse", - "is_root": true, + "name": "TriggerOrderMetadata", + "is_root": false, "fields": [ { - "name": "users", - "lite_name": "u", - "semantic_type": "TraderLeaderboardUser", - "json_type": "TraderLeaderboardUser", + "name": "trigger_type", + "lite_name": "tt", + "semantic_type": "TriggerType", + "json_type": "TriggerType", "index": 0, - "array_depth": 1, + "array_depth": 0, + "optional": false, + "example": "'TAKE_PROFIT'", + "comment": [ + "Type of the trigger order. eg: Take Profit, Stop Loss, etc" + ] + }, + { + "name": "tpsl", + "lite_name": "t", + "semantic_type": "TPSLOrderMetadata", + "json_type": "TPSLOrderMetadata", + "index": 1, + "array_depth": 0, "optional": false, "comment": [ - "The list of trader leaderboard users" + "Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.", + "", + "" ] } ], - "comment": [] + "comment": [ + "Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).", + "", + "Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies.", + "", + "" + ] }, { - "name": "WSOrderFeedSelectorV1", - "is_root": true, + "name": "OrderMetadata", + "is_root": false, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", + "name": "client_order_id", + "lite_name": "co", "semantic_type": "uint64", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'23042'", "comment": [ - "The subaccount ID to filter by" - ], - "selector": "primary" + "A unique identifier for the active order within a subaccount, specified by the client", + "This is used to identify the order in the client's system", + "This field can be used for order amendment/cancellation, but has no bearing on the smart contract layer", + "This field will not be propagated to the smart contract, and should not be signed by the client", + "This value must be unique for all active orders in a subaccount, or amendment/cancellation will not work as expected", + "Gravity UI will generate a random clientOrderID for each order in the range [0, 2^63 - 1]", + "To prevent any conflicts, client machines should generate a random clientOrderID in the range [2^63, 2^64 - 1]", + "", + "When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId" + ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "create_time", + "lite_name": "ct", + "semantic_type": "timestamp", "json_type": "string", "index": 1, "array_depth": 0, "optional": true, - "default": "'all'", - "example": "'BTC_USDT_Perp'", + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "The instrument filter to apply." - ], - "selector": "primary" + "[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds" + ] + }, + { + "name": "trigger", + "lite_name": "t", + "semantic_type": "TriggerOrderMetadata", + "json_type": "TriggerOrderMetadata", + "index": 2, + "array_depth": 0, + "optional": true, + "default": "", + "comment": [ + "Trigger fields are used to support any type of trigger order such as TP/SL" + ] + }, + { + "name": "broker", + "lite_name": "b", + "semantic_type": "BrokerTag", + "json_type": "BrokerTag", + "index": 3, + "array_depth": 0, + "optional": true, + "default": "", + "example": "'BROKER_CODE'", + "comment": [ + "Specifies the broker who brokered the order" + ] } ], "comment": [ - "Subscribes to a feed of order updates pertaining to orders made by your account.", - "Each Order can be uniquely identified by its `order_id` or `client_order_id`.", - "To subscribe to all orders, specify an empty `instrument` (eg. `2345123`).", - "Otherwise, specify the `instrument` to only receive orders for that instrument (eg. `2345123-BTC_USDT_Perp`)." + "Metadata fields are used to support Backend only operations. These operations are not trustless by nature.", + "Hence, fields in here are never signed, and is never transmitted to the smart contract." ] }, { - "name": "WSOrderFeedDataV1", - "is_root": true, + "name": "OrderState", + "is_root": false, "fields": [ { - "name": "stream", + "name": "status", "lite_name": "s", - "semantic_type": "string", - "json_type": "string", + "semantic_type": "OrderStatus", + "json_type": "OrderStatus", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.order'", "comment": [ - "Stream name" + "The status of the order" ] }, { - "name": "selector", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", + "name": "reject_reason", + "lite_name": "rr", + "semantic_type": "OrderRejectReason", + "json_type": "OrderRejectReason", "index": 1, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'CLIENT_CANCEL'", "comment": [ - "Primary selector" + "The reason for rejection or cancellation" ] }, { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", + "name": "book_size", + "lite_name": "bs", + "semantic_type": "string", "json_type": "string", "index": 2, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'872634876'", + "example": "['10.5']", "comment": [ - "A sequence number used to determine message order within a stream.", - "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", - "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", - " - A single cluster payload can be multiplexed into multiple stream payloads.", - " - To distinguish each stream payload, a `dedupCounter` is included.", - " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." + "The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "Order", - "json_type": "Order", + "name": "traded_size", + "lite_name": "ts", + "semantic_type": "string", + "json_type": "string", "index": 3, - "array_depth": 0, + "array_depth": 1, "optional": false, + "example": "['1.5']", "comment": [ - "The order object being created or updated" + "The total number of assets traded. Sorted in same order as Order.Legs" ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", + "name": "update_time", + "lite_name": "ut", + "semantic_type": "timestamp", "json_type": "string", "index": 4, "array_depth": 0, "optional": false, - "example": "'872634875'", + "example": "'1697788800000000000'", "comment": [ - "The previous sequence number that determines the message order" + "Time at which the order was updated by GRVT, expressed in unix nanoseconds" ] - } - ], - "comment": [] - }, - { - "name": "WSOrderStateFeedSelectorV1", - "is_root": true, - "fields": [ - { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The subaccount ID to filter by" - ], - "selector": "primary" }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "avg_fill_price", + "lite_name": "af", + "semantic_type": "string", "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": true, - "default": "'all'", - "example": "'BTC_USDT_Perp'", + "index": 5, + "array_depth": 1, + "optional": false, + "example": "['60000.4']", "comment": [ - "The instrument filter to apply." - ], - "selector": "primary" + "The average fill price of the order. Sorted in same order as Order.Legs" + ] } ], - "comment": [ - "Subscribes to a feed of order updates pertaining to orders made by your account.", - "Unlike the Order Stream, this only streams state updates, drastically improving throughput, and latency.", - "Each Order can be uniquely identified by its `order_id` or `client_order_id`.", - "To subscribe to all orders, specify an empty `instrument` (eg. `2345123`).", - "Otherwise, specify the `instrument` to only receive orders for that instrument (eg. `2345123-BTC_USDT_Perp`)." - ] + "comment": [] }, { - "name": "OrderStateFeed", + "name": "Order", "is_root": false, "fields": [ { @@ -13085,235 +7425,270 @@ "json_type": "string", "index": 0, "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", + "optional": true, + "default": "0", + "example": "'0x1234567890abcdef'", "comment": [ - "A unique 128-bit identifier for the order, deterministically generated within the GRVT backend" + "[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend" ] }, { - "name": "client_order_id", - "lite_name": "co", + "name": "sub_account_id", + "lite_name": "sa", "semantic_type": "uint64", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'23042'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "A unique identifier for the active order within a subaccount, specified by the client" + "The subaccount initiating the order" ] }, { - "name": "order_state", - "lite_name": "os", - "semantic_type": "OrderState", - "json_type": "OrderState", + "name": "is_market", + "lite_name": "im", + "semantic_type": "bool", + "json_type": "boolean", "index": 2, "array_depth": 0, + "optional": true, + "default": "false", + "example": "false", + "comment": [ + "If the order is a market order", + "Market Orders do not have a limit price, and are always executed according to the maker order price.", + "Market Orders must always be taker orders" + ] + }, + { + "name": "time_in_force", + "lite_name": "ti", + "semantic_type": "TimeInForce", + "json_type": "TimeInForce", + "index": 3, + "array_depth": 0, "optional": false, "comment": [ - "The order state object being created or updated" + "Four supported types of orders: GTT, IOC, AON, FOK:\u003cul\u003e", + "\u003cli\u003ePARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg\u003c/li\u003e", + "\u003cli\u003eFULL EXECUTION = AON / FOK - only allows full size execution on all legs\u003c/li\u003e", + "\u003cli\u003eTAKER ONLY = IOC / FOK - only allows taker orders\u003c/li\u003e", + "\u003cli\u003eMAKER OR TAKER = GTT / AON - allows maker or taker orders\u003c/li\u003e", + "\u003c/ul\u003eExchange only supports (GTT, IOC, FOK)", + "RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)" + ] + }, + { + "name": "post_only", + "lite_name": "po", + "semantic_type": "bool", + "json_type": "boolean", + "index": 4, + "array_depth": 0, + "optional": true, + "default": "false", + "example": "false", + "comment": [ + "If True, Order must be a maker order. It has to fill the orderbook instead of match it.", + "If False, Order can be either a maker or taker order. \u003cb\u003eIn this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.\u003c/b\u003e", + "", + "| | Must Fill All | Can Fill Partial |", + "| - | - | - |", + "| Must Be Taker | FOK + False | IOC + False |", + "| Can Be Either | AON + False | GTC + False |", + "| Must Be Maker | AON + True | GTC + True |", + "" ] - } - ], - "comment": [] - }, - { - "name": "WSOrderStateFeedDataV1", - "is_root": true, - "fields": [ + }, { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 0, + "name": "reduce_only", + "lite_name": "ro", + "semantic_type": "bool", + "json_type": "boolean", + "index": 5, "array_depth": 0, - "optional": false, - "example": "'v1.state'", + "optional": true, + "default": "false", + "example": "false", "comment": [ - "Stream name" + "If True, Order must reduce the position size, or be cancelled" ] }, { - "name": "selector", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, + "name": "legs", + "lite_name": "l", + "semantic_type": "OrderLeg", + "json_type": "OrderLeg", + "index": 6, + "array_depth": 1, "optional": false, - "example": "'BTC_USDT_Perp'", "comment": [ - "Primary selector" + "The legs present in this order", + "The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice" ] }, { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", - "json_type": "string", - "index": 2, + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 7, "array_depth": 0, "optional": false, - "example": "'872634876'", "comment": [ - "A sequence number used to determine message order within a stream.", - "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", - "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", - " - A single cluster payload can be multiplexed into multiple stream payloads.", - " - To distinguish each stream payload, a `dedupCounter` is included.", - " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." + "The signature approving this order" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "OrderStateFeed", - "json_type": "OrderStateFeed", - "index": 3, + "name": "metadata", + "lite_name": "m", + "semantic_type": "OrderMetadata", + "json_type": "OrderMetadata", + "index": 8, "array_depth": 0, "optional": false, "comment": [ - "The Order State Feed" + "Order Metadata, ignored by the smart contract, and unsigned by the client" ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", - "json_type": "string", - "index": 4, + "name": "state", + "lite_name": "s1", + "semantic_type": "OrderState", + "json_type": "OrderState", + "index": 9, "array_depth": 0, - "optional": false, - "example": "'872634875'", + "optional": true, + "default": "''", "comment": [ - "The previous sequence number that determines the message order" + "[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client" ] } ], - "comment": [] + "comment": [ + "Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.", + "GRVT orders are capable of expressing both single-legged, and multi-legged orders by default.", + "This increases the learning curve slightly but reduces overall integration load, since the order payload is used across all GRVT trading venues.", + "Given GRVT's trustless settlement model, the Order payload also carries the signature, required to trade the order on our ZKSync Hyperchain.", + "", + "All fields in the Order payload (except `id`, `metadata`, and `state`) are trustlessly enforced on our Hyperchain.", + "This minimizes the amount of trust users have to offer to GRVT" + ] }, { - "name": "WSPositionsFeedSelectorV1", + "name": "ApiCreateOrderRequest", "is_root": true, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", + "name": "order", + "lite_name": "o", + "semantic_type": "Order", + "json_type": "Order", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The subaccount ID to filter by" - ], - "selector": "primary" - }, - { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": true, - "default": "'all'", - "example": "'BTC_USDT_Perp'", "comment": [ - "The instrument filter to apply." - ], - "selector": "primary" + "The order to create" + ] } ], "comment": [ - "Subscribes to a feed of position updates.", - "Updates get published when a trade is executed, and when leverage configurations are changed for instruments with ongoing positions.", - "To subscribe to all positions, specify an empty `instrument` (eg. `2345123`).", - "Otherwise, specify the `instrument` to only receive positions for that instrument (eg. `2345123-BTC_USDT_Perp`)." + "Create an order on the orderbook for this trading account." ] }, { - "name": "WSPositionsFeedDataV1", + "name": "ApiCreateOrderResponse", "is_root": true, "fields": [ { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "Order", + "json_type": "Order", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.position'", "comment": [ - "Stream name" + "The created order" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiCancelOrderRequest", + "is_root": true, + "fields": [ { - "name": "selector", - "lite_name": "s1", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", - "index": 1, + "index": 0, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "Primary selector" + "The subaccount ID cancelling the order" ] }, { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", "json_type": "string", - "index": 2, + "index": 1, "array_depth": 0, - "optional": false, - "example": "'872634876'", + "optional": true, + "default": "0", + "example": "'0x1028403'", "comment": [ - "A sequence number used to determine message order within a stream.", - "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", - "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", - " - A single cluster payload can be multiplexed into multiple stream payloads.", - " - To distinguish each stream payload, a `dedupCounter` is included.", - " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." + "Cancel the order with this `order_id`" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "Positions", - "json_type": "Positions", - "index": 3, + "name": "client_order_id", + "lite_name": "co", + "semantic_type": "uint64", + "json_type": "string", + "index": 2, "array_depth": 0, - "optional": false, + "optional": true, + "default": "0", + "example": "'23042'", "comment": [ - "A Position being created or updated matching the request filter" + "Cancel the order with this `client_order_id`" ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", + "name": "time_to_live_ms", + "lite_name": "tt", "semantic_type": "uint64", "json_type": "string", - "index": 4, + "index": 3, "array_depth": 0, - "optional": false, - "example": "'872634875'", + "optional": true, + "default": "100", + "example": "'500'", "comment": [ - "The previous sequence number that determines the message order" + "Specifies the time-to-live (in milliseconds) for this cancellation.", + "During this period, any order creation with a matching `client_order_id` will be cancelled and not be added to the GRVT matching engine.", + "This mechanism helps mitigate time-of-flight issues where cancellations might arrive before the corresponding orders.", + "Hence, cancellation by `order_id` ignores this field as the exchange can only assign `order_id`s to already-processed order creations.", + "The duration cannot be negative, is rounded down to the nearest 100ms (e.g., `'670'` -\u003e `'600'`, `'30'` -\u003e `'0'`) and capped at 5 seconds (i.e., `'5000'`).", + "Value of `'0'` or omission results in the default time-to-live value being applied.", + "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.", + "" ] } ], - "comment": [] + "comment": [ + "Cancel an order on the orderbook for this trading account. Either `order_id` or `client_order_id` must be provided." + ] }, { - "name": "WSFillFeedSelectorV1", + "name": "ApiCancelAllOrdersRequest", "is_root": true, "fields": [ { @@ -13326,458 +7701,506 @@ "optional": false, "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The sub account ID to request for" - ], - "selector": "primary" + "The subaccount ID cancelling all orders" + ] + }, + { + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", + "index": 1, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['PERPETUAL']", + "comment": [ + "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be cancelled" + ] + }, + { + "name": "base", + "lite_name": "b", + "semantic_type": "Currency", + "json_type": "Currency", + "index": 2, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['BTC', 'ETH']", + "comment": [ + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be cancelled" + ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 1, - "array_depth": 0, + "name": "quote", + "lite_name": "q", + "semantic_type": "Currency", + "json_type": "Currency", + "index": 3, + "array_depth": 1, "optional": true, - "default": "'all'", - "example": "'BTC_USDT_Perp'", + "default": "all", + "example": "['USDT', 'USDC']", "comment": [ - "The instrument filter to apply." - ], - "selector": "primary" + "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be cancelled" + ] } ], "comment": [ - "Subscribes to a feed of private trade updates. This happens when a trade is executed.", - "To subscribe to all private trades, specify an empty `instrument` (eg. `2345123`).", - "Otherwise, specify the `instrument` to only receive private trades for that instrument (eg. `2345123-BTC_USDT_Perp`)." + "Cancel all orders on the orderbook for this trading account. This may not match new orders in flight." ] }, { - "name": "WSFillFeedDataV1", + "name": "ApiOpenOrdersRequest", "is_root": true, "fields": [ { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.fill'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The websocket channel to which the response is sent" + "The subaccount ID to filter by" ] }, { - "name": "selector", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", "index": 1, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['PERPETUAL']", "comment": [ - "Primary selector" + "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", - "json_type": "string", + "name": "base", + "lite_name": "b", + "semantic_type": "Currency", + "json_type": "Currency", "index": 2, - "array_depth": 0, - "optional": false, - "example": "'872634876'", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['BTC', 'ETH']", "comment": [ - "A sequence number used to determine message order within a stream.", - "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", - "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", - " - A single cluster payload can be multiplexed into multiple stream payloads.", - " - To distinguish each stream payload, a `dedupCounter` is included.", - " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "Fill", - "json_type": "Fill", + "name": "quote", + "lite_name": "q", + "semantic_type": "Currency", + "json_type": "Currency", "index": 3, - "array_depth": 0, - "optional": false, - "comment": [ - "A private trade matching the request filter" - ] - }, - { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'872634875'", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['USDT', 'USDC']", "comment": [ - "The previous sequence number that determines the message order" + "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" ] } ], "comment": [] }, { - "name": "WSTransferFeedSelectorV1", + "name": "ApiOpenOrdersResponse", "is_root": true, "fields": [ { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "Order", + "json_type": "Order", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'$GRVT_MAIN_ACCOUNT_ID'", - "comment": [ - "The main account ID to request for" - ], - "selector": "primary" - }, - { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": true, - "default": "'0'", - "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The sub account ID to request for" - ], - "selector": "primary" + "The Open Orders matching the request filter" + ] } ], "comment": [ - "Subscribes to a feed of transfers. This will execute when there is any transfer to or from the selected account.", - "To subscribe to a main account, specify the account ID (eg. `0x9fe3758b67ce7a2875ee4b452f01a5282d84ed8a`).", - "To subscribe to a sub account, specify the main account and the sub account dash separated (eg. `0x9fe3758b67ce7a2875ee4b452f01a5282d84ed8a-1920109784202388`)." + "Retrieves all open orders for the account. This may not match new orders in flight." ] }, { - "name": "TransferHistory", + "name": "ApiOrderHistoryRequest", "is_root": true, "fields": [ { - "name": "tx_id", - "lite_name": "ti", + "name": "sub_account_id", + "lite_name": "sa", "semantic_type": "uint64", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'1028403'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The transaction ID of the transfer" + "The subaccount ID to filter by" ] }, { - "name": "from_account_id", - "lite_name": "fa", - "semantic_type": "address", - "json_type": "string", + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", "index": 1, - "array_depth": 0, - "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['PERPETUAL']", "comment": [ - "The account to transfer from" + "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "from_sub_account_id", - "lite_name": "fs", - "semantic_type": "uint64", - "json_type": "string", + "name": "base", + "lite_name": "b", + "semantic_type": "Currency", + "json_type": "Currency", "index": 2, - "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['BTC', 'ETH']", "comment": [ - "The subaccount to transfer from (0 if transferring from main account)" + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "to_account_id", - "lite_name": "ta", - "semantic_type": "address", - "json_type": "string", + "name": "quote", + "lite_name": "q", + "semantic_type": "Currency", + "json_type": "Currency", "index": 3, - "array_depth": 0, - "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['USDT', 'USDC']", "comment": [ - "The account to deposit into" + "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "to_sub_account_id", - "lite_name": "ts", - "semantic_type": "uint64", + "name": "start_time", + "lite_name": "st", + "semantic_type": "int64", "json_type": "string", "index": 4, "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "optional": true, + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "The subaccount to transfer to (0 if transferring to main account)" + "The start time to apply in nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "currency", - "lite_name": "c", - "semantic_type": "Currency", - "json_type": "Currency", + "name": "end_time", + "lite_name": "et", + "semantic_type": "int64", + "json_type": "string", "index": 5, "array_depth": 0, - "optional": false, - "example": "'USDT'", + "optional": true, + "default": "now()", + "example": "'1697788800000000000'", "comment": [ - "The token currency to transfer" + "The end time to apply in nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "num_tokens", - "lite_name": "nt", - "semantic_type": "string", - "json_type": "string", + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", "index": 6, "array_depth": 0, - "optional": false, - "example": "'1500.0'", - "comment": [ - "The number of tokens to transfer" - ] - }, - { - "name": "signature", - "lite_name": "s", - "semantic_type": "Signature", - "json_type": "Signature", - "index": 7, - "array_depth": 0, - "optional": false, + "optional": true, + "default": "500", + "example": "500", "comment": [ - "The signature of the transfer" + "The limit to query for. Defaults to 500; Max 1000" ] }, { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "cursor", + "lite_name": "c", + "semantic_type": "string", "json_type": "string", - "index": 8, + "index": 7, "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", + "optional": true, + "default": "''", + "example": "''", "comment": [ - "The timestamp of the transfer in unix nanoseconds" + "The cursor to indicate when to start the query from" ] - }, + } + ], + "comment": [ + "Retrieves the order history for the account.", + "", + "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" + ] + }, + { + "name": "ApiOrderHistoryResponse", + "is_root": true, + "fields": [ { - "name": "transfer_type", - "lite_name": "tt", - "semantic_type": "TransferType", - "json_type": "TransferType", - "index": 9, - "array_depth": 0, + "name": "result", + "lite_name": "r", + "semantic_type": "Order", + "json_type": "Order", + "index": 0, + "array_depth": 1, "optional": false, "comment": [ - "The type of transfer" + "The Open Orders matching the request filter" ] }, { - "name": "transfer_metadata", - "lite_name": "tm", + "name": "next", + "lite_name": "n", "semantic_type": "string", "json_type": "string", - "index": 10, + "index": 1, "array_depth": 0, "optional": false, + "example": "'Qw0918='", "comment": [ - "The metadata of the transfer" + "The cursor to indicate when to start the query from" ] } ], "comment": [] }, { - "name": "WSTransferFeedDataV1", + "name": "EmptyRequest", "is_root": true, + "fields": [], + "comment": [ + "Used for requests that do not require any parameters" + ] + }, + { + "name": "Ack", + "is_root": false, "fields": [ { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", + "name": "ack", + "lite_name": "a", + "semantic_type": "bool", + "json_type": "boolean", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.transfer'", + "example": "'true'", "comment": [ - "The websocket channel to which the response is sent" + "Gravity has acknowledged that the request has been successfully received and it will process it in the backend" ] - }, + } + ], + "comment": [] + }, + { + "name": "AckResponse", + "is_root": true, + "fields": [ { - "name": "selector", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", - "index": 1, + "name": "result", + "lite_name": "r", + "semantic_type": "Ack", + "json_type": "Ack", + "index": 0, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", "comment": [ - "Primary selector" + "The Ack Object" ] - }, + } + ], + "comment": [ + "Used to acknowledge a request has been received and will be processed" + ] + }, + { + "name": "ApiGetOrderRequest", + "is_root": true, + "fields": [ { - "name": "sequence_number", - "lite_name": "sn", + "name": "sub_account_id", + "lite_name": "sa", "semantic_type": "uint64", "json_type": "string", - "index": 2, + "index": 0, "array_depth": 0, "optional": false, - "example": "'872634876'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "A sequence number used to determine message order within a stream.", - "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", - "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", - " - A single cluster payload can be multiplexed into multiple stream payloads.", - " - To distinguish each stream payload, a `dedupCounter` is included.", - " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." + "The subaccount ID to filter by" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "TransferHistory", - "json_type": "TransferHistory", - "index": 3, + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", + "json_type": "string", + "index": 1, "array_depth": 0, - "optional": false, + "optional": true, + "default": "0", + "example": "'0x1028403'", "comment": [ - "The transfer history matching the requested filters" + "Filter for `order_id`" ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", + "name": "client_order_id", + "lite_name": "co", "semantic_type": "uint64", "json_type": "string", - "index": 4, + "index": 2, "array_depth": 0, - "optional": false, - "example": "'872634875'", + "optional": true, + "default": "0", + "example": "'23042'", "comment": [ - "The previous sequence number that determines the message order" + "Filter for `client_order_id`" ] } ], "comment": [ - "Subscribes to a feed of transfer updates." + "Retrieve the order for the account. Either `order_id` or `client_order_id` must be provided." ] }, { - "name": "WSDepositFeedSelectorV1", + "name": "ApiGetOrderResponse", "is_root": true, "fields": [ { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "Order", + "json_type": "Order", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_MAIN_ACCOUNT_ID'", "comment": [ - "The main account ID to request for" - ], - "selector": "primary" + "The order object for the requested filter" + ] } ], - "comment": [ - "Subscribes to a feed of deposits. This will execute when there is any deposit to selected account.", - "To subscribe to a main account, specify the account ID (eg. `0x9fe3758b67ce7a2875ee4b452f01a5282d84ed8a`)." - ] + "comment": [] }, { - "name": "Deposit", - "is_root": false, + "name": "ApiCancelOnDisconnectRequest", + "is_root": true, "fields": [ { - "name": "tx_hash", - "lite_name": "th", - "semantic_type": "uint256", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'0x1234567890123456789012345678901234567890123456789012345678901234'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The hash of the bridgemint event producing the deposit" + "The subaccount ID cancelling the orders for" ] }, { - "name": "to_account_id", - "lite_name": "ta", - "semantic_type": "address", + "name": "countdown_time", + "lite_name": "ct", + "semantic_type": "uint64", "json_type": "string", "index": 1, "array_depth": 0, - "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "optional": true, + "default": "1000", + "example": "300", "comment": [ - "The account to deposit into" + "Countdown time in milliseconds (ex. 120000 for 120s).", + "", + "0 to disable the timer.", + "", + "Does not accept negative values.", + "", + "Minimum acceptable value is 1,000.", + "", + "Maximum acceptable value is 300,000" ] - }, + } + ], + "comment": [ + "Auto-Cancel All Open Orders when the countdown time hits zero.", + "", + "Market Maker inputs a countdown time parameter in milliseconds (e.g. 120000 for 120s) rounded down to the smallest second follows the following logic:", + " - Market Maker initially entered a value between 0 -\u003e 1000, which is rounded to 0: will result in termination of their COD", + " - Market Maker initially entered a value between 1001 -\u003e 300_000, which is rounded to the nearest second: will result in refresh of their COD", + " - Market Maker initially entered a value bigger than 300_000, which will result in error (upper bound)", + "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.", + "", + "If the server does not receive a heartbeat message within the countdown time, it will cancel all open orders for the specified Sub Account ID." + ] + }, + { + "name": "WSOrderFeedSelectorV1", + "is_root": true, + "fields": [ { - "name": "currency", - "lite_name": "c", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 2, + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", + "json_type": "string", + "index": 0, "array_depth": 0, "optional": false, - "example": "'USDT'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The token currency to deposit" - ] + "The subaccount ID to filter by" + ], + "selector": "primary" }, { - "name": "num_tokens", - "lite_name": "nt", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 3, + "index": 1, "array_depth": 0, - "optional": false, - "example": "'10.50'", + "optional": true, + "default": "'all'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The number of tokens to deposit" - ] + "The instrument filter to apply." + ], + "selector": "primary" } ], - "comment": [] + "comment": [ + "Subscribes to a feed of order updates pertaining to orders made by your account.", + "Each Order can be uniquely identified by its `order_id` or `client_order_id`.", + "To subscribe to all orders, specify an empty `instrument` (eg. `2345123`).", + "Otherwise, specify the `instrument` to only receive orders for that instrument (eg. `2345123-BTC_USDT_Perp`)." + ] }, { - "name": "WSDepositFeedDataV1", + "name": "WSOrderFeedDataV1", "is_root": true, "fields": [ { @@ -13788,9 +8211,9 @@ "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.deposit'", + "example": "'v1.order'", "comment": [ - "The websocket channel to which the response is sent" + "Stream name" ] }, { @@ -13827,13 +8250,13 @@ { "name": "feed", "lite_name": "f", - "semantic_type": "Deposit", - "json_type": "Deposit", + "semantic_type": "Order", + "json_type": "Order", "index": 3, "array_depth": 0, "optional": false, "comment": [ - "The Deposit object" + "The order object being created or updated" ] }, { @@ -13850,107 +8273,97 @@ ] } ], - "comment": [ - "Subscribes to a feed of deposit updates." - ] + "comment": [] }, { - "name": "WSWithdrawalFeedSelectorV1", + "name": "WSOrderStateFeedSelectorV1", "is_root": true, "fields": [ { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_MAIN_ACCOUNT_ID'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The main account ID to request for" + "The subaccount ID to filter by" + ], + "selector": "primary" + }, + { + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": true, + "default": "'all'", + "example": "'BTC_USDT_Perp'", + "comment": [ + "The instrument filter to apply." ], "selector": "primary" } ], "comment": [ - "Subscribes to a feed of withdrawals. This will execute when there is any withdrawal from the selected account.", - "To subscribe to a main account, specify the account ID (eg. `0x9fe3758b67ce7a2875ee4b452f01a5282d84ed8a`)." + "Subscribes to a feed of order updates pertaining to orders made by your account.", + "Unlike the Order Stream, this only streams state updates, drastically improving throughput, and latency.", + "Each Order can be uniquely identified by its `order_id` or `client_order_id`.", + "To subscribe to all orders, specify an empty `instrument` (eg. `2345123`).", + "Otherwise, specify the `instrument` to only receive orders for that instrument (eg. `2345123-BTC_USDT_Perp`)." ] }, { - "name": "Withdrawal", + "name": "OrderStateFeed", "is_root": false, "fields": [ { - "name": "from_account_id", - "lite_name": "fa", - "semantic_type": "address", + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "example": "'10000101000203040506'", "comment": [ - "The subaccount to withdraw from" + "A unique 128-bit identifier for the order, deterministically generated within the GRVT backend" ] }, { - "name": "to_eth_address", - "lite_name": "te", - "semantic_type": "address", + "name": "client_order_id", + "lite_name": "co", + "semantic_type": "uint64", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "example": "'23042'", "comment": [ - "The ethereum address to withdraw to" + "A unique identifier for the active order within a subaccount, specified by the client" ] }, { - "name": "currency", - "lite_name": "c", - "semantic_type": "Currency", - "json_type": "Currency", + "name": "order_state", + "lite_name": "os", + "semantic_type": "OrderState", + "json_type": "OrderState", "index": 2, "array_depth": 0, "optional": false, - "example": "'USDT'", - "comment": [ - "The token currency to withdraw" - ] - }, - { - "name": "num_tokens", - "lite_name": "nt", - "semantic_type": "string", - "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "'10.50'", - "comment": [ - "The number of tokens to withdraw" - ] - }, - { - "name": "signature", - "lite_name": "s", - "semantic_type": "Signature", - "json_type": "Signature", - "index": 4, - "array_depth": 0, - "optional": false, "comment": [ - "The signature of the withdrawal" + "The order state object being created or updated" ] } ], "comment": [] }, { - "name": "WSWithdrawalFeedDataV1", + "name": "WSOrderStateFeedDataV1", "is_root": true, "fields": [ { @@ -13961,9 +8374,9 @@ "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.withdrawal'", + "example": "'v1.state'", "comment": [ - "The websocket channel to which the response is sent" + "Stream name" ] }, { @@ -14000,13 +8413,13 @@ { "name": "feed", "lite_name": "f", - "semantic_type": "Withdrawal", - "json_type": "Withdrawal", + "semantic_type": "OrderStateFeed", + "json_type": "OrderStateFeed", "index": 3, "array_depth": 0, "optional": false, "comment": [ - "The Withdrawal object" + "The Order State Feed" ] }, { @@ -14023,13 +8436,11 @@ ] } ], - "comment": [ - "Subscribes to a feed of withdrawal updates." - ] + "comment": [] }, { - "name": "CancelStatusFeed", - "is_root": false, + "name": "WSPositionsFeedSelectorV1", + "is_root": true, "fields": [ { "name": "sub_account_id", @@ -14041,78 +8452,35 @@ "optional": false, "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The subaccount ID that requested the cancellation" - ] + "The subaccount ID to filter by" + ], + "selector": "primary" }, { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 1, "array_depth": 0, - "optional": false, - "example": "'23042'", - "comment": [ - "A unique identifier for the active order within a subaccount, specified by the client" - ] - }, - { - "name": "order_id", - "lite_name": "oi", - "semantic_type": "uint128", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'10000101000203040506'", - "comment": [ - "A unique 128-bit identifier for the order, deterministically generated within the GRVT backend" - ] - }, - { - "name": "reason", - "lite_name": "r", - "semantic_type": "OrderRejectReason", - "json_type": "OrderRejectReason", - "index": 3, - "array_depth": 0, - "optional": false, - "comment": [ - "The user-provided reason for cancelling the order" - ] - }, - { - "name": "update_time", - "lite_name": "ut", - "semantic_type": "timestamp", - "json_type": "string", - "index": 4, - "array_depth": 0, "optional": true, - "default": "0", - "example": "'1697788800000000000'", - "comment": [ - "[Filled by GRVT Backend] Time at which the cancellation status was updated by GRVT in unix nanoseconds" - ] - }, - { - "name": "cancel_status", - "lite_name": "cs", - "semantic_type": "CancelStatus", - "json_type": "CancelStatus", - "index": 5, - "array_depth": 0, - "optional": false, + "default": "'all'", + "example": "'BTC_USDT_Perp'", "comment": [ - "Status of the cancellation attempt" - ] + "The instrument filter to apply." + ], + "selector": "primary" } ], - "comment": [] + "comment": [ + "Subscribes to a feed of position updates.", + "Updates get published when a trade is executed, and when leverage configurations are changed for instruments with ongoing positions.", + "To subscribe to all positions, specify an empty `instrument` (eg. `2345123`).", + "Otherwise, specify the `instrument` to only receive positions for that instrument (eg. `2345123-BTC_USDT_Perp`)." + ] }, { - "name": "WSCancelFeedDataV1", + "name": "WSPositionsFeedDataV1", "is_root": true, "fields": [ { @@ -14123,7 +8491,7 @@ "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.cancel'", + "example": "'v1.position'", "comment": [ "Stream name" ] @@ -14136,7 +8504,7 @@ "index": 1, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'BTC_USDT_Perp'", "comment": [ "Primary selector" ] @@ -14162,13 +8530,13 @@ { "name": "feed", "lite_name": "f", - "semantic_type": "CancelStatusFeed", - "json_type": "CancelStatusFeed", + "semantic_type": "Positions", + "json_type": "Positions", "index": 3, "array_depth": 0, "optional": false, "comment": [ - "Data relating to the status of the cancellation attempt" + "A Position being created or updated matching the request filter" ] }, { @@ -14185,38 +8553,10 @@ ] } ], - "comment": [] - }, - { - "name": "WSCancelFeedSelectorV1", - "is_root": true, - "fields": [ - { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The subaccount ID to filter by" - ], - "selector": "primary" - } - ], - "comment": [ - "Subscribes to a feed of time-to-live expiry events for order cancellations requested by a given subaccount.", - "**This stream presently only provides expiry updates for cancel-order requests set with a valid TTL value**.", - "Successful order cancellations will reflect as updates published to the [order-state stream](https://api-docs.grvt.io/trading_streams/#order-state).", - "_A future release will expand the functionality of this stream to provide more general status updates on order cancellation requests._", - "Each Order can be uniquely identified by its `client_order_id`.", - "" - ] + "comment": [] }, { - "name": "WSOrderGroupFeedSelectorV1", + "name": "WSFillFeedSelectorV1", "is_root": true, "fields": [ { @@ -14229,18 +8569,34 @@ "optional": false, "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The subaccount ID to filter by" + "The sub account ID to request for" + ], + "selector": "primary" + }, + { + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": true, + "default": "'all'", + "example": "'BTC_USDT_Perp'", + "comment": [ + "The instrument filter to apply." ], "selector": "primary" } ], "comment": [ - "Subscribes to a feed of order group to get updated when a new group is created for the subAccount specified.", - "" + "Subscribes to a feed of private trade updates. This happens when a trade is executed.", + "To subscribe to all private trades, specify an empty `instrument` (eg. `2345123`).", + "Otherwise, specify the `instrument` to only receive private trades for that instrument (eg. `2345123-BTC_USDT_Perp`)." ] }, { - "name": "WSOrderGroupFeedDataV1", + "name": "WSFillFeedDataV1", "is_root": true, "fields": [ { @@ -14251,9 +8607,9 @@ "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.group'", + "example": "'v1.fill'", "comment": [ - "Stream name" + "The websocket channel to which the response is sent" ] }, { @@ -14264,7 +8620,7 @@ "index": 1, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'BTC_USDT_Perp'", "comment": [ "Primary selector" ] @@ -14290,13 +8646,13 @@ { "name": "feed", "lite_name": "f", - "semantic_type": "ClientOrderIDsByGroup", - "json_type": "ClientOrderIDsByGroup", + "semantic_type": "Fill", + "json_type": "Fill", "index": 3, "array_depth": 0, "optional": false, "comment": [ - "The order object being created or updated" + "A private trade matching the request filter" ] }, { @@ -14316,7 +8672,7 @@ "comment": [] }, { - "name": "ApiDropClientWsRequest", + "name": "WSTransferFeedSelectorV1", "is_root": true, "fields": [ { @@ -14327,584 +8683,632 @@ "index": 0, "array_depth": 0, "optional": false, - "comment": [] - } - ], - "comment": [] - }, - { - "name": "ApiDropClientWsResponse", - "is_root": true, - "fields": [ - { - "name": "num_dropped", - "lite_name": "nd", - "semantic_type": "int32", - "json_type": "integer", - "index": 0, - "array_depth": 0, - "optional": false, - "comment": [] - } - ], - "comment": [] - }, - { - "name": "MarginTierResponse", - "is_root": true, - "fields": [ - { - "name": "lower_bound", - "lite_name": "lb", - "semantic_type": "string", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "comment": [] + "example": "'$GRVT_MAIN_ACCOUNT_ID'", + "comment": [ + "The main account ID to request for" + ], + "selector": "primary" }, { - "name": "rate", - "lite_name": "r", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", "index": 1, "array_depth": 0, - "optional": false, - "comment": [] - } - ], - "comment": [] - }, - { - "name": "AssetMarginTierResponse", - "is_root": true, - "fields": [ - { - "name": "asset", - "lite_name": "a", - "semantic_type": "asset", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "comment": [] - }, - { - "name": "tiers", - "lite_name": "t", - "semantic_type": "MarginTierResponse", - "json_type": "MarginTierResponse", - "index": 1, - "array_depth": 1, - "optional": false, - "comment": [] - } - ], - "comment": [] - }, - { - "name": "ApiGetMarginTiersResponse", - "is_root": true, - "fields": [ - { - "name": "results", - "lite_name": "r", - "semantic_type": "AssetMarginTierResponse", - "json_type": "AssetMarginTierResponse", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [] + "optional": true, + "default": "'0'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", + "comment": [ + "The sub account ID to request for" + ], + "selector": "primary" } ], - "comment": [] + "comment": [ + "Subscribes to a feed of transfers. This will execute when there is any transfer to or from the selected account.", + "To subscribe to a main account, specify the account ID (eg. `0x9fe3758b67ce7a2875ee4b452f01a5282d84ed8a`).", + "To subscribe to a sub account, specify the main account and the sub account dash separated (eg. `0x9fe3758b67ce7a2875ee4b452f01a5282d84ed8a-1920109784202388`)." + ] }, { - "name": "SessionInformation", + "name": "WSTransferFeedDataV1", "is_root": true, "fields": [ { - "name": "country_code", - "lite_name": "cc", + "name": "stream", + "lite_name": "s", "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, + "example": "'v1.transfer'", "comment": [ - "country code of user based on IP address" + "The websocket channel to which the response is sent" ] }, { - "name": "client_session_id", - "lite_name": "cs", + "name": "selector", + "lite_name": "s1", "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "unique identity of the session generated from client" + "Primary selector" ] }, { - "name": "device_screen_size", - "lite_name": "ds", - "semantic_type": "string", + "name": "sequence_number", + "lite_name": "sn", + "semantic_type": "uint64", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, + "example": "'872634876'", "comment": [ - "screen size" + "A sequence number used to determine message order within a stream.", + "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", + "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", + " - A single cluster payload can be multiplexed into multiple stream payloads.", + " - To distinguish each stream payload, a `dedupCounter` is included.", + " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." ] }, { - "name": "device_os", - "lite_name": "do", - "semantic_type": "string", - "json_type": "string", + "name": "feed", + "lite_name": "f", + "semantic_type": "TransferHistory", + "json_type": "TransferHistory", "index": 3, "array_depth": 0, "optional": false, "comment": [ - "OS of user's device" + "The transfer history matching the requested filters" ] }, { - "name": "device_os_version", - "lite_name": "do1", - "semantic_type": "string", + "name": "prev_sequence_number", + "lite_name": "ps", + "semantic_type": "uint64", "json_type": "string", "index": 4, "array_depth": 0, "optional": false, + "example": "'872634875'", "comment": [ - "OS version of user's device" + "The previous sequence number that determines the message order" ] } ], - "comment": [] + "comment": [ + "Subscribes to a feed of transfer updates." + ] }, { - "name": "UserVaultCategoryEventPayLoad", + "name": "WSDepositFeedSelectorV1", "is_root": true, "fields": [ { - "name": "category_id", - "lite_name": "ci", - "semantic_type": "string", + "name": "main_account_id", + "lite_name": "ma", + "semantic_type": "address", + "json_type": "string", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "'$GRVT_MAIN_ACCOUNT_ID'", + "comment": [ + "The main account ID to request for" + ], + "selector": "primary" + } + ], + "comment": [ + "Subscribes to a feed of deposits. This will execute when there is any deposit to selected account.", + "To subscribe to a main account, specify the account ID (eg. `0x9fe3758b67ce7a2875ee4b452f01a5282d84ed8a`)." + ] + }, + { + "name": "Deposit", + "is_root": false, + "fields": [ + { + "name": "tx_hash", + "lite_name": "th", + "semantic_type": "uint256", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, + "example": "'0x1234567890123456789012345678901234567890123456789012345678901234'", "comment": [ - "category ID of event" + "The hash of the bridgemint event producing the deposit" ] }, { - "name": "vault_id", - "lite_name": "vi", - "semantic_type": "string", + "name": "to_account_id", + "lite_name": "ta", + "semantic_type": "address", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "vault ID" + "The account to deposit into" ] }, { - "name": "action", - "lite_name": "a", - "semantic_type": "string", - "json_type": "string", + "name": "currency", + "lite_name": "c", + "semantic_type": "Currency", + "json_type": "Currency", "index": 2, "array_depth": 0, "optional": false, + "example": "'USDT'", "comment": [ - "action of event. search/filter/invest..." + "The token currency to deposit" ] }, { - "name": "num_bumps", - "lite_name": "nb", - "semantic_type": "int64", + "name": "num_tokens", + "lite_name": "nt", + "semantic_type": "string", "json_type": "string", "index": 3, "array_depth": 0, "optional": false, + "example": "'10.50'", "comment": [ - "number of bumps in this event. default 1" + "The number of tokens to deposit" ] } ], "comment": [] }, { - "name": "ApiUserCategoryAffinityScoreRequest", + "name": "WSDepositFeedDataV1", "is_root": true, "fields": [ { - "name": "account_id", - "lite_name": "ai", + "name": "stream", + "lite_name": "s", "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'ACC_1234567890'", + "example": "'v1.deposit'", "comment": [ - "The off chain account id" + "The websocket channel to which the response is sent" ] }, { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", + "name": "selector", + "lite_name": "s1", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The start time of query. Can leave empty to query from the beginning" + "Primary selector" ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "The end time of query. Can leave empty to query until now" - ] - } - ], - "comment": [] - }, - { - "name": "UserCategoryAffinityScore", - "is_root": false, - "fields": [ - { - "name": "account_id", - "lite_name": "ai", - "semantic_type": "string", + "name": "sequence_number", + "lite_name": "sn", + "semantic_type": "uint64", "json_type": "string", - "index": 0, + "index": 2, "array_depth": 0, "optional": false, - "example": "'ACC_1234567890'", + "example": "'872634876'", "comment": [ - "The off chain account id" + "A sequence number used to determine message order within a stream.", + "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", + "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", + " - A single cluster payload can be multiplexed into multiple stream payloads.", + " - To distinguish each stream payload, a `dedupCounter` is included.", + " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." ] }, { - "name": "category_id", - "lite_name": "ci", - "semantic_type": "string", - "json_type": "string", - "index": 1, + "name": "feed", + "lite_name": "f", + "semantic_type": "Deposit", + "json_type": "Deposit", + "index": 3, "array_depth": 0, "optional": false, "comment": [ - "target category" + "The Deposit object" ] }, { - "name": "affinity_score", - "lite_name": "as", - "semantic_type": "float64", - "json_type": "number", - "index": 2, + "name": "prev_sequence_number", + "lite_name": "ps", + "semantic_type": "uint64", + "json_type": "string", + "index": 4, "array_depth": 0, "optional": false, + "example": "'872634875'", "comment": [ - "affinity score" + "The previous sequence number that determines the message order" ] } ], "comment": [ - "" + "Subscribes to a feed of deposit updates." ] }, { - "name": "ApiUserCategoryAffinityScoreResponse", + "name": "WSWithdrawalFeedSelectorV1", "is_root": true, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "UserCategoryAffinityScore", - "json_type": "UserCategoryAffinityScore", + "name": "main_account_id", + "lite_name": "ma", + "semantic_type": "address", + "json_type": "string", "index": 0, - "array_depth": 1, + "array_depth": 0, "optional": false, + "example": "'$GRVT_MAIN_ACCOUNT_ID'", "comment": [ - "The list of categoryAffinities score" - ] + "The main account ID to request for" + ], + "selector": "primary" } ], - "comment": [] + "comment": [ + "Subscribes to a feed of withdrawals. This will execute when there is any withdrawal from the selected account.", + "To subscribe to a main account, specify the account ID (eg. `0x9fe3758b67ce7a2875ee4b452f01a5282d84ed8a`)." + ] }, { - "name": "ApiCategoryAffinityScoreRequest", - "is_root": true, + "name": "Withdrawal", + "is_root": false, "fields": [ { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", + "name": "from_account_id", + "lite_name": "fa", + "semantic_type": "address", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "The start time of query. Can leave empty to query from the beginning" + "The subaccount to withdraw from" ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "to_eth_address", + "lite_name": "te", + "semantic_type": "address", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "The end time of query. Can leave empty to query until now" + "The ethereum address to withdraw to" ] - } - ], - "comment": [] - }, - { - "name": "ApiCategoryAffinityScoreResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "UserCategoryAffinityScore", - "json_type": "UserCategoryAffinityScore", - "index": 0, - "array_depth": 1, + "name": "currency", + "lite_name": "c", + "semantic_type": "Currency", + "json_type": "Currency", + "index": 2, + "array_depth": 0, + "optional": false, + "example": "'USDT'", + "comment": [ + "The token currency to withdraw" + ] + }, + { + "name": "num_tokens", + "lite_name": "nt", + "semantic_type": "string", + "json_type": "string", + "index": 3, + "array_depth": 0, + "optional": false, + "example": "'10.50'", + "comment": [ + "The number of tokens to withdraw" + ] + }, + { + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 4, + "array_depth": 0, "optional": false, "comment": [ - "The list of categoryAffinities score" + "The signature of the withdrawal" ] } ], "comment": [] }, { - "name": "UserTrackingEvent", + "name": "WSWithdrawalFeedDataV1", "is_root": true, "fields": [ { - "name": "event_id", - "lite_name": "ei", + "name": "stream", + "lite_name": "s", "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, + "example": "'v1.withdrawal'", "comment": [ - "uuid for event" + "The websocket channel to which the response is sent" ] }, { - "name": "tracking_version", - "lite_name": "tv", - "semantic_type": "int32", - "json_type": "integer", + "name": "selector", + "lite_name": "s1", + "semantic_type": "string", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "version of tracking" + "Primary selector" ] }, { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "sequence_number", + "lite_name": "sn", + "semantic_type": "uint64", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'872634876'", "comment": [ - "timestamp of event" + "A sequence number used to determine message order within a stream.", + "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", + "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", + " - A single cluster payload can be multiplexed into multiple stream payloads.", + " - To distinguish each stream payload, a `dedupCounter` is included.", + " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." ] }, { - "name": "event_type", - "lite_name": "et1", - "semantic_type": "string", - "json_type": "string", + "name": "feed", + "lite_name": "f", + "semantic_type": "Withdrawal", + "json_type": "Withdrawal", "index": 3, "array_depth": 0, "optional": false, "comment": [ - "event type" + "The Withdrawal object" ] }, { - "name": "event_sub_type", - "lite_name": "es", - "semantic_type": "string", + "name": "prev_sequence_number", + "lite_name": "ps", + "semantic_type": "uint64", "json_type": "string", "index": 4, "array_depth": 0, "optional": false, + "example": "'872634875'", "comment": [ - "event sub type" + "The previous sequence number that determines the message order" ] - }, + } + ], + "comment": [ + "Subscribes to a feed of withdrawal updates." + ] + }, + { + "name": "CancelStatusFeed", + "is_root": false, + "fields": [ { - "name": "client_session_id", - "lite_name": "cs", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", - "index": 5, + "index": 0, "array_depth": 0, "optional": false, + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "unique identity of the session generated from client" + "The subaccount ID that requested the cancellation" ] }, { - "name": "device_os", - "lite_name": "do", - "semantic_type": "string", + "name": "client_order_id", + "lite_name": "co", + "semantic_type": "uint64", "json_type": "string", - "index": 6, + "index": 1, "array_depth": 0, "optional": false, + "example": "'23042'", "comment": [ - "OS of user's device" + "A unique identifier for the active order within a subaccount, specified by the client" ] }, { - "name": "device_os_version", - "lite_name": "do1", - "semantic_type": "string", + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", "json_type": "string", - "index": 7, + "index": 2, "array_depth": 0, "optional": false, + "example": "'10000101000203040506'", "comment": [ - "OS version of user's device" + "A unique 128-bit identifier for the order, deterministically generated within the GRVT backend" ] }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "string", - "json_type": "string", - "index": 8, + "name": "reason", + "lite_name": "r", + "semantic_type": "OrderRejectReason", + "json_type": "OrderRejectReason", + "index": 3, "array_depth": 0, "optional": false, "comment": [ - "sub account id" + "The user-provided reason for cancelling the order" ] }, { - "name": "trading_address", - "lite_name": "ta", - "semantic_type": "string", + "name": "update_time", + "lite_name": "ut", + "semantic_type": "timestamp", "json_type": "string", - "index": 9, + "index": 4, "array_depth": 0, - "optional": false, + "optional": true, + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "trading session key" + "[Filled by GRVT Backend] Time at which the cancellation status was updated by GRVT in unix nanoseconds" ] }, { - "name": "screen_size", - "lite_name": "ss", + "name": "cancel_status", + "lite_name": "cs", + "semantic_type": "CancelStatus", + "json_type": "CancelStatus", + "index": 5, + "array_depth": 0, + "optional": false, + "comment": [ + "Status of the cancellation attempt" + ] + } + ], + "comment": [] + }, + { + "name": "WSCancelFeedDataV1", + "is_root": true, + "fields": [ + { + "name": "stream", + "lite_name": "s", "semantic_type": "string", "json_type": "string", - "index": 10, + "index": 0, "array_depth": 0, "optional": false, + "example": "'v1.cancel'", "comment": [ - "screen size" + "Stream name" ] }, { - "name": "event_data", - "lite_name": "ed", + "name": "selector", + "lite_name": "s1", "semantic_type": "string", "json_type": "string", - "index": 11, + "index": 1, "array_depth": 0, "optional": false, + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "event data" + "Primary selector" ] }, { - "name": "user_id", - "lite_name": "ui", - "semantic_type": "string", + "name": "sequence_number", + "lite_name": "sn", + "semantic_type": "uint64", "json_type": "string", - "index": 12, + "index": 2, "array_depth": 0, "optional": false, + "example": "'872634876'", "comment": [ - "user id" + "A sequence number used to determine message order within a stream.", + "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", + "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", + " - A single cluster payload can be multiplexed into multiple stream payloads.", + " - To distinguish each stream payload, a `dedupCounter` is included.", + " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." ] }, { - "name": "account_id", - "lite_name": "ai", - "semantic_type": "string", - "json_type": "string", - "index": 13, + "name": "feed", + "lite_name": "f", + "semantic_type": "CancelStatusFeed", + "json_type": "CancelStatusFeed", + "index": 3, "array_depth": 0, "optional": false, "comment": [ - "account id" + "Data relating to the status of the cancellation attempt" ] }, { - "name": "auth_session_hash", - "lite_name": "as", - "semantic_type": "string", + "name": "prev_sequence_number", + "lite_name": "ps", + "semantic_type": "uint64", "json_type": "string", - "index": 14, + "index": 4, "array_depth": 0, "optional": false, + "example": "'872634875'", "comment": [ - "auth session hash of the authenticated session on backend" + "The previous sequence number that determines the message order" ] - }, + } + ], + "comment": [] + }, + { + "name": "WSCancelFeedSelectorV1", + "is_root": true, + "fields": [ { - "name": "country_code", - "lite_name": "cc", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", - "index": 15, + "index": 0, "array_depth": 0, "optional": false, + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "country code of user based on IP address" - ] + "The subaccount ID to filter by" + ], + "selector": "primary" } ], "comment": [ - "event of user" + "Subscribes to a feed of time-to-live expiry events for order cancellations requested by a given subaccount.", + "**This stream presently only provides expiry updates for cancel-order requests set with a valid TTL value**.", + "Successful order cancellations will reflect as updates published to the [order-state stream](https://api-docs.grvt.io/trading_streams/#order-state).", + "_A future release will expand the functionality of this stream to provide more general status updates on order cancellation requests._", + "Each Order can be uniquely identified by its `client_order_id`.", + "" ] }, { @@ -15118,6 +9522,60 @@ "" ] }, + { + "name": "ApiTransferAck", + "is_root": false, + "fields": [ + { + "name": "ack", + "lite_name": "a", + "semantic_type": "bool", + "json_type": "boolean", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "'true'", + "comment": [ + "Gravity has acknowledged that the transfer has been successfully processed. If true, a `tx_id` will be returned. If false, an error will be returned." + ] + }, + { + "name": "tx_id", + "lite_name": "ti", + "semantic_type": "uint64", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'1028403'", + "comment": [ + "The transaction ID of the transfer. This is only returned if the transfer is successful." + ] + } + ], + "comment": [] + }, + { + "name": "ApiTransferResponse", + "is_root": true, + "fields": [ + { + "name": "result", + "lite_name": "r", + "semantic_type": "ApiTransferAck", + "json_type": "ApiTransferAck", + "index": 0, + "array_depth": 0, + "optional": false, + "comment": [ + "The Transfer response object" + ] + } + ], + "comment": [ + "Used to acknowledge a transfer request outcome" + ] + }, { "name": "ApiDepositHistoryRequest", "is_root": true, @@ -15594,103 +10052,6 @@ "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" ] }, - { - "name": "WithdrawalHistory", - "is_root": true, - "fields": [ - { - "name": "tx_id", - "lite_name": "ti", - "semantic_type": "uint64", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'1028403'", - "comment": [ - "The transaction ID of the withdrawal" - ] - }, - { - "name": "from_account_id", - "lite_name": "fa", - "semantic_type": "address", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", - "comment": [ - "The subaccount to withdraw from" - ] - }, - { - "name": "to_eth_address", - "lite_name": "te", - "semantic_type": "address", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", - "comment": [ - "The ethereum address to withdraw to" - ] - }, - { - "name": "currency", - "lite_name": "c", - "semantic_type": "Currency", - "json_type": "Currency", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "'USDT'", - "comment": [ - "The token currency to withdraw" - ] - }, - { - "name": "num_tokens", - "lite_name": "nt", - "semantic_type": "string", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'1500.0'", - "comment": [ - "The number of tokens to withdraw" - ] - }, - { - "name": "signature", - "lite_name": "s", - "semantic_type": "Signature", - "json_type": "Signature", - "index": 5, - "array_depth": 0, - "optional": false, - "comment": [ - "The signature of the withdrawal" - ] - }, - { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", - "index": 6, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "The timestamp of the withdrawal in unix nanoseconds" - ] - } - ], - "comment": [] - }, { "name": "ApiWithdrawalHistoryResponse", "is_root": true, @@ -15735,6 +10096,13 @@ "comment": [ "XY Bridge type" ] + }, + { + "name": "RHINO", + "value": 2, + "comment": [ + "Rhino Bridge type" + ] } ], "comment": [] @@ -16653,6 +11021,20 @@ "comment": [ "the OCO counter part order was triggered" ] + }, + { + "name": "REDUCE_ONLY_LIMIT", + "value": 31, + "comment": [ + "the remaining order size was cancelled because it exceeded current position size" + ] + }, + { + "name": "CLIENT_REPLACE", + "value": 32, + "comment": [ + "the order was replaced by a client replace request" + ] } ], "comment": [] @@ -16810,6 +11192,13 @@ "comment": [ "FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it" ] + }, + { + "name": "RETAIL_PRICE_IMPROVEMENT", + "value": 5, + "comment": [ + "RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users." + ] } ], "comment": [ @@ -16820,6 +11209,42 @@ "" ] }, + { + "name": "TimeInterval", + "values": [ + { + "name": "INTERVAL_1_D", + "value": 1, + "comment": [ + "1 day" + ] + }, + { + "name": "INTERVAL_7_D", + "value": 2, + "comment": [ + "7 days" + ] + }, + { + "name": "INTERVAL_30_D", + "value": 3, + "comment": [ + "30 days" + ] + }, + { + "name": "INTERVAL_90_D", + "value": 4, + "comment": [ + "90 days" + ] + } + ], + "comment": [ + "Time interval can be used as a filter in metric/portfolio management APIs" + ] + }, { "name": "TransferType", "values": [ @@ -16843,6 +11268,20 @@ "comment": [ "Fast Arb Withdrawal Metadata type" ] + }, + { + "name": "NON_NATIVE_BRIDGE_DEPOSIT", + "value": 4, + "comment": [ + "Transfer type for non native bridging deposit" + ] + }, + { + "name": "NON_NATIVE_BRIDGE_WITHDRAWAL", + "value": 5, + "comment": [ + "Transfer type for non native bridging withdrawal" + ] } ], "comment": [] @@ -16913,6 +11352,26 @@ "" ] }, + { + "name": "VaultType", + "values": [ + { + "name": "PRIME", + "value": 1, + "comment": [ + "Prime vault" + ] + }, + { + "name": "LAUNCH_PAD", + "value": 2, + "comment": [ + "Launchpad vault" + ] + } + ], + "comment": [] + }, { "name": "Venue", "values": [ From 3cd03c121ff9f951bc76636f3df409348d283e0a Mon Sep 17 00:00:00 2001 From: Aaron Ong Date: Wed, 14 May 2025 00:29:53 +0800 Subject: [PATCH 2/2] [RFC] Update API docs and specs --- .../api_funding_account_summary_response.md | 45 +++ .../schemas/api_transfer_history_response.md | 62 ++++ .../api_withdrawal_history_response.md | 50 +++ artifacts/apidocs/schemas/transfer_history.md | 2 + .../schemas/ws_transfer_feed_data_v1.md | 62 ++++ artifacts/apidocs/trading_api.md | 96 +++++- artifacts/apidocs/trading_streams.md | 42 ++- artifacts/pysdk/grvt_raw_types.py | 54 ++++ src/codegen/apispec.json | 291 ++++++++++++++++++ 9 files changed, 696 insertions(+), 8 deletions(-) diff --git a/artifacts/apidocs/schemas/api_funding_account_summary_response.md b/artifacts/apidocs/schemas/api_funding_account_summary_response.md index 58c6872..8ec97c1 100644 --- a/artifacts/apidocs/schemas/api_funding_account_summary_response.md +++ b/artifacts/apidocs/schemas/api_funding_account_summary_response.md @@ -4,3 +4,48 @@ |Name
`Lite`|Type|Required
`Default`| Description | |-|-|-|-| |result
`r` |FundingAccountSummary|True|The funding account summary| + ??? info "[FundingAccountSummary](/../../schemas/funding_account_summary)" + The funding account summary, that reports the total equity and spot balances of a funding (main) account
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |main_account_id
`ma` |string|True|The main account ID of the account to which the summary belongs| + |total_equity
`te` |string|True|Total equity of the main account, denominated in USD| + |spot_balances
`sb` |[SpotBalance]|True|The list of spot assets owned by this main account, and their balances| + ??? info "[SpotBalance](/../../schemas/spot_balance)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |currency
`c` |Currency|True|The currency you hold a spot balance in| + |balance
`b` |string|True|This currency's balance in this trading account.| + |index_price
`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
+ + |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| diff --git a/artifacts/apidocs/schemas/api_transfer_history_response.md b/artifacts/apidocs/schemas/api_transfer_history_response.md index 179cf6f..10b7def 100644 --- a/artifacts/apidocs/schemas/api_transfer_history_response.md +++ b/artifacts/apidocs/schemas/api_transfer_history_response.md @@ -3,3 +3,65 @@ |-|-|-|-| |result
`r` |[TransferHistory]|True|The transfer history matching the request account| |next
`n` |string|False
`''`|The cursor to indicate when to start the next query from| + ??? info "[TransferHistory](/../../schemas/transfer_history)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |tx_id
`ti` |string|True|The transaction ID of the transfer| + |from_account_id
`fa` |string|True|The account to transfer from| + |from_sub_account_id
`fs` |string|True|The subaccount to transfer from (0 if transferring from main account)| + |to_account_id
`ta` |string|True|The account to deposit into| + |to_sub_account_id
`ts` |string|True|The subaccount to transfer to (0 if transferring to main account)| + |currency
`c` |Currency|True|The token currency to transfer| + |num_tokens
`nt` |string|True|The number of tokens to transfer| + |signature
`s` |Signature|True|The signature of the transfer| + |event_time
`et` |string|True|The timestamp of the transfer in unix nanoseconds| + |transfer_type
`tt` |TransferType|True|The type of transfer| + |transfer_metadata
`tm` |string|True|The metadata of the transfer| + ??? info "[Currency](/../../schemas/currency)" + The list of Currencies that are supported on the GRVT exchange
+ + |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 "[Signature](/../../schemas/signature)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |signer
`s` |string|True|The address (public key) of the wallet signing the payload| + |r
`r` |string|True|Signature R| + |s
`s1` |string|True|Signature S| + |v
`v` |integer|True|Signature V| + |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days| + |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.| + ??? info "[TransferType](/../../schemas/transfer_type)" + |Value| Description | + |-|-| + |`STANDARD` = 1|Standard transfer that has nothing to do with bridging| + |`FAST_ARB_DEPOSIT` = 2|Fast Arb Deposit Metadata type| + |`FAST_ARB_WITHDRAWAL` = 3|Fast Arb Withdrawal Metadata type| + |`NON_NATIVE_BRIDGE_DEPOSIT` = 4|Transfer type for non native bridging deposit| + |`NON_NATIVE_BRIDGE_WITHDRAWAL` = 5|Transfer type for non native bridging withdrawal| diff --git a/artifacts/apidocs/schemas/api_withdrawal_history_response.md b/artifacts/apidocs/schemas/api_withdrawal_history_response.md index 861aa1d..6376519 100644 --- a/artifacts/apidocs/schemas/api_withdrawal_history_response.md +++ b/artifacts/apidocs/schemas/api_withdrawal_history_response.md @@ -3,3 +3,53 @@ |-|-|-|-| |result
`r` |[WithdrawalHistory]|True|The withdrawals history matching the request account| |next
`n` |string|False
`''`|The cursor to indicate when to start the next query from| + ??? info "[WithdrawalHistory](/../../schemas/withdrawal_history)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |tx_id
`ti` |string|True|The transaction ID of the withdrawal| + |from_account_id
`fa` |string|True|The subaccount to withdraw from| + |to_eth_address
`te` |string|True|The ethereum address to withdraw to| + |currency
`c` |Currency|True|The token currency to withdraw| + |num_tokens
`nt` |string|True|The number of tokens to withdraw| + |signature
`s` |Signature|True|The signature of the withdrawal| + |event_time
`et` |string|True|The timestamp of the withdrawal in unix nanoseconds| + ??? info "[Currency](/../../schemas/currency)" + The list of Currencies that are supported on the GRVT exchange
+ + |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 "[Signature](/../../schemas/signature)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |signer
`s` |string|True|The address (public key) of the wallet signing the payload| + |r
`r` |string|True|Signature R| + |s
`s1` |string|True|Signature S| + |v
`v` |integer|True|Signature V| + |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days| + |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.| diff --git a/artifacts/apidocs/schemas/transfer_history.md b/artifacts/apidocs/schemas/transfer_history.md index fa698b0..abb24e9 100644 --- a/artifacts/apidocs/schemas/transfer_history.md +++ b/artifacts/apidocs/schemas/transfer_history.md @@ -58,3 +58,5 @@ |`STANDARD` = 1|Standard transfer that has nothing to do with bridging| |`FAST_ARB_DEPOSIT` = 2|Fast Arb Deposit Metadata type| |`FAST_ARB_WITHDRAWAL` = 3|Fast Arb Withdrawal Metadata type| + |`NON_NATIVE_BRIDGE_DEPOSIT` = 4|Transfer type for non native bridging deposit| + |`NON_NATIVE_BRIDGE_WITHDRAWAL` = 5|Transfer type for non native bridging withdrawal| diff --git a/artifacts/apidocs/schemas/ws_transfer_feed_data_v1.md b/artifacts/apidocs/schemas/ws_transfer_feed_data_v1.md index 21ee028..04628f1 100644 --- a/artifacts/apidocs/schemas/ws_transfer_feed_data_v1.md +++ b/artifacts/apidocs/schemas/ws_transfer_feed_data_v1.md @@ -7,3 +7,65 @@ |selector
`s1` |string|True|Primary selector| |sequence_number
`sn` |string|True|A sequence number used to determine message order within a stream.
- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.
- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.
- A single cluster payload can be multiplexed into multiple stream payloads.
- To distinguish each stream payload, a `dedupCounter` is included.
- The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`.| |feed
`f` |TransferHistory|True|The transfer history matching the requested filters| + ??? info "[TransferHistory](/../../schemas/transfer_history)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |tx_id
`ti` |string|True|The transaction ID of the transfer| + |from_account_id
`fa` |string|True|The account to transfer from| + |from_sub_account_id
`fs` |string|True|The subaccount to transfer from (0 if transferring from main account)| + |to_account_id
`ta` |string|True|The account to deposit into| + |to_sub_account_id
`ts` |string|True|The subaccount to transfer to (0 if transferring to main account)| + |currency
`c` |Currency|True|The token currency to transfer| + |num_tokens
`nt` |string|True|The number of tokens to transfer| + |signature
`s` |Signature|True|The signature of the transfer| + |event_time
`et` |string|True|The timestamp of the transfer in unix nanoseconds| + |transfer_type
`tt` |TransferType|True|The type of transfer| + |transfer_metadata
`tm` |string|True|The metadata of the transfer| + ??? info "[Currency](/../../schemas/currency)" + The list of Currencies that are supported on the GRVT exchange
+ + |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 "[Signature](/../../schemas/signature)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |signer
`s` |string|True|The address (public key) of the wallet signing the payload| + |r
`r` |string|True|Signature R| + |s
`s1` |string|True|Signature S| + |v
`v` |integer|True|Signature V| + |expiration
`e` |string|True|Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days| + |nonce
`n` |integer|True|Users can randomly generate this value, used as a signature deconflicting key.
ie. You can send the same exact instruction twice with different nonces.
When the same nonce is used, the same payload will generate the same signature.
Our system will consider the payload a duplicate, and ignore it.| + ??? info "[TransferType](/../../schemas/transfer_type)" + |Value| Description | + |-|-| + |`STANDARD` = 1|Standard transfer that has nothing to do with bridging| + |`FAST_ARB_DEPOSIT` = 2|Fast Arb Deposit Metadata type| + |`FAST_ARB_WITHDRAWAL` = 3|Fast Arb Withdrawal Metadata type| + |`NON_NATIVE_BRIDGE_DEPOSIT` = 4|Transfer type for non native bridging deposit| + |`NON_NATIVE_BRIDGE_WITHDRAWAL` = 5|Transfer type for non native bridging withdrawal| diff --git a/artifacts/apidocs/trading_api.md b/artifacts/apidocs/trading_api.md index 5313b67..642c74a 100644 --- a/artifacts/apidocs/trading_api.md +++ b/artifacts/apidocs/trading_api.md @@ -5844,14 +5844,52 @@ LITE ENDPOINT: lite/v1/transfer_history **Full Response** ``` { .json .copy } { - "result": [null], + "result": [{ + "tx_id": "1028403", + "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "currency": "USDT", + "num_tokens": "1500.0", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890 + }, + "event_time": "1697788800000000000", + "transfer_type": "STANDARD", + "transfer_metadata": null + }], "next": "Qw0918=" } ``` **Lite Response** ``` { .json .copy } { - "r": [null], + "r": [{ + "ti": "1028403", + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "fs": "'$GRVT_SUB_ACCOUNT_ID'", + "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "ts": "'$GRVT_SUB_ACCOUNT_ID'", + "c": "USDT", + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890 + }, + "et": "1697788800000000000", + "tt": "STANDARD", + "tm": null + }], "n": "Qw0918=" } ``` @@ -6771,14 +6809,44 @@ LITE ENDPOINT: lite/v1/withdrawal_history **Full Response** ``` { .json .copy } { - "result": [null], + "result": [{ + "tx_id": "1028403", + "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_eth_address": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "currency": "USDT", + "num_tokens": "1500.0", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890 + }, + "event_time": "1697788800000000000" + }], "next": "Qw0918=" } ``` **Lite Response** ``` { .json .copy } { - "r": [null], + "r": [{ + "ti": "1028403", + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "c": "USDT", + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890 + }, + "et": "1697788800000000000" + }], "n": "Qw0918=" } ``` @@ -8287,13 +8355,29 @@ LITE ENDPOINT: lite/v1/funding_account_summary **Full Response** ``` { .json .copy } { - "result": null + "result": { + "main_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "total_equity": "3945034.23", + "spot_balances": [{ + "currency": "USDT", + "balance": "123456.78", + "index_price": "1.0000102" + }] + } } ``` **Lite Response** ``` { .json .copy } { - "r": null + "r": { + "ma": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "3945034.23", + "sb": [{ + "c": "USDT", + "b": "123456.78", + "ip": "1.0000102" + }] + } } ```
diff --git a/artifacts/apidocs/trading_streams.md b/artifacts/apidocs/trading_streams.md index d576326..d9344bf 100644 --- a/artifacts/apidocs/trading_streams.md +++ b/artifacts/apidocs/trading_streams.md @@ -3828,7 +3828,26 @@ STREAM: v1.transfer "stream": "v1.transfer", "selector": "BTC_USDT_Perp", "sequence_number": "872634876", - "feed": null + "feed": { + "tx_id": "1028403", + "from_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "from_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "to_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "to_sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "currency": "USDT", + "num_tokens": "1500.0", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890 + }, + "event_time": "1697788800000000000", + "transfer_type": "STANDARD", + "transfer_metadata": null + } } ``` **Lite Feed Response** @@ -3837,7 +3856,26 @@ STREAM: v1.transfer "s": "v1.transfer", "s1": "BTC_USDT_Perp", "sn": "872634876", - "f": null + "f": { + "ti": "1028403", + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "fs": "'$GRVT_SUB_ACCOUNT_ID'", + "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "ts": "'$GRVT_SUB_ACCOUNT_ID'", + "c": "USDT", + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890 + }, + "et": "1697788800000000000", + "tt": "STANDARD", + "tm": null + } } ```
diff --git a/artifacts/pysdk/grvt_raw_types.py b/artifacts/pysdk/grvt_raw_types.py index 458093f..8c1c738 100644 --- a/artifacts/pysdk/grvt_raw_types.py +++ b/artifacts/pysdk/grvt_raw_types.py @@ -760,6 +760,16 @@ class ApiAggregatedAccountSummaryResponse: result: AggregatedAccountSummary +@dataclass +class FundingAccountSummary: + # The main account ID of the account to which the summary belongs + main_account_id: str + # Total equity of the main account, denominated in USD + total_equity: str + # The list of spot assets owned by this main account, and their balances + spot_balances: list[SpotBalance] + + @dataclass class ApiFundingAccountSummaryResponse: # The funding account summary @@ -2108,6 +2118,32 @@ class WSTransferFeedSelectorV1: sub_account_id: str | None = None +@dataclass +class TransferHistory: + # The transaction ID of the transfer + tx_id: str + # The account to transfer from + from_account_id: str + # The subaccount to transfer from (0 if transferring from main account) + from_sub_account_id: str + # The account to deposit into + to_account_id: str + # The subaccount to transfer to (0 if transferring to main account) + to_sub_account_id: str + # The token currency to transfer + currency: Currency + # The number of tokens to transfer + num_tokens: str + # The signature of the transfer + signature: Signature + # The timestamp of the transfer in unix nanoseconds + event_time: str + # The type of transfer + transfer_type: TransferType + # The metadata of the transfer + transfer_metadata: str + + @dataclass class WSTransferFeedDataV1: # The websocket channel to which the response is sent @@ -2450,6 +2486,24 @@ class ApiWithdrawalHistoryRequest: main_account_id: str | None = None +@dataclass +class WithdrawalHistory: + # The transaction ID of the withdrawal + tx_id: str + # The subaccount to withdraw from + from_account_id: str + # The ethereum address to withdraw to + to_eth_address: str + # The token currency to withdraw + currency: Currency + # The number of tokens to withdraw + num_tokens: str + # The signature of the withdrawal + signature: Signature + # The timestamp of the withdrawal in unix nanoseconds + event_time: str + + @dataclass class ApiWithdrawalHistoryResponse: # The withdrawals history matching the request account diff --git a/src/codegen/apispec.json b/src/codegen/apispec.json index 6e935b9..25a5197 100644 --- a/src/codegen/apispec.json +++ b/src/codegen/apispec.json @@ -3651,6 +3651,53 @@ "The aggregated account summary, that reports the total equity and spot balances of a funding (main) account, and its constituent trading (sub) accounts" ] }, + { + "name": "FundingAccountSummary", + "is_root": false, + "fields": [ + { + "name": "main_account_id", + "lite_name": "ma", + "semantic_type": "address", + "json_type": "string", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "comment": [ + "The main account ID of the account to which the summary belongs" + ] + }, + { + "name": "total_equity", + "lite_name": "te", + "semantic_type": "string", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'3945034.23'", + "comment": [ + "Total equity of the main account, denominated in USD" + ] + }, + { + "name": "spot_balances", + "lite_name": "sb", + "semantic_type": "SpotBalance", + "json_type": "SpotBalance", + "index": 2, + "array_depth": 1, + "optional": false, + "comment": [ + "The list of spot assets owned by this main account, and their balances" + ] + } + ], + "comment": [ + "The funding account summary, that reports the total equity and spot balances of a funding (main) account" + ] + }, { "name": "ApiFundingAccountSummaryResponse", "is_root": true, @@ -8711,6 +8758,153 @@ "To subscribe to a sub account, specify the main account and the sub account dash separated (eg. `0x9fe3758b67ce7a2875ee4b452f01a5282d84ed8a-1920109784202388`)." ] }, + { + "name": "TransferHistory", + "is_root": false, + "fields": [ + { + "name": "tx_id", + "lite_name": "ti", + "semantic_type": "uint64", + "json_type": "string", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "'1028403'", + "comment": [ + "The transaction ID of the transfer" + ] + }, + { + "name": "from_account_id", + "lite_name": "fa", + "semantic_type": "address", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "comment": [ + "The account to transfer from" + ] + }, + { + "name": "from_sub_account_id", + "lite_name": "fs", + "semantic_type": "uint64", + "json_type": "string", + "index": 2, + "array_depth": 0, + "optional": false, + "example": "'$GRVT_SUB_ACCOUNT_ID'", + "comment": [ + "The subaccount to transfer from (0 if transferring from main account)" + ] + }, + { + "name": "to_account_id", + "lite_name": "ta", + "semantic_type": "address", + "json_type": "string", + "index": 3, + "array_depth": 0, + "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "comment": [ + "The account to deposit into" + ] + }, + { + "name": "to_sub_account_id", + "lite_name": "ts", + "semantic_type": "uint64", + "json_type": "string", + "index": 4, + "array_depth": 0, + "optional": false, + "example": "'$GRVT_SUB_ACCOUNT_ID'", + "comment": [ + "The subaccount to transfer to (0 if transferring to main account)" + ] + }, + { + "name": "currency", + "lite_name": "c", + "semantic_type": "Currency", + "json_type": "Currency", + "index": 5, + "array_depth": 0, + "optional": false, + "example": "'USDT'", + "comment": [ + "The token currency to transfer" + ] + }, + { + "name": "num_tokens", + "lite_name": "nt", + "semantic_type": "string", + "json_type": "string", + "index": 6, + "array_depth": 0, + "optional": false, + "example": "'1500.0'", + "comment": [ + "The number of tokens to transfer" + ] + }, + { + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 7, + "array_depth": 0, + "optional": false, + "comment": [ + "The signature of the transfer" + ] + }, + { + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", + "json_type": "string", + "index": 8, + "array_depth": 0, + "optional": false, + "example": "'1697788800000000000'", + "comment": [ + "The timestamp of the transfer in unix nanoseconds" + ] + }, + { + "name": "transfer_type", + "lite_name": "tt", + "semantic_type": "TransferType", + "json_type": "TransferType", + "index": 9, + "array_depth": 0, + "optional": false, + "comment": [ + "The type of transfer" + ] + }, + { + "name": "transfer_metadata", + "lite_name": "tm", + "semantic_type": "string", + "json_type": "string", + "index": 10, + "array_depth": 0, + "optional": false, + "comment": [ + "The metadata of the transfer" + ] + } + ], + "comment": [] + }, { "name": "WSTransferFeedDataV1", "is_root": true, @@ -10052,6 +10246,103 @@ "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe 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.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination 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.\u003c/li\u003e\u003c/ul\u003e" ] }, + { + "name": "WithdrawalHistory", + "is_root": false, + "fields": [ + { + "name": "tx_id", + "lite_name": "ti", + "semantic_type": "uint64", + "json_type": "string", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "'1028403'", + "comment": [ + "The transaction ID of the withdrawal" + ] + }, + { + "name": "from_account_id", + "lite_name": "fa", + "semantic_type": "address", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "comment": [ + "The subaccount to withdraw from" + ] + }, + { + "name": "to_eth_address", + "lite_name": "te", + "semantic_type": "address", + "json_type": "string", + "index": 2, + "array_depth": 0, + "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "comment": [ + "The ethereum address to withdraw to" + ] + }, + { + "name": "currency", + "lite_name": "c", + "semantic_type": "Currency", + "json_type": "Currency", + "index": 3, + "array_depth": 0, + "optional": false, + "example": "'USDT'", + "comment": [ + "The token currency to withdraw" + ] + }, + { + "name": "num_tokens", + "lite_name": "nt", + "semantic_type": "string", + "json_type": "string", + "index": 4, + "array_depth": 0, + "optional": false, + "example": "'1500.0'", + "comment": [ + "The number of tokens to withdraw" + ] + }, + { + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 5, + "array_depth": 0, + "optional": false, + "comment": [ + "The signature of the withdrawal" + ] + }, + { + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", + "json_type": "string", + "index": 6, + "array_depth": 0, + "optional": false, + "example": "'1697788800000000000'", + "comment": [ + "The timestamp of the withdrawal in unix nanoseconds" + ] + } + ], + "comment": [] + }, { "name": "ApiWithdrawalHistoryResponse", "is_root": true,