roq-bybit#

Purpose#

  • Maintain network connectivity with the Bybit 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: TBD

Conda#

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

# Then modify $CONFIG_FILE_PATH to match your specific configuration
$ roq-bybit \
      --name "bybit" \
      --config_file "$CONFIG_FILE_PATH" \
      --client_listen_address "$UNIX_SOCKET_PATH" \
      --metrics_listen_address "$TCP_LISTEN_PORT" \
      --flagfile "$FLAG_FILE"

Config#

Flags#

$ roq-bybit --help

Environments#

# flagfile

--rest_uri=https://api.bybit.com
--ws_public_uri=wss://stream.bybit.com/spot/public/v3
--ws_private_uri=wss://stream.bybit.com/spot/private/v3
# flagfile

--rest_uri=https://api-testnet.bybit.com
--ws_public_uri=wss://stream-testnet.bybit.com/spot/public/v3
--ws_private_uri=wss://stream-testnet.bybit.com/spot/private/v3

Market Data#

Event

Stream

Messages

Comments

roq::ReferenceData

roq::MarketStatus

roq::TopOfBook

MarketData

bookticker

roq::MarketByPriceUpdate

MarketData

orderbook.40

roq::MarketByOrderUpdate

roq::TradeSummary

MarketData

trade

roq::StatisticsUpdate

MarketData

tickers

Statistics#

Type

Comments

HIGHEST_TRADED_PRICE

(tickers) h

LOWEST_TRADED_PRICE

(tickers) l

CLOSE_PRICE

(tickers) c

TRADE_VOLUME

(tickers) v

Order Management#

Event

Stream

Messages

Comments

roq::OrderUpdate

DropCopy

order

roq::TradeUpdate

DropCopy

ticketInfo

Event

Stream

Messages

Comments

roq::OrderUpdate

OrderEntry

/spot/v3/private/open-orders

roq::TradeUpdate

OrderEntry

/spot/v3/private/my-trades

Event

Stream

Messages

Comments

roq::CreateOrder

OrderEntry

/spot/v3/private/order

roq::ModifyOrder

roq::CancelOrder

OrderEntry

/spot/v3/private/cancel-order

roq::CancelAllOrders

OrderEntry

/spot/v3/private/cancel-orders

Event

Stream

Messages

Comments

roq::OrderAck

OrderEntry

Order Types#

Type

Comments

MARKET

Mapped to 'MARKET' (JSON)

LIMIT

Mapped to 'LIMIT' or 'LIMIT_MAKER' (JSON)

Time in Force#

Type

Comments

GTC

Mapped to 'GTC' (JSON)

FOK

Mapped to 'FOK' (JSON)

IOC

Mapped to 'IOC' (JSON)

Position Effect#

Note

Not supported

Execution Instructions#

Type

Comments

PARTICIPATE_DO_NOT_INITIATE

Mapped to 'LIMIT_MAKER' (JSON)

Account Management#

Event

Stream

Messages

Comments

roq::PositionUpdate

roq::FundsUpdate

DropCopy

outboundAccountInfo

Event

Stream

Messages

Comments

roq::PositionUpdate

roq::FundsUpdate

OrderEntry

/spot/v3/private/account

Streams#

Type

Comments

REST

Primary purpose

  • discover the full list of symbols

Type

Comments

WebSocket

Primary purpose

  • live market data

Each connection

  • supports a slice of the symbols

Type

Comments

REST

Primary purpose

  • Order actions

Type

Comments

WebSocket

Primary purpose

  • order updates

Constraints#

Comments#

  • The v3 API publish full depth snapshot. This has implications for the event-logs because there’s currently no automatic translation into incremental updates.

  • Depth is limited to 40 price levels (by exchange)

  • Depth is published every 100ms