Skip to main content

Market endpoints

The API endpoint under the [Market endpoints] module doesn't require authentication.

Get the server time

Request

curl "https://contract.mexc.com/api/v1/contract/ping"

Response

{
"success": true,
"data":1587442022003
}
  • GET api/v1/contract/ping

Request parameters:

None

Get the contract information

Request

curl "https://contract.mexc.com/api/v1/contract/detail"

Response

{
"success":true,
"code":0,
"data":[
{
"symbol":"BTC_USDT",
"displayName":"BTC_USDT永续",
"displayNameEn":"BTC_USDT SWAP",
"positionOpenType":3,
"baseCoin":"BTC",
"quoteCoin":"USDT",
"settleCoin":"USDT",
"contractSize":0.0001,
"minLeverage":1,
"maxLeverage":125,
"priceScale":2,
"volScale":0,
"amountScale":4,
"priceUnit":0.5,
"volUnit":1,
"minVol":1,
"maxVol":5000000,
"bidLimitPriceRate":0.03,
"askLimitPriceRate":0.03,
"takerFeeRate":0.0006,
"makerFeeRate":0.0002,
"maintenanceMarginRate":0.004,
"initialMarginRate":0.008,
"riskBaseVol":150000,
"riskIncrVol":150000,
"riskIncrMmr":0.004,
"riskIncrImr":0.004,
"riskLevelLimit":5,
"priceCoefficientVariation":0.05,
"indexOrigin":[
"Binance",
"GATEIO",
"HUOBI",
"MXC"
],
"state":0,
"isNew":false,
"isHot":true,
"isHidden":false,
"conceptPlate": [
"mc-trade-zone-grey",
"mc-trade-zone-pow"
],
"riskLimitType": "BY_VOLUME",
"maxNumOrders": [
200,
50
],
"marketOrderMaxLevel": 15,
"marketOrderPriceLimitRate1": 0.03,
"marketOrderPriceLimitRate2": 0.005,
"triggerProtect": 0.05,
"appraisal": 0,
"showAppraisalCountdown": 0,
"automaticDelivery": 0,
"apiAllowed": false
},
]
}
  • GET api/v1/contract/detail

Request parameters:

ParameterDate TypeMandatoryDescription
symbolstringfalsethe name of the contract

Response parameters:

ParameterDate TypeDescription
symbolstringthe name of the contract
displayNamestringdisplay name
displayNameEnstringenglish display name
positionOpenTypeintposition open type,1:isolated,2:cross,3:both
baseCoinstringbase currency such as BTC
quoteCoinstringquote currency such as USDT
settleCoinstringliquidation currency such as USDT
contractSizedecimalcontract value
minLeverageintminimum leverage
maxLeverageintmaximum leverage
priceScaleintprice scale
volScaleintquantity scale
amountScaleintamount scale
priceUnitintprice unit
volUnitintvolume unit
minVoldecimalminimum volume
maxVoldecimalmaximum volume
bidLimitPriceRatedecimalbid limit price rate
askLimitPriceRatedecimalask limit price rate
takerFeeRatedecimaltaker rate
makerFeeRatedecimalmaker rate
maintenanceMarginRatedecimalmaintenance margin rate
initialMarginRatedecimalinitial margin rate
riskBaseVoldecimalinitial volume
riskIncrVoldecimalrisk increasing volume
riskIncrMmrdecimalmaintain increasing margin rate
riskIncrImrdecimalinitial increasing margin rate
riskLevelLimitintrisk level limit
priceCoefficientVariationdecimalfair price coefficient variation
indexOriginListindex origin
stateintstatus, 0:enabled,1:delivery, 2:completed, 3: offline, 4: pause
apiAllowedboolwhether support api
conceptPlateListThe zone, corresponding to the entryKey field of the section list
riskLimitTypeListRisk limit type, BY_VOLUME: by the volume, BY_VALUE: by the position

Get the transferable currencies

Request

curl "https://contract.mexc.com/api/v1/contract/support_currencies"

Response

{
"success": true,
"code": 0,
"data": [
"BTC",
"ETH",
"USDT"
]
}
  • GET api/v1/contract/support_currencies

Request parameters:

None

Response parameters:

The returned "data" field contains a list of string with each string represents a suppported currency.

