# Perpetual Trading API

### Unified Interface Domain Name：

Test environment：

{% hint style="info" %}
REST：<https://test-futures-api.ln.exchange>

WebSocket：wss\://test-futures-ws.ln.exchange/kline-api/ws
{% endhint %}

***

## Introduction

### Obtain API Key

* Many interfaces require API Key to access. Please create a user on the site first. Then call the interface: import nostr address and obtain API Key
* the API Key is displayed only once for security purposes. **Please keep your API key/secret**
* **never tell anyone your API key/secret**

### Signature

* First sort the parameters in ascending dictionary order of their parameter names
* traverses the sorted dictionary and splices all parameters together in the "keyvalue" format.
* **Plus your private key.**
* Using MD5 to Treat Signature String for Signing

{% code title="" lineNumbers="true" %}

```
String decodingSecret = "123456";
// First, sort the parameters in ascending order by their parameter names
Map<String, Object> sortedParams = new TreeMap<String, Object>(params);
Set<Map.Entry<String, Object>> entrys = sortedParams.entrySet();
// Traverse the sorted dictionary and concatenate all parameters in the "keyvalue" format
StringBuilder basestring = new StringBuilder();
for (Map.Entry<String, Object> param : entrys) {
    // Skip the signature field
    if("sign".equals(param.getKey())){
        continue;
    }

    if(!StringUtils.isBlank(param.getValue().toString())) {
        basestring.append(param.getKey());
        basestring.append(param.getValue().toString());
    }
}
basestring.append(decodingSecret);
// Use MD5 to sign the concatenated string
String curSign = MD5Util.getMD5(basestring.toString());
```

{% endcode %}

***

### REST Request Validation

All REST private request headers must contain the following

#### Request Header Parameters

| Parameter Name | Type   | Required | Description            |
| -------------- | ------ | -------- | ---------------------- |
| apikey         | String | **Yes**  | **API key**            |
| time           | String | **Yes**  | **13-digit timestamp** |
| sign           | String | **Yes**  | **Signature**          |

***

## API section-OPEN：

### Access to public information

* **URL**：`/napi/common/public_info`
* **Method**：`GET`
* **Login required:** N

#### Request Parameters

| Parameter Name | Type | Required | Description |
| -------------- | ---- | -------- | ----------- |
|                |      |          |             |

**Request Example**

```json
{}
```

#### Return parameter

| Parameters           | Type   | Description                     |
| -------------------- | ------ | ------------------------------- |
| nostrAddress         | String | NostrAddress                    |
| wsUrl                | String | WebSocket Connection Address    |
| currentTimeMillis    | String | Current timestamp               |
| marginCoinList       | List   | List of Margin Currencies       |
| coinList             | List   | Currency List                   |
| coin                 | String | currency Name                   |
| precious             | String | currency precision              |
| contractList         | List   | contract List                   |
| id                   | String | Contract ID                     |
| contractName         | String | contract Name                   |
| symbol               | String | transaction Pair Symbol         |
| closeMakerFee        | String | Maker fees                      |
| closeTakerFee        | String | Taker fee                       |
| base                 | String | base Currency                   |
| quote                | String | pricing Currency                |
| sort                 | String | sort Value                      |
| robot                | String | robot Address                   |
| coinResultVo         | Object | coin pair information           |
| symbolPricePrecision | String | trading Pair Price Precision    |
| minOrderVolume       | String | minimum Order Quantity          |
| minOrderMoney        | String | minimum Order Amount            |
| maxMarketVolume      | String | maximum Market Order Volume     |
| maxMarketMoney       | String | Maximum Market Order Amount     |
| maxLimitVolume       | String | maximum Limit Order Quantity    |
| maxLimitMoney        | String | maximum Limit Order Amount      |
| marginCoinPrecision  | String | currency precision              |
| depth                | List   | coin Pair Depth Precision Array |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "wsUrl": "wss://dev-futuresws.ln.exchange/kline-api/ws",
        "nostrAddress": "npub1pnvxt989e2udtnwxst46xn648rqtn0zlm4a5xdudhd0sx976hwfspyx227,
        "marginCoinList": [
            "USDT",
            "TREAT"
        ],
        "contractList": [
            {
                "id": 18,
                "contractName": "E-BTC-USDT",
                "symbol": "BTC-USDT",
                "contractType": "E",
                "coType": "E",
                "deliveryKind": "0",
                "contractSide": 1,
                "multiplier": 0.01,
                "multiplierCoin": "BTC",
                "marginCoin": "USDT",
                "marginRate": 1,
                "closeMakerFee": 0.0002,
                "closeTakerFee": 0.0005,
                "capitalStartTime": 0,
                "capitalFrequency": 8,
                "settlementFrequency": 1,
                "brokerId": 1000,
                "base": "BTC",
                "quote": "USDT",
                "coinResultVo": {
                    "symbolPricePrecision": 1,
                    "depth": [
                        "0"
                    ],
                    "minOrderVolume": 1,
                    "minOrderMoney": 200,
                    "maxMarketVolume": 10000,
                    "maxMarketMoney": 1000000,
                    "maxLimitVolume": 100000,
                    "maxLimitMoney": 1000000,
                    "priceRange": 9999999,
                    "marginCoinPrecision": 5,
                    "fundsInStatus": 1,
                    "fundsOutStatus": 1
                },
                "sort": 1,
                "maxLever": 125,
                "minLever": 0,
                "robot": "npub1pnvxt989e2udtnwxst46xn648rqtn0zlm4a5xdudhd0sx976hwfspyx227",
                "auditor": 90000097
            },
            {
                "id": 63,
                "contractName": "TREAT-BTC-USDT",
                "symbol": "BTC-USDT",
                "contractType": "TREAT",
                "coType": "H",
                "deliveryKind": "0",
                "contractSide": 1,
                "multiplier": 0.001,
                "multiplierCoin": "BTC",
                "marginCoin": "TREAT",
                "marginRate": 1,
                "closeMakerFee": 0.0002,
                "closeTakerFee": 0.0005,
                "capitalStartTime": 0,
                "capitalFrequency": 8,
                "settlementFrequency": 1,
                "brokerId": 1000,
                "base": "BTC",
                "quote": "USDT",
                "coinResultVo": {
                    "symbolPricePrecision": 1,
                    "depth": [
                        "0"
                    ],
                    "minOrderVolume": 1,
                    "minOrderMoney": 200,
                    "maxMarketVolume": 10000,
                    "maxMarketMoney": 1000000,
                    "maxLimitVolume": 100000,
                    "maxLimitMoney": 1000000,
                    "priceRange": 9999999,
                    "marginCoinPrecision": 0,
                    "fundsInStatus": 1,
                    "fundsOutStatus": 1
                },
                "sort": 29,
                "maxLever": 25,
                "minLever": 0,
                "robot": "npub19386mnlhrn35auvqrshujkyf7mm9pty8v2atkuhr04ka8zxazucq4kam4p",
                "auditor": 90000102
            }
        ],
        "currentTimeMillis": 1725609265656,
        "coinList": [
            {
                "coin": "BTC",
                "precious": 4,
                "fundsInStatus": 1,
                "fundsOutStatus": 1,
                "assetsId": "",
                "assetsPrecision": 100000000,
                "fundsInMinAmount": 0.0001,
                "fundsOutMinAmount": 0.0002,
                "fundsOutDuration": 60,
                "fundsOutDurationAmount": 3
            },
            {
                "coin": "USDT",
                "precious": 5,
                "fundsInStatus": 1,
                "fundsOutStatus": 1,
                "assetsId": "3f74dd174205195be44fbe6c49b9632b79cfb1c367160df902bb4d3d189e4cc8",
                "assetsPrecision": 1,
                "fundsInMinAmount": 0.01,
                "fundsOutMinAmount": 0.1,
                "fundsOutDuration": 60,
                "fundsOutDurationAmount": 5000
            },
            {
                "coin": "TREAT",
                "precious": 0,
                "fundsInStatus": 1,
                "fundsOutStatus": 1,
                "assetsId": "b6c698a6d8f0d8e30fc4dd937e6f4034d6ca62e83a0a02f22a8a500ed58908cf",
                "assetsPrecision": 1,
                "fundsInMinAmount": 5,
                "fundsOutMinAmount": 10,
                "fundsOutDuration": 60,
                "fundsOutDurationAmount": 1000
            }
        ]
    },
    "succ": true
}
```

***

### Get list of outstanding orders

* **URL**：`/open/v1/openOrders`
* **Method**：`POST`
* **Login required**：Y

#### Request Parameters

| Parameter Name | Type   | Required | Description   |
| -------------- | ------ | -------- | ------------- |
| contractName   | String | yes      | Contract Name |

**Request Example**

```json
{"contractName":"E-BTC-USDT"}
```

#### Return parameters

| Parameter Name | Type   | Description                                                                                              |
| -------------- | ------ | -------------------------------------------------------------------------------------------------------- |
| orderId        | String | Order id                                                                                                 |
| contractName   | String | contract Name                                                                                            |
| price          | String | order Price                                                                                              |
| origQty        | String | order quantity                                                                                           |
| executedQty    | String | number of transactions                                                                                   |
| avgPrice       | String | average Transaction Price                                                                                |
| status         | String | order Status (Order Status: 0 init,1 new,2 filled,3 part\_filled,4 canceled,5 pending\_cancel,6 expired) |
| type           | Strin  | order Type (1 limit; 2 market;)                                                                          |
| timeInForce    | String | order Type (1 limit; 2 market;)                                                                          |
| side           | String | BUY and SELL direction (BUY BUY, SELL SELL)                                                              |
| transactTime   | String | creation time                                                                                            |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": [
        {
            "side": "BUY",
            "executedQty": 0E-16,
            "orderId": 2110961582587810435,
            "price": 65000.0000000000000000,
            "origQty": 1.0000000000000000,
            "avgPrice": 0E-8,
            "transactTime": 1710825215000,
            "action": "OPEN",
            "contractName": "E-BTC-USDT",
            "type": "LIMIT",
            "timeInForce": "",
            "status": "INIT"
        }
    ],
    "succ": true
}
```

