Web

The --service_listen_address supports a generic web interface.

Note

All interfaces are case sensitive.

Note

Almost all interfaces are JSON based.

Exceptions:

  • Metrics (text)

Note

Errors will generally not return anything except for the status code.

Metrics (Prometheus)

/metrics

Internal metrics in Prometheus’ Exposition Format.

[...]

# TYPE roq_market_data_latency histogram
roq_market_data_latency_bucket{source="deribit", function="market_by_price", le="10000"} 0
roq_market_data_latency_bucket{source="deribit", function="market_by_price", le="100000"} 0
roq_market_data_latency_bucket{source="deribit", function="market_by_price", le="1000000"} 0
roq_market_data_latency_bucket{source="deribit", function="market_by_price", le="10000000"} 90
roq_market_data_latency_bucket{source="deribit", function="market_by_price", le="100000000"} 100
roq_market_data_latency_bucket{source="deribit", function="market_by_price", le="1000000000"} 100
roq_market_data_latency_bucket{source="deribit", function="market_by_price", le="+Inf"} 100
roq_market_data_latency_sum{source="deribit", function="market_by_price"} 918419439
roq_market_data_latency_count{source="deribit", function="market_by_price"} 100

[...]

Session

/session

Session

{
  "package":{
    "name":"roq-deribit",
    "version":"0.8.8",
    "build_number":"unknown"
  },
  "config":{
    "name":"deribit",
    "config_hash":"9M4CpcPmByCaAoiw4NukVWcRrFhELP2Uz7JG5-BJyD4=",
    "api":""
  },
  "session":{
    "id":"545e8fd2-3e67-4d9e-b029-1a191f5b5d95",
    "cache_dir":"/home/thraneh/var/lib/roq/cache/deribit",
    "event_logs":{
      "public":"/home/thraneh/var/lib/roq/data/public/2022-W45/deribit/deribit-public-1667801956048.roq",
      "private":"/home/thraneh/var/lib/roq/data/private/2022-W45/deribit/deribit-private-1667801956048.roq"
    }
  },
  "host":{
    "kernel":{
      "name":"Linux",
      "release":"5.15.0-52-generic",
      "version":"#58-Ubuntu SMP Thu Oct 13 08:03:55 UTC 2022"
    },
    "network":{
      "hostname":"VQ-WRK-02"
    }
  },
  "process":{
    "pid":469847,
    "start_time":1667801956,
    "user":"thraneh"
  }
}

Users

/users

List of users

/users/<user>

A user

{
  "name":"trader",
  "connected":false
}

Accounts

/accounts

List of accounts

/accounts/<account>

An account

Stream Status

/stream_status

List of stream_id’s

/stream_status/<stream_id>

StreamStatus

{
  "stream_id":1,
  "account":"A1",
  "supports":"CREATE_ORDER|MODIFY_ORDER|CANCEL_ORDER|ORDER_ACK|ORDER|TRADE|POSITION",
  "transport":"TCP",
  "protocol":"FIX",
  "encoding":"FIX",
  "priority":"PRIMARY",
  "connection_status":"READY"
}

Gateway Status

/gateway_status

List of accounts.

Note

null is the special “account” used for public data.

/gateway_status/<account>

GatewayStatus for an account

{
  "account":"A1",
  "supported":"CREATE_ORDER|MODIFY_ORDER|CANCEL_ORDER|ORDER_ACK|ORDER|TRADE|POSITION|FUNDS",
  "available":"CREATE_ORDER|MODIFY_ORDER|CANCEL_ORDER|ORDER_ACK|ORDER|TRADE|POSITION|FUNDS",
  "unavailable":null
}

Reference Data

/reference_data

List of exchanges

/reference_data/<exchange>

List of symbols

/reference_data/<exchange>/<symbol>

ReferenceData for the <exchange> / <symbol> pair.

{
  "stream_id":4,
  "exchange":"deribit",
  "symbol":"BTC-PERPETUAL",
  "description":"future",
  "security_type":"FUTURES",
  "base_currency":"USD",
  "quote_currency":"USD",
  "margin_currency":null,
  "commission_currency":"BTC",
  "tick_size":0.5,
  "multiplier":10,
  "min_notional":null,
  "min_trade_vol":1,
  "max_trade_vol":null,
  "trade_vol_step_size":1,
  "option_type":null,
  "strike_currency":null,
  "strike_price":null,
  "underlying":null,
  "time_zone":null,
  "issue_date":"2018-08-13",
  "settlement_date":null,
  "expiry_datetime":"3000-01-01T08:00:00Z",
  "expiry_datetime_utc":"3000-01-01T08:00:00Z",
  "discard":false
}

Market Status

/market_status

List of exchanges

/market_status/<exchange>

List of symbols

/market_status/<exchange>/<symbol>

MarketStatus for the <exchange> / <symbol> pair.

{
  "stream_id":3,
  "exchange":"deribit",
  "symbol":"BTC-PERPETUAL",
  "trading_status":"OPEN"
}

Top of Book

/top_of_book

List of exchanges

/top_of_book/<exchange>

List of symbols

/top_of_book/<exchange>/<symbol>

TopOfBook for the <exchange> / <symbol> pair.

{
  "stream_id":0,
  "exchange":"deribit",
  "symbol":"BTC-PERPETUAL",
  "layer":{
    "bid_price":20776,
    "bid_quantity":624,
    "ask_price":20776.5,
    "ask_quantity":9751
  },
  "update_type":"SNAPSHOT",
  "exchange_time_utc":"2022-11-07T10:25:28.788000000Z",
  "exchange_sequence":0
}

Statistics

/statistics

List of exchanges

/statistics/<exchange>

List of symbols

/statistics/<exchange>/<symbol>

Statistics for the <exchange> / <symbol> pair.

{
  "stream_id":4,
  "exchange":"deribit",
  "symbol":"BTC-PERPETUAL",
  "statistics":[{
    "type":"PRE_OPEN_INTEREST",
    "value":381431265,
    "begin_time_utc":null,
    "end_time_utc":null
  },{
    "type":"PRE_SETTLEMENT_PRICE",
    "value":20770.13,
    "begin_time_utc":null,
    "end_time_utc":null
  }],
  "update_type":"SNAPSHOT",
  "exchange_time_utc":null
}

Orders

MISSING

Trades

MISSING

Positions

MISSING

Funds

MISSING

Custom Metrics

/custom_metrics

List of users

/custom_metrics/<user>

List of labels

/custom_metrics/<user>/<label>

List of CustomMetrics for the <user> / <symbol> pair.

Note

The result is a list of objects. Each object has the <account>, <exchange>, <symbol> tuple as the unique key.

Note

A future version of the REST interface may support query parameters for the embedded key.

[{
  "user":"trader",
  "label":"ToB",
  "account":null,
  "exchange":"deribit",
  "symbol":"BTC-PERPETUAL",
  "measurements":[{
    "name":"bp",
    "value":20754
  },{
    "name":"ap",
    "value":20754.5
  }],
  "update_type":"SNAPSHOT"
}]

Parameters

/parameters

List of users

/parameters/<user>

Parameters for <user>.

/parameters/<user>/<label>

Parameters for <user> and <label>.