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

1. Subscribe Request

paramtypedescription
typestringmust be 'subscribe'
channelstringMust be 'marketdata'
market_idstringMarket ID that you want subscribe.
filterstring[]Required parameters are one or more of the values ​​below.

ticker,
recent_trades,
order_books,
order_books_l2,
order_books_l3,
order_books_l4
intervalnumberData 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)

paramtypedescription
channelstringIt will return 'marketdata'
lagnumberAPI server's internal lag (ms).
For example, if lag is 2000, It means this data is 2 seconds ago.
market_idstringsame as request
statusstring"ok" - working normal
"unavailable" - We're preparing datas, so retry later.
tickerObjectReturns 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_tradesRECENT_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.
resetbooleanIf 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 sends the full value on the first request, and only changes thereafter.

You can 'overwrite' the quantity of the Orderbook as received.
If the Orderbook quantity is 0, there is no quantity for that amount, or the quantity is completely exhausted between intervals.