NAV Navbar

Introduction

Authentication request

Payload consists of the following:

  {
    clientId: "Issued Client ID (required)",
    nonce: "Current time, epoch milliseconds (required)",
    query: "Parameter's querystring (required if parameters are available)"
  }

When requesting a Private API, generate a token with the issued Client Id and Client Secret and send it through the Authorization header. The token to register in the Authorization header follows the JWT

HS256 is recommended for signing, and the secret key issued as a secret is used.

If the parameters are not available

const jwt = require("jsonwebtoken");

const payload = {
  clientId: "Issued Client Id",
  nonce: (new Date).getTime()
};

const jwtToken = jwt.sign(payload, "Issued Client Secret");
const authorizationToken = `Bearer ${jwtToken}`;













If the parameters are available

const jwt = require("jsonwebtoken");
const querystring = require("query-string");
const query = queryString.stringify(
  {/* requested parameters */}, 
  { sort: (a, b) => a > b ? 1 : -1 } //QueryString must be alphabetically ordered.
);

const payload = {
  clientId: "Issued Client Id",
  nonce: (new Date).getTime(),
  query: query
};

const jwtToken = jwt.sign(payload, "Issued Secret key");
const authorizationToken = `Bearer ${jwtToken}`;

Public API

GET Retrieve Orderbook

curl --request GET \
  --url 'https://user-api.hanbitco.com/v1/markets/{currency_pair}/orderbook'

Example Output:

  {
    status: "success",
    data:
    { 
      asks:
        [ 
          [ 
            '0.002776', // PRICE
            '2.5937'    // QTY
          ],
          [ 
            '0.003936',
            '2.3505' 
          ],
        ],
      bids:
        [ 
          [ 
            '0.000041', // PRICE
            '0.6829'    // QTY
          ],
          [ 
            '0.001773', 
            '0.4438' 
          ],
        ] 
    } 
  }

Retrieves the orderbook for a market with a requested currency_pair.

HTTP Request

GET https://user-api.hanbitco.com/v1/markets/{currency_pair}/orderbook

Path Parameters

Parameter Type Description
currency_pair string Used to retrieve the orderbook with the respective currency pair.

GET Get Trades History

curl --request GET \
  --url 'https://user-api.hanbitco.com/v1/markets/{currency_pair}/trades'

Example output:

{ 
  status: "success",
  data:
   { 
     offset: '0',
     limit: '10',
     items:
      [ 
        { 
          tradeId: "34dc838d-a847-4f3d-92e9-5e3e9ac99e0f",
          currencyPair: "REP_BTC",
          amount: '0.1',
          price: '0.002774',
          buyOrderType: "LIMIT",
          sellOrderType: "LIMIT",
          taker: "SELL",
          createdAt: "2019-02-07T07:07:17.937Z",
          total: '0.0002774',
          timestamp: '1549523237' 
        },
      ],
     total: '15',
     nextPageUrl: "?offset=10&limit=10",
     pageIndex: '0' 
   } 
}

Retrieves all the recent trade records of a selected currency market.

HTTP Request

GET https://user-api.hanbitco.com/v1/markets/{currency_pair}/trades

Path Parameters

Parameter Type Description
currency_pair string Used to retrieve the trade records with the respective currency pair.

GET Current Prices Ticker

curl --request GET \
  --url 'https://user-api.hanbitco.com/v1/markets/{currency_pair}/ticker'
{ 
  status: "success",
  data:
   { 
     currencyPair: "REP_BTC",
     timestamp: '1549523237',
     lastPrice: '0.002774',
     lastDayPrice: '0.002767',
     lowPrice: '0.002768',
     highPrice: '0.002776',
     volume: '43.4556' 
   } 
}

Retrieves a selected currency pair ticker that contains information such as last matched price, price 24 hours ago, lowest and highest price, and the daily volume.

HTTP Request

GET https://user-api.hanbitco.com/v1/markets/{currency_pair}/ticker

Path Parameters

Parameter Type Description
currency_pair string Used to retrieve the ticker with the respective currency pair.

Private API

