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_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..1ba0baf 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 | ??? 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..6836876 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 | ??? 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_deposit_history_request.md b/artifacts/apidocs/schemas/api_deposit_history_request.md index f5159be..2e5df75 100644 --- a/artifacts/apidocs/schemas/api_deposit_history_request.md +++ b/artifacts/apidocs/schemas/api_deposit_history_request.md @@ -1,5 +1,5 @@ !!! info "[ApiDepositHistoryRequest](/../../schemas/api_deposit_history_request)" - The request to get the historical deposits of an account
The history is returned in reverse chronological order

Pagination works as follows:
+ The request to get the historical deposits of an account
The history is returned in reverse chronological order
Both finalized and pending deposits are returned, and pending deposits are indicated by an empty `confirmedTime` field.

Pagination works as follows:
|Name
`Lite`|Type|Required
`Default`| Description | |-|-|-|-| diff --git a/artifacts/apidocs/schemas/api_deposit_history_response.md b/artifacts/apidocs/schemas/api_deposit_history_response.md index 6246bd9..c15240d 100644 --- a/artifacts/apidocs/schemas/api_deposit_history_response.md +++ b/artifacts/apidocs/schemas/api_deposit_history_response.md @@ -12,5 +12,5 @@ |currency
`c` |string|True|The token currency to deposit| |num_tokens
`nt` |string|True|The number of tokens to deposit| |initiated_time
`it` |string|True|The timestamp when the deposit was initiated on L1 in unix nanoseconds| - |confirmed_time
`ct` |string|True|The timestamp when the deposit was confirmed on L2 in unix nanoseconds| + |confirmed_time
`ct` |string|True|The timestamp when the deposit was confirmed on L2 in unix nanoseconds, empty if the deposit is pending.| |from_address
`fa` |string|True|The address of the sender| 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_margin_rules_response.md b/artifacts/apidocs/schemas/api_get_margin_rules_response.md index 639d311..800f336 100644 --- a/artifacts/apidocs/schemas/api_get_margin_rules_response.md +++ b/artifacts/apidocs/schemas/api_get_margin_rules_response.md @@ -11,7 +11,7 @@ |-|-|-|-| |tier
`t` |integer|True|1-indexed tier number| |notional_floor
`nf` |string|True|Lower bound of notional value (inclusive) in quote currency| - |notional_cap
`nc` |string|True|Upper bound of notional value (exclusive) in quote currency, empty for last tier| + |notional_cap
`nc` |string|False
`None`|Upper bound of notional value (exclusive) in quote currency, omitted for last tier| |maintenance_margin_rate
`mm` |string|True|Maintenance margin rate as a decimal (e.g., '0.01' for 1%)| |initial_margin_rate
`im` |string|True|Initial margin rate as a decimal (e.g., '0.02' for 2%)| |max_leverage
`ml` |integer|True|Maximum leverage allowed at this tier (floor of 1 / initial_margin_rate)| diff --git a/artifacts/apidocs/schemas/api_get_order_response.md b/artifacts/apidocs/schemas/api_get_order_response.md index 7b922b0..d0ccb51 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 | ??? 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_get_sub_accounts_response.md b/artifacts/apidocs/schemas/api_get_sub_accounts_response.md new file mode 100644 index 0000000..3a4ebb1 --- /dev/null +++ b/artifacts/apidocs/schemas/api_get_sub_accounts_response.md @@ -0,0 +1,6 @@ +!!! info "[ApiGetSubAccountsResponse](/../../schemas/api_get_sub_accounts_response)" + Response payload containing all sub-accounts accessible within the given auth session
+ + |Name
`Lite`|Type|Required
`Default`| Description | + |-|-|-|-| + |sub_account_ids
`sa` |[string]|True|List of sub-account IDs accessible to the session| diff --git a/artifacts/apidocs/schemas/api_open_orders_response.md b/artifacts/apidocs/schemas/api_open_orders_response.md index b20c7d9..3d440f0 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 | ??? 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..cba29b2 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 | ??? 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_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/api_withdrawal_history_request.md b/artifacts/apidocs/schemas/api_withdrawal_history_request.md index 346c5bb..0c33702 100644 --- a/artifacts/apidocs/schemas/api_withdrawal_history_request.md +++ b/artifacts/apidocs/schemas/api_withdrawal_history_request.md @@ -1,5 +1,5 @@ !!! info "[ApiWithdrawalHistoryRequest](/../../schemas/api_withdrawal_history_request)" - The request to get the historical withdrawals of an account
The history is returned in reverse chronological order

Pagination works as follows:
+ The request to get the historical withdrawals of an account
The history is returned in reverse chronological order
Both finalized and pending withdrawals are returned, and pending withdrawals are indicated by an empty `l1Hash` field.

Pagination works as follows:
|Name
`Lite`|Type|Required
`Default`| Description | |-|-|-|-| diff --git a/artifacts/apidocs/schemas/api_withdrawal_history_response.md b/artifacts/apidocs/schemas/api_withdrawal_history_response.md index a861d27..0474fc0 100644 --- a/artifacts/apidocs/schemas/api_withdrawal_history_response.md +++ b/artifacts/apidocs/schemas/api_withdrawal_history_response.md @@ -13,7 +13,7 @@ |num_tokens
`nt` |string|True|The number of tokens to withdraw| |signature
`s` |Signature|True|The signature of the withdrawal| |event_time
`et` |string|True|The timestamp of the withdrawal in unix nanoseconds| - |l_1_hash
`l1` |string|False
`''`|The finalized withdrawal transaction hash on L1| + |l_1_hash
`l1` |string|False
`''`|The finalized withdrawal transaction hash on L1, empty if the withdrawal is 'pending'.| |l_2_hash
`l2` |string|True|The transaction hash on L2| ??? info "[Signature](/../../schemas/signature)" |Name
`Lite`|Type|Required
`Default`| Description | 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/deposit_history.md b/artifacts/apidocs/schemas/deposit_history.md index e24fed3..bba2982 100644 --- a/artifacts/apidocs/schemas/deposit_history.md +++ b/artifacts/apidocs/schemas/deposit_history.md @@ -7,5 +7,5 @@ |currency
`c` |string|True|The token currency to deposit| |num_tokens
`nt` |string|True|The number of tokens to deposit| |initiated_time
`it` |string|True|The timestamp when the deposit was initiated on L1 in unix nanoseconds| - |confirmed_time
`ct` |string|True|The timestamp when the deposit was confirmed on L2 in unix nanoseconds| + |confirmed_time
`ct` |string|True|The timestamp when the deposit was confirmed on L2 in unix nanoseconds, empty if the deposit is pending.| |from_address
`fa` |string|True|The address of the sender| 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..9dad6c4 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 | ??? 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/risk_bracket.md b/artifacts/apidocs/schemas/risk_bracket.md index ab13f94..1e56c23 100644 --- a/artifacts/apidocs/schemas/risk_bracket.md +++ b/artifacts/apidocs/schemas/risk_bracket.md @@ -3,7 +3,7 @@ |-|-|-|-| |tier
`t` |integer|True|1-indexed tier number| |notional_floor
`nf` |string|True|Lower bound of notional value (inclusive) in quote currency| - |notional_cap
`nc` |string|True|Upper bound of notional value (exclusive) in quote currency, empty for last tier| + |notional_cap
`nc` |string|False
`None`|Upper bound of notional value (exclusive) in quote currency, omitted for last tier| |maintenance_margin_rate
`mm` |string|True|Maintenance margin rate as a decimal (e.g., '0.01' for 1%)| |initial_margin_rate
`im` |string|True|Initial margin rate as a decimal (e.g., '0.02' for 2%)| |max_leverage
`ml` |integer|True|Maximum leverage allowed at this tier (floor of 1 / initial_margin_rate)| 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/withdrawal_history.md b/artifacts/apidocs/schemas/withdrawal_history.md index eaa9632..99962aa 100644 --- a/artifacts/apidocs/schemas/withdrawal_history.md +++ b/artifacts/apidocs/schemas/withdrawal_history.md @@ -8,7 +8,7 @@ |num_tokens
`nt` |string|True|The number of tokens to withdraw| |signature
`s` |Signature|True|The signature of the withdrawal| |event_time
`et` |string|True|The timestamp of the withdrawal in unix nanoseconds| - |l_1_hash
`l1` |string|False
`''`|The finalized withdrawal transaction hash on L1| + |l_1_hash
`l1` |string|False
`''`|The finalized withdrawal transaction hash on L1, empty if the withdrawal is 'pending'.| |l_2_hash
`l2` |string|True|The transaction hash on L2| ??? info "[Signature](/../../schemas/signature)" |Name
`Lite`|Type|Required
`Default`| Description | 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..54e354d 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 | ??? 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..f174f6c 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 below minimum notional. Please try again with a higher price or size.| + |2067|400|Order below minimum notional. Please try reducing your position again with a higher price or size.| |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,14 +5867,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", @@ -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,23 +6549,16 @@ 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 } ' ``` @@ -6626,23 +6570,2949 @@ 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" - } - }, - "i": 123 + "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/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.testnet.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.testnet.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.testnet.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 + ``` +
+ === "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 ``` @@ -6651,23 +9521,15 @@ 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/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": "" } ' ``` @@ -6679,21 +9541,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 } @@ -6703,23 +9557,15 @@ 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/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": "" } ' ``` @@ -6731,21 +9577,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 } @@ -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", + "method": "v1/aggregated_account_summary", "params": { - "currency": ["USDT", "USDC"], - "start_time": "1697788800000000000", - "end_time": "1697788800000000000", - "limit": 500, - "cursor": "", - "main_account_id": null }, "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,10 +10812,11 @@ LITE ENDPOINT: lite/v1/account_history ```

-### Aggregated Account Summary +## Account +### Get Sub Accounts ``` -FULL ENDPOINT: full/v1/aggregated_account_summary -LITE ENDPOINT: lite/v1/aggregated_account_summary +FULL ENDPOINT: full/v1/get_sub_accounts +LITE ENDPOINT: lite/v1/get_sub_accounts ``` === "Request" @@ -8170,62 +10834,24 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary ``` { .json .copy } { } - ``` -
-=== "Response" -
- -8<- "docs/schemas/api_aggregated_account_summary_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" - } - } - ``` - **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" - } + ``` +
+=== "Response" +
+ -8<- "docs/schemas/api_get_sub_accounts_response.md" +
+
+ !!! success + **Full Response** + ``` { .json .copy } + { + "sub_account_ids": ["4724219064482495","2095919380","1170592370"] + } + ``` + **Lite Response** + ``` { .json .copy } + { + "sa": ["4724219064482495","2095919380","1170592370"] } ```
@@ -8234,11 +10860,9 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary !!! info "Error Codes" |Code|HttpStatus| Description | |-|-|-| - |1001|403|You are not authorized to access this functionality| + |1000|401|You need to authenticate prior to using 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 @@ -8246,18 +10870,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,7 +10891,7 @@ 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_sub_accounts' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8282,7 +10906,7 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/aggregated_account_summary", + "method": "v1/get_sub_accounts", "params": { }, "id": 123 @@ -8293,7 +10917,7 @@ 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_sub_accounts' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8308,7 +10932,7 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "j": "2.0", - "m": "v1/aggregated_account_summary", + "m": "v1/get_sub_accounts", "p": { }, "i": 123 @@ -8320,7 +10944,7 @@ 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_sub_accounts' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8335,7 +10959,7 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/aggregated_account_summary", + "method": "v1/get_sub_accounts", "params": { }, "id": 123 @@ -8346,7 +10970,7 @@ 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_sub_accounts' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8361,7 +10985,7 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "j": "2.0", - "m": "v1/aggregated_account_summary", + "m": "v1/get_sub_accounts", "p": { }, "i": 123 @@ -8373,7 +10997,7 @@ 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_sub_accounts' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8388,7 +11012,7 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/aggregated_account_summary", + "method": "v1/get_sub_accounts", "params": { }, "id": 123 @@ -8399,7 +11023,7 @@ 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_sub_accounts' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8414,7 +11038,7 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "j": "2.0", - "m": "v1/aggregated_account_summary", + "m": "v1/get_sub_accounts", "p": { }, "i": 123 @@ -8426,7 +11050,7 @@ 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_sub_accounts' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8441,7 +11065,7 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/aggregated_account_summary", + "method": "v1/get_sub_accounts", "params": { }, "id": 123 @@ -8452,7 +11076,7 @@ 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_sub_accounts' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -8467,7 +11091,7 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary -x ' { "j": "2.0", - "m": "v1/aggregated_account_summary", + "m": "v1/get_sub_accounts", "p": { }, "i": 123 @@ -8476,87 +11100,60 @@ LITE ENDPOINT: lite/v1/aggregated_account_summary ```

-### Funding Account Summary +## InitialLeverage +### Get All Initial Leverage ``` -FULL ENDPOINT: full/v1/funding_account_summary -LITE ENDPOINT: lite/v1/funding_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_funding_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 - }] - }, - "tier": { - "tier": null, - "futures_taker_fee": null, - "futures_maker_fee": null, - "options_taker_fee": null, - "options_maker_fee": null - } + "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 - }] - }, - "t": { - "t": null, - "ft": null, - "fm": null, - "ot": null, - "om": null - } + "r": [{ + "i": "BTC_USDT_Perp", + "l": "10", + "ml": "10", + "ml1": "50", + "mt": "ISOLATED" + }] } ```
@@ -8565,11 +11162,12 @@ 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|
!!! failure @@ -8577,18 +11175,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 +11196,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8613,8 +11212,9 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/funding_account_summary", + "method": "v1/get_all_initial_leverage", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -8624,10 +11224,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8639,8 +11240,9 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "j": "2.0", - "m": "v1/funding_account_summary", + "m": "v1/get_all_initial_leverage", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -8651,10 +11253,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8666,8 +11269,9 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/funding_account_summary", + "method": "v1/get_all_initial_leverage", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -8677,10 +11281,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8692,8 +11297,9 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "j": "2.0", - "m": "v1/funding_account_summary", + "m": "v1/get_all_initial_leverage", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -8704,10 +11310,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8719,8 +11326,9 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/funding_account_summary", + "method": "v1/get_all_initial_leverage", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -8730,10 +11338,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8745,8 +11354,9 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "j": "2.0", - "m": "v1/funding_account_summary", + "m": "v1/get_all_initial_leverage", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -8757,10 +11367,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8772,8 +11383,9 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "jsonrpc": "2.0", - "method": "v1/funding_account_summary", + "method": "v1/get_all_initial_leverage", "params": { + "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'" }, "id": 123 } @@ -8783,10 +11395,11 @@ 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/get_all_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ + "sa": "'$GRVT_SUB_ACCOUNT_ID'" } ' ``` @@ -8798,8 +11411,9 @@ LITE ENDPOINT: lite/v1/funding_account_summary -x ' { "j": "2.0", - "m": "v1/funding_account_summary", + "m": "v1/get_all_initial_leverage", "p": { + "sa": "'$GRVT_SUB_ACCOUNT_ID'" }, "i": 123 } @@ -8807,16 +11421,15 @@ LITE ENDPOINT: lite/v1/funding_account_summary ```

-## DeriskMMRatio -### Set Derisk M M Ratio +### Set Initial Leverage ``` -FULL ENDPOINT: full/v1/set_derisk_mm_ratio -LITE ENDPOINT: lite/v1/set_derisk_mm_ratio +FULL ENDPOINT: full/v1/set_initial_leverage +LITE ENDPOINT: lite/v1/set_initial_leverage ``` === "Request"
- -8<- "docs/schemas/api_set_derisk_to_maintenance_margin_ratio_request.md" + -8<- "docs/schemas/api_set_initial_leverage_request.md"
!!! question "Query" @@ -8824,38 +11437,22 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio ``` { .json .copy } { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "instrument": "BTC_USDT_Perp", + "leverage": "10" } ``` **Lite Request** ``` { .json .copy } { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "i": "BTC_USDT_Perp", + "l": "10" } ```
=== "Response"
- -8<- "docs/schemas/api_set_derisk_to_maintenance_margin_ratio_response.md" + -8<- "docs/schemas/api_set_initial_leverage_response.md"
!!! success @@ -8883,7 +11480,8 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio |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| + |2100|400|Invalid initial leverage| + |2101|400|Vaults cannot configure leverage|
!!! failure @@ -8912,21 +11510,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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "instrument": "BTC_USDT_Perp", + "leverage": "10" } ' ``` @@ -8938,19 +11528,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "jsonrpc": "2.0", - "method": "v1/set_derisk_mm_ratio", + "method": "v1/set_initial_leverage", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "instrument": "BTC_USDT_Perp", + "leverage": "10" }, "id": 123 } @@ -8960,21 +11542,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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "sa": "'$GRVT_SUB_ACCOUNT_ID'", + "i": "BTC_USDT_Perp", + "l": "10" } ' ``` @@ -8986,19 +11560,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "j": "2.0", - "m": "v1/set_derisk_mm_ratio", + "m": "v1/set_initial_leverage", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "i": "BTC_USDT_Perp", + "l": "10" }, "i": 123 } @@ -9009,21 +11575,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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "instrument": "BTC_USDT_Perp", + "leverage": "10" } ' ``` @@ -9035,19 +11593,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "jsonrpc": "2.0", - "method": "v1/set_derisk_mm_ratio", + "method": "v1/set_initial_leverage", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "instrument": "BTC_USDT_Perp", + "leverage": "10" }, "id": 123 } @@ -9057,21 +11607,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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "i": "BTC_USDT_Perp", + "l": "10" } ' ``` @@ -9083,19 +11625,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "j": "2.0", - "m": "v1/set_derisk_mm_ratio", + "m": "v1/set_initial_leverage", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "i": "BTC_USDT_Perp", + "l": "10" }, "i": 123 } @@ -9106,21 +11640,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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "instrument": "BTC_USDT_Perp", + "leverage": "10" } ' ``` @@ -9132,19 +11658,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "jsonrpc": "2.0", - "method": "v1/set_derisk_mm_ratio", + "method": "v1/set_initial_leverage", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "instrument": "BTC_USDT_Perp", + "leverage": "10" }, "id": 123 } @@ -9154,21 +11672,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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "i": "BTC_USDT_Perp", + "l": "10" } ' ``` @@ -9180,19 +11690,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "j": "2.0", - "m": "v1/set_derisk_mm_ratio", + "m": "v1/set_initial_leverage", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "i": "BTC_USDT_Perp", + "l": "10" }, "i": 123 } @@ -9203,21 +11705,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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "instrument": "BTC_USDT_Perp", + "leverage": "10" } ' ``` @@ -9229,19 +11723,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "jsonrpc": "2.0", - "method": "v1/set_derisk_mm_ratio", + "method": "v1/set_initial_leverage", "params": { "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "ratio": "1.5", - "signature": { - "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "expiration": "1697788800000000000", - "nonce": 1234567890, - "chain_id": "325" - } + "instrument": "BTC_USDT_Perp", + "leverage": "10" }, "id": 123 } @@ -9251,21 +11737,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/set_initial_leverage' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "i": "BTC_USDT_Perp", + "l": "10" } ' ``` @@ -9277,19 +11755,11 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio -x ' { "j": "2.0", - "m": "v1/set_derisk_mm_ratio", + "m": "v1/set_initial_leverage", "p": { "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "r": "1.5", - "s": { - "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", - "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", - "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", - "v": 28, - "e": "1697788800000000000", - "n": 1234567890, - "ci": "325" - } + "i": "BTC_USDT_Perp", + "l": "10" }, "i": 123 } @@ -9297,58 +11767,74 @@ LITE ENDPOINT: lite/v1/set_derisk_mm_ratio ```

-## InitialLeverage -### Get All Initial Leverage +## Vault +### Vault Burn Tokens ``` -FULL ENDPOINT: full/v1/get_all_initial_leverage -LITE ENDPOINT: lite/v1/get_all_initial_leverage +FULL ENDPOINT: full/v1/vault_burn_tokens +LITE ENDPOINT: lite/v1/vault_burn_tokens ``` === "Request"
- -8<- "docs/schemas/api_get_all_initial_leverage_request.md" + -8<- "docs/schemas/api_vault_burn_tokens_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 +11848,19 @@ 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.| + |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 @@ -9391,11 +11889,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_burn_tokens' \ --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 +11916,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/get_all_initial_leverage", + "method": "v1/vault_burn_tokens", "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 +11939,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_burn_tokens' \ --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 +11966,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "j": "2.0", - "m": "v1/get_all_initial_leverage", + "m": "v1/vault_burn_tokens", "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 +11990,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_burn_tokens' \ --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 +12017,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/get_all_initial_leverage", + "method": "v1/vault_burn_tokens", "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 +12040,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_burn_tokens' \ --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 +12067,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "j": "2.0", - "m": "v1/get_all_initial_leverage", + "m": "v1/vault_burn_tokens", "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 +12091,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_burn_tokens' \ --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 +12118,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/get_all_initial_leverage", + "method": "v1/vault_burn_tokens", "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 +12141,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_burn_tokens' \ --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 +12168,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "j": "2.0", - "m": "v1/get_all_initial_leverage", + "m": "v1/vault_burn_tokens", "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 +12192,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_burn_tokens' \ --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 +12219,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/get_all_initial_leverage", + "method": "v1/vault_burn_tokens", "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 +12242,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_burn_tokens' \ --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 +12269,20 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage -x ' { "j": "2.0", - "m": "v1/get_all_initial_leverage", + "m": "v1/vault_burn_tokens", "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 +12290,73 @@ LITE ENDPOINT: lite/v1/get_all_initial_leverage ```

-### Set Initial Leverage +### Vault Invest ``` -FULL ENDPOINT: full/v1/set_initial_leverage -LITE ENDPOINT: lite/v1/set_initial_leverage +FULL ENDPOINT: full/v1/vault_invest +LITE ENDPOINT: lite/v1/vault_invest ``` === "Request"
- -8<- "docs/schemas/api_set_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'", - "instrument": "BTC_USDT_Perp", - "leverage": "10" + "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'", - "i": "BTC_USDT_Perp", - "l": "10" + "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_set_initial_leverage_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" + } } ```
@@ -9674,9 +12370,20 @@ 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| + |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 @@ -9705,13 +12412,22 @@ 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_invest' \ --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", + "currency": "USDT", + "num_tokens": 1000000, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -9723,11 +12439,20 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/set_initial_leverage", + "method": "v1/vault_invest", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "leverage": "10" + "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 } @@ -9737,13 +12462,22 @@ 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_invest' \ --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", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -9755,11 +12489,20 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "j": "2.0", - "m": "v1/set_initial_leverage", + "m": "v1/vault_invest", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "l": "10" + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -9770,13 +12513,22 @@ 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_invest' \ --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", + "currency": "USDT", + "num_tokens": 1000000, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -9788,11 +12540,20 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/set_initial_leverage", + "method": "v1/vault_invest", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "leverage": "10" + "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 } @@ -9802,13 +12563,22 @@ 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_invest' \ --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", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -9820,11 +12590,20 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "j": "2.0", - "m": "v1/set_initial_leverage", + "m": "v1/vault_invest", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "l": "10" + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -9835,13 +12614,22 @@ 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_invest' \ --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", + "currency": "USDT", + "num_tokens": 1000000, + "signature": { + "signer": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "expiration": "1697788800000000000", + "nonce": 1234567890, + "chain_id": "325" + } } ' ``` @@ -9853,11 +12641,20 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/set_initial_leverage", + "method": "v1/vault_invest", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "leverage": "10" + "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 } @@ -9867,13 +12664,22 @@ 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_invest' \ --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", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -9885,11 +12691,20 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "j": "2.0", - "m": "v1/set_initial_leverage", + "m": "v1/vault_invest", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "l": "10" + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -9900,13 +12715,22 @@ 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_invest' \ --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" + --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" + } } ' ``` @@ -9918,11 +12742,20 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "jsonrpc": "2.0", - "method": "v1/set_initial_leverage", + "method": "v1/vault_invest", "params": { - "sub_account_id": "'$GRVT_SUB_ACCOUNT_ID'", - "instrument": "BTC_USDT_Perp", - "leverage": "10" + "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 } @@ -9932,13 +12765,22 @@ 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_invest' \ --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", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } } ' ``` @@ -9950,11 +12792,20 @@ LITE ENDPOINT: lite/v1/set_initial_leverage -x ' { "j": "2.0", - "m": "v1/set_initial_leverage", + "m": "v1/vault_invest", "p": { - "sa": "'$GRVT_SUB_ACCOUNT_ID'", - "i": "BTC_USDT_Perp", - "l": "10" + "vi": "3477045127917224", + "c": "USDT", + "nt": 1000000, + "s": { + "s": "0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0", + "r": "0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8", + "s1": "0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d", + "v": 28, + "e": "1697788800000000000", + "n": 1234567890, + "ci": "325" + } }, "i": 123 } @@ -9962,74 +12813,77 @@ LITE ENDPOINT: lite/v1/set_initial_leverage ```

-## Vault -### Vault Burn Tokens +### Vault Investor Summary ``` -FULL ENDPOINT: full/v1/vault_burn_tokens -LITE ENDPOINT: lite/v1/vault_burn_tokens +FULL ENDPOINT: full/v1/vault_investor_summary +LITE ENDPOINT: lite/v1/vault_investor_summary ``` === "Request"
- -8<- "docs/schemas/api_vault_burn_tokens_request.md" + -8<- "docs/schemas/api_vault_investor_summary_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" } ```
=== "Response"
- -8<- "docs/schemas/ack_response.md" + -8<- "docs/schemas/api_vault_investor_summary_response.md"
!!! success **Full Response** ``` { .json .copy } { - "result": { - "ack": "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 } { - "r": { - "a": "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 + }] } ```
@@ -10044,18 +12898,8 @@ 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.| + |7007|400|The investor is not an LP for this vault.|
!!! failure @@ -10084,22 +12928,11 @@ 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_investor_summary' \ --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" } ' ``` @@ -10111,20 +12944,9 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "jsonrpc": "2.0", - "method": "v1/vault_burn_tokens", + "method": "v1/vault_investor_summary", "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 } @@ -10134,22 +12956,11 @@ 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_investor_summary' \ --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" } ' ``` @@ -10161,20 +12972,9 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "j": "2.0", - "m": "v1/vault_burn_tokens", + "m": "v1/vault_investor_summary", "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 } @@ -10185,22 +12985,11 @@ 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_investor_summary' \ --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" } ' ``` @@ -10212,20 +13001,9 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "jsonrpc": "2.0", - "method": "v1/vault_burn_tokens", + "method": "v1/vault_investor_summary", "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 } @@ -10235,22 +13013,11 @@ 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_investor_summary' \ --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" } ' ``` @@ -10262,20 +13029,9 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "j": "2.0", - "m": "v1/vault_burn_tokens", + "m": "v1/vault_investor_summary", "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 } @@ -10286,22 +13042,11 @@ 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_investor_summary' \ --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" } ' ``` @@ -10313,20 +13058,9 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "jsonrpc": "2.0", - "method": "v1/vault_burn_tokens", + "method": "v1/vault_investor_summary", "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 } @@ -10336,22 +13070,11 @@ 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_investor_summary' \ --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" } ' ``` @@ -10363,20 +13086,9 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "j": "2.0", - "m": "v1/vault_burn_tokens", + "m": "v1/vault_investor_summary", "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 } @@ -10387,22 +13099,11 @@ 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_investor_summary' \ --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" } ' ``` @@ -10414,20 +13115,9 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "jsonrpc": "2.0", - "method": "v1/vault_burn_tokens", + "method": "v1/vault_investor_summary", "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 } @@ -10437,22 +13127,11 @@ 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_investor_summary' \ --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" } ' ``` @@ -10464,20 +13143,9 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens -x ' { "j": "2.0", - "m": "v1/vault_burn_tokens", + "m": "v1/vault_investor_summary", "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 } @@ -10485,15 +13153,15 @@ LITE ENDPOINT: lite/v1/vault_burn_tokens ```

