Skip to content

API Call Description

huyaohua edited this page Jan 19, 2020 · 1 revision

Quote API uses Get mode and other APIs use Post mode.
For security reasons, API requests other than market APIs must be signed. A legitimate request consists of the following parts:

  • Method request address or access server address:https://api.bitforex.com Followed by the method name, such as https://api.bitforex.com/api/v1/fund/mainAccount?currency=btc.

  • API access key (accessKey) accessKey in your requested APIKEY.

  • request time (nonce) The timestamp (in milliseconds) that you initiated the request.

  • SignData The calculated value of the signature used to ensure that the signature is valid and has not been tampered with. ``` signData=hex(HMAC_SHA256(secretKey, content))

# Example request link
/api/v1/trade/placeOrder?
symbol=coin-usd-eth
&price=1000
&amount=1
&tradeType=1
&nonce=1501234567890
&accessKey=fd91cd9ba2cc78fed6bb40e0bcff29ba
       
# Sort params (sort by first letter, first letter is same as the second letter):
accessKey=fd91cd9ba2cc78fed6bb40e0bcff29ba
&amount=1
&nonce=1501234567890
&price=1000
&symbol=coin-usd-eth
&tradeType=1

# Signed Content(content)为:
/api/v1/trade/placeOrder?accessKey=fd91cd9ba2cc78fed6bb40e0bcff29ba&amount=1&nonce=1501234567890&price=1000&symbol=coin-usd-eth&tradeType=1
  
# For signing keys(secretKey):
82f192d903f363f22a031dfdbbeaf851
 
# Perform HMAC_SHA256 encryption and convert to hexadecimal. The result is:
2a0a848d76920a425190c5f2c509b45ef730956fac5331c79a988671223fd367

# Finally sent to the server api request is:
https://api.bitforex.com/api/v1/trade/placeBuyOrder?accessKey=fd91cd9ba2cc78fed6bb40e0bcff29ba&amount=1&nonce=1501234567890&price=1000&symbol=coin-usd-eth&signData=2a0a848d76920a425190c5f2c509b45ef730956fac5331c79a988671223fd367