GET Get Balance

const axios = require("axios");
const { sign } = require("jsonwebtoken");

const clientId = `${clientId}`;
const clientSecret =  `${clientSecret}`;

const payload = {
  clientId, 
  nonce: (new Date).getTime()
};

const token = sign(payload, clientSecret);

var options = {
  method: "GET",
  url: "https://user-api.hanbitco.com/v1/balances",
  headers: { Authorization: `Bearer ${token}` }
};

axios(options).then(res => console.log(res.data));

Example outputs:

{ status: "success",
  data:
   [ 
     { 
       currency: "BCH", 
       balance: '2.19', 
       tradable: '2.19' 
     },
     { 
       currency: "BTC",
       balance: '34.67261377',
       tradable: '32.14838915' 
     },
     { 
       currency: "EOS",
       balance: '939.60880658',
       tradable: '464.41852158' 
     },
     { 
       currency: "ETH",
       balance: '99.63595433',
       tradable: '98.39185433' 
     } 
   ] 
}

Retrieves the balances and tradable balances of all the currencies in the account.

HTTP Request

GET https://user-api.hanbitco.com/v1/balances

Headers

Parameter Type Description
Authorization string Authorization Token JWT

Response

Key Type Description
currency string Currency Code
balance string Total Balance of a currency
tradable string Amount of currency available for trading.

GET Get Currency Balance

const axios = require("axios");
const { sign } = require("jsonwebtoken");
const queryString = require("query-string");

const clientId = `${clientId}`;
const clientSecret =  `${clientSecret}`;

const query = queryString.stringify({ currency: "BTC" });

const payload = {
  clientId,
  query,
  nonce: (new Date).getTime(),
};

const token = sign(payload, clientSecret);

var options = {
  method: "GET",
  url: "https://user-api.hanbitco.com/v1/balances?currency=BTC",
  headers: { Authorization: `Bearer ${token}` }
};

axios(options).then(res => console.log(res.data));

Example output:

{
  status: "success",
  data: 
  [
    {
      currency:"BTC",
      balance:'34.67261377',
      tradable:'32.14838915'
    }
  ]
}

Retrieves the balances and tradable balances of a specific currency in the account.

HTTP Request

GEThttps://user-api.hanbitco.com/v1/balances?currency={currency}

Path Parameters

Parameter Type Description
currency string currency (e.g BTC)

Headers

Parameter Type Description
Authorization string Authorization Token JWT

Response

Key Type Description
currency string Currency Code
balance string Total Balance of a currency
tradable string Amount of currency available for trading.

POST Create Order

const axios = require("axios");
const { sign } = require("jsonwebtoken");
const queryString = require("query-string");
const uuid = require('uuid/v1');

const clientId = `${clientId}`;
const clientSecret =  `${clientSecret}`;

const body = {
  orderId: uuid(),
  currencyPair: 'pib_btc', 
  side: 'sell', 
  price: '0.00000013', 
  amount: '1000'
};

const query = queryString.stringify(body, { sort: (a, b) => a > b ? 1 : -1 });

const payload = {
  clientId,
  query,
  nonce: (new Date).getTime(),
};

const token = sign(payload, clientSecret);

var options = {
  method: "POST",
  url: "https://user-api.hanbitco.com/v1/orders",
  headers: { Authorization: `Bearer ${token}` },
  data: body,
};

axios(options).then(res => console.log(res.data));

Example output:

{
  status:"success",
  data: 
  {
    orderId:"27112ab0-1362-11e9-a084-3756505aeaaf",
    currencyPair:"PIB_BTC",
    side:"SELL",
    type:"LIMIT",
    amount:'1000',
    price:'0.00000013',
    remains:'1000',
    fee:'0.000000195',
    feeRate:'0.0015',
    status:"CREATED",
    timestamp:'1546964790'
  }
}

Creates an order for a specific market.

HTTP Request

POSThttps://user-api.hanbitco.com/v1/orders

Body Parameters