### Get Transaction Details

* **URL**：`/open/v1/myTrades`
* **Method**：`POST`
* **Login required:** Y

#### Request Parameters

| Parameter Name | Type   | Required | Description                                          |
| -------------- | ------ | -------- | ---------------------------------------------------- |
| contractName   | String | Yes      | Contract Name                                        |
| limit          | String | no       | get the number of bars: the default 100 maximum 1000 |
| fromId         | String | no       | query start ID (this ID is not included)             |

**Request Example**

```json
{"contractName":"E-BTC-USDT","limit":"100","fromId":"123456"}
```

#### Return parameters

| Parameters   | type   | description                                                        |
| ------------ | ------ | ------------------------------------------------------------------ |
| price        | String | Transaction Price                                                  |
| volume       | String | number of transactions                                             |
| amount       | String | transaction amount                                                 |
| contractName | String | contract Name                                                      |
| time         | String | transaction time                                                   |
| side         | Strin  | BUY and SELL direction (BUY BUY, SELL SELL)                        |
| fee          | String | fees                                                               |
| bidId        | String | pay id                                                             |
| askId        | String | selling order id                                                   |
| bidUserId    | String | pay user ID                                                        |
| askUserId    | String | sell order user ID                                                 |
| isBuyer      | String | buyer (true buyer, false seller)                                   |
| tradeId      | String | the ID of the transaction details.                                 |
| isMaker      | String | Whether the order is pending (ture order taker, false order taker) |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": [
        {
            "amount": 67000.000,
            "side": "BUY",
            "fee": "0.0008",
            "isMaker": true,
            "isBuyer": true,
            "bidId": 2110903085133234196,
            "bidUserId": 90000123,
            "volume": 1.0000000000000000,
            "price": 67000.0000000000000000,
            "askId": 2110903085133234197,
            "contractName": "E-BTC-USDT",
            "time": 1710695925000,
            "tradeId": 1154932,
            "askUserId": 90000123
        }
    ],
    "succ": true
}
```

***

### Batch Order & Batch Withdrawal

* **URL**：`/open/v1/batchOrders`
* **Method**：`POST`
* **Login required:** Y

#### Request Parameters

| Parameter Name | Type   | Required | Description                                             |
| -------------- | ------ | -------- | ------------------------------------------------------- |
| contractName   | String | Yes      | Contract Name                                           |
| orders         | List   | yes      | order List                                              |
| side           | String | yes      | BUY and SELL direction (BUY BUY, SELL SELL)             |
| open           | String | yes      | OPEN position direction (OPEN position, CLOSE position) |
| type           | String | yes      | order type (1 limit, 2 market,3 IOC,4 FOK,5 POST\_ONLY) |
| volume         | String | yes      | order quantity                                          |
| price          | String | no       | order Price                                             |
| clientOrderId  | String | no       | client order ID                                         |
| orderIds       | List   | yes      | List of cancellation ID                                 |

**Request Example (Bulk Order)**

```json
{"contractName":"E-BTC-USDT","orders":"[{\"volume\":1,\"side\":\"BUY\",\"open\":\"OPEN\",\"price\":50000,\"type\":1}]"}
```

**Request Example (Bulk Withdrawal)**

```json
{"contractName":"E-BTC-USDT","orderIds":"[2368243249036902927,2368243249036902921]"}
```

#### Return parameters

| Parameters | type | description                                              |
| ---------- | ---- | -------------------------------------------------------- |
| ids        | List | Successful order ID list                                 |
| cancelIds  | List | list of order withdrawal ID when placing an order failed |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "ids": [
            "2116489841153081344"
        ],
        "cancelIds": []
    },
    "succ": true
}
```

### Get depth list

* **URL**：`/open/v1/depth`
* **Method**：`POST`
* **Login required**：N

#### Request Parameters

| Parameter Name | Type   | Required | Description                                         |
| -------------- | ------ | -------- | --------------------------------------------------- |
| contractName   | String | Yes      | contract Name                                       |
| limit          | String | no       | get the number of bars: the default 100 maximum 100 |

**Request Example**

```json
{"contractName":"E-BTC-USDT","limit":"100"}
```

#### Return parameters