Get the contract‘s depth information

Request

curl "https://contract.mexc.com/api/v1/contract/depth/BTC_USDT"

Response

{
"asks":[
[
3968.5,
121
],
[
3968.6,
160,
4
]
],
"bids":[
[
3968.4,
179,
4
],
[
3968,
914,
3
]
],
"version":1,
"timestamp":1587442022003
}
  • GET api/v1/contract/depth/{symbol}

Request parameters:

ParameterDate TypeMandatoryDescription
symbolstringtruethe name of the contract
limitintfalsetier

Response parameters:

ParameterData TypeDescription
asksListthe seller depth
bidsListthe buyer depth
versionlongthe version number
timestamplongsystem timestamp

note: [411.8, 10, 1] 411.8 is the price,10 is the volume of contracts for this price,1 is the order quantity

Get a snapshot of the latest N depth information of the contract

Request

curl "https://contract.mexc.com/api/v1/contract/depth_commits/BTC_USDT/20"

Response

{
"success": true,
"code": 0,
"data": [
{
"asks": [
[
31792,
59105,
1
]
],
"bids": [],
"version": 1481763378
}
]
}
  • GET api/v1/contract/depth_commits/{symbol}/{limit}

Request parameter:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract
limitinttruecount

Response parameters:

ParameterData TypeDescription
asksListthe seller depth
bidsListthe buyer depth
versionlongthe version number

Get contract index price

Request

curl "https://contract.mexc.com/api/v1/contract/index_price/BTC_USDT"

Response

{
"success": true,
"code": 0,
"data": {
"symbol": "BTC_USDT",
"indexPrice": 31104.6,
"timestamp": 1609829627708
}
}
  • GET api/v1/contract/index_price/{symbol}

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract

Response parameters:

ParameterData TypeDescription
symbolstringtrading pair
indexPricedecimalindex price
timestamplongsystem timestamp

Get contract fair price

Request

curl "https://contract.mexc.com/api/v1/contract/fair_price/BTC_USDT"

Response

{
"success": true,
"code": 0,
"data": {
"symbol": "BTC_USDT",
"fairPrice": 31103.4,
"timestamp": 1609829705178
}
}
  • GET api/v1/contract/fair_price/{symbol}

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract

Response parameters:

ParameterData TypeDescription
symbolstringthe name of the contract
fairPricedecimalfair price
timestamplongsystem timestamp

Get contract funding rate

Request

curl "https://contract.mexc.com/api/v1/contract/funding_rate/BTC_USDT"

Response

{
"success": true,
"code": 0,
"data": {
"symbol": "BTC_USDT",
"fundingRate": -0.000489,
"maxFundingRate": 0.001,
"minFundingRate": -0.001,
"collectCycle": 8,
"nextSettleTime": 1609833600000,
"timestamp": 1609829807577
}
}
  • GET api/v1/contract/funding_rate/{symbol}

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract

Response parameters:

ParameterData TypeDescription
symbolstringthe name of the contract
fundingRatedecimalfunding rate
maxFundingRatedecimalmax funding rate
minFundingRatedecimalmin funding rate
collectCycleintcharge cycle
nextSettleTimelongnext charge time
timestamplongsystem timestamp

K-line data

Request

curl "https://contract.mexc.com/api/v1/contract/kline/BTC_USDT?interval=Min15&start=1609992674&end=1609992694"

Response

{
"success": true,
"code": 0,
"data": {
"time": [
1609740600
],
"open": [
33016.5
],
"close": [
33040.5
],
"high": [
33094.0
],
"low": [
32995.0
],
"vol": [
67332.0
],
"amount": [
222515.85925
]
}
}
  • GET api/v1/contract/kline/{symbol}

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract
intervalstringfalseinterval: Min1、Min5、Min15、Min30、Min60、Hour4、Hour8、Day1、Week1、Month1,default: Min1
startlongfalsestart timestamp,seconds
endlongfalseend timestamp,seconds

Response parameters:

ParameterData TypeDescription
opendoublethe opening price
closedoublethe closing price
highdoublethe highest price
lowdoublethe lowest price
voldoublevolume
timelongtime window

Attention:

1、The maximum data in a single request is 2000 pieces. If your choice of start/end time and granularity of time results in more than the maximum volume of data in a single request, your request will only return 2000 pieces. If you want to get sufficiently fine-grained data over a larger time range, you need to make several times requests.

