roq-bitstamp#

Important

This gateway needs sponsorship to complete certain features.

Purpose#

  • Maintain network connectivity with the BitStamp 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 eu-central-1, AWS, Germany, Frankfurt

  • No test environment

Conda#

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

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

Config#

Flags#

$ roq-bitstamp --help
--exchange (bitstamp)

exchange identifier (string)

--encode_buffer_size (1048576)

encode buffer size

--decode_buffer_size (10485760)

decode buffer size

--fix_uri (tcp+ssl://fix.bitstamp.com:8905)

FIX end-point (URI)

--fix_ping_freq (5s)

ping frequency

--fix_request_timeout (15s)

request timeout

--fix_debug (false)

log fix messages?

--rest_uri (https://www.bitstamp.net)

REST end-point (URI)

--rest_proxy

proxy end-point (URI)

--rest_ping_freq (5s)

ping frequency

--rest_ping_path (/api/v2/ticker/btcusd)

URI path used for REST connection keep-alive messages

--rest_request_timeout (30s)

request: timeout

--ws_uri (wss://ws.bitstamp.net)

WebSocket end-point (URI)

--ws_ping_freq (5s)

ping frequency

--ws_max_subscriptions_per_stream (256)

max subscriptions per connection (count)

Environments#

$ $CONDA_PREFIX/share/roq-bitstamp/flags
# flagfile for the roq-bitstamp gateway

--rest_uri=https://www.bitstamp.net
--ws_uri=wss://ws.bitstamp.net
--fix_uri=tcp+ssl://fix.bitstamp.net:8905

Note

You will have to contact BitStamp support to enable FIX connectivity.

Some restrictions to keep in mind

  • You must have a fixed IP address

  • You must choose which access key to use for access: only one access key can be configured

Market Data#

Event

Stream

Messages

Comments

roq::ReferenceData

roq::MarketStatus

Unavailable

roq::TopOfBook

roq::MarketByPriceUpdate

MarketData

order_book

See note below

roq::MarketByOrderUpdate

MarketData

live_orders

Not implemented

roq::TradeSummary

MarketData

live_trades

roq::StatisticsUpdate

Event

Stream

Messages

Comments

roq::ReferenceData

Rest

/api/v2/trading-pairs-info/

roq::MarketStatus

Rest

/api/v2/trading-pairs-info/

roq::TopOfBook

roq::MarketByPriceUpdate

roq::MarketByOrderUpdate

roq::TradeSummary

roq::StatisticsUpdate

Rest

/api/v2/ticker/<currency_pair>/

Not implemented

Statistics#

Order Management#

Event

Stream

Messages

Comments

roq::OrderUpdate

OrderEntry

ExecutionReport (8)

Not implemented

roq::TradeUpdate

OrderEntry

ExecutionReport (8)

Not implemented

Event

Stream

Messages

Comments

roq::OrderUpdate

Rest

api/v2/open_orders/all/

Not implemented, It is only possible to download open orders

roq::TradeUpdate

Event

Stream

Messages

Comments

roq::CreateOrder

OrderEntry

NewOrderSingle (D)

Not implemented

roq::ModifyOrder

Unavailable

roq::CancelOrder

OrderEntry

OrderCancelRequest (F)

Not implemented

roq::CancelAllOrders

OrderEntry

OrderMassCancelRequest (q)

Event

Stream

Messages

Comments

roq::OrderAck

OrderEntry

ExecutionReport (8), OrderCancelReject (9), BusinessMessageReject (j)

Not implemented

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

Rest

/api/v2/balance/

Not implemented

Streams#

Type

Comments

REST

Primary purpose

  • support order management

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 symbols

Constraints#

  • The exchange API does not support a pass-through value

  • It is only possible to download open orders

  • It does not appear to be possible to download historical order fills

  • The FIX interface does not support automatic order cancellation following a disconnect

  • Rate-limit usage is not communicated by the exchange

  • Only possible to support order book snapshots (see notes below)

  • Choice or inverted prices is a real thing

Comments#

  • The WebSocket protocol to receive differential L2 order book updates does not support correct initialisation through synchronisation. The conclusion is that only the (top 100) snapshot L2 order book updates can be used.

  • The (top 100) snapshot L2 order book sometimes include choice or inverted prices (bid >= ask).