| Parameters | type   | description      |
| ---------- | ------ | ---------------- |
| asks       | String | Sale order depth |
| bids       | String | paying Depth     |
| time       | String | latest timestamp |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "asks": [
            [
                65810,
                0.9845
            ],
            [
                65794,
                1.2804
            ],
            [
                65761,
                1.3675
            ]
        ],
        "bids": [
            [
                65834,
                1.4365
            ],
            [
                65992,
                1.4689
            ],
            [
                66008,
                0.242
            ]
        ],
        "time": null
    },
    "succ": true
}
```

***

### Batch withdrawal of all orders

* **URL**：`/open/v1/cancelAll`
* **Method**：`POST`
* **Login required:** Y

#### Request Parameters

| Parameter Name | Type   | Required | Description   |
| -------------- | ------ | -------- | ------------- |
| contractName   | String | Yes      | Contract Name |

**Request Example**

```json
{"contractName":"E-BTC-USDT"}
```

#### Return parameters

| Parameters | type | description |
| ---------- | ---- | ----------- |
|            |      |             |

#### Return Results

```json
{
    "code": 0,
    "msg": "SUCCESS",
    "time": 1707121453886,
    "data": []
}
```

***

### View account balance

* **URL**：`/open/v1/account`
* **Method**：`POST`
* **Login required:** Y

#### Request Parameters

| Parameter Name | Type | Required | Description |
| -------------- | ---- | -------- | ----------- |
|                |      |          |             |

**Request Example**

```json
{}
```

#### Return parameters

| Parameters            | type   | description                                                                                                         |
| --------------------- | ------ | ------------------------------------------------------------------------------------------------------------------- |
| data                  | List   | Asset List                                                                                                          |
| accountNormal         | String | available                                                                                                           |
| accountLock           | String | freeze                                                                                                              |
| marginCoin            | String | currency of margin                                                                                                  |
| partPositionNormal    | String | position-by-position margin balance                                                                                 |
| totalPositionNormal   | String | initial margin occupied by a full position                                                                          |
| achievedAmount        | String | realized profit and loss                                                                                            |
| unrealizedAmount      | String | unrealized profit and loss                                                                                          |
| totalMarginRate       | String | Full position margin rate                                                                                           |
| totalEquity           | String | full Position Equity                                                                                                |
| partEquity            | String | position-by-position equity                                                                                         |
| totalCost             | String | cost of full warehouse occupancy                                                                                    |
| sumMarginRate         | String | margin rate for full account                                                                                        |
|                       |        |                                                                                                                     |
| positionVos           | List   | position collection                                                                                                 |
| contractId            | String | contract id                                                                                                         |
| contractName          | String | contract Name                                                                                                       |
| contractSymbol        | String | contract currency exchange                                                                                          |
| positions             | List   | position collection                                                                                                 |
| positionType          | String | position type (1 full position, 2 positions one by one)                                                             |
| side                  | String | BUY and SELL direction (BUY BUY, SELL SELL)                                                                         |
| volume                | String | Number of Positions                                                                                                 |
| openPrice             | String | opening Price                                                                                                       |
| avgPrice              | String | average price of position                                                                                           |
| closePrice            | String | average closing price                                                                                               |
| leverageLevel         | String | leverage multiple                                                                                                   |
| openAmount            | String | opening margin (including Variation)                                                                                |
| holdAmount            | String | position Margin                                                                                                     |
| closeVolume           | String | number of closed positions                                                                                          |
| pendingCloseVolume    | String | the number of open positions that have been hung out.                                                               |
| realizedAmount        | String | Realized profit and loss                                                                                            |
| historyRealizedAmount | String | historical cumulative realized profit and loss                                                                      |
| tradeFee              | String | Transaction Fees                                                                                                    |
| capitalFee            | String | capital expenses                                                                                                    |
| closeProfit           | String | closing profit and loss                                                                                             |
| shareAmount           | String | apportioned amount                                                                                                  |
| freezeLock            | String | position freeze status: 0 normal, 1 burst freeze, 2 delivery freeze                                                 |
| status                | String | position validity, 0 invalid 1 valid                                                                                |
| marginRate            | String | margin rate                                                                                                         |
| reducePrice           | String | price reduction                                                                                                     |
| returnRate            | String | rate of Return (Yield)                                                                                              |
| unRealizedAmount      | String | unrealized profit and loss                                                                                          |
| openRealizedAmount    | String | unrealized profit or loss on opening position                                                                       |
| positionBalance       | String | position Value                                                                                                      |
| settleProfit          | String | position settlement (current number of positions, average opening price and average position price profit and loss) |
| indexPrice            | String | Latest Mark Price                                                                                                   |
| keepRate              | String | ladder Minimum Maintenance Margin Rate                                                                              |
| maxFeeRate            | String | maximum commission rate for closing positions                                                                       |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": [
        {
            "marginCoin": "USDT",
            "accountNormal": 95344.6858935000000000,
            "accountLock": 500.0000000000000000,
            "partPositionNormal": 79501.8235017791283000,
            "totalPositionNormal": 0,
            "achievedAmount": 0E-16,
            "unrealizedAmount": 33.70439150400000000000000000000000000000000000000000000000,
            "totalMarginRate": 0,
            "totalEquity": 95344.6858935000000000,
            "partEquity": 79535.52789328312830000000000000000000000000000000000000000000,
            "totalCost": 0,
            "sumMarginRate": 1.2656772919895387,
            "positionVos": [
                {
                    "contractId": 18,
                    "contractName": "E-BTC-USDT",
                    "contractSymbol": "BTC-USDT",
                    "positions": [
                        {
                            "id": 1637,
                            "uid": 90000161,
                            "contractId": 18,
                            "positionType": 2,
                            "side": "BUY",
                            "volume": 210.0000000000000000,
                            "openPrice": 60846.8571428600000000,
                            "avgPrice": 65983.9502897600000000,
                            "closePrice": 0E-16,
                            "leverageLevel": 100,
                            "openAmount": 0E-16,
                            "holdAmount": 78805.7116950341283000,
                            "closeVolume": 0E-16,
                            "pendingCloseVolume": 0E-16,
                            "realizedAmount": 0E-16,
                            "historyRealizedAmount": 77527.9276950341283000,
                            "tradeFee": -42.6620100000000000,
                            "capitalFee": 4850.5162152834360500,
                            "closeProfit": 0E-16,
                            "shareAmount": 0E-16,
                            "freezeLock": 0,
                            "status": 1,
                            "ctime": "2024-07-12T10:31:37",
                            "mtime": "2024-09-06T15:54:54",
                            "brokerId": 1000,
                            "marginRate": 0.5689653154132829,
                            "reducePrice": 28586.0581729505975461,
                            "returnRate": 8.4690370203363728,
                            "unRealizedAmount": 33.70439150400000000000000000000000000000000000000000000000,
                            "openRealizedAmount": 10821.59999999400000000000000000000000000000000000000000000000,
                            "positionBalance": 138566.29560849600000000000000000000000000000000000000000000000,
                            "settleProfit": 10787.89560849000000000000000000000000000000000000000000000000,
                            "indexPrice": 66000,
                            "keepRate": 0.004,
                            "maxFeeRate": 0.00050
                        }
                    ]
                }
            ],
            "totalHisRealizeAmount": null,
            "accountAmount": null,
            "totalShareAmount": null
        },
        {
            "marginCoin": "TREAT",
            "accountNormal": 0E-16,
            "accountLock": 0E-16,
            "partPositionNormal": 0E-16,
            "totalPositionNormal": 0,
            "achievedAmount": 0,
            "unrealizedAmount": 0,
            "totalMarginRate": 0,
            "totalEquity": 0E-16,
            "partEquity": 0E-16,
            "totalCost": 0,
            "sumMarginRate": 0,
            "positionVos": [],
            "totalHisRealizeAmount": null,
            "accountAmount": null,
            "totalShareAmount": null
        }
    ],
    "succ": true
}
```

***

## API part-NAPI-direct call：

### Interaction-Nostr part：

Before making a request to any interface, you must sign the request parameters through the Nostr protocol.

**Parameter Description**

| Parameter Name | Type   | Required | Description                                                                                                                              |
| -------------- | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| sig            | String | Yes      | Event entire signature                                                                                                                   |
| kind           | String | yes      | Event Type:(1 plaintext; 4 ciphertext;)                                                                                                  |
| created\_at    | String | yes      | Event timestamp                                                                                                                          |
| id             | String | yes      | Event message ID                                                                                                                         |
| content        | String | yes      | Event Content: (AES/CBC/PKCS5Padding) encryption required,(? The first half of iv =) is base64Message ,(? The second half of iv =) is iv |
| pubkey         | String | yes      | fields returned by the public\_info interface: nostrAddress                                                                              |
| tags           | String | yes      | p: User nostrAddress r:json                                                                                                              |

**Request Sample**

```json
{
    "sig": "5375cda2249722881fdfd9fdd69edd861e93769f596ad76dfded3e576835b24406c52e66e85cf891630c7e088007fdf9dd282fadc47cdc0cd7a35f3fe71a385d",
    "kind": 4,
    "created_at": 1710325923,
    "id": "503c2610bb82b3672ccae9f8c8686672f245e2a837ad4bd50974481533d1d754",
    "content": "7moMWXa8coPGUJ20AosrlDJozo9kGgmtmgs2xlJnRXdOVyRGepCje1FeoYBfa4UPBO7nIC7F5Ii8nNiyahMZFA==?iv=EmF1gfPCxiiJiDANRtvUrA==",
    "pubkey": "0077fe56d9e72bff869021308c74ac79ce6d6f103a4f7e2b3db088ac0bfcf324",
    "tags": [
        [
            "p",
            "443fa483535b0d99937ed54553802b64e2dc2f30ede3dc6df11a51f7771e09a5"
        ],
        [
            "r",
            "json"
        ]
    ]
}
```

***

### Access to public information

* **URL**：`/napi/common/public_info`
* **Method**：`GET`
* **Login required:** N

#### Request Parameters

| Parameter Name | Type | Required | Description |
| -------------- | ---- | -------- | ----------- |
|                |      |          |             |

**Request Example**

```json
{}
```

#### Return parameters