Key Type Description
orderId string A Unique Id (UUID) for the order
currencyPair string The market of the respective currency pair to order from e.g 'eth_btc'
side string Order type 'buy' or 'sell'
price string Price of currency per amount
amount string Amount of currency to buy or sell

Headers

Parameter Type Description
Authorization string Authorization Token JWT

Response

Key Type Description
orderId string A Unique Id (UUID) for the order
currencyPair string Currency pair of the market
side string Order Type "BUY" or "SELL"
type string Matching type "LIMIT"
amount string Total order amount
price string Order price
remains string Remaining amount
fee string Total transaction fee
feeRate string Fee rates
status string Order status
timestamp string Time of order created

DELETE Cancel Order

const axios = require("axios");
const { sign } = require("jsonwebtoken");
const queryString = require("query-string");
const uuid = require('uuid/v1');

const clientId = `${clientId}`;
const clientSecret =  `${clientSecret}`;

const body = {
  orderId: "27112ab0-1362-11e9-a084-3756505aeaaf"
};

const query = queryString.stringify(body);

const payload = {
  clientId,
  query,
  nonce: (new Date).getTime(),
};

const token = sign(payload, clientSecret);

var options = {
  method: "DELETE",
  url: "https://user-api.hanbitco.com/v1/orders",
  headers: { Authorization: `Bearer ${token}` },
  data: body,
};

axios(options).then(res => console.log(res.data));

Example output:

{
  status:"success",
  data: 
  {
    orderId:"27113ab0-1362-11e9-a084-3756505aeaaf",
    currencyPair:"PIB_BTC",
    side:"SELL",
    type:"LIMIT",
    amount:'1000',
    price:'0.00000013',
    remains:'1000',
    fee:'0.000000195',
    feeRate:'0.0015',
    status:"CANCELING",
    timestamp:'1546964790'
  }
}

Deletes an order for a specific market.

HTTP Request

DELETEhttps://user-api.hanbitco.com/v1/orders

Body Parameters

Key Type Description
orderId string A Unique Id (UUID) for the order
currencyPair string Currency pair for cancel orders
side string Order type for cancel orders 'buy' or 'sell'

Headers

Parameter Type Description
Authorization string Authorization Token JWT

Response

Key Type Description
orderId string A Unique Id (UUID) for the order
currencyPair string Currency pair of the market
side string Order Type "BUY" or "SELL"
type string Matching type "LIMIT"
amount string Total order amount
price string Order price
remains string Remaining amount
fee string Total transaction fee
feeRate string Fee rates
status string Order status
timestamp string Time of order created

GET Get Orders

const axios = require("axios");
const { sign } = require("jsonwebtoken");
const queryString = require("query-string");
const uuid = require('uuid/v1');

const clientId = `${clientId}`;
const clientSecret =  `${clientSecret}`;

const body = {
  currencyPair: 'rep_btc', 
  side: 'sell', 
  limit: 10,
  offset: 0,
};

const query = queryString.stringify(body, { sort: (a, b) => a > b ? 1 : -1 });

const payload = {
  clientId,
  query,
  nonce: (new Date).getTime(),
};

const token = sign(payload, clientSecret);

var options = {
  method: "GET",
  url: `https://user-api.hanbitco.com/v1/orders?${query}`,
  headers: { Authorization: `Bearer ${token}` },
};

axios(options).then(res => console.log(res.data));

Example output:

{ 
  status: "success",
  data:
   { 
     items:
      [ 
        { 
          orderId: "a43d4f93-2aa6-11e9-a5c7-b978e9f3ec42",
          currencyPair: "REP_BTC",
          side: "SELL",
          type: "LIMIT",
          amount: '2.3505',
          price: '0.003936',
          remains: '2.3505',
          fee: '0.000004625784',
          feeRate: '0.0005',
          status: "CREATED",
          timestamp: '1549523166' 
        } 
      ],
     offset: '10',
     limit: '1',
     total: '116',
     pageIndex: '10' 
   } 
}

Retrieves all the orders of a specific currency pair market based on the requested limit and offset.

HTTP Request

GEThttps://user-api.hanbitco.com/v1/orders

Query Parameters

