关于API的一些说明,亦可参考以下网页
https://www.btcbox.co.jp/api/doc/v1
Index
API Instructions
1. Request Process
- Create request data, user data. Generate signature and data package to be send to Btcbox server
- Send request data, data package to Btcbox by http request: "POST/GET";
- Btcbox server will process the request after safety check
- Btcbox returns data in JSON format, refer to 3 and 4 for detailed format and error code
- Process the returned data;
2. Safety Authentication
All private API will be verified.
Go to Finance->Api, click 'apply', get private key and public key, private key will not be stored, once lost can not be recovered
Important Note: Do not reveal to anybody your keys. They are as important as your password
Signature Process
private api needs to verify the signature, example:
$param = array( amount => 1, price => 10000, type => 'buy', nonce => 141377098123 key => 5zi7w-4mnes-swmc4-egg9b-f2iqw-396z4-g541b signature => 459c69d25c496765191582d9611028b9974830e9dfafd762854669809290ed82 );
parameter description:
nonce -- Can be understood as an increasing integer ,http://zh.wikipedia.org/wiki/Nonce key -- Public key signature -- Parameters like "amount", "price", "type", "nonce", "key" will be combined by '&' to create a new string, encrypt the new string by Sha256 algorithm, key is md5(private key)
3. API_Url
3.1. Ticker
Path: https://www.btcbox.co.jp/api/v1/ticker/
Request method: GET
Parameters
- coin - btc , ltc , eth , bch. Default: btc
Return JSON dictionary
- high - represents highest price
- low - represents lowest price
- buy - represents bid price one
- sell - represents ask price one
- last - represents latest price
- vol - represents last 24 hour trade volume
Return:
{ "high":39700, "low":36300, "buy":1.879, "sell":0, "last":38800, "vol":283.954 }
3.2. Depth
Market Depth, Return data is large, Do not frequently use.
Path: https://www.btcbox.co.jp/api/v1/depth/
Request method: GET
Parameters
- coin - btc , ltc , eth , bch. Default: btc
Return JSON dictionary
- asks - represents sell orders, format is: [price, quantity],the orders are ranked according to price from high to low.
- bids - represents buy orders, format is: [price, quantity],the orders are ranked according to price from high to low.
Return:
{ "asks":[ [ 41700, 10 ], [ 41300, 6 ], [ 40900, 10 ], [ 40500, 6 ], [ 40125, 10.0277 ], [ 40100, 5 ], [ 40089, 0.509 ], [ 39800, 14.7132 ], [ 39799, 0.0695 ], [ 39798, 5 ], [ 39700, 2.89 ], [ 39000, 0.209 ] ], "bids":[ [ 38300, 1.879 ], [ 38100, 1.0078 ], [ 38000, 1.24 ], [ 37700, 4.706 ], [ 37600, 3.8313 ], [ 37001, 0.146 ], [ 36999, 5.8 ], [ 36400, 5 ], [ 36200, 1.3314 ], [ 36002, 2 ], [ 36000, 1.568 ], [ 35501, 0.282 ], [ 35500, 9.9 ], [ 35200, 5.6 ] ] }
3.3. Orders
Return the most recent 100 transactions, Orders are listed by value of "date" and "tid" DESC
Path: https://www.btcbox.co.jp/api/v1/orders/
Request method:GET
Parameters:
- coin - btc , ltc , eth , bch. Default: btc
Return JSON dictionary
- date - timestamp
- price - price
- amount - amount
- tid - Orders ID
- type - buy or sell
Return:
[ { "date":"0", "price":3, "amount":0.1, "tid":"1", "type":"buy" }, { "date":"0", "price":32323, "amount":2, "tid":"2", "type":"sell" }, { "date":"0", "price":32, "amount":432, "tid":"3", "type":"sell" }, { "date":"0", "price":323, "amount":2, "tid":"4", "type":"sell" }, { "date":"0", "price":2100, "amount":0.3, "tid":"5", "type":"buy" } ]
Readonly
3.4. Account Balance
Account information
Path: https://www.btcbox.co.jp/api/v1/balance/
Request method: POST
Parameters
- key - API key
- signature - signature
- nonce - nonce
Return JSON dictionary:
- jpy_balance - Total JPY
- btc_balance - Total BTC
- jpy_lock - Lock JPY
- btc_lock - Lock BTC
- nameauth - Real-name authentication status, 0 -> no, 1 -> wait, 2 -> success
- moflag - Cellphone status, 0 -> no ,1 -> yes
Return:
{ "uid":8, "nameauth":0, "moflag":0, "btc_balance":4234234, "btc_lock":0, "ltc_balance":32429.6, "ltc_lock":2.4, "doge_balance":0, "doge_lock":0, "jpy_balance":2344581.519, "jpy_lock":868862.481 }
3.5. Wallet
Path: https://www.btcbox.co.jp/api/v1/wallet/
Request method: POST
Parameters:
- coin - btc , ltc , eth , bch. Default: btc
- key - API key
- signature - signature
- nonce - nonce
Return JSON dicitionary:
- result - true(success), false(fail)
- address - Bitcoin address
Return:
{ "result":true, "address":"1xxxxxxxxxxxxxxxxxxxxxxxx" }
3.6. Trade_list
return trade list by timestamp or trade type
Path: https://www.btcbox.co.jp/api/v1/trade_list/
Request method: POST
Parameters:
- coin - btc , ltc , eth , bch. Default: btc
- key - API key
- signature - signature
- nonce - nonce
- since - unix timestamp(utc timezone) default == 0
- type - [open or all]
Return JSON dictionary:
- id - ID
- datetime - date and time
- type - "buy" or "sell"
- price - price
- amount_original - total number
- amount_outstanding - The number of remaining
Return:
[ { "id":"7", "datetime":"2014-10-20 13:27:38", "type":"buy", "price":42750, "amount_original":0.235, "amount_outstanding":0.235 }, { "id":"6", "datetime":"2014-10-20 13:27:15", "type":"buy", "price":43299, "amount_original":4.789, "amount_outstanding":4.789 }, { "id":"5", "datetime":"2014-10-20 13:26:52", "type":"buy", "price":42500, "amount_original":14, "amount_outstanding":14 }, { "id":"4", "datetime":"2014-10-20 13:26:23", "type":"buy", "price":43200, "amount_original":0.4813, "amount_outstanding":0.4813 }, { "id":"3", "datetime":"2014-10-20 13:25:57", "type":"buy", "price":43200, "amount_original":0.4813, "amount_outstanding":0.4813 } ]
3.7. Trade_view
Path: https://www.btcbox.co.jp/api/v1/trade_view/
Request method: POST
Parameters:
- coin - btc , ltc , eth , bch. Default: btc
- key - API key
- signature - signature
- nonce - nonce
- id - ID
Return JSON dictionary:
- id - ID
- datetime - format: YYYY-mm-dd HH:ii:ss
- type - "buy" or "sell"
- price - price
- amount_original - total number
- amount_outstanding - The number of remaining
- status - Order status: no, part, cancelled, all
- trades - JSON dictionary list:
- trade_id - ID
- amount - Number of transactions
- price - price of transactions
- datetime - format: YYYY-mm-dd HH:ii:ss
- fee
Return:
{ "id":11, "datetime":"2014-10-21 10:47:20", "type":"sell", "price":42000, "amount_original":1.2, "amount_outstanding":1.2, "status":"closed", "trades":[ ] }Full
3.8. Trade_cancel
Path: https://www.btcbox.co.jp/api/v1/trade_cancel/
Request method: POST
Parameters:
- coin - btc , ltc , eth , bch. Default: btc
- key - API key
- signature - signature
- nonce - nonce
- id - ID
Return JSON dictionary
- result - true(success), false(fail)
- id - ID
Return:
{ result: true (boolean), id: 11 (string) }
3.9. Trade_add
Path: https://www.btcbox.co.jp/api/v1/trade_add/
Request method: POST
Parameters:
- coin - btc , ltc , eth , bch. Default: btc
- key - API key
- signature - signature
- nonce - nonce
- amount - Total number
- price
- type - buy or sell
Return JSON dictionary
- id - ID
- result - true(success), false(fail)
Return:
{ "result":true, "id":"11" }
Data Types
- balance - float
- id - int
- datetime - datetime
- since - int
- type - string
- price - float
- amount* - float
- status - string
- trade_id - int
- fee - float
- result - bool
- message - string
- address - string
DEMO
PHP Source
Common Error Code and Solution
Error Code | Solution |
---|---|
100 | Required parameters can not be empty |
101 | Illegal parameter |
102 | coin does not exist |
103 | Key does not exist |
104 | Signature does not match |
105 | Insufficient permissions |
106 | Request expired(nonce error) |
107 | The price must be an integer |
200 | Lack of balance |
201 | Too small for the number of trading |
202 | Price must be in 0 - 1000000 |
203 | Order does not exist |
301 | No Verified |
401 | System error |
402 | Requests too frequently |
403 | Non-open API |
404 | IP restriction does not request the resource |
评论
0 条评论
文章评论已关闭。