Spot Price API
Receive the latest OKCoin spot market data
Resource and Description | ||||
---|---|---|---|---|
Get /api/v1/ticker Get Price Ticker
BTC https://www.okcoin.com/api/v1/ticker.do?symbol=btc_usd LTC https://www.okcoin.com/api/v1/ticker.do?symbol=ltc_usd ETH https://www.okcoin.com/api/v1/ticker.do?symbol=eth_usd ETC https://www.okcoin.com/api/v1/ticker.do?symbol=etc_usd BCH https://www.okcoin.com/api/v1/ticker.do?symbol=bch_usd Example# Request GET https://www.okcoin.com/api/v1/ticker.do?symbol=ltc_usd # Response { "date": "1410431279", "ticker": { "buy": "33.15", "high": "34.15", "last": "33.15", "low": "32.05", "sell": "33.16", "vol": "10532696.39199642" } } Return Valuesdate: server time for returned data buy: best bid high: highest price last: latest price low: lowest price sell: best ask vol: volume (in the last rolling 24 hours) Request Parameters
|
Resource and Description | ||||||||
---|---|---|---|---|---|---|---|---|
Get /api/v1/depth Get Market Depth | ||||||||
BTC https://www.okcoin.com/api/v1/depth.do?symbol=btc_usd LTC https://www.okcoin.com/api/v1/depth.do?symbol=ltc_usd ETH https://www.okcoin.com/api/v1/depth.do?symbol=eth_usd ETC https://www.okcoin.com/api/v1/depth.do?symbol=etc_usd BCH https://www.okcoin.com/api/v1/depth.do?symbol=bch_usd Example# Request GET https://www.okcoin.com/api/v1/depth.do?symbol=btc_usd # Response { "asks": [ [792, 5], [789.68, 0.018], [788.99, 0.042], [788.43, 0.036], [787.27, 0.02] ], "bids": [ [787.1, 0.35], [787, 12.071], [786.5, 0.014], [786.2, 0.38], [786, 3.217], [785.3, 5.322], [785.04, 5.04] ] } Return Valuesasks : ask depth bids : bid depth Request Parameters
|
Resource and Description | ||||||
---|---|---|---|---|---|---|
Get /api/v1/trades Get Trade Recently 60 | ||||||
BTC https://www.okcoin.com/api/v1/trades.do?symbol=btc_usd LTC https://www.okcoin.com/api/v1/trades.do?symbol=ltc_usd ETH https://www.okcoin.com/api/v1/trades.do?symbol=eth_usd ETC https://www.okcoin.com/api/v1/trades.do?symbol=etc_usd BCH https://www.okcoin.com/api/v1/trades.do?symbol=bch_usd Example# Request GET https://www.okcoin.com/api/v1/trades.do?since=5000 # Response [ { "date": "1367130137", "date_ms": "1367130137000", "price": 787.71, "amount": 0.003, "tid": "230433", "type": "sell" }, { "date": "1367130137", "date_ms": "1367130137000", "price": 787.65, "amount": 0.001, "tid": "230434", "type": "sell" }, { "date": "1367130137", "date_ms": "1367130137000", "price": 787.5, "amount": 0.091, "tid": "230435", "type": "sell" } ] Return Valuesdate: transaction time date_ms: transaction time in milliseconds price: transaction price amount: quantity in BTC (or LTC) tid: transaction ID type: buy/sell Request Parameters
|
Resource and Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Get /api/v1/kline Get Candlestick Data | ||||||||||
URL https://www.okcoin.com/api/v1/kline.do approximately 2000 pieces of data are returned each cycle Example# Request GET https://www.okcoin.com/api/v1/kline.do?symbol=btc_usd&type=1min # Response [ [ 1417478400000, 380.94, 387.7, 378.75, 384.61, 6857.31 ], [ 1417564800000, 384.47, 387.13, 383.5, 387.13, 1062.04 ] ] Return Values[ 1417564800000, timestamp 384.47, open 387.13, high 383.5, low 387.13, close 1062.04, volume ] Request Parameters
|
Spot Trading API
Place spot orders on OKCoin
Resource and Description | ||||||
---|---|---|---|---|---|---|
POST /api/v1/userinfo Get User Account Info
URL https://www.okcoin.com/api/v1/userinfo.do Request frequency 6 times/2s Example# Request POST https://www.okcoin.com/api/v1/userinfo.do # Response { "info": { "funds": { "asset": { "net": "0", "total": "0" }, "borrow": { "btc": "0", "usd": "0", "ltc": "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" } } }, "result": true } Return Valuesasset: account funds, including net fund and total fund net:net Equity (Borrowed Value Excluded) total:total Equity (Borrowed Value Included) 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
|
Resource and Description | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
POST /api/v1/trade Place Orders | ||||||||||||||
URL https://www.okcoin.com/api/v1/trade.do Request frequency 20 times/2s Example# Request POST https://www.okcoin.com/api/v1/trade.do # Response {"result":true,"order_id":123456} Return Valuesresult: true means order placed successfully order_id: order ID of the newly placed order Request Parameters
|
Resource and Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
POST /api/v1/trade_history Get Trade History (Not for Personal) | ||||||||||
URL https://www.okcoin.com/api/v1/trade_history.do Request frequency 6 times/2s Example# Request POST https://www.okcoin.com/api/v1/trade_history.do # Response [ { "date": "1367130137", "date_ms": "1367130137000", "price": 787.71, "amount": 0.003, "tid": "230433", "type": "sell" }, { "date": "1367130137", "date_ms": "1367130137000", "price": 787.65, "amount": 0.001, "tid": "230434", "type": "sell" }, { "date": "1367130137", "date_ms": "1367130137000", "price": 787.5, "amount": 0.091, "tid": "230435", "type": "sell" } ] Return Valuesdate: transaction time date_ms: transaction time in milliseconds price: transaction price amount: quantity in BTC (or LTC) tid: transaction ID type: buy/sell Request Parameters
|
Resource and Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
POST /api/v1/batch_trade Batch Trade | ||||||||||||
URL https://www.okcoin.com/api/v1/batch_trade.do Request frequency 20 times/2s Example# Request POST https://www.okcoin.com/api/v1/batch_trade.do # Response { "order_info":[ {"order_id":41724206}, {"error_code":10011,"order_id":-1}, {"error_code":10014,"order_id":-1} ], "result":true } Return Valuesresult: true indicates order successfully placed order_id: order ID Note: return true if any one order is placed successfully returned orders info and 'orders_data' are in same sequence if fail to place order: order_id is -1 Request Parameters
|
Resource and Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
POST /api/v1/cancel_order Cancel Orders | ||||||||||
URL https://www.okcoin.com/api/v1/cancel_order.do Request frequency 20 times/2s Example# Request POST https://www.okcoin.com/api/v1/cancel_order.do # Response # For batch orders, return (success order IDs, failed order IDs) {"success":"123456,123457","error":"123458,123459"} Return Valuesresult: true: cancel order request successful, wait to be processed, false: cancel order failed(applicable to single order) order_id: order ID (applicable to single order) success: ID of orders whose cancel request are successful, wait to be processed.(applicable to batch orders) error: ID of orders whose cancel request are unsuccessful.(applicable to batch orders) Request Parameters
|
Resource and Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
POST /api/v1/order_info Get Order Info | ||||||||||
URL https://www.okcoin.com/api/v1/order_info.do Request frequency 20 times/2s (unfilled orders) Example# Request POST https://www.okcoin.com/api/v1/order_info.do # Response { "result": true, "orders": [ { "amount": 0.1, "avg_price": 0, "create_date": 1418008467000, "deal_amount": 0, "order_id": 10000591, "orders_id": 10000591, "price": 500, "status": 0, "symbol": "btc_usd", "type": "sell" }, { "amount": 0.2, "avg_price": 0, "create_date": 1417417957000, "deal_amount": 0, "order_id": 10000724, "orders_id": 10000724, "price": 0.1, "status": 0, "symbol": "btc_usd", "type": "buy" } ] } Return Valuesamount: order quantity avg_price: average transaction price create_date: order time deal_amount: filled quantity order_id: order ID orders_id: order ID (Deprecated) price: order price status: -1 = cancelled, 0 = unfilled, 1 = partially filled, 2 = fully filled, 4 = cancel request in process type: buy_market = market buy order, sell_market = market sell order Request Parameters
|
Resource and Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
POST /api/v1/orders_info Get Order Information in Batch | ||||||||||||
URL https://www.okcoin.com/api/v1/orders_info.do Request frequency 20 times/2s Example# Request POST https://www.okcoin.com/api/v1/orders_info.do # Response { "result":true, "orders":[{ "order_id":15088, "status":0, "symbol":"btc_usd", "type":"sell", "price":811, "amount":1.39901357, "deal_amount":1, "avg_price":811 } , { "order_id":15088, "status":-1, "symbol":"btc_usd", "type":"sell", "price":811, "amount":1.39901357, "deal_amount":1, "avg_price":811 } ] } Return Valuesamount: for limit orders, returns the order quantity. For market orders, returns the filled quantity deal_amount: filled quantity avg_price: average transaction price create_date: order time order_id: order ID price: for limit orders, return the order price. For market orders, returns the filled price status: -1 = cancelled, 0 = unfilled, 1 = partially filled, 2 = fully filled, 4 = cancel request in process type: buy_market = market buy order, sell_market = market sell order result: request result Request Parameters
|
Resource and Description |
---|
POST /api/v1/order_history Only the most recent 2 days are returned |
URL https://www.okcoin.com/api/v1/order_history.do Example# Request POST https://www.okcoin.com/api/v1/order_history.do # Response { "current_page": 1, "orders": [ { "amount": 0, "avg_price": 0, "create_date": 1405562100000, "deal_amount": 0, "order_id": 0, "price": 0, "status": 2, "symbol": "btc_usd", "type": "sell” } ], "page_length": 1, "result": true, "total": 3 } ] Return Valuescurrent_page: current page number orders: detailed order information amount: order quantity avg_price: average transaction price create_date: order time deal_amount: filled quantity order_id: order ID price: order price status: -1 = cancelled, 0 = unfilled, 1 = partially filled, 2 = fully filled, 4 = cancel request in process type: buy_market = market buy order, sell_market = market sell order page_length: number of orders per page result: true means request successfully handled |
Resource and Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
POST /api/v1/withdraw BTC/LTC/ETH/ETC/BCH Withdraw | ||||||||||||||||||
URL https://www.okcoin.com/api/v1/withdraw.do Example# Request POST https://www.okcoin.com/api/v1/withdraw.do # Response { "withdraw_id":301, "result":true } Return Valueswithdraw_id: withdrawal request ID result: true means request successful Request Parameters
|
Resource and Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
POST /api/v1/cancel_withdraw Withdrawal Cancellation Request | ||||||||||
URL https://www.okcoin.com/api/v1/cancel_withdraw.do Example# Request POST https://www.okcoin.com/api/v1/cancel_withdraw.do # Response { "result":true, "withdraw_id":301 } Return Valuesresult: true for success, false for error withdraw_id: withdrawal request ID Request Parameters
|
Resource and Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
POST /api/v1/withdraw_info Get Withdrawal Information | ||||||||||
URL https://www.okcoin.com/api/v1/withdraw_info.do Example# Request POST https://www.okcoin.com/api/v1/withdraw_info.do # Response { "result": true, "withdraw": [ { "address": "15KGp……", "amount": 2.5, "created_date": 1447312756190, "chargefee": 0.1, "status": 0, "withdraw_id": 45001 } ] } Return Valuesresult: true for success, false for error address: withdrawal address amount: withdrawal amount created_date: withdrawal time chargefee: network transaction fee status: withdrawal status (-3:Revoked;-2:Cancelled;-1:Failure;0:Pending;1:Pending;2:Complete;3:Email Confirmation;4:Verifying5:Wait Confirmation) withdraw_id: withdrawal request ID Request Parameters
|
Resource and Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
POST /api/v1/order_fee Query Fee | ||||||||||
URL https://www.okcoin.com/api/v1/order_fee.do Note: Fee inquiries within 2 days Example# Request POST https://www.okcoin.com/api/v1/order_fee.do # Response { "data":{ "fee":"-2", "order_id":125499667, "type":"Usd" }, "result":true } Return Valuesfee:fee order_id:order ID type:Usd Btc Ltc Request Parameters
|
Resource and Description | ||||||||
---|---|---|---|---|---|---|---|---|
POST /api/v1/lend_depth Get Top 10 Lending Entries | ||||||||
URL https://www.okcoin.com/api/v1/lend_depth.do Example# Request POST https://www.okcoin.com/api/v1/lend_depth.do # Response { "lend_depth": [ { "amount": 26272982.5427, "days": "15 - 90", "num": 14, "rate": 0.001 }, { "amount": 47403.1424, "days": "15", "num": 1, "rate": 0.0013 } ] } Return Valuesamount: loan amount days: loan days num: number of loans rate: interest rate Request Parameters
|
Resource and Description | ||||||||
---|---|---|---|---|---|---|---|---|
POST /api/v1/borrows_info Get User Borrow Information | ||||||||
URL https://www.okcoin.com/api/v1/borrows_info.do Example# Request POST https://www.okcoin.com/api/v1/borrows_info.do # Response { "borrow_btc": 0, "borrow_ltc": 11.06, "borrow_usd": 0, "can_borrow": 0.03, "interest_btc": 0, "interest_ltc": 0.0011, "interest_usd": 0, "result": true, "today_interest_btc": 0, "today_interest_ltc": 0.0011, "today_interest_usd": 0 } Return Valuesborrow_btc: already borrowed btc quantity borrow_ltc: already borrowed ltc quantity borrow_usd: already borrowed usd amount can_borrow: amount of money can be borrowed interest_btc: btc total interest interest_ltc: ltc total interest interest_usd: usd total interest today_interest_btc: btc interest of today today_interest_ltc: ltc interest of today today_interest_usd: usd interest of today Request Parameters
|
Resource and Description | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
POST /api/v1/borrow_money Request Borrow | ||||||||||||||
URL https://www.okcoin.com/api/v1/borrow_money.do Example# Request POST https://www.okcoin.com/api/v1/borrow_money.do # Response { "result": true, "borrow_id": 312 } Return Valuesborrow_id: borrow order id Request Parameters
|
Resource and Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
POST /api/v1/cancel_borrow Cancel Borrow Order | ||||||||||
URL https://www.okcoin.com/api/v1/cancel_borrow.do Example# Request POST https://www.okcoin.com/api/v1/cancel_borrow.do # Response { "result": true, "borrow_id": 312 } Return Valuesborrow_id:borrow order id Request Parameters
|
Resource and Description | ||||||||
---|---|---|---|---|---|---|---|---|
POST /api/v1/borrow_order_info Get Borrowing Order Info | ||||||||
URL https://www.okcoin.com/api/v1/borrow_order_info.do Example# Request POST https://www.okcoin.com/api/v1/borrow_order_info.do # Response { "borrow_order": { "amount": 111, "borrow_date": 1423214717000, "borrow_id": 65426, "days": 15, "deal_amount": 0, "rate": 0.001, "status": 0, "symbol": "usd" }, "result": true } Return Valuesamount: borrow amount borrow_date: borrow date borrow_id: borrow order id days: borrowing period deal_amount: borrowed amount rate: interest rate status: borrow status: 0 pending, 1 partially deal, 2 fully deal, -1, cancel symbol: currency type of borrowing Request Parameters
|
Resource and Description | ||||||||
---|---|---|---|---|---|---|---|---|
POST /api/v1/repayment Pay Off Debt | ||||||||
URL https://www.okcoin.com/api/v1/repayment.do Example# Request POST https://www.okcoin.com/api/v1/repayment.do # Response { "borrow_id": 613388, "result": true } Return Valuesborrow_id: borrow order id result: result Request Parameters
|
Resource and Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
POST /api/v1/unrepayments_info Get Debt List | ||||||||||||
URL https://www.okcoin.com/api/v1/unrepayments_info.do Example# Request POST https://www.okcoin.com/api/v1/unrepayments_info.do # Response { "unrepayments": [ { "amount": 0.1, "borrow_date": 1423475249000, "borrow_id": 613388, "days": 15, "deal_amount": 0.1, "rate": 0.001, "status": 2, "symbol": "btc_usd" } ], "result": true } Return Valuesamount: borrow amount borrow_date: borrow date borrow_id: borrow order id days: borrowing period deal_amount: borrowed amount rate: interest rate status: borrow status:: 0 pending, 1 partially deal symbol: currency type of borrowing Request Parameters
|
Resource and Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
POST /api/v1/account_records Get User Deposits or Withdraw Record | |||||||||||||||
URL https://www.okcoin.com/api/v1/account_records.do |
|||||||||||||||
Example# Request POST https://www.okcoin.com/api/v1/account_records.do # Response { "records": [ { "addr": "1CWKbfwxSkEWP8W45D76j3BX8vPieoSCyL", "account": "12312", "amount": 0, "bank": "HSBC Hongkong", "benificiary_addr": "350541545", "transaction_value": 111, "fee": 0, "date": 1418008467000, "status": 1 } ], "symbol": "btc_usd" } Return Valuesaddr: address account: account name amount: amount bank: bank benificiary_addr: benificiary address transaction_value: withdraw amount after fee deduction fee: commission fee date: date symbol: btc_usd ltc_usd usd status: recharge status (-1:Failure;0:Wait Confirmation;1:Complete), withdrawal status (-3:Revoked;-2:Cancelled;-1:Failure;0:Pending;1:Pending;2:Complete;3:Email Confirmation;4:Verifying5:Wait Confirmation) Request Parameters
|