012security_authorization - coinexcom/coinex_exchange_api GitHub Wiki
- All requests based on the Https protocol should set the request header information Content-Type as:'application/json’.
- All input and output data are in JSON format.
- Visit Root URL: https://api.coinex.com/v1
- Signature is required for Account API and trading API related interfaces. The signature data is placed in the authorization header of the HTTP header and authorization is the signature result string. No signature is required for market API related interfaces.
- Request header information must be declared: User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36
- Rate limit: Please refer to the specific instruction of each interface. The general speed limit of the sockets is 200 times per 10 second per IP (for Trading and Account API); no limit on Market API
Sign in to CoinEx before invoking API and get Acquire access_id/secret_key in Account > API.
access_id: To mark identity of API invoker
secret_key: Key to sign the request parameters
Note: access_id/secret_key is equivalent to your account/password. For your asset security, please keep it safe and change it regularly. Once lost, please sign in to CoinEx for reset.
Request parameters should include access_id and all parameters need to be signed.
E.g. Relevant parameters of a request are as follows:
POST:
{
"access_id": "4DA36FFC61334695A66F8D29020EB589",
"market": "BTCBCH",
"type" : "buy",
"price": "10",
"amount": "1.0",
"tonce": 1513746038205
};
GET:
access_id=4DA36FFC61334695A66F8D29020EB589&market=BTCBCH&type=buy&price=680&amount=1.0&tonce=1513746038205
Sort field names alphabetically as follows:
POST:
{
"access_id": "4DA36FFC61334695A66F8D29020EB589",
"amount": "1.0",
"market": "BTCBCH",
"price": "10",
"tonce": 1513746038205,
"type: "buy"
};
GET:
access_id=4DA36FFC61334695A66F8D29020EB589&amount=1.0&market=BTCBCH&price=680&tonce=1513746038205&type=buy
Use & match the sorted parameters as follows:
access_id=4DA36FFC61334695A66F8D29020EB589&amount=1.0&market=BTCBCH&price=680&tonce=1513746038205&type=buy
Add secret_key to the last string to sign, supposing this is a secret_key: B51068CF10B34E7789C374AB932696A05E0A629BE7BFC62F:
access_id=4DA36FFC61334695A66F8D29020EB589&amount=1.0&market=BTCBCH&price=680&tonce=1513746038205&type=buy&secret_key=B51068CF10B34E7789C374AB932696A05E0A629BE7BFC62F
Use MD5 algorithm to encrypt the signature string, convert encrypted result to uppercase, get signature data and put signature data in HTTP Header - authorization:
authorization: 610AB90A1D31D45901D173E4F59C9384
https://api.coinex.com/v1/market/list
# Response
{
"code": 0, # Refer to code error description.
"data": {}, # Return data as list or dictionary.
"message": "Ok" # Code error description.
}