roq-gate-futures

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

Supports

Products

Spot

Futures

Swap

Option

Orders & Quotes
Account

Funds

Position

Note

✅ = Available.

❎ = Not implemented.

❌ = Unavailable.

Using

$ roq-gate-futures [FLAGS]

Flags

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

Exchange identifier

--api (btc)

API (btc or usdt)

--rest_uri (https://api.gateio.ws/api/v4)

Exchange end-point

--rest_proxy

Proxy end-point

--rest_ping_freq (5s)

Ping frequency

--rest_ping_path (/)

Ping path

--rest_request_timeout (30s)

Request timeout

--rest_disable_currencies_download (false)

Disable currencies download

--ws_uri (wss://api.gateio.ws/ws/v4/btc)

Exchange end-point

--ws_ping_freq (5s)

Ping frequency

--ws_request_timeout (15s)

Request timeout

--ws_max_subscriptions_per_stream (100)

Maximum number of symbols per connection

--ws_mbp_request_delay (500ms)

Request delay

--ws_mbp_request_max_retries (3)

Request max retries

--request_limit (80)

Request limit per interval

--request_limit_interval (10s)

Request limit monitor interval

--self_trade_prevention (CN)

Self-trade prevention: CN, CO, CB, DC

--encode_buffer_size (1048576)

Encode buffer size

--decode_buffer_size (10485760)

Decode buffer size

--mbp_allow_price_inversion (true)

Allow price inversion?

--order_book_depth (20)

Order book depth

--order_book_freq (100ms)

Order book frequency

Environments

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

--api=usdt
--rest_uri=https://api.gateio.ws/api/v4
--ws_uri=wss://fx-ws.gateio.ws/v4/ws/usdt
$ $CONDA_PREFIX/share/roq-gate-futures/flags/prod/flags-btc.cfg
# flagfile for the roq-gate-futures gateway

--api=btc
--rest_uri=https://api.gateio.ws/api/v4
--ws_uri=wss://fx-ws.gateio.ws/v4/ws/btc
$ $CONDA_PREFIX/share/roq-gate-futures/flags/test/flags-usdt.cfg
# flagfile for the roq-gate-futures gateway

--api=usdt
--rest_uri=https://fx-api-testnet.gateio.ws/api/v4
--ws_uri=wss://fx-ws-testnet.gateio.ws/v4/ws/usdt
--rest_disable_currencies_download=true
$ $CONDA_PREFIX/share/roq-gate-futures/flags/test/flags-btc.cfg
# flagfile for the roq-gate-futures gateway

--api=btc
--rest_uri=https://fx-api-testnet.gateio.ws/api/v4
--ws_uri=wss://fx-ws-testnet.gateio.ws/v4/ws/btc
--rest_disable_currencies_download=true

Configuration

$ $CONDA_PREFIX/share/roq-gate-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-gate-futures gateway

symbols = [
  "^BTC_USD[A-Z]?$",
  "^ETH_USD[A-Z]?$"
]

[accounts]

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

Comment

futures.tickers

volume_24h_quote

TRADE_VOLUME

futures.tickers

index_price

INDEX_VALUE

futures.tickers

funding_rate

FUNDING_RATE

futures.tickers

funding_rate_indicative

FUNDING_RATE_PREDICTION

Order Management

Inbound

Enum

GTC

GTC

IOC

IOC

FOK

FOK

finish_as

filled

COMPLETED

cancelled

CANCLED

liquidated

CANCLED

ioc

COMPLETED

auto_deleveraged

CANCLED

reduce_only

CANCLED

position_close

CANCLED

stp

CANCLED

_new

WORKING

_update

WORKING

reduce_out

WORKING

Outbound

order_type

execution_instructions

price

stop_price

price

reduce_only

MARKET

NaN

NaN

MARKET

NaN

LIMIT

NaN

LIMIT

TBD

TBD

TBD

Comments

  • Order book updates are throttled at 100ms (default) or 1000ms.

  • Order books appear to allow inverted prices.

    • This has been confirmed and documented with a request (snapshot) + a single update (which brackets the snapshot). Applying the update to the snapshot results in inverted prices.

  • Order books can be subscribed to a depth of 5, 10 and 20, according to the documentation. However, a value of 100 also appear to be valid. Other values may result in a response saying “success’, yet updates do not appear to arrive.

  • Order/account management is completely missing (needs sponsorship).

  • Testnet doesn’t support downloading of (spot) currencies. Use --rest_disable_currencies_download=true.

References

Common

Exchange