roq-coinbase-pro#

Purpose#

  • Maintain network connectivity with the Coinbase PRO 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 us-east-1, AWS, USA, North Virginia

Conda#

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

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

Config#

Flags#

$ roq-coinbase-pro --help

--cancel_on_disconnect

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

--self_trade_prevention

The NewOrderSingle FIX message has a policy field to prevent self trading in the case a new order would match a resting order. Please refer to the API for possible values.

--ws_include_status

Default is to not include the Status updates from the Web-Socket feed. These updates arrive periodically and contains a snapshot for all instruments. Parsing such updates has relatively expensive (due to the size of the message) and will therefore have a latency impact. You should enable this flag if you rely on accurate reference data updates and/or market status changes.

--ws_enable_mbo

Enables the Market by Order (L3) feed.

Environments#

# flagfile

--fix_uri=tcp+ssl://fix.pro.coinbase.com:4198
--ws_uri=wss://ws-feed.pro.coinbase.com
--rest_uri=https://api.pro.coinbase.com
# flagfile

--fix_uri=tcp+ssl://fix-public.sandbox.pro.coinbase.com:4198
--ws_uri=wss://ws-feed-public.sandbox.pro.coinbase.com
--rest_uri=https://api-public.sandbox.pro.coinbase.com

Market Data#

Event

Stream

Messages

Comments

roq::ReferenceData

Rest

status

roq::MarketStatus

Rest

status

roq::TopOfBook

MarketData

ticker

No quantity from exchange

roq::MarketByPriceUpdate

MarketData

snapshot, l2update

roq::MarketByOrderUpdate

MarketData

open, change, done

roq::TradeSummary

MarketData

match

roq::StatisticsUpdate

MarketData

ticker

Statistics#

Type

Comments

OPEN_PRICE

HIGHEST_TRADED_PRICE

LOWEST_TRADED_PRICE

Order Management#

Event

Stream

Messages

Comments

roq::OrderUpdate

OrderEntry

ExecutionReport (8)

roq::TradeUpdate

DropCopy

Match

Event

Stream

Messages

Comments

roq::OrderUpdate

roq::TradeUpdate

Event

Stream

Messages

Comments

roq::CreateOrder

OrderEntry

NewOrderSingle (D)

roq::ModifyOrder

roq::CancelOrder

OrderEntry

OrderCancelRequest (F)

roq::CancelAllOrders

Not implemented

Event

Stream

Messages

Comments

roq::OrderAck

OrderEntry

ExecutionReport (8), OrderCancelReject (9)

Order Types#

Type

Comments

MARKET

Mapped to '1' (FIX)

LIMIT

Mapped to '2' (FIX)

STOP_LIMIT

Mapped to '4' (FIX)

Time in Force#

Type

Comments

GTC

Mapped to '1' (FIX)

IOC

Mapped to '3' (FIX)

FOK

Mapped to '4' (FIX)

Note

A non-standard value of 'P' (FIX) is used to indicate “Post-Only. This value is derived from Execution Instruction (see below) and will override any other value of Time in Force.

Position Effect#

Note

Not supported

Execution Instructions#

Type

Comments

CANCEL_IF_NOT_BEST

Mapped to the 'P' (FIX) used by Time in Force

Account Management#

Event

Stream

Messages

Comments

roq::PositionUpdate

Unavailable

roq::FundsUpdate

Unavailable

Event

Stream

Messages

Comments

roq::PositionUpdate

Unavailable

roq::FundsUpdate

Rest

accounts

Streams#

Type

Comments

FIX

Primary purpose

  • support order management

Each connection

  • supports a single account

Type

Comments

WebSocket

Primary purpose

  • live account updates, including orders and fills

Each connection

  • supports a single account

Type

Comments

WebSocket

Primary purpose

  • live market data

Each connection

  • supports a slice of the symbols

Type

Comments

REST

Primary purpose

  • download reference data, market statussupport, and funds

Constraints#

  • Rate-limit usage is not communicated by the exchange

  • FIX OrderMassCancelRequest (q) is not supported and orders must therefore be canceled one by one

Comments#

  • WebSocket is through a third-party CDN (CloudFlare) with all the issues such a solution entails.

  • FIX support is minimal and only supporting very basic order management.

  • Fills are not available from the FIX connection and there is a probability Match messages are lost from WebSocket connection. YOU SHOULD NOT RELY ON TRADE UPDATES FOR YOUR POSITION KEEPING !!!

  • TradeUpdate

    • You should not rely on this feed for your position keeping.

  • FundsUpdate

    • Only downloaded immediately after connection has been established.