Install and Configure Gateways

You will learn how to install and configure a gateway.

Install

Install the gateway package

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

Configure

The package includes a TOML config template.

You should make a copy of the template before updating it with your specific details

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

Now edit the config file using your favorite editor

$ vi ~/deribit.toml

There are 3 key sections in the config file

  • symbols – a list of regex used for market data subscriptions

  • accounts – a list of exchange sub-accounts

  • users – a list of client permissions

Symbols

The symbols section is a list of regex

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

Accounts

The accounts section defines your sub-accounts

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

Note

You should replace YOUR_DERIBIT_LOGIN_GOES_HERE and YOUR_DERIBIT_SECRET_GOES_HERE with your actual exchange credentials.

Clients can specify this sub-account using the A1 alias.

Users

The users section defines your clients

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

Note

The accounts field is used to specify what account aliases can be traded from this client.

The symbols field is used to specify what symbols can be traded from this client.

Run

You should now be able to launch your gateway.

Free

The free version can be started like this

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

Note

The --flagfile argument allows you to import flags from a file. You can import multiple files by adding multiple flagfile arguments. In this case we import Deribit’s testnet URLs (end-points).

Note

The --name argument is a service name which is required and must not exceed 16 characters.

Note

The --client_listen_address argument is a path of a Unix domain socket. This is the address used by clients wanting to connect with the gateway.

Licensed

If you have a registered license key, you can launch your gateway by adding the --auth_keys_file and --auth_is_uat arguments

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

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.