Key Type Description
orderId string Order ID
currencyPair string The market of the respective currency pair to order from e.g 'eth_btc'
status string Orer Status 'open' or 'closed'
side string Order type 'buy' or 'sell'
limit int32 Limit the amount of items to retrieve
offset int32 Offset the amount of orders to retrieve based on the limit.

Headers

Parameter Type Description
Authorization string Authorization Token JWT

Response

Key Type Description
items array[item] Array of all the orders retrieved
offset string Offset of the orders
limit string Amount of orders to retrieve
total string Total number of orders that exist (disregarding limit and offset)
pageIndex string Current page index

Response (Item)

Key Type Description
orderId string A Unique Id (UUID) for the order
currencyPair string Currency pair of the market
side string Order Type "BUY" or "SELL"
type string Matching type "LIMIT"
amount string Total order amount
price string Order price
remains string Remaining amount
fee string Total transaction fee
feeRate string Fee rates
status string Order status
timestamp string Time of order created

GET Get Matched Orders

const axios = require("axios");
const { sign } = require("jsonwebtoken");
const queryString = require("query-string");
const uuid = require('uuid/v1');

const clientId = `${clientId}`;
const clientSecret =  `${clientSecret}`;

const body = {
  currencyPair: 'rep_btc', 
  side: 'sell', 
  limit: 1,
  offset: 0,
};

const query = queryString.stringify(body, { sort: (a, b) => a > b ? 1 : -1 });

const payload = {
  clientId,
  query,
  nonce: (new Date).getTime(),
};

const token = sign(payload, clientSecret);

var options = {
  method: "GET",
  url: `https://user-api.hanbitco.com/v1/trades?${query}`,
  headers: { Authorization: `Bearer ${token}` }
};

axios(options).then(res => console.log(res.data))

Example output:

{ 
  status: "success",
  data:
   { 
     items:
      [ 
        { 
          tradeId: "a43d4f93-2aa6-11e9-a5c7-b978e9f3ec42",
          currencyPair: "REP_BTC",
          side: "SELL",
          type: "LIMIT",
          amount: '2.1111',
          price: '0.002774',
          fee: '0.000000001384',
          taker: 'SELL
          timestamp: '1549523336' 
        } 
      ],
     offset: '0',
     limit: '1',
     total: '11',
     pageIndex: '0' 
   } 
}

Retrieves all the orders of a specific currency pair market based on the requested limit and offset.

HTTP Request

GEThttps://user-api.hanbitco.com/v1/trades

Query Parameters

Key Type Description
tradeId string Trade ID
currencyPair string The market of the respective currency pair to order from e.g 'eth_btc'
status string Status of trade
side string Order type 'buy' or 'sell'
limit int32 Limit the amount of items to retrieve
offset int32 Offset the amount of orders to retrieve based on the limit.

Headers

Parameter Type Description
Authorization string Authorization Token JWT

Response

Key Type Description
items array[item] Array of all the orders retrieved
offset string Offset of the orders
limit string Amount of orders to retrieve
total string Total number of orders that exist (disregarding limit and offset)
pageIndex string Current page index

Response (Item)

Key Type Description
tradeId string A unique tradeId UUID
currencyPair string Currency pair of the market
side string Order type "BUY" or "SELL"
type string Matching type "LIMIT"
amount string Matched amount
price string Matched price
fee string Matched fee
taker string taker
timestamp string time of order created

개요

인증값 생성

Payload의 구성은 다음과 같습니다.

  {
    clientId: "발급 받은 Client Id (필수)",
    nonce: "현재 시간, epoch milliseconds (필수)",
    query: "파라미터의 querystring(파라미터가 있을 경우 필수)"
  }

