roq-kraken-futures

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-kraken-futures
$ mamba install \
      --channel https://roq-trading.com/conda/unstable \
      roq-kraken-futures

Using

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

Flags

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

Exchange identifier

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

Exchange end-point

--rest_proxy

Proxy end-point

--rest_ping_freq (5s)

Ping frequency

--rest_ping_path (/api/v3/instruments)

Ping path

--rest_cancel_on_disconnect (true)

Cancel orders on disconnect?

--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?

--rest_use_nonce (true)

Use nonce for security?

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

Exchange end-point

--ws_ping_freq (5s)

Ping frequency

--ws_request_timeout (15s)

Request timeout

--ws_max_subscriptions_per_stream (128)

Maximum number of symbols per connection

--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-kraken-futures/flags/prod/flags.cfg
# flagfile for the roq-kraken-futures gateway

--rest_uri=https://futures.kraken.com/derivatives/
--ws_uri=wss://futures.kraken.com/ws/v3
$ $CONDA_PREFIX/share/roq-kraken-futures/flags/test/flags.cfg
# flagfile for the roq-kraken-futures gateway

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

Configuration

$ $CONDA_PREFIX/share/roq-kraken-futures/config.toml

Important

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

symbols = [
  "^FI_ETHUSD_[0-9]{6}$",  # futures
  "^FI_XBTUSD_[0-9]{6}$",  # futures
  "^PF_ETHUSD$",           # swaps
  "^PF_XBTUSD$"            # swaps
]

[accounts]

  [accounts.A1]
  master = true
  login = "YOUR_KRAKEN_FUTURES_API_KEY_GOES_HERE"
  secret = "YOUR_KRAKEN_FUTURES_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

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