HTX DM API Interface Upgrade
- Önemli Duyurular
API Access:https://huobiglobal.zendesk.com/hc/en-us/articles/360000188382
1.1.2 2020-04-09【Add an interface: Futures liquidation order WS push without authentication】
- Interface name: WebSocket liquidation order push
- Subscribe topic: public.$symbol.liquidation_orders
- Interface type: public interface
1.1.1 2020-03-12 【upgrade:added websocket subscription of index kline data;added websocket subscription of basis data; added restful interface of querying index kline data; added restful interface of querying basis data】
1、Added websocket subscription of index kline data
- Interface name:Subscribe Index Kline Data
- Interface type:public interface
- Subscribe Topic:market.$symbol.index.$period
2、Added websocket subscription of basis data
- Interface name:Subscribe Basis Data
- Interface type: public interface
- Subscribe Topic:market.$symbol.basis.$period.$basis_price_type
3、Added restful interface of querying index kline data
- Interface name: Get Index Kline Data
- Interface type: public interface
- Interface URL:/index/market/history/index
4、Added restful interface of querying basis data
- Interface name:Get Basis Data
- Interface type:public interface
- Interface URL:/index/market/history/basis
1.1.0 【upgrade:add transfer between master account and sub-account; add more order types; add websocket subscription of match orders】
1、Added asset transfer function between master account and sub-account on Web and API. When using Web, only master account has transfer authority, including transfer master account assets to sub-account and vice versa, but transfers between sub-accounts are not supported; When using API, only API Key of master account has authority for the transfer operations between master and sub account.
1.1、Added an interface: transfer between master account and sub-accounts, the rate limit between the master account and each subaccount is 10 times/ minute.Interface name: Transfer between master account and sub-accounts.
Interface type: User private interface
URL:api/v1/contract_master_sub_transfer
1.2、Added a parameter: transfer permission between master account and sub-accounts. Added strings: "master_transfer_sub" and "sub_transfer_master" in returning parameter data array.
Interface name: Query information on system status
Interface type: Public
URL:api/v1/contract_api_state
1.3、Added an interface: query transfer records of master account and sub-accounts.
Interface name: Query transfer records of master account and sub-accounts.
Interface type: User private interface
URL: api/v1/contract_master_sub_transfer_record
1.4、Added 4 kinds transfer statements of master account and sub-accounts in query contract financial record interface.
Interface name: Query contract financial record
Interface type: User private interface
URL: api/v1/contract_financial_record
2、Modifications details of contract asset interface and contract trade interface are laid out as following:
2.1、Modified query contract information on order limit: added 10 order price types including opponent_ioc, lightning_ioc, optimal_5_ioc, optimal_10_ioc,optimal_20_ioc,opponent_fok,lightning_fok,optimal_5_fok,optimal_10_fok,optimal_20_fok
Interface name: Query contract information on order limit
Interface type: User private interface
URL: POST api/v1/contract_order_limit
2.2、Modified place an order interface: added 8 order price types, including opponent_ioc, optimal_5_ioc, optimal_10_ioc, optimal_20_ioc, opponent_fok,optimal_5_fok, optimal_10_fok, optimal_20_fok.
Interface name: Place an order
Interface type: User private interface
URL: api/v1/contract_order
2.3、Modified place a batch of orders interface: added 8 order price types, including opponent_ioc, optimal_5_ioc, optimal_10_ioc, optimal_20_ioc, opponent_fok, optimal_5_fok, optimal_10_fok, optimal_20_fok.
Interface name: Place a batch of orders
Interface type: User private interface
URL: api/v1/contract_batchorder
2.4、Modified get trade details of an order interface: added string "liquidation_type".
Interface name: Get trade details of an order
Interface type: User private interface
URL: POST api/v1/contract_order_detail
2.5、Modified "trade_type" and "orders" in query history orders interface. Added "reduce positions to close long" and "reduce positions to close short" types in request parameter "trade_type"; Added string "liquidation_type" in orders array of returning parameter.
Interface name: Query history orders interface.
Interface type: User private interface
URL: POST api/v1/contract_hisorders
2.6、Modified place flash close order interface: added string "order_price_type", including values:lightning_ioc, lightning_fok, lightning
Interface name: Place flash close order
Interface type: User private interface
URL: api/v1/lightning_close_position
2.7、Added string "liquidation_type" in order transaction push in WebSocket Subscription.
Interface name: Match result on order push in WebSocket subscription
Interface type: User private interface
Subscribe Topic: orders.$symbol
2.8、Added matching order transaction push interface in WebSocket Subscription.
Interface name: WebSocket matching order transaction push
Interface type: User private interface
Subscribe Topic: matchOrders.$symbol
2.9、Queried if system interface is available, added strings on perpetual swap related status, added strings "swap_heartbeat"、"swap_estimated_recovery_time"in the array "data" with the returned parameters
Interface name: Queried if system interface is available
Interface type: public
URL: https://www.hbdm.com/heartbeat
2.10、Added API interface of getting user's API indicator disable information
Interface name: get user's API indicator disable information
Interface type: User private interface
Interface type: public
URL: api/v1/contract_api_trading_status
1.0.11 API Uprade
1、 Interface URL: api/v1/contract_batchorder
the maximum number of batch order cancellation each time in request parameter “orders_data” will be changed from 20 to 10.
2、Interface URL: api/v1/contract_cancel
the maximum number of order cancellation each time in request parameter “order_id” and “client_order_id” will be changed from 20 to 10. Multiple order IDs are separated by “,”.
1.0.10 API Upgrade
- modify get Kline data interface:Added two request parameters “from” and “to”. Request parameter “from” stands for starting time and request parameter “to” stands for ending time. Data can be obtained for up to two consecutive years. Request parameter “size” was changed to non-mandatory.
- /market/history/kline Get K-line data
- When getting information on order cancellation via get contracts Information interface, users can only query last 24-hour data.
- /api/v1/contract_order_info Get Contracts Information
- When getting information on order cancellation via query history orders interface, users can only query last 24-hour data.
- /api/v1/contract_hisorders
- When getting information on order cancellation via query order detail interface, users who type in parameters “created_at” and “order_type” can query last 90-day data, while users who don’t type in parameters “created_at” and “order_type” can only query last 24-hour data.
- /api/v1/contract_order_detail
1.0.9【changelog: Added API interface with trigger order function.】
- Added API interface with query assets and positions function.
- rest uri: api/v1/contract_account_position_info Added to get the current assets and positions.
- Added API interface with trigger order function.
- api/v1/contract_trigger_order` Added API interface with place trigger order function
- api/v1/contract_ trigger_cancel` Added API interface with cancel trigger order funcion
- api/v1/contract_trigger_cancelall` Added API interface with cancal all trigger orders function
- api/v1/contract_trigger_openorders` Added API interface with get trigger orders function
- api/v1/contract_trigger_hisorders` Added API interface with get history trigger orders function
- Updated API interfaces with fee coin type field added corresponding to the given fee.
Interfaces are as follows:
- api/v1/contract_fee` query current fee rate
- api/v1/contract_order_info`query order information
- api/v1/contract_order_detail`query order detail
- api/v1/contract_openorders`query current open orders
- api/v1/contract_hisorders`query history orders
- api/v1/contract_matchresults`query history transactions
- add fee coin type push in websocket transactions subcription
- Updated API interfaces with the 'create_date' field to support any positive interger
Please note that the system will return with the last 90-day data by default if the 'create_date' field exceed 90.
- api/v1/contract_hisorders`query history orders
- api/v1/contract_trigger_hisorders`query history trigger orders
- api/v1/contract_matchresults`query history transactions
- api/v1/contract_financial_record`query financial records
1.0.8 API Upgrade:Added the order_id_str field
- To solve the problem that the return order_id of node.js and javascript users is over 18 bits,, the order_id_str field will be added to the following interface, the type is String, which is expected to go online today:
- api/v1/contract_order
- api/v1/contract_batchorder
- api/v1/contract_matchresults
- api/v1/contract_hisorders
- api/v1/contract_openorders
- api/v1/lightning_close_position
- api/v1/contract_order_info
- Added order_id_str in WS subscription
1.0.7 API Upgrade: Added FOK IOC
The return order_id is 18 bits, it will make mistakes when nodejs and JavaScript analysed 18 bits. Because the JSON.parse in nodejs and JavaScript is int by default, the number over 18 bits needs to be parsed by json-bigint package. Please check the demoof nodejs fordetails.
- Modified rest interface: Order details acquisition
- The request parameter“created_at”in rest interface “Order details acquisition” (URL: api/v1/contract_order_detail) was changed from “true” to “false”under Mandatory.
- Modified rest interface: User’s Account Information
- Added return string “margin_static”in rest interface User’s Account Information (URL: api/v1/contract_account_info). The newly added return string “margin_static” in data array means account static equity.
- Added string “ID “in three interfaces;
- Added string“ID”in rest interface Order details acquisition (URL: api/v1/contract_order_detail) ,rest interface Acquire History Match Results (URL: api/v1/contract_matchresults) as well as the match result on Order Push in WebSocket Subscription.
- Added “IOC”and “FOK order types for order placement
- Added order_price_type “ioc” and “fok”under Request Parameter in rest interface Place an Order(URL: api/v1/contract_order) and rest interface Place a Batch of Orders(URL: api/v1/contract_batchorder)
- Modified interface: Query contract information on order limit
- Added “fok”:FOK Order,“ioc”:IOC Order into string of“ order_price_type” in Returning Parameter under rest interface Query contract information on order limit (URL: api/v1/contract_order_limit)
- The“ order_price_type” means Order Type here.
- Added rest API interface: Query information on system status
- Interface URL: api/v1/contract_api_state
- Added rest interface: Top Trader Sentiment Index Function-Account
- Interface URL: api/v1/contract_elite_account_ratio
- Added rest interface: Top Trader Sentiment Index Function-Position
- Interface URL: api/v1/contract_elite_position_ratio
- Added Liquidation order query function in API and WS subscription.
- Added rest interface: Request Liquidation Order Information Interface URL: rest interface api/v1/contract_liquidation_orders
- Liquidation order push is added also into WebSocket Subscription.
1.0.6 API Upgrade: added rest interface
1. Added rest interface
- Request access to address: https://www.hbdm.com/heartbeat
- Note: To query whether the system is available or not, requesthttps://www.hbdm.com/heartbeat. When Heartbeat is 1, system is available; when Heartbeat is 0, system is unavailable.
1.0.5 API Upgrade: New Features of Query and Order Placing
- Newly Added API Restful Interface
- Newly added Interface: query user’s order limit information
- Newly added Interface: query user’s trading fee information
- Newly added Interface: query user’s transfer limit information
- Newly added Interface: query users’ position limit information
- Newly added Interface: query platform information on insurance fund and estimated clawback rate
- Newly added Interface: query platform information on open interest information
- Newly added Interface: query history records information on insurance fund
- Newly added Interface: query platform information on Tiered Adjustment Factor
- Newly added Interface: place Flash Close order
- Modified API Interface
- Restful interface: add “return to users’ adjustment factor” on Query Users’ Account Information Interface.;
- Restful interface: add “return to users’ adjustment factor” on Query a Single Sub-Account’s Assets Information Interface.
- WebSocket Interface: add “return to users’ adjustment factor” on WebSoket Portfolio Push Interface;
- Restful Interface: add Optimal price set with optimal top 5, optimal 10 and optimal top 20 on Order Place Interface and Place a Batch of Orders Interface
- Restful Interface: add “query according contract code” on Acquire History of Match Results Interface
1.0.4 API Upgrade:Restful interface
- Query assets information of all sub-accounts under the master account
- URL:api/v1/contract_sub_account_list
- Notice: Only return data for activated contract sub-account (i.e. sub-accounts that have gained contract trading permission).
- Query a single sub-account's assets information
- URL:api/v1/contract_sub_account_info
- Notice: Only query account information for activated contract sub-account (i.e. sub-accounts that have gained contract trading permission); No data return for sub-accounts which has logged in hbdm but have not gained trading permission/activated.
- Query a single sub-account's position information
- URL:api/v1/contract_sub_position_info
- Query account financial records
- URL:api/v1/contract_financial_record
1.0.3 API Upgrade: WebSoket Portfolio Push
- WebSoket balance push is available: users could subscribe the interface to get information of their balances automatically.
- WebSoket position push is available: users could subscribe the interface to get information of their positions automatically.
- Acuqire positions information via Restful interface: api/v1/contract_position_info .The string of “latest price”is added into response
1.0.2 API Upgrade: Transfer margin between Spot account and Future account
- URL /v1/futures/transfer
- This interface is used to transfer assets between Spot account and Future account.
- The type is “pro-to-futures” when transferring assets from Spot account to Future; “futures-to-pro” when transferring from Future account to Spot account.
- API rate limit for this interface is up to 10 times per minute.
- API rate limit
- Private interface rate limit has been increased from 10 times/second to 30 times every 3 seconds, which means users could send up to 30 requests within 3 seconds.
- The rate limit of other non-market public interface has been increased from 20 times/second to 60 times every 3 seconds, which means users could send up to 60 requests within 3 seconds.
1.0.1 API Upgrade: Post_only and more
- Cancel all interface: URL api/v1/contract_cancelall
- Send symbol to cancel all the contracts of that kind of symbol, e.g. send “BTC” to cancel all BTC weekly, biweekly and quarterly contracts.
- Send contract_code to cancel the contracts of that code.
- Send symbol+contract_type to cancel the certain contracts under the symbol of that contract_type, e.g. send “BTC” and “this week”, then the BTC weekly contracts will be cancelled.
- Order place interface: URL api/v1/contract_order
- Post_only is added into the string of order_price_type.
- Description of post_only: assure that the maker order remains as maker order, it will not be filled immediately with the use of post_only, for the match system will automatically check whether the price of the maker order is higher/lower than the opponent first price, i.e. higher than bid price 1 or lower than the ask price 1. If yes, the maker order will placed on the orderbook, if not, the maker order will be cancelled.
-
Position limit will be applied to post_only while order limit will not.
- Place a batch of orders: URL /v1/contract_batchorder
- Post_only is added into the string of order_price_type.
- Description of post_only: assure that the maker order remains as maker order, it will not be filled immediately with the use of post_only, for the match system will automatically check whether the price of the maker order is higher/lower than the opponent first price, i.e. higher than bid price 1 or lower than the ask price 1. If yes, the maker order will placed on the orderbook, if not, the maker order will be cancelled.
-
Position limit will be applied to post_only while order limit will not.
- Will response following string for "header" via api
- ratelimit-limit: the upper limit of requests per time, unit: time
ratelimit-interval: reset interval (reset the number of request), unit: ms
ratelimit-remaining: the left available request number for this round, unit: time
ratelimit-reset: upper limit of reset time used to reset request number, unit: ms
- Order details acquisition: URL api/v1/contract_order_detail
- The string of “role” (i.e. taker or maker) is added into “trades”
- Acquire history of match results: URL api/v1/contract_matchresults
- The string of “role” (i.e. taker or maker) is added into “trades
- WebSoket, the private order push interface, requires API KEY Verification
- Each UID can build at most create 10 WS connections for private order push at the same time. For each account, contracts of the same underlying coin only need to subscribe one WS order push, e.g. users only need to create one WS order push connection for BTC Contract which will automatically push orders of BTC weekly, BTC biweekly and BTC quarterly contracts.
-
Please note that the rate limit of WS order push and RESTFUL private interface are separated from each other, with no relations.
1.0.0 has launched on December 10, 2018