| Parameters           | type   | description                     |
| -------------------- | ------ | ------------------------------- |
| nostrAddress         | String | Nostr address                   |
| wsUrl                | String | WebSocket connection address    |
| currentTimeMillis    | String | current timestamp               |
| marginCoinList       | List   | list of Margin Currencies       |
| coinList             | List   | currency List                   |
| coin                 | String | currency Name                   |
| precious             | String | currency precision              |
| contractList         | List   | contract List                   |
| id                   | String | contract ID                     |
| contractName         | String | contract Name                   |
| symbol               | String | transaction Pair Symbol         |
| closeMakerFee        | String | Maker fees                      |
| closeTakerFee        | String | Taker fee                       |
| base                 | String | base Currency                   |
| quote                | String | pricing Currency                |
| sort                 | String | sort Value                      |
| robot                | String | robot Address                   |
| coinResultVo         | Object | coin pair information           |
| symbolPricePrecision | String | trading Pair Price Precision    |
| minOrderVolume       | String | minimum Order Quantity          |
| minOrderMoney        | String | minimum Order Amount            |
| maxMarketVolume      | String | maximum Market Order Volume     |
| maxMarketMoney       | String | maximum Market Order Amount     |
| maxLimitVolume       | String | maximum Limit Order Quantity    |
| maxLimitMoney        | String | maximum Limit Order Amount      |
| marginCoinPrecision  | String | currency precision              |
| depth                | List   | Coin Pair Depth Precision Array |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "wsUrl": "wss://dev-futuresws.ln.exchange/kline-api/ws",
        "nostrAddress": "npub1pnvxt989e2udtnwxst46xn648rqtn0zlm4a5xdudhd0sx976hwfspyx227,
        "marginCoinList": [
            "USDT",
            "TREAT"
        ],
        "contractList": [
            {
                "id": 18,
                "contractName": "E-BTC-USDT",
                "symbol": "BTC-USDT",
                "contractType": "E",
                "coType": "E",
                "deliveryKind": "0",
                "contractSide": 1,
                "multiplier": 0.01,
                "multiplierCoin": "BTC",
                "marginCoin": "USDT",
                "marginRate": 1,
                "closeMakerFee": 0.0002,
                "closeTakerFee": 0.0005,
                "capitalStartTime": 0,
                "capitalFrequency": 8,
                "settlementFrequency": 1,
                "brokerId": 1000,
                "base": "BTC",
                "quote": "USDT",
                "coinResultVo": {
                    "symbolPricePrecision": 1,
                    "depth": [
                        "0"
                    ],
                    "minOrderVolume": 1,
                    "minOrderMoney": 200,
                    "maxMarketVolume": 10000,
                    "maxMarketMoney": 1000000,
                    "maxLimitVolume": 100000,
                    "maxLimitMoney": 1000000,
                    "priceRange": 9999999,
                    "marginCoinPrecision": 5,
                    "fundsInStatus": 1,
                    "fundsOutStatus": 1
                },
                "sort": 1,
                "maxLever": 125,
                "minLever": 0,
                "robot": "npub1pnvxt989e2udtnwxst46xn648rqtn0zlm4a5xdudhd0sx976hwfspyx227",
                "auditor": 90000097
            },
            {
                "id": 63,
                "contractName": "TREAT-BTC-USDT",
                "symbol": "BTC-USDT",
                "contractType": "TREAT",
                "coType": "H",
                "deliveryKind": "0",
                "contractSide": 1,
                "multiplier": 0.001,
                "multiplierCoin": "BTC",
                "marginCoin": "TREAT",
                "marginRate": 1,
                "closeMakerFee": 0.0002,
                "closeTakerFee": 0.0005,
                "capitalStartTime": 0,
                "capitalFrequency": 8,
                "settlementFrequency": 1,
                "brokerId": 1000,
                "base": "BTC",
                "quote": "USDT",
                "coinResultVo": {
                    "symbolPricePrecision": 1,
                    "depth": [
                        "0"
                    ],
                    "minOrderVolume": 1,
                    "minOrderMoney": 200,
                    "maxMarketVolume": 10000,
                    "maxMarketMoney": 1000000,
                    "maxLimitVolume": 100000,
                    "maxLimitMoney": 1000000,
                    "priceRange": 9999999,
                    "marginCoinPrecision": 0,
                    "fundsInStatus": 1,
                    "fundsOutStatus": 1
                },
                "sort": 29,
                "maxLever": 25,
                "minLever": 0,
                "robot": "npub19386mnlhrn35auvqrshujkyf7mm9pty8v2atkuhr04ka8zxazucq4kam4p",
                "auditor": 90000102
            }
        ],
        "currentTimeMillis": 1725609265656,
        "coinList": [
            {
                "coin": "BTC",
                "precious": 4,
                "fundsInStatus": 1,
                "fundsOutStatus": 1,
                "assetsId": "",
                "assetsPrecision": 100000000,
                "fundsInMinAmount": 0.0001,
                "fundsOutMinAmount": 0.0002,
                "fundsOutDuration": 60,
                "fundsOutDurationAmount": 3
            },
            {
                "coin": "USDT",
                "precious": 5,
                "fundsInStatus": 1,
                "fundsOutStatus": 1,
                "assetsId": "3f74dd174205195be44fbe6c49b9632b79cfb1c367160df902bb4d3d189e4cc8",
                "assetsPrecision": 1,
                "fundsInMinAmount": 0.01,
                "fundsOutMinAmount": 0.1,
                "fundsOutDuration": 60,
                "fundsOutDurationAmount": 5000
            },
            {
                "coin": "TREAT",
                "precious": 0,
                "fundsInStatus": 1,
                "fundsOutStatus": 1,
                "assetsId": "b6c698a6d8f0d8e30fc4dd937e6f4034d6ca62e83a0a02f22a8a500ed58908cf",
                "assetsPrecision": 1,
                "fundsInMinAmount": 5,
                "fundsOutMinAmount": 10,
                "fundsOutDuration": 60,
                "fundsOutDurationAmount": 1000
            }
        ]
    },
    "succ": true
}
```

***

### Get all tag prices and index prices

* **URL**：`/napi/common/public_all_index_tag_price`
* **Method**：`GET`
* **Login required**：N

#### Request Parameters

| Parameter Name | Type | Required | Description |
| -------------- | ---- | -------- | ----------- |
|                |      |          |             |

**Request Example**

```json
{}
```

#### Return parameters

| Parameters      | type   | description          |
| --------------- | ------ | -------------------- |
| contract\_name  | String | Contract Name        |
| currentFundRate | String | current Funding Rate |
| tag\_price      | String | tag Price            |
| index\_price    | String | index price          |
| nextFundRate    | String | next Fund Rate       |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": [
        {
            "currentFundRate": "0.0037500000000000",
            "tag_price": "65998.6662470565391541",
            "index_price": "55739",
            "contract_name": "E-BTC-USDT",
            "nextFundRate": "0.0037500000000000"
        },
        {
            "currentFundRate": "0.0037500000000000",
            "tag_price": "65998.6662470565391541",
            "index_price": "55739",
            "contract_name": "TREAT-BTC-USDT",
            "nextFundRate": "0.0037500000000000"
        }
    ],
    "succ": true
}
```

***

### Get depth list

* **URL**：`/napi/market/depth`
* **Method**：`POST`
* **Login required:** N

#### Request Parameters

| Parameter Name | Type   | Required | Description                                         |
| -------------- | ------ | -------- | --------------------------------------------------- |
| contractName   | String | Yes      | contract Name                                       |
| limit          | String | no       | get the number of bars: the default 100 maximum 100 |

**Request Example**

```json
{"contractName":"E-BTC-USDT","limit":"100"}
```

#### Return parameters

| Parameters | type   | description      |
| ---------- | ------ | ---------------- |
| asks       | String | Sale order depth |
| bids       | String | paying Depth     |
| time       | String | latest timestamp |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "asks": [
            [
                65810,
                0.9845
            ],
            [
                65794,
                1.2804
            ],
            [
                65761,
                1.3675
            ]
        ],
        "bids": [
            [
                65834,
                1.4365
            ],
            [
                65992,
                1.4689
            ],
            [
                66008,
                0.242
            ]
        ],
        "time": null
    },
    "succ": true
}
```

***

### Open currency exchange account

* **URL**：`/napi/user/enable_trade`
* **Method**：`POST`
* **Login required:** Y

#### Request Parameters

| Parameter Name | Type   | Required | Description   |
| -------------- | ------ | -------- | ------------- |
| contractName   | String | Yes      | contract Name |

**Request Example**

```json
{"contractName":"E-BTC-USDT"}
```

#### Return parameters

| Parameters | type   | description              |
| ---------- | ------ | ------------------------ |
| code       | String | Successful opening for 0 |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": true,
    "succ": true
}
```

***

### Get user current delegate and current conditional delegate count

* **URL**：`/napi/order/get_user_order_count`
* **Method**：`POST`
* **Login required**：Y

#### Request Parameters

| **Parameter Name** | **Type** | **Required** | **Description** |
| ------------------ | -------- | ------------ | --------------- |
| contractName       | String   | Yes          | Contract Name   |

**Request Example**

```json
{"contractName":"E-BTC-USDT"}
```

#### Return parameters