-### Vault Invest +### Vault Redeem ``` -FULL ENDPOINT: full/v1/vault_invest -LITE ENDPOINT: lite/v1/vault_invest +FULL ENDPOINT: full/v1/vault_redeem +LITE ENDPOINT: lite/v1/vault_redeem ``` === "Request"
- -8<- "docs/schemas/api_vault_invest_request.md" + -8<- "docs/schemas/api_vault_redeem_request.md"
!!! question "Query" @@ -10566,19 +13234,9 @@ 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.| + |7001|400|Vault does not have sufficient LP token balance| + |7002|400|User has an ongoing redemption|
!!! failure @@ -10607,7 +13265,7 @@ 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' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10634,7 +13292,7 @@ LITE ENDPOINT: lite/v1/vault_invest -x ' { "jsonrpc": "2.0", - "method": "v1/vault_invest", + "method": "v1/vault_redeem", "params": { "vault_id": "3477045127917224", "currency": "USDT", @@ -10657,7 +13315,7 @@ 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' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10684,7 +13342,7 @@ LITE ENDPOINT: lite/v1/vault_invest -x ' { "j": "2.0", - "m": "v1/vault_invest", + "m": "v1/vault_redeem", "p": { "vi": "3477045127917224", "c": "USDT", @@ -10708,7 +13366,7 @@ 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' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10735,7 +13393,7 @@ LITE ENDPOINT: lite/v1/vault_invest -x ' { "jsonrpc": "2.0", - "method": "v1/vault_invest", + "method": "v1/vault_redeem", "params": { "vault_id": "3477045127917224", "currency": "USDT", @@ -10758,7 +13416,7 @@ 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' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10785,7 +13443,7 @@ LITE ENDPOINT: lite/v1/vault_invest -x ' { "j": "2.0", - "m": "v1/vault_invest", + "m": "v1/vault_redeem", "p": { "vi": "3477045127917224", "c": "USDT", @@ -10809,7 +13467,7 @@ 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' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10836,7 +13494,7 @@ LITE ENDPOINT: lite/v1/vault_invest -x ' { "jsonrpc": "2.0", - "method": "v1/vault_invest", + "method": "v1/vault_redeem", "params": { "vault_id": "3477045127917224", "currency": "USDT", @@ -10859,7 +13517,7 @@ 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' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10886,7 +13544,7 @@ LITE ENDPOINT: lite/v1/vault_invest -x ' { "j": "2.0", - "m": "v1/vault_invest", + "m": "v1/vault_redeem", "p": { "vi": "3477045127917224", "c": "USDT", @@ -10910,7 +13568,7 @@ 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' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10937,7 +13595,7 @@ LITE ENDPOINT: lite/v1/vault_invest -x ' { "jsonrpc": "2.0", - "method": "v1/vault_invest", + "method": "v1/vault_redeem", "params": { "vault_id": "3477045127917224", "currency": "USDT", @@ -10960,7 +13618,7 @@ 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' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -10987,7 +13645,7 @@ LITE ENDPOINT: lite/v1/vault_invest -x ' { "j": "2.0", - "m": "v1/vault_invest", + "m": "v1/vault_redeem", "p": { "vi": "3477045127917224", "c": "USDT", @@ -11008,15 +13666,15 @@ LITE ENDPOINT: lite/v1/vault_invest ```

-### Vault Investor Summary +### Vault Redeem Cancel ``` -FULL ENDPOINT: full/v1/vault_investor_summary -LITE ENDPOINT: lite/v1/vault_investor_summary +FULL ENDPOINT: full/v1/vault_redeem_cancel +LITE ENDPOINT: lite/v1/vault_redeem_cancel ``` === "Request"
- -8<- "docs/schemas/api_vault_investor_summary_request.md" + -8<- "docs/schemas/api_vault_redeem_cancel_request.md"
!!! question "Query" @@ -11035,50 +13693,24 @@ LITE ENDPOINT: lite/v1/vault_investor_summary
=== "Response"
- -8<- "docs/schemas/api_vault_investor_summary_response.md" + -8<- "docs/schemas/ack_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, - "request_time": "1697788800000000000", - "max_redemption_period_timestamp": 1727788800000000000, - "cancel_blocked": null - }, - "can_burn": null - }] + "result": { + "ack": "true" + } } ``` **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, - "rt": "1697788800000000000", - "mr": 1727788800000000000, - "cb": null - }, - "cb": null - }] + "r": { + "a": "true" + } } ```
@@ -11094,7 +13726,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 +13754,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_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11139,7 +13770,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "jsonrpc": "2.0", - "method": "v1/vault_investor_summary", + "method": "v1/vault_redeem_cancel", "params": { "vault_id": "3477045127917224" }, @@ -11151,7 +13782,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_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11167,7 +13798,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "j": "2.0", - "m": "v1/vault_investor_summary", + "m": "v1/vault_redeem_cancel", "p": { "vi": "3477045127917224" }, @@ -11180,7 +13811,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_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11196,7 +13827,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "jsonrpc": "2.0", - "method": "v1/vault_investor_summary", + "method": "v1/vault_redeem_cancel", "params": { "vault_id": "3477045127917224" }, @@ -11208,7 +13839,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_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11224,7 +13855,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "j": "2.0", - "m": "v1/vault_investor_summary", + "m": "v1/vault_redeem_cancel", "p": { "vi": "3477045127917224" }, @@ -11237,7 +13868,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_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11253,7 +13884,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "jsonrpc": "2.0", - "method": "v1/vault_investor_summary", + "method": "v1/vault_redeem_cancel", "params": { "vault_id": "3477045127917224" }, @@ -11265,7 +13896,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_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11281,7 +13912,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "j": "2.0", - "m": "v1/vault_investor_summary", + "m": "v1/vault_redeem_cancel", "p": { "vi": "3477045127917224" }, @@ -11294,7 +13925,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_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11310,7 +13941,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "jsonrpc": "2.0", - "method": "v1/vault_investor_summary", + "method": "v1/vault_redeem_cancel", "params": { "vault_id": "3477045127917224" }, @@ -11322,7 +13953,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_redeem_cancel' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ @@ -11338,7 +13969,7 @@ LITE ENDPOINT: lite/v1/vault_investor_summary -x ' { "j": "2.0", - "m": "v1/vault_investor_summary", + "m": "v1/vault_redeem_cancel", "p": { "vi": "3477045127917224" }, @@ -11348,72 +13979,90 @@ LITE ENDPOINT: lite/v1/vault_investor_summary ```

-### Vault Redeem +### Vault Redemption Queue ``` -FULL ENDPOINT: full/v1/vault_redeem -LITE ENDPOINT: lite/v1/vault_redeem +FULL ENDPOINT: full/v1/vault_view_redemption_queue +LITE ENDPOINT: lite/v1/vault_view_redemption_queue ``` === "Request"
- -8<- "docs/schemas/api_vault_redeem_request.md" + -8<- "docs/schemas/api_vault_view_redemption_queue_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" } ```
=== "Response"
- -8<- "docs/schemas/ack_response.md" + -8<- "docs/schemas/api_vault_view_redemption_queue_response.md"
!!! success **Full Response** ``` { .json .copy } { - "result": { - "ack": "true" + "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" } } ``` **Lite Response** ``` { .json .copy } { - "r": { - "a": "true" + "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" } } ``` @@ -11430,8 +14079,6 @@ LITE ENDPOINT: lite/v1/vault_redeem |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 +14107,11 @@ 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_view_redemption_queue' \ --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" } ' ``` @@ -11487,20 +14123,9 @@ LITE ENDPOINT: lite/v1/vault_redeem -x ' { "jsonrpc": "2.0", - "method": "v1/vault_redeem", + "method": "v1/vault_view_redemption_queue", "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 } @@ -11510,22 +14135,11 @@ 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_view_redemption_queue' \ --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" } ' ``` @@ -11537,20 +14151,9 @@ LITE ENDPOINT: lite/v1/vault_redeem -x ' { "j": "2.0", - "m": "v1/vault_redeem", + "m": "v1/vault_view_redemption_queue", "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 } @@ -11561,22 +14164,11 @@ 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_view_redemption_queue' \ --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" } ' ``` @@ -11588,20 +14180,9 @@ LITE ENDPOINT: lite/v1/vault_redeem -x ' { "jsonrpc": "2.0", - "method": "v1/vault_redeem", + "method": "v1/vault_view_redemption_queue", "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 } @@ -11611,22 +14192,11 @@ 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_view_redemption_queue' \ --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" } ' ``` @@ -11638,20 +14208,9 @@ LITE ENDPOINT: lite/v1/vault_redeem -x ' { "j": "2.0", - "m": "v1/vault_redeem", + "m": "v1/vault_view_redemption_queue", "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 } @@ -11662,47 +14221,25 @@ 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_view_redemption_queue' \ --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" } ' ``` !!! 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/vault_redeem", - "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" - } + ``` { .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/vault_view_redemption_queue", + "params": { + "vault_id": "3477045127917224" }, "id": 123 } @@ -11712,22 +14249,11 @@ 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_view_redemption_queue' \ --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" } ' ``` @@ -11739,20 +14265,9 @@ LITE ENDPOINT: lite/v1/vault_redeem -x ' { "j": "2.0", - "m": "v1/vault_redeem", + "m": "v1/vault_view_redemption_queue", "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 } @@ -11763,22 +14278,11 @@ 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_view_redemption_queue' \ --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" } ' ``` @@ -11790,20 +14294,9 @@ LITE ENDPOINT: lite/v1/vault_redeem -x ' { "jsonrpc": "2.0", - "method": "v1/vault_redeem", + "method": "v1/vault_view_redemption_queue", "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 } @@ -11813,22 +14306,11 @@ 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_view_redemption_queue' \ --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" } ' ``` @@ -11840,20 +14322,9 @@ LITE ENDPOINT: lite/v1/vault_redeem -x ' { "j": "2.0", - "m": "v1/vault_redeem", + "m": "v1/vault_view_redemption_queue", "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 } @@ -11861,51 +14332,71 @@ LITE ENDPOINT: lite/v1/vault_redeem ```

-### Vault Redeem Cancel +### Vault Manager Investment History ``` -FULL ENDPOINT: full/v1/vault_redeem_cancel -LITE ENDPOINT: lite/v1/vault_redeem_cancel +FULL ENDPOINT: full/v1/vault_manager_investor_history +LITE ENDPOINT: lite/v1/vault_manager_investor_history ``` === "Request"
- -8<- "docs/schemas/api_vault_redeem_cancel_request.md" + -8<- "docs/schemas/api_query_vault_manager_investor_history_request.md"
!!! question "Query" **Full Request** ``` { .json .copy } { - "vault_id": "3477045127917224" + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" } ``` **Lite Request** ``` { .json .copy } { - "vi": "3477045127917224" + "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" + }] } ```
@@ -11920,7 +14411,6 @@ 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|
!!! failure @@ -11949,11 +14439,14 @@ 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/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224" + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" } ' ``` @@ -11965,9 +14458,12 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "jsonrpc": "2.0", - "method": "v1/vault_redeem_cancel", + "method": "v1/vault_manager_investor_history", "params": { - "vault_id": "3477045127917224" + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" }, "id": 123 } @@ -11977,11 +14473,14 @@ 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/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224" + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" } ' ``` @@ -11993,9 +14492,12 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "j": "2.0", - "m": "v1/vault_redeem_cancel", + "m": "v1/vault_manager_investor_history", "p": { - "vi": "3477045127917224" + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" }, "i": 123 } @@ -12006,11 +14508,14 @@ 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/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224" + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" } ' ``` @@ -12022,9 +14527,12 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "jsonrpc": "2.0", - "method": "v1/vault_redeem_cancel", + "method": "v1/vault_manager_investor_history", "params": { - "vault_id": "3477045127917224" + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" }, "id": 123 } @@ -12034,11 +14542,14 @@ 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/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224" + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" } ' ``` @@ -12050,9 +14561,12 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "j": "2.0", - "m": "v1/vault_redeem_cancel", + "m": "v1/vault_manager_investor_history", "p": { - "vi": "3477045127917224" + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" }, "i": 123 } @@ -12063,11 +14577,14 @@ 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/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224" + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" } ' ``` @@ -12079,9 +14596,12 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "jsonrpc": "2.0", - "method": "v1/vault_redeem_cancel", + "method": "v1/vault_manager_investor_history", "params": { - "vault_id": "3477045127917224" + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" }, "id": 123 } @@ -12091,11 +14611,14 @@ 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/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224" + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" } ' ``` @@ -12107,9 +14630,12 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "j": "2.0", - "m": "v1/vault_redeem_cancel", + "m": "v1/vault_manager_investor_history", "p": { - "vi": "3477045127917224" + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" }, "i": 123 } @@ -12120,11 +14646,14 @@ 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/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vault_id": "3477045127917224" + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" } ' ``` @@ -12136,9 +14665,12 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "jsonrpc": "2.0", - "method": "v1/vault_redeem_cancel", + "method": "v1/vault_manager_investor_history", "params": { - "vault_id": "3477045127917224" + "vault_id": "2312134", + "only_own_investments": true, + "start_time": "1697788800000000000", + "end_time": "1697788800000000000" }, "id": 123 } @@ -12148,11 +14680,14 @@ 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/vault_manager_investor_history' \ --header "Cookie: $GRVT_COOKIE" \ --header "X-Grvt-Account-Id: $GRVT_ACCOUNT_ID" \ --data '{ - "vi": "3477045127917224" + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" } ' ``` @@ -12164,9 +14699,12 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel -x ' { "j": "2.0", - "m": "v1/vault_redeem_cancel", + "m": "v1/vault_manager_investor_history", "p": { - "vi": "3477045127917224" + "vi": "2312134", + "oo": true, + "st": "1697788800000000000", + "et": "1697788800000000000" }, "i": 123 } @@ -12174,91 +14712,54 @@ LITE ENDPOINT: lite/v1/vault_redeem_cancel ```

-### Vault Redemption Queue +## Builder +### 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 +14774,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 +14802,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 +14817,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 +14828,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 +14843,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 +14855,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 +14870,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 +14881,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 +14896,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 +14908,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 +14923,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 +14934,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 +14949,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 +14961,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 +14976,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 +14987,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 +15002,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 +15011,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 +15055,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 +15074,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 +15127,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 +15146,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 +15161,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 +15180,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 +15196,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 +15215,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 +15230,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 +15249,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 +15265,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 +15284,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 +15299,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 +15318,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 +15334,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 +15353,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 +15368,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 +15387,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..f0d7fcd 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( @@ -286,6 +318,14 @@ async def set_derisk_mm_ratio_v1( types.ApiSetDeriskToMaintenanceMarginRatioResponse, resp, Config(cast=[Enum]) ) + async def get_sub_accounts_v1( + self, req: types.EmptyRequest + ) -> types.ApiGetSubAccountsResponse | GrvtError: + resp = await self._post(True, self.td_rpc + "/full/v1/get_sub_accounts", req) + if resp.get("code"): + return GrvtError(**resp) + return from_dict(types.ApiGetSubAccountsResponse, resp, Config(cast=[Enum])) + async def get_all_initial_leverage_v1( self, req: types.ApiGetAllInitialLeverageRequest ) -> types.ApiGetAllInitialLeverageResponse | GrvtError: @@ -371,3 +411,23 @@ async def vault_manager_investment_history_v1( return from_dict( types.ApiQueryVaultManagerInvestorHistoryResponse, 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..104303b 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( @@ -278,6 +308,14 @@ def set_derisk_mm_ratio_v1( types.ApiSetDeriskToMaintenanceMarginRatioResponse, resp, Config(cast=[Enum]) ) + def get_sub_accounts_v1( + self, req: types.EmptyRequest + ) -> types.ApiGetSubAccountsResponse | GrvtError: + resp = self._post(True, self.td_rpc + "/full/v1/get_sub_accounts", req) + if resp.get("code"): + return GrvtError(**resp) + return from_dict(types.ApiGetSubAccountsResponse, resp, Config(cast=[Enum])) + def get_all_initial_leverage_v1( self, req: types.ApiGetAllInitialLeverageRequest ) -> types.ApiGetAllInitialLeverageResponse | GrvtError: @@ -357,3 +395,21 @@ def vault_manager_investment_history_v1( return from_dict( types.ApiQueryVaultManagerInvestorHistoryResponse, 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..4724f32 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,237 @@ 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 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 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)` + 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.
""" - entry_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 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)` + 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. """ - exit_price: str - # The mark price of the position, expressed in `9` decimals - mark_price: str + + # The subaccount ID cancelling the orders for + sub_account_id: str """ - The unrealized PnL of the position, expressed in quote asset decimal units - `unrealized_pnl = (mark_price - entry_price) * 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 """ - unrealized_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 realized PnL of the position, expressed in quote asset decimal units - `realized_pnl = (exit_price - entry_price) * exit_trade_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'` -> `'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. + """ - realized_pnl: str + time_to_live_ms: str | None = None + + +@dataclass +class ApiCandlestickRequest: """ - The total PnL of the position, expressed in quote asset decimal units - `total_pnl = realized_pnl + unrealized_pnl` + 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.
""" - total_pnl: 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 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 ROI of the position, expressed as a percentage - `roi = (total_pnl / (entry_price * abs(size))) * 100^` + The request to get the historical deposits of an account + The history is returned in reverse chronological order + Both finalized and pending deposits are returned, and pending deposits are indicated by an empty `confirmedTime` field. + + 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 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 ApiPositionsResponse: - # The positions matching the request filter - result: list[Positions] +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 +599,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 +607,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 +635,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 +652,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] - - -@dataclass -class ClientTier: - tier: int - futures_taker_fee: int - futures_maker_fee: int - options_taker_fee: int - options_maker_fee: int +class ApiGetAllInstrumentsResponse: + # List of instruments + result: list[InstrumentDisplay] @dataclass -class ApiFundingAccountSummaryResponse: - # The funding account summary - result: FundingAccountSummary - # Client fee tier at the time of query - tier: ClientTier +class ApiGetAuthorizedBuildersResponse: + # The list of authorized builders + results: list[ApiAuthorizedBuilder] @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 ApiGetCurrencyRequest: + pass @dataclass -class ApiSetInitialLeverageResponse: - # Whether the leverage was set successfully - success: bool +class ApiGetCurrencyResponse: + # The list of currencies + result: list[CurrencyDetail] @dataclass -class ApiGetAllInitialLeverageRequest: - # The sub account ID to get the leverage for - sub_account_id: str +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 InitialLeverageResult: - # The instrument to get the leverage for - 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 +class ApiGetFilteredInstrumentsResponse: + # The instruments matching the request filter + result: list[InstrumentDisplay] @dataclass -class ApiGetAllInitialLeverageResponse: - # The initial leverage of the sub account - results: list[InitialLeverageResult] +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 @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 +794,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 +805,253 @@ 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 ApiGetSubAccountsResponse: + # List of sub-account IDs accessible to the session + sub_account_ids: list[str] + + +@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 - # 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`) +class ApiOrderbookLevelsResponse: + # The orderbook levels objects matching the request asset + result: OrderbookLevels - 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. - """ +@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 - # 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 ApiPositionsResponse: + # The positions matching the request filter + result: list[Positions] @dataclass -class ApiTickerResponse: - # The mini ticker matching the request asset - result: Ticker +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 ApiTradeRequest: +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: + # 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 + + +@dataclass +class ApiSetInitialLeverageResponse: + # Whether the leverage was set successfully + success: bool + + +@dataclass +class ApiSetSubAccountPositionMarginConfigRequest: """ - 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. + 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 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 margin type and leverage for + sub_account_id: str + # The instrument of the position to set the margin type and leverage for instrument: 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: + """ + 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.
+ """ + + # 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 + limit: int | None = None + # The cursor to indicate when to start the next query from + cursor: str | None = None @dataclass -class Trade: - # Time at which the event was emitted in unix nanoseconds - event_time: str +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 - # 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 ApiTradeResponse: - # The public trades matching the request asset - result: list[Trade] +class ApiTickerResponse: + # The mini ticker matching the request asset + result: Ticker @dataclass @@ -1080,736 +1085,681 @@ 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 +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 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] - - -@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 + + # The unique identifier of the vault to fetch the summary for. + vault_id: str @dataclass -class WSSubscribeParams: +class ApiVaultInvestorSummaryResponse: """ - 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. + 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 to subscribe to - selectors: list[str] - # Whether to use the global sequence number for the stream - use_global_sequence_number: bool | None = None + # The summary of investments in the vault. + vault_investor_summary: list[VaultInvestorSummary] @dataclass -class WSSubscribeResult: - """ - 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. +class ApiVaultRedeemCancelRequest: """ + Request payload for canceling a vault redemption. - # 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 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 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 + Both finalized and pending withdrawals are returned, and pending withdrawals are indicated by an empty `l1Hash` field. + + 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 + + # 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 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 - - -@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, empty if the deposit is pending. + 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] +class Error: + # The error code for the request + code: int + # The error message for the request + message: str @dataclass -class ApiGetAllInstrumentsRequest: - # Fetch only active instruments - is_active: bool | None = None - +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 + # 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 ApiGetAllInstrumentsResponse: - # List of instruments - result: list[InstrumentDisplay] + 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 + # 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 @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 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] @dataclass -class ApiVaultInvestorHistory: +class FundingPayment: # 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 made the funding payment + sub_account_id: str + # The perpetual instrument being funded 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 currency of the funding payment + currency: str + # The amount of the funding payment. Positive if paid, negative if received + amount: str """ - The limit price of the order leg, expressed in `9` decimals. - This is the number of quote currency units to pay/receive for this leg. - This should be `null/0` if the order is a market order + The 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`. """ - limit_price: str | None = None + tx_id: str @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. - +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 - """ - # 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 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 @dataclass -class TriggerOrderMetadata: +class JSONRPCRequest: """ - 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. """ - # Type of the trigger order. eg: Take Profit, Stop Loss, etc - trigger_type: TriggerType + # 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 """ - 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 """ - tpsl: TPSLOrderMetadata + 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 +1795,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 + 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,301 +1826,537 @@ 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 + # 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 + # Upper bound of notional value (exclusive) in quote currency, omitted for last tier + notional_cap: str | None = None @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 - sub_account_id: str - # Filter for `order_id` - order_id: str | None = None - # Filter for `client_order_id` - client_order_id: str | None = None +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 ApiGetOrderResponse: - # The order object for the requested filter - result: Order +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 ApiCancelOnDisconnectRequest: +class TPSLOrderMetadata: """ - Auto-Cancel All Open Orders when the countdown time hits zero. + 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. - 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 + # 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: """ - Countdown time in milliseconds (ex. 120000 for 120s). + 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`) - 0 to disable the timer. + 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. - Does not accept negative values. + """ + + # 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 - Minimum acceptable value is 1,000. - Maximum acceptable value is 300,000 - """ - countdown_time: 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 WSOrderFeedSelectorV1: - """ - 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`). +class TriggerOrderMetadata: """ + Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL). - # The subaccount ID to filter by - sub_account_id: str - # The instrument filter to apply. - instrument: str | None = None + 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 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`. + + # Type of the trigger order. eg: Take Profit, Stop Loss, etc + trigger_type: TriggerType """ - 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 + Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders. -@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`). """ - - # The subaccount ID to filter by - sub_account_id: str - # The instrument filter to apply. - instrument: str | None = None + tpsl: TPSLOrderMetadata @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 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 WSOrderStateFeedDataV1: - # 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 VaultInvestorSummary: """ - sequence_number: str - # The Order State Feed - feed: OrderStateFeed - # The previous sequence number that determines the message order - prev_sequence_number: str - + Vault investor summary information. -@dataclass -class WSPositionsFeedSelectorV1: - """ - 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`). + 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 WSPositionsFeedDataV1: - # Stream name - stream: str - # Primary selector - selector: str +class VaultRedemption: """ - 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`. + Vault redemption information. + + This struct contains information about a pending redemption from a vault. """ - 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 + + # 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 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 +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 WSFillFeedDataV1: - # The websocket channel to which the response is sent +class WSCancelFeedDataV1: + # Stream name stream: str # Primary selector selector: str @@ -2179,55 +2369,30 @@ class WSFillFeedDataV1: - 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 + # 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 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`). +class WSCancelFeedSelectorV1: """ + 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 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 + # The subaccount ID to filter by + sub_account_id: str @dataclass -class WSTransferFeedDataV1: - # The websocket channel to which the response is sent +class WSCandlestickFeedDataV1: + # Stream name stream: str # Primary selector selector: str @@ -2240,33 +2405,25 @@ 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 + # A candlestick entry matching the request filters + feed: Candlestick # The previous sequence number that determines the message order prev_sequence_number: str @dataclass -class WSDepositFeedSelectorV1: +class WSCandlestickFeedSelectorV1: """ - 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`). + 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 main account ID to request for - main_account_id: str - - -@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 + # 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 @@ -2291,9 +2448,9 @@ class WSDepositFeedDataV1: @dataclass -class WSWithdrawalFeedSelectorV1: +class WSDepositFeedSelectorV1: """ - 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`). """ @@ -2302,21 +2459,7 @@ class WSWithdrawalFeedSelectorV1: @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 - - -@dataclass -class WSWithdrawalFeedDataV1: +class WSFillFeedDataV1: # The websocket channel to which the response is sent stream: str # Primary selector @@ -2330,30 +2473,39 @@ class WSWithdrawalFeedDataV1: - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`. """ sequence_number: str - # The Withdrawal object - feed: Withdrawal + # A private trade matching the request filter + feed: Fill # The previous sequence number that determines the message order prev_sequence_number: str @dataclass -class CancelStatusFeed: - # The subaccount ID that requested the cancellation +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 - # 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 + # The instrument filter to apply. + instrument: str | None = None @dataclass -class WSCancelFeedDataV1: +class WSListStreamsParams: + pass + + +@dataclass +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 @@ -2367,449 +2519,482 @@ 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 + # A mini ticker matching the request filter + feed: MiniTicker # The previous sequence number that determines the message order prev_sequence_number: str @dataclass -class WSCancelFeedSelectorV1: - """ - 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`. - +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 subaccount ID to filter by - sub_account_id: str - + 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.
-@dataclass -class ApiWithdrawalRequest: + 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: ''}
""" - 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 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 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 + 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 ApiTransferRequest: +class WSOrderFeedDataV1: + # 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 + 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 @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 - +class WSOrderFeedSelectorV1: + """ + 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`). + """ -@dataclass -class ApiTransferResponse: - # The Transfer response object - result: ApiTransferAck + # The subaccount ID to filter by + sub_account_id: str + # The instrument filter to apply. + instrument: str | None = None @dataclass -class ApiDepositHistoryRequest: +class WSOrderStateFeedDataV1: + # Stream name + stream: str + # Primary selector + selector: str """ - 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.
+ 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 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 + sequence_number: str + # The Order State Feed + feed: OrderStateFeed + # The previous sequence number that determines the message order + prev_sequence_number: str @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 +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`). + """ + + # 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, empty if the withdrawal is 'pending'. + l_1_hash: str | None = None diff --git a/src/codegen/apispec.json b/src/codegen/apispec.json index 57fb075..f852eeb 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 below minimum notional. Please try again with a higher price or size.", + "status": 400 + }, + { + "code": 2067, + "message": "Order below minimum notional. Please try reducing your position again with a higher price or size.", + "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 } ] }, @@ -1933,6 +2136,32 @@ } ] }, + { + "namespace": "Account", + "name": "RPCGetSubAccountsV1", + "version": 1, + "route": "/get_sub_accounts", + "auth_required": true, + "request": "EmptyRequest", + "response": "ApiGetSubAccountsResponse", + "on_request_errors": [ + { + "code": 1000, + "message": "You need to authenticate prior to using this functionality", + "status": 401 + }, + { + "code": 1002, + "message": "Internal Server Error", + "status": 500 + }, + { + "code": 1006, + "message": "You have surpassed the allocated rate limit for your tier", + "status": 429 + } + ] + }, { "namespace": "InitialLeverage", "name": "RPCGetAllInitialLeverageV1", @@ -2471,17 +2700,16 @@ "status": 401 } ] - } - ], - "streams": [ + }, { - "namespace": "Order", - "name": "StreamOrderV1", - "channel": "v1.order", + "namespace": "Builder", + "name": "RPCGetAuthorizedBuildersV1", + "version": 1, + "route": "/get_authorized_builders", "auth_required": true, - "feed_selector": "WSOrderFeedSelectorV1", - "feed": "WSOrderFeedDataV1", - "on_subscribe_errors": [ + "request": "EmptyRequest", + "response": "ApiGetAuthorizedBuildersResponse", + "on_request_errors": [ { "code": 1000, "message": "You need to authenticate prior to using this functionality", @@ -2498,45 +2726,31 @@ "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", + "code": 1003, + "message": "Request could not be processed due to malformed syntax", "status": 400 }, { - "code": 3000, - "message": "Instrument is invalid", - "status": 400 + "code": 1006, + "message": "You have surpassed the allocated rate limit for your tier", + "status": 429 }, { - "code": 3020, - "message": "Sub account ID must be an uint64 integer", - "status": 400 + "code": 1008, + "message": "Your IP has not been whitelisted for access", + "status": 401 } ] }, { - "namespace": "Order", - "name": "StreamOrderStateV1", - "channel": "v1.state", + "namespace": "Execution", + "name": "RPCBuilderFillHistoryV1", + "version": 1, + "route": "/builder_fill_history", "auth_required": true, - "feed_selector": "WSOrderStateFeedSelectorV1", - "feed": "WSOrderStateFeedDataV1", - "on_subscribe_errors": [ + "request": "ApiBuilderFillHistoryRequest", + "response": "ApiBuilderFillHistoryResponse", + "on_request_errors": [ { "code": 1000, "message": "You need to authenticate prior to using this functionality", @@ -2553,12 +2767,109 @@ "status": 500 }, { - "code": 1008, - "message": "Your IP has not been whitelisted for access", - "status": 401 + "code": 1003, + "message": "Request could not be processed due to malformed syntax", + "status": 400 }, { - "code": 1101, + "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 }, @@ -2864,409 +3175,347 @@ ], "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'", - "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'", + "example": "'3945034.23'", "comment": [ - "The ROI of the position, expressed as a percentage", - "`roi = (total_pnl / (entry_price * abs(size))) * 100^`" + "Total entry (initial investment) amount of the open investments, denominated in USD" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiAddIsolatedPositionMarginRequest", + "is_root": true, + "fields": [ { - "name": "quote_index_price", - "lite_name": "qi", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", - "index": 12, + "index": 0, "array_depth": 0, "optional": false, - "example": "'1.0000102'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The index price of the quote currency. (reported in `USD`)" + "The sub account ID to add isolated margin in or remove margin from" ] }, { - "name": "est_liquidation_price", - "lite_name": "el", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 13, + "index": 1, "array_depth": 0, "optional": false, - "example": "60000.25", + "example": "'BTC_USDT_Perp'", "comment": [ - "The estimated liquidation price" + "The instrument to add margin into, or remove margin from" ] }, { - "name": "leverage", - "lite_name": "l", + "name": "amount", + "lite_name": "a", "semantic_type": "string", "json_type": "string", - "index": 14, + "index": 2, "array_depth": 0, "optional": false, - "example": "'10'", + "example": "'123456.78'", "comment": [ - "The current leverage value for this position" + "The amount of margin to add to the position, positive to add, negative to remove, expressed in quote asset decimal units" ] }, { - "name": "cumulative_fee", - "lite_name": "cf", - "semantic_type": "string", - "json_type": "string", - "index": 15, + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 3, "array_depth": 0, "optional": false, - "example": "'100000.20'", "comment": [ - "The cumulative fee paid on the position, expressed in quote asset decimal units" + "The signature of this operation" ] - }, + } + ], + "comment": [ + "The request to add margin to a isolated position" + ] + }, + { + "name": "ApiAddIsolatedPositionMarginResponse", + "is_root": true, + "fields": [ { - "name": "cumulative_realized_funding_payment", - "lite_name": "cr", - "semantic_type": "string", - "json_type": "string", - "index": 16, + "name": "success", + "lite_name": "s", + "semantic_type": "bool", + "json_type": "boolean", + "index": 0, "array_depth": 0, "optional": false, - "example": "'100000.20'", + "example": "'true'", "comment": [ - "The cumulative realized funding payment of the position, expressed in quote asset decimal units. Positive if paid, negative if received" + "Whether the margin mode and leverage was set successfully" ] } ], - "comment": [] + "comment": [ + "The response to add margin to a isolated position" + ] }, { - "name": "ApiPositionsResponse", + "name": "ApiAggregatedAccountSummaryResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "Positions", - "json_type": "Positions", + "semantic_type": "AggregatedAccountSummary", + "json_type": "AggregatedAccountSummary", "index": 0, - "array_depth": 1, + "array_depth": 0, "optional": false, "comment": [ - "The positions matching the request filter" + "The aggregated account summary" ] } ], - "comment": [] + "comment": [ + "The aggregated account summary, that reports the total equity and spot balances of a funding (main) account, and its constituent trading (sub) accounts" + ] }, { - "name": "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 +3523,7 @@ "lite_name": "l", "semantic_type": "uint32", "json_type": "integer", - "index": 6, + "index": 3, "array_depth": 0, "optional": true, "default": "500", @@ -3288,326 +3537,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": "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": "ApiCancelAllOrdersRequest", + "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 participated in the trade" + "The subaccount ID cancelling all orders" ] }, { - "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 cancelled" + ] + }, + { + "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 instrument being represented" + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be cancelled" ] }, { - "name": "is_buyer", - "lite_name": "ib", - "semantic_type": "bool", - "json_type": "boolean", + "name": "quote", + "lite_name": "q", + "semantic_type": "string", + "json_type": "string", "index": 3, - "array_depth": 0, - "optional": false, - "example": "true", + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['USDT', 'USDC']", "comment": [ - "The side that the subaccount took on the trade" + "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": "is_taker", - "lite_name": "it", - "semantic_type": "bool", - "json_type": "boolean", - "index": 4, + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", + "json_type": "string", + "index": 0, "array_depth": 0, "optional": false, - "example": "true", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The role that the subaccount took on the trade" + "The subaccount ID cancelling the orders for" ] }, { - "name": "size", - "lite_name": "s", - "semantic_type": "string", + "name": "countdown_time", + "lite_name": "ct", + "semantic_type": "uint64", "json_type": "string", - "index": 5, + "index": 1, "array_depth": 0, - "optional": false, - "example": "'0.30'", + "optional": true, + "default": "1000", + "example": "300", "comment": [ - "The number of assets being traded, expressed in base asset decimal units" + "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": "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 order" ] }, { - "name": "mark_price", - "lite_name": "mp", - "semantic_type": "string", + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", "json_type": "string", - "index": 7, + "index": 1, "array_depth": 0, - "optional": false, - "example": "'65038.01'", + "optional": true, + "default": "0", + "example": "'0x1028403'", "comment": [ - "The mark price of the instrument at point of trade, expressed in `9` decimals" + "Cancel the order with this `order_id`" ] }, { - "name": "index_price", - "lite_name": "ip", - "semantic_type": "string", + "name": "client_order_id", + "lite_name": "co", + "semantic_type": "uint64", "json_type": "string", - "index": 8, + "index": 2, "array_depth": 0, - "optional": false, - "example": "'65038.01'", + "optional": true, + "default": "0", + "example": "'23042'", "comment": [ - "The index price of the instrument at point of trade, expressed in `9` decimals" + "Cancel the order with this `client_order_id`" ] }, { - "name": "interest_rate", - "lite_name": "ir", - "semantic_type": "string", + "name": "time_to_live_ms", + "lite_name": "tt", + "semantic_type": "uint64", "json_type": "string", - "index": 9, + "index": 3, "array_depth": 0, - "optional": false, - "example": "0.0003", + "optional": true, + "default": "100", + "example": "'500'", "comment": [ - "The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)" + "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": "forward_price", - "lite_name": "fp", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 10, + "index": 0, "array_depth": 0, "optional": false, - "example": "'65038.01'", + "example": "'BTC_USDT_Perp'", "comment": [ - "[Options] The forward price of the option at point of trade, 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": "realized_pnl", - "lite_name": "rp", - "semantic_type": "string", - "json_type": "string", - "index": 11, + "name": "interval", + "lite_name": "i1", + "semantic_type": "CandlestickInterval", + "json_type": "CandlestickInterval", + "index": 1, "array_depth": 0, "optional": false, - "example": "'2400.50'", "comment": [ - "The realized PnL of the trade, expressed in quote asset decimal units (0 if increasing position size)" + "The interval of each candlestick" ] }, { - "name": "fee", - "lite_name": "f", - "semantic_type": "string", - "json_type": "string", - "index": 12, + "name": "type", + "lite_name": "t", + "semantic_type": "CandlestickType", + "json_type": "CandlestickType", + "index": 2, "array_depth": 0, "optional": false, - "example": "'9.75'", "comment": [ - "The fees paid on the trade, expressed in quote asset decimal unit (negative if maker rebate applied)" + "The type of candlestick data to retrieve" ] }, { - "name": "fee_rate", - "lite_name": "fr", - "semantic_type": "string", + "name": "start_time", + "lite_name": "st", + "semantic_type": "timestamp", "json_type": "string", - "index": 13, + "index": 3, "array_depth": 0, - "optional": false, - "example": "0.0003", + "optional": true, + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "The fee rate paid on the trade" + "Start time of kline data in unix nanoseconds" ] }, { - "name": "trade_id", - "lite_name": "ti", - "semantic_type": "string", + "name": "end_time", + "lite_name": "et", + "semantic_type": "timestamp", "json_type": "string", - "index": 14, + "index": 4, "array_depth": 0, - "optional": false, - "example": "'209358-2'", + "optional": true, + "default": "now()", + "example": "'1697788800000000000'", "comment": [ - "A trade identifier, globally unique, and monotonically increasing (not by `1`).", - "All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.", - "`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`." - ] - }, - { - "name": "order_id", - "lite_name": "oi", - "semantic_type": "uint128", - "json_type": "string", - "index": 15, - "array_depth": 0, - "optional": false, - "example": "'0x10000101000203040506'", - "comment": [ - "An order identifier" - ] - }, - { - "name": "venue", - "lite_name": "v", - "semantic_type": "Venue", - "json_type": "Venue", - "index": 16, - "array_depth": 0, - "optional": false, - "example": "'ORDERBOOK'", - "comment": [ - "The venue where the trade occurred" + "End time of kline data in unix nanoseconds" ] }, { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", - "json_type": "string", - "index": 18, + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", + "index": 5, "array_depth": 0, - "optional": false, - "example": "'23042'", + "optional": true, + "default": "500", + "example": "500", "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 limit to query for. Defaults to 500; Max 1000" ] }, { - "name": "signer", - "lite_name": "s1", - "semantic_type": "uint256", + "name": "cursor", + "lite_name": "c", + "semantic_type": "string", "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, + "index": 6, "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", + "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 +3901,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 +4001,7 @@ "lite_name": "l", "semantic_type": "uint32", "json_type": "integer", - "index": 4, + "index": 3, "array_depth": 0, "optional": true, "default": "500", @@ -3701,126 +4012,210 @@ }, { "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", + "Both finalized and pending deposits are returned, and pending deposits are indicated by an empty `confirmedTime` field.", "", "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", - "json_type": "string", - "index": 2, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", + "index": 1, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['PERPETUAL']", "comment": [ - "The perpetual instrument being funded" + "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "currency", - "lite_name": "c", + "name": "base", + "lite_name": "b", "semantic_type": "string", "json_type": "string", - "index": 3, - "array_depth": 0, - "optional": false, - "example": "'USDT'", + "index": 2, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['BTC', 'ETH']", "comment": [ - "The currency of the funding payment" + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "amount", - "lite_name": "a", + "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" + ] + }, + { + "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,354 +4235,306 @@ "comment": [] }, { - "name": "ApiSubAccountSummaryRequest", + "name": "ApiFundingAccountSummaryResponse", "is_root": true, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 0, - "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", - "comment": [ - "The subaccount ID to filter by" - ] - } - ], - "comment": [] - }, - { - "name": "SpotBalance", - "is_root": false, - "fields": [ - { - "name": "currency", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "FundingAccountSummary", + "json_type": "FundingAccountSummary", "index": 0, "array_depth": 0, "optional": false, - "example": "'USDT'", "comment": [ - "The currency you hold a spot balance in" + "The funding account summary" ] }, { - "name": "balance", - "lite_name": "b", - "semantic_type": "string", - "json_type": "string", + "name": "tier", + "lite_name": "t", + "semantic_type": "ClientTier", + "json_type": "ClientTier", "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`)" + "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": "SubAccount", - "is_root": false, + "name": "ApiFundingPaymentHistoryRequest", + "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": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 1, "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "optional": true, + "default": "all", + "example": "'BTC_USDT_Perp'", "comment": [ - "The sub account ID this entry refers to" + "The perpetual instrument to filter for" ] }, { - "name": "margin_type", - "lite_name": "mt", - "semantic_type": "MarginType", - "json_type": "MarginType", + "name": "start_time", + "lite_name": "st", + "semantic_type": "int64", + "json_type": "string", "index": 2, "array_depth": 0, - "optional": false, - "example": "'SIMPLE_CROSS_MARGIN'", + "optional": true, + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "The type of margin algorithm this subaccount uses" + "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": "settle_currency", - "lite_name": "sc", - "semantic_type": "string", + "name": "end_time", + "lite_name": "et", + "semantic_type": "int64", "json_type": "string", "index": 3, "array_depth": 0, - "optional": false, - "example": "'USDT'", + "optional": true, + "default": "now()", + "example": "'1697788800000000000'", "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" + "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": "unrealized_pnl", - "lite_name": "up", - "semantic_type": "string", - "json_type": "string", + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", "index": 4, "array_depth": 0, - "optional": false, - "example": "'123456.78'", + "optional": true, + "default": "500", + "example": "500", "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`" + "The limit to query for. Defaults to 500; Max 1000" ] }, { - "name": "total_equity", - "lite_name": "te", + "name": "cursor", + "lite_name": "c", "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'", - "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, + "example": "'Qw0918='", "comment": [ - "Whether this sub account is a vault" + "The cursor to indicate when to start the query from" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiFundingRate", + "is_root": false, + "fields": [ { - "name": "vault_im_additions", - "lite_name": "vi", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 13, + "index": 0, "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "Total amount of IM (reported in `settle_currency`) deducted from the vault due to redemptions nearing the end of their redemption period" + "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": "derisk_margin", - "lite_name": "dm", + "name": "funding_rate", + "lite_name": "fr", "semantic_type": "string", "json_type": "string", - "index": 14, + "index": 1, "array_depth": 0, "optional": false, - "example": "'185185.77'", + "example": "0.0003", "comment": [ - "The derisk margin of this sub account" + "The funding rate of the instrument, expressed in percentage points" ] }, { - "name": "derisk_to_maintenance_margin_ratio", - "lite_name": "dt", - "semantic_type": "string", + "name": "funding_time", + "lite_name": "ft", + "semantic_type": "timestamp", "json_type": "string", - "index": 15, + "index": 2, "array_depth": 0, "optional": false, - "example": "'1.5'", + "example": "'1697788800000000000'", "comment": [ - "The derisk margin to maintenance margin ratio of this sub account" + "The funding timestamp of the funding rate, expressed in unix nanoseconds" ] }, { - "name": "total_cross_equity", - "lite_name": "tc", + "name": "mark_price", + "lite_name": "mp", "semantic_type": "string", "json_type": "string", - "index": 16, + "index": 3, "array_depth": 0, "optional": false, - "example": "'123456.78'", + "example": "'65038.01'", "comment": [ - "The total equity of this sub account for cross margin" + "The mark price of the instrument at funding timestamp, expressed in `9` decimals" ] }, { - "name": "cross_unrealized_pnl", - "lite_name": "cu", + "name": "funding_rate_8_h_avg", + "lite_name": "fr1", "semantic_type": "string", "json_type": "string", - "index": 17, + "index": 4, "array_depth": 0, "optional": false, - "example": "'123456.78'", + "example": "0.0003", "comment": [ - "The unrealized PnL of this sub account for cross margin" + "Deprecated: Refer to `funding_rate` instead. Will be removed in a future release." ] - } - ], - "comment": [] - }, - { - "name": "ApiSubAccountSummaryResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "SubAccount", - "json_type": "SubAccount", - "index": 0, + "name": "funding_interval_hours", + "lite_name": "fi", + "semantic_type": "uint8", + "json_type": "integer", + "index": 5, "array_depth": 0, "optional": false, + "example": "8", "comment": [ - "The sub account matching the request sub account" + "Funding interval in hours (e.g. 1/4/8/etc)." ] } ], - "comment": [ - "Query for sub-account details, including base currency balance, all derivative positions, margin levels, and P\u0026L." - ] + "comment": [] }, { - "name": "ApiSubAccountHistoryRequest", + "name": "ApiFundingRateRequest", "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 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" ] }, { @@ -4201,7 +4548,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 +4562,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 +4590,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 +4637,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,356 +4648,1088 @@ "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", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The trading account ID of the vault invested in." + "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": "results", + "lite_name": "r", + "semantic_type": "InitialLeverageResult", + "json_type": "InitialLeverageResult", + "index": 0, + "array_depth": 1, + "optional": false, + "comment": [ + "The initial leverage of the sub account" + ] + } + ], + "comment": [ + "The response to get the initial leverage of a sub account" + ] + }, + { + "name": "ApiGetAllInstrumentsRequest", + "is_root": true, + "fields": [ + { + "name": "is_active", + "lite_name": "ia", + "semantic_type": "bool", + "json_type": "boolean", + "index": 0, + "array_depth": 0, + "optional": true, + "default": "false", + "example": "true", + "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" + ] + } + ], + "comment": [] + }, + { + "name": "ApiGetAuthorizedBuildersResponse", + "is_root": true, + "fields": [ + { + "name": "results", + "lite_name": "r", + "semantic_type": "ApiAuthorizedBuilder", + "json_type": "ApiAuthorizedBuilder", + "index": 0, + "array_depth": 1, + "optional": false, + "comment": [ + "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": "result", + "lite_name": "r", + "semantic_type": "CurrencyDetail", + "json_type": "CurrencyDetail", + "index": 0, + "array_depth": 1, + "optional": false, + "comment": [ + "The list of currencies" + ] + } + ], + "comment": [ + "The list of currencies" + ] + }, + { + "name": "ApiGetFilteredInstrumentsRequest", + "is_root": true, + "fields": [ + { + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", + "index": 0, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['PERPETUAL']", + "comment": [ + "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" + ] + }, + { + "name": "base", + "lite_name": "b", + "semantic_type": "string", + "json_type": "string", + "index": 1, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['BTC', 'ETH']", + "comment": [ + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" + ] + }, + { + "name": "quote", + "lite_name": "q", + "semantic_type": "string", + "json_type": "string", + "index": 2, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['USDT', 'USDC']", + "comment": [ + "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" + ] + }, + { + "name": "is_active", + "lite_name": "ia", + "semantic_type": "bool", + "json_type": "boolean", + "index": 3, + "array_depth": 0, + "optional": true, + "default": "false", + "example": "true", + "comment": [ + "Request for active instruments only" + ] + }, + { + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", + "index": 4, + "array_depth": 0, + "optional": true, + "default": "500", + "example": "500", + "comment": [ + "The limit to query for. Defaults to 500; Max 100000" + ] + } + ], + "comment": [ + "Fetch a list of instruments based on the filters provided" + ] + }, + { + "name": "ApiGetFilteredInstrumentsResponse", + "is_root": true, + "fields": [ + { + "name": "result", + "lite_name": "r", + "semantic_type": "InstrumentDisplay", + "json_type": "InstrumentDisplay", + "index": 0, + "array_depth": 1, + "optional": false, + "comment": [ + "The instruments matching the request filter" + ] + } + ], + "comment": [] + }, + { + "name": "ApiGetInstrumentRequest", + "is_root": true, + "fields": [ + { + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "'BTC_USDT_Perp'", + "comment": [ + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" + ] + } + ], + "comment": [ + "Fetch a single instrument by supplying the asset or instrument name" + ] + }, + { + "name": "ApiGetInstrumentResponse", + "is_root": true, + "fields": [ + { + "name": "result", + "lite_name": "r", + "semantic_type": "InstrumentDisplay", + "json_type": "InstrumentDisplay", + "index": 0, + "array_depth": 0, + "optional": false, + "comment": [ + "The instrument matching the request asset" + ] + } + ], + "comment": [] + }, + { + "name": "ApiGetIsolatedPositionMarginLimitsRequest", + "is_root": true, + "fields": [ + { + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", + "json_type": "string", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "'$GRVT_SUB_ACCOUNT_ID'", + "comment": [ + "The sub account ID to get the margin limits for" + ] + }, + { + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'BTC_USDT_Perp'", + "comment": [ + "The isolated position asset to get the margin limits for" + ] + } + ], + "comment": [ + "The request to get the max addable and removable amount for an isolated position" + ] + }, + { + "name": "ApiGetIsolatedPositionMarginLimitsResponse", + "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 isolated position asset" + ] + }, + { + "name": "max_addable_amount", + "lite_name": "ma", + "semantic_type": "string", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'123456.78'", + "comment": [ + "The max addable amount that can be added to the isolated position, expressed in quote asset decimal units" + ] + }, + { + "name": "max_removable_amount", + "lite_name": "mr", + "semantic_type": "string", + "json_type": "string", + "index": 2, + "array_depth": 0, + "optional": false, + "example": "'123456.78'", + "comment": [ + "The max removable amount that can be removed from the isolated position, expressed in quote asset decimal units" + ] + } + ], + "comment": [ + "The response to get the max addable and removable amount for an isolated position request" + ] + }, + { + "name": "ApiGetMarginRulesRequest", + "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 instrument to query margin rules for" + ] + } + ], + "comment": [ + "API request payload to get margin rules for a particular instrument" + ] + }, + { + "name": "ApiGetMarginRulesResponse", + "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 instrument name" + ] + }, + { + "name": "max_position_size", + "lite_name": "mp", + "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, + "comment": [ + "List of risk brackets defining margin requirements at different notional tiers" + ] + } + ], + "comment": [ + "API response payload for margin rules of a particular instrument" + ] + }, + { + "name": "ApiGetOrderRequest", + "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" + ] + }, + { + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": true, + "default": "0", + "example": "'0x1028403'", + "comment": [ + "Filter for `order_id`" + ] + }, + { + "name": "client_order_id", + "lite_name": "co", + "semantic_type": "uint64", + "json_type": "string", + "index": 2, + "array_depth": 0, + "optional": true, + "default": "0", + "example": "'23042'", + "comment": [ + "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": "num_lp_tokens", - "lite_name": "nl", - "semantic_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "Order", + "json_type": "Order", + "index": 0, + "array_depth": 0, + "optional": false, + "comment": [ + "The order object for the requested filter" + ] + } + ], + "comment": [] + }, + { + "name": "ApiGetSubAccountsResponse", + "is_root": true, + "fields": [ + { + "name": "sub_account_ids", + "lite_name": "sa", + "semantic_type": "uint64", + "json_type": "string", + "index": 0, + "array_depth": 1, + "optional": false, + "example": "[\"4724219064482495\",\"2095919380\",\"1170592370\"]", + "comment": [ + "List of sub-account IDs accessible to the session" + ] + } + ], + "comment": [ + "Response payload containing all sub-accounts accessible within the given auth session" + ] + }, + { + "name": "ApiMiniTickerRequest", + "is_root": true, + "fields": [ + { + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", + "index": 0, + "array_depth": 0, + "optional": false, + "example": "'BTC_USDT_Perp'", + "comment": [ + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" + ] + } + ], + "comment": [ + "Retrieves a single mini ticker value for a single instrument. Please do not use this to repeatedly poll for data -- a websocket subscription is much more performant, and useful." + ] + }, + { + "name": "ApiMiniTickerResponse", + "is_root": true, + "fields": [ + { + "name": "result", + "lite_name": "r", + "semantic_type": "MiniTicker", + "json_type": "MiniTicker", + "index": 0, + "array_depth": 0, + "optional": false, + "comment": [ + "The mini ticker matching the request asset" + ] + } + ], + "comment": [] + }, + { + "name": "ApiOpenOrdersRequest", + "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" + ] + }, + { + "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']", + "comment": [ + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" + ] + }, + { + "name": "quote", + "lite_name": "q", + "semantic_type": "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": [] + }, + { + "name": "ApiOpenOrdersResponse", + "is_root": true, + "fields": [ + { + "name": "result", + "lite_name": "r", + "semantic_type": "Order", + "json_type": "Order", + "index": 0, + "array_depth": 1, + "optional": false, + "comment": [ + "The Open Orders matching the request filter" + ] + } + ], + "comment": [ + "Retrieves all open orders for the account. This may not match new orders in flight." + ] + }, + { + "name": "ApiOrderHistoryRequest", + "is_root": true, + "fields": [ + { + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", + "json_type": "string", + "index": 0, "array_depth": 0, "optional": false, - "example": "1000000", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The number of shares held by the investor." + "The subaccount ID to filter by" ] }, { - "name": "share_price", - "lite_name": "sp", + "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']", + "comment": [ + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" + ] + }, + { + "name": "quote", + "lite_name": "q", + "semantic_type": "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, + "array_depth": 0, + "optional": true, + "default": "0", + "example": "'1697788800000000000'", + "comment": [ + "The start time to apply in nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned" + ] + }, + { + "name": "end_time", + "lite_name": "et", + "semantic_type": "int64", + "json_type": "string", + "index": 5, + "array_depth": 0, + "optional": true, + "default": "now()", + "example": "'1697788800000000000'", + "comment": [ + "The end time to apply in nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned" + ] + }, + { + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", + "index": 6, "array_depth": 0, - "optional": false, - "example": "1000000", + "optional": true, + "default": "500", + "example": "500", "comment": [ - "The current share price (in USD) of this vault investment." + "The limit to query for. Defaults to 500; Max 1000" ] }, { - "name": "usd_notional_invested", - "lite_name": "un", + "name": "cursor", + "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 3, + "index": 7, "array_depth": 0, - "optional": false, - "example": "1000000", + "optional": true, + "default": "''", + "example": "''", "comment": [ - "The USD notional invested in this vault investment." + "The cursor to indicate when to start the query from" ] } ], "comment": [ - "Summarizes a vault investment held by a funding account" + "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": "AggregatedAccountSummary", - "is_root": false, + "name": "ApiOrderHistoryResponse", + "is_root": true, "fields": [ { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "Order", + "json_type": "Order", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "The main account ID of the account to which the summary belongs" + "The Open Orders matching the request filter" ] }, { - "name": "total_equity", - "lite_name": "te", + "name": "next", + "lite_name": "n", "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'3945034.23'", + "example": "'Qw0918='", "comment": [ - "Total equity of the main (+ sub) account, denominated in USD" + "The cursor to indicate when to start the query from" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiOrderbookLevelsRequest", + "is_root": true, + "fields": [ { - "name": "spot_balances", - "lite_name": "sb", - "semantic_type": "SpotBalance", - "json_type": "SpotBalance", - "index": 2, - "array_depth": 1, + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", + "index": 0, + "array_depth": 0, "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The list of spot assets owned by this main (+ sub) account, and their balances" + "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_investments", - "lite_name": "vi", - "semantic_type": "VaultInvestment", - "json_type": "VaultInvestment", - "index": 3, - "array_depth": 1, + "name": "depth", + "lite_name": "d", + "semantic_type": "uint32", + "json_type": "integer", + "index": 1, + "array_depth": 0, "optional": false, + "example": "50", "comment": [ - "The list of vault investments held by this main account" + "Depth of the order book to be retrieved (10, 50, 100, 500)" ] - }, + } + ], + "comment": [ + "Retrieves aggregated price depth for a single instrument, with a maximum depth of 10 levels. Do not use this to poll for data -- a websocket subscription is much more performant, and useful." + ] + }, + { + "name": "ApiOrderbookLevelsResponse", + "is_root": true, + "fields": [ { - "name": "total_sub_account_balance", - "lite_name": "ts", - "semantic_type": "string", - "json_type": "string", - "index": 4, + "name": "result", + "lite_name": "r", + "semantic_type": "OrderbookLevels", + "json_type": "OrderbookLevels", + "index": 0, "array_depth": 0, "optional": false, - "example": "'3945034.23'", "comment": [ - "Deprecated: Use totalSubAccountEquity instead" + "The orderbook levels objects matching the request asset" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiPositionsRequest", + "is_root": true, + "fields": [ { - "name": "total_sub_account_equity", - "lite_name": "ts1", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", - "index": 5, + "index": 0, "array_depth": 0, "optional": false, - "example": "'3945034.23'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "Total equity of the sub accounts, denominated in USD" + "The sub account ID to request for" ] }, { - "name": "total_vault_investments_balance", - "lite_name": "tv", - "semantic_type": "string", - "json_type": "string", - "index": 6, - "array_depth": 0, - "optional": false, - "example": "'3945034.23'", + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", + "index": 1, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['PERPETUAL']", "comment": [ - "Total amount of the vault investments, denominated in USD" + "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_available_balance", - "lite_name": "ts2", + "name": "base", + "lite_name": "b", "semantic_type": "string", "json_type": "string", - "index": 7, - "array_depth": 0, - "optional": false, - "example": "'3945034.23'", + "index": 2, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['BTC', 'ETH']", "comment": [ - "Total available balance of the main account, denominated in USD" + "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" ] }, { - "name": "total_usd_notional_invested", - "lite_name": "tu", + "name": "quote", + "lite_name": "q", "semantic_type": "string", "json_type": "string", - "index": 8, - "array_depth": 0, - "optional": false, - "example": "'3945034.23'", + "index": 3, + "array_depth": 1, + "optional": true, + "default": "all", + "example": "['USDT', 'USDC']", "comment": [ - "Total entry (initial investment) amount of the open investments, denominated in USD" + "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": "ApiAggregatedAccountSummaryResponse", + "name": "ApiPositionsResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "AggregatedAccountSummary", - "json_type": "AggregatedAccountSummary", + "semantic_type": "Positions", + "json_type": "Positions", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, "comment": [ - "The aggregated account summary" + "The positions 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": "ApiQueryVaultManagerInvestorHistoryRequest", + "is_root": true, "fields": [ { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", + "name": "vault_id", + "lite_name": "vi", + "semantic_type": "uint64", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "example": "'2312134'", "comment": [ - "The main account ID of the account to which the summary belongs" + "The unique identifier of the vault to filter by" ] }, { - "name": "total_equity", - "lite_name": "te", - "semantic_type": "string", - "json_type": "string", + "name": "only_own_investments", + "lite_name": "oo", + "semantic_type": "bool", + "json_type": "boolean", "index": 1, "array_depth": 0, "optional": false, - "example": "'3945034.23'", + "example": "true", "comment": [ - "Total equity of the main account, denominated in USD" + "Whether to only return investments made by the manager" ] }, { - "name": "spot_balances", - "lite_name": "sb", - "semantic_type": "SpotBalance", - "json_type": "SpotBalance", + "name": "start_time", + "lite_name": "st", + "semantic_type": "timestamp", + "json_type": "string", "index": 2, - "array_depth": 1, - "optional": false, + "array_depth": 0, + "optional": true, + "default": "0", + "example": "'1697788800000000000'", + "comment": [ + "Optional. Start time in unix nanoseconds" + ] + }, + { + "name": "end_time", + "lite_name": "et", + "semantic_type": "timestamp", + "json_type": "string", + "index": 3, + "array_depth": 0, + "optional": true, + "default": "now()", + "example": "'1697788800000000000'", "comment": [ - "The list of spot assets owned by this main account, and their balances" + "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": "vault_investments", - "lite_name": "vi", - "semantic_type": "VaultInvestment", - "json_type": "VaultInvestment", - "index": 3, + "name": "result", + "lite_name": "r", + "semantic_type": "ApiVaultInvestorHistory", + "json_type": "ApiVaultInvestorHistory", + "index": 0, "array_depth": 1, "optional": false, "comment": [ - "The list of vault investments held by this main account" + "The list of vault investor history belong to the manager" ] } ], "comment": [ - "The funding account summary, that reports the total equity and spot balances of a funding (main) account" + "Response to retrieve the vault summary for a given vault" ] }, { - "name": "ClientTier", - "is_root": false, + "name": "ApiSetDeriskToMaintenanceMarginRatioRequest", + "is_root": true, "fields": [ { - "name": "tier", - "lite_name": "t", - "semantic_type": "uint8", - "json_type": "integer", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "comment": [] + "example": "'$GRVT_SUB_ACCOUNT_ID'", + "comment": [ + "The sub account ID to set the leverage for" + ] }, { - "name": "futures_taker_fee", - "lite_name": "ft", - "semantic_type": "int32", - "json_type": "integer", + "name": "ratio", + "lite_name": "r", + "semantic_type": "string", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "comment": [] + "example": "'1.5'", + "comment": [ + "The derisk margin to maintenance margin ratio of this sub account" + ] }, { - "name": "futures_maker_fee", - "lite_name": "fm", - "semantic_type": "int32", - "json_type": "integer", + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", "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 signature of this operation" + ] } ], - "comment": [] + "comment": [ + "The request to set the derisk margin to maintenance margin ratio of a sub account" + ] }, { - "name": "ApiFundingAccountSummaryResponse", + "name": "ApiSetDeriskToMaintenanceMarginRatioResponse", "is_root": true, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "FundingAccountSummary", - "json_type": "FundingAccountSummary", + "name": "success", + "lite_name": "s", + "semantic_type": "bool", + "json_type": "boolean", "index": 0, "array_depth": 0, "optional": false, + "example": "'true'", "comment": [ - "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" + "Whether the derisk margin to maintenance margin ratio was set successfully" ] } ], "comment": [ - "The funding account summary, that reports the total equity and spot balances of a funding (main) account" + "The response to set the derisk margin to maintenance margin ratio of a sub account" ] }, { @@ -4712,7 +5803,7 @@ ] }, { - "name": "ApiGetAllInitialLeverageRequest", + "name": "ApiSetSubAccountPositionMarginConfigRequest", "is_root": true, "fields": [ { @@ -4725,267 +5816,247 @@ "optional": false, "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The sub account ID to get the leverage for" + "The sub account ID to set the margin type and leverage for" ] - } - ], - "comment": [ - "The request to get the initial leverage of a sub account" - ] - }, - { - "name": "InitialLeverageResult", - "is_root": false, - "fields": [ + }, { "name": "instrument", "lite_name": "i", "semantic_type": "asset", "json_type": "string", - "index": 0, + "index": 1, "array_depth": 0, "optional": false, "example": "'BTC_USDT_Perp'", "comment": [ - "The instrument to get the leverage for" + "The instrument of the position to set the margin type and leverage for" ] }, { - "name": "leverage", - "lite_name": "l", - "semantic_type": "string", - "json_type": "string", - "index": 1, + "name": "margin_type", + "lite_name": "mt", + "semantic_type": "PositionMarginType", + "json_type": "PositionMarginType", + "index": 2, "array_depth": 0, "optional": false, - "example": "'10'", "comment": [ - "The initial leverage of the sub account" + "The margin type to set for the position" ] }, { - "name": "min_leverage", - "lite_name": "ml", + "name": "leverage", + "lite_name": "l", "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 3, "array_depth": 0, "optional": false, - "example": "'10'", + "example": "'1.5'", "comment": [ - "The min leverage this sub account can set" + "The leverage to set for the position" ] }, { - "name": "max_leverage", - "lite_name": "ml1", - "semantic_type": "string", - "json_type": "string", - "index": 3, + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 4, "array_depth": 0, "optional": false, - "example": "'50'", "comment": [ - "The max leverage this sub account can set" + "The signature of this operation" ] } ], - "comment": [] + "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": "ApiGetAllInitialLeverageResponse", + "name": "ApiSetSubAccountPositionMarginConfigResponse", "is_root": true, "fields": [ { - "name": "results", - "lite_name": "r", - "semantic_type": "InitialLeverageResult", - "json_type": "InitialLeverageResult", + "name": "ack", + "lite_name": "a", + "semantic_type": "bool", + "json_type": "boolean", "index": 0, - "array_depth": 1, + "array_depth": 0, "optional": false, + "example": "'true'", "comment": [ - "The initial leverage of the sub account" + "Whether the margin type and leverage was acked" ] } ], "comment": [ - "The response to get the initial leverage of a sub account" + "The response to set the margin type and leverage for a position" ] }, { - "name": "Signature", - "is_root": false, + "name": "ApiSubAccountHistoryRequest", + "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 sub account ID to request for" ] }, { - "name": "r", - "lite_name": "r", - "semantic_type": "uint256", + "name": "start_time", + "lite_name": "st", + "semantic_type": "timestamp", "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'", + "optional": true, + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "Signature V" + "Start time of sub account history in unix nanoseconds" ] }, { - "name": "expiration", - "lite_name": "e", + "name": "end_time", + "lite_name": "et", "semantic_type": "timestamp", "json_type": "string", - "index": 4, + "index": 2, "array_depth": 0, - "optional": false, + "optional": true, + "default": "now()", "example": "'1697788800000000000'", "comment": [ - "Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days" + "End time of sub account history in unix nanoseconds" ] }, { - "name": "nonce", - "lite_name": "n", + "name": "limit", + "lite_name": "l", "semantic_type": "uint32", "json_type": "integer", - "index": 5, + "index": 3, "array_depth": 0, - "optional": false, - "example": "'1234567890'", + "optional": true, + "default": "500", + "example": "500", "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 limit to query for. Defaults to 500; Max 1000" ] }, { - "name": "chain_id", - "lite_name": "ci", - "semantic_type": "uint64", + "name": "cursor", + "lite_name": "c", + "semantic_type": "string", "json_type": "string", - "index": 6, + "index": 4, "array_depth": 0, - "optional": false, - "example": "'325'", + "optional": true, + "default": "''", + "example": "''", "comment": [ - "Chain ID used in EIP-712 domain. Zero value fallbacks to GRVT Chain ID." + "The cursor to indicate when to start the next query from" ] } ], - "comment": [] + "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": "ApiSetDeriskToMaintenanceMarginRatioRequest", + "name": "ApiSubAccountHistoryResponse", "is_root": true, "fields": [ { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "SubAccount", + "json_type": "SubAccount", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The sub account ID to set the leverage for" + "The sub account history matching the request sub account" ] }, { - "name": "ratio", - "lite_name": "r", + "name": "next", + "lite_name": "n", "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'1.5'", + "example": "'Qw0918='", "comment": [ - "The derisk margin to maintenance margin ratio of this sub account" + "The cursor to indicate when to start the next query from" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiSubAccountSummaryRequest", + "is_root": true, + "fields": [ { - "name": "signature", - "lite_name": "s", - "semantic_type": "Signature", - "json_type": "Signature", - "index": 2, + "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 signature of this operation" + "The subaccount ID to filter by" ] } ], - "comment": [ - "The request to set the derisk margin to maintenance margin ratio of a sub account" - ] + "comment": [] }, { - "name": "ApiSetDeriskToMaintenanceMarginRatioResponse", + "name": "ApiSubAccountSummaryResponse", "is_root": true, "fields": [ { - "name": "success", - "lite_name": "s", - "semantic_type": "bool", - "json_type": "boolean", + "name": "result", + "lite_name": "r", + "semantic_type": "SubAccount", + "json_type": "SubAccount", "index": 0, "array_depth": 0, "optional": false, - "example": "'true'", "comment": [ - "Whether the derisk margin to maintenance margin ratio was set successfully" + "The sub account matching the request sub account" ] } ], "comment": [ - "The response to set the derisk margin to maintenance margin ratio of a sub account" + "Query for sub-account details, including base currency balance, all derivative positions, margin levels, and P\u0026L." ] }, { - "name": "ApiGetMarginRulesRequest", + "name": "ApiTickerRequest", "is_root": true, "fields": [ { @@ -4998,161 +6069,150 @@ "optional": false, "example": "'BTC_USDT_Perp'", "comment": [ - "The instrument to query margin rules 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" ] } ], "comment": [ - "API request payload to get margin rules for a particular instrument" + "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": "RiskBracket", - "is_root": false, + "name": "ApiTickerResponse", + "is_root": true, "fields": [ { - "name": "tier", - "lite_name": "t", - "semantic_type": "uint32", - "json_type": "integer", + "name": "result", + "lite_name": "r", + "semantic_type": "Ticker", + "json_type": "Ticker", "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" + "The mini ticker matching the request asset" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiTradeHistoryRequest", + "is_root": true, + "fields": [ { - "name": "notional_cap", - "lite_name": "nc", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", - "index": 2, + "index": 0, "array_depth": 0, "optional": false, - "example": "'600000'", + "example": "'BTC_USDT_Perp'", "comment": [ - "Upper bound of notional value (exclusive) in quote currency, empty for last tier" + "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": "maintenance_margin_rate", - "lite_name": "mm", - "semantic_type": "string", + "name": "start_time", + "lite_name": "st", + "semantic_type": "int64", "json_type": "string", - "index": 3, + "index": 1, "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": 2, "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": 3, "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": 4, "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": [ + "Perform historical lookup of public trades in any given instrument.", + "This endpoint offers public trading data, use the Trading APIs instead to query for your personalized trade tape.", + "Only data from the last three months will be retained.", + "", + "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.\u003c/li\u003e\u003c/ul\u003e" + ] }, { - "name": "ApiGetMarginRulesResponse", + "name": "ApiTradeHistoryResponse", "is_root": true, "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "Trade", + "json_type": "Trade", "index": 0, - "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", - "comment": [ - "The instrument name" - ] - }, - { - "name": "max_position_size", - "lite_name": "mp", - "semantic_type": "string", - "json_type": "string", - "index": 1, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'100.0'", "comment": [ - "The maximum position size, expressed in base asset decimal units" + "The public trades matching the request asset" ] }, { - "name": "risk_brackets", - "lite_name": "rb", - "semantic_type": "RiskBracket", - "json_type": "RiskBracket", - "index": 2, - "array_depth": 1, - "optional": false, + "name": "next", + "lite_name": "n", + "semantic_type": "string", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": true, + "default": "''", + "example": "'Qw0918='", "comment": [ - "List of risk brackets defining margin requirements at different notional tiers" + "The cursor to indicate when to start the next query from" ] } ], - "comment": [ - "API response payload for margin rules of a particular instrument" - ] + "comment": [] }, { - "name": "ApiOrderbookLevelsRequest", + "name": "ApiTradeRequest", "is_root": true, "fields": [ { @@ -5169,360 +6229,515 @@ ] }, { - "name": "depth", - "lite_name": "d", + "name": "limit", + "lite_name": "l", "semantic_type": "uint32", "json_type": "integer", "index": 1, "array_depth": 0, "optional": false, - "example": "50", + "example": "500", "comment": [ - "Depth of the order book to be retrieved (10, 50, 100, 500)" + "The limit to query for. Defaults to 500; Max 1000" ] } ], "comment": [ - "Retrieves aggregated price depth for a single instrument, with a maximum depth of 10 levels. Do not use this to poll for data -- a websocket subscription is much more performant, and useful." + "Retrieves up to 1000 of the most recent trades in any given instrument. Do not use this to poll for data -- a websocket subscription is much more performant, and useful.", + "This endpoint offers public trading data, use the Trading APIs instead to query for your personalized trade tape." ] }, { - "name": "OrderbookLevel", - "is_root": false, + "name": "ApiTradeResponse", + "is_root": true, "fields": [ { - "name": "price", - "lite_name": "p", - "semantic_type": "string", - "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": "'65038.01'", "comment": [ - "The price of the level, expressed in `9` decimals" + "The public trades matching the request asset" ] - }, + } + ], + "comment": [] + }, + { + "name": "ApiTransferAck", + "is_root": false, + "fields": [ { - "name": "size", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 1, + "name": "ack", + "lite_name": "a", + "semantic_type": "bool", + "json_type": "boolean", + "index": 0, "array_depth": 0, "optional": false, - "example": "'3456.78'", + "example": "'true'", "comment": [ - "The number of assets offered, expressed in base asset decimal units" + "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": "num_orders", - "lite_name": "no", - "semantic_type": "uint32", - "json_type": "integer", - "index": 2, + "name": "tx_id", + "lite_name": "ti", + "semantic_type": "uint64", + "json_type": "string", + "index": 1, "array_depth": 0, "optional": false, - "example": "'123'", + "example": "'1028403'", "comment": [ - "The number of open orders at this level" + "The transaction ID of the transfer. This is only returned if the transfer is successful." ] } ], "comment": [] }, { - "name": "OrderbookLevels", - "is_root": false, + "name": "ApiTransferHistoryRequest", + "is_root": true, "fields": [ { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "currency", + "lite_name": "c", + "semantic_type": "string", "json_type": "string", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'1697788800000000000'", + "example": "['USDT', 'USDC']", "comment": [ - "Time at which the event was emitted 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" ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "start_time", + "lite_name": "st", + "semantic_type": "timestamp", "json_type": "string", "index": 1, "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", + "optional": true, + "default": "0", + "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" + "The start time to query for in unix nanoseconds" ] }, { - "name": "bids", - "lite_name": "b", - "semantic_type": "OrderbookLevel", - "json_type": "OrderbookLevel", + "name": "end_time", + "lite_name": "et", + "semantic_type": "timestamp", + "json_type": "string", "index": 2, - "array_depth": 1, - "optional": false, + "array_depth": 0, + "optional": true, + "default": "now()", + "example": "'1697788800000000000'", "comment": [ - "The list of best bids up till query depth" + "The end time to query for in unix nanoseconds" ] }, { - "name": "asks", - "lite_name": "a", - "semantic_type": "OrderbookLevel", - "json_type": "OrderbookLevel", + "name": "limit", + "lite_name": "l", + "semantic_type": "uint32", + "json_type": "integer", "index": 3, + "array_depth": 0, + "optional": true, + "default": "500", + "example": "500", + "comment": [ + "The limit to query for. Defaults to 500; Max 1000" + ] + }, + { + "name": "cursor", + "lite_name": "c1", + "semantic_type": "string", + "json_type": "string", + "index": 4, + "array_depth": 0, + "optional": true, + "default": "''", + "example": "''", + "comment": [ + "The cursor to indicate when to start the next query from" + ] + }, + { + "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": false, + "optional": true, + "default": "[]", "comment": [ - "The list of best asks up till query depth" + "The transfer type to filters for. If the list is empty, return all transfer types." ] } ], - "comment": [] + "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" + ] }, { - "name": "ApiOrderbookLevelsResponse", + "name": "ApiTransferHistoryResponse", "is_root": true, "fields": [ { "name": "result", "lite_name": "r", - "semantic_type": "OrderbookLevels", - "json_type": "OrderbookLevels", + "semantic_type": "TransferHistory", + "json_type": "TransferHistory", "index": 0, - "array_depth": 0, + "array_depth": 1, "optional": false, "comment": [ - "The orderbook levels objects matching the request asset" + "The transfer history matching the request account" ] - } - ], - "comment": [] - }, - { - "name": "ApiMiniTickerRequest", - "is_root": true, - "fields": [ + }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "next", + "lite_name": "n", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 1, "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", + "optional": true, + "default": "''", + "example": "'Qw0918='", "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 cursor to indicate when to start the next query from" ] } ], - "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." - ] + "comment": [] }, { - "name": "MiniTicker", - "is_root": false, + "name": "ApiTransferRequest", + "is_root": true, "fields": [ { - "name": "event_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "from_account_id", + "lite_name": "fa", + "semantic_type": "address", "json_type": "string", "index": 0, "array_depth": 0, - "optional": true, - "example": "'1697788800000000000'", + "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "Time at which the event was emitted in unix nanoseconds" + "The main account to transfer from" ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "from_sub_account_id", + "lite_name": "fs", + "semantic_type": "uint64", "json_type": "string", "index": 1, "array_depth": 0, - "optional": true, - "example": "'BTC_USDT_Perp'", + "optional": false, + "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": "mark_price", - "lite_name": "mp", - "semantic_type": "string", + "name": "to_account_id", + "lite_name": "ta", + "semantic_type": "address", "json_type": "string", "index": 2, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "The mark price of the instrument, expressed in `9` decimals" + "The main account to deposit into" ] }, { - "name": "index_price", - "lite_name": "ip", - "semantic_type": "string", + "name": "to_sub_account_id", + "lite_name": "ts", + "semantic_type": "uint64", "json_type": "string", "index": 3, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The index price of the instrument, expressed in `9` decimals" + "The subaccount to transfer to (0 if transferring to main account)" ] }, { - "name": "last_price", - "lite_name": "lp", + "name": "currency", + "lite_name": "c", "semantic_type": "string", "json_type": "string", "index": 4, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, + "example": "'USDT'", "comment": [ - "The last traded price of the instrument (also close price), expressed in `9` decimals" + "The token currency to transfer" ] }, { - "name": "last_size", - "lite_name": "ls", + "name": "num_tokens", + "lite_name": "nt", "semantic_type": "string", "json_type": "string", "index": 5, "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "optional": false, + "example": "'1500.0'", "comment": [ - "The number of assets traded in the last trade, expressed in base asset decimal units" + "The number of tokens to transfer, quoted in tokenCurrency decimal units" ] }, { - "name": "mid_price", - "lite_name": "mp1", - "semantic_type": "string", - "json_type": "string", + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", "index": 6, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, "comment": [ - "The mid price of the instrument, expressed in `9` decimals" + "The signature of the transfer" ] }, { - "name": "best_bid_price", - "lite_name": "bb", - "semantic_type": "string", - "json_type": "string", + "name": "transfer_type", + "lite_name": "tt", + "semantic_type": "TransferType", + "json_type": "TransferType", "index": 7, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, "comment": [ - "The best bid price of the instrument, expressed in `9` decimals" + "The type of transfer" ] }, { - "name": "best_bid_size", - "lite_name": "bb1", + "name": "transfer_metadata", + "lite_name": "tm", "semantic_type": "string", "json_type": "string", "index": 8, "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "optional": false, + "example": "'{\\\"provider\\\":\\\"XY\\\",\\\"direction\\\":\\\"WITHDRAWAL\\\",\\\"provider_tx_id\\\":\\\"txn123456\\\",\\\"chainid\\\":\\\"42161\\\",\\\"endpoint\\\":\\\"0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0\\\"}'", "comment": [ - "The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units" + "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": "result", + "lite_name": "r", + "semantic_type": "ApiTransferAck", + "json_type": "ApiTransferAck", + "index": 0, + "array_depth": 0, + "optional": false, + "comment": [ + "The Transfer response object" + ] + } + ], + "comment": [ + "Used to acknowledge a transfer request outcome" + ] + }, + { + "name": "ApiVaultBurnTokensRequest", + "is_root": true, + "fields": [ + { + "name": "vault_id", + "lite_name": "vi", + "semantic_type": "uint64", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'3477045127917224'", + "comment": [ + "The unique identifier of the vault to burn tokens from." ] }, { - "name": "best_ask_price", - "lite_name": "ba", + "name": "currency", + "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 9, + "index": 2, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, + "example": "'USDT'", "comment": [ - "The best ask price of the instrument, expressed in `9` decimals" + "The currency used for the burn. This should be the vault's quote currency." ] }, { - "name": "best_ask_size", - "lite_name": "ba1", + "name": "num_tokens", + "lite_name": "nt", "semantic_type": "string", "json_type": "string", - "index": 10, + "index": 3, "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "optional": false, + "example": "1000000", "comment": [ - "The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units" + "The number of tokens to burn." ] - } - ], - "comment": [] - }, - { - "name": "ApiMiniTickerResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "MiniTicker", - "json_type": "MiniTicker", - "index": 0, + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 4, "array_depth": 0, "optional": false, "comment": [ - "The mini ticker 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 burning tokens in a vault.", + "", + "This API allows a client to burn a specified amount of tokens in a particular vault." + ] }, { - "name": "ApiTickerRequest", + "name": "ApiVaultInvestRequest", "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, + "index": 1, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'3477045127917224'", "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 unique identifier of the vault to invest in." + ] + }, + { + "name": "currency", + "lite_name": "c", + "semantic_type": "string", + "json_type": "string", + "index": 2, + "array_depth": 0, + "optional": false, + "example": "'USDT'", + "comment": [ + "The currency used for the investment. This should be the vault's quote currency." + ] + }, + { + "name": "num_tokens", + "lite_name": "nt", + "semantic_type": "string", + "json_type": "string", + "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)." + ] + }, + { + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 4, + "array_depth": 0, + "optional": false, + "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." ] } ], "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." + "Request payload for investing in a vault.", + "", + "This API allows a client to invest a specified amount of tokens in a particular vault." ] }, { - "name": "Ticker", + "name": "ApiVaultInvestorHistory", "is_root": false, "fields": [ { @@ -5532,410 +6747,573 @@ "json_type": "string", "index": 0, "array_depth": 0, - "optional": true, + "optional": false, "example": "'1697788800000000000'", "comment": [ "Time at which the event was emitted in unix nanoseconds" ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "off_chain_account_id", + "lite_name": "oc", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, - "optional": true, - "example": "'BTC_USDT_Perp'", + "optional": false, + "example": "'ACC:123456'", "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 off chain account id of the investor, only visible to the manager" ] }, { - "name": "mark_price", - "lite_name": "mp", - "semantic_type": "string", + "name": "vault_id", + "lite_name": "vi", + "semantic_type": "uint64", "json_type": "string", "index": 2, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, + "example": "'2312134'", "comment": [ - "The mark price of the instrument, expressed in `9` decimals" + "The unique identifier of the vault." ] }, { - "name": "index_price", - "lite_name": "ip", - "semantic_type": "string", - "json_type": "string", + "name": "type", + "lite_name": "t", + "semantic_type": "VaultInvestorAction", + "json_type": "VaultInvestorAction", "index": 3, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, + "example": "'VAULT_INVEST'", "comment": [ - "The index price of the instrument, expressed in `9` decimals" + "The type of transaction that occurred. List of types: vaultInvest, vaultBurnLpToken, vaultRedeem" ] }, { - "name": "last_price", - "lite_name": "lp", + "name": "price", + "lite_name": "p", "semantic_type": "string", "json_type": "string", "index": 4, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, + "example": "'1000000'", "comment": [ - "The last traded price of the instrument (also close price), expressed in `9` decimals" + "The price of the vault LP tokens at the time of the event." ] }, { - "name": "last_size", - "lite_name": "ls", + "name": "size", + "lite_name": "s", "semantic_type": "string", "json_type": "string", "index": 5, "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "optional": false, + "example": "'1000000'", "comment": [ - "The number of assets traded in the last trade, expressed in base asset decimal units" + "The amount of Vault LP tokens invested or redeemed." ] }, { - "name": "mid_price", - "lite_name": "mp1", + "name": "realized_pnl", + "lite_name": "rp", "semantic_type": "string", "json_type": "string", "index": 6, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, + "example": "'1000000'", "comment": [ - "The mid price of the instrument, expressed in `9` decimals" + "The realized PnL of the vault." ] }, { - "name": "best_bid_price", - "lite_name": "bb", + "name": "performance_fee", + "lite_name": "pf", "semantic_type": "string", "json_type": "string", "index": 7, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, + "example": "'1000000'", "comment": [ - "The best bid price of the instrument, expressed in `9` decimals" + "The performance fee of the vault." ] - }, + } + ], + "comment": [ + "The vault investor history returned by the service to client" + ] + }, + { + "name": "ApiVaultInvestorSummaryRequest", + "is_root": true, + "fields": [ { - "name": "best_bid_size", - "lite_name": "bb1", - "semantic_type": "string", + "name": "vault_id", + "lite_name": "vi", + "semantic_type": "uint64", "json_type": "string", - "index": 8, + "index": 1, "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "optional": false, + "example": "'3477045127917224'", "comment": [ - "The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units" + "The unique identifier of the vault to fetch the summary for." ] - }, + } + ], + "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": "ApiVaultInvestorSummaryResponse", + "is_root": true, + "fields": [ { - "name": "best_ask_price", - "lite_name": "ba", - "semantic_type": "string", + "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": "ApiVaultRedeemCancelRequest", + "is_root": true, + "fields": [ + { + "name": "vault_id", + "lite_name": "vi", + "semantic_type": "uint64", "json_type": "string", - "index": 9, + "index": 1, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, + "example": "'3477045127917224'", "comment": [ - "The best ask price of the instrument, expressed in `9` decimals" + "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": "vault_id", + "lite_name": "vi", + "semantic_type": "uint64", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'3477045127917224'", + "comment": [ + "The unique identifier of the vault to redeem from." ] }, { - "name": "best_ask_size", - "lite_name": "ba1", + "name": "currency", + "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 10, + "index": 2, "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "optional": false, + "example": "'USDT'", "comment": [ - "The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units" + "The currency used for the redemption. This should be the vault's quote currency." ] }, { - "name": "funding_rate_8h_curr", - "lite_name": "fr", + "name": "num_tokens", + "lite_name": "nt", "semantic_type": "string", "json_type": "string", - "index": 11, + "index": 3, "array_depth": 0, - "optional": true, - "example": "0.0003", + "optional": false, + "example": "1000000", "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 number of shares to redeem." ] }, { - "name": "funding_rate_8h_avg", - "lite_name": "fr1", - "semantic_type": "string", - "json_type": "string", - "index": 12, - "array_depth": 0, - "optional": true, - "example": "0.0003", + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 4, + "array_depth": 0, + "optional": false, + "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." + ] + } + ], + "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": "vault_id", + "lite_name": "vi", + "semantic_type": "uint64", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'3477045127917224'", + "comment": [ + "The unique identifier of the vault to fetch the redemption queue for." + ] + } + ], + "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." + ] + }, + { + "name": "ApiVaultViewRedemptionQueueResponse", + "is_root": true, + "fields": [ + { + "name": "redemption_queue", + "lite_name": "rq", + "semantic_type": "VaultRedemptionRequest", + "json_type": "VaultRedemptionRequest", + "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`)." + "Outstanding vault redemption requests, ordered by descending priority. Excludes requests that have not yet aged past the minimum redemption period." ] }, { - "name": "interest_rate", - "lite_name": "ir", + "name": "pending_redemption_token_count", + "lite_name": "pr", "semantic_type": "string", "json_type": "string", - "index": 13, + "index": 1, "array_depth": 0, - "optional": true, - "example": "0.0003", + "optional": false, + "example": "'1000000'", "comment": [ - "The interest rate of the underlying, expressed in centibeeps (1/100th of a basis point)" + "Number of shares eligible for automated redemption (held in queue for at least the minimum redemption period)." ] }, { - "name": "forward_price", - "lite_name": "fp", + "name": "urgent_redemption_token_count", + "lite_name": "ur", "semantic_type": "string", "json_type": "string", - "index": 14, + "index": 2, "array_depth": 0, - "optional": true, - "example": "'65038.01'", + "optional": false, + "example": "'0'", "comment": [ - "[Options] The forward price of the option, expressed in `9` decimals" + "Number of shares nearing the maximum redemption period (\u003e= 90% of maximum redemption period)." ] }, { - "name": "buy_volume_24h_b", - "lite_name": "bv", + "name": "auto_redeemable_balance", + "lite_name": "ar", "semantic_type": "string", "json_type": "string", - "index": 15, + "index": 3, "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "optional": false, + "example": "'0'", "comment": [ - "The 24 hour taker buy volume of the instrument, expressed in base asset decimal units" + "Amount available for automated redemption request servicing (in USD)." ] }, { - "name": "sell_volume_24h_b", - "lite_name": "sv", + "name": "share_price", + "lite_name": "sp", "semantic_type": "string", "json_type": "string", - "index": 16, + "index": 4, "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "optional": false, + "example": "'1.25'", "comment": [ - "The 24 hour taker sell volume of the instrument, expressed in base asset decimal units" + "Current share price (in USD)." ] }, { - "name": "buy_volume_24h_q", - "lite_name": "bv1", - "semantic_type": "string", - "json_type": "string", - "index": 17, + "name": "pre_min", + "lite_name": "pm", + "semantic_type": "PreMinRedemptions", + "json_type": "PreMinRedemptions", + "index": 5, "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" + "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": "sell_volume_24h_q", - "lite_name": "sv1", + "name": "currency", + "lite_name": "c", "semantic_type": "string", "json_type": "string", - "index": 18, - "array_depth": 0, - "optional": true, - "example": "'123456.78'", + "index": 0, + "array_depth": 1, + "optional": false, + "example": "['USDT', 'USDC']", "comment": [ - "The 24 hour taker sell volume of the instrument, expressed in quote 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": "high_price", - "lite_name": "hp", - "semantic_type": "string", + "name": "start_time", + "lite_name": "st", + "semantic_type": "timestamp", "json_type": "string", - "index": 19, + "index": 1, "array_depth": 0, "optional": true, - "example": "'65038.01'", + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "The 24 hour highest traded price of the instrument, expressed in `9` decimals" + "The start time to query for in unix nanoseconds" ] }, { - "name": "low_price", - "lite_name": "lp1", - "semantic_type": "string", + "name": "end_time", + "lite_name": "et", + "semantic_type": "timestamp", "json_type": "string", - "index": 20, + "index": 2, "array_depth": 0, "optional": true, - "example": "'65038.01'", + "default": "now()", + "example": "'1697788800000000000'", "comment": [ - "The 24 hour lowest traded price of the instrument, expressed in `9` decimals" + "The end time to query for in unix nanoseconds" ] }, { - "name": "open_price", - "lite_name": "op", - "semantic_type": "string", - "json_type": "string", - "index": 21, + "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 24 hour first traded price of the instrument, expressed in `9` decimals" + "The limit to query for. Defaults to 500; Max 1000" ] }, { - "name": "open_interest", - "lite_name": "oi", + "name": "cursor", + "lite_name": "c1", "semantic_type": "string", "json_type": "string", - "index": 22, + "index": 4, "array_depth": 0, "optional": true, - "example": "'123456.78'", + "default": "''", + "example": "''", "comment": [ - "The open interest in the instrument, expressed in base asset decimal units" + "The cursor to indicate when to start the next query from" ] }, { - "name": "long_short_ratio", - "lite_name": "ls1", - "semantic_type": "string", + "name": "main_account_id", + "lite_name": "ma", + "semantic_type": "address", "json_type": "string", - "index": 23, + "index": 5, "array_depth": 0, "optional": true, - "example": "'0.5'", + "default": "", + "example": "", "comment": [ - "The ratio of accounts that are net long vs net short on this instrument" + "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", + "Both finalized and pending withdrawals are returned, and pending withdrawals are indicated by an empty `l1Hash` field.", + "", + "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": "ApiWithdrawalHistoryResponse", + "is_root": true, + "fields": [ { - "name": "funding_rate", - "lite_name": "fr2", - "semantic_type": "string", - "json_type": "string", - "index": 24, - "array_depth": 0, - "optional": true, - "example": "0.0003", + "name": "result", + "lite_name": "r", + "semantic_type": "WithdrawalHistory", + "json_type": "WithdrawalHistory", + "index": 0, + "array_depth": 1, + "optional": false, "comment": [ - "The current indicative funding rate for the active interval, expressed in centibeeps" + "The withdrawals history matching the request account" ] }, { - "name": "next_funding_time", - "lite_name": "nf", - "semantic_type": "timestamp", + "name": "next", + "lite_name": "n", + "semantic_type": "string", "json_type": "string", - "index": 26, + "index": 1, "array_depth": 0, "optional": true, - "example": "'1697788800000000000'", + "default": "''", + "example": "'Qw0918='", "comment": [ - "Timestamp in nanoseconds when the current funding interval ends" + "The cursor to indicate when to start the next 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`)", - "", - "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.", - "" - ] + "comment": [] }, { - "name": "ApiTickerResponse", + "name": "ApiWithdrawalRequest", "is_root": true, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "Ticker", - "json_type": "Ticker", - "index": 0, + "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", + "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 mini ticker matching the request asset" + "The token currency to withdraw" ] - } - ], - "comment": [] - }, - { - "name": "ApiTradeRequest", - "is_root": true, - "fields": [ + }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "num_tokens", + "lite_name": "nt", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 3, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'1500.0'", "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 number of tokens to withdraw, quoted in tokenCurrency decimal units" ] }, { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, + "name": "signature", + "lite_name": "s", + "semantic_type": "Signature", + "json_type": "Signature", + "index": 4, "array_depth": 0, "optional": false, - "example": "500", "comment": [ - "The limit to query for. Defaults to 500; Max 1000" + "The signature of the withdrawal" ] } ], "comment": [ - "Retrieves up to 1000 of the most recent trades in any given instrument. Do not use this to poll for data -- a websocket subscription is much more performant, and useful.", - "This endpoint offers public trading data, use the Trading APIs instead to query for your personalized trade tape." + "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." ] }, { - "name": "Trade", + "name": "BuilderFillHistory", "is_root": false, "fields": [ { @@ -5951,30 +7329,56 @@ "Time at which the event was emitted in unix nanoseconds" ] }, + { + "name": "off_chain_account_id", + "lite_name": "oc", + "semantic_type": "string", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'ACC:123456'", + "comment": [ + "The off chain account id" + ] + }, { "name": "instrument", "lite_name": "i", "semantic_type": "asset", "json_type": "string", - "index": 1, + "index": 2, "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 being represented" ] }, { - "name": "is_taker_buyer", + "name": "is_buyer", + "lite_name": "ib", + "semantic_type": "bool", + "json_type": "boolean", + "index": 3, + "array_depth": 0, + "optional": false, + "example": "true", + "comment": [ + "The side that the subaccount took on the trade" + ] + }, + { + "name": "is_taker", "lite_name": "it", "semantic_type": "bool", "json_type": "boolean", - "index": 2, + "index": 4, "array_depth": 0, "optional": false, "example": "true", "comment": [ - "If taker was the buyer on the trade" + "The role that the subaccount took on the trade" ] }, { @@ -5982,10 +7386,10 @@ "lite_name": "s", "semantic_type": "string", "json_type": "string", - "index": 3, + "index": 5, "array_depth": 0, "optional": false, - "example": "'123456.78'", + "example": "'0.30'", "comment": [ "The number of assets being traded, expressed in base asset decimal units" ] @@ -5995,7 +7399,7 @@ "lite_name": "p", "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 6, "array_depth": 0, "optional": false, "example": "'65038.01'", @@ -6008,7 +7412,7 @@ "lite_name": "mp", "semantic_type": "string", "json_type": "string", - "index": 5, + "index": 7, "array_depth": 0, "optional": false, "example": "'65038.01'", @@ -6021,1595 +7425,1501 @@ "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" + "The index price of the instrument at point of trade, expressed in `9` decimals" ] }, { - "name": "trade_id", - "lite_name": "ti", + "name": "fee_rate", + "lite_name": "fr", "semantic_type": "string", "json_type": "string", "index": 9, "array_depth": 0, "optional": false, - "example": "'209358-2'", + "example": "0.001", "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`." + "Builder fee percentage charged for this order. referred to Order.builder builderFee " ] }, { - "name": "venue", - "lite_name": "v", - "semantic_type": "Venue", - "json_type": "Venue", + "name": "fee", + "lite_name": "f", + "semantic_type": "int64", + "json_type": "string", "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": [ - "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, - "comment": [ - "The public trades matching the request asset" + "The builder fee paid on the trade, expressed in quote asset decimal unit. referred to Trade.builderFee" ] } ], "comment": [] }, { - "name": "ApiTradeHistoryRequest", - "is_root": true, + "name": "CancelStatusFeed", + "is_root": false, "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 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 ID that requested the cancellation" ] }, { - "name": "start_time", - "lite_name": "st", - "semantic_type": "int64", + "name": "client_order_id", + "lite_name": "co", + "semantic_type": "uint64", "json_type": "string", "index": 1, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "optional": false, + "example": "'23042'", "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" + "A unique identifier for the active order within a subaccount, specified by the client" ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "int64", + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", "json_type": "string", "index": 2, "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", - "comment": [ - "The end time to apply in nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned" - ] - }, - { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 3, - "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", - "comment": [ - "The limit to query for. Defaults to 500; Max 1000" - ] - }, - { - "name": "cursor", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", + "optional": false, + "example": "'10000101000203040506'", "comment": [ - "The cursor to indicate when to start the query from" + "A unique 128-bit identifier for the order, deterministically generated within the GRVT backend" ] - } - ], - "comment": [ - "Perform historical lookup of public trades in any given instrument.", - "This endpoint offers public trading data, use the Trading APIs instead to query for your personalized trade tape.", - "Only data from the last three months will be retained.", - "", - "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "ApiTradeHistoryResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", + "name": "reason", "lite_name": "r", - "semantic_type": "Trade", - "json_type": "Trade", - "index": 0, - "array_depth": 1, + "semantic_type": "OrderRejectReason", + "json_type": "OrderRejectReason", + "index": 3, + "array_depth": 0, "optional": false, "comment": [ - "The public trades matching the request asset" + "The user-provided reason for cancelling the order" ] }, { - "name": "next", - "lite_name": "n", - "semantic_type": "string", + "name": "update_time", + "lite_name": "ut", + "semantic_type": "timestamp", "json_type": "string", - "index": 1, + "index": 4, "array_depth": 0, "optional": true, - "default": "''", - "example": "'Qw0918='", + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "The cursor to indicate when to start the next query from" + "[Filled by GRVT Backend] Time at which the cancellation status was updated by GRVT in unix nanoseconds" ] - } - ], - "comment": [] - }, - { - "name": "ApiGetInstrumentRequest", - "is_root": true, - "fields": [ + }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, + "name": "cancel_status", + "lite_name": "cs", + "semantic_type": "CancelStatus", + "json_type": "CancelStatus", + "index": 5, "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" + "Status of the cancellation attempt" ] } ], - "comment": [ - "Fetch a single instrument by supplying the asset or instrument name" - ] + "comment": [] }, { - "name": "InstrumentDisplay", + "name": "Candlestick", "is_root": false, "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "open_time", + "lite_name": "ot", + "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" + "Open time of kline bar in unix nanoseconds" ] }, { - "name": "instrument_hash", - "lite_name": "ih", - "semantic_type": "uint256", + "name": "close_time", + "lite_name": "ct", + "semantic_type": "timestamp", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'0x030501'", + "example": "'1697788800000000000'", "comment": [ - "The asset ID used for instrument signing." + "Close time of kline bar in unix nanosecond" ] }, { - "name": "base", - "lite_name": "b", + "name": "open", + "lite_name": "o", "semantic_type": "string", "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "'BTC'", + "example": "'123456.78'", "comment": [ - "The base currency" + "The open price, expressed in underlying currency resolution units" ] }, { - "name": "quote", - "lite_name": "q", + "name": "close", + "lite_name": "c", "semantic_type": "string", "json_type": "string", "index": 3, "array_depth": 0, "optional": false, - "example": "'USDT'", + "example": "'123456.78'", "comment": [ - "The quote currency" + "The close price, expressed in underlying currency resolution units" ] }, { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", + "name": "high", + "lite_name": "h", + "semantic_type": "string", + "json_type": "string", "index": 4, "array_depth": 0, "optional": false, - "example": "'PERPETUAL'", + "example": "'123456.78'", "comment": [ - "The kind of instrument" + "The high price, expressed in underlying currency resolution units" ] }, { - "name": "venues", - "lite_name": "v", - "semantic_type": "Venue", - "json_type": "Venue", + "name": "low", + "lite_name": "l", + "semantic_type": "string", + "json_type": "string", + "index": 5, + "array_depth": 0, + "optional": false, + "example": "'123456.78'", + "comment": [ + "The low price, expressed in underlying currency resolution units" + ] + }, + { + "name": "volume_b", + "lite_name": "vb", + "semantic_type": "string", + "json_type": "string", + "index": 6, + "array_depth": 0, + "optional": false, + "example": "'123456.78'", + "comment": [ + "The underlying volume transacted, expressed in base asset decimal units" + ] + }, + { + "name": "volume_q", + "lite_name": "vq", + "semantic_type": "string", + "json_type": "string", "index": 7, - "array_depth": 1, + "array_depth": 0, "optional": false, - "example": "['ORDERBOOK']", + "example": "'123456.78'", "comment": [ - "Venues that this instrument can be traded at" + "The quote volume transacted, expressed in quote asset decimal units" ] }, { - "name": "settlement_period", - "lite_name": "sp1", - "semantic_type": "InstrumentSettlementPeriod", - "json_type": "InstrumentSettlementPeriod", + "name": "trades", + "lite_name": "t", + "semantic_type": "uint32", + "json_type": "integer", "index": 8, "array_depth": 0, "optional": false, - "example": "'PERPETUAL'", + "example": "123456", "comment": [ - "The settlement period of the instrument" + "The number of trades transacted" ] }, { - "name": "base_decimals", - "lite_name": "bd", - "semantic_type": "int8", - "json_type": "integer", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 9, "array_depth": 0, "optional": false, - "example": "3", + "example": "'BTC_USDT_Perp'", "comment": [ - "The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)" + "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": "ClientTier", + "is_root": false, + "fields": [ + { + "name": "tier", + "lite_name": "t", + "semantic_type": "uint8", + "json_type": "integer", + "index": 0, + "array_depth": 0, + "optional": false, + "comment": [] }, { - "name": "quote_decimals", - "lite_name": "qd", - "semantic_type": "int8", + "name": "futures_taker_fee", + "lite_name": "ft", + "semantic_type": "int32", "json_type": "integer", - "index": 10, + "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": [] + }, + { + "name": "CurrencyDetail", + "is_root": false, + "fields": [ + { + "name": "id", + "lite_name": "i", + "semantic_type": "uint16", + "json_type": "integer", + "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 integer value of the currency" ] }, { - "name": "tick_size", - "lite_name": "ts", + "name": "symbol", + "lite_name": "s", "semantic_type": "string", "json_type": "string", - "index": 11, + "index": 1, "array_depth": 0, "optional": false, - "example": "'0.01'", + "example": "'USDT'", "comment": [ - "The size of a single tick, expressed in price decimal units" + "The name of the currency" ] }, { - "name": "min_size", - "lite_name": "ms", - "semantic_type": "string", - "json_type": "string", - "index": 12, + "name": "balance_decimals", + "lite_name": "bd", + "semantic_type": "int8", + "json_type": "integer", + "index": 2, "array_depth": 0, "optional": false, - "example": "'0.01'", + "example": "6", "comment": [ - "The minimum contract size, expressed in base asset decimal units" + "The balance decimals of the currency" ] }, { - "name": "create_time", - "lite_name": "ct", - "semantic_type": "timestamp", + "name": "quantity_multiplier", + "lite_name": "qm", + "semantic_type": "uint64", "json_type": "string", - "index": 14, + "index": 3, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "1000000", "comment": [ - "Creation time in unix nanoseconds" + "The quantity multiplier of the currency" ] - }, + } + ], + "comment": [] + }, + { + "name": "Deposit", + "is_root": false, + "fields": [ { - "name": "max_position_size", - "lite_name": "mp", - "semantic_type": "string", + "name": "tx_hash", + "lite_name": "th", + "semantic_type": "uint256", "json_type": "string", - "index": 15, + "index": 0, "array_depth": 0, "optional": false, - "example": "'100.0'", + "example": "'0x1234567890123456789012345678901234567890123456789012345678901234'", "comment": [ - "The maximum position size, expressed in base asset decimal units" + "The hash of the bridgemint event producing the deposit" ] }, { - "name": "funding_interval_hours", - "lite_name": "fi", - "semantic_type": "uint8", - "json_type": "integer", - "index": 17, + "name": "to_account_id", + "lite_name": "ta", + "semantic_type": "address", + "json_type": "string", + "index": 1, "array_depth": 0, - "optional": true, + "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "Defines the funding interval to be applied." + "The account to deposit into" ] }, { - "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 token currency to deposit" ] }, { - "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": "'10.50'", "comment": [ - "Funding rate floor over the defined `intervalHours`." + "The number of tokens to deposit" ] } ], "comment": [] }, { - "name": "ApiGetInstrumentResponse", - "is_root": true, + "name": "DepositHistory", + "is_root": false, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "InstrumentDisplay", - "json_type": "InstrumentDisplay", + "name": "l_1_hash", + "lite_name": "l1", + "semantic_type": "uint256", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, + "example": "'0x10000101000203040506'", "comment": [ - "The instrument matching the request asset" + "The L1 txHash of the deposit" ] - } - ], - "comment": [] - }, - { - "name": "ApiGetFilteredInstrumentsRequest", - "is_root": true, - "fields": [ + }, { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", - "index": 0, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['PERPETUAL']", + "name": "l_2_hash", + "lite_name": "l2", + "semantic_type": "uint256", + "json_type": "string", + "index": 1, + "array_depth": 0, + "optional": false, + "example": "'0x10000101000203040506'", "comment": [ - "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" + "The L2 txHash of the deposit" ] }, { - "name": "base", - "lite_name": "b", + "name": "to_account_id", + "lite_name": "ta", + "semantic_type": "address", + "json_type": "string", + "index": 2, + "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": 1, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", + "index": 3, + "array_depth": 0, + "optional": false, + "example": "'USDT'", "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" + "The token currency to deposit" ] }, { - "name": "quote", - "lite_name": "q", + "name": "num_tokens", + "lite_name": "nt", "semantic_type": "string", "json_type": "string", - "index": 2, - "array_depth": 1, - "optional": true, - "default": "all", - "example": "['USDT', 'USDC']", + "index": 4, + "array_depth": 0, + "optional": false, + "example": "'1500.0'", "comment": [ - "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" + "The number of tokens to deposit" ] }, { - "name": "is_active", - "lite_name": "ia", - "semantic_type": "bool", - "json_type": "boolean", - "index": 3, + "name": "initiated_time", + "lite_name": "it", + "semantic_type": "timestamp", + "json_type": "string", + "index": 5, "array_depth": 0, - "optional": true, - "default": "false", - "example": "true", + "optional": false, + "example": "'1697788800000000000'", "comment": [ - "Request for active instruments only" + "The timestamp when the deposit was initiated on L1 in unix nanoseconds" ] }, { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 4, + "name": "confirmed_time", + "lite_name": "ct", + "semantic_type": "timestamp", + "json_type": "string", + "index": 6, "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", + "optional": false, + "example": "'1697788800000000000'", "comment": [ - "The limit to query for. Defaults to 500; Max 100000" + "The timestamp when the deposit was confirmed on L2 in unix nanoseconds, empty if the deposit is pending." + ] + }, + { + "name": "from_address", + "lite_name": "fa", + "semantic_type": "address", + "json_type": "string", + "index": 7, + "array_depth": 0, + "optional": false, + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "comment": [ + "The address of the sender" ] } ], + "comment": [] + }, + { + "name": "EmptyRequest", + "is_root": true, + "fields": [], "comment": [ - "Fetch a list of instruments based on the filters provided" + "Used for requests that do not require any parameters" ] }, { - "name": "ApiGetFilteredInstrumentsResponse", + "name": "Error", "is_root": true, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "InstrumentDisplay", - "json_type": "InstrumentDisplay", + "name": "code", + "lite_name": "c", + "semantic_type": "uint16", + "json_type": "integer", "index": 0, - "array_depth": 1, + "array_depth": 0, + "optional": false, + "example": "123", + "comment": [ + "The error code for the request" + ] + }, + { + "name": "message", + "lite_name": "m", + "semantic_type": "string", + "json_type": "string", + "index": 1, + "array_depth": 0, "optional": false, + "example": "'An error occurred'", "comment": [ - "The instruments matching the request filter" + "The error message for the request" ] } ], - "comment": [] - }, - { - "name": "ApiGetCurrencyRequest", - "is_root": true, - "fields": [], "comment": [ - "Fetch all currencies" + "An error response" ] }, { - "name": "CurrencyDetail", + "name": "Fill", "is_root": false, "fields": [ { - "name": "id", - "lite_name": "i", - "semantic_type": "uint16", - "json_type": "integer", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "3", + "example": "'1697788800000000000'", "comment": [ - "The integer value of the currency" + "Time at which the event was emitted in unix nanoseconds" ] }, { - "name": "symbol", - "lite_name": "s", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'USDT'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The name of the currency" + "The sub account ID that participated in the trade" ] }, { - "name": "balance_decimals", - "lite_name": "bd", - "semantic_type": "int8", - "json_type": "integer", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "6", + "example": "'BTC_USDT_Perp'", "comment": [ - "The balance decimals of the currency" + "The instrument being represented" ] }, { - "name": "quantity_multiplier", - "lite_name": "qm", - "semantic_type": "uint64", - "json_type": "string", + "name": "is_buyer", + "lite_name": "ib", + "semantic_type": "bool", + "json_type": "boolean", "index": 3, "array_depth": 0, "optional": false, - "example": "1000000", + "example": "true", "comment": [ - "The quantity multiplier of the currency" + "The side that the subaccount took on the trade" ] - } - ], - "comment": [] - }, - { - "name": "ApiGetCurrencyResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "CurrencyDetail", - "json_type": "CurrencyDetail", - "index": 0, - "array_depth": 1, + "name": "is_taker", + "lite_name": "it", + "semantic_type": "bool", + "json_type": "boolean", + "index": 4, + "array_depth": 0, "optional": false, + "example": "true", "comment": [ - "The list of currencies" + "The role that the subaccount took on the trade" ] - } - ], - "comment": [ - "The list of currencies" - ] - }, - { - "name": "ApiCandlestickRequest", - "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" + "The number of assets being traded, expressed in base asset decimal units" ] }, { - "name": "interval", - "lite_name": "i1", - "semantic_type": "CandlestickInterval", - "json_type": "CandlestickInterval", - "index": 1, + "name": "price", + "lite_name": "p", + "semantic_type": "string", + "json_type": "string", + "index": 6, "array_depth": 0, "optional": false, + "example": "'65038.01'", "comment": [ - "The interval of each candlestick" + "The traded price, expressed in `9` decimals" ] }, { - "name": "type", - "lite_name": "t", - "semantic_type": "CandlestickType", - "json_type": "CandlestickType", - "index": 2, + "name": "mark_price", + "lite_name": "mp", + "semantic_type": "string", + "json_type": "string", + "index": 7, "array_depth": 0, "optional": false, + "example": "'65038.01'", "comment": [ - "The type of candlestick data to retrieve" + "The mark price of the instrument at point of trade, expressed in `9` decimals" ] }, { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", + "name": "index_price", + "lite_name": "ip", + "semantic_type": "string", "json_type": "string", - "index": 3, + "index": 8, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "optional": false, + "example": "'65038.01'", "comment": [ - "Start time of kline data in unix nanoseconds" + "The index price of the instrument at point of trade, expressed in `9` decimals" ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "interest_rate", + "lite_name": "ir", + "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 9, "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", + "optional": false, + "example": "0.0003", "comment": [ - "End time of kline data in unix nanoseconds" + "The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)" ] }, { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 5, + "name": "forward_price", + "lite_name": "fp", + "semantic_type": "string", + "json_type": "string", + "index": 10, "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", + "optional": false, + "example": "'65038.01'", "comment": [ - "The limit to query for. Defaults to 500; Max 1000" + "[Options] The forward price of the option at point of trade, expressed in `9` decimals" ] }, { - "name": "cursor", - "lite_name": "c", + "name": "realized_pnl", + "lite_name": "rp", "semantic_type": "string", "json_type": "string", - "index": 6, + "index": 11, "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", + "optional": false, + "example": "'2400.50'", "comment": [ - "The cursor to indicate when to start the query from" + "The realized PnL of the trade, expressed in quote asset decimal units (0 if increasing position size)" ] - } - ], - "comment": [ - "Kline/Candlestick bars for an instrument. Klines are uniquely identified by their instrument, type, interval, and open time.", - "", - "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "Candlestick", - "is_root": false, - "fields": [ + }, { - "name": "open_time", - "lite_name": "ot", - "semantic_type": "timestamp", + "name": "fee", + "lite_name": "f", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 12, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'9.75'", "comment": [ - "Open time of kline bar in unix nanoseconds" + "The fees paid on the trade, expressed in quote asset decimal unit (negative if maker rebate applied)" ] }, { - "name": "close_time", - "lite_name": "ct", - "semantic_type": "timestamp", + "name": "fee_rate", + "lite_name": "fr", + "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 13, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "0.0003", "comment": [ - "Close time of kline bar in unix nanosecond" + "The fee rate paid on the trade" ] }, { - "name": "open", - "lite_name": "o", + "name": "trade_id", + "lite_name": "ti", "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 14, + "array_depth": 0, + "optional": false, + "example": "'209358-2'", + "comment": [ + "A trade identifier, globally unique, and monotonically increasing (not by `1`).", + "All trades sharing a single taker execution share the same first component (before `-`), and `event_time`.", + "`trade_id` is guaranteed to be consistent across MarketData `Trade` and Trading `Fill`." + ] + }, + { + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", + "json_type": "string", + "index": 15, "array_depth": 0, "optional": false, - "example": "'123456.78'", + "example": "'0x10000101000203040506'", "comment": [ - "The open price, expressed in underlying currency resolution units" + "An order identifier" ] }, { - "name": "close", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", - "index": 3, + "name": "venue", + "lite_name": "v", + "semantic_type": "Venue", + "json_type": "Venue", + "index": 16, "array_depth": 0, "optional": false, - "example": "'123456.78'", + "example": "'ORDERBOOK'", "comment": [ - "The close price, expressed in underlying currency resolution units" + "The venue where the trade occurred" ] }, { - "name": "high", - "lite_name": "h", - "semantic_type": "string", - "json_type": "string", - "index": 4, + "name": "is_liquidation", + "lite_name": "il", + "semantic_type": "bool", + "json_type": "boolean", + "index": 17, "array_depth": 0, "optional": false, - "example": "'123456.78'", + "example": "false", "comment": [ - "The high price, expressed in underlying currency resolution units" + "If the trade was a liquidation" ] }, { - "name": "low", - "lite_name": "l", - "semantic_type": "string", + "name": "client_order_id", + "lite_name": "co", + "semantic_type": "uint64", "json_type": "string", - "index": 5, + "index": 18, "array_depth": 0, "optional": false, - "example": "'123456.78'", + "example": "'23042'", "comment": [ - "The low price, expressed in underlying currency resolution units" + "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": "volume_b", - "lite_name": "vb", - "semantic_type": "string", + "name": "signer", + "lite_name": "s1", + "semantic_type": "uint256", "json_type": "string", - "index": 6, + "index": 20, "array_depth": 0, "optional": false, - "example": "'123456.78'", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "The underlying volume transacted, expressed in base asset decimal units" + "The address (public key) of the wallet signing the payload" ] }, { - "name": "volume_q", - "lite_name": "vq", - "semantic_type": "string", - "json_type": "string", - "index": 7, + "name": "broker", + "lite_name": "b", + "semantic_type": "BrokerTag", + "json_type": "BrokerTag", + "index": 21, "array_depth": 0, - "optional": false, - "example": "'123456.78'", + "optional": true, + "default": "", "comment": [ - "The quote volume transacted, expressed in quote asset decimal units" + "Specifies the broker who brokered the order" ] }, { - "name": "trades", - "lite_name": "t", - "semantic_type": "uint32", - "json_type": "integer", - "index": 8, + "name": "is_rpi", + "lite_name": "ir1", + "semantic_type": "bool", + "json_type": "boolean", + "index": 22, "array_depth": 0, "optional": false, - "example": "123456", + "example": "false", "comment": [ - "The number of trades transacted" + "If the trade is a RPI trade" ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "builder", + "lite_name": "b1", + "semantic_type": "address", "json_type": "string", - "index": 9, + "index": 24, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'$GRVT_MAIN_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 main account ID of the builder. referred to Order.builder" ] - } - ], - "comment": [ - "" - ] - }, - { - "name": "ApiCandlestickResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "Candlestick", - "json_type": "Candlestick", - "index": 0, - "array_depth": 1, + "name": "builder_fee_rate", + "lite_name": "bf", + "semantic_type": "string", + "json_type": "string", + "index": 25, + "array_depth": 0, "optional": false, + "example": "0.001", "comment": [ - "The candlestick result set for given interval" + "Builder fee percentage charged for this order. referred to Order.builder builderFee " ] }, { - "name": "next", - "lite_name": "n", + "name": "builder_fee", + "lite_name": "bf1", "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 26, "array_depth": 0, - "optional": true, - "default": "''", - "example": "'Qw0918='", + "optional": false, + "example": "'0.2'", "comment": [ - "The cursor to indicate when to start the next query from" + "The builder fee paid on the trade, expressed in quote asset decimal unit. referred to Trade.builderFee" ] } ], "comment": [] }, { - "name": "ApiFundingRateRequest", - "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" + "The main account ID of the account to which the summary belongs" ] }, { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", + "name": "total_equity", + "lite_name": "te", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "optional": false, + "example": "'3945034.23'", "comment": [ - "Start time of funding rate in unix nanoseconds" + "Total equity of the main account, denominated in USD" ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", - "json_type": "string", + "name": "spot_balances", + "lite_name": "sb", + "semantic_type": "SpotBalance", + "json_type": "SpotBalance", "index": 2, - "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", + "array_depth": 1, + "optional": false, "comment": [ - "End time of funding rate in unix nanoseconds" + "The list of spot assets owned by this main account, and their balances" ] }, { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", + "name": "vault_investments", + "lite_name": "vi", + "semantic_type": "VaultInvestment", + "json_type": "VaultInvestment", "index": 3, - "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", - "comment": [ - "The limit to query for. Defaults to 500; Max 1000" - ] - }, - { - "name": "cursor", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", - "comment": [ - "The cursor to indicate when to start the query from" - ] - }, - { - "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'", + "array_depth": 1, + "optional": false, "comment": [ - "Aggregation method for historical funding rate observations. Defaults to using the instrument-specific funding interval." + "The list of vault investments held by this main account" ] } ], "comment": [ - "Lookup the historical funding rate of a perpetual future.", - "", - "Pagination works as follows:\u003cul\u003e\u003cli\u003eWe perform a reverse chronological lookup, starting from `end_time`. If `end_time` is not set, we start from the most recent data.\u003c/li\u003e\u003cli\u003eThe lookup is limited to `limit` records. If more data is requested, the response will contain a `next` cursor for you to query the next page.\u003c/li\u003e\u003cli\u003eIf a `cursor` is provided, it will be used to fetch results from that point onwards.\u003c/li\u003e\u003cli\u003ePagination will continue until the `start_time` is reached. If `start_time` is not set, pagination will continue as far back as our data retention policy allows.\u003c/li\u003e\u003c/ul\u003e" + "The funding account summary, that reports the total equity and spot balances of a funding (main) account" ] }, { - "name": "ApiFundingRate", + "name": "FundingPayment", "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", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "0.0003", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The funding rate of the instrument, expressed in percentage points" + "The sub account ID that made the funding payment" ] }, { - "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 perpetual instrument being funded" ] }, - { - "name": "mark_price", - "lite_name": "mp", + { + "name": "currency", + "lite_name": "c", "semantic_type": "string", "json_type": "string", "index": 3, "array_depth": 0, "optional": false, - "example": "'65038.01'", + "example": "'USDT'", "comment": [ - "The mark price of the instrument at funding timestamp, expressed in `9` decimals" + "The currency of the funding payment" ] }, { - "name": "funding_rate_8_h_avg", - "lite_name": "fr1", + "name": "amount", + "lite_name": "a", "semantic_type": "string", "json_type": "string", "index": 4, "array_depth": 0, "optional": false, - "example": "0.0003", + "example": "'9.75'", "comment": [ - "Deprecated: Refer to `funding_rate` instead. Will be removed in a future release." + "The amount of the funding payment. Positive if paid, negative if received" ] }, { - "name": "funding_interval_hours", - "lite_name": "fi", - "semantic_type": "uint8", - "json_type": "integer", + "name": "tx_id", + "lite_name": "ti", + "semantic_type": "uint64", + "json_type": "string", "index": 5, "array_depth": 0, "optional": false, - "example": "8", + "example": "'209358'", "comment": [ - "Funding interval in hours (e.g. 1/4/8/etc)." + "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": "ApiFundingRateResponse", - "is_root": true, + "name": "InitialLeverageResult", + "is_root": false, "fields": [ { - "name": "result", - "lite_name": "r", - "semantic_type": "ApiFundingRate", - "json_type": "ApiFundingRate", + "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 funding rate result set for given interval" + "The instrument to get the leverage for" ] }, { - "name": "next", - "lite_name": "n", + "name": "leverage", + "lite_name": "l", "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, - "optional": true, - "default": "''", - "example": "'Qw0918='", + "optional": false, + "example": "'10'", "comment": [ - "The cursor to indicate when to start the next query from" + "The initial leverage of this instrument" ] - } - ], - "comment": [] - }, - { - "name": "JSONRPCRequest", - "is_root": true, - "fields": [ + }, { - "name": "jsonrpc", - "lite_name": "j", + "name": "min_leverage", + "lite_name": "ml", "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 2, "array_depth": 0, "optional": false, - "example": "'2.0'", + "example": "'10'", "comment": [ - "The JSON RPC version to use for the request" + "The min leverage user can set for this instrument" ] }, { - "name": "method", - "lite_name": "m", + "name": "max_leverage", + "lite_name": "ml1", "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 3, "array_depth": 0, "optional": false, - "example": "'subscribe'", + "example": "'50'", "comment": [ - "The method to use for the request (eg: `subscribe` / `unsubscribe` / `v1/instrument` )" + "The max leverage user can set for this instrument" ] }, { - "name": "params", - "lite_name": "p", - "semantic_type": "any", - "json_type": "object", - "index": 2, + "name": "margin_type", + "lite_name": "mt", + "semantic_type": "PositionMarginType", + "json_type": "PositionMarginType", + "index": 4, "array_depth": 0, "optional": false, "comment": [ - "The parameters for the request" - ] - }, - { - "name": "id", - "lite_name": "i", - "semantic_type": "uint32", - "json_type": "integer", - "index": 3, - "array_depth": 0, - "optional": true, - "default": "0", - "example": "123", - "comment": [ - "Optional Field which is used to match the response by the client.", - "If not passed, this field will not be returned" + "The margin type of this instrument" ] } ], - "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": "InstrumentDisplay", + "is_root": false, "fields": [ { - "name": "code", - "lite_name": "c", - "semantic_type": "uint16", - "json_type": "integer", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "123", + "example": "'BTC_USDT_Perp'", "comment": [ - "The error code for the request" + "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": "message", - "lite_name": "m", - "semantic_type": "string", + "name": "instrument_hash", + "lite_name": "ih", + "semantic_type": "uint256", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'An error occurred'", + "example": "'0x030501'", "comment": [ - "The error message for the request" + "The asset ID used for instrument signing." ] - } - ], - "comment": [ - "An error response" - ] - }, - { - "name": "JSONRPCResponse", - "is_root": true, - "fields": [ + }, { - "name": "jsonrpc", - "lite_name": "j", + "name": "base", + "lite_name": "b", "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 2, "array_depth": 0, "optional": false, - "example": "'2.0'", + "example": "'BTC'", "comment": [ - "The JSON RPC version to use for the request" + "The base currency" ] }, { - "name": "result", - "lite_name": "r", - "semantic_type": "any", - "json_type": "object", - "index": 1, + "name": "quote", + "lite_name": "q", + "semantic_type": "string", + "json_type": "string", + "index": 3, "array_depth": 0, - "optional": true, - "default": "null", + "optional": false, + "example": "'USDT'", "comment": [ - "The result for the request" + "The quote currency" ] }, { - "name": "error", - "lite_name": "e", - "semantic_type": "Error", - "json_type": "Error", - "index": 2, + "name": "kind", + "lite_name": "k", + "semantic_type": "Kind", + "json_type": "Kind", + "index": 4, "array_depth": 0, - "optional": true, - "default": "null", + "optional": false, + "example": "'PERPETUAL'", "comment": [ - "The error for the request" + "The kind of instrument" ] }, { - "name": "id", - "lite_name": "i", - "semantic_type": "uint32", - "json_type": "integer", - "index": 3, + "name": "venues", + "lite_name": "v", + "semantic_type": "Venue", + "json_type": "Venue", + "index": 7, + "array_depth": 1, + "optional": false, + "example": "['ORDERBOOK']", + "comment": [ + "Venues that this instrument can be traded at" + ] + }, + { + "name": "settlement_period", + "lite_name": "sp1", + "semantic_type": "InstrumentSettlementPeriod", + "json_type": "InstrumentSettlementPeriod", + "index": 8, "array_depth": 0, - "optional": true, - "default": "0", - "example": "123", + "optional": false, + "example": "'PERPETUAL'", "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 settlement period of the instrument" ] }, { - "name": "method", - "lite_name": "m", - "semantic_type": "string", - "json_type": "string", - "index": 4, + "name": "base_decimals", + "lite_name": "bd", + "semantic_type": "int8", + "json_type": "integer", + "index": 9, "array_depth": 0, "optional": false, - "example": "'subscribe'", + "example": "3", "comment": [ - "The method used in the request for this response (eg: `subscribe` / `unsubscribe` / `v1/instrument` )" + "The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)" ] - } - ], - "comment": [ - "All Websocket JSON RPC Responses are housed in this wrapper. It returns a confirmation of the JSON RPC subscribe request.", - "If a `request_id` is supplied in the JSON RPC request, it will be propagated back in this JSON RPC response." - ] - }, - { - "name": "WSSubscribeParams", - "is_root": true, - "fields": [ + }, { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 0, + "name": "quote_decimals", + "lite_name": "qd", + "semantic_type": "int8", + "json_type": "integer", + "index": 10, "array_depth": 0, "optional": false, - "example": "'v1.ticker.d'", + "example": "3", "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" + "The smallest denomination of the quote asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)" ] }, { - "name": "selectors", - "lite_name": "s1", + "name": "tick_size", + "lite_name": "ts", "semantic_type": "string", "json_type": "string", - "index": 1, - "array_depth": 1, + "index": 11, + "array_depth": 0, "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", + "example": "'0.01'", "comment": [ - "The list of feeds to subscribe to" + "The size of a single tick, expressed in price decimal units" ] }, { - "name": "use_global_sequence_number", - "lite_name": "ug", - "semantic_type": "bool", - "json_type": "boolean", - "index": 2, - "array_depth": 0, - "optional": true, - "default": "false", - "example": "true", - "comment": [ - "Whether to use the global sequence number for the stream" - ] - } - ], - "comment": [ - "All V1 Websocket Subscription Requests are housed in this wrapper. You may specify a stream and a list of feeds to subscribe to.", - "When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details.", - "Sequence numbers can be either gateway-specific or global:", - "- **Gateway Unique Sequence Number**: Increments by one per stream, resets to 0 on gateway restart.", - "- **Global Unique Sequence Number**: A cluster-wide unique number assigned to each cluster payload, does not reset on gateway restarts, and can be used to track and identify message order across streams using `sequence_number` and `prev_sequence_number` in the feed response.", - "Set `useGlobalSequenceNumber = true` if you need a persistent, unique identifier across all streams or ordering across multiple feeds." - ] - }, - { - "name": "WSSubscribeResult", - "is_root": true, - "fields": [ - { - "name": "stream", - "lite_name": "s", + "name": "min_size", + "lite_name": "ms", "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 12, "array_depth": 0, "optional": false, - "example": "'v1.ticker.d'", + "example": "'0.01'", "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" + "The minimum contract size, expressed in base asset decimal units" ] }, { - "name": "subs", - "lite_name": "s1", - "semantic_type": "string", + "name": "create_time", + "lite_name": "ct", + "semantic_type": "timestamp", "json_type": "string", - "index": 1, - "array_depth": 1, + "index": 14, + "array_depth": 0, "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", + "example": "'1697788800000000000'", "comment": [ - "The list of feeds subscribed to" + "Creation time in unix nanoseconds" ] }, { - "name": "unsubs", - "lite_name": "u", + "name": "max_position_size", + "lite_name": "mp", "semantic_type": "string", "json_type": "string", - "index": 2, - "array_depth": 1, + "index": 15, + "array_depth": 0, "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", + "example": "'100.0'", "comment": [ - "The list of feeds unsubscribed from" + "The maximum position size, expressed in base asset decimal units" ] }, { - "name": "num_snapshots", - "lite_name": "ns", - "semantic_type": "uint32", + "name": "funding_interval_hours", + "lite_name": "fi", + "semantic_type": "uint8", "json_type": "integer", - "index": 3, - "array_depth": 1, - "optional": false, - "example": "10", + "index": 17, + "array_depth": 0, + "optional": true, "comment": [ - "The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs`" + "Defines the funding interval to be applied." ] }, { - "name": "first_sequence_number", - "lite_name": "fs", - "semantic_type": "uint64", + "name": "adjusted_funding_rate_cap", + "lite_name": "af", + "semantic_type": "string", "json_type": "string", - "index": 4, - "array_depth": 1, - "optional": false, - "example": "872634876", + "index": 18, + "array_depth": 0, + "optional": true, + "example": "2.5", "comment": [ - "The first sequence number to expect for each subscribed feed. Returned in same order as `subs`" + "Funding rate cap over the defined `intervalHours`." ] }, { - "name": "latest_sequence_number", - "lite_name": "ls", - "semantic_type": "uint64", + "name": "adjusted_funding_rate_floor", + "lite_name": "af1", + "semantic_type": "string", "json_type": "string", - "index": 5, - "array_depth": 1, + "index": 19, + "array_depth": 0, + "optional": true, + "example": "-2.5", + "comment": [ + "Funding rate floor over the defined `intervalHours`." + ] + }, + { + "name": "min_notional", + "lite_name": "mn", + "semantic_type": "string", + "json_type": "string", + "index": 20, + "array_depth": 0, "optional": false, - "example": "872634875", + "example": "'20.0'", "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 minimum order notional value, expressed in quote currency decimal units" ] } ], - "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." - ] + "comment": [] }, { - "name": "WSUnsubscribeParams", + "name": "JSONRPCRequest", "is_root": true, "fields": [ { - "name": "stream", - "lite_name": "s", + "name": "jsonrpc", + "lite_name": "j", "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.ticker.d'", + "example": "'2.0'", "comment": [ - "The channel to unsubscribe from (eg: ticker.s / ticker.d)" + "The JSON RPC version to use for the request" ] }, { - "name": "selectors", - "lite_name": "s1", + "name": "method", + "lite_name": "m", "semantic_type": "string", "json_type": "string", "index": 1, - "array_depth": 1, + "array_depth": 0, "optional": false, - "example": "['BTC_USDT_Perp', 'ETH_USDT_Perp']", + "example": "'subscribe'", "comment": [ - "The list of feeds to unsubscribe from" + "The method to use for the request (eg: `subscribe` / `unsubscribe` / `v1/instrument` )" ] }, { - "name": "use_global_sequence_number", - "lite_name": "ug", - "semantic_type": "bool", - "json_type": "boolean", + "name": "params", + "lite_name": "p", + "semantic_type": "any", + "json_type": "object", "index": 2, "array_depth": 0, + "optional": false, + "comment": [ + "The parameters for the request" + ] + }, + { + "name": "id", + "lite_name": "i", + "semantic_type": "uint32", + "json_type": "integer", + "index": 3, + "array_depth": 0, "optional": true, - "default": "false", - "example": "true", + "default": "0", + "example": "123", "comment": [ - "Whether to use the global sequence number for the stream" + "Optional Field which is used to match the response by the client.", + "If not passed, this field will not be returned" ] } ], "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." + "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": "WSUnsubscribeResult", + "name": "JSONRPCResponse", "is_root": true, "fields": [ { - "name": "stream", - "lite_name": "s", + "name": "jsonrpc", + "lite_name": "j", "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.ticker.d'", + "example": "'2.0'", "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" + "The JSON RPC version to use for the request" ] }, { - "name": "unsubs", - "lite_name": "u", - "semantic_type": "string", - "json_type": "string", + "name": "result", + "lite_name": "r", + "semantic_type": "any", + "json_type": "object", "index": 1, - "array_depth": 1, - "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", - "comment": [ - "The list of feeds unsubscribed from" - ] - } - ], - "comment": [ - "Returns a confirmation of all unsubscribes" - ] - }, - { - "name": "WSSubscribeRequestV1Legacy", - "is_root": true, - "fields": [ - { - "name": "request_id", - "lite_name": "ri", - "semantic_type": "uint32", - "json_type": "integer", - "index": 0, "array_depth": 0, "optional": true, - "default": "0", - "example": "123", + "default": "null", "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 result for the request" ] }, { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 1, + "name": "error", + "lite_name": "e", + "semantic_type": "Error", + "json_type": "Error", + "index": 2, "array_depth": 0, - "optional": false, - "example": "'v1.ticker.d'", + "optional": true, + "default": "null", "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" + "The error for the request" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "string", - "json_type": "string", - "index": 2, - "array_depth": 1, - "optional": false, - "example": "['BTC_USDT_Perp', 'ETH_USDT_Perp']", + "name": "id", + "lite_name": "i", + "semantic_type": "uint32", + "json_type": "integer", + "index": 3, + "array_depth": 0, + "optional": true, + "default": "0", + "example": "123", "comment": [ - "The list of feeds to subscribe to" + "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)" ] }, { @@ -7617,402 +8927,361 @@ "lite_name": "m", "semantic_type": "string", "json_type": "string", - "index": 3, + "index": 4, "array_depth": 0, "optional": false, "example": "'subscribe'", "comment": [ - "The method to use for the request (eg: subscribe / unsubscribe)" - ] - }, - { - "name": "is_full", - "lite_name": "if", - "semantic_type": "bool", - "json_type": "boolean", - "index": 4, - "array_depth": 0, - "optional": true, - "default": "false", - "example": "true", - "comment": [ - "Whether the request is for full data or lite data" + "The method used in the request for this response (eg: `subscribe` / `unsubscribe` / `v1/instrument` )" ] } ], "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." + "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": "WSSubscribeResponseV1Legacy", - "is_root": true, + "name": "MiniTicker", + "is_root": false, "fields": [ { - "name": "request_id", - "lite_name": "ri", - "semantic_type": "uint32", - "json_type": "integer", + "name": "event_time", + "lite_name": "et", + "semantic_type": "timestamp", + "json_type": "string", "index": 0, "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" + "Time at which the event was emitted in unix nanoseconds" ] }, { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 1, "array_depth": 0, - "optional": false, - "example": "'v1.ticker.d'", + "optional": true, + "example": "'BTC_USDT_Perp'", "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" + "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": "subs", - "lite_name": "s1", + "name": "mark_price", + "lite_name": "mp", "semantic_type": "string", "json_type": "string", "index": 2, - "array_depth": 1, - "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", + "array_depth": 0, + "optional": true, + "example": "'65038.01'", "comment": [ - "The list of feeds subscribed to" + "The mark price of the instrument, expressed in `9` decimals" ] }, { - "name": "unsubs", - "lite_name": "u", + "name": "index_price", + "lite_name": "ip", "semantic_type": "string", "json_type": "string", "index": 3, - "array_depth": 1, - "optional": false, - "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", + "array_depth": 0, + "optional": true, + "example": "'65038.01'", "comment": [ - "The list of feeds unsubscribed from" + "The index price of the instrument, expressed in `9` decimals" ] }, { - "name": "num_snapshots", - "lite_name": "ns", - "semantic_type": "uint32", - "json_type": "integer", + "name": "last_price", + "lite_name": "lp", + "semantic_type": "string", + "json_type": "string", "index": 4, - "array_depth": 1, - "optional": false, - "example": "10", + "array_depth": 0, + "optional": true, + "example": "'65038.01'", "comment": [ - "The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs`" + "The last traded price of the instrument (also close price), expressed in `9` decimals" ] }, { - "name": "first_sequence_number", - "lite_name": "fs", - "semantic_type": "uint64", + "name": "last_size", + "lite_name": "ls", + "semantic_type": "string", "json_type": "string", "index": 5, - "array_depth": 1, - "optional": false, - "example": "872634876", + "array_depth": 0, + "optional": true, + "example": "'123456.78'", "comment": [ - "The first sequence number to expect for each subscribed feed. Returned in same order as `subs`" + "The number of assets traded in the last trade, expressed in base asset decimal units" ] }, { - "name": "latest_sequence_number", - "lite_name": "ls", - "semantic_type": "uint64", + "name": "mid_price", + "lite_name": "mp1", + "semantic_type": "string", "json_type": "string", "index": 6, - "array_depth": 1, - "optional": false, - "example": "872634875", + "array_depth": 0, + "optional": true, + "example": "'65038.01'", "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 mid price of the instrument, expressed in `9` decimals" ] - } - ], - "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": "best_bid_price", + "lite_name": "bb", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 7, "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", + "optional": true, + "example": "'65038.01'", "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 best bid price of the instrument, expressed in `9` decimals" + ] }, { - "name": "rate", - "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, + "name": "best_bid_size", + "lite_name": "bb1", + "semantic_type": "string", + "json_type": "string", + "index": 8, "array_depth": 0, - "optional": false, - "example": "500", + "optional": true, + "example": "'123456.78'", "comment": [ - "The minimal rate at which we publish feeds (in milliseconds)", - "Delta (50, 100, 500, 1000)", - "Snapshot (500, 1000)" - ], - "selector": "secondary" + "The number of assets offered on the best bid price of the instrument, expressed in base asset decimal units" + ] }, { - "name": "depth", - "lite_name": "d", - "semantic_type": "uint32", - "json_type": "integer", - "index": 2, + "name": "best_ask_price", + "lite_name": "ba", + "semantic_type": "string", + "json_type": "string", + "index": 9, "array_depth": 0, "optional": true, - "default": "'0'", - "example": "50", + "example": "'65038.01'", "comment": [ - "Depth of the order book to be retrieved", - "Delta(0 - `unlimited`)", - "Snapshot(10, 50, 100, 500)" - ], - "selector": "secondary" + "The best ask price of the instrument, expressed in `9` decimals" + ] + }, + { + "name": "best_ask_size", + "lite_name": "ba1", + "semantic_type": "string", + "json_type": "string", + "index": 10, + "array_depth": 0, + "optional": true, + "example": "'123456.78'", + "comment": [ + "The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units" + ] } ], - "comment": [ - "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" - ] + "comment": [] }, { - "name": "WSOrderbookLevelsFeedDataV1", - "is_root": true, + "name": "Order", + "is_root": false, "fields": [ { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", "json_type": "string", "index": 0, "array_depth": 0, - "optional": false, - "example": "'v1.book.s'", + "optional": true, + "default": "0", + "example": "'0x1234567890abcdef'", "comment": [ - "Stream name" + "[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend" ] }, { - "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 subaccount initiating the order" ] }, { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", - "json_type": "string", + "name": "is_market", + "lite_name": "im", + "semantic_type": "bool", + "json_type": "boolean", "index": 2, "array_depth": 0, - "optional": false, - "example": "'872634876'", + "optional": true, + "default": "false", + "example": "false", "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`." + "If the order is a market order", + "Market Orders do not have a limit price, and are always executed according to the maker order price.", + "Market Orders must always be taker orders" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "OrderbookLevels", - "json_type": "OrderbookLevels", + "name": "time_in_force", + "lite_name": "ti", + "semantic_type": "TimeInForce", + "json_type": "TimeInForce", "index": 3, "array_depth": 0, "optional": false, "comment": [ - "An orderbook levels object matching the request filter" + "Four supported types of orders: GTT, IOC, AON, FOK:\u003cul\u003e", + "\u003cli\u003ePARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg\u003c/li\u003e", + "\u003cli\u003eFULL EXECUTION = AON / FOK - only allows full size execution on all legs\u003c/li\u003e", + "\u003cli\u003eTAKER ONLY = IOC / FOK - only allows taker orders\u003c/li\u003e", + "\u003cli\u003eMAKER OR TAKER = GTT / AON - allows maker or taker orders\u003c/li\u003e", + "\u003c/ul\u003eExchange only supports (GTT, IOC, FOK)", + "RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)" ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", - "json_type": "string", + "name": "post_only", + "lite_name": "po", + "semantic_type": "bool", + "json_type": "boolean", "index": 4, "array_depth": 0, - "optional": false, - "example": "'872634875'", + "optional": true, + "default": "false", + "example": "false", "comment": [ - "The previous sequence number that determines the message order" + "If True, Order must be a maker order. It has to fill the orderbook instead of match it.", + "If False, Order can be either a maker or taker order. \u003cb\u003eIn this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.\u003c/b\u003e", + "", + "| | Must Fill All | Can Fill Partial |", + "| - | - | - |", + "| Must Be Taker | FOK + False | IOC + False |", + "| Can Be Either | AON + False | GTC + False |", + "| Must Be Maker | AON + True | GTC + True |", + "" ] - } - ], - "comment": [] - }, - { - "name": "WSMiniTickerFeedSelectorV1", - "is_root": true, - "fields": [ + }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 0, + "name": "reduce_only", + "lite_name": "ro", + "semantic_type": "bool", + "json_type": "boolean", + "index": 5, "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", + "optional": true, + "default": "false", + "example": "false", "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" + "If True, Order must reduce the position size, or be cancelled" + ] }, { - "name": "rate", - "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", - "index": 1, - "array_depth": 0, + "name": "legs", + "lite_name": "l", + "semantic_type": "OrderLeg", + "json_type": "OrderLeg", + "index": 6, + "array_depth": 1, "optional": false, - "example": "500", "comment": [ - "The minimal rate at which we publish feeds (in milliseconds)", - "Delta (0 - `raw`, 50, 100, 200, 500, 1000, 5000)", - "Snapshot (200, 500, 1000, 5000)" - ], - "selector": "secondary" - } - ], - "comment": [ - "Subscribes to a mini ticker feed for a single instrument. The `mini.s` channel offers simpler integration. To experience higher publishing rates, please use the `mini.d` channel.", - "Unlike the `mini.d` channel which publishes an initial snapshot, then only streams deltas after, the `mini.s` channel publishes full snapshots at each feed.", - "", - "The Delta feed will work as follows:\u003cul\u003e\u003cli\u003eOn subscription, the server will send a full snapshot of the mini ticker.\u003c/li\u003e\u003cli\u003eAfter the snapshot, the server will only send deltas of the mini ticker.\u003c/li\u003e\u003cli\u003eThe server will send a delta if any of the fields in the mini ticker have changed.\u003c/li\u003e\u003c/ul\u003e", - "", - "Field Semantics:\u003cul\u003e\u003cli\u003e[DeltaOnly] If a field is not updated, {}\u003c/li\u003e\u003cli\u003eIf a field is updated, {field: '123'}\u003c/li\u003e\u003cli\u003eIf a field is set to zero, {field: '0'}\u003c/li\u003e\u003cli\u003eIf a field is set to null, {field: ''}\u003c/li\u003e\u003c/ul\u003e" - ] - }, - { - "name": "WSMiniTickerFeedDataV1", - "is_root": true, - "fields": [ + "The legs present in this order", + "The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice" + ] + }, { - "name": "stream", + "name": "signature", "lite_name": "s", - "semantic_type": "string", - "json_type": "string", - "index": 0, + "semantic_type": "Signature", + "json_type": "Signature", + "index": 7, "array_depth": 0, "optional": false, - "example": "'v1.mini.s'", "comment": [ - "Stream name" + "The signature approving this order" ] }, { - "name": "selector", - "lite_name": "s1", - "semantic_type": "string", - "json_type": "string", - "index": 1, + "name": "metadata", + "lite_name": "m", + "semantic_type": "OrderMetadata", + "json_type": "OrderMetadata", + "index": 8, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", "comment": [ - "Primary selector" + "Order Metadata, ignored by the smart contract, and unsigned by the client" ] }, { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", - "json_type": "string", - "index": 2, + "name": "state", + "lite_name": "s1", + "semantic_type": "OrderState", + "json_type": "OrderState", + "index": 9, "array_depth": 0, - "optional": false, - "example": "'872634876'", + "optional": true, + "default": "''", "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`." + "[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "MiniTicker", - "json_type": "MiniTicker", - "index": 3, + "name": "builder", + "lite_name": "b", + "semantic_type": "address", + "json_type": "string", + "index": 12, "array_depth": 0, "optional": false, + "example": "'$GRVT_MAIN_ACCOUNT_ID'", "comment": [ - "A mini ticker matching the request filter" + "The main account ID of the builder" ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", + "name": "builder_fee", + "lite_name": "bf", + "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 13, "array_depth": 0, "optional": false, - "example": "'872634875'", + "example": "0.001", "comment": [ - "The previous sequence number that determines the message order" + "Builder fee charged for this order " ] } ], - "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": "WSTickerFeedSelectorV1", - "is_root": true, + "name": "OrderLeg", + "is_root": false, "fields": [ { "name": "instrument", @@ -8024,2439 +9293,2415 @@ "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" + "The instrument to trade in this leg" + ] }, { - "name": "rate", - "lite_name": "r", - "semantic_type": "uint32", - "json_type": "integer", + "name": "size", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "500", + "example": "'10.5'", + "comment": [ + "The total number of assets to trade in this leg, expressed in base asset decimal units." + ] + }, + { + "name": "limit_price", + "lite_name": "lp", + "semantic_type": "string", + "json_type": "string", + "index": 2, + "array_depth": 0, + "optional": true, + "default": "0", + "example": "'65038.01'", + "comment": [ + "The limit price of the order leg, expressed in `9` decimals.", + "This is the number of quote currency units to pay/receive for this leg.", + "This should be `null/0` if the order is a market order" + ] + }, + { + "name": "is_buying_asset", + "lite_name": "ib", + "semantic_type": "bool", + "json_type": "boolean", + "index": 3, + "array_depth": 0, + "optional": false, + "example": "true", "comment": [ - "The minimal rate at which we publish feeds (in milliseconds)", - "Delta (100, 200, 500, 1000, 5000)", - "Snapshot (500, 1000, 5000)" - ], - "selector": "secondary" + "Specifies if the order leg is a buy or sell" + ] } ], - "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" - ] + "comment": [] }, { - "name": "WSTickerFeedDataV1", - "is_root": true, + "name": "OrderMetadata", + "is_root": false, "fields": [ { - "name": "stream", - "lite_name": "s", - "semantic_type": "string", + "name": "client_order_id", + "lite_name": "co", + "semantic_type": "uint64", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.ticker.s'", + "example": "'23042'", "comment": [ - "Stream name" + "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": "selector", - "lite_name": "s1", - "semantic_type": "string", + "name": "create_time", + "lite_name": "ct", + "semantic_type": "timestamp", "json_type": "string", "index": 1, "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", + "optional": true, + "default": "0", + "example": "'1697788800000000000'", "comment": [ - "Primary selector" + "[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds" ] }, { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", - "json_type": "string", + "name": "trigger", + "lite_name": "t", + "semantic_type": "TriggerOrderMetadata", + "json_type": "TriggerOrderMetadata", "index": 2, "array_depth": 0, - "optional": false, - "example": "'872634876'", + "optional": true, + "default": "", "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`." + "Trigger fields are used to support any type of trigger order such as TP/SL" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "Ticker", - "json_type": "Ticker", + "name": "broker", + "lite_name": "b", + "semantic_type": "BrokerTag", + "json_type": "BrokerTag", "index": 3, "array_depth": 0, - "optional": false, - "comment": [ - "A ticker matching the request filter" - ] - }, - { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'872634875'", + "optional": true, + "default": "", + "example": "'BROKER_CODE'", "comment": [ - "The previous sequence number that determines the message order" + "Specifies the broker who brokered the order" ] } ], - "comment": [] + "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": "WSTradeFeedSelectorV1", - "is_root": true, + "name": "OrderState", + "is_root": false, "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", + "name": "status", + "lite_name": "s", + "semantic_type": "OrderStatus", + "json_type": "OrderStatus", "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" + "The status of the order" + ] }, { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", + "name": "reject_reason", + "lite_name": "rr", + "semantic_type": "OrderRejectReason", + "json_type": "OrderRejectReason", "index": 1, "array_depth": 0, "optional": false, - "example": "500", + "example": "'CLIENT_CANCEL'", "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 reason for rejection or cancellation" + ] + }, { - "name": "stream", - "lite_name": "s", + "name": "book_size", + "lite_name": "bs", "semantic_type": "string", "json_type": "string", - "index": 0, - "array_depth": 0, + "index": 2, + "array_depth": 1, "optional": false, - "example": "'v1.trade'", + "example": "['10.5']", "comment": [ - "Stream name" + "The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs" ] }, { - "name": "selector", - "lite_name": "s1", + "name": "traded_size", + "lite_name": "ts", "semantic_type": "string", "json_type": "string", - "index": 1, - "array_depth": 0, + "index": 3, + "array_depth": 1, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "['1.5']", "comment": [ - "Primary selector" + "The total number of assets traded. Sorted in same order as Order.Legs" ] }, { - "name": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", + "name": "update_time", + "lite_name": "ut", + "semantic_type": "timestamp", "json_type": "string", - "index": 2, + "index": 4, "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`." + "Time at which the order was updated by GRVT, expressed in unix nanoseconds" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "Trade", - "json_type": "Trade", - "index": 3, + "name": "avg_fill_price", + "lite_name": "af", + "semantic_type": "string", + "json_type": "string", + "index": 5, + "array_depth": 1, + "optional": false, + "example": "['60000.4']", + "comment": [ + "The average fill price of the order. Sorted in same order as Order.Legs" + ] + } + ], + "comment": [] + }, + { + "name": "OrderStateFeed", + "is_root": false, + "fields": [ + { + "name": "order_id", + "lite_name": "oi", + "semantic_type": "uint128", + "json_type": "string", + "index": 0, "array_depth": 0, "optional": false, + "example": "'10000101000203040506'", "comment": [ - "A public trade matching the request filter" + "A unique 128-bit identifier for the order, deterministically generated within the GRVT backend" ] }, { - "name": "prev_sequence_number", - "lite_name": "ps", + "name": "client_order_id", + "lite_name": "co", "semantic_type": "uint64", "json_type": "string", - "index": 4, + "index": 1, "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" + ] + }, + { + "name": "order_state", + "lite_name": "os", + "semantic_type": "OrderState", + "json_type": "OrderState", + "index": 2, + "array_depth": 0, + "optional": false, + "comment": [ + "The order state object being created or updated" ] } ], "comment": [] }, { - "name": "WSCandlestickFeedSelectorV1", - "is_root": true, + "name": "OrderbookLevel", + "is_root": false, "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "name": "price", + "lite_name": "p", + "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'BTC_USDT_Perp'", + "example": "'65038.01'", "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 price of the level, expressed in `9` decimals" + ] }, { - "name": "interval", - "lite_name": "i1", - "semantic_type": "CandlestickInterval", - "json_type": "CandlestickInterval", + "name": "size", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, + "example": "'3456.78'", "comment": [ - "The interval of each candlestick" - ], - "selector": "secondary" + "The number of assets offered, expressed in base asset decimal units" + ] }, { - "name": "type", - "lite_name": "t", - "semantic_type": "CandlestickType", - "json_type": "CandlestickType", + "name": "num_orders", + "lite_name": "no", + "semantic_type": "uint32", + "json_type": "integer", "index": 2, "array_depth": 0, "optional": false, + "example": "'123'", "comment": [ - "The type of candlestick data to retrieve" - ], - "selector": "secondary" + "The number of open orders at this level" + ] } ], - "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." - ] + "comment": [] }, { - "name": "WSCandlestickFeedDataV1", - "is_root": true, + "name": "OrderbookLevels", + "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": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, "example": "'BTC_USDT_Perp'", "comment": [ - "Primary selector" + "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": "sequence_number", - "lite_name": "sn", - "semantic_type": "uint64", - "json_type": "string", + "name": "bids", + "lite_name": "b", + "semantic_type": "OrderbookLevel", + "json_type": "OrderbookLevel", "index": 2, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'872634876'", "comment": [ - "A sequence number used to determine message order within a stream.", - "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", - "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", - " - A single cluster payload can be multiplexed into multiple stream payloads.", - " - To distinguish each stream payload, a `dedupCounter` is included.", - " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." + "The list of best bids up till query depth" ] }, { - "name": "feed", - "lite_name": "f", - "semantic_type": "Candlestick", - "json_type": "Candlestick", + "name": "asks", + "lite_name": "a", + "semantic_type": "OrderbookLevel", + "json_type": "OrderbookLevel", "index": 3, - "array_depth": 0, - "optional": false, - "comment": [ - "A candlestick entry matching the request filters" - ] - }, - { - "name": "prev_sequence_number", - "lite_name": "ps", - "semantic_type": "uint64", - "json_type": "string", - "index": 4, - "array_depth": 0, + "array_depth": 1, "optional": false, - "example": "'872634875'", "comment": [ - "The previous sequence number that determines the message order" + "The list of best asks up till query depth" ] } ], "comment": [] }, { - "name": "WSUnsubscribeAllParams", - "is_root": true, - "fields": [], - "comment": [ - "All V1 Websocket Unsubscription Request to unsubscribe from all active websocket streams." - ] - }, - { - "name": "StreamReference", + "name": "Positions", "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.ticker.d'", + "example": "'1697788800000000000'", "comment": [ - "The channel to subscribe to (eg: ticker.s / ticker.d)" + "Time at which the event was emitted in unix nanoseconds" ] }, { - "name": "selectors", - "lite_name": "s1", - "semantic_type": "string", + "name": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", "json_type": "string", "index": 1, - "array_depth": 1, + "array_depth": 0, "optional": false, - "example": "['BTC_USDT_Perp', 'ETH_USDT_Perp']", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The list of selectors for the stream" + "The sub account ID that participated in the trade" ] - } - ], - "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": "instrument", + "lite_name": "i", + "semantic_type": "asset", + "json_type": "string", + "index": 2, + "array_depth": 0, "optional": false, + "example": "'BTC_USDT_Perp'", "comment": [ - "The list of stream references unsubscribed from" + "The instrument being represented" ] - } - ], - "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": "size", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", + "index": 3, + "array_depth": 0, + "optional": false, + "example": "'2635000.50'", + "comment": [ + "The size of the position, expressed in base asset decimal units. Negative for short positions" + ] + }, + { + "name": "notional", + "lite_name": "n", + "semantic_type": "string", + "json_type": "string", + "index": 4, + "array_depth": 0, "optional": false, + "example": "'2635000.50'", "comment": [ - "The list of stream references the connection is connected to" + "The notional value of the position, negative for short assets, expressed in quote asset decimal units" ] - } - ], - "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": "entry_price", + "lite_name": "ep", + "semantic_type": "string", + "json_type": "string", + "index": 5, "array_depth": 0, - "optional": true, - "default": "false", - "example": "true", + "optional": false, + "example": "'65038.01'", "comment": [ - "Fetch only active instruments" + "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)`" ] - } - ], - "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, + "name": "exit_price", + "lite_name": "ep1", + "semantic_type": "string", + "json_type": "string", + "index": 6, + "array_depth": 0, "optional": false, + "example": "'65038.01'", "comment": [ - "List of instruments" + "The exit price of the position, expressed in `9` decimals", + "Whenever decreasing the size of a position, the exit price is updated to the new average exit price", + "`new_exit_price = (old_exit_price * old_exit_trade_size + trade_price * trade_size) / (old_exit_trade_size + trade_size)`" ] - } - ], - "comment": [] - }, - { - "name": "ApiQueryVaultManagerInvestorHistoryRequest", - "is_root": true, - "fields": [ + }, { - "name": "vault_id", - "lite_name": "vi", - "semantic_type": "uint64", + "name": "mark_price", + "lite_name": "mp", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 7, "array_depth": 0, "optional": false, - "example": "'2312134'", + "example": "'65038.01'", "comment": [ - "The unique identifier of the vault to filter by" + "The mark price of the position, expressed in `9` decimals" ] }, { - "name": "only_own_investments", - "lite_name": "oo", - "semantic_type": "bool", - "json_type": "boolean", - "index": 1, + "name": "unrealized_pnl", + "lite_name": "up", + "semantic_type": "string", + "json_type": "string", + "index": 8, "array_depth": 0, "optional": false, - "example": "true", + "example": "'135000.50'", "comment": [ - "Whether to only return investments made by the manager" + "The unrealized PnL of the position, expressed in quote asset decimal units", + "`unrealized_pnl = (mark_price - entry_price) * size`" ] }, { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", + "name": "realized_pnl", + "lite_name": "rp", + "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 9, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "optional": false, + "example": "'-35000.30'", "comment": [ - "Optional. Start time in unix nanoseconds" + "The realized PnL of the position, expressed in quote asset decimal units", + "`realized_pnl = (exit_price - entry_price) * exit_trade_size`" ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "total_pnl", + "lite_name": "tp", + "semantic_type": "string", "json_type": "string", - "index": 3, + "index": 10, "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", + "optional": false, + "example": "'100000.20'", "comment": [ - "Optional. End time in unix nanoseconds" + "The total PnL of the position, expressed in quote asset decimal units", + "`total_pnl = realized_pnl + unrealized_pnl`" ] - } - ], - "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", + "name": "roi", + "lite_name": "r", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 11, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'10.20'", "comment": [ - "Time at which the event was emitted in unix nanoseconds" + "The ROI of the position, expressed as a percentage", + "`roi = (total_pnl / (entry_price * abs(size))) * 100^`" ] }, { - "name": "off_chain_account_id", - "lite_name": "oc", + "name": "quote_index_price", + "lite_name": "qi", "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 12, "array_depth": 0, "optional": false, - "example": "'ACC:123456'", + "example": "'1.0000102'", "comment": [ - "The off chain account id of the investor, only visible to the manager" + "The index price of the quote currency. (reported in `USD`)" ] }, { - "name": "vault_id", - "lite_name": "vi", - "semantic_type": "uint64", + "name": "est_liquidation_price", + "lite_name": "el", + "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 13, "array_depth": 0, "optional": false, - "example": "'2312134'", + "example": "60000.25", "comment": [ - "The unique identifier of the vault." + "The estimated liquidation price" ] }, { - "name": "type", - "lite_name": "t", - "semantic_type": "VaultInvestorAction", - "json_type": "VaultInvestorAction", - "index": 3, + "name": "leverage", + "lite_name": "l", + "semantic_type": "string", + "json_type": "string", + "index": 14, "array_depth": 0, "optional": false, - "example": "'VAULT_INVEST'", + "example": "'10'", "comment": [ - "The type of transaction that occurred. List of types: vaultInvest, vaultBurnLpToken, vaultRedeem" + "The current leverage value for this position" ] }, { - "name": "price", - "lite_name": "p", + "name": "cumulative_fee", + "lite_name": "cf", "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 15, "array_depth": 0, "optional": false, - "example": "'1000000'", + "example": "'100000.20'", "comment": [ - "The price of the vault LP tokens at the time of the event." + "The cumulative fee paid on the position, expressed in quote asset decimal units" ] }, { - "name": "size", - "lite_name": "s", + "name": "cumulative_realized_funding_payment", + "lite_name": "cr", "semantic_type": "string", "json_type": "string", - "index": 5, + "index": 16, "array_depth": 0, "optional": false, - "example": "'1000000'", + "example": "'100000.20'", "comment": [ - "The amount of Vault LP tokens invested or redeemed." + "The cumulative realized funding payment of the position, expressed in quote asset decimal units. Positive if paid, negative if received" ] }, { - "name": "realized_pnl", - "lite_name": "rp", + "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": 6, + "index": 18, "array_depth": 0, - "optional": false, - "example": "'1000000'", + "optional": true, + "example": "'100000.20'", "comment": [ - "The realized PnL of the vault." + "[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": "performance_fee", - "lite_name": "pf", + "name": "isolated_im", + "lite_name": "ii", "semantic_type": "string", "json_type": "string", - "index": 7, + "index": 19, "array_depth": 0, - "optional": false, - "example": "'1000000'", + "optional": true, + "example": "'100000.20'", "comment": [ - "The performance fee of the vault." + "[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": [ - "The vault investor history returned by the service to client" - ] + "comment": [] }, { - "name": "ApiQueryVaultManagerInvestorHistoryResponse", - "is_root": true, + "name": "PreMinRedemptions", + "is_root": false, "fields": [ { - "name": "result", + "name": "requests", "lite_name": "r", - "semantic_type": "ApiVaultInvestorHistory", - "json_type": "ApiVaultInvestorHistory", + "semantic_type": "VaultRedemptionRequest", + "json_type": "VaultRedemptionRequest", "index": 0, "array_depth": 1, "optional": false, "comment": [ - "The list of vault investor history belong to the manager" + "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": [ - "Response to retrieve the vault summary for a given vault" + "Vault redemption queue section hidden from main view. All requests here have yet to age past the vault's minimum redemption period." ] }, { - "name": "OrderLeg", + "name": "RiskBracket", "is_root": false, "fields": [ { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", + "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": 0, + "index": 2, "array_depth": 0, - "optional": false, - "example": "'BTC_USDT_Perp'", + "optional": true, + "example": "'600000'", "comment": [ - "The instrument to trade in this leg" + "Upper bound of notional value (exclusive) in quote currency, omitted for last tier" ] }, { - "name": "size", - "lite_name": "s", + "name": "maintenance_margin_rate", + "lite_name": "mm", "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 3, "array_depth": 0, "optional": false, - "example": "'10.5'", + "example": "'0.01'", "comment": [ - "The total number of assets to trade in this leg, expressed in base asset decimal units." + "Maintenance margin rate as a decimal (e.g., '0.01' for 1%)" ] }, { - "name": "limit_price", - "lite_name": "lp", + "name": "initial_margin_rate", + "lite_name": "im", "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 4, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'65038.01'", + "optional": false, + "example": "'0.02'", "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" + "Initial margin rate as a decimal (e.g., '0.02' for 2%)" ] }, { - "name": "is_buying_asset", - "lite_name": "ib", - "semantic_type": "bool", - "json_type": "boolean", - "index": 3, + "name": "max_leverage", + "lite_name": "ml", + "semantic_type": "uint32", + "json_type": "integer", + "index": 5, "array_depth": 0, "optional": false, - "example": "true", + "example": "50", "comment": [ - "Specifies if the order leg is a buy or sell" + "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": "TPSLOrderMetadata", + "name": "Signature", "is_root": false, "fields": [ { - "name": "trigger_by", - "lite_name": "tb", - "semantic_type": "TriggerBy", - "json_type": "TriggerBy", + "name": "signer", + "lite_name": "s", + "semantic_type": "uint256", + "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'LAST'", + "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", "comment": [ - "Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order" + "The address (public key) of the wallet signing the payload" ] }, { - "name": "trigger_price", - "lite_name": "tp", - "semantic_type": "string", + "name": "r", + "lite_name": "r", + "semantic_type": "uint256", "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'65038.10'", + "example": "'0xb788d96fee91c7cdc35918e0441b756d4000ec1d07d900c73347d9abbc20acc8'", "comment": [ - "The Trigger Price of the order, expressed in `9` decimals." + "Signature R" ] }, { - "name": "close_position", - "lite_name": "cp", - "semantic_type": "bool", - "json_type": "boolean", + "name": "s", + "lite_name": "s1", + "semantic_type": "uint256", + "json_type": "string", "index": 2, "array_depth": 0, "optional": false, - "example": "false", + "example": "'0x3d786193125f7c29c958647da64d0e2875ece2c3f845a591bdd7dae8c475e26d'", "comment": [ - "If True, the order will close the position when the trigger price is reached" + "Signature S" ] - } - ], - "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, + "name": "v", + "lite_name": "v", + "semantic_type": "uint8", + "json_type": "integer", + "index": 3, "array_depth": 0, "optional": false, - "example": "'TAKE_PROFIT'", + "example": "'28'", "comment": [ - "Type of the trigger order. eg: Take Profit, Stop Loss, etc" + "Signature V" ] }, { - "name": "tpsl", - "lite_name": "t", - "semantic_type": "TPSLOrderMetadata", - "json_type": "TPSLOrderMetadata", - "index": 1, + "name": "expiration", + "lite_name": "e", + "semantic_type": "timestamp", + "json_type": "string", + "index": 4, "array_depth": 0, "optional": false, + "example": "'1697788800000000000'", "comment": [ - "Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.", - "", - "" + "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": [ - "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.", - "", - "" - ] + "comment": [] }, { - "name": "OrderMetadata", + "name": "SpotBalance", "is_root": false, "fields": [ { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", + "name": "currency", + "lite_name": "c", + "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'23042'", + "example": "'USDT'", "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 currency you hold a spot balance in" ] }, { - "name": "create_time", - "lite_name": "ct", - "semantic_type": "timestamp", + "name": "balance", + "lite_name": "b", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "optional": false, + "example": "'123456.78'", "comment": [ - "[Filled by GRVT Backend] Time at which the order was received by GRVT in unix nanoseconds" + "This currency's balance in this trading account." ] }, { - "name": "trigger", - "lite_name": "t", - "semantic_type": "TriggerOrderMetadata", - "json_type": "TriggerOrderMetadata", + "name": "index_price", + "lite_name": "ip", + "semantic_type": "string", + "json_type": "string", "index": 2, "array_depth": 0, - "optional": true, - "default": "", + "optional": false, + "example": "'1.0000102'", "comment": [ - "Trigger fields are used to support any type of trigger order such as TP/SL" + "The index price of this currency. (reported in `USD`)" ] - }, + } + ], + "comment": [] + }, + { + "name": "StreamReference", + "is_root": false, + "fields": [ { - "name": "broker", - "lite_name": "b", - "semantic_type": "BrokerTag", - "json_type": "BrokerTag", - "index": 3, + "name": "stream", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", + "index": 0, "array_depth": 0, - "optional": true, - "default": "", - "example": "'BROKER_CODE'", + "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": [ - "Specifies the broker who brokered the order" + "The list of selectors for the stream" ] } ], - "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." - ] + "comment": [] }, { - "name": "OrderState", + "name": "SubAccount", "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, + "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": "sub_account_id", + "lite_name": "sa", + "semantic_type": "uint64", + "json_type": "string", "index": 1, "array_depth": 0, "optional": false, - "example": "'CLIENT_CANCEL'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The reason for rejection or cancellation" + "The sub account ID this entry refers to" ] }, { - "name": "book_size", - "lite_name": "bs", - "semantic_type": "string", - "json_type": "string", + "name": "margin_type", + "lite_name": "mt", + "semantic_type": "MarginType", + "json_type": "MarginType", "index": 2, - "array_depth": 1, + "array_depth": 0, "optional": false, - "example": "['10.5']", + "example": "'SIMPLE_CROSS_MARGIN'", "comment": [ - "The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs" + "The type of margin algorithm this subaccount uses" ] }, { - "name": "traded_size", - "lite_name": "ts", + "name": "settle_currency", + "lite_name": "sc", "semantic_type": "string", "json_type": "string", "index": 3, - "array_depth": 1, + "array_depth": 0, "optional": false, - "example": "['1.5']", + "example": "'USDT'", "comment": [ - "The total number of assets traded. Sorted in same order as Order.Legs" + "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": "update_time", - "lite_name": "ut", - "semantic_type": "timestamp", + "name": "unrealized_pnl", + "lite_name": "up", + "semantic_type": "string", "json_type": "string", "index": 4, "array_depth": 0, "optional": false, - "example": "'1697788800000000000'", + "example": "'123456.78'", "comment": [ - "Time at which the order was updated by GRVT, expressed in unix nanoseconds" + "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": "avg_fill_price", - "lite_name": "af", + "name": "total_equity", + "lite_name": "te", "semantic_type": "string", "json_type": "string", "index": 5, - "array_depth": 1, + "array_depth": 0, "optional": false, - "example": "['60000.4']", + "example": "'123456.78'", "comment": [ - "The average fill price of the order. Sorted in same order as Order.Legs" + "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`" ] - } - ], - "comment": [] - }, - { - "name": "Order", - "is_root": false, - "fields": [ + }, { - "name": "order_id", - "lite_name": "oi", - "semantic_type": "uint128", + "name": "initial_margin", + "lite_name": "im", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 6, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'0x1234567890abcdef'", + "optional": false, + "example": "'123456.78'", "comment": [ - "[Filled by GRVT Backend] A unique 128-bit identifier for the order, deterministically generated within the GRVT backend" + "The `total_equity` required to open positions in the account (reported in `settle_currency`).", + "Computation is different depending on account's `margin_type`" ] }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "maintenance_margin", + "lite_name": "mm", + "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 7, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'123456.78'", "comment": [ - "The subaccount initiating the order" + "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": "is_market", - "lite_name": "im", - "semantic_type": "bool", - "json_type": "boolean", - "index": 2, + "name": "available_balance", + "lite_name": "ab", + "semantic_type": "string", + "json_type": "string", + "index": 8, "array_depth": 0, - "optional": true, - "default": "false", - "example": "false", + "optional": false, + "example": "'123456.78'", "comment": [ - "If the order is a market order", - "Market Orders do not have a limit price, and are always executed according to the maker order price.", - "Market Orders must always be taker orders" + "The 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": "time_in_force", - "lite_name": "ti", - "semantic_type": "TimeInForce", - "json_type": "TimeInForce", - "index": 3, + "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": [ - "Four supported types of orders: GTT, IOC, AON, FOK:\u003cul\u003e", - "\u003cli\u003ePARTIAL EXECUTION = GTT / IOC - allows partial size execution on each leg\u003c/li\u003e", - "\u003cli\u003eFULL EXECUTION = AON / FOK - only allows full size execution on all legs\u003c/li\u003e", - "\u003cli\u003eTAKER ONLY = IOC / FOK - only allows taker orders\u003c/li\u003e", - "\u003cli\u003eMAKER OR TAKER = GTT / AON - allows maker or taker orders\u003c/li\u003e", - "\u003c/ul\u003eExchange only supports (GTT, IOC, FOK)", - "RFQ Maker only supports (GTT, AON), RFQ Taker only supports (FOK)" + "The index price of the settle currency. (reported in `USD`)" ] }, { - "name": "post_only", - "lite_name": "po", + "name": "is_vault", + "lite_name": "iv", "semantic_type": "bool", "json_type": "boolean", - "index": 4, + "index": 12, "array_depth": 0, "optional": true, - "default": "false", - "example": "false", "comment": [ - "If True, Order must be a maker order. It has to fill the orderbook instead of match it.", - "If False, Order can be either a maker or taker order. \u003cb\u003eIn this case, order creation is currently subject to a speedbump of 25ms to ensure orders are matched against updated orderbook quotes.\u003c/b\u003e", - "", - "| | Must Fill All | Can Fill Partial |", - "| - | - | - |", - "| Must Be Taker | FOK + False | IOC + False |", - "| Can Be Either | AON + False | GTC + False |", - "| Must Be Maker | AON + True | GTC + True |", - "" + "Whether this sub account is a vault" ] }, { - "name": "reduce_only", - "lite_name": "ro", - "semantic_type": "bool", - "json_type": "boolean", - "index": 5, + "name": "vault_im_additions", + "lite_name": "vi", + "semantic_type": "string", + "json_type": "string", + "index": 13, "array_depth": 0, "optional": true, - "default": "false", - "example": "false", + "example": "'123456.78'", "comment": [ - "If True, Order must reduce the position size, or be cancelled" + "Total amount of IM (reported in `settle_currency`) deducted from the vault due to redemptions nearing the end of their redemption period" ] }, { - "name": "legs", - "lite_name": "l", - "semantic_type": "OrderLeg", - "json_type": "OrderLeg", - "index": 6, - "array_depth": 1, + "name": "derisk_margin", + "lite_name": "dm", + "semantic_type": "string", + "json_type": "string", + "index": 14, + "array_depth": 0, "optional": false, + "example": "'185185.77'", "comment": [ - "The legs present in this order", - "The legs must be sorted by Asset.Instrument/Underlying/Quote/Expiration/StrikePrice" + "The derisk margin of this sub account" ] }, { - "name": "signature", - "lite_name": "s", - "semantic_type": "Signature", - "json_type": "Signature", - "index": 7, + "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 signature approving this order" + "The derisk margin to maintenance margin ratio of this sub account" ] }, { - "name": "metadata", - "lite_name": "m", - "semantic_type": "OrderMetadata", - "json_type": "OrderMetadata", - "index": 8, + "name": "total_cross_equity", + "lite_name": "tc", + "semantic_type": "string", + "json_type": "string", + "index": 16, "array_depth": 0, "optional": false, + "example": "'123456.78'", "comment": [ - "Order Metadata, ignored by the smart contract, and unsigned by the client" + "The total equity of this sub account for cross margin" ] }, { - "name": "state", - "lite_name": "s1", - "semantic_type": "OrderState", - "json_type": "OrderState", - "index": 9, + "name": "cross_unrealized_pnl", + "lite_name": "cu", + "semantic_type": "string", + "json_type": "string", + "index": 17, "array_depth": 0, - "optional": true, - "default": "''", + "optional": false, + "example": "'123456.78'", "comment": [ - "[Filled by GRVT Backend] The current state of the order, ignored by the smart contract, and unsigned by the client" + "The unrealized PnL of this sub account for cross margin" ] } ], - "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" - ] + "comment": [] }, { - "name": "ApiCreateOrderRequest", - "is_root": true, + "name": "TPSLOrderMetadata", + "is_root": false, "fields": [ { - "name": "order", - "lite_name": "o", - "semantic_type": "Order", - "json_type": "Order", + "name": "trigger_by", + "lite_name": "tb", + "semantic_type": "TriggerBy", + "json_type": "TriggerBy", "index": 0, "array_depth": 0, "optional": false, + "example": "'LAST'", "comment": [ - "The order to create" + "Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order" ] - } - ], - "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": "trigger_price", + "lite_name": "tp", + "semantic_type": "string", + "json_type": "string", + "index": 1, "array_depth": 0, "optional": false, + "example": "'65038.10'", "comment": [ - "The created order" + "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": [] + "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": "ApiCancelOrderRequest", - "is_root": true, + "name": "Ticker", + "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'", + "optional": true, + "example": "'1697788800000000000'", "comment": [ - "The subaccount ID cancelling the order" + "Time at which the event was emitted in unix nanoseconds" ] }, { - "name": "order_id", - "lite_name": "oi", - "semantic_type": "uint128", + "name": "instrument", + "lite_name": "i", + "semantic_type": "asset", "json_type": "string", "index": 1, "array_depth": 0, "optional": true, - "default": "0", - "example": "'0x1028403'", + "example": "'BTC_USDT_Perp'", "comment": [ - "Cancel the order with this `order_id`" + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" ] }, { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", + "name": "mark_price", + "lite_name": "mp", + "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 mark price of the instrument, expressed in `9` decimals" ] }, { - "name": "time_to_live_ms", - "lite_name": "tt", - "semantic_type": "uint64", + "name": "index_price", + "lite_name": "ip", + "semantic_type": "string", "json_type": "string", "index": 3, "array_depth": 0, "optional": true, - "default": "100", - "example": "'500'", + "example": "'65038.01'", "comment": [ - "Specifies the time-to-live (in milliseconds) for this cancellation.", - "During this period, any order creation with a matching `client_order_id` will be cancelled and not be added to the GRVT matching engine.", - "This mechanism helps mitigate time-of-flight issues where cancellations might arrive before the corresponding orders.", - "Hence, cancellation by `order_id` ignores this field as the exchange can only assign `order_id`s to already-processed order creations.", - "The duration cannot be negative, is rounded down to the nearest 100ms (e.g., `'670'` -\u003e `'600'`, `'30'` -\u003e `'0'`) and capped at 5 seconds (i.e., `'5000'`).", - "Value of `'0'` or omission results in the default time-to-live value being applied.", - "If the caller requests multiple successive cancellations for a given order, such that the time-to-live windows overlap, only the first request will be considered.", - "" + "The index price of the instrument, expressed in `9` decimals" ] - } - ], - "comment": [ - "Cancel an order on the orderbook for this trading account. Either `order_id` or `client_order_id` must be provided." - ] - }, - { - "name": "ApiCancelAllOrdersRequest", - "is_root": true, - "fields": [ + }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "last_price", + "lite_name": "lp", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 4, "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "optional": true, + "example": "'65038.01'", "comment": [ - "The subaccount ID cancelling all orders" + "The last traded price of the instrument (also close price), expressed in `9` decimals" ] }, { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", - "index": 1, - "array_depth": 1, + "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, - "default": "all", - "example": "['PERPETUAL']", + "example": "'123456.78'", "comment": [ - "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be cancelled" + "The number of assets offered on the best ask price of the instrument, expressed in base asset decimal units" ] }, { - "name": "base", - "lite_name": "b", + "name": "funding_rate_8h_curr", + "lite_name": "fr", "semantic_type": "string", "json_type": "string", - "index": 2, - "array_depth": 1, + "index": 11, + "array_depth": 0, "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", + "example": "0.0003", "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be cancelled" + "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": "quote", - "lite_name": "q", + "name": "funding_rate_8h_avg", + "lite_name": "fr1", "semantic_type": "string", "json_type": "string", - "index": 3, - "array_depth": 1, + "index": 12, + "array_depth": 0, "optional": true, - "default": "all", - "example": "['USDT', 'USDC']", + "example": "0.0003", "comment": [ - "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be cancelled" + "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`)." ] - } - ], - "comment": [ - "Cancel all orders on the orderbook for this trading account. This may not match new orders in flight." - ] - }, - { - "name": "ApiOpenOrdersRequest", - "is_root": true, - "fields": [ + }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "interest_rate", + "lite_name": "ir", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 13, "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "optional": true, + "example": "0.0003", "comment": [ - "The subaccount ID to filter by" + "The interest rate of the underlying, expressed in centibeeps (1/100th of a basis point)" ] }, { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", - "index": 1, - "array_depth": 1, + "name": "forward_price", + "lite_name": "fp", + "semantic_type": "string", + "json_type": "string", + "index": 14, + "array_depth": 0, "optional": true, - "default": "all", - "example": "['PERPETUAL']", + "example": "'65038.01'", "comment": [ - "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" + "[Options] The forward price of the option, expressed in `9` decimals" ] }, { - "name": "base", - "lite_name": "b", + "name": "buy_volume_24h_b", + "lite_name": "bv", "semantic_type": "string", "json_type": "string", - "index": 2, - "array_depth": 1, + "index": 15, + "array_depth": 0, "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", + "example": "'123456.78'", "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" + "The 24 hour taker buy volume of the instrument, expressed in base asset decimal units" ] }, { - "name": "quote", - "lite_name": "q", + "name": "sell_volume_24h_b", + "lite_name": "sv", "semantic_type": "string", "json_type": "string", - "index": 3, - "array_depth": 1, + "index": 16, + "array_depth": 0, "optional": true, - "default": "all", - "example": "['USDT', 'USDC']", + "example": "'123456.78'", "comment": [ - "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" + "The 24 hour taker sell volume of the instrument, expressed in base asset decimal units" ] - } - ], - "comment": [] - }, - { - "name": "ApiOpenOrdersResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "Order", - "json_type": "Order", - "index": 0, - "array_depth": 1, - "optional": false, + "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 Open Orders matching the request filter" + "The 24 hour taker buy volume of the instrument, expressed in quote asset decimal units" ] - } - ], - "comment": [ - "Retrieves all open orders for the account. This may not match new orders in flight." - ] - }, - { - "name": "ApiOrderHistoryRequest", - "is_root": true, - "fields": [ + }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "sell_volume_24h_q", + "lite_name": "sv1", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 18, "array_depth": 0, - "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "optional": true, + "example": "'123456.78'", "comment": [ - "The subaccount ID to filter by" + "The 24 hour taker sell volume of the instrument, expressed in quote asset decimal units" ] }, { - "name": "kind", - "lite_name": "k", - "semantic_type": "Kind", - "json_type": "Kind", - "index": 1, - "array_depth": 1, + "name": "high_price", + "lite_name": "hp", + "semantic_type": "string", + "json_type": "string", + "index": 19, + "array_depth": 0, "optional": true, - "default": "all", - "example": "['PERPETUAL']", + "example": "'65038.01'", "comment": [ - "The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned" + "The 24 hour highest traded price of the instrument, expressed in `9` decimals" ] }, { - "name": "base", - "lite_name": "b", + "name": "low_price", + "lite_name": "lp1", "semantic_type": "string", "json_type": "string", - "index": 2, - "array_depth": 1, + "index": 20, + "array_depth": 0, "optional": true, - "default": "all", - "example": "['BTC', 'ETH']", + "example": "'65038.01'", "comment": [ - "The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned" + "The 24 hour lowest traded price of the instrument, expressed in `9` decimals" ] }, { - "name": "quote", - "lite_name": "q", + "name": "open_price", + "lite_name": "op", "semantic_type": "string", "json_type": "string", - "index": 3, - "array_depth": 1, + "index": 21, + "array_depth": 0, "optional": true, - "default": "all", - "example": "['USDT', 'USDC']", + "example": "'65038.01'", "comment": [ - "The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned" + "The 24 hour first traded price of the instrument, expressed in `9` decimals" ] }, { - "name": "start_time", - "lite_name": "st", - "semantic_type": "int64", + "name": "open_interest", + "lite_name": "oi", + "semantic_type": "string", "json_type": "string", - "index": 4, + "index": 22, "array_depth": 0, "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "example": "'123456.78'", "comment": [ - "The start time to apply in nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned" + "The open interest in the instrument, expressed in base asset decimal units" ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "int64", + "name": "long_short_ratio", + "lite_name": "ls1", + "semantic_type": "string", "json_type": "string", - "index": 5, + "index": 23, "array_depth": 0, "optional": true, - "default": "now()", - "example": "'1697788800000000000'", + "example": "'0.5'", "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 ratio of accounts that are net long vs net short on this instrument" ] }, { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", - "index": 6, + "name": "funding_rate", + "lite_name": "fr2", + "semantic_type": "string", + "json_type": "string", + "index": 24, "array_depth": 0, "optional": true, - "default": "500", - "example": "500", + "example": "0.0003", "comment": [ - "The limit to query for. Defaults to 500; Max 1000" + "The current indicative funding rate for the active interval, expressed in centibeeps" ] }, { - "name": "cursor", - "lite_name": "c", - "semantic_type": "string", + "name": "next_funding_time", + "lite_name": "nf", + "semantic_type": "timestamp", "json_type": "string", - "index": 7, + "index": 26, "array_depth": 0, "optional": true, - "default": "''", - "example": "''", + "example": "'1697788800000000000'", "comment": [ - "The cursor to indicate when to start the query from" + "Timestamp in nanoseconds when the current funding interval ends" ] } ], "comment": [ - "Retrieves the order history for the account.", + "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`)", "", - "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" + "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": "ApiOrderHistoryResponse", - "is_root": true, + "name": "Trade", + "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", - "lite_name": "a", + "name": "is_taker_buyer", + "lite_name": "it", "semantic_type": "bool", "json_type": "boolean", - "index": 0, + "index": 2, "array_depth": 0, "optional": false, - "example": "'true'", + "example": "true", "comment": [ - "Gravity has acknowledged that the request has been successfully received and it will process it in the backend" + "If taker was the buyer on the trade" ] - } - ], - "comment": [] - }, - { - "name": "AckResponse", - "is_root": true, - "fields": [ + }, { - "name": "result", - "lite_name": "r", - "semantic_type": "Ack", - "json_type": "Ack", - "index": 0, + "name": "size", + "lite_name": "s", + "semantic_type": "string", + "json_type": "string", + "index": 3, "array_depth": 0, "optional": false, + "example": "'123456.78'", "comment": [ - "The Ack Object" + "The number of assets being traded, expressed in base asset decimal units" ] - } - ], - "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", + "name": "price", + "lite_name": "p", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 4, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'65038.01'", "comment": [ - "The subaccount ID to filter by" + "The traded price, expressed in `9` decimals" ] }, { - "name": "order_id", - "lite_name": "oi", - "semantic_type": "uint128", + "name": "mark_price", + "lite_name": "mp", + "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 5, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'0x1028403'", + "optional": false, + "example": "'65038.01'", "comment": [ - "Filter for `order_id`" + "The mark price of the instrument at point of trade, expressed in `9` decimals" ] }, { - "name": "client_order_id", - "lite_name": "co", - "semantic_type": "uint64", + "name": "index_price", + "lite_name": "ip", + "semantic_type": "string", "json_type": "string", - "index": 2, + "index": 6, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'23042'", + "optional": false, + "example": "'65038.01'", "comment": [ - "Filter for `client_order_id`" + "The index price of the instrument at point of trade, expressed in `9` decimals" ] - } - ], - "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": "interest_rate", + "lite_name": "ir", + "semantic_type": "string", + "json_type": "string", + "index": 7, "array_depth": 0, "optional": false, + "example": "0.0003", "comment": [ - "The order object for the requested filter" + "The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)" ] - } - ], - "comment": [] - }, - { - "name": "ApiCancelOnDisconnectRequest", - "is_root": true, - "fields": [ + }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", + "name": "forward_price", + "lite_name": "fp", + "semantic_type": "string", "json_type": "string", - "index": 0, + "index": 8, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'65038.01'", "comment": [ - "The subaccount ID cancelling the orders for" + "[Options] The forward price of the option at point of trade, expressed in `9` decimals" ] }, { - "name": "countdown_time", - "lite_name": "ct", - "semantic_type": "uint64", + "name": "trade_id", + "lite_name": "ti", + "semantic_type": "string", "json_type": "string", - "index": 1, + "index": 9, "array_depth": 0, - "optional": true, - "default": "1000", - "example": "300", + "optional": false, + "example": "'209358-2'", "comment": [ - "Countdown time in milliseconds (ex. 120000 for 120s).", - "", - "0 to disable the timer.", - "", - "Does not accept negative values.", - "", - "Minimum acceptable value is 1,000.", - "", - "Maximum acceptable value is 300,000" + "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`." ] - } - ], - "comment": [ - "Auto-Cancel All Open Orders when the countdown time hits zero.", - "", - "Market Maker inputs a countdown time parameter in milliseconds (e.g. 120000 for 120s) rounded down to the smallest second follows the following logic:", - " - Market Maker initially entered a value between 0 -\u003e 1000, which is rounded to 0: will result in termination of their COD", - " - Market Maker initially entered a value between 1001 -\u003e 300_000, which is rounded to the nearest second: will result in refresh of their COD", - " - Market Maker initially entered a value bigger than 300_000, which will result in error (upper bound)", - "Market Maker will send a heartbeat message by calling the endpoint at specific intervals (ex. every 30 seconds) to the server to refresh the count down.", - "", - "If the server does not receive a heartbeat message within the countdown time, it will cancel all open orders for the specified Sub Account ID." - ] - }, - { - "name": "WSOrderFeedSelectorV1", - "is_root": true, - "fields": [ + }, { - "name": "sub_account_id", - "lite_name": "sa", - "semantic_type": "uint64", - "json_type": "string", - "index": 0, + "name": "venue", + "lite_name": "v", + "semantic_type": "Venue", + "json_type": "Venue", + "index": 10, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The subaccount ID to filter by" - ], - "selector": "primary" + "The venue where the trade occurred" + ] }, { - "name": "instrument", - "lite_name": "i", - "semantic_type": "asset", - "json_type": "string", - "index": 1, - "array_depth": 0, - "optional": true, - "default": "'all'", - "example": "'BTC_USDT_Perp'", + "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 +11712,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 +11751,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 +11774,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 +11905,7 @@ ] }, { - "name": "WSWithdrawalFeedSelectorV1", + "name": "WSDepositFeedSelectorV1", "is_root": true, "fields": [ { @@ -10714,83 +11924,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 +12085,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 +12124,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 +12147,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" - ] - }, - { - "name": "cancel_status", - "lite_name": "cs", - "semantic_type": "CancelStatus", - "json_type": "CancelStatus", - "index": 5, + "The readable instrument name:\u003cul\u003e\u003cli\u003ePerpetual: `ETH_USDT_Perp`\u003c/li\u003e\u003cli\u003eFuture: `BTC_USDT_Fut_20Oct23`\u003c/li\u003e\u003cli\u003eCall: `ETH_USDT_Call_20Oct23_2800`\u003c/li\u003e\u003cli\u003ePut: `ETH_USDT_Put_20Oct23_2800`\u003c/li\u003e\u003c/ul\u003e" + ], + "selector": "primary" + }, + { + "name": "rate", + "lite_name": "r", + "semantic_type": "uint32", + "json_type": "integer", + "index": 1, "array_depth": 0, "optional": false, + "example": "500", "comment": [ - "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 +12205,7 @@ "index": 0, "array_depth": 0, "optional": false, - "example": "'v1.cancel'", + "example": "'v1.order'", "comment": [ "Stream name" ] @@ -10976,7 +12218,7 @@ "index": 1, "array_depth": 0, "optional": false, - "example": "'$GRVT_SUB_ACCOUNT_ID'", + "example": "'BTC_USDT_Perp'", "comment": [ "Primary selector" ] @@ -11002,13 +12244,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 +12270,7 @@ "comment": [] }, { - "name": "WSCancelFeedSelectorV1", + "name": "WSOrderFeedSelectorV1", "is_root": true, "fields": [ { @@ -11044,1622 +12286,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", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", "index": 0, "array_depth": 0, "optional": false, - "example": "'0xc73c0c2538fd9b833d20933ccc88fdaa74fcb0d0'", + "example": "'v1.state'", "comment": [ - "The main account to transfer from" + "Stream name" ] }, { - "name": "from_sub_account_id", - "lite_name": "fs", - "semantic_type": "uint64", + "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 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'", + "example": "'BTC_USDT_Perp'", "comment": [ - "The main account to deposit into" + "Primary selector" ] }, { - "name": "to_sub_account_id", - "lite_name": "ts", + "name": "sequence_number", + "lite_name": "sn", "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", - "semantic_type": "string", - "json_type": "string", - "index": 4, - "array_depth": 0, - "optional": false, - "example": "'USDT'", - "comment": [ - "The token currency to transfer" - ] - }, - { - "name": "num_tokens", - "lite_name": "nt", - "semantic_type": "string", - "json_type": "string", - "index": 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, - "array_depth": 0, - "optional": false, - "comment": [ - "The type of transfer" - ] - }, - { - "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": [ + "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": "ack", - "lite_name": "a", - "semantic_type": "bool", - "json_type": "boolean", - "index": 0, + "name": "feed", + "lite_name": "f", + "semantic_type": "OrderStateFeed", + "json_type": "OrderStateFeed", + "index": 3, "array_depth": 0, "optional": false, - "example": "'true'", "comment": [ - "Gravity has acknowledged that the transfer has been successfully processed. If true, a `tx_id` will be returned. If false, an error will be returned." + "The Order State Feed" ] }, { - "name": "tx_id", - "lite_name": "ti", + "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": "", - "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": [ - "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": "ApiTransferHistoryResponse", - "is_root": true, - "fields": [ - { - "name": "result", - "lite_name": "r", - "semantic_type": "TransferHistory", - "json_type": "TransferHistory", - "index": 0, - "array_depth": 1, "optional": false, + "example": "'subscribe'", "comment": [ - "The transfer history matching the request account" + "The method to use for the request (eg: subscribe / unsubscribe)" ] }, { - "name": "next", - "lite_name": "n", - "semantic_type": "string", - "json_type": "string", - "index": 1, + "name": "is_full", + "lite_name": "if", + "semantic_type": "bool", + "json_type": "boolean", + "index": 4, "array_depth": 0, "optional": true, - "default": "''", - "example": "'Qw0918='", + "default": "false", + "example": "true", "comment": [ - "The cursor to indicate when to start the next query from" + "Whether the request is for full data or lite data" ] } ], - "comment": [] + "comment": [ + "All V1 Websocket Requests are housed in this wrapper. You may specify a stream, and a list of feeds to subscribe to.", + "If a `request_id` is supplied in this JSON RPC request, it will be propagated back to any relevant JSON RPC responses (including error).", + "When subscribing to the same primary selector again, the previous secondary selector will be replaced. See `Overview` page for more details." + ] }, { - "name": "ApiWithdrawalHistoryRequest", + "name": "WSSubscribeResponseV1Legacy", "is_root": true, "fields": [ { - "name": "currency", - "lite_name": "c", - "semantic_type": "string", - "json_type": "string", + "name": "request_id", + "lite_name": "ri", + "semantic_type": "uint32", + "json_type": "integer", "index": 0, - "array_depth": 1, - "optional": false, - "example": "['USDT', 'USDC']", + "array_depth": 0, + "optional": true, + "default": "0", + "example": "123", "comment": [ - "The token currency to query for, if nil or empty, return all withdrawals. Otherwise, only entries matching the filter will be returned" + "Optional Field which is used to match the response by the client.", + "If not passed, this field will not be returned" ] }, { - "name": "start_time", - "lite_name": "st", - "semantic_type": "timestamp", + "name": "stream", + "lite_name": "s", + "semantic_type": "string", "json_type": "string", "index": 1, "array_depth": 0, - "optional": true, - "default": "0", - "example": "'1697788800000000000'", + "optional": false, + "example": "'v1.ticker.d'", "comment": [ - "The start time to query for in unix nanoseconds" + "The channel to subscribe to (eg: ticker.s / ticker.d)" ] }, { - "name": "end_time", - "lite_name": "et", - "semantic_type": "timestamp", + "name": "subs", + "lite_name": "s1", + "semantic_type": "string", "json_type": "string", "index": 2, - "array_depth": 0, - "optional": true, - "default": "now()", - "example": "'1697788800000000000'", + "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 subscribed to" ] }, { - "name": "limit", - "lite_name": "l", - "semantic_type": "uint32", - "json_type": "integer", + "name": "unsubs", + "lite_name": "u", + "semantic_type": "string", + "json_type": "string", "index": 3, - "array_depth": 0, - "optional": true, - "default": "500", - "example": "500", + "array_depth": 1, + "optional": false, + "example": "['BTC_USDT_Perp@500', 'ETH_USDT_Perp@500']", "comment": [ - "The limit to query for. Defaults to 500; Max 1000" + "The list of feeds unsubscribed from" ] }, { - "name": "cursor", - "lite_name": "c1", - "semantic_type": "string", - "json_type": "string", + "name": "num_snapshots", + "lite_name": "ns", + "semantic_type": "uint32", + "json_type": "integer", "index": 4, - "array_depth": 0, - "optional": true, - "default": "''", - "example": "''", + "array_depth": 1, + "optional": false, + "example": "10", "comment": [ - "The cursor to indicate when to start the next query from" + "The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs`" ] }, { - "name": "main_account_id", - "lite_name": "ma", - "semantic_type": "address", + "name": "first_sequence_number", + "lite_name": "fs", + "semantic_type": "uint64", "json_type": "string", "index": 5, - "array_depth": 0, - "optional": true, - "default": "", - "example": "", + "array_depth": 1, + "optional": false, + "example": "872634876", "comment": [ - "Main account ID being queried. By default, applies the requestor's main account ID." + "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": [ - "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": [ + "A sequence number used to determine message order within a stream.", + "- If `useGlobalSequenceNumber` is **false**, this returns the gateway sequence number, which increments by one locally within each stream and resets on gateway restarts.", + "- If `useGlobalSequenceNumber` is **true**, this returns the global sequence number, which uniquely identifies messages across the cluster.", + " - A single cluster payload can be multiplexed into multiple stream payloads.", + " - To distinguish each stream payload, a `dedupCounter` is included.", + " - The returned sequence number is computed as: `cluster_sequence_number * 10^5 + dedupCounter`." + ] + }, + { + "name": "feed", + "lite_name": "f", + "semantic_type": "Ticker", + "json_type": "Ticker", + "index": 3, + "array_depth": 0, + "optional": false, "comment": [ - "The finalized withdrawal transaction hash on L1" + "A ticker matching the request filter" ] }, { - "name": "l_2_hash", - "lite_name": "l2", - "semantic_type": "string", + "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", + "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, "array_depth": 0, - "optional": false, - "example": "'3477045127917224'", + "optional": true, + "default": "'0'", + "example": "'$GRVT_SUB_ACCOUNT_ID'", "comment": [ - "The unique identifier of the vault to cancel the redemption from." - ] + "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, empty if the withdrawal is 'pending'." ] }, { - "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 +14402,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 +14475,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": [