# Spot Trading API

### Unified interface domain name:

Test environment:

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

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

***

## Introduction

### Obtain API Key <a href="#uedxn" id="uedxn"></a>

Many API endpoints require an API Key for access. To obtain an API Key:

1. Create a user account on the platform.
2. Import a Nostr address to the account.
3. Retrieve your API Key. \
   **Note: The API Key is displayed only once. Keep it secure and do not share it.**

### Signature <a href="#ytpwl" id="ytpwl"></a>

To sign requests, follow these steps:

1. Sort parameters in ascending lexicographical order by parameter names.
2. Concatenate all parameters in `key=value` format.
3. Append your private key to the concatenated string.
4. Use MD5 to hash the string for signing.

{% code title="Example" 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 Authentication**

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 | Nostr address                   |
| wsUrl                | String | WebSocket connection address    |
| currentTimeMillis    | String | current timestamp               |
| coinList             | List   | currency List                   |
| coin                 | String | currency Name                   |
| precious             | String | currency precision              |
| symbolList           | List   | transaction Pair List           |
| id                   | String | transaction pair ID             |
| symbolName           | String | currency exchange name          |
| symbol               | String | transaction Pair Symbol         |
| makerFee             | String | Maker fees                      |
| takerFee             | String | Taker fee                       |
| base                 | String | base Currency                   |
| quote                | String | pricing Currency                |
| sort                 | String | sort Value                      |
| robot                | String | robot Address                   |
| 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      |
| coinPrecision        | String | currency precision              |
| depth                | List   | coin Pair Depth Precision Array |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "nostrAddress": "npub1gxns2uvk2rkhtzsk3mxa4ey3d3x375a9q7jc54qkt4j367rgrzwqv76xss",
        "wsUrl": "wss://dev-ln-spotws.ln.exchange/kline-api/ws",
        "currentTimeMillis": 1712456190308,
        "coinList": [
            {
                "coin": "BTC",
                "precious": 5
            },
            {
                "coin": "USDT",
                "precious": 4
            },
            {
                "coin": "ETH",
                "precious": 4
            },
            {
                "coin": "TREAT",
                "precious": 4
            }
        ],
        "symbolList": [
            {
                "id": 62,
                "symbolName": "TREAT-USDT",
                "symbol": "TREAT-USDT",
                "makerFee": 0.00080000,
                "takerFee": 0.00100000,
                "base": "TREAT",
                "quote": "USDT",
                "sort": 30,
                "robot": "npub1gxns2uvk2rkhtzsk3mxa4ey3d3x375a9q7jc54qkt4j367rgrzwqv76xss",
                "symbolPricePrecision": 2,
                "minOrderVolume": 1,
                "minOrderMoney": 1.0000000000000000,
                "maxMarketVolume": 90000000,
                "maxMarketMoney": 90000000.0000000000000000,
                "maxLimitVolume": 90000000,
                "maxLimitMoney": 90000000.0000000000000000,
                "coinPrecision": 4,
                "depth": [
                    "2",
                    "1",
                    "0"
                ]
            },
            {
                "id": 18,
                "symbolName": "BTC-USDT",
                "symbol": "BTC-USDT",
                "makerFee": 0.00080000,
                "takerFee": 0.00100000,
                "base": "BTC",
                "quote": "USDT",
                "sort": 1,
                "robot": "npub1gsl6fq6ntvxenym764z48qptvn3dctesah3acm03rfglwac7pxjsca7uyp",
                "symbolPricePrecision": 2,
                "minOrderVolume": 0,
                "minOrderMoney": 1.0000000000000000,
                "maxMarketVolume": 10000,
                "maxMarketMoney": 1000000.0000000000000000,
                "maxLimitVolume": 100000,
                "maxLimitMoney": 1000000.0000000000000000,
                "coinPrecision": 5,
                "depth": [
                    "2",
                    "1",
                    "0"
                ]
            }
        ]
    },
    "succ": true
}
```

***

### Get list of outstanding orders

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

#### Request Parameters

| Parameter Name | Type   | Required | Description            |
| -------------- | ------ | -------- | ---------------------- |
| symbolName     | String | yes      | currency exchange name |

**Request Example**

```json
{"symbolName":"BTC-USDT"}
```

#### Return parameter

| Parameters   | Type   | Description                                                                                              |
| ------------ | ------ | -------------------------------------------------------------------------------------------------------- |
| orderId      | String | order id                                                                                                 |
| symbolName   | String | currency exchange 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         | String | 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",
            "symbolName": "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                                          |
| -------------- | ------ | -------- | ---------------------------------------------------- |
| symbolName     | String | Yes      | Currency exchange 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
{"symbolName":"BTC-USDT","limit":"100","fromId":"123456"}
```