| Parameters        | type   | description                      |
| ----------------- | ------ | -------------------------------- |
| orderCount        | String | Normal Current Delegation Count  |
| triggerOrderCount | String | condition Current Delegate Count |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "orderCount": 1,
        "triggerOrderCount": 0
    },
    "succ": true
}
```

***

### Get the list of current delegates

* **URL**：`/napi/order/current_order_list`
* **Method**：`POST`
* **Login required**：Y

#### Request Parameters

| Parameter Name | Type   | Required | Description            |
| -------------- | ------ | -------- | ---------------------- |
| contractName   | String | Yes      | contract Name          |
| page           | String | no       | page number: Default 1 |
| limit          | String | no       | number: default 100    |

**Request Example**

```json
{"contractName":"E-BTC-USDT","page":1,"limit":100}
```

#### Return parameters

| Parameters     | type   | description                                                                                                                                  |
| -------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| count          | String | Total                                                                                                                                        |
| orderList      | List   | order                                                                                                                                        |
| symbol         | String | transaction Pair                                                                                                                             |
| pricePrecision | String | price precision                                                                                                                              |
| eventId        | String | event ID                                                                                                                                     |
| side           | String | BUY and SELL direction (BUY BUY, SELL SELL)                                                                                                  |
| address        | String | user Address                                                                                                                                 |
| avgPrice       | String | average Transaction Price                                                                                                                    |
| tradeFee       | String | transaction Fees                                                                                                                             |
| memo           | String | order Status Remarks                                                                                                                         |
| type           | String | order type (1 limit; 2 market; 3 IOC; 4 FOK; 5 POST\_ONLY; 6 warehouse explosion, only displayed on the page, not recorded in the database;) |
| mtime          | String | Update time                                                                                                                                  |
| volume         | String | order quantity                                                                                                                               |
| dealVolume     | String | number of transactions                                                                                                                       |
| price          | String | order Price                                                                                                                                  |
| ctime          | String | creation time                                                                                                                                |
| contractName   | String | contract Name                                                                                                                                |
| id             | String | order ID                                                                                                                                     |
| orderBalance   | String | order Balance                                                                                                                                |
| dealMoney      | String | amount of transactions                                                                                                                       |
| status         | String | order Status (Order Status: 0 init,1 new,2 filled,3 part\_filled,4 canceled,5 pending\_cancel,6 expired)                                     |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "count": 1,
        "orderList": [
            {
                "symbol": "BTC-USDT",
                "pricePrecision": 2,
                "eventId": "684db9069089bfb339fcc64ed89f91eb9ac9870ca569b8286286d90428bde804",
                "side": "BUY",
                "address": "npub1z8vkcn30lrt6uwmkhrslnw43qglzrhudx0aw3ervkfrfv4gs20wq3rt8zq",
                "positionType": 1,
                "avgPrice": 0E-8,
                "tradeFee": 0E-16,
                "memo": 0,
                "type": 1,
                "mtime": 1710832100000,
                "volume": 1.0000000000000000,
                "dealVolume": 0E-16,
                "price": 60000.0000000000000000,
                "ctime": 1710832100000,
                "contractName": "E-BTC-USDT",
                "id": "2115623941386416880",
                "orderBalance": 60000.00000000000000000000000000000000000000000000000000000000,
                "dealMoney": 0E-16,
                "status": 0
            }
        ]
    },
    "succ": true
}
```

***

### Obtain the historical delegation list.

* **URL**：`/napi/order/history_order_list`
* **Method**：`POST`
* **Login required**：Y

#### Request Parameters

| Parameter Name | Type   | Required | Description            |
| -------------- | ------ | -------- | ---------------------- |
| contractName   | String | Yes      | contract Name          |
| wallet         | String | yes      | wallet address         |
| page           | String | no       | page number: Default 1 |
| limit          | String | no       | number: default 100    |

**Request Example**

```json
{"contractName":"E-BTC-USDT","wallet":"npub18luy0zu5gmllkwsyel3xaz5h33qgschq6kt7es3vuezg749pkdjs941234","page":1,"limit":200}
```

#### Return parameters

| Parameters     | Type   | Description                                                                                                                                  |
| -------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| count          | String | Total                                                                                                                                        |
| orderList      | List   | order                                                                                                                                        |
| symbol         | String | transaction Pair                                                                                                                             |
| pricePrecision | String | price precision                                                                                                                              |
| eventId        | String | event ID                                                                                                                                     |
| side           | String | BUY and SELL direction (BUY BUY, SELL SELL)                                                                                                  |
| address        | String | user Address                                                                                                                                 |
| avgPrice       | String | average Transaction Price                                                                                                                    |
| tradeFee       | String | transaction Fees                                                                                                                             |
| memo           | String | order Status Remarks                                                                                                                         |
| type           | String | order type (1 limit; 2 market; 3 IOC; 4 FOK; 5 POST\_ONLY; 6 warehouse explosion, only displayed on the page, not recorded in the database;) |
| mtime          | String | Update time                                                                                                                                  |
| volume         | String | order quantity                                                                                                                               |
| dealVolume     | String | number of transactions                                                                                                                       |
| price          | String | order Price                                                                                                                                  |
| ctime          | String | creation time                                                                                                                                |
| contractName   | String | contract Name                                                                                                                                |
| id             | String | order ID                                                                                                                                     |
| orderBalance   | String | order Balance                                                                                                                                |
| dealMoney      | String | amount of transactions                                                                                                                       |
| status         | String | order Status (Order Status: 0 init,1 new,2 filled,3 part\_filled,4 canceled,5 pending\_cancel,6 expired)                                     |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "count": 6,
        "orderList": [
            {
                "symbol": "BTC-USDT",
                "pricePrecision": 2,
                "eventId": "4ef6a6d0169d7622c449edad7932befc2998902b1258187cbf2ede8a8715850c",
                "side": "BUY",
                "address": "npub1z8vkcn30lrt6uwmkhrslnw43qglzrhudx0aw3ervkfrfv4gs20wq3rt8zq",
                "avgPrice": 65000.00000000,
                "tradeFee": 0.0005307400000000,
                "realizedAmount": 0E-16,
                "memo": 0,
                "type": 1,
                "mtime": 1710830986000,
                "volume": 1.0000000000000000,
                "dealVolume": 0.7582000000000000,
                "price": 65000.0000000000000000,
                "ctime": 1710825215000,
                "contractName": "E-BTC-USDT",
                "id": "2110961582587810435",
                "orderBalance": 15717.00000000000000000000000000000000000000000000000000000000,
                "dealMoney": 49283.0000000000000000,
                "status": 2
            }
        ]
    },
    "succ": true
}
```

### Get the list of current plan delegations

* **URL**：`/napi/order/trigger_order_list`
* **Method**：`POST`
* **Login required**：Y

#### Request Parameters

| **Parameter Name** | **Type** | **Required** | **Description**        |
| ------------------ | -------- | ------------ | ---------------------- |
| contractName       | String   | Yes          | contract Name          |
| page               | String   | no           | page number: Default 1 |
| limit              | String   | no           | number: default 100    |

**Request Example**

```json
{"contractName":"E-BTC-USDT","page":1,"limit":100}
```

#### Return parameters

| Parameters     | Type   | description                                                                                                                                  |
| -------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| count          | String | Total                                                                                                                                        |
| trigOrderList  | Lis    | planned Order                                                                                                                                |
| symbol         | String | transaction Pair                                                                                                                             |
| pricePrecision | String | price precision                                                                                                                              |
| eventId        | String | event ID                                                                                                                                     |
| side           | String | BUY and SELL direction (BUY BUY, SELL SELL)                                                                                                  |
| triggerPrice   | String | trigger Price                                                                                                                                |
| memo           | String | order Status Remarks                                                                                                                         |
| type           | String | order type (1 limit; 2 market; 3 IOC; 4 FOK; 5 POST\_ONLY; 6 warehouse explosion, only displayed on the page, not recorded in the database;) |
| mtime          | String | Update time                                                                                                                                  |
| volume         | String | order quantity                                                                                                                               |
| expireTime     | String | condition Order Expiration Time                                                                                                              |
| price          | String | order Price                                                                                                                                  |
| ctime          | String | creation time                                                                                                                                |
| contractName   | String | contract Name                                                                                                                                |
| id             | String | order ID                                                                                                                                     |
| triggerType    | String | condition sheet type (1 stop loss,2 take profit,3 stop loss limit,4 take profit limit)                                                       |
| timeInForce    | String | effective Way (1 GTC, 2 IOC, 3 FOK, 4GTX, 5 PostOnly)                                                                                        |
| status         | String | Valid Status (0 Valid, 1 Expired, 2 Completed, 3 Trigger Failed)                                                                             |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "count": 1,
        "trigOrderList": [
            {
                "symbol": "BTC-USDT",
                "pricePrecision": 2,
                "eventId": "87bea8e5ddeee5d3c7ea218ec3b83524128750906e67e4cd9d5ad10517ec8e3c",
                "side": "BUY",
                "triggerPrice": 60000.0000000000000000,
                "memo": 0,
                "type": 1,
                "mtime": 1710837111000,
                "volume": 1.0000000000000000,
                "expireTime": 1712046712000,
                "price": 55000.0000000000000000,
                "ctime": 1710837111000,
                "contractName": "E-BTC-USDT",
                "id": "887",
                "triggerType": 4,
                "timeInForce": 1,
                "status": 0
            }
        ]
    },
    "succ": true
}
```

