roq-bitfinex

Supports

Products

Spot

Futures

Options

Combos

Market Data

Reference Data

Market Status

Top of Book

Market by Price

Market by Order

Trade Summary

Statistics

Order Management

Create

Modify

Cancel

Cancel All

Auto-Cancel

Account Management

Positions

Funds

Installing

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

Using

$ roq-bitfinex \
      --name "bitfinex" \
      --config_file $CONFIG_FILE_PATH \
      --client_listen_address $UNIX_SOCKET_PATH \
      --flagfile $ENVIRONMENT_FLAGFILE

Flags

$ roq-bitfinex --help
--exchange (bitfinex)

Exchange identifier

--rest_uri (https://api-pub.bitfinex.com/)

Exchange end-point

--rest_proxy

Proxy end-point

--rest_ping_freq (5s)

Ping frequency

--rest_ping_path (/v2/platform/status)

Ping path

--rest_request_timeout (30s)

Request timeout

--rest_download_orders_page_size (500)

Page size used when downloading orders

--rest_download_orders_begin (24h)

Download orders since (now - begin)

--rest_download_only_active_orders (false)

Download only active orders?

--rest_download_fills_page_size (500)

Page size used when downloading fills

--rest_download_fills_begin (24h)

Download fills since (now - begin)

--rest_token_refresh_freq (8h)

Token refresh frequency

--ws_public_uri (wss://api-pub.bitfinex.com/ws/2)

Exchange end-point

--ws_private_uri (wss://api.bitfinex.com/ws/2)

Exchange end-point

--ws_ping_freq (5s)

Ping frequency

--ws_request_timeout (15s)

Request timeout

--ws_max_subscriptions_per_stream (8)

Maximum number of symbols per connection

--ws_mbp_request_delay (500ms)

Request delay

--ws_mbp_request_max_retries (3)

Request max retries

--request_limit (80)

Request limit per interval

--request_limit_interval (10s)

Request limit monitor interval

--self_trade_prevention (CN)

Self-trade prevention: CN, CO, CB, DC

--encode_buffer_size (1048576)

Encode buffer size

--decode_buffer_size (10485760)

Decode buffer size

--mbp_allow_price_inversion (false)

Allow price inversion?

Environments

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

--rest_uri=https://api-pub.bitfinex.com/
--ws_public_uri=wss://api-pub.bitfinex.com/ws/2
--ws_prvate_uri=wss://api.bitfinex.com/ws/2

Configuration

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

Important

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

symbols = [
  "^BTCUSD[A-Z]?$",
  "^ETHUSD[A-Z]?$"
]

[accounts]

  [accounts.A1]
  master = true
  login = "YOUR_BITFINEX_API_KEY_GOES_HERE"
  secret = "YOUR_BITFINEX_SECRET_GOES_HERE"
  symbols = [ ".*" ]

[users]

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

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

[rate_limits]

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

Market Data

Event

Stream

Messages

Comments

roq::ReferenceData

roq::MarketStatus

roq::TopOfBook

MarketData

ticker

roq::MarketByPriceUpdate

MarketData

book

roq::MarketByOrderUpdate

MarketData

book (prec=R0)

roq::TradeSummary

MarketData

trades

roq::StatisticsUpdate

MarketData

status

Event

Stream

Messages

Comments

roq::ReferenceData

Rest

/v2/tickers?symbols=ALL (!!! CONTAINS NO REFERENCE DATA !!!)

roq::MarketStatus

roq::TopOfBook

roq::MarketByPriceUpdate

roq::MarketByOrderUpdate

roq::TradeSummary

roq::StatisticsUpdate

Statistics

Type

Comments

HIGHEST_TRADED_PRICE

(ticker) high

LOWEST_TRADED_PRICE

(ticker) low

TRADE_VOLUME

(ticker) volume

Order Management

Event

Stream

Messages

Comments

roq::OrderUpdate

roq::TradeUpdate

Event

Stream

Messages

Comments

roq::OrderUpdate

roq::TradeUpdate

Event

Stream

Messages

Comments

roq::OrderAck

Order Types

TBD

Time in Force

TBD

Position Effect

TBD

Execution Instructions

TBD

Account Management

Event

Stream

Messages

Comments

roq::PositionUpdate

roq::FundsUpdate

Event

Stream

Messages

Comments

roq::PositionUpdate

roq::FundsUpdate

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

Constraints

  • The exchange rate limiter is VERY strict. You should therefore try to not subscribe too many symbols.

Comments

  • General

    • Messages are NOT self-describing. There is a risk that message meta data change in a non-backwards-compatible way thereby causing production breaks. Except for perhaps scraping the web-site, there doesn’t appear to be an easy way to infer meta data.

  • Market data

    • The are NO reference data !!!