bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 27쪽 중 13쪽
rmation about the Spot Pair Deploy Auction
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/info`
Note: This returns the status of the Dutch auction for spot pair deployments between existing base and quote tokens. Participation in this auction is permissionless through the same action as the `registerSpot` phase of base token deployment.
#### Headers
| Name | Value |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | "application/json" |
#### Body
| Name | Type | Description |
| -------------------------------------- | ------ | ----------------------------- |
| type<mark style="color:red;">\*</mark> | String | "spotPairDeployAuctionStatus" |
{% tabs %}
{% tab title="200: OK Successful Response" %}
```json
{
"startTimeSeconds":1755468000,
"durationSeconds":111600,
"startGas":"500.0",
"currentGas":"500.0",
"endGas":null
}
```
{% endtab %}
{% endtabs %}
## Retrieve information about a token
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/info`
**Headers**
| Name | Value |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | "application/json" |
**Body**
| Name | Type | Description |
| ----------------------------------------- | ------ | --------------------------------------------------------------------------------------- |
| type<mark style="color:red;">\*</mark> | String | "tokenDetails" |
| tokenId<mark style="color:red;">\*</mark> | String | Onchain id in 34-character hexadecimal format; e.g. 0x00000000000000000000000000000000. |
**Response**
{% tabs %}
{% tab title="200: OK Successful Response" %}
```json
{
"name": "TEST",
"maxSupply": "1852229076.12716007",
"totalSupply": "851681534.05516005",
"circulatingSupply": "851681534.05516005",
"szDecimals": 0,
"weiDecimals": 5,
"midPx": "3.2049",
"markPx": "3.2025",
"prevDayPx": "3.2025",
"genesis": {
"userBalances": [
[
"0x0000000000000000000000000000000000000001",
"1000000000.0"
],
[
"0xffffffffffffffffffffffffffffffffffffffff",
"1000000000.0"
]
],
"existingTokenBalances": []
},
"deployer": "0x0000000000000000000000000000000000000001",
"deployGas": "100.0",
"deployTime": "2024-06-05T10:50:59.434",
"seededUsdc": "0.0",
"nonCirculatingUserBalances": [],
"futureEmissions": "0.0"
}
```
{% endtab %}
{% endtabs %}
## Retrieve outcome metadata
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/info`
**Headers**
| Name | Value |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | "application/json" |
**Body**
| Name | Type | Description |
| -------------------------------------- | ------ | ------------- |
| type<mark style="color:red;">\*</mark> | String | "outcomeMeta" |
**Response**
{% tabs %}
{% tab title="200: OK Successful Response" %}
```json
{
"outcomes": [
{
"outcome": 123,
"name": "Recurring",
"description": "class:priceBinary|underlying:HYPE|expiry:20260310-1100|targetPrice:34.5|period:3m",
"sideSpecs": [
{
"name": "Yes"
},
{
"name": "No"
}
]
}
]
}
```
{% endtab %}
{% endtabs %}
## Retrieve information about a settled outcome
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/info`
**Headers**
| Name | Value |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | "application/json" |
**Body**
| Name | Type | Description |
| ----------------------------------------- | ------ | ---------------- |
| type<mark style="color:red;">\*</mark> | String | "settledOutcome" |
| outcome<mark style="color:red;">\*</mark> | int | outcome |
**Response**
{% tabs %}
{% tab title="200: OK Successful Response" %}
```json
{
"spec": {
"outcome": 95,
"name": "Recurring",
"description": "class:priceBinary|underlying:BTC|expiry:20260526-0600|targetPrice:77363|period:1d",
"sideSpecs": [
{
"name": "Yes"
},
{
"name": "No"
}
],
"quoteToken": "USDC"
},
"settleFraction": "0.0",
"details": "price:76876.9"
}
```
{% endtab %}
{% endtabs %}
## Retrieve outcome deployer limits
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/info`
**Headers**
| Name | Value |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | "application/json" |
**Body**
| Name | Type | Description |
| --------------------------------------- | ------ | ----------------------- |
| type<mark style="color:red;">\*</mark> | String | "outcomeDeployerLimits" |
| venue<mark style="color:red;">\*</mark> | String | venue name |
**Response**
{% tabs %}
{% tab title="200: OK Successful Response" %}
```json
{
"nDailyOutcomesRemaining": 50,
"nActiveOutcomesRemaining": 14
}
```
{% endtab %}
{% endtabs %}
# Exchange endpoint
The exchange endpoint is used to interact with and trade on the Hyperliquid chain. See the Python SDK for code to generate signatures for these requests.
### Asset
Many of the requests take asset as an input. For perpetuals this is the index in the `universe` field returned by the`meta` response. For spot assets, use `10000 + index` where `index` is the corresponding index in `spotMeta.universe`. For example, when submitting an order for `PURR/USDC`, the asset that should be used is `10000` because its asset index in the spot metadata is `0`.
### Subaccounts and vaults
Subaccounts and vaults do not have private keys. To perform actions on behalf of a subaccount or vault signing should be done by the master account and the vaultAddress field should be set to the address of the subaccount or vault. The basic\_vault.py example in the Python SDK demonstrates this.
### Expires After
Some actions support an optional field `expiresAfter` which is a timestamp in milliseconds after which the action will be rejected. User-signed actions such as Core USDC transfer do not support the `expiresAfter` field. Note that actions consume 5x the usual address-based rate limit when canceled due to a stale `expiresAfter` field.
See the Python SDK for details on how to incorporate this field when signing.
## Place an order
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`
See Python SDK for full featured examples on the fields of the order request.
For limit orders, TIF (time-in-force) sets the behavior of the order upon first hitting the book.
ALO (add liquidity only, i.e. "post only") will be canceled instead of immediately matching.
IOC (immediate or cancel) will have the unfilled part canceled instead of resting.
GTC (good til canceled) orders have no special behavior.
Client Order ID (cloid) is an optional 128 bit hex string, e.g. `0x1234567890abcdef1234567890abcdef`
#### Headers
| Name | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |
#### Request Body
| Name | Type | Description | | | | | |
| ------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark> | Object | <p>{</p><p> "type": "order",<br> "orders": \[{</p><p> "a": Number,</p><p> "b": Boolean,</p><p> "p": String,</p><p> "s": String,</p><p> "r": Boolean,</p><p> "t": {</p><p> "limit": {</p><p> "tif": "Alo" | "Ioc" | "Gtc"</p><p> } or</p><p> "trigger": {</p><p> "isMarket": Boolean,</p><p> "triggerPx": String,</p><p> "tpsl": "tp" | "sl"</p><p> }</p><p> },</p><p> "c": Cloid (optional)</p><p> }],</p><p> "grouping": "na" | "normalTpsl" | "positionTpsl",</p><p> "builder": Optional({"b": "address", "f": Number})</p><p>}<br><br>Meaning of keys:<br>a is asset<br>b is isBuy<br>p is price<br>s is size<br>r is reduceOnly<br>t is type<br>c is cloid (client order id)<br><br>Meaning of keys in optional builder argument:<br>b is the address the should receive the additional fee<br>f is the size of the fee in tenths of a basis point e.g. if f is 10, 1bp of the order notional will be charged to the user and sent to the builder</p> |
| nonce<mark style="color:red;">\*</mark> | Number | Recommended to use the current timestamp in milliseconds | | | | | |
| signature<mark style="color:red;">\*</mark> | Object | | | | | | |
| vaultAddress | String | If trading on behalf of a vault or subaccount, its Onchain address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000 | | | | | |
| expiresAfter | Number | Timestamp in milliseconds | | | | | |
{% tabs %}
{% tab title="200: OK Successful Response (resting)" %}
```
{
"status":"ok",
"response":{
"type":"order",
"data":{
"statuses":[
{
"resting":{
"oid":77738308
}
}
]
}
}
}
```
{% endtab %}
{% tab title="200: OK Error Response" %}
```
{
"status":"ok",
"response":{
"type":"order",
"data":{
"statuses":[
{
"error":"Order must have minimum value of $10."
}
]
}
}
}
```
{% endtab %}
{% tab title="200: OK Successful Response (filled)" %}
```
{
"status":"ok",
"response":{
"type":"order",
"data":{
"statuses":[
{
"filled":{
"totalSz":"0.02",
"avgPx":"1891.4",
"oid":77747314
}
}
]
}
}
}
```
{% endtab %}
{% endtabs %}
## Cancel order(s)
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`
#### Headers
| Name | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |
#### Request Body
| Name | Type | Description |
| ------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark> | Object | <p>{</p><p> "type": "cancel",</p><p> "cancels": \[</p><p> {</p><p> "a": Number,</p><p> "o": Number</p><p> }</p><p> ],</p><p> "f": Boolean // fast</p><p>}<br><br>Meaning of keys:<br>a is asset<br>o is oid (order id)</p> |
| | | |
| nonce<mark style="color:red;">\*</mark> | Number | Recommended to use the current timestamp in milliseconds |
| signature<mark style="color:red;">\*</mark> | Object | |
| vaultAddress | String | If trading on behalf of a vault or subaccount, its address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000 |
| expiresAfter | Number | Timestamp in milliseconds |
{% tabs %}
{% tab title="200: OK Successful Response" %}
```
{
"status":"ok",
"response":{
"type":"cancel",
"data":{
"statuses":[
"success"
]
}
}
}
```
{% endtab %}
{% tab title="200: OK Error Response" %}
```
{
"status":"ok",
"response":{
"type":"cancel",
"data":{
"statuses":[
{
"error":"Order was never placed, already canceled, or filled."
}
]
}
}
}
```
{% endtab %}
{% endtabs %}
Both `cancel` and `cancelByCloid` actions include an optional `fast` flag, encoded as `f` in the action. Orders with `f: true` are rejected if they refer to trigger orders. Currently `fast` has no other effect. In a future network upgrade, cancel actions will be prioritized in the mempool if and only if `fast = true`.
Note that `f` must be skipped if false, i.e. actions hashed with `f: false` will be rejected.
## Cancel order(s) by cloid
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`
#### Headers
| Name | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |
#### Request Body
| Name | Type | Description |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| action<mark style="color:red;">\*</mark> | Object | <p>{</p><p> "type": "cancelByCloid",</p><p> "cancels": \[</p><p> {</p><p> "asset": Number,</p><p> "cloid": String</p><p> }</p><p> ],</p><p> "f": Boolean // fast</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark> | Number | Recommended to use the current timestamp in milliseconds |
| signature<mark style="color:red;">\*</mark> | Object | |
| vaultAddress | String | If trading on behalf of a vault or subaccount, its address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000 |
| expiresAfter | Number | Timestamp in milliseconds |
{% tabs %}
{% tab title="200: OK Successful Response" %}
{% endtab %}
{% tab title="200: OK Error Response" %}
{% endtab %}
{% endtabs %}
## Schedule cancel (dead man's switch)
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`
#### Headers
| Name | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |
#### Request Body
| Name | Type | Description |
| ------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark> | Object | <p>{</p><p> "type": "scheduleCancel",</p><p> "time": number (optional)</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark> | Number | Recommended to use the current timestamp in milliseconds |
| signature<mark style="color:red;">\*</mark> | Object | |
| vaultAddress | String | If trading on behalf of a vault or subaccount, its address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000 |
| expiresAfter | Number | Timestamp in milliseconds |
Schedule a cancel-all operation at a future time. Not including time will remove the scheduled cancel operation. The time must be at least 5 seconds after the current time. Once the time comes, all open orders will be canceled and a trigger count will be incremented. The max number of triggers per day is 10. This trigger count is reset at 00:00 UTC.
## Modify an order
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`
#### Headers
| Name | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |
#### Request Body
| Name | Type | Description | | | | |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark> | Object | <p>{</p><p> "type": "modify",</p><p> "oid": Number | Cloid,</p><p> "order": {</p><p> "a": Number,</p><p> "b": Boolean,</p><p> "p": String,</p><p> "s": String,</p><p> "r": Boolean,</p><p> "t": {</p><p> "limit": {</p><p> "tif": "Alo" | "Ioc" | "Gtc"</p><p> } or</p><p> "trigger": {</p><p> "isMarket": Boolean,</p><p> "triggerPx": String,</p><p> "tpsl": "tp" | "sl"</p><p> }</p><p> },</p><p> "c": Cloid (optional)</p><p> },</p><p> "a": Boolean // always\_place</p><p>}<br><br>Meaning of keys:<br>a is asset<br>b is isBuy<br>p is price<br>s is size<br>r is reduceOnly<br>t is type<br>c is cloid (client order id)</p> |
| nonce<mark style="color:red;">\*</mark> | Number | Recommended to use the current timestamp in milliseconds | | | | |
| signature<mark style="color:red;">\*</mark> | Object | | | | | |
| vaultAddress | String | If trading on behalf of a vault or subaccount, its Onchain address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000 | | | | |
| expiresAfter | Number | Timestamp in milliseconds | | | | |
{% tabs %}
{% tab title="200: OK Successful Response" %}
{% endtab %}
{% tab title="200: OK Error Response" %}
{% endtab %}
{% endtabs %}
Both single and batch modify actions include an optional `always_place` flag, encoded as `a` in the action. When `always_place = true` will place the new order regardless of whether the cancel succeeded. When `always_place = false` the new order must be a non-trigger order, and must have TIF = ALO or a non-executable order with TIF = GTC. In the latter case, TIF of the new order is overridden to ALO.
Note that `a` must be skipped if false, i.e. actions hashed with `a: false` will be rejected.
## Modify multiple orders
<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`
#### Headers
| Name | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |
#### Request Body
| Name | Type | Description | | | | |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark> | Object | <p>{</p><p> "type": "batchModify",</p><p> "modifies": \[{</p><p> "oid": Number | Cloid,</p><p> "order": {</p><p> "a": Number,</p><p> "b": Boolean,</p><p> "p": String,</p><p> "s": String,</p><p> "r": Boolean,</p><p> "t": {</p><p> "limit": {</p><p> "tif": "Alo" | "Ioc" | "Gtc"</p><p> } or</p><p> "trigger": {</p><p> "isMarket": Boolean,</p><p> "triggerPx": String,</p><p> "tpsl": "tp" | "sl"</p><p> }<프로젝트로 돌아가기