2、If only the start time is provided, then query the data from the start time to the current system time. If only the end time is provided, the 2000 pieces of data closest to the end time are returned. If neither start time nor end time is provided, the 2000 pieces of data closest to the current time in the system are queried.

Get K-line data of the index price

Request

curl "https://contract.mexc.com/api/v1/contract/kline/index_price/BTC_USDT?interval=Min15&start=1609992674&end=1609992694"

Response

{
"success": true,
"code": 0,
"data": {
"time": [
1609740900
],
"open": [
33039.0
],
"close": [
33233.1
],
"high": [
33352.3
],
"low": [
33007.9
],
"vol": [
0.0
],
"amount": [
0.0
]
}
}
  • GET api/v1/contract/kline/index_price/{symbol}

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract
intervalstringfalseinterval: Min1、Min5、Min15、Min30、Min60、Hour4、Hour8、Day1、Week1、Month1,default: Min1
startlongfalsestart timestamp,seconds
endlongfalseend timestamp,seconds

Response parameters:

ParameterData TypeDescription
opendoublethe opening price
closedoublethe closing price
highdoublethe highest price
lowdoublethe lowest price
voldoublevolume
timelongtime window

Attention:

1、The maximum data in a single request is 2000 pieces. If your choice of start/end time and granularity of time results in more than the maximum volume of data in a single request, your request will only return 2000 pieces. If you want to get sufficiently fine-grained data over a larger time range, you need to make several times requests.

2、If only the start time is provided, then query the data from the start time to the current system time. If only the end time is provided, the 2000 pieces of data closest to the end time are returned. If neither start time nor end time is provided, the 2000 pieces of data closest to the current time in the system are queried.

Get K-line data of the fair price

Request

curl "https://contract.mexc.com/api/v1/contract/kline/fair_price/BTC_USDT?interval=Min15&start=1609992674&end=1609992694"

Response

{
"success": true,
"code": 0,
"data": {
"time": [
1609740900
],
"open": [
33041.0
],
"close": [
33233.3
],
"high": [
33354.8
],
"low": [
33009.4
],
"vol": [
0.0
],
"amount": [
0.0
]
}
}
  • GET api/v1/contract/kline/fair_price/{symbol}

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract
intervalstringfalseinterval: Min1、Min5、Min15、Min30、Min60、Hour4、Hour8、Day1、Week1、Month1,default: Min1
startlongfalsestart timestamp,seconds
endlongfalseend timestamp,seconds

Response parameters:

ParameterData TypeDescription
opendoublethe opening price
closedoublethe closing price
highdoublethe highest price
lowdoublethe lowest price
voldoublevolume
timelongtime window

Attention:

1、The maximum data in a single request is 2000 pieces. If your choice of start/end time and granularity of time results in more than the maximum volume of data in a single request, your request will only return 2000 pieces. If you want to get sufficiently fine-grained data over a larger time range, you need to make several times requests.

2、If only the start time is provided, then query the data from the start time to the current system time. If only the end time is provided, the 2000 pieces of data closest to the end time are returned. If neither start time nor end time is provided, the 2000 pieces of data closest to the current time in the system are queried.

Get contract transaction data

Request

curl "https://contract.mexc.com/api/v1/contract/deals/BTC_USDT"

Response

{
"success": true,
"code": 0,
"data": [
{
"p": 31199,
"v": 18,
"T": 1,
"O": 3,
"M": 2,
"t": 1609831235985
},
{
"p": 31199,
"v": 15,
"T": 2,
"O": 3,
"M": 1,
"t": 1609831234759
}
]
}
  • GET api/v1/contract/deals/{symbol}

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract
limitintfalseconsequence set quantity ,maximum is 100, default 100 without setting

Response parameters:

ParameterData TypeDescription
pdecimaltransaction price
vdecimalquantity
Tintdeal type,1:purchase,2:sell
Ointopen position, 1: Yes,2: No, when O is 1, vol is additional position
Mintself-transact,1:yes,2:no
tlongtransaction time

Get contract trend data

Request

curl "https://contract.mexc.com/api/v1/contract/ticker"

Response

