Spot Price API : Receive the latest OKCoin spot market data
[GET방식] Get Price Ticker / 가격 티커 가져오기
# Request
GET https://www.okcoinkr.com/api/v1/ticker.do?symbol=btc_krw
요청항목 |
유형 |
필수여부 |
설명 |
symbol |
String |
Y |
token_krw (ex. btc_krw, token정보 확인하기) |
# Response
{
"date": "1410431279",
"ticker": {
"buy": "33.15",
"high": "34.15",
"last": "33.15",
"low": "32.05",
"sell": "33.16",
"vol": "10532696.39199642"
}
}
#Response Values
date: 응답시 서버시간
buy: 매수가
high: 최고가
last: 마지막 체결가
low: 최저가
sell: 매도가
vol: 전체 체결된 수량 (최근 24시간)
[GET방식] Get Market Depth / 마켓 depth 가져오기
# Request
GET https://www.okcoinkr.com/api/v1/depth.do?symbol=btc_krw
요청항목 |
유형 |
필수여부 |
설명 |
symbol |
String |
Y |
token_krw (ex. btc_krw, token정보 확인하기) |
size |
Integer |
N |
value: must be between 1 - 200 |
# 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]
]
}
# Response Values
asks : ask depth
bids : bid depth
- URL Example : https://www.okcoinkr.com/api/v1/trades.do?symbol=btc_krw
- Request / Response
# Request
GET https://www.okcoinkr.com/api/v1/trades.do?symbol=btc_krw
요청항목 |
유형 |
필수여부 |
설명 |
symbol |
String |
Y |
token_krw (ex. btc_krw) token정보 확인하기) |
since |
Long |
N |
지정한 tid 로부터 최근 60건 데이터를 가져옴 (필수 아님) |
# Response
[
{
"date":1526148197,
"date_ms":1526148197535,
"amount":0.0019,
"price":9267000,
"type":"sell",
"tid":443072632
},
{
"date":1526157121,
"date_ms":1526157121957,
"amount":0.04,
"price":9390000,
"type":"buy",
"tid":443072636
},
{
"date":1526157150,
"date_ms":1526157150389,
"amount":0.0628,
"price":9400000,
"type":"buy",
"tid":443072638
}
]
# Response Values
date: 응답시 서버 시간
date_ms: 거래시간(밀리초)
amount: quantity in BTC (or LTC)
price: 거래가격
type: buy/sell
tid: 거래ID
# Request
GET https://www.okcoinkr.com/api/v1/kline.do
요청항목 |
유형 |
필수여부 |
설명 |
symbol |
String |
Y |
token_krw (ex. btc_krw) token정보 확인하기) |
type |
String |
Y |
1min/3min/5min/15min/30min/
1day/3day/1week/1hour/2hour/4hour/6hour/12hour
|
size |
Integer |
N |
데이터 건수 |
since |
String |
N |
타임스탬프. 해당 시간 이후 데이터가 리턴됨 |
# Response
[
[
1526253960000,
"9800000",
"9800000",
"9800000",
"9800000",
"0"
],
[
1526254020000,
"9800000",
"9800000",
"9800000",
"9800000",
"0"
]
]
# Response Values
[
1526253960000, -->timestamp
"9800000", -->open
"9800000", -->hight
"9800000", -->low
"9800000", -->close
"0", -->volume
]
Spot Trading API : Place spot orders on OKCOIN
- URL Example : https://www.okcoinkr.com/api/v1/userinfo.do
- Request / Response
- 요청주기: 6회/초
# Request
POST https://www.okcoinkr.com/api/v1/userinfo.do
요청항목 |
유형 |
필수여부 |
설명 |
api_key |
String |
Y |
user 가 할당 받은 api key값 |
sign |
String |
Y |
api key, parameter, secretkey 조합으로 생성 된 사이닝값 |
# Response
{
"result":true,
"info":{
"funds":{
"borrow":{
"ast":"0",
"xuc":"0",
"nano":"0",
"eos":"0",
"rdn":"0"
},
"free":{
"ast":"0",
"xuc":"0",
"nano":"0",
"eos":"0",
"rdn":"0"
},
"freezed":{
"ast":"0",
"xuc":"0",
"nano":"0",
"eos":"0",
"rdn":"0"
}
}
}
}
# Response Values
free: 계좌잔액
freezed: 계좌동결잔액
- URL Example : https://www.okcoinkr.com/api/v1/trade.do
- Request / Response
- 요청주기: 20회/초
# Request
POST https://www.okcoinkr.com/api/v1/trade.do
요청항목 |
유형 |
필수여부 |
설명 |
api_key |
String |
Y |
user가 할당받은 API 키값 |
symbol |
String |
Y |
token_krw (ex. btc_krw, token정보 확인하기)) |
type |
String |
Y |
buy,sell |
price |
Double |
Y |
범위: >= 0 ,<=1000000 |
amout |
String |
Y |
범위:BTC수량 >=0.01,LTC수량>=0.1,ETH수량>=0.01 등 |
sign |
String |
Y |
api key, parameter, secretkey 조합으로 생성 된 사이닝값 |
# Response
{"result":true,"order_id":123456}
# Response Values
result: true --> 성공
order_id: --> 생성된 주문 ID
- URL Example : https://www.okcoinkr.com/api/v1/trade.do
- Request / Response
- 요청주기: 20회/초
# Request
POST https://www.okcoinkr.com/api/v1/trade.do
요청항목 |
유형 |
필수여부 |
설명 |
api_key |
String |
Y |
user가 할당받은 API 키값 |
symbol |
String |
Y |
token_krw (ex. btc_krw, token정보 확인하기)) |
type |
String |
Y |
buy_market |
price |
Double |
Y |
1호 매수가격보다 커야 함. |
sign |
String |
Y |
api key, parameter, secretkey 조합으로 생성 된 사이닝값 |
# Response
{"result":true,"order_id":123456}
# Response Values
result: true --> 성공
order_id: --> 생성된 주문 ID
- URL Example : https://www.okcoinkr.com/api/v1/trade.do
- Request / Response
- 요청주기: 20회/초
# Request
POST https://www.okcoinkr.com/api/v1/trade.do
요청항목 |
유형 |
필수여부 |
설명 |
api_key |
String |
Y |
user가 할당받은 API 키값 |
symbol |
String |
Y |
token_krw (ex. btc_krw, token정보 확인하기)) |
type |
String |
Y |
sell_market |
amount |
Double |
Y |
1호 매도가격보다 커야 함. |
sign |
String |
Y |
api key, parameter, secretkey 조합으로 생성 된 사이닝값 |
# Response
{"result":true,"order_id":123456}
# Response Values
result: true --> 성공
order_id: --> 생성된 주문 ID
- URL Example : https://www.okcoinkr.com/api/v1/trade_history.do
- Request / Response
- 요청주기: 6회/2초
# Request
POST https://www.okcoinkr.com/api/v1/trade_history.do
요청항목 |
유형 |
필수여부 |
설명 |
api_key |
String |
Y |
user가 할당받은 API 키값 |
sign |
String |
Y |
api key, parameter, secretkey 조합으로 생성 된 사이닝값 |
symbol |
String |
Y |
token_krw (ex. btc_krw, token정보 확인하기)) |
since |
Long |
Y |
지정 tid 부터 600건 데이터 |
# 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"
}
]
# Response Values
date: 거래일자
date_ms: 거래시간 (밀리초)
price: 거래가격
amount: 거래 수량
tid: 거래ID
type: 거래 유형 (buy/sell)
- URL Example : https://www.okcoinkr.com/api/v1/batch_trade.do
- Request / Response
- 요청주기: 20회/2초
# Request
POST https://www.okcoinkr.com/api/v1/batch_trade.do
요청항목 |
유형 |
필수여부 |
설명 |
api_key |
String |
Y |
user가 할당받은 API 키값 |
symbol |
String |
Y |
token_krw (ex. btc_krw,더 많은 token정보 확인하기)) |
type |
String |
N |
지정가 주문(buy/sell) |
orders_data |
String |
Y |
JSON string Example: [{price:3,amount:5,type:'sell'},{price:3,amount:3,type:'buy'},{price:3,amount:3}]
주문최고 5개까지 가능, price , amount 는 trade api 설명 참고.
최종 매수,매도유형은 orders_data의 type기준으로 하고 , orders_data의 type항목이 없을시 type 유형 기준으로 함.
|
sign |
String |
Y |
api key, parameter, secretkey 조합으로 생성 된 사이닝값 |
# Response
{
"order_info":[
{"order_id":41724206},
{"error_code":10011,"order_id":-1},
{"error_code":10014,"order_id":-1}
],
"result":true
}
# Response Values
result: true / false 주문거래 성공/실패
order_id: 주문 ID
Note: 하나의 주문이라도 성공이면 true 값을 리턴하며 주문순서는 order__data 주문 순서와 같다.
주문 실패 시 : order_id : -1 , error_code: (ex: 10011,10014 등 )
- URL Example : https://www.okcoinkr.com/api/v1/cancel_order.do
- Request / Response
- 요청주기: 20회/2초
# Request
POST https://www.okcoinkr.com/api/v1/cancel_order.do
요청항목 |
유형 |
필수여부 |
설명 |
api_key |
String |
Y |
user가 할당받은 API 키값 |
symbol |
String |
Y |
token_krw (ex. btc_krw, token정보 확인하기)) |
order_id |
String |
Y |
order ID 여러건일 경우 ", " 로 분리하고 최대 1회 최대 3개 까지 취소 가능. |
sign |
String |
Y |
api key, parameter, secretkey 조합으로 생성 된 사이닝값 |
# Response
# For batch orders, return (success order IDs, failed order IDs)
{"success":"123456,123457","error":"123458,123459"}
# Response Values
result: true: 주문취소 성공 , false: 주문취소 실패 (단건 주문에 사용)
order_id: 주문 ID
success: 주문취소 성공한 주문ID (다수주문에 사용)
error: 주문취소 실패한 주문ID(다수주문에 사용)
- URL Example : https://www.okcoinkr.com/api/v1/order_info.do
- Request / Response
- 요청주기: 20회/2초
# Request
POST https://www.okcoinkr.com/api/v1/order_info.do
요청항목 |
유형 |
필수여부 |
설명 |
api_key |
String |
Y |
user가 할당받은 API 키값 |
symbol |
String |
Y |
token_krw (ex. btc_krw, token정보 확인하기)) |
order_id |
Long |
Y |
order_id :-1, 미 체결 주문, 아닐경우 해당 주문id 보여줌. |
sign |
String |
Y |
api key, parameter, secretkey 조합으로 생성 된 사이닝값 |
# Response
{
"result": true,
"orders": [
{
"amount": 1,
"avg_price": 0,
"create_date": 1523340062000,
"deal_amount": 0,
"order_id": 2626,
"orders_id": 2626,
"price": 400,
"status": 0,
"symbol": "xrp_krw",apiKey of the user
"type": "buy"
}
]
}
# Response Values
amount: 수량
avg_price: 평균거래가격
create_date: 주문시간
deal_amount: 체결수량
order_id: order ID
orders_id: order ID (비권장항목)
price: 가격
status: -1 = 취소 됨, 0 = 미체결, 1 = 부분 체결, 2 = 전부 체결, 3 = 주문취소 처리중
type: buy/sell
- URL Example : https://www.okcoinkr.com/api/v1/orders_info.do
- Request / Response
- 요청주기: 20회/2초
# Request
POST https://www.okcoinkr.com/api/v1/orders_info.do
요청항목 |
유형 |
필수여부 |
설명 |
api_key |
String |
Y |
user가 할당받은 API 키값 |
type |
Integer |
Y |
0: 미체결 주문 1: 체결완료 주문 |
symbol |
String |
Y |
token_krw (ex. btc_krw, token정보 확인하기)) |
order_id |
String |
Y |
여러건일 경우 ", " 로 분리하고 회당 최대 50건 주문까지 조회 가능 |
sign |
String |
Y |
api key, parameter, secretkey 조합으로 생성 된 사이닝값 |
# Response
{
"result": true,
"orders": [
{
"amount": 1,
"avg_price": 0,
"create_date": 1523339943000,
"deal_amount": 0,
"order_id": 2625,
"orders_id": 2625,
"price": 400,
"status": 0,
"symbol": "xrp_krw",
"type": "buy"
},
{
"amount": 1,
"avg_price": 0,
"create_date": 1523340062000,
"deal_amount": 0,
"order_id": 2626,
"orders_id": 2626,
"price": 400,
"status": 0,
"symbol": "xrp_krw",
"type": "buy"
}
]
}
# Response Values
amount: 지정가주문요청: 주문수량 | 시장가주문요청: 매도된 xrp 수량
deal_amount: 거래량
avg_price: 평균거래가
create_date: 주문시간
order_id: order ID
price: 지정가 주문요청: 가격 / 시장가주문요청 : 매수된 USD금액
status: -1 = 취소 됨, 0 = 미체결, 1 = 부분 체결, 2 = 전부 체결, 3 = 주문취소 처리중
type:buy/sell
- URL Example : https://www.okcoinkr.com/api/v1/order_history.do
- Request / Response
# Request
POST https://www.okcoinkr.com/api/v1/order_history.do
요청항목 |
유형 |
필수여부 |
설명 |
api_key |
String |
Y |
user가 할당받은 API 키값 |
symbol |
String |
Y |
token_krw (ex. btc_krw, token정보 확인하기)) |
status |
Integer |
Y |
0: 미체결 주문 1: 체결완료 주문 (최근 2일간 데이터) |
current_page |
Integer |
Y |
현재페이지 |
page_length |
Integer |
Y |
한 페이지에서 보여줄 데이터 행(row) |
sign |
String |
Y |
api key, parameter, secretkey 조합으로 생성 된 사이닝값 |
# Response
{
"result":true,
"total":1,
"currency_page":1,
"page_length":100,
"orders":[
{
"amount":1,
"avg_price":0,
"create_date":1526524337000,
"deal_amount":0,
"order_id":14830,
"orders_id":14830,
"price":2E+2,
"status":0,
"symbol":"xrp_krw",
"type":"buy"
}
]
}
# Response Values
current_page: 현재 페이지
orders: 주문상세
amount: 수량
avg_price: 평균거래가
create_date: 주문시간
deal_amount: 거래수량
order_id: order ID
price: 주문가격
status: -1 = 취소 됨, 0 = 미체결, 1 = 부분 체결, 2 = 전부 체결, 3 = 주문취소 처리중
type:buy/sell
page_length: 페이지당 데이터 row수
result: true (성공)