roq-huobi

Supports

Products

Spot

Futures

Options

Combos

Market Data

Reference Data

Market Status

Top of Book

Market by Price

Market by Order

Trade Summary

Statistics

Order Management

Create

Modify

Cancel

Cancel All

Auto-Cancel

Account Management

Positions

Funds

Installing

$ mamba install \
      --channel https://roq-trading.com/conda/stable \
      roq-huobi
$ mamba install \
      --channel https://roq-trading.com/conda/unstable \
      roq-huobi

Using

$ roq-huobi \
      --name "huobi" \
      --config_file $CONFIG_FILE_PATH \
      --client_listen_address $UNIX_SOCKET_PATH \
      --flagfile $ENVIRONMENT_FLAGFILE

Flags

$ roq-huobi --help
--exchange (huobi)

Exchange identifier

--rest_uri (https://api.huobi.pro)

Exchange end-point

--rest_proxy

Proxy end-point

--rest_ping_freq (5s)

Ping frequency

--rest_ping_path (/v1/common/timestamp)

Ping path

--rest_request_timeout (30s)

Request timeout

--rest_listen_key_refresh (1800s)

Listen key refresh period

--rest_order_recv_window (5000ms)

Receive window

--rest_cancel_on_disconnect (false)

Cancel orders on disconnect?

--ws_market_uri (wss://api.huobi.pro/ws)

Exchange end-point

--ws_mbp_uri (wss://api.huobi.pro/feed)

Exchange end-point

--ws_order_uri (wss://api.huobi.pro/ws/v2)

Exchange end-point

--ws_ping_freq (5s)

Ping frequency

--ws_max_subscriptions_per_stream (128)

Maximum number of symbols per connection

--ws_request_delay (100ms)

Request delay

--ws_mbp_request_max_retries (3)

Request max retries

--request_limit (10)

Request limit per interval

--request_limit_interval (1s)

Request limit monitor interval

--encode_buffer_size (1048576)

Encode buffer size

--decode_buffer_size (10485760)

Decode buffer size

--mbp_allow_price_inversion (false)

Allow price inversion?

Environments

$ $CONDA_PREFIX/share/roq-huobi/flags/prod/flags.cfg
# flagfile for the roq-huobi gateway

--rest_uri=https://api.huobi.pro
--ws_market_uri=wss://api.huobi.pro/ws
--ws_mbp_uri=wss://api.huobi.pro/feed
--ws_order_uri=wss://api.huobi.pro/ws/v2

Configuration

$ $CONDA_PREFIX/share/roq-huobi/config.toml

Important

The template will be replaced when the software is upgraded. Make a copy and modify to your needs.

symbols = [
  "^btcusd[a-z]$",
  "^ethusd[a-z]$"
]

[accounts]

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

roq::ReferenceData

roq::MarketStatus

roq::TopOfBook

MarketData

market.$symbol.bbo

roq::MarketByPriceUpdate

MBPFeed

market.$symbol.mbp.20

roq::MarketByOrderUpdate

roq::TradeSummary

MarketData

market.$symbol.trade.detail

roq::StatisticsUpdate

MarketData

market.$symbol.ticker, market.$symbol.detail

Event

Stream

Messages

Comments

roq::ReferenceData

Rest

/v1/common/currencys, /v1/common/symbols

roq::MarketStatus

MarketData

/v1/common/symbols

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

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

Type

Comments

WebSocket

Primary purpose

Type

Comments

WebSocket

Primary purpose

Constraints

Comments

  • Only including symbols having state=ONLINE and api_trading=ENABLED