roq-bybit#
Links#
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#
Spot |
✓ |
Futures |
✓ |
Options |
✓ |
Reference Data |
✓ |
Market Status |
✓ |
Top of Book |
✓ |
Market by Price (L2) |
✓ |
Market by Order (L3) |
|
Trade Summary |
✓ |
Statistics |
✓ |
Create |
✓ |
Modify |
✓ |
Cancel |
✓ |
Cancel All |
✓ |
Auto Cancellation |
Positions |
✓ |
Funds |
✓ |
Data center located in: TBD
Conda#
$ mamba 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" \
--api "spot" \
--config_file "$CONFIG_FILE_PATH" \
--client_listen_address "$UNIX_SOCKET_PATH" \
--service_listen_address "$TCP_LISTEN_PORT" \
--flagfile "$FLAG_FILE"
Config#
Flags#
$ roq-bybit --help
--exchange
(bybit
)Exchange identifier (string)
--api
(pot
)What api to use (spot, linear, inverse, option)
--request_limit
(10
)Request limit per interval
--request_limit_interval
(1s
)Request limit monitor interval
--encode_buffer_size
(1048576
)Encode buffer size
--decode_buffer_size
(10485760
)Decode buffer size
--mbp_allow_price_inversion
(false
)Allow price inversion?
--download_trades_lookback
(300s
)How far back to request executions?
--download_trades_lookback_on_restart
How far back to request executions?
--download_trades_limit
(100
)Exchange limit
--rest_uri
(https://api-testnet.bybit.com
)REST end-point (URI)
--rest_host
Host (http header) in case uri uses an IP address
--rest_proxy
Proxy end-point (URI)
--rest_ping_freq
(5s
)Ping frequency
--rest_ping_path
(/v5/market/time
)URI path used for REST connection keep-alive messages
--rest_request_timeout
(30s
)Request: timeout
--rest_recv_window
(5s
)Recv window
--rest_terminate_on_403
(false
)Terminate on 403?
--rest_back_off_delay
(30s
)Back-off period
--ws_public_uri
(wss://stream-testnet.bybit.com/v5/public
)WS public end-point (URI)
--ws_public_host
Host (http header) in case uri uses an IP address
--ws_private_uri
(wss://stream-testnet.bybit.com/v5/private
)WS private end-point (URI)
--ws_private_host
Host (http header) in case uri uses an IP address
--ws_ping_freq
(5s
)Ping frequency
--ws_request_timeout
(15s
)Request: timeout
--ws_max_subscriptions_per_stream
(100
)Max symbols per connection (count)
--ws_mbp_depth
(0
)MbP depth
Environments#
$ $CONDA_PREFIX/share/roq-bybit/flags
# flagfile for the roq-bybit gateway
--rest_uri=https://api.bybit.com
--ws_public_uri=wss://stream.bybit.com/v5/public
--ws_private_uri=wss://stream.bybit.com/v5/private
# flagfile for the roq-bybit gateway
--rest_uri=https://api-testnet.bybit.com
--ws_public_uri=wss://stream-testnet.bybit.com/v5/public
--ws_private_uri=wss://stream-testnet.bybit.com/v5/private
Market Data#
Event |
Stream |
Messages |
Comments |
---|---|---|---|
MarketData |
|
||
MarketData |
orderbook.<ws_mbp_depth>.<symbol> |
||
MarketData |
publicTrade.<symbol> |
||
MarketData |
tickers.<symbol> |
Event |
Stream |
Messages |
Comments |
---|---|---|---|
Rest |
/v5/market/instruments-info |
||
Rest |
/v5/market/instruments-info |
||
Statistics#
Type |
Comments |
---|---|
|
(tickers) |
|
(tickers) |
|
(tickers) |
|
(tickers) |
Order Management#
Event |
Stream |
Messages |
Comments |
---|---|---|---|
DropCopy |
order |
||
DropCopy |
execution |
Event |
Stream |
Messages |
Comments |
---|---|---|---|
OrderEntry |
/v5/order/realtime |
||
OrderEntry |
/v5/execution/list |
Event |
Stream |
Messages |
Comments |
---|---|---|---|
OrderEntry |
/v5/order/create |
||
OrderEntry |
/v5/order/amend |
||
OrderEntry |
/v5/order/cancel |
||
OrderEntry |
/v5/order/cancel-all |
Event |
Stream |
Messages |
Comments |
---|---|---|---|
OrderEntry |
Order Types#
Type |
Comments |
---|---|
|
Mapped to |
|
Mapped to |
Time in Force#
Type |
Comments |
---|---|
|
Mapped to |
|
Mapped to |
|
Mapped to |
Position Effect#
Note
Not supported
Execution Instructions#
Type |
Comments |
---|---|
|
Mapped to |
Account Management#
Event |
Stream |
Messages |
Comments |
---|---|---|---|
DropCopy |
position |
||
DropCopy |
wallet |
Event |
Stream |
Messages |
Comments |
---|---|---|---|
OrderEntry |
/v5/position/list” |
||
OrderEntry |
/v5/account/wallet-balance |
Streams#
Type |
Comments |
---|---|
REST |
Primary purpose
|
Type |
Comments |
---|---|
WebSocket |
Primary purpose
Each connection
|
Type |
Comments |
---|---|
REST |
Primary purpose
|
Type |
Comments |
---|---|
WebSocket |
Primary purpose
|
Constraints#
The gateway can not simultaneously support all product categories due to overlapping symbol names, e.g. BTCUSDT being both spot and linear. For this reason, the
--api
flag controls the product category and, if necessary, the--name
or--exchange
flags must be configured to appropriately differentitate the sources.The
order
channel doesn’t give us any information about last traded, only the aggregate fields (traded / remaining / average price) are available. The last trade price/quantity fields are therefore estimated.Note
The
execution
channel will independently report the fills.
Comments#
TopOfBook
is based onorderbook.1
for spot andtickers
for all other categories.