English
NAV
demo

Change Log (2023-03-17)

2023-03-17

OpenApi V2.0

General Info

SDK and Code Demonstration

Disclaimer:

Java

To get the provided SDK for Bitrue Futures,

python

To get the provided SDK for Bitrue Futures,

General API Information

HTTP Error Codes

Error Codes and Messages

{
  "code": -1121,
  "msg": "Invalid symbol."
}

General Information on Endpoints

LIMITS

Endpoint Security Type

Security Type Description
NONE Endpoint can be accessed freely.
TRADE Endpoint requires sending a valid API-Key and signature.
USER_DATA Endpoint requires sending a valid API-Key and signature.
USER_STREAM Endpoint requires sending a valid API-Key.
MARKET_DATA Endpoint requires sending a valid API-Key.

SIGNED (TRADE and USER_DATA) Endpoint Security

Timing Security

if (timestamp < (serverTime + 1000) && (serverTime - timestamp) <= recvWindow) {
  // process request
} else {
  // reject request
}

SIGNED Endpoint Examples for POST /fapi/v1/order - HMAC Keys

Signature example body:

{"symbol":"BTCUSDT","price":"9300","volume":"1","side":"BUY","type":"LIMIT"}

HMAC SHA256 Signature:

[linux]$ echo -n "1588591856950POST/sapi/v1/order/test{\"symbol\":\"BTCUSDT\",\"price\":\"9300\",\"volume\":\"1\",\"side\":\"BUY\",\"type\":\"LIMIT\"}" | openssl dgst -sha256 -hmac "902ae3cb34ecee2779aa4d3e1d226686"
(stdin)= c50d0a74bb9427a9a03933d0eded03af9bf50115dc5b706882a4fcf07a26b761

Curl command :

  [linux]$ curl -H "X-CH-APIKEY: c3b165fd5218cdd2c2874c65da468b1e" -H "X-CH-SIGN: c50d0a74bb9427a9a03933d0eded03af9bf50115dc5b706882a4fcf07a26b761" -H "X-CH-TS: 1588591856950" -H "Content-Type:application/json" -X POST 'http://localhost:30000/sapi/v1/order/test' -d '{"symbol":"BTCUSDT","price":"9300","quantity":"1","side":"BUY","type":"LIMIT"}'
Key Value
apiKey vmPUZE6mv9SD5V5e14y7Ju91duEh8A
secretKey 902ae3cb34ecee2779aa4d3e1d226686
Parameter Value
symbol BTCUSDT
side BUY
type LIMIT
volume 1
price 9300