NAV Navbar

Market Data Specification(MD)

Quick Start

  1. Apply for an account and get API_Key_ID and API_Secret_Key
  2. Use Websocket or REST to get market data.
  3. The {SYMBOL} is the pair to be subscribed. For example: ETHBTC.
  4. The {VENUE} is the exchange to be subscribed. For example: VENUE1.

Types of market data

  1. md(raw): Market data as we receive from the exchange.
  2. fxmd: Market data in which we use an FX feed to convert the data from different quote currency into one. For example, BTCKRW from Bithumb will be converted to BTCUSD using the KRWUSD FX fx rate.
  3. gbbo: Proprietary market data feed in which we establish come up with our own FX rate.

{type} = md,fxmd,gbbo

Signature

Signature:

// js
signature = JWT(payload={
    "accessKey": "API_Key_ID"
}, key="API_Secret_Key", algorithm='HS256')
# python3
import jwt
signature = jwt.encode({'accessKey': "API_Key_ID"}, "API_Secret_Key", algorithm='HS256')
headers = {'signature': str(signature, encoding='utf-8')}

Request:

curl -X GET -H "signature: eyJhbI1NiJ9.eyJhY**************lY1TyJ9.RrWnyheQs" "https://api.apifiny.com/md/orderbook/v1/BTCUSD/VENUE1"

Please use JWT to generate a Signature and add the parameter signature to each request header.

For every request, please use JWT and secretKey to generate a Signature and use the Signature in the request header parameter.

Parameter Description
accessKey API Key ID
key API Key secret

OrderBook

We support price level order book per exchange/symbol pair. It represents the total quantity available by price level on each side.

Websocket Interface

Request (subscribe):

{
  "channel":"orderbook",
  "symbol":"BTCUSDT",
  "venues": ["VENUE1","VENUE2"],
  "action":"sub"
}

Request (unsubscribe):

{
  "channel":"orderbook",
  "symbol":"BTCUSDT",
  "venues":["VENUE1"],
  "action":"unsub"
}

Response:

{
  "symbol": "BTCUSDT",
  "asks": [
    {
    "price": 7175.27,
    "qty": 0.67560373,
    "provider": "VENUE1"
    }
    // ...
  ],
  "bids": [
    {
    "price": 7191.64,
    "qty": 0.1,
    "provider": "VENUE2"
    }
    // ...
  ],
  "updateAt": 1577437657146
}

URL:

wss://api.apifiny.com/{type}/orderbook/v1

Request:

The request for subscribe/unsubscribe must be in JSON format.

Parameter Description
channel channel is orderbook
symbol symbol E.g BTCUSD
venues list of venues from which we want the market data
action subscribe or unsubscribe

Response:

The response of the websocket request is also in JSON format.

RESTful Interface

Response:

{
  "symbol": "BTCUSD",
  "asks": [
    {
    "price": 7175.27,
    "qty": 0.67560373,
    "provider": "VENUE2"
    }
    // ...
  ],
  "bids": [
    {
    "price": 7191.64,
    "qty": 0.1,
    "provider": "VENUE1"
    }
    // ...
  ],
  "updateAt": 1577437657146
}

URL:

GET https://api.apifiny.com/{type}/orderbook/v1/{SYMBOL}/{VENUE}?signature={key}

Response:

Same as websocket response.

URL:

GET https://api.apifiny.com/{type}/orderbook/v1/{SYMBOL}?signature={key}

Response:

Same as websocket response. This will contain consolidated data from the venues on which the symbol is currently trading.

BBO

We support BBO per exchange/symbol pair which represents the best bid/offer (price,quantity,symbol).

Websocket Interface

Request (subscription):

{
  "channel":"bbo",
  "symbol":"BTCUSDT",
  "venues": "VENUE1,VENUE2",
  "action":"sub"
}

Request (unsubscribing):

{
  "channel":"bbo",
  "symbol":"BTCUSDT",
  "venues":"VENUE1",
  "action":"unsub"
}

Response:

{
  "symbol": "BTCUSD",
  "asks": [
    {
    "price": 7175.27,
    "qty": 0.67560373,
    "provider": "VENUE1"
    },
    {
    "price": 7175.25,
    "qty": 1.373,
    "provider": "VENUE2"
    },
  ],
  "bids": [
    {
    "price": 7191.64,
    "qty": 0.1,
    "provider": "VENUE1"
    },
    {
    "price": 7190.52,
    "qty": 1.1,
    "provider": "VENUE2"
    }
  ],
  "updateAt": 1577437657146
}

URL:

