roq-ftx

Purpose

  • Maintain network connectivity with the FTX 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

Conda

1conda install \
2  --channel https://roq-trading.com/conda/stable \
3  roq-ftx
1cp $CONDA_PREFIX/share/roq-ftx/config.toml $CONFIG_FILE_PATH
2
3# Then modify $CONFIG_FILE_PATH to match your specific configuration
1roq-ftx \
2      --name "ftx" \
3      --config_file "$CONFIG_FILE_PATH" \
4      --client_listen_address "$UNIX_SOCKET_PATH" \
5      --metrics_listen_address "$TCP_LISTEN_PORT" \
6      --flagfile "$FLAG_FILE"

Config

Flags

1roq-ftx --help

--ws_order_book_checksum_every

Number of updates between validating order-book checksum (0 means never validate).

--cancel_on_disconnect

The Logon FIX message can be used to instruct the exchange to automatically cancel all orders if a disconnect has been detected.

Environments

1# flagfile
2
3--rest_uri=https://ftx.com
4--ws_uri=wss://ftx.com/ws
5--fix_uri=tcp+ssl://fix.ftx.com:4363

Market Data

Event

Stream

Messages

Comments

roq::ReferenceData

MarketData

markets

roq::MarketStatus

MarketData

markets

roq::TopOfBook

MarketData

ticker

roq::MarketByPriceUpdate

MarketData

orderbook

roq::MarketByOrderUpdate

Unavailable

roq::TradeSummary

MarketData

trades

roq::StatisticsUpdate

MarketData

markets

Event

Stream

Messages

Comments

roq::ReferenceData

DropCopy

/api/markets, /api/futures

  • multiplier not available

  • special logic to derive quote and base currencies for futures

roq::MarketStatus

DropCopy

/api/markets, /api/futures

roq::TopOfBook

roq::MarketByPriceUpdate

roq::MarketByOrderUpdate

roq::TradeSummary

roq::StatisticsUpdate

DropCopy

/api/markets

Statistics

Type

Comments

SETTLEMENT_PRICE

(future) mark

PRE_SETTLEMENT_PRICE

(future) marginPrice

UPPER_LIMIT_PRICE

(future) upperBound

LOWER_LIMIT_PRICE

(future) lowerBound

OPEN_INTEREST

(future) openInterest

Order Management

Event

Stream

Messages

Comments

roq::OrderUpdate

OrderEntry

ExecutionReport (8)

roq::TradeUpdate

OrderEntry

ExecutionReport (8)

Event

Stream

Messages

Comments

roq::OrderUpdate

DropCopy

/api/orders, /api/orders/history

Not implemented

roq::TradeUpdate

DropCopy

/api/fills

Not implemented

Event

Stream

Messages

Comments

roq::CreateOrder

OrderEntry

NewOrderSingle (D)

roq::ModifyOrder

Unavailable

roq::CancelOrder

OrderEntry

OrderCancelRequest (F)

roq::CancelAllOrders

OrderEntry

OrderMassCancelRequest (q)

Event

Stream

Messages

Comments

roq::OrderAck

OrderEntry

ExecutionReport (8), OrderCancelReject (9), Reject (3)

Order Types

Type

Comments

LIMIT

Mapped to '2' (FIX)

Time in Force

Type

Comments

GTC

Mapped to '1' (FIX)

IOC

Mapped to '3' (FIX)

Position Effect

Note

Not supported

Execution Instructions

Type

Comments

PARTICIPATE_DO_NOT_INITIATE

Mapped to '6' (FIX)

DO_NOT_INCREASE

Mapped to 'E' (FIX)

Account Management

Event

Stream

Messages

Comments

roq::PositionUpdate

roq::FundsUpdate

Event

Stream

Messages

Comments

roq::PositionUpdate

DropCopy

/api/account

roq::FundsUpdate

DropCopy

/api/wallet/balances

Streams

Type

Comments

FIX

Primary purpose

  • support order management

Each connection

  • supports a single account

Type

Comments

REST

Primary purpose

  • live account updates, including orders and fills

Each connection

  • supports a single account

The master account is used to

  • discover the full list of symbols (by downloading exchange info)

  • request depth snapshots

Type

Comments

WebSocket

Primary purpose

  • live market data

  • reference data and markets (from the markets channel)

Each connection

  • supports a slice of the symbols

The first stream is used to

  • subscribe the markets channel

Constraints

  • The gateway requires a master account definition to be functional. This is currently needed by the market data connection.

  • Rate-limit usage is not communicated by the exchange

  • Order book

    • Max depth is 100

Comments

  • Order book

    • Top-100 checksum is not being verified for latency reasons

    • Instructions to clear levels appear outside top 100

  • Order Management

    • TimeInForce is automatically converted to IOC if order size too small. (More details here.)

    • Have seen FIX execution reports with pending-cancel arrive after cancel. For this reason, all pending-cancel are dropped.

    • REST/WS is unreliable at this point. Ordering is a real issue. Also, the automatic conversion to IOC is causing issues because the WS orders channel reports the order to be closed oftentimes followed by a REST response with order details indicating the order is working (new).