### Get historical plan delegation list

* **URL**：`/napi/order/history_trigger_order_list`
* **Method**：`POST`
* **Login required**：Y

#### Request Parameters

| Parameter Name | Type   | Required | Description            |
| -------------- | ------ | -------- | ---------------------- |
| contractName   | String | Yes      | contract Name          |
| page           | String | no       | page number: Default 1 |
| limit          | String | no       | number: default 100    |

**Request Example**

```json
{"contractName":"E-BTC-USDT","page":1,"limit":100}
```

#### Return parameters

| Parameters     | type   | description                                                                                                                                  |
| -------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| count          | String | Total                                                                                                                                        |
| trigOrderList  | List   | planned Order                                                                                                                                |
| symbol         | String | transaction Pair                                                                                                                             |
| pricePrecision | String | price precision                                                                                                                              |
| eventId        | String | event ID                                                                                                                                     |
| side           | String | BUY and SELL direction (BUY BUY, SELL SELL)                                                                                                  |
| triggerPrice   | String | trigger Price                                                                                                                                |
| memo           | String | order Status Remarks                                                                                                                         |
| type           | String | order type (1 limit; 2 market; 3 IOC; 4 FOK; 5 POST\_ONLY; 6 warehouse explosion, only displayed on the page, not recorded in the database;) |
| mtime          | String | Update time                                                                                                                                  |
| volume         | String | order quantity                                                                                                                               |
| expireTime     | String | condition Order Expiration Time                                                                                                              |
| price          | String | order Price                                                                                                                                  |
| ctime          | String | creation time                                                                                                                                |
| contractName   | String | contract Name                                                                                                                                |
| id             | String | order ID                                                                                                                                     |
| triggerType    | String | condition sheet type (1 stop loss,2 take profit,3 stop loss limit,4 take profit limit)                                                       |
| timeInForce    | String | effective Way (1 GTC, 2 IOC, 3 FOK, 4GTX, 5 PostOnly)                                                                                        |
| status         | String | valid Status (0 Valid, 1 Expired, 2 Completed, 3 Trigger Failed)                                                                             |
|                |        |                                                                                                                                              |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "count": 1,
        "trigOrderList": [
            {
                "symbol": "BTC-USDT",
                "pricePrecision": 2,
                "eventId": "87bea8e5ddeee5d3c7ea218ec3b83524128750906e67e4cd9d5ad10517ec8e3c",
                "side": "BUY",
                "triggerPrice": 60000.0000000000000000,
                "memo": 1,
                "type": 1,
                "mtime": 1710838297000,
                "volume": 1.0000000000000000,
                "expireTime": 1710838297000,
                "price": 55000.0000000000000000,
                "ctime": 1710837111000,
                "contractName": "E-BTC-USDT",
                "id": "887",
                "triggerType": 4,
                "timeInForce": 1,
                "status": 4
            }
        ]
    },
    "succ": true
}
```

***

### Get historical transaction list

* **URL**：`/napi/order/his_trade_list`
* **Method**：`POST`
* **Login required**：Y

#### Request Parameters

| Parameter Name | Type   | Required | Description            |
| -------------- | ------ | -------- | ---------------------- |
| contractName   | String | Yes      | contract Name          |
| page           | String | no       | page number: Default 1 |
| limit          | String | no       | number: default 100    |

**Request Example**

```json
{"contractName":"E-BTC-USDT","page":1,"limit":100}
```

#### Return parameters

| Parameters       | type   | description                                                        |
| ---------------- | ------ | ------------------------------------------------------------------ |
| count            | String | Total                                                              |
| tradeHisList     | List   | transaction Order List                                             |
| symbol           | String | transaction Pair                                                   |
| pricePrecision   | String | price precision                                                    |
| eventId          | String | event ID                                                           |
| side             | String | BUY and SELL direction (BUY BUY, SELL SELL)                        |
| role             | String | active one-way direction:(Maker hangs one-way, Taker eats one-way) |
| fee              | String | fees                                                               |
| realizedAmount   | String | accumulated profit and loss of order                               |
| feeCoinPrecision | String | currency Display Precision                                         |
| volume           | String | number of transactions                                             |
| feeCoin          | String | fee Currency                                                       |
| price            | String | transaction Price                                                  |
| ctime            | String | transaction time                                                   |
| contractName     | String | contract Name                                                      |
| id               | String | transaction ID                                                     |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "count": 3,
        "tradeHisList": [
            {
                "symbol": "BTC-USDT",
                "pricePrecision": 2,
                "eventId": "4ef6a6d0169d7622c449edad7932befc2998902b1258187cbf2ede8a8715850c",
                "side": "BUY",
                "role": "Maker",
                "fee": 0.0002895900000000,
                "realizedAmount": 0E-16,
                "feeCoinPrecision": 4,
                "volume": 0.4137000000000000,
                "feeCoin": "USDT",
                "price": 65000.0000000000000000,
                "ctime": 1710830986000,
                "contractName": "E-BTC-USDT",
                "id": "1156731"
            }
        ]
    },
    "succ": true
}
```

***

### Browser-Market Data

* **URL**：`/napi/order/history_order_list_explorer`
* **Method**：`POST`
* **Login required**：N

#### Request Parameters

| Parameter Name | Type   | Required | Description                         |
| -------------- | ------ | -------- | ----------------------------------- |
| contractName   | String | Yes      | Contract Name                       |
| wallet         | String | no       | wallet address or eventId retrieval |
| page           | String | no       | page number: Default 1              |
| limit          | String | no       | number: default 100                 |
| type           | String | no       | order Type (1 limit; 2 market;)     |

**Request Example**

```json
{"contractName":"E-BTC-USDT","wallet":"npub18luy0zu5gmllkwsyel3xaz5h33qgschq6kt7es3vuezg749pkdjs941234","page":1,"limit":200}
```

#### Return parameters

