roq-huobi-futures#

Important

This gateway needs sponsorship to complete certain features.

Important

There are different network end-points required for linear and inverse perpetuals/futures. The API’s are different but sufficiently similar to allow this gateway to support both. The implication of this is that you will need more instances of this gateway if you need support for both product groups.

Purpose#

  • Maintain network connectivity with the Huobi Futures 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 Singapore (to be confirmed)

  • No test environment

Conda#

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

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

Config#

Flags#

$ roq-huobi-futures --help

--rest_download_refresh

Periodic refresh

--exchange (huobi-futures)

exchange identifier (string)

--api

what api to use (<empty>, swap, linear-swap)

--encode_buffer_size (1048576)

encode buffer size

--decode_buffer_size (10485760)

decode buffer size

--mbp_allow_price_inversion (false)

allow price inversion?

--rest_uri (https://api.hbdm.com)

REST end-point (URI)

--rest_proxy

proxy end-point (URI)

--rest_ping_freq (5s)

ping frequency

--rest_ping_path (/api/v1/contract_api_state)

URI path used for REST connection keep-alive messages

--rest_request_timeout (30s)

request: timeout

--rest_listen_key_refresh (1800s)

listen key refresh period

--rest_order_recv_window (5000ms)

receive window, please refer to Binance documentation!

--rest_cancel_on_disconnect (false)

cancel orders on disconnect? (bool)

--rest_download_refresh (600s)

download refresh period

--ws_market_uri (wss://api.hbdm.com/ws)

WebSocket end-point (URI) for market data

--ws_index_uri (wss://api.hbdm.com/ws_index)

WebSocket end-point (URI) for market data

--ws_order_uri (wss://api.hbdm.com/notification)

WebSocket end-point (URI) for order management

--ws_ping_freq (5s)

ping frequency

--ws_max_subscriptions_per_stream (32)

max symbols per connection (count)

--ws_subscribe_depth_levels (0)

depth levels (count)

--ws_subscribe_depth_freq (100ms)

depth update frequency

--ws_subscribe_trade_details (false)

report individual matches for trade summary? (bool)

Environments#

$ $CONDA_PREFIX/share/roq-huobi-futures/flags

COIN-M Futures#

# flagfile for the roq-huobi-futures gateway

--rest_uri=https://api.hbdm.com
--ws_market_uri=wss://api.hbdm.com/ws
--ws_order_uri=wss://api.hbdm.com/notification
--ws_index_uri=wss://api.hbdm.com/ws_index

Note

You may also specify --api="" (the default).

COIN-M Swaps#

# flagfile for the roq-huobi-futures gateway

--api=swap
--rest_uri=https://api.hbdm.com
--ws_market_uri=wss://api.hbdm.com/swap-ws
--ws_order_uri=wss://api.hbdm.com/swap-notification
--ws_index_uri=wss://api.hbdm.com/ws_index

USDT-M#

# flagfile for the roq-huobi-futures gateway

--api=linear-swap
--rest_uri=https://api.hbdm.com
--ws_market_uri=wss://api.hbdm.com/linear-swap-ws
--ws_order_uri=wss://api.hbdm.com/linear-swap-notification
--ws_index_uri=wss://api.hbdm.com/ws_index

Market Data#

Event

Stream

Messages

Comments

roq::ReferenceData

DropCopy

public.$symbol.contract_info

Requires authentication.

roq::MarketStatus

roq::TopOfBook

MarketData

market.$symbol.bbo

roq::MarketByPriceUpdate

MarketData

market.$symbol.depth.size_150.high_freq

roq::MarketByOrderUpdate

roq::TradeSummary

MarketData

market.$symbol.trade.detail

roq::StatisticsUpdate

MarketData

market.$symbol.detail, market.$symbol.estimated_rate.1min, market.$symbol.premium_index.1min, public.$symbol.funding_rate

Event

Stream

Messages

Comments

roq::ReferenceData

Rest

/api/v1/contract_contract_info, /linear-swap-api/v1/swap_contract_info

roq::MarketStatus

roq::TopOfBook

roq::MarketByPriceUpdate

roq::MarketByOrderUpdate

roq::TradeSummary

roq::StatisticsUpdate

Statistics#

Type

Comments

OPEN_PRICE

(detail) open

HIGHEST_TRADED_PRICE

(detail) high

LOWEST_TRADED_PRICE

(detail) low

CLOSE_PRICE

(detail) close

TRADE_VOLUME

(detail) vol

FUNDING_RATE

(funding_rate) funding_rate

FUNDING_RATE_PREDICTION

(funding_rate) estimated_rate

INDEX_VALUE

(index) close

Order Management#

Event

Stream

Messages

Comments

roq::OrderUpdate

roq::TradeUpdate

Event

Stream

Messages

Comments

roq::OrderUpdate

roq::TradeUpdate

Event

Stream

Messages

Comments

roq::OrderAck

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

roq::FundsUpdate

Streams#

Type

Comments

REST

Primary purpose

Comments#

  • Symbols are only processed when contract_status==1

  • The channels premium_index and estimated_rate are not available when --api is inverse (or missing, the default).