roq-bitmex

$ conda install \
      --channel https://roq-trading.com/conda/unstable \
      roq-bitmex
$ conda install \
      --channel https://roq-trading.com/conda/stable \
      roq-bitmex

Supports

Products

Spot

Futures

Swap

Option

Orders & Quotes
Account

Funds

Position

Note

✅ = Available.

❎ = Not implemented.

❌ = Unavailable.

Using

$ roq-bitmex [FLAGS]

Flags

$ roq-bitmex --help
--exchange (bitmex)

Exchange identifier

--rest_uri (https://testnet.bitmex.com)

Exchange end-point

--rest_proxy

Proxy end-point

--rest_ping_freq (5s)

Ping frequency

--rest_ping_path (/api/v1/announcement/urgent)

Ping path

--rest_request_timeout (30s)

Request timeout

--rest_expires_timeout (1s)

Expires time-out

--rest_allow_order_request_pipeline (false)

Allow more than one in-flight order action?

--ws_uri (wss://ws.testnet.bitmex.com/realtime)

Exchange end-point

--ws_ping_freq (5s)

Ping frequency

--ws_request_timeout (15s)

Request time-out

--ws_cancel_on_disconnect (true)

Cancel orders on disconnect?

--ws_cancel_all_after (15s)

Cancel all after, requires cancel-on-disconnect

--encode_buffer_size (1048576)

Encode buffer size

--decode_buffer_size (10485760)

Decode buffer size

--mbp_allow_price_inversion (false)

Allow price inversion?

--oms_using_web_socket (false)

Use web-socket for order management?

Environments

$ $CONDA_PREFIX/share/roq-bitmex/flags/prod/flags.cfg
# flagfile for the roq-bitmex gateway

--rest_uri=https://www.bitmex.com
--ws_uri=wss://ws.bitmex.com/realtime
$ $CONDA_PREFIX/share/roq-bitmex/flags/test/flags.cfg
# flagfile for the roq-bitmex gateway

--rest_uri=https://testnet.bitmex.com
--ws_uri=wss://ws.testnet.bitmex.com/realtime

Configuration

$ $CONDA_PREFIX/share/roq-bitmex/config.toml

Important

This template will be replaced when the software is upgraded. Make a copy and modify to your own needs.

# config template for the roq-bitmex gateway

symbols = [
  "^XBTUSD[A-Z]?([FGHJKMNQUVXZ][0-9]{2})?$",
  "^ETHUSD[A-Z]?([FGHJKMNQUVXZ][0-9]{2})?$",
  "^[.]XBTUSD[A-Z]?PI(8H)?$",
  "^[.]ETHUSD[A-Z]?PI(8H)?$"
]

[accounts]

  [accounts.A1]
  master = true
  login = "YOUR_BITMEX_API_KEY_GOES_HERE"
  secret = "YOUR_BITMEX_SECRET_GOES_HERE"
  symbols = [ ".*" ]

[users]

  [users.test]
  password = "1234"
  symbols = ".*"

  [users.trader]
  password = "secret"
  accounts = [ "A1" ]
  symbols = [ ".*XBT.*", ".*ETH.*" ]

[rate_limits]

  [rate_limits.global]
    type = "ORDER_ACTION"
    aggregate = true
    request_limit = 100
    monitor_period = "10s"
    ban_period = "5m"

Market Data

Inbound

state

Open

OPEN

Closed

CLOSE

Settled

UNDEFINED

Unlisted

UNDEFINED

Expired

UNDEFINED

Table

Field

instrument

markPrice

SETTLEMENT_PRICE

instrument

openInterest

OPEN_INTEREST

instrument

indicativeSettlePrice

PRE_SETTLEMENT_PRICE

instrument

limitUpPrice

UPPER_LIMIT_PRICE

instrument

limitDownPrice

LOWER_LIMIT_PRICE

instrument

fairPrice

INDEX_VALUE

funding

fundingRate

FUNDING_RATE

funding

indicativeFundingRate

FUNDING_RATE_PREDICTION

Order Management

Inbound

Enum

Market

MARKET

Limit

LIMIT

Enum

GTC

GTC

Enum

Canceled

CANCELED

DoneForDay

SUSPENDED

Expired

EXPIRED

Filled

COMPLETED

New

WORKING

PartiallyFilled

WORKING

PendingCancel

UNDEFINED

PendingNew

SENT

Rejected

REJECTED

Stopped

STOPPED

Triggered

ACCEPTED

Untriggered

WORKING

Outbound

order_type

execution_instructions

price

stop_price

ordType

price

execInst

MARKET

NaN

NaN

Market

MARKET

PARTICIPATE_DO_NOT_INITIATE

NaN

NaN

Market

ParticipateDoNotInitiate

MARKET

DO_NOT_INCREASE

NaN

NaN

Market

ReduceOnly

MARKET

NaN

LIMIT

NaN

Limit

LIMIT

PARTICIPATE_DO_NOT_INITIATE

NaN

Limit

ParticipateDoNotInitiate

LIMIT

DO_NOT_INCREASE

NaN

Limit

ReduceOnly

LIMIT

Comments

  • The field clOrdID is a string and can not exceed 36 characters

  • The exchange API’s do not appear particularly suitable for low latency trading:

    • Order action requests must be signed (which is expensive) and then sent over REST

    • REST response (order ack) could be lost possibly leaving the client in a situation where it must trigger timeout logic and/or issue operational alerts

    • Several WebSocket channels are used communicate order state possibly allowing for inconsistent order management by client

References

Common

Exchange