wss://api.apifiny.com/{type}/orderbook/v1

Request:

The request for subscribe/unsubscribe must be in JSON format.

Parameter Description
channel channel is bbo
symbol symbol E.g BTCUSD
venues list of venues from which we want the market data
action subscribe or unsubscribe

Response:

The response of the websocket request is also in JSON format.

RESTful Interface

Response:

{
  "symbol": "BTCUSD",
  "asks": [
    {
    "price": 7175.27,
    "qty": 0.67560373,
    "provider": "VENUE1"
    },
    {
    "price": 7175.25,
    "qty": 1.373,
    "provider": "VENUE2"
    },
  ],
  "bids": [
    {
    "price": 7191.64,
    "qty": 0.1,
    "provider": "VENUE1"
    },
    {
    "price": 7190.52,
    "qty": 1.1,
    "provider": "VENUE2"
    }
  ],
  "updateAt": 1577437657146
}

URL:

GET https://api.apifiny.com/{type}/bbo/v1/{SYMBOL}/{VENUE}?signature={key}

Response:

Same as the websocket response.

URL:

GET https://api.apifiny.com/{type}/bbo/v1/{SYMBOL}?signature={key}

Response:

Same as the websocket response. This will contain consolidated data from the venues on which the symbol is currently trading.

Trade

Websocket Interface

Request (subscription):

{
  "channel":"trade",
  "symbol":"BTCUSDT",
  "venues": "VENUE1,VENUE2",
  "action":"sub"
}

Request (unsubscribing):

{
  "channel":"trade",
  "symbol":"BTCUSDT",
  "venues":"VENUE1",
  "action":"unsub"
}

Response:

{
  "symbol": "BTCUSDT",
  "price": 7175.27,
  "qty": 0.67560373,
  "provider": "VENUE1",
  "updateAt": 1577437657146
}

URL:

wss://api.apifiny.com/{type}/orderbook/v1

Request:

The request for subscribe/unsubscribe must be in JSON format.

Parameter Description
channel channel is trade
symbol symbol E.g BTCUSD
venues list of venues from which we want the market data
action subscribe or unsubscribe

Response:

The response of the websocket request is also in JSON format.

RESTful Interface

Response:

{
  "symbol": "BTCUSDT",
  "price": 7175.27,
  "qty": 0.67560373,
  "provider": "VENUE1",
  "updateAt": 1577437657146
}

RESTFul interface endpoint is:

URL:

GET https://api.apifiny.com/{type}/trade/v1/{SYMBOL}/{VENUE}?signature={key}

Response:

Same as the websocket response.

URL:

GET https://api.apifiny.com/{type}/trade/v1/{SYMBOL}?signature={key}

Response:

Same as the websocket response. This will contain consolidated data from the venues on which the symbol is currently trading.

Ticker

Websocket InterfaceInteface

Request (subscribe):

{
  "channel":"ticker",
  "symbol":"BTCUSDT",
  "venues": "VENUE1,VENUE2",
  "action":"sub"
}

Request (unsubscribe):

{
  "channel":"ticker",
  "symbol":"BTCUSDT",
  "venues":"VENUE1",
  "action":"unsub"
}

Response:

{
  "symbol": "BTCUSDT",
  "open": 7175.27,
  "high": 7178.27,
  "low" : 7170.26,
  "close": 7171.27,
  "vol": 8962.5670,
  "amount": 1.245,
  "count": 5,
  "updateAt": 1577437657146,
  "provider": "VENUE1"
}

URL:

wss://api.apifiny.com/{type}/orderbook/v1

Request:

The request for subscribe/unsubscribe must be in JSON format.

Parameter Description
channel channel is ticker
symbol symbol E.g BTCUSD
venues list of venues from which we want the market data
action subscribe or unsubscribe

Response:

The response of the websocket request is also in JSON format.

RESTful Interface

Response:

{
  "symbol": "BTCUSDT",
  "open": 7175.27,
  "high": 7178.27,
  "low" : 7170.26,
  "close": 7171.27,
  "vol": 8962.5670
  "amount": 1.245
  "count": 5
  "updateAt": 1577437657146
  "provider": "VENUE1"
}

The RESTFul interface endpoint is:

URL:

GET https://api.apifiny.com/{type}/ticker/v1/{SYMBOL}/{VENUE}?signature={key}

Response:

Same as the websocket response.

URL:

GET https://api.apifiny.com/{type}/ticker/v1/{SYMBOL}?signature={key}

Response:

Same as the websocket response. This will contain consolidated data from the venues on which the symbol is currently trading.