marketdata

Websocket Request for public market data.
This method provides ticker, order book, recent trades.

1. Subscribe Request

param

type

description

type

string

must be 'subscribe'

channel

string

Must be 'marketdata'

market_id

string

Market ID that you want subscribe.

filter

string[]

Data that what you need.
It can be one of this values:

ticker,
recent_trades,
order_books,
order_books_l2,
order_books_l3,
order_books_l4

각 항목에 대한 상세 내용은 하단에 별도로 기재한다.

interval

number

Data sending interval(ms). It can be one of this values:

100, 500

// request

{
  "channel": "marketdata",
  "filter": [<FILTER>],
  "interval": <INTERVAL>,
  "market_id": <MARKET_ID>,
  "type": "subscribe"
}

2. Responses (When subscribe, and on going)

param

type

description

channel

string

It will return 'marketdata'

lag

number

API server's internal lag (ms).
For example, if lag is 2000, It means this data is 2 seconds ago.

market_id

string

same as request

status

string

"ok" - working normal
"unavailable" - We're preparing datas, so retry later.

ticker

Object

Returns if you put 'ticker' in your "filter" parameter.
Ticker made with 24 hours since last trade occurs.

TICKER Object:

  • base_volume: Trade volume of base currency
  • change: Price difference over 24 hours ago
  • high: highest price in 24 hours.
  • last: last price of lastest trade.
  • low: : lowest price in 24 hours.
  • quote_volume: Trade volume of quote currency
  • time: when ticker last calculated

recent_trades

RECENT_TRADES[]

Returns if you put 'recent_trades' in your "filter" parameter.
It will return last 100 trades of the market.
Old trade will be first, New trade will be last.

RECENT_TRADES:

  • price: a closed price,
  • quantity: traded quantity,
  • time: the time the deal was made,
  • side: 'buy' or 'sell',
  • tick_direction:
    An indicator of whether the transaction amount has risen or gone down compared to the previous transaction.
    It will be 'up' | 'down' | 'zero' | 'zeroup' | 'zerodown',

order_books
order_books_l1
order_books_l2
order_books_l3
order_books_l4

ORDER_BOOK[]

Returns if you put 'order_books' or 'order_books_l1' or 'order_books_l2' or 'order_books_l3' or 'order_books_l4' in your "filter" parameter.

It sends differ of order_book.
{
side: "buy",
price: "0.00004477",
quantity: "1789410.140359",
}

order_books_l1
order_books_l2
order_books_l3
order_books_l4:
Sends orderbook grouped by 10^(ceil(log10(tick size))+[LEVEL]). Other than this everything is the same as order_books.

reset

boolean

If data is returning all data (not diff), set it true.
IF data is diff data (not all), set it false.

//response

{
  "channel": "marketdata",
  "market_id": <MARKET_ID>,
  "status":"ok",
  "lag":0,
  "<channels>": <data>
  "reset":true
}

example)

// request

{
  "channel": "marketdata",
  "filter": ["ticker", "recent_trades"],
  "interval": 100,
  "market_id": "XRP-BTC",
  "type": "subscribe"
}

//response

{
  "channel":"marketdata",
  "market_id":"XRP-BTC",
  "status":"ok",
  "lag":0,
  "ticker":{
   "time":"2018-08-17T03:00:43.000Z",
   "last":"0.00004221",
   "low":"0.00003953",
   "high":"0.00004233",
   "change":"0.00000195",
   "base_volume":"119304953.57728445",
   "quote_volume":"4914.391934022046355"
  },
  "recent_trades":[
    {"price":"0.00004221","quantity":"555","time":"2018-08-17T02:56:17.249Z","side":"buy","tick_direction":"zeroup"},
.
.
.
{"side":"buy","price":"0.00003218","quantity":"167912.55816365"}
   ],
"reset":true,
}

Marketdata 의 경우 처음 접속했을때 전체값을, 이후에는 변경분만 보낸다.
개발시에는 Orderbook 의 수량을 받은대로 '덮어쓰면' 된다.
Orderbook 의 수량이 0이라면 해당 금액에 물량이 없거나, interval 사이에 물량이 전체 소진된것이다.