Private API 요청 시, 발급 받은 Client Id와 Client Secret으로 token을 생성하여 Authorization 헤더를 통해 전송합니다. Authorization 헤더에 등록 할 token은 JWT(https://jwt.io) 형식을 따릅니다.

서명 방식은 HS256 을 권장하며, secret으로 발급받은 Secret key를 사용합니다.

Parameter가 없을 경우,

const jwt = require("jsonwebtoken");

const payload = {
  clientId: "발급받은 Client Id",
  nonce: (new Date).getTime()
};

const jwtToken = jwt.sign(payload, "발급받은 Client Secret");
const authorizationToken = `Bearer ${jwtToken}`;













Parameter가 존재할 경우,

const jwt = require("jsonwebtoken");
const querystring = require("query-string");
const query = queryString.stringify(
  {/* 요청할 파라미터 */}, 
  { sort: (a, b) => a > b ? 1 : -1 } //QueryString은 알파벳 순으로 나열되어야 합니다.
);

const payload = {
  clientId: "발급받은 Client Id",
  nonce: (new Date).getTime(),
  query: query
};

const jwtToken = jwt.sign(payload, "발급받은 Secret key");
const authorizationToken = `Bearer ${jwtToken}`;

공개 API

GET 호가 정보 조회

curl --request GET \
  --url 'https://user-api.hanbitco.com/v1/markets/{currency_pair}/orderbook'

예시 응답:

  {
    status: "success",
    data:
    { 
      asks:
        [ 
          [ 
            '0.002776', // PRICE
            '2.5937'    // QTY
          ],
          [ 
            '0.003936',
            '2.3505' 
          ],
        ],
      bids:
        [ 
          [ 
            '0.000041', // PRICE
            '0.6829'    // QTY
          ],
          [ 
            '0.001773', 
            '0.4438' 
          ],
        ] 
    } 
  }

요청한 마켓의 오더북을 불러온다.

HTTP Request

GET https://user-api.hanbitco.com/v1/markets/{currency_pair}/orderbook

Path 파라미터

Parameter Type Description
currency_pair string 오더북을 불러올 마켓값 소문자 심볼 예) eth_btc.

GET 최근 체결 내역

curl --request GET \
  --url 'https://user-api.hanbitco.com/v1/markets/{currency_pair}/trades'

예시 응답:

{ 
  status: "success",
  data:
   { 
     offset: '0',
     limit: '10',
     items:
      [ 
        { 
          tradeId: "34dc838d-a847-4f3d-92e9-5e3e9ac99e0f",
          currencyPair: "REP_BTC",
          amount: '0.1',
          price: '0.002774',
          buyOrderType: "LIMIT",
          sellOrderType: "LIMIT",
          taker: "SELL",
          createdAt: "2019-02-07T07:07:17.937Z",
          total: '0.0002774',
          timestamp: '1549523237' 
        },
      ],
     total: '15',
     nextPageUrl: "?offset=10&limit=10",
     pageIndex: '0' 
   } 
}

해당 마켓의 최근 체결 내역을 불러온다.

HTTP Request

GET https://user-api.hanbitco.com/v1/markets/{currency_pair}/trades

Path 파라미터

Parameter Type Description
currency_pair string 최근 체결 내역을 불러올 마켓값 소문자 심볼 예) eth_btc.

GET 현재가 정보

curl --request GET \
  --url 'https://user-api.hanbitco.com/v1/markets/{currency_pair}/ticker'
{ 
  status: "success",
  data:
   { 
     currencyPair: "REP_BTC",
     timestamp: '1549523237',
     lastPrice: '0.002774',
     lastDayPrice: '0.002767',
     lowPrice: '0.002768',
     highPrice: '0.002776',
     volume: '43.4556' 
   } 
}

요청한 마켓의 최근 체결가, 전일가, 현재가, 최저가, 최고가 및 거래량 정보를 불러온다.

HTTP Request

GET https://user-api.hanbitco.com/v1/markets/{currency_pair}/ticker

Path 파라미터

Parameter Type Description
currency_pair string 현재가 정보를 불러올 마켓값 소문자 심볼 예) eth_btc.

개인 API

GET 전체 잔고 조회

const axios = require("axios");
const { sign } = require("jsonwebtoken");

const clientId = `${clientId}`;
const clientSecret =  `${clientSecret}`;

const payload = {
  clientId, 
  nonce: (new Date).getTime()
};

const token = sign(payload, clientSecret);