{
"success": true,
"code": 0,
"data": {
"symbol": "BTC_USDT",
"lastPrice": 31199,
"bid1": 31198.5,
"ask1": 31199,
"volume24": 40146908,
"amount24": 124905007.4428,
"holdVol": 55102960,
"lower24Price": 27795,
"high24Price": 33152.5,
"riseFallRate": -0.0176,
"riseFallValue": -562,
"indexPrice": 31016.3,
"fairPrice": 31199.5,
"fundingRate": 0.001,
"maxBidPrice": 31946.5,
"minAskPrice": 30085.5,
"timestamp": 1609831334016
}
}
  • GET api/v1/contract/ticker

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringfalsethe name of the contract

Response parameters:

ParameterData TypeDescription
symbolstringthe name of the contract
lastPricedecimalthe latest price
bid1decimalpurchase price
ask1decimalsell price
volume24decimal24 hours trading volume, according to the volume of statistical count
amount24decimal24 hours transaction volume
holdVoldecimaltotal holdings
lower24Pricedecimallowest price within 24 hours
high24Pricedecimalhighest price within 24 hours
riseFallRatedecimalrise/fall rate
riseFallValuedecimalrise/fall value
indexPricedecimalindex price
fairPricedecimalfair price
fundingRatedecimalfunding rate
timestamplongtransaction timestamp

Get all contract risk fund balance

Request

curl "https://contract.mexc.com/api/v1/contract/risk_reverse"

Response

{
"success": true,
"code": 0,
"data": [
{
"symbol": "BTC_USDT",
"currency": "USDT",
"available": 425018.32968325152473812,
"timestamp": 1609831395734
},
{
"symbol": "BTC_USD",
"currency": "BTC",
"available": 5.00211366264782435,
"timestamp": 1609831395734
},
]
}
  • GET api/v1/contract/risk_reverse

Request parameters:

None

Response parameters:

parameter nametypedescription
symbolstringthe name of the cntract
currencystringcurrency
availabledecimalavailable balance
timestamplongsystem timestamp

Get contract risk fund balance history

Request

curl "https://contract.mexc.com/api/v1/contract/risk_reverse/history?symbol=BTC_USDT&page_num=1&page_size=20"

Response

{
"success": true,
"code": 0,
"data": {
"pageSize": 2,
"totalCount": 42,
"totalPage": 21,
"currentPage": 1,
"resultList": [
{
"symbol": "BTC_USDT",
"currency": "USDT",
"available": 424288.053161046680168662,
"snapshotTime": 1609819200000
},
{
"symbol": "BTC_USDT",
"currency": "USDT",
"available": 423989.817244106347071489,
"snapshotTime": 1609804800000
}
]
}
}
  • GET api/v1/contract/risk_reverse/history

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract
page_numinttruecurrent page number, default is 1
page_sizeinttruethe page size, default 20, maximum 100

Response parameters:

ParameterData TypeDescription
pageSizeintpage size
totalCountinttotal count
totalPageinttotal pages
currentPageintcurrent page
resultListlistdata consequence set
symbolstringthe name of the contract
currencystringliquidation currency
availabledecimalbalance
snapshotTimelongsnapshot time

Get contract funding rate history

Request

curl "https://contract.mexc.com/api/v1/contract/funding_rate/history?symbol=BTC_USDT&page_num=1&page_size=20"

Response

{
"success": true,
"code": 0,
"data": {
"pageSize": 2,
"totalCount": 21,
"totalPage": 11,
"currentPage": 1,
"resultList": [
{
"symbol": "BTC_USDT",
"fundingRate": 0.000266,
"settleTime": 1609804800000
},
{
"symbol": "BTC_USDT",
"fundingRate": 0.00029,
"settleTime": 1609776000000
}
]
}
}
  • GET api/v1/contract/funding_rate/history

Request parameters:

ParameterData TypeMandatoryDescription
symbolstringtruethe name of the contract
page_numinttruecurrent page number, default is 1
page_sizeinttruethe page size, default 20, maximum 1000

Response parameters:

ParameterData TypeDescription
pageSizeintpage size
totalCountintthe total count
totalPageintthe total pages
currentPageintthe current page
resultListlistdata consequence set
symbolstringthe name of the contract
fundingRatedecimalfunding rate
settleTimelongliquidation time