| Parameters     | type   | description                                                                                                                                  |
| -------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| count          | String | Total                                                                                                                                        |
| orderList      | List   | order                                                                                                                                        |
| symbol         | String | transaction Pair                                                                                                                             |
| pricePrecision | String | price precision                                                                                                                              |
| eventId        | String | event ID                                                                                                                                     |
| side           | String | BUY and SELL direction (BUY BUY, SELL SELL)                                                                                                  |
| address        | String | user Address                                                                                                                                 |
| avgPrice       | String | average Transaction Price                                                                                                                    |
| tradeFee       | String | transaction Fees                                                                                                                             |
| memo           | String | Order Status Remarks                                                                                                                         |
| type           | String | order type (1 limit; 2 market; 3 IOC; 4 FOK; 5 POST\_ONLY; 6 warehouse explosion, only displayed on the page, not recorded in the database;) |
| mtime          | String | update time                                                                                                                                  |
| volume         | String | order quantity                                                                                                                               |
| dealVolume     | String | number of transactions                                                                                                                       |
| price          | String | order Price                                                                                                                                  |
| ctime          | String | creation time                                                                                                                                |
| contractName   | String | contract Name                                                                                                                                |
| id             | String | order ID                                                                                                                                     |
| orderBalance   | String | order Balance                                                                                                                                |
| dealMoney      | String | Amount of transactions                                                                                                                       |
| status         | String | order Status (Order Status: 0 init,1 new,2 filled,3 part\_filled,4 canceled,5 pending\_cancel,6 expired)                                     |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "count": 6,
        "orderList": [
            {
                "symbol": "BTC-USDT",
                "pricePrecision": 2,
                "eventId": "4ef6a6d0169d7622c449edad7932befc2998902b1258187cbf2ede8a8715850c",
                "side": "BUY",
                "address": "npub1z8vkcn30lrt6uwmkhrslnw43qglzrhudx0aw3ervkfrfv4gs20wq3rt8zq",
                "avgPrice": 65000.00000000,
                "tradeFee": 0.0005307400000000,
                "realizedAmount": 0E-16,
                "memo": 0,
                "type": 1,
                "mtime": 1710830986000,
                "volume": 1.0000000000000000,
                "dealVolume": 0.7582000000000000,
                "price": 65000.0000000000000000,
                "ctime": 1710825215000,
                "contractName": "E-BTC-USDT",
                "id": "2110961582587810435",
                "orderBalance": 15717.00000000000000000000000000000000000000000000000000000000,
                "dealMoney": 49283.0000000000000000,
                "status": 2
            }
        ]
    },
    "succ": true
}
```

***

### Browser-Market Data-Details

* **URL**：`/napi/order/his_trade_list_explorer`
* **Method**：`POST`
* **Login required:** N

#### Request Parameters

| Parameter Name | Type   | Required | Description            |
| -------------- | ------ | -------- | ---------------------- |
| contractName   | String | Yes      | contract Name          |
| page           | String | no       | page number: Default 1 |
| limit          | String | no       | number: default 100    |
| orderId        | String | yes      | order ID               |

**Request Example**

```json
{"contractName":"E-BTC-USDT","orderId":"2115630744614604870","page":1,"limit":100}
```

#### Return parameter

| Parameters       | Type   | Description                                                        |
| ---------------- | ------ | ------------------------------------------------------------------ |
| count            | String | Total                                                              |
| tradeHisList     | List   | transaction Order List                                             |
| symbol           | String | transaction Pair                                                   |
| pricePrecision   | String | price precision                                                    |
| eventId          | String | event ID                                                           |
| side             | String | BUY and SELL direction (BUY BUY, SELL SELL)                        |
| role             | String | active one-way direction:(Maker hangs one-way, Taker eats one-way) |
| fee              | String | fees                                                               |
| realizedAmount   | String | accumulated profit and loss of order                               |
| feeCoinPrecision | String | currency Display Precision                                         |
| volume           | String | number of transactions                                             |
| feeCoin          | String | fee Currency                                                       |
| price            | String | transaction Price                                                  |
| ctime            | String | transaction time                                                   |
| contractName     | String | contract Name                                                      |
| id               | String | transaction ID                                                     |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "count": 3,
        "tradeHisList": [
            {
                "symbol": "BTC-USDT",
                "pricePrecision": 2,
                "eventId": "4ef6a6d0169d7622c449edad7932befc2998902b1258187cbf2ede8a8715850c",
                "side": "BUY",
                "role": "Maker",
                "fee": 0.0002895900000000,
                "realizedAmount": 0E-16,
                "feeCoinPrecision": 4,
                "volume": 0.4137000000000000,
                "feeCoin": "USDT",
                "price": 65000.0000000000000000,
                "ctime": 1710830986000,
                "contractName": "E-BTC-USDT",
                "id": "1156731"
            }
        ]
    },
    "succ": true
}
```

***

### Browser-Money Flow

* **URL**：`/napi/trade/get_transaction_list_explorer`
* **Method**：`POST`
* **Login required:** N

#### Request Parameters

| Parameter Name | Type   | Required | Description                                                                                                                                    |
| -------------- | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| address        | String | No       | wallet address                                                                                                                                 |
| symbol         | String | no       | currency                                                                                                                                       |
| page           | String | no       | page number: Default 1                                                                                                                         |
| limit          | String | no       | number: default 100                                                                                                                            |
| type           | String | no       | type of flowing water (1 transfer-in 2 Transfer-out 6 Transaction Fee 13 Order Freeze 14 Order Cancellation Unfreeze 15 Transaction Transfer ) |

**Request Example**

```json
{"limit":20,"page":1,"type":"13","symbol":"USDT","address":""}
```

#### Return parameter

| Parameters     | type   | description                                                                                                                                    |
| -------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| ctimeL         | String | Create timestamp                                                                                                                               |
| fromCoinSymbol | String | from Currency Name                                                                                                                             |
| toCoinSymbol   | String | to Currency Name                                                                                                                               |
| type           | String | type of flowing water (1 transfer-in 2 Transfer-out 6 Transaction Fee 13 Order Freeze 14 Order Cancellation Unfreeze 15 Transaction Transfer ) |
| amount         | String | quantity                                                                                                                                       |
| fromAddress    | String | from user address                                                                                                                              |
| toAddress      | String | to User Address                                                                                                                                |

#### Return Results

```json
{
    "code": "0",
    "msg": "success",
    "data": {
        "transList": [
            {
                "symbol": "btcusdt",
                "eventId": 4826157,
                "amount": "24303.211464",
                "type": 14,
                "toAddress": "npub1m5vfe4uz9sk3e0n30lj0undcu2akyzrhva8zzr902qmj3ymvnqcsv3edk2",
                "toCoinSymbol": "USDT",
                "ctime": "2024-03-19 14:15:01",
                "fromCoinSymbol": "USDT",
                "fromAddress": "npub1m5vfe4uz9sk3e0n30lj0undcu2akyzrhva8zzr902qmj3ymvnqcsv3edk2",
                "id": 4826157,
                "ctimeL": 1710857701000
            },
            {
                "symbol": "btcusdt",
                "eventId": 4826156,
                "amount": "30863.870946288",
                "type": 15,
                "toAddress": "npub1m5vfe4uz9sk3e0n30lj0undcu2akyzrhva8zzr902qmj3ymvnqcsv3edk2",
                "toCoinSymbol": "USDT",
                "ctime": "2024-03-19 14:15:01",
                "fromCoinSymbol": "USDT",
                "fromAddress": "npub1m5vfe4uz9sk3e0n30lj0undcu2akyzrhva8zzr902qmj3ymvnqcsv3edk2",
                "id": 4826156,
                "ctimeL": 1710857701000
            }
        ],
        "count": 9331
    },
    "succ": true
}
```

***

### Get Daily Trading Volume

* **URL**：`/napi/common/getDayTradeAmount`
* **Method**：`POST`
* **Login required:** N

#### Request Parameters

| Parameter Name | Type   | Required | Description                                                                  |
| -------------- | ------ | -------- | ---------------------------------------------------------------------------- |
| dayTimestamp   | String | No       | query date 0 timestamp (milliseconds), not passed default: query current day |

**Request Example**

```json
{}    
{"dayTimestamp":"1735516800000"}
```

#### Return parameter

| Parameters   | Type   | Description          |
| ------------ | ------ | -------------------- |
| contractName | String | Contract Name        |
| dayNtlVlm    | String | daily trading volume |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": [
        {
            "contractName": "E-BURGER-USDT",
            "dayNtlVlm": 11839.5551
        },
        {
            "contractName": "E-BTC-USDT",
            "dayNtlVlm": 246326.83141
        }
    ],
    "succ": true
}
```

### Acquisition day fee, Total fee

* **URL**：`/napi/common/getTradeFee`
* **Method**：`POST`
* **Login required:** N

#### Request Parameters

| Parameter Name | Type   | Required | Description                               |
| -------------- | ------ | -------- | ----------------------------------------- |
| startTimestamp | String | Yes      | query date start timestamp (milliseconds) |
| endTimestamp   | String | yes      | query date end timestamp (milliseconds)   |

**Request Example**

```json
{"startTimestamp":"1735516800000","endTimestamp":"1735603199000"}
```

#### Return parameters

| Parameters | Type   | Description        |
| ---------- | ------ | ------------------ |
| dailyFees  | String | Daily fee          |
| totalFees  | String | total Handling Fee |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "totalFees": "91.34757952128017",
        "dailyFees": "7.716232098"
    },
    "succ": true
}
```

***

## API section-NAPI- RELAY instruction：

### Create User

* **URL**：`/napi/user/create_user`
* **Method**：`POST`
* **Login required:** N

#### Request Parameters

| Parameter Name | Type   | Required | Description               |
| -------------- | ------ | -------- | ------------------------- |
| nostrAddress   | String | Yes      | nostr protocol address    |
| sign           | String | no       | value after eth signature |
| broker         | String | yes      | merchant id: fixed 1000   |
| ethAddress     | String | yes      | eth address               |
| time           | String | yes      | latest timestamp          |
| referrals      | String | no       | invitation Code           |

**Request Example**