var options = {
  method: "GET",
  url: "https://user-api.hanbitco.com/v1/balances",
  headers: { Authorization: `Bearer ${token}` }
};

axios(options).then(res => console.log(res.data));

예시 응답:

{ status: "success",
  data:
   [ 
     { 
       currency: "BCH", 
       balance: '2.19', 
       tradable: '2.19' 
     },
     { 
       currency: "BTC",
       balance: '34.67261377',
       tradable: '32.14838915' 
     },
     { 
       currency: "EOS",
       balance: '939.60880658',
       tradable: '464.41852158' 
     },
     { 
       currency: "ETH",
       balance: '99.63595433',
       tradable: '98.39185433' 
     } 
   ] 
}

계정 지갑의 모든 암호화폐의 전체 및 거래 가능한 잔고를 불러온다.

HTTP Request

GET https://user-api.hanbitco.com/v1/balances

헤더

Parameter Type Description
Authorization string 인증 토큰 JWT

응답

Key Type Description
currency string 암호화폐 값 BTC
balance string 해당 암호화폐의 전체 잔고
tradable string 해당 암호화폐의 거래 가능 잔고

GET 특정 암호화폐 잔고 조회

const axios = require("axios");
const { sign } = require("jsonwebtoken");
const queryString = require("query-string");

const clientId = `${clientId}`;
const clientSecret =  `${clientSecret}`;

const query = queryString.stringify({ currency: "BTC" });

const payload = {
  clientId,
  query,
  nonce: (new Date).getTime(),
};

const token = sign(payload, clientSecret);

var options = {
  method: "GET",
  url: "https://user-api.hanbitco.com/v1/balances?currency=BTC",
  headers: { Authorization: `Bearer ${token}` }
};

axios(options).then(res => console.log(res.data));

Example output:

{
  status: "success",
  data: 
  [
    {
      currency:"BTC",
      balance:'34.67261377',
      tradable:'32.14838915'
    }
  ]
}

특정 암호화폐의 잔고와 거래 가능한 잔고를 조회햔다.

HTTP Request

GEThttps://user-api.hanbitco.com/v1/balances?currency={currency}

Path 파라미터

Parameter Type Description
currency string 암호화폐 값 BTC

헤더

Parameter Type Description
Authorization string 인증 토큰 JWT

응답

Key Type Description
currency string 암호화폐 값
balance string 해당 암호화폐의 전체 잔고
tradable string 해당 암호화폐의 거래 가능한 잔고

POST 주문 생성

const axios = require("axios");
const { sign } = require("jsonwebtoken");
const queryString = require("query-string");
const uuid = require('uuid/v1');

const clientId = `${clientId}`;
const clientSecret =  `${clientSecret}`;

const body = {
  orderId: uuid(),
  currencyPair: 'pib_btc', 
  side: 'sell', 
  price: '0.00000013', 
  amount: '1000'
};

const query = queryString.stringify(body, { sort: (a, b) => a > b ? 1 : -1 });

const payload = {
  clientId,
  query,
  nonce: (new Date).getTime(),
};

const token = sign(payload, clientSecret);

var options = {
  method: "POST",
  url: "https://user-api.hanbitco.com/v1/orders",
  headers: { Authorization: `Bearer ${token}` },
  data: body,
};

axios(options).then(res => console.log(res.data));

Example output:

{
  status:"success",
  data: 
  {
    orderId:"27112ab0-1362-11e9-a084-3756505aeaaf",
    currencyPair:"PIB_BTC",
    side:"SELL",
    type:"LIMIT",
    amount:'1000',
    price:'0.00000013',
    remains:'1000',
    fee:'0.000000195',
    feeRate:'0.0015',
    status:"CREATED",
    timestamp:'1546964790'
  }
}

해당 마켓에 매수/매도 주문을 생성한다.

HTTP Request

POSThttps://user-api.hanbitco.com/v1/orders

Body 파라미터

Key Type Description
orderId string 주문의 고유 ID UUID
currencyPair string 주문을 생성한 마켓 예) ETH_BTC
side string 주문 종류 'buy' or 'sell'
price string Price of currency per amount
amount string Amount of currency to buy or sell

