mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-10 16:58:08 +00:00
Add Nado documentation and examples, including new API endpoints, FAQs, and guides for using the TypeScript SDK. Update .env.example with additional configuration options.
This commit is contained in:
@@ -0,0 +1,155 @@
|
||||
# All Products
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 480 requests/min or 8 requests/sec per IP address. (**weight = 5**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "all_products"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=all_products`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "all_products"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Response
|
||||
|
||||
{% hint style="info" %}
|
||||
**Note**:
|
||||
|
||||
* A product is some asset / position an account can take on.
|
||||
* A market is a venue for a product against USDT0.
|
||||
* All products have a market quoted against USDT0, except for product 0.
|
||||
* Product 0 is the USDT0 asset itself.
|
||||
* You can retrieve product symbols via [symbols](https://docs.nado.xyz/developer-resources/api/symbols "mention") query.Body
|
||||
{% endhint %}
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"spot_products": [
|
||||
{
|
||||
"product_id": 0,
|
||||
"oracle_price_x18": "1000000000000000000",
|
||||
"risk": {
|
||||
"long_weight_initial_x18": "1000000000000000000",
|
||||
"short_weight_initial_x18": "1000000000000000000",
|
||||
"long_weight_maintenance_x18": "1000000000000000000",
|
||||
"short_weight_maintenance_x18": "1000000000000000000",
|
||||
"price_x18": "1000000000000000000"
|
||||
},
|
||||
"config": {
|
||||
"token": "0x5f65358d61a9a281ea3bb930d05889aca21e3f4f",
|
||||
"interest_inflection_util_x18": "800000000000000000",
|
||||
"interest_floor_x18": "10000000000000000",
|
||||
"interest_small_cap_x18": "40000000000000000",
|
||||
"interest_large_cap_x18": "1000000000000000000",
|
||||
"withdraw_fee_x18": "1000000000000000000",
|
||||
"min_deposit_rate_x18": "0"
|
||||
},
|
||||
"state": {
|
||||
"cumulative_deposits_multiplier_x18": "1000000000025524653",
|
||||
"cumulative_borrows_multiplier_x18": "1000347390837434279",
|
||||
"total_deposits_normalized": "20001011744258817298755054194662",
|
||||
"total_borrows_normalized": "1617724891363505323532211"
|
||||
},
|
||||
"book_info": {
|
||||
"size_increment": "0",
|
||||
"price_increment_x18": "0",
|
||||
"min_size": "0",
|
||||
"collected_fees": "0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"product_id": 1,
|
||||
"oracle_price_x18": "115575316424148798147115",
|
||||
"risk": {
|
||||
"long_weight_initial_x18": "900000000000000000",
|
||||
"short_weight_initial_x18": "1100000000000000000",
|
||||
"long_weight_maintenance_x18": "950000000000000000",
|
||||
"short_weight_maintenance_x18": "1050000000000000000",
|
||||
"price_x18": "115575316424148798147115"
|
||||
},
|
||||
"config": {
|
||||
"token": "0xc57c1c64561a37ac9e8f9039cb6deab7539d99fc",
|
||||
"interest_inflection_util_x18": "800000000000000000",
|
||||
"interest_floor_x18": "10000000000000000",
|
||||
"interest_small_cap_x18": "40000000000000000",
|
||||
"interest_large_cap_x18": "1000000000000000000",
|
||||
"withdraw_fee_x18": "40000000000000",
|
||||
"min_deposit_rate_x18": "0"
|
||||
},
|
||||
"state": {
|
||||
"cumulative_deposits_multiplier_x18": "1000000000000318713",
|
||||
"cumulative_borrows_multiplier_x18": "1000347390679880473",
|
||||
"total_deposits_normalized": "9000399823280682696107190850",
|
||||
"total_borrows_normalized": "9580268570661550719"
|
||||
},
|
||||
"book_info": {
|
||||
"size_increment": "1000000000000000",
|
||||
"price_increment_x18": "1000000000000000000",
|
||||
"min_size": "4000000000000000",
|
||||
"collected_fees": "0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"perp_products": [
|
||||
{
|
||||
"product_id": 2,
|
||||
"oracle_price_x18": "115432187703236794231754",
|
||||
"risk": {
|
||||
"long_weight_initial_x18": "950000000000000000",
|
||||
"short_weight_initial_x18": "1050000000000000000",
|
||||
"long_weight_maintenance_x18": "970000000000000000",
|
||||
"short_weight_maintenance_x18": "1030000000000000000",
|
||||
"price_x18": "115432187703236794231754"
|
||||
},
|
||||
"state": {
|
||||
"cumulative_funding_long_x18": "-394223711772447555304",
|
||||
"cumulative_funding_short_x18": "-394223711772447555304",
|
||||
"available_settle": "20092193239667417956947",
|
||||
"open_interest": "113605000000000000000"
|
||||
},
|
||||
"book_info": {
|
||||
"size_increment": "1000000000000000",
|
||||
"price_increment_x18": "1000000000000000000",
|
||||
"min_size": "4000000000000000",
|
||||
"collected_fees": "0"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"request_type": "query_all_products"
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,62 @@
|
||||
# Contracts
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 2400 requests/min or 40 requests/sec per IP address. (**weight = 1**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "contracts"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=contracts`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "contracts"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"chain_id": "763373",
|
||||
"endpoint_addr": "0xf8963f7860af7de9b94893edb9a3b5c155e1fc0c"
|
||||
},
|
||||
"request_type": "query_contracts"
|
||||
}
|
||||
```
|
||||
|
||||
{% hint style="info" %}
|
||||
**Note:**
|
||||
|
||||
* <mark style="color:red;">`endpoint_addr`</mark> is the address of the Nado endpoint contracts. Deposits are sent to the endpoint address; **this to used sign every request except **<mark style="color:red;">**`PlaceOrder`**</mark>
|
||||
{% endhint %}
|
||||
@@ -0,0 +1,160 @@
|
||||
# Edge All Products
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 480 requests/min or 8 requests/sec per IP address. (**weight = 5**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "edge_all_products"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=edge_all_products`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "edge_all_products"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Response
|
||||
|
||||
{% hint style="info" %}
|
||||
**Note**:
|
||||
|
||||
* A product is some asset / position an account can take on.
|
||||
* A market is a venue for a product against USDT0.
|
||||
* All products have a market quoted against USDT0, except for product 0.
|
||||
* Product 0 is the USDT0 asset itself.
|
||||
* You can retrieve product symbols via [symbols](https://docs.nado.xyz/developer-resources/api/symbols "mention") query.Body
|
||||
* Returns a mapping of <mark style="color:orange;">`chain_id -> all_products`</mark>
|
||||
{% endhint %}
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"edge_all_products": {
|
||||
"763373": {
|
||||
"spot_products": [
|
||||
{
|
||||
"product_id": 0,
|
||||
"oracle_price_x18": "1000000000000000000",
|
||||
"risk": {
|
||||
"long_weight_initial_x18": "1000000000000000000",
|
||||
"short_weight_initial_x18": "1000000000000000000",
|
||||
"long_weight_maintenance_x18": "1000000000000000000",
|
||||
"short_weight_maintenance_x18": "1000000000000000000",
|
||||
"price_x18": "1000000000000000000"
|
||||
},
|
||||
"config": {
|
||||
"token": "0x5f65358d61a9a281ea3bb930d05889aca21e3f4f",
|
||||
"interest_inflection_util_x18": "800000000000000000",
|
||||
"interest_floor_x18": "10000000000000000",
|
||||
"interest_small_cap_x18": "40000000000000000",
|
||||
"interest_large_cap_x18": "1000000000000000000",
|
||||
"withdraw_fee_x18": "1000000000000000000",
|
||||
"min_deposit_rate_x18": "0"
|
||||
},
|
||||
"state": {
|
||||
"cumulative_deposits_multiplier_x18": "1000000000025524653",
|
||||
"cumulative_borrows_multiplier_x18": "1000347390837434279",
|
||||
"total_deposits_normalized": "20001011744258817298755054194662",
|
||||
"total_borrows_normalized": "1617724891363505323532211"
|
||||
},
|
||||
"book_info": {
|
||||
"size_increment": "0",
|
||||
"price_increment_x18": "0",
|
||||
"min_size": "0",
|
||||
"collected_fees": "0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"product_id": 1,
|
||||
"oracle_price_x18": "115575316424148798147115",
|
||||
"risk": {
|
||||
"long_weight_initial_x18": "900000000000000000",
|
||||
"short_weight_initial_x18": "1100000000000000000",
|
||||
"long_weight_maintenance_x18": "950000000000000000",
|
||||
"short_weight_maintenance_x18": "1050000000000000000",
|
||||
"price_x18": "115575316424148798147115"
|
||||
},
|
||||
"config": {
|
||||
"token": "0xc57c1c64561a37ac9e8f9039cb6deab7539d99fc",
|
||||
"interest_inflection_util_x18": "800000000000000000",
|
||||
"interest_floor_x18": "10000000000000000",
|
||||
"interest_small_cap_x18": "40000000000000000",
|
||||
"interest_large_cap_x18": "1000000000000000000",
|
||||
"withdraw_fee_x18": "40000000000000",
|
||||
"min_deposit_rate_x18": "0"
|
||||
},
|
||||
"state": {
|
||||
"cumulative_deposits_multiplier_x18": "1000000000000318713",
|
||||
"cumulative_borrows_multiplier_x18": "1000347390679880473",
|
||||
"total_deposits_normalized": "9000399823280682696107190850",
|
||||
"total_borrows_normalized": "9580268570661550719"
|
||||
},
|
||||
"book_info": {
|
||||
"size_increment": "1000000000000000",
|
||||
"price_increment_x18": "1000000000000000000",
|
||||
"min_size": "4000000000000000",
|
||||
"collected_fees": "0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"perp_products": [
|
||||
{
|
||||
"product_id": 2,
|
||||
"oracle_price_x18": "115432187703236794231754",
|
||||
"risk": {
|
||||
"long_weight_initial_x18": "950000000000000000",
|
||||
"short_weight_initial_x18": "1050000000000000000",
|
||||
"long_weight_maintenance_x18": "970000000000000000",
|
||||
"short_weight_maintenance_x18": "1030000000000000000",
|
||||
"price_x18": "115432187703236794231754"
|
||||
},
|
||||
"state": {
|
||||
"cumulative_funding_long_x18": "-394223711772447555304",
|
||||
"cumulative_funding_short_x18": "-394223711772447555304",
|
||||
"available_settle": "20092193239667417956947",
|
||||
"open_interest": "113605000000000000000"
|
||||
},
|
||||
"book_info": {
|
||||
"size_increment": "1000000000000000",
|
||||
"price_increment_x18": "1000000000000000000",
|
||||
"min_size": "4000000000000000",
|
||||
"collected_fees": "0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"request_type": "query_edge_all_products"
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,93 @@
|
||||
# Fee Rates
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 1200 requests/min or 20 requests/sec per IP address. (**weight = 2**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "fee_rates",
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=fee_rates&sender={sender}`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "fee_rates",
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Request Parameters
|
||||
|
||||
<table><thead><tr><th width="140" align="center">Parameter</th><th width="97" align="center">Type</th><th width="104" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">sender</td><td align="center">string</td><td align="center">Yes</td><td>A <mark style="color:red;"><code>bytes32</code></mark> sent as a hex string; includes the address and the subaccount identifier.</td></tr></tbody></table>
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"taker_fee_rates_x18": [
|
||||
"0",
|
||||
"300000000000000",
|
||||
"200000000000000",
|
||||
"300000000000000",
|
||||
"200000000000000"
|
||||
],
|
||||
"maker_fee_rates_x18": [
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0"
|
||||
],
|
||||
"liquidation_sequencer_fee": "250000000000000000",
|
||||
"health_check_sequencer_fee": "100000000000000000",
|
||||
"taker_sequencer_fee": "25000000000000000",
|
||||
"withdraw_sequencer_fees": [
|
||||
"10000000000000000",
|
||||
"40000000000000",
|
||||
"0",
|
||||
"600000000000000",
|
||||
"0"
|
||||
]
|
||||
},
|
||||
"request_type": "query_fee_rates",
|
||||
}
|
||||
```
|
||||
|
||||
{% hint style="info" %}
|
||||
|
||||
* <mark style="color:red;">`taker_fee_rates_x18`</mark>: taker fee associated with a given product indexed by `product_id`. **Note**: this fee represents the basis point (BPS) on a taker order in <mark style="color:red;">`x18`</mark>.
|
||||
* <mark style="color:red;">`maker_fee_rates_x18`</mark>: maker fee associated with a given produced indexed by <mark style="color:red;">`product_id`</mark>`.`
|
||||
* <mark style="color:red;">`withdraw_sequencer_fees`</mark>: withdraw fees associated with a given product indexed by <mark style="color:red;">`product_id`</mark>. **Note**: this fee represents a fixed amount of product to be deducted as fee in <mark style="color:red;">`x18`</mark>.
|
||||
{% endhint %}
|
||||
|
||||
See our [fees](https://github.com/nadohq/nado-docs/blob/main/docs/basics/fees.md) page for details about current fee rates.
|
||||
@@ -0,0 +1,69 @@
|
||||
# Health Groups
|
||||
|
||||
{% hint style="info" %}
|
||||
**Note**: a health group is a perp and spot product whose health is calculated together (e.g. BTC and BTC-PERP).
|
||||
{% endhint %}
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 1200 requests/min or 20 requests/sec per IP address. (**weight = 2**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "health_groups"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=health_groups`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "health_groups"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"health_groups": [
|
||||
[
|
||||
1,
|
||||
2
|
||||
]
|
||||
]
|
||||
},
|
||||
"request_type": "query_health_groups"
|
||||
}
|
||||
```
|
||||
|
||||
{% hint style="info" %}
|
||||
|
||||
* <mark style="color:red;">`health_groups`</mark>: list of all available health groups. **Note**: <mark style="color:red;">`health_groups[i]`</mark> is the spot / perp product pair of health group <mark style="color:red;">`i`</mark> where <mark style="color:red;">`health_groups[i][0]`</mark> is the spot <mark style="color:red;">`product_id`</mark> and <mark style="color:red;">`health_groups[i][1]`</mark> is the perp <mark style="color:red;">`product_id`</mark>. Additionally, it is possible for a health group to only have either a spot or perp product, in which case, the product that doesn’t exist is set to <mark style="color:red;">`0`</mark>.
|
||||
{% endhint %}
|
||||
@@ -0,0 +1,55 @@
|
||||
# Insurance
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 1200 requests/min or 20 requests/sec per IP address. (**weight = 2**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "insurance"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=insurance`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "insurance"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"insurance": "552843342443351553629462"
|
||||
},
|
||||
"request_type": "query_insurance"
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,171 @@
|
||||
# Isolated Positions
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 240 requests/min or 40 requests every 10 seconds per IP address. (**weight = 10**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "isolated_positions",
|
||||
"subaccount": "0xeae27ae6412147ed6d5692fd91709dad6dbfc34264656661756c740000000000"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=isolated_positions&subaccount={subaccount}`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "isolated_positions",
|
||||
"subaccount": "0xeae27ae6412147ed6d5692fd91709dad6dbfc34264656661756c740000000000"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Request Parameters
|
||||
|
||||
<table><thead><tr><th width="140" align="center">Parameter</th><th width="100" align="center">Type</th><th width="104" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">subaccount</td><td align="center">string</td><td align="center">Yes</td><td>A <mark style="color:red;"><code>bytes32</code></mark> sent as a hex string; includes the address and the subaccount identifier. See <a href="../../executes#sender-field-structure">sender field structure</a> for details.</td></tr></tbody></table>
|
||||
|
||||
## Response
|
||||
|
||||
{% hint style="info" %}
|
||||
**Note**:
|
||||
|
||||
* <mark style="color:red;">`isolated_positions[i].subaccount`</mark>: is the isolated subaccount for the base product.
|
||||
* <mark style="color:red;">`healths`</mark>:
|
||||
* <mark style="color:red;">`healths[0]`</mark>: info about your initial health, which is weighted by `long_weight_initial_x18` and `short_weight_initial_x18.`
|
||||
* <mark style="color:red;">`healths[1]`</mark>: info about your maintenance health, which is weighted by `long_weight_maintenance_x18` and `short_weight_maintenance_x18.`
|
||||
* <mark style="color:red;">`healths[2]`</mark>: info about your unweighted health.
|
||||
{% endhint %}
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"isolated_positions": [
|
||||
{
|
||||
"subaccount": "0xeae27ae6412147ed6d5692fd91709dad6dbfc34200000000000000280269736f",
|
||||
"quote_balance": {
|
||||
"product_id": 0,
|
||||
"balance": {
|
||||
"amount": "200044412311089295472"
|
||||
}
|
||||
},
|
||||
"base_balance": {
|
||||
"product_id": 40,
|
||||
"balance": {
|
||||
"amount": "1720000000000000000000",
|
||||
"v_quote_balance": "-800854578334374649165",
|
||||
"last_cumulative_funding_x18": "85496772388082947"
|
||||
}
|
||||
},
|
||||
"quote_product": {
|
||||
"product_id": 0,
|
||||
"oracle_price_x18": "1000000000000000000",
|
||||
"risk": {
|
||||
"long_weight_initial_x18": "1000000000000000000",
|
||||
"short_weight_initial_x18": "1000000000000000000",
|
||||
"long_weight_maintenance_x18": "1000000000000000000",
|
||||
"short_weight_maintenance_x18": "1000000000000000000",
|
||||
"price_x18": "1000000000000000000"
|
||||
},
|
||||
"config": {
|
||||
"token": "0x5f65358d61a9a281ea3bb930d05889aca21e3f4f",
|
||||
"interest_inflection_util_x18": "800000000000000000",
|
||||
"interest_floor_x18": "10000000000000000",
|
||||
"interest_small_cap_x18": "40000000000000000",
|
||||
"interest_large_cap_x18": "1000000000000000000",
|
||||
"withdraw_fee_x18": "1000000000000000000",
|
||||
"min_deposit_rate_x18": "0"
|
||||
},
|
||||
"state": {
|
||||
"cumulative_deposits_multiplier_x18": "1000000000025524653",
|
||||
"cumulative_borrows_multiplier_x18": "1000347390837434279",
|
||||
"total_deposits_normalized": "20001011744258817298755054194662",
|
||||
"total_borrows_normalized": "1617724891363505323532211"
|
||||
},
|
||||
"book_info": {
|
||||
"size_increment": "0",
|
||||
"price_increment_x18": "0",
|
||||
"min_size": "0",
|
||||
"collected_fees": "0"
|
||||
}
|
||||
},
|
||||
"base_product": {
|
||||
"product_id": 2,
|
||||
"oracle_price_x18": "115596528090565357611177",
|
||||
"risk": {
|
||||
"long_weight_initial_x18": "950000000000000000",
|
||||
"short_weight_initial_x18": "1050000000000000000",
|
||||
"long_weight_maintenance_x18": "970000000000000000",
|
||||
"short_weight_maintenance_x18": "1030000000000000000",
|
||||
"price_x18": "115596528090565357611177"
|
||||
},
|
||||
"state": {
|
||||
"cumulative_funding_long_x18": "-394223711772447555304",
|
||||
"cumulative_funding_short_x18": "-394223711772447555304",
|
||||
"available_settle": "20092193239667417956947",
|
||||
"open_interest": "113605000000000000000"
|
||||
},
|
||||
"book_info": {
|
||||
"size_increment": "1000000000000000",
|
||||
"price_increment_x18": "1000000000000000000",
|
||||
"min_size": "4000000000000000",
|
||||
"collected_fees": "0"
|
||||
}
|
||||
},
|
||||
"quote_healths": [
|
||||
"200044412311089295472",
|
||||
"200044412311089295472",
|
||||
"200044412311089295472"
|
||||
],
|
||||
"base_healths": [
|
||||
"-109839746873700492625",
|
||||
"-71450034014774150595",
|
||||
"-33060321155847808565"
|
||||
],
|
||||
"healths": [
|
||||
{
|
||||
"assets": "200044412311089295472",
|
||||
"liabilities": "109839746873700492625",
|
||||
"health": "90204665437388802847"
|
||||
},
|
||||
{
|
||||
"assets": "200044412311089295472",
|
||||
"liabilities": "71450034014774150595",
|
||||
"health": "128594378296315144877"
|
||||
},
|
||||
{
|
||||
"assets": "200044412311089295472",
|
||||
"liabilities": "33060321155847808565",
|
||||
"health": "166984091155241486907"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"request_type": "query_isolated_positions"
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,63 @@
|
||||
# Linked Signer
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 480 requests/min or 8 requests/sec per IP address. (**weight = 5**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "linked_signer",
|
||||
"subaccount": "0x9b9989a4E0b260B84a5f367d636298a8bfFb7a9b42544353504f540000000000"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=linked_signer&subaccount=0x9b9989a4E0b260B84a5f367d636298a8bfFb7a9b42544353504f540000000000`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "linked_signer",
|
||||
"subaccount": "0x9b9989a4E0b260B84a5f367d636298a8bfFb7a9b42544353504f540000000000"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"linked_signer": "0x0000000000000000000000000000000000000000"
|
||||
},
|
||||
"request_type": "query_linked_signer",
|
||||
}
|
||||
```
|
||||
|
||||
{% hint style="info" %}
|
||||
**Notes**:
|
||||
|
||||
* <mark style="color:red;">`linked_signer`</mark>: the current linked signer address (20 bytes) associated to the provided `subaccount`. It returns the zero address when no signer is linked.
|
||||
{% endhint %}
|
||||
@@ -0,0 +1,91 @@
|
||||
# Market Liquidity
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 2400 requests/min or 40 requests/sec per IP address. (**weight = 1**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "market_liquidity",
|
||||
"product_id": 1,
|
||||
"depth": 10
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=market_liquidity&product_id={product_id}&depth={depth}`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "market_liquidity",
|
||||
"product_id": 1,
|
||||
"depth": 10
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Request Parameters
|
||||
|
||||
<table><thead><tr><th width="140" align="center">Parameter</th><th width="97" align="center">Type</th><th width="104" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">product_id</td><td align="center">number</td><td align="center">Yes</td><td>Id of spot / perp product for which to retrieve market liquidity.</td></tr><tr><td align="center">depth</td><td align="center">number</td><td align="center">Yes</td><td>Number of price levels to retrieve. (<mark style="color:red;"><code>max: 100</code></mark>)</td></tr></tbody></table>
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"bids": [
|
||||
[
|
||||
"30234000000000000000000",
|
||||
"663000000000000000"
|
||||
],
|
||||
[
|
||||
"30170000000000000000000",
|
||||
"24623000000000000000"
|
||||
]
|
||||
],
|
||||
"asks": [
|
||||
[
|
||||
"30245000000000000000000",
|
||||
"664000000000000000"
|
||||
],
|
||||
[
|
||||
"30252000000000000000000",
|
||||
"4646000000000000000"
|
||||
]
|
||||
],
|
||||
"timestamp": "1681850046966693400",
|
||||
"product_id": 1
|
||||
},
|
||||
"request_type": "query_market_liquidity"
|
||||
}
|
||||
```
|
||||
|
||||
{% hint style="info" %}
|
||||
**Note:**
|
||||
|
||||
* Each entry inside bids and asks is an array of price and size respectively. **Note**: that price is represented using fixed point, so it is <mark style="color:red;">`1e18`</mark> times greater than the decimal price.
|
||||
* <mark style="color:red;">`timestamp`</mark> is in nanoseconds.
|
||||
{% endhint %}
|
||||
@@ -0,0 +1,131 @@
|
||||
# Market Prices
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 2400 requests/min or 40 requests/sec per IP address. (**weight = 1**) or length of <mark style="color:red;">`product_ids`</mark> for [multi-product markets](#multiple-products) query.
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Single Product
|
||||
|
||||
### Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "market_price",
|
||||
"product_id": 1
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=market_price&product_id={product_id}`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "market_price",
|
||||
"product_id": 1
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
### Request Parameters
|
||||
|
||||
<table><thead><tr><th width="140" align="center">Parameter</th><th width="97" align="center">Type</th><th width="104" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">product_id</td><td align="center">number</td><td align="center">Yes</td><td>Id of spot / perp product for which to retrieve market price data.</td></tr></tbody></table>
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"product_id": 1,
|
||||
"bid_x18": "24224000000000000000000",
|
||||
"ask_x18": "24243000000000000000000"
|
||||
},
|
||||
"request_type": "query_market_price",
|
||||
}
|
||||
```
|
||||
|
||||
{% hint style="info" %}
|
||||
**Note**: that price is represented using fixed point, so it is <mark style="color:red;">`1e18`</mark> times greater than the decimal price.
|
||||
{% endhint %}
|
||||
|
||||
## Multiple Products
|
||||
|
||||
### Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [CORE_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "market_prices",
|
||||
"product_ids": [1, 2]
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST" %} <mark style="color:orange;">`POST /query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "market_prices",
|
||||
"product_ids": [1, 2]
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
### Request Parameters
|
||||
|
||||
<table><thead><tr><th width="140" align="center">Parameter</th><th width="118" align="center">Type</th><th width="135.125" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">product_ids</td><td align="center">number[]</td><td align="center">Yes</td><td>List of spot / perp products for which to retrieve market price data.</td></tr></tbody></table>
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"market_prices": [
|
||||
{
|
||||
"product_id": 1,
|
||||
"bid_x18": "31315000000000000000000",
|
||||
"ask_x18": "31326000000000000000000"
|
||||
},
|
||||
{
|
||||
"product_id": 2,
|
||||
"bid_x18": "31291000000000000000000",
|
||||
"ask_x18": "31301000000000000000000"
|
||||
},
|
||||
]
|
||||
},
|
||||
"request_type": "query_market_prices"
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,61 @@
|
||||
# Max NLP Burnable
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 120 requests/min or 20 requests every 10 seconds per IP address. (**weight = 20**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "max_nlp_burnable",
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=max_nlp_burnable&sender={sender}`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "max_nlp_burnable",
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Request Parameters
|
||||
|
||||
<table><thead><tr><th width="154" align="center">Parameter</th><th width="97" align="center">Type</th><th width="87" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">sender</td><td align="center">string</td><td align="center">Yes</td><td>A <mark style="color:red;"><code>bytes32</code></mark> sent as a hex string; includes the address and the subaccount identifier.</td></tr></tbody></table>
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"max_nlp_amount": "34250782930221490366619"
|
||||
},
|
||||
"request_type": "query_max_nlp_burnable",
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,63 @@
|
||||
# Max NLP Mintable
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 120 requests/min or 20 requests every 10 seconds per IP address. (**weight = 20**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "max_nlp_mintable",
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
|
||||
"spot_leverage": "true"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=max_nlp_mintable&sender={sender}`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "max_nlp_mintable",
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
|
||||
"spot_leverage": "true"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Request Parameters
|
||||
|
||||
<table><thead><tr><th width="154" align="center">Parameter</th><th width="97" align="center">Type</th><th width="87" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">sender</td><td align="center">string</td><td align="center">Yes</td><td>A <mark style="color:red;"><code>bytes32</code></mark> sent as a hex string; includes the address and the subaccount identifier.</td></tr><tr><td align="center">spot_leverage</td><td align="center">boolean</td><td align="center">No</td><td>Boolean sent as a string. indicates whether leverage should be used; when set to <mark style="color:red;"><code>false</code></mark> , returns the max amount of base LP mintable possible without borrow. Defaults to <mark style="color:red;"><code>true</code></mark></td></tr></tbody></table>
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"max_quote_amount": "34250782930221490366619"
|
||||
},
|
||||
"request_type": "query_max_nlp_mintable",
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,73 @@
|
||||
# Max Order Size
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 480 requests/min or 80 requests every 10 seconds per IP address. (**weight = 5**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "max_order_size",
|
||||
"product_id": 1,
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
|
||||
"price_x18": "23000000000000000000000",
|
||||
"direction": "short",
|
||||
"spot_leverage": "true",
|
||||
"reduce_only": "false",
|
||||
"isolated": "false"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=max_order_size&product_id={product_id}&sender={sender}&price_x18={price_x18}&direction={direction}`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "max_order_size",
|
||||
"product_id": 1,
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
|
||||
"price_x18": "23000000000000000000000",
|
||||
"direction": "short",
|
||||
"spot_leverage": "true",
|
||||
"reduce_only": "false",
|
||||
"isolated": "false"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Request Parameters
|
||||
|
||||
<table><thead><tr><th width="158" align="center">Parameter</th><th width="97" align="center">Type</th><th width="104" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">sender</td><td align="center">string</td><td align="center">Yes</td><td>A <mark style="color:red;"><code>bytes32</code></mark> sent as a hex string; includes the address and the subaccount identifier.</td></tr><tr><td align="center">product_id</td><td align="center">number</td><td align="center">Yes</td><td>Id of spot / perp product for which to retrieve max order size.</td></tr><tr><td align="center">price_x18</td><td align="center">string</td><td align="center">Yes</td><td>An <mark style="color:red;"><code>int128</code></mark> representing the price of the order multiplied by 1e18, sent as a string. For example, a price of 1 USDT0 would be sent as <code>"1000000000000000000"</code></td></tr><tr><td align="center">direction</td><td align="center">string</td><td align="center">Yes</td><td><mark style="color:red;"><code>long</code></mark> for max bid or <mark style="color:red;"><code>short</code></mark> for max ask.</td></tr><tr><td align="center">spot_leverage</td><td align="center">string</td><td align="center">No</td><td>Boolean sent as a string. Indicates whether leverage should be used; when set to <mark style="color:red;"><code>false</code></mark> , returns the max order possible without borrow. Defaults to <mark style="color:red;"><code>true</code></mark></td></tr><tr><td align="center">reduce_only</td><td align="center">string</td><td align="center">No</td><td>Boolean sent as a string. Indicates wether to retrieve the max order size to close / reduce a position. Defaults to <mark style="color:red;"><code>false</code></mark></td></tr><tr><td align="center">isolated</td><td align="center">string</td><td align="center">No</td><td>Boolean sent as a string. When set to <mark style="color:red;"><code>true</code></mark>, calculates max order size for an isolated margin position. Defaults to <mark style="color:red;"><code>false</code></mark>. See <a href="https://github.com/nadohq/nado-docs/blob/main/docs/basics/isolated-margin.md">Isolated Margin</a> to learn more.</td></tr></tbody></table>
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"max_order_size": "137847520631947079935"
|
||||
},
|
||||
"request_type": "query_max_order_size",
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,65 @@
|
||||
# Max Withdrawable
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 480 requests/min or 80 requests every 10 seconds per IP address. (**weight = 5**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "max_withdrawable",
|
||||
"product_id": 1,
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
|
||||
"spot_leverage": "true"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=max_withdrawable&product_id={product_id}&sender={sender}`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "max_withdrawable",
|
||||
"product_id": 1,
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
|
||||
"spot_leverage": "true"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Request Parameters
|
||||
|
||||
<table><thead><tr><th width="154" align="center">Parameter</th><th width="97" align="center">Type</th><th width="104" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">sender</td><td align="center">string</td><td align="center">Yes</td><td>A <mark style="color:red;"><code>bytes32</code></mark> sent as a hex string; includes the address and the subaccount identifier.</td></tr><tr><td align="center">product_id</td><td align="center">number</td><td align="center">Yes</td><td>Id of spot / perp product for which to retrieve max withdrawable amount.</td></tr><tr><td align="center">spot_leverage</td><td align="center">string</td><td align="center">No</td><td>Boolean sent as a string. Indicates whether leverage should be used; when set to <mark style="color:red;"><code>false</code></mark> , returns the max withdrawable amount possible without borrow. Defaults to <mark style="color:red;"><code>true</code></mark></td></tr></tbody></table>
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"max_withdrawable": "7968557932297078268650"
|
||||
},
|
||||
"request_type": "query_max_withdrawable",
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,117 @@
|
||||
# NLP Locked Balances
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 120 requests/min or 20 requests every 10 seconds per IP address. (**weight = 20**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "nlp_locked_balances",
|
||||
"subaccount": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=nlp_locked_balances&subaccount={subaccount}`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "nlp_locked_balances",
|
||||
"subaccount": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Request Parameters
|
||||
|
||||
<table><thead><tr><th width="154" align="center">Parameter</th><th width="97" align="center">Type</th><th width="87" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">subaccount</td><td align="center">string</td><td align="center">Yes</td><td>A <mark style="color:red;"><code>bytes32</code></mark> sent as a hex string; includes the address and the subaccount identifier.</td></tr></tbody></table>
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"balance_locked": {
|
||||
"product_id": 0,
|
||||
"balance": {
|
||||
"amount": "1000000000000000000000",
|
||||
"last_cumulative_funding_x18": "0"
|
||||
}
|
||||
},
|
||||
"balance_unlocked": {
|
||||
"product_id": 0,
|
||||
"balance": {
|
||||
"amount": "500000000000000000000",
|
||||
"last_cumulative_funding_x18": "0"
|
||||
}
|
||||
},
|
||||
"locked_balances": [
|
||||
{
|
||||
"balance": {
|
||||
"product_id": 0,
|
||||
"balance": {
|
||||
"amount": "250000000000000000000",
|
||||
"last_cumulative_funding_x18": "0"
|
||||
}
|
||||
},
|
||||
"unlocked_at": "1735689600"
|
||||
},
|
||||
{
|
||||
"balance": {
|
||||
"product_id": 0,
|
||||
"balance": {
|
||||
"amount": "750000000000000000000",
|
||||
"last_cumulative_funding_x18": "0"
|
||||
}
|
||||
},
|
||||
"unlocked_at": "1736035200"
|
||||
}
|
||||
]
|
||||
},
|
||||
"request_type": "query_nlp_locked_balances"
|
||||
}
|
||||
```
|
||||
|
||||
## Response Fields
|
||||
|
||||
### NLP Locked Balances Response
|
||||
|
||||
<table><thead><tr><th width="263">Field name</th><th>Description</th></tr></thead><tbody><tr><td>balance_locked</td><td>Total balance that is currently locked (SpotBalance object)</td></tr><tr><td>balance_unlocked</td><td>Total balance that is currently unlocked and available (SpotBalance object)</td></tr><tr><td>locked_balances</td><td>Array of individual locked balance entries with their unlock times</td></tr></tbody></table>
|
||||
|
||||
### Locked Balance Entry
|
||||
|
||||
<table><thead><tr><th width="263">Field name</th><th>Description</th></tr></thead><tbody><tr><td>balance</td><td>SpotBalance object containing the locked amount</td></tr><tr><td>unlocked_at</td><td>Unix epoch timestamp (in seconds) when this balance will unlock</td></tr></tbody></table>
|
||||
|
||||
### SpotBalance Object
|
||||
|
||||
<table><thead><tr><th width="263">Field name</th><th>Description</th></tr></thead><tbody><tr><td>product_id</td><td>The product ID (typically 0 for USDT0/quote asset)</td></tr><tr><td>balance</td><td>Balance details object</td></tr><tr><td>balance.amount</td><td>The balance amount in x18 format (string)</td></tr><tr><td>balance.last_cumulative_funding_x18</td><td>Last cumulative funding value in x18 format (string)</td></tr></tbody></table>
|
||||
|
||||
## Notes
|
||||
|
||||
* NLP positions have a 4-day lock period after minting before they can be burned (withdrawn)
|
||||
* The `locked_balances` array shows individual lock entries, each with their own unlock timestamp
|
||||
* `balance_locked` is the sum of all locked balances
|
||||
* `balance_unlocked` represents balances that have passed their lock period and can be withdrawn
|
||||
@@ -0,0 +1,89 @@
|
||||
# NLP Pool Info
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 120 requests/min or 20 requests every 10 seconds per IP address. (**weight = 20**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "nlp_pool_info"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=nlp_pool_info`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "nlp_pool_info"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Request Parameters
|
||||
|
||||
This query does not require any parameters.
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"nlp_pools": [
|
||||
{
|
||||
"pool_id": 1,
|
||||
"subaccount": "0x0000000000000000000000000000000000000000000000000000000000000002",
|
||||
"owner": "0x1234567890123456789012345678901234567890",
|
||||
"balance_weight_x18": "500000000000000000",
|
||||
"subaccount_info": {
|
||||
"subaccount": "0x0000000000000000000000000000000000000000000000000000000000000002",
|
||||
"exists": true,
|
||||
"health": {
|
||||
"assets": "1000000000000000000000",
|
||||
"liabilities": "500000000000000000000",
|
||||
"initial_health": "250000000000000000000",
|
||||
"maintenance_health": "100000000000000000000"
|
||||
},
|
||||
"spot_balances": [],
|
||||
"perp_balances": []
|
||||
},
|
||||
"open_orders": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"request_type": "query_nlp_pool_info"
|
||||
}
|
||||
```
|
||||
|
||||
## Response Fields
|
||||
|
||||
### NLP Pool Info
|
||||
|
||||
<table><thead><tr><th width="263">Field name</th><th>Description</th></tr></thead><tbody><tr><td>nlp_pools</td><td>Array of NLP pool objects</td></tr></tbody></table>
|
||||
|
||||
### NLP Pool Object
|
||||
|
||||
<table><thead><tr><th width="263">Field name</th><th>Description</th></tr></thead><tbody><tr><td>pool_id</td><td>Unique identifier for the pool</td></tr><tr><td>subaccount</td><td>The subaccount address associated with this pool (bytes32 hex string)</td></tr><tr><td>owner</td><td>The owner address of the pool (bytes20 hex string)</td></tr><tr><td>balance_weight_x18</td><td>Weight of this pool's balance in x18 format (string representation of u128)</td></tr><tr><td>subaccount_info</td><td>Complete subaccount information including health, balances, and positions</td></tr><tr><td>open_orders</td><td>Array of currently open orders for this pool</td></tr></tbody></table>
|
||||
@@ -0,0 +1,66 @@
|
||||
# Nonces
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 1200 requests/min or 20 requests/sec per IP address. (**weight = 2**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "nonces",
|
||||
"address": "0x0000000000000000000000000000000000000000"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GGET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=nonces&address={address}`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "nonces",
|
||||
"address": "0x0000000000000000000000000000000000000000"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Request Parameters
|
||||
|
||||
<table><thead><tr><th width="134" align="center">Parameter</th><th width="86" align="center">Type</th><th width="104" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">address</td><td align="center">string</td><td align="center">Yes</td><td>A <mark style="color:red;"><code>bytes20</code></mark> sent as a hex string representing the wallet address.</td></tr></tbody></table>
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status":"success",
|
||||
"data":{
|
||||
"tx_nonce": 0,
|
||||
"order_nonce": 1753048133299863552
|
||||
},
|
||||
"request_type": "query_nonces",
|
||||
}
|
||||
```
|
||||
|
||||
{% hint style="info" %}
|
||||
**Note**: when doing any execute that is not <mark style="color:red;">`place_orders`</mark>, i.e. <mark style="color:red;">`withdraw_collateral`</mark>, <mark style="color:red;">`liquidate_subaccount`</mark>, you want to use <mark style="color:red;">`tx_nonce`</mark> as the nonce. <mark style="color:red;">`tx_nonce`</mark> increments by one each time a successful execute goes through. <mark style="color:red;">`order_nonce`</mark> is a historical artifact for the frontend, and simply returns the current timestamp in milliseconds plus 100000 multiplied by 2\*\*20.
|
||||
{% endhint %}
|
||||
@@ -0,0 +1,77 @@
|
||||
# Order
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 2400 requests/min or 40 requests/sec per IP address. (**weight = 1**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "order",
|
||||
"product_id": 1,
|
||||
"digest": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=order&product_id={product_id}&digest={digest}`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "order",
|
||||
"product_id": 1,
|
||||
"digest": "0x0000000000000000000000000000000000000000000000000000000000000000"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Request Parameters
|
||||
|
||||
<table><thead><tr><th width="140" align="center">Parameter</th><th width="97" align="center">Type</th><th width="104" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">product_id</td><td align="center">number</td><td align="center">Yes</td><td>Id of spot / perp product for which to retrieve order.</td></tr><tr><td align="center">digest</td><td align="center">string</td><td align="center">Yes</td><td>Order digest to retrieve.</td></tr></tbody></table>
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"product_id": 1,
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
|
||||
"price_x18": "1000000000000000000",
|
||||
"amount": "1000000000000000000",
|
||||
"expiration": "2000000000",
|
||||
"nonce": "1",
|
||||
"unfilled_amount": "1000000000000000000",
|
||||
"digest": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"placed_at": 1681951347,
|
||||
"appendix": "1537",
|
||||
"order_type": "ioc"
|
||||
},
|
||||
"request_type": "query_order",
|
||||
}
|
||||
```
|
||||
|
||||
{% hint style="info" %}
|
||||
**Note**: that side of the order (buy/sell) is included in the sign of <mark style="color:red;">`amount`</mark> and <mark style="color:red;">`unfilled_amount`</mark> . They are positive if the order is a buy order, otherwise negative.
|
||||
{% endhint %}
|
||||
@@ -0,0 +1,162 @@
|
||||
# Orders
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 1200 requests/min or 20 requests/sec per IP address. (**weight = 2**) or 2 \* length of <mark style="color:red;">`product_ids`</mark> for [multi-product orders](#multiple-products) query.
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Single Product
|
||||
|
||||
### Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "subaccount_orders",
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
|
||||
"product_id": 1
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=subaccount_orders&sender={sender}&product_id={product_id}`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "subaccount_orders",
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
|
||||
"product_id": 1
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
### Request Parameters
|
||||
|
||||
<table><thead><tr><th width="140" align="center">Parameter</th><th width="97" align="center">Type</th><th width="104" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">sender</td><td align="center">string</td><td align="center">Yes</td><td>A <mark style="color:red;"><code>bytes32</code></mark> sent as a hex string; includes the address and the subaccount identifier.</td></tr><tr><td align="center">product_id</td><td align="center">number</td><td align="center">Yes</td><td>Id of spot / perp product for which to retrieve subaccount orders.</td></tr></tbody></table>
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
|
||||
"product_id": 1,
|
||||
"orders": [
|
||||
{
|
||||
"product_id": 1,
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
|
||||
"price_x18": "1000000000000000000",
|
||||
"amount": "1000000000000000000",
|
||||
"expiration": "2000000000",
|
||||
"nonce": "1",
|
||||
"unfilled_amount": "1000000000000000000",
|
||||
"digest": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"placed_at": 1682437739,
|
||||
"appendix": "1537",
|
||||
"order_type": "ioc"
|
||||
}
|
||||
]
|
||||
},
|
||||
"request_type": "query_subaccount_orders"
|
||||
}
|
||||
```
|
||||
|
||||
{% hint style="info" %}
|
||||
**Note**: that side of the order (buy/sell) is included in the sign of <mark style="color:red;">`amount`</mark> and <mark style="color:red;">`unfilled_amount`</mark> . They are positive if the order is a buy order, otherwise negative.
|
||||
{% endhint %}
|
||||
|
||||
## Multiple Products
|
||||
|
||||
### Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [CORE_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "orders",
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
|
||||
"product_ids": [1, 2, 3]
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST /query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "orders",
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
|
||||
"product_ids": [1, 2, 3]
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
### Request Parameters
|
||||
|
||||
<table><thead><tr><th width="140" align="center">Parameter</th><th width="109" align="center">Type</th><th width="104" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">sender</td><td align="center">string</td><td align="center">Yes</td><td>A <mark style="color:red;"><code>bytes32</code></mark> sent as a hex string; includes the address and the subaccount identifier.</td></tr><tr><td align="center">product_ids</td><td align="center">number[]</td><td align="center">Yes</td><td>List of spot / perp products for which to retrieve open orders.</td></tr></tbody></table>
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
|
||||
"product_orders": [
|
||||
{
|
||||
"product_id": 1,
|
||||
"orders": [
|
||||
{
|
||||
"product_id": 1,
|
||||
"sender": "0x7a5ec2748e9065794491a8d29dcf3f9edb8d7c43000000000000000000000000",
|
||||
"price_x18": "1000000000000000000",
|
||||
"amount": "1000000000000000000",
|
||||
"expiration": "2000000000",
|
||||
"nonce": "1",
|
||||
"unfilled_amount": "1000000000000000000",
|
||||
"digest": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"appendix": "1537",
|
||||
"placed_at": 1682437739,
|
||||
"order_type": "ioc"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"product_id": 2,
|
||||
"orders": []
|
||||
}
|
||||
]
|
||||
},
|
||||
"request_type": "query_orders"
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,60 @@
|
||||
# Status
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 2400 requests/min or 40 requests/sec per IP address. (**weight = 1**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "status"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=status`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "status"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": "active",
|
||||
"request_type": "query_status",
|
||||
}
|
||||
```
|
||||
|
||||
{% hint style="info" %}
|
||||
The offchain sequencer could be in any of the following statuses:
|
||||
|
||||
* <mark style="color:red;">`active`</mark>: accepting incoming executes.
|
||||
* <mark style="color:red;">`failed`</mark>: sequencer is in a failed state.
|
||||
{% endhint %}
|
||||
@@ -0,0 +1,353 @@
|
||||
# Subaccount Info
|
||||
|
||||
## Rate limits
|
||||
|
||||
The rate limit weight varies based on the request parameters:
|
||||
|
||||
* **Basic query** (no `txns`): **weight = 2**
|
||||
* 1200 requests/min or 200 requests every 10 seconds per IP address
|
||||
* **With simulation** (`txns` provided): **weight = 10**
|
||||
* 240 requests/min or 40 requests every 10 seconds per IP address
|
||||
* **With simulation + pre\_state** (`txns` and `pre_state="true"`): **weight = 15**
|
||||
* 160 requests/min or \~26 requests every 10 seconds per IP address
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "subaccount_info",
|
||||
"subaccount": "0xeae27ae6412147ed6d5692fd91709dad6dbfc34264656661756c740000000000",
|
||||
"txns": "[{\"apply_delta\":{\"product_id\":4,\"subaccount\":\"0xeae27ae6412147ed6d5692fd91709dad6dbfc34264656661756c740000000000\",\"amount_delta\":\"10790000000000000000\",\"v_quote_delta\":\"-35380410000000000000000\"}}]"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=subaccount_info&subaccount={subaccount}&txns=[{"apply_delta":{"product_id":2,"subaccount":"0xeae27ae6412147ed6d5692fd91709dad6dbfc34264656661756c740000000000","amount_delta":"100000000000000000","v_quote_delta":"3033500000000000000000"}}]`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "subaccount_info",
|
||||
"subaccount": "0xeae27ae6412147ed6d5692fd91709dad6dbfc34264656661756c740000000000",
|
||||
"txns": "[{\"apply_delta\":{\"product_id\":4,\"subaccount\":\"0xeae27ae6412147ed6d5692fd91709dad6dbfc34264656661756c740000000000\",\"amount_delta\":\"10790000000000000000\",\"v_quote_delta\":\"-35380410000000000000000\"}}]"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Request Parameters
|
||||
|
||||
<table><thead><tr><th width="140" align="center">Parameter</th><th width="100" align="center">Type</th><th width="104" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">subaccount</td><td align="center">string</td><td align="center">Yes</td><td>A <mark style="color:red;"><code>bytes32</code></mark> sent as a hex string; includes the address and the subaccount identifier. See <a href="../../executes#sender-field-structure">sender field structure</a> for details.</td></tr><tr><td align="center">txns</td><td align="center">string</td><td align="center">no</td><td>A list of transactions to get an estimated/simulated view. see more info below.</td></tr><tr><td align="center">pre_state</td><td align="center">string</td><td align="center">no</td><td>When <mark style="color:red;"><code>"true"</code></mark> and <mark style="color:red;"><code>txns</code></mark> are provided, returns the subaccount state before the transactions were applied in the <mark style="color:red;"><code>pre_state</code></mark> field. Defaults to <mark style="color:red;"><code>"false"</code></mark>.</td></tr></tbody></table>
|
||||
|
||||
### Supported txs for an estimated subaccount info
|
||||
|
||||
The following are the supported <mark style="color:red;">`txns`</mark> you can provide to get an estimated view of your subaccount.
|
||||
|
||||
{% hint style="info" %}
|
||||
**Note**: these <mark style="color:red;">`txns`</mark> are only used to simulate what your subaccount would look like if they were executed.
|
||||
{% endhint %}
|
||||
|
||||
#### ApplyDelta
|
||||
|
||||
Updates internal balances for the <mark style="color:red;">`product_id`</mark> and amount deltas provided.
|
||||
|
||||
```json
|
||||
{
|
||||
"apply_delta": {
|
||||
"product_id": 2,
|
||||
"subaccount": "0xeae27ae6412147ed6d5692fd91709dad6dbfc34264656661756c740000000000",
|
||||
"amount_delta": "100000000000000000",
|
||||
"v_quote_delta": "3033500000000000000000"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Response
|
||||
|
||||
{% hint style="info" %}
|
||||
**Note**:
|
||||
|
||||
* <mark style="color:red;">`healths`</mark>:
|
||||
* <mark style="color:red;">`healths[0]`</mark>: info about your initial health, which is weighted by `long_weight_initial_x18` and `short_weight_initial_x18.`
|
||||
* <mark style="color:red;">`healths[1]`</mark>: info about your maintenance health, which is weighted by `long_weight_maintenance_x18` and `short_weight_maintenance_x18.`
|
||||
* <mark style="color:red;">`healths[2]`</mark>: info about your unweighted health.
|
||||
* <mark style="color:red;">`health_contributions`</mark> is indexed by <mark style="color:red;">product\_id</mark> and represents the contribution of the corresponding product to the final health.
|
||||
* <mark style="color:red;">`health_contributions[product_id][0]`</mark>`: contribution to healths[0]`
|
||||
* <mark style="color:red;">`health_contributions[product_id][1]`</mark>`: contribution to healths[1]`
|
||||
* <mark style="color:red;">`health_contributions[product_id][2]`</mark>`: contribution to healths[2]`
|
||||
* <mark style="color:red;">`pre_state`</mark>: (Optional) When <mark style="color:red;">`pre_state="true"`</mark> is provided with <mark style="color:red;">`txns`</mark>, this field contains the subaccount state **before** the simulated transactions were applied. This allows you to compare the before/after states when simulating transactions.
|
||||
* <mark style="color:red;">`pre_state.healths`</mark>: Same structure as the main `healths` field, but reflecting the state before transactions
|
||||
* <mark style="color:red;">`pre_state.health_contributions`</mark>: Health contributions before transactions
|
||||
* <mark style="color:red;">`pre_state.spot_balances`</mark>: Spot balances before transactions
|
||||
* <mark style="color:red;">`pre_state.perp_balances`</mark>: Perpetual balances before transactions
|
||||
{% endhint %}
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"subaccount": "0x8d7d64d6cf1d4f018dd101482ac71ad49e30c56064656661756c740000000000",
|
||||
"exists": true,
|
||||
"healths": [
|
||||
{
|
||||
"assets": "456895621098158389211471",
|
||||
"liabilities": "76286259844766495292488",
|
||||
"health": "380609361253391893918983"
|
||||
},
|
||||
{
|
||||
"assets": "456895621098158389211471",
|
||||
"liabilities": "72818702579095290924243",
|
||||
"health": "384076918519063098287228"
|
||||
},
|
||||
{
|
||||
"assets": "456895621098158389211471",
|
||||
"liabilities": "69351145313424086671554",
|
||||
"health": "387544475784734302539917"
|
||||
}
|
||||
],
|
||||
"health_contributions": [
|
||||
[
|
||||
"456895621098158389211471",
|
||||
"456895621098158389211471",
|
||||
"456895621098158389211471"
|
||||
],
|
||||
[
|
||||
"-76286259844766495292488",
|
||||
"-72818702579095290924243",
|
||||
"-69351145313424086671554"
|
||||
],
|
||||
[
|
||||
"0",
|
||||
"0",
|
||||
"0"
|
||||
]
|
||||
],
|
||||
"spot_count": 2,
|
||||
"perp_count": 1,
|
||||
"spot_balances": [
|
||||
{
|
||||
"product_id": 0,
|
||||
"balance": {
|
||||
"amount": "456895621098158389211471"
|
||||
}
|
||||
},
|
||||
{
|
||||
"product_id": 1,
|
||||
"balance": {
|
||||
"amount": "-600152323366021154"
|
||||
}
|
||||
}
|
||||
],
|
||||
"perp_balances": [
|
||||
{
|
||||
"product_id": 2,
|
||||
"balance": {
|
||||
"amount": "0",
|
||||
"v_quote_balance": "0",
|
||||
"last_cumulative_funding_x18": "-394223711772447555304"
|
||||
}
|
||||
}
|
||||
],
|
||||
"spot_products": [
|
||||
{
|
||||
"product_id": 0,
|
||||
"oracle_price_x18": "1000000000000000000",
|
||||
"risk": {
|
||||
"long_weight_initial_x18": "1000000000000000000",
|
||||
"short_weight_initial_x18": "1000000000000000000",
|
||||
"long_weight_maintenance_x18": "1000000000000000000",
|
||||
"short_weight_maintenance_x18": "1000000000000000000",
|
||||
"price_x18": "1000000000000000000"
|
||||
},
|
||||
"config": {
|
||||
"token": "0x5f65358d61a9a281ea3bb930d05889aca21e3f4f",
|
||||
"interest_inflection_util_x18": "800000000000000000",
|
||||
"interest_floor_x18": "10000000000000000",
|
||||
"interest_small_cap_x18": "40000000000000000",
|
||||
"interest_large_cap_x18": "1000000000000000000",
|
||||
"withdraw_fee_x18": "1000000000000000000",
|
||||
"min_deposit_rate_x18": "0"
|
||||
},
|
||||
"state": {
|
||||
"cumulative_deposits_multiplier_x18": "1000000000025524653",
|
||||
"cumulative_borrows_multiplier_x18": "1000347390837434279",
|
||||
"total_deposits_normalized": "20001011744258817298755054194662",
|
||||
"total_borrows_normalized": "1617724891363505323532211"
|
||||
},
|
||||
"book_info": {
|
||||
"size_increment": "0",
|
||||
"price_increment_x18": "0",
|
||||
"min_size": "0",
|
||||
"collected_fees": "0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"product_id": 1,
|
||||
"oracle_price_x18": "115555905748161505821744",
|
||||
"risk": {
|
||||
"long_weight_initial_x18": "900000000000000000",
|
||||
"short_weight_initial_x18": "1100000000000000000",
|
||||
"long_weight_maintenance_x18": "950000000000000000",
|
||||
"short_weight_maintenance_x18": "1050000000000000000",
|
||||
"price_x18": "115555905748161505821744"
|
||||
},
|
||||
"config": {
|
||||
"token": "0xc57c1c64561a37ac9e8f9039cb6deab7539d99fc",
|
||||
"interest_inflection_util_x18": "800000000000000000",
|
||||
"interest_floor_x18": "10000000000000000",
|
||||
"interest_small_cap_x18": "40000000000000000",
|
||||
"interest_large_cap_x18": "1000000000000000000",
|
||||
"withdraw_fee_x18": "40000000000000",
|
||||
"min_deposit_rate_x18": "0"
|
||||
},
|
||||
"state": {
|
||||
"cumulative_deposits_multiplier_x18": "1000000000000318713",
|
||||
"cumulative_borrows_multiplier_x18": "1000347390679880473",
|
||||
"total_deposits_normalized": "9000399823280682696107190850",
|
||||
"total_borrows_normalized": "9580268570661550719"
|
||||
},
|
||||
"book_info": {
|
||||
"size_increment": "1000000000000000",
|
||||
"price_increment_x18": "1000000000000000000",
|
||||
"min_size": "4000000000000000",
|
||||
"collected_fees": "0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"perp_products": [
|
||||
{
|
||||
"product_id": 2,
|
||||
"oracle_price_x18": "115596528090565357611177",
|
||||
"risk": {
|
||||
"long_weight_initial_x18": "950000000000000000",
|
||||
"short_weight_initial_x18": "1050000000000000000",
|
||||
"long_weight_maintenance_x18": "970000000000000000",
|
||||
"short_weight_maintenance_x18": "1030000000000000000",
|
||||
"price_x18": "115596528090565357611177"
|
||||
},
|
||||
"state": {
|
||||
"cumulative_funding_long_x18": "-394223711772447555304",
|
||||
"cumulative_funding_short_x18": "-394223711772447555304",
|
||||
"available_settle": "20092193239667417956947",
|
||||
"open_interest": "113605000000000000000"
|
||||
},
|
||||
"book_info": {
|
||||
"size_increment": "1000000000000000",
|
||||
"price_increment_x18": "1000000000000000000",
|
||||
"min_size": "4000000000000000",
|
||||
"collected_fees": "0"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"request_type": "query_subaccount_info"
|
||||
}
|
||||
```
|
||||
|
||||
### Example with `pre_state`
|
||||
|
||||
When you want to simulate transactions and compare the before/after states, you can use the `pre_state` parameter:
|
||||
|
||||
#### Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=subaccount_info&subaccount={subaccount}&txns=[{"apply_delta":{"product_id":2,"subaccount":"0xeae27ae6412147ed6d5692fd91709dad6dbfc34264656661756c740000000000","amount_delta":"100000000000000000","v_quote_delta":"3033500000000000000000"}}]&pre_state="true"`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "subaccount_info",
|
||||
"subaccount": "0xeae27ae6412147ed6d5692fd91709dad6dbfc34264656661756c740000000000",
|
||||
"txns": "[{\"apply_delta\":{\"product_id\":2,\"subaccount\":\"0xeae27ae6412147ed6d5692fd91709dad6dbfc34264656661756c740000000000\",\"amount_delta\":\"100000000000000000\",\"v_quote_delta\":\"3033500000000000000000\"}}]",
|
||||
"pre_state": "true"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
#### Response
|
||||
|
||||
The response will now include a `pre_state` field showing the state before the simulated transactions:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"subaccount": "0x8d7d64d6cf1d4f018dd101482ac71ad49e30c56064656661756c740000000000",
|
||||
"exists": true,
|
||||
"healths": [
|
||||
{
|
||||
"assets": "460000000000000000000000",
|
||||
"liabilities": "80000000000000000000000",
|
||||
"health": "380000000000000000000000"
|
||||
}
|
||||
],
|
||||
"health_contributions": [...],
|
||||
"spot_balances": [...],
|
||||
"perp_balances": [
|
||||
{
|
||||
"product_id": 2,
|
||||
"balance": {
|
||||
"amount": "100000000000000000",
|
||||
"v_quote_balance": "3033500000000000000000",
|
||||
"last_cumulative_funding_x18": "-394223711772447555304"
|
||||
}
|
||||
}
|
||||
],
|
||||
"spot_products": [...],
|
||||
"perp_products": [...],
|
||||
"pre_state": {
|
||||
"healths": [
|
||||
{
|
||||
"assets": "456895621098158389211471",
|
||||
"liabilities": "76286259844766495292488",
|
||||
"health": "380609361253391893918983"
|
||||
}
|
||||
],
|
||||
"health_contributions": [...],
|
||||
"spot_balances": [...],
|
||||
"perp_balances": [
|
||||
{
|
||||
"product_id": 2,
|
||||
"balance": {
|
||||
"amount": "0",
|
||||
"v_quote_balance": "0",
|
||||
"last_cumulative_funding_x18": "-394223711772447555304"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"request_type": "query_subaccount_info"
|
||||
}
|
||||
```
|
||||
|
||||
{% hint style="success" %}
|
||||
**Use Case**: The `pre_state` feature is particularly useful for:
|
||||
|
||||
* **Position Simulation**: Preview how a potential trade would affect your health and balances
|
||||
* **Risk Analysis**: Compare health metrics before and after simulated transactions
|
||||
* **UI/UX**: Display "before → after" views to users when they're about to execute trades
|
||||
* **Testing**: Validate transaction impacts without executing them on-chain
|
||||
{% endhint %}
|
||||
@@ -0,0 +1,103 @@
|
||||
# Symbols
|
||||
|
||||
## Rate limits
|
||||
|
||||
* 1200 requests/min or 20 requests/sec per IP address. (**weight = 2**)
|
||||
|
||||
{% hint style="info" %}
|
||||
See more details in [API Rate limits](https://docs.nado.xyz/developer-resources/api/rate-limits)
|
||||
{% endhint %}
|
||||
|
||||
## Request
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Websocket" %}
|
||||
**Connect**
|
||||
|
||||
<mark style="color:orange;">`WEBSOCKET [GATEWAY_WEBSOCKET_ENDPOINT]`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "symbols",
|
||||
"product_ids": [1, 2]
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (GET)" %} <mark style="color:green;">**GET**</mark> `[GATEWAY_REST_ENDPOINT]/query?type=symbols&product_type=spot`
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="REST (POST)" %} <mark style="color:orange;">`POST [GATEWAY_REST_ENDPOINT]/query`</mark>
|
||||
|
||||
**Message**
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "symbols",
|
||||
"product_ids": [1, 2, 3, 4],
|
||||
"product_type": "spot"
|
||||
}
|
||||
```
|
||||
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
## Request Parameters
|
||||
|
||||
<table><thead><tr><th width="155" align="center">Parameter</th><th width="108" align="center">Type</th><th width="132.125" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td align="center">product_ids</td><td align="center">number[]</td><td align="center">No</td><td>An array of product ids. Only available for POST and WS requests.</td></tr><tr><td align="center">product_type</td><td align="center">string</td><td align="center">No</td><td>Type of products to return, must be:<br>"spot" | "perp".</td></tr></tbody></table>
|
||||
|
||||
## Response
|
||||
|
||||
{% hint style="info" %}
|
||||
**Note**:
|
||||
|
||||
* All products have are quoted against USDT0, except for product 0.
|
||||
{% endhint %}
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"data": {
|
||||
"symbols": {
|
||||
"WBTC": {
|
||||
"type": "spot",
|
||||
"product_id": 1,
|
||||
"symbol": "WBTC",
|
||||
"price_increment_x18": "1000000000000000000",
|
||||
"size_increment": "1000000000000000",
|
||||
"min_size": "4000000000000000",
|
||||
"maker_fee_rate_x18": "0",
|
||||
"taker_fee_rate_x18": "200000000000000",
|
||||
"long_weight_initial_x18": "900000000000000000",
|
||||
"long_weight_maintenance_x18": "950000000000000000",
|
||||
"max_open_interest_x18": null
|
||||
},
|
||||
"BTC-PERP": {
|
||||
"type": "perp",
|
||||
"product_id": 2,
|
||||
"symbol": "BTC-PERP",
|
||||
"price_increment_x18": "1000000000000000000",
|
||||
"size_increment": "1000000000000000",
|
||||
"min_size": "4000000000000000",
|
||||
"maker_fee_rate_x18": "0",
|
||||
"taker_fee_rate_x18": "200000000000000",
|
||||
"long_weight_initial_x18": "950000000000000000",
|
||||
"long_weight_maintenance_x18": "970000000000000000",
|
||||
"max_open_interest_x18": null
|
||||
}
|
||||
}
|
||||
},
|
||||
"request_type": "query_symbols"
|
||||
}
|
||||
```
|
||||
|
||||
## Response fields
|
||||
|
||||
### Symbols
|
||||
|
||||
All numerical values are returned as strings and scaled by 1e18.
|
||||
|
||||
<table><thead><tr><th width="318">Field name</th><th>Description</th></tr></thead><tbody><tr><td>type</td><td>Product type, "spot" or "perp"</td></tr><tr><td>product_id</td><td>Product id</td></tr><tr><td>symbol</td><td>Product symbol</td></tr><tr><td>price_increment_x18</td><td>Price increment, a.k.a tick size</td></tr><tr><td>size_increment</td><td>Size increment, in base units</td></tr><tr><td>min_size</td><td>Minimum order size, in base units</td></tr><tr><td>maker_fee_rate_x18</td><td>Maker fee rate, given as decimal rate</td></tr><tr><td>taker_fee_rate_x18</td><td>Taker fee rate, given as decimal rate</td></tr><tr><td>long_weight_initial_x18</td><td>Long initial margin weight, given as decimal</td></tr><tr><td>long_weight_maintenance_x18</td><td>Long maintenance margin weight, given as decimal</td></tr><tr><td>max_open_interest_x18</td><td>Maximum open interest, null if no limit</td></tr></tbody></table>
|
||||
Reference in New Issue
Block a user