Install and Configure Gateways

You will learn to install and configure a gateway.

Install

Install the roq-deribit gateway package

$ conda install -y -c https://roq-trading.com/conda/unstable roq-deribit

Configure

The gateway packages always include a TOML config template which you can copy and modify

$ cp $CONDA_PREFIX/share/roq-deribit/config.toml $HOME/deribit.toml

Edit the config file

$ vi $HOME/deribit.toml

The config file has 3 key sections which are discussed in the following.

Symbols

An optional regex list used for market data subscriptions.

Some examples

symbols = [
  "^BTC-PERPETUAL$",
  "^.*-PERPETUAL$",
  "^BTC-15APR26$",
  "^BTC-[0-9]{1,2}[A-Z]{3}[0-9]{2}$",
  ".*"
]

Accounts

A list of sub-accounts, their credentials and their permissions.

[accounts.A1]
login = "YOUR_DERIBIT_LOGIN_GOES_HERE"
secret = "YOUR_DERIBIT_SECRET_GOES_HERE"

Important

Replace "YOUR_DERIBIT_LOGIN_GOES_HERE" and "YOUR_DERIBIT_SECRET_GOES_HERE" with your actual exchange credentials.

Note

Roq will match "A1" to the account field from connecting clients.

Users

A list of users (clients to the gateway), their credentials and their permissions.

[users.trader]
accounts = [ "A1" ]      # permissioned accounts
symbols = [ ".*BTC.*" ]  # permissioned symbols

Note

Roq will match "trader" to the --name argument from the connecting client.

Running

You should be able to launch your gateway.

Free Version

$ roq-deribit \
    --name "deribit" \
    --config_file $HOME/deribit.toml \
    --client_listen_address unix://$HOME/deribit.sock \
    --flagfile $CONDA_PREFIX/share/roq-deribit/flags/test/flags.cfg

Note

The --flagfile argument allows you to import flags from a file. Here we import the end-points for Deribit’s testnet.

Licensed Version

$ roq-deribit \
    --name "deribit" \
    --config_file $HOME/deribit.toml \
    --client_listen_address unix://$HOME/deribit.sock \
    --flagfile $CONDA_PREFIX/share/flags/test/flags.cfg \
    --auth_keys_file $HOME/roq-auth_keys.json \
    --auth_is_uat=false

Note

The --auth_keys_file flag is the path where you saved your public/secret key-pair. Adding this flag instructs the gateway to contact Roq’s license server.

Important

The --auth_is_uat flag (boolean) is used to signal prod or UAT to the license server. Each gateway instance will be included in your license count if you don’t specify the flag. Roq will monitor activity to see if the UAT instances are indeed used for testing.