헤더

Parameter Type Description
Authorization string 인증 토큰 JWT

응답

Key Type Description
orderId string 주문의 고유 ID UUID
currencyPair string 마켓 종류 예) ETH_BTC
side string 주문 종류 "BUY" or "SELL"
type string 주문 형태 "LIMIT"
amount string 총 주문 수량
price string 주문 가격
remains string 주문 잔량
fee string 총 주문 수수료
feeRate string 적용 수수료율
status string 주문 상태 예) CREATED
timestamp string 주문 생성 시각

DELETE 주문 취소

const axios = require("axios");
const { sign } = require("jsonwebtoken");
const queryString = require("query-string");
const uuid = require('uuid/v1');

const clientId = `${clientId}`;
const clientSecret =  `${clientSecret}`;

const body = {
  orderId: "27112ab0-1362-11e9-a084-3756505aeaaf"
};

const query = queryString.stringify(body);

const payload = {
  clientId,
  query,
  nonce: (new Date).getTime(),
};

const token = sign(payload, clientSecret);

var options = {
  method: "DELETE",
  url: "https://user-api.hanbitco.com/v1/orders",
  headers: { Authorization: `Bearer ${token}` },
  data: body,
};

axios(options).then(res => console.log(res.data));

예시 응답:

{
  status:"success",
  data: 
  {
    orderId:"27113ab0-1362-11e9-a084-3756505aeaaf",
    currencyPair:"PIB_BTC",
    side:"SELL",
    type:"LIMIT",
    amount:'1000',
    price:'0.00000013',
    remains:'1000',
    fee:'0.000000195',
    feeRate:'0.0015',
    status:"CANCELING",
    timestamp:'1546964790'
  }
}

해당 마켓의 주문을 취소함.

HTTP Request

DELETEhttps://user-api.hanbitco.com/v1/orders

Body 파라미터

Key Type Description
orderId string 주문의 고유 ID UUID
currencyPair string 주문 취소을 취소할 마켓
side string 주문 종류 'buy' or 'sell'

헤더

Parameter Type Description
Authorization string 인증 토큰 JWT

응답

Key Type Description
orderId string 주문의 고유 ID UUID
currencyPair string 마켓 종류 예) ETH_BTC
side string 주문 종류 "BUY" or "SELL"
type string 주문 형태 "LIMIT"
amount string 총 주문 수량
price string 주문 가격
remains string 주문 잔량
fee string 총 주문 수수료
feeRate string 주문 적용 수수료율
status string 주문 상태 CREATED
timestamp string 주문 생성 시각

GET 주문 조회

const axios = require("axios");
const { sign } = require("jsonwebtoken");
const queryString = require("query-string");
const uuid = require('uuid/v1');

const clientId = `${clientId}`;
const clientSecret =  `${clientSecret}`;

const body = {
  currencyPair: 'rep_btc', 
  side: 'sell', 
  limit: 10,
  offset: 0,
};

const query = queryString.stringify(body, { sort: (a, b) => a > b ? 1 : -1 });

const payload = {
  clientId,
  query,
  nonce: (new Date).getTime(),
};

const token = sign(payload, clientSecret);

var options = {
  method: "GET",
  url: `https://user-api.hanbitco.com/v1/orders?${query}`,
  headers: { Authorization: `Bearer ${token}` },
};

axios(options).then(res => console.log(res.data));

예시 응답:

{ 
  status: "success",
  data:
   { 
     items:
      [ 
        { 
          orderId: "a43d4f93-2aa6-11e9-a5c7-b978e9f3ec42",
          currencyPair: "REP_BTC",
          side: "SELL",
          type: "LIMIT",
          amount: '2.3505',
          price: '0.003936',
          remains: '2.3505',
          fee: '0.000004625784',
          feeRate: '0.0005',
          status: "CREATED",
          timestamp: '1549523166' 
        } 
      ],
     offset: '10',
     limit: '1',
     total: '116',
     pageIndex: '10' 
   } 
}

