roq-kraken#

Important

This gateway needs sponsorship to complete certain features.

Purpose#

  • Maintain network connectivity with the Kraken 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 Costa Rica (to be confirmed, best source here)

Conda#

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

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

Flags#

$ roq-kraken --help

--book_depth

Maximum order book depth. The exchange will limit order book updates to this depth. Please refer to Kraken Websockets API for further details.

Environments#

# flagfile

--rest_uri=https://api.kraken.com
--ws_public_uri=wss://ws.kraken.com
--ws_private_uri=wss://ws-auth.kraken.com
# flagfile

--rest_uri=https://beta-api.kraken.com
--ws_public_uri=wss://beta-ws.kraken.com
--ws_private_uri=wss://beta-ws-auth.kraken.com

Warning

The test environment is used to beta test new API’s

Market Data#

Event

Stream

Messages

Comments

roq::ReferenceData

Unavailable

roq::MarketStatus

Unavailable

roq::TopOfBook

MarketData

spread

roq::MarketByPriceUpdate

MarketData

book

roq::MarketByOrderUpdate

Unavailable

roq::TradeSummary

MarketData

trade

roq::StatisticsUpdate

Not supported

Statistics#

Order Management#

Event

Stream

Messages

Comments

roq::OrderUpdate

DropCopy

openOrders

Not implemented

roq::TradeUpdate

DropCopy

ownTrades

Not implemented

Event

Stream

Messages

Comments

roq::OrderUpdate

roq::TradeUpdate

Event

Stream

Messages

Comments

roq::CreateOrder

DropCopy

addOrder

Not implemented

roq::ModifyOrder

Unavailable

roq::CancelOrder

DropCopy

cancelOrder

Not implemented

roq::CancelAllOrders

DropCopy

cancelAll

Not implemented

Event

Stream

Messages

Comments

roq::OrderAck

DropCopy

addOrder, cancelOrder

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

OrderEntry

/0/private/OpenPositions

Not implemented

roq::FundsUpdate

OrderEntry

/0/private/Balance, /0/private/TradeBalance

Not implemented

Streams#

Type

Comments

REST

Primary purpose

  • support order management

Each connection

  • supports a single account

  • maintains a listen key (used by the DropCopy stream)

The master account is used to

  • discover the full list of symbols (by downloading asset pairs)

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

Constraints#

  • Rate-limit usage is not communicated by the exchange

Order book ends up in bad state

Downtime (scheduled or not) appears to not shutdown existing connections nor are established subscriptions unsubscribed. Worse, during downtime, what appears to be uninitialized order book data can be disseminated. (This was confirmed with Kraken support early May 2020).

Warning

We currently have no means to detect bad order book updates. At best, a parse exception will terminate your gateway with an unhandled excpetion.