```json
{"nostrAddress":"npub1wmp4k62sqmw3plv6eu53p9rzpufxr09er25dlxrhjfzgsa644g8skxh943","sign":"0x83e814031c2e9d45202a3cabbe6cf2bdb28f55fc7c18f8f2280a4b162b0df87d4e66a1b9cd7c54d198321b65bcec022a41e5529a911cc3539b61a6978d34ac161b","broker":1000,"ethAddress":"0x29c044869E937DF22c47DeEe554E1D257858bf99","time":1711444596754,"referrals":"0x123444869E937DF22c47DeEe554E1D2123456789"}
```

#### Return parameter

| Parameters | Type   | Description      |
| ---------- | ------ | ---------------- |
| code       | String | 0 is successful. |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": "null",
    "succ": "true"
}
```

### Limit order & Market price order & Plan to entrust order

* **URL**：`/napi/order/order_create`
* **Method**：`POST`
* **Login required:** Y

#### Request Parameters

| Parameter Name   | Type   | Required | Description                                                                             |
| ---------------- | ------ | -------- | --------------------------------------------------------------------------------------- |
| side             | String | Yes      | BUY and SELL direction (BUY BUY, SELL SELL)                                             |
| open             | String | yes      | OPEN position direction (OPEN position, CLOSE position)                                 |
| isConditionOrder | String | yes      | whether it is a conditional list (true is, false is not)                                |
| type             | String | yes      | order type (1 limit, 2 market,3 IOC,4 FOK,5 POST\_ONLY)                                 |
| volume           | String | yes      | order quantity (open market price order: Amount)                                        |
| contractName     | String | yes      | contract Name                                                                           |
| price            | String | yes      | order Price                                                                             |
| clientId         | String | no       | client order ID                                                                         |
| triggerPrice     | String | yes      | trigger Price                                                                           |
| source           | String | yes      | order source (order Source: 1web,2app,3api,4 others)                                    |
| triggerType      | String | yes      | condition order type (0 normal condition order, 3 stop loss limit, 4 take profit limit) |
| expiredTime      | String | Yes      | validity duration of conditional sheet                                                  |
| ctime            | String | yes      | creation time                                                                           |
| timeInForce      | String | yes      | effective Way (1 limit, 2 market,3 IOC,4 FOK,5 POST\_ONLY)                              |

**Request Example**

```json
{"side":"buy","open":"OPEN","isConditionOrder":false,"clientId":"web39","triggerPrice":0,"kind":10,"source":1,"type":1,"triggerType":1,"expiredTime":30,"volume":1,"price":60000,"ctime":1710843099430,"contractName":"E-BTC-USDT","timeInForce":2}
```

#### Return parameter

| Parameters | Type | description                                              |
| ---------- | ---- | -------------------------------------------------------- |
| ids        | List | Successful order ID list                                 |
| cancelIds  | List | list of order withdrawal ID when placing an order failed |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "ids": [
            "2115627033762860615"
        ],
        "cancelIds": []
    },
    "succ": true
}
```

***

### Withdrawal & Revocation of Plan Delegation

* **URL**：`/napi/order/order_cancel`
* **Method**：`POST`
* **Login required:** Y

#### Request Parameters

| Parameter Name   | Type   | Required | Description                                              |
| ---------------- | ------ | -------- | -------------------------------------------------------- |
| orderId          | String | Yes      | order ID                                                 |
| clientId         | String | no       | client order ID                                          |
| contractName     | String | yes      | contract Name                                            |
| isConditionOrder | String | yes      | whether it is a conditional list (true is, false is not) |

**Request Example**

```json
{"contractName":"E-BTC-USDT","orderId":"2115623941386416880","isConditionOrder":false}
```

#### Return parameter

| Parameters | Type | Description                      |
| ---------- | ---- | -------------------------------- |
| cancelIds  | List | List of successful withdrawal ID |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "cancelIds": [
            "2115627377360243492"
        ]
    },
    "succ": true
}
```

***

### Withdraw all orders\&Cancellation of all plan commissions

* **URL**：`/napi/order/order_cancel_all`
* **Method**：`POST`
* **Login required:** Y

#### Request Parameters

| Parameter Name   | Type   | Required | Description                                              |
| ---------------- | ------ | -------- | -------------------------------------------------------- |
| contractName     | String | Yes      | contract Name                                            |
| isConditionOrder | String | yes      | whether it is a conditional list (true is, false is not) |

**Request Example**

```json
{"contractName":"E-BTC-USDT","isConditionOrder":false}
```

#### Return parameter

| Parameters | Type | Description                      |
| ---------- | ---- | -------------------------------- |
| cancelIds  | List | List of successful withdrawal ID |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "cancelIds": [
            "2115627377360243492"
        ]
    },
    "succ": true
}
```

***

## WSS：

### OrderBook

#### Subscription Parameters

```javascript
{"event":"sub","params":{"channel":"market_e_btcusdt_depth_step0","cb_id":"e_btcusdt"}}
```

#### Push data

```javascript
{
    "event_rep": "",
    "channel": "market_e_btcusdt_depth_step0",
    "data": null,
    "tick": {
        "asks": [
            [
                68265,
                0.1528
            ]
        ],
        "buys": [
            [
                68195,
                0.1911
            ]
        ]
    },
    "ts": 1710812527000,
    "status": "ok"
}
```

***

### Latest Transaction (Full Volume)

#### Subscription Parameters

```javascript
{"event":"req","params":{"channel":"market_e_btcusdt_trade_ticker","cb_id":"e_btcusdt","top":100}}
```

#### Push data

```javascript
{
    "event_rep": "rep",
    "channel": "market_e_btcusdt_trade_ticker",
    "data": [
        {
            "amount": "13973.44819",
            "ds": "2024-03-18 19:46:03",
            "price": "68329.82",
            "side": "SELL",
            "ts": 1710762363430,
            "vol": "0.2045"
        }
    ],
    "tick": null,
    "ts": 1710812527000,
    "status": "ok"
}
```

***

### Latest Deal (Increment)

#### Subscription Parameters

```javascript
{"event":"sub","params":{"channel":"market_usdt_btcusdt_trade_ticker","cb_id":"e_btcusdt","top":100}}
```

#### Push data

```javascript
{
    "event_rep": "rep",
    "channel": "market_e_btcusdt_trade_ticker",
    "data": null
    "tick": {
            "amount": "13973.44819",
            "ds": "2024-03-18 19:46:03",
            "price": "68329.82",
            "side": "SELL",
            "ts": 1710762363430,
            "vol": "0.2045"
        },
    "ts": 1710812527000,
    "status": "ok"
}
```

***

### Trading Pair Real-Time Price Trading Volume

#### Subscription Parameters

```javascript
{"event":"sub","params":{"channel":"market_e_btcusdt_ticker","cb_id":"e_btcusdt"}}
```

#### Push data

```javascript
{
    "event_rep": "",
    "channel": "market_e_btcusdt_ticker",
    "data": null,
    "tick": {
        "amount": "15076475.921172",
        "close": "68264.21",
        "high": "68935.29",
        "low": "67341.29",
        "open": "68276",
        "rose": "-0.00017268",
        "vol": "221.3856"
    },
    "ts": 1710813265000,
    "status": "ok"
}
```

***

### K line (full quantity)

#### Subscription Parameters

```javascript
{"event":"req","params":{"channel":"market_e_btcusdt_kline_60min","cb_id":"e_btcusdt"}}
```

#### Push data

```javascript
{
    "event_rep": "rep",
    "channel": "market_e_btcusdt_kline_60min",
    "data": [
        {
            "amount": 4458871.49795525,
            "close": 66843.6282,
            "ds": "2024-03-05 16:00:00",
            "high": 66843.6282,
            "id": 1709625600,
            "low": 65533.34,
            "open": 66129.65,
            "tradeId": 0,
            "vol": 67.281
        }
    ],
    "tick": null,
    "ts": 1710813260000,
    "status": "ok"
}
```

***

### K-Line (increment)

#### Subscription Parameters

```javascript
{"event":"sub","params":{"channel":"market_e_btcusdt_kline_60min","cb_id":"e_btcusdt"}}
```

#### Push data

```javascript
{
    "event_rep": "",
    "channel": "market_e_btcusdt_kline_60min",
    "data": null,
    "tick": {
        "amount": 13645.923,
        "close": 68264.21,
        "ds": "2024-03-19 09:00:00",
        "high": 68264.21,
        "id": 1710810000,
        "low": 68195.02,
        "open": 68195.02,
        "tradeId": 0,
        "vol": 0.2
    },
    "ts": 1710812746000,
    "status": "ok"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ln.exchange/api/perpetual-trading-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
