> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monochrome.exchange/llms.txt
> Use this file to discover all available pages before exploring further.

# Market data

> Spot API: market data.

## Get server time

`GET` `/v4/public/time`

```java Java theme={null}
public String getServerInfo(){


}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "SUCCESS",
  "ma": [],
  "result": {
    "serverTime": 1662435658062  
  }
}
```

## Get client ip

`GET` `/v4/public/client`

```java Java theme={null}
public String getClient(){


}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "SUCCESS",
  "ma": [],
  "result": {
    "ip": 192.168.1.1  
  }
}
```

## Get symbol information

`GET` `/v4/public/symbol`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | false | | trading pair eg:btc\_usdt | |
| symbols | array | false | | Collection of trading pairs. Priority is higher than symbol. eg: btc\_usdt,eth\_usdt | |
| version | string | false | | Version number, when the request version number is consistent with the response content version, the list will not be returned, reducing IO eg: 2e14d2cd5czcb2c2af2c1db6 | |

### Limit Flow Rules

1.single symbol：10/s/ip

2.multiple symbols：10/s/ip

### FILTER

Filter, defines a series of trading rules. There are different filters for different fields or entities. Here we mainly introduce the filter for the entity symbol. For symbols, there are two kinds of filters, one is a global filter, and the other is a filter customized for a certain trading pair.

**PRICE FILTER**

The price filter is used to check the validity of the price parameter in the order. Contains the following three parts:

1.min Defines the minimum allowable price in the order

2.max Defines the maximum price allowed in the order

3.tickSize Defines the step interval of price in the order, that is, price must be equal to minPrice+(integer multiple of tickSize)

Each of the above items can be null, when it is null, it means that this item is no longer restricted

The logical pseudocode is as follows:

* price >= min
* price \<= max
* (price-minPrice) % tickSize == 0

**QUANTITY FILTER**

The logic is similar to **PRICE FILTER** ,but for the order quantity.

It contains three parts:

1.min minimum allowed

2.max maximum allowed

3.tickSize  Step interval, that is, quantity must be equal to minQuantity+(integer multiple of tickSize)

Each of the above items can be null, when it is null, it means that this item is no longer restricted

The logical pseudocode is as follows:

* quantity>= min
* quantity\<= max
* (quantity-minQuantity)% tickSize == 0

**QUOTE\_QTY FILTER**

Limit the amount of the order

It internally defines the minimum allowable value-min

When min is null, the order is not limited

Otherwise the restriction rules are as follows:

1.For orders of the LIMIT type,must meet the following conditions: price\*quantity>=min

2.For orders of the MARKET type and BUY type,must meet the following conditions: quoteQty>=min,(quoteQty,The required amount when placing an order of MARKET type by amount)

**PROTECTION\_LIMIT FILTER**

There are price protection restrictions for orders whose order type (orderType) is LIMIT, including the following four parts：

1.buyMaxDeviation: The maximum deviation of the buy order, determine the minimum buy order price based on this value and the latest transaction price

2.buyPriceLimitCoefficient: The buy limit coefficient, determine the maximum buy order price based on this value and the latest transaction price

3.sellMaxDeviation: The maximum deviation of the sell order, determine the maximum sell order price based on this value and the latest transaction price

4.sellPriceLimitCoefficient: The sell limit coefficient, determine the minimum sell order price based on this value and the latest transaction price

If there is no latest transaction price, there will be no restrictions, or if the above parameters are null, the corresponding direction type orders will not be restricted.

In order to pass the limit price protection, the order price must meet the following conditions (latestPrice is the latest transaction price)

buy order: price >= latestPrice-latestPrice*buyMaxDeviation  && price \<= latestPrice+latestPrice*buyPriceLimitCoefficient

sell order: price \<= latestPrice+latestPrice*sellMaxDeviation  && price >= latestPrice-latestPrice*sellPriceLimitCoefficient

**PROTECTION\_MARKET FILTER**

There is a price limit protection mechanism for orders of the order type MARKET, which internally specifies the maximum deviation rate(maxDeviation).

For market type orders, the market price must meet the following conditions for the order to pass(sellBestPrice  sell one price，buyBestPrice buy one price，latestPrice The latest transaction price, these data are obtained through historical transaction data)

buy order: latestPrice + latestPrice\* maxDeviation >= sellBestPrice

sell order: latestPrice - latestPrice\* maxDeviation \<= buyBestPrice

For the above situation maxDeviation,latestPrice,sellBestPrice,buyBestPrice

All may be empty or there is no latest transaction price, buy one price, sell one price, there is no limit

**PROTECTION\_ONLINE FILTER**

Limit the price of orders of the MARKET type within the specified time range after the opening

The maximum price multiple is defined inside this filter(maxPriceMultiple)，duration(durationSeconds)。

Limitation logic: when it is within the durationSeconds time range after the opening of the symbol, Orders with an order type of LIMIT must meet the following conditions to pass