해당 마켓의 모든 주문을 LIMIT 값과 OFFSET값에 기반해 주문 정보를 불러온다.

HTTP Request

GEThttps://user-api.hanbitco.com/v1/orders

Query 파라미터

Key Type Description

orderId | string | 확인할 주문 아이디 currencyPair | string | 주문을 생성한 마켓 예) ETH_BTC status | string | 주문의 상태 'open' or 'closed' side | string | 주문 종류 'buy' or 'sell' limit | int32 | API가 불러올 정보 개수 제한 offset | int32 | 조회할 주문의 offset

헤더

Parameter Type Description
Authorization string 인증 토큰 JWT

응답

Key Type Description
items array[item] 조회된 주문 배열
offset string 현재 조회된 주문의 offset
limit string 요청된 주문의 조회 개수
total string 페이징을 제외한 조건에 맞는 총 주문의 개수
pageIndex string 현재 페이지의 인덱스

응답 (Item)

Key Type Description
orderId string 주문의 고유 ID UUID
currencyPair string 마켓 종류 예) ETH_BTC
side string 주문 종류 "BUY" or "SELL"
type string 주문 형태 "LIMIT"
amount string 총 주문 수량
price string 주문 가격
remains string 주문 잔량
fee string 총 주문 수수료
feeRate string 주문 적용 수수료율
status string 주문 상태 CREATED
timestamp string 주문 생성 시각

GET 체결 주문 조회

const axios = require("axios");
const { sign } = require("jsonwebtoken");
const queryString = require("query-string");
const uuid = require('uuid/v1');

const clientId = `${clientId}`;
const clientSecret =  `${clientSecret}`;

const body = {
  currencyPair: 'rep_btc', 
  side: 'sell', 
  limit: 1,
  offset: 0,
};

const query = queryString.stringify(body, { sort: (a, b) => a > b ? 1 : -1 });

const payload = {
  clientId,
  query,
  nonce: (new Date).getTime(),
};

const token = sign(payload, clientSecret);

var options = {
  method: "GET",
  url: `https://user-api.hanbitco.com/v1/trades?${query}`,
  headers: { Authorization: `Bearer ${token}` }
};

axios(options).then(res => console.log(res.data))

예시 응답:

{ 
  status: "success",
  data:
   { 
     items:
      [ 
        { 
          tradeId: "a43d4f93-2aa6-11e9-a5c7-b978e9f3ec42",
          currencyPair: "REP_BTC",
          side: "SELL",
          type: "LIMIT",
          amount: '2.1111',
          price: '0.002774',
          fee: '0.000000001384',
          taker: 'SELL
          timestamp: '1549523336' 
        } 
      ],
     offset: '0',
     limit: '1',
     total: '11',
     pageIndex: '0' 
   } 
}

해당 마켓에 체결된 모든 주문을 LIMIT 값과 OFFSET값에 기반해 거래 정보를 불러온다.

HTTP Request

GEThttps://user-api.hanbitco.com/v1/trades

Query 파라미터

Key Type Description
tradeId string 체결 주문 아이디
currencyPair string 주문을 생성한 마켓 예) ETH_BTC
status string 주문 상태
side string 주문 종류 'buy' or 'sell'
limit int32 API가 불러올 정보 개수 제한
offset int32 조회할 주문의 offset

헤더

Parameter Type Description
Authorization string 인증 토큰 JWT

응답

Key Type Description
items array[item] 조회된 주문 배열
offset string 현재 조회된 주문의 offset
limit string 요청된 주문의 조회 개수
total string 페이징을 제외한 조건에 맞는 총 주문의 개수
pageIndex string 현재 페이지의 인덱스

응답 (Item)

Key Type Description
tradeId string 주문의 고유 ID UUID
currencyPair string 마켓 종류 예) ETH_BTC
side string 주문 종류 "BUY" or "SELL"
type string 주문 형태 "LIMIT"
amount string 체결 수량
price string 체결 가격
fee string 체결 수수료
taker string taker "BUY" or "SELL"
timestamp string 주문 생성 시각