roq-gate-futures¶
Links¶
Supports¶
Spot |
|
Futures |
✓ |
Options |
|
Combos |
Reference Data |
✓ |
Market Status |
|
Top of Book |
✓ |
Market by Price |
✓ |
Market by Order |
|
Trade Summary |
✓ |
Statistics |
✓ |
Create |
✓ |
Modify |
|
Cancel |
✓ |
Cancel All |
✓ |
Auto-Cancel |
Positions |
|
Funds |
✓ |
Installing¶
$ conda install \
--channel https://roq-trading.com/conda/stable \
roq-gate-futures
$ conda install \
--channel https://roq-trading.com/conda/unstable \
roq-gate-futures
Using¶
$ roq-gate-futures \
--name "gate-futures" \
--config_file $CONFIG_FILE_PATH \
--client_listen_address $UNIX_SOCKET_PATH \
--flagfile $ENVIRONMENT_FLAGFILE
Flags¶
$ roq-gate-futures --help
--exchange
(gate-futures
)Exchange identifier
--api
(btc
)API (
btc
orusdt
)
--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
--download_trades_lookback
(300s
)Lookback period when downloading trades (following a disconnect)
--download_trades_lookback_on_restart
Lookback period when downloading trades (initial download)
--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
The template will be replaced when the software is upgraded. Make a copy and modify to your needs.
symbols = [
"^BTC_USD[A-Z]?$",
"^ETH_USD[A-Z]?$"
]
[accounts]
[accounts.A1]
master = true
login = "YOUR_GATE.IO_FUTURES_API_KEY_GOES_HERE"
secret = "YOUR_GATE.IO_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¶
Event |
Stream |
Messages |
Comments |
---|---|---|---|
MarketData |
futures.book_ticker |
||
MarketData |
futures.order_book_update |
||
MarketData |
futures.trades |
||
MarketData |
futures.tickers |
Event |
Stream |
Messages |
Comments |
---|---|---|---|
Rest |
/futures/{api}/contracts |
||
Rest |
/futures/{api}/order_book |
||
Statistics¶
Type |
Comments |
---|---|
|
(futures.tickers) |
|
(futures.tickers) |
|
(futures.tickers) |
|
(futures.tickers) |
Order Management¶
Event |
Stream |
Messages |
Comments |
---|---|---|---|
Event |
Stream |
Messages |
Comments |
---|---|---|---|
Event |
Stream |
Messages |
Comments |
---|---|---|---|
Event |
Stream |
Messages |
Comments |
---|---|---|---|
Order Types¶
TBD
Time in Force¶
TBD
Position Effect¶
TBD
Execution Instructions¶
TBD
Account Management¶
Event |
Stream |
Messages |
Comments |
---|---|---|---|
Event |
Stream |
Messages |
Comments |
---|---|---|---|
Streams¶
Type |
Comments |
---|---|
REST |
Primary purpose
|
Type |
Comments |
---|---|
WebSocket |
Primary purpose
Each connection
|
Constraints¶
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.
Comments¶
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
.