price\<=openPrice\*maxPriceMultiple,（openPrice is the opening price）.

There are no restrictions on other types of orders or orders outside the opening time frame.

For maxPriceMultiple, durationSeconds can be null, when they are null, no opening protection limit is applied.

```json Response theme={null}
{
  "rc": 0,
  "mc": "SUCCESS",
  "ma": [],
  "result": {
    "time": 1662444177871,  
    "version": "7cd2cfab0dc979339f1de904bd90c9cb",  
    "symbols": [                   
      {
        "id": 614,                   //ID
        "symbol": "btc_usdt",         
        "state": "ONLINE",           //symbol state [ONLINE;OFFLINE,DELISTED]
        "tradingEnabled": true,
        "openapiEnabled": true,      //Openapi transaction is available or not
        "nextStateTime": null,              
        "nextState": null,                 
        "depthMergePrecision": 5,    //Depth Merge Accuracy
        "baseCurrency": "btc",                  
        "baseCurrencyPrecision": 5,              
        "baseCurrencyId": 2,                 
        "quoteCurrency": "usdt",             
        "quoteCurrencyPrecision": 6,        
        "quoteCurrencyId": 11,             
        "pricePrecision": 4,         //Transaction price accuracy
        "quantityPrecision": 6,
        "takerFeeRate": 0.001,       //Taker fee rate
        "makerFeeRate": 0.002,       //Maker fee rate
        "orderTypes": [              //Order Type [LIMIT;MARKET]
          "LIMIT",
          "MARKET"
        ],
        "timeInForces": [            //Effective ways [GTC=It remains valid until the transaction is concluded; IOC=Cancel the part that cannot be transacted immediately (taking orders); FOK=Cancellation if all transactions cannot be completed immediately; GTX=Revoke if unable to become a pending party]
          "GTC",
          "FOK",
          "IOC",
          "GTX"
        ],
        "displayWeight": 1,          //Show the weight, the greater the weight, the more forward
        "displayLevel": "FULL",      //Presentation level, [FULL=Full display,SEARCH=Search display,DIRECT=Direct display,NONE=Don't show]
        "plates": [],                //  eg:22,23,24
        "filters": [                       
          {
            "filter": "PROTECTION_LIMIT",
            "buyMaxDeviation": "0.8"
            "sellMaxDeviation": "0.8"
          },
          {
            "filter": "PROTECTION_MARKET",
            "maxDeviation": "0.1"
          },
          {
            "filter": "PROTECTION_ONLINE",
            "durationSeconds": "300",
            "maxPriceMultiple": "5"
          },
          {
            "filter": "PRICE",
            "min": null,
            "max": null,
            "tickSize": null
          },
          {
            "filter": "QUANTITY",
            "min": null,
            "max": null,
            "tickSize": null
          },
          {
            "filter": "QUOTE_QTY",
            "min": null
          },
       ]
      }
    ]
  }
}
```

## Get depth data

`GET` `/v4/public/depth`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | true | | trading pair eg:btc\_usdt | |
| limit | number | false | 100 | minimum number of queries is 100 | 1\~500 |

### Limit Flow Rules

10/s/ip

```java Java theme={null}
public String depth(){


}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "SUCCESS",
  "ma": [],
  "result": {
    "timestamp": 1662445330524,  
    "lastUpdateId": 137333589606963580,     //Last updated record
    "bids": [                               //buy order([?][0]=price;[?][1]=pending order volume)
      [
        "200.0000",                         //price
        "0.996000"                          //pending order volume
      ],
      [
        "100.0000",
        "0.001000"
      ],
      [
        "20.0000",
        "10.000000"
      ]
    ],
    "asks": []                              //sell order([?][0]=price;[?][1]=pending order volume)
  }
}
```

## Get K-line data

`GET` `/v4/public/kline`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | true | | trading pair eg:btc\_usdt | |
| interval | string | true | | K line type, eg:1m | \[1m;3m;5m;15m;30m;1h;2h;4h;6h;8h;12h;1d;3d;1w;1M] |
| startTime | number | false | | start timestamp | |
| endTime | number | false | | end timestamp | |
| limit | number | false | 100 | | 1\~1000 |

### Limit Flow Rules

