roq-kraken-futures#

Purpose#

  • Maintain network connectivity with the Kraken Futures 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 (to be confirmed)

  • No test environment

Conda#

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

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

Config#

Flags#

$ roq-kraken-futures --help
--exchange (kraken-futures)

exchange identifier (string)

--encode_buffer_size (1048576)

encode buffer size

--decode_buffer_size (10485760)

decode buffer size

--mbp_allow_price_inversion (false)

allow price inversion?

--rest_uri (https://demo-futures.kraken.com/derivatives)

REST end-point (URI)

--rest_proxy

proxy end-point (URI)

--rest_ping_freq (5s)

ping frequency

--rest_ping_path (/api/v3/instruments)

URI path used for REST connection keep-alive messages

--rest_cancel_on_disconnect (true)

cancel orders on disconnect? (bool)

--rest_cancel_all_after (30s)

cancel all after, requires cancel-on-disconnect

--rest_request_timeout (30s)

request: timeout

--rest_allow_order_request_pipeline (false)

allow more than one in-flight order action? (bool)

--rest_use_nonce (true)

use nonce for security?

--ws_uri (wss://demo-futures.kraken.com/ws/v3)

WebSocket end-point (URI)

--ws_ping_freq (5s)

ping frequency

--ws_request_timeout (15s)

request timeout

--ws_max_subscriptions_per_stream (128)

max subscriptions per connection (count)

Environments#

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

--rest_uri=https://futures.kraken.com/derivatives/
--ws_uri=wss://futures.kraken.com/ws/v3
# flagfile for the roq-kraken-futures gateway

--rest_uri=https://demo-futures.kraken.com/derivatives/
--ws_uri=wss://demo-futures.kraken.com/ws/v3

Market Data#

Event

Stream

Messages

Comments

roq::ReferenceData

roq::MarketStatus

MarketData

ticker

roq::TopOfBook

MarketData

ticker

roq::MarketByPriceUpdate

MarketData

book

roq::MarketByOrderUpdate

Unavailable

roq::TradeSummary

MarketData

trade

roq::StatisticsUpdate

MarketData

ticker

Statistics#

Type

Comments

INDEX_VALUE

(ticker) index

SETTLEMENT_PRICE

(ticker) markPrice

FUNDING_RATE

(ticker) relative_funding_rate

FUNDING_RATE_PREDICTION

(ticker) relative_funding_rate_prediction

Order Management#

Event

Stream

Messages

Comments

roq::OrderUpdate

DropCopy

open_orders

roq::TradeUpdate

DropCopy

fills

Event

Stream

Messages

Comments

roq::OrderUpdate

DropCopy

open_orders_snapshot

roq::TradeUpdate

DropCopy

fills_snapshot

Event

Stream

Messages

Comments

roq::CreateOrder

OrderEntry

/api/v3/sendorder

roq::ModifyOrder

OrderEntry

/api/v3/editorder

roq::CancelOrder

OrderEntry

/api/v3/cancelorder

roq::CancelAllOrders

OrderEntry

/api/v3/canceallorders

Event

Stream

Messages

Comments

roq::OrderAck

Order Types#

Type

Comments

MARKET

Mapped to mkt (JSON)

LIMIT

Mapped to lmt (JSON)

Time in Force#

Type

Comments

GTC

Mapped to ioc=false (JSON)

IOC

Mapped to ioc=true (JSON)

Position Effect#

Note

Not supported

Execution Instructions#

Type

Comments

DO_NOT_INCREASE

Mapped to reduce_only=true (JSON)

Account Management#

Event

Stream

Messages

Comments

roq::PositionUpdate

DropCopy

open_positions

roq::FundsUpdate

DropCopy

account_balances_and_margins

Event

Stream

Messages

Comments

roq::PositionUpdate

roq::FundsUpdate

Streams#

Type

Comments

REST

Primary purpose

  • Download instruments

Type

Comments

WebSocket

Primary purpose

  • live market data (top of book + market status)

Each connection

  • supports a slice of the symbols

Type

Comments

REST

Primary purpose

  • support order management

Each connection

  • supports a single account

Type

Comments

WebSocket

Primary purpose

  • live account updates, including positions and funds

Each connection

  • supports a single account

Constraints#

  • The field cliOrdId is a string containing only web-safe characters.

Comments#

  • Order updates has no information about last traded price/quantity and total average price

  • There is a race between REST (ack) and WebSocket (update) for order actions

  • Some uncertainty around edit/cancel order and execution response

  • Statistics are using relative funding rates to be compatible with other exchanges