diff --git a/artifacts/apidocs/market_data_api.md b/artifacts/apidocs/market_data_api.md index 34ed711..2eb33a3 100644 --- a/artifacts/apidocs/market_data_api.md +++ b/artifacts/apidocs/market_data_api.md @@ -52,7 +52,8 @@ LITE ENDPOINT: lite/v1/instrument "max_position_size": "100.0", "funding_interval_hours": null, "adjusted_funding_rate_cap": 2.5, - "adjusted_funding_rate_floor": -2.5 + "adjusted_funding_rate_floor": -2.5, + "min_notional": "20.0" } } ``` @@ -75,7 +76,8 @@ LITE ENDPOINT: lite/v1/instrument "mp": "100.0", "fi": null, "af": 2.5, - "af1": -2.5 + "af1": -2.5, + "mn": "20.0" } } ``` @@ -359,7 +361,8 @@ LITE ENDPOINT: lite/v1/all_instruments "max_position_size": "100.0", "funding_interval_hours": null, "adjusted_funding_rate_cap": 2.5, - "adjusted_funding_rate_floor": -2.5 + "adjusted_funding_rate_floor": -2.5, + "min_notional": "20.0" }] } ``` @@ -382,7 +385,8 @@ LITE ENDPOINT: lite/v1/all_instruments "mp": "100.0", "fi": null, "af": 2.5, - "af1": -2.5 + "af1": -2.5, + "mn": "20.0" }] } ``` @@ -673,7 +677,8 @@ LITE ENDPOINT: lite/v1/instruments "max_position_size": "100.0", "funding_interval_hours": null, "adjusted_funding_rate_cap": 2.5, - "adjusted_funding_rate_floor": -2.5 + "adjusted_funding_rate_floor": -2.5, + "min_notional": "20.0" }] } ``` @@ -696,7 +701,8 @@ LITE ENDPOINT: lite/v1/instruments "mp": "100.0", "fi": null, "af": 2.5, - "af1": -2.5 + "af1": -2.5, + "mn": "20.0" }] } ``` diff --git a/artifacts/apidocs/schemas/api_add_isolated_position_margin_request.md b/artifacts/apidocs/schemas/api_add_isolated_position_margin_request.md new file mode 100644 index 0000000..2952726 --- /dev/null +++ b/artifacts/apidocs/schemas/api_add_isolated_position_margin_request.md @@ -0,0 +1,19 @@ +!!! info "[ApiAddIsolatedPositionMarginRequest](/../../schemas/api_add_isolated_position_margin_request)" + The request to add margin to a isolated position
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |sub_account_id
`sa` |string|True|The sub account ID to add isolated margin in or remove margin from| + |instrument
`i` |string|True|The instrument to add margin into, or remove margin from| + |amount
`a` |string|True|The amount of margin to add to the position, positive to add, negative to remove, expressed in quote asset decimal units| + |signature
`s` |Signature|True|The signature of this operation| + ??? 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.
Range: 0 to 4,294,967,295 (uint32)| + |chain_id
`ci` |string|True|Chain ID used in EIP-712 domain. Zero value fallbacks to GRVT Chain ID.| diff --git a/artifacts/apidocs/schemas/api_add_isolated_position_margin_response.md b/artifacts/apidocs/schemas/api_add_isolated_position_margin_response.md new file mode 100644 index 0000000..e8d806b --- /dev/null +++ b/artifacts/apidocs/schemas/api_add_isolated_position_margin_response.md @@ -0,0 +1,6 @@ +!!! info "[ApiAddIsolatedPositionMarginResponse](/../../schemas/api_add_isolated_position_margin_response)" + The response to add margin to a isolated position
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |success
`s` |boolean|True|Whether the margin mode and leverage was set successfully| diff --git a/artifacts/apidocs/schemas/api_authorize_builder_request.md b/artifacts/apidocs/schemas/api_authorize_builder_request.md new file mode 100644 index 0000000..3ca59f9 --- /dev/null +++ b/artifacts/apidocs/schemas/api_authorize_builder_request.md @@ -0,0 +1,20 @@ +!!! info "[ApiAuthorizeBuilderRequest](/../../schemas/api_authorize_builder_request)" + Authorizes a specific Builder to execute transactions on behalf of the Main Account.

This endpoint acts as an **upsert** operation:
- **New Authorization**: If the builder is not currently authorized, a new record is created.
- **Update Limit**: If the builder is already authorized, this request updates the `maxFuturesFeeRate` and `maxSpotFeeRate` to the new values provided.
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |main_account_id
`ma` |string|True|The Main Account ID of the user granting the authorization.| + |builder_account_id
`ba` |string|True|The Main Account ID of the Builder receiving the authorization.| + |max_futures_fee_rate
`mf` |string|True|The maximum fee rate cap for **Futures** trades executed by this builder, expressed as a percentage (e.g., 0.001 means 0.001%). The builder cannot charge fees exceeding this limit.| + |max_spot_fee_rate
`ms` |string|True|The maximum fee rate cap for **Spot** trades executed by this builder, expressed as a percentage (e.g., 0.0001 means 0.0001%). The builder cannot charge fees exceeding this limit.| + |signature
`s` |Signature|True|The cryptographic signature authenticating this request. Must be signed by the private key associated with `mainAccountID`.| + ??? 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.
Range: 0 to 4,294,967,295 (uint32)| + |chain_id
`ci` |string|True|Chain ID used in EIP-712 domain. Zero value fallbacks to GRVT Chain ID.| diff --git a/artifacts/apidocs/schemas/api_authorized_builder.md b/artifacts/apidocs/schemas/api_authorized_builder.md new file mode 100644 index 0000000..0bfdfbc --- /dev/null +++ b/artifacts/apidocs/schemas/api_authorized_builder.md @@ -0,0 +1,6 @@ +!!! info "[ApiAuthorizedBuilder](/../../schemas/api_authorized_builder)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |builder_account_id
`ba` |string|True|The main account ID of the builder| + |max_futures_fee_rate
`mf` |string|True|The maximum fee rate for the authorized builder| + |max_spot_fee_rate
`ms` |string|True|The maximum fee rate for the authorized builder| diff --git a/artifacts/apidocs/schemas/api_builder_fill_history_request.md b/artifacts/apidocs/schemas/api_builder_fill_history_request.md new file mode 100644 index 0000000..535ccbe --- /dev/null +++ b/artifacts/apidocs/schemas/api_builder_fill_history_request.md @@ -0,0 +1,9 @@ +!!! info "[ApiBuilderFillHistoryRequest](/../../schemas/api_builder_fill_history_request)" + The request to get the historical builder trade of a builder
The history is returned in reverse chronological order

Pagination works as follows:
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |start_time
`st` |string|False
`0`|The start time to query for in unix nanoseconds| + |end_time
`et` |string|False
`now()`|The end time to query for in unix nanoseconds| + |limit
`l` |integer|False
`500`|The limit to query for. Defaults to 500; Max 1000| + |cursor
`c` |string|False
`''`|The cursor to indicate when to start the next query from| diff --git a/artifacts/apidocs/schemas/api_builder_fill_history_response.md b/artifacts/apidocs/schemas/api_builder_fill_history_response.md new file mode 100644 index 0000000..bd18338 --- /dev/null +++ b/artifacts/apidocs/schemas/api_builder_fill_history_response.md @@ -0,0 +1,19 @@ +!!! info "[ApiBuilderFillHistoryResponse](/../../schemas/api_builder_fill_history_response)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |result
`r` |[BuilderFillHistory]|True|The builder fill history matching the request builder account| + |next
`n` |string|False
`''`|The cursor to indicate when to start the next query from| + ??? info "[BuilderFillHistory](/../../schemas/builder_fill_history)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds| + |off_chain_account_id
`oc` |string|True|The off chain account id| + |instrument
`i` |string|True|The instrument being represented| + |is_buyer
`ib` |boolean|True|The side that the subaccount took on the trade| + |is_taker
`it` |boolean|True|The role that the subaccount took on the trade| + |size
`s` |string|True|The number of assets being traded, expressed in base asset decimal units| + |price
`p` |string|True|The traded price, expressed in `9` decimals| + |mark_price
`mp` |string|True|The mark price of the instrument at point of trade, expressed in `9` decimals| + |index_price
`ip` |string|True|The index price of the instrument at point of trade, expressed in `9` decimals| + |fee_rate
`fr` |string|True|Builder fee percentage charged for this order. referred to Order.builder builderFee | + |fee
`f` |string|True|The builder fee paid on the trade, expressed in quote asset decimal unit. referred to Trade.builderFee| diff --git a/artifacts/apidocs/schemas/api_create_order_request.md b/artifacts/apidocs/schemas/api_create_order_request.md index 503b0af..20071c6 100644 --- a/artifacts/apidocs/schemas/api_create_order_request.md +++ b/artifacts/apidocs/schemas/api_create_order_request.md @@ -19,6 +19,8 @@ |signature
`s` |Signature|True|The signature approving this order| |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client| |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client| + |builder
`b` |string|True|The main account ID of the builder| + |builder_fee
`bf` |string|True|Builder fee charged for this order, expressed as a percentage (e.g., 0.001 means 0.001%). | ??? info "[TimeInForce](/../../schemas/time_in_force)" | | Must Fill All | Can Fill Partial | | - | - | - | @@ -160,3 +162,7 @@ |`INVALID_ORDER_TYPE` = 36|the order type is invalid| |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined| |`INVALID_CHAIN_ID` = 38|the chain ID is invalid| + |`BUILDER_ORDER_FEE_EXCEED` = 39|Builder fee exceed the limit| + |`BUILDER_ORDER_FEE_NEGATIVE` = 40|Builder fee is below 0| + |`BUILDER_ORDER_BUILDER_NOT_AUTHORIZED` = 41|Builder is not an authorized builder for client| + |`BUILDER_ORDER_BUILDER_NOT_EXIST` = 42|Builder does not exist| diff --git a/artifacts/apidocs/schemas/api_create_order_response.md b/artifacts/apidocs/schemas/api_create_order_response.md index b0c6aa0..5f0e6af 100644 --- a/artifacts/apidocs/schemas/api_create_order_response.md +++ b/artifacts/apidocs/schemas/api_create_order_response.md @@ -17,6 +17,8 @@ |signature
`s` |Signature|True|The signature approving this order| |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client| |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client| + |builder
`b` |string|True|The main account ID of the builder| + |builder_fee
`bf` |string|True|Builder fee charged for this order, expressed as a percentage (e.g., 0.001 means 0.001%). | ??? info "[TimeInForce](/../../schemas/time_in_force)" | | Must Fill All | Can Fill Partial | | - | - | - | @@ -158,3 +160,7 @@ |`INVALID_ORDER_TYPE` = 36|the order type is invalid| |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined| |`INVALID_CHAIN_ID` = 38|the chain ID is invalid| + |`BUILDER_ORDER_FEE_EXCEED` = 39|Builder fee exceed the limit| + |`BUILDER_ORDER_FEE_NEGATIVE` = 40|Builder fee is below 0| + |`BUILDER_ORDER_BUILDER_NOT_AUTHORIZED` = 41|Builder is not an authorized builder for client| + |`BUILDER_ORDER_BUILDER_NOT_EXIST` = 42|Builder does not exist| diff --git a/artifacts/apidocs/schemas/api_fill_history_response.md b/artifacts/apidocs/schemas/api_fill_history_response.md index 65a847a..c7154d5 100644 --- a/artifacts/apidocs/schemas/api_fill_history_response.md +++ b/artifacts/apidocs/schemas/api_fill_history_response.md @@ -23,10 +23,14 @@ |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`.| |order_id
`oi` |string|True|An order identifier| |venue
`v` |Venue|True|The venue where the trade occurred| + |is_liquidation
`il` |boolean|True|If the trade was a liquidation| |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| + |builder
`b1` |string|True|The main account ID of the builder. referred to Order.builder| + |builder_fee_rate
`bf` |string|True|Builder fee percentage charged for this order. referred to Order.builder builderFee | + |builder_fee
`bf1` |string|True|The builder fee paid on the trade, expressed in quote asset decimal unit. referred to Trade.builderFee| ??? info "[Venue](/../../schemas/venue)" The list of Trading Venues that are supported on the GRVT exchange
diff --git a/artifacts/apidocs/schemas/api_funding_payment_history_request.md b/artifacts/apidocs/schemas/api_funding_payment_history_request.md index 33f4166..5dd5cc2 100644 --- a/artifacts/apidocs/schemas/api_funding_payment_history_request.md +++ b/artifacts/apidocs/schemas/api_funding_payment_history_request.md @@ -9,3 +9,15 @@ |end_time
`et` |string|False
`now()`|The end time to apply in unix nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned| |limit
`l` |integer|False
`500`|The limit to query for. Defaults to 500; Max 1000| |cursor
`c` |string|False
`''`|The cursor to indicate when to start the query from| + |kind
`k` |[Kind]|False
`all`|The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned| + |base
`b` |[string]|False
`all`|The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned| + |quote
`q` |[string]|False
`all`|The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned| + ??? info "[Kind](/../../schemas/kind)" + The list of asset kinds that are supported on the GRVT exchange
+ + |Value| Description | + |-|-| + |`PERPETUAL` = 1|the perpetual asset kind| + |`FUTURE` = 2|the future asset kind| + |`CALL` = 3|the call option asset kind| + |`PUT` = 4|the put option asset kind| diff --git a/artifacts/apidocs/schemas/api_get_all_initial_leverage_response.md b/artifacts/apidocs/schemas/api_get_all_initial_leverage_response.md index 55a1e63..74b714a 100644 --- a/artifacts/apidocs/schemas/api_get_all_initial_leverage_response.md +++ b/artifacts/apidocs/schemas/api_get_all_initial_leverage_response.md @@ -8,6 +8,12 @@ |Name
`Lite`|Type|Required
`Default`| Description | |-|-|-|-| |instrument
`i` |string|True|The instrument to get the leverage for| - |leverage
`l` |string|True|The initial leverage of the sub account| - |min_leverage
`ml` |string|True|The min leverage this sub account can set| - |max_leverage
`ml1` |string|True|The max leverage this sub account can set| + |leverage
`l` |string|True|The initial leverage of this instrument| + |min_leverage
`ml` |string|True|The min leverage user can set for this instrument| + |max_leverage
`ml1` |string|True|The max leverage user can set for this instrument| + |margin_type
`mt` |PositionMarginType|True|The margin type of this instrument| + ??? info "[PositionMarginType](/../../schemas/position_margin_type)" + |Value| Description | + |-|-| + |`ISOLATED` = 1|Isolated Margin Mode: each position is allocated a fixed amount of collateral| + |`CROSS` = 2|Cross Margin Mode: uses all available funds in your account as collateral across all cross margin positions| diff --git a/artifacts/apidocs/schemas/api_get_all_instruments_response.md b/artifacts/apidocs/schemas/api_get_all_instruments_response.md index d716fd3..8137495 100644 --- a/artifacts/apidocs/schemas/api_get_all_instruments_response.md +++ b/artifacts/apidocs/schemas/api_get_all_instruments_response.md @@ -21,6 +21,7 @@ |funding_interval_hours
`fi` |integer|False
`None`|Defines the funding interval to be applied.| |adjusted_funding_rate_cap
`af` |string|False
`None`|Funding rate cap over the defined `intervalHours`.| |adjusted_funding_rate_floor
`af1` |string|False
`None`|Funding rate floor over the defined `intervalHours`.| + |min_notional
`mn` |string|True|The minimum order notional value, expressed in quote currency decimal units| ??? info "[Kind](/../../schemas/kind)" The list of asset kinds that are supported on the GRVT exchange
diff --git a/artifacts/apidocs/schemas/api_get_authorized_builders_response.md b/artifacts/apidocs/schemas/api_get_authorized_builders_response.md new file mode 100644 index 0000000..f541520 --- /dev/null +++ b/artifacts/apidocs/schemas/api_get_authorized_builders_response.md @@ -0,0 +1,12 @@ +!!! info "[ApiGetAuthorizedBuildersResponse](/../../schemas/api_get_authorized_builders_response)" + Returns list of authorized builders and the associated fee
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |results
`r` |[ApiAuthorizedBuilder]|True|The list of authorized builders| + ??? info "[ApiAuthorizedBuilder](/../../schemas/api_authorized_builder)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |builder_account_id
`ba` |string|True|The main account ID of the builder| + |max_futures_fee_rate
`mf` |string|True|The maximum fee rate for the authorized builder| + |max_spot_fee_rate
`ms` |string|True|The maximum fee rate for the authorized builder| diff --git a/artifacts/apidocs/schemas/api_get_filtered_instruments_response.md b/artifacts/apidocs/schemas/api_get_filtered_instruments_response.md index 74855bb..57d26d5 100644 --- a/artifacts/apidocs/schemas/api_get_filtered_instruments_response.md +++ b/artifacts/apidocs/schemas/api_get_filtered_instruments_response.md @@ -21,6 +21,7 @@ |funding_interval_hours
`fi` |integer|False
`None`|Defines the funding interval to be applied.| |adjusted_funding_rate_cap
`af` |string|False
`None`|Funding rate cap over the defined `intervalHours`.| |adjusted_funding_rate_floor
`af1` |string|False
`None`|Funding rate floor over the defined `intervalHours`.| + |min_notional
`mn` |string|True|The minimum order notional value, expressed in quote currency decimal units| ??? info "[Kind](/../../schemas/kind)" The list of asset kinds that are supported on the GRVT exchange
diff --git a/artifacts/apidocs/schemas/api_get_instrument_response.md b/artifacts/apidocs/schemas/api_get_instrument_response.md index dd01849..bf0e50c 100644 --- a/artifacts/apidocs/schemas/api_get_instrument_response.md +++ b/artifacts/apidocs/schemas/api_get_instrument_response.md @@ -21,6 +21,7 @@ |funding_interval_hours
`fi` |integer|False
`None`|Defines the funding interval to be applied.| |adjusted_funding_rate_cap
`af` |string|False
`None`|Funding rate cap over the defined `intervalHours`.| |adjusted_funding_rate_floor
`af1` |string|False
`None`|Funding rate floor over the defined `intervalHours`.| + |min_notional
`mn` |string|True|The minimum order notional value, expressed in quote currency decimal units| ??? info "[Kind](/../../schemas/kind)" The list of asset kinds that are supported on the GRVT exchange
diff --git a/artifacts/apidocs/schemas/api_get_isolated_position_margin_limits_request.md b/artifacts/apidocs/schemas/api_get_isolated_position_margin_limits_request.md new file mode 100644 index 0000000..cbb7c5c --- /dev/null +++ b/artifacts/apidocs/schemas/api_get_isolated_position_margin_limits_request.md @@ -0,0 +1,7 @@ +!!! info "[ApiGetIsolatedPositionMarginLimitsRequest](/../../schemas/api_get_isolated_position_margin_limits_request)" + The request to get the max addable and removable amount for an isolated position
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |sub_account_id
`sa` |string|True|The sub account ID to get the margin limits for| + |instrument
`i` |string|True|The isolated position asset to get the margin limits for| diff --git a/artifacts/apidocs/schemas/api_get_isolated_position_margin_limits_response.md b/artifacts/apidocs/schemas/api_get_isolated_position_margin_limits_response.md new file mode 100644 index 0000000..a51f8aa --- /dev/null +++ b/artifacts/apidocs/schemas/api_get_isolated_position_margin_limits_response.md @@ -0,0 +1,8 @@ +!!! info "[ApiGetIsolatedPositionMarginLimitsResponse](/../../schemas/api_get_isolated_position_margin_limits_response)" + The response to get the max addable and removable amount for an isolated position request
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |instrument
`i` |string|True|The isolated position asset| + |max_addable_amount
`ma` |string|True|The max addable amount that can be added to the isolated position, expressed in quote asset decimal units| + |max_removable_amount
`mr` |string|True|The max removable amount that can be removed from the isolated position, expressed in quote asset decimal units| diff --git a/artifacts/apidocs/schemas/api_get_order_response.md b/artifacts/apidocs/schemas/api_get_order_response.md index 7b922b0..21efed2 100644 --- a/artifacts/apidocs/schemas/api_get_order_response.md +++ b/artifacts/apidocs/schemas/api_get_order_response.md @@ -17,6 +17,8 @@ |signature
`s` |Signature|True|The signature approving this order| |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client| |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client| + |builder
`b` |string|True|The main account ID of the builder| + |builder_fee
`bf` |string|True|Builder fee charged for this order, expressed as a percentage (e.g., 0.001 means 0.001%). | ??? info "[TimeInForce](/../../schemas/time_in_force)" | | Must Fill All | Can Fill Partial | | - | - | - | @@ -158,3 +160,7 @@ |`INVALID_ORDER_TYPE` = 36|the order type is invalid| |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined| |`INVALID_CHAIN_ID` = 38|the chain ID is invalid| + |`BUILDER_ORDER_FEE_EXCEED` = 39|Builder fee exceed the limit| + |`BUILDER_ORDER_FEE_NEGATIVE` = 40|Builder fee is below 0| + |`BUILDER_ORDER_BUILDER_NOT_AUTHORIZED` = 41|Builder is not an authorized builder for client| + |`BUILDER_ORDER_BUILDER_NOT_EXIST` = 42|Builder does not exist| diff --git a/artifacts/apidocs/schemas/api_open_orders_response.md b/artifacts/apidocs/schemas/api_open_orders_response.md index b20c7d9..03fe793 100644 --- a/artifacts/apidocs/schemas/api_open_orders_response.md +++ b/artifacts/apidocs/schemas/api_open_orders_response.md @@ -19,6 +19,8 @@ |signature
`s` |Signature|True|The signature approving this order| |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client| |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client| + |builder
`b` |string|True|The main account ID of the builder| + |builder_fee
`bf` |string|True|Builder fee charged for this order, expressed as a percentage (e.g., 0.001 means 0.001%). | ??? info "[TimeInForce](/../../schemas/time_in_force)" | | Must Fill All | Can Fill Partial | | - | - | - | @@ -160,3 +162,7 @@ |`INVALID_ORDER_TYPE` = 36|the order type is invalid| |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined| |`INVALID_CHAIN_ID` = 38|the chain ID is invalid| + |`BUILDER_ORDER_FEE_EXCEED` = 39|Builder fee exceed the limit| + |`BUILDER_ORDER_FEE_NEGATIVE` = 40|Builder fee is below 0| + |`BUILDER_ORDER_BUILDER_NOT_AUTHORIZED` = 41|Builder is not an authorized builder for client| + |`BUILDER_ORDER_BUILDER_NOT_EXIST` = 42|Builder does not exist| diff --git a/artifacts/apidocs/schemas/api_order_history_response.md b/artifacts/apidocs/schemas/api_order_history_response.md index 7302cae..1941e79 100644 --- a/artifacts/apidocs/schemas/api_order_history_response.md +++ b/artifacts/apidocs/schemas/api_order_history_response.md @@ -18,6 +18,8 @@ |signature
`s` |Signature|True|The signature approving this order| |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client| |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client| + |builder
`b` |string|True|The main account ID of the builder| + |builder_fee
`bf` |string|True|Builder fee charged for this order, expressed as a percentage (e.g., 0.001 means 0.001%). | ??? info "[TimeInForce](/../../schemas/time_in_force)" | | Must Fill All | Can Fill Partial | | - | - | - | @@ -159,3 +161,7 @@ |`INVALID_ORDER_TYPE` = 36|the order type is invalid| |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined| |`INVALID_CHAIN_ID` = 38|the chain ID is invalid| + |`BUILDER_ORDER_FEE_EXCEED` = 39|Builder fee exceed the limit| + |`BUILDER_ORDER_FEE_NEGATIVE` = 40|Builder fee is below 0| + |`BUILDER_ORDER_BUILDER_NOT_AUTHORIZED` = 41|Builder is not an authorized builder for client| + |`BUILDER_ORDER_BUILDER_NOT_EXIST` = 42|Builder does not exist| diff --git a/artifacts/apidocs/schemas/api_positions_response.md b/artifacts/apidocs/schemas/api_positions_response.md index a4d6886..524a537 100644 --- a/artifacts/apidocs/schemas/api_positions_response.md +++ b/artifacts/apidocs/schemas/api_positions_response.md @@ -22,3 +22,12 @@ |leverage
`l` |string|True|The current leverage value for this position| |cumulative_fee
`cf` |string|True|The cumulative fee paid on the position, expressed in quote asset decimal units| |cumulative_realized_funding_payment
`cr` |string|True|The cumulative realized funding payment of the position, expressed in quote asset decimal units. Positive if paid, negative if received| + |margin_type
`mt` |PositionMarginType|True|The margin type of the position| + |isolated_balance
`ib` |string|False
`None`|[IsolatedOnly] The wallet balance reserved for this isolated margin position, expressed in quote asset decimal units. If this positions is liquidated, this is the maximal balance that can be lost| + |isolated_im
`ii` |string|False
`None`|[IsolatedOnly] The initial margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to open more size in the position| + |isolated_mm
`im` |string|False
`None`|[IsolatedOnly] The maintenance margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to avoid liquidation of the position| + ??? info "[PositionMarginType](/../../schemas/position_margin_type)" + |Value| Description | + |-|-| + |`ISOLATED` = 1|Isolated Margin Mode: each position is allocated a fixed amount of collateral| + |`CROSS` = 2|Cross Margin Mode: uses all available funds in your account as collateral across all cross margin positions| diff --git a/artifacts/apidocs/schemas/api_set_initial_leverage_request.md b/artifacts/apidocs/schemas/api_set_initial_leverage_request.md index 10e6027..6414291 100644 --- a/artifacts/apidocs/schemas/api_set_initial_leverage_request.md +++ b/artifacts/apidocs/schemas/api_set_initial_leverage_request.md @@ -1,5 +1,5 @@ !!! info "[ApiSetInitialLeverageRequest](/../../schemas/api_set_initial_leverage_request)" - The request to set the initial leverage of a sub account
+ The request to set the initial leverage of a sub account.
DEPRECATED: This API is deprecated, use set_position_config API instead
|Name
`Lite`|Type|Required
`Default`| Description | |-|-|-|-| diff --git a/artifacts/apidocs/schemas/api_set_initial_leverage_response.md b/artifacts/apidocs/schemas/api_set_initial_leverage_response.md index 415d0cc..700548b 100644 --- a/artifacts/apidocs/schemas/api_set_initial_leverage_response.md +++ b/artifacts/apidocs/schemas/api_set_initial_leverage_response.md @@ -1,5 +1,5 @@ !!! info "[ApiSetInitialLeverageResponse](/../../schemas/api_set_initial_leverage_response)" - The response to set the initial leverage of a sub account
+ The response to set the initial leverage of a sub account.
DEPRECATED: This API is deprecated, use set_position_config API instead
|Name
`Lite`|Type|Required
`Default`| Description | |-|-|-|-| diff --git a/artifacts/apidocs/schemas/api_set_sub_account_position_margin_config_request.md b/artifacts/apidocs/schemas/api_set_sub_account_position_margin_config_request.md new file mode 100644 index 0000000..d9b362a --- /dev/null +++ b/artifacts/apidocs/schemas/api_set_sub_account_position_margin_config_request.md @@ -0,0 +1,25 @@ +!!! info "[ApiSetSubAccountPositionMarginConfigRequest](/../../schemas/api_set_sub_account_position_margin_config_request)" + Sets the margin type and leverage configuration for a specific position (instrument) within a sub account.

This configuration is applied per-instrument, allowing different margin settings for different positions.

+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |sub_account_id
`sa` |string|True|The sub account ID to set the margin type and leverage for| + |instrument
`i` |string|True|The instrument of the position to set the margin type and leverage for| + |margin_type
`mt` |PositionMarginType|True|The margin type to set for the position| + |leverage
`l` |string|True|The leverage to set for the position| + |signature
`s` |Signature|True|The signature of this operation| + ??? info "[PositionMarginType](/../../schemas/position_margin_type)" + |Value| Description | + |-|-| + |`ISOLATED` = 1|Isolated Margin Mode: each position is allocated a fixed amount of collateral| + |`CROSS` = 2|Cross Margin Mode: uses all available funds in your account as collateral across all cross margin positions| + ??? 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.
Range: 0 to 4,294,967,295 (uint32)| + |chain_id
`ci` |string|True|Chain ID used in EIP-712 domain. Zero value fallbacks to GRVT Chain ID.| diff --git a/artifacts/apidocs/schemas/api_set_sub_account_position_margin_config_response.md b/artifacts/apidocs/schemas/api_set_sub_account_position_margin_config_response.md new file mode 100644 index 0000000..a766cfa --- /dev/null +++ b/artifacts/apidocs/schemas/api_set_sub_account_position_margin_config_response.md @@ -0,0 +1,6 @@ +!!! info "[ApiSetSubAccountPositionMarginConfigResponse](/../../schemas/api_set_sub_account_position_margin_config_response)" + The response to set the margin type and leverage for a position
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |ack
`a` |boolean|True|Whether the margin type and leverage was acked| diff --git a/artifacts/apidocs/schemas/api_sub_account_history_response.md b/artifacts/apidocs/schemas/api_sub_account_history_response.md index 4150773..bd2bf12 100644 --- a/artifacts/apidocs/schemas/api_sub_account_history_response.md +++ b/artifacts/apidocs/schemas/api_sub_account_history_response.md @@ -55,3 +55,12 @@ |leverage
`l` |string|True|The current leverage value for this position| |cumulative_fee
`cf` |string|True|The cumulative fee paid on the position, expressed in quote asset decimal units| |cumulative_realized_funding_payment
`cr` |string|True|The cumulative realized funding payment of the position, expressed in quote asset decimal units. Positive if paid, negative if received| + |margin_type
`mt` |PositionMarginType|True|The margin type of the position| + |isolated_balance
`ib` |string|False
`None`|[IsolatedOnly] The wallet balance reserved for this isolated margin position, expressed in quote asset decimal units. If this positions is liquidated, this is the maximal balance that can be lost| + |isolated_im
`ii` |string|False
`None`|[IsolatedOnly] The initial margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to open more size in the position| + |isolated_mm
`im` |string|False
`None`|[IsolatedOnly] The maintenance margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to avoid liquidation of the position| + ??? info "[PositionMarginType](/../../schemas/position_margin_type)" + |Value| Description | + |-|-| + |`ISOLATED` = 1|Isolated Margin Mode: each position is allocated a fixed amount of collateral| + |`CROSS` = 2|Cross Margin Mode: uses all available funds in your account as collateral across all cross margin positions| diff --git a/artifacts/apidocs/schemas/api_sub_account_summary_response.md b/artifacts/apidocs/schemas/api_sub_account_summary_response.md index 6e4e176..63c5b6b 100644 --- a/artifacts/apidocs/schemas/api_sub_account_summary_response.md +++ b/artifacts/apidocs/schemas/api_sub_account_summary_response.md @@ -56,3 +56,12 @@ |leverage
`l` |string|True|The current leverage value for this position| |cumulative_fee
`cf` |string|True|The cumulative fee paid on the position, expressed in quote asset decimal units| |cumulative_realized_funding_payment
`cr` |string|True|The cumulative realized funding payment of the position, expressed in quote asset decimal units. Positive if paid, negative if received| + |margin_type
`mt` |PositionMarginType|True|The margin type of the position| + |isolated_balance
`ib` |string|False
`None`|[IsolatedOnly] The wallet balance reserved for this isolated margin position, expressed in quote asset decimal units. If this positions is liquidated, this is the maximal balance that can be lost| + |isolated_im
`ii` |string|False
`None`|[IsolatedOnly] The initial margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to open more size in the position| + |isolated_mm
`im` |string|False
`None`|[IsolatedOnly] The maintenance margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to avoid liquidation of the position| + ??? info "[PositionMarginType](/../../schemas/position_margin_type)" + |Value| Description | + |-|-| + |`ISOLATED` = 1|Isolated Margin Mode: each position is allocated a fixed amount of collateral| + |`CROSS` = 2|Cross Margin Mode: uses all available funds in your account as collateral across all cross margin positions| diff --git a/artifacts/apidocs/schemas/builder_fill_history.md b/artifacts/apidocs/schemas/builder_fill_history.md new file mode 100644 index 0000000..be399e7 --- /dev/null +++ b/artifacts/apidocs/schemas/builder_fill_history.md @@ -0,0 +1,14 @@ +!!! info "[BuilderFillHistory](/../../schemas/builder_fill_history)" + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |event_time
`et` |string|True|Time at which the event was emitted in unix nanoseconds| + |off_chain_account_id
`oc` |string|True|The off chain account id| + |instrument
`i` |string|True|The instrument being represented| + |is_buyer
`ib` |boolean|True|The side that the subaccount took on the trade| + |is_taker
`it` |boolean|True|The role that the subaccount took on the trade| + |size
`s` |string|True|The number of assets being traded, expressed in base asset decimal units| + |price
`p` |string|True|The traded price, expressed in `9` decimals| + |mark_price
`mp` |string|True|The mark price of the instrument at point of trade, expressed in `9` decimals| + |index_price
`ip` |string|True|The index price of the instrument at point of trade, expressed in `9` decimals| + |fee_rate
`fr` |string|True|Builder fee percentage charged for this order. referred to Order.builder builderFee | + |fee
`f` |string|True|The builder fee paid on the trade, expressed in quote asset decimal unit. referred to Trade.builderFee| diff --git a/artifacts/apidocs/schemas/cancel_status_feed.md b/artifacts/apidocs/schemas/cancel_status_feed.md index 6e56c93..ef8d133 100644 --- a/artifacts/apidocs/schemas/cancel_status_feed.md +++ b/artifacts/apidocs/schemas/cancel_status_feed.md @@ -49,6 +49,10 @@ |`INVALID_ORDER_TYPE` = 36|the order type is invalid| |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined| |`INVALID_CHAIN_ID` = 38|the chain ID is invalid| + |`BUILDER_ORDER_FEE_EXCEED` = 39|Builder fee exceed the limit| + |`BUILDER_ORDER_FEE_NEGATIVE` = 40|Builder fee is below 0| + |`BUILDER_ORDER_BUILDER_NOT_AUTHORIZED` = 41|Builder is not an authorized builder for client| + |`BUILDER_ORDER_BUILDER_NOT_EXIST` = 42|Builder does not exist| ??? info "[CancelStatus](/../../schemas/cancel_status)" |Value| Description | |-|-| diff --git a/artifacts/apidocs/schemas/fill.md b/artifacts/apidocs/schemas/fill.md index f0f4482..7bc15cb 100644 --- a/artifacts/apidocs/schemas/fill.md +++ b/artifacts/apidocs/schemas/fill.md @@ -18,10 +18,14 @@ |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`.| |order_id
`oi` |string|True|An order identifier| |venue
`v` |Venue|True|The venue where the trade occurred| + |is_liquidation
`il` |boolean|True|If the trade was a liquidation| |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| + |builder
`b1` |string|True|The main account ID of the builder. referred to Order.builder| + |builder_fee_rate
`bf` |string|True|Builder fee percentage charged for this order. referred to Order.builder builderFee | + |builder_fee
`bf1` |string|True|The builder fee paid on the trade, expressed in quote asset decimal unit. referred to Trade.builderFee| ??? info "[Venue](/../../schemas/venue)" The list of Trading Venues that are supported on the GRVT exchange
diff --git a/artifacts/apidocs/schemas/initial_leverage_result.md b/artifacts/apidocs/schemas/initial_leverage_result.md index f6c5cb0..5e02dee 100644 --- a/artifacts/apidocs/schemas/initial_leverage_result.md +++ b/artifacts/apidocs/schemas/initial_leverage_result.md @@ -2,6 +2,12 @@ |Name
`Lite`|Type|Required
`Default`| Description | |-|-|-|-| |instrument
`i` |string|True|The instrument to get the leverage for| - |leverage
`l` |string|True|The initial leverage of the sub account| - |min_leverage
`ml` |string|True|The min leverage this sub account can set| - |max_leverage
`ml1` |string|True|The max leverage this sub account can set| + |leverage
`l` |string|True|The initial leverage of this instrument| + |min_leverage
`ml` |string|True|The min leverage user can set for this instrument| + |max_leverage
`ml1` |string|True|The max leverage user can set for this instrument| + |margin_type
`mt` |PositionMarginType|True|The margin type of this instrument| + ??? info "[PositionMarginType](/../../schemas/position_margin_type)" + |Value| Description | + |-|-| + |`ISOLATED` = 1|Isolated Margin Mode: each position is allocated a fixed amount of collateral| + |`CROSS` = 2|Cross Margin Mode: uses all available funds in your account as collateral across all cross margin positions| diff --git a/artifacts/apidocs/schemas/instrument_display.md b/artifacts/apidocs/schemas/instrument_display.md index fc9e045..b79586c 100644 --- a/artifacts/apidocs/schemas/instrument_display.md +++ b/artifacts/apidocs/schemas/instrument_display.md @@ -17,6 +17,7 @@ |funding_interval_hours
`fi` |integer|False
`None`|Defines the funding interval to be applied.| |adjusted_funding_rate_cap
`af` |string|False
`None`|Funding rate cap over the defined `intervalHours`.| |adjusted_funding_rate_floor
`af1` |string|False
`None`|Funding rate floor over the defined `intervalHours`.| + |min_notional
`mn` |string|True|The minimum order notional value, expressed in quote currency decimal units| ??? info "[Kind](/../../schemas/kind)" The list of asset kinds that are supported on the GRVT exchange
diff --git a/artifacts/apidocs/schemas/order.md b/artifacts/apidocs/schemas/order.md index 3cb5e7f..bc99a82 100644 --- a/artifacts/apidocs/schemas/order.md +++ b/artifacts/apidocs/schemas/order.md @@ -13,6 +13,8 @@ |signature
`s` |Signature|True|The signature approving this order| |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client| |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client| + |builder
`b` |string|True|The main account ID of the builder| + |builder_fee
`bf` |string|True|Builder fee charged for this order, expressed as a percentage (e.g., 0.001 means 0.001%). | ??? info "[TimeInForce](/../../schemas/time_in_force)" | | Must Fill All | Can Fill Partial | | - | - | - | @@ -154,3 +156,7 @@ |`INVALID_ORDER_TYPE` = 36|the order type is invalid| |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined| |`INVALID_CHAIN_ID` = 38|the chain ID is invalid| + |`BUILDER_ORDER_FEE_EXCEED` = 39|Builder fee exceed the limit| + |`BUILDER_ORDER_FEE_NEGATIVE` = 40|Builder fee is below 0| + |`BUILDER_ORDER_BUILDER_NOT_AUTHORIZED` = 41|Builder is not an authorized builder for client| + |`BUILDER_ORDER_BUILDER_NOT_EXIST` = 42|Builder does not exist| diff --git a/artifacts/apidocs/schemas/order_reject_reason.md b/artifacts/apidocs/schemas/order_reject_reason.md index 39c60a2..dd056d4 100644 --- a/artifacts/apidocs/schemas/order_reject_reason.md +++ b/artifacts/apidocs/schemas/order_reject_reason.md @@ -40,3 +40,7 @@ |`INVALID_ORDER_TYPE` = 36|the order type is invalid| |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined| |`INVALID_CHAIN_ID` = 38|the chain ID is invalid| + |`BUILDER_ORDER_FEE_EXCEED` = 39|Builder fee exceed the limit| + |`BUILDER_ORDER_FEE_NEGATIVE` = 40|Builder fee is below 0| + |`BUILDER_ORDER_BUILDER_NOT_AUTHORIZED` = 41|Builder is not an authorized builder for client| + |`BUILDER_ORDER_BUILDER_NOT_EXIST` = 42|Builder does not exist| diff --git a/artifacts/apidocs/schemas/order_state.md b/artifacts/apidocs/schemas/order_state.md index 30a2154..6047688 100644 --- a/artifacts/apidocs/schemas/order_state.md +++ b/artifacts/apidocs/schemas/order_state.md @@ -57,3 +57,7 @@ |`INVALID_ORDER_TYPE` = 36|the order type is invalid| |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined| |`INVALID_CHAIN_ID` = 38|the chain ID is invalid| + |`BUILDER_ORDER_FEE_EXCEED` = 39|Builder fee exceed the limit| + |`BUILDER_ORDER_FEE_NEGATIVE` = 40|Builder fee is below 0| + |`BUILDER_ORDER_BUILDER_NOT_AUTHORIZED` = 41|Builder is not an authorized builder for client| + |`BUILDER_ORDER_BUILDER_NOT_EXIST` = 42|Builder does not exist| diff --git a/artifacts/apidocs/schemas/order_state_feed.md b/artifacts/apidocs/schemas/order_state_feed.md index e9beafd..cd2ffed 100644 --- a/artifacts/apidocs/schemas/order_state_feed.md +++ b/artifacts/apidocs/schemas/order_state_feed.md @@ -63,3 +63,7 @@ |`INVALID_ORDER_TYPE` = 36|the order type is invalid| |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined| |`INVALID_CHAIN_ID` = 38|the chain ID is invalid| + |`BUILDER_ORDER_FEE_EXCEED` = 39|Builder fee exceed the limit| + |`BUILDER_ORDER_FEE_NEGATIVE` = 40|Builder fee is below 0| + |`BUILDER_ORDER_BUILDER_NOT_AUTHORIZED` = 41|Builder is not an authorized builder for client| + |`BUILDER_ORDER_BUILDER_NOT_EXIST` = 42|Builder does not exist| diff --git a/artifacts/apidocs/schemas/position_margin_type.md b/artifacts/apidocs/schemas/position_margin_type.md new file mode 100644 index 0000000..7fe441f --- /dev/null +++ b/artifacts/apidocs/schemas/position_margin_type.md @@ -0,0 +1,5 @@ +!!! info "[PositionMarginType](/../../schemas/position_margin_type)" + |Value| Description | + |-|-| + |`ISOLATED` = 1|Isolated Margin Mode: each position is allocated a fixed amount of collateral| + |`CROSS` = 2|Cross Margin Mode: uses all available funds in your account as collateral across all cross margin positions| diff --git a/artifacts/apidocs/schemas/positions.md b/artifacts/apidocs/schemas/positions.md index 589ab70..ad2f6dc 100644 --- a/artifacts/apidocs/schemas/positions.md +++ b/artifacts/apidocs/schemas/positions.md @@ -18,3 +18,12 @@ |leverage
`l` |string|True|The current leverage value for this position| |cumulative_fee
`cf` |string|True|The cumulative fee paid on the position, expressed in quote asset decimal units| |cumulative_realized_funding_payment
`cr` |string|True|The cumulative realized funding payment of the position, expressed in quote asset decimal units. Positive if paid, negative if received| + |margin_type
`mt` |PositionMarginType|True|The margin type of the position| + |isolated_balance
`ib` |string|False
`None`|[IsolatedOnly] The wallet balance reserved for this isolated margin position, expressed in quote asset decimal units. If this positions is liquidated, this is the maximal balance that can be lost| + |isolated_im
`ii` |string|False
`None`|[IsolatedOnly] The initial margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to open more size in the position| + |isolated_mm
`im` |string|False
`None`|[IsolatedOnly] The maintenance margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to avoid liquidation of the position| + ??? info "[PositionMarginType](/../../schemas/position_margin_type)" + |Value| Description | + |-|-| + |`ISOLATED` = 1|Isolated Margin Mode: each position is allocated a fixed amount of collateral| + |`CROSS` = 2|Cross Margin Mode: uses all available funds in your account as collateral across all cross margin positions| diff --git a/artifacts/apidocs/schemas/sub_account.md b/artifacts/apidocs/schemas/sub_account.md index e5dba25..e80dcf0 100644 --- a/artifacts/apidocs/schemas/sub_account.md +++ b/artifacts/apidocs/schemas/sub_account.md @@ -50,3 +50,12 @@ |leverage
`l` |string|True|The current leverage value for this position| |cumulative_fee
`cf` |string|True|The cumulative fee paid on the position, expressed in quote asset decimal units| |cumulative_realized_funding_payment
`cr` |string|True|The cumulative realized funding payment of the position, expressed in quote asset decimal units. Positive if paid, negative if received| + |margin_type
`mt` |PositionMarginType|True|The margin type of the position| + |isolated_balance
`ib` |string|False
`None`|[IsolatedOnly] The wallet balance reserved for this isolated margin position, expressed in quote asset decimal units. If this positions is liquidated, this is the maximal balance that can be lost| + |isolated_im
`ii` |string|False
`None`|[IsolatedOnly] The initial margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to open more size in the position| + |isolated_mm
`im` |string|False
`None`|[IsolatedOnly] The maintenance margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to avoid liquidation of the position| + ??? info "[PositionMarginType](/../../schemas/position_margin_type)" + |Value| Description | + |-|-| + |`ISOLATED` = 1|Isolated Margin Mode: each position is allocated a fixed amount of collateral| + |`CROSS` = 2|Cross Margin Mode: uses all available funds in your account as collateral across all cross margin positions| diff --git a/artifacts/apidocs/schemas/ws_cancel_feed_data_v1.md b/artifacts/apidocs/schemas/ws_cancel_feed_data_v1.md index b485507..6c1eed0 100644 --- a/artifacts/apidocs/schemas/ws_cancel_feed_data_v1.md +++ b/artifacts/apidocs/schemas/ws_cancel_feed_data_v1.md @@ -56,6 +56,10 @@ |`INVALID_ORDER_TYPE` = 36|the order type is invalid| |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined| |`INVALID_CHAIN_ID` = 38|the chain ID is invalid| + |`BUILDER_ORDER_FEE_EXCEED` = 39|Builder fee exceed the limit| + |`BUILDER_ORDER_FEE_NEGATIVE` = 40|Builder fee is below 0| + |`BUILDER_ORDER_BUILDER_NOT_AUTHORIZED` = 41|Builder is not an authorized builder for client| + |`BUILDER_ORDER_BUILDER_NOT_EXIST` = 42|Builder does not exist| ??? 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 c2b42f1..debbffd 100644 --- a/artifacts/apidocs/schemas/ws_fill_feed_data_v1.md +++ b/artifacts/apidocs/schemas/ws_fill_feed_data_v1.md @@ -25,10 +25,14 @@ |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`.| |order_id
`oi` |string|True|An order identifier| |venue
`v` |Venue|True|The venue where the trade occurred| + |is_liquidation
`il` |boolean|True|If the trade was a liquidation| |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| + |builder
`b1` |string|True|The main account ID of the builder. referred to Order.builder| + |builder_fee_rate
`bf` |string|True|Builder fee percentage charged for this order. referred to Order.builder builderFee | + |builder_fee
`bf1` |string|True|The builder fee paid on the trade, expressed in quote asset decimal unit. referred to Trade.builderFee| ??? 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 7b47e58..efafaa7 100644 --- a/artifacts/apidocs/schemas/ws_order_feed_data_v1.md +++ b/artifacts/apidocs/schemas/ws_order_feed_data_v1.md @@ -20,6 +20,8 @@ |signature
`s` |Signature|True|The signature approving this order| |metadata
`m` |OrderMetadata|True|Order Metadata, ignored by the smart contract, and unsigned by the client| |state
`s1` |OrderState|False
`''`|[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client| + |builder
`b` |string|True|The main account ID of the builder| + |builder_fee
`bf` |string|True|Builder fee charged for this order, expressed as a percentage (e.g., 0.001 means 0.001%). | ??? info "[TimeInForce](/../../schemas/time_in_force)" | | Must Fill All | Can Fill Partial | | - | - | - | @@ -161,3 +163,7 @@ |`INVALID_ORDER_TYPE` = 36|the order type is invalid| |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined| |`INVALID_CHAIN_ID` = 38|the chain ID is invalid| + |`BUILDER_ORDER_FEE_EXCEED` = 39|Builder fee exceed the limit| + |`BUILDER_ORDER_FEE_NEGATIVE` = 40|Builder fee is below 0| + |`BUILDER_ORDER_BUILDER_NOT_AUTHORIZED` = 41|Builder is not an authorized builder for client| + |`BUILDER_ORDER_BUILDER_NOT_EXIST` = 42|Builder does not exist| 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 02782b0..13be9ef 100644 --- a/artifacts/apidocs/schemas/ws_order_state_feed_data_v1.md +++ b/artifacts/apidocs/schemas/ws_order_state_feed_data_v1.md @@ -70,3 +70,7 @@ |`INVALID_ORDER_TYPE` = 36|the order type is invalid| |`CURRENCY_NOT_DEFINED` = 37|the currency is not defined| |`INVALID_CHAIN_ID` = 38|the chain ID is invalid| + |`BUILDER_ORDER_FEE_EXCEED` = 39|Builder fee exceed the limit| + |`BUILDER_ORDER_FEE_NEGATIVE` = 40|Builder fee is below 0| + |`BUILDER_ORDER_BUILDER_NOT_AUTHORIZED` = 41|Builder is not an authorized builder for client| + |`BUILDER_ORDER_BUILDER_NOT_EXIST` = 42|Builder does not exist| diff --git a/artifacts/apidocs/schemas/ws_positions_feed_data_v1.md b/artifacts/apidocs/schemas/ws_positions_feed_data_v1.md index b8e7814..062dbe0 100644 --- a/artifacts/apidocs/schemas/ws_positions_feed_data_v1.md +++ b/artifacts/apidocs/schemas/ws_positions_feed_data_v1.md @@ -25,3 +25,12 @@ |leverage
`l` |string|True|The current leverage value for this position| |cumulative_fee
`cf` |string|True|The cumulative fee paid on the position, expressed in quote asset decimal units| |cumulative_realized_funding_payment
`cr` |string|True|The cumulative realized funding payment of the position, expressed in quote asset decimal units. Positive if paid, negative if received| + |margin_type
`mt` |PositionMarginType|True|The margin type of the position| + |isolated_balance
`ib` |string|False
`None`|[IsolatedOnly] The wallet balance reserved for this isolated margin position, expressed in quote asset decimal units. If this positions is liquidated, this is the maximal balance that can be lost| + |isolated_im
`ii` |string|False
`None`|[IsolatedOnly] The initial margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to open more size in the position| + |isolated_mm
`im` |string|False
`None`|[IsolatedOnly] The maintenance margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to avoid liquidation of the position| + ??? info "[PositionMarginType](/../../schemas/position_margin_type)" + |Value| Description | + |-|-| + |`ISOLATED` = 1|Isolated Margin Mode: each position is allocated a fixed amount of collateral| + |`CROSS` = 2|Cross Margin Mode: uses all available funds in your account as collateral across all cross margin positions| diff --git a/artifacts/apidocs/trading_api.md b/artifacts/apidocs/trading_api.md index 3cb9d28..d6a0df8 100644 --- a/artifacts/apidocs/trading_api.md +++ b/artifacts/apidocs/trading_api.md @@ -50,7 +50,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "broker": "BROKER_CODE" - } + }, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee": 0.001 } } ``` @@ -90,7 +92,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "b": "BROKER_CODE" - } + }, + "b": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001 } } ``` @@ -146,7 +150,9 @@ LITE ENDPOINT: lite/v1/create_order "traded_size": ["1.5"], "update_time": "1697788800000000000", "avg_fill_price": ["60000.4"] - } + }, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee": 0.001 } } ``` @@ -195,7 +201,9 @@ LITE ENDPOINT: lite/v1/create_order "ts": ["1.5"], "ut": "1697788800000000000", "af": ["60000.4"] - } + }, + "b": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001 } } ``` @@ -243,6 +251,8 @@ LITE ENDPOINT: lite/v1/create_order |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| + |2066|400|Order notional value is below minimum requirement| + |2067|400|Orders below the minimum notional are only allowed when closing positions that are also below the minimum| |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| @@ -328,7 +338,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "broker": "BROKER_CODE" - } + }, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee": 0.001 } } ' @@ -376,7 +388,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "broker": "BROKER_CODE" - } + }, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee": 0.001 } }, "id": 123 @@ -424,7 +438,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "b": "BROKER_CODE" - } + }, + "b": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001 } } ' @@ -472,7 +488,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "b": "BROKER_CODE" - } + }, + "b": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001 } }, "i": 123 @@ -521,7 +539,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "broker": "BROKER_CODE" - } + }, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee": 0.001 } } ' @@ -569,7 +589,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "broker": "BROKER_CODE" - } + }, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee": 0.001 } }, "id": 123 @@ -617,7 +639,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "b": "BROKER_CODE" - } + }, + "b": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001 } } ' @@ -665,7 +689,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "b": "BROKER_CODE" - } + }, + "b": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001 } }, "i": 123 @@ -714,7 +740,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "broker": "BROKER_CODE" - } + }, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee": 0.001 } } ' @@ -762,7 +790,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "broker": "BROKER_CODE" - } + }, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee": 0.001 } }, "id": 123 @@ -810,7 +840,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "b": "BROKER_CODE" - } + }, + "b": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001 } } ' @@ -858,7 +890,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "b": "BROKER_CODE" - } + }, + "b": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001 } }, "i": 123 @@ -907,7 +941,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "broker": "BROKER_CODE" - } + }, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee": 0.001 } } ' @@ -955,7 +991,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "broker": "BROKER_CODE" - } + }, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee": 0.001 } }, "id": 123 @@ -1003,7 +1041,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "b": "BROKER_CODE" - } + }, + "b": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001 } } ' @@ -1051,7 +1091,9 @@ LITE ENDPOINT: lite/v1/create_order } }, "b": "BROKER_CODE" - } + }, + "b": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001 } }, "i": 123 @@ -1875,7 +1917,9 @@ LITE ENDPOINT: lite/v1/order "traded_size": ["1.5"], "update_time": "1697788800000000000", "avg_fill_price": ["60000.4"] - } + }, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee": 0.001 } } ``` @@ -1924,7 +1968,9 @@ LITE ENDPOINT: lite/v1/order "ts": ["1.5"], "ut": "1697788800000000000", "af": ["60000.4"] - } + }, + "b": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001 } } ``` @@ -2309,7 +2355,9 @@ LITE ENDPOINT: lite/v1/open_orders "traded_size": ["1.5"], "update_time": "1697788800000000000", "avg_fill_price": ["60000.4"] - } + }, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee": 0.001 }] } ``` @@ -2358,7 +2406,9 @@ LITE ENDPOINT: lite/v1/open_orders "ts": ["1.5"], "ut": "1697788800000000000", "af": ["60000.4"] - } + }, + "b": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001 }] } ``` @@ -2765,7 +2815,9 @@ LITE ENDPOINT: lite/v1/order_history "traded_size": ["1.5"], "update_time": "1697788800000000000", "avg_fill_price": ["60000.4"] - } + }, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee": 0.001 }], "next": "Qw0918=" } @@ -2815,7 +2867,9 @@ LITE ENDPOINT: lite/v1/order_history "ts": ["1.5"], "ut": "1697788800000000000", "af": ["60000.4"] - } + }, + "b": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001 }], "n": "Qw0918=" } @@ -3595,10 +3649,14 @@ LITE ENDPOINT: lite/v1/fill_history "trade_id": "209358-2", "order_id": "0x10000101000203040506", "venue": "ORDERBOOK", + "is_liquidation": false, "client_order_id": "23042", "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "broker": "UNSPECIFIED", - "is_rpi": false + "is_rpi": false, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee_rate": 0.001, + "builder_fee": "0.2" }], "next": "Qw0918=" } @@ -3624,10 +3682,14 @@ LITE ENDPOINT: lite/v1/fill_history "ti": "209358-2", "oi": "0x10000101000203040506", "v": "ORDERBOOK", + "il": false, "co": "23042", "s1": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "b": "UNSPECIFIED", - "ir1": false + "ir1": false, + "b1": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001, + "bf1": "0.2" }], "n": "Qw0918=" } @@ -4009,15 +4071,15 @@ LITE ENDPOINT: lite/v1/fill_history ```
-### Positions +### Funding Payment History ``` -FULL ENDPOINT: full/v1/positions -LITE ENDPOINT: lite/v1/positions +FULL ENDPOINT: full/v1/funding_payment_history +LITE ENDPOINT: lite/v1/funding_payment_history ``` === "Request"
- -8<- "docs/schemas/api_positions_request.md" + -8<- "docs/schemas/api_funding_payment_history_request.md"
!!! question "Query" @@ -4025,6 +4087,11 @@ LITE ENDPOINT: lite/v1/positions ``` { .json .copy } { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", "kind": ["PERPETUAL"], "base": ["BTC", "ETH"], "quote": ["USDT", "USDC"] @@ -4034,6 +4101,11 @@ LITE ENDPOINT: lite/v1/positions ``` { .json .copy } { "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "", "k": ["PERPETUAL"], "b": ["BTC", "ETH"], "q": ["USDT", "USDC"] @@ -4042,7 +4114,7 @@ LITE ENDPOINT: lite/v1/positions
=== "Response"
- -8<- "docs/schemas/api_positions_response.md" + -8<- "docs/schemas/api_funding_payment_history_response.md"
!!! success @@ -4053,21 +4125,11 @@ LITE ENDPOINT: lite/v1/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", - "cumulative_fee": "100000.20", - "cumulative_realized_funding_payment": "100000.20" - }] + "currency": "USDT", + "amount": "9.75", + "tx_id": "209358" + }], + "next": "Qw0918=" } ``` **Lite Response** @@ -4077,21 +4139,11 @@ LITE ENDPOINT: lite/v1/positions "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", - "cf": "100000.20", - "cr": "100000.20" - }] + "c": "USDT", + "a": "9.75", + "ti": "209358" + }], + "n": "Qw0918=" } ```
@@ -4134,11 +4186,16 @@ 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/funding_payment_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", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", "kind": ["PERPETUAL"], "base": ["BTC", "ETH"], "quote": ["USDT", "USDC"] @@ -4153,9 +4210,14 @@ LITE ENDPOINT: lite/v1/positions -x ' { "jsonrpc": "2.0", - "method": "v1/positions", + "method": "v1/funding_payment_history", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", "kind": ["PERPETUAL"], "base": ["BTC", "ETH"], "quote": ["USDT", "USDC"] @@ -4168,11 +4230,16 @@ 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/funding_payment_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "", "k": ["PERPETUAL"], "b": ["BTC", "ETH"], "q": ["USDT", "USDC"] @@ -4187,9 +4254,14 @@ LITE ENDPOINT: lite/v1/positions -x ' { "j": "2.0", - "m": "v1/positions", + "m": "v1/funding_payment_history", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "", "k": ["PERPETUAL"], "b": ["BTC", "ETH"], "q": ["USDT", "USDC"] @@ -4203,11 +4275,16 @@ 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/funding_payment_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", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", "kind": ["PERPETUAL"], "base": ["BTC", "ETH"], "quote": ["USDT", "USDC"] @@ -4222,9 +4299,14 @@ LITE ENDPOINT: lite/v1/positions -x ' { "jsonrpc": "2.0", - "method": "v1/positions", + "method": "v1/funding_payment_history", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", "kind": ["PERPETUAL"], "base": ["BTC", "ETH"], "quote": ["USDT", "USDC"] @@ -4237,11 +4319,16 @@ 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/funding_payment_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "", "k": ["PERPETUAL"], "b": ["BTC", "ETH"], "q": ["USDT", "USDC"] @@ -4256,9 +4343,14 @@ LITE ENDPOINT: lite/v1/positions -x ' { "j": "2.0", - "m": "v1/positions", + "m": "v1/funding_payment_history", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "", "k": ["PERPETUAL"], "b": ["BTC", "ETH"], "q": ["USDT", "USDC"] @@ -4272,11 +4364,16 @@ 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/funding_payment_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", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", "kind": ["PERPETUAL"], "base": ["BTC", "ETH"], "quote": ["USDT", "USDC"] @@ -4291,9 +4388,14 @@ LITE ENDPOINT: lite/v1/positions -x ' { "jsonrpc": "2.0", - "method": "v1/positions", + "method": "v1/funding_payment_history", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", "kind": ["PERPETUAL"], "base": ["BTC", "ETH"], "quote": ["USDT", "USDC"] @@ -4306,11 +4408,16 @@ 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/funding_payment_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "", "k": ["PERPETUAL"], "b": ["BTC", "ETH"], "q": ["USDT", "USDC"] @@ -4325,9 +4432,14 @@ LITE ENDPOINT: lite/v1/positions -x ' { "j": "2.0", - "m": "v1/positions", + "m": "v1/funding_payment_history", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "", "k": ["PERPETUAL"], "b": ["BTC", "ETH"], "q": ["USDT", "USDC"] @@ -4341,11 +4453,16 @@ 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/funding_payment_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", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", "kind": ["PERPETUAL"], "base": ["BTC", "ETH"], "quote": ["USDT", "USDC"] @@ -4360,9 +4477,14 @@ LITE ENDPOINT: lite/v1/positions -x ' { "jsonrpc": "2.0", - "method": "v1/positions", + "method": "v1/funding_payment_history", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", "kind": ["PERPETUAL"], "base": ["BTC", "ETH"], "quote": ["USDT", "USDC"] @@ -4375,11 +4497,16 @@ 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/funding_payment_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "", "k": ["PERPETUAL"], "b": ["BTC", "ETH"], "q": ["USDT", "USDC"] @@ -4394,9 +4521,14 @@ LITE ENDPOINT: lite/v1/positions -x ' { "j": "2.0", - "m": "v1/positions", + "m": "v1/funding_payment_history", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "", "k": ["PERPETUAL"], "b": ["BTC", "ETH"], "q": ["USDT", "USDC"] @@ -4407,15 +4539,16 @@ LITE ENDPOINT: lite/v1/positions ```

-### Funding Payment History +## Position +### Positions ``` -FULL ENDPOINT: full/v1/funding_payment_history -LITE ENDPOINT: lite/v1/funding_payment_history +FULL ENDPOINT: full/v1/positions +LITE ENDPOINT: lite/v1/positions ``` === "Request"
- -8<- "docs/schemas/api_funding_payment_history_request.md" + -8<- "docs/schemas/api_positions_request.md"
!!! question "Query" @@ -4423,28 +4556,24 @@ LITE ENDPOINT: lite/v1/funding_payment_history ``` { .json .copy } { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] } ``` **Lite Request** ``` { .json .copy } { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] } ```
=== "Response"
- -8<- "docs/schemas/api_funding_payment_history_response.md" + -8<- "docs/schemas/api_positions_response.md"
!!! success @@ -4455,25 +4584,53 @@ 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" - }], - "next": "Qw0918=" - } - ``` - **Lite Response** - ``` { .json .copy } - { - "r": [{ - "et": "1697788800000000000", - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "c": "USDT", - "a": "9.75", - "ti": "209358" - }], - "n": "Qw0918=" + "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", + "cumulative_fee": "100000.20", + "cumulative_realized_funding_payment": "100000.20", + "margin_type": "cross", + "isolated_balance": "100000.20", + "isolated_im": "100000.20", + "isolated_mm": "100000.20" + }] + } + ``` + **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", + "cf": "100000.20", + "cr": "100000.20", + "mt": "cross", + "ib": "100000.20", + "ii": "100000.20", + "im": "100000.20" + }] } ```
@@ -4516,16 +4673,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/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] } ' ``` @@ -4537,14 +4692,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "jsonrpc": "2.0", - "method": "v1/funding_payment_history", + "method": "v1/positions", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] }, "id": 123 } @@ -4554,16 +4707,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/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] } ' ``` @@ -4575,14 +4726,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "j": "2.0", - "m": "v1/funding_payment_history", + "m": "v1/positions", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] }, "i": 123 } @@ -4593,16 +4742,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/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] } ' ``` @@ -4614,14 +4761,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "jsonrpc": "2.0", - "method": "v1/funding_payment_history", + "method": "v1/positions", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] }, "id": 123 } @@ -4631,16 +4776,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/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] } ' ``` @@ -4652,14 +4795,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "j": "2.0", - "m": "v1/funding_payment_history", + "m": "v1/positions", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] }, "i": 123 } @@ -4670,16 +4811,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/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] } ' ``` @@ -4691,14 +4830,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "jsonrpc": "2.0", - "method": "v1/funding_payment_history", + "method": "v1/positions", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] }, "id": 123 } @@ -4708,16 +4845,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/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] } ' ``` @@ -4729,14 +4864,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "j": "2.0", - "m": "v1/funding_payment_history", + "m": "v1/positions", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] }, "i": 123 } @@ -4747,16 +4880,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/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] } ' ``` @@ -4768,14 +4899,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "jsonrpc": "2.0", - "method": "v1/funding_payment_history", + "method": "v1/positions", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "kind": ["PERPETUAL"], + "base": ["BTC", "ETH"], + "quote": ["USDT", "USDC"] }, "id": 123 } @@ -4785,16 +4914,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/positions' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] } ' ``` @@ -4806,14 +4933,12 @@ LITE ENDPOINT: lite/v1/funding_payment_history -x ' { "j": "2.0", - "m": "v1/funding_payment_history", + "m": "v1/positions", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "k": ["PERPETUAL"], + "b": ["BTC", "ETH"], + "q": ["USDT", "USDC"] }, "i": 123 } @@ -4821,78 +4946,71 @@ LITE ENDPOINT: lite/v1/funding_payment_history ```

-## Transfer -### Deposit History +### Set Position Config ``` -FULL ENDPOINT: full/v1/deposit_history -LITE ENDPOINT: lite/v1/deposit_history +FULL ENDPOINT: full/v1/set_position_config +LITE ENDPOINT: lite/v1/set_position_config ``` === "Request"
- -8<- "docs/schemas/api_deposit_history_request.md" + -8<- "docs/schemas/api_set_sub_account_position_margin_config_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'", + "instrument": "BTC_USDT_Perp", + "margin_type": "ISOLATED", + "leverage": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ``` **Lite Request** ``` { .json .copy } { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "mt": "ISOLATED", + "l": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ```
=== "Response"
- -8<- "docs/schemas/api_deposit_history_response.md" + -8<- "docs/schemas/api_set_sub_account_position_margin_config_response.md"
!!! success **Full Response** ``` { .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=" + "ack": "true" } ``` **Lite Response** ``` { .json .copy } { - "r": [{ - "l1": "0x10000101000203040506", - "l2": "0x10000101000203040506", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "c": "USDT", - "nt": "1500.0", - "it": "1697788800000000000", - "ct": "1697788800000000000", - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0" - }], - "n": "Qw0918=" + "a": "true" } ```
@@ -4906,7 +5024,15 @@ LITE ENDPOINT: lite/v1/deposit_history |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| + |2102|400|Margin type change failed, has open position for this instrument| + |2103|400|Margin type change failed, has open orders for this instrument| + |2101|400|Vaults cannot configure leverage| + |2104|400|Margin type not supported| + |2105|400|Margin type change failed| + |2100|400|Invalid initial leverage| + |2107|400|Attempted to set leverage below minimum| + |2108|400|Attempted to set leverage above maximum|
!!! failure @@ -4935,16 +5061,23 @@ 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/set_position_config' \ --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'", + "instrument": "BTC_USDT_Perp", + "margin_type": "ISOLATED", + "leverage": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -4956,14 +5089,21 @@ LITE ENDPOINT: lite/v1/deposit_history -x ' { "jsonrpc": "2.0", - "method": "v1/deposit_history", + "method": "v1/set_position_config", "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "margin_type": "ISOLATED", + "leverage": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } }, "id": 123 } @@ -4973,16 +5113,23 @@ 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/set_position_config' \ --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'", + "i": "BTC_USDT_Perp", + "mt": "ISOLATED", + "l": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -4994,14 +5141,21 @@ LITE ENDPOINT: lite/v1/deposit_history -x ' { "j": "2.0", - "m": "v1/deposit_history", + "m": "v1/set_position_config", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "mt": "ISOLATED", + "l": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -5012,16 +5166,23 @@ 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/set_position_config' \ --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'", + "instrument": "BTC_USDT_Perp", + "margin_type": "ISOLATED", + "leverage": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -5033,14 +5194,21 @@ LITE ENDPOINT: lite/v1/deposit_history -x ' { "jsonrpc": "2.0", - "method": "v1/deposit_history", + "method": "v1/set_position_config", "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "margin_type": "ISOLATED", + "leverage": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } }, "id": 123 } @@ -5050,16 +5218,23 @@ 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/set_position_config' \ --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'", + "i": "BTC_USDT_Perp", + "mt": "ISOLATED", + "l": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -5071,14 +5246,21 @@ LITE ENDPOINT: lite/v1/deposit_history -x ' { "j": "2.0", - "m": "v1/deposit_history", + "m": "v1/set_position_config", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "mt": "ISOLATED", + "l": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -5089,16 +5271,23 @@ 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/set_position_config' \ --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'", + "instrument": "BTC_USDT_Perp", + "margin_type": "ISOLATED", + "leverage": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -5110,14 +5299,21 @@ LITE ENDPOINT: lite/v1/deposit_history -x ' { "jsonrpc": "2.0", - "method": "v1/deposit_history", + "method": "v1/set_position_config", "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "margin_type": "ISOLATED", + "leverage": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } }, "id": 123 } @@ -5127,16 +5323,23 @@ 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/set_position_config' \ --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'", + "i": "BTC_USDT_Perp", + "mt": "ISOLATED", + "l": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -5148,14 +5351,21 @@ LITE ENDPOINT: lite/v1/deposit_history -x ' { "j": "2.0", - "m": "v1/deposit_history", + "m": "v1/set_position_config", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "mt": "ISOLATED", + "l": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -5166,16 +5376,23 @@ 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/set_position_config' \ --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'", + "instrument": "BTC_USDT_Perp", + "margin_type": "ISOLATED", + "leverage": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -5187,33 +5404,47 @@ LITE ENDPOINT: lite/v1/deposit_history -x ' { "jsonrpc": "2.0", - "method": "v1/deposit_history", + "method": "v1/set_position_config", "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null - }, - "id": 123 - } - ' -w 360 - ``` -
+ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "margin_type": "ISOLATED", + "leverage": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } + }, + "id": 123 + } + ' -w 360 + ``` +
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/deposit_history' \ + curl --location 'https://trades.grvt.io/lite/v1/set_position_config' \ --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'", + "i": "BTC_USDT_Perp", + "mt": "ISOLATED", + "l": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -5225,14 +5456,21 @@ LITE ENDPOINT: lite/v1/deposit_history -x ' { "j": "2.0", - "m": "v1/deposit_history", + "m": "v1/set_position_config", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "mt": "ISOLATED", + "l": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -5240,27 +5478,24 @@ LITE ENDPOINT: lite/v1/deposit_history ```

-### Transfer +### Add Position Margin ``` -FULL ENDPOINT: full/v1/transfer -LITE ENDPOINT: lite/v1/transfer +FULL ENDPOINT: full/v1/add_position_margin +LITE ENDPOINT: lite/v1/add_position_margin ``` === "Request"
- -8<- "docs/schemas/api_transfer_request.md" + -8<- "docs/schemas/api_add_isolated_position_margin_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", + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "amount": "123456.78", "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5269,20 +5504,15 @@ LITE ENDPOINT: lite/v1/transfer "expiration": "1697788800000000000", "nonce": 1234567890, "chain_id": "325" - }, - "transfer_type": "UNSPECIFIED", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } } ``` **Lite Request** ``` { .json .copy } { - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", - "c": "USDT", - "nt": "1500.0", + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "a": "123456.78", "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5291,34 +5521,26 @@ LITE ENDPOINT: lite/v1/transfer "e": "1697788800000000000", "n": 1234567890, "ci": "325" - }, - "tt": "UNSPECIFIED", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } } ```
=== "Response"
- -8<- "docs/schemas/api_transfer_response.md" + -8<- "docs/schemas/api_add_isolated_position_margin_response.md"
!!! success **Full Response** ``` { .json .copy } { - "result": { - "ack": "true", - "tx_id": "1028403" - } + "success": "true" } ``` **Lite Response** ``` { .json .copy } { - "r": { - "a": "true", - "ti": "1028403" - } + "s": "true" } ```
@@ -5332,18 +5554,12 @@ LITE ENDPOINT: lite/v1/transfer |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| - |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.| - |7100|500|Unknown transaction type| - |7101|400|Transfer account not found| - |7102|400|Transfer sub-account not found| - |7103|500|Charged trading fee below the config minimum| + |1004|404|Data Not Found| + |7450|400|Add margin failed| + |7451|400|Add margin to empty position| + |7452|400|Add margin to non isolated position| + |7453|400|Max addable amount exceeded| + |7454|400|Max removable amount exceeded|
!!! failure @@ -5372,16 +5588,13 @@ 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/add_position_margin' \ --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", + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "amount": "123456.78", "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5390,9 +5603,7 @@ LITE ENDPOINT: lite/v1/transfer "expiration": "1697788800000000000", "nonce": 1234567890, "chain_id": "325" - }, - "transfer_type": "UNSPECIFIED", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } } ' ``` @@ -5404,14 +5615,11 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "jsonrpc": "2.0", - "method": "v1/transfer", + "method": "v1/add_position_margin", "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", + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "amount": "123456.78", "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5420,9 +5628,7 @@ LITE ENDPOINT: lite/v1/transfer "expiration": "1697788800000000000", "nonce": 1234567890, "chain_id": "325" - }, - "transfer_type": "UNSPECIFIED", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } }, "id": 123 } @@ -5432,16 +5638,13 @@ 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/add_position_margin' \ --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", + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "a": "123456.78", "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5450,9 +5653,7 @@ LITE ENDPOINT: lite/v1/transfer "e": "1697788800000000000", "n": 1234567890, "ci": "325" - }, - "tt": "UNSPECIFIED", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } } ' ``` @@ -5464,14 +5665,11 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "j": "2.0", - "m": "v1/transfer", + "m": "v1/add_position_margin", "p": { - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", - "c": "USDT", - "nt": "1500.0", + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "a": "123456.78", "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5480,9 +5678,7 @@ LITE ENDPOINT: lite/v1/transfer "e": "1697788800000000000", "n": 1234567890, "ci": "325" - }, - "tt": "UNSPECIFIED", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } }, "i": 123 } @@ -5493,16 +5689,13 @@ 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/add_position_margin' \ --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", + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "amount": "123456.78", "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5511,9 +5704,7 @@ LITE ENDPOINT: lite/v1/transfer "expiration": "1697788800000000000", "nonce": 1234567890, "chain_id": "325" - }, - "transfer_type": "UNSPECIFIED", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } } ' ``` @@ -5525,14 +5716,11 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "jsonrpc": "2.0", - "method": "v1/transfer", + "method": "v1/add_position_margin", "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", + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "amount": "123456.78", "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5541,9 +5729,7 @@ LITE ENDPOINT: lite/v1/transfer "expiration": "1697788800000000000", "nonce": 1234567890, "chain_id": "325" - }, - "transfer_type": "UNSPECIFIED", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } }, "id": 123 } @@ -5553,16 +5739,13 @@ 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/add_position_margin' \ --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", + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "a": "123456.78", "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5571,9 +5754,7 @@ LITE ENDPOINT: lite/v1/transfer "e": "1697788800000000000", "n": 1234567890, "ci": "325" - }, - "tt": "UNSPECIFIED", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } } ' ``` @@ -5585,14 +5766,11 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "j": "2.0", - "m": "v1/transfer", + "m": "v1/add_position_margin", "p": { - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", - "c": "USDT", - "nt": "1500.0", + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "a": "123456.78", "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5601,9 +5779,7 @@ LITE ENDPOINT: lite/v1/transfer "e": "1697788800000000000", "n": 1234567890, "ci": "325" - }, - "tt": "UNSPECIFIED", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } }, "i": 123 } @@ -5614,16 +5790,13 @@ 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/add_position_margin' \ --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", + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "amount": "123456.78", "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5632,9 +5805,7 @@ LITE ENDPOINT: lite/v1/transfer "expiration": "1697788800000000000", "nonce": 1234567890, "chain_id": "325" - }, - "transfer_type": "UNSPECIFIED", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } } ' ``` @@ -5646,14 +5817,11 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "jsonrpc": "2.0", - "method": "v1/transfer", + "method": "v1/add_position_margin", "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", + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "amount": "123456.78", "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5662,9 +5830,7 @@ LITE ENDPOINT: lite/v1/transfer "expiration": "1697788800000000000", "nonce": 1234567890, "chain_id": "325" - }, - "transfer_type": "UNSPECIFIED", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } }, "id": 123 } @@ -5674,16 +5840,13 @@ 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/add_position_margin' \ --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", + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "a": "123456.78", "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5692,9 +5855,7 @@ LITE ENDPOINT: lite/v1/transfer "e": "1697788800000000000", "n": 1234567890, "ci": "325" - }, - "tt": "UNSPECIFIED", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } } ' ``` @@ -5706,15 +5867,12 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "j": "2.0", - "m": "v1/transfer", + "m": "v1/add_position_margin", "p": { - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", - "c": "USDT", - "nt": "1500.0", - "s": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "a": "123456.78", + "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", @@ -5722,9 +5880,7 @@ LITE ENDPOINT: lite/v1/transfer "e": "1697788800000000000", "n": 1234567890, "ci": "325" - }, - "tt": "UNSPECIFIED", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } }, "i": 123 } @@ -5735,16 +5891,13 @@ 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/add_position_margin' \ --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", + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "amount": "123456.78", "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5753,9 +5906,7 @@ LITE ENDPOINT: lite/v1/transfer "expiration": "1697788800000000000", "nonce": 1234567890, "chain_id": "325" - }, - "transfer_type": "UNSPECIFIED", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } } ' ``` @@ -5767,14 +5918,11 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "jsonrpc": "2.0", - "method": "v1/transfer", + "method": "v1/add_position_margin", "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", + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "amount": "123456.78", "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5783,9 +5931,7 @@ LITE ENDPOINT: lite/v1/transfer "expiration": "1697788800000000000", "nonce": 1234567890, "chain_id": "325" - }, - "transfer_type": "UNSPECIFIED", - "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } }, "id": 123 } @@ -5795,16 +5941,13 @@ 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/add_position_margin' \ --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", + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "a": "123456.78", "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5813,9 +5956,7 @@ LITE ENDPOINT: lite/v1/transfer "e": "1697788800000000000", "n": 1234567890, "ci": "325" - }, - "tt": "UNSPECIFIED", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } } ' ``` @@ -5827,14 +5968,11 @@ LITE ENDPOINT: lite/v1/transfer -x ' { "j": "2.0", - "m": "v1/transfer", + "m": "v1/add_position_margin", "p": { - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "fs": "'$GRVT_SUB_ACCOUNT_ID'", - "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "ts": "'$GRVT_SUB_ACCOUNT_ID'", - "c": "USDT", - "nt": "1500.0", + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "a": "123456.78", "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -5843,9 +5981,7 @@ LITE ENDPOINT: lite/v1/transfer "e": "1697788800000000000", "n": 1234567890, "ci": "325" - }, - "tt": "UNSPECIFIED", - "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } }, "i": 123 } @@ -5853,103 +5989,53 @@ LITE ENDPOINT: lite/v1/transfer ```

-### Transfer History +### Get Position Margin Limits ``` -FULL ENDPOINT: full/v1/transfer_history -LITE ENDPOINT: lite/v1/transfer_history +FULL ENDPOINT: full/v1/get_position_margin_limits +LITE ENDPOINT: lite/v1/get_position_margin_limits ``` === "Request"
- -8<- "docs/schemas/api_transfer_history_request.md" + -8<- "docs/schemas/api_get_isolated_position_margin_limits_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "tx_id": "1028403", - "main_account_id": null, - "transfer_types": ["UNSPECIFIED"] + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp" } ``` **Lite Request** ``` { .json .copy } { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ti": "1028403", - "ma": null, - "tt": ["UNSPECIFIED"] + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp" } ```
=== "Response"
- -8<- "docs/schemas/api_transfer_history_response.md" + -8<- "docs/schemas/api_get_isolated_position_margin_limits_response.md"
!!! success **Full Response** ``` { .json .copy } { - "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, - "chain_id": "325" - }, - "event_time": "1697788800000000000", - "transfer_type": "UNSPECIFIED", - "transfer_metadata": null - }], - "next": "Qw0918=" + "instrument": "BTC_USDT_Perp", + "max_addable_amount": "123456.78", + "max_removable_amount": "123456.78" } ``` **Lite Response** ``` { .json .copy } { - "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, - "ci": "325" - }, - "et": "1697788800000000000", - "tt": "UNSPECIFIED", - "tm": null - }], - "n": "Qw0918=" + "i": "BTC_USDT_Perp", + "ma": "123456.78", + "mr": "123456.78" } ```
@@ -5963,7 +6049,8 @@ LITE ENDPOINT: lite/v1/transfer_history |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| + |7455|400|Not isolated margin position|
!!! failure @@ -5992,18 +6079,12 @@ 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/get_position_margin_limits' \ --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": "", - "tx_id": "1028403", - "main_account_id": null, - "transfer_types": ["UNSPECIFIED"] + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp" } ' ``` @@ -6015,16 +6096,10 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "jsonrpc": "2.0", - "method": "v1/transfer_history", + "method": "v1/get_position_margin_limits", "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "tx_id": "1028403", - "main_account_id": null, - "transfer_types": ["UNSPECIFIED"] + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp" }, "id": 123 } @@ -6034,18 +6109,12 @@ 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/get_position_margin_limits' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ti": "1028403", - "ma": null, - "tt": ["UNSPECIFIED"] + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp" } ' ``` @@ -6057,16 +6126,10 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "j": "2.0", - "m": "v1/transfer_history", + "m": "v1/get_position_margin_limits", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ti": "1028403", - "ma": null, - "tt": ["UNSPECIFIED"] + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp" }, "i": 123 } @@ -6077,18 +6140,12 @@ 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/get_position_margin_limits' \ --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": "", - "tx_id": "1028403", - "main_account_id": null, - "transfer_types": ["UNSPECIFIED"] + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp" } ' ``` @@ -6100,16 +6157,10 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "jsonrpc": "2.0", - "method": "v1/transfer_history", + "method": "v1/get_position_margin_limits", "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "tx_id": "1028403", - "main_account_id": null, - "transfer_types": ["UNSPECIFIED"] + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp" }, "id": 123 } @@ -6119,18 +6170,12 @@ 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/get_position_margin_limits' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ti": "1028403", - "ma": null, - "tt": ["UNSPECIFIED"] + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp" } ' ``` @@ -6142,16 +6187,10 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "j": "2.0", - "m": "v1/transfer_history", + "m": "v1/get_position_margin_limits", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ti": "1028403", - "ma": null, - "tt": ["UNSPECIFIED"] + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp" }, "i": 123 } @@ -6162,18 +6201,12 @@ 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/get_position_margin_limits' \ --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": "", - "tx_id": "1028403", - "main_account_id": null, - "transfer_types": ["UNSPECIFIED"] + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp" } ' ``` @@ -6185,16 +6218,10 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "jsonrpc": "2.0", - "method": "v1/transfer_history", + "method": "v1/get_position_margin_limits", "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "tx_id": "1028403", - "main_account_id": null, - "transfer_types": ["UNSPECIFIED"] + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp" }, "id": 123 } @@ -6204,18 +6231,12 @@ 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/get_position_margin_limits' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ti": "1028403", - "ma": null, - "tt": ["UNSPECIFIED"] + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp" } ' ``` @@ -6227,16 +6248,10 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "j": "2.0", - "m": "v1/transfer_history", + "m": "v1/get_position_margin_limits", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ti": "1028403", - "ma": null, - "tt": ["UNSPECIFIED"] + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp" }, "i": 123 } @@ -6247,18 +6262,12 @@ 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/get_position_margin_limits' \ --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": "", - "tx_id": "1028403", - "main_account_id": null, - "transfer_types": ["UNSPECIFIED"] + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp" } ' ``` @@ -6270,16 +6279,10 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "jsonrpc": "2.0", - "method": "v1/transfer_history", + "method": "v1/get_position_margin_limits", "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "tx_id": "1028403", - "main_account_id": null, - "transfer_types": ["UNSPECIFIED"] + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp" }, "id": 123 } @@ -6289,18 +6292,12 @@ 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/get_position_margin_limits' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ti": "1028403", - "ma": null, - "tt": ["UNSPECIFIED"] + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp" } ' ``` @@ -6312,16 +6309,10 @@ LITE ENDPOINT: lite/v1/transfer_history -x ' { "j": "2.0", - "m": "v1/transfer_history", + "m": "v1/get_position_margin_limits", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ti": "1028403", - "ma": null, - "tt": ["UNSPECIFIED"] + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp" }, "i": 123 } @@ -6329,75 +6320,78 @@ LITE ENDPOINT: lite/v1/transfer_history ```

-### Withdrawal +## Transfer +### Deposit History ``` -FULL ENDPOINT: full/v1/withdrawal -LITE ENDPOINT: lite/v1/withdrawal +FULL ENDPOINT: full/v1/deposit_history +LITE ENDPOINT: lite/v1/deposit_history ``` === "Request"
- -8<- "docs/schemas/api_withdrawal_request.md" + -8<- "docs/schemas/api_deposit_history_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "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, - "chain_id": "325" - } + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null } ``` **Lite Request** ``` { .json .copy } { - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null } ```
=== "Response"
- -8<- "docs/schemas/ack_response.md" + -8<- "docs/schemas/api_deposit_history_response.md"
!!! success **Full Response** ``` { .json .copy } { - "result": { - "ack": "true" - } + "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=" } ``` **Lite Response** ``` { .json .copy } { - "r": { - "a": "true" - } + "r": [{ + "l1": "0x10000101000203040506", + "l2": "0x10000101000203040506", + "ta": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "c": "USDT", + "nt": "1500.0", + "it": "1697788800000000000", + "ct": "1697788800000000000", + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0" + }], + "n": "Qw0918=" } ```
@@ -6412,7 +6406,6 @@ 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.|
!!! failure @@ -6441,23 +6434,16 @@ 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/deposit_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "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, - "chain_id": "325" - } + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null } ' ``` @@ -6469,21 +6455,14 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal", + "method": "v1/deposit_history", "params": { - "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, - "chain_id": "325" - } + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null }, "id": 123 } @@ -6493,23 +6472,16 @@ 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/deposit_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null } ' ``` @@ -6521,21 +6493,14 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "j": "2.0", - "m": "v1/withdrawal", + "m": "v1/deposit_history", "p": { - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null }, "i": 123 } @@ -6546,23 +6511,16 @@ 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/deposit_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "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, - "chain_id": "325" - } + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null } ' ``` @@ -6574,21 +6532,14 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal", + "method": "v1/deposit_history", "params": { - "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, - "chain_id": "325" - } + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null }, "id": 123 } @@ -6598,26 +6549,19 @@ 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/deposit_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } - } - ' - ``` + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null + } + ' + ``` !!! example "JSONRPC Lite" ``` { .bash .copy } wscat -c "wss://trades.staging.gravitymarkets.io/ws/lite" \ @@ -6626,21 +6570,14 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "j": "2.0", - "m": "v1/withdrawal", + "m": "v1/deposit_history", "p": { - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null }, "i": 123 } @@ -6651,23 +6588,16 @@ 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/deposit_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "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, - "chain_id": "325" - } + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null } ' ``` @@ -6679,21 +6609,14 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal", + "method": "v1/deposit_history", "params": { - "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, - "chain_id": "325" - } + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null }, "id": 123 } @@ -6703,23 +6626,16 @@ 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/deposit_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null } ' ``` @@ -6731,21 +6647,2943 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "j": "2.0", - "m": "v1/withdrawal", + "m": "v1/deposit_history", "p": { - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null + }, + "i": 123 + } + ' -w 360 + ``` +
+ === "PROD" +
+ !!! example "REST Full" + ``` { .bash .copy } + curl --location 'https://trades.grvt.io/full/v1/deposit_history' \ + --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 + } + ' + ``` + !!! 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/deposit_history", + "params": { + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + curl --location 'https://trades.grvt.io/lite/v1/deposit_history' \ + --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 + } + ' + ``` + !!! 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/deposit_history", + "p": { + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null + }, + "i": 123 + } + ' -w 360 + ``` +
+
+### Transfer +``` +FULL ENDPOINT: full/v1/transfer +LITE ENDPOINT: lite/v1/transfer +``` + +=== "Request" +
+ -8<- "docs/schemas/api_transfer_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, + "chain_id": "325" + }, + "transfer_type": "UNSPECIFIED", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } + ``` + **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, + "ci": "325" + }, + "tt": "UNSPECIFIED", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } + ``` +
+=== "Response" +
+ -8<- "docs/schemas/api_transfer_response.md" +
+
+ !!! success + **Full Response** + ``` { .json .copy } + { + "result": { + "ack": "true", + "tx_id": "1028403" + } + } + ``` + **Lite Response** + ``` { .json .copy } + { + "r": { + "a": "true", + "ti": "1028403" + } + } + ``` +
+=== "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| + |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.| + |7100|500|Unknown transaction type| + |7101|400|Transfer account not found| + |7102|400|Transfer sub-account not found| + |7103|500|Charged trading fee below the config minimum| +
+
+ !!! 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/transfer' \ + --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, + "chain_id": "325" + }, + "transfer_type": "UNSPECIFIED", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } + ' + ``` + !!! 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/transfer", + "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, + "chain_id": "325" + }, + "transfer_type": "UNSPECIFIED", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + 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", + "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, + "ci": "325" + }, + "tt": "UNSPECIFIED", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } + ' + ``` + !!! 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/transfer", + "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, + "ci": "325" + }, + "tt": "UNSPECIFIED", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + }, + "i": 123 + } + ' -w 360 + ``` +
+ === "STAGING" +
+ !!! example "REST Full" + ``` { .bash .copy } + 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", + "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, + "chain_id": "325" + }, + "transfer_type": "UNSPECIFIED", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } + ' + ``` + !!! 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/transfer", + "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, + "chain_id": "325" + }, + "transfer_type": "UNSPECIFIED", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + 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", + "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, + "ci": "325" + }, + "tt": "UNSPECIFIED", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } + ' + ``` + !!! 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/transfer", + "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, + "ci": "325" + }, + "tt": "UNSPECIFIED", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + }, + "i": 123 + } + ' -w 360 + ``` +
+ === "TESTNET" +
+ !!! example "REST Full" + ``` { .bash .copy } + 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", + "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, + "chain_id": "325" + }, + "transfer_type": "UNSPECIFIED", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } + ' + ``` + !!! 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/transfer", + "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, + "chain_id": "325" + }, + "transfer_type": "UNSPECIFIED", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + 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", + "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, + "ci": "325" + }, + "tt": "UNSPECIFIED", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } + ' + ``` + !!! 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/transfer", + "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, + "ci": "325" + }, + "tt": "UNSPECIFIED", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + }, + "i": 123 + } + ' -w 360 + ``` +
+ === "PROD" +
+ !!! example "REST Full" + ``` { .bash .copy } + 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", + "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, + "chain_id": "325" + }, + "transfer_type": "UNSPECIFIED", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } + ' + ``` + !!! 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/transfer", + "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, + "chain_id": "325" + }, + "transfer_type": "UNSPECIFIED", + "transfer_metadata": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + curl --location 'https://trades.grvt.io/lite/v1/transfer' \ + --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, + "ci": "325" + }, + "tt": "UNSPECIFIED", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + } + ' + ``` + !!! 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/transfer", + "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, + "ci": "325" + }, + "tt": "UNSPECIFIED", + "tm": {"provider":"XY","direction":"WITHDRAWAL","provider_tx_id":"txn123456","chainid":"42161","endpoint":"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0"} + }, + "i": 123 + } + ' -w 360 + ``` +
+
+### Transfer History +``` +FULL ENDPOINT: full/v1/transfer_history +LITE ENDPOINT: lite/v1/transfer_history +``` + +=== "Request" +
+ -8<- "docs/schemas/api_transfer_history_request.md" +
+
+ !!! question "Query" + **Full Request** + ``` { .json .copy } + { + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "tx_id": "1028403", + "main_account_id": null, + "transfer_types": ["UNSPECIFIED"] + } + ``` + **Lite Request** + ``` { .json .copy } + { + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ti": "1028403", + "ma": null, + "tt": ["UNSPECIFIED"] + } + ``` +
+=== "Response" +
+ -8<- "docs/schemas/api_transfer_history_response.md" +
+
+ !!! success + **Full Response** + ``` { .json .copy } + { + "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, + "chain_id": "325" + }, + "event_time": "1697788800000000000", + "transfer_type": "UNSPECIFIED", + "transfer_metadata": null + }], + "next": "Qw0918=" + } + ``` + **Lite Response** + ``` { .json .copy } + { + "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, + "ci": "325" + }, + "et": "1697788800000000000", + "tt": "UNSPECIFIED", + "tm": null + }], + "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/transfer_history' \ + --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": "", + "tx_id": "1028403", + "main_account_id": null, + "transfer_types": ["UNSPECIFIED"] + } + ' + ``` + !!! 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/transfer_history", + "params": { + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "tx_id": "1028403", + "main_account_id": null, + "transfer_types": ["UNSPECIFIED"] + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/transfer_history' \ + --header "Cookie: $GRVT_COOKIE" \ + --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ + --data '{ + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ti": "1028403", + "ma": null, + "tt": ["UNSPECIFIED"] + } + ' + ``` + !!! 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/transfer_history", + "p": { + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ti": "1028403", + "ma": null, + "tt": ["UNSPECIFIED"] + }, + "i": 123 + } + ' -w 360 + ``` +
+ === "STAGING" +
+ !!! example "REST Full" + ``` { .bash .copy } + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/transfer_history' \ + --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": "", + "tx_id": "1028403", + "main_account_id": null, + "transfer_types": ["UNSPECIFIED"] + } + ' + ``` + !!! 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/transfer_history", + "params": { + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "tx_id": "1028403", + "main_account_id": null, + "transfer_types": ["UNSPECIFIED"] + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/transfer_history' \ + --header "Cookie: $GRVT_COOKIE" \ + --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ + --data '{ + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ti": "1028403", + "ma": null, + "tt": ["UNSPECIFIED"] + } + ' + ``` + !!! 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/transfer_history", + "p": { + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ti": "1028403", + "ma": null, + "tt": ["UNSPECIFIED"] + }, + "i": 123 + } + ' -w 360 + ``` +
+ === "TESTNET" +
+ !!! example "REST Full" + ``` { .bash .copy } + curl --location 'https://trades.testnet.grvt.io/full/v1/transfer_history' \ + --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": "", + "tx_id": "1028403", + "main_account_id": null, + "transfer_types": ["UNSPECIFIED"] + } + ' + ``` + !!! 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/transfer_history", + "params": { + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "tx_id": "1028403", + "main_account_id": null, + "transfer_types": ["UNSPECIFIED"] + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + curl --location 'https://trades.testnet.grvt.io/lite/v1/transfer_history' \ + --header "Cookie: $GRVT_COOKIE" \ + --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ + --data '{ + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ti": "1028403", + "ma": null, + "tt": ["UNSPECIFIED"] + } + ' + ``` + !!! 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/transfer_history", + "p": { + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ti": "1028403", + "ma": null, + "tt": ["UNSPECIFIED"] + }, + "i": 123 + } + ' -w 360 + ``` +
+ === "PROD" +
+ !!! example "REST Full" + ``` { .bash .copy } + curl --location 'https://trades.grvt.io/full/v1/transfer_history' \ + --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": "", + "tx_id": "1028403", + "main_account_id": null, + "transfer_types": ["UNSPECIFIED"] + } + ' + ``` + !!! 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/transfer_history", + "params": { + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "tx_id": "1028403", + "main_account_id": null, + "transfer_types": ["UNSPECIFIED"] + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + curl --location 'https://trades.grvt.io/lite/v1/transfer_history' \ + --header "Cookie: $GRVT_COOKIE" \ + --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ + --data '{ + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ti": "1028403", + "ma": null, + "tt": ["UNSPECIFIED"] + } + ' + ``` + !!! 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/transfer_history", + "p": { + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ti": "1028403", + "ma": null, + "tt": ["UNSPECIFIED"] + }, + "i": 123 + } + ' -w 360 + ``` +
+
+### Withdrawal +``` +FULL ENDPOINT: full/v1/withdrawal +LITE ENDPOINT: lite/v1/withdrawal +``` + +=== "Request" +
+ -8<- "docs/schemas/api_withdrawal_request.md" +
+
+ !!! question "Query" + **Full Request** + ``` { .json .copy } + { + "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, + "chain_id": "325" + } + } + ``` + **Lite Request** + ``` { .json .copy } + { + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "c": "USDT", + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } + } + ``` +
+=== "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| + |4010|400|This wallet is not supported. Please try another wallet.| +
+
+ !!! 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/withdrawal' \ + --header "Cookie: $GRVT_COOKIE" \ + --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ + --data '{ + "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, + "chain_id": "325" + } + } + ' + ``` + !!! 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/withdrawal", + "params": { + "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, + "chain_id": "325" + } + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + 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", + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } + } + ' + ``` + !!! 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/withdrawal", + "p": { + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "c": "USDT", + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } + }, + "i": 123 + } + ' -w 360 + ``` +
+ === "STAGING" +
+ !!! example "REST Full" + ``` { .bash .copy } + 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", + "num_tokens": "1500.0", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } + } + ' + ``` + !!! 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/withdrawal", + "params": { + "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, + "chain_id": "325" + } + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + 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", + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } + } + ' + ``` + !!! 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/withdrawal", + "p": { + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "c": "USDT", + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } + }, + "i": 123 + } + ' -w 360 + ``` +
+ === "TESTNET" +
+ !!! example "REST Full" + ``` { .bash .copy } + 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", + "num_tokens": "1500.0", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } + } + ' + ``` + !!! 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/withdrawal", + "params": { + "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, + "chain_id": "325" + } + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + 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", + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } + } + ' + ``` + !!! 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/withdrawal", + "p": { + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "c": "USDT", + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } + }, + "i": 123 + } + ' -w 360 + ``` +
+ === "PROD" +
+ !!! example "REST Full" + ``` { .bash .copy } + 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", + "num_tokens": "1500.0", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } + } + ' + ``` + !!! 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/withdrawal", + "params": { + "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, + "chain_id": "325" + } + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + 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", + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } + } + ' + ``` + !!! 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/withdrawal", + "p": { + "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "c": "USDT", + "nt": "1500.0", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } + }, + "i": 123 + } + ' -w 360 + ``` +
+
+### Withdrawal History +``` +FULL ENDPOINT: full/v1/withdrawal_history +LITE ENDPOINT: lite/v1/withdrawal_history +``` + +=== "Request" +
+ -8<- "docs/schemas/api_withdrawal_history_request.md" +
+
+ !!! question "Query" + **Full Request** + ``` { .json .copy } + { + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null + } + ``` + **Lite Request** + ``` { .json .copy } + { + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null + } + ``` +
+=== "Response" +
+ -8<- "docs/schemas/api_withdrawal_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, + "chain_id": "325" + }, + "event_time": "1697788800000000000", + "l_1_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "l_2_hash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890" + }], + "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, + "ci": "325" + }, + "et": "1697788800000000000", + "l1": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", + "l2": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890" + }], + "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/withdrawal_history' \ + --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 + } + ' + ``` + !!! 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/withdrawal_history", + "params": { + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/withdrawal_history' \ + --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 + } + ' + ``` + !!! 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/withdrawal_history", + "p": { + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null + }, + "i": 123 + } + ' -w 360 + ``` +
+ === "STAGING" +
+ !!! example "REST Full" + ``` { .bash .copy } + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/withdrawal_history' \ + --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 + } + ' + ``` + !!! 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/withdrawal_history", + "params": { + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/withdrawal_history' \ + --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 + } + ' + ``` + !!! 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/withdrawal_history", + "p": { + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null + }, + "i": 123 + } + ' -w 360 + ``` +
+ === "TESTNET" +
+ !!! example "REST Full" + ``` { .bash .copy } + curl --location 'https://trades.testnet.grvt.io/full/v1/withdrawal_history' \ + --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 + } + ' + ``` + !!! 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/withdrawal_history", + "params": { + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + curl --location 'https://trades.testnet.grvt.io/lite/v1/withdrawal_history' \ + --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 + } + ' + ``` + !!! 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/withdrawal_history", + "p": { + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null + }, + "i": 123 + } + ' -w 360 + ``` +
+ === "PROD" +
+ !!! example "REST Full" + ``` { .bash .copy } + curl --location 'https://trades.grvt.io/full/v1/withdrawal_history' \ + --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 + } + ' + ``` + !!! 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/withdrawal_history", + "params": { + "currency": ["USDT", "USDC"], + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "", + "main_account_id": null + }, + "id": 123 + } + ' -w 360 + ``` +
+
+ !!! example "REST Lite" + ``` { .bash .copy } + curl --location 'https://trades.grvt.io/lite/v1/withdrawal_history' \ + --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 + } + ' + ``` + !!! 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/withdrawal_history", + "p": { + "c": ["USDT", "USDC"], + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c1": "", + "ma": null + }, + "i": 123 + } + ' -w 360 + ``` +
+
+## Account +### Sub Account Summary +``` +FULL ENDPOINT: full/v1/account_summary +LITE ENDPOINT: lite/v1/account_summary +``` + +=== "Request" +
+ -8<- "docs/schemas/api_sub_account_summary_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_sub_account_summary_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", + "cumulative_fee": "100000.20", + "cumulative_realized_funding_payment": "100000.20", + "margin_type": "cross", + "isolated_balance": "100000.20", + "isolated_im": "100000.20", + "isolated_mm": "100000.20" + }], + "settle_index_price": "1.0000102", + "is_vault": null, + "vault_im_additions": "123456.78", + "derisk_margin": "185185.77", + "derisk_to_maintenance_margin_ratio": "1.5", + "total_cross_equity": "123456.78", + "cross_unrealized_pnl": "123456.78" + } + } + ``` + **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", + "cf": "100000.20", + "cr": "100000.20", + "mt": "cross", + "ib": "100000.20", + "ii": "100000.20", + "im": "100000.20" + }], + "si": "1.0000102", + "iv": null, + "vi": "123456.78", + "dm": "185185.77", + "dt": "1.5", + "tc": "123456.78", + "cu": "123456.78" + } + } + ``` +
+=== "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/account_summary' \ + --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/account_summary", + "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/account_summary' \ + --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/account_summary", + "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/account_summary' \ + --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/account_summary", + "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/account_summary' \ + --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/account_summary", + "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/account_summary' \ + --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/account_summary", + "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/account_summary' \ + --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/account_summary", + "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'" + }, + "i": 123 + } + ' -w 360 + ``` +
+ === "PROD" +
+ !!! example "REST Full" + ``` { .bash .copy } + 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'" + } + ' + ``` + !!! 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/account_summary", + "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/account_summary' \ + --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/account_summary", + "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'" + }, + "i": 123 + } + ' -w 360 + ``` +
+
+### Sub Account History +``` +FULL ENDPOINT: full/v1/account_history +LITE ENDPOINT: lite/v1/account_history +``` + +=== "Request" +
+ -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_sub_account_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", + "cumulative_fee": "100000.20", + "cumulative_realized_funding_payment": "100000.20", + "margin_type": "cross", + "isolated_balance": "100000.20", + "isolated_im": "100000.20", + "isolated_mm": "100000.20" + }], + "settle_index_price": "1.0000102", + "is_vault": null, + "vault_im_additions": "123456.78", + "derisk_margin": "185185.77", + "derisk_to_maintenance_margin_ratio": "1.5", + "total_cross_equity": "123456.78", + "cross_unrealized_pnl": "123456.78" + }], + "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", + "cf": "100000.20", + "cr": "100000.20", + "mt": "cross", + "ib": "100000.20", + "ii": "100000.20", + "im": "100000.20" + }], + "si": "1.0000102", + "iv": null, + "vi": "123456.78", + "dm": "185185.77", + "dt": "1.5", + "tc": "123456.78", + "cu": "123456.78" + }], + "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/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": "" + } + ' + ``` + !!! 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/account_history", + "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "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/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": "" + } + ' + ``` + !!! 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/account_history", + "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "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/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": "" + } + ' + ``` + !!! 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/account_history", + "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "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/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": "" + } + ' + ``` + !!! 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/account_history", + "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "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/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": "" + } + ' + ``` + !!! 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/account_history", + "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "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/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": "" + } + ' + ``` + !!! 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/account_history", + "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" }, "i": 123 } @@ -6756,23 +9594,15 @@ 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/account_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "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, - "chain_id": "325" - } + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ' ``` @@ -6784,21 +9614,13 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal", + "method": "v1/account_history", "params": { - "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, - "chain_id": "325" - } + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "start_time": "1697788800000000000", + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" }, "id": 123 } @@ -6808,23 +9630,15 @@ 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/account_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" } ' ``` @@ -6836,21 +9650,13 @@ LITE ENDPOINT: lite/v1/withdrawal -x ' { "j": "2.0", - "m": "v1/withdrawal", + "m": "v1/account_history", "p": { - "fa": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "c": "USDT", - "nt": "1500.0", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "st": "1697788800000000000", + "et": "1697788800000000000", + "l": 500, + "c": "" }, "i": 123 } @@ -6858,95 +9664,83 @@ LITE ENDPOINT: lite/v1/withdrawal ```

-### Withdrawal History +### Aggregated Account Summary ``` -FULL ENDPOINT: full/v1/withdrawal_history -LITE ENDPOINT: lite/v1/withdrawal_history +FULL ENDPOINT: full/v1/aggregated_account_summary +LITE ENDPOINT: lite/v1/aggregated_account_summary ``` === "Request"
- -8<- "docs/schemas/api_withdrawal_history_request.md" + -8<- "docs/schemas/empty_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null } ``` **Lite Request** ``` { .json .copy } { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null } ```
=== "Response"
- -8<- "docs/schemas/api_withdrawal_history_response.md" + -8<- "docs/schemas/api_aggregated_account_summary_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, - "chain_id": "325" - }, - "event_time": "1697788800000000000", - "l_1_hash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", - "l_2_hash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890" - }], - "next": "Qw0918=" + "result": { + "main_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "total_equity": "3945034.23", + "spot_balances": [{ + "currency": "USDT", + "balance": "123456.78", + "index_price": "1.0000102" + }], + "vault_investments": [{ + "vault_id": 123456789, + "num_lp_tokens": 1000000, + "share_price": 1000000, + "usd_notional_invested": 1000000 + }], + "total_sub_account_balance": "3945034.23", + "total_sub_account_equity": "3945034.23", + "total_vault_investments_balance": "3945034.23", + "total_sub_account_available_balance": "3945034.23", + "total_usd_notional_invested": "3945034.23" + } } ``` **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, - "ci": "325" - }, - "et": "1697788800000000000", - "l1": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", - "l2": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890" - }], - "n": "Qw0918=" + "r": { + "ma": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "3945034.23", + "sb": [{ + "c": "USDT", + "b": "123456.78", + "ip": "1.0000102" + }], + "vi": [{ + "vi": 123456789, + "nl": 1000000, + "sp": 1000000, + "un": 1000000 + }], + "ts": "3945034.23", + "ts1": "3945034.23", + "tv": "3945034.23", + "ts2": "3945034.23", + "tu": "3945034.23" + } } ```
@@ -6955,7 +9749,6 @@ LITE ENDPOINT: lite/v1/withdrawal_history !!! 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| @@ -6968,18 +9761,18 @@ LITE ENDPOINT: lite/v1/withdrawal_history ``` { .json .copy } { "request_id":1, - "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 } ``` **Lite Error Response** ``` { .json .copy } { "ri":1, - "c":1000, - "m":"You need to authenticate prior to using this functionality", - "s":401 + "c":1001, + "m":"You are not authorized to access this functionality", + "s":403 } ```
@@ -6989,16 +9782,10 @@ 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/aggregated_account_summary' \ --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 } ' ``` @@ -7010,14 +9797,8 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal_history", + "method": "v1/aggregated_account_summary", "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null }, "id": 123 } @@ -7027,16 +9808,10 @@ 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/aggregated_account_summary' \ --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 } ' ``` @@ -7048,14 +9823,8 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "j": "2.0", - "m": "v1/withdrawal_history", + "m": "v1/aggregated_account_summary", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null }, "i": 123 } @@ -7066,16 +9835,10 @@ 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/aggregated_account_summary' \ --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 } ' ``` @@ -7087,14 +9850,8 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal_history", - "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null + "method": "v1/aggregated_account_summary", + "params": { }, "id": 123 } @@ -7104,16 +9861,10 @@ 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/aggregated_account_summary' \ --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 } ' ``` @@ -7125,14 +9876,8 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "j": "2.0", - "m": "v1/withdrawal_history", + "m": "v1/aggregated_account_summary", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null }, "i": 123 } @@ -7143,16 +9888,10 @@ 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/aggregated_account_summary' \ --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 } ' ``` @@ -7164,14 +9903,8 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal_history", + "method": "v1/aggregated_account_summary", "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null }, "id": 123 } @@ -7181,16 +9914,10 @@ 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/aggregated_account_summary' \ --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 } ' ``` @@ -7202,14 +9929,8 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "j": "2.0", - "m": "v1/withdrawal_history", + "m": "v1/aggregated_account_summary", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null }, "i": 123 } @@ -7220,16 +9941,10 @@ 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/aggregated_account_summary' \ --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 } ' ``` @@ -7241,14 +9956,8 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "jsonrpc": "2.0", - "method": "v1/withdrawal_history", + "method": "v1/aggregated_account_summary", "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null }, "id": 123 } @@ -7258,16 +9967,10 @@ 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/aggregated_account_summary' \ --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 } ' ``` @@ -7279,14 +9982,8 @@ LITE ENDPOINT: lite/v1/withdrawal_history -x ' { "j": "2.0", - "m": "v1/withdrawal_history", + "m": "v1/aggregated_account_summary", "p": { - "c": ["USDT", "USDC"], - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c1": "", - "ma": null }, "i": 123 } @@ -7294,35 +9991,32 @@ LITE ENDPOINT: lite/v1/withdrawal_history ```

-## Account -### Sub Account Summary +### Funding Account Summary ``` -FULL ENDPOINT: full/v1/account_summary -LITE ENDPOINT: lite/v1/account_summary +FULL ENDPOINT: full/v1/funding_account_summary +LITE ENDPOINT: lite/v1/funding_account_summary ``` === "Request"
- -8<- "docs/schemas/api_sub_account_summary_request.md" + -8<- "docs/schemas/empty_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_sub_account_summary_response.md" + -8<- "docs/schemas/api_funding_account_summary_response.md"
!!! success @@ -7330,46 +10024,26 @@ LITE ENDPOINT: lite/v1/account_summary ``` { .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", + "main_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "total_equity": "3945034.23", "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", - "cumulative_fee": "100000.20", - "cumulative_realized_funding_payment": "100000.20" - }], - "settle_index_price": "1.0000102", - "is_vault": null, - "vault_im_additions": "123456.78", - "derisk_margin": "185185.77", - "derisk_to_maintenance_margin_ratio": "1.5", - "total_cross_equity": "123456.78", - "cross_unrealized_pnl": "123456.78" + "vault_investments": [{ + "vault_id": 123456789, + "num_lp_tokens": 1000000, + "share_price": 1000000, + "usd_notional_invested": 1000000 + }] + }, + "tier": { + "tier": null, + "futures_taker_fee": null, + "futures_maker_fee": null, + "options_taker_fee": null, + "options_maker_fee": null } } ``` @@ -7377,46 +10051,26 @@ LITE ENDPOINT: lite/v1/account_summary ``` { .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", + "ma": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "te": "3945034.23", "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", - "cf": "100000.20", - "cr": "100000.20" - }], - "si": "1.0000102", - "iv": null, - "vi": "123456.78", - "dm": "185185.77", - "dt": "1.5", - "tc": "123456.78", - "cu": "123456.78" + "vi": [{ + "vi": 123456789, + "nl": 1000000, + "sp": 1000000, + "un": 1000000 + }] + }, + "t": { + "t": null, + "ft": null, + "fm": null, + "ot": null, + "om": null } } ``` @@ -7426,7 +10080,6 @@ LITE ENDPOINT: lite/v1/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| @@ -7439,18 +10092,18 @@ LITE ENDPOINT: lite/v1/account_summary ``` { .json .copy } { "request_id":1, - "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 } ``` **Lite Error Response** ``` { .json .copy } { "ri":1, - "c":1000, - "m":"You need to authenticate prior to using this functionality", - "s":401 + "c":1001, + "m":"You are not authorized to access this functionality", + "s":403 } ```
@@ -7460,11 +10113,10 @@ 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/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -7476,9 +10128,8 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/account_summary", + "method": "v1/funding_account_summary", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -7488,11 +10139,10 @@ 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/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -7504,9 +10154,8 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "j": "2.0", - "m": "v1/account_summary", + "m": "v1/funding_account_summary", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -7517,11 +10166,10 @@ 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/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -7533,9 +10181,8 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/account_summary", + "method": "v1/funding_account_summary", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -7545,11 +10192,10 @@ 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/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -7561,9 +10207,8 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "j": "2.0", - "m": "v1/account_summary", + "m": "v1/funding_account_summary", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -7574,11 +10219,10 @@ 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/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -7590,9 +10234,8 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/account_summary", + "method": "v1/funding_account_summary", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -7602,11 +10245,10 @@ 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/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -7618,9 +10260,8 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "j": "2.0", - "m": "v1/account_summary", + "m": "v1/funding_account_summary", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -7631,11 +10272,10 @@ 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/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -7647,9 +10287,8 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/account_summary", + "method": "v1/funding_account_summary", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -7659,11 +10298,10 @@ 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/funding_account_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -7675,9 +10313,8 @@ LITE ENDPOINT: lite/v1/account_summary -x ' { "j": "2.0", - "m": "v1/account_summary", + "m": "v1/funding_account_summary", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -7685,15 +10322,16 @@ LITE ENDPOINT: lite/v1/account_summary ```

-### Sub Account History +## DeriskMMRatio +### Set Derisk M M Ratio ``` -FULL ENDPOINT: full/v1/account_history -LITE ENDPOINT: lite/v1/account_history +FULL ENDPOINT: full/v1/set_derisk_mm_ratio +LITE ENDPOINT: lite/v1/set_derisk_mm_ratio ``` === "Request"
- -8<- "docs/schemas/api_sub_account_history_request.md" + -8<- "docs/schemas/api_set_derisk_to_maintenance_margin_ratio_request.md"
!!! question "Query" @@ -7701,123 +10339,51 @@ LITE ENDPOINT: lite/v1/account_history ``` { .json .copy } { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "ratio": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ``` **Lite Request** ``` { .json .copy } { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "r": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ```
=== "Response"
- -8<- "docs/schemas/api_sub_account_history_response.md" + -8<- "docs/schemas/api_set_derisk_to_maintenance_margin_ratio_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", - "cumulative_fee": "100000.20", - "cumulative_realized_funding_payment": "100000.20" - }], - "settle_index_price": "1.0000102", - "is_vault": null, - "vault_im_additions": "123456.78", - "derisk_margin": "185185.77", - "derisk_to_maintenance_margin_ratio": "1.5", - "total_cross_equity": "123456.78", - "cross_unrealized_pnl": "123456.78" - }], - "next": "Qw0918=" + "success": "true" } ``` **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", - "cf": "100000.20", - "cr": "100000.20" - }], - "si": "1.0000102", - "iv": null, - "vi": "123456.78", - "dm": "185185.77", - "dt": "1.5", - "tc": "123456.78", - "cu": "123456.78" - }], - "n": "Qw0918=" + "s": "true" } ```
@@ -7831,7 +10397,8 @@ LITE ENDPOINT: lite/v1/account_history |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| + |6100|400|Derisk MM Ratio is out of range|
!!! failure @@ -7860,15 +10427,21 @@ 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/set_derisk_mm_ratio' \ --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": "" + "ratio": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -7880,13 +10453,19 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "jsonrpc": "2.0", - "method": "v1/account_history", + "method": "v1/set_derisk_mm_ratio", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "ratio": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } }, "id": 123 } @@ -7896,15 +10475,21 @@ 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/set_derisk_mm_ratio' \ --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": "" + "r": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -7916,13 +10501,19 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "j": "2.0", - "m": "v1/account_history", + "m": "v1/set_derisk_mm_ratio", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "r": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -7933,15 +10524,21 @@ 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/set_derisk_mm_ratio' \ --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": "" + "ratio": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -7953,13 +10550,19 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "jsonrpc": "2.0", - "method": "v1/account_history", + "method": "v1/set_derisk_mm_ratio", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "ratio": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } }, "id": 123 } @@ -7969,15 +10572,21 @@ 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/set_derisk_mm_ratio' \ --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": "" + "r": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -7989,13 +10598,19 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "j": "2.0", - "m": "v1/account_history", + "m": "v1/set_derisk_mm_ratio", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "r": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -8006,15 +10621,21 @@ 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/set_derisk_mm_ratio' \ --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": "" + "ratio": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -8026,13 +10647,19 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "jsonrpc": "2.0", - "method": "v1/account_history", + "method": "v1/set_derisk_mm_ratio", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "ratio": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } }, "id": 123 } @@ -8042,15 +10669,21 @@ 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/set_derisk_mm_ratio' \ --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": "" + "r": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -8062,13 +10695,19 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "j": "2.0", - "m": "v1/account_history", + "m": "v1/set_derisk_mm_ratio", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "r": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -8079,15 +10718,21 @@ 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/set_derisk_mm_ratio' \ --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": "" + "ratio": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -8099,13 +10744,19 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "jsonrpc": "2.0", - "method": "v1/account_history", + "method": "v1/set_derisk_mm_ratio", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "" + "ratio": "1.5", + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } }, "id": 123 } @@ -8115,15 +10766,21 @@ 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/set_derisk_mm_ratio' \ --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": "" + "r": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -8135,13 +10792,19 @@ LITE ENDPOINT: lite/v1/account_history -x ' { "j": "2.0", - "m": "v1/account_history", + "m": "v1/set_derisk_mm_ratio", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "st": "1697788800000000000", - "et": "1697788800000000000", - "l": 500, - "c": "" + "r": "1.5", + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -8149,83 +10812,60 @@ LITE ENDPOINT: lite/v1/account_history ```

-### Aggregated Account Summary +## InitialLeverage +### Get All Initial Leverage ``` -FULL ENDPOINT: full/v1/aggregated_account_summary -LITE ENDPOINT: lite/v1/aggregated_account_summary +FULL ENDPOINT: full/v1/get_all_initial_leverage +LITE ENDPOINT: lite/v1/get_all_initial_leverage ``` === "Request"
- -8<- "docs/schemas/empty_request.md" + -8<- "docs/schemas/api_get_all_initial_leverage_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_aggregated_account_summary_response.md" + -8<- "docs/schemas/api_get_all_initial_leverage_response.md"
!!! success **Full Response** ``` { .json .copy } { - "result": { - "main_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "total_equity": "3945034.23", - "spot_balances": [{ - "currency": "USDT", - "balance": "123456.78", - "index_price": "1.0000102" - }], - "vault_investments": [{ - "vault_id": 123456789, - "num_lp_tokens": 1000000, - "share_price": 1000000, - "usd_notional_invested": 1000000 - }], - "total_sub_account_balance": "3945034.23", - "total_sub_account_equity": "3945034.23", - "total_vault_investments_balance": "3945034.23", - "total_sub_account_available_balance": "3945034.23", - "total_usd_notional_invested": "3945034.23" - } + "results": [{ + "instrument": "BTC_USDT_Perp", + "leverage": "10", + "min_leverage": "10", + "max_leverage": "50", + "margin_type": "ISOLATED" + }] } ``` **Lite Response** ``` { .json .copy } { - "r": { - "ma": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "3945034.23", - "sb": [{ - "c": "USDT", - "b": "123456.78", - "ip": "1.0000102" - }], - "vi": [{ - "vi": 123456789, - "nl": 1000000, - "sp": 1000000, - "un": 1000000 - }], - "ts": "3945034.23", - "ts1": "3945034.23", - "tv": "3945034.23", - "ts2": "3945034.23", - "tu": "3945034.23" - } + "r": [{ + "i": "BTC_USDT_Perp", + "l": "10", + "ml": "10", + "ml1": "50", + "mt": "ISOLATED" + }] } ```
@@ -8234,11 +10874,12 @@ 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| - |1008|401|Your IP has not been whitelisted for access| + |1004|404|Data Not Found|
!!! failure @@ -8246,18 +10887,18 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary ``` { .json .copy } { "request_id":1, - "code":1001, - "message":"You are not authorized to access this functionality", - "status":403 + "code":1000, + "message":"You need to authenticate prior to using this functionality", + "status":401 } ``` **Lite Error Response** ``` { .json .copy } { "ri":1, - "c":1001, - "m":"You are not authorized to access this functionality", - "s":403 + "c":1000, + "m":"You need to authenticate prior to using this functionality", + "s":401 } ```
@@ -8267,10 +10908,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8282,8 +10924,9 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/aggregated_account_summary", + "method": "v1/get_all_initial_leverage", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -8293,10 +10936,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8308,8 +10952,9 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "j": "2.0", - "m": "v1/aggregated_account_summary", + "m": "v1/get_all_initial_leverage", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -8320,10 +10965,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8335,8 +10981,9 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/aggregated_account_summary", + "method": "v1/get_all_initial_leverage", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -8346,10 +10993,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8361,8 +11009,9 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "j": "2.0", - "m": "v1/aggregated_account_summary", + "m": "v1/get_all_initial_leverage", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -8373,10 +11022,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8388,8 +11038,9 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/aggregated_account_summary", + "method": "v1/get_all_initial_leverage", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -8399,10 +11050,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8414,8 +11066,9 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "j": "2.0", - "m": "v1/aggregated_account_summary", + "m": "v1/get_all_initial_leverage", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -8426,10 +11079,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8441,8 +11095,9 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/aggregated_account_summary", + "method": "v1/get_all_initial_leverage", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -8452,10 +11107,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8467,8 +11123,9 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "j": "2.0", - "m": "v1/aggregated_account_summary", + "m": "v1/get_all_initial_leverage", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -8476,87 +11133,51 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary ```

-### Funding Account Summary +### Set Initial Leverage ``` -FULL ENDPOINT: full/v1/funding_account_summary -LITE ENDPOINT: lite/v1/funding_account_summary +FULL ENDPOINT: full/v1/set_initial_leverage +LITE ENDPOINT: lite/v1/set_initial_leverage ``` === "Request"
- -8<- "docs/schemas/empty_request.md" + -8<- "docs/schemas/api_set_initial_leverage_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "leverage": "10" } ``` **Lite Request** ``` { .json .copy } { + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "l": "10" } ```
=== "Response"
- -8<- "docs/schemas/api_funding_account_summary_response.md" + -8<- "docs/schemas/api_set_initial_leverage_response.md"
!!! success **Full Response** ``` { .json .copy } { - "result": { - "main_account_id": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "total_equity": "3945034.23", - "spot_balances": [{ - "currency": "USDT", - "balance": "123456.78", - "index_price": "1.0000102" - }], - "vault_investments": [{ - "vault_id": 123456789, - "num_lp_tokens": 1000000, - "share_price": 1000000, - "usd_notional_invested": 1000000 - }] - }, - "tier": { - "tier": null, - "futures_taker_fee": null, - "futures_maker_fee": null, - "options_taker_fee": null, - "options_maker_fee": null - } + "success": "true" } ``` **Lite Response** ``` { .json .copy } { - "r": { - "ma": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "te": "3945034.23", - "sb": [{ - "c": "USDT", - "b": "123456.78", - "ip": "1.0000102" - }], - "vi": [{ - "vi": 123456789, - "nl": 1000000, - "sp": 1000000, - "un": 1000000 - }] - }, - "t": { - "t": null, - "ft": null, - "fm": null, - "ot": null, - "om": null - } + "s": "true" } ```
@@ -8565,11 +11186,14 @@ LITE ENDPOINT: lite/v1/funding_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| - |1008|401|Your IP has not been whitelisted for access| + |1004|404|Data Not Found| + |2100|400|Invalid initial leverage| + |2101|400|Vaults cannot configure leverage|
!!! failure @@ -8577,18 +11201,18 @@ LITE ENDPOINT: lite/v1/funding_account_summary ``` { .json .copy } { "request_id":1, - "code":1001, - "message":"You are not authorized to access this functionality", - "status":403 + "code":1000, + "message":"You need to authenticate prior to using this functionality", + "status":401 } ``` **Lite Error Response** ``` { .json .copy } { "ri":1, - "c":1001, - "m":"You are not authorized to access this functionality", - "s":403 + "c":1000, + "m":"You need to authenticate prior to using this functionality", + "s":401 } ```
@@ -8598,10 +11222,13 @@ 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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "leverage": "10" } ' ``` @@ -8613,8 +11240,11 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/funding_account_summary", + "method": "v1/set_initial_leverage", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "leverage": "10" }, "id": 123 } @@ -8624,10 +11254,13 @@ 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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "l": "10" } ' ``` @@ -8639,8 +11272,11 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "j": "2.0", - "m": "v1/funding_account_summary", + "m": "v1/set_initial_leverage", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "l": "10" }, "i": 123 } @@ -8651,10 +11287,13 @@ 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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "leverage": "10" } ' ``` @@ -8666,8 +11305,11 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/funding_account_summary", + "method": "v1/set_initial_leverage", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "leverage": "10" }, "id": 123 } @@ -8677,10 +11319,13 @@ 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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "l": "10" } ' ``` @@ -8692,8 +11337,11 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "j": "2.0", - "m": "v1/funding_account_summary", + "m": "v1/set_initial_leverage", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "l": "10" }, "i": 123 } @@ -8704,10 +11352,13 @@ 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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "leverage": "10" } ' ``` @@ -8719,8 +11370,11 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/funding_account_summary", + "method": "v1/set_initial_leverage", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "leverage": "10" }, "id": 123 } @@ -8730,10 +11384,13 @@ 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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "l": "10" } ' ``` @@ -8745,8 +11402,11 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "j": "2.0", - "m": "v1/funding_account_summary", + "m": "v1/set_initial_leverage", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "l": "10" }, "i": 123 } @@ -8757,10 +11417,13 @@ 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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "leverage": "10" } ' ``` @@ -8772,8 +11435,11 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/funding_account_summary", + "method": "v1/set_initial_leverage", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "instrument": "BTC_USDT_Perp", + "leverage": "10" }, "id": 123 } @@ -8783,10 +11449,13 @@ 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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "l": "10" } ' ``` @@ -8798,8 +11467,11 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "j": "2.0", - "m": "v1/funding_account_summary", + "m": "v1/set_initial_leverage", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "l": "10" }, "i": 123 } @@ -8807,24 +11479,25 @@ LITE ENDPOINT: lite/v1/funding_account_summary ```

-## DeriskMMRatio -### Set Derisk M M Ratio +## Vault +### Vault Burn Tokens ``` -FULL ENDPOINT: full/v1/set_derisk_mm_ratio -LITE ENDPOINT: lite/v1/set_derisk_mm_ratio +FULL ENDPOINT: full/v1/vault_burn_tokens +LITE ENDPOINT: lite/v1/vault_burn_tokens ``` === "Request"
- -8<- "docs/schemas/api_set_derisk_to_maintenance_margin_ratio_request.md" + -8<- "docs/schemas/api_vault_burn_tokens_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -8839,8 +11512,9 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio **Lite Request** ``` { .json .copy } { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -8855,20 +11529,24 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio
=== "Response"
- -8<- "docs/schemas/api_set_derisk_to_maintenance_margin_ratio_response.md" + -8<- "docs/schemas/ack_response.md"
!!! success **Full Response** ``` { .json .copy } { - "success": "true" + "result": { + "ack": "true" + } } ``` **Lite Response** ``` { .json .copy } { - "s": "true" + "r": { + "a": "true" + } } ```
@@ -8882,8 +11560,19 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio |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| - |1004|404|Data Not Found| - |6100|400|Derisk MM Ratio is out of range| + |1008|401|Your IP has not been whitelisted for access| + |1009|503|We are temporarily deactivating this API endpoint, please try again later| + |2000|403|Signature is from an unauthorized signer| + |2001|403|Signature has expired| + |2002|403|Signature does not match payload| + |2004|403|Signature is from an expired session key| + |2006|403|Signature R/S must have exactly 64 characters long without 0x prefix| + |2005|403|Signature V must be 27/28| + |2007|403|Signature S must be in the lower half of the curve| + |2008|403|Signature exceeds maximum allowed duration.| + |7000|400|Vault ID provided is invalid and does not belong to any vault| + |7005|400|You are attempting to burn more vault tokens than you own.| + |7006|400|You are attempting to burn vault tokens whilst having an active redemption request.|
!!! failure @@ -8912,12 +11601,13 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/set_derisk_mm_ratio' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_burn_tokens' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -8938,10 +11628,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "jsonrpc": "2.0", - "method": "v1/set_derisk_mm_ratio", + "method": "v1/vault_burn_tokens", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -8960,12 +11651,13 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/set_derisk_mm_ratio' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_burn_tokens' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -8986,10 +11678,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "j": "2.0", - "m": "v1/set_derisk_mm_ratio", + "m": "v1/vault_burn_tokens", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -9009,12 +11702,13 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/set_derisk_mm_ratio' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_burn_tokens' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -9035,10 +11729,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "jsonrpc": "2.0", - "method": "v1/set_derisk_mm_ratio", + "method": "v1/vault_burn_tokens", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -9057,12 +11752,13 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/set_derisk_mm_ratio' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_burn_tokens' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -9083,10 +11779,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "j": "2.0", - "m": "v1/set_derisk_mm_ratio", + "m": "v1/vault_burn_tokens", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -9106,12 +11803,13 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/set_derisk_mm_ratio' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/vault_burn_tokens' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -9132,10 +11830,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "jsonrpc": "2.0", - "method": "v1/set_derisk_mm_ratio", + "method": "v1/vault_burn_tokens", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -9154,12 +11853,13 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/set_derisk_mm_ratio' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_burn_tokens' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -9180,10 +11880,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "j": "2.0", - "m": "v1/set_derisk_mm_ratio", + "m": "v1/vault_burn_tokens", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -9203,12 +11904,13 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/set_derisk_mm_ratio' \ + curl --location 'https://trades.grvt.io/full/v1/vault_burn_tokens' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -9229,10 +11931,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "jsonrpc": "2.0", - "method": "v1/set_derisk_mm_ratio", + "method": "v1/vault_burn_tokens", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, "signature": { "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -9251,12 +11954,13 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/set_derisk_mm_ratio' \ + curl --location 'https://trades.grvt.io/lite/v1/vault_burn_tokens' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -9277,10 +11981,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "j": "2.0", - "m": "v1/set_derisk_mm_ratio", + "m": "v1/vault_burn_tokens", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, "s": { "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", @@ -9297,58 +12002,73 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio ```

-## InitialLeverage -### Get All Initial Leverage +### Vault Invest ``` -FULL ENDPOINT: full/v1/get_all_initial_leverage -LITE ENDPOINT: lite/v1/get_all_initial_leverage +FULL ENDPOINT: full/v1/vault_invest +LITE ENDPOINT: lite/v1/vault_invest ``` === "Request"
- -8<- "docs/schemas/api_get_all_initial_leverage_request.md" + -8<- "docs/schemas/api_vault_invest_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ``` **Lite Request** ``` { .json .copy } { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ```
=== "Response"
- -8<- "docs/schemas/api_get_all_initial_leverage_response.md" + -8<- "docs/schemas/ack_response.md"
!!! success **Full Response** ``` { .json .copy } { - "results": [{ - "instrument": "BTC_USDT_Perp", - "leverage": "10", - "min_leverage": "10", - "max_leverage": "50" - }] + "result": { + "ack": "true" + } } ``` **Lite Response** ``` { .json .copy } { - "r": [{ - "i": "BTC_USDT_Perp", - "l": "10", - "ml": "10", - "ml1": "50" - }] + "r": { + "a": "true" + } } ```
@@ -9362,7 +12082,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage |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| - |1004|404|Data Not Found| + |1008|401|Your IP has not been whitelisted for access| + |1009|503|We are temporarily deactivating this API endpoint, please try again later| + |2000|403|Signature is from an unauthorized signer| + |2001|403|Signature has expired| + |2002|403|Signature does not match payload| + |2004|403|Signature is from an expired session key| + |2006|403|Signature R/S must have exactly 64 characters long without 0x prefix| + |2005|403|Signature V must be 27/28| + |2007|403|Signature S must be in the lower half of the curve| + |2008|403|Signature exceeds maximum allowed duration.| + |4000|400|Insufficient balance to complete transfer| + |7000|400|Vault ID provided is invalid and does not belong to any vault| + |7003|400|This vault has been delisted/closed.| + |7004|400|This investment would cause the vault to exceed its valuation cap.|
!!! failure @@ -9391,11 +12124,22 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/get_all_initial_leverage' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_invest' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -9407,9 +12151,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/get_all_initial_leverage", + "method": "v1/vault_invest", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } }, "id": 123 } @@ -9419,11 +12174,22 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/get_all_initial_leverage' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_invest' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -9435,9 +12201,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "j": "2.0", - "m": "v1/get_all_initial_leverage", + "m": "v1/vault_invest", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -9448,11 +12225,22 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/get_all_initial_leverage' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_invest' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -9464,9 +12252,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/get_all_initial_leverage", + "method": "v1/vault_invest", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } }, "id": 123 } @@ -9476,11 +12275,22 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/get_all_initial_leverage' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_invest' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -9492,9 +12302,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "j": "2.0", - "m": "v1/get_all_initial_leverage", + "m": "v1/vault_invest", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -9505,11 +12326,22 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/get_all_initial_leverage' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/vault_invest' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -9521,9 +12353,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/get_all_initial_leverage", + "method": "v1/vault_invest", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } }, "id": 123 } @@ -9533,11 +12376,22 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/get_all_initial_leverage' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_invest' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -9549,9 +12403,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "j": "2.0", - "m": "v1/get_all_initial_leverage", + "m": "v1/vault_invest", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -9562,11 +12427,22 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/get_all_initial_leverage' \ + curl --location 'https://trades.grvt.io/full/v1/vault_invest' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -9578,9 +12454,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/get_all_initial_leverage", + "method": "v1/vault_invest", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" + "vault_id": "3477045127917224", + "currency": "USDT", + "num_tokens": 1000000, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } }, "id": 123 } @@ -9590,11 +12477,22 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/get_all_initial_leverage' \ + curl --location 'https://trades.grvt.io/lite/v1/vault_invest' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -9606,9 +12504,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "j": "2.0", - "m": "v1/get_all_initial_leverage", + "m": "v1/vault_invest", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'" + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -9616,51 +12525,77 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage ```

-### Set Initial Leverage +### Vault Investor Summary ``` -FULL ENDPOINT: full/v1/set_initial_leverage -LITE ENDPOINT: lite/v1/set_initial_leverage +FULL ENDPOINT: full/v1/vault_investor_summary +LITE ENDPOINT: lite/v1/vault_investor_summary ``` === "Request"
- -8<- "docs/schemas/api_set_initial_leverage_request.md" + -8<- "docs/schemas/api_vault_investor_summary_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "leverage": "10" + "vault_id": "3477045127917224" } ``` **Lite Request** ``` { .json .copy } { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "l": "10" + "vi": "3477045127917224" } ```
=== "Response"
- -8<- "docs/schemas/api_set_initial_leverage_response.md" + -8<- "docs/schemas/api_vault_investor_summary_response.md"
!!! success **Full Response** ``` { .json .copy } { - "success": "true" + "vault_investor_summary": [{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", + "num_lp_tokens": 1000000, + "avg_entry_price": 1000000, + "current_price": 1000000, + "total_equity": 1000000, + "all_time_realized_pnl": 1000000, + "pending_redemption": { + "num_lp_tokens": 1000000, + "request_valuation": 1000000, + "request_time": "1697788800000000000", + "max_redemption_period_timestamp": 1727788800000000000, + "cancel_blocked": null + }, + "can_burn": null + }] } ``` **Lite Response** ``` { .json .copy } { - "s": "true" + "vi": [{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "nl": 1000000, + "ae": 1000000, + "cp": 1000000, + "te": 1000000, + "at": 1000000, + "pr": { + "nl": 1000000, + "rv": 1000000, + "rt": "1697788800000000000", + "mr": 1727788800000000000, + "cb": null + }, + "cb": null + }] } ```
@@ -9674,9 +12609,9 @@ LITE ENDPOINT: lite/v1/set_initial_leverage |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| - |1004|404|Data Not Found| - |2100|400|Invalid initial leverage| - |2101|400|Vaults cannot configure leverage| + |1008|401|Your IP has not been whitelisted for access| + |7000|400|Vault ID provided is invalid and does not belong to any vault| + |7007|400|The investor is not an LP for this vault.|
!!! failure @@ -9705,13 +12640,11 @@ LITE ENDPOINT: lite/v1/set_initial_leverage
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/set_initial_leverage' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_investor_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "leverage": "10" + "vault_id": "3477045127917224" } ' ``` @@ -9723,11 +12656,9 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/set_initial_leverage", + "method": "v1/vault_investor_summary", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "leverage": "10" + "vault_id": "3477045127917224" }, "id": 123 } @@ -9737,13 +12668,11 @@ LITE ENDPOINT: lite/v1/set_initial_leverage
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/set_initial_leverage' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_investor_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "l": "10" + "vi": "3477045127917224" } ' ``` @@ -9755,11 +12684,9 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "j": "2.0", - "m": "v1/set_initial_leverage", + "m": "v1/vault_investor_summary", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "l": "10" + "vi": "3477045127917224" }, "i": 123 } @@ -9770,13 +12697,11 @@ LITE ENDPOINT: lite/v1/set_initial_leverage
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/set_initial_leverage' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_investor_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "leverage": "10" + "vault_id": "3477045127917224" } ' ``` @@ -9788,11 +12713,9 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/set_initial_leverage", + "method": "v1/vault_investor_summary", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "leverage": "10" + "vault_id": "3477045127917224" }, "id": 123 } @@ -9802,13 +12725,11 @@ LITE ENDPOINT: lite/v1/set_initial_leverage
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/set_initial_leverage' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_investor_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "l": "10" + "vi": "3477045127917224" } ' ``` @@ -9820,11 +12741,9 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "j": "2.0", - "m": "v1/set_initial_leverage", + "m": "v1/vault_investor_summary", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "l": "10" + "vi": "3477045127917224" }, "i": 123 } @@ -9835,13 +12754,11 @@ LITE ENDPOINT: lite/v1/set_initial_leverage
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/set_initial_leverage' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/vault_investor_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "leverage": "10" + "vault_id": "3477045127917224" } ' ``` @@ -9853,11 +12770,9 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/set_initial_leverage", + "method": "v1/vault_investor_summary", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "leverage": "10" + "vault_id": "3477045127917224" }, "id": 123 } @@ -9867,13 +12782,11 @@ LITE ENDPOINT: lite/v1/set_initial_leverage
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/set_initial_leverage' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_investor_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "l": "10" + "vi": "3477045127917224" } ' ``` @@ -9885,11 +12798,9 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "j": "2.0", - "m": "v1/set_initial_leverage", + "m": "v1/vault_investor_summary", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "l": "10" + "vi": "3477045127917224" }, "i": 123 } @@ -9900,13 +12811,11 @@ LITE ENDPOINT: lite/v1/set_initial_leverage
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/set_initial_leverage' \ + curl --location 'https://trades.grvt.io/full/v1/vault_investor_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "leverage": "10" + "vault_id": "3477045127917224" } ' ``` @@ -9918,11 +12827,9 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/set_initial_leverage", + "method": "v1/vault_investor_summary", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "leverage": "10" + "vault_id": "3477045127917224" }, "id": 123 } @@ -9932,13 +12839,11 @@ LITE ENDPOINT: lite/v1/set_initial_leverage
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/set_initial_leverage' \ + curl --location 'https://trades.grvt.io/lite/v1/vault_investor_summary' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "l": "10" + "vi": "3477045127917224" } ' ``` @@ -9950,11 +12855,9 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "j": "2.0", - "m": "v1/set_initial_leverage", + "m": "v1/vault_investor_summary", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "l": "10" + "vi": "3477045127917224" }, "i": 123 } @@ -9962,16 +12865,15 @@ LITE ENDPOINT: lite/v1/set_initial_leverage ```

-## Vault -### Vault Burn Tokens +### Vault Redeem ``` -FULL ENDPOINT: full/v1/vault_burn_tokens -LITE ENDPOINT: lite/v1/vault_burn_tokens +FULL ENDPOINT: full/v1/vault_redeem +LITE ENDPOINT: lite/v1/vault_redeem ``` === "Request"
- -8<- "docs/schemas/api_vault_burn_tokens_request.md" + -8<- "docs/schemas/api_vault_redeem_request.md"
!!! question "Query" @@ -10044,18 +12946,9 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens |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| - |1009|503|We are temporarily deactivating this API endpoint, please try again later| - |2000|403|Signature is from an unauthorized signer| - |2001|403|Signature has expired| - |2002|403|Signature does not match payload| - |2004|403|Signature is from an expired session key| - |2006|403|Signature R/S must have exactly 64 characters long without 0x prefix| - |2005|403|Signature V must be 27/28| - |2007|403|Signature S must be in the lower half of the curve| - |2008|403|Signature exceeds maximum allowed duration.| |7000|400|Vault ID provided is invalid and does not belong to any vault| - |7005|400|You are attempting to burn more vault tokens than you own.| - |7006|400|You are attempting to burn vault tokens whilst having an active redemption request.| + |7001|400|Vault does not have sufficient LP token balance| + |7002|400|User has an ongoing redemption|
!!! failure @@ -10084,7 +12977,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_burn_tokens' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_redeem' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10111,7 +13004,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "jsonrpc": "2.0", - "method": "v1/vault_burn_tokens", + "method": "v1/vault_redeem", "params": { "vault_id": "3477045127917224", "currency": "USDT", @@ -10134,7 +13027,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_burn_tokens' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_redeem' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10161,7 +13054,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "j": "2.0", - "m": "v1/vault_burn_tokens", + "m": "v1/vault_redeem", "p": { "vi": "3477045127917224", "c": "USDT", @@ -10185,7 +13078,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_burn_tokens' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_redeem' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10212,7 +13105,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "jsonrpc": "2.0", - "method": "v1/vault_burn_tokens", + "method": "v1/vault_redeem", "params": { "vault_id": "3477045127917224", "currency": "USDT", @@ -10235,7 +13128,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_burn_tokens' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_redeem' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10262,7 +13155,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "j": "2.0", - "m": "v1/vault_burn_tokens", + "m": "v1/vault_redeem", "p": { "vi": "3477045127917224", "c": "USDT", @@ -10286,7 +13179,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/vault_burn_tokens' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/vault_redeem' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10313,7 +13206,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "jsonrpc": "2.0", - "method": "v1/vault_burn_tokens", + "method": "v1/vault_redeem", "params": { "vault_id": "3477045127917224", "currency": "USDT", @@ -10336,7 +13229,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_burn_tokens' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_redeem' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10363,7 +13256,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "j": "2.0", - "m": "v1/vault_burn_tokens", + "m": "v1/vault_redeem", "p": { "vi": "3477045127917224", "c": "USDT", @@ -10387,7 +13280,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/vault_burn_tokens' \ + curl --location 'https://trades.grvt.io/full/v1/vault_redeem' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10414,7 +13307,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "jsonrpc": "2.0", - "method": "v1/vault_burn_tokens", + "method": "v1/vault_redeem", "params": { "vault_id": "3477045127917224", "currency": "USDT", @@ -10437,7 +13330,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/vault_burn_tokens' \ + curl --location 'https://trades.grvt.io/lite/v1/vault_redeem' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10464,7 +13357,7 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "j": "2.0", - "m": "v1/vault_burn_tokens", + "m": "v1/vault_redeem", "p": { "vi": "3477045127917224", "c": "USDT", @@ -10485,50 +13378,28 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens ```

-### Vault Invest +### Vault Redeem Cancel ``` -FULL ENDPOINT: full/v1/vault_invest -LITE ENDPOINT: lite/v1/vault_invest +FULL ENDPOINT: full/v1/vault_redeem_cancel +LITE ENDPOINT: lite/v1/vault_redeem_cancel ``` === "Request"
- -8<- "docs/schemas/api_vault_invest_request.md" + -8<- "docs/schemas/api_vault_redeem_cancel_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "3477045127917224" } ``` **Lite Request** ``` { .json .copy } { - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "3477045127917224" } ```
@@ -10566,19 +13437,7 @@ LITE ENDPOINT: lite/v1/vault_invest |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| - |1009|503|We are temporarily deactivating this API endpoint, please try again later| - |2000|403|Signature is from an unauthorized signer| - |2001|403|Signature has expired| - |2002|403|Signature does not match payload| - |2004|403|Signature is from an expired session key| - |2006|403|Signature R/S must have exactly 64 characters long without 0x prefix| - |2005|403|Signature V must be 27/28| - |2007|403|Signature S must be in the lower half of the curve| - |2008|403|Signature exceeds maximum allowed duration.| - |4000|400|Insufficient balance to complete transfer| |7000|400|Vault ID provided is invalid and does not belong to any vault| - |7003|400|This vault has been delisted/closed.| - |7004|400|This investment would cause the vault to exceed its valuation cap.|
!!! failure @@ -10607,22 +13466,11 @@ LITE ENDPOINT: lite/v1/vault_invest
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_invest' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "3477045127917224" } ' ``` @@ -10634,20 +13482,9 @@ LITE ENDPOINT: lite/v1/vault_invest -x ' { "jsonrpc": "2.0", - "method": "v1/vault_invest", + "method": "v1/vault_redeem_cancel", "params": { - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "3477045127917224" }, "id": 123 } @@ -10657,22 +13494,11 @@ LITE ENDPOINT: lite/v1/vault_invest
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_invest' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "3477045127917224" } ' ``` @@ -10684,20 +13510,9 @@ LITE ENDPOINT: lite/v1/vault_invest -x ' { "j": "2.0", - "m": "v1/vault_invest", + "m": "v1/vault_redeem_cancel", "p": { - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "3477045127917224" }, "i": 123 } @@ -10708,22 +13523,11 @@ LITE ENDPOINT: lite/v1/vault_invest
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_invest' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "3477045127917224" } ' ``` @@ -10735,20 +13539,9 @@ LITE ENDPOINT: lite/v1/vault_invest -x ' { "jsonrpc": "2.0", - "method": "v1/vault_invest", + "method": "v1/vault_redeem_cancel", "params": { - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "3477045127917224" }, "id": 123 } @@ -10758,22 +13551,11 @@ LITE ENDPOINT: lite/v1/vault_invest
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_invest' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "3477045127917224" } ' ``` @@ -10785,20 +13567,9 @@ LITE ENDPOINT: lite/v1/vault_invest -x ' { "j": "2.0", - "m": "v1/vault_invest", + "m": "v1/vault_redeem_cancel", "p": { - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "3477045127917224" }, "i": 123 } @@ -10809,22 +13580,11 @@ LITE ENDPOINT: lite/v1/vault_invest
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/vault_invest' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/vault_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "3477045127917224" } ' ``` @@ -10835,21 +13595,10 @@ LITE ENDPOINT: lite/v1/vault_invest -H "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ -x ' { - "jsonrpc": "2.0", - "method": "v1/vault_invest", - "params": { - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "jsonrpc": "2.0", + "method": "v1/vault_redeem_cancel", + "params": { + "vault_id": "3477045127917224" }, "id": 123 } @@ -10859,22 +13608,11 @@ LITE ENDPOINT: lite/v1/vault_invest
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_invest' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "3477045127917224" } ' ``` @@ -10886,20 +13624,9 @@ LITE ENDPOINT: lite/v1/vault_invest -x ' { "j": "2.0", - "m": "v1/vault_invest", + "m": "v1/vault_redeem_cancel", "p": { - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "3477045127917224" }, "i": 123 } @@ -10910,22 +13637,11 @@ LITE ENDPOINT: lite/v1/vault_invest
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/vault_invest' \ + curl --location 'https://trades.grvt.io/full/v1/vault_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "3477045127917224" } ' ``` @@ -10937,20 +13653,9 @@ LITE ENDPOINT: lite/v1/vault_invest -x ' { "jsonrpc": "2.0", - "method": "v1/vault_invest", + "method": "v1/vault_redeem_cancel", "params": { - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "3477045127917224" }, "id": 123 } @@ -10960,22 +13665,11 @@ LITE ENDPOINT: lite/v1/vault_invest
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/vault_invest' \ + curl --location 'https://trades.grvt.io/lite/v1/vault_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "3477045127917224" } ' ``` @@ -10987,20 +13681,9 @@ LITE ENDPOINT: lite/v1/vault_invest -x ' { "j": "2.0", - "m": "v1/vault_invest", + "m": "v1/vault_redeem_cancel", "p": { - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "3477045127917224" }, "i": 123 } @@ -11008,15 +13691,15 @@ LITE ENDPOINT: lite/v1/vault_invest ```

-### Vault Investor Summary +### Vault Redemption Queue ``` -FULL ENDPOINT: full/v1/vault_investor_summary -LITE ENDPOINT: lite/v1/vault_investor_summary +FULL ENDPOINT: full/v1/vault_view_redemption_queue +LITE ENDPOINT: lite/v1/vault_view_redemption_queue ``` === "Request"
- -8<- "docs/schemas/api_vault_investor_summary_request.md" + -8<- "docs/schemas/api_vault_view_redemption_queue_request.md"
!!! question "Query" @@ -11035,50 +13718,64 @@ LITE ENDPOINT: lite/v1/vault_investor_summary
=== "Response"
- -8<- "docs/schemas/api_vault_investor_summary_response.md" + -8<- "docs/schemas/api_vault_view_redemption_queue_response.md"
!!! success **Full Response** ``` { .json .copy } { - "vault_investor_summary": [{ - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "num_lp_tokens": 1000000, - "avg_entry_price": 1000000, - "current_price": 1000000, - "total_equity": 1000000, - "all_time_realized_pnl": 1000000, - "pending_redemption": { - "num_lp_tokens": 1000000, - "request_valuation": 1000000, + "redemption_queue": [{ + "request_time": "1697788800000000000", + "num_lp_tokens": "1000000", + "max_redemption_period_timestamp": "1727788800000000000", + "age_category": "NORMAL", + "is_manager": true, + "eligible_for_auto_redemption_timestamp": "1727788800000000000" + }], + "pending_redemption_token_count": "1000000", + "urgent_redemption_token_count": "0", + "auto_redeemable_balance": "0", + "share_price": "1.25", + "pre_min": { + "requests": [{ "request_time": "1697788800000000000", - "max_redemption_period_timestamp": 1727788800000000000, - "cancel_blocked": null - }, - "can_burn": null - }] + "num_lp_tokens": "1000000", + "max_redemption_period_timestamp": "1727788800000000000", + "age_category": "NORMAL", + "is_manager": true, + "eligible_for_auto_redemption_timestamp": "1727788800000000000" + }], + "token_count": "1000000" + } } ``` **Lite Response** ``` { .json .copy } { - "vi": [{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "nl": 1000000, - "ae": 1000000, - "cp": 1000000, - "te": 1000000, - "at": 1000000, - "pr": { - "nl": 1000000, - "rv": 1000000, + "rq": [{ + "rt": "1697788800000000000", + "nl": "1000000", + "mr": "1727788800000000000", + "ac": "NORMAL", + "im": true, + "ef": "1727788800000000000" + }], + "pr": "1000000", + "ur": "0", + "ar": "0", + "sp": "1.25", + "pm": { + "r": [{ "rt": "1697788800000000000", - "mr": 1727788800000000000, - "cb": null - }, - "cb": null - }] + "nl": "1000000", + "mr": "1727788800000000000", + "ac": "NORMAL", + "im": true, + "ef": "1727788800000000000" + }], + "tc": "1000000" + } } ```
@@ -11094,7 +13791,6 @@ LITE ENDPOINT: lite/v1/vault_investor_summary |1006|429|You have surpassed the allocated rate limit for your tier| |1008|401|Your IP has not been whitelisted for access| |7000|400|Vault ID provided is invalid and does not belong to any vault| - |7007|400|The investor is not an LP for this vault.|
!!! failure @@ -11123,7 +13819,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_investor_summary' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_view_redemption_queue' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11139,7 +13835,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "jsonrpc": "2.0", - "method": "v1/vault_investor_summary", + "method": "v1/vault_view_redemption_queue", "params": { "vault_id": "3477045127917224" }, @@ -11151,7 +13847,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_investor_summary' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_view_redemption_queue' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11167,7 +13863,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "j": "2.0", - "m": "v1/vault_investor_summary", + "m": "v1/vault_view_redemption_queue", "p": { "vi": "3477045127917224" }, @@ -11180,7 +13876,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_investor_summary' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_view_redemption_queue' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11196,7 +13892,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "jsonrpc": "2.0", - "method": "v1/vault_investor_summary", + "method": "v1/vault_view_redemption_queue", "params": { "vault_id": "3477045127917224" }, @@ -11208,7 +13904,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_investor_summary' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_view_redemption_queue' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11224,7 +13920,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "j": "2.0", - "m": "v1/vault_investor_summary", + "m": "v1/vault_view_redemption_queue", "p": { "vi": "3477045127917224" }, @@ -11237,7 +13933,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/vault_investor_summary' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/vault_view_redemption_queue' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11253,7 +13949,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "jsonrpc": "2.0", - "method": "v1/vault_investor_summary", + "method": "v1/vault_view_redemption_queue", "params": { "vault_id": "3477045127917224" }, @@ -11265,7 +13961,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_investor_summary' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_view_redemption_queue' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11281,7 +13977,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "j": "2.0", - "m": "v1/vault_investor_summary", + "m": "v1/vault_view_redemption_queue", "p": { "vi": "3477045127917224" }, @@ -11294,7 +13990,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/vault_investor_summary' \ + curl --location 'https://trades.grvt.io/full/v1/vault_view_redemption_queue' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11310,7 +14006,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "jsonrpc": "2.0", - "method": "v1/vault_investor_summary", + "method": "v1/vault_view_redemption_queue", "params": { "vault_id": "3477045127917224" }, @@ -11322,7 +14018,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/vault_investor_summary' \ + curl --location 'https://trades.grvt.io/lite/v1/vault_view_redemption_queue' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11338,7 +14034,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "j": "2.0", - "m": "v1/vault_investor_summary", + "m": "v1/vault_view_redemption_queue", "p": { "vi": "3477045127917224" }, @@ -11348,73 +14044,71 @@ LITE ENDPOINT: lite/v1/vault_investor_summary ```

-### Vault Redeem +### Vault Manager Investment History ``` -FULL ENDPOINT: full/v1/vault_redeem -LITE ENDPOINT: lite/v1/vault_redeem +FULL ENDPOINT: full/v1/vault_manager_investor_history +LITE ENDPOINT: lite/v1/vault_manager_investor_history ``` === "Request"
- -8<- "docs/schemas/api_vault_redeem_request.md" + -8<- "docs/schemas/api_query_vault_manager_investor_history_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" } ``` **Lite Request** ``` { .json .copy } { - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" } ```
=== "Response"
- -8<- "docs/schemas/ack_response.md" + -8<- "docs/schemas/api_query_vault_manager_investor_history_response.md"
!!! success **Full Response** ``` { .json .copy } { - "result": { - "ack": "true" - } + "result": [{ + "event_time": "1697788800000000000", + "off_chain_account_id": "ACC:123456", + "vault_id": "2312134", + "type": "VAULT_INVEST", + "price": "1000000", + "size": "1000000", + "realized_pnl": "1000000", + "performance_fee": "1000000" + }] } ``` **Lite Response** ``` { .json .copy } { - "r": { - "a": "true" - } + "r": [{ + "et": "1697788800000000000", + "oc": "ACC:123456", + "vi": "2312134", + "t": "VAULT_INVEST", + "p": "1000000", + "s": "1000000", + "rp": "1000000", + "pf": "1000000" + }] } ```
@@ -11429,9 +14123,6 @@ LITE ENDPOINT: lite/v1/vault_redeem |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| - |7000|400|Vault ID provided is invalid and does not belong to any vault| - |7001|400|Vault does not have sufficient LP token balance| - |7002|400|User has an ongoing redemption|
!!! failure @@ -11460,22 +14151,14 @@ LITE ENDPOINT: lite/v1/vault_redeem
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_redeem' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" } ' ``` @@ -11487,20 +14170,12 @@ LITE ENDPOINT: lite/v1/vault_redeem -x ' { "jsonrpc": "2.0", - "method": "v1/vault_redeem", + "method": "v1/vault_manager_investor_history", "params": { - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" }, "id": 123 } @@ -11510,22 +14185,14 @@ LITE ENDPOINT: lite/v1/vault_redeem
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_redeem' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" } ' ``` @@ -11537,20 +14204,12 @@ LITE ENDPOINT: lite/v1/vault_redeem -x ' { "j": "2.0", - "m": "v1/vault_redeem", + "m": "v1/vault_manager_investor_history", "p": { - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" }, "i": 123 } @@ -11561,22 +14220,14 @@ LITE ENDPOINT: lite/v1/vault_redeem
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_redeem' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" } ' ``` @@ -11588,20 +14239,12 @@ LITE ENDPOINT: lite/v1/vault_redeem -x ' { "jsonrpc": "2.0", - "method": "v1/vault_redeem", + "method": "v1/vault_manager_investor_history", "params": { - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" }, "id": 123 } @@ -11611,22 +14254,14 @@ LITE ENDPOINT: lite/v1/vault_redeem
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_redeem' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" } ' ``` @@ -11638,20 +14273,12 @@ LITE ENDPOINT: lite/v1/vault_redeem -x ' { "j": "2.0", - "m": "v1/vault_redeem", + "m": "v1/vault_manager_investor_history", "p": { - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" }, "i": 123 } @@ -11662,22 +14289,14 @@ LITE ENDPOINT: lite/v1/vault_redeem
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/vault_redeem' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" } ' ``` @@ -11689,20 +14308,12 @@ LITE ENDPOINT: lite/v1/vault_redeem -x ' { "jsonrpc": "2.0", - "method": "v1/vault_redeem", + "method": "v1/vault_manager_investor_history", "params": { - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" }, "id": 123 } @@ -11712,22 +14323,14 @@ LITE ENDPOINT: lite/v1/vault_redeem
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_redeem' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" } ' ``` @@ -11739,20 +14342,12 @@ LITE ENDPOINT: lite/v1/vault_redeem -x ' { "j": "2.0", - "m": "v1/vault_redeem", + "m": "v1/vault_manager_investor_history", "p": { - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" }, "i": 123 } @@ -11763,22 +14358,14 @@ LITE ENDPOINT: lite/v1/vault_redeem
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/vault_redeem' \ + curl --location 'https://trades.grvt.io/full/v1/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" } ' ``` @@ -11790,20 +14377,12 @@ LITE ENDPOINT: lite/v1/vault_redeem -x ' { "jsonrpc": "2.0", - "method": "v1/vault_redeem", + "method": "v1/vault_manager_investor_history", "params": { - "vault_id": "3477045127917224", - "currency": "USDT", - "num_tokens": 1000000, - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" }, "id": 123 } @@ -11813,22 +14392,14 @@ LITE ENDPOINT: lite/v1/vault_redeem
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/vault_redeem' \ + curl --location 'https://trades.grvt.io/lite/v1/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" } ' ``` @@ -11840,20 +14411,12 @@ LITE ENDPOINT: lite/v1/vault_redeem -x ' { "j": "2.0", - "m": "v1/vault_redeem", + "m": "v1/vault_manager_investor_history", "p": { - "vi": "3477045127917224", - "c": "USDT", - "nt": 1000000, - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" }, "i": 123 } @@ -11861,28 +14424,53 @@ LITE ENDPOINT: lite/v1/vault_redeem ```

-### Vault Redeem Cancel +## Builder +### Authorize Builder ``` -FULL ENDPOINT: full/v1/vault_redeem_cancel -LITE ENDPOINT: lite/v1/vault_redeem_cancel +FULL ENDPOINT: full/v1/authorize_builder +LITE ENDPOINT: lite/v1/authorize_builder ``` === "Request"
- -8<- "docs/schemas/api_vault_redeem_cancel_request.md" + -8<- "docs/schemas/api_authorize_builder_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "vault_id": "3477045127917224" + "main_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "max_futures_fee_rate": 0.001, + "max_spot_fee_rate": 0.0001, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ``` **Lite Request** ``` { .json .copy } { - "vi": "3477045127917224" + "ma": "'$GRVT_MAIN_ACCOUNT_ID'", + "ba": "'$GRVT_MAIN_ACCOUNT_ID'", + "mf": 0.001, + "ms": 0.0001, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ```
@@ -11920,7 +14508,10 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel |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| - |7000|400|Vault ID provided is invalid and does not belong to any vault| + |7500|400|Builder Fee exceeds the allowed program limit.| + |7501|400|Builder Fee can't be negative.| + |7502|400|Builder Account does not exist.| + |7503|400|Builder is already authorized for this account with the given fee.|
!!! failure @@ -11949,11 +14540,23 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_redeem_cancel' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/authorize_builder' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224" + "main_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "max_futures_fee_rate": 0.001, + "max_spot_fee_rate": 0.0001, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -11965,9 +14568,21 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "jsonrpc": "2.0", - "method": "v1/vault_redeem_cancel", + "method": "v1/authorize_builder", "params": { - "vault_id": "3477045127917224" + "main_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "max_futures_fee_rate": 0.001, + "max_spot_fee_rate": 0.0001, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } }, "id": 123 } @@ -11977,11 +14592,23 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_redeem_cancel' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/authorize_builder' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224" + "ma": "'$GRVT_MAIN_ACCOUNT_ID'", + "ba": "'$GRVT_MAIN_ACCOUNT_ID'", + "mf": 0.001, + "ms": 0.0001, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -11993,9 +14620,21 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "j": "2.0", - "m": "v1/vault_redeem_cancel", + "m": "v1/authorize_builder", "p": { - "vi": "3477045127917224" + "ma": "'$GRVT_MAIN_ACCOUNT_ID'", + "ba": "'$GRVT_MAIN_ACCOUNT_ID'", + "mf": 0.001, + "ms": 0.0001, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -12006,11 +14645,23 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_redeem_cancel' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/authorize_builder' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224" + "main_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "max_futures_fee_rate": 0.001, + "max_spot_fee_rate": 0.0001, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -12022,9 +14673,21 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "jsonrpc": "2.0", - "method": "v1/vault_redeem_cancel", + "method": "v1/authorize_builder", "params": { - "vault_id": "3477045127917224" + "main_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "max_futures_fee_rate": 0.001, + "max_spot_fee_rate": 0.0001, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } }, "id": 123 } @@ -12034,11 +14697,23 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_redeem_cancel' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/authorize_builder' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224" + "ma": "'$GRVT_MAIN_ACCOUNT_ID'", + "ba": "'$GRVT_MAIN_ACCOUNT_ID'", + "mf": 0.001, + "ms": 0.0001, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -12050,9 +14725,21 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "j": "2.0", - "m": "v1/vault_redeem_cancel", + "m": "v1/authorize_builder", "p": { - "vi": "3477045127917224" + "ma": "'$GRVT_MAIN_ACCOUNT_ID'", + "ba": "'$GRVT_MAIN_ACCOUNT_ID'", + "mf": 0.001, + "ms": 0.0001, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -12063,11 +14750,23 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/vault_redeem_cancel' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/authorize_builder' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224" + "main_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "max_futures_fee_rate": 0.001, + "max_spot_fee_rate": 0.0001, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -12079,9 +14778,21 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "jsonrpc": "2.0", - "method": "v1/vault_redeem_cancel", + "method": "v1/authorize_builder", "params": { - "vault_id": "3477045127917224" + "main_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "max_futures_fee_rate": 0.001, + "max_spot_fee_rate": 0.0001, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } }, "id": 123 } @@ -12091,11 +14802,23 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_redeem_cancel' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/authorize_builder' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224" + "ma": "'$GRVT_MAIN_ACCOUNT_ID'", + "ba": "'$GRVT_MAIN_ACCOUNT_ID'", + "mf": 0.001, + "ms": 0.0001, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -12107,9 +14830,21 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "j": "2.0", - "m": "v1/vault_redeem_cancel", + "m": "v1/authorize_builder", "p": { - "vi": "3477045127917224" + "ma": "'$GRVT_MAIN_ACCOUNT_ID'", + "ba": "'$GRVT_MAIN_ACCOUNT_ID'", + "mf": 0.001, + "ms": 0.0001, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -12120,11 +14855,23 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/vault_redeem_cancel' \ + curl --location 'https://trades.grvt.io/full/v1/authorize_builder' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224" + "main_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "max_futures_fee_rate": 0.001, + "max_spot_fee_rate": 0.0001, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -12136,9 +14883,21 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "jsonrpc": "2.0", - "method": "v1/vault_redeem_cancel", + "method": "v1/authorize_builder", "params": { - "vault_id": "3477045127917224" + "main_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "max_futures_fee_rate": 0.001, + "max_spot_fee_rate": 0.0001, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } }, "id": 123 } @@ -12148,11 +14907,23 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/vault_redeem_cancel' \ + curl --location 'https://trades.grvt.io/lite/v1/authorize_builder' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224" + "ma": "'$GRVT_MAIN_ACCOUNT_ID'", + "ba": "'$GRVT_MAIN_ACCOUNT_ID'", + "mf": 0.001, + "ms": 0.0001, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -12164,9 +14935,21 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "j": "2.0", - "m": "v1/vault_redeem_cancel", + "m": "v1/authorize_builder", "p": { - "vi": "3477045127917224" + "ma": "'$GRVT_MAIN_ACCOUNT_ID'", + "ba": "'$GRVT_MAIN_ACCOUNT_ID'", + "mf": 0.001, + "ms": 0.0001, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -12174,91 +14957,53 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel ```

-### Vault Redemption Queue +### Get Authorized Builders ``` -FULL ENDPOINT: full/v1/vault_view_redemption_queue -LITE ENDPOINT: lite/v1/vault_view_redemption_queue +FULL ENDPOINT: full/v1/get_authorized_builders +LITE ENDPOINT: lite/v1/get_authorized_builders ``` === "Request"
- -8<- "docs/schemas/api_vault_view_redemption_queue_request.md" + -8<- "docs/schemas/empty_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "vault_id": "3477045127917224" } ``` **Lite Request** ``` { .json .copy } { - "vi": "3477045127917224" } ```
=== "Response"
- -8<- "docs/schemas/api_vault_view_redemption_queue_response.md" + -8<- "docs/schemas/api_get_authorized_builders_response.md"
!!! success **Full Response** ``` { .json .copy } { - "redemption_queue": [{ - "request_time": "1697788800000000000", - "num_lp_tokens": "1000000", - "max_redemption_period_timestamp": "1727788800000000000", - "age_category": "NORMAL", - "is_manager": true, - "eligible_for_auto_redemption_timestamp": "1727788800000000000" - }], - "pending_redemption_token_count": "1000000", - "urgent_redemption_token_count": "0", - "auto_redeemable_balance": "0", - "share_price": "1.25", - "pre_min": { - "requests": [{ - "request_time": "1697788800000000000", - "num_lp_tokens": "1000000", - "max_redemption_period_timestamp": "1727788800000000000", - "age_category": "NORMAL", - "is_manager": true, - "eligible_for_auto_redemption_timestamp": "1727788800000000000" - }], - "token_count": "1000000" - } + "results": [{ + "builder_account_id": "'$GRVT_MAIN_ACCOUNT_ID'", + "max_futures_fee_rate": 0.001, + "max_spot_fee_rate": 0.0001 + }] } ``` **Lite Response** ``` { .json .copy } { - "rq": [{ - "rt": "1697788800000000000", - "nl": "1000000", - "mr": "1727788800000000000", - "ac": "NORMAL", - "im": true, - "ef": "1727788800000000000" - }], - "pr": "1000000", - "ur": "0", - "ar": "0", - "sp": "1.25", - "pm": { - "r": [{ - "rt": "1697788800000000000", - "nl": "1000000", - "mr": "1727788800000000000", - "ac": "NORMAL", - "im": true, - "ef": "1727788800000000000" - }], - "tc": "1000000" - } + "r": [{ + "ba": "'$GRVT_MAIN_ACCOUNT_ID'", + "mf": 0.001, + "ms": 0.0001 + }] } ```
@@ -12273,7 +15018,6 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue |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| - |7000|400|Vault ID provided is invalid and does not belong to any vault|
!!! failure @@ -12302,11 +15046,10 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_view_redemption_queue' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/get_authorized_builders' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224" } ' ``` @@ -12318,9 +15061,8 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue -x ' { "jsonrpc": "2.0", - "method": "v1/vault_view_redemption_queue", + "method": "v1/get_authorized_builders", "params": { - "vault_id": "3477045127917224" }, "id": 123 } @@ -12330,11 +15072,10 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_view_redemption_queue' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/get_authorized_builders' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224" } ' ``` @@ -12346,9 +15087,8 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue -x ' { "j": "2.0", - "m": "v1/vault_view_redemption_queue", + "m": "v1/get_authorized_builders", "p": { - "vi": "3477045127917224" }, "i": 123 } @@ -12359,11 +15099,10 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_view_redemption_queue' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/get_authorized_builders' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224" } ' ``` @@ -12375,9 +15114,8 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue -x ' { "jsonrpc": "2.0", - "method": "v1/vault_view_redemption_queue", + "method": "v1/get_authorized_builders", "params": { - "vault_id": "3477045127917224" }, "id": 123 } @@ -12387,11 +15125,10 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_view_redemption_queue' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/get_authorized_builders' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224" } ' ``` @@ -12403,9 +15140,8 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue -x ' { "j": "2.0", - "m": "v1/vault_view_redemption_queue", + "m": "v1/get_authorized_builders", "p": { - "vi": "3477045127917224" }, "i": 123 } @@ -12416,11 +15152,10 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/vault_view_redemption_queue' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/get_authorized_builders' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224" } ' ``` @@ -12432,9 +15167,8 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue -x ' { "jsonrpc": "2.0", - "method": "v1/vault_view_redemption_queue", + "method": "v1/get_authorized_builders", "params": { - "vault_id": "3477045127917224" }, "id": 123 } @@ -12444,11 +15178,10 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_view_redemption_queue' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/get_authorized_builders' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224" } ' ``` @@ -12460,9 +15193,8 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue -x ' { "j": "2.0", - "m": "v1/vault_view_redemption_queue", + "m": "v1/get_authorized_builders", "p": { - "vi": "3477045127917224" }, "i": 123 } @@ -12473,11 +15205,10 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/vault_view_redemption_queue' \ + curl --location 'https://trades.grvt.io/full/v1/get_authorized_builders' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224" } ' ``` @@ -12489,9 +15220,8 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue -x ' { "jsonrpc": "2.0", - "method": "v1/vault_view_redemption_queue", + "method": "v1/get_authorized_builders", "params": { - "vault_id": "3477045127917224" }, "id": 123 } @@ -12501,11 +15231,10 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/vault_view_redemption_queue' \ + curl --location 'https://trades.grvt.io/lite/v1/get_authorized_builders' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224" } ' ``` @@ -12517,9 +15246,8 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue -x ' { "j": "2.0", - "m": "v1/vault_view_redemption_queue", + "m": "v1/get_authorized_builders", "p": { - "vi": "3477045127917224" }, "i": 123 } @@ -12527,40 +15255,41 @@ LITE ENDPOINT: lite/v1/vault_view_redemption_queue ```

-### Vault Manager Investment History +## Execution +### Builder Fill History ``` -FULL ENDPOINT: full/v1/vault_manager_investor_history -LITE ENDPOINT: lite/v1/vault_manager_investor_history +FULL ENDPOINT: full/v1/builder_fill_history +LITE ENDPOINT: lite/v1/builder_fill_history ``` === "Request"
- -8<- "docs/schemas/api_query_vault_manager_investor_history_request.md" + -8<- "docs/schemas/api_builder_fill_history_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "vault_id": "2312134", - "only_own_investments": true, "start_time": "1697788800000000000", - "end_time": "1697788800000000000" + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ``` **Lite Request** ``` { .json .copy } { - "vi": "2312134", - "oo": true, "st": "1697788800000000000", - "et": "1697788800000000000" + "et": "1697788800000000000", + "l": 500, + "c": "" } ```
=== "Response"
- -8<- "docs/schemas/api_query_vault_manager_investor_history_response.md" + -8<- "docs/schemas/api_builder_fill_history_response.md"
!!! success @@ -12570,13 +15299,17 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history "result": [{ "event_time": "1697788800000000000", "off_chain_account_id": "ACC:123456", - "vault_id": "2312134", - "type": "VAULT_INVEST", - "price": "1000000", - "size": "1000000", - "realized_pnl": "1000000", - "performance_fee": "1000000" - }] + "instrument": "BTC_USDT_Perp", + "is_buyer": true, + "is_taker": true, + "size": "0.30", + "price": "65038.01", + "mark_price": "65038.01", + "index_price": "65038.01", + "fee_rate": 0.001, + "fee": null + }], + "next": "Qw0918=" } ``` **Lite Response** @@ -12585,13 +15318,17 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history "r": [{ "et": "1697788800000000000", "oc": "ACC:123456", - "vi": "2312134", - "t": "VAULT_INVEST", - "p": "1000000", - "s": "1000000", - "rp": "1000000", - "pf": "1000000" - }] + "i": "BTC_USDT_Perp", + "ib": true, + "it": true, + "s": "0.30", + "p": "65038.01", + "mp": "65038.01", + "ip": "65038.01", + "fr": 0.001, + "f": null + }], + "n": "Qw0918=" } ```
@@ -12634,14 +15371,14 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/full/v1/vault_manager_investor_history' \ + curl --location 'https://trades.dev.gravitymarkets.io/full/v1/builder_fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "2312134", - "only_own_investments": true, "start_time": "1697788800000000000", - "end_time": "1697788800000000000" + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ' ``` @@ -12653,12 +15390,12 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history -x ' { "jsonrpc": "2.0", - "method": "v1/vault_manager_investor_history", + "method": "v1/builder_fill_history", "params": { - "vault_id": "2312134", - "only_own_investments": true, "start_time": "1697788800000000000", - "end_time": "1697788800000000000" + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" }, "id": 123 } @@ -12668,14 +15405,14 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/vault_manager_investor_history' \ + curl --location 'https://trades.dev.gravitymarkets.io/lite/v1/builder_fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "2312134", - "oo": true, "st": "1697788800000000000", - "et": "1697788800000000000" + "et": "1697788800000000000", + "l": 500, + "c": "" } ' ``` @@ -12687,12 +15424,12 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history -x ' { "j": "2.0", - "m": "v1/vault_manager_investor_history", + "m": "v1/builder_fill_history", "p": { - "vi": "2312134", - "oo": true, "st": "1697788800000000000", - "et": "1697788800000000000" + "et": "1697788800000000000", + "l": 500, + "c": "" }, "i": 123 } @@ -12703,14 +15440,14 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/full/v1/vault_manager_investor_history' \ + curl --location 'https://trades.staging.gravitymarkets.io/full/v1/builder_fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "2312134", - "only_own_investments": true, "start_time": "1697788800000000000", - "end_time": "1697788800000000000" + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ' ``` @@ -12722,12 +15459,12 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history -x ' { "jsonrpc": "2.0", - "method": "v1/vault_manager_investor_history", + "method": "v1/builder_fill_history", "params": { - "vault_id": "2312134", - "only_own_investments": true, "start_time": "1697788800000000000", - "end_time": "1697788800000000000" + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" }, "id": 123 } @@ -12737,14 +15474,14 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/vault_manager_investor_history' \ + curl --location 'https://trades.staging.gravitymarkets.io/lite/v1/builder_fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "2312134", - "oo": true, "st": "1697788800000000000", - "et": "1697788800000000000" + "et": "1697788800000000000", + "l": 500, + "c": "" } ' ``` @@ -12756,12 +15493,12 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history -x ' { "j": "2.0", - "m": "v1/vault_manager_investor_history", + "m": "v1/builder_fill_history", "p": { - "vi": "2312134", - "oo": true, "st": "1697788800000000000", - "et": "1697788800000000000" + "et": "1697788800000000000", + "l": 500, + "c": "" }, "i": 123 } @@ -12772,14 +15509,14 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/full/v1/vault_manager_investor_history' \ + curl --location 'https://trades.testnet.grvt.io/full/v1/builder_fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "2312134", - "only_own_investments": true, "start_time": "1697788800000000000", - "end_time": "1697788800000000000" + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ' ``` @@ -12791,12 +15528,12 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history -x ' { "jsonrpc": "2.0", - "method": "v1/vault_manager_investor_history", + "method": "v1/builder_fill_history", "params": { - "vault_id": "2312134", - "only_own_investments": true, "start_time": "1697788800000000000", - "end_time": "1697788800000000000" + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" }, "id": 123 } @@ -12806,14 +15543,14 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.testnet.grvt.io/lite/v1/vault_manager_investor_history' \ + curl --location 'https://trades.testnet.grvt.io/lite/v1/builder_fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "2312134", - "oo": true, "st": "1697788800000000000", - "et": "1697788800000000000" + "et": "1697788800000000000", + "l": 500, + "c": "" } ' ``` @@ -12825,12 +15562,12 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history -x ' { "j": "2.0", - "m": "v1/vault_manager_investor_history", + "m": "v1/builder_fill_history", "p": { - "vi": "2312134", - "oo": true, "st": "1697788800000000000", - "et": "1697788800000000000" + "et": "1697788800000000000", + "l": 500, + "c": "" }, "i": 123 } @@ -12841,14 +15578,14 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history
!!! example "REST Full" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/full/v1/vault_manager_investor_history' \ + curl --location 'https://trades.grvt.io/full/v1/builder_fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "2312134", - "only_own_investments": true, "start_time": "1697788800000000000", - "end_time": "1697788800000000000" + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" } ' ``` @@ -12860,12 +15597,12 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history -x ' { "jsonrpc": "2.0", - "method": "v1/vault_manager_investor_history", + "method": "v1/builder_fill_history", "params": { - "vault_id": "2312134", - "only_own_investments": true, "start_time": "1697788800000000000", - "end_time": "1697788800000000000" + "end_time": "1697788800000000000", + "limit": 500, + "cursor": "" }, "id": 123 } @@ -12875,14 +15612,14 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history
!!! example "REST Lite" ``` { .bash .copy } - curl --location 'https://trades.grvt.io/lite/v1/vault_manager_investor_history' \ + curl --location 'https://trades.grvt.io/lite/v1/builder_fill_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "2312134", - "oo": true, "st": "1697788800000000000", - "et": "1697788800000000000" + "et": "1697788800000000000", + "l": 500, + "c": "" } ' ``` @@ -12894,12 +15631,12 @@ LITE ENDPOINT: lite/v1/vault_manager_investor_history -x ' { "j": "2.0", - "m": "v1/vault_manager_investor_history", + "m": "v1/builder_fill_history", "p": { - "vi": "2312134", - "oo": true, "st": "1697788800000000000", - "et": "1697788800000000000" + "et": "1697788800000000000", + "l": 500, + "c": "" }, "i": 123 } diff --git a/artifacts/apidocs/trading_streams.md b/artifacts/apidocs/trading_streams.md index fcdd183..2d44283 100644 --- a/artifacts/apidocs/trading_streams.md +++ b/artifacts/apidocs/trading_streams.md @@ -150,7 +150,9 @@ STREAM: v1.order "traded_size": ["1.5"], "update_time": "1697788800000000000", "avg_fill_price": ["60000.4"] - } + }, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee": 0.001 } } ``` @@ -202,7 +204,9 @@ STREAM: v1.order "ts": ["1.5"], "ut": "1697788800000000000", "af": ["60000.4"] - } + }, + "b": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001 } } ``` @@ -2007,10 +2011,14 @@ STREAM: v1.fill "trade_id": "209358-2", "order_id": "0x10000101000203040506", "venue": "ORDERBOOK", + "is_liquidation": false, "client_order_id": "23042", "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "broker": "UNSPECIFIED", - "is_rpi": false + "is_rpi": false, + "builder": "'$GRVT_MAIN_ACCOUNT_ID'", + "builder_fee_rate": 0.001, + "builder_fee": "0.2" } } ``` @@ -2038,10 +2046,14 @@ STREAM: v1.fill "ti": "209358-2", "oi": "0x10000101000203040506", "v": "ORDERBOOK", + "il": false, "co": "23042", "s1": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", "b": "UNSPECIFIED", - "ir1": false + "ir1": false, + "b1": "'$GRVT_MAIN_ACCOUNT_ID'", + "bf": 0.001, + "bf1": "0.2" } } ``` @@ -2636,7 +2648,11 @@ STREAM: v1.position "est_liquidation_price": 60000.25, "leverage": "10", "cumulative_fee": "100000.20", - "cumulative_realized_funding_payment": "100000.20" + "cumulative_realized_funding_payment": "100000.20", + "margin_type": "cross", + "isolated_balance": "100000.20", + "isolated_im": "100000.20", + "isolated_mm": "100000.20" } } ``` @@ -2663,7 +2679,11 @@ STREAM: v1.position "el": 60000.25, "l": "10", "cf": "100000.20", - "cr": "100000.20" + "cr": "100000.20", + "mt": "cross", + "ib": "100000.20", + "ii": "100000.20", + "im": "100000.20" } } ``` diff --git a/artifacts/pysdk/grvt_raw_async.py b/artifacts/pysdk/grvt_raw_async.py index 0e5cb75..1cd9da3 100644 --- a/artifacts/pysdk/grvt_raw_async.py +++ b/artifacts/pysdk/grvt_raw_async.py @@ -176,6 +176,18 @@ async def fill_history_v1( return GrvtError(**resp) return from_dict(types.ApiFillHistoryResponse, resp, Config(cast=[Enum])) + async def funding_payment_history_v1( + self, req: types.ApiFundingPaymentHistoryRequest + ) -> types.ApiFundingPaymentHistoryResponse | GrvtError: + resp = await self._post( + True, self.td_rpc + "/full/v1/funding_payment_history", req + ) + if resp.get("code"): + return GrvtError(**resp) + return from_dict( + types.ApiFundingPaymentHistoryResponse, resp, Config(cast=[Enum]) + ) + async def positions_v1( self, req: types.ApiPositionsRequest ) -> types.ApiPositionsResponse | GrvtError: @@ -184,16 +196,36 @@ async def positions_v1( return GrvtError(**resp) return from_dict(types.ApiPositionsResponse, resp, Config(cast=[Enum])) - async def funding_payment_history_v1( - self, req: types.ApiFundingPaymentHistoryRequest - ) -> types.ApiFundingPaymentHistoryResponse | GrvtError: + async def set_position_config_v1( + self, req: types.ApiSetSubAccountPositionMarginConfigRequest + ) -> types.ApiSetSubAccountPositionMarginConfigResponse | GrvtError: + resp = await self._post(True, self.td_rpc + "/full/v1/set_position_config", req) + if resp.get("code"): + return GrvtError(**resp) + return from_dict( + types.ApiSetSubAccountPositionMarginConfigResponse, resp, Config(cast=[Enum]) + ) + + async def add_position_margin_v1( + self, req: types.ApiAddIsolatedPositionMarginRequest + ) -> types.ApiAddIsolatedPositionMarginResponse | GrvtError: + resp = await self._post(True, self.td_rpc + "/full/v1/add_position_margin", req) + if resp.get("code"): + return GrvtError(**resp) + return from_dict( + types.ApiAddIsolatedPositionMarginResponse, resp, Config(cast=[Enum]) + ) + + async def get_position_margin_limits_v1( + self, req: types.ApiGetIsolatedPositionMarginLimitsRequest + ) -> types.ApiGetIsolatedPositionMarginLimitsResponse | GrvtError: resp = await self._post( - True, self.td_rpc + "/full/v1/funding_payment_history", req + True, self.td_rpc + "/full/v1/get_position_margin_limits", req ) if resp.get("code"): return GrvtError(**resp) return from_dict( - types.ApiFundingPaymentHistoryResponse, resp, Config(cast=[Enum]) + types.ApiGetIsolatedPositionMarginLimitsResponse, resp, Config(cast=[Enum]) ) async def deposit_history_v1( @@ -371,3 +403,31 @@ async def vault_manager_investment_history_v1( return from_dict( types.ApiQueryVaultManagerInvestorHistoryResponse, resp, Config(cast=[Enum]) ) + + async def authorize_builder_v1( + self, req: types.ApiAuthorizeBuilderRequest + ) -> types.AckResponse | GrvtError: + resp = await self._post(True, self.td_rpc + "/full/v1/authorize_builder", req) + if resp.get("code"): + return GrvtError(**resp) + return from_dict(types.AckResponse, resp, Config(cast=[Enum])) + + async def get_authorized_builders_v1( + self, req: types.EmptyRequest + ) -> types.ApiGetAuthorizedBuildersResponse | GrvtError: + resp = await self._post( + True, self.td_rpc + "/full/v1/get_authorized_builders", req + ) + if resp.get("code"): + return GrvtError(**resp) + return from_dict( + types.ApiGetAuthorizedBuildersResponse, resp, Config(cast=[Enum]) + ) + + async def builder_fill_history_v1( + self, req: types.ApiBuilderFillHistoryRequest + ) -> types.ApiBuilderFillHistoryResponse | GrvtError: + resp = await self._post(True, self.td_rpc + "/full/v1/builder_fill_history", req) + if resp.get("code"): + return GrvtError(**resp) + return from_dict(types.ApiBuilderFillHistoryResponse, resp, Config(cast=[Enum])) diff --git a/artifacts/pysdk/grvt_raw_sync.py b/artifacts/pysdk/grvt_raw_sync.py index 166de01..8d515f6 100644 --- a/artifacts/pysdk/grvt_raw_sync.py +++ b/artifacts/pysdk/grvt_raw_sync.py @@ -174,6 +174,16 @@ def fill_history_v1( return GrvtError(**resp) return from_dict(types.ApiFillHistoryResponse, resp, Config(cast=[Enum])) + def funding_payment_history_v1( + self, req: types.ApiFundingPaymentHistoryRequest + ) -> types.ApiFundingPaymentHistoryResponse | GrvtError: + resp = self._post(True, self.td_rpc + "/full/v1/funding_payment_history", req) + if resp.get("code"): + return GrvtError(**resp) + return from_dict( + types.ApiFundingPaymentHistoryResponse, resp, Config(cast=[Enum]) + ) + def positions_v1( self, req: types.ApiPositionsRequest ) -> types.ApiPositionsResponse | GrvtError: @@ -182,14 +192,34 @@ def positions_v1( return GrvtError(**resp) return from_dict(types.ApiPositionsResponse, resp, Config(cast=[Enum])) - def funding_payment_history_v1( - self, req: types.ApiFundingPaymentHistoryRequest - ) -> types.ApiFundingPaymentHistoryResponse | GrvtError: - resp = self._post(True, self.td_rpc + "/full/v1/funding_payment_history", req) + def set_position_config_v1( + self, req: types.ApiSetSubAccountPositionMarginConfigRequest + ) -> types.ApiSetSubAccountPositionMarginConfigResponse | GrvtError: + resp = self._post(True, self.td_rpc + "/full/v1/set_position_config", req) if resp.get("code"): return GrvtError(**resp) return from_dict( - types.ApiFundingPaymentHistoryResponse, resp, Config(cast=[Enum]) + types.ApiSetSubAccountPositionMarginConfigResponse, resp, Config(cast=[Enum]) + ) + + def add_position_margin_v1( + self, req: types.ApiAddIsolatedPositionMarginRequest + ) -> types.ApiAddIsolatedPositionMarginResponse | GrvtError: + resp = self._post(True, self.td_rpc + "/full/v1/add_position_margin", req) + if resp.get("code"): + return GrvtError(**resp) + return from_dict( + types.ApiAddIsolatedPositionMarginResponse, resp, Config(cast=[Enum]) + ) + + def get_position_margin_limits_v1( + self, req: types.ApiGetIsolatedPositionMarginLimitsRequest + ) -> types.ApiGetIsolatedPositionMarginLimitsResponse | GrvtError: + resp = self._post(True, self.td_rpc + "/full/v1/get_position_margin_limits", req) + if resp.get("code"): + return GrvtError(**resp) + return from_dict( + types.ApiGetIsolatedPositionMarginLimitsResponse, resp, Config(cast=[Enum]) ) def deposit_history_v1( @@ -357,3 +387,29 @@ def vault_manager_investment_history_v1( return from_dict( types.ApiQueryVaultManagerInvestorHistoryResponse, resp, Config(cast=[Enum]) ) + + def authorize_builder_v1( + self, req: types.ApiAuthorizeBuilderRequest + ) -> types.AckResponse | GrvtError: + resp = self._post(True, self.td_rpc + "/full/v1/authorize_builder", req) + if resp.get("code"): + return GrvtError(**resp) + return from_dict(types.AckResponse, resp, Config(cast=[Enum])) + + def get_authorized_builders_v1( + self, req: types.EmptyRequest + ) -> types.ApiGetAuthorizedBuildersResponse | GrvtError: + resp = self._post(True, self.td_rpc + "/full/v1/get_authorized_builders", req) + if resp.get("code"): + return GrvtError(**resp) + return from_dict( + types.ApiGetAuthorizedBuildersResponse, resp, Config(cast=[Enum]) + ) + + def builder_fill_history_v1( + self, req: types.ApiBuilderFillHistoryRequest + ) -> types.ApiBuilderFillHistoryResponse | GrvtError: + resp = self._post(True, self.td_rpc + "/full/v1/builder_fill_history", req) + if resp.get("code"): + return GrvtError(**resp) + return from_dict(types.ApiBuilderFillHistoryResponse, resp, Config(cast=[Enum])) diff --git a/artifacts/pysdk/grvt_raw_types.py b/artifacts/pysdk/grvt_raw_types.py index 1e55674..c2456ef 100644 --- a/artifacts/pysdk/grvt_raw_types.py +++ b/artifacts/pysdk/grvt_raw_types.py @@ -198,6 +198,14 @@ class OrderRejectReason(Enum): CURRENCY_NOT_DEFINED = "CURRENCY_NOT_DEFINED" # the chain ID is invalid INVALID_CHAIN_ID = "INVALID_CHAIN_ID" + # Builder fee exceed the limit + BUILDER_ORDER_FEE_EXCEED = "BUILDER_ORDER_FEE_EXCEED" + # Builder fee is below 0 + BUILDER_ORDER_FEE_NEGATIVE = "BUILDER_ORDER_FEE_NEGATIVE" + # Builder is not an authorized builder for client + BUILDER_ORDER_BUILDER_NOT_AUTHORIZED = "BUILDER_ORDER_BUILDER_NOT_AUTHORIZED" + # Builder does not exist + BUILDER_ORDER_BUILDER_NOT_EXIST = "BUILDER_ORDER_BUILDER_NOT_EXIST" class OrderStatus(Enum): @@ -213,6 +221,13 @@ class OrderStatus(Enum): CANCELLED = "CANCELLED" +class PositionMarginType(Enum): + # Isolated Margin Mode: each position is allocated a fixed amount of collateral + ISOLATED = "ISOLATED" + # Cross Margin Mode: uses all available funds in your account as collateral across all cross margin positions + CROSS = "CROSS" + + class TimeInForce(Enum): """ | | Must Fill All | Can Fill Partial | @@ -325,79 +340,258 @@ class Venue(Enum): @dataclass -class ApiPositionsRequest: - # The sub account ID to request for - sub_account_id: str - # The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned - kind: list[Kind] | None = None - # The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned - base: list[str] | None = None - # The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned - quote: list[str] | None = None +class Ack: + # Gravity has acknowledged that the request has been successfully received and it will process it in the backend + ack: bool @dataclass -class Positions: - # Time at which the event was emitted in unix nanoseconds - event_time: str - # The sub account ID that participated in the trade +class AckResponse: + # The Ack Object + result: Ack + + +@dataclass +class AggregatedAccountSummary: + # The main account ID of the account to which the summary belongs + main_account_id: str + # Total equity of the main (+ sub) account, denominated in USD + total_equity: str + # The list of spot assets owned by this main (+ sub) account, and their balances + spot_balances: list[SpotBalance] + # The list of vault investments held by this main account + vault_investments: list[VaultInvestment] + # Deprecated: Use totalSubAccountEquity instead + total_sub_account_balance: str + # Total equity of the sub accounts, denominated in USD + total_sub_account_equity: str + # Total amount of the vault investments, denominated in USD + total_vault_investments_balance: str + # Total available balance of the main account, denominated in USD + total_sub_account_available_balance: str + # Total entry (initial investment) amount of the open investments, denominated in USD + total_usd_notional_invested: str + + +@dataclass +class ApiAddIsolatedPositionMarginRequest: + # The sub account ID to add isolated margin in or remove margin from sub_account_id: str - # The instrument being represented + # The instrument to add margin into, or remove margin from instrument: str - # The size of the position, expressed in base asset decimal units. Negative for short positions - size: str - # The notional value of the position, negative for short assets, expressed in quote asset decimal units - notional: str + # The amount of margin to add to the position, positive to add, negative to remove, expressed in quote asset decimal units + amount: str + # The signature of this operation + signature: Signature + + +@dataclass +class ApiAddIsolatedPositionMarginResponse: + # Whether the margin mode and leverage was set successfully + success: bool + + +@dataclass +class ApiAggregatedAccountSummaryResponse: + # The aggregated account summary + result: AggregatedAccountSummary + + +@dataclass +class ApiAuthorizeBuilderRequest: """ - 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)` + Authorizes a specific Builder to execute transactions on behalf of the Main Account. + + This endpoint acts as an **upsert** operation: + - **New Authorization**: If the builder is not currently authorized, a new record is created. + - **Update Limit**: If the builder is already authorized, this request updates the `maxFuturesFeeRate` and `maxSpotFeeRate` to the new values provided. """ - entry_price: str + + # The Main Account ID of the user granting the authorization. + main_account_id: str + # The Main Account ID of the Builder receiving the authorization. + builder_account_id: str + # The maximum fee rate cap for **Futures** trades executed by this builder, expressed as a percentage (e.g., 0.001 means 0.001%). The builder cannot charge fees exceeding this limit. + max_futures_fee_rate: str + # The maximum fee rate cap for **Spot** trades executed by this builder, expressed as a percentage (e.g., 0.0001 means 0.0001%). The builder cannot charge fees exceeding this limit. + max_spot_fee_rate: str + # The cryptographic signature authenticating this request. Must be signed by the private key associated with `mainAccountID`. + signature: Signature + + +@dataclass +class ApiAuthorizedBuilder: + # The main account ID of the builder + builder_account_id: str + # The maximum fee rate for the authorized builder + max_futures_fee_rate: str + # The maximum fee rate for the authorized builder + max_spot_fee_rate: str + + +@dataclass +class ApiBuilderFillHistoryRequest: """ - 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)` + The request to get the historical builder trade of a builder + The history is returned in reverse chronological order + + 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.
""" - exit_price: str - # The mark price of the position, expressed in `9` decimals - mark_price: str + + # The start time to query for in unix nanoseconds + start_time: str | None = None + # The end time to query for 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 next query from + cursor: str | None = None + + +@dataclass +class ApiBuilderFillHistoryResponse: + # The builder fill history matching the request builder account + result: list[BuilderFillHistory] + # The cursor to indicate when to start the next query from + next: str | None = None + + +@dataclass +class ApiCancelAllOrdersRequest: + # The subaccount ID cancelling all orders + sub_account_id: str + # The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be cancelled + kind: list[Kind] | None = None + # The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be cancelled + base: list[str] | None = None + # The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be cancelled + quote: list[str] | None = None + + +@dataclass +class ApiCancelOnDisconnectRequest: """ - The unrealized PnL of the position, expressed in quote asset decimal units - `unrealized_pnl = (mark_price - entry_price) * size` + 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 -> 1000, which is rounded to 0: will result in termination of their COD + - Market Maker initially entered a value between 1001 -> 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. """ - unrealized_pnl: str + + # The subaccount ID cancelling the orders for + sub_account_id: str """ - The realized PnL of the position, expressed in quote asset decimal units - `realized_pnl = (exit_price - entry_price) * exit_trade_size` + 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 """ - realized_pnl: str + countdown_time: str | None = None + + +@dataclass +class ApiCancelOrderRequest: + # The subaccount ID cancelling the order + sub_account_id: str + # Cancel the order with this `order_id` + order_id: str | None = None + # Cancel the order with this `client_order_id` + client_order_id: str | None = None """ - The total PnL of the position, expressed in quote asset decimal units - `total_pnl = realized_pnl + unrealized_pnl` + 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'` -> `'600'`, `'30'` -> `'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. + """ - total_pnl: str + time_to_live_ms: str | None = None + + +@dataclass +class ApiCandlestickRequest: """ - The ROI of the position, expressed as a percentage - `roi = (total_pnl / (entry_price * abs(size))) * 100^` + Kline/Candlestick bars for an instrument. Klines are uniquely identified by their instrument, type, interval, and open time. + + 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.
""" - roi: str - # The index price of the quote currency. (reported in `USD`) - quote_index_price: str - # The estimated liquidation price - est_liquidation_price: str - # The current leverage value for this position - leverage: str - # The cumulative fee paid on the position, expressed in quote asset decimal units - cumulative_fee: str - # The cumulative realized funding payment of the position, expressed in quote asset decimal units. Positive if paid, negative if received - cumulative_realized_funding_payment: str + + # 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`
+ instrument: str + # The interval of each candlestick + interval: CandlestickInterval + # The type of candlestick data to retrieve + type: CandlestickType + # Start time of kline data in unix nanoseconds + start_time: str | None = None + # End time of kline data 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 ApiPositionsResponse: - # The positions matching the request filter - result: list[Positions] +class ApiCandlestickResponse: + # The candlestick result set for given interval + result: list[Candlestick] + # The cursor to indicate when to start the next query from + next: str | None = None + + +@dataclass +class ApiCreateOrderRequest: + # The order to create + order: Order + + +@dataclass +class ApiCreateOrderResponse: + # The created order + result: Order + + +@dataclass +class ApiDepositHistoryRequest: + """ + The request to get the historical deposits of an account + The history is returned in reverse chronological order + + 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 token currency to query for, if nil or empty, return all deposits. Otherwise, only entries matching the filter will be returned + currency: list[str] + # The start time to query for in unix nanoseconds + start_time: str | None = None + # The end time to query for 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 next query from + cursor: str | None = None + # Main account ID being queried. By default, applies the requestor's main account ID. + main_account_id: str | None = None + + +@dataclass +class ApiDepositHistoryResponse: + # The deposit history matching the request account + result: list[DepositHistory] + # The cursor to indicate when to start the next query from + next: str | None = None @dataclass @@ -426,66 +620,6 @@ class ApiFillHistoryRequest: cursor: str | None = None -@dataclass -class Fill: - # Time at which the event was emitted in unix nanoseconds - event_time: str - # The sub account ID that participated in the trade - sub_account_id: str - # The instrument being represented - instrument: str - # The side that the subaccount took on the trade - is_buyer: bool - # The role that the subaccount took on the trade - is_taker: bool - # The number of assets being traded, expressed in base asset decimal units - size: str - # The traded price, expressed in `9` decimals - price: str - # The mark price of the instrument at point of trade, expressed in `9` decimals - mark_price: str - # The index price of the instrument at point of trade, expressed in `9` decimals - index_price: str - # The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point) - interest_rate: str - # [Options] The forward price of the option at point of trade, expressed in `9` decimals - forward_price: str - # The realized PnL of the trade, expressed in quote asset decimal units (0 if increasing position size) - realized_pnl: str - # The fees paid on the trade, expressed in quote asset decimal unit (negative if maker rebate applied) - fee: str - # The fee rate paid on the trade - fee_rate: str - """ - 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`. - """ - trade_id: str - # An order identifier - order_id: str - # The venue where the trade occurred - venue: Venue - """ - 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 - """ - 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 - - @dataclass class ApiFillHistoryResponse: # The private trades matching the request asset @@ -494,6 +628,14 @@ class ApiFillHistoryResponse: next: str +@dataclass +class ApiFundingAccountSummaryResponse: + # The funding account summary + result: FundingAccountSummary + # Client fee tier at the time of query + tier: ClientTier + + @dataclass class ApiFundingPaymentHistoryRequest: """ @@ -514,26 +656,12 @@ class ApiFundingPaymentHistoryRequest: limit: int | None = None # The cursor to indicate when to start the query from cursor: str | None = None - - -@dataclass -class FundingPayment: - # Time at which the event was emitted in unix nanoseconds - event_time: str - # The sub account ID that made the funding payment - sub_account_id: str - # The perpetual instrument being funded - instrument: str - # The currency of the funding payment - currency: str - # The amount of the funding payment. Positive if paid, negative if received - amount: str - """ - 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`. - """ - tx_id: str + # The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned + kind: list[Kind] | None = None + # The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned + base: list[str] | None = None + # The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned + quote: list[str] | None = None @dataclass @@ -545,266 +673,140 @@ class ApiFundingPaymentHistoryResponse: @dataclass -class ApiSubAccountSummaryRequest: - # The subaccount ID to filter by - sub_account_id: str - - -@dataclass -class SpotBalance: - # The currency you hold a spot balance in - currency: str - # This currency's balance in this trading account. - balance: str - # The index price of this currency. (reported in `USD`) - index_price: str - - -@dataclass -class SubAccount: - # Time at which the event was emitted in unix nanoseconds - event_time: str - # The sub account ID this entry refers to - sub_account_id: str - # The type of margin algorithm this subaccount uses - margin_type: MarginType - """ - 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 - """ - settle_currency: str - """ - 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` - """ - unrealized_pnl: str - """ - 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` - """ - total_equity: str - """ - The `total_equity` required to open positions in the account (reported in `settle_currency`). - Computation is different depending on account's `margin_type` - """ - initial_margin: str - """ - 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` - """ - maintenance_margin: str - """ - 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)` - """ - available_balance: str - # The list of spot assets owned by this sub account, and their balances - spot_balances: list[SpotBalance] - # The list of positions owned by this sub account - positions: list[Positions] - # The index price of the settle currency. (reported in `USD`) - settle_index_price: str - # The derisk margin of this sub account - derisk_margin: str - # The derisk margin to maintenance margin ratio of this sub account - derisk_to_maintenance_margin_ratio: str - # The total equity of this sub account for cross margin - total_cross_equity: str - # The unrealized PnL of this sub account for cross margin - cross_unrealized_pnl: str - # Whether this sub account is a vault - is_vault: bool | None = None - # Total amount of IM (reported in `settle_currency`) deducted from the vault due to redemptions nearing the end of their redemption period - vault_im_additions: str | None = None - - -@dataclass -class ApiSubAccountSummaryResponse: - # The sub account matching the request sub account - result: SubAccount +class ApiFundingRate: + # 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`
+ instrument: str + # The funding rate of the instrument, expressed in percentage points + funding_rate: str + # The funding timestamp of the funding rate, expressed in unix nanoseconds + funding_time: str + # The mark price of the instrument at funding timestamp, expressed in `9` decimals + mark_price: str + # Deprecated: Refer to `funding_rate` instead. Will be removed in a future release. + funding_rate_8_h_avg: str + # Funding interval in hours (e.g. 1/4/8/etc). + funding_interval_hours: int @dataclass -class ApiSubAccountHistoryRequest: +class ApiFundingRateRequest: """ - 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 + Lookup the historical funding rate of a perpetual future. 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 sub account ID to request for - sub_account_id: str - # Start time of sub account history in unix nanoseconds + # 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`
+ instrument: str + # Start time of funding rate in unix nanoseconds start_time: str | None = None - # End time of sub account history in unix nanoseconds + # End time of funding rate 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 next query from + # The cursor to indicate when to start the query from cursor: str | None = None + # Aggregation method for historical funding rate observations. Defaults to using the instrument-specific funding interval. + agg_type: FundingRateAggregationType | None = None @dataclass -class ApiSubAccountHistoryResponse: - # The sub account history matching the request sub account - result: list[SubAccount] +class ApiFundingRateResponse: + # The funding rate result set for given interval + result: list[ApiFundingRate] # The cursor to indicate when to start the next query from - next: str + next: str | None = None @dataclass -class VaultInvestment: - # The trading account ID of the vault invested in. - vault_id: str - # The number of shares held by the investor. - num_lp_tokens: str - # The current share price (in USD) of this vault investment. - share_price: str - # The USD notional invested in this vault investment. - usd_notional_invested: str +class ApiGetAllInitialLeverageRequest: + # The sub account ID to get the leverage for + sub_account_id: str @dataclass -class AggregatedAccountSummary: - # The main account ID of the account to which the summary belongs - main_account_id: str - # Total equity of the main (+ sub) account, denominated in USD - total_equity: str - # The list of spot assets owned by this main (+ sub) account, and their balances - spot_balances: list[SpotBalance] - # The list of vault investments held by this main account - vault_investments: list[VaultInvestment] - # Deprecated: Use totalSubAccountEquity instead - total_sub_account_balance: str - # Total equity of the sub accounts, denominated in USD - total_sub_account_equity: str - # Total amount of the vault investments, denominated in USD - total_vault_investments_balance: str - # Total available balance of the main account, denominated in USD - total_sub_account_available_balance: str - # Total entry (initial investment) amount of the open investments, denominated in USD - total_usd_notional_invested: str +class ApiGetAllInitialLeverageResponse: + # The initial leverage of the sub account + results: list[InitialLeverageResult] @dataclass -class ApiAggregatedAccountSummaryResponse: - # The aggregated account summary - result: AggregatedAccountSummary +class ApiGetAllInstrumentsRequest: + # Fetch only active instruments + is_active: bool | None = None @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] - # The list of vault investments held by this main account - vault_investments: list[VaultInvestment] +class ApiGetAllInstrumentsResponse: + # List of instruments + result: list[InstrumentDisplay] @dataclass -class ClientTier: - tier: int - futures_taker_fee: int - futures_maker_fee: int - options_taker_fee: int - options_maker_fee: int +class ApiGetAuthorizedBuildersResponse: + # The list of authorized builders + results: list[ApiAuthorizedBuilder] @dataclass -class ApiFundingAccountSummaryResponse: - # The funding account summary - result: FundingAccountSummary - # Client fee tier at the time of query - tier: ClientTier +class ApiGetCurrencyRequest: + pass @dataclass -class ApiSetInitialLeverageRequest: - # The sub account ID to set the leverage for - sub_account_id: str - # The instrument to set the leverage for - instrument: str - # The leverage to set for the sub account - leverage: str +class ApiGetCurrencyResponse: + # The list of currencies + result: list[CurrencyDetail] @dataclass -class ApiSetInitialLeverageResponse: - # Whether the leverage was set successfully - success: bool +class ApiGetFilteredInstrumentsRequest: + # The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned + kind: list[Kind] | None = None + # The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned + base: list[str] | None = None + # The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned + quote: list[str] | None = None + # Request for active instruments only + is_active: bool | None = None + # The limit to query for. Defaults to 500; Max 100000 + limit: int | None = None @dataclass -class ApiGetAllInitialLeverageRequest: - # The sub account ID to get the leverage for - sub_account_id: str +class ApiGetFilteredInstrumentsResponse: + # The instruments matching the request filter + result: list[InstrumentDisplay] @dataclass -class InitialLeverageResult: - # The instrument to get the leverage for +class ApiGetInstrumentRequest: + # 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`
instrument: str - # The initial leverage of the sub account - leverage: str - # The min leverage this sub account can set - min_leverage: str - # The max leverage this sub account can set - max_leverage: str - - -@dataclass -class ApiGetAllInitialLeverageResponse: - # The initial leverage of the sub account - results: list[InitialLeverageResult] @dataclass -class Signature: - # The address (public key) of the wallet signing the payload - signer: str - # Signature R - r: str - # Signature S - s: str - # Signature V - v: int - # Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days - expiration: str - """ - 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. - Range: 0 to 4,294,967,295 (uint32) - """ - nonce: int - # Chain ID used in EIP-712 domain. Zero value fallbacks to GRVT Chain ID. - chain_id: str +class ApiGetInstrumentResponse: + # The instrument matching the request asset + result: InstrumentDisplay @dataclass -class ApiSetDeriskToMaintenanceMarginRatioRequest: - # The sub account ID to set the leverage for +class ApiGetIsolatedPositionMarginLimitsRequest: + # The sub account ID to get the margin limits for sub_account_id: str - # The derisk margin to maintenance margin ratio of this sub account - ratio: str - # The signature of this operation - signature: Signature + # The isolated position asset to get the margin limits for + instrument: str @dataclass -class ApiSetDeriskToMaintenanceMarginRatioResponse: - # Whether the derisk margin to maintenance margin ratio was set successfully - success: bool +class ApiGetIsolatedPositionMarginLimitsResponse: + # The isolated position asset + instrument: str + # The max addable amount that can be added to the isolated position, expressed in quote asset decimal units + max_addable_amount: str + # The max removable amount that can be removed from the isolated position, expressed in quote asset decimal units + max_removable_amount: str @dataclass @@ -813,24 +815,6 @@ class ApiGetMarginRulesRequest: instrument: str -@dataclass -class RiskBracket: - # 1-indexed tier number - tier: int - # Lower bound of notional value (inclusive) in quote currency - notional_floor: str - # Upper bound of notional value (exclusive) in quote currency, empty for last tier - notional_cap: str - # Maintenance margin rate as a decimal (e.g., '0.01' for 1%) - maintenance_margin_rate: str - # Initial margin rate as a decimal (e.g., '0.02' for 2%) - initial_margin_rate: str - # Maximum leverage allowed at this tier (floor of 1 / initial_margin_rate) - max_leverage: int - # Cumulative maintenance margin amount in quote currency - cumulative_maintenance_amount: str - - @dataclass class ApiGetMarginRulesResponse: # The instrument name @@ -842,211 +826,257 @@ class ApiGetMarginRulesResponse: @dataclass -class ApiOrderbookLevelsRequest: - # 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`
- instrument: str - # Depth of the order book to be retrieved (10, 50, 100, 500) - depth: int +class ApiGetOrderRequest: + # 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 OrderbookLevel: - # The price of the level, expressed in `9` decimals - price: str - # The number of assets offered, expressed in base asset decimal units - size: str - # The number of open orders at this level - num_orders: int +class ApiGetOrderResponse: + # The order object for the requested filter + result: Order @dataclass -class OrderbookLevels: - # Time at which the event was emitted in unix nanoseconds - event_time: str +class ApiMiniTickerRequest: # 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`
instrument: str - # The list of best bids up till query depth - bids: list[OrderbookLevel] - # The list of best asks up till query depth - asks: list[OrderbookLevel] @dataclass -class ApiOrderbookLevelsResponse: - # The orderbook levels objects matching the request asset - result: OrderbookLevels +class ApiMiniTickerResponse: + # The mini ticker matching the request asset + result: MiniTicker @dataclass -class ApiMiniTickerRequest: - # 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`
- instrument: str +class ApiOpenOrdersRequest: + # The subaccount ID to filter by + sub_account_id: str + # The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned + kind: list[Kind] | None = None + # The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned + base: list[str] | None = None + # The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned + quote: list[str] | None = None @dataclass -class MiniTicker: - # Time at which the event was emitted in unix nanoseconds - event_time: str | None = None - # 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`
- instrument: str | None = None - # The mark price of the instrument, expressed in `9` decimals - mark_price: str | None = None - # The index price of the instrument, expressed in `9` decimals - index_price: str | None = None - # The last traded price of the instrument (also close price), expressed in `9` decimals - last_price: str | None = None - # The number of assets traded in the last trade, expressed in base asset decimal units - last_size: str | None = None - # The mid price of the instrument, expressed in `9` decimals - mid_price: str | None = None - # The best bid price of the instrument, expressed in `9` decimals - best_bid_price: str | None = None - # The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units - best_bid_size: str | None = None - # The best ask price of the instrument, expressed in `9` decimals - best_ask_price: str | None = None - # The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units - best_ask_size: str | None = None +class ApiOpenOrdersResponse: + # The Open Orders matching the request filter + result: list[Order] @dataclass -class ApiMiniTickerResponse: - # The mini ticker matching the request asset - result: MiniTicker +class ApiOrderHistoryRequest: + """ + Retrieves the order history for the account. + + 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 subaccount ID to filter by + sub_account_id: str + # The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned + kind: list[Kind] | None = None + # The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned + base: list[str] | None = None + # The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned + quote: list[str] | None = None + # The start time to apply in nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned + start_time: str | None = None + # The end time to apply in nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned + 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 ApiTickerRequest: +class ApiOrderHistoryResponse: + # The Open Orders matching the request filter + result: list[Order] + # The cursor to indicate when to start the query from + next: str + + +@dataclass +class ApiOrderbookLevelsRequest: # 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`
instrument: str + # Depth of the order book to be retrieved (10, 50, 100, 500) + depth: int @dataclass -class Ticker: - """ - 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. +class ApiOrderbookLevelsResponse: + # The orderbook levels objects matching the request asset + result: OrderbookLevels - """ - # Time at which the event was emitted in unix nanoseconds - event_time: str | None = None - # 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`
- instrument: str | None = None - # The mark price of the instrument, expressed in `9` decimals - mark_price: str | None = None - # The index price of the instrument, expressed in `9` decimals - index_price: str | None = None - # The last traded price of the instrument (also close price), expressed in `9` decimals - last_price: str | None = None - # The number of assets traded in the last trade, expressed in base asset decimal units - last_size: str | None = None - # The mid price of the instrument, expressed in `9` decimals - mid_price: str | None = None - # The best bid price of the instrument, expressed in `9` decimals - best_bid_price: str | None = None - # The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units - best_bid_size: str | None = None - # The best ask price of the instrument, expressed in `9` decimals - best_ask_price: str | None = None - # The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units - best_ask_size: str | None = None - # DEPRECATED: To be removed in a future release. Please refer to the field `funding_rate` instead, for the funding rate being applied over `funding_interval_hours` (interval ending at `next_funding_time`). - funding_rate_8h_curr: str | None = None - # DEPRECATED: To be removed in a future release. Please refer to the field `funding_rate` instead, for the funding rate being applied over `funding_interval_hours` (interval ending at `next_funding_time`). - funding_rate_8h_avg: str | None = None - # The interest rate of the underlying, expressed in centibeeps (1/100th of a basis point) - interest_rate: str | None = None - # [Options] The forward price of the option, expressed in `9` decimals - forward_price: str | None = None - # The 24 hour taker buy volume of the instrument, expressed in base asset decimal units - buy_volume_24h_b: str | None = None - # The 24 hour taker sell volume of the instrument, expressed in base asset decimal units - sell_volume_24h_b: str | None = None - # The 24 hour taker buy volume of the instrument, expressed in quote asset decimal units - buy_volume_24h_q: str | None = None - # The 24 hour taker sell volume of the instrument, expressed in quote asset decimal units - sell_volume_24h_q: str | None = None - # The 24 hour highest traded price of the instrument, expressed in `9` decimals - high_price: str | None = None - # The 24 hour lowest traded price of the instrument, expressed in `9` decimals - low_price: str | None = None - # The 24 hour first traded price of the instrument, expressed in `9` decimals - open_price: str | None = None - # The open interest in the instrument, expressed in base asset decimal units - open_interest: str | None = None - # The ratio of accounts that are net long vs net short on this instrument - long_short_ratio: str | None = None - # The current indicative funding rate for the active interval, expressed in centibeeps - funding_rate: str | None = None - # Timestamp in nanoseconds when the current funding interval ends - next_funding_time: str | None = None +@dataclass +class ApiPositionsRequest: + # The sub account ID to request for + sub_account_id: str + # The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned + kind: list[Kind] | None = None + # The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned + base: list[str] | None = None + # The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned + quote: list[str] | None = None @dataclass -class ApiTickerResponse: - # The mini ticker matching the request asset - result: Ticker +class ApiPositionsResponse: + # The positions matching the request filter + result: list[Positions] @dataclass -class ApiTradeRequest: +class ApiQueryVaultManagerInvestorHistoryRequest: + # The unique identifier of the vault to filter by + vault_id: str + # Whether to only return investments made by the manager + only_own_investments: bool + # Optional. Start time in unix nanoseconds + start_time: str | None = None + # Optional. End time in unix nanoseconds + end_time: str | None = None + + +@dataclass +class ApiQueryVaultManagerInvestorHistoryResponse: + # The list of vault investor history belong to the manager + result: list[ApiVaultInvestorHistory] + + +@dataclass +class ApiSetDeriskToMaintenanceMarginRatioRequest: + # The sub account ID to set the leverage for + sub_account_id: str + # The derisk margin to maintenance margin ratio of this sub account + ratio: str + # The signature of this operation + signature: Signature + + +@dataclass +class ApiSetDeriskToMaintenanceMarginRatioResponse: + # Whether the derisk margin to maintenance margin ratio was set successfully + success: bool + + +@dataclass +class ApiSetInitialLeverageRequest: """ - 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. + The request to set the initial leverage of a sub account. + DEPRECATED: This API is deprecated, use set_position_config API instead """ - # 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`
+ # The sub account ID to set the leverage for + sub_account_id: str + # The instrument to set the leverage for instrument: str - # The limit to query for. Defaults to 500; Max 1000 - limit: int + # The leverage to set for the sub account + leverage: str @dataclass -class Trade: - # Time at which the event was emitted in unix nanoseconds - event_time: str - # 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`
+class ApiSetInitialLeverageResponse: + """ + The response to set the initial leverage of a sub account. + DEPRECATED: This API is deprecated, use set_position_config API instead + """ + + # Whether the leverage was set successfully + success: bool + + +@dataclass +class ApiSetSubAccountPositionMarginConfigRequest: + """ + Sets the margin type and leverage configuration for a specific position (instrument) within a sub account. + + This configuration is applied per-instrument, allowing different margin settings for different positions. + + """ + + # The sub account ID to set the margin type and leverage for + sub_account_id: str + # The instrument of the position to set the margin type and leverage for instrument: str - # If taker was the buyer on the trade - is_taker_buyer: bool - # The number of assets being traded, expressed in base asset decimal units - size: str - # The traded price, expressed in `9` decimals - price: str - # The mark price of the instrument at point of trade, expressed in `9` decimals - mark_price: str - # The index price of the instrument at point of trade, expressed in `9` decimals - index_price: str - # The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point) - interest_rate: str - # [Options] The forward price of the option at point of trade, expressed in `9` decimals - forward_price: str + # The margin type to set for the position + margin_type: PositionMarginType + # The leverage to set for the position + leverage: str + # The signature of this operation + signature: Signature + + +@dataclass +class ApiSetSubAccountPositionMarginConfigResponse: + # Whether the margin type and leverage was acked + ack: bool + + +@dataclass +class ApiSubAccountHistoryRequest: """ - 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`. + 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:
  • 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.
""" - trade_id: str - # The venue where the trade occurred - venue: Venue - # If the trade is a RPI trade - is_rpi: bool + + # The sub account ID to request for + sub_account_id: str + # Start time of sub account history in unix nanoseconds + start_time: str | None = None + # End time of sub account history 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 next query from + cursor: str | None = None @dataclass -class ApiTradeResponse: - # The public trades matching the request asset - result: list[Trade] +class ApiSubAccountHistoryResponse: + # The sub account history matching the request sub account + result: list[SubAccount] + # The cursor to indicate when to start the next query from + next: str + + +@dataclass +class ApiSubAccountSummaryRequest: + # The subaccount ID to filter by + sub_account_id: str + + +@dataclass +class ApiSubAccountSummaryResponse: + # The sub account matching the request sub account + result: SubAccount + + +@dataclass +class ApiTickerRequest: + # 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`
+ instrument: str + + +@dataclass +class ApiTickerResponse: + # The mini ticker matching the request asset + result: Ticker @dataclass @@ -1080,736 +1110,680 @@ class ApiTradeHistoryResponse: @dataclass -class ApiGetInstrumentRequest: +class ApiTradeRequest: + """ + 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. + """ + # 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`
instrument: str + # The limit to query for. Defaults to 500; Max 1000 + limit: int @dataclass -class InstrumentDisplay: - # 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`
- instrument: str - # The asset ID used for instrument signing. - instrument_hash: str - # The base currency - base: str - # The quote currency - quote: str - # The kind of instrument - kind: Kind - # Venues that this instrument can be traded at - venues: list[Venue] - # The settlement period of the instrument - settlement_period: InstrumentSettlementPeriod - # The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1) - base_decimals: int - # The smallest denomination of the quote asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1) - quote_decimals: int - # The size of a single tick, expressed in price decimal units - tick_size: str - # The minimum contract size, expressed in base asset decimal units - min_size: str - # Creation time in unix nanoseconds - create_time: str - # The maximum position size, expressed in base asset decimal units - max_position_size: str - # Defines the funding interval to be applied. - funding_interval_hours: int | None = None - # Funding rate cap over the defined `intervalHours`. - adjusted_funding_rate_cap: str | None = None - # Funding rate floor over the defined `intervalHours`. - adjusted_funding_rate_floor: str | None = None +class ApiTradeResponse: + # The public trades matching the request asset + result: list[Trade] @dataclass -class ApiGetInstrumentResponse: - # The instrument matching the request asset - result: InstrumentDisplay - - -@dataclass -class ApiGetFilteredInstrumentsRequest: - # The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned - kind: list[Kind] | None = None - # The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned - base: list[str] | None = None - # The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned - quote: list[str] | None = None - # Request for active instruments only - is_active: bool | None = None - # The limit to query for. Defaults to 500; Max 100000 - limit: int | None = None - - -@dataclass -class ApiGetFilteredInstrumentsResponse: - # The instruments matching the request filter - result: list[InstrumentDisplay] - - -@dataclass -class ApiGetCurrencyRequest: - pass - - -@dataclass -class CurrencyDetail: - # The integer value of the currency - id: int - # The name of the currency - symbol: str - # The balance decimals of the currency - balance_decimals: int - # The quantity multiplier of the currency - quantity_multiplier: str - - -@dataclass -class ApiGetCurrencyResponse: - # The list of currencies - result: list[CurrencyDetail] +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 ApiCandlestickRequest: +class ApiTransferHistoryRequest: """ - Kline/Candlestick bars for an instrument. Klines are uniquely identified by their instrument, type, interval, and open time. + The request to get the historical transfers of an account + The history is returned in reverse chronological order 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 readable instrument name:
  • Perpetual: `ETH_USDT_Perp`
  • Future: `BTC_USDT_Fut_20Oct23`
  • Call: `ETH_USDT_Call_20Oct23_2800`
  • Put: `ETH_USDT_Put_20Oct23_2800`
- instrument: str - # The interval of each candlestick - interval: CandlestickInterval - # The type of candlestick data to retrieve - type: CandlestickType - # Start time of kline data in unix nanoseconds + # The token currency to query for, if nil or empty, return all transfers. Otherwise, only entries matching the filter will be returned + currency: list[str] + # The start time to query for in unix nanoseconds start_time: str | None = None - # End time of kline data in unix nanoseconds + # The end time to query for 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 + # The cursor to indicate when to start the next query from cursor: str | None = None + # The transaction ID to query for + tx_id: str | None = None + # Main account ID being queried. By default, applies the requestor's main account ID. + main_account_id: str | None = None + # The transfer type to filters for. If the list is empty, return all transfer types. + transfer_types: list[TransferType] | None = None @dataclass -class Candlestick: - # Open time of kline bar in unix nanoseconds - open_time: str - # Close time of kline bar in unix nanosecond - close_time: str - # The open price, expressed in underlying currency resolution units - open: str - # The close price, expressed in underlying currency resolution units - close: str - # The high price, expressed in underlying currency resolution units - high: str - # The low price, expressed in underlying currency resolution units - low: str - # The underlying volume transacted, expressed in base asset decimal units - volume_b: str - # The quote volume transacted, expressed in quote asset decimal units - volume_q: str - # The number of trades transacted - trades: int - # 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`
- instrument: str - - -@dataclass -class ApiCandlestickResponse: - # The candlestick result set for given interval - result: list[Candlestick] +class ApiTransferHistoryResponse: + # The transfer history matching the request account + result: list[TransferHistory] # The cursor to indicate when to start the next query from next: str | None = None @dataclass -class ApiFundingRateRequest: +class ApiTransferRequest: """ - Lookup the historical funding rate of a perpetual future. + This API allows you to transfer funds in multiple different ways
    +
  • Between SubAccounts within your Main Account
  • +
  • Between your MainAccount and your SubAccounts
  • +
  • To other MainAccounts that you have previously allowlisted
  • +
Fast Withdrawal Funding Address + For fast withdrawals, funds must be sent to the designated funding account address. Please ensure you use the correct address based on the environment: + Production Environment Address: + [To be updated, not ready yet] + This address should be specified as the to_account_id in your API requests for transferring funds using the transfer API. Ensure accurate input to avoid loss of funds or use the UI. - 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 readable instrument name:
  • Perpetual: `ETH_USDT_Perp`
  • Future: `BTC_USDT_Fut_20Oct23`
  • Call: `ETH_USDT_Call_20Oct23_2800`
  • Put: `ETH_USDT_Put_20Oct23_2800`
- instrument: str - # Start time of funding rate in unix nanoseconds - start_time: str | None = None - # End time of funding rate 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 - # Aggregation method for historical funding rate observations. Defaults to using the instrument-specific funding interval. - agg_type: FundingRateAggregationType | None = None + # The main 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 main 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: str + # The number of tokens to transfer, quoted in tokenCurrency decimal units + num_tokens: str + # The signature of the transfer + signature: Signature + # The type of transfer + transfer_type: TransferType + # The metadata of the transfer + transfer_metadata: str @dataclass -class ApiFundingRate: - # 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`
- instrument: str - # The funding rate of the instrument, expressed in percentage points - funding_rate: str - # The funding timestamp of the funding rate, expressed in unix nanoseconds - funding_time: str - # The mark price of the instrument at funding timestamp, expressed in `9` decimals - mark_price: str - # Deprecated: Refer to `funding_rate` instead. Will be removed in a future release. - funding_rate_8_h_avg: str - # Funding interval in hours (e.g. 1/4/8/etc). - funding_interval_hours: int +class ApiTransferResponse: + # The Transfer response object + result: ApiTransferAck @dataclass -class ApiFundingRateResponse: - # The funding rate result set for given interval - result: list[ApiFundingRate] - # The cursor to indicate when to start the next query from - next: str | None = None +class ApiVaultBurnTokensRequest: + """ + Request payload for burning tokens in a vault. + + This API allows a client to burn a specified amount of tokens in a particular vault. + """ + + # The unique identifier of the vault to burn tokens from. + vault_id: str + # The currency used for the burn. This should be the vault's quote currency. + currency: str + # The number of tokens to burn. + num_tokens: str + """ + The digital signature from the investing account. + This signature must be generated by the main account ID and is used to verify the authenticity of the request. + The signature must comply with AccountPermExternalTransfer permission. + """ + signature: Signature @dataclass -class JSONRPCRequest: +class ApiVaultInvestRequest: """ - 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. + Request payload for investing in a vault. + + This API allows a client to invest a specified amount of tokens in a particular vault. """ - # The JSON RPC version to use for the request - jsonrpc: str - # The method to use for the request (eg: `subscribe` / `unsubscribe` / `v1/instrument` ) - method: str - # The parameters for the request - params: Any + # The unique identifier of the vault to invest in. + vault_id: str + # The currency used for the investment. This should be the vault's quote currency. + currency: str + # The investment sum, in terms of the token currency specified (i.e., `numTokens` of '1000' with `tokenCurrency` of 'USDT' denotes investment of 1,000 USDT). + num_tokens: str """ - Optional Field which is used to match the response by the client. - If not passed, this field will not be returned + The digital signature from the investing account. + This signature must be generated by the main account ID and is used to verify the authenticity of the request. + The signature must comply with AccountPermExternalTransfer permission. """ - id: int | None = None + signature: Signature @dataclass -class Error: - # The error code for the request - code: int - # The error message for the request - message: str +class ApiVaultInvestorHistory: + # Time at which the event was emitted in unix nanoseconds + event_time: str + # The off chain account id of the investor, only visible to the manager + off_chain_account_id: str + # The unique identifier of the vault. + vault_id: str + # The type of transaction that occurred. List of types: vaultInvest, vaultBurnLpToken, vaultRedeem + type: VaultInvestorAction + # The price of the vault LP tokens at the time of the event. + price: str + # The amount of Vault LP tokens invested or redeemed. + size: str + # The realized PnL of the vault. + realized_pnl: str + # The performance fee of the vault. + performance_fee: str @dataclass -class JSONRPCResponse: - """ - 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. +class ApiVaultInvestorSummaryRequest: """ + Request payload for fetching the summary of a vault investor. - # The JSON RPC version to use for the request - jsonrpc: str - # The method used in the request for this response (eg: `subscribe` / `unsubscribe` / `v1/instrument` ) - method: str - # The result for the request - result: Any | None = None - # The error for the request - error: Error | None = None - """ - Optional Field which is used to match the response by the client. - If not passed, this field will not be returned. - Range: 0 to 4,294,967,295 (uint32) + This API allows a client to retrieve the summary of investments in a specific vault. """ - id: int | None = None - -@dataclass -class WSSubscribeParams: - """ - 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. - """ - - # The channel to subscribe to (eg: ticker.s / ticker.d) - stream: str - # The list of feeds to subscribe to - selectors: list[str] - # Whether to use the global sequence number for the stream - use_global_sequence_number: bool | None = None + # The unique identifier of the vault to fetch the summary for. + vault_id: str @dataclass -class WSSubscribeResult: +class ApiVaultInvestorSummaryResponse: """ - To ensure you always know if you have missed any payloads, GRVT servers apply the following heuristics to sequence numbers:
  • All 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
  • Num snapshots returned in Response (per stream): You can ensure that you received the right number of snapshots
  • First sequence number returned in Response (per stream): You can ensure that you received the first stream, without gaps from snapshots
  • Sequence numbers should always monotonically increase by `1`. If it decreases, or increases by more than `1`. Please reconnect
  • Duplicate sequence numbers are possible due to network retries. If you receive a duplicate, please ignore it, or idempotently re-update it.
- When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details. + Response payload for the summary of a vault investor. + + This API provides the summary of investments in a specific vault. """ - # The channel to subscribe to (eg: ticker.s / ticker.d) - stream: str - # The list of feeds subscribed to - subs: list[str] - # The list of feeds unsubscribed from - unsubs: list[str] - # The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs` - num_snapshots: list[int] - # The first sequence number to expect for each subscribed feed. Returned in same order as `subs` - first_sequence_number: list[str] - # 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` - latest_sequence_number: list[str] + # The summary of investments in the vault. + vault_investor_summary: list[VaultInvestorSummary] @dataclass -class WSUnsubscribeParams: - # The channel to unsubscribe from (eg: ticker.s / ticker.d) - stream: str - # The list of feeds to unsubscribe from - selectors: list[str] - # Whether to use the global sequence number for the stream - use_global_sequence_number: bool | None = None +class ApiVaultRedeemCancelRequest: + """ + Request payload for canceling a vault redemption. + This API allows a client to cancel a previously initiated redemption from a vault. + """ -@dataclass -class WSUnsubscribeResult: - # The channel to subscribe to (eg: ticker.s / ticker.d) - stream: str - # The list of feeds unsubscribed from - unsubs: list[str] + # The unique identifier of the vault to cancel the redemption from. + vault_id: str @dataclass -class WSSubscribeRequestV1Legacy: +class ApiVaultRedeemRequest: """ - 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. + Request payload for redeeming from a vault. + + This API allows a client to redeem a specified amount of tokens from a particular vault. """ - # The channel to subscribe to (eg: ticker.s / ticker.d) - stream: str - # The list of feeds to subscribe to - feed: list[str] - # The method to use for the request (eg: subscribe / unsubscribe) - method: str + # The unique identifier of the vault to redeem from. + vault_id: str + # The currency used for the redemption. This should be the vault's quote currency. + currency: str + # The number of shares to redeem. + num_tokens: str """ - Optional Field which is used to match the response by the client. - If not passed, this field will not be returned. - Range: 0 to 4,294,967,295 (uint32) + The digital signature from the investing account. + This signature must be generated by the main account ID and is used to verify the authenticity of the request. + The signature must comply with AccountPermExternalTransfer permission. """ - request_id: int | None = None - # Whether the request is for full data or lite data - is_full: bool | None = None + signature: Signature @dataclass -class WSSubscribeResponseV1Legacy: - """ - 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:
  • All 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
  • Num snapshots returned in Response (per stream): You can ensure that you received the right number of snapshots
  • First sequence number returned in Response (per stream): You can ensure that you received the first stream, without gaps from snapshots
  • Sequence numbers should always monotonically increase by `1`. If it decreases, or increases by more than `1`. Please reconnect
  • Duplicate sequence numbers are possible due to network retries. If you receive a duplicate, please ignore it, or idempotently re-update it.
- When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details. - """ - - # The channel to subscribe to (eg: ticker.s / ticker.d) - stream: str - # The list of feeds subscribed to - subs: list[str] - # The list of feeds unsubscribed from - unsubs: list[str] - # The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs` - num_snapshots: list[int] - # The first sequence number to expect for each subscribed feed. Returned in same order as `subs` - first_sequence_number: list[str] - # 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` - latest_sequence_number: list[str] - """ - Optional Field which is used to match the response by the client. - If not passed, this field will not be returned +class ApiVaultViewRedemptionQueueRequest: """ - request_id: int | None = None + Request payload for a vault manager to view the redemption queue for their vault. + Fetches the redemption queue for a vault, ordered by descending priority. -@dataclass -class WSOrderbookLevelsFeedSelectorV1: - """ - 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. + Urgent redemption requests, defined as having been pending >90% of the manager-defined maximum redemption period, have top priority (following insertion order). - The Delta feed will work as follows:
  • On subscription, the server will send a full snapshot of all levels of the Orderbook.
  • After the snapshot, the server will only send levels that have changed in value.
+ Non-urgent redemption requests are otherwise prioritized by insertion order, unless they are >5x the size of the smallest redemption request. - Subscription Pattern:
  • Delta - `instrument@rate`
  • Snapshot - `instrument@rate-depth`
+ E.g., If FIFO ordering (all non-urgent) is 1k -> 50k -> 100k -> 20k -> 10k -> 25k, then priority ordering is 1k -> 10k -> 50k -> 20k -> 100k -> 25k. - Field Semantics:
  • [DeltaOnly] If a level is not updated, level not published
  • If a level is updated, {size: '123'}
  • If a level is set to zero, {size: '0'}
  • Incoming levels will be published as soon as price moves
  • Outgoing levels will be published with `size = 0`
+ Only displays redemption requests that are eligible for automated redemption, i.e., have been pending for the manager-defined minimum redemption period. """ - # 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`
- instrument: str - """ - The minimal rate at which we publish feeds (in milliseconds) - Delta (50, 100, 500, 1000) - Snapshot (500, 1000) - """ - rate: int - """ - Depth of the order book to be retrieved - Delta(0 - `unlimited`) - Snapshot(10, 50, 100, 500) - """ - depth: int | None = None + # The unique identifier of the vault to fetch the redemption queue for. + vault_id: str @dataclass -class WSOrderbookLevelsFeedDataV1: - # 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`. +class ApiVaultViewRedemptionQueueResponse: """ - sequence_number: str - # An orderbook levels object matching the request filter - feed: OrderbookLevels - # The previous sequence number that determines the message order - prev_sequence_number: str - + Response payload for a vault manager to view the redemption queue for their vault, ordered by descending priority. -@dataclass -class WSMiniTickerFeedSelectorV1: - """ - 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. + Also includes counters for total redemption sizes pending as well as urgent (refer to API integration guide for more detail on redemption request classifications). - The Delta feed will work as follows:
  • On subscription, the server will send a full snapshot of the mini ticker.
  • After the snapshot, the server will only send deltas of the mini ticker.
  • The server will send a delta if any of the fields in the mini ticker have changed.
- Field Semantics:
  • [DeltaOnly] If a field is not updated, {}
  • If a field is updated, {field: '123'}
  • If a field is set to zero, {field: '0'}
  • If a field is set to null, {field: ''}
""" - # 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`
- instrument: str - """ - The minimal rate at which we publish feeds (in milliseconds) - Delta (0 - `raw`, 50, 100, 200, 500, 1000, 5000) - Snapshot (200, 500, 1000, 5000) - """ - rate: int + # Outstanding vault redemption requests, ordered by descending priority. Excludes requests that have not yet aged past the minimum redemption period. + redemption_queue: list[VaultRedemptionRequest] + # Number of shares eligible for automated redemption (held in queue for at least the minimum redemption period). + pending_redemption_token_count: str + # Number of shares nearing the maximum redemption period (>= 90% of maximum redemption period). + urgent_redemption_token_count: str + # Amount available for automated redemption request servicing (in USD). + auto_redeemable_balance: str + # Current share price (in USD). + share_price: str + # Dedicated section for requests yet to wait at least the minimum redemption period. + pre_min: PreMinRedemptions @dataclass -class WSMiniTickerFeedDataV1: - # Stream name - stream: str - # Primary selector - selector: str +class ApiWithdrawalHistoryRequest: """ - 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 request to get the historical withdrawals of an account + The history is returned in reverse chronological order + + 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.
""" - sequence_number: str - # A mini ticker matching the request filter - feed: MiniTicker - # The previous sequence number that determines the message order - prev_sequence_number: str + + # The token currency to query for, if nil or empty, return all withdrawals. Otherwise, only entries matching the filter will be returned + currency: list[str] + # The start time to query for in unix nanoseconds + start_time: str | None = None + # The end time to query for 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 next query from + cursor: str | None = None + # Main account ID being queried. By default, applies the requestor's main account ID. + main_account_id: str | None = None @dataclass -class WSTickerFeedSelectorV1: - """ - 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. +class ApiWithdrawalHistoryResponse: + # The withdrawals history matching the request account + result: list[WithdrawalHistory] + # The cursor to indicate when to start the next query from + next: str | None = None - The Delta feed will work as follows:
  • On subscription, the server will send a full snapshot of the ticker.
  • After the snapshot, the server will only send deltas of the ticker.
  • The server will send a delta if any of the fields in the ticker have changed.
- Field Semantics:
  • [DeltaOnly] If a field is not updated, {}
  • If a field is updated, {field: '123'}
  • If a field is set to zero, {field: '0'}
  • If a field is set to null, {field: ''}
+@dataclass +class ApiWithdrawalRequest: """ + Leverage this API to initialize a withdrawal from GRVT's Hyperchain onto Ethereum. + Do take note that the bridging process does take time. The GRVT UI will help you keep track of bridging progress, and notify you once its complete. - # 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`
- instrument: str - """ - The minimal rate at which we publish feeds (in milliseconds) - Delta (100, 200, 500, 1000, 5000) - Snapshot (500, 1000, 5000) + If not withdrawing the entirety of your balance, there is a minimum withdrawal amount. Currently that amount is ~25 USDT. + Withdrawal fees also apply to cover the cost of the Ethereum transaction. + Note that your funds will always remain in self-custory throughout the withdrawal process. At no stage does GRVT gain control over your funds. """ - rate: int - -@dataclass -class WSTickerFeedDataV1: - # 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 - # A ticker matching the request filter - feed: Ticker - # The previous sequence number that determines the message order - prev_sequence_number: str + # The main account to withdraw from + from_account_id: str + # The Ethereum wallet to withdraw into + to_eth_address: str + # The token currency to withdraw + currency: str + # The number of tokens to withdraw, quoted in tokenCurrency decimal units + num_tokens: str + # The signature of the withdrawal + signature: Signature @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`
+class BuilderFillHistory: + # Time at which the event was emitted in unix nanoseconds + event_time: str + # The off chain account id + off_chain_account_id: str + # The instrument being represented instrument: str - # The limit to query for. Valid values are (50, 200, 500, 1000). Default is 50 - limit: int + # The side that the subaccount took on the trade + is_buyer: bool + # The role that the subaccount took on the trade + is_taker: bool + # The number of assets being traded, expressed in base asset decimal units + size: str + # The traded price, expressed in `9` decimals + price: str + # The mark price of the instrument at point of trade, expressed in `9` decimals + mark_price: str + # The index price of the instrument at point of trade, expressed in `9` decimals + index_price: str + # Builder fee percentage charged for this order. referred to Order.builder builderFee + fee_rate: str + # The builder fee paid on the trade, expressed in quote asset decimal unit. referred to Trade.builderFee + fee: str @dataclass -class WSTradeFeedDataV1: - # 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 - # A public trade matching the request filter - feed: Trade - # The previous sequence number that determines the message order - prev_sequence_number: str +class CancelStatusFeed: + # The subaccount ID that requested the cancellation + sub_account_id: str + # A unique identifier for the active order within a subaccount, specified by the client + client_order_id: str + # A unique 128-bit identifier for the order, deterministically generated within the GRVT backend + order_id: str + # The user-provided reason for cancelling the order + reason: OrderRejectReason + # Status of the cancellation attempt + cancel_status: CancelStatus + # [Filled by GRVT Backend] Time at which the cancellation status was updated by GRVT in unix nanoseconds + update_time: str | None = None @dataclass -class WSCandlestickFeedSelectorV1: - """ - 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. - """ - +class Candlestick: + # Open time of kline bar in unix nanoseconds + open_time: str + # Close time of kline bar in unix nanosecond + close_time: str + # The open price, expressed in underlying currency resolution units + open: str + # The close price, expressed in underlying currency resolution units + close: str + # The high price, expressed in underlying currency resolution units + high: str + # The low price, expressed in underlying currency resolution units + low: str + # The underlying volume transacted, expressed in base asset decimal units + volume_b: str + # The quote volume transacted, expressed in quote asset decimal units + volume_q: str + # The number of trades transacted + trades: int # 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`
instrument: str - # The interval of each candlestick - interval: CandlestickInterval - # The type of candlestick data to retrieve - type: CandlestickType @dataclass -class WSCandlestickFeedDataV1: - # 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 - # A candlestick entry matching the request filters - feed: Candlestick - # The previous sequence number that determines the message order - prev_sequence_number: str +class ClientTier: + tier: int + futures_taker_fee: int + futures_maker_fee: int + options_taker_fee: int + options_maker_fee: int @dataclass -class WSUnsubscribeAllParams: - pass +class CurrencyDetail: + # The integer value of the currency + id: int + # The name of the currency + symbol: str + # The balance decimals of the currency + balance_decimals: int + # The quantity multiplier of the currency + quantity_multiplier: str @dataclass -class StreamReference: - # The channel to subscribe to (eg: ticker.s / ticker.d) - stream: str - # The list of selectors for the stream - selectors: list[str] +class Deposit: + # The hash of the bridgemint event producing the deposit + tx_hash: str + # The account to deposit into + to_account_id: str + # The token currency to deposit + currency: str + # The number of tokens to deposit + num_tokens: str @dataclass -class WSUnsubscribeAllResult: - # The list of stream references unsubscribed from - stream_reference: list[StreamReference] +class DepositHistory: + # The L1 txHash of the deposit + l_1_hash: str + # The L2 txHash of the deposit + l_2_hash: str + # The account to deposit into + to_account_id: str + # The token currency to deposit + currency: str + # The number of tokens to deposit + num_tokens: str + # The timestamp when the deposit was initiated on L1 in unix nanoseconds + initiated_time: str + # The timestamp when the deposit was confirmed on L2 in unix nanoseconds + confirmed_time: str + # The address of the sender + from_address: str @dataclass -class WSListStreamsParams: +class EmptyRequest: pass @dataclass -class WSListStreamsResult: - # The list of stream references the connection is connected to - stream_reference: list[StreamReference] - - -@dataclass -class ApiGetAllInstrumentsRequest: - # Fetch only active instruments - is_active: bool | None = None - - -@dataclass -class ApiGetAllInstrumentsResponse: - # List of instruments - result: list[InstrumentDisplay] - - -@dataclass -class ApiQueryVaultManagerInvestorHistoryRequest: - # The unique identifier of the vault to filter by - vault_id: str - # Whether to only return investments made by the manager - only_own_investments: bool - # Optional. Start time in unix nanoseconds - start_time: str | None = None - # Optional. End time in unix nanoseconds - end_time: str | None = None +class Error: + # The error code for the request + code: int + # The error message for the request + message: str @dataclass -class ApiVaultInvestorHistory: +class Fill: # Time at which the event was emitted in unix nanoseconds event_time: str - # The off chain account id of the investor, only visible to the manager - off_chain_account_id: str - # The unique identifier of the vault. - vault_id: str - # The type of transaction that occurred. List of types: vaultInvest, vaultBurnLpToken, vaultRedeem - type: VaultInvestorAction - # The price of the vault LP tokens at the time of the event. - price: str - # The amount of Vault LP tokens invested or redeemed. - size: str - # The realized PnL of the vault. - realized_pnl: str - # The performance fee of the vault. - performance_fee: str - - -@dataclass -class ApiQueryVaultManagerInvestorHistoryResponse: - # The list of vault investor history belong to the manager - result: list[ApiVaultInvestorHistory] - - -@dataclass -class OrderLeg: - # The instrument to trade in this leg + # The sub account ID that participated in the trade + sub_account_id: str + # The instrument being represented instrument: str - # The total number of assets to trade in this leg, expressed in base asset decimal units. + # The side that the subaccount took on the trade + is_buyer: bool + # The role that the subaccount took on the trade + is_taker: bool + # The number of assets being traded, expressed in base asset decimal units size: str - # Specifies if the order leg is a buy or sell - is_buying_asset: bool - """ - 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 - """ - limit_price: str | None = None - + # The traded price, expressed in `9` decimals + price: str + # The mark price of the instrument at point of trade, expressed in `9` decimals + mark_price: str + # The index price of the instrument at point of trade, expressed in `9` decimals + index_price: str + # The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point) + interest_rate: str + # [Options] The forward price of the option at point of trade, expressed in `9` decimals + forward_price: str + # The realized PnL of the trade, expressed in quote asset decimal units (0 if increasing position size) + realized_pnl: str + # The fees paid on the trade, expressed in quote asset decimal unit (negative if maker rebate applied) + fee: str + # The fee rate paid on the trade + fee_rate: str + """ + 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`. + """ + trade_id: str + # An order identifier + order_id: str + # The venue where the trade occurred + venue: Venue + # If the trade was a liquidation + is_liquidation: bool + """ + 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] -@dataclass -class TPSLOrderMetadata: + When GRVT Backend receives an order with an overlapping clientOrderID, we will reject the order with rejectReason set to overlappingClientOrderId """ - Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders. + 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 + # The main account ID of the builder. referred to Order.builder + builder: str + # Builder fee percentage charged for this order. referred to Order.builder builderFee + builder_fee_rate: str + # The builder fee paid on the trade, expressed in quote asset decimal unit. referred to Trade.builderFee + builder_fee: str + # Specifies the broker who brokered the order + broker: BrokerTag | None = None - ### 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. +@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] + # The list of vault investments held by this main account + vault_investments: list[VaultInvestment] - """ - # Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order - 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 +class FundingPayment: + # Time at which the event was emitted in unix nanoseconds + event_time: str + # The sub account ID that made the funding payment + sub_account_id: str + # The perpetual instrument being funded + instrument: str + # The currency of the funding payment + currency: str + # The amount of the funding payment. Positive if paid, negative if received + amount: str + """ + 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`. + """ + tx_id: str @dataclass -class TriggerOrderMetadata: - """ - Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL). +class InitialLeverageResult: + # The instrument to get the leverage for + instrument: str + # The initial leverage of this instrument + leverage: str + # The min leverage user can set for this instrument + min_leverage: str + # The max leverage user can set for this instrument + max_leverage: str + # The margin type of this instrument + margin_type: PositionMarginType - Trigger orders are used to automatically execute an order when a predefined price condition is met, allowing traders to implement risk management strategies. +@dataclass +class InstrumentDisplay: + # 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`
+ instrument: str + # The asset ID used for instrument signing. + instrument_hash: str + # The base currency + base: str + # The quote currency + quote: str + # The kind of instrument + kind: Kind + # Venues that this instrument can be traded at + venues: list[Venue] + # The settlement period of the instrument + settlement_period: InstrumentSettlementPeriod + # The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1) + base_decimals: int + # The smallest denomination of the quote asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1) + quote_decimals: int + # The size of a single tick, expressed in price decimal units + tick_size: str + # The minimum contract size, expressed in base asset decimal units + min_size: str + # Creation time in unix nanoseconds + create_time: str + # The maximum position size, expressed in base asset decimal units + max_position_size: str + # The minimum order notional value, expressed in quote currency decimal units + min_notional: str + # Defines the funding interval to be applied. + funding_interval_hours: int | None = None + # Funding rate cap over the defined `intervalHours`. + adjusted_funding_rate_cap: str | None = None + # Funding rate floor over the defined `intervalHours`. + adjusted_funding_rate_floor: str | None = None - """ - # Type of the trigger order. eg: Take Profit, Stop Loss, etc - trigger_type: TriggerType +@dataclass +class JSONRPCRequest: + """ + 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. """ - Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders. - + # The JSON RPC version to use for the request + jsonrpc: str + # The method to use for the request (eg: `subscribe` / `unsubscribe` / `v1/instrument` ) + method: str + # The parameters for the request + params: Any """ - tpsl: TPSLOrderMetadata + Optional Field which is used to match the response by the client. + If not passed, this field will not be returned + """ + id: int | None = None @dataclass -class OrderMetadata: +class JSONRPCResponse: """ - 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. + 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. """ + # The JSON RPC version to use for the request + jsonrpc: str + # The method used in the request for this response (eg: `subscribe` / `unsubscribe` / `v1/instrument` ) + method: str + # The result for the request + result: Any | None = None + # The error for the request + error: Error | None = None """ - 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 + Optional Field which is used to match the response by the client. + If not passed, this field will not be returned. + Range: 0 to 4,294,967,295 (uint32) """ - client_order_id: str - # [Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds - create_time: str | None = None - # Trigger fields are used to support any type of trigger order such as TP/SL - trigger: TriggerOrderMetadata | None = None - # Specifies the broker who brokered the order - broker: BrokerTag | None = None + id: int | None = None @dataclass -class OrderState: - # The status of the order - status: OrderStatus - # The reason for rejection or cancellation - reject_reason: OrderRejectReason - # The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs - book_size: list[str] - # The total number of assets traded. Sorted in same order as Order.Legs - traded_size: list[str] - # Time at which the order was updated by GRVT, expressed in unix nanoseconds - update_time: str - # The average fill price of the order. Sorted in same order as Order.Legs - avg_fill_price: list[str] +class MiniTicker: + # Time at which the event was emitted in unix nanoseconds + event_time: str | None = None + # 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`
+ instrument: str | None = None + # The mark price of the instrument, expressed in `9` decimals + mark_price: str | None = None + # The index price of the instrument, expressed in `9` decimals + index_price: str | None = None + # The last traded price of the instrument (also close price), expressed in `9` decimals + last_price: str | None = None + # The number of assets traded in the last trade, expressed in base asset decimal units + last_size: str | None = None + # The mid price of the instrument, expressed in `9` decimals + mid_price: str | None = None + # The best bid price of the instrument, expressed in `9` decimals + best_bid_price: str | None = None + # The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units + best_bid_size: str | None = None + # The best ask price of the instrument, expressed in `9` decimals + best_ask_price: str | None = None + # The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units + best_ask_size: str | None = None @dataclass @@ -1845,6 +1819,10 @@ class Order: signature: Signature # Order Metadata, ignored by the smart contract, and unsigned by the client metadata: OrderMetadata + # The main account ID of the builder + builder: str + # Builder fee charged for this order, expressed as a percentage (e.g., 0.001 means 0.001%). + builder_fee: str # [Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend order_id: str | None = None """ @@ -1872,229 +1850,536 @@ class Order: @dataclass -class ApiCreateOrderRequest: - # The order to create - order: Order +class OrderLeg: + # The instrument to trade in this leg + instrument: str + # The total number of assets to trade in this leg, expressed in base asset decimal units. + size: str + # Specifies if the order leg is a buy or sell + is_buying_asset: bool + """ + 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 + """ + limit_price: str | None = None @dataclass -class ApiCreateOrderResponse: - # The created order - result: Order - +class OrderMetadata: + """ + 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. + """ -@dataclass -class ApiCancelOrderRequest: - # The subaccount ID cancelling the order - sub_account_id: str - # Cancel the order with this `order_id` - order_id: str | None = None - # Cancel the order with this `client_order_id` - client_order_id: str | None = None """ - 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'` -> `'600'`, `'30'` -> `'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. + 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 """ - time_to_live_ms: str | None = None + client_order_id: str + # [Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds + create_time: str | None = None + # Trigger fields are used to support any type of trigger order such as TP/SL + trigger: TriggerOrderMetadata | None = None + # Specifies the broker who brokered the order + broker: BrokerTag | None = None @dataclass -class ApiCancelAllOrdersRequest: - # The subaccount ID cancelling all orders - sub_account_id: str - # The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be cancelled - kind: list[Kind] | None = None - # The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be cancelled - base: list[str] | None = None - # The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be cancelled - quote: list[str] | None = None +class OrderState: + # The status of the order + status: OrderStatus + # The reason for rejection or cancellation + reject_reason: OrderRejectReason + # The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs + book_size: list[str] + # The total number of assets traded. Sorted in same order as Order.Legs + traded_size: list[str] + # Time at which the order was updated by GRVT, expressed in unix nanoseconds + update_time: str + # The average fill price of the order. Sorted in same order as Order.Legs + avg_fill_price: list[str] @dataclass -class ApiOpenOrdersRequest: - # The subaccount ID to filter by - sub_account_id: str - # The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned - kind: list[Kind] | None = None - # The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned - base: list[str] | None = None - # The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned - quote: list[str] | None = None +class OrderStateFeed: + # A unique 128-bit identifier for the order, deterministically generated within the GRVT backend + order_id: str + # A unique identifier for the active order within a subaccount, specified by the client + client_order_id: str + # The order state object being created or updated + order_state: OrderState @dataclass -class ApiOpenOrdersResponse: - # The Open Orders matching the request filter - result: list[Order] +class OrderbookLevel: + # The price of the level, expressed in `9` decimals + price: str + # The number of assets offered, expressed in base asset decimal units + size: str + # The number of open orders at this level + num_orders: int @dataclass -class ApiOrderHistoryRequest: - """ - Retrieves the order history for the account. +class OrderbookLevels: + # Time at which the event was emitted in unix nanoseconds + event_time: str + # 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`
+ instrument: str + # The list of best bids up till query depth + bids: list[OrderbookLevel] + # The list of best asks up till query depth + asks: list[OrderbookLevel] - 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 subaccount ID to filter by +@dataclass +class Positions: + # Time at which the event was emitted in unix nanoseconds + event_time: str + # The sub account ID that participated in the trade sub_account_id: str - # The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned - kind: list[Kind] | None = None - # The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned - base: list[str] | None = None - # The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned - quote: list[str] | None = None - # The start time to apply in nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned - start_time: str | None = None - # The end time to apply in nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned - 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 + # The instrument being represented + instrument: str + # The size of the position, expressed in base asset decimal units. Negative for short positions + size: str + # The notional value of the position, negative for short assets, expressed in quote asset decimal units + notional: str + """ + 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)` + """ + entry_price: str + """ + 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)` + """ + exit_price: str + # The mark price of the position, expressed in `9` decimals + mark_price: str + """ + The unrealized PnL of the position, expressed in quote asset decimal units + `unrealized_pnl = (mark_price - entry_price) * size` + """ + unrealized_pnl: str + """ + The realized PnL of the position, expressed in quote asset decimal units + `realized_pnl = (exit_price - entry_price) * exit_trade_size` + """ + realized_pnl: str + """ + The total PnL of the position, expressed in quote asset decimal units + `total_pnl = realized_pnl + unrealized_pnl` + """ + total_pnl: str + """ + The ROI of the position, expressed as a percentage + `roi = (total_pnl / (entry_price * abs(size))) * 100^` + """ + roi: str + # The index price of the quote currency. (reported in `USD`) + quote_index_price: str + # The estimated liquidation price + est_liquidation_price: str + # The current leverage value for this position + leverage: str + # The cumulative fee paid on the position, expressed in quote asset decimal units + cumulative_fee: str + # The cumulative realized funding payment of the position, expressed in quote asset decimal units. Positive if paid, negative if received + cumulative_realized_funding_payment: str + # The margin type of the position + margin_type: PositionMarginType + # [IsolatedOnly] The wallet balance reserved for this isolated margin position, expressed in quote asset decimal units. If this positions is liquidated, this is the maximal balance that can be lost + isolated_balance: str | None = None + # [IsolatedOnly] The initial margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to open more size in the position + isolated_im: str | None = None + # [IsolatedOnly] The maintenance margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to avoid liquidation of the position + isolated_mm: str | None = None @dataclass -class ApiOrderHistoryResponse: - # The Open Orders matching the request filter - result: list[Order] - # The cursor to indicate when to start the query from - next: str +class PreMinRedemptions: + # Pre-minimum-age redemption requests, ordered by age (first element is the oldest request that is pre-minimum-age). + requests: list[VaultRedemptionRequest] + # Number of shares in the pre-minimum-age section of the vault's redemption queue. + token_count: str @dataclass -class EmptyRequest: - pass +class RiskBracket: + # 1-indexed tier number + tier: int + # Lower bound of notional value (inclusive) in quote currency + notional_floor: str + # Upper bound of notional value (exclusive) in quote currency, empty for last tier + notional_cap: str + # Maintenance margin rate as a decimal (e.g., '0.01' for 1%) + maintenance_margin_rate: str + # Initial margin rate as a decimal (e.g., '0.02' for 2%) + initial_margin_rate: str + # Maximum leverage allowed at this tier (floor of 1 / initial_margin_rate) + max_leverage: int + # Cumulative maintenance margin amount in quote currency + cumulative_maintenance_amount: str @dataclass -class Ack: - # Gravity has acknowledged that the request has been successfully received and it will process it in the backend - ack: bool +class Signature: + # The address (public key) of the wallet signing the payload + signer: str + # Signature R + r: str + # Signature S + s: str + # Signature V + v: int + # Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days + expiration: str + """ + 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. + Range: 0 to 4,294,967,295 (uint32) + """ + nonce: int + # Chain ID used in EIP-712 domain. Zero value fallbacks to GRVT Chain ID. + chain_id: str @dataclass -class AckResponse: - # The Ack Object - result: Ack +class SpotBalance: + # The currency you hold a spot balance in + currency: str + # This currency's balance in this trading account. + balance: str + # The index price of this currency. (reported in `USD`) + index_price: str @dataclass -class ApiGetOrderRequest: - # The subaccount ID to filter by +class StreamReference: + # The channel to subscribe to (eg: ticker.s / ticker.d) + stream: str + # The list of selectors for the stream + selectors: list[str] + + +@dataclass +class SubAccount: + # Time at which the event was emitted in unix nanoseconds + event_time: str + # The sub account ID this entry refers to sub_account_id: str - # Filter for `order_id` - order_id: str | None = None - # Filter for `client_order_id` - client_order_id: str | None = None + # The type of margin algorithm this subaccount uses + margin_type: MarginType + """ + 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 + """ + settle_currency: str + """ + 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` + """ + unrealized_pnl: str + """ + 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` + """ + total_equity: str + """ + The `total_equity` required to open positions in the account (reported in `settle_currency`). + Computation is different depending on account's `margin_type` + """ + initial_margin: str + """ + 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` + """ + maintenance_margin: str + """ + 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)` + """ + available_balance: str + # The list of spot assets owned by this sub account, and their balances + spot_balances: list[SpotBalance] + # The list of positions owned by this sub account + positions: list[Positions] + # The index price of the settle currency. (reported in `USD`) + settle_index_price: str + # The derisk margin of this sub account + derisk_margin: str + # The derisk margin to maintenance margin ratio of this sub account + derisk_to_maintenance_margin_ratio: str + # The total equity of this sub account for cross margin + total_cross_equity: str + # The unrealized PnL of this sub account for cross margin + cross_unrealized_pnl: str + # Whether this sub account is a vault + is_vault: bool | None = None + # Total amount of IM (reported in `settle_currency`) deducted from the vault due to redemptions nearing the end of their redemption period + vault_im_additions: str | None = None + + +@dataclass +class TPSLOrderMetadata: + """ + 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. + + + """ + + # Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order + 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 +class Ticker: + """ + 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. + + """ + + # Time at which the event was emitted in unix nanoseconds + event_time: str | None = None + # 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`
+ instrument: str | None = None + # The mark price of the instrument, expressed in `9` decimals + mark_price: str | None = None + # The index price of the instrument, expressed in `9` decimals + index_price: str | None = None + # The last traded price of the instrument (also close price), expressed in `9` decimals + last_price: str | None = None + # The number of assets traded in the last trade, expressed in base asset decimal units + last_size: str | None = None + # The mid price of the instrument, expressed in `9` decimals + mid_price: str | None = None + # The best bid price of the instrument, expressed in `9` decimals + best_bid_price: str | None = None + # The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units + best_bid_size: str | None = None + # The best ask price of the instrument, expressed in `9` decimals + best_ask_price: str | None = None + # The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units + best_ask_size: str | None = None + # DEPRECATED: To be removed in a future release. Please refer to the field `funding_rate` instead, for the funding rate being applied over `funding_interval_hours` (interval ending at `next_funding_time`). + funding_rate_8h_curr: str | None = None + # DEPRECATED: To be removed in a future release. Please refer to the field `funding_rate` instead, for the funding rate being applied over `funding_interval_hours` (interval ending at `next_funding_time`). + funding_rate_8h_avg: str | None = None + # The interest rate of the underlying, expressed in centibeeps (1/100th of a basis point) + interest_rate: str | None = None + # [Options] The forward price of the option, expressed in `9` decimals + forward_price: str | None = None + # The 24 hour taker buy volume of the instrument, expressed in base asset decimal units + buy_volume_24h_b: str | None = None + # The 24 hour taker sell volume of the instrument, expressed in base asset decimal units + sell_volume_24h_b: str | None = None + # The 24 hour taker buy volume of the instrument, expressed in quote asset decimal units + buy_volume_24h_q: str | None = None + # The 24 hour taker sell volume of the instrument, expressed in quote asset decimal units + sell_volume_24h_q: str | None = None + # The 24 hour highest traded price of the instrument, expressed in `9` decimals + high_price: str | None = None + # The 24 hour lowest traded price of the instrument, expressed in `9` decimals + low_price: str | None = None + # The 24 hour first traded price of the instrument, expressed in `9` decimals + open_price: str | None = None + # The open interest in the instrument, expressed in base asset decimal units + open_interest: str | None = None + # The ratio of accounts that are net long vs net short on this instrument + long_short_ratio: str | None = None + # The current indicative funding rate for the active interval, expressed in centibeeps + funding_rate: str | None = None + # Timestamp in nanoseconds when the current funding interval ends + next_funding_time: str | None = None + + +@dataclass +class Trade: + # Time at which the event was emitted in unix nanoseconds + event_time: str + # 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`
+ instrument: str + # If taker was the buyer on the trade + is_taker_buyer: bool + # The number of assets being traded, expressed in base asset decimal units + size: str + # The traded price, expressed in `9` decimals + price: str + # The mark price of the instrument at point of trade, expressed in `9` decimals + mark_price: str + # The index price of the instrument at point of trade, expressed in `9` decimals + index_price: str + # The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point) + interest_rate: str + # [Options] The forward price of the option at point of trade, expressed in `9` decimals + forward_price: str + """ + 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`. + """ + trade_id: str + # The venue where the trade occurred + venue: Venue + # If the trade is a RPI trade + is_rpi: bool @dataclass -class ApiGetOrderResponse: - # The order object for the requested filter - result: Order +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: str + # 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 ApiCancelOnDisconnectRequest: +class TriggerOrderMetadata: """ - Auto-Cancel All Open Orders when the countdown time hits zero. + 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. - 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 -> 1000, which is rounded to 0: will result in termination of their COD - - Market Maker initially entered a value between 1001 -> 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. """ - # The subaccount ID cancelling the orders for - sub_account_id: str + # Type of the trigger order. eg: Take Profit, Stop Loss, etc + trigger_type: TriggerType """ - Countdown time in milliseconds (ex. 120000 for 120s). + Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders. - 0 to disable the timer. - Does not accept negative values. + """ + tpsl: TPSLOrderMetadata - Minimum acceptable value is 1,000. - Maximum acceptable value is 300,000 - """ - countdown_time: str | None = None +@dataclass +class VaultInvestment: + # The trading account ID of the vault invested in. + vault_id: str + # The number of shares held by the investor. + num_lp_tokens: str + # The current share price (in USD) of this vault investment. + share_price: str + # The USD notional invested in this vault investment. + usd_notional_invested: str @dataclass -class WSOrderFeedSelectorV1: +class VaultInvestorSummary: """ - 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`). + Vault investor summary information. + + This struct contains the summary of investments in a vault. """ - # The subaccount ID to filter by + # The unique identifier of the vault sub account. sub_account_id: str - # The instrument filter to apply. - instrument: str | None = None + # The number of Vault LP tokens held by the investor. + num_lp_tokens: str + # The average entry price (in USD) of the vault LP tokens. + avg_entry_price: str + # The current price (in USD) of the vault LP tokens. + current_price: str + # The current valuation (in USD) of all held vault LP tokens. + total_equity: str + # The all-time realized PnL (in USD) that the investor has received from the vault. + all_time_realized_pnl: str + # The singleton pending redemption (omitted if none). + pending_redemption: VaultRedemption | None = None + # True if the requesting account is authorized to burn tokens on this vault, omitted otherwise. + can_burn: bool | None = None @dataclass -class WSOrderFeedDataV1: - # 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`. +class VaultRedemption: """ - sequence_number: str - # The order object being created or updated - feed: Order - # The previous sequence number that determines the message order - prev_sequence_number: str - + Vault redemption information. -@dataclass -class WSOrderStateFeedSelectorV1: - """ - 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`). + This struct contains information about a pending redemption from a vault. """ - # The subaccount ID to filter by - sub_account_id: str - # The instrument filter to apply. - instrument: str | None = None + # The number of LP Tokens requested for redemption. + num_lp_tokens: str + # The valuation (in USD) of the redemption request. + request_valuation: str + # [Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds + request_time: str + # [Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed. + max_redemption_period_timestamp: str + # Omitted for redemption requests to non-cross exchange vaults. True if cancellation is blocked within the CEV allocation allowance for the user's current tier (e.g. because the user has already transferred out the spot balance underlying the redemption request). + cancel_blocked: bool | None = None @dataclass -class OrderStateFeed: - # A unique 128-bit identifier for the order, deterministically generated within the GRVT backend - order_id: str - # A unique identifier for the active order within a subaccount, specified by the client - client_order_id: str - # The order state object being created or updated - order_state: OrderState +class VaultRedemptionRequest: + # [Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds + request_time: str + # The number of shares to redeem + num_lp_tokens: str + # [Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed. + max_redemption_period_timestamp: str + # Age category of this redemption request. + age_category: VaultRedemptionReqAgeCategory + # [Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be eligible for automated redemption. + eligible_for_auto_redemption_timestamp: str + # `true` if this request belongs to the vault manager, omitted otherwise. + is_manager: bool | None = None @dataclass -class WSOrderStateFeedDataV1: +class WSCancelFeedDataV1: # Stream name stream: str # Primary selector @@ -2108,29 +2393,29 @@ class WSOrderStateFeedDataV1: - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`. """ sequence_number: str - # The Order State Feed - feed: OrderStateFeed + # Data relating to the status of the cancellation attempt + feed: CancelStatusFeed # The previous sequence number that determines the message order prev_sequence_number: str @dataclass -class WSPositionsFeedSelectorV1: +class WSCancelFeedSelectorV1: """ - 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`). + 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`. + """ # The subaccount ID to filter by sub_account_id: str - # The instrument filter to apply. - instrument: str | None = None @dataclass -class WSPositionsFeedDataV1: +class WSCandlestickFeedDataV1: # Stream name stream: str # Primary selector @@ -2144,89 +2429,29 @@ class WSPositionsFeedDataV1: - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`. """ sequence_number: str - # A Position being created or updated matching the request filter - feed: Positions - # The previous sequence number that determines the message order - prev_sequence_number: str - - -@dataclass -class WSFillFeedSelectorV1: - """ - 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`). - """ - - # The sub account ID to request for - sub_account_id: str - # The instrument filter to apply. - instrument: str | None = None - - -@dataclass -class WSFillFeedDataV1: - # The websocket channel to which the response is sent - 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 - # A private trade matching the request filter - feed: Fill + # A candlestick entry matching the request filters + feed: Candlestick # The previous sequence number that determines the message order prev_sequence_number: str -@dataclass -class WSTransferFeedSelectorV1: - """ - 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`). - """ - - # The main account ID to request for - main_account_id: str - # The sub account ID to request for - 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: str - # 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 WSCandlestickFeedSelectorV1: + """ + 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. + """ + + # 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`
+ instrument: str + # The interval of each candlestick + interval: CandlestickInterval + # The type of candlestick data to retrieve + type: CandlestickType + @dataclass -class WSTransferFeedDataV1: +class WSDepositFeedDataV1: # The websocket channel to which the response is sent stream: str # Primary selector @@ -2240,8 +2465,8 @@ class WSTransferFeedDataV1: - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`. """ sequence_number: str - # The transfer history matching the requested filters - feed: TransferHistory + # The Deposit object + feed: Deposit # The previous sequence number that determines the message order prev_sequence_number: str @@ -2258,19 +2483,7 @@ class WSDepositFeedSelectorV1: @dataclass -class Deposit: - # The hash of the bridgemint event producing the deposit - tx_hash: str - # The account to deposit into - to_account_id: str - # The token currency to deposit - currency: str - # The number of tokens to deposit - num_tokens: str - - -@dataclass -class WSDepositFeedDataV1: +class WSFillFeedDataV1: # The websocket channel to which the response is sent stream: str # Primary selector @@ -2284,40 +2497,40 @@ class WSDepositFeedDataV1: - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`. """ sequence_number: str - # The Deposit object - feed: Deposit + # A private trade matching the request filter + feed: Fill # The previous sequence number that determines the message order prev_sequence_number: str @dataclass -class WSWithdrawalFeedSelectorV1: +class WSFillFeedSelectorV1: """ - 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 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`). """ - # The main account ID to request for - main_account_id: str + # The sub account ID to request for + sub_account_id: str + # The instrument filter to apply. + instrument: str | None = None @dataclass -class Withdrawal: - # 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: str - # The number of tokens to withdraw - num_tokens: str - # The signature of the withdrawal - signature: Signature +class WSListStreamsParams: + pass @dataclass -class WSWithdrawalFeedDataV1: - # The websocket channel to which the response is sent +class WSListStreamsResult: + # The list of stream references the connection is connected to + stream_reference: list[StreamReference] + + +@dataclass +class WSMiniTickerFeedDataV1: + # Stream name stream: str # Primary selector selector: str @@ -2330,30 +2543,35 @@ class WSWithdrawalFeedDataV1: - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`. """ sequence_number: str - # The Withdrawal object - feed: Withdrawal + # A mini ticker matching the request filter + feed: MiniTicker # The previous sequence number that determines the message order prev_sequence_number: str @dataclass -class CancelStatusFeed: - # The subaccount ID that requested the cancellation - sub_account_id: str - # A unique identifier for the active order within a subaccount, specified by the client - client_order_id: str - # A unique 128-bit identifier for the order, deterministically generated within the GRVT backend - order_id: str - # The user-provided reason for cancelling the order - reason: OrderRejectReason - # Status of the cancellation attempt - cancel_status: CancelStatus - # [Filled by GRVT Backend] Time at which the cancellation status was updated by GRVT in unix nanoseconds - update_time: str | None = None +class WSMiniTickerFeedSelectorV1: + """ + 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:
  • On subscription, the server will send a full snapshot of the mini ticker.
  • After the snapshot, the server will only send deltas of the mini ticker.
  • The server will send a delta if any of the fields in the mini ticker have changed.
+ + Field Semantics:
  • [DeltaOnly] If a field is not updated, {}
  • If a field is updated, {field: '123'}
  • If a field is set to zero, {field: '0'}
  • If a field is set to null, {field: ''}
+ """ + + # 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`
+ instrument: str + """ + The minimal rate at which we publish feeds (in milliseconds) + Delta (0 - `raw`, 50, 100, 200, 500, 1000, 5000) + Snapshot (200, 500, 1000, 5000) + """ + rate: int @dataclass -class WSCancelFeedDataV1: +class WSOrderFeedDataV1: # Stream name stream: str # Primary selector @@ -2367,449 +2585,440 @@ class WSCancelFeedDataV1: - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`. """ sequence_number: str - # Data relating to the status of the cancellation attempt - feed: CancelStatusFeed + # The order object being created or updated + feed: Order # The previous sequence number that determines the message order prev_sequence_number: str @dataclass -class WSCancelFeedSelectorV1: +class WSOrderFeedSelectorV1: """ - 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`. - + 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`). """ # The subaccount ID to filter by sub_account_id: str + # The instrument filter to apply. + instrument: str | None = None @dataclass -class ApiWithdrawalRequest: - """ - Leverage this API to initialize a withdrawal from GRVT's Hyperchain onto Ethereum. - Do take note that the bridging process does take time. The GRVT UI will help you keep track of bridging progress, and notify you once its complete. - - If not withdrawing the entirety of your balance, there is a minimum withdrawal amount. Currently that amount is ~25 USDT. - Withdrawal fees also apply to cover the cost of the Ethereum transaction. - Note that your funds will always remain in self-custory throughout the withdrawal process. At no stage does GRVT gain control over your funds. - """ - - # The main account to withdraw from - from_account_id: str - # The Ethereum wallet to withdraw into - to_eth_address: str - # The token currency to withdraw - currency: str - # The number of tokens to withdraw, quoted in tokenCurrency decimal units - num_tokens: str - # The signature of the withdrawal - signature: Signature - - -@dataclass -class ApiTransferRequest: +class WSOrderStateFeedDataV1: + # Stream name + stream: str + # Primary selector + selector: str """ - This API allows you to transfer funds in multiple different ways
    -
  • Between SubAccounts within your Main Account
  • -
  • Between your MainAccount and your SubAccounts
  • -
  • To other MainAccounts that you have previously allowlisted
  • -
Fast Withdrawal Funding Address - For fast withdrawals, funds must be sent to the designated funding account address. Please ensure you use the correct address based on the environment: - Production Environment Address: - [To be updated, not ready yet] - This address should be specified as the to_account_id in your API requests for transferring funds using the transfer API. Ensure accurate input to avoid loss of funds or use the UI. - + 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 main 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 main 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: str - # The number of tokens to transfer, quoted in tokenCurrency decimal units - num_tokens: str - # The signature of the transfer - signature: Signature - # The type of transfer - transfer_type: TransferType - # The metadata of the transfer - 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 + sequence_number: str + # The Order State Feed + feed: OrderStateFeed + # The previous sequence number that determines the message order + prev_sequence_number: str @dataclass -class ApiDepositHistoryRequest: - """ - The request to get the historical deposits of an account - The history is returned in reverse chronological order - - 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.
+class WSOrderStateFeedSelectorV1: """ - - # The token currency to query for, if nil or empty, return all deposits. Otherwise, only entries matching the filter will be returned - currency: list[str] - # The start time to query for in unix nanoseconds - start_time: str | None = None - # The end time to query for 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 next query from - cursor: str | None = None - # Main account ID being queried. By default, applies the requestor's main account ID. - main_account_id: str | None = None - - -@dataclass -class DepositHistory: - # The L1 txHash of the deposit - l_1_hash: str - # The L2 txHash of the deposit - l_2_hash: str - # The account to deposit into - to_account_id: str - # The token currency to deposit - currency: str - # The number of tokens to deposit - num_tokens: str - # The timestamp when the deposit was initiated on L1 in unix nanoseconds - initiated_time: str - # The timestamp when the deposit was confirmed on L2 in unix nanoseconds - confirmed_time: str - # The address of the sender - from_address: str + 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`). + """ + + # The subaccount ID to filter by + sub_account_id: str + # The instrument filter to apply. + instrument: str | None = None @dataclass -class ApiDepositHistoryResponse: - # The deposit history matching the request account - result: list[DepositHistory] - # The cursor to indicate when to start the next query from - next: str | None = None +class WSOrderbookLevelsFeedDataV1: + # 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 + # An orderbook levels object matching the request filter + feed: OrderbookLevels + # The previous sequence number that determines the message order + prev_sequence_number: str @dataclass -class ApiTransferHistoryRequest: +class WSOrderbookLevelsFeedSelectorV1: """ - The request to get the historical transfers of an account - The history is returned in reverse chronological order + 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. - 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 Delta feed will work as follows:
  • On subscription, the server will send a full snapshot of all levels of the Orderbook.
  • After the snapshot, the server will only send levels that have changed in value.
+ + Subscription Pattern:
  • Delta - `instrument@rate`
  • Snapshot - `instrument@rate-depth`
+ + Field Semantics:
  • [DeltaOnly] If a level is not updated, level not published
  • If a level is updated, {size: '123'}
  • If a level is set to zero, {size: '0'}
  • Incoming levels will be published as soon as price moves
  • Outgoing levels will be published with `size = 0`
""" - # The token currency to query for, if nil or empty, return all transfers. Otherwise, only entries matching the filter will be returned - currency: list[str] - # The start time to query for in unix nanoseconds - start_time: str | None = None - # The end time to query for 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 next query from - cursor: str | None = None - # The transaction ID to query for - tx_id: str | None = None - # Main account ID being queried. By default, applies the requestor's main account ID. - main_account_id: str | None = None - # The transfer type to filters for. If the list is empty, return all transfer types. - transfer_types: list[TransferType] | None = None + # 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`
+ instrument: str + """ + The minimal rate at which we publish feeds (in milliseconds) + Delta (50, 100, 500, 1000) + Snapshot (500, 1000) + """ + rate: int + """ + Depth of the order book to be retrieved + Delta(0 - `unlimited`) + Snapshot(10, 50, 100, 500) + """ + depth: int | None = None @dataclass -class ApiTransferHistoryResponse: - # The transfer history matching the request account - result: list[TransferHistory] - # The cursor to indicate when to start the next query from - next: str | None = None +class WSPositionsFeedDataV1: + # 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 + # A Position being created or updated matching the request filter + feed: Positions + # The previous sequence number that determines the message order + prev_sequence_number: str @dataclass -class ApiWithdrawalHistoryRequest: +class WSPositionsFeedSelectorV1: """ - The request to get the historical withdrawals of an account - The history is returned in reverse chronological order - - 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.
+ 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`). """ - # The token currency to query for, if nil or empty, return all withdrawals. Otherwise, only entries matching the filter will be returned - currency: list[str] - # The start time to query for in unix nanoseconds - start_time: str | None = None - # The end time to query for 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 next query from - cursor: str | None = None - # Main account ID being queried. By default, applies the requestor's main account ID. - main_account_id: str | None = None + # The subaccount ID to filter by + sub_account_id: str + # The instrument filter to apply. + instrument: 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: str - # 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 - # The transaction hash on L2 - l_2_hash: str - # The finalized withdrawal transaction hash on L1 - l_1_hash: str | None = None +class WSSubscribeParams: + """ + 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. + """ + + # The channel to subscribe to (eg: ticker.s / ticker.d) + stream: str + # The list of feeds to subscribe to + selectors: list[str] + # Whether to use the global sequence number for the stream + use_global_sequence_number: bool | None = None @dataclass -class ApiWithdrawalHistoryResponse: - # The withdrawals history matching the request account - result: list[WithdrawalHistory] - # The cursor to indicate when to start the next query from - next: str | None = None +class WSSubscribeRequestV1Legacy: + """ + 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. + """ + + # The channel to subscribe to (eg: ticker.s / ticker.d) + stream: str + # The list of feeds to subscribe to + feed: list[str] + # The method to use for the request (eg: subscribe / unsubscribe) + method: str + """ + Optional Field which is used to match the response by the client. + If not passed, this field will not be returned. + Range: 0 to 4,294,967,295 (uint32) + """ + request_id: int | None = None + # Whether the request is for full data or lite data + is_full: bool | None = None @dataclass -class ApiVaultInvestRequest: +class WSSubscribeResponseV1Legacy: """ - Request payload for investing in a vault. - - This API allows a client to invest a specified amount of tokens in a particular vault. + 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:
  • All 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
  • Num snapshots returned in Response (per stream): You can ensure that you received the right number of snapshots
  • First sequence number returned in Response (per stream): You can ensure that you received the first stream, without gaps from snapshots
  • Sequence numbers should always monotonically increase by `1`. If it decreases, or increases by more than `1`. Please reconnect
  • Duplicate sequence numbers are possible due to network retries. If you receive a duplicate, please ignore it, or idempotently re-update it.
+ When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details. """ - # The unique identifier of the vault to invest in. - vault_id: str - # The currency used for the investment. This should be the vault's quote currency. - currency: str - # The investment sum, in terms of the token currency specified (i.e., `numTokens` of '1000' with `tokenCurrency` of 'USDT' denotes investment of 1,000 USDT). - num_tokens: str + # The channel to subscribe to (eg: ticker.s / ticker.d) + stream: str + # The list of feeds subscribed to + subs: list[str] + # The list of feeds unsubscribed from + unsubs: list[str] + # The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs` + num_snapshots: list[int] + # The first sequence number to expect for each subscribed feed. Returned in same order as `subs` + first_sequence_number: list[str] + # 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` + latest_sequence_number: list[str] """ - The digital signature from the investing account. - This signature must be generated by the main account ID and is used to verify the authenticity of the request. - The signature must comply with AccountPermExternalTransfer permission. + Optional Field which is used to match the response by the client. + If not passed, this field will not be returned """ - signature: Signature + request_id: int | None = None @dataclass -class ApiVaultRedeemRequest: +class WSSubscribeResult: """ - Request payload for redeeming from a vault. - - This API allows a client to redeem a specified amount of tokens from a particular vault. + To ensure you always know if you have missed any payloads, GRVT servers apply the following heuristics to sequence numbers:
  • All 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
  • Num snapshots returned in Response (per stream): You can ensure that you received the right number of snapshots
  • First sequence number returned in Response (per stream): You can ensure that you received the first stream, without gaps from snapshots
  • Sequence numbers should always monotonically increase by `1`. If it decreases, or increases by more than `1`. Please reconnect
  • Duplicate sequence numbers are possible due to network retries. If you receive a duplicate, please ignore it, or idempotently re-update it.
+ When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details. """ - # The unique identifier of the vault to redeem from. - vault_id: str - # The currency used for the redemption. This should be the vault's quote currency. - currency: str - # The number of shares to redeem. - num_tokens: str + # The channel to subscribe to (eg: ticker.s / ticker.d) + stream: str + # The list of feeds subscribed to + subs: list[str] + # The list of feeds unsubscribed from + unsubs: list[str] + # The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs` + num_snapshots: list[int] + # The first sequence number to expect for each subscribed feed. Returned in same order as `subs` + first_sequence_number: list[str] + # 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` + latest_sequence_number: list[str] + + +@dataclass +class WSTickerFeedDataV1: + # Stream name + stream: str + # Primary selector + selector: str """ - The digital signature from the investing account. - This signature must be generated by the main account ID and is used to verify the authenticity of the request. - The signature must comply with AccountPermExternalTransfer permission. + 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`. """ - signature: Signature + sequence_number: str + # A ticker matching the request filter + feed: Ticker + # The previous sequence number that determines the message order + prev_sequence_number: str @dataclass -class ApiVaultRedeemCancelRequest: +class WSTickerFeedSelectorV1: """ - Request payload for canceling a vault redemption. + 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. - This API allows a client to cancel a previously initiated redemption from a vault. + The Delta feed will work as follows:
  • On subscription, the server will send a full snapshot of the ticker.
  • After the snapshot, the server will only send deltas of the ticker.
  • The server will send a delta if any of the fields in the ticker have changed.
+ + Field Semantics:
  • [DeltaOnly] If a field is not updated, {}
  • If a field is updated, {field: '123'}
  • If a field is set to zero, {field: '0'}
  • If a field is set to null, {field: ''}
""" - # The unique identifier of the vault to cancel the redemption from. - vault_id: str + # 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`
+ instrument: str + """ + The minimal rate at which we publish feeds (in milliseconds) + Delta (100, 200, 500, 1000, 5000) + Snapshot (500, 1000, 5000) + """ + rate: int @dataclass -class ApiVaultViewRedemptionQueueRequest: +class WSTradeFeedDataV1: + # Stream name + stream: str + # Primary selector + selector: str """ - Request payload for a vault manager to view the redemption queue for their vault. - - Fetches the redemption queue for a vault, ordered by descending priority. - - Urgent redemption requests, defined as having been pending >90% of the manager-defined maximum redemption period, have top priority (following insertion order). - - Non-urgent redemption requests are otherwise prioritized by insertion order, unless they are >5x the size of the smallest redemption request. - - E.g., If FIFO ordering (all non-urgent) is 1k -> 50k -> 100k -> 20k -> 10k -> 25k, then priority ordering is 1k -> 10k -> 50k -> 20k -> 100k -> 25k. - - Only displays redemption requests that are eligible for automated redemption, i.e., have been pending for the manager-defined minimum redemption period. + 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 unique identifier of the vault to fetch the redemption queue for. - vault_id: str + sequence_number: str + # A public trade matching the request filter + feed: Trade + # The previous sequence number that determines the message order + prev_sequence_number: str @dataclass -class VaultRedemptionRequest: - # [Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds - request_time: str - # The number of shares to redeem - num_lp_tokens: str - # [Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed. - max_redemption_period_timestamp: str - # Age category of this redemption request. - age_category: VaultRedemptionReqAgeCategory - # [Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be eligible for automated redemption. - eligible_for_auto_redemption_timestamp: str - # `true` if this request belongs to the vault manager, omitted otherwise. - is_manager: bool | None = None +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`
+ instrument: str + # The limit to query for. Valid values are (50, 200, 500, 1000). Default is 50 + limit: int @dataclass -class PreMinRedemptions: - # Pre-minimum-age redemption requests, ordered by age (first element is the oldest request that is pre-minimum-age). - requests: list[VaultRedemptionRequest] - # Number of shares in the pre-minimum-age section of the vault's redemption queue. - token_count: str +class WSTransferFeedDataV1: + # The websocket channel to which the response is sent + 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 transfer history matching the requested filters + feed: TransferHistory + # The previous sequence number that determines the message order + prev_sequence_number: str @dataclass -class ApiVaultViewRedemptionQueueResponse: +class WSTransferFeedSelectorV1: """ - Response payload for a vault manager to view the redemption queue for their vault, ordered by descending priority. - - Also includes counters for total redemption sizes pending as well as urgent (refer to API integration guide for more detail on redemption request classifications). - - + 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`). """ - # Outstanding vault redemption requests, ordered by descending priority. Excludes requests that have not yet aged past the minimum redemption period. - redemption_queue: list[VaultRedemptionRequest] - # Number of shares eligible for automated redemption (held in queue for at least the minimum redemption period). - pending_redemption_token_count: str - # Number of shares nearing the maximum redemption period (>= 90% of maximum redemption period). - urgent_redemption_token_count: str - # Amount available for automated redemption request servicing (in USD). - auto_redeemable_balance: str - # Current share price (in USD). - share_price: str - # Dedicated section for requests yet to wait at least the minimum redemption period. - pre_min: PreMinRedemptions + # The main account ID to request for + main_account_id: str + # The sub account ID to request for + sub_account_id: str | None = None @dataclass -class ApiVaultInvestorSummaryRequest: - """ - Request payload for fetching the summary of a vault investor. +class WSUnsubscribeAllParams: + pass - This API allows a client to retrieve the summary of investments in a specific vault. - """ - # The unique identifier of the vault to fetch the summary for. - vault_id: str +@dataclass +class WSUnsubscribeAllResult: + # The list of stream references unsubscribed from + stream_reference: list[StreamReference] @dataclass -class VaultRedemption: - """ - Vault redemption information. +class WSUnsubscribeParams: + # The channel to unsubscribe from (eg: ticker.s / ticker.d) + stream: str + # The list of feeds to unsubscribe from + selectors: list[str] + # Whether to use the global sequence number for the stream + use_global_sequence_number: bool | None = None - This struct contains information about a pending redemption from a vault. - """ - # The number of LP Tokens requested for redemption. - num_lp_tokens: str - # The valuation (in USD) of the redemption request. - request_valuation: str - # [Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds - request_time: str - # [Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed. - max_redemption_period_timestamp: str - # Omitted for redemption requests to non-cross exchange vaults. True if cancellation is blocked within the CEV allocation allowance for the user's current tier (e.g. because the user has already transferred out the spot balance underlying the redemption request). - cancel_blocked: bool | None = None +@dataclass +class WSUnsubscribeResult: + # The channel to subscribe to (eg: ticker.s / ticker.d) + stream: str + # The list of feeds unsubscribed from + unsubs: list[str] @dataclass -class VaultInvestorSummary: +class WSWithdrawalFeedDataV1: + # The websocket channel to which the response is sent + stream: str + # Primary selector + selector: str """ - Vault investor summary information. - - This struct contains the summary of investments in a vault. + 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 unique identifier of the vault sub account. - sub_account_id: str - # The number of Vault LP tokens held by the investor. - num_lp_tokens: str - # The average entry price (in USD) of the vault LP tokens. - avg_entry_price: str - # The current price (in USD) of the vault LP tokens. - current_price: str - # The current valuation (in USD) of all held vault LP tokens. - total_equity: str - # The all-time realized PnL (in USD) that the investor has received from the vault. - all_time_realized_pnl: str - # The singleton pending redemption (omitted if none). - pending_redemption: VaultRedemption | None = None - # True if the requesting account is authorized to burn tokens on this vault, omitted otherwise. - can_burn: bool | None = None + sequence_number: str + # The Withdrawal object + feed: Withdrawal + # The previous sequence number that determines the message order + prev_sequence_number: str @dataclass -class ApiVaultInvestorSummaryResponse: +class WSWithdrawalFeedSelectorV1: """ - Response payload for the summary of a vault investor. - - This API provides the summary of investments in a specific vault. + 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`). """ - # The summary of investments in the vault. - vault_investor_summary: list[VaultInvestorSummary] + # The main account ID to request for + main_account_id: str @dataclass -class ApiVaultBurnTokensRequest: - """ - Request payload for burning tokens in a vault. +class Withdrawal: + # 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: str + # The number of tokens to withdraw + num_tokens: str + # The signature of the withdrawal + signature: Signature - This API allows a client to burn a specified amount of tokens in a particular vault. - """ - # The unique identifier of the vault to burn tokens from. - vault_id: str - # The currency used for the burn. This should be the vault's quote currency. +@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: str - # The number of tokens to burn. + # The number of tokens to withdraw num_tokens: str - """ - The digital signature from the investing account. - This signature must be generated by the main account ID and is used to verify the authenticity of the request. - The signature must comply with AccountPermExternalTransfer permission. - """ + # The signature of the withdrawal signature: Signature + # The timestamp of the withdrawal in unix nanoseconds + event_time: str + # The transaction hash on L2 + l_2_hash: str + # The finalized withdrawal transaction hash on L1 + l_1_hash: str | None = None diff --git a/src/codegen/apispec.json b/src/codegen/apispec.json index 57fb075..06444d0 100644 --- a/src/codegen/apispec.json +++ b/src/codegen/apispec.json @@ -967,6 +967,16 @@ "message": "Order size too granular", "status": 400 }, + { + "code": 2066, + "message": "Order notional value is below minimum requirement", + "status": 400 + }, + { + "code": 2067, + "message": "Orders below the minimum notional are only allowed when closing positions that are also below the minimum", + "status": 400 + }, { "code": 2070, "message": "Liquidation Order is not supported", @@ -1388,6 +1398,47 @@ }, { "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", + "status": 429 + }, + { + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 + } + ] + }, + { + "namespace": "Position", "name": "RPCPositionsV1", "version": 1, "route": "/positions", @@ -1428,13 +1479,13 @@ ] }, { - "namespace": "Execution", - "name": "RPCFundingPaymentHistoryV1", + "namespace": "Position", + "name": "RPCSetPositionConfigV1", "version": 1, - "route": "/funding_payment_history", + "route": "/set_position_config", "auth_required": true, - "request": "ApiFundingPaymentHistoryRequest", - "response": "ApiFundingPaymentHistoryResponse", + "request": "ApiSetSubAccountPositionMarginConfigRequest", + "response": "ApiSetSubAccountPositionMarginConfigResponse", "on_request_errors": [ { "code": 1000, @@ -1462,9 +1513,161 @@ "status": 429 }, { - "code": 1008, - "message": "Your IP has not been whitelisted for access", + "code": 1004, + "message": "Data Not Found", + "status": 404 + }, + { + "code": 2102, + "message": "Margin type change failed, has open position for this instrument", + "status": 400 + }, + { + "code": 2103, + "message": "Margin type change failed, has open orders for this instrument", + "status": 400 + }, + { + "code": 2101, + "message": "Vaults cannot configure leverage", + "status": 400 + }, + { + "code": 2104, + "message": "Margin type not supported", + "status": 400 + }, + { + "code": 2105, + "message": "Margin type change failed", + "status": 400 + }, + { + "code": 2100, + "message": "Invalid initial leverage", + "status": 400 + }, + { + "code": 2107, + "message": "Attempted to set leverage below minimum", + "status": 400 + }, + { + "code": 2108, + "message": "Attempted to set leverage above maximum", + "status": 400 + } + ] + }, + { + "namespace": "Position", + "name": "RPCAddPositionMarginV1", + "version": 1, + "route": "/add_position_margin", + "auth_required": true, + "request": "ApiAddIsolatedPositionMarginRequest", + "response": "ApiAddIsolatedPositionMarginResponse", + "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": 7450, + "message": "Add margin failed", + "status": 400 + }, + { + "code": 7451, + "message": "Add margin to empty position", + "status": 400 + }, + { + "code": 7452, + "message": "Add margin to non isolated position", + "status": 400 + }, + { + "code": 7453, + "message": "Max addable amount exceeded", + "status": 400 + }, + { + "code": 7454, + "message": "Max removable amount exceeded", + "status": 400 + } + ] + }, + { + "namespace": "Position", + "name": "RPCGetPositionMarginLimitsV1", + "version": 1, + "route": "/get_position_margin_limits", + "auth_required": true, + "request": "ApiGetIsolatedPositionMarginLimitsRequest", + "response": "ApiGetIsolatedPositionMarginLimitsResponse", + "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": 7455, + "message": "Not isolated margin position", + "status": 400 } ] }, @@ -2471,17 +2674,16 @@ "status": 401 } ] - } - ], - "streams": [ + }, { - "namespace": "Order", - "name": "StreamOrderV1", - "channel": "v1.order", + "namespace": "Builder", + "name": "RPCAuthorizeBuilderV1", + "version": 1, + "route": "/authorize_builder", "auth_required": true, - "feed_selector": "WSOrderFeedSelectorV1", - "feed": "WSOrderFeedDataV1", - "on_subscribe_errors": [ + "request": "ApiAuthorizeBuilderRequest", + "response": "AckResponse", + "on_request_errors": [ { "code": 1000, "message": "You need to authenticate prior to using this functionality", @@ -2497,46 +2699,52 @@ "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": 1101, - "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", - "status": 400 - }, - { - "code": 1102, - "message": "Wrong number of primary selectors", + "code": 7500, + "message": "Builder Fee exceeds the allowed program limit.", "status": 400 }, { - "code": 1103, - "message": "Wrong number of secondary selectors", + "code": 7501, + "message": "Builder Fee can't be negative.", "status": 400 }, { - "code": 3000, - "message": "Instrument is invalid", + "code": 7502, + "message": "Builder Account does not exist.", "status": 400 }, { - "code": 3020, - "message": "Sub account ID must be an uint64 integer", + "code": 7503, + "message": "Builder is already authorized for this account with the given fee.", "status": 400 } ] }, { - "namespace": "Order", - "name": "StreamOrderStateV1", - "channel": "v1.state", + "namespace": "Builder", + "name": "RPCGetAuthorizedBuildersV1", + "version": 1, + "route": "/get_authorized_builders", "auth_required": true, - "feed_selector": "WSOrderStateFeedSelectorV1", - "feed": "WSOrderStateFeedDataV1", - "on_subscribe_errors": [ + "request": "EmptyRequest", + "response": "ApiGetAuthorizedBuildersResponse", + "on_request_errors": [ { "code": 1000, "message": "You need to authenticate prior to using this functionality", @@ -2552,24 +2760,162 @@ "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": "RPCBuilderFillHistoryV1", + "version": 1, + "route": "/builder_fill_history", + "auth_required": true, + "request": "ApiBuilderFillHistoryRequest", + "response": "ApiBuilderFillHistoryResponse", + "on_request_errors": [ + { + "code": 1000, + "message": "You need to authenticate prior to using this functionality", + "status": 401 }, { - "code": 1101, - "message": "Feed Format must be in the format of \u003cprimary\u003e@\u003csecondary\u003e", - "status": 400 + "code": 1001, + "message": "You are not authorized to access this functionality", + "status": 403 }, { - "code": 1102, - "message": "Wrong number of primary selectors", - "status": 400 + "code": 1002, + "message": "Internal Server Error", + "status": 500 }, { - "code": 1103, - "message": "Wrong number of secondary selectors", + "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 }, { @@ -2864,409 +3210,424 @@ ], "structs": [ { - "name": "ApiPositionsRequest", - "is_root": true, + "name": "Ack", + "is_root": false, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", + "name": "ack", + "lite_name": "a", + "semantic_type": "bool", + "json_type": "boolean", "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": "string", - "json_type": "string", - "index": 2, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", + "example": "'true'", "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" + "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": "quote", - "lite_name": "q", - "semantic_type": "string", - "json_type": "string", - "index": 3, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['USDT', 'USDC']", + "name": "result", + "lite_name": "r", + "semantic_type": "Ack", + "json_type": "Ack", + "index": 0, + "array_depth": 0, + "optional": false, "comment": [ - "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" + "The Ack Object" ] } ], "comment": [ - "Query the positions of a sub account" + "Used to acknowledge a request has been received and will be processed" ] }, { - "name": "Positions", + "name": "AggregatedAccountSummary", "is_root": false, "fields": [ { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "main_account_id", + "lite_name": "ma", + "semantic_type": "address", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "Time at which the event was emitted in unix nanoseconds" + "The main account ID of the account to which the summary belongs" ] }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "total_equity", + "lite_name": "te", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'3945034.23'", "comment": [ - "The sub account ID that participated in the trade" + "Total equity of the main (+ sub) account, denominated in USD" ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", + "name": "spot_balances", + "lite_name": "sb", + "semantic_type": "SpotBalance", + "json_type": "SpotBalance", "index": 2, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'BTC_USDT_Perp'", "comment": [ - "The instrument being represented" + "The list of spot assets owned by this main (+ sub) account, and their balances" ] }, { - "name": "size", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", + "name": "vault_investments", + "lite_name": "vi", + "semantic_type": "VaultInvestment", + "json_type": "VaultInvestment", "index": 3, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'2635000.50'", "comment": [ - "The size of the position, expressed in base asset decimal units. Negative for short positions" + "The list of vault investments held by this main account" ] }, { - "name": "notional", - "lite_name": "n", + "name": "total_sub_account_balance", + "lite_name": "ts", "semantic_type": "string", "json_type": "string", "index": 4, "array_depth": 0, "optional": false, - "example": "'2635000.50'", + "example": "'3945034.23'", "comment": [ - "The notional value of the position, negative for short assets, expressed in quote asset decimal units" + "Deprecated: Use totalSubAccountEquity instead" ] }, { - "name": "entry_price", - "lite_name": "ep", + "name": "total_sub_account_equity", + "lite_name": "ts1", "semantic_type": "string", "json_type": "string", "index": 5, "array_depth": 0, "optional": false, - "example": "'65038.01'", + "example": "'3945034.23'", "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)`" + "Total equity of the sub accounts, denominated in USD" ] }, { - "name": "exit_price", - "lite_name": "ep1", + "name": "total_vault_investments_balance", + "lite_name": "tv", "semantic_type": "string", "json_type": "string", "index": 6, "array_depth": 0, "optional": false, - "example": "'65038.01'", + "example": "'3945034.23'", "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)`" + "Total amount of the vault investments, denominated in USD" ] }, { - "name": "mark_price", - "lite_name": "mp", + "name": "total_sub_account_available_balance", + "lite_name": "ts2", "semantic_type": "string", "json_type": "string", "index": 7, "array_depth": 0, "optional": false, - "example": "'65038.01'", + "example": "'3945034.23'", "comment": [ - "The mark price of the position, expressed in `9` decimals" + "Total available balance of the main account, denominated in USD" ] }, { - "name": "unrealized_pnl", - "lite_name": "up", + "name": "total_usd_notional_invested", + "lite_name": "tu", "semantic_type": "string", "json_type": "string", "index": 8, "array_depth": 0, "optional": false, - "example": "'135000.50'", + "example": "'3945034.23'", "comment": [ - "The unrealized PnL of the position, expressed in quote asset decimal units", - "`unrealized_pnl = (mark_price - entry_price) * size`" + "Total entry (initial investment) amount of the open investments, denominated in USD" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiAddIsolatedPositionMarginRequest", + "is_root": true, + "fields": [ { - "name": "realized_pnl", - "lite_name": "rp", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", - "index": 9, + "index": 0, "array_depth": 0, "optional": false, - "example": "'-35000.30'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The realized PnL of the position, expressed in quote asset decimal units", - "`realized_pnl = (exit_price - entry_price) * exit_trade_size`" + "The sub account ID to add isolated margin in or remove margin from" ] }, { - "name": "total_pnl", - "lite_name": "tp", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 10, + "index": 1, "array_depth": 0, "optional": false, - "example": "'100000.20'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The total PnL of the position, expressed in quote asset decimal units", - "`total_pnl = realized_pnl + unrealized_pnl`" + "The instrument to add margin into, or remove margin from" ] }, { - "name": "roi", - "lite_name": "r", + "name": "amount", + "lite_name": "a", "semantic_type": "string", "json_type": "string", - "index": 11, + "index": 2, "array_depth": 0, "optional": false, - "example": "'10.20'", + "example": "'123456.78'", "comment": [ - "The ROI of the position, expressed as a percentage", - "`roi = (total_pnl / (entry_price * abs(size))) * 100^`" + "The amount of margin to add to the position, positive to add, negative to remove, expressed in quote asset decimal units" ] }, { - "name": "quote_index_price", - "lite_name": "qi", - "semantic_type": "string", - "json_type": "string", - "index": 12, + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 3, "array_depth": 0, "optional": false, - "example": "'1.0000102'", "comment": [ - "The index price of the quote currency. (reported in `USD`)" + "The signature of this operation" ] - }, + } + ], + "comment": [ + "The request to add margin to a isolated position" + ] + }, + { + "name": "ApiAddIsolatedPositionMarginResponse", + "is_root": true, + "fields": [ { - "name": "est_liquidation_price", - "lite_name": "el", - "semantic_type": "string", + "name": "success", + "lite_name": "s", + "semantic_type": "bool", + "json_type": "boolean", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "'true'", + "comment": [ + "Whether the margin mode and leverage was set successfully" + ] + } + ], + "comment": [ + "The response to add margin to a isolated position" + ] + }, + { + "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": "ApiAuthorizeBuilderRequest", + "is_root": true, + "fields": [ + { + "name": "main_account_id", + "lite_name": "ma", + "semantic_type": "address", "json_type": "string", - "index": 13, + "index": 0, "array_depth": 0, "optional": false, - "example": "60000.25", + "example": "'$GRVT_MAIN_ACCOUNT_ID'", "comment": [ - "The estimated liquidation price" + "The Main Account ID of the user granting the authorization." ] }, { - "name": "leverage", - "lite_name": "l", - "semantic_type": "string", + "name": "builder_account_id", + "lite_name": "ba", + "semantic_type": "address", "json_type": "string", - "index": 14, + "index": 1, "array_depth": 0, "optional": false, - "example": "'10'", + "example": "'$GRVT_MAIN_ACCOUNT_ID'", "comment": [ - "The current leverage value for this position" + "The Main Account ID of the Builder receiving the authorization." ] }, { - "name": "cumulative_fee", - "lite_name": "cf", + "name": "max_futures_fee_rate", + "lite_name": "mf", "semantic_type": "string", "json_type": "string", - "index": 15, + "index": 2, "array_depth": 0, "optional": false, - "example": "'100000.20'", + "example": "0.001", "comment": [ - "The cumulative fee paid on the position, expressed in quote asset decimal units" + "The maximum fee rate cap for **Futures** trades executed by this builder, expressed as a percentage (e.g., 0.001 means 0.001%). The builder cannot charge fees exceeding this limit." ] }, { - "name": "cumulative_realized_funding_payment", - "lite_name": "cr", + "name": "max_spot_fee_rate", + "lite_name": "ms", "semantic_type": "string", "json_type": "string", - "index": 16, + "index": 3, "array_depth": 0, "optional": false, - "example": "'100000.20'", + "example": "0.0001", "comment": [ - "The cumulative realized funding payment of the position, expressed in quote asset decimal units. Positive if paid, negative if received" + "The maximum fee rate cap for **Spot** trades executed by this builder, expressed as a percentage (e.g., 0.0001 means 0.0001%). The builder cannot charge fees exceeding this limit." ] - } - ], - "comment": [] - }, - { - "name": "ApiPositionsResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "Positions", - "json_type": "Positions", - "index": 0, - "array_depth": 1, + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 4, + "array_depth": 0, "optional": false, "comment": [ - "The positions matching the request filter" + "The cryptographic signature authenticating this request. Must be signed by the private key associated with `mainAccountID`." ] } ], - "comment": [] + "comment": [ + "Authorizes a specific Builder to execute transactions on behalf of the Main Account.", + "", + "This endpoint acts as an **upsert** operation:", + "- **New Authorization**: If the builder is not currently authorized, a new record is created.", + "- **Update Limit**: If the builder is already authorized, this request updates the `maxFuturesFeeRate` and `maxSpotFeeRate` to the new values provided." + ] }, { - "name": "ApiFillHistoryRequest", - "is_root": true, + "name": "ApiAuthorizedBuilder", + "is_root": false, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "builder_account_id", + "lite_name": "ba", + "semantic_type": "address", "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']", + "example": "'$GRVT_MAIN_ACCOUNT_ID'", "comment": [ - "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" + "The main account ID of the builder" ] }, { - "name": "base", - "lite_name": "b", + "name": "max_futures_fee_rate", + "lite_name": "mf", "semantic_type": "string", "json_type": "string", - "index": 2, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "0.001", "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" + "The maximum fee rate for the authorized builder" ] }, { - "name": "quote", - "lite_name": "q", + "name": "max_spot_fee_rate", + "lite_name": "ms", "semantic_type": "string", "json_type": "string", - "index": 3, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['USDT', 'USDC']", + "index": 2, + "array_depth": 0, + "optional": false, + "example": "0.0001", "comment": [ - "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" + "The maximum fee rate for the authorized builder" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiBuilderFillHistoryRequest", + "is_root": true, + "fields": [ { "name": "start_time", "lite_name": "st", - "semantic_type": "int64", + "semantic_type": "timestamp", "json_type": "string", - "index": 4, + "index": 1, "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" + "The start time to query for in unix nanoseconds" ] }, { "name": "end_time", "lite_name": "et", - "semantic_type": "int64", + "semantic_type": "timestamp", "json_type": "string", - "index": 5, + "index": 2, "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" + "The end time to query for in unix nanoseconds" ] }, { @@ -3274,7 +3635,7 @@ "lite_name": "l", "semantic_type": "uint32", "json_type": "integer", - "index": 6, + "index": 3, "array_depth": 0, "optional": true, "default": "500", @@ -3288,326 +3649,361 @@ "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 7, + "index": 4, "array_depth": 0, "optional": true, "default": "''", "example": "''", "comment": [ - "The cursor to indicate when to start the query from" + "The cursor to indicate when to start the next 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.", + "The request to get the historical builder trade of a builder", + "The history is returned in reverse chronological order", "", "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, + "name": "ApiBuilderFillHistoryResponse", + "is_root": true, "fields": [ { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "BuilderFillHistory", + "json_type": "BuilderFillHistory", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'1697788800000000000'", "comment": [ - "Time at which the event was emitted in unix nanoseconds" + "The builder fill history matching the request builder account" ] }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "next", + "lite_name": "n", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "optional": true, + "default": "''", + "example": "'Qw0918='", "comment": [ - "The sub account ID that participated in the trade" + "The cursor to indicate when to start the next query from" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiCancelAllOrdersRequest", + "is_root": true, + "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", - "index": 2, + "index": 0, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The instrument being represented" + "The subaccount ID cancelling all orders" ] }, { - "name": "is_buyer", - "lite_name": "ib", - "semantic_type": "bool", - "json_type": "boolean", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "true", + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", + "index": 1, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['PERPETUAL']", "comment": [ - "The side that the subaccount took on the trade" + "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be cancelled" ] }, { - "name": "is_taker", - "lite_name": "it", - "semantic_type": "bool", - "json_type": "boolean", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "true", + "name": "base", + "lite_name": "b", + "semantic_type": "string", + "json_type": "string", + "index": 2, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['BTC', 'ETH']", "comment": [ - "The role that the subaccount took on the trade" + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be cancelled" ] }, { - "name": "size", - "lite_name": "s", + "name": "quote", + "lite_name": "q", "semantic_type": "string", "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": false, - "example": "'0.30'", + "index": 3, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['USDT', 'USDC']", "comment": [ - "The number of assets being traded, expressed in base asset decimal units" + "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be cancelled" ] - }, + } + ], + "comment": [ + "Cancel all orders on the orderbook for this trading account. This may not match new orders in flight." + ] + }, + { + "name": "ApiCancelOnDisconnectRequest", + "is_root": true, + "fields": [ { - "name": "price", - "lite_name": "p", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", - "index": 6, + "index": 0, "array_depth": 0, "optional": false, - "example": "'65038.01'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The traded price, expressed in `9` decimals" + "The subaccount ID cancelling the orders for" ] }, { - "name": "mark_price", - "lite_name": "mp", - "semantic_type": "string", + "name": "countdown_time", + "lite_name": "ct", + "semantic_type": "uint64", "json_type": "string", - "index": 7, + "index": 1, "array_depth": 0, - "optional": false, - "example": "'65038.01'", + "optional": true, + "default": "1000", + "example": "300", "comment": [ - "The mark price of the instrument at point of trade, expressed in `9` decimals" + "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": "ApiCancelOrderRequest", + "is_root": true, + "fields": [ { - "name": "index_price", - "lite_name": "ip", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", - "index": 8, + "index": 0, "array_depth": 0, "optional": false, - "example": "'65038.01'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The index price of the instrument at point of trade, expressed in `9` decimals" + "The subaccount ID cancelling the order" ] }, { - "name": "interest_rate", - "lite_name": "ir", - "semantic_type": "string", + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", "json_type": "string", - "index": 9, + "index": 1, "array_depth": 0, - "optional": false, - "example": "0.0003", + "optional": true, + "default": "0", + "example": "'0x1028403'", "comment": [ - "The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)" + "Cancel the order with this `order_id`" ] }, { - "name": "forward_price", - "lite_name": "fp", - "semantic_type": "string", + "name": "client_order_id", + "lite_name": "co", + "semantic_type": "uint64", "json_type": "string", - "index": 10, + "index": 2, "array_depth": 0, - "optional": false, - "example": "'65038.01'", + "optional": true, + "default": "0", + "example": "'23042'", "comment": [ - "[Options] The forward price of the option at point of trade, expressed in `9` decimals" + "Cancel the order with this `client_order_id`" ] }, { - "name": "realized_pnl", - "lite_name": "rp", - "semantic_type": "string", + "name": "time_to_live_ms", + "lite_name": "tt", + "semantic_type": "uint64", "json_type": "string", - "index": 11, + "index": 3, "array_depth": 0, - "optional": false, - "example": "'2400.50'", + "optional": true, + "default": "100", + "example": "'500'", "comment": [ - "The realized PnL of the trade, expressed in quote asset decimal units (0 if increasing position size)" + "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": [ + "Cancel an order on the orderbook for this trading account. Either `order_id` or `client_order_id` must be provided." + ] + }, + { + "name": "ApiCandlestickRequest", + "is_root": true, + "fields": [ { - "name": "fee", - "lite_name": "f", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 12, + "index": 0, "array_depth": 0, "optional": false, - "example": "'9.75'", + "example": "'BTC_USDT_Perp'", "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`." + "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": "order_id", - "lite_name": "oi", - "semantic_type": "uint128", - "json_type": "string", - "index": 15, + "name": "interval", + "lite_name": "i1", + "semantic_type": "CandlestickInterval", + "json_type": "CandlestickInterval", + "index": 1, "array_depth": 0, "optional": false, - "example": "'0x10000101000203040506'", "comment": [ - "An order identifier" + "The interval of each candlestick" ] }, { - "name": "venue", - "lite_name": "v", - "semantic_type": "Venue", - "json_type": "Venue", - "index": 16, + "name": "type", + "lite_name": "t", + "semantic_type": "CandlestickType", + "json_type": "CandlestickType", + "index": 2, "array_depth": 0, "optional": false, - "example": "'ORDERBOOK'", "comment": [ - "The venue where the trade occurred" + "The type of candlestick data to retrieve" ] }, { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", + "name": "start_time", + "lite_name": "st", + "semantic_type": "timestamp", "json_type": "string", - "index": 18, + "index": 3, "array_depth": 0, - "optional": false, - "example": "'23042'", + "optional": true, + "default": "0", + "example": "'1697788800000000000'", "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" + "Start time of kline data in unix nanoseconds" ] }, { - "name": "signer", - "lite_name": "s1", - "semantic_type": "uint256", + "name": "end_time", + "lite_name": "et", + "semantic_type": "timestamp", "json_type": "string", - "index": 20, + "index": 4, "array_depth": 0, - "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "optional": true, + "default": "now()", + "example": "'1697788800000000000'", "comment": [ - "The address (public key) of the wallet signing the payload" + "End time of kline data in unix nanoseconds" ] }, { - "name": "broker", - "lite_name": "b", - "semantic_type": "BrokerTag", - "json_type": "BrokerTag", - "index": 21, + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", + "index": 5, "array_depth": 0, "optional": true, - "default": "", + "default": "500", + "example": "500", "comment": [ - "Specifies the broker who brokered the order" + "The limit to query for. Defaults to 500; Max 1000" ] }, { - "name": "is_rpi", - "lite_name": "ir1", - "semantic_type": "bool", - "json_type": "boolean", - "index": 22, + "name": "cursor", + "lite_name": "c", + "semantic_type": "string", + "json_type": "string", + "index": 6, "array_depth": 0, - "optional": false, - "example": "false", + "optional": true, + "default": "''", + "example": "''", "comment": [ - "If the trade is a RPI trade" + "The cursor to indicate when to start the query from" ] } ], - "comment": [] + "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": "ApiFillHistoryResponse", + "name": "ApiCandlestickResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "Fill", - "json_type": "Fill", + "semantic_type": "Candlestick", + "json_type": "Candlestick", "index": 0, "array_depth": 1, "optional": false, "comment": [ - "The private trades matching the request asset" + "The candlestick result set for given interval" ] }, { @@ -3617,72 +4013,99 @@ "json_type": "string", "index": 1, "array_depth": 0, - "optional": false, + "optional": true, + "default": "''", "example": "'Qw0918='", "comment": [ - "The cursor to indicate when to start the query from" + "The cursor to indicate when to start the next query from" ] } ], "comment": [] }, { - "name": "ApiFundingPaymentHistoryRequest", + "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 sub account ID to request for" + "The order to create" ] - }, + } + ], + "comment": [ + "Create an order on the orderbook for this trading account." + ] + }, + { + "name": "ApiCreateOrderResponse", + "is_root": true, + "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 1, + "name": "result", + "lite_name": "r", + "semantic_type": "Order", + "json_type": "Order", + "index": 0, "array_depth": 0, - "optional": true, - "default": "all", - "example": "'BTC_USDT_Perp'", + "optional": false, "comment": [ - "The perpetual instrument to filter for" + "The created order" + ] + } + ], + "comment": [] + }, + { + "name": "ApiDepositHistoryRequest", + "is_root": true, + "fields": [ + { + "name": "currency", + "lite_name": "c", + "semantic_type": "string", + "json_type": "string", + "index": 0, + "array_depth": 1, + "optional": false, + "example": "['USDT', 'USDC']", + "comment": [ + "The token currency to query for, if nil or empty, return all deposits. Otherwise, only entries matching the filter will be returned" ] }, { "name": "start_time", "lite_name": "st", - "semantic_type": "int64", + "semantic_type": "timestamp", "json_type": "string", - "index": 2, + "index": 1, "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" + "The start time to query for in unix nanoseconds" ] }, { "name": "end_time", "lite_name": "et", - "semantic_type": "int64", + "semantic_type": "timestamp", "json_type": "string", - "index": 3, + "index": 2, "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" + "The end time to query for in unix nanoseconds" ] }, { @@ -3690,7 +4113,7 @@ "lite_name": "l", "semantic_type": "uint32", "json_type": "integer", - "index": 4, + "index": 3, "array_depth": 0, "optional": true, "default": "500", @@ -3701,126 +4124,209 @@ }, { "name": "cursor", - "lite_name": "c", + "lite_name": "c1", "semantic_type": "string", "json_type": "string", - "index": 5, + "index": 4, "array_depth": 0, "optional": true, "default": "''", "example": "''", "comment": [ - "The cursor to indicate when to start the query from" + "The cursor to indicate when to start the next query from" + ] + }, + { + "name": "main_account_id", + "lite_name": "ma", + "semantic_type": "address", + "json_type": "string", + "index": 5, + "array_depth": 0, + "optional": true, + "default": "", + "example": "", + "comment": [ + "Main account ID being queried. By default, applies the requestor's main account ID." ] } ], "comment": [ - "Query for all historical funding payments made by a single account.", + "The request to get the historical deposits of an account", + "The history is returned in reverse chronological order", "", "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, + "name": "ApiDepositHistoryResponse", + "is_root": true, "fields": [ { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "DepositHistory", + "json_type": "DepositHistory", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'1697788800000000000'", "comment": [ - "Time at which the event was emitted in unix nanoseconds" + "The deposit history matching the request account" ] }, + { + "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": "ApiFillHistoryRequest", + "is_root": true, + "fields": [ { "name": "sub_account_id", "lite_name": "sa", "semantic_type": "uint64", "json_type": "string", - "index": 1, + "index": 0, "array_depth": 0, "optional": false, "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The sub account ID that made the funding payment" + "The sub account ID to request for" ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "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": "string", "json_type": "string", "index": 2, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['BTC', 'ETH']", "comment": [ - "The perpetual instrument being funded" + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "currency", - "lite_name": "c", + "name": "quote", + "lite_name": "q", "semantic_type": "string", "json_type": "string", "index": 3, - "array_depth": 0, - "optional": false, - "example": "'USDT'", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['USDT', 'USDC']", "comment": [ - "The currency of the funding payment" + "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "amount", - "lite_name": "a", - "semantic_type": "string", + "name": "start_time", + "lite_name": "st", + "semantic_type": "int64", "json_type": "string", "index": 4, "array_depth": 0, - "optional": false, - "example": "'9.75'", + "optional": true, + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "The amount of the funding payment. Positive if paid, negative if received" + "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": "tx_id", - "lite_name": "ti", - "semantic_type": "uint64", + "name": "end_time", + "lite_name": "et", + "semantic_type": "int64", "json_type": "string", "index": 5, "array_depth": 0, - "optional": false, - "example": "'209358'", + "optional": true, + "default": "now()", + "example": "'1697788800000000000'", "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`." + "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": [] + "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": "ApiFundingPaymentHistoryResponse", + "name": "ApiFillHistoryResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "FundingPayment", - "json_type": "FundingPayment", + "semantic_type": "Fill", + "json_type": "Fill", "index": 0, "array_depth": 1, "optional": false, "comment": [ - "The funding payments matching the request asset" + "The private trades matching the request asset" ] }, { @@ -3840,360 +4346,312 @@ "comment": [] }, { - "name": "ApiSubAccountSummaryRequest", + "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 to filter by" + "The funding account summary" + ] + }, + { + "name": "tier", + "lite_name": "t", + "semantic_type": "ClientTier", + "json_type": "ClientTier", + "index": 1, + "array_depth": 0, + "optional": false, + "comment": [ + "Client fee tier at the time of query" ] } ], - "comment": [] + "comment": [ + "The funding account summary, that reports the total equity and spot balances of a funding (main) account" + ] }, { - "name": "SpotBalance", - "is_root": false, + "name": "ApiFundingPaymentHistoryRequest", + "is_root": true, "fields": [ { - "name": "currency", - "lite_name": "c", - "semantic_type": "string", + "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 currency you hold a spot balance in" + "The sub account ID to request for" ] }, { - "name": "balance", - "lite_name": "b", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 1, "array_depth": 0, - "optional": false, - "example": "'123456.78'", + "optional": true, + "default": "all", + "example": "'BTC_USDT_Perp'", "comment": [ - "This currency's balance in this trading account." + "The perpetual instrument to filter for" ] }, { - "name": "index_price", - "lite_name": "ip", - "semantic_type": "string", + "name": "start_time", + "lite_name": "st", + "semantic_type": "int64", "json_type": "string", "index": 2, "array_depth": 0, - "optional": false, - "example": "'1.0000102'", + "optional": true, + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "The index price of this currency. (reported in `USD`)" + "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" ] - } - ], - "comment": [] - }, - { - "name": "SubAccount", - "is_root": false, - "fields": [ + }, { - "name": "event_time", + "name": "end_time", "lite_name": "et", - "semantic_type": "timestamp", + "semantic_type": "int64", "json_type": "string", - "index": 0, + "index": 3, "array_depth": 0, - "optional": false, + "optional": true, + "default": "now()", "example": "'1697788800000000000'", "comment": [ - "Time at which the event was emitted in unix nanoseconds" + "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": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 1, + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", + "index": 4, "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "optional": true, + "default": "500", + "example": "500", "comment": [ - "The sub account ID this entry refers to" + "The limit to query for. Defaults to 500; Max 1000" ] }, { - "name": "margin_type", - "lite_name": "mt", - "semantic_type": "MarginType", - "json_type": "MarginType", - "index": 2, + "name": "cursor", + "lite_name": "c", + "semantic_type": "string", + "json_type": "string", + "index": 5, "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": "string", - "json_type": "string", - "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'", + "optional": true, + "default": "''", + "example": "''", "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`" + "The cursor to indicate when to start the query from" ] }, { - "name": "initial_margin", - "lite_name": "im", - "semantic_type": "string", - "json_type": "string", + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", "index": 6, - "array_depth": 0, - "optional": false, - "example": "'123456.78'", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['PERPETUAL']", "comment": [ - "The `total_equity` required to open positions in the account (reported in `settle_currency`).", - "Computation is different depending on account's `margin_type`" + "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "maintenance_margin", - "lite_name": "mm", + "name": "base", + "lite_name": "b", "semantic_type": "string", "json_type": "string", "index": 7, - "array_depth": 0, - "optional": false, - "example": "'123456.78'", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['BTC', 'ETH']", "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`" + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "available_balance", - "lite_name": "ab", + "name": "quote", + "lite_name": "q", "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, + "optional": true, + "default": "all", + "example": "['USDT', 'USDC']", "comment": [ - "The list of spot assets owned by this sub account, and their balances" + "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" ] - }, + } + ], + "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": "ApiFundingPaymentHistoryResponse", + "is_root": true, + "fields": [ { - "name": "positions", - "lite_name": "p", - "semantic_type": "Positions", - "json_type": "Positions", - "index": 10, + "name": "result", + "lite_name": "r", + "semantic_type": "FundingPayment", + "json_type": "FundingPayment", + "index": 0, "array_depth": 1, "optional": false, "comment": [ - "The list of positions owned by this sub account" + "The funding payments matching the request asset" ] }, { - "name": "settle_index_price", - "lite_name": "si", + "name": "next", + "lite_name": "n", "semantic_type": "string", "json_type": "string", - "index": 11, + "index": 1, "array_depth": 0, "optional": false, - "example": "'1.0000102'", + "example": "'Qw0918='", "comment": [ - "The index price of the settle currency. (reported in `USD`)" + "The cursor to indicate when to start the query from" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiFundingRate", + "is_root": false, + "fields": [ { - "name": "is_vault", - "lite_name": "iv", - "semantic_type": "bool", - "json_type": "boolean", - "index": 12, + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", + "index": 0, "array_depth": 0, - "optional": true, + "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "Whether this sub account is a vault" + "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": "vault_im_additions", - "lite_name": "vi", + "name": "funding_rate", + "lite_name": "fr", "semantic_type": "string", "json_type": "string", - "index": 13, + "index": 1, "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "optional": false, + "example": "0.0003", "comment": [ - "Total amount of IM (reported in `settle_currency`) deducted from the vault due to redemptions nearing the end of their redemption period" + "The funding rate of the instrument, expressed in percentage points" ] }, { - "name": "derisk_margin", - "lite_name": "dm", - "semantic_type": "string", + "name": "funding_time", + "lite_name": "ft", + "semantic_type": "timestamp", "json_type": "string", - "index": 14, + "index": 2, "array_depth": 0, "optional": false, - "example": "'185185.77'", + "example": "'1697788800000000000'", "comment": [ - "The derisk margin of this sub account" + "The funding timestamp of the funding rate, expressed in unix nanoseconds" ] }, { - "name": "derisk_to_maintenance_margin_ratio", - "lite_name": "dt", + "name": "mark_price", + "lite_name": "mp", "semantic_type": "string", "json_type": "string", - "index": 15, + "index": 3, "array_depth": 0, "optional": false, - "example": "'1.5'", + "example": "'65038.01'", "comment": [ - "The derisk margin to maintenance margin ratio of this sub account" + "The mark price of the instrument at funding timestamp, expressed in `9` decimals" ] }, { - "name": "total_cross_equity", - "lite_name": "tc", + "name": "funding_rate_8_h_avg", + "lite_name": "fr1", "semantic_type": "string", "json_type": "string", - "index": 16, + "index": 4, "array_depth": 0, "optional": false, - "example": "'123456.78'", + "example": "0.0003", "comment": [ - "The total equity of this sub account for cross margin" + "Deprecated: Refer to `funding_rate` instead. Will be removed in a future release." ] }, { - "name": "cross_unrealized_pnl", - "lite_name": "cu", - "semantic_type": "string", - "json_type": "string", - "index": 17, + "name": "funding_interval_hours", + "lite_name": "fi", + "semantic_type": "uint8", + "json_type": "integer", + "index": 5, "array_depth": 0, "optional": false, - "example": "'123456.78'", + "example": "8", "comment": [ - "The unrealized PnL of this sub account for cross margin" + "Funding interval in hours (e.g. 1/4/8/etc)." ] } ], "comment": [] }, { - "name": "ApiSubAccountSummaryResponse", + "name": "ApiFundingRateRequest", "is_root": true, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "SubAccount", - "json_type": "SubAccount", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The sub account matching the request sub account" + "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": [ - "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", + "name": "start_time", + "lite_name": "st", + "semantic_type": "timestamp", "json_type": "string", "index": 1, "array_depth": 0, @@ -4201,7 +4659,7 @@ "default": "0", "example": "'1697788800000000000'", "comment": [ - "Start time of sub account history in unix nanoseconds" + "Start time of funding rate in unix nanoseconds" ] }, { @@ -4215,7 +4673,7 @@ "default": "now()", "example": "'1697788800000000000'", "comment": [ - "End time of sub account history in unix nanoseconds" + "End time of funding rate in unix nanoseconds" ] }, { @@ -4243,33 +4701,44 @@ "default": "''", "example": "''", "comment": [ - "The cursor to indicate when to start the next query from" + "The cursor to indicate when to start the query from" + ] + }, + { + "name": "agg_type", + "lite_name": "at", + "semantic_type": "FundingRateAggregationType", + "json_type": "FundingRateAggregationType", + "index": 5, + "array_depth": 0, + "optional": true, + "default": "'FUNDING_INTERVAL'", + "example": "'FUNDING_INTERVAL'", + "comment": [ + "Aggregation method for historical funding rate observations. Defaults to using the instrument-specific funding interval." ] } ], "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", + "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": "ApiSubAccountHistoryResponse", + "name": "ApiFundingRateResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "SubAccount", - "json_type": "SubAccount", + "semantic_type": "ApiFundingRate", + "json_type": "ApiFundingRate", "index": 0, "array_depth": 1, "optional": false, "comment": [ - "The sub account history matching the request sub account" + "The funding rate result set for given interval" ] }, { @@ -4279,7 +4748,8 @@ "json_type": "string", "index": 1, "array_depth": 0, - "optional": false, + "optional": true, + "default": "''", "example": "'Qw0918='", "comment": [ "The cursor to indicate when to start the next query from" @@ -4289,453 +4759,387 @@ "comment": [] }, { - "name": "VaultInvestment", - "is_root": false, + "name": "ApiGetAllInitialLeverageRequest", + "is_root": true, "fields": [ { - "name": "vault_id", - "lite_name": "vi", + "name": "sub_account_id", + "lite_name": "sa", "semantic_type": "uint64", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "123456789", - "comment": [ - "The trading account ID of the vault invested in." - ] - }, - { - "name": "num_lp_tokens", - "lite_name": "nl", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "1000000", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The number of shares held by the investor." + "The sub account ID to get the leverage for" ] - }, + } + ], + "comment": [ + "The request to get the initial leverage of a sub account" + ] + }, + { + "name": "ApiGetAllInitialLeverageResponse", + "is_root": true, + "fields": [ { - "name": "share_price", - "lite_name": "sp", - "semantic_type": "string", - "json_type": "string", - "index": 2, - "array_depth": 0, + "name": "results", + "lite_name": "r", + "semantic_type": "InitialLeverageResult", + "json_type": "InitialLeverageResult", + "index": 0, + "array_depth": 1, "optional": false, - "example": "1000000", "comment": [ - "The current share price (in USD) of this vault investment." + "The initial leverage of the sub account" ] - }, + } + ], + "comment": [ + "The response to get the initial leverage of a sub account" + ] + }, + { + "name": "ApiGetAllInstrumentsRequest", + "is_root": true, + "fields": [ { - "name": "usd_notional_invested", - "lite_name": "un", - "semantic_type": "string", - "json_type": "string", - "index": 3, + "name": "is_active", + "lite_name": "ia", + "semantic_type": "bool", + "json_type": "boolean", + "index": 0, "array_depth": 0, - "optional": false, - "example": "1000000", + "optional": true, + "default": "false", + "example": "true", "comment": [ - "The USD notional invested in this vault investment." + "Fetch only active instruments" ] } ], "comment": [ - "Summarizes a vault investment held by a funding account" + "Fetch all instruments" ] }, { - "name": "AggregatedAccountSummary", - "is_root": false, + "name": "ApiGetAllInstrumentsResponse", + "is_root": true, "fields": [ { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "InstrumentDisplay", + "json_type": "InstrumentDisplay", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "The main account ID of the account to which the summary belongs" + "List of instruments" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiGetAuthorizedBuildersResponse", + "is_root": true, + "fields": [ { - "name": "total_equity", - "lite_name": "te", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, + "name": "results", + "lite_name": "r", + "semantic_type": "ApiAuthorizedBuilder", + "json_type": "ApiAuthorizedBuilder", + "index": 0, + "array_depth": 1, "optional": false, - "example": "'3945034.23'", "comment": [ - "Total equity of the main (+ sub) account, denominated in USD" + "The list of authorized builders" ] - }, + } + ], + "comment": [ + "Returns list of authorized builders and the associated fee" + ] + }, + { + "name": "ApiGetCurrencyRequest", + "is_root": true, + "fields": [], + "comment": [ + "Fetch all currencies" + ] + }, + { + "name": "ApiGetCurrencyResponse", + "is_root": true, + "fields": [ { - "name": "spot_balances", - "lite_name": "sb", - "semantic_type": "SpotBalance", - "json_type": "SpotBalance", - "index": 2, + "name": "result", + "lite_name": "r", + "semantic_type": "CurrencyDetail", + "json_type": "CurrencyDetail", + "index": 0, "array_depth": 1, "optional": false, "comment": [ - "The list of spot assets owned by this main (+ sub) account, and their balances" + "The list of currencies" ] - }, + } + ], + "comment": [ + "The list of currencies" + ] + }, + { + "name": "ApiGetFilteredInstrumentsRequest", + "is_root": true, + "fields": [ { - "name": "vault_investments", - "lite_name": "vi", - "semantic_type": "VaultInvestment", - "json_type": "VaultInvestment", - "index": 3, + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", + "index": 0, "array_depth": 1, - "optional": false, + "optional": true, + "default": "all", + "example": "['PERPETUAL']", "comment": [ - "The list of vault investments held by this main account" + "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "total_sub_account_balance", - "lite_name": "ts", + "name": "base", + "lite_name": "b", "semantic_type": "string", "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'3945034.23'", + "index": 1, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['BTC', 'ETH']", "comment": [ - "Deprecated: Use totalSubAccountEquity instead" + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "total_sub_account_equity", - "lite_name": "ts1", + "name": "quote", + "lite_name": "q", "semantic_type": "string", "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": false, - "example": "'3945034.23'", + "index": 2, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['USDT', 'USDC']", "comment": [ - "Total equity of the sub accounts, denominated in USD" + "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "total_vault_investments_balance", - "lite_name": "tv", - "semantic_type": "string", - "json_type": "string", - "index": 6, - "array_depth": 0, - "optional": false, - "example": "'3945034.23'", - "comment": [ - "Total amount of the vault investments, denominated in USD" - ] - }, - { - "name": "total_sub_account_available_balance", - "lite_name": "ts2", - "semantic_type": "string", - "json_type": "string", - "index": 7, + "name": "is_active", + "lite_name": "ia", + "semantic_type": "bool", + "json_type": "boolean", + "index": 3, "array_depth": 0, - "optional": false, - "example": "'3945034.23'", + "optional": true, + "default": "false", + "example": "true", "comment": [ - "Total available balance of the main account, denominated in USD" + "Request for active instruments only" ] }, { - "name": "total_usd_notional_invested", - "lite_name": "tu", - "semantic_type": "string", - "json_type": "string", - "index": 8, + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", + "index": 4, "array_depth": 0, - "optional": false, - "example": "'3945034.23'", + "optional": true, + "default": "500", + "example": "500", "comment": [ - "Total entry (initial investment) amount of the open investments, denominated in USD" + "The limit to query for. Defaults to 500; Max 100000" ] } ], - "comment": [] + "comment": [ + "Fetch a list of instruments based on the filters provided" + ] }, { - "name": "ApiAggregatedAccountSummaryResponse", + "name": "ApiGetFilteredInstrumentsResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "AggregatedAccountSummary", - "json_type": "AggregatedAccountSummary", + "semantic_type": "InstrumentDisplay", + "json_type": "InstrumentDisplay", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, "comment": [ - "The aggregated account summary" + "The instruments matching the request filter" ] } ], - "comment": [ - "The aggregated account summary, that reports the total equity and spot balances of a funding (main) account, and its constituent trading (sub) accounts" - ] + "comment": [] }, { - "name": "FundingAccountSummary", - "is_root": false, + "name": "ApiGetInstrumentRequest", + "is_root": true, "fields": [ { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "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" - ] - }, - { - "name": "vault_investments", - "lite_name": "vi", - "semantic_type": "VaultInvestment", - "json_type": "VaultInvestment", - "index": 3, - "array_depth": 1, - "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The list of vault investments held by this main account" + "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": [ - "The funding account summary, that reports the total equity and spot balances of a funding (main) account" + "Fetch a single instrument by supplying the asset or instrument name" ] }, { - "name": "ClientTier", - "is_root": false, + "name": "ApiGetInstrumentResponse", + "is_root": true, "fields": [ { - "name": "tier", - "lite_name": "t", - "semantic_type": "uint8", - "json_type": "integer", + "name": "result", + "lite_name": "r", + "semantic_type": "InstrumentDisplay", + "json_type": "InstrumentDisplay", "index": 0, "array_depth": 0, "optional": false, - "comment": [] - }, - { - "name": "futures_taker_fee", - "lite_name": "ft", - "semantic_type": "int32", - "json_type": "integer", - "index": 1, - "array_depth": 0, - "optional": false, - "comment": [] - }, - { - "name": "futures_maker_fee", - "lite_name": "fm", - "semantic_type": "int32", - "json_type": "integer", - "index": 2, - "array_depth": 0, - "optional": false, - "comment": [] - }, - { - "name": "options_taker_fee", - "lite_name": "ot", - "semantic_type": "int32", - "json_type": "integer", - "index": 3, - "array_depth": 0, - "optional": false, - "comment": [] - }, - { - "name": "options_maker_fee", - "lite_name": "om", - "semantic_type": "int32", - "json_type": "integer", - "index": 4, - "array_depth": 0, - "optional": false, - "comment": [] + "comment": [ + "The instrument matching the request asset" + ] } ], "comment": [] }, { - "name": "ApiFundingAccountSummaryResponse", + "name": "ApiGetIsolatedPositionMarginLimitsRequest", "is_root": true, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "FundingAccountSummary", - "json_type": "FundingAccountSummary", + "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 funding account summary" + "The sub account ID to get the margin limits for" ] }, { - "name": "tier", - "lite_name": "t", - "semantic_type": "ClientTier", - "json_type": "ClientTier", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "Client fee tier at the time of query" + "The isolated position asset to get the margin limits for" ] } ], "comment": [ - "The funding account summary, that reports the total equity and spot balances of a funding (main) account" + "The request to get the max addable and removable amount for an isolated position" ] }, { - "name": "ApiSetInitialLeverageRequest", + "name": "ApiGetIsolatedPositionMarginLimitsResponse", "is_root": true, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The sub account ID to set the leverage for" + "The isolated position asset" ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "max_addable_amount", + "lite_name": "ma", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'123456.78'", "comment": [ - "The instrument to set the leverage for" + "The max addable amount that can be added to the isolated position, expressed in quote asset decimal units" ] }, { - "name": "leverage", - "lite_name": "l", + "name": "max_removable_amount", + "lite_name": "mr", "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'", + "example": "'123456.78'", "comment": [ - "Whether the leverage was set successfully" + "The max removable amount that can be removed from the isolated position, expressed in quote asset decimal units" ] } ], "comment": [ - "The response to set the initial leverage of a sub account" + "The response to get the max addable and removable amount for an isolated position request" ] }, { - "name": "ApiGetAllInitialLeverageRequest", + "name": "ApiGetMarginRulesRequest", "is_root": true, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The sub account ID to get the leverage for" + "The instrument to query margin rules for" ] } ], "comment": [ - "The request to get the initial leverage of a sub account" + "API request payload to get margin rules for a particular instrument" ] }, { - "name": "InitialLeverageResult", - "is_root": false, + "name": "ApiGetMarginRulesResponse", + "is_root": true, "fields": [ { "name": "instrument", @@ -4747,176 +5151,151 @@ "optional": false, "example": "'BTC_USDT_Perp'", "comment": [ - "The instrument to get the leverage for" + "The instrument name" ] }, { - "name": "leverage", - "lite_name": "l", + "name": "max_position_size", + "lite_name": "mp", "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'10'", + "example": "'100.0'", "comment": [ - "The initial leverage of the sub account" + "The maximum position size, expressed in base asset decimal units" ] }, { - "name": "min_leverage", - "lite_name": "ml", - "semantic_type": "string", - "json_type": "string", + "name": "risk_brackets", + "lite_name": "rb", + "semantic_type": "RiskBracket", + "json_type": "RiskBracket", "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" + "List of risk brackets defining margin requirements at different notional tiers" ] } ], "comment": [ - "The response to get the initial leverage of a sub account" + "API response payload for margin rules of a particular instrument" ] }, { - "name": "Signature", - "is_root": false, + "name": "ApiGetOrderRequest", + "is_root": true, "fields": [ { - "name": "signer", - "lite_name": "s", - "semantic_type": "uint256", + "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 subaccount ID to filter by" ] }, { - "name": "r", - "lite_name": "r", - "semantic_type": "uint256", + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", "json_type": "string", "index": 1, "array_depth": 0, - "optional": false, - "example": "'0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8'", + "optional": true, + "default": "0", + "example": "'0x1028403'", "comment": [ - "Signature R" + "Filter for `order_id`" ] }, { - "name": "s", - "lite_name": "s1", - "semantic_type": "uint256", + "name": "client_order_id", + "lite_name": "co", + "semantic_type": "uint64", "json_type": "string", "index": 2, "array_depth": 0, - "optional": false, - "example": "'0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d'", + "optional": true, + "default": "0", + "example": "'23042'", "comment": [ - "Signature S" + "Filter for `client_order_id`" ] - }, + } + ], + "comment": [ + "Retrieve the order for the account. Either `order_id` or `client_order_id` must be provided." + ] + }, + { + "name": "ApiGetOrderResponse", + "is_root": true, + "fields": [ { - "name": "v", - "lite_name": "v", - "semantic_type": "uint8", - "json_type": "integer", - "index": 3, + "name": "result", + "lite_name": "r", + "semantic_type": "Order", + "json_type": "Order", + "index": 0, "array_depth": 0, "optional": false, - "example": "'28'", "comment": [ - "Signature V" + "The order object for the requested filter" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiMiniTickerRequest", + "is_root": true, + "fields": [ { - "name": "expiration", - "lite_name": "e", - "semantic_type": "timestamp", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", - "comment": [ - "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, + "index": 0, "array_depth": 0, "optional": false, - "example": "'1234567890'", + "example": "'BTC_USDT_Perp'", "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.", - "Range: 0 to 4,294,967,295 (uint32)" + "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": "ApiMiniTickerResponse", + "is_root": true, + "fields": [ { - "name": "chain_id", - "lite_name": "ci", - "semantic_type": "uint64", - "json_type": "string", - "index": 6, + "name": "result", + "lite_name": "r", + "semantic_type": "MiniTicker", + "json_type": "MiniTicker", + "index": 0, "array_depth": 0, "optional": false, - "example": "'325'", "comment": [ - "Chain ID used in EIP-712 domain. Zero value fallbacks to GRVT Chain ID." + "The mini ticker matching the request asset" ] } ], "comment": [] }, { - "name": "ApiSetDeriskToMaintenanceMarginRatioRequest", + "name": "ApiOpenOrdersRequest", "is_root": true, "fields": [ { @@ -4929,227 +5308,228 @@ "optional": false, "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The sub account ID to set the leverage for" + "The subaccount ID to filter by" ] }, { - "name": "ratio", - "lite_name": "r", - "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": "'1.5'", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['PERPETUAL']", "comment": [ - "The derisk margin to maintenance margin ratio of this sub account" + "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "signature", - "lite_name": "s", - "semantic_type": "Signature", - "json_type": "Signature", + "name": "base", + "lite_name": "b", + "semantic_type": "string", + "json_type": "string", "index": 2, - "array_depth": 0, - "optional": false, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['BTC', 'ETH']", "comment": [ - "The signature of this operation" + "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": "string", + "json_type": "string", + "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": [ - "The request to set the derisk margin to maintenance margin ratio of a sub account" - ] + "comment": [] }, { - "name": "ApiSetDeriskToMaintenanceMarginRatioResponse", + "name": "ApiOpenOrdersResponse", "is_root": true, "fields": [ { - "name": "success", - "lite_name": "s", - "semantic_type": "bool", - "json_type": "boolean", + "name": "result", + "lite_name": "r", + "semantic_type": "Order", + "json_type": "Order", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'true'", "comment": [ - "Whether the derisk margin to maintenance margin ratio was set successfully" + "The Open Orders matching the request filter" ] } ], "comment": [ - "The response to set the derisk margin to maintenance margin ratio of a sub account" + "Retrieves all open orders for the account. This may not match new orders in flight." ] }, { - "name": "ApiGetMarginRulesRequest", + "name": "ApiOrderHistoryRequest", "is_root": true, "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The instrument to query margin rules for" + "The subaccount ID to filter by" ] - } - ], - "comment": [ - "API request payload to get margin rules for a particular instrument" - ] - }, - { - "name": "RiskBracket", - "is_root": false, - "fields": [ + }, { - "name": "tier", - "lite_name": "t", - "semantic_type": "uint32", - "json_type": "integer", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "1", + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", + "index": 1, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['PERPETUAL']", "comment": [ - "1-indexed tier number" + "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "notional_floor", - "lite_name": "nf", + "name": "base", + "lite_name": "b", "semantic_type": "string", "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'0'", + "index": 2, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['BTC', 'ETH']", "comment": [ - "Lower bound of notional value (inclusive) in quote currency" + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "notional_cap", - "lite_name": "nc", + "name": "quote", + "lite_name": "q", "semantic_type": "string", "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'600000'", + "index": 3, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['USDT', 'USDC']", "comment": [ - "Upper bound of notional value (exclusive) in quote currency, empty for last tier" + "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "maintenance_margin_rate", - "lite_name": "mm", - "semantic_type": "string", + "name": "start_time", + "lite_name": "st", + "semantic_type": "int64", "json_type": "string", - "index": 3, + "index": 4, "array_depth": 0, - "optional": false, - "example": "'0.01'", + "optional": true, + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "Maintenance margin rate as a decimal (e.g., '0.01' for 1%)" + "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": "initial_margin_rate", - "lite_name": "im", - "semantic_type": "string", + "name": "end_time", + "lite_name": "et", + "semantic_type": "int64", "json_type": "string", - "index": 4, + "index": 5, "array_depth": 0, - "optional": false, - "example": "'0.02'", + "optional": true, + "default": "now()", + "example": "'1697788800000000000'", "comment": [ - "Initial margin rate as a decimal (e.g., '0.02' for 2%)" + "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": "max_leverage", - "lite_name": "ml", + "name": "limit", + "lite_name": "l", "semantic_type": "uint32", "json_type": "integer", - "index": 5, + "index": 6, "array_depth": 0, - "optional": false, - "example": "50", + "optional": true, + "default": "500", + "example": "500", "comment": [ - "Maximum leverage allowed at this tier (floor of 1 / initial_margin_rate)" + "The limit to query for. Defaults to 500; Max 1000" ] }, { - "name": "cumulative_maintenance_amount", - "lite_name": "cm", + "name": "cursor", + "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 6, + "index": 7, "array_depth": 0, - "optional": false, - "example": "'0'", + "optional": true, + "default": "''", + "example": "''", "comment": [ - "Cumulative maintenance margin amount in quote currency" + "The cursor to indicate when to start the query from" ] } ], - "comment": [] + "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": "ApiGetMarginRulesResponse", + "name": "ApiOrderHistoryResponse", "is_root": true, "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "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": "'BTC_USDT_Perp'", "comment": [ - "The instrument name" + "The Open Orders matching the request filter" ] }, { - "name": "max_position_size", - "lite_name": "mp", + "name": "next", + "lite_name": "n", "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'100.0'", - "comment": [ - "The maximum position size, expressed in base asset decimal units" - ] - }, - { - "name": "risk_brackets", - "lite_name": "rb", - "semantic_type": "RiskBracket", - "json_type": "RiskBracket", - "index": 2, - "array_depth": 1, - "optional": false, + "example": "'Qw0918='", "comment": [ - "List of risk brackets defining margin requirements at different notional tiers" + "The cursor to indicate when to start the query from" ] } ], - "comment": [ - "API response payload for margin rules of a particular instrument" - ] + "comment": [] }, { "name": "ApiOrderbookLevelsRequest", @@ -5187,355 +5567,347 @@ ] }, { - "name": "OrderbookLevel", - "is_root": false, + "name": "ApiOrderbookLevelsResponse", + "is_root": true, "fields": [ { - "name": "price", - "lite_name": "p", - "semantic_type": "string", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "OrderbookLevels", + "json_type": "OrderbookLevels", "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" + "The orderbook levels objects matching the request asset" ] } ], "comment": [] }, { - "name": "OrderbookLevels", - "is_root": false, + "name": "ApiPositionsRequest", + "is_root": true, "fields": [ { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "Time at which the event was emitted in unix nanoseconds" + "The sub account ID to request for" ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "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": [ - "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" + "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "bids", + "name": "base", "lite_name": "b", - "semantic_type": "OrderbookLevel", - "json_type": "OrderbookLevel", + "semantic_type": "string", + "json_type": "string", "index": 2, "array_depth": 1, - "optional": false, + "optional": true, + "default": "all", + "example": "['BTC', 'ETH']", "comment": [ - "The list of best bids up till query depth" + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "asks", - "lite_name": "a", - "semantic_type": "OrderbookLevel", - "json_type": "OrderbookLevel", + "name": "quote", + "lite_name": "q", + "semantic_type": "string", + "json_type": "string", "index": 3, "array_depth": 1, - "optional": false, + "optional": true, + "default": "all", + "example": "['USDT', 'USDC']", "comment": [ - "The list of best asks up till query depth" + "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": "ApiOrderbookLevelsResponse", + "name": "ApiPositionsResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "OrderbookLevels", - "json_type": "OrderbookLevels", + "semantic_type": "Positions", + "json_type": "Positions", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, "comment": [ - "The orderbook levels objects matching the request asset" + "The positions matching the request filter" ] } ], "comment": [] }, { - "name": "ApiMiniTickerRequest", + "name": "ApiQueryVaultManagerInvestorHistoryRequest", "is_root": true, "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "vault_id", + "lite_name": "vi", + "semantic_type": "uint64", "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'", + "example": "'2312134'", "comment": [ - "Time at which the event was emitted in unix nanoseconds" + "The unique identifier of the vault to filter by" ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", + "name": "only_own_investments", + "lite_name": "oo", + "semantic_type": "bool", + "json_type": "boolean", "index": 1, "array_depth": 0, - "optional": true, - "example": "'BTC_USDT_Perp'", + "optional": false, + "example": "true", "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" + "Whether to only return investments made by the manager" ] }, { - "name": "mark_price", - "lite_name": "mp", - "semantic_type": "string", + "name": "start_time", + "lite_name": "st", + "semantic_type": "timestamp", "json_type": "string", "index": 2, "array_depth": 0, "optional": true, - "example": "'65038.01'", + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "The mark price of the instrument, expressed in `9` decimals" + "Optional. Start time in unix nanoseconds" ] }, { - "name": "index_price", - "lite_name": "ip", - "semantic_type": "string", + "name": "end_time", + "lite_name": "et", + "semantic_type": "timestamp", "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'", + "default": "now()", + "example": "'1697788800000000000'", "comment": [ - "The mid price of the instrument, expressed in `9` decimals" + "Optional. End time in unix nanoseconds" ] - }, + } + ], + "comment": [ + "Request for the manager to retrieve the vault investor history for their vault" + ] + }, + { + "name": "ApiQueryVaultManagerInvestorHistoryResponse", + "is_root": true, + "fields": [ { - "name": "best_bid_price", - "lite_name": "bb", - "semantic_type": "string", - "json_type": "string", - "index": 7, - "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "name": "result", + "lite_name": "r", + "semantic_type": "ApiVaultInvestorHistory", + "json_type": "ApiVaultInvestorHistory", + "index": 0, + "array_depth": 1, + "optional": false, "comment": [ - "The best bid price of the instrument, expressed in `9` decimals" + "The list of vault investor history belong to the manager" ] - }, + } + ], + "comment": [ + "Response to retrieve the vault summary for a given vault" + ] + }, + { + "name": "ApiSetDeriskToMaintenanceMarginRatioRequest", + "is_root": true, + "fields": [ { - "name": "best_bid_size", - "lite_name": "bb1", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", - "index": 8, + "index": 0, "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "optional": false, + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units" + "The sub account ID to set the leverage for" ] }, { - "name": "best_ask_price", - "lite_name": "ba", + "name": "ratio", + "lite_name": "r", "semantic_type": "string", "json_type": "string", - "index": 9, + "index": 1, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, + "example": "'1.5'", "comment": [ - "The best ask price of the instrument, expressed in `9` decimals" + "The derisk margin to maintenance margin ratio of this sub account" ] }, { - "name": "best_ask_size", - "lite_name": "ba1", - "semantic_type": "string", - "json_type": "string", - "index": 10, + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 2, "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "optional": false, "comment": [ - "The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units" + "The signature of this operation" ] } ], - "comment": [] + "comment": [ + "The request to set the derisk margin to maintenance margin ratio of a sub account" + ] }, { - "name": "ApiMiniTickerResponse", + "name": "ApiSetDeriskToMaintenanceMarginRatioResponse", "is_root": true, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "MiniTicker", - "json_type": "MiniTicker", + "name": "success", + "lite_name": "s", + "semantic_type": "bool", + "json_type": "boolean", "index": 0, "array_depth": 0, "optional": false, + "example": "'true'", "comment": [ - "The mini ticker matching the request asset" + "Whether the derisk margin to maintenance margin ratio was set successfully" ] } ], - "comment": [] + "comment": [ + "The response to set the derisk margin to maintenance margin ratio of a sub account" + ] }, { - "name": "ApiTickerRequest", + "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": 0, + "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" + "The instrument to set the leverage for" ] - } - ], - "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": "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.", + " DEPRECATED: This API is deprecated, use set_position_config API instead" ] }, { - "name": "Ticker", - "is_root": false, + "name": "ApiSetInitialLeverageResponse", + "is_root": true, "fields": [ { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", + "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.", + " DEPRECATED: This API is deprecated, use set_position_config API instead" + ] + }, + { + "name": "ApiSetSubAccountPositionMarginConfigRequest", + "is_root": true, + "fields": [ + { + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", "index": 0, "array_depth": 0, - "optional": true, - "example": "'1697788800000000000'", + "optional": false, + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "Time at which the event was emitted in unix nanoseconds" + "The sub account ID to set the margin type and leverage for" ] }, { @@ -5545,354 +5917,386 @@ "json_type": "string", "index": 1, "array_depth": 0, - "optional": true, + "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" + "The instrument of the position to set the margin type and leverage for" ] }, { - "name": "mark_price", - "lite_name": "mp", - "semantic_type": "string", - "json_type": "string", + "name": "margin_type", + "lite_name": "mt", + "semantic_type": "PositionMarginType", + "json_type": "PositionMarginType", "index": 2, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, "comment": [ - "The mark price of the instrument, expressed in `9` decimals" + "The margin type to set for the position" ] }, { - "name": "index_price", - "lite_name": "ip", + "name": "leverage", + "lite_name": "l", "semantic_type": "string", "json_type": "string", "index": 3, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, + "example": "'1.5'", "comment": [ - "The index price of the instrument, expressed in `9` decimals" + "The leverage to set for the position" ] }, { - "name": "last_price", - "lite_name": "lp", - "semantic_type": "string", - "json_type": "string", + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", "index": 4, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, "comment": [ - "The last traded price of the instrument (also close price), expressed in `9` decimals" + "The signature of this operation" ] - }, + } + ], + "comment": [ + "Sets the margin type and leverage configuration for a specific position (instrument) within a sub account.", + "", + "This configuration is applied per-instrument, allowing different margin settings for different positions.", + "" + ] + }, + { + "name": "ApiSetSubAccountPositionMarginConfigResponse", + "is_root": true, + "fields": [ { - "name": "last_size", - "lite_name": "ls", - "semantic_type": "string", - "json_type": "string", - "index": 5, + "name": "ack", + "lite_name": "a", + "semantic_type": "bool", + "json_type": "boolean", + "index": 0, "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "optional": false, + "example": "'true'", "comment": [ - "The number of assets traded in the last trade, expressed in base asset decimal units" + "Whether the margin type and leverage was acked" ] - }, + } + ], + "comment": [ + "The response to set the margin type and leverage for a position" + ] + }, + { + "name": "ApiSubAccountHistoryRequest", + "is_root": true, + "fields": [ { - "name": "mid_price", - "lite_name": "mp1", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", - "index": 6, + "index": 0, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The mid price of the instrument, expressed in `9` decimals" + "The sub account ID to request for" ] }, { - "name": "best_bid_price", - "lite_name": "bb", - "semantic_type": "string", + "name": "start_time", + "lite_name": "st", + "semantic_type": "timestamp", "json_type": "string", - "index": 7, + "index": 1, "array_depth": 0, "optional": true, - "example": "'65038.01'", + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "The best bid price of the instrument, expressed in `9` decimals" + "Start time of sub account history in unix nanoseconds" ] }, { - "name": "best_bid_size", - "lite_name": "bb1", - "semantic_type": "string", + "name": "end_time", + "lite_name": "et", + "semantic_type": "timestamp", "json_type": "string", - "index": 8, + "index": 2, "array_depth": 0, "optional": true, - "example": "'123456.78'", + "default": "now()", + "example": "'1697788800000000000'", "comment": [ - "The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units" + "End time of sub account history in unix nanoseconds" ] }, { - "name": "best_ask_price", - "lite_name": "ba", - "semantic_type": "string", - "json_type": "string", - "index": 9, + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", + "index": 3, "array_depth": 0, "optional": true, - "example": "'65038.01'", + "default": "500", + "example": "500", "comment": [ - "The best ask price of the instrument, expressed in `9` decimals" + "The limit to query for. Defaults to 500; Max 1000" ] }, { - "name": "best_ask_size", - "lite_name": "ba1", + "name": "cursor", + "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 10, + "index": 4, "array_depth": 0, "optional": true, - "example": "'123456.78'", + "default": "''", + "example": "''", "comment": [ - "The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units" + "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": "funding_rate_8h_curr", - "lite_name": "fr", - "semantic_type": "string", - "json_type": "string", - "index": 11, - "array_depth": 0, - "optional": true, - "example": "0.0003", + "name": "result", + "lite_name": "r", + "semantic_type": "SubAccount", + "json_type": "SubAccount", + "index": 0, + "array_depth": 1, + "optional": false, "comment": [ - "DEPRECATED: To be removed in a future release. Please refer to the field `funding_rate` instead, for the funding rate being applied over `funding_interval_hours` (interval ending at `next_funding_time`)." + "The sub account history matching the request sub account" ] }, { - "name": "funding_rate_8h_avg", - "lite_name": "fr1", + "name": "next", + "lite_name": "n", "semantic_type": "string", "json_type": "string", - "index": 12, + "index": 1, "array_depth": 0, - "optional": true, - "example": "0.0003", + "optional": false, + "example": "'Qw0918='", "comment": [ - "DEPRECATED: To be removed in a future release. Please refer to the field `funding_rate` instead, for the funding rate being applied over `funding_interval_hours` (interval ending at `next_funding_time`)." + "The cursor to indicate when to start the next query from" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiSubAccountSummaryRequest", + "is_root": true, + "fields": [ { - "name": "interest_rate", - "lite_name": "ir", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", - "index": 13, + "index": 0, "array_depth": 0, - "optional": true, - "example": "0.0003", + "optional": false, + "example": "'$GRVT_SUB_ACCOUNT_ID'", "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" + "The subaccount ID to filter by" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiSubAccountSummaryResponse", + "is_root": true, + "fields": [ { - "name": "buy_volume_24h_q", - "lite_name": "bv1", - "semantic_type": "string", - "json_type": "string", - "index": 17, + "name": "result", + "lite_name": "r", + "semantic_type": "SubAccount", + "json_type": "SubAccount", + "index": 0, "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "optional": false, "comment": [ - "The 24 hour taker buy volume of the instrument, expressed in quote asset decimal units" + "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": "ApiTickerRequest", + "is_root": true, + "fields": [ { - "name": "sell_volume_24h_q", - "lite_name": "sv1", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 18, + "index": 0, "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The 24 hour taker sell volume of the instrument, expressed in quote asset decimal units" + "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": "ApiTickerResponse", + "is_root": true, + "fields": [ { - "name": "high_price", - "lite_name": "hp", - "semantic_type": "string", - "json_type": "string", - "index": 19, + "name": "result", + "lite_name": "r", + "semantic_type": "Ticker", + "json_type": "Ticker", + "index": 0, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, "comment": [ - "The 24 hour highest traded price of the instrument, expressed in `9` decimals" + "The mini ticker matching the request asset" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiTradeHistoryRequest", + "is_root": true, + "fields": [ { - "name": "low_price", - "lite_name": "lp1", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 20, + "index": 0, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The 24 hour lowest traded price of the instrument, expressed in `9` decimals" + "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": "open_price", - "lite_name": "op", - "semantic_type": "string", + "name": "start_time", + "lite_name": "st", + "semantic_type": "int64", "json_type": "string", - "index": 21, + "index": 1, "array_depth": 0, "optional": true, - "example": "'65038.01'", + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "The 24 hour first traded price of the instrument, expressed in `9` decimals" + "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": "open_interest", - "lite_name": "oi", - "semantic_type": "string", + "name": "end_time", + "lite_name": "et", + "semantic_type": "int64", "json_type": "string", - "index": 22, + "index": 2, "array_depth": 0, "optional": true, - "example": "'123456.78'", + "default": "now()", + "example": "'1697788800000000000'", "comment": [ - "The open interest in the instrument, expressed in base asset decimal units" + "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": "long_short_ratio", - "lite_name": "ls1", - "semantic_type": "string", - "json_type": "string", - "index": 23, + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", + "index": 3, "array_depth": 0, "optional": true, - "example": "'0.5'", + "default": "500", + "example": "500", "comment": [ - "The ratio of accounts that are net long vs net short on this instrument" + "The limit to query for. Defaults to 500; Max 1000" ] }, { - "name": "funding_rate", - "lite_name": "fr2", + "name": "cursor", + "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 24, - "array_depth": 0, - "optional": true, - "example": "0.0003", - "comment": [ - "The current indicative funding rate for the active interval, expressed in centibeeps" - ] - }, - { - "name": "next_funding_time", - "lite_name": "nf", - "semantic_type": "timestamp", - "json_type": "string", - "index": 26, + "index": 4, "array_depth": 0, "optional": true, - "example": "'1697788800000000000'", + "default": "''", + "example": "''", "comment": [ - "Timestamp in nanoseconds when the current funding interval ends" + "The cursor to indicate when to start the query from" ] } ], "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`)", + "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.", "", - "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.", - "" + "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": "ApiTickerResponse", + "name": "ApiTradeHistoryResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "Ticker", - "json_type": "Ticker", + "semantic_type": "Trade", + "json_type": "Trade", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, "comment": [ - "The mini ticker matching the request asset" + "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" ] } ], @@ -5935,211 +6339,78 @@ ] }, { - "name": "Trade", - "is_root": false, + "name": "ApiTradeResponse", + "is_root": true, "fields": [ { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "Trade", + "json_type": "Trade", "index": 0, - "array_depth": 0, + "array_depth": 1, "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" + "The public trades matching the request asset" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiTransferAck", + "is_root": false, + "fields": [ { - "name": "is_taker_buyer", - "lite_name": "it", + "name": "ack", + "lite_name": "a", "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, + "index": 0, "array_depth": 0, "optional": false, - "example": "'65038.01'", + "example": "'true'", "comment": [ - "[Options] The forward price of the option at point of trade, expressed in `9` decimals" + "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": "trade_id", + "name": "tx_id", "lite_name": "ti", - "semantic_type": "string", + "semantic_type": "uint64", "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" - ] - }, - { - "name": "is_rpi", - "lite_name": "ir1", - "semantic_type": "bool", - "json_type": "boolean", - "index": 13, + "index": 1, "array_depth": 0, "optional": false, - "example": "false", - "comment": [ - "If the trade is a RPI trade" - ] - } - ], - "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, + "example": "'1028403'", "comment": [ - "The public trades matching the request asset" + "The transaction ID of the transfer. This is only returned if the transfer is successful." ] } ], "comment": [] }, { - "name": "ApiTradeHistoryRequest", + "name": "ApiTransferHistoryRequest", "is_root": true, "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "currency", + "lite_name": "c", + "semantic_type": "string", "json_type": "string", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "['USDT', 'USDC']", "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" + "The token currency to query for, if nil or empty, return all transfers. Otherwise, only entries matching the filter will be returned" ] }, { "name": "start_time", "lite_name": "st", - "semantic_type": "int64", + "semantic_type": "timestamp", "json_type": "string", "index": 1, "array_depth": 0, @@ -6147,13 +6418,13 @@ "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" + "The start time to query for in unix nanoseconds" ] }, { "name": "end_time", "lite_name": "et", - "semantic_type": "int64", + "semantic_type": "timestamp", "json_type": "string", "index": 2, "array_depth": 0, @@ -6161,7 +6432,7 @@ "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" + "The end time to query for in unix nanoseconds" ] }, { @@ -6180,7 +6451,7 @@ }, { "name": "cursor", - "lite_name": "c", + "lite_name": "c1", "semantic_type": "string", "json_type": "string", "index": 4, @@ -6189,32 +6460,72 @@ "default": "''", "example": "''", "comment": [ - "The cursor to indicate when to start the query from" + "The cursor to indicate when to start the next query from" + ] + }, + { + "name": "tx_id", + "lite_name": "ti", + "semantic_type": "uint64", + "json_type": "string", + "index": 5, + "array_depth": 0, + "optional": true, + "default": "0", + "example": "'1028403'", + "comment": [ + "The transaction ID to query for" + ] + }, + { + "name": "main_account_id", + "lite_name": "ma", + "semantic_type": "address", + "json_type": "string", + "index": 6, + "array_depth": 0, + "optional": true, + "default": "", + "example": "", + "comment": [ + "Main account ID being queried. By default, applies the requestor's main account ID." + ] + }, + { + "name": "transfer_types", + "lite_name": "tt", + "semantic_type": "TransferType", + "json_type": "TransferType", + "index": 7, + "array_depth": 1, + "optional": true, + "default": "[]", + "comment": [ + "The transfer type to filters for. If the list is empty, return all transfer types." ] } ], "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.", + "The request to get the historical transfers of an account", + "The history is returned in reverse chronological order", "", "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", + "name": "ApiTransferHistoryResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "Trade", - "json_type": "Trade", + "semantic_type": "TransferHistory", + "json_type": "TransferHistory", "index": 0, "array_depth": 1, "optional": false, "comment": [ - "The public trades matching the request asset" + "The transfer history matching the request account" ] }, { @@ -6235,703 +6546,765 @@ "comment": [] }, { - "name": "ApiGetInstrumentRequest", + "name": "ApiTransferRequest", "is_root": true, "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "from_account_id", + "lite_name": "fa", + "semantic_type": "address", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "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" + "The main account to transfer from" ] - } - ], - "comment": [ - "Fetch a single instrument by supplying the asset or instrument name" - ] - }, - { - "name": "InstrumentDisplay", - "is_root": false, - "fields": [ + }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "from_sub_account_id", + "lite_name": "fs", + "semantic_type": "uint64", "json_type": "string", - "index": 0, + "index": 1, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "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" + "The subaccount to transfer from (0 if transferring from main account)" ] }, { - "name": "instrument_hash", - "lite_name": "ih", - "semantic_type": "uint256", + "name": "to_account_id", + "lite_name": "ta", + "semantic_type": "address", "json_type": "string", - "index": 1, + "index": 2, "array_depth": 0, "optional": false, - "example": "'0x030501'", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "The asset ID used for instrument signing." + "The main account to deposit into" ] }, { - "name": "base", - "lite_name": "b", - "semantic_type": "string", + "name": "to_sub_account_id", + "lite_name": "ts", + "semantic_type": "uint64", "json_type": "string", - "index": 2, + "index": 3, "array_depth": 0, "optional": false, - "example": "'BTC'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The base currency" + "The subaccount to transfer to (0 if transferring to main account)" ] }, { - "name": "quote", - "lite_name": "q", + "name": "currency", + "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 3, + "index": 4, "array_depth": 0, "optional": false, "example": "'USDT'", "comment": [ - "The quote currency" + "The token currency to transfer" ] }, { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", - "index": 4, + "name": "num_tokens", + "lite_name": "nt", + "semantic_type": "string", + "json_type": "string", + "index": 5, "array_depth": 0, "optional": false, - "example": "'PERPETUAL'", + "example": "'1500.0'", "comment": [ - "The kind of instrument" + "The number of tokens to transfer, quoted in tokenCurrency decimal units" ] }, { - "name": "venues", - "lite_name": "v", - "semantic_type": "Venue", - "json_type": "Venue", - "index": 7, - "array_depth": 1, + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 6, + "array_depth": 0, "optional": false, - "example": "['ORDERBOOK']", "comment": [ - "Venues that this instrument can be traded at" + "The signature of the transfer" ] }, { - "name": "settlement_period", - "lite_name": "sp1", - "semantic_type": "InstrumentSettlementPeriod", - "json_type": "InstrumentSettlementPeriod", - "index": 8, + "name": "transfer_type", + "lite_name": "tt", + "semantic_type": "TransferType", + "json_type": "TransferType", + "index": 7, "array_depth": 0, "optional": false, - "example": "'PERPETUAL'", "comment": [ - "The settlement period of the instrument" + "The type of transfer" ] }, { - "name": "base_decimals", - "lite_name": "bd", - "semantic_type": "int8", - "json_type": "integer", - "index": 9, + "name": "transfer_metadata", + "lite_name": "tm", + "semantic_type": "string", + "json_type": "string", + "index": 8, "array_depth": 0, "optional": false, - "example": "3", + "example": "{\"provider\":\"XY\",\"direction\":\"WITHDRAWAL\",\"provider_tx_id\":\"txn123456\",\"chainid\":\"42161\",\"endpoint\":\"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0\"}", "comment": [ - "The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)" + "The metadata of the transfer" ] - }, + } + ], + "comment": [ + "This API allows you to transfer funds in multiple different ways\u003cul\u003e", + "\u003cli\u003eBetween SubAccounts within your Main Account\u003c/li\u003e", + "\u003cli\u003eBetween your MainAccount and your SubAccounts\u003c/li\u003e", + "\u003cli\u003eTo other MainAccounts that you have previously allowlisted\u003c/li\u003e", + "\u003c/ul\u003e\u003cb\u003eFast Withdrawal Funding Address\u003c/b\u003e", + "For fast withdrawals, funds must be sent to the designated funding account address. Please ensure you use the correct address based on the environment:", + "\u003cb\u003eProduction Environment Address:\u003c/b\u003e", + "\u003cem\u003e[To be updated, not ready yet]\u003c/em\u003e", + "This address should be specified as the \u003ccode\u003eto_account_id\u003c/code\u003e in your API requests for transferring funds using the transfer API. Ensure accurate input to avoid loss of funds or use the UI.", + "" + ] + }, + { + "name": "ApiTransferResponse", + "is_root": true, + "fields": [ { - "name": "quote_decimals", - "lite_name": "qd", - "semantic_type": "int8", - "json_type": "integer", - "index": 10, + "name": "result", + "lite_name": "r", + "semantic_type": "ApiTransferAck", + "json_type": "ApiTransferAck", + "index": 0, "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)" + "The Transfer response object" ] - }, + } + ], + "comment": [ + "Used to acknowledge a transfer request outcome" + ] + }, + { + "name": "ApiVaultBurnTokensRequest", + "is_root": true, + "fields": [ { - "name": "tick_size", - "lite_name": "ts", - "semantic_type": "string", + "name": "vault_id", + "lite_name": "vi", + "semantic_type": "uint64", "json_type": "string", - "index": 11, + "index": 1, "array_depth": 0, "optional": false, - "example": "'0.01'", + "example": "'3477045127917224'", "comment": [ - "The size of a single tick, expressed in price decimal units" + "The unique identifier of the vault to burn tokens from." ] }, { - "name": "min_size", - "lite_name": "ms", + "name": "currency", + "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 12, + "index": 2, "array_depth": 0, "optional": false, - "example": "'0.01'", + "example": "'USDT'", "comment": [ - "The minimum contract size, expressed in base asset decimal units" + "The currency used for the burn. This should be the vault's quote currency." ] }, { - "name": "create_time", - "lite_name": "ct", - "semantic_type": "timestamp", + "name": "num_tokens", + "lite_name": "nt", + "semantic_type": "string", "json_type": "string", - "index": 14, + "index": 3, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "1000000", "comment": [ - "Creation time in unix nanoseconds" + "The number of tokens to burn." ] }, { - "name": "max_position_size", - "lite_name": "mp", - "semantic_type": "string", - "json_type": "string", - "index": 15, + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 4, "array_depth": 0, "optional": false, - "example": "'100.0'", "comment": [ - "The maximum position size, expressed in base asset decimal units" + "The digital signature from the investing account.", + "This signature must be generated by the main account ID and is used to verify the authenticity of the request.", + "The signature must comply with AccountPermExternalTransfer permission." ] - }, + } + ], + "comment": [ + "Request payload for burning tokens in a vault.", + "", + "This API allows a client to burn a specified amount of tokens in a particular vault." + ] + }, + { + "name": "ApiVaultInvestRequest", + "is_root": true, + "fields": [ { - "name": "funding_interval_hours", - "lite_name": "fi", - "semantic_type": "uint8", - "json_type": "integer", - "index": 17, + "name": "vault_id", + "lite_name": "vi", + "semantic_type": "uint64", + "json_type": "string", + "index": 1, "array_depth": 0, - "optional": true, + "optional": false, + "example": "'3477045127917224'", "comment": [ - "Defines the funding interval to be applied." + "The unique identifier of the vault to invest in." ] }, { - "name": "adjusted_funding_rate_cap", - "lite_name": "af", + "name": "currency", + "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 18, + "index": 2, "array_depth": 0, - "optional": true, - "example": "2.5", + "optional": false, + "example": "'USDT'", "comment": [ - "Funding rate cap over the defined `intervalHours`." + "The currency used for the investment. This should be the vault's quote currency." ] }, { - "name": "adjusted_funding_rate_floor", - "lite_name": "af1", + "name": "num_tokens", + "lite_name": "nt", "semantic_type": "string", "json_type": "string", - "index": 19, + "index": 3, "array_depth": 0, - "optional": true, - "example": "-2.5", + "optional": false, + "example": "1000000", "comment": [ - "Funding rate floor over the defined `intervalHours`." + "The investment sum, in terms of the token currency specified (i.e., `numTokens` of '1000' with `tokenCurrency` of 'USDT' denotes investment of 1,000 USDT)." ] - } - ], - "comment": [] - }, - { - "name": "ApiGetInstrumentResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "InstrumentDisplay", - "json_type": "InstrumentDisplay", - "index": 0, + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 4, "array_depth": 0, "optional": false, "comment": [ - "The instrument matching the request asset" + "The digital signature from the investing account.", + "This signature must be generated by the main account ID and is used to verify the authenticity of the request.", + "The signature must comply with AccountPermExternalTransfer permission." ] } ], - "comment": [] + "comment": [ + "Request payload for investing in a vault.", + "", + "This API allows a client to invest a specified amount of tokens in a particular vault." + ] }, { - "name": "ApiGetFilteredInstrumentsRequest", - "is_root": true, + "name": "ApiVaultInvestorHistory", + "is_root": false, "fields": [ { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", + "json_type": "string", "index": 0, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['PERPETUAL']", + "array_depth": 0, + "optional": false, + "example": "'1697788800000000000'", "comment": [ - "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" + "Time at which the event was emitted in unix nanoseconds" ] }, { - "name": "base", - "lite_name": "b", + "name": "off_chain_account_id", + "lite_name": "oc", "semantic_type": "string", "json_type": "string", "index": 1, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", + "array_depth": 0, + "optional": false, + "example": "'ACC:123456'", "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" + "The off chain account id of the investor, only visible to the manager" ] }, { - "name": "quote", - "lite_name": "q", - "semantic_type": "string", + "name": "vault_id", + "lite_name": "vi", + "semantic_type": "uint64", "json_type": "string", "index": 2, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['USDT', 'USDC']", + "array_depth": 0, + "optional": false, + "example": "'2312134'", "comment": [ - "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" + "The unique identifier of the vault." ] }, { - "name": "is_active", - "lite_name": "ia", - "semantic_type": "bool", - "json_type": "boolean", + "name": "type", + "lite_name": "t", + "semantic_type": "VaultInvestorAction", + "json_type": "VaultInvestorAction", "index": 3, "array_depth": 0, - "optional": true, - "default": "false", - "example": "true", + "optional": false, + "example": "'VAULT_INVEST'", "comment": [ - "Request for active instruments only" + "The type of transaction that occurred. List of types: vaultInvest, vaultBurnLpToken, vaultRedeem" ] }, { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", + "name": "price", + "lite_name": "p", + "semantic_type": "string", + "json_type": "string", "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": "InstrumentDisplay", - "json_type": "InstrumentDisplay", - "index": 0, - "array_depth": 1, "optional": false, + "example": "'1000000'", "comment": [ - "The instruments matching the request filter" + "The price of the vault LP tokens at the time of the event." ] - } - ], - "comment": [] - }, - { - "name": "ApiGetCurrencyRequest", - "is_root": true, - "fields": [], - "comment": [ - "Fetch all currencies" - ] - }, - { - "name": "CurrencyDetail", - "is_root": false, - "fields": [ + }, { - "name": "id", - "lite_name": "i", - "semantic_type": "uint16", - "json_type": "integer", - "index": 0, + "name": "size", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", + "index": 5, "array_depth": 0, "optional": false, - "example": "3", + "example": "'1000000'", "comment": [ - "The integer value of the currency" + "The amount of Vault LP tokens invested or redeemed." ] }, { - "name": "symbol", - "lite_name": "s", + "name": "realized_pnl", + "lite_name": "rp", "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 6, "array_depth": 0, "optional": false, - "example": "'USDT'", + "example": "'1000000'", "comment": [ - "The name of the currency" + "The realized PnL of the vault." ] }, { - "name": "balance_decimals", - "lite_name": "bd", - "semantic_type": "int8", - "json_type": "integer", - "index": 2, + "name": "performance_fee", + "lite_name": "pf", + "semantic_type": "string", + "json_type": "string", + "index": 7, "array_depth": 0, "optional": false, - "example": "6", + "example": "'1000000'", "comment": [ - "The balance decimals of the currency" + "The performance fee of the vault." ] - }, + } + ], + "comment": [ + "The vault investor history returned by the service to client" + ] + }, + { + "name": "ApiVaultInvestorSummaryRequest", + "is_root": true, + "fields": [ { - "name": "quantity_multiplier", - "lite_name": "qm", + "name": "vault_id", + "lite_name": "vi", "semantic_type": "uint64", "json_type": "string", - "index": 3, + "index": 1, "array_depth": 0, "optional": false, - "example": "1000000", + "example": "'3477045127917224'", "comment": [ - "The quantity multiplier of the currency" + "The unique identifier of the vault to fetch the summary for." ] } ], - "comment": [] + "comment": [ + "Request payload for fetching the summary of a vault investor.", + "", + "This API allows a client to retrieve the summary of investments in a specific vault." + ] }, { - "name": "ApiGetCurrencyResponse", + "name": "ApiVaultInvestorSummaryResponse", "is_root": true, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "CurrencyDetail", - "json_type": "CurrencyDetail", + "name": "vault_investor_summary", + "lite_name": "vi", + "semantic_type": "VaultInvestorSummary", + "json_type": "VaultInvestorSummary", "index": 0, "array_depth": 1, "optional": false, "comment": [ - "The list of currencies" + "The summary of investments in the vault." ] } ], "comment": [ - "The list of currencies" + "Response payload for the summary of a vault investor.", + "", + "This API provides the summary of investments in a specific vault." ] }, { - "name": "ApiCandlestickRequest", + "name": "ApiVaultRedeemCancelRequest", "is_root": true, "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "vault_id", + "lite_name": "vi", + "semantic_type": "uint64", "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, + "example": "'3477045127917224'", "comment": [ - "The interval of each candlestick" + "The unique identifier of the vault to cancel the redemption from." ] - }, + } + ], + "comment": [ + "Request payload for canceling a vault redemption.", + "", + "This API allows a client to cancel a previously initiated redemption from a vault." + ] + }, + { + "name": "ApiVaultRedeemRequest", + "is_root": true, + "fields": [ { - "name": "type", - "lite_name": "t", - "semantic_type": "CandlestickType", - "json_type": "CandlestickType", - "index": 2, + "name": "vault_id", + "lite_name": "vi", + "semantic_type": "uint64", + "json_type": "string", + "index": 1, "array_depth": 0, "optional": false, + "example": "'3477045127917224'", "comment": [ - "The type of candlestick data to retrieve" + "The unique identifier of the vault to redeem from." ] }, { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", + "name": "currency", + "lite_name": "c", + "semantic_type": "string", "json_type": "string", - "index": 3, + "index": 2, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "optional": false, + "example": "'USDT'", "comment": [ - "Start time of kline data in unix nanoseconds" + "The currency used for the redemption. This should be the vault's quote currency." ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "num_tokens", + "lite_name": "nt", + "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 3, "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", + "optional": false, + "example": "1000000", "comment": [ - "End time of kline data in unix nanoseconds" + "The number of shares to redeem." ] }, { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 5, + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 4, "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", + "optional": false, "comment": [ - "The limit to query for. Defaults to 500; Max 1000" + "The digital signature from the investing account.", + "This signature must be generated by the main account ID and is used to verify the authenticity of the request.", + "The signature must comply with AccountPermExternalTransfer permission." ] - }, + } + ], + "comment": [ + "Request payload for redeeming from a vault.", + "", + "This API allows a client to redeem a specified amount of tokens from a particular vault." + ] + }, + { + "name": "ApiVaultViewRedemptionQueueRequest", + "is_root": true, + "fields": [ { - "name": "cursor", - "lite_name": "c", - "semantic_type": "string", + "name": "vault_id", + "lite_name": "vi", + "semantic_type": "uint64", "json_type": "string", - "index": 6, + "index": 1, "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", + "optional": false, + "example": "'3477045127917224'", "comment": [ - "The cursor to indicate when to start the query from" + "The unique identifier of the vault to fetch the redemption queue for." ] } ], "comment": [ - "Kline/Candlestick bars for an instrument. Klines are uniquely identified by their instrument, type, interval, and open time.", + "Request payload for a vault manager to view the redemption queue for their vault.", "", - "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" + "Fetches the redemption queue for a vault, ordered by descending priority.", + "", + "\u003cb\u003eUrgent\u003c/b\u003e redemption requests, defined as having been pending \u003e90% of the manager-defined maximum redemption period, have top priority (following insertion order).", + "", + "\u003cb\u003eNon-urgent\u003c/b\u003e redemption requests are otherwise prioritized by insertion order, \u003cb\u003eunless\u003c/b\u003e they are \u003e5x the size of the smallest redemption request.", + "", + "E.g., If FIFO ordering (all non-urgent) is 1k -\u003e 50k -\u003e 100k -\u003e 20k -\u003e 10k -\u003e 25k, then priority ordering is 1k -\u003e 10k -\u003e 50k -\u003e 20k -\u003e 100k -\u003e 25k.", + "", + "Only displays redemption requests that are eligible for automated redemption, i.e., have been pending for the manager-defined minimum redemption period." ] }, { - "name": "Candlestick", - "is_root": false, + "name": "ApiVaultViewRedemptionQueueResponse", + "is_root": true, "fields": [ { - "name": "open_time", - "lite_name": "ot", - "semantic_type": "timestamp", - "json_type": "string", + "name": "redemption_queue", + "lite_name": "rq", + "semantic_type": "VaultRedemptionRequest", + "json_type": "VaultRedemptionRequest", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'1697788800000000000'", "comment": [ - "Open time of kline bar in unix nanoseconds" + "Outstanding vault redemption requests, ordered by descending priority. Excludes requests that have not yet aged past the minimum redemption period." ] }, { - "name": "close_time", - "lite_name": "ct", - "semantic_type": "timestamp", + "name": "pending_redemption_token_count", + "lite_name": "pr", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'1000000'", "comment": [ - "Close time of kline bar in unix nanosecond" + "Number of shares eligible for automated redemption (held in queue for at least the minimum redemption period)." ] }, { - "name": "open", - "lite_name": "o", + "name": "urgent_redemption_token_count", + "lite_name": "ur", "semantic_type": "string", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "'123456.78'", + "example": "'0'", "comment": [ - "The open price, expressed in underlying currency resolution units" + "Number of shares nearing the maximum redemption period (\u003e= 90% of maximum redemption period)." ] }, { - "name": "close", - "lite_name": "c", + "name": "auto_redeemable_balance", + "lite_name": "ar", "semantic_type": "string", "json_type": "string", "index": 3, "array_depth": 0, "optional": false, - "example": "'123456.78'", + "example": "'0'", "comment": [ - "The close price, expressed in underlying currency resolution units" + "Amount available for automated redemption request servicing (in USD)." ] }, { - "name": "high", - "lite_name": "h", + "name": "share_price", + "lite_name": "sp", "semantic_type": "string", "json_type": "string", "index": 4, "array_depth": 0, "optional": false, - "example": "'123456.78'", + "example": "'1.25'", "comment": [ - "The high price, expressed in underlying currency resolution units" + "Current share price (in USD)." ] }, { - "name": "low", - "lite_name": "l", - "semantic_type": "string", - "json_type": "string", + "name": "pre_min", + "lite_name": "pm", + "semantic_type": "PreMinRedemptions", + "json_type": "PreMinRedemptions", "index": 5, "array_depth": 0, "optional": false, - "example": "'123456.78'", "comment": [ - "The low price, expressed in underlying currency resolution units" + "Dedicated section for requests yet to wait at least the minimum redemption period." ] - }, + } + ], + "comment": [ + "Response payload for a vault manager to view the redemption queue for their vault, ordered by descending priority.", + "", + "Also includes counters for total redemption sizes pending as well as urgent (refer to API integration guide for more detail on redemption request classifications).", + "", + "" + ] + }, + { + "name": "ApiWithdrawalHistoryRequest", + "is_root": true, + "fields": [ { - "name": "volume_b", - "lite_name": "vb", + "name": "currency", + "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 6, - "array_depth": 0, + "index": 0, + "array_depth": 1, "optional": false, - "example": "'123456.78'", + "example": "['USDT', 'USDC']", "comment": [ - "The underlying volume transacted, expressed in base asset decimal units" + "The token currency to query for, if nil or empty, return all withdrawals. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "volume_q", - "lite_name": "vq", - "semantic_type": "string", + "name": "start_time", + "lite_name": "st", + "semantic_type": "timestamp", "json_type": "string", - "index": 7, + "index": 1, "array_depth": 0, - "optional": false, - "example": "'123456.78'", + "optional": true, + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "The quote volume transacted, expressed in quote asset decimal units" + "The start time to query for in unix nanoseconds" ] }, { - "name": "trades", - "lite_name": "t", + "name": "end_time", + "lite_name": "et", + "semantic_type": "timestamp", + "json_type": "string", + "index": 2, + "array_depth": 0, + "optional": true, + "default": "now()", + "example": "'1697788800000000000'", + "comment": [ + "The end time to query for in unix nanoseconds" + ] + }, + { + "name": "limit", + "lite_name": "l", "semantic_type": "uint32", "json_type": "integer", - "index": 8, + "index": 3, "array_depth": 0, - "optional": false, - "example": "123456", + "optional": true, + "default": "500", + "example": "500", "comment": [ - "The number of trades transacted" + "The limit to query for. Defaults to 500; Max 1000" ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "cursor", + "lite_name": "c1", + "semantic_type": "string", "json_type": "string", - "index": 9, + "index": 4, "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" + "optional": true, + "default": "''", + "example": "''", + "comment": [ + "The cursor to indicate when to start the next query from" + ] + }, + { + "name": "main_account_id", + "lite_name": "ma", + "semantic_type": "address", + "json_type": "string", + "index": 5, + "array_depth": 0, + "optional": true, + "default": "", + "example": "", + "comment": [ + "Main account ID being queried. By default, applies the requestor's main account ID." ] } ], "comment": [ - "" + "The request to get the historical withdrawals of an account", + "The history is returned in reverse chronological order", + "", + "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": "ApiCandlestickResponse", + "name": "ApiWithdrawalHistoryResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "Candlestick", - "json_type": "Candlestick", + "semantic_type": "WithdrawalHistory", + "json_type": "WithdrawalHistory", "index": 0, "array_depth": 1, "optional": false, "comment": [ - "The candlestick result set for given interval" + "The withdrawals history matching the request account" ] }, { @@ -6952,2060 +7325,1857 @@ "comment": [] }, { - "name": "ApiFundingRateRequest", + "name": "ApiWithdrawalRequest", "is_root": true, "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "from_account_id", + "lite_name": "fa", + "semantic_type": "address", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "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" + "The main account to withdraw from" ] }, { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", + "name": "to_eth_address", + "lite_name": "te", + "semantic_type": "address", "json_type": "string", "index": 1, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "Start time of funding rate in unix nanoseconds" + "The Ethereum wallet to withdraw into" ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "currency", + "lite_name": "c", + "semantic_type": "string", "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", + "optional": false, + "example": "'USDT'", "comment": [ - "The limit to query for. Defaults to 500; Max 1000" + "The token currency to withdraw" ] }, { - "name": "cursor", - "lite_name": "c", + "name": "num_tokens", + "lite_name": "nt", "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 3, "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", + "optional": false, + "example": "'1500.0'", "comment": [ - "The cursor to indicate when to start the query from" + "The number of tokens to withdraw, quoted in tokenCurrency decimal units" ] }, { - "name": "agg_type", - "lite_name": "at", - "semantic_type": "FundingRateAggregationType", - "json_type": "FundingRateAggregationType", - "index": 5, + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 4, "array_depth": 0, - "optional": true, - "default": "'FUNDING_INTERVAL'", - "example": "'FUNDING_INTERVAL'", + "optional": false, "comment": [ - "Aggregation method for historical funding rate observations. Defaults to using the instrument-specific funding interval." + "The signature of the withdrawal" ] } ], "comment": [ - "Lookup the historical funding rate of a perpetual future.", + "Leverage this API to initialize a withdrawal from GRVT's Hyperchain onto Ethereum.", + "Do take note that the bridging process does take time. The GRVT UI will help you keep track of bridging progress, and notify you once its complete.", "", - "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" + "If not withdrawing the entirety of your balance, there is a minimum withdrawal amount. Currently that amount is ~25 USDT.", + "Withdrawal fees also apply to cover the cost of the Ethereum transaction.", + "Note that your funds will always remain in self-custory throughout the withdrawal process. At no stage does GRVT gain control over your funds." ] }, { - "name": "ApiFundingRate", + "name": "BuilderFillHistory", "is_root": false, "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'1697788800000000000'", "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" + "Time at which the event was emitted in unix nanoseconds" ] }, { - "name": "funding_rate", - "lite_name": "fr", + "name": "off_chain_account_id", + "lite_name": "oc", "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "0.0003", + "example": "'ACC:123456'", "comment": [ - "The funding rate of the instrument, expressed in percentage points" + "The off chain account id" ] }, { - "name": "funding_time", - "lite_name": "ft", - "semantic_type": "timestamp", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The funding timestamp of the funding rate, expressed in unix nanoseconds" + "The instrument being represented" ] }, { - "name": "mark_price", - "lite_name": "mp", - "semantic_type": "string", - "json_type": "string", + "name": "is_buyer", + "lite_name": "ib", + "semantic_type": "bool", + "json_type": "boolean", "index": 3, "array_depth": 0, "optional": false, - "example": "'65038.01'", + "example": "true", "comment": [ - "The mark price of the instrument at funding timestamp, expressed in `9` decimals" + "The side that the subaccount took on the trade" ] }, { - "name": "funding_rate_8_h_avg", - "lite_name": "fr1", - "semantic_type": "string", - "json_type": "string", + "name": "is_taker", + "lite_name": "it", + "semantic_type": "bool", + "json_type": "boolean", "index": 4, "array_depth": 0, "optional": false, - "example": "0.0003", + "example": "true", "comment": [ - "Deprecated: Refer to `funding_rate` instead. Will be removed in a future release." + "The role that the subaccount took on the trade" ] }, { - "name": "funding_interval_hours", - "lite_name": "fi", - "semantic_type": "uint8", - "json_type": "integer", + "name": "size", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", "index": 5, "array_depth": 0, "optional": false, - "example": "8", + "example": "'0.30'", "comment": [ - "Funding interval in hours (e.g. 1/4/8/etc)." + "The number of assets being traded, expressed in base asset decimal units" ] - } - ], - "comment": [] - }, - { - "name": "ApiFundingRateResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "ApiFundingRate", - "json_type": "ApiFundingRate", - "index": 0, - "array_depth": 1, + "name": "price", + "lite_name": "p", + "semantic_type": "string", + "json_type": "string", + "index": 6, + "array_depth": 0, "optional": false, + "example": "'65038.01'", "comment": [ - "The funding rate result set for given interval" + "The traded price, expressed in `9` decimals" ] }, { - "name": "next", - "lite_name": "n", + "name": "mark_price", + "lite_name": "mp", "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 7, "array_depth": 0, - "optional": true, - "default": "''", - "example": "'Qw0918='", + "optional": false, + "example": "'65038.01'", "comment": [ - "The cursor to indicate when to start the next query from" + "The mark price of the instrument at point of trade, expressed in `9` decimals" ] - } - ], - "comment": [] - }, - { - "name": "JSONRPCRequest", - "is_root": true, - "fields": [ + }, { - "name": "jsonrpc", - "lite_name": "j", + "name": "index_price", + "lite_name": "ip", "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 8, "array_depth": 0, "optional": false, - "example": "'2.0'", + "example": "'65038.01'", "comment": [ - "The JSON RPC version to use for the request" + "The index price of the instrument at point of trade, expressed in `9` decimals" ] }, { - "name": "method", - "lite_name": "m", + "name": "fee_rate", + "lite_name": "fr", "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 9, "array_depth": 0, "optional": false, - "example": "'subscribe'", + "example": "0.001", "comment": [ - "The method to use for the request (eg: `subscribe` / `unsubscribe` / `v1/instrument` )" + "Builder fee percentage charged for this order. referred to Order.builder builderFee " ] }, { - "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, + "name": "fee", + "lite_name": "f", + "semantic_type": "int64", + "json_type": "string", + "index": 10, "array_depth": 0, - "optional": true, - "default": "0", - "example": "123", + "optional": false, "comment": [ - "Optional Field which is used to match the response by the client.", - "If not passed, this field will not be returned" + "The builder fee paid on the trade, expressed in quote asset decimal unit. referred to Trade.builderFee" ] } ], - "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." - ] + "comment": [] }, { - "name": "Error", - "is_root": true, + "name": "CancelStatusFeed", + "is_root": false, "fields": [ { - "name": "code", - "lite_name": "c", - "semantic_type": "uint16", - "json_type": "integer", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "123", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The error code for the request" + "The subaccount ID that requested the cancellation" ] }, { - "name": "message", - "lite_name": "m", - "semantic_type": "string", + "name": "client_order_id", + "lite_name": "co", + "semantic_type": "uint64", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'An error occurred'", + "example": "'23042'", "comment": [ - "The error message for the request" + "A unique identifier for the active order within a subaccount, specified by the client" ] - } - ], - "comment": [ - "An error response" - ] - }, - { - "name": "JSONRPCResponse", - "is_root": true, - "fields": [ + }, { - "name": "jsonrpc", - "lite_name": "j", - "semantic_type": "string", + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", "json_type": "string", - "index": 0, + "index": 2, "array_depth": 0, "optional": false, - "example": "'2.0'", + "example": "'10000101000203040506'", "comment": [ - "The JSON RPC version to use for the request" + "A unique 128-bit identifier for the order, deterministically generated within the GRVT backend" ] }, { - "name": "result", + "name": "reason", "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, + "semantic_type": "OrderRejectReason", + "json_type": "OrderRejectReason", + "index": 3, "array_depth": 0, - "optional": true, - "default": "null", + "optional": false, "comment": [ - "The error for the request" + "The user-provided reason for cancelling the order" ] }, { - "name": "id", - "lite_name": "i", - "semantic_type": "uint32", - "json_type": "integer", - "index": 3, + "name": "update_time", + "lite_name": "ut", + "semantic_type": "timestamp", + "json_type": "string", + "index": 4, "array_depth": 0, "optional": true, "default": "0", - "example": "123", + "example": "'1697788800000000000'", "comment": [ - "Optional Field which is used to match the response by the client.", - "If not passed, this field will not be returned.", - "Range: 0 to 4,294,967,295 (uint32)" + "[Filled by GRVT Backend] Time at which the cancellation status was updated by GRVT in unix nanoseconds" ] }, { - "name": "method", - "lite_name": "m", - "semantic_type": "string", - "json_type": "string", - "index": 4, + "name": "cancel_status", + "lite_name": "cs", + "semantic_type": "CancelStatus", + "json_type": "CancelStatus", + "index": 5, "array_depth": 0, "optional": false, - "example": "'subscribe'", "comment": [ - "The method used in the request for this response (eg: `subscribe` / `unsubscribe` / `v1/instrument` )" + "Status of the cancellation attempt" ] } ], - "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." - ] + "comment": [] }, { - "name": "WSSubscribeParams", - "is_root": true, + "name": "Candlestick", + "is_root": false, "fields": [ { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", + "name": "open_time", + "lite_name": "ot", + "semantic_type": "timestamp", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.ticker.d'", + "example": "'1697788800000000000'", "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" + "Open time of kline bar in unix nanoseconds" ] }, { - "name": "selectors", - "lite_name": "s1", - "semantic_type": "string", + "name": "close_time", + "lite_name": "ct", + "semantic_type": "timestamp", "json_type": "string", "index": 1, - "array_depth": 1, + "array_depth": 0, "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", + "example": "'1697788800000000000'", "comment": [ - "The list of feeds to subscribe to" + "Close time of kline bar in unix nanosecond" ] }, { - "name": "use_global_sequence_number", - "lite_name": "ug", - "semantic_type": "bool", - "json_type": "boolean", + "name": "open", + "lite_name": "o", + "semantic_type": "string", + "json_type": "string", "index": 2, "array_depth": 0, - "optional": true, - "default": "false", - "example": "true", + "optional": false, + "example": "'123456.78'", "comment": [ - "Whether to use the global sequence number for the stream" + "The open price, expressed in underlying currency resolution units" ] - } - ], - "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", + "name": "close", + "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 3, "array_depth": 0, "optional": false, - "example": "'v1.ticker.d'", + "example": "'123456.78'", "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" + "The close price, expressed in underlying currency resolution units" ] }, { - "name": "subs", - "lite_name": "s1", + "name": "high", + "lite_name": "h", "semantic_type": "string", "json_type": "string", - "index": 1, - "array_depth": 1, + "index": 4, + "array_depth": 0, "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", + "example": "'123456.78'", "comment": [ - "The list of feeds subscribed to" + "The high price, expressed in underlying currency resolution units" ] }, { - "name": "unsubs", - "lite_name": "u", + "name": "low", + "lite_name": "l", "semantic_type": "string", "json_type": "string", - "index": 2, - "array_depth": 1, + "index": 5, + "array_depth": 0, "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", + "example": "'123456.78'", "comment": [ - "The list of feeds unsubscribed from" + "The low price, expressed in underlying currency resolution units" ] }, { - "name": "num_snapshots", - "lite_name": "ns", - "semantic_type": "uint32", - "json_type": "integer", - "index": 3, - "array_depth": 1, + "name": "volume_b", + "lite_name": "vb", + "semantic_type": "string", + "json_type": "string", + "index": 6, + "array_depth": 0, "optional": false, - "example": "10", + "example": "'123456.78'", "comment": [ - "The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs`" + "The underlying volume transacted, expressed in base asset decimal units" ] }, { - "name": "first_sequence_number", - "lite_name": "fs", - "semantic_type": "uint64", + "name": "volume_q", + "lite_name": "vq", + "semantic_type": "string", "json_type": "string", - "index": 4, - "array_depth": 1, + "index": 7, + "array_depth": 0, "optional": false, - "example": "872634876", + "example": "'123456.78'", "comment": [ - "The first sequence number to expect for each subscribed feed. Returned in same order as `subs`" + "The quote volume transacted, expressed in quote asset decimal units" ] }, { - "name": "latest_sequence_number", - "lite_name": "ls", - "semantic_type": "uint64", + "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": 5, - "array_depth": 1, + "index": 9, + "array_depth": 0, "optional": false, - "example": "872634875", + "example": "'BTC_USDT_Perp'", "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`" + "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": [ - "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, + "name": "ClientTier", + "is_root": false, "fields": [ { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", + "name": "tier", + "lite_name": "t", + "semantic_type": "uint8", + "json_type": "integer", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.ticker.d'", - "comment": [ - "The channel to unsubscribe from (eg: ticker.s / ticker.d)" - ] + "comment": [] }, { - "name": "selectors", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", + "name": "futures_taker_fee", + "lite_name": "ft", + "semantic_type": "int32", + "json_type": "integer", "index": 1, - "array_depth": 1, + "array_depth": 0, "optional": false, - "example": "['BTC_USDT_Perp', 'ETH_USDT_Perp']", - "comment": [ - "The list of feeds to unsubscribe from" - ] + "comment": [] }, { - "name": "use_global_sequence_number", - "lite_name": "ug", - "semantic_type": "bool", - "json_type": "boolean", + "name": "futures_maker_fee", + "lite_name": "fm", + "semantic_type": "int32", + "json_type": "integer", "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": [ + "optional": false, + "comment": [] + }, { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 0, + "name": "options_taker_fee", + "lite_name": "ot", + "semantic_type": "int32", + "json_type": "integer", + "index": 3, "array_depth": 0, "optional": false, - "example": "'v1.ticker.d'", - "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" - ] + "comment": [] }, { - "name": "unsubs", - "lite_name": "u", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 1, + "name": "options_maker_fee", + "lite_name": "om", + "semantic_type": "int32", + "json_type": "integer", + "index": 4, + "array_depth": 0, "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", - "comment": [ - "The list of feeds unsubscribed from" - ] + "comment": [] } ], - "comment": [ - "Returns a confirmation of all unsubscribes" - ] + "comment": [] }, { - "name": "WSSubscribeRequestV1Legacy", - "is_root": true, + "name": "CurrencyDetail", + "is_root": false, "fields": [ { - "name": "request_id", - "lite_name": "ri", - "semantic_type": "uint32", + "name": "id", + "lite_name": "i", + "semantic_type": "uint16", "json_type": "integer", "index": 0, "array_depth": 0, - "optional": true, - "default": "0", - "example": "123", + "optional": false, + "example": "3", "comment": [ - "Optional Field which is used to match the response by the client.", - "If not passed, this field will not be returned.", - "Range: 0 to 4,294,967,295 (uint32)" + "The integer value of the currency" ] }, { - "name": "stream", + "name": "symbol", "lite_name": "s", "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'v1.ticker.d'", + "example": "'USDT'", "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" + "The name of the currency" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "string", - "json_type": "string", + "name": "balance_decimals", + "lite_name": "bd", + "semantic_type": "int8", + "json_type": "integer", "index": 2, - "array_depth": 1, + "array_depth": 0, "optional": false, - "example": "['BTC_USDT_Perp', 'ETH_USDT_Perp']", + "example": "6", "comment": [ - "The list of feeds to subscribe to" + "The balance decimals of the currency" ] }, { - "name": "method", - "lite_name": "m", - "semantic_type": "string", + "name": "quantity_multiplier", + "lite_name": "qm", + "semantic_type": "uint64", "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", + "example": "1000000", "comment": [ - "Whether the request is for full data or lite data" + "The quantity multiplier of the currency" ] } ], - "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." - ] + "comment": [] }, { - "name": "WSSubscribeResponseV1Legacy", - "is_root": true, + "name": "Deposit", + "is_root": false, "fields": [ { - "name": "request_id", - "lite_name": "ri", - "semantic_type": "uint32", - "json_type": "integer", + "name": "tx_hash", + "lite_name": "th", + "semantic_type": "uint256", + "json_type": "string", "index": 0, "array_depth": 0, - "optional": true, - "default": "0", - "example": "123", + "optional": false, + "example": "'0x1234567890123456789012345678901234567890123456789012345678901234'", "comment": [ - "Optional Field which is used to match the response by the client.", - "If not passed, this field will not be returned" + "The hash of the bridgemint event producing the deposit" ] }, { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", + "name": "to_account_id", + "lite_name": "ta", + "semantic_type": "address", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'v1.ticker.d'", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" + "The account to deposit into" ] }, { - "name": "subs", - "lite_name": "s1", + "name": "currency", + "lite_name": "c", "semantic_type": "string", "json_type": "string", "index": 2, - "array_depth": 1, + "array_depth": 0, "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", + "example": "'USDT'", "comment": [ - "The list of feeds subscribed to" + "The token currency to deposit" ] }, { - "name": "unsubs", - "lite_name": "u", + "name": "num_tokens", + "lite_name": "nt", "semantic_type": "string", "json_type": "string", "index": 3, - "array_depth": 1, + "array_depth": 0, "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", + "example": "'10.50'", "comment": [ - "The list of feeds unsubscribed from" + "The number of tokens to deposit" ] - }, + } + ], + "comment": [] + }, + { + "name": "DepositHistory", + "is_root": false, + "fields": [ { - "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", + "name": "l_1_hash", + "lite_name": "l1", + "semantic_type": "uint256", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'0x10000101000203040506'", "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" + "The L1 txHash of the deposit" + ] }, { - "name": "rate", - "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", + "name": "l_2_hash", + "lite_name": "l2", + "semantic_type": "uint256", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "500", + "example": "'0x10000101000203040506'", "comment": [ - "The minimal rate at which we publish feeds (in milliseconds)", - "Delta (50, 100, 500, 1000)", - "Snapshot (500, 1000)" - ], - "selector": "secondary" + "The L2 txHash of the deposit" + ] }, { - "name": "depth", - "lite_name": "d", - "semantic_type": "uint32", - "json_type": "integer", + "name": "to_account_id", + "lite_name": "ta", + "semantic_type": "address", + "json_type": "string", "index": 2, "array_depth": 0, - "optional": true, - "default": "'0'", - "example": "50", + "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "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": [ + "The account to deposit into" + ] + }, { - "name": "stream", - "lite_name": "s", + "name": "currency", + "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 3, "array_depth": 0, "optional": false, - "example": "'v1.book.s'", + "example": "'USDT'", "comment": [ - "Stream name" + "The token currency to deposit" ] }, { - "name": "selector", - "lite_name": "s1", + "name": "num_tokens", + "lite_name": "nt", "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 4, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'1500.0'", "comment": [ - "Primary selector" + "The number of tokens to deposit" ] }, { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", + "name": "initiated_time", + "lite_name": "it", + "semantic_type": "timestamp", "json_type": "string", - "index": 2, + "index": 5, "array_depth": 0, "optional": false, - "example": "'872634876'", + "example": "'1697788800000000000'", "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 timestamp when the deposit was initiated on L1 in unix nanoseconds" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "OrderbookLevels", - "json_type": "OrderbookLevels", - "index": 3, + "name": "confirmed_time", + "lite_name": "ct", + "semantic_type": "timestamp", + "json_type": "string", + "index": 6, "array_depth": 0, "optional": false, + "example": "'1697788800000000000'", "comment": [ - "An orderbook levels object matching the request filter" + "The timestamp when the deposit was confirmed on L2 in unix nanoseconds" ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", + "name": "from_address", + "lite_name": "fa", + "semantic_type": "address", "json_type": "string", - "index": 4, + "index": 7, "array_depth": 0, "optional": false, - "example": "'872634875'", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "The previous sequence number that determines the message order" + "The address of the sender" ] } ], "comment": [] }, { - "name": "WSMiniTickerFeedSelectorV1", + "name": "EmptyRequest", + "is_root": true, + "fields": [], + "comment": [ + "Used for requests that do not require any parameters" + ] + }, + { + "name": "Error", "is_root": true, "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", + "name": "code", + "lite_name": "c", + "semantic_type": "uint16", + "json_type": "integer", "index": 0, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "123", "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" + "The error code for the request" + ] }, { - "name": "rate", - "lite_name": "r", - "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": "500", + "example": "'An error occurred'", "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" + "The error message for the request" + ] } ], "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" + "An error response" ] }, { - "name": "WSMiniTickerFeedDataV1", - "is_root": true, + "name": "Fill", + "is_root": false, "fields": [ { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.mini.s'", + "example": "'1697788800000000000'", "comment": [ - "Stream name" + "Time at which the event was emitted in unix nanoseconds" ] }, { - "name": "selector", - "lite_name": "s1", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "Primary selector" + "The sub account ID that participated in the trade" ] }, { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", - "json_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "'872634876'", + "example": "'BTC_USDT_Perp'", "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 instrument being represented" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "MiniTicker", - "json_type": "MiniTicker", + "name": "is_buyer", + "lite_name": "ib", + "semantic_type": "bool", + "json_type": "boolean", "index": 3, "array_depth": 0, "optional": false, + "example": "true", "comment": [ - "A mini ticker matching the request filter" + "The side that the subaccount took on the trade" ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", - "json_type": "string", + "name": "is_taker", + "lite_name": "it", + "semantic_type": "bool", + "json_type": "boolean", "index": 4, "array_depth": 0, "optional": false, - "example": "'872634875'", + "example": "true", "comment": [ - "The previous sequence number that determines the message order" + "The role that the subaccount took on the trade" ] - } - ], - "comment": [] - }, - { - "name": "WSTickerFeedSelectorV1", - "is_root": true, - "fields": [ + }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "size", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 5, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'0.30'", "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" + "The number of assets being traded, expressed in base asset decimal units" + ] }, { - "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", + "name": "price", + "lite_name": "p", "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 6, "array_depth": 0, "optional": false, - "example": "'v1.ticker.s'", + "example": "'65038.01'", "comment": [ - "Stream name" + "The traded price, expressed in `9` decimals" ] }, { - "name": "selector", - "lite_name": "s1", + "name": "mark_price", + "lite_name": "mp", "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 7, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'65038.01'", "comment": [ - "Primary selector" + "The mark price of the instrument at point of trade, expressed in `9` decimals" ] }, { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", + "name": "index_price", + "lite_name": "ip", + "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 8, "array_depth": 0, "optional": false, - "example": "'872634876'", + "example": "'65038.01'", "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 index price of the instrument at point of trade, expressed in `9` decimals" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "Ticker", - "json_type": "Ticker", - "index": 3, + "name": "interest_rate", + "lite_name": "ir", + "semantic_type": "string", + "json_type": "string", + "index": 9, "array_depth": 0, "optional": false, + "example": "0.0003", "comment": [ - "A ticker matching the request filter" + "The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)" ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", + "name": "forward_price", + "lite_name": "fp", + "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 10, "array_depth": 0, "optional": false, - "example": "'872634875'", + "example": "'65038.01'", "comment": [ - "The previous sequence number that determines the message order" + "[Options] The forward price of the option at point of trade, expressed in `9` decimals" ] - } - ], - "comment": [] - }, - { - "name": "WSTradeFeedSelectorV1", - "is_root": true, - "fields": [ + }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "realized_pnl", + "lite_name": "rp", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 11, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'2400.50'", "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" + "The realized PnL of the trade, expressed in quote asset decimal units (0 if increasing position size)" + ] }, { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, + "name": "fee", + "lite_name": "f", + "semantic_type": "string", + "json_type": "string", + "index": 12, "array_depth": 0, "optional": false, - "example": "500", + "example": "'9.75'", "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": [ + "The fees paid on the trade, expressed in quote asset decimal unit (negative if maker rebate applied)" + ] + }, { - "name": "stream", - "lite_name": "s", + "name": "fee_rate", + "lite_name": "fr", "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 13, "array_depth": 0, "optional": false, - "example": "'v1.trade'", + "example": "0.0003", "comment": [ - "Stream name" + "The fee rate paid on the trade" ] }, { - "name": "selector", - "lite_name": "s1", + "name": "trade_id", + "lite_name": "ti", "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 14, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'209358-2'", "comment": [ - "Primary selector" + "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": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", "json_type": "string", - "index": 2, + "index": 15, "array_depth": 0, "optional": false, - "example": "'872634876'", + "example": "'0x10000101000203040506'", "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`." + "An order identifier" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "Trade", - "json_type": "Trade", - "index": 3, + "name": "venue", + "lite_name": "v", + "semantic_type": "Venue", + "json_type": "Venue", + "index": 16, "array_depth": 0, "optional": false, + "example": "'ORDERBOOK'", "comment": [ - "A public trade matching the request filter" + "The venue where the trade occurred" ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", + "name": "is_liquidation", + "lite_name": "il", + "semantic_type": "bool", + "json_type": "boolean", + "index": 17, + "array_depth": 0, + "optional": false, + "example": "false", + "comment": [ + "If the trade was a liquidation" + ] + }, + { + "name": "client_order_id", + "lite_name": "co", "semantic_type": "uint64", "json_type": "string", - "index": 4, + "index": 18, "array_depth": 0, "optional": false, - "example": "'872634875'", + "example": "'23042'", "comment": [ - "The previous sequence number that determines the message 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": "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" + ] + }, + { + "name": "is_rpi", + "lite_name": "ir1", + "semantic_type": "bool", + "json_type": "boolean", + "index": 22, + "array_depth": 0, + "optional": false, + "example": "false", + "comment": [ + "If the trade is a RPI trade" + ] + }, + { + "name": "builder", + "lite_name": "b1", + "semantic_type": "address", + "json_type": "string", + "index": 24, + "array_depth": 0, + "optional": false, + "example": "'$GRVT_MAIN_ACCOUNT_ID'", + "comment": [ + "The main account ID of the builder. referred to Order.builder" + ] + }, + { + "name": "builder_fee_rate", + "lite_name": "bf", + "semantic_type": "string", + "json_type": "string", + "index": 25, + "array_depth": 0, + "optional": false, + "example": "0.001", + "comment": [ + "Builder fee percentage charged for this order. referred to Order.builder builderFee " + ] + }, + { + "name": "builder_fee", + "lite_name": "bf1", + "semantic_type": "string", + "json_type": "string", + "index": 26, + "array_depth": 0, + "optional": false, + "example": "'0.2'", + "comment": [ + "The builder fee paid on the trade, expressed in quote asset decimal unit. referred to Trade.builderFee" ] } ], "comment": [] }, { - "name": "WSCandlestickFeedSelectorV1", - "is_root": true, + "name": "FundingAccountSummary", + "is_root": false, "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "main_account_id", + "lite_name": "ma", + "semantic_type": "address", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "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" + "The main account ID of the account to which the summary belongs" + ] }, { - "name": "interval", - "lite_name": "i1", - "semantic_type": "CandlestickInterval", - "json_type": "CandlestickInterval", + "name": "total_equity", + "lite_name": "te", + "semantic_type": "string", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, + "example": "'3945034.23'", "comment": [ - "The interval of each candlestick" - ], - "selector": "secondary" + "Total equity of the main account, denominated in USD" + ] }, { - "name": "type", - "lite_name": "t", - "semantic_type": "CandlestickType", - "json_type": "CandlestickType", + "name": "spot_balances", + "lite_name": "sb", + "semantic_type": "SpotBalance", + "json_type": "SpotBalance", "index": 2, - "array_depth": 0, + "array_depth": 1, "optional": false, "comment": [ - "The type of candlestick data to retrieve" - ], - "selector": "secondary" + "The list of spot assets owned by this main account, and their balances" + ] + }, + { + "name": "vault_investments", + "lite_name": "vi", + "semantic_type": "VaultInvestment", + "json_type": "VaultInvestment", + "index": 3, + "array_depth": 1, + "optional": false, + "comment": [ + "The list of vault investments held by this main account" + ] } ], "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." + "The funding account summary, that reports the total equity and spot balances of a funding (main) account" ] }, { - "name": "WSCandlestickFeedDataV1", - "is_root": true, + "name": "FundingPayment", + "is_root": false, "fields": [ { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.candle'", + "example": "'1697788800000000000'", "comment": [ - "Stream name" + "Time at which the event was emitted in unix nanoseconds" ] }, { - "name": "selector", - "lite_name": "s1", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "Primary selector" + "The sub account ID that made the funding payment" ] }, { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "'872634876'", + "example": "'BTC_USDT_Perp'", "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 perpetual instrument being funded" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "Candlestick", - "json_type": "Candlestick", + "name": "currency", + "lite_name": "c", + "semantic_type": "string", + "json_type": "string", "index": 3, "array_depth": 0, "optional": false, + "example": "'USDT'", "comment": [ - "A candlestick entry matching the request filters" + "The currency of the funding payment" ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", + "name": "amount", + "lite_name": "a", + "semantic_type": "string", "json_type": "string", "index": 4, "array_depth": 0, "optional": false, - "example": "'872634875'", + "example": "'9.75'", "comment": [ - "The previous sequence number that determines the message order" + "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": "WSUnsubscribeAllParams", - "is_root": true, - "fields": [], - "comment": [ - "All V1 Websocket Unsubscription Request to unsubscribe from all active websocket streams." - ] - }, - { - "name": "StreamReference", + "name": "InitialLeverageResult", "is_root": false, "fields": [ { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.ticker.d'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" + "The instrument to get the leverage for" ] }, { - "name": "selectors", - "lite_name": "s1", + "name": "leverage", + "lite_name": "l", "semantic_type": "string", "json_type": "string", "index": 1, - "array_depth": 1, + "array_depth": 0, "optional": false, - "example": "['BTC_USDT_Perp', 'ETH_USDT_Perp']", + "example": "'10'", "comment": [ - "The list of selectors for the stream" + "The initial leverage of this instrument" ] - } - ], - "comment": [] - }, - { - "name": "WSUnsubscribeAllResult", - "is_root": true, - "fields": [ + }, { - "name": "stream_reference", - "lite_name": "sr", - "semantic_type": "StreamReference", - "json_type": "StreamReference", - "index": 0, - "array_depth": 1, + "name": "min_leverage", + "lite_name": "ml", + "semantic_type": "string", + "json_type": "string", + "index": 2, + "array_depth": 0, "optional": false, + "example": "'10'", "comment": [ - "The list of stream references unsubscribed from" + "The min leverage user can set for this instrument" ] - } - ], - "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, + "name": "max_leverage", + "lite_name": "ml1", + "semantic_type": "string", + "json_type": "string", + "index": 3, + "array_depth": 0, "optional": false, + "example": "'50'", "comment": [ - "The list of stream references the connection is connected to" + "The max leverage user can set for this instrument" ] - } - ], - "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, + "name": "margin_type", + "lite_name": "mt", + "semantic_type": "PositionMarginType", + "json_type": "PositionMarginType", + "index": 4, "array_depth": 0, - "optional": true, - "default": "false", - "example": "true", - "comment": [ - "Fetch only active instruments" - ] - } - ], - "comment": [ - "Fetch all instruments" - ] - }, - { - "name": "ApiGetAllInstrumentsResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "InstrumentDisplay", - "json_type": "InstrumentDisplay", - "index": 0, - "array_depth": 1, "optional": false, "comment": [ - "List of instruments" + "The margin type of this instrument" ] } ], "comment": [] }, { - "name": "ApiQueryVaultManagerInvestorHistoryRequest", - "is_root": true, + "name": "InstrumentDisplay", + "is_root": false, "fields": [ { - "name": "vault_id", - "lite_name": "vi", - "semantic_type": "uint64", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'2312134'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The unique identifier of the vault to filter by" + "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": "only_own_investments", - "lite_name": "oo", - "semantic_type": "bool", - "json_type": "boolean", + "name": "instrument_hash", + "lite_name": "ih", + "semantic_type": "uint256", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "true", + "example": "'0x030501'", "comment": [ - "Whether to only return investments made by the manager" + "The asset ID used for instrument signing." ] }, { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", + "name": "base", + "lite_name": "b", + "semantic_type": "string", "json_type": "string", "index": 2, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "optional": false, + "example": "'BTC'", "comment": [ - "Optional. Start time in unix nanoseconds" + "The base currency" ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "quote", + "lite_name": "q", + "semantic_type": "string", "json_type": "string", "index": 3, "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", + "optional": false, + "example": "'USDT'", "comment": [ - "Optional. End time in unix nanoseconds" + "The quote currency" ] - } - ], - "comment": [ - "Request for the manager to retrieve the vault investor history for their vault" - ] - }, - { - "name": "ApiVaultInvestorHistory", - "is_root": false, - "fields": [ + }, { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", - "index": 0, + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", + "index": 4, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'PERPETUAL'", "comment": [ - "Time at which the event was emitted in unix nanoseconds" + "The kind of instrument" ] }, { - "name": "off_chain_account_id", - "lite_name": "oc", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, + "name": "venues", + "lite_name": "v", + "semantic_type": "Venue", + "json_type": "Venue", + "index": 7, + "array_depth": 1, "optional": false, - "example": "'ACC:123456'", + "example": "['ORDERBOOK']", "comment": [ - "The off chain account id of the investor, only visible to the manager" + "Venues that this instrument can be traded at" ] }, { - "name": "vault_id", - "lite_name": "vi", - "semantic_type": "uint64", - "json_type": "string", - "index": 2, + "name": "settlement_period", + "lite_name": "sp1", + "semantic_type": "InstrumentSettlementPeriod", + "json_type": "InstrumentSettlementPeriod", + "index": 8, "array_depth": 0, "optional": false, - "example": "'2312134'", + "example": "'PERPETUAL'", "comment": [ - "The unique identifier of the vault." + "The settlement period of the instrument" ] }, { - "name": "type", - "lite_name": "t", - "semantic_type": "VaultInvestorAction", - "json_type": "VaultInvestorAction", - "index": 3, + "name": "base_decimals", + "lite_name": "bd", + "semantic_type": "int8", + "json_type": "integer", + "index": 9, "array_depth": 0, "optional": false, - "example": "'VAULT_INVEST'", + "example": "3", "comment": [ - "The type of transaction that occurred. List of types: vaultInvest, vaultBurnLpToken, vaultRedeem" + "The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)" ] }, { - "name": "price", - "lite_name": "p", - "semantic_type": "string", - "json_type": "string", - "index": 4, + "name": "quote_decimals", + "lite_name": "qd", + "semantic_type": "int8", + "json_type": "integer", + "index": 10, "array_depth": 0, "optional": false, - "example": "'1000000'", + "example": "3", "comment": [ - "The price of the vault LP tokens at the time of the event." + "The smallest denomination of the quote asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)" ] }, { - "name": "size", - "lite_name": "s", + "name": "tick_size", + "lite_name": "ts", "semantic_type": "string", "json_type": "string", - "index": 5, + "index": 11, "array_depth": 0, "optional": false, - "example": "'1000000'", + "example": "'0.01'", "comment": [ - "The amount of Vault LP tokens invested or redeemed." + "The size of a single tick, expressed in price decimal units" ] }, { - "name": "realized_pnl", - "lite_name": "rp", + "name": "min_size", + "lite_name": "ms", "semantic_type": "string", "json_type": "string", - "index": 6, + "index": 12, "array_depth": 0, "optional": false, - "example": "'1000000'", + "example": "'0.01'", "comment": [ - "The realized PnL of the vault." + "The minimum contract size, expressed in base asset decimal units" ] }, { - "name": "performance_fee", - "lite_name": "pf", - "semantic_type": "string", + "name": "create_time", + "lite_name": "ct", + "semantic_type": "timestamp", "json_type": "string", - "index": 7, + "index": 14, "array_depth": 0, "optional": false, - "example": "'1000000'", + "example": "'1697788800000000000'", "comment": [ - "The performance fee of the vault." + "Creation time in unix nanoseconds" ] - } - ], - "comment": [ - "The vault investor history returned by the service to client" - ] - }, - { - "name": "ApiQueryVaultManagerInvestorHistoryResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "ApiVaultInvestorHistory", - "json_type": "ApiVaultInvestorHistory", - "index": 0, - "array_depth": 1, + "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 list of vault investor history belong to the manager" + "The maximum position size, expressed in base asset decimal units" ] - } - ], - "comment": [ - "Response to retrieve the vault summary for a given vault" - ] - }, - { - "name": "OrderLeg", - "is_root": false, - "fields": [ + }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, + "name": "funding_interval_hours", + "lite_name": "fi", + "semantic_type": "uint8", + "json_type": "integer", + "index": 17, "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", + "optional": true, "comment": [ - "The instrument to trade in this leg" + "Defines the funding interval to be applied." ] }, { - "name": "size", - "lite_name": "s", + "name": "adjusted_funding_rate_cap", + "lite_name": "af", "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 18, "array_depth": 0, - "optional": false, - "example": "'10.5'", + "optional": true, + "example": "2.5", "comment": [ - "The total number of assets to trade in this leg, expressed in base asset decimal units." + "Funding rate cap over the defined `intervalHours`." ] }, { - "name": "limit_price", - "lite_name": "lp", + "name": "adjusted_funding_rate_floor", + "lite_name": "af1", "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 19, "array_depth": 0, "optional": true, - "default": "0", - "example": "'65038.01'", + "example": "-2.5", "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" + "Funding rate floor over the defined `intervalHours`." ] }, { - "name": "is_buying_asset", - "lite_name": "ib", - "semantic_type": "bool", - "json_type": "boolean", - "index": 3, + "name": "min_notional", + "lite_name": "mn", + "semantic_type": "string", + "json_type": "string", + "index": 20, "array_depth": 0, "optional": false, - "example": "true", + "example": "'20.0'", "comment": [ - "Specifies if the order leg is a buy or sell" + "The minimum order notional value, expressed in quote currency decimal units" ] } ], "comment": [] }, { - "name": "TPSLOrderMetadata", - "is_root": false, + "name": "JSONRPCRequest", + "is_root": true, "fields": [ { - "name": "trigger_by", - "lite_name": "tb", - "semantic_type": "TriggerBy", - "json_type": "TriggerBy", + "name": "jsonrpc", + "lite_name": "j", + "semantic_type": "string", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'LAST'", + "example": "'2.0'", "comment": [ - "Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order" + "The JSON RPC version to use for the request" ] }, { - "name": "trigger_price", - "lite_name": "tp", + "name": "method", + "lite_name": "m", "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'65038.10'", + "example": "'subscribe'", "comment": [ - "The Trigger Price of the order, expressed in `9` decimals." + "The method to use for the request (eg: `subscribe` / `unsubscribe` / `v1/instrument` )" ] }, { - "name": "close_position", - "lite_name": "cp", - "semantic_type": "bool", - "json_type": "boolean", + "name": "params", + "lite_name": "p", + "semantic_type": "any", + "json_type": "object", "index": 2, "array_depth": 0, "optional": false, - "example": "false", - "comment": [ - "If True, the order will close the position when the trigger price is reached" - ] - } - ], - "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": "TriggerOrderMetadata", - "is_root": false, - "fields": [ - { - "name": "trigger_type", - "lite_name": "tt", - "semantic_type": "TriggerType", - "json_type": "TriggerType", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'TAKE_PROFIT'", "comment": [ - "Type of the trigger order. eg: Take Profit, Stop Loss, etc" + "The parameters for the request" ] }, { - "name": "tpsl", - "lite_name": "t", - "semantic_type": "TPSLOrderMetadata", - "json_type": "TPSLOrderMetadata", - "index": 1, + "name": "id", + "lite_name": "i", + "semantic_type": "uint32", + "json_type": "integer", + "index": 3, "array_depth": 0, - "optional": false, + "optional": true, + "default": "0", + "example": "123", "comment": [ - "Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.", - "", - "" + "Optional Field which is used to match the response by the client.", + "If not passed, this field will not be returned" ] } ], "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.", - "", - "" + "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": "OrderMetadata", - "is_root": false, + "name": "JSONRPCResponse", + "is_root": true, "fields": [ { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", + "name": "jsonrpc", + "lite_name": "j", + "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'23042'", + "example": "'2.0'", "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 JSON RPC version to use for the request" ] }, { - "name": "create_time", - "lite_name": "ct", - "semantic_type": "timestamp", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "any", + "json_type": "object", "index": 1, "array_depth": 0, "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "default": "null", "comment": [ - "[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds" + "The result for the request" ] }, { - "name": "trigger", - "lite_name": "t", - "semantic_type": "TriggerOrderMetadata", - "json_type": "TriggerOrderMetadata", + "name": "error", + "lite_name": "e", + "semantic_type": "Error", + "json_type": "Error", "index": 2, "array_depth": 0, "optional": true, - "default": "", + "default": "null", "comment": [ - "Trigger fields are used to support any type of trigger order such as TP/SL" + "The error for the request" ] }, { - "name": "broker", - "lite_name": "b", - "semantic_type": "BrokerTag", - "json_type": "BrokerTag", + "name": "id", + "lite_name": "i", + "semantic_type": "uint32", + "json_type": "integer", "index": 3, "array_depth": 0, "optional": true, - "default": "", - "example": "'BROKER_CODE'", + "default": "0", + "example": "123", "comment": [ - "Specifies the broker who brokered the order" + "Optional Field which is used to match the response by the client.", + "If not passed, this field will not be returned.", + "Range: 0 to 4,294,967,295 (uint32)" ] - } - ], - "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": "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": "OrderState", + "name": "MiniTicker", "is_root": false, "fields": [ { - "name": "status", - "lite_name": "s", - "semantic_type": "OrderStatus", - "json_type": "OrderStatus", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", + "json_type": "string", "index": 0, "array_depth": 0, - "optional": false, + "optional": true, + "example": "'1697788800000000000'", "comment": [ - "The status of the order" + "Time at which the event was emitted in unix nanoseconds" ] }, { - "name": "reject_reason", - "lite_name": "rr", - "semantic_type": "OrderRejectReason", - "json_type": "OrderRejectReason", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 1, "array_depth": 0, - "optional": false, - "example": "'CLIENT_CANCEL'", + "optional": true, + "example": "'BTC_USDT_Perp'", "comment": [ - "The reason for rejection or cancellation" + "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": "book_size", - "lite_name": "bs", + "name": "mark_price", + "lite_name": "mp", "semantic_type": "string", "json_type": "string", "index": 2, - "array_depth": 1, - "optional": false, - "example": "['10.5']", + "array_depth": 0, + "optional": true, + "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, 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, - "optional": false, - "example": "['1.5']", + "array_depth": 0, + "optional": true, + "example": "'65038.01'", "comment": [ - "The total number of assets traded. Sorted in same order as Order.Legs" + "The index price of the instrument, expressed in `9` decimals" ] }, { - "name": "update_time", - "lite_name": "ut", - "semantic_type": "timestamp", + "name": "last_price", + "lite_name": "lp", + "semantic_type": "string", "json_type": "string", "index": 4, "array_depth": 0, - "optional": false, - "example": "'1697788800000000000'", + "optional": true, + "example": "'65038.01'", "comment": [ - "Time at which the order was updated by GRVT, expressed in unix nanoseconds" + "The last traded price of the instrument (also close price), expressed in `9` decimals" ] }, { - "name": "avg_fill_price", - "lite_name": "af", + "name": "last_size", + "lite_name": "ls", "semantic_type": "string", "json_type": "string", "index": 5, - "array_depth": 1, - "optional": false, - "example": "['60000.4']", + "array_depth": 0, + "optional": true, + "example": "'123456.78'", "comment": [ - "The average fill price of the order. Sorted in same order as Order.Legs" + "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" ] } ], @@ -9161,617 +9331,1686 @@ "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": [ + }, { - "name": "order", - "lite_name": "o", - "semantic_type": "Order", - "json_type": "Order", - "index": 0, + "name": "builder", + "lite_name": "b", + "semantic_type": "address", + "json_type": "string", + "index": 12, "array_depth": 0, "optional": false, + "example": "'$GRVT_MAIN_ACCOUNT_ID'", "comment": [ - "The order to create" + "The main account ID of the builder" ] - } - ], - "comment": [ - "Create an order on the orderbook for this trading account." - ] - }, - { - "name": "ApiCreateOrderResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "Order", - "json_type": "Order", - "index": 0, + "name": "builder_fee", + "lite_name": "bf", + "semantic_type": "string", + "json_type": "string", + "index": 13, "array_depth": 0, "optional": false, + "example": "0.001", "comment": [ - "The created order" + "Builder fee charged for this order, expressed as a percentage (e.g., 0.001 means 0.001%). " ] } ], - "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": "ApiCancelOrderRequest", - "is_root": true, + "name": "OrderLeg", + "is_root": false, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The subaccount ID cancelling the order" + "The instrument to trade in this leg" ] }, { - "name": "order_id", - "lite_name": "oi", - "semantic_type": "uint128", + "name": "size", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'0x1028403'", + "optional": false, + "example": "'10.5'", "comment": [ - "Cancel the order with this `order_id`" + "The total number of assets to trade in this leg, expressed in base asset decimal units." ] }, { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", + "name": "limit_price", + "lite_name": "lp", + "semantic_type": "string", "json_type": "string", "index": 2, "array_depth": 0, "optional": true, "default": "0", - "example": "'23042'", + "example": "'65038.01'", "comment": [ - "Cancel the order with this `client_order_id`" + "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": "time_to_live_ms", - "lite_name": "tt", - "semantic_type": "uint64", - "json_type": "string", + "name": "is_buying_asset", + "lite_name": "ib", + "semantic_type": "bool", + "json_type": "boolean", "index": 3, "array_depth": 0, - "optional": true, - "default": "100", - "example": "'500'", + "optional": false, + "example": "true", "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.", - "" + "Specifies if the order leg is a buy or sell" ] } ], - "comment": [ - "Cancel an order on the orderbook for this trading account. Either `order_id` or `client_order_id` must be provided." - ] + "comment": [] }, { - "name": "ApiCancelAllOrdersRequest", - "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 cancelling all orders" + "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": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", + "name": "create_time", + "lite_name": "ct", + "semantic_type": "timestamp", + "json_type": "string", "index": 1, - "array_depth": 1, + "array_depth": 0, "optional": true, - "default": "all", - "example": "['PERPETUAL']", + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be cancelled" + "[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds" ] }, { - "name": "base", - "lite_name": "b", - "semantic_type": "string", - "json_type": "string", + "name": "trigger", + "lite_name": "t", + "semantic_type": "TriggerOrderMetadata", + "json_type": "TriggerOrderMetadata", "index": 2, - "array_depth": 1, + "array_depth": 0, "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", + "default": "", "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be cancelled" + "Trigger fields are used to support any type of trigger order such as TP/SL" ] }, { - "name": "quote", - "lite_name": "q", - "semantic_type": "string", - "json_type": "string", + "name": "broker", + "lite_name": "b", + "semantic_type": "BrokerTag", + "json_type": "BrokerTag", "index": 3, - "array_depth": 1, + "array_depth": 0, "optional": true, - "default": "all", - "example": "['USDT', 'USDC']", + "default": "", + "example": "'BROKER_CODE'", "comment": [ - "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be cancelled" + "Specifies the broker who brokered the order" ] } ], "comment": [ - "Cancel all orders on the orderbook for this trading account. This may not match new orders in flight." + "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": "ApiOpenOrdersRequest", - "is_root": true, + "name": "OrderState", + "is_root": false, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", + "name": "status", + "lite_name": "s", + "semantic_type": "OrderStatus", + "json_type": "OrderStatus", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The subaccount ID to filter by" + "The status of the order" ] }, { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", + "name": "reject_reason", + "lite_name": "rr", + "semantic_type": "OrderRejectReason", + "json_type": "OrderRejectReason", "index": 1, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['PERPETUAL']", + "array_depth": 0, + "optional": false, + "example": "'CLIENT_CANCEL'", "comment": [ - "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" + "The reason for rejection or cancellation" ] }, { - "name": "base", - "lite_name": "b", + "name": "book_size", + "lite_name": "bs", "semantic_type": "string", "json_type": "string", "index": 2, "array_depth": 1, - "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", + "optional": false, + "example": "['10.5']", "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" + "The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs" ] }, { - "name": "quote", - "lite_name": "q", + "name": "traded_size", + "lite_name": "ts", "semantic_type": "string", "json_type": "string", "index": 3, "array_depth": 1, - "optional": true, - "default": "all", - "example": "['USDT', 'USDC']", + "optional": false, + "example": "['1.5']", "comment": [ - "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" + "The total number of assets traded. Sorted in same order as Order.Legs" ] - } - ], - "comment": [] - }, - { - "name": "ApiOpenOrdersResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "Order", - "json_type": "Order", - "index": 0, + "name": "update_time", + "lite_name": "ut", + "semantic_type": "timestamp", + "json_type": "string", + "index": 4, + "array_depth": 0, + "optional": false, + "example": "'1697788800000000000'", + "comment": [ + "Time at which the order was updated by GRVT, expressed in unix nanoseconds" + ] + }, + { + "name": "avg_fill_price", + "lite_name": "af", + "semantic_type": "string", + "json_type": "string", + "index": 5, "array_depth": 1, "optional": false, + "example": "['60000.4']", "comment": [ - "The Open Orders matching the request filter" + "The average fill price of the order. Sorted in same order as Order.Legs" ] } ], - "comment": [ - "Retrieves all open orders for the account. This may not match new orders in flight." - ] + "comment": [] }, { - "name": "ApiOrderHistoryRequest", - "is_root": true, + "name": "OrderStateFeed", + "is_root": false, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'10000101000203040506'", "comment": [ - "The subaccount ID to filter by" + "A unique 128-bit identifier for the order, deterministically generated within the GRVT backend" ] }, { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", + "name": "client_order_id", + "lite_name": "co", + "semantic_type": "uint64", + "json_type": "string", "index": 1, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['PERPETUAL']", + "array_depth": 0, + "optional": false, + "example": "'23042'", "comment": [ - "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" + "A unique identifier for the active order within a subaccount, specified by the client" ] }, { - "name": "base", - "lite_name": "b", - "semantic_type": "string", - "json_type": "string", + "name": "order_state", + "lite_name": "os", + "semantic_type": "OrderState", + "json_type": "OrderState", "index": 2, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", + "array_depth": 0, + "optional": false, "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" + "The order state object being created or updated" ] - }, + } + ], + "comment": [] + }, + { + "name": "OrderbookLevel", + "is_root": false, + "fields": [ { - "name": "quote", - "lite_name": "q", + "name": "price", + "lite_name": "p", "semantic_type": "string", "json_type": "string", - "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, + "index": 0, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "optional": false, + "example": "'65038.01'", "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 price of the level, expressed in `9` decimals" ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "int64", + "name": "size", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", - "index": 5, + "index": 1, "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", + "optional": false, + "example": "'3456.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 number of assets offered, expressed in base asset decimal units" ] }, { - "name": "limit", - "lite_name": "l", + "name": "num_orders", + "lite_name": "no", "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, + "index": 2, "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", + "optional": false, + "example": "'123'", "comment": [ - "The cursor to indicate when to start the query from" + "The number of open orders at this level" ] } ], - "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" - ] + "comment": [] }, { - "name": "ApiOrderHistoryResponse", - "is_root": true, + "name": "OrderbookLevels", + "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" ] }, { - "name": "next", - "lite_name": "n", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'Qw0918='", + "example": "'BTC_USDT_Perp'", "comment": [ - "The cursor to indicate when to start the query from" + "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": "EmptyRequest", - "is_root": true, - "fields": [], - "comment": [ - "Used for requests that do not require any parameters" - ] - }, - { - "name": "Ack", - "is_root": false, - "fields": [ + }, { - "name": "ack", + "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": "bool", - "json_type": "boolean", - "index": 0, - "array_depth": 0, + "semantic_type": "OrderbookLevel", + "json_type": "OrderbookLevel", + "index": 3, + "array_depth": 1, "optional": false, - "example": "'true'", "comment": [ - "Gravity has acknowledged that the request has been successfully received and it will process it in the backend" + "The list of best asks up till query depth" ] } ], "comment": [] }, { - "name": "AckResponse", - "is_root": true, + "name": "Positions", + "is_root": false, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "Ack", - "json_type": "Ack", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, + "example": "'1697788800000000000'", "comment": [ - "The Ack Object" + "Time at which the event was emitted in unix nanoseconds" ] - } - ], - "comment": [ - "Used to acknowledge a request has been received and will be processed" - ] - }, - { - "name": "ApiGetOrderRequest", - "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" + "The sub account ID that participated in the trade" ] }, { - "name": "order_id", - "lite_name": "oi", - "semantic_type": "uint128", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 1, + "index": 2, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'0x1028403'", + "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "Filter for `order_id`" + "The instrument being represented" ] }, { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", + "name": "size", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 3, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'23042'", + "optional": false, + "example": "'2635000.50'", "comment": [ - "Filter for `client_order_id`" + "The size of the position, expressed in base asset decimal units. Negative for short positions" ] - } - ], - "comment": [ - "Retrieve the order for the account. Either `order_id` or `client_order_id` must be provided." - ] - }, - { - "name": "ApiGetOrderResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "Order", - "json_type": "Order", - "index": 0, + "name": "notional", + "lite_name": "n", + "semantic_type": "string", + "json_type": "string", + "index": 4, "array_depth": 0, "optional": false, + "example": "'2635000.50'", "comment": [ - "The order object for the requested filter" + "The notional value of the position, negative for short assets, expressed in quote asset decimal units" ] - } - ], - "comment": [] - }, - { - "name": "ApiCancelOnDisconnectRequest", - "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": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'65038.01'", "comment": [ - "The subaccount ID cancelling the orders for" + "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": "countdown_time", - "lite_name": "ct", - "semantic_type": "uint64", + "name": "exit_price", + "lite_name": "ep1", + "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 6, "array_depth": 0, - "optional": true, - "default": "1000", - "example": "300", + "optional": false, + "example": "'65038.01'", "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.", + "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" + ] + }, + { + "name": "cumulative_fee", + "lite_name": "cf", + "semantic_type": "string", + "json_type": "string", + "index": 15, + "array_depth": 0, + "optional": false, + "example": "'100000.20'", + "comment": [ + "The cumulative fee paid on the position, expressed in quote asset decimal units" + ] + }, + { + "name": "cumulative_realized_funding_payment", + "lite_name": "cr", + "semantic_type": "string", + "json_type": "string", + "index": 16, + "array_depth": 0, + "optional": false, + "example": "'100000.20'", + "comment": [ + "The cumulative realized funding payment of the position, expressed in quote asset decimal units. Positive if paid, negative if received" + ] + }, + { + "name": "margin_type", + "lite_name": "mt", + "semantic_type": "PositionMarginType", + "json_type": "PositionMarginType", + "index": 17, + "array_depth": 0, + "optional": false, + "example": "'cross'", + "comment": [ + "The margin type of the position" + ] + }, + { + "name": "isolated_balance", + "lite_name": "ib", + "semantic_type": "string", + "json_type": "string", + "index": 18, + "array_depth": 0, + "optional": true, + "example": "'100000.20'", + "comment": [ + "[IsolatedOnly] The wallet balance reserved for this isolated margin position, expressed in quote asset decimal units. If this positions is liquidated, this is the maximal balance that can be lost" + ] + }, + { + "name": "isolated_im", + "lite_name": "ii", + "semantic_type": "string", + "json_type": "string", + "index": 19, + "array_depth": 0, + "optional": true, + "example": "'100000.20'", + "comment": [ + "[IsolatedOnly] The initial margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to open more size in the position" + ] + }, + { + "name": "isolated_mm", + "lite_name": "im", + "semantic_type": "string", + "json_type": "string", + "index": 20, + "array_depth": 0, + "optional": true, + "example": "'100000.20'", + "comment": [ + "[IsolatedOnly] The maintenance margin of the isolated margin position, expressed in quote asset decimal units. The `total_equity` required to avoid liquidation of the position" + ] + } + ], + "comment": [] + }, + { + "name": "PreMinRedemptions", + "is_root": false, + "fields": [ + { + "name": "requests", + "lite_name": "r", + "semantic_type": "VaultRedemptionRequest", + "json_type": "VaultRedemptionRequest", + "index": 0, + "array_depth": 1, + "optional": false, + "comment": [ + "Pre-minimum-age redemption requests, ordered by age (first element is the oldest request that is pre-minimum-age)." + ] + }, + { + "name": "token_count", + "lite_name": "tc", + "semantic_type": "string", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'1000000'", + "comment": [ + "Number of shares in the pre-minimum-age section of the vault's redemption queue." + ] + } + ], + "comment": [ + "Vault redemption queue section hidden from main view. All requests here have yet to age past the vault's minimum redemption period." + ] + }, + { + "name": "RiskBracket", + "is_root": false, + "fields": [ + { + "name": "tier", + "lite_name": "t", + "semantic_type": "uint32", + "json_type": "integer", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "1", + "comment": [ + "1-indexed tier number" + ] + }, + { + "name": "notional_floor", + "lite_name": "nf", + "semantic_type": "string", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'0'", + "comment": [ + "Lower bound of notional value (inclusive) in quote currency" + ] + }, + { + "name": "notional_cap", + "lite_name": "nc", + "semantic_type": "string", + "json_type": "string", + "index": 2, + "array_depth": 0, + "optional": false, + "example": "'600000'", + "comment": [ + "Upper bound of notional value (exclusive) in quote currency, empty for last tier" + ] + }, + { + "name": "maintenance_margin_rate", + "lite_name": "mm", + "semantic_type": "string", + "json_type": "string", + "index": 3, + "array_depth": 0, + "optional": false, + "example": "'0.01'", + "comment": [ + "Maintenance margin rate as a decimal (e.g., '0.01' for 1%)" + ] + }, + { + "name": "initial_margin_rate", + "lite_name": "im", + "semantic_type": "string", + "json_type": "string", + "index": 4, + "array_depth": 0, + "optional": false, + "example": "'0.02'", + "comment": [ + "Initial margin rate as a decimal (e.g., '0.02' for 2%)" + ] + }, + { + "name": "max_leverage", + "lite_name": "ml", + "semantic_type": "uint32", + "json_type": "integer", + "index": 5, + "array_depth": 0, + "optional": false, + "example": "50", + "comment": [ + "Maximum leverage allowed at this tier (floor of 1 / initial_margin_rate)" + ] + }, + { + "name": "cumulative_maintenance_amount", + "lite_name": "cm", + "semantic_type": "string", + "json_type": "string", + "index": 6, + "array_depth": 0, + "optional": false, + "example": "'0'", + "comment": [ + "Cumulative maintenance margin amount in quote currency" + ] + } + ], + "comment": [] + }, + { + "name": "Signature", + "is_root": false, + "fields": [ + { + "name": "signer", + "lite_name": "s", + "semantic_type": "uint256", + "json_type": "string", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "comment": [ + "The address (public key) of the wallet signing the payload" + ] + }, + { + "name": "r", + "lite_name": "r", + "semantic_type": "uint256", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8'", + "comment": [ + "Signature R" + ] + }, + { + "name": "s", + "lite_name": "s1", + "semantic_type": "uint256", + "json_type": "string", + "index": 2, + "array_depth": 0, + "optional": false, + "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": [ + "Signature V" + ] + }, + { + "name": "expiration", + "lite_name": "e", + "semantic_type": "timestamp", + "json_type": "string", + "index": 4, + "array_depth": 0, + "optional": false, + "example": "'1697788800000000000'", + "comment": [ + "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.", + "Range: 0 to 4,294,967,295 (uint32)" + ] + }, + { + "name": "chain_id", + "lite_name": "ci", + "semantic_type": "uint64", + "json_type": "string", + "index": 6, + "array_depth": 0, + "optional": false, + "example": "'325'", + "comment": [ + "Chain ID used in EIP-712 domain. Zero value fallbacks to GRVT Chain ID." + ] + } + ], + "comment": [] + }, + { + "name": "SpotBalance", + "is_root": false, + "fields": [ + { + "name": "currency", + "lite_name": "c", + "semantic_type": "string", + "json_type": "string", + "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": "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": "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": "string", + "json_type": "string", + "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", "", - "Maximum acceptable value is 300,000" + "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`)" + ] + }, + { + "name": "is_vault", + "lite_name": "iv", + "semantic_type": "bool", + "json_type": "boolean", + "index": 12, + "array_depth": 0, + "optional": true, + "comment": [ + "Whether this sub account is a vault" + ] + }, + { + "name": "vault_im_additions", + "lite_name": "vi", + "semantic_type": "string", + "json_type": "string", + "index": 13, + "array_depth": 0, + "optional": true, + "example": "'123456.78'", + "comment": [ + "Total amount of IM (reported in `settle_currency`) deducted from the vault due to redemptions nearing the end of their redemption period" + ] + }, + { + "name": "derisk_margin", + "lite_name": "dm", + "semantic_type": "string", + "json_type": "string", + "index": 14, + "array_depth": 0, + "optional": false, + "example": "'185185.77'", + "comment": [ + "The derisk margin of this sub account" + ] + }, + { + "name": "derisk_to_maintenance_margin_ratio", + "lite_name": "dt", + "semantic_type": "string", + "json_type": "string", + "index": 15, + "array_depth": 0, + "optional": false, + "example": "'1.5'", + "comment": [ + "The derisk margin to maintenance margin ratio of this sub account" + ] + }, + { + "name": "total_cross_equity", + "lite_name": "tc", + "semantic_type": "string", + "json_type": "string", + "index": 16, + "array_depth": 0, + "optional": false, + "example": "'123456.78'", + "comment": [ + "The total equity of this sub account for cross margin" + ] + }, + { + "name": "cross_unrealized_pnl", + "lite_name": "cu", + "semantic_type": "string", + "json_type": "string", + "index": 17, + "array_depth": 0, + "optional": false, + "example": "'123456.78'", + "comment": [ + "The unrealized PnL of this sub account for cross margin" + ] + } + ], + "comment": [] + }, + { + "name": "TPSLOrderMetadata", + "is_root": false, + "fields": [ + { + "name": "trigger_by", + "lite_name": "tb", + "semantic_type": "TriggerBy", + "json_type": "TriggerBy", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "'LAST'", + "comment": [ + "Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order" + ] + }, + { + "name": "trigger_price", + "lite_name": "tp", + "semantic_type": "string", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'65038.10'", + "comment": [ + "The Trigger Price of the order, expressed in `9` decimals." + ] + }, + { + "name": "close_position", + "lite_name": "cp", + "semantic_type": "bool", + "json_type": "boolean", + "index": 2, + "array_depth": 0, + "optional": false, + "example": "false", + "comment": [ + "If True, the order will close the position when the trigger price is reached" + ] + } + ], + "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": "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": [ + "DEPRECATED: To be removed in a future release. Please refer to the field `funding_rate` instead, for the funding rate being applied over `funding_interval_hours` (interval ending at `next_funding_time`)." + ] + }, + { + "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": [ + "DEPRECATED: To be removed in a future release. Please refer to the field `funding_rate` instead, for the funding rate being applied over `funding_interval_hours` (interval ending at `next_funding_time`)." + ] + }, + { + "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" + ] + }, + { + "name": "funding_rate", + "lite_name": "fr2", + "semantic_type": "string", + "json_type": "string", + "index": 24, + "array_depth": 0, + "optional": true, + "example": "0.0003", + "comment": [ + "The current indicative funding rate for the active interval, expressed in centibeeps" + ] + }, + { + "name": "next_funding_time", + "lite_name": "nf", + "semantic_type": "timestamp", + "json_type": "string", + "index": 26, + "array_depth": 0, + "optional": true, + "example": "'1697788800000000000'", + "comment": [ + "Timestamp in nanoseconds when the current funding interval ends" ] } ], "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.", + "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`)", "", - "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." + "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": "WSOrderFeedSelectorV1", - "is_root": true, + "name": "Trade", + "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 to filter by" - ], - "selector": "primary" + "Time at which the event was emitted in unix nanoseconds" + ] }, { "name": "instrument", @@ -9780,683 +11019,779 @@ "json_type": "string", "index": 1, "array_depth": 0, - "optional": true, - "default": "'all'", - "example": "'BTC_USDT_Perp'", + "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" + ] + }, + { + "name": "is_rpi", + "lite_name": "ir1", + "semantic_type": "bool", + "json_type": "boolean", + "index": 13, + "array_depth": 0, + "optional": false, + "example": "false", "comment": [ - "The instrument filter to apply." - ], - "selector": "primary" + "If the trade is a RPI trade" + ] } ], "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`)." + "All private RFQs and Private AXEs will be filtered out from the responses" ] }, { - "name": "WSOrderFeedDataV1", - "is_root": true, + "name": "TransferHistory", + "is_root": false, "fields": [ { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", + "name": "tx_id", + "lite_name": "ti", + "semantic_type": "uint64", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.order'", + "example": "'1028403'", "comment": [ - "Stream name" + "The transaction ID of the transfer" ] }, { - "name": "selector", - "lite_name": "s1", - "semantic_type": "string", + "name": "from_account_id", + "lite_name": "fa", + "semantic_type": "address", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "Primary selector" + "The account to transfer from" ] }, { - "name": "sequence_number", - "lite_name": "sn", + "name": "from_sub_account_id", + "lite_name": "fs", "semantic_type": "uint64", "json_type": "string", "index": 2, "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 to transfer from (0 if transferring from main account)" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "Order", - "json_type": "Order", + "name": "to_account_id", + "lite_name": "ta", + "semantic_type": "address", + "json_type": "string", "index": 3, "array_depth": 0, "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "The order object being created or updated" + "The account to deposit into" ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", + "name": "to_sub_account_id", + "lite_name": "ts", "semantic_type": "uint64", "json_type": "string", "index": 4, "array_depth": 0, "optional": false, - "example": "'872634875'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The previous sequence number that determines the message order" + "The subaccount to transfer to (0 if transferring to main account)" ] - } - ], - "comment": [] - }, - { - "name": "WSOrderStateFeedSelectorV1", - "is_root": true, - "fields": [ + }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "currency", + "lite_name": "c", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 5, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'USDT'", "comment": [ - "The subaccount ID to filter by" - ], - "selector": "primary" + "The token currency to transfer" + ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "num_tokens", + "lite_name": "nt", + "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 6, "array_depth": 0, - "optional": true, - "default": "'all'", - "example": "'BTC_USDT_Perp'", + "optional": false, + "example": "'1500.0'", "comment": [ - "The instrument filter to apply." - ], - "selector": "primary" - } - ], - "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`)." - ] - }, - { - "name": "OrderStateFeed", - "is_root": false, - "fields": [ + "The number of tokens to transfer" + ] + }, { - "name": "order_id", - "lite_name": "oi", - "semantic_type": "uint128", - "json_type": "string", - "index": 0, + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 7, "array_depth": 0, "optional": false, - "example": "'10000101000203040506'", "comment": [ - "A unique 128-bit identifier for the order, deterministically generated within the GRVT backend" + "The signature of the transfer" ] }, { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", "json_type": "string", - "index": 1, + "index": 8, "array_depth": 0, "optional": false, - "example": "'23042'", + "example": "'1697788800000000000'", "comment": [ - "A unique identifier for the active order within a subaccount, specified by the client" + "The timestamp of the transfer in unix nanoseconds" ] }, { - "name": "order_state", - "lite_name": "os", - "semantic_type": "OrderState", - "json_type": "OrderState", - "index": 2, + "name": "transfer_type", + "lite_name": "tt", + "semantic_type": "TransferType", + "json_type": "TransferType", + "index": 9, "array_depth": 0, "optional": false, "comment": [ - "The order state object being created or updated" + "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": "WSOrderStateFeedDataV1", - "is_root": true, + "name": "TriggerOrderMetadata", + "is_root": false, "fields": [ { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", + "name": "trigger_type", + "lite_name": "tt", + "semantic_type": "TriggerType", + "json_type": "TriggerType", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.state'", + "example": "'TAKE_PROFIT'", "comment": [ - "Stream name" + "Type of the trigger order. eg: Take Profit, Stop Loss, etc" ] }, { - "name": "selector", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", + "name": "tpsl", + "lite_name": "t", + "semantic_type": "TPSLOrderMetadata", + "json_type": "TPSLOrderMetadata", "index": 1, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", "comment": [ - "Primary selector" + "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": "VaultInvestment", + "is_root": false, + "fields": [ { - "name": "sequence_number", - "lite_name": "sn", + "name": "vault_id", + "lite_name": "vi", "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": "OrderStateFeed", - "json_type": "OrderStateFeed", - "index": 3, + "index": 0, "array_depth": 0, "optional": false, + "example": "123456789", "comment": [ - "The Order State Feed" + "The trading account ID of the vault invested in." ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", + "name": "num_lp_tokens", + "lite_name": "nl", + "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 1, "array_depth": 0, "optional": false, - "example": "'872634875'", + "example": "1000000", "comment": [ - "The previous sequence number that determines the message order" + "The number of shares held by the investor." ] - } - ], - "comment": [] - }, - { - "name": "WSPositionsFeedSelectorV1", - "is_root": true, - "fields": [ + }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "share_price", + "lite_name": "sp", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 2, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "1000000", "comment": [ - "The subaccount ID to filter by" - ], - "selector": "primary" + "The current share price (in USD) of this vault investment." + ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "usd_notional_invested", + "lite_name": "un", + "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 3, "array_depth": 0, - "optional": true, - "default": "'all'", - "example": "'BTC_USDT_Perp'", + "optional": false, + "example": "1000000", "comment": [ - "The instrument filter to apply." - ], - "selector": "primary" + "The USD notional invested in this vault investment." + ] } ], "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`)." + "Summarizes a vault investment held by a funding account" ] }, { - "name": "WSPositionsFeedDataV1", - "is_root": true, + "name": "VaultInvestorSummary", + "is_root": false, "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.position'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "Stream name" + "The unique identifier of the vault sub account." ] }, { - "name": "selector", - "lite_name": "s1", + "name": "num_lp_tokens", + "lite_name": "nl", "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "1000000", "comment": [ - "Primary selector" + "The number of Vault LP tokens held by the investor." ] }, { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", + "name": "avg_entry_price", + "lite_name": "ae", + "semantic_type": "string", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "'872634876'", + "example": "1000000", "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 average entry price (in USD) of the vault LP tokens." ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "Positions", - "json_type": "Positions", + "name": "current_price", + "lite_name": "cp", + "semantic_type": "string", + "json_type": "string", "index": 3, "array_depth": 0, "optional": false, + "example": "1000000", "comment": [ - "A Position being created or updated matching the request filter" + "The current price (in USD) of the vault LP tokens." ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", + "name": "total_equity", + "lite_name": "te", + "semantic_type": "string", "json_type": "string", "index": 4, "array_depth": 0, "optional": false, - "example": "'872634875'", + "example": "1000000", "comment": [ - "The previous sequence number that determines the message order" + "The current valuation (in USD) of all held vault LP tokens." ] - } - ], - "comment": [] - }, - { - "name": "WSFillFeedSelectorV1", - "is_root": true, - "fields": [ + }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "all_time_realized_pnl", + "lite_name": "at", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 5, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "1000000", "comment": [ - "The sub account ID to request for" - ], - "selector": "primary" + "The all-time realized PnL (in USD) that the investor has received from the vault." + ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 1, + "name": "pending_redemption", + "lite_name": "pr", + "semantic_type": "VaultRedemption", + "json_type": "VaultRedemption", + "index": 6, "array_depth": 0, "optional": true, - "default": "'all'", - "example": "'BTC_USDT_Perp'", "comment": [ - "The instrument filter to apply." - ], - "selector": "primary" + "The singleton pending redemption (omitted if none)." + ] + }, + { + "name": "can_burn", + "lite_name": "cb", + "semantic_type": "bool", + "json_type": "boolean", + "index": 7, + "array_depth": 0, + "optional": true, + "default": "true", + "comment": [ + "True if the requesting account is authorized to burn tokens on this vault, omitted otherwise." + ] } ], "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`)." + "Vault investor summary information.", + "", + "This struct contains the summary of investments in a vault." ] }, { - "name": "WSFillFeedDataV1", - "is_root": true, + "name": "VaultRedemption", + "is_root": false, "fields": [ { - "name": "stream", - "lite_name": "s", + "name": "num_lp_tokens", + "lite_name": "nl", "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.fill'", + "example": "1000000", "comment": [ - "The websocket channel to which the response is sent" + "The number of LP Tokens requested for redemption." ] }, { - "name": "selector", - "lite_name": "s1", + "name": "request_valuation", + "lite_name": "rv", "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "1000000", "comment": [ - "Primary selector" + "The valuation (in USD) of the redemption request." ] }, { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", + "name": "request_time", + "lite_name": "rt", + "semantic_type": "timestamp", "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": "Fill", - "json_type": "Fill", - "index": 3, - "array_depth": 0, - "optional": false, + "example": "'1697788800000000000'", "comment": [ - "A private trade matching the request filter" + "[Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds" ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", + "name": "max_redemption_period_timestamp", + "lite_name": "mr", + "semantic_type": "timestamp", "json_type": "string", - "index": 4, + "index": 3, "array_depth": 0, "optional": false, - "example": "'872634875'", + "example": "1727788800000000000", "comment": [ - "The previous sequence number that determines the message order" + "[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed." ] - } - ], - "comment": [] - }, - { - "name": "WSTransferFeedSelectorV1", - "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": "'$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, + "name": "cancel_blocked", + "lite_name": "cb", + "semantic_type": "bool", + "json_type": "boolean", + "index": 4, "array_depth": 0, "optional": true, - "default": "'0'", - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "default": "true", "comment": [ - "The sub account ID to request for" - ], - "selector": "primary" + "Omitted for redemption requests to non-cross exchange vaults. True if cancellation is blocked within the CEV allocation allowance for the user's current tier (e.g. because the user has already transferred out the spot balance underlying the redemption request)." + ] } ], "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`)." + "Vault redemption information.", + "", + "This struct contains information about a pending redemption from a vault." ] }, { - "name": "TransferHistory", + "name": "VaultRedemptionRequest", "is_root": false, "fields": [ { - "name": "tx_id", - "lite_name": "ti", - "semantic_type": "uint64", + "name": "request_time", + "lite_name": "rt", + "semantic_type": "timestamp", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'1028403'", + "example": "'1697788800000000000'", "comment": [ - "The transaction ID of the transfer" + "[Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds" ] }, { - "name": "from_account_id", - "lite_name": "fa", - "semantic_type": "address", + "name": "num_lp_tokens", + "lite_name": "nl", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "example": "'1000000'", "comment": [ - "The account to transfer from" + "The number of shares to redeem" ] }, { - "name": "from_sub_account_id", - "lite_name": "fs", - "semantic_type": "uint64", + "name": "max_redemption_period_timestamp", + "lite_name": "mr", + "semantic_type": "timestamp", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'1727788800000000000'", "comment": [ - "The subaccount to transfer from (0 if transferring from main account)" + "[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed." ] }, { - "name": "to_account_id", - "lite_name": "ta", - "semantic_type": "address", - "json_type": "string", + "name": "age_category", + "lite_name": "ac", + "semantic_type": "VaultRedemptionReqAgeCategory", + "json_type": "VaultRedemptionReqAgeCategory", "index": 3, "array_depth": 0, "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "example": "'NORMAL'", "comment": [ - "The account to deposit into" + "Age category of this redemption request." ] }, { - "name": "to_sub_account_id", - "lite_name": "ts", - "semantic_type": "uint64", - "json_type": "string", + "name": "is_manager", + "lite_name": "im", + "semantic_type": "bool", + "json_type": "boolean", "index": 4, "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "optional": true, + "example": "true", "comment": [ - "The subaccount to transfer to (0 if transferring to main account)" + "`true` if this request belongs to the vault manager, omitted otherwise." ] }, { - "name": "currency", - "lite_name": "c", - "semantic_type": "string", + "name": "eligible_for_auto_redemption_timestamp", + "lite_name": "ef", + "semantic_type": "timestamp", "json_type": "string", "index": 5, "array_depth": 0, "optional": false, - "example": "'USDT'", + "example": "'1727788800000000000'", "comment": [ - "The token currency to transfer" + "[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be eligible for automated redemption." ] - }, + } + ], + "comment": [ + "Representation of a pending redemption request for a given vault." + ] + }, + { + "name": "WSCancelFeedDataV1", + "is_root": true, + "fields": [ { - "name": "num_tokens", - "lite_name": "nt", + "name": "stream", + "lite_name": "s", "semantic_type": "string", "json_type": "string", - "index": 6, + "index": 0, "array_depth": 0, "optional": false, - "example": "'1500.0'", + "example": "'v1.cancel'", "comment": [ - "The number of tokens to transfer" + "Stream name" ] }, { - "name": "signature", - "lite_name": "s", - "semantic_type": "Signature", - "json_type": "Signature", - "index": 7, + "name": "selector", + "lite_name": "s1", + "semantic_type": "string", + "json_type": "string", + "index": 1, "array_depth": 0, "optional": false, + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The signature of the transfer" + "Primary selector" ] }, { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "sequence_number", + "lite_name": "sn", + "semantic_type": "uint64", "json_type": "string", - "index": 8, + "index": 2, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'872634876'", "comment": [ - "The timestamp of the transfer in unix nanoseconds" + "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": "transfer_type", - "lite_name": "tt", - "semantic_type": "TransferType", - "json_type": "TransferType", - "index": 9, + "name": "feed", + "lite_name": "f", + "semantic_type": "CancelStatusFeed", + "json_type": "CancelStatusFeed", + "index": 3, "array_depth": 0, "optional": false, "comment": [ - "The type of transfer" + "Data relating to the status of the cancellation attempt" ] }, { - "name": "transfer_metadata", - "lite_name": "tm", - "semantic_type": "string", + "name": "prev_sequence_number", + "lite_name": "ps", + "semantic_type": "uint64", "json_type": "string", - "index": 10, + "index": 4, "array_depth": 0, "optional": false, + "example": "'872634875'", "comment": [ - "The metadata of the transfer" + "The previous sequence number that determines the message order" ] } ], "comment": [] }, { - "name": "WSTransferFeedDataV1", + "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`.", + "" + ] + }, + { + "name": "WSCandlestickFeedDataV1", "is_root": true, "fields": [ { @@ -10467,9 +11802,9 @@ "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.transfer'", + "example": "'v1.candle'", "comment": [ - "The websocket channel to which the response is sent" + "Stream name" ] }, { @@ -10506,13 +11841,13 @@ { "name": "feed", "lite_name": "f", - "semantic_type": "TransferHistory", - "json_type": "TransferHistory", + "semantic_type": "Candlestick", + "json_type": "Candlestick", "index": 3, "array_depth": 0, "optional": false, "comment": [ - "The transfer history matching the requested filters" + "A candlestick entry matching the request filters" ] }, { @@ -10529,92 +11864,57 @@ ] } ], - "comment": [ - "Subscribes to a feed of transfer updates." - ] + "comment": [] }, { - "name": "WSDepositFeedSelectorV1", + "name": "WSCandlestickFeedSelectorV1", "is_root": true, "fields": [ { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_MAIN_ACCOUNT_ID'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The main account ID to request for" + "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" - } - ], - "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": [ - "The hash of the bridgemint event producing the deposit" - ] - }, - { - "name": "to_account_id", - "lite_name": "ta", - "semantic_type": "address", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", - "comment": [ - "The account to deposit into" - ] }, { - "name": "currency", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", - "index": 2, + "name": "interval", + "lite_name": "i1", + "semantic_type": "CandlestickInterval", + "json_type": "CandlestickInterval", + "index": 1, "array_depth": 0, "optional": false, - "example": "'USDT'", "comment": [ - "The token currency to deposit" - ] + "The interval of each candlestick" + ], + "selector": "secondary" }, { - "name": "num_tokens", - "lite_name": "nt", - "semantic_type": "string", - "json_type": "string", - "index": 3, + "name": "type", + "lite_name": "t", + "semantic_type": "CandlestickType", + "json_type": "CandlestickType", + "index": 2, "array_depth": 0, "optional": false, - "example": "'10.50'", "comment": [ - "The number of tokens to deposit" - ] + "The type of candlestick data to retrieve" + ], + "selector": "secondary" } ], - "comment": [] + "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": "WSDepositFeedDataV1", @@ -10695,7 +11995,7 @@ ] }, { - "name": "WSWithdrawalFeedSelectorV1", + "name": "WSDepositFeedSelectorV1", "is_root": true, "fields": [ { @@ -10714,83 +12014,157 @@ } ], "comment": [ - "Subscribes to a feed of withdrawals. This will execute when there is any withdrawal from the selected account.", + "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": "Withdrawal", - "is_root": false, + "name": "WSFillFeedDataV1", + "is_root": true, "fields": [ { - "name": "from_account_id", - "lite_name": "fa", - "semantic_type": "address", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "example": "'v1.fill'", "comment": [ - "The subaccount to withdraw from" + "The websocket channel to which the response is sent" ] }, { - "name": "to_eth_address", - "lite_name": "te", - "semantic_type": "address", + "name": "selector", + "lite_name": "s1", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The ethereum address to withdraw to" + "Primary selector" ] }, { - "name": "currency", - "lite_name": "c", - "semantic_type": "string", + "name": "sequence_number", + "lite_name": "sn", + "semantic_type": "uint64", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "'USDT'", + "example": "'872634876'", "comment": [ - "The token currency to withdraw" + "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_tokens", - "lite_name": "nt", - "semantic_type": "string", - "json_type": "string", + "name": "feed", + "lite_name": "f", + "semantic_type": "Fill", + "json_type": "Fill", "index": 3, "array_depth": 0, "optional": false, - "example": "'10.50'", "comment": [ - "The number of tokens to withdraw" + "A private trade matching the request filter" ] }, { - "name": "signature", - "lite_name": "s", - "semantic_type": "Signature", - "json_type": "Signature", + "name": "prev_sequence_number", + "lite_name": "ps", + "semantic_type": "uint64", + "json_type": "string", "index": 4, "array_depth": 0, "optional": false, + "example": "'872634875'", "comment": [ - "The signature of the withdrawal" + "The previous sequence number that determines the message order" ] } ], "comment": [] }, { - "name": "WSWithdrawalFeedDataV1", + "name": "WSFillFeedSelectorV1", + "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" + ], + "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 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": "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": "WSMiniTickerFeedDataV1", "is_root": true, "fields": [ { @@ -10801,9 +12175,9 @@ "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.withdrawal'", + "example": "'v1.mini.s'", "comment": [ - "The websocket channel to which the response is sent" + "Stream name" ] }, { @@ -10840,13 +12214,13 @@ { "name": "feed", "lite_name": "f", - "semantic_type": "Withdrawal", - "json_type": "Withdrawal", + "semantic_type": "MiniTicker", + "json_type": "MiniTicker", "index": 3, "array_depth": 0, "optional": false, "comment": [ - "The Withdrawal object" + "A mini ticker matching the request filter" ] }, { @@ -10863,96 +12237,54 @@ ] } ], - "comment": [ - "Subscribes to a feed of withdrawal updates." - ] + "comment": [] }, { - "name": "CancelStatusFeed", - "is_root": false, + "name": "WSMiniTickerFeedSelectorV1", + "is_root": true, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The subaccount ID that requested the cancellation" - ] - }, - { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", - "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'", + "example": "'BTC_USDT_Perp'", "comment": [ - "[Filled by GRVT Backend] Time at which the cancellation status was updated by GRVT in unix nanoseconds" - ] + "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": "cancel_status", - "lite_name": "cs", - "semantic_type": "CancelStatus", - "json_type": "CancelStatus", - "index": 5, + "name": "rate", + "lite_name": "r", + "semantic_type": "uint32", + "json_type": "integer", + "index": 1, "array_depth": 0, "optional": false, + "example": "500", "comment": [ - "Status of the cancellation attempt" - ] + "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": "WSCancelFeedDataV1", + "name": "WSOrderFeedDataV1", "is_root": true, "fields": [ { @@ -10963,7 +12295,7 @@ "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.cancel'", + "example": "'v1.order'", "comment": [ "Stream name" ] @@ -10976,7 +12308,7 @@ "index": 1, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'BTC_USDT_Perp'", "comment": [ "Primary selector" ] @@ -11002,13 +12334,13 @@ { "name": "feed", "lite_name": "f", - "semantic_type": "CancelStatusFeed", - "json_type": "CancelStatusFeed", + "semantic_type": "Order", + "json_type": "Order", "index": 3, "array_depth": 0, "optional": false, "comment": [ - "Data relating to the status of the cancellation attempt" + "The order object being created or updated" ] }, { @@ -11028,7 +12360,7 @@ "comment": [] }, { - "name": "WSCancelFeedSelectorV1", + "name": "WSOrderFeedSelectorV1", "is_root": true, "fields": [ { @@ -11044,1622 +12376,1491 @@ "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`.", - "" - ] - }, - { - "name": "ApiWithdrawalRequest", - "is_root": true, - "fields": [ - { - "name": "from_account_id", - "lite_name": "fa", - "semantic_type": "address", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", - "comment": [ - "The main account to withdraw from" - ] }, { - "name": "to_eth_address", - "lite_name": "te", - "semantic_type": "address", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 1, "array_depth": 0, - "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", - "comment": [ - "The Ethereum wallet to withdraw into" - ] - }, - { - "name": "currency", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", - "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": "'1500.0'", - "comment": [ - "The number of tokens to withdraw, quoted in tokenCurrency decimal units" - ] - }, - { - "name": "signature", - "lite_name": "s", - "semantic_type": "Signature", - "json_type": "Signature", - "index": 4, - "array_depth": 0, - "optional": false, + "optional": true, + "default": "'all'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The signature of the withdrawal" - ] + "The instrument filter to apply." + ], + "selector": "primary" } ], "comment": [ - "Leverage this API to initialize a withdrawal from GRVT's Hyperchain onto Ethereum.", - "Do take note that the bridging process does take time. The GRVT UI will help you keep track of bridging progress, and notify you once its complete.", - "", - "If not withdrawing the entirety of your balance, there is a minimum withdrawal amount. Currently that amount is ~25 USDT.", - "Withdrawal fees also apply to cover the cost of the Ethereum transaction.", - "Note that your funds will always remain in self-custory throughout the withdrawal process. At no stage does GRVT gain control over your funds." + "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": "ApiTransferRequest", + "name": "WSOrderStateFeedDataV1", "is_root": true, "fields": [ { - "name": "from_account_id", - "lite_name": "fa", - "semantic_type": "address", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", - "comment": [ - "The main account to transfer from" - ] - }, - { - "name": "from_sub_account_id", - "lite_name": "fs", - "semantic_type": "uint64", - "json_type": "string", - "index": 1, - "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": 2, - "array_depth": 0, - "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", - "comment": [ - "The main account to deposit into" - ] - }, - { - "name": "to_sub_account_id", - "lite_name": "ts", - "semantic_type": "uint64", - "json_type": "string", - "index": 3, - "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", + "name": "stream", + "lite_name": "s", "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 0, "array_depth": 0, "optional": false, - "example": "'USDT'", + "example": "'v1.state'", "comment": [ - "The token currency to transfer" + "Stream name" ] }, { - "name": "num_tokens", - "lite_name": "nt", + "name": "selector", + "lite_name": "s1", "semantic_type": "string", "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": false, - "example": "'1500.0'", - "comment": [ - "The number of tokens to transfer, quoted in tokenCurrency decimal units" - ] - }, - { - "name": "signature", - "lite_name": "s", - "semantic_type": "Signature", - "json_type": "Signature", - "index": 6, - "array_depth": 0, - "optional": false, - "comment": [ - "The signature of the transfer" - ] - }, - { - "name": "transfer_type", - "lite_name": "tt", - "semantic_type": "TransferType", - "json_type": "TransferType", - "index": 7, + "index": 1, "array_depth": 0, "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The type of transfer" + "Primary selector" ] }, { - "name": "transfer_metadata", - "lite_name": "tm", - "semantic_type": "string", - "json_type": "string", - "index": 8, - "array_depth": 0, - "optional": false, - "example": "{\"provider\":\"XY\",\"direction\":\"WITHDRAWAL\",\"provider_tx_id\":\"txn123456\",\"chainid\":\"42161\",\"endpoint\":\"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0\"}", - "comment": [ - "The metadata of the transfer" - ] - } - ], - "comment": [ - "This API allows you to transfer funds in multiple different ways\u003cul\u003e", - "\u003cli\u003eBetween SubAccounts within your Main Account\u003c/li\u003e", - "\u003cli\u003eBetween your MainAccount and your SubAccounts\u003c/li\u003e", - "\u003cli\u003eTo other MainAccounts that you have previously allowlisted\u003c/li\u003e", - "\u003c/ul\u003e\u003cb\u003eFast Withdrawal Funding Address\u003c/b\u003e", - "For fast withdrawals, funds must be sent to the designated funding account address. Please ensure you use the correct address based on the environment:", - "\u003cb\u003eProduction Environment Address:\u003c/b\u003e", - "\u003cem\u003e[To be updated, not ready yet]\u003c/em\u003e", - "This address should be specified as the \u003ccode\u003eto_account_id\u003c/code\u003e in your API requests for transferring funds using the transfer API. Ensure accurate input to avoid loss of funds or use the UI.", - "" - ] - }, - { - "name": "ApiTransferAck", - "is_root": false, - "fields": [ - { - "name": "ack", - "lite_name": "a", - "semantic_type": "bool", - "json_type": "boolean", - "index": 0, + "name": "sequence_number", + "lite_name": "sn", + "semantic_type": "uint64", + "json_type": "string", + "index": 2, "array_depth": 0, "optional": false, - "example": "'true'", + "example": "'872634876'", "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." + "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": "tx_id", - "lite_name": "ti", + "name": "feed", + "lite_name": "f", + "semantic_type": "OrderStateFeed", + "json_type": "OrderStateFeed", + "index": 3, + "array_depth": 0, + "optional": false, + "comment": [ + "The Order State Feed" + ] + }, + { + "name": "prev_sequence_number", + "lite_name": "ps", "semantic_type": "uint64", "json_type": "string", - "index": 1, + "index": 4, "array_depth": 0, "optional": false, - "example": "'1028403'", + "example": "'872634875'", "comment": [ - "The transaction ID of the transfer. This is only returned if the transfer is successful." + "The previous sequence number that determines the message order" ] } ], "comment": [] }, { - "name": "ApiTransferResponse", + "name": "WSOrderStateFeedSelectorV1", "is_root": true, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "ApiTransferAck", - "json_type": "ApiTransferAck", + "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 Transfer response object" - ] + "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": [ - "Used to acknowledge a transfer request outcome" + "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": "ApiDepositHistoryRequest", + "name": "WSOrderbookLevelsFeedDataV1", "is_root": true, "fields": [ { - "name": "currency", - "lite_name": "c", + "name": "stream", + "lite_name": "s", "semantic_type": "string", "json_type": "string", "index": 0, - "array_depth": 1, + "array_depth": 0, "optional": false, - "example": "['USDT', 'USDC']", + "example": "'v1.book.s'", "comment": [ - "The token currency to query for, if nil or empty, return all deposits. Otherwise, only entries matching the filter will be returned" + "Stream name" ] }, { - "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": true, - "default": "0", - "example": "'1697788800000000000'", + "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The start time to query for in unix nanoseconds" + "Primary selector" ] }, { - "name": "end_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": true, - "default": "now()", - "example": "'1697788800000000000'", + "optional": false, + "example": "'872634876'", "comment": [ - "The end time to query for in unix nanoseconds" + "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": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", + "name": "feed", + "lite_name": "f", + "semantic_type": "OrderbookLevels", + "json_type": "OrderbookLevels", "index": 3, "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", + "optional": false, "comment": [ - "The limit to query for. Defaults to 500; Max 1000" + "An orderbook levels object matching the request filter" ] }, { - "name": "cursor", - "lite_name": "c1", - "semantic_type": "string", + "name": "prev_sequence_number", + "lite_name": "ps", + "semantic_type": "uint64", "json_type": "string", "index": 4, "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", - "comment": [ - "The cursor to indicate when to start the next query from" - ] - }, - { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", - "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": true, - "default": "", - "example": "", + "optional": false, + "example": "'872634875'", "comment": [ - "Main account ID being queried. By default, applies the requestor's main account ID." + "The previous sequence number that determines the message order" ] } ], - "comment": [ - "The request to get the historical deposits of an account", - "The history is returned in reverse chronological order", - "", - "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" - ] + "comment": [] }, { - "name": "DepositHistory", - "is_root": false, + "name": "WSOrderbookLevelsFeedSelectorV1", + "is_root": true, "fields": [ { - "name": "l_1_hash", - "lite_name": "l1", - "semantic_type": "uint256", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'0x10000101000203040506'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The L1 txHash of the deposit" - ] + "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": "l_2_hash", - "lite_name": "l2", - "semantic_type": "uint256", - "json_type": "string", + "name": "rate", + "lite_name": "r", + "semantic_type": "uint32", + "json_type": "integer", "index": 1, "array_depth": 0, "optional": false, - "example": "'0x10000101000203040506'", + "example": "500", "comment": [ - "The L2 txHash of the deposit" - ] + "The minimal rate at which we publish feeds (in milliseconds)", + "Delta (50, 100, 500, 1000)", + "Snapshot (500, 1000)" + ], + "selector": "secondary" }, { - "name": "to_account_id", - "lite_name": "ta", - "semantic_type": "address", - "json_type": "string", + "name": "depth", + "lite_name": "d", + "semantic_type": "uint32", + "json_type": "integer", "index": 2, "array_depth": 0, - "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "optional": true, + "default": "'0'", + "example": "50", "comment": [ - "The account to deposit into" - ] - }, + "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": "WSPositionsFeedDataV1", + "is_root": true, + "fields": [ { - "name": "currency", - "lite_name": "c", + "name": "stream", + "lite_name": "s", "semantic_type": "string", "json_type": "string", - "index": 3, + "index": 0, "array_depth": 0, "optional": false, - "example": "'USDT'", + "example": "'v1.position'", "comment": [ - "The token currency to deposit" + "Stream name" ] }, { - "name": "num_tokens", - "lite_name": "nt", + "name": "selector", + "lite_name": "s1", "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 1, "array_depth": 0, "optional": false, - "example": "'1500.0'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The number of tokens to deposit" + "Primary selector" ] }, { - "name": "initiated_time", - "lite_name": "it", - "semantic_type": "timestamp", + "name": "sequence_number", + "lite_name": "sn", + "semantic_type": "uint64", "json_type": "string", - "index": 5, + "index": 2, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'872634876'", "comment": [ - "The timestamp when the deposit was initiated on L1 in unix nanoseconds" + "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": "confirmed_time", - "lite_name": "ct", - "semantic_type": "timestamp", - "json_type": "string", - "index": 6, + "name": "feed", + "lite_name": "f", + "semantic_type": "Positions", + "json_type": "Positions", + "index": 3, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", "comment": [ - "The timestamp when the deposit was confirmed on L2 in unix nanoseconds" + "A Position being created or updated matching the request filter" ] }, { - "name": "from_address", - "lite_name": "fa", - "semantic_type": "address", + "name": "prev_sequence_number", + "lite_name": "ps", + "semantic_type": "uint64", "json_type": "string", - "index": 7, + "index": 4, "array_depth": 0, "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "example": "'872634875'", "comment": [ - "The address of the sender" + "The previous sequence number that determines the message order" ] } ], "comment": [] }, { - "name": "ApiDepositHistoryResponse", + "name": "WSPositionsFeedSelectorV1", "is_root": true, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "DepositHistory", - "json_type": "DepositHistory", + "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": [ - "The deposit history matching the request account" - ] + "The subaccount ID to filter by" + ], + "selector": "primary" }, { - "name": "next", - "lite_name": "n", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 1, "array_depth": 0, "optional": true, - "default": "''", - "example": "'Qw0918='", + "default": "'all'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The cursor to indicate when to start the next query from" - ] + "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": "ApiTransferHistoryRequest", + "name": "WSSubscribeParams", "is_root": true, "fields": [ { - "name": "currency", - "lite_name": "c", + "name": "stream", + "lite_name": "s", "semantic_type": "string", "json_type": "string", "index": 0, - "array_depth": 1, + "array_depth": 0, "optional": false, - "example": "['USDT', 'USDC']", + "example": "'v1.ticker.d'", "comment": [ - "The token currency to query for, if nil or empty, return all transfers. Otherwise, only entries matching the filter will be returned" + "The channel to subscribe to (eg: ticker.s / ticker.d)" ] }, { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", + "name": "selectors", + "lite_name": "s1", + "semantic_type": "string", "json_type": "string", "index": 1, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "array_depth": 1, + "optional": false, + "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", "comment": [ - "The start time to query for in unix nanoseconds" + "The list of feeds to subscribe to" ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", + "name": "use_global_sequence_number", + "lite_name": "ug", + "semantic_type": "bool", + "json_type": "boolean", "index": 2, "array_depth": 0, "optional": true, - "default": "now()", - "example": "'1697788800000000000'", + "default": "false", + "example": "true", "comment": [ - "The end time to query for in unix nanoseconds" + "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": "WSSubscribeRequestV1Legacy", + "is_root": true, + "fields": [ { - "name": "limit", - "lite_name": "l", + "name": "request_id", + "lite_name": "ri", "semantic_type": "uint32", "json_type": "integer", - "index": 3, + "index": 0, "array_depth": 0, "optional": true, - "default": "500", - "example": "500", + "default": "0", + "example": "123", "comment": [ - "The limit to query for. Defaults to 500; Max 1000" + "Optional Field which is used to match the response by the client.", + "If not passed, this field will not be returned.", + "Range: 0 to 4,294,967,295 (uint32)" ] }, { - "name": "cursor", - "lite_name": "c1", + "name": "stream", + "lite_name": "s", "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 1, "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", + "optional": false, + "example": "'v1.ticker.d'", "comment": [ - "The cursor to indicate when to start the next query from" + "The channel to subscribe to (eg: ticker.s / ticker.d)" ] }, { - "name": "tx_id", - "lite_name": "ti", - "semantic_type": "uint64", + "name": "feed", + "lite_name": "f", + "semantic_type": "string", "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1028403'", + "index": 2, + "array_depth": 1, + "optional": false, + "example": "['BTC_USDT_Perp', 'ETH_USDT_Perp']", "comment": [ - "The transaction ID to query for" + "The list of feeds to subscribe to" ] }, { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", + "name": "method", + "lite_name": "m", + "semantic_type": "string", "json_type": "string", - "index": 6, + "index": 3, "array_depth": 0, - "optional": true, - "default": "", - "example": "", + "optional": false, + "example": "'subscribe'", "comment": [ - "Main account ID being queried. By default, applies the requestor's main account ID." + "The method to use for the request (eg: subscribe / unsubscribe)" ] }, { - "name": "transfer_types", - "lite_name": "tt", - "semantic_type": "TransferType", - "json_type": "TransferType", - "index": 7, - "array_depth": 1, + "name": "is_full", + "lite_name": "if", + "semantic_type": "bool", + "json_type": "boolean", + "index": 4, + "array_depth": 0, "optional": true, - "default": "[]", + "default": "false", + "example": "true", "comment": [ - "The transfer type to filters for. If the list is empty, return all transfer types." + "Whether the request is for full data or lite data" ] } ], "comment": [ - "The request to get the historical transfers of an account", - "The history is returned in reverse chronological order", - "", - "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" + "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": "ApiTransferHistoryResponse", + "name": "WSSubscribeResponseV1Legacy", "is_root": true, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "TransferHistory", - "json_type": "TransferHistory", + "name": "request_id", + "lite_name": "ri", + "semantic_type": "uint32", + "json_type": "integer", "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The transfer history matching the request account" - ] - }, - { - "name": "next", - "lite_name": "n", - "semantic_type": "string", - "json_type": "string", - "index": 1, "array_depth": 0, "optional": true, - "default": "''", - "example": "'Qw0918='", + "default": "0", + "example": "123", "comment": [ - "The cursor to indicate when to start the next query from" + "Optional Field which is used to match the response by the client.", + "If not passed, this field will not be returned" ] - } - ], - "comment": [] - }, - { - "name": "ApiWithdrawalHistoryRequest", - "is_root": true, - "fields": [ + }, { - "name": "currency", - "lite_name": "c", + "name": "stream", + "lite_name": "s", "semantic_type": "string", "json_type": "string", - "index": 0, - "array_depth": 1, + "index": 1, + "array_depth": 0, "optional": false, - "example": "['USDT', 'USDC']", + "example": "'v1.ticker.d'", "comment": [ - "The token currency to query for, if nil or empty, return all withdrawals. Otherwise, only entries matching the filter will be returned" + "The channel to subscribe to (eg: ticker.s / ticker.d)" ] }, { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", + "name": "subs", + "lite_name": "s1", + "semantic_type": "string", "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "index": 2, + "array_depth": 1, + "optional": false, + "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", "comment": [ - "The start time to query for in unix nanoseconds" + "The list of feeds subscribed to" ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "unsubs", + "lite_name": "u", + "semantic_type": "string", "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", + "index": 3, + "array_depth": 1, + "optional": false, + "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", "comment": [ - "The end time to query for in unix nanoseconds" + "The list of feeds unsubscribed from" ] }, { - "name": "limit", - "lite_name": "l", + "name": "num_snapshots", + "lite_name": "ns", "semantic_type": "uint32", "json_type": "integer", - "index": 3, - "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", + "index": 4, + "array_depth": 1, + "optional": false, + "example": "10", "comment": [ - "The limit to query for. Defaults to 500; Max 1000" + "The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs`" ] }, { - "name": "cursor", - "lite_name": "c1", - "semantic_type": "string", + "name": "first_sequence_number", + "lite_name": "fs", + "semantic_type": "uint64", "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", + "index": 5, + "array_depth": 1, + "optional": false, + "example": "872634876", "comment": [ - "The cursor to indicate when to start the next query from" + "The first sequence number to expect for each subscribed feed. Returned in same order as `subs`" ] }, { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", + "name": "latest_sequence_number", + "lite_name": "ls", + "semantic_type": "uint64", "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": true, - "default": "", - "example": "", + "index": 6, + "array_depth": 1, + "optional": false, + "example": "872634875", "comment": [ - "Main account ID being queried. By default, applies the requestor's main account ID." + "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": [ - "The request to get the historical withdrawals of an account", - "The history is returned in reverse chronological order", - "", - "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" + "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": "WithdrawalHistory", - "is_root": false, + "name": "WSSubscribeResult", + "is_root": true, "fields": [ { - "name": "tx_id", - "lite_name": "ti", - "semantic_type": "uint64", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'1028403'", + "example": "'v1.ticker.d'", "comment": [ - "The transaction ID of the withdrawal" + "The channel to subscribe to (eg: ticker.s / ticker.d)" ] }, { - "name": "from_account_id", - "lite_name": "fa", - "semantic_type": "address", + "name": "subs", + "lite_name": "s1", + "semantic_type": "string", "json_type": "string", "index": 1, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", "comment": [ - "The subaccount to withdraw from" + "The list of feeds subscribed to" ] }, { - "name": "to_eth_address", - "lite_name": "te", - "semantic_type": "address", + "name": "unsubs", + "lite_name": "u", + "semantic_type": "string", "json_type": "string", "index": 2, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", "comment": [ - "The ethereum address to withdraw to" + "The list of feeds unsubscribed from" ] }, { - "name": "currency", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", + "name": "num_snapshots", + "lite_name": "ns", + "semantic_type": "uint32", + "json_type": "integer", "index": 3, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'USDT'", + "example": "10", "comment": [ - "The token currency to withdraw" + "The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs`" ] }, { - "name": "num_tokens", - "lite_name": "nt", - "semantic_type": "string", + "name": "first_sequence_number", + "lite_name": "fs", + "semantic_type": "uint64", "json_type": "string", "index": 4, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'1500.0'", + "example": "872634876", "comment": [ - "The number of tokens to withdraw" + "The first sequence number to expect for each subscribed feed. Returned in same order as `subs`" ] }, { - "name": "signature", - "lite_name": "s", - "semantic_type": "Signature", - "json_type": "Signature", + "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": "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": [ - "The signature of the withdrawal" + "Stream name" ] }, { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "selector", + "lite_name": "s1", + "semantic_type": "string", "json_type": "string", - "index": 6, + "index": 1, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The timestamp of the withdrawal in unix nanoseconds" + "Primary selector" ] }, { - "name": "l_1_hash", - "lite_name": "l1", - "semantic_type": "string", + "name": "sequence_number", + "lite_name": "sn", + "semantic_type": "uint64", "json_type": "string", - "index": 7, + "index": 2, "array_depth": 0, - "optional": true, - "default": "''", - "example": "'0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'", + "optional": false, + "example": "'872634876'", "comment": [ - "The finalized withdrawal transaction hash on L1" + "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": "l_2_hash", - "lite_name": "l2", - "semantic_type": "string", + "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": 8, + "index": 4, "array_depth": 0, "optional": false, - "example": "'0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890'", + "example": "'872634875'", "comment": [ - "The transaction hash on L2" + "The previous sequence number that determines the message order" ] } ], "comment": [] }, { - "name": "ApiWithdrawalHistoryResponse", + "name": "WSTickerFeedSelectorV1", "is_root": true, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "WithdrawalHistory", - "json_type": "WithdrawalHistory", + "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 withdrawals history matching the request account" - ] + "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": "next", - "lite_name": "n", - "semantic_type": "string", - "json_type": "string", + "name": "rate", + "lite_name": "r", + "semantic_type": "uint32", + "json_type": "integer", "index": 1, "array_depth": 0, - "optional": true, - "default": "''", - "example": "'Qw0918='", + "optional": false, + "example": "500", "comment": [ - "The cursor to indicate when to start the next query from" - ] + "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": "ApiVaultInvestRequest", + "name": "WSTradeFeedDataV1", "is_root": true, "fields": [ { - "name": "vault_id", - "lite_name": "vi", - "semantic_type": "uint64", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 0, "array_depth": 0, "optional": false, - "example": "'3477045127917224'", + "example": "'v1.trade'", "comment": [ - "The unique identifier of the vault to invest in." + "Stream name" ] }, { - "name": "currency", - "lite_name": "c", + "name": "selector", + "lite_name": "s1", "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 1, "array_depth": 0, "optional": false, - "example": "'USDT'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The currency used for the investment. This should be the vault's quote currency." + "Primary selector" ] }, { - "name": "num_tokens", - "lite_name": "nt", - "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": [ + "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, - "example": "1000000", "comment": [ - "The investment sum, in terms of the token currency specified (i.e., `numTokens` of '1000' with `tokenCurrency` of 'USDT' denotes investment of 1,000 USDT)." + "A public trade matching the request filter" ] }, { - "name": "signature", - "lite_name": "s", - "semantic_type": "Signature", - "json_type": "Signature", + "name": "prev_sequence_number", + "lite_name": "ps", + "semantic_type": "uint64", + "json_type": "string", "index": 4, "array_depth": 0, "optional": false, + "example": "'872634875'", "comment": [ - "The digital signature from the investing account.", - "This signature must be generated by the main account ID and is used to verify the authenticity of the request.", - "The signature must comply with AccountPermExternalTransfer permission." + "The previous sequence number that determines the message order" ] } ], + "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": [ - "Request payload for investing in a vault.", - "", - "This API allows a client to invest a specified amount of tokens in a particular vault." + "Subscribes to a stream of Public Trades for an instrument." ] }, { - "name": "ApiVaultRedeemRequest", + "name": "WSTransferFeedDataV1", "is_root": true, "fields": [ { - "name": "vault_id", - "lite_name": "vi", - "semantic_type": "uint64", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 0, "array_depth": 0, "optional": false, - "example": "'3477045127917224'", + "example": "'v1.transfer'", "comment": [ - "The unique identifier of the vault to redeem from." + "The websocket channel to which the response is sent" ] }, { - "name": "currency", - "lite_name": "c", + "name": "selector", + "lite_name": "s1", "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 1, "array_depth": 0, "optional": false, - "example": "'USDT'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The currency used for the redemption. This should be the vault's quote currency." + "Primary selector" ] }, { - "name": "num_tokens", - "lite_name": "nt", - "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": [ + "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": "TransferHistory", + "json_type": "TransferHistory", "index": 3, "array_depth": 0, "optional": false, - "example": "1000000", "comment": [ - "The number of shares to redeem." + "The transfer history matching the requested filters" ] }, { - "name": "signature", - "lite_name": "s", - "semantic_type": "Signature", - "json_type": "Signature", + "name": "prev_sequence_number", + "lite_name": "ps", + "semantic_type": "uint64", + "json_type": "string", "index": 4, "array_depth": 0, "optional": false, + "example": "'872634875'", "comment": [ - "The digital signature from the investing account.", - "This signature must be generated by the main account ID and is used to verify the authenticity of the request.", - "The signature must comply with AccountPermExternalTransfer permission." + "The previous sequence number that determines the message order" ] } ], "comment": [ - "Request payload for redeeming from a vault.", - "", - "This API allows a client to redeem a specified amount of tokens from a particular vault." + "Subscribes to a feed of transfer updates." ] }, { - "name": "ApiVaultRedeemCancelRequest", + "name": "WSTransferFeedSelectorV1", "is_root": true, "fields": [ { - "name": "vault_id", - "lite_name": "vi", - "semantic_type": "uint64", + "name": "main_account_id", + "lite_name": "ma", + "semantic_type": "address", "json_type": "string", - "index": 1, + "index": 0, "array_depth": 0, "optional": false, - "example": "'3477045127917224'", + "example": "'$GRVT_MAIN_ACCOUNT_ID'", "comment": [ - "The unique identifier of the vault to cancel the redemption from." - ] + "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" } ], "comment": [ - "Request payload for canceling a vault redemption.", - "", - "This API allows a client to cancel a previously initiated redemption from a vault." + "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": "ApiVaultViewRedemptionQueueRequest", + "name": "WSUnsubscribeAllParams", + "is_root": true, + "fields": [], + "comment": [ + "All V1 Websocket Unsubscription Request to unsubscribe from all active websocket streams." + ] + }, + { + "name": "WSUnsubscribeAllResult", "is_root": true, "fields": [ { - "name": "vault_id", - "lite_name": "vi", - "semantic_type": "uint64", - "json_type": "string", - "index": 1, - "array_depth": 0, + "name": "stream_reference", + "lite_name": "sr", + "semantic_type": "StreamReference", + "json_type": "StreamReference", + "index": 0, + "array_depth": 1, "optional": false, - "example": "'3477045127917224'", "comment": [ - "The unique identifier of the vault to fetch the redemption queue for." + "The list of stream references unsubscribed from" ] } ], "comment": [ - "Request payload for a vault manager to view the redemption queue for their vault.", - "", - "Fetches the redemption queue for a vault, ordered by descending priority.", - "", - "\u003cb\u003eUrgent\u003c/b\u003e redemption requests, defined as having been pending \u003e90% of the manager-defined maximum redemption period, have top priority (following insertion order).", - "", - "\u003cb\u003eNon-urgent\u003c/b\u003e redemption requests are otherwise prioritized by insertion order, \u003cb\u003eunless\u003c/b\u003e they are \u003e5x the size of the smallest redemption request.", - "", - "E.g., If FIFO ordering (all non-urgent) is 1k -\u003e 50k -\u003e 100k -\u003e 20k -\u003e 10k -\u003e 25k, then priority ordering is 1k -\u003e 10k -\u003e 50k -\u003e 20k -\u003e 100k -\u003e 25k.", - "", - "Only displays redemption requests that are eligible for automated redemption, i.e., have been pending for the manager-defined minimum redemption period." + "Returns a list of all rooms the client has unsubscribed from." ] }, { - "name": "VaultRedemptionRequest", - "is_root": false, + "name": "WSUnsubscribeParams", + "is_root": true, "fields": [ { - "name": "request_time", - "lite_name": "rt", - "semantic_type": "timestamp", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'v1.ticker.d'", "comment": [ - "[Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds" + "The channel to unsubscribe from (eg: ticker.s / ticker.d)" ] }, { - "name": "num_lp_tokens", - "lite_name": "nl", + "name": "selectors", + "lite_name": "s1", "semantic_type": "string", "json_type": "string", "index": 1, - "array_depth": 0, - "optional": false, - "example": "'1000000'", - "comment": [ - "The number of shares to redeem" - ] - }, - { - "name": "max_redemption_period_timestamp", - "lite_name": "mr", - "semantic_type": "timestamp", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'1727788800000000000'", - "comment": [ - "[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed." - ] - }, - { - "name": "age_category", - "lite_name": "ac", - "semantic_type": "VaultRedemptionReqAgeCategory", - "json_type": "VaultRedemptionReqAgeCategory", - "index": 3, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'NORMAL'", + "example": "['BTC_USDT_Perp', 'ETH_USDT_Perp']", "comment": [ - "Age category of this redemption request." + "The list of feeds to unsubscribe from" ] }, { - "name": "is_manager", - "lite_name": "im", + "name": "use_global_sequence_number", + "lite_name": "ug", "semantic_type": "bool", "json_type": "boolean", - "index": 4, + "index": 2, "array_depth": 0, "optional": true, + "default": "false", "example": "true", "comment": [ - "`true` if this request belongs to the vault manager, omitted otherwise." - ] - }, - { - "name": "eligible_for_auto_redemption_timestamp", - "lite_name": "ef", - "semantic_type": "timestamp", - "json_type": "string", - "index": 5, - "array_depth": 0, - "optional": false, - "example": "'1727788800000000000'", - "comment": [ - "[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be eligible for automated redemption." + "Whether to use the global sequence number for the stream" ] } ], "comment": [ - "Representation of a pending redemption request for a given vault." + "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": "PreMinRedemptions", - "is_root": false, + "name": "WSUnsubscribeResult", + "is_root": true, "fields": [ { - "name": "requests", - "lite_name": "r", - "semantic_type": "VaultRedemptionRequest", - "json_type": "VaultRedemptionRequest", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", "index": 0, - "array_depth": 1, + "array_depth": 0, "optional": false, + "example": "'v1.ticker.d'", "comment": [ - "Pre-minimum-age redemption requests, ordered by age (first element is the oldest request that is pre-minimum-age)." + "The channel to subscribe to (eg: ticker.s / ticker.d)" ] }, { - "name": "token_count", - "lite_name": "tc", + "name": "unsubs", + "lite_name": "u", "semantic_type": "string", "json_type": "string", "index": 1, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'1000000'", + "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", "comment": [ - "Number of shares in the pre-minimum-age section of the vault's redemption queue." + "The list of feeds unsubscribed from" ] } ], "comment": [ - "Vault redemption queue section hidden from main view. All requests here have yet to age past the vault's minimum redemption period." + "Returns a confirmation of all unsubscribes" ] }, { - "name": "ApiVaultViewRedemptionQueueResponse", + "name": "WSWithdrawalFeedDataV1", "is_root": true, "fields": [ { - "name": "redemption_queue", - "lite_name": "rq", - "semantic_type": "VaultRedemptionRequest", - "json_type": "VaultRedemptionRequest", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", "index": 0, - "array_depth": 1, + "array_depth": 0, "optional": false, + "example": "'v1.withdrawal'", "comment": [ - "Outstanding vault redemption requests, ordered by descending priority. Excludes requests that have not yet aged past the minimum redemption period." + "The websocket channel to which the response is sent" ] }, { - "name": "pending_redemption_token_count", - "lite_name": "pr", + "name": "selector", + "lite_name": "s1", "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'1000000'", + "example": "'BTC_USDT_Perp'", "comment": [ - "Number of shares eligible for automated redemption (held in queue for at least the minimum redemption period)." + "Primary selector" ] }, { - "name": "urgent_redemption_token_count", - "lite_name": "ur", - "semantic_type": "string", + "name": "sequence_number", + "lite_name": "sn", + "semantic_type": "uint64", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "'0'", + "example": "'872634876'", "comment": [ - "Number of shares nearing the maximum redemption period (\u003e= 90% of maximum redemption period)." + "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": "auto_redeemable_balance", - "lite_name": "ar", - "semantic_type": "string", - "json_type": "string", + "name": "feed", + "lite_name": "f", + "semantic_type": "Withdrawal", + "json_type": "Withdrawal", "index": 3, "array_depth": 0, "optional": false, - "example": "'0'", "comment": [ - "Amount available for automated redemption request servicing (in USD)." + "The Withdrawal object" ] }, { - "name": "share_price", - "lite_name": "sp", - "semantic_type": "string", + "name": "prev_sequence_number", + "lite_name": "ps", + "semantic_type": "uint64", "json_type": "string", "index": 4, "array_depth": 0, "optional": false, - "example": "'1.25'", - "comment": [ - "Current share price (in USD)." - ] - }, - { - "name": "pre_min", - "lite_name": "pm", - "semantic_type": "PreMinRedemptions", - "json_type": "PreMinRedemptions", - "index": 5, - "array_depth": 0, - "optional": false, + "example": "'872634875'", "comment": [ - "Dedicated section for requests yet to wait at least the minimum redemption period." + "The previous sequence number that determines the message order" ] } ], "comment": [ - "Response payload for a vault manager to view the redemption queue for their vault, ordered by descending priority.", - "", - "Also includes counters for total redemption sizes pending as well as urgent (refer to API integration guide for more detail on redemption request classifications).", - "", - "" + "Subscribes to a feed of withdrawal updates." ] }, { - "name": "ApiVaultInvestorSummaryRequest", + "name": "WSWithdrawalFeedSelectorV1", "is_root": true, "fields": [ { - "name": "vault_id", - "lite_name": "vi", - "semantic_type": "uint64", + "name": "main_account_id", + "lite_name": "ma", + "semantic_type": "address", "json_type": "string", - "index": 1, + "index": 0, "array_depth": 0, "optional": false, - "example": "'3477045127917224'", + "example": "'$GRVT_MAIN_ACCOUNT_ID'", "comment": [ - "The unique identifier of the vault to fetch the summary for." - ] + "The main account ID to request for" + ], + "selector": "primary" } ], "comment": [ - "Request payload for fetching the summary of a vault investor.", - "", - "This API allows a client to retrieve the summary of investments in a specific vault." + "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": "VaultRedemption", + "name": "Withdrawal", "is_root": false, "fields": [ { - "name": "num_lp_tokens", - "lite_name": "nl", - "semantic_type": "string", + "name": "from_account_id", + "lite_name": "fa", + "semantic_type": "address", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "1000000", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "The number of LP Tokens requested for redemption." + "The subaccount to withdraw from" ] }, { - "name": "request_valuation", - "lite_name": "rv", - "semantic_type": "string", + "name": "to_eth_address", + "lite_name": "te", + "semantic_type": "address", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "1000000", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "The valuation (in USD) of the redemption request." + "The ethereum address to withdraw to" ] }, { - "name": "request_time", - "lite_name": "rt", - "semantic_type": "timestamp", + "name": "currency", + "lite_name": "c", + "semantic_type": "string", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'USDT'", "comment": [ - "[Filled by GRVT Backend] Time at which the redemption request was received by GRVT in unix nanoseconds" + "The token currency to withdraw" ] }, { - "name": "max_redemption_period_timestamp", - "lite_name": "mr", - "semantic_type": "timestamp", + "name": "num_tokens", + "lite_name": "nt", + "semantic_type": "string", "json_type": "string", "index": 3, "array_depth": 0, "optional": false, - "example": "1727788800000000000", + "example": "'10.50'", "comment": [ - "[Filled by GRVT Backend] Time in unix nanoseconds, beyond which the request will be force-redeemed." + "The number of tokens to withdraw" ] }, { - "name": "cancel_blocked", - "lite_name": "cb", - "semantic_type": "bool", - "json_type": "boolean", + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", "index": 4, "array_depth": 0, - "optional": true, - "default": "true", + "optional": false, "comment": [ - "Omitted for redemption requests to non-cross exchange vaults. True if cancellation is blocked within the CEV allocation allowance for the user's current tier (e.g. because the user has already transferred out the spot balance underlying the redemption request)." + "The signature of the withdrawal" ] } ], - "comment": [ - "Vault redemption information.", - "", - "This struct contains information about a pending redemption from a vault." - ] + "comment": [] }, { - "name": "VaultInvestorSummary", + "name": "WithdrawalHistory", "is_root": false, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", + "name": "tx_id", + "lite_name": "ti", "semantic_type": "uint64", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'1028403'", "comment": [ - "The unique identifier of the vault sub account." + "The transaction ID of the withdrawal" ] }, { - "name": "num_lp_tokens", - "lite_name": "nl", - "semantic_type": "string", + "name": "from_account_id", + "lite_name": "fa", + "semantic_type": "address", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "1000000", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "The number of Vault LP tokens held by the investor." + "The subaccount to withdraw from" ] }, { - "name": "avg_entry_price", - "lite_name": "ae", - "semantic_type": "string", + "name": "to_eth_address", + "lite_name": "te", + "semantic_type": "address", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "1000000", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "The average entry price (in USD) of the vault LP tokens." + "The ethereum address to withdraw to" ] }, { - "name": "current_price", - "lite_name": "cp", + "name": "currency", + "lite_name": "c", "semantic_type": "string", "json_type": "string", "index": 3, "array_depth": 0, "optional": false, - "example": "1000000", + "example": "'USDT'", "comment": [ - "The current price (in USD) of the vault LP tokens." + "The token currency to withdraw" ] }, { - "name": "total_equity", - "lite_name": "te", + "name": "num_tokens", + "lite_name": "nt", "semantic_type": "string", "json_type": "string", "index": 4, "array_depth": 0, "optional": false, - "example": "1000000", + "example": "'1500.0'", "comment": [ - "The current valuation (in USD) of all held vault LP tokens." + "The number of tokens to withdraw" ] }, { - "name": "all_time_realized_pnl", - "lite_name": "at", - "semantic_type": "string", - "json_type": "string", + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", "index": 5, "array_depth": 0, "optional": false, - "example": "1000000", - "comment": [ - "The all-time realized PnL (in USD) that the investor has received from the vault." - ] - }, - { - "name": "pending_redemption", - "lite_name": "pr", - "semantic_type": "VaultRedemption", - "json_type": "VaultRedemption", - "index": 6, - "array_depth": 0, - "optional": true, "comment": [ - "The singleton pending redemption (omitted if none)." + "The signature of the withdrawal" ] }, { - "name": "can_burn", - "lite_name": "cb", - "semantic_type": "bool", - "json_type": "boolean", - "index": 7, - "array_depth": 0, - "optional": true, - "default": "true", - "comment": [ - "True if the requesting account is authorized to burn tokens on this vault, omitted otherwise." - ] - } - ], - "comment": [ - "Vault investor summary information.", - "", - "This struct contains the summary of investments in a vault." - ] - }, - { - "name": "ApiVaultInvestorSummaryResponse", - "is_root": true, - "fields": [ - { - "name": "vault_investor_summary", - "lite_name": "vi", - "semantic_type": "VaultInvestorSummary", - "json_type": "VaultInvestorSummary", - "index": 0, - "array_depth": 1, - "optional": false, - "comment": [ - "The summary of investments in the vault." - ] - } - ], - "comment": [ - "Response payload for the summary of a vault investor.", - "", - "This API provides the summary of investments in a specific vault." - ] - }, - { - "name": "ApiVaultBurnTokensRequest", - "is_root": true, - "fields": [ - { - "name": "vault_id", - "lite_name": "vi", - "semantic_type": "uint64", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", "json_type": "string", - "index": 1, + "index": 6, "array_depth": 0, "optional": false, - "example": "'3477045127917224'", + "example": "'1697788800000000000'", "comment": [ - "The unique identifier of the vault to burn tokens from." + "The timestamp of the withdrawal in unix nanoseconds" ] }, { - "name": "currency", - "lite_name": "c", + "name": "l_1_hash", + "lite_name": "l1", "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 7, "array_depth": 0, - "optional": false, - "example": "'USDT'", + "optional": true, + "default": "''", + "example": "'0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'", "comment": [ - "The currency used for the burn. This should be the vault's quote currency." + "The finalized withdrawal transaction hash on L1" ] }, { - "name": "num_tokens", - "lite_name": "nt", + "name": "l_2_hash", + "lite_name": "l2", "semantic_type": "string", "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "1000000", - "comment": [ - "The number of tokens to burn." - ] - }, - { - "name": "signature", - "lite_name": "s", - "semantic_type": "Signature", - "json_type": "Signature", - "index": 4, + "index": 8, "array_depth": 0, "optional": false, + "example": "'0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890'", "comment": [ - "The digital signature from the investing account.", - "This signature must be generated by the main account ID and is used to verify the authenticity of the request.", - "The signature must comply with AccountPermExternalTransfer permission." + "The transaction hash on L2" ] } ], - "comment": [ - "Request payload for burning tokens in a vault.", - "", - "This API allows a client to burn a specified amount of tokens in a particular vault." - ] + "comment": [] } ], "enums": [ @@ -13291,6 +14492,34 @@ "comment": [ "the chain ID is invalid" ] + }, + { + "name": "BUILDER_ORDER_FEE_EXCEED", + "value": 39, + "comment": [ + "Builder fee exceed the limit" + ] + }, + { + "name": "BUILDER_ORDER_FEE_NEGATIVE", + "value": 40, + "comment": [ + "Builder fee is below 0" + ] + }, + { + "name": "BUILDER_ORDER_BUILDER_NOT_AUTHORIZED", + "value": 41, + "comment": [ + "Builder is not an authorized builder for client" + ] + }, + { + "name": "BUILDER_ORDER_BUILDER_NOT_EXIST", + "value": 42, + "comment": [ + "Builder does not exist" + ] } ], "comment": [] @@ -13336,6 +14565,26 @@ ], "comment": [] }, + { + "name": "PositionMarginType", + "values": [ + { + "name": "ISOLATED", + "value": 1, + "comment": [ + "Isolated Margin Mode: each position is allocated a fixed amount of collateral" + ] + }, + { + "name": "CROSS", + "value": 2, + "comment": [ + "Cross Margin Mode: uses all available funds in your account as collateral across all cross margin positions" + ] + } + ], + "comment": [] + }, { "name": "TimeInForce", "values": [