10/s/ip

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": [
    {
      "t": 1662601014832,   //open time
      "o": "30000",         //open price
      "c": "32000",         //close price
      "h": "35000",         //highest price
      "l": "25000",         //lowest price
      "q": "512",           //transaction quantity
      "v": "15360000"       //transaction volume
    }
  ]
}
```

## Query the list of recent transactions

`GET` `/v4/public/trade/recent`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | true | | trading pair | |
| limit | number | false | 200 | | 1，1000 |

### Limit Flow Rules

10/s/ip

```java Java theme={null}
public String tradeRecent(){


}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": [
    {
      "i": 0,           //ID
      "t": 0,           //transaction time
      "p": "string",    //transaction price
      "q": "string",    //transaction quantity
      "v": "string",    //transaction volume
      "b": true         //whether is buyerMaker or not
    }
  ]
}
```

## Query historical transaction list

`GET` `/v4/public/trade/history`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | true | | trading pair | |
| limit | number | false | 200 | | 1，1000 |
| direction | string | true | | query direction | PREV-previous page,NEXT-next page |
| fromId | number | false | | Start ID，eg: 6216559590087220004 | |

### Limit Flow Rules

10/s/ip

```java Java theme={null}
public String tradeHistory(){


}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "string",
  "ma": [
    {}
  ],
  "result": [
    {
      "i": 0,           //ID
      "t": 0,           //transaction time
      "p": "string",    //transaction price
      "q": "string",    //transaction quantity
      "v": "string",    //transaction volume
      "b": true         //whether is buyerMaker or not
    }
  ]
}
```

## Full ticker

`GET` `/v4/public/ticker`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | false | | trading pair eg:btc\_usdt | |
| symbols | array | false | | Collection of trading pairs. Priority is higher than symbol. eg: btc\_usdt,eth\_usdt | |
| tags | string | false | | Set of tags, separated by commas, currently only supports spot | |

### Limit Flow Rules

1.single symbol：10/s/ip

2.multiple symbols：10/s/ip

```java Java theme={null}
public String price(){


}
```

```json Response theme={null}
{
    "rc": 0,
    "mc": "SUCCESS",
    "ma": [],
    "result": [
          {
            "s": "btc_usdt",        //symbol
            "t": 1662444879425,     //update time
            "cv": "0.00",           //change value
            "cr": "0.0000",         //change rate
            "o": "200.00",          //open
            "l": "200.00",          //low
            "h": "200.00",          //high
            "c": "200.00",          //close
            "q": "0.002",           //quantity
            "v": "0.40",            //volume
            "ap": null,             //asks price(sell one price)
            "aq": null,             //asks qty(sell one quantity)
            "bp": null,             //bids price(buy one price)
            "bq": null              //bids qty(buy one quantity)
            }
        ]
}
```

## Get latest prices ticker

`GET` `/v4/public/ticker/price`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | false | | trading pair eg:btc\_usdt | |
| symbols | array | false | | Collection of trading pairs. Priority is higher than symbol. eg: btc\_usdt,eth\_usdt | |
| tags | string | false | | Set of tags, separated by commas, currently only supports spot | |

### Limit Flow Rules

1.single symbol：10/s/ip

2.multiple symbols：10/s/ip

```java Java theme={null}
public String price(){


}
```

```json Response theme={null}
{
  "rc": 0,
  "mc": "SUCCESS",
  "ma": [],
  "result": [
    {
      "s": "btc_usdt",      //symbol
      "t": 1661856036925    //time
      "p": "9000.0000",     //price
      }
  ]
}
```

## Get the best pending order ticker

`GET` `/v4/public/ticker/book`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | false | | trading pair eg:btc\_usdt | |
| symbols | array | false | | Collection of trading pairs. Priority is higher than symbol. eg: btc\_usdt,eth\_usdt | |
| tags | string | false | | Set of tags, separated by commas, currently only supports spot | |

### Limit Flow Rules

1.single symbol：10/s/ip

2.multiple symbols：10/s/ip

```json Response theme={null}
{
  "rc": 0,
  "mc": "SUCCESS",
  "ma": [],
  "result": [
    {
      "s": "btc_usdt",      //symbol
      "t": 1661856036925,   //last updated time 
      "ap": null,           //asks price(sell one price)
      "aq": null,           //asks qty(sell one quantity)
      "bp": null,           //bids price(buy one price)
      "bq": null            //bids qty(buy one quantity)
    }
  ]
}
```

## Get 24h statistics ticker

`GET` `/v4/public/ticker/24h`

**Parameters**

| Parameter | Type | mandatory | Default | Description | Ranges |
| - | - | - | - | - | - |
| symbol | string | false | | trading pair eg:btc\_usdt | |
| symbols | array | false | | Collection of trading pairs. Priority is higher than symbol. eg: btc\_usdt,eth\_usdt | |
| tags | string | false | | Set of tags, separated by commas, currently only supports spot | |

### Limit Flow Rules

1.single symbol：10/s/ip

2.multiple symbols：10/s/ip

```json Response theme={null}
{
  "rc": 0,
  "mc": "SUCCESS",
  "ma": [],
  "result": [
    {
      "s": "btc_usdt",      //symbol
      "t": 1661856036925,   //time 
      "cv": "0.0000",       //price change value
      "cr": "0.00",         //price change rate
      "o": "9000.0000",     //open price
      "l": "9000.0000",     //lowest price
      "h": "9000.0000",     //highest price
      "c": "9000.0000",     //close price
      "q": "0.0136",        //transaction quantity
      "v": "122.9940"       //transaction volume
    }
  ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.