roq-kraken-futures

$ conda install \
      --channel https://roq-trading.com/conda/unstable \
      roq-kraken-futures
$ conda install \
      --channel https://roq-trading.com/conda/stable \
      roq-kraken-futures

Supports

Products

Spot

❌

Futures

✅

Swap

✅

Option

❌

Orders & Quotes
Account

Funds

✅

Position

✅

Note

✅ = Available.

❎ = Not implemented.

❌ = Unavailable.

Using

$ roq-kraken-futures [FLAGS]

Flags

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

Exchange identifier

--rest_uri

Exchange end-point

--rest_proxy

Proxy end-point

--rest_ping_freq (5s)

Ping frequency

--rest_ping_path (/derivatives/api/v3/instruments/PF_XBTUSD/status)

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

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?

--request_limit (10)

Maximum number of requests per interval

--request_limit_interval (1s)

Monitor interval

Environments

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

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

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

Configuration

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

Important

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

# config template for the roq-kraken-futures gateway

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

Inbound

Event

Field

Value

ticker

suspended

false

⇒

OPEN

ticker

suspended

true

⇒

CLOSE

Event

Field

ticker

open

⇒

OPEN_PRICE

ticker

mark_price

⇒

SETTLEMENT_PRICE

ticker

open_interest

⇒

OPEN_INTEREST

ticker

high

⇒

HIGHEST_TRADED_PRICE

ticker

low

⇒

LOWEST_TRADED_PRICE

ticker

relative_funding_rate

⇒

FUNDING_RATE

ticker

relative_funding_rate_prediction

⇒

FUNDING_RATE_PREDICTION

ticker

volume

⇒

TRADE_VOUME

Order Management

Inbound

Enum

mkt

⇒

MARKET

lmt

⇒

LIMIT

Enum

GTC

⇒

GTC

IOC

⇒

IOC

Outbound

order_type

execution_instructions

price

stop_price

orderType

limitPrice

stopPrice

reduceOnly

MARKET

NaN

NaN

⇒

mkt

❌

❌

MARKET

NaN

✅

⇒

mkt

❌

✅

LIMIT

✅

NaN

⇒

LIMIT

✅

❌

LIMIT

✅

✅

⇒

mkt

✅

✅

TBD

TBD

TBD

Comments

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

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

  • Aggressive orders may only report fills on the WS channel (an open order never exists). This is an issue because we can potentially lose the REST response and then never be able to update the order status. An artificial OrderUpdate is therefore injected when receiving fills from the WS channel.

  • Order updates have no information about last traded price/quantity and total average price. Although attempts are made to compute the right average price, this is not always possible and errors should be expected.

  • Time-series can only be downloaded. There is no web-socket API for subscribing.

References

Common

GitHub

Exchange