HPX.com provides a simple and useful API to its users. It will help users to quickly and efficiently integrate HPX trading function into their own applications.
If you have any question, you can contact our telegram group @hpxexchange for help; We will provide you with the most authoritative answers.
1. Market Info API
(1) Returns new markets information
API |
Description |
http://api.hpx.world/data/v2/ticker |
Market |
Returned value description
high: highest price
low: lowest price
buy: buy
sell: sell
last: the latest price
volume: trading volume in last 24 hours
Request parameter description
Parameter name |
Description |
currency |
hc_cnyt: hcash/cnyt |
btc_cnyt: btc/cnyt |
|
eos_eth: eos_eth |
|
leek_cnyt: leek/cnyt |
|
trx_cnyt: trx_cnyt |
(2) Returns all markets information
API |
Description |
https://api.hpx.com/data/v2/tickers |
All market info |
Returned value description
high: highest price
low: lowest price
buy: buy
sell: sell
last: the latest price
volume: trading volume in last 24 hours
(3) Returns market depth
API |
Description |
https://api.hpx.com/data/v2/depth |
Depth |
Returned value description
asks: the seller depth
bids: the buyer depth
timestamp: the depth of this timestamp
Request parameter description
Parameter name |
Description |
currency |
hc_cnyt: hcash/cnyt |
btc_cnyt: btc/cnyt |
|
eos_eth: eos_eth |
|
leek_cnyt: leek/cnyt |
|
trx_cnyt: trx_cnyt |
|
Size |
Default is 3 |
Merge |
Merge depth, defalut is 0.1 |
(4) Return history trading record
API |
Description |
https://api.hpx.com/data/v2/trades |
History |
Returned value description
date: date/timestamp
price: price
amount: amount
tid: Txhash
type: type,0=buy/ 1=sell
Request parameter description
Parameter name |
Description |
currency |
hc_cnyt: hcash/cnyt |
btc_cnyt: btc/cnyt |
|
eos_eth: eos_eth |
|
leek_cnyt: leek/cnyt |
|
trx_cnyt: trx_cnyt |
(5) Return Kline
API |
Description |
https://api.hpx.com/data/v2/kline |
Kline |
Returned value description
data:Kline content
data:explanation
[1417536000000:timestamp,2370.16:open,2380: high,2352:low,2367.37: close,17259.83:trading volume]
Request parameter description
Parameter name |
Description |
currency |
hc_cnyt: hcash/cnyt |
btc_cnyt: btc/cnyt |
|
eos_eth: eos_eth |
|
leek_cnyt: leek/cnyt |
|
trx_cnyt: trx_cnyt |
(6) Return trading pairs
API |
Description |
https://api.hpx.com/data/v2/symbols |
Trading Pairs |
Returned value description
Code: 0000 means successful
data: all trading pairs at HPX
Symble: trading pair symble
fPricePlace:demicals
id:trading pair ID
(7)Return all trading pairs
API |
Description |
Get all trading pairs |
Returned value description
[{"marketName":"CNYT","fromSymbol":"HC","toSymbol":"CNYT","assetName":"HC","id":"HC_CNYT"},
{"marketName":"CNYT","fromSymbol":"BTC","toSymbol":"CNYT","assetName":"BTC","id":"BTC_CNYT"}]
Request parameter description
marketName:trading zone
fromSymbol:left side of trading pair
toSymbol:right side of trading pair
id:trading pair ID
2. Trade API
(1) Return order
API |
Description |
https://api.hpx.com/api/v2/order |
Order |
Returned value description
Code: return to code
message: prompt message
id: order id
Request parameter instruction
Parameter name |
Description |
method |
Assign Order |
accesskey |
Accesskey |
currency |
btc_cnyt: btc_CNYT |
Trade type |
0:buy, 1:sell. |
Price |
Price |
Amount |
amount |
sign |
Request encrypted signature string |
reqtime |
The current time in milliseconds |
(2) Return a commissioned buy order or sell order
API |
Description |
https://api.hpx.com/api/v2/getOrder |
Get Order |
Returned value description
Currency: currency
Id: order number
Price: price
Status: status (1: wait for sell, 2:partially sold, 3: completed 5: canceled)
Total_amount: total amount
Trade_amount: trade amount
Trade_date: trade date
Trade_money: trade money
Trade_price: trade average price
Type: type 0/1[buy/sell]
Request parameter description
parameter name |
Description |
method |
Cancel Order |
accesskey |
Accesskey |
id |
Order id |
currency |
btc_cnyt: BTC/CNYT |
sign |
Request encrypted signature string |
reqtime |
The current time in milliseconds |
(3) Return multiple commissions for paying or selling orders, and returns pagesize<100 records per request
API |
Description |
https://api.hpx.com/api/v2/getOrders |
Gets multiple commissions for paying or selling orders, and returns pagesize<100 records per request |
Returned value description
Currency: currency
Id: order number
Price: price
Status: status (1: wait for sell, 2:partially sold, 3: completed 5: canceled)
Total_amount: total amount
Trade_amount: trade amount
Trade_date: trade date
Trade_money: trade money
Trade_price: trade average price
Type: type 0/1[buy/sell]
Request parameter instruction
parameter name |
Description |
method |
Assign to Getorder |
accesskey |
Accesskey |
tradetype |
Type 0/1[buy/sell] |
currency |
hc_cnyt: Keep the decimal three |
btc_cnyt: Keep the decimal two |
|
eos_eth: Keep the decimal six |
|
leek_cnyt: Keep the decimal four |
|
trx_cnyt: Keep the decimal four |
|
pageindex |
Page number |
pagesize |
Quantity per page |
sign |
Request encrypted signature string |
reqtime |
The current time in milliseconds |
(4) Return your history trading record
API |
Description |
Get your history trading record |
Returned value description
[{"amount":5.000000000000,"price":45000.000000000000,"id":2567104,"type":"buy","timestamp":1542081470000}]
Request parameter instruction
method:assigned getHistoryTrades
accesskey:user’s requeted accesskey
pair:name of trading pairs
limit:paging size
fromId:record ID
- Cancel order
API |
Description |
https://api.hpx.com/api/v2/cancel
|
Cancel order |
Returned value description:
code:returned code
message:returned message
Request parameter instruction
API |
Description |
accesskey |
accesskey |
id |
Order id
|
currency |
btc_cnyt:BTC/CNYT |
(6)cancel all order
API |
Description |
https://api.hpx.com/api/v2/cancelAll
|
Cancel all order |
Returned value description:
code:returned code
message:returned message
Request parameter instruction
API |
Description |
accesskey |
accesskey |
fexchangeid
|
Trading pair ID |
type
|
Trading type, 0=buy, 1=sell |
minPrice
|
Minimum price |
maxPrice
|
Maximum price |
3. Account API
(1) Return account info
API |
Description |
https://api.hpx.com/api/v2/getAccountInfo |
Get account info |
Returned value description
totalAsset:total asset estimated(RMB)
balance:Available balance
frozen:frozen balance
lock:locked balance
Request parameter instruction
parameter name |
Description |
method |
Get account info |
accesskey |
Accesskey |
sign |
Request encrypted signature string |
reqtime |
The current time in milliseconds |
(2) Return user deposit address
API |
Description |
https://api.hpx.com/api/v2/getUserAddress |
Get user address |
Returned value description
Key: address
Request parameter instruction
parameter name |
Description |
method |
Cancel Order |
accesskey |
Accesskey |
ID |
Order Number |
currency |
Btc, currency name |
sign |
Request encrypted signature string |
reqtime |
The current time in milliseconds |
(3) Return withdrawal record
API |
Description |
https://api.hpx.com/api/v2/getWithdrawRecord |
Get withdraw record |
Returned value description
Code: code
Message: prompt message
Amount: amount
Fees: withdraw fee
Id: withdraw id
Managetime: withdraw handling timestamp
Submittime: withdraw submit timestamp
Toaddress: withdraw address
Request parameter instruction
parameter name |
Description |
method |
Get withdraw record |
accesskey |
Accesskey |
currency |
Btc, currency name |
pageindex |
Page number |
pagesize |
Quantity per page |
sign |
Request encrypted signature string |
reqtime |
The current time in milliseconds |
(4) Return charge record
API |
Description |
https://api.hpx.com/api/v2/getChargeRecord |
Get charge record |
Returned value description
Code: code
Message: prompt message
Amount: amount
Confirmtimes: confirm times
Currency: currency name
Description: transaction process
Hash: txhash
Id: recharge id
Status: status (0 waiting for confirm, 1 recharge failed, 2 recharge succeed)
Submit_time: submit time
Address: recharge address
Request parameter instruction
parameter name |
Description |
method |
Get charge record |
accesskey |
Accesskey |
currency |
Btc, currency name |
pageindex |
Page number |
pagesize |
Quantity per page |
sign |
Request encrypted signature string |
reqtime |
The current time in milliseconds |
4.Wrong Code
All API method will return to JSON error when request failed or unknown error happened.
Code |
Description |
0000 |
Call successful |
1000 |
System Exception |
2000 |
Illegal access |
2001 |
Acceekey can’t be blank |
2002 |
Illegal accesskey |
2011 |
Wrong format of timestamp |
2012 |
Timestamp has different time than system time |
2021 |
Sign can’t be blank |
2022 |
Signatures are different |
2023 |
Sign failed |
2031 |
Project parameter can’t be blank |
3000 |
User status exception |
3001 |
Insufficient balance on wallet |
3100 |
Unsupportive balance |
3101 |
Transaction pause at this period |
3102 |
The price is beyond the reasonable range |
3103 |
The transaction value is not within a reasonable range |
3104 |
Order failed |
3105 |
Cancel order failed |
3106 |
Cancel all orders failed |
3107 |
Failed to obtain order information |
3108 |
Unsupportive currency |
3109 |
Exceed daily withdraw limit |
3110 |
Exceed daily withdraw amount |
3111 |
Bind mobile phone or email first |
3112 |
Complete KYC first |
3113 |
The account has been frozen, please contact customer service for help |
3114 |
Users are prohibited to withdraw currency, please contact customer service for help |
3115 |
Close position |
3116 |
Minimum withdraw amount |
3117 |
Set trading password first |
3118 |
Trading password error happened many times, exceed the daily limit times |
3119 |
Wrong trading password |
3120 |
Insufficient balance |
3121 |
Withdraw address has not been verified. |
3122 |
The request frequency is high, please try later |
3123 |
No corresponding address |
5.Example Code
Currently we only support Java version, we will support other languages later. If you have any question, please contact our telegram group @hpxexchange for help. We will solve it for your as soon as possible.
Signature method: use SHA to encrypt secretkey, then sign the parameters of the request according to the encrypted secretkey. The parameters of the request are sorted and encrypted according to the list of interface parameters above, and the 16-bit encryption is filled in by md5.
Below is a sample of order in (http://api.hpx.world/api/v2/order)
HashMap<String, String> signMap = new LinkedHashMap<>();
signMap.put("method","order");
signMap.put("accesskey","ak55c32cf539d247da");
signMap.put("currency","btc_cnyt");
signMap.put("tradeType","0");
signMap.put("price","6");
signMap.put("amount","1");
signMap.remove("sign");
signMap.remove("reqTime");
String plainText = EncryptDigestUtil.getPlainSignString(signMap);
// secretket use SHA to encrypt key
String encryptSecretKey = EncryptDigestUtil.digest("b1c25258ae40472db2f5fea1331a5051");
String mySign = EncryptDigestUtil.sign(plainText, encryptSecretKey);
System.out.println("Plain Text: " + plainText + ", encryptSecretKey:" + encryptSecretKey + ", Signature Text: " + mySign);
Join code in Plain Text(requested time stamp and signature is not in encrypted string.): method=order&accesskey=ak55c32cf539d247da¤cy=btc_cnyt&tradeType=0&price=6&amount=1
SHA encrupted secretkey: d9fafceee688bf9f438c2efdd763ba5409943f22
Encrypt result:f7351f3cc913ece07af7e8be771b6076
6.FAQ
Access limit
each user is limited to requesting data only once per second.
评论
0 条评论
文章评论已关闭。