#### Return parameter

| Parameters | Type   | Description                                   |
| ---------- | ------ | --------------------------------------------- |
| price      | String | transaction Price                             |
| volume     | String | number of transactions                        |
| amount     | String | transaction amount                            |
| symbolName | String | currency exchange name                        |
| time       | String | transaction Time                              |
| side       | String | 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 | pendant (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,
            "symbolName": "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                                             |
| -------------- | ------ | -------- | ------------------------------------------------------- |
| symbolName     | String | Yes      | currency exchange name                                  |
| orders         | List   | yes      | order List                                              |
| side           | String | yes      | BUY and SELL direction (BUY BUY, SELL SELL)             |
| 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
{"symbolName":"BTC-USDT","orders":"[{\"volume\":1,\"side\":\"BUY\",\"price\":60000,\"type\":1}]"}
```

**Request Example（Batch withdrawal）**

```json
{"symbolName":"BTC-USDT","orderIds":[2116489841153081344,2116489841153081345]}
```

#### Return parameter

| Parameters | Type | Description              |
| ---------- | ---- | ------------------------ |
| ids        | List | successful order ID list |
| cancelIds  | List | order withdrawal ID list |

#### 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                                         |
| -------------- | ------ | -------- | --------------------------------------------------- |
| symbolName     | String | Yes      | Currency exchange name                              |
| limit          | String | no       | get the number of bars: the default 100 maximum 100 |

**Request Example**

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

#### Return parameter

| Parameters | Type   | Description      |
| ---------- | ------ | ---------------- |
| asks       | String | sell 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            |
| -------------- | ------ | -------- | ---------------------- |
| symbolName     | String | Yes      | currency exchange name |

**Request Example**

```json
{"symbolName":"BTC-USDT"}
```

#### Return parameter

| 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 parameter

| Parameters    | Type   | Description |
| ------------- | ------ | ----------- |
| balanceList   | List   | asset List  |
| accountNormal | String | available   |
| accountLock   | String | freeze      |
| coin          | String | currency    |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "balanceList": [
            {
                "accountNormal": "13.75386926",
                "accountLock": "0",
                "coin": "BTC"
            },
            {
                "accountNormal": "475114.11",
                "accountLock": "257869.5337",
                "coin": "USDT"
            },
            {
                "accountNormal": "0",
                "accountLock": "0",
                "coin": "ETH"
            },
            {
                "accountNormal": "989997",
                "accountLock": "1",
                "coin": "TREAT"
            }
        ]
    },
    "succ": true
}
```

***

## API part-NAPI-direct call:

### Interaction-Nostr part:

Before requesting any interface, you must sign the Request Parameters via 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 parameter

| Parameters           | Type   | Description                     |
| -------------------- | ------ | ------------------------------- |
| nostrAddress         | String | Nostr address                   |
| wsUrl                | String | WebSocket connection address    |
| currentTimeMillis    | String | current timestamp               |
| coinList             | List   | currency List                   |
| coin                 | String | currency Name                   |
| precious             | String | currency precision              |
| symbolList           | List   | transaction Pair List           |
| id                   | String | transaction pair ID             |
| symbolName           | String | currency exchange name          |
| symbol               | String | transaction Pair Symbol         |
| makerFee             | String | Maker fees                      |
| takerFee             | String | Taker fee                       |
| base                 | String | base Currency                   |
| quote                | String | pricing Currency                |
| sort                 | String | sort Value                      |
| robot                | String | robot Address                   |
| 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      |
| coinPrecision        | String | currency precision              |
| depth                | List   | coin Pair Depth Precision Array |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": {
        "nostrAddress": "npub1gxns2uvk2rkhtzsk3mxa4ey3d3x375a9q7jc54qkt4j367rgrzwqv76xss",
        "wsUrl": "wss://dev-ln-spotws.ln.exchange/kline-api/ws",
        "currentTimeMillis": 1712456190308,
        "coinList": [
            {
                "coin": "BTC",
                "precious": 5
            },
            {
                "coin": "USDT",
                "precious": 4
            },
            {
                "coin": "ETH",
                "precious": 4
            },
            {
                "coin": "TREAT",
                "precious": 4
            }
        ],
        "symbolList": [
            {
                "id": 62,
                "symbolName": "TREAT-USDT",
                "symbol": "TREAT-USDT",
                "makerFee": 0.00080000,
                "takerFee": 0.00100000,
                "base": "TREAT",
                "quote": "USDT",
                "sort": 30,
                "robot": "npub1gxns2uvk2rkhtzsk3mxa4ey3d3x375a9q7jc54qkt4j367rgrzwqv76xss",
                "symbolPricePrecision": 2,
                "minOrderVolume": 1,
                "minOrderMoney": 1.0000000000000000,
                "maxMarketVolume": 90000000,
                "maxMarketMoney": 90000000.0000000000000000,
                "maxLimitVolume": 90000000,
                "maxLimitMoney": 90000000.0000000000000000,
                "coinPrecision": 4,
                "depth": [
                    "2",
                    "1",
                    "0"
                ]
            },
            {
                "id": 18,
                "symbolName": "BTC-USDT",
                "symbol": "BTC-USDT",
                "makerFee": 0.00080000,
                "takerFee": 0.00100000,
                "base": "BTC",
                "quote": "USDT",
                "sort": 1,
                "robot": "npub1gsl6fq6ntvxenym764z48qptvn3dctesah3acm03rfglwac7pxjsca7uyp",
                "symbolPricePrecision": 2,
                "minOrderVolume": 0,
                "minOrderMoney": 1.0000000000000000,
                "maxMarketVolume": 10000,
                "maxMarketMoney": 1000000.0000000000000000,
                "maxLimitVolume": 100000,
                "maxLimitMoney": 1000000.0000000000000000,
                "coinPrecision": 5,
                "depth": [
                    "2",
                    "1",
                    "0"
                ]
            }
        ]
    },
    "succ": true
}
```

***

### Get the latest transaction information for all coins.

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

#### Request Parameters

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

**Request Example**

```json
{}
```

#### Return parameter

| Parameters    | Type   | Description                           |
| ------------- | ------ | ------------------------------------- |
| symbolName    | String | currency exchange name                |
| rose          | String | 24-hour rise and fall                 |
| latestPrice   | String | latest Price                          |
| previousPrice | String | last price (penultimate latest price) |

#### Return Results

```json
{
    "code": "0",
    "msg": "Success",
    "data": [
        {
            "symbolName": "TREAT-USDT",
            "rose": "0.08135593",
            "latestPrice": "3.19",
            "previousPrice": "3.18"
        },
        {
            "symbolName": "BTC-USDT",
            "rose": "0.0094292155",
            "latestPrice": "70477.51",
            "previousPrice": "70472.75"
        }
    ],
    "succ": true
}
```

***

### Get depth list

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

#### Request Parameters

| Parameter Name | Type   | Required | Description                                         |
| -------------- | ------ | -------- | --------------------------------------------------- |
| symbolName     | String | Yes      | currency exchange name                              |
| limit          | String | no       | get the number of bars: the default 100 maximum 100 |
|                |        |          |                                                     |

**Request Example**

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

#### Return parameter

| Parameters | Type   | Description      |
| ---------- | ------ | ---------------- |
| asks       | String | sell 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            |
| -------------- | ------ | -------- | ---------------------- |
| symbolName     | String | Yes      | Currency exchange name |

**Request Example**

```json
{"symbolName":"BTC-USDT"}
```

#### Return parameter

| 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            |
| -------------- | ------ | -------- | ---------------------- |
| symbolName     | String | Yes      | currency exchange name |

**Request Example**

```json
{"symbolName":"BTC-USDT"}
```

#### Return parameter

| 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            |
| -------------- | ------ | -------- | ---------------------- |
| symbolName     | String | Yes      | currency exchange name |
| page           | String | no       | page number: Default 1 |
| limit          | String | no       | number: default 100    |

**Request Example**

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

#### Return parameter

| 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                                                                                                                                |
| symbolName     | String | currency exchange 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,
                "symbolName": "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            |
| -------------- | ------ | -------- | ---------------------- |
| symbolName     | String | Yes      | currency exchange name |
| wallet         | String | Yes      | wallet address         |
| page           | String | no       | page number: Default 1 |
| limit          | String | no       | number: default 100    |

**Request Example**

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

#### Return parameter

| 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                                                                                                                                |
| symbolName     | 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,
                "symbolName": "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 require&#x64;**：**&#x59;

#### Request Parameters

| Parameter Name | Type   | Required | Description            |
| -------------- | ------ | -------- | ---------------------- |
| symbolName     | String | Yes      | currency exchange name |
| page           | String | no       | page number: Default 1 |
| limit          | String | no       | number: default 100    |

**Request Example**

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

#### Return parameter

| 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                                                                                                                                |
| symbolName     | String | currency exchange 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,
                "symboltName": "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：**&#x59;

#### Request Parameters

| Parameter Name | Type   | Required | Description            |
| -------------- | ------ | -------- | ---------------------- |
| symbolName     | String | yes      | currency exchange name |
| page           | String | no       | page number: Default 1 |
| limit          | String | no       | number: default 100    |

**Request Example**

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

#### Return parameter

| 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                                                                                                                                |
| symbolName     | 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,
                "symbolName": "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**        |
| ------------------ | -------- | ------------ | ---------------------- |
| symbolName         | String   | Yes          | currency exchange name |
| page               | String   | no           | page number: Default 1 |
| limit              | String   | no           | number: default 100    |

**Request Example**

```json
{"symbolName":"BTC-USDT","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                                                   |
| symbolName       | String | currency exchange 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,
                "symbolName": "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                         |
| -------------- | ------ | -------- | ----------------------------------- |
| symbolName     | String | yes      | currency exchange 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
{"symbolName":"BTC-USDT","wallet":"npub18luy0zu5gmllkwsyel3xaz5h33qgschq6kt7es3vuezg749pkdjs941234","page":1,"limit":200}
```

#### Return parameter

| 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                                                                                                                                |
| symbolName     | 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,
                "symbolName": "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：**&#x4E;

#### Request Parameters

| Parameter Name | Type   | Required | Description            |
| -------------- | ------ | -------- | ---------------------- |
| symbolName     | String | yes      | currency exchange name |
| page           | String | no       | page number: Default 1 |
| limit          | String | no       | number: default 100    |
| orderId        | String | yes      | order ID               |

**Request Example**

```json
{"symbolName":"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                                                   |
| symbolName       | String | currency exchange 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,
                "symbolName": "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
}
```

***

## 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 Order & Plan Order by 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)                                             |
| 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)                                        |
| symbolName       | String | yes      | currency exchange 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      | effective 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","isConditionOrder":false,"clientId":"web39","triggerPrice":0,"kind":10,"source":1,"type":1,"triggerType":1,"expiredTime":30,"volume":1,"price":60000,"ctime":1710843099430,"symbolName":"BTC-USDT","timeInForce":2}
```

#### Return parameter

| Parameters | Type | Description              |
| ---------- | ---- | ------------------------ |
| ids        | List | successful order ID list |
| cancelIds  | List | order withdrawal ID list |

#### Return Results

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

***

### Cancellation & Cancellation 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                                          |
| symbolName       | String | yes      | currency exchange name                                   |
| isConditionOrder | String | yes      | whether it is a conditional list (true is, false is not) |

**Request Example**

```json
{"symbolName":"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
}
```

### All Cancellation Orders & All Cancellation Plan Delegation

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

#### Request Parameters

| Parameter Name   | Type   | Required | Description                                              |
| ---------------- | ------ | -------- | -------------------------------------------------------- |
| symbolName       | String | yes      | currency exchange name                                   |
| isConditionOrder | String | yes      | whether it is a conditional list (true is, false is not) |

**Request Example**

```json
{"symbolName":"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 Section:

### 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"
}
```

***

### Line K (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/spot-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.
