Interface
This article mainly describes some specifications of the interface from the following two aspects.
- Request standard
- Authentication type
Request Standard
1.Rest Interface
1.1 Request parameter and format
For interfaces using GET, DELETE methods, the parameters should be sent via query string.
Example:
curl https://api-cloud.bitmart.com/contract/v1/ifcontract/contracts?contractID=1
For interfaces using POST, PUT methods, the parameters should be sent in the request body for concent type of application/json.
Example:
curl https://api-cloud.bitmart.com/contract/v1/ifcontract/submitOrder
body: {"contract_id":1,"category":1,"way":1,"open_type":1,"leverage":10,"custom_id":1,"price":5000,"vol":10,"nonce":1589266686}
1.2 Reponse
The server response data format is JSON.
{
"code": 1000,
"trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1",
"message": "OK",
"data": [
{
"low": "130",
"high": "130",
"open": "130",
"close": "130",
"last_price": "130",
"avg_price": "130",
"volume": "0",
"timestamp": 1532610000,
"rise_fall_rate": "0",
"rise_fall_value": "0"
}
]
}
Field | Description |
---|---|
code | Error code,See Details |
message | Error message |
trace | Each request event tracking ID, the server will return for each request |
data | Data returned by the server |
Instruction
1.There is no requirement on the order of request parameters.
2.The data returned by the server is all in json format.
3.If you cannot solve the error yourself, you need to submit the code, trace and message to BitMart.
2.WebSocket Interface
No description.
Authentication Type
This chapter is mainly divided into the following two aspects of interface type details:
- Public interface
- Private interface
1. Public Interface
The public interface can be used to obtain configuration information and market data. Public requests can be called without authentication.
2. Private Interface
The private interface can be used for order and account management. Each private request must be signed using a standardized authentication method. The private interface needs to be verified with your API key.