roq-binance

Purpose

  • Maintain network connectivity with the Binance exchange

  • Route exchange updates to connected clients

  • Route client requests to the relevant exchange accounts

  • Stream all messages to an event-log

Overview

Products

Spot

Futures

Options

Market Data

Reference Data

Market Status

Top of Book

Market by Price (L2)

Market by Order (L3)

Trade Summary

Statistics

Order Management

Create

Modify

Cancel

Cancel All

Auto Cancellation

Account Management

Positions

Funds

  • Data center located in Japan (to be confirmed)

  • No test environment

Conda

1
2
3
conda install \
  --channel https://roq-trading.com/conda/stable \
  roq-binance
1
2
3
cp $CONDA_PREFIX/share/roq-binance/config.toml $CONFIG_FILE_PATH

# Then modify $CONFIG_FILE_PATH to match your specific configuration
1
2
3
4
5
6
roq-binance \
      --name "binance" \
      --config_file "$CONFIG_FILE_PATH" \
      --client_listen_address "$UNIX_SOCKET_PATH" \
      --metrics_listen_address "$TCP_LISTEN_PORT" \
      --flagfile "$FLAG_FILE"

Flags

1
roq-binance --help

--rest_uri

URI

--rest_depth_limit

Depth limit. This choice has influence on request limits, please refer to exchange documentation.

--rest_listen_key_refresh

Time between listen key refresh.

--ws_uri

URI

--ws_depth_levels

Max levels for snapshots.

--ws_depth_freq

Conflated depth updates are published at a frequency of either 100ms or 1000ms.

--ws_trade_details

Report individual matches for trade summary?

--ws_max_subscriptions

Subscription limit per web-socket connection

Environments

1
2
3
4
# flagfile

--rest_uri=https://api.binance.com
--ws_uri=wss://stream.binance.com:9443/stream

Market Data

Event

Stream

Messages

Comments

roq::ReferenceData

Unavailable

roq::MarketStatus

Unavailable

roq::TopOfBook

MarketData

<symbol>@bookTicker

roq::MarketByPriceUpdate

MarketData

<symbol>@depth@<freq>, <symbol>@depth<levels>@<freq>

See Flags

roq::MarketByOrderUpdate

Unavailable

roq::TradeSummary

MarketData

<symbol>@trade, <symbol>@aggTrade

See Flags

roq::StatisticsUpdate

MarketData

<symbol>@miniTicker

Event

Stream

Messages

Comments

roq::ReferenceData

OrderEntry

GET /api/v3/exchangeInfo

roq::MarketStatus

OrderEntry

GET /api/v3/exchangeInfo

roq::TopOfBook

roq::MarketByPriceUpdate

OrderEntry

GET /api/v3/depth

See Flags

roq::MarketByOrderUpdate

roq::TradeSummary

roq::StatisticsUpdate

Statistics

Type

Comments

UPPER_LIMIT_PRICE

LOWER_LIMIT_PRICE

OPEN_PRICE

CLOSE_PRICE

Order Management

Event

Stream

Messages

Comments

roq::OrderUpdate

DropCopy

executionReport

roq::TradeUpdate

DropCopy

executionReport

Event

Stream

Messages

Comments

roq::OrderUpdate

OrderEntry

GET /api/v3/allOrders, /api/v3/openOrders

Not implemented

roq::TradeUpdate

OrderEntry

GET /api/v3/myTrades

Not implemented

Event

Stream

Messages

Comments

roq::CreateOrder

OrderEntry

POST /api/v3/order, /api/v3/order/test

Test is not implemented

roq::ModifyOrder

Unavailable

roq::CancelOrder

OrderEntry

DELETE /api/v3/order

roq::CancelAllOrders

OrderEntry

DELETE /api/v3/openOrders

Not implemented

Event

Stream

Messages

Comments

roq::OrderAck

OrderEntry

/api/v3/order, /api/v3/order/test

Test is not implemented

Order Types

TBD

Time in Force

TBD

Position Effect

TBD

Execution Instructions

TBD

Account Management

Event

Stream

Messages

Comments

roq::PositionUpdate

Unavailable

roq::FundsUpdate

DropCopy

outboundAccountInfo, outboundAccountPosition

Event

Stream

Messages

Comments

roq::PositionUpdate

Unavailable

roq::FundsUpdate

OrderEntry

GET /api/v3/account

Streams

Type

Comments

REST

Primary purpose

  • support order management

Each connection

  • supports a single account

  • maintains a listen key (used by the DropCopy stream)

Rate-limit avoidance is implemented by

  • not using HTTP pipelining

  • monitoring the following HTTP headers

    • X-MBX-USED-WEIGHT-1M

  • blocking new requests for the duration of :code:`–rest_rate_limit_interval after receiving HTTP status 429 (too many requests)

Type

Comments

WebSocket

Primary purpose

  • live account updates, including orders and fills

Each connection

  • supports a single account

Type

Comments

WebSocket

Primary purpose

  • live market data

Each connection

  • supports a slice of the symbols

Constraints

  • MarketByPrice is currently subscribed as full snapshot (with limited depth) due to rate limitations on fetching the initial images from the REST connection.