access_key
access_key
can be found in API Token page.There are two kinds of API interfaces for developers:
PUBLIC API | PRIVATE API | |
---|---|---|
Verification | No Verification | Require Verification |
Application Frequency | No Limitation | 600 requests / 5 mins |
Preparations | No Preparation Required | Use your API Token page to get access/secretkey |
Before applying for Private API signature, you should prepare your access/secret_key. These materails could be found in the API Token page after registration.
All Private API users need the following 3 parameters when doing identity verification:
access_key
access_key
can be found in API Token page.tonce
tonce
is the time stamp using positive integer, it repesents the number of millisecond from Unix epoch The time error between tonce and Peatio's server could be limited to plus-minus 30 seconds. And, every value of tonce can only be used once.The generation process of signature is simple. First, the application should be transfer into a character string. Then use this character string to do HMAC-SHA256 calculation:
payload
is representing the applied character string, it could be fomulate by using HTTP method. The application address and parameter is listed below.
Assume the secret key
is yyy
, then using HMAC-SHA256 algorithm to calculate the payload
mentioned above, the result is(use hex to illustrate).
Now, we could make application by using this signature(use curl for example):
If API call failed, the return will use HTTP status code. Also, the return include detail error information showing JSON data. For example:
All the errors have the same format according to the above sentence, the only differences are code
and message
. Code is the custom error defined by Peatio, it illustrates the category of the error. Message is detail error information.
For complete API application, Peatio will return 200
for JSON data.
Cancel order and cancel all the orders are asynchronous operations, API return complete only means cancel application has been submitted, it doesn't mean your order has been canceled. If you have orders which haven't been processed or the cancel queue is busy, your cancel application will delay. API returns the canceled order, the return order may not be conceled. Your code should not rely on API retrun result. It should get the latest status by using "order inquiry interface".