请先登录
| Resource | Description |
|---|---|
|
ok_sub_spot_X_ticker New
Subscribe Price Ticker
websocket.send("{'event':'addChannel','channel':'ok_sub_spot_X_ticker'}"); ① value of X is: btc_usd, ltc_usd, eth_usd, etc_usd, bcc_usdExample# Request {'event':'addChannel','channel':'ok_sub_spot_btc_usd_ticker'} # Response [{ "channel":"ok_sub_spot_btc_usd_ticker", "data":{ "buy":2478.3, "high":2555, "last":2478.51, "low":2466, "sell":2478.5, "timestamp":1411718074965, "vol":49020.30 } }] Returned Value Descriptionbuy(double): best bid high(double): highest price last(double): latest price low(double): lowest price sell(double): best ask timestamp(long): timestamp vol(double: volume(the most recent 24 hours) |
|
|
ok_sub_spot_X_depth New
Subscribe Market Depth(Increment)
websocket.send("{'event':'addChannel','channel':'ok_sub_spot_X_depth'}"); ① the value of X is: btc_usd, ltc_usd, eth_usd, etc_usd, bcc_usd
|
|
|
ok_sub_spot_X_depth_Y New
Subscribe Market Depth(Full)
websocket.send("{'event':'addChannel','channel':'ok_sub_spot_X_depth_Y'}"); ① value of X is: btc_usd, ltc_usd, eth_usd, etc_usd, bcc_usd
|
|
|
ok_sub_spot_X_deals New
Subscribe Trade Records
websocket.send("{'event':'addChannel','channel':'ok_sub_spot_X_deals'}"); value of X is: btc_usd, ltc_usd, eth_usd, etc_usd, bcc_usdExample# Response
[{
"channel":"ok_sub_spot_btc_usd_deals",
"data":[["1001","2463.86","0.052","16:34:07","ask"]]
}]
Returned Value Description[tid, price, amount, time, type] [string, string, string, string, string] |
|
|
ok_sub_spot_X_kline_Y New
Subscribe Candlestick Chart Data
websocket.send("{'event':'addChannel','channel':'ok_sub_spot_X_kline_Y'}"); ① value of X is: btc_usd, ltc_usd, eth_usd, etc_usd, bcc_usd
|
|
| Resource | Description | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
login New
Login(Personal Information)
Example# Request {"event":"login","parameters":{"api_key":"xxx","sign":"xxx"}} # Response [ { "binary": 0, "channel": "login", "data": { "result": true } } ] Request Parameters
DescriptionThe data will return when it changed. These types need not be subscribed. eg:ok_sub_spot_X_order,ok_sub_spot_X_balance |
|||||||||||||||
|
ok_spot_order New
Place Orders
websocket.send("{'event':'addChannel','channel':'ok_spot_order','parameters': {'api_key':'XXXX','sign':'XXXX','symbol':'btc_usd','type':'buy','price':'50','amount':'0.02'}}"); Example# Request { 'event':'addChannel', 'channel':'ok_spot_order', 'parameters':{ 'api_key':'XXXX', 'sign':'XXXX', 'symbol':'btc_usd', 'type':'buy', 'price':'50', 'amount':'0.02' } } # Response [{ "channel":"ok_spot_order", "data":{ "order_id":125433029, "result":true } }] Returned Value Descriptionorder_id(long):order id result(boolean):execute result Request Parameters
|
|||||||||||||||
|
ok_spot_cancel_order New
Cancel Order
websocket.send("{'event':'addChannel','channel':'ok_spot_cancel_order','parameters': {'api_key':'XXXX','sign':'XXXX','symbol':'btc_usd','order_id':'125433027'}}"); Example# Request { 'event':'addChannel', 'channel':'ok_spot_cancel_order', 'parameters':{ 'api_key':'XXXX', 'sign':'XXXX', 'symbol':'btc_usd', 'order_id':'125433027' } } # Response [{ "channel":"ok_spot_cancel_order", "data":{ "order_id":125433027, "result":true } }] Returned Value Descriptionorder_id(long):order id result(boolean):execute result Request Parameters
|
|||||||||||||||
|
ok_spot_userinfo New
Get User Account Info
websocket.send("{'event':'addChannel','channel':'ok_spot_userinfo','parameters': {'api_key':'XXXX','sign':'XXXX'}}"); Example# Request { 'event':'addChannel', 'channel':'ok_spot_userinfo', 'parameters':{ 'api_key':'XXXX', 'sign':'XXXX' } } # Response [{ "channel": "ok_spot_userinfo", "data": { "info": { "funds": { "asset": { "net": "0", "total": "0" }, "borrow": { "btc": "0", "usd": "0", "ltc": "0", "eth": "0" }, "free": { "btc": "0", "usd": "0", "ltc": "0", "eth": "0" }, "freezed": { "btc": "0", "usd": "0", "ltc": "0", "eth": "0" }, "union_fund": { "btc": "0", "ltc": "0", "eth": "0" } } }, "result": true } }] Returned Value Descriptionasset: account funds, including net fund and total fund borrow: account borrowing information (only returned when this field is not null) free: available fund freezed: frozen fund union_fund: fund management information (only returned when this field is not null) Request Parameters
|
|||||||||||||||
|
ok_spot_orderinfo New
Get Order Info
websocket.send("{'event':'addChannel','channel':'ok_spot_orderinfo','parameters': {'api_key':'XXXX','sign':'XXXX','symbol':'btc_usd','order_id':'20914907'}}"); Example# Request { 'event':'addChannel', 'channel':'ok_spot_orderinfo', 'parameters':{ 'api_key':'XXXX', 'sign':'XXXX', 'symbol':'btc_usd', 'order_id':'20914907' } } # Response [{ "channel": "ok_spot_orderinfo", "data": { "orders": [{ "amount": 0.1, "avg_price": 1.961, "create_date": 1422502117000, "deal_amount": 0.1, "order_id": 20914907, "orders_id": 20914907, "price": 0, "status": 2, "symbol": "btc_usd", "type": "sell_market" }], "result": true } }] Returned Value Descriptionamount(double): order quantity create_date(double): order time avg_price(double): average transaction price deal_amount(double): filled quantity order_id(long): order ID orders_id(long): order ID (Deprecated) price(double): order price status(int): -1 = cancelled, 0 = unfilled, 1 = partially filled, 2 = fully filled, 4 = cancel request in process,5 = cancel request in process symbol(string): coin type type(string): buy_market = market buy order, sell_market = market sell order Request Parameters
|
|||||||||||||||
ok_sub_spot_X_order New
Trade Record
① value of X is: btc_usd, ltc_usd, eth_usd, etc_usd, bcc_usdExample# Response
[
{
"channel": "ok_sub_spot_X_order",
"data": {
"averagePrice": "0",
"completedTradeAmount": "0",
"createdDate": 1422258604000,
"id": 268013884,
"orderId": 268013884,
"sigTradeAmount": "0",
"sigTradePrice": "0",
"status": -1,
"symbol": "btc_usd",
"tradeAmount": "1.105",
"tradePrice": "0",
"tradeType": "buy",
"tradeUnitPrice": "1853.74",
"unTrade": "0"
}
}
]
Returned Value DescriptioncreatedDate(string): created date orderId(long): order ID tradeType(string): trade type (buy: buy;sell: sell;buy_market: buy at market price;sell_market: sell at market price) sigTradeAmount(string):quantity in a single transaction sigTradePrice(string):rate in a single transaction tradeAmount(string):for market sell orders: total sell quantity, for limit orders: order quantity tradeUnitPrice(string):for market buy orders: total buy amount, for limit orders: order rate symbol(string):btc_usd, ltc_usd, eth_usd, etc_usd, bcc_usd completedTradeAmount(string): filled 'tradeAmount' tradePrice(string): filled amount averagePrice(string): average transaction price unTrade(string): unfilled amount in usd for market order, unfilled coin quantity for limit order status(int): -1: cancelled, 0: pending, 1: partially filled, 2: fully filled, 4: cancel request in process DescriptionThere is no need to subscribe to the login, compatible with the old subscription, the old subscription is equivalent to the login operation.
Response:
[
{
"binary": 0,
"channel": "login",
"data": {
"result": true
}
}
]
|
|||||||||||||||
ok_sub_spot_X_balance New
User Account Info
① value of X is: btc_usd, ltc_usd, eth_usd, etc_usd, bcc_usdExample# Response
[{
"channel": "ok_sub_spot_X_balance",
"data": {
"info": {
"free": {
"btc": 0.0001,
"usd": 2.2687485,
"ltc": 1.479023,
"eth": 1.479022
},
"freezed": {
"btc": 0,
"usd": 0.000045,
"ltc": 0,
"eth": 0
}
}
}
}]
Returned Value Descriptionlend: account lending information (only returned when this field is not null) borrow: account borrowing information (only returned when this field is not null) free: available fund freezed: frozen fund DescriptionThere is no need to subscribe to the login, compatible with the old subscription, the old subscription is equivalent to the login operation.
Response:
[
{
"binary": 0,
"channel": "login",
"data": {
"result": true
}
}
]
|
|||||||||||||||