From f978a185369e090546af0b57e41f03547727f0a7 Mon Sep 17 00:00:00 2001 From: rayxy Date: Mon, 24 Dec 2018 11:39:18 +0000 Subject: [PATCH 001/759] Delete index.html.md --- source/index.html.md | 1434 ------------------------------------------ 1 file changed, 1434 deletions(-) delete mode 100644 source/index.html.md diff --git a/source/index.html.md b/source/index.html.md deleted file mode 100644 index feeaca758eb..00000000000 --- a/source/index.html.md +++ /dev/null @@ -1,1434 +0,0 @@ ---- -title: Huobi API Reference - -language_tabs: # must be one of https://git.io/vQNgJ - - shell - -toc_footers: - - Sign Up for a Huobi API key - - Login is required for creating an API key - -includes: - -search: true ---- - -# Introduction - -Welcome to the Huobi API! You can use our API to access all market data, trading, and account management endpoints. - -We have language bindings in Shell, and Python! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right. - -# General - -## Request Format - -All API requests are in either GET or POST method. For GET request, all parameters are path parameters. For POST request, all parameters are in POST body and in JSON format. - -## Response Format - -All response will be returned in JSON format. The top level JSON is a wrapper object which provides three metadata in "status", "ch", and "ts". The actual per API response data is in "data" field. - -### Response Wrapper Content - -> Response wrapper content example: - -```json -{ - "status": "ok", - "ch": "market.btcusdt.kline.1day", - "ts": 1499223904680, - "data": // per API response data in nested JSON object -} -``` - -Parameter | Data Type | Description ---------- | --------- | ----------- -status | string | The overall API call result status -ch | string | The data channel this response was originated from. Some API return does not have this field. -ts | int | The timestamp in milliseconds for when the response is created -data | object | The actual response content per API - -## Endpoint Rate Limit - -Each apikey can send maximum of 100 https requests within 10 seconds. Please contact customer support if you believe you need higher limit rate. - -## Authentication - -Some API endpoints require authentication. To be authenticated, you should first acquire an API key and the corresponding secret key. - - - -In order to successfully sign a request, you need to follow below steps - -1. Generate the "Query String" for your query - -2. Use "Query String" and your secret key to to created a signature - -3. Add the signature as a path parameter to your query - -### Generate the "Query String" for your query - -> Add the query path section of the query string - -```shell -[HTTP Method]\n[URL Root]\n[Query Path]\n -``` - -> For example below - -```shell -GET\napi.huobi.pro\n/v1/order/orders\n -``` - -> Add the authentication section of the query string - -```shell -AccessKeyId=[Your API key]&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=[Your Request Timestamp] -``` - -> For example below - -```shell -AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-05-11T15%3A19%3A30 -``` - -> Add the parameter section of the query string, for example - -```shell -&order-id=1234567890 -``` - -> The final query string will be this - -```shell -GET\napi.huobi.pro\n/v1/order/orders\nAccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-05-11T15%3A19%3A30&order-id=1234567890 -``` - -1. Add the query path to the query string - -2. Add mandatory authentication parameters to the query string - -3. Add other path parameters to the query string ordered by parameter name (asc) - - - -### Use "Query String" and your secret key to to created a signature - -> The result signature will look like - -```shell -4F65x5A2bLyMWVQj3Aqp+B4w+ivaA7n5Oi2SuYtCJ9o= -``` - -1. Apply HmacSHA256 hash function with inputs (query string, secret key) to get the hashed string - -2. Encode the hashed string with base-64 - -### Add the signature as a path parameter to your query - -> The final request with signature will look like - -```shell -https://api.huobi.pro/v1/order/orders?AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&order-id=1234567890&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-05-11T15%3A19%3A30&Signature=4F65x5A2bLyMWVQj3Aqp%2BB4w%2BivaA7n5Oi2SuYtCJ9o%3D - -``` - -1. Add all mandatory authentication parameters to your path parameter - -2. Add "&Signature=[Your request signature with URL encode]" to your path parameter - -# Market Data - -## Get Klines(candles) - -This endpoint retrieves all klines in a specific range. - -### HTTP Request - -`GET https://api.huobi.pro/market/history/kline` - -```shell -curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" -``` - -> The above command returns JSON structured like this: - -```json -[ - { - "id": 1499184000, - "amount": 37593.0266, - "count": 0, - "open": 1935.2000, - "close": 1879.0000, - "low": 1856.0000, - "high": 1940.0000, - "vol": 71031537.97866500 - } -] -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -period | string | true | NA | The period of each candle, allowed values are: 1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year -size | integer | false | 150 | The number of data returns, range [1, 2000] - -### Response Content -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The UNIX timestamp in seconds as response id -amount | float | The aggregated trading volume in USDT -count | integer | The number of completed trades -open | float | The opening price -close | float | The closing price -low | float | The low price -high | float | The high price -vol | float | The trading volume in base currency - -## Get Latest Aggregated Ticker - -This endpoint retrieves the latest ticker with some important 24h aggregated market data. - -### HTTP Request - -`GET https://api.huobi.pro/market/detail/merged` - -```shell -curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" -``` - -> The above command returns JSON structured like this: - -```json -{ - "id":1499225271, - "ts":1499225271000, - "close":1885.0000, - "open":1960.0000, - "high":1985.0000, - "low":1856.0000, - "amount":81486.2926, - "count":42122, - "vol":157052744.85708200, - "ask":[1885.0000,21.8804], - "bid":[1884.0000,1.6702] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The UNIX timestamp in seconds as response id -amount | float | The aggregated trading volume in USDT -count | integer | The number of completed trades -open | float | The opening price of last 24 hours -close | float | The closing price of last 24 hours -low | float | The low price of last 24 hours -high | float | The high price of last 24 hours -vol | float | The trading volume in base currency of last 24 hours -bid | object | The current best bid in format [price, quote volume] -ask | object | The current best ask in format [price, quote volume] - -## Get Latest Tickers for All Pairs - -This endpoint retrieves the latest tickers for all supported pairs. - - - -### HTTP Request - -`GET https://api.huobi.pro/market/tickers` - -```shell -curl "https://api.huobi.pro/market/tickers" -``` - -> The above command returns JSON structured like this: - -```json -[ - { - "open":0.044297, // daily Kline,opennig price - "close":0.042178, // daily Kline,closing price - "low":0.040110, // daily Kline,the minimum price - "high":0.045255, // daily Kline,the maxmum price - "amount":12880.8510, - "count":12838, - "vol":563.0388715740, - "symbol":"ethbtc" - }, - { - "open":0.008545, - "close":0.008656, - "low":0.008088, - "high":0.009388, - "amount":88056.1860, - "count":16077, - "vol":771.7975953754, - "symbol":"ltcbtc" - } -] -``` - -### Query Parameters - -This endpoint does not require parameters. - -### Response Content - -Response content is an array of object, each object has below fields. - -Parameter | Data Type | Description ---------- | --------- | ----------- -amount | float | The aggregated trading volume in USDT of last 24 hours -count | integer | The number of completed trades of last 24 hours -open | float | The opening price of last 24 hours -close | float | The closing price of last 24 hours -low | float | The low price of last 24 hours -high | float | The high price of last 24 hours -vol | float | The trading volume in base currency of last 24 hours -symbol | string | The trading pair of this object, e.g. btcusdt, bccbtc - -## Get Market Depth - -This endpoint retrieves the current order book of a specific pair. - -### HTTP Request - -`GET https://api.huobi.pro/market/depth` - -```shell -curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" -``` - -> The above command returns JSON structured like this: - -```json -{ - "version": 31615842081, - "ts": 1489464585407, - "bids": [ - [7964, 0.0678], // [price, amount] - [7963, 0.9162], - [7961, 0.1], - [7960, 12.8898], - [7958, 1.2], - [7955, 2.1009], - [7954, 0.4708], - [7953, 0.0564], - [7951, 2.8031], - [7950, 13.7785], - [7949, 0.125], - [7948, 4], - [7942, 0.4337], - [7940, 6.1612], - [7936, 0.02], - [7935, 1.3575], - [7933, 2.002], - [7932, 1.3449], - [7930, 10.2974], - [7929, 3.2226] - ], - "asks": [ - [7979, 0.0736], - [7980, 1.0292], - [7981, 5.5652], - [7986, 0.2416], - [7990, 1.9970], - [7995, 0.88], - [7996, 0.0212], - [8000, 9.2609], - [8002, 0.02], - [8008, 1], - [8010, 0.8735], - [8011, 2.36], - [8012, 0.02], - [8014, 0.1067], - [8015, 12.9118], - [8016, 2.5206], - [8017, 0.0166], - [8018, 1.3218], - [8019, 0.01], - [8020, 13.6584] - ] - } -``` - -### Query Parameters - -Parameter | Data Type | Required | Allowed Value | Description ---------- | --------- | -------- | ------------- | ----------- -symbol | string | true | All supported trading pair symbols | The trading pair to query, e.g. btcusdt, bccbtc -type | string | true | step0, step1, step2, step3, step4, step5 | TBC - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -ts | integer | The UNIX timestamp in milliseconds -version | integer | TBC -bids | object | The current all bids in format [price, quote volume] -asks | object | The current all asks in format [price, quote volume] - -## Get the Last Trade - -This endpoint retrieves the latest trade with its price, volume, and direction. - -### HTTP Request - -`GET https://api.huobi.pro/market/trade` - -```shell -curl "https://api.huobi.pro/market/trade?symbol=ethusdt" -``` - -> The above command returns JSON structured like this: - -```json -{ - "id": 600848670, - "ts": 1489464451000, - "data": [ - { - "id": 600848670, - "price": 7962.62, - "amount": 0.0122, - "direction": "buy", - "ts": 1489464451000 - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The unique trade id of this trade -amount | float | The trading volume in base currency -price | float | The trading price in quote currency -ts | integer | The UNIX timestamp in milliseconds -direction | string | The direction of the trade: 'buy' or 'sell' - -## Get the Most Recent Trades - -This endpoint retrieves the most recent trades with their price, volume, and direction. - -### HTTP Request - -`GET https://api.huobi.pro/market/history/trade` - -```shell -curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" -``` - -> The above command returns JSON structured like this: - -```json -[ - { - "id":31618787514, - "ts":1544390317905, - "data":[ - { - "amount":9.000000000000000000, - "ts":1544390317905, - "id":3161878751418918529341, - "price":94.690000000000000000, - "direction":"sell" - }, - { - "amount":73.771000000000000000, - "ts":1544390317905, - "id":3161878751418918532514, - "price":94.660000000000000000, - "direction":"sell" - } - ] - }, - { - "id":31618776989, - "ts":1544390311353, - "data":[ - { - "amount":1.000000000000000000, - "ts":1544390311353, - "id":3161877698918918522622, - "price":94.710000000000000000, - "direction":"buy" - } - ] - } -] -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -size | integer | false | 1 | The number of data returns - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The unique trade id of this trade -amount | float | The trading volume in base currency -price | float | The trading price in quote currency -ts | integer | The UNIX timestamp in milliseconds -direction | string | The direction of the trade: 'buy' or 'sell' - -## Get the Last 24h Market Summary - -This endpoint retrieves the summary of trading in the market for the last 24 hours. - -### HTTP Request - -`GET https://api.huobi.pro/market/detail/` - -```shell -curl "https://api.huobi.pro/market/detail?symbol=ethusdt" -``` - -> The above command returns JSON structured like this: - -```json -{ - "amount":613071.438479561, - "open":86.21, - "close":94.35, - "high":98.7, - "id":31619471534, - "count":138909, - "low":84.63, - "version":31619471534, - "vol":5.6617373443873316E7 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The UNIX timestamp in seconds as response id -amount | float | The aggregated trading volume in USDT -count | integer | The number of completed trades -open | float | The opening price of last 24 hours -close | float | The closing price of last 24 hours -low | float | The low price of last 24 hours -high | float | The high price of last 24 hours -vol | float | The trading volume in base currency of last 24 hours -version | integer | TBC - -# Spot Trading - - - -## Place a New Trading Order - -This endpoint place an trading order and send to the exchange to be matched. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/place` - -```shell -curl "https://api.huobi.pro/v1/order/orders/place" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit"} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": "59378" -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -account-id | string | true | NA | The account id used for this spot trading -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -type | string | true | NA | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -amount | string | true | NA | The amount in quote currency to buy / the amount in base currency to sell -price | string | false | NA | The limit price of limit order -source | string | false | api | When trade with margin use 'margin-api' - -### Response Content - - - -## Show All Open Orders - -This endpoint returns all open orders which have not been filled completely. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/openOrders` - -```shell -curl "https://api.huobi.pro/v1/order/openOrders" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit"} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 5454937, - "symbol": "ethusdt", - "account-id": 30925, - "amount": "1.000000000000000000", - "price": "0.453000000000000000", - "created-at": 1530604762277, - "type": "sell-limit", - "filled-amount": "0.0", - "filled-cash-amount": "0.0", - "filled-fees": "0.0", - "source": "web", - "state": "submitted" - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -account-id | string | false | NA | The account id used for this spot trading -symbol | string | false | NA | The trading pair to trade, e.g. btcusdt, bccbtc -side | string | false | both | Filter on the direction of the trade, possible values are: buy, sell. Default is to return all -size | int | false | 10 | The max number of orders to return - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | order id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app -state | string | submitted, partical-filled, cancelling - -## Submit Cancel for an Order - -This endpoint submit a request to cancel an order. - - - -### HTTP Request - -`POST https://api.huobi.pro/v1/order/orders/{order-id}/submitcancel` - -```shell -curl "https://api.huobi.pro/v1/order/orders/59378/submitcancel" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": "59378" -} -``` - -## Submit Cancel for Multiple Orders at Once - -This endpoint submit cancellation for multiple orders at once. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/batchcancel` - -```shell -curl "https://api.huobi.pro/v1/order/orders/batchcancel" -BODY { - "order-ids": [ - "1", "2", "3" - ] -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": { - "success": [ - "1", - "3" - ], - "failed": [ - { - "err-msg": "记录无效", - "order-id": "2", - "err-code": "base-record-invalid" - } - ] - } -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -order-ids | list | true | NA | The order ids to cancel. Max size is 50. - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request - -## Submit Cancel for Multiple Orders at Once - -This endpoint submit cancellation for multiple orders at once. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/batchcancel` - -```shell -curl "https://api.huobi.pro/v1/order/orders/batchcancel" -BODY { - "order-ids": [ - "1", "2", "3" - ] -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": { - "success": [ - "1", - "3" - ], - "failed": [ - { - "err-msg": "记录无效", - "order-id": "2", - "err-code": "base-record-invalid" - } - ] - } -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -order-ids | list | true | NA | The order ids to cancel. Max size is 50. - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request - -## Show the Order Detail of One Order - -This endpoint returns the detail of one order. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/{order-id}` - -```shell -curl "https://api.huobi.pro/v1/order/orders/59378" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": { - "id": 59378, - "symbol": "ethusdt", - "account-id": 100009, - "amount": "10.1000000000", - "price": "100.1000000000", - "created-at": 1494901162595, - "type": "buy-limit", - "field-amount": "10.1000000000", - "field-cash-amount": "1011.0100000000", - "field-fees": "0.0202000000", - "finished-at": 1494901400468, - "user-id": 1000, - "source": "api", - "state": "filled", - "canceled-at": 0, - "exchange": "huobi", - "batch": "" - } -} -``` - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | order id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -account-id | string | The account id which this order belongs to -amount | string | The amount of base currency in this order -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -finished-at | int | The timestamp in milliseconds when the order was changed to a final state. This is not the time the order is matched. -canceled-at | int | The timestamp in milliseconds when the order was canceled, if not canceled then has value of 0 -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app -state | string | Order state: submitted, partical-filled, cancelling, filled, canceled -exchange | string | Internal data -batch | string | Internal data - -## Show the Match Result of an Order - -This endpoint returns the match result of an order. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/{order-id}/matchresult` - -```shell -curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 29553, - "order-id": 59378, - "match-id": 59335, - "symbol": "ethusdt", - "type": "buy-limit", - "source": "api", - "price": "100.1000000000", - "filled-amount": "9.1155000000", - "filled-fees": "0.0182310000", - "created-at": 1494901400435 - } - ] -} -``` - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Internal id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -order-id | string | The order id of this order -match-id | string | The match id of this match -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the match and fill is done -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app - -## Search Past Orders - -This endpoint returns orders based on a specific searching criteria. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders` - -```shell -curl "https://api.huobi.pro/v1/order/orders" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" - } -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 59378, - "symbol": "ethusdt", - "account-id": 100009, - "amount": "10.1000000000", - "price": "100.1000000000", - "created-at": 1494901162595, - "type": "buy-limit", - "field-amount": "10.1000000000", - "field-cash-amount": "1011.0100000000", - "field-fees": "0.0202000000", - "finished-at": 1494901400468, - "user-id": 1000, - "source": "api", - "state": "filled", - "canceled-at": 0, - "exchange": "huobi", - "batch": "" - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -types | string | false | All | The types of order to include in the search -states | string | false | All | The states of order to include in the search -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd -from | string | false | both | Search order id to begin with -direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' -size | int | false | 100 | The max number of orders to return, max value is 100 - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Order id -account-id | integer | Account id -user-id | integer | User id -amount | string | The amount of base currency in this order -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -canceled-at | int | The timestamp in milliseconds when the order was canceled, or 0 if not canceled -canceled-at | int | The timestamp in milliseconds when the order was finished, or 0 if not finished -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app -state | string | submitted, partical-filled, cancelling -exchange | string | Internal data -batch | string | Internal data - -## Search the Match Results - -This endpoint returns the match results of past and open orders based on specific search criteria. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/matchresults` - -```shell -curl "https://api.huobi.pro/v1/order/matchresults" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 29553, - "order-id": 59378, - "match-id": 59335, - "symbol": "ethusdt", - "type": "buy-limit", - "source": "api", - "price": "100.1000000000", - "filled-amount": "9.1155000000", - "filled-fees": "0.0182310000", - "created-at": 1494901400435 - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -types | string | false | All | The types of order to include in the search -states | string | false | All | The states of order to include in the search -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd -from | string | false | NA | Search match result id to begin with -direct | string | false | next | Search direction when 'from' is used, possible values: 'next', 'prev' -size | int | false | 100 | The max number of orders to return - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Internal id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -order-id | string | The order id of this order -match-id | string | The match id of this match -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the match and fill is done -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app - -# Margin Trading - - - - - - - -## Transfer Asset from Spot Trading Account to Margin Account - -This endpoint transfer specific asset from spot trading account to margin account. - -### HTTP Request - -`GET https://api.huobi.pro/v1/dw/transfer-in` - -```shell -curl "https://api.huobi.pro/v1/dw/transfer-in" -BODY -{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Transfer id - -## Transfer Asset from Margin Account to Spot Trading Account - -This endpoint transfer specific asset from margin account to spot trading account. - -### HTTP Request - -`GET https://api.huobi.pro/v1/dw/transfer-out` - -```shell -curl "https://api.huobi.pro/v1/dw/transfer-out" -BODY -{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Transfer id - -## Place a Margin Loan Order - -This endpoint place an order to initiate a margin loan. - -### HTTP Request - -`GET https://api.huobi.pro/v1/margin/orders` - -```shell -curl "https://api.huobi.pro/v1/margin/orders" -BODY -{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Margin order id - -## Repay Margin Loan - -This endpoint repays margin loan with you asset in your margin account. - -### HTTP Request - -`POST https://api.huobi.pro/v1/margin/orders/{order-id}/repay` - -```shell -curl "https://api.huobi.pro/v1/margin/orders/1000/repay" -BODY -{ - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -amount | string | true | NA | The amount of currency to repay - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Margin order id - -## Search Past Margin Orders - -This endpoint returns margin orders based on a specific searching criteria. - -### HTTP Request - -`GET https://api.huobi.pro/v1/margin/loan-orders` - -```shell -curl "https://api.huobi.pro/v1/margin/load-orders" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" - } -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "loan-balance": "0.100000000000000000", - "interest-balance": "0.000200000000000000", - "interest-rate": "0.002000000000000000", - "loan-amount": "0.100000000000000000", - "accrued-at": 1511169724531, - "interest-amount": "0.000200000000000000", - "symbol": "ethbtc", - "currency": "btc", - "id": 394, - "state": "accrual", - "account-id": 17747, - "user-id": 119913, - "created-at": 1511169724531 - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -states | string | false | All | The states of order to include in the search -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd -from | string | false | both | Search order id to begin with -direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' -size | int | false | 100 | The max number of orders to return, max value is 100 - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Order id -account-id | integer | Account id -user-id | integer | User id -symbol | string | The margin loan pair to trade, e.g. btcusdt, bccbtc -currency | string | The currency in the loan -created-at | int | The timestamp in milliseconds when the order was created -accrued-at | int | The timestamp in milliseconds when the last accure happened -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -loan-amount | string | The amount of the origin loan -loan-balance | string | The amount of the loan left -interest-rate | string | The loan interest rate -interest-amount | string | The accumulated loan interest -interest-balance | string | The amount of loan interest left -state | string | Loan state, possible values: created, accrual, cleared, invalid - -## Return the Balance of the Margin Loan Account - -This endpoint returns the balance of the margin loan account. - -### HTTP Request - -`GET https://api.huobi.pro/v1/margin/accounts/balance` - -```shell -curl "https://api.huobi.pro/v1/margin/accounts/balance" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" - } -``` - -> The above command returns JSON structured like this: - -```json -{ -"data": [ - { - "id": 18264, - "type": "margin", - "state": "working", - "symbol": "btcusdt", - "fl-price": "0", - "fl-type": "safe", - "risk-rate": "475.952571086994250554", - "list": [ - { - "currency": "btc", - "type": "trade", - "balance": "1168.533000000000000000" - }, - { - "currency": "btc", - "type": "frozen", - "balance": "0.000000000000000000" - }, - { - "currency": "btc", - "type": "loan", - "balance": "-2.433000000000000000" - }, - { - "currency": "btc", - "type": "interest", - "balance": "-0.000533000000000000" - }, - { - "currency": "btc", - "type": "transfer-out-available",//可转btc - "balance": "1163.872174670000000000" - }, - { - "currency": "btc", - "type": "loan-available",//可借btc - "balance": "8161.876538350676000000" - } - ] - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -symbol | string | The margin loan pair, e.g. btcusdt, bccbtc -state | string | Balance state, possible values: working,fl-sys,fl-mgt,fl-end -risk-rate | string | The risk rate -fl-price | string | The price which triggers closeout -list | object array | The list of loans and their details - -# Wallet (Deposit and Withdraw) - -## Create a Withdraw Request - -This endpoint creates a withdraw request from your spot trading account to an external address. - - - -### HTTP Request - -`GET https://api.huobi.pro/v1/dw/withdraw/api/create` - -```shell -curl "https://api.huobi.pro/v1/dw/withdraw/api/create" -BODY -{ - "address": "0xde709f2102306220921060314715629080e2fb77", - "amount": "0.05", - "currency": "eth", - "fee": "0.01" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -address | string | true | NA | The desination address of this withdraw -currency | string | true | NA | The crypto currency to withdraw -amount | string | true | NA | The amount of currency to withdraw -fee | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -addr-tag | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Transfer id - -TBC - -# Account - -TBC From b8d54d7f139048d6151ec87d1c6fced8d9aa8d2a Mon Sep 17 00:00:00 2001 From: rayxy Date: Mon, 24 Dec 2018 12:38:20 +0000 Subject: [PATCH 002/759] change the deploy logic --- deploy.sh | 27 +- {source_common => source}/fonts/slate.eot | Bin {source_common => source}/fonts/slate.svg | 0 {source_common => source}/fonts/slate.ttf | Bin {source_common => source}/fonts/slate.woff | Bin {source_common => source}/fonts/slate.woff2 | Bin {source_common => source}/images/logo.png | Bin {source_common => source}/images/navbar.png | Bin {source_common => source}/includes/_errors.md | 0 {source_v1_cn => source}/index.html.md | 0 {source_common => source}/javascripts/all.js | 0 .../javascripts/all_nosearch.js | 0 .../javascripts/app/_lang.js | 0 .../javascripts/app/_search.js | 0 .../javascripts/app/_toc.js | 0 .../javascripts/lib/_energize.js | 0 .../javascripts/lib/_imagesloaded.min.js | 0 .../javascripts/lib/_jquery.highlight.js | 0 .../javascripts/lib/_jquery.js | 0 .../javascripts/lib/_lunr.js | 0 {source_common => source}/layouts/layout.erb | 0 .../stylesheets/_icon-font.scss | 0 .../stylesheets/_normalize.scss | 0 .../stylesheets/_rtl.scss | 0 .../stylesheets/_variables.scss | 0 .../stylesheets/print.css.scss | 0 .../stylesheets/screen.css.scss | 0 source_v1_en/index.html.md | 1387 ----------------- source_v2_cn/index.html.md | 1387 ----------------- source_v2_en/index.html.md | 1387 ----------------- 30 files changed, 12 insertions(+), 4176 deletions(-) rename {source_common => source}/fonts/slate.eot (100%) rename {source_common => source}/fonts/slate.svg (100%) rename {source_common => source}/fonts/slate.ttf (100%) rename {source_common => source}/fonts/slate.woff (100%) rename {source_common => source}/fonts/slate.woff2 (100%) rename {source_common => source}/images/logo.png (100%) rename {source_common => source}/images/navbar.png (100%) rename {source_common => source}/includes/_errors.md (100%) rename {source_v1_cn => source}/index.html.md (100%) rename {source_common => source}/javascripts/all.js (100%) rename {source_common => source}/javascripts/all_nosearch.js (100%) rename {source_common => source}/javascripts/app/_lang.js (100%) rename {source_common => source}/javascripts/app/_search.js (100%) rename {source_common => source}/javascripts/app/_toc.js (100%) rename {source_common => source}/javascripts/lib/_energize.js (100%) rename {source_common => source}/javascripts/lib/_imagesloaded.min.js (100%) rename {source_common => source}/javascripts/lib/_jquery.highlight.js (100%) rename {source_common => source}/javascripts/lib/_jquery.js (100%) rename {source_common => source}/javascripts/lib/_lunr.js (100%) rename {source_common => source}/layouts/layout.erb (100%) rename {source_common => source}/stylesheets/_icon-font.scss (100%) rename {source_common => source}/stylesheets/_normalize.scss (100%) rename {source_common => source}/stylesheets/_rtl.scss (100%) rename {source_common => source}/stylesheets/_variables.scss (100%) rename {source_common => source}/stylesheets/print.css.scss (100%) rename {source_common => source}/stylesheets/screen.css.scss (100%) delete mode 100644 source_v1_en/index.html.md delete mode 100644 source_v2_cn/index.html.md delete mode 100644 source_v2_en/index.html.md diff --git a/deploy.sh b/deploy.sh index 4562bb39238..61e2a32297f 100755 --- a/deploy.sh +++ b/deploy.sh @@ -17,24 +17,11 @@ Options: commit's message. --source-only Only build but not push --push-only Only push but not build - -V, --version VERSION Specify the version to be built, possible values: [1, 2], default: 1 - -l, --language LANGUAGE Specify the language to be built, possible values: [en, cn], default: en " run_build() { - - #default version uses 1 if a custom one is not supplied - if [[ -z $version ]]; then - version="1" - fi - - #default language uses en if a custom one is not supplied - if [[ -z $language ]]; then - language="en" - fi - - bundle exec middleman build --clean --source "source_v${version}_${language}" --build-dir "build/v${version}/${language}" + bundle exec middleman build --clean --build-dir "build/v${version}/${language}" } parse_args() { @@ -73,11 +60,21 @@ parse_args() { fi done + #default version uses 1 if a custom one is not supplied + if [[ -z $version ]]; then + version="1" + fi + + #default language uses en if a custom one is not supplied + if [[ -z $language ]]; then + language="en" + fi + # Set internal option vars from the environment and arg flags. All internal # vars should be declared here, with sane defaults if applicable. # Source directory & target branch. - deploy_directory=build + deploy_directory=build/v${version}/${language} deploy_branch=gh-pages #if no user identity is already set in the current git environment, use this: diff --git a/source_common/fonts/slate.eot b/source/fonts/slate.eot similarity index 100% rename from source_common/fonts/slate.eot rename to source/fonts/slate.eot diff --git a/source_common/fonts/slate.svg b/source/fonts/slate.svg similarity index 100% rename from source_common/fonts/slate.svg rename to source/fonts/slate.svg diff --git a/source_common/fonts/slate.ttf b/source/fonts/slate.ttf similarity index 100% rename from source_common/fonts/slate.ttf rename to source/fonts/slate.ttf diff --git a/source_common/fonts/slate.woff b/source/fonts/slate.woff similarity index 100% rename from source_common/fonts/slate.woff rename to source/fonts/slate.woff diff --git a/source_common/fonts/slate.woff2 b/source/fonts/slate.woff2 similarity index 100% rename from source_common/fonts/slate.woff2 rename to source/fonts/slate.woff2 diff --git a/source_common/images/logo.png b/source/images/logo.png similarity index 100% rename from source_common/images/logo.png rename to source/images/logo.png diff --git a/source_common/images/navbar.png b/source/images/navbar.png similarity index 100% rename from source_common/images/navbar.png rename to source/images/navbar.png diff --git a/source_common/includes/_errors.md b/source/includes/_errors.md similarity index 100% rename from source_common/includes/_errors.md rename to source/includes/_errors.md diff --git a/source_v1_cn/index.html.md b/source/index.html.md similarity index 100% rename from source_v1_cn/index.html.md rename to source/index.html.md diff --git a/source_common/javascripts/all.js b/source/javascripts/all.js similarity index 100% rename from source_common/javascripts/all.js rename to source/javascripts/all.js diff --git a/source_common/javascripts/all_nosearch.js b/source/javascripts/all_nosearch.js similarity index 100% rename from source_common/javascripts/all_nosearch.js rename to source/javascripts/all_nosearch.js diff --git a/source_common/javascripts/app/_lang.js b/source/javascripts/app/_lang.js similarity index 100% rename from source_common/javascripts/app/_lang.js rename to source/javascripts/app/_lang.js diff --git a/source_common/javascripts/app/_search.js b/source/javascripts/app/_search.js similarity index 100% rename from source_common/javascripts/app/_search.js rename to source/javascripts/app/_search.js diff --git a/source_common/javascripts/app/_toc.js b/source/javascripts/app/_toc.js similarity index 100% rename from source_common/javascripts/app/_toc.js rename to source/javascripts/app/_toc.js diff --git a/source_common/javascripts/lib/_energize.js b/source/javascripts/lib/_energize.js similarity index 100% rename from source_common/javascripts/lib/_energize.js rename to source/javascripts/lib/_energize.js diff --git a/source_common/javascripts/lib/_imagesloaded.min.js b/source/javascripts/lib/_imagesloaded.min.js similarity index 100% rename from source_common/javascripts/lib/_imagesloaded.min.js rename to source/javascripts/lib/_imagesloaded.min.js diff --git a/source_common/javascripts/lib/_jquery.highlight.js b/source/javascripts/lib/_jquery.highlight.js similarity index 100% rename from source_common/javascripts/lib/_jquery.highlight.js rename to source/javascripts/lib/_jquery.highlight.js diff --git a/source_common/javascripts/lib/_jquery.js b/source/javascripts/lib/_jquery.js similarity index 100% rename from source_common/javascripts/lib/_jquery.js rename to source/javascripts/lib/_jquery.js diff --git a/source_common/javascripts/lib/_lunr.js b/source/javascripts/lib/_lunr.js similarity index 100% rename from source_common/javascripts/lib/_lunr.js rename to source/javascripts/lib/_lunr.js diff --git a/source_common/layouts/layout.erb b/source/layouts/layout.erb similarity index 100% rename from source_common/layouts/layout.erb rename to source/layouts/layout.erb diff --git a/source_common/stylesheets/_icon-font.scss b/source/stylesheets/_icon-font.scss similarity index 100% rename from source_common/stylesheets/_icon-font.scss rename to source/stylesheets/_icon-font.scss diff --git a/source_common/stylesheets/_normalize.scss b/source/stylesheets/_normalize.scss similarity index 100% rename from source_common/stylesheets/_normalize.scss rename to source/stylesheets/_normalize.scss diff --git a/source_common/stylesheets/_rtl.scss b/source/stylesheets/_rtl.scss similarity index 100% rename from source_common/stylesheets/_rtl.scss rename to source/stylesheets/_rtl.scss diff --git a/source_common/stylesheets/_variables.scss b/source/stylesheets/_variables.scss similarity index 100% rename from source_common/stylesheets/_variables.scss rename to source/stylesheets/_variables.scss diff --git a/source_common/stylesheets/print.css.scss b/source/stylesheets/print.css.scss similarity index 100% rename from source_common/stylesheets/print.css.scss rename to source/stylesheets/print.css.scss diff --git a/source_common/stylesheets/screen.css.scss b/source/stylesheets/screen.css.scss similarity index 100% rename from source_common/stylesheets/screen.css.scss rename to source/stylesheets/screen.css.scss diff --git a/source_v1_en/index.html.md b/source_v1_en/index.html.md deleted file mode 100644 index 4eb89bd578e..00000000000 --- a/source_v1_en/index.html.md +++ /dev/null @@ -1,1387 +0,0 @@ ---- -title: Huobi API Reference V1 Chinese - -language_tabs: # must be one of https://git.io/vQNgJ - - shell - -toc_footers: - - Sign Up for a Huobi API key - - Login is required for creating an API key - -includes: - -search: true ---- - -# Introduction - -Welcome to the Huobi API! You can use our API to access all market data, trading, and account management endpoints. - -We have language bindings in Shell, and Python! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right. - -# General - -## Request Format - -All API requests are in either GET or POST method. For GET request, all parameters are path parameters. For POST request, all parameters are in POST body and in JSON format. - -## Response Format - -All response will be returned in JSON format. The top level JSON is a wrapper object which provides three metadata in "status", "ch", and "ts". The actual per API response data is in "data" field. - -### Response Wrapper Content - -> Response wrapper content example: - -```json -{ - "status": "ok", - "ch": "market.btcusdt.kline.1day", - "ts": 1499223904680, - "data": // per API response data in nested JSON object -} -``` - -Parameter | Data Type | Description ---------- | --------- | ----------- -status | string | The overall API call result status -ch | string | The data channel this response was originated from. Some API return does not have this field. -ts | int | The timestamp in milliseconds for when the response is created -data | object | The actual response content per API - -## Endpoint Rate Limit - -Each apikey can send maximum of 100 https requests within 10 seconds. Please contact customer support if you believe you need higher limit rate. - -## Authentication - -Some API endpoints require authentication. To be authenticated, you should first acquire an API key and the corresponding secret key. - - - -In order to successfully sign a request, you need to follow below steps - -1. Generate the "Query String" for your query - -2. Use "Query String" and your secret key to to created a signature - -3. Add the signature as a path parameter to your query - -### Generate the "Query String" for your query - -> Add the query path section of the query string - -```shell -[HTTP Method]\n[URL Root]\n[Query Path]\n -``` - -> For example below - -```shell -GET\napi.huobi.pro\n/v1/order/orders\n -``` - -> Add the authentication section of the query string - -```shell -AccessKeyId=[Your API key]&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=[Your Request Timestamp] -``` - -> For example below - -```shell -AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-05-11T15%3A19%3A30 -``` - -> Add the parameter section of the query string, for example - -```shell -&order-id=1234567890 -``` - -> The final query string will be this - -```shell -GET\napi.huobi.pro\n/v1/order/orders\nAccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-05-11T15%3A19%3A30&order-id=1234567890 -``` - -1. Add the query path to the query string - -2. Add mandatory authentication parameters to the query string - -3. Add other path parameters to the query string ordered by parameter name (asc) - - - -### Use "Query String" and your secret key to to created a signature - -> The result signature will look like - -```shell -4F65x5A2bLyMWVQj3Aqp+B4w+ivaA7n5Oi2SuYtCJ9o= -``` - -1. Apply HmacSHA256 hash function with inputs (query string, secret key) to get the hashed string - -2. Encode the hashed string with base-64 - -### Add the signature as a path parameter to your query - -> The final request with signature will look like - -```shell -https://api.huobi.pro/v1/order/orders?AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&order-id=1234567890&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-05-11T15%3A19%3A30&Signature=4F65x5A2bLyMWVQj3Aqp%2BB4w%2BivaA7n5Oi2SuYtCJ9o%3D - -``` - -1. Add all mandatory authentication parameters to your path parameter - -2. Add "&Signature=[Your request signature with URL encode]" to your path parameter - -# Market Data - -## Get Klines(candles) - -This endpoint retrieves all klines in a specific range. - -### HTTP Request - -`GET https://api.huobi.pro/market/history/kline` - -```shell -curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" -``` - -> The above command returns JSON structured like this: - -```json -[ - { - "id": 1499184000, - "amount": 37593.0266, - "count": 0, - "open": 1935.2000, - "close": 1879.0000, - "low": 1856.0000, - "high": 1940.0000, - "vol": 71031537.97866500 - } -] -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -period | string | true | NA | The period of each candle, allowed values are: 1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year -size | integer | false | 150 | The number of data returns, range [1, 2000] - -### Response Content -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The UNIX timestamp in seconds as response id -amount | float | The aggregated trading volume in USDT -count | integer | The number of completed trades -open | float | The opening price -close | float | The closing price -low | float | The low price -high | float | The high price -vol | float | The trading volume in base currency - -## Get Latest Aggregated Ticker - -This endpoint retrieves the latest ticker with some important 24h aggregated market data. - -### HTTP Request - -`GET https://api.huobi.pro/market/detail/merged` - -```shell -curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" -``` - -> The above command returns JSON structured like this: - -```json -{ - "id":1499225271, - "ts":1499225271000, - "close":1885.0000, - "open":1960.0000, - "high":1985.0000, - "low":1856.0000, - "amount":81486.2926, - "count":42122, - "vol":157052744.85708200, - "ask":[1885.0000,21.8804], - "bid":[1884.0000,1.6702] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The UNIX timestamp in seconds as response id -amount | float | The aggregated trading volume in USDT -count | integer | The number of completed trades -open | float | The opening price of last 24 hours -close | float | The closing price of last 24 hours -low | float | The low price of last 24 hours -high | float | The high price of last 24 hours -vol | float | The trading volume in base currency of last 24 hours -bid | object | The current best bid in format [price, quote volume] -ask | object | The current best ask in format [price, quote volume] - -## Get Latest Tickers for All Pairs - -This endpoint retrieves the latest tickers for all supported pairs. - - - -### HTTP Request - -`GET https://api.huobi.pro/market/tickers` - -```shell -curl "https://api.huobi.pro/market/tickers" -``` - -> The above command returns JSON structured like this: - -```json -[ - { - "open":0.044297, // daily Kline,opennig price - "close":0.042178, // daily Kline,closing price - "low":0.040110, // daily Kline,the minimum price - "high":0.045255, // daily Kline,the maxmum price - "amount":12880.8510, - "count":12838, - "vol":563.0388715740, - "symbol":"ethbtc" - }, - { - "open":0.008545, - "close":0.008656, - "low":0.008088, - "high":0.009388, - "amount":88056.1860, - "count":16077, - "vol":771.7975953754, - "symbol":"ltcbtc" - } -] -``` - -### Query Parameters - -This endpoint does not require parameters. - -### Response Content - -Response content is an array of object, each object has below fields. - -Parameter | Data Type | Description ---------- | --------- | ----------- -amount | float | The aggregated trading volume in USDT of last 24 hours -count | integer | The number of completed trades of last 24 hours -open | float | The opening price of last 24 hours -close | float | The closing price of last 24 hours -low | float | The low price of last 24 hours -high | float | The high price of last 24 hours -vol | float | The trading volume in base currency of last 24 hours -symbol | string | The trading pair of this object, e.g. btcusdt, bccbtc - -## Get Market Depth - -This endpoint retrieves the current order book of a specific pair. - -### HTTP Request - -`GET https://api.huobi.pro/market/depth` - -```shell -curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" -``` - -> The above command returns JSON structured like this: - -```json -{ - "version": 31615842081, - "ts": 1489464585407, - "bids": [ - [7964, 0.0678], // [price, amount] - [7963, 0.9162], - [7961, 0.1], - [7960, 12.8898], - [7958, 1.2], - [7955, 2.1009], - [7954, 0.4708], - [7953, 0.0564], - [7951, 2.8031], - [7950, 13.7785], - [7949, 0.125], - [7948, 4], - [7942, 0.4337], - [7940, 6.1612], - [7936, 0.02], - [7935, 1.3575], - [7933, 2.002], - [7932, 1.3449], - [7930, 10.2974], - [7929, 3.2226] - ], - "asks": [ - [7979, 0.0736], - [7980, 1.0292], - [7981, 5.5652], - [7986, 0.2416], - [7990, 1.9970], - [7995, 0.88], - [7996, 0.0212], - [8000, 9.2609], - [8002, 0.02], - [8008, 1], - [8010, 0.8735], - [8011, 2.36], - [8012, 0.02], - [8014, 0.1067], - [8015, 12.9118], - [8016, 2.5206], - [8017, 0.0166], - [8018, 1.3218], - [8019, 0.01], - [8020, 13.6584] - ] - } -``` - -### Query Parameters - -Parameter | Data Type | Required | Allowed Value | Description ---------- | --------- | -------- | ------------- | ----------- -symbol | string | true | All supported trading pair symbols | The trading pair to query, e.g. btcusdt, bccbtc -type | string | true | step0, step1, step2, step3, step4, step5 | TBC - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -ts | integer | The UNIX timestamp in milliseconds -version | integer | TBC -bids | object | The current all bids in format [price, quote volume] -asks | object | The current all asks in format [price, quote volume] - -## Get the Last Trade - -This endpoint retrieves the latest trade with its price, volume, and direction. - -### HTTP Request - -`GET https://api.huobi.pro/market/trade` - -```shell -curl "https://api.huobi.pro/market/trade?symbol=ethusdt" -``` - -> The above command returns JSON structured like this: - -```json -{ - "id": 600848670, - "ts": 1489464451000, - "data": [ - { - "id": 600848670, - "price": 7962.62, - "amount": 0.0122, - "direction": "buy", - "ts": 1489464451000 - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The unique trade id of this trade -amount | float | The trading volume in base currency -price | float | The trading price in quote currency -ts | integer | The UNIX timestamp in milliseconds -direction | string | The direction of the trade: 'buy' or 'sell' - -## Get the Most Recent Trades - -This endpoint retrieves the most recent trades with their price, volume, and direction. - -### HTTP Request - -`GET https://api.huobi.pro/market/history/trade` - -```shell -curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" -``` - -> The above command returns JSON structured like this: - -```json -[ - { - "id":31618787514, - "ts":1544390317905, - "data":[ - { - "amount":9.000000000000000000, - "ts":1544390317905, - "id":3161878751418918529341, - "price":94.690000000000000000, - "direction":"sell" - }, - { - "amount":73.771000000000000000, - "ts":1544390317905, - "id":3161878751418918532514, - "price":94.660000000000000000, - "direction":"sell" - } - ] - }, - { - "id":31618776989, - "ts":1544390311353, - "data":[ - { - "amount":1.000000000000000000, - "ts":1544390311353, - "id":3161877698918918522622, - "price":94.710000000000000000, - "direction":"buy" - } - ] - } -] -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -size | integer | false | 1 | The number of data returns - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The unique trade id of this trade -amount | float | The trading volume in base currency -price | float | The trading price in quote currency -ts | integer | The UNIX timestamp in milliseconds -direction | string | The direction of the trade: 'buy' or 'sell' - -## Get the Last 24h Market Summary - -This endpoint retrieves the summary of trading in the market for the last 24 hours. - -### HTTP Request - -`GET https://api.huobi.pro/market/detail/` - -```shell -curl "https://api.huobi.pro/market/detail?symbol=ethusdt" -``` - -> The above command returns JSON structured like this: - -```json -{ - "amount":613071.438479561, - "open":86.21, - "close":94.35, - "high":98.7, - "id":31619471534, - "count":138909, - "low":84.63, - "version":31619471534, - "vol":5.6617373443873316E7 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The UNIX timestamp in seconds as response id -amount | float | The aggregated trading volume in USDT -count | integer | The number of completed trades -open | float | The opening price of last 24 hours -close | float | The closing price of last 24 hours -low | float | The low price of last 24 hours -high | float | The high price of last 24 hours -vol | float | The trading volume in base currency of last 24 hours -version | integer | TBC - -# Spot Trading - - - -## Place a New Trading Order - -This endpoint place an trading order and send to the exchange to be matched. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/place` - -```shell -curl "https://api.huobi.pro/v1/order/orders/place" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit"} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": "59378" -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -account-id | string | true | NA | The account id used for this spot trading -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -type | string | true | NA | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -amount | string | true | NA | The amount in quote currency to buy / the amount in base currency to sell -price | string | false | NA | The limit price of limit order -source | string | false | api | When trade with margin use 'margin-api' - -### Response Content - - - -## Show All Open Orders - -This endpoint returns all open orders which have not been filled completely. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/openOrders` - -```shell -curl "https://api.huobi.pro/v1/order/openOrders" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit"} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 5454937, - "symbol": "ethusdt", - "account-id": 30925, - "amount": "1.000000000000000000", - "price": "0.453000000000000000", - "created-at": 1530604762277, - "type": "sell-limit", - "filled-amount": "0.0", - "filled-cash-amount": "0.0", - "filled-fees": "0.0", - "source": "web", - "state": "submitted" - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -account-id | string | false | NA | The account id used for this spot trading -symbol | string | false | NA | The trading pair to trade, e.g. btcusdt, bccbtc -side | string | false | both | Filter on the direction of the trade, possible values are: buy, sell. Default is to return all -size | int | false | 10 | The max number of orders to return - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | order id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app -state | string | submitted, partical-filled, cancelling - -## Submit Cancel for an Order - -This endpoint submit a request to cancel an order. - - - -### HTTP Request - -`POST https://api.huobi.pro/v1/order/orders/{order-id}/submitcancel` - -```shell -curl "https://api.huobi.pro/v1/order/orders/59378/submitcancel" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": "59378" -} -``` - -## Submit Cancel for Multiple Orders at Once - -This endpoint submit cancellation for multiple orders at once. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/batchcancel` - -```shell -curl "https://api.huobi.pro/v1/order/orders/batchcancel" -BODY { - "order-ids": [ - "1", "2", "3" - ] -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": { - "success": [ - "1", - "3" - ], - "failed": [ - { - "err-msg": "记录无效", - "order-id": "2", - "err-code": "base-record-invalid" - } - ] - } -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -order-ids | list | true | NA | The order ids to cancel. Max size is 50. - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request - -## Submit Cancel for Multiple Orders at Once - -This endpoint submit cancellation for multiple orders at once. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/batchcancel` - -```shell -curl "https://api.huobi.pro/v1/order/orders/batchcancel" -BODY { - "order-ids": [ - "1", "2", "3" - ] -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": { - "success": [ - "1", - "3" - ], - "failed": [ - { - "err-msg": "记录无效", - "order-id": "2", - "err-code": "base-record-invalid" - } - ] - } -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -order-ids | list | true | NA | The order ids to cancel. Max size is 50. - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request - -## Show the Order Detail of One Order - -This endpoint returns the detail of one order. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/{order-id}` - -```shell -curl "https://api.huobi.pro/v1/order/orders/59378" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": { - "id": 59378, - "symbol": "ethusdt", - "account-id": 100009, - "amount": "10.1000000000", - "price": "100.1000000000", - "created-at": 1494901162595, - "type": "buy-limit", - "field-amount": "10.1000000000", - "field-cash-amount": "1011.0100000000", - "field-fees": "0.0202000000", - "finished-at": 1494901400468, - "user-id": 1000, - "source": "api", - "state": "filled", - "canceled-at": 0, - "exchange": "huobi", - "batch": "" - } -} -``` - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | order id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -account-id | string | The account id which this order belongs to -amount | string | The amount of base currency in this order -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -finished-at | int | The timestamp in milliseconds when the order was changed to a final state. This is not the time the order is matched. -canceled-at | int | The timestamp in milliseconds when the order was canceled, if not canceled then has value of 0 -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app -state | string | Order state: submitted, partical-filled, cancelling, filled, canceled -exchange | string | Internal data -batch | string | Internal data - -## Show the Match Result of an Order - -This endpoint returns the match result of an order. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/{order-id}/matchresult` - -```shell -curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 29553, - "order-id": 59378, - "match-id": 59335, - "symbol": "ethusdt", - "type": "buy-limit", - "source": "api", - "price": "100.1000000000", - "filled-amount": "9.1155000000", - "filled-fees": "0.0182310000", - "created-at": 1494901400435 - } - ] -} -``` - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Internal id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -order-id | string | The order id of this order -match-id | string | The match id of this match -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the match and fill is done -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app - -## Search Past Orders - -This endpoint returns orders based on a specific searching criteria. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders` - -```shell -curl "https://api.huobi.pro/v1/order/orders" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" - } -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 59378, - "symbol": "ethusdt", - "account-id": 100009, - "amount": "10.1000000000", - "price": "100.1000000000", - "created-at": 1494901162595, - "type": "buy-limit", - "field-amount": "10.1000000000", - "field-cash-amount": "1011.0100000000", - "field-fees": "0.0202000000", - "finished-at": 1494901400468, - "user-id": 1000, - "source": "api", - "state": "filled", - "canceled-at": 0, - "exchange": "huobi", - "batch": "" - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -types | string | false | All | The types of order to include in the search -states | string | false | All | The states of order to include in the search -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd -from | string | false | both | Search order id to begin with -direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' -size | int | false | 100 | The max number of orders to return, max value is 100 - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Order id -account-id | integer | Account id -user-id | integer | User id -amount | string | The amount of base currency in this order -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -canceled-at | int | The timestamp in milliseconds when the order was canceled, or 0 if not canceled -canceled-at | int | The timestamp in milliseconds when the order was finished, or 0 if not finished -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app -state | string | submitted, partical-filled, cancelling -exchange | string | Internal data -batch | string | Internal data - -## Search the Match Results - -This endpoint returns the match results of past and open orders based on specific search criteria. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/matchresults` - -```shell -curl "https://api.huobi.pro/v1/order/matchresults" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 29553, - "order-id": 59378, - "match-id": 59335, - "symbol": "ethusdt", - "type": "buy-limit", - "source": "api", - "price": "100.1000000000", - "filled-amount": "9.1155000000", - "filled-fees": "0.0182310000", - "created-at": 1494901400435 - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -types | string | false | All | The types of order to include in the search -states | string | false | All | The states of order to include in the search -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd -from | string | false | NA | Search match result id to begin with -direct | string | false | next | Search direction when 'from' is used, possible values: 'next', 'prev' -size | int | false | 100 | The max number of orders to return - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Internal id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -order-id | string | The order id of this order -match-id | string | The match id of this match -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the match and fill is done -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app - -# Margin Trading - - - - - - - -## Transfer Asset from Spot Trading Account to Margin Account - -This endpoint transfer specific asset from spot trading account to margin account. - -### HTTP Request - -`GET https://api.huobi.pro/v1/dw/transfer-in` - -```shell -curl "https://api.huobi.pro/v1/dw/transfer-in" -BODY -{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Transfer id - -## Transfer Asset from Margin Account to Spot Trading Account - -This endpoint transfer specific asset from margin account to spot trading account. - -### HTTP Request - -`GET https://api.huobi.pro/v1/dw/transfer-out` - -```shell -curl "https://api.huobi.pro/v1/dw/transfer-out" -BODY -{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Transfer id - -## Place a Margin Loan Order - -This endpoint place an order to initiate a margin loan. - -### HTTP Request - -`GET https://api.huobi.pro/v1/margin/orders` - -```shell -curl "https://api.huobi.pro/v1/margin/orders" -BODY -{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Margin order id - -## Repay Margin Loan - -This endpoint repays margin loan with you asset in your margin account. - -### HTTP Request - -`POST https://api.huobi.pro/v1/margin/orders/{order-id}/repay` - -```shell -curl "https://api.huobi.pro/v1/margin/orders/1000/repay" -BODY -{ - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -amount | string | true | NA | The amount of currency to repay - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Margin order id - -## Search Past Margin Orders - -This endpoint returns margin orders based on a specific searching criteria. - -### HTTP Request - -`GET https://api.huobi.pro/v1/margin/loan-orders` - -```shell -curl "https://api.huobi.pro/v1/margin/load-orders" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" - } -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "loan-balance": "0.100000000000000000", - "interest-balance": "0.000200000000000000", - "interest-rate": "0.002000000000000000", - "loan-amount": "0.100000000000000000", - "accrued-at": 1511169724531, - "interest-amount": "0.000200000000000000", - "symbol": "ethbtc", - "currency": "btc", - "id": 394, - "state": "accrual", - "account-id": 17747, - "user-id": 119913, - "created-at": 1511169724531 - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -states | string | false | All | The states of order to include in the search -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd -from | string | false | both | Search order id to begin with -direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' -size | int | false | 100 | The max number of orders to return, max value is 100 - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Order id -account-id | integer | Account id -user-id | integer | User id -symbol | string | The margin loan pair to trade, e.g. btcusdt, bccbtc -currency | string | The currency in the loan -created-at | int | The timestamp in milliseconds when the order was created -accrued-at | int | The timestamp in milliseconds when the last accure happened -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -loan-amount | string | The amount of the origin loan -loan-balance | string | The amount of the loan left -interest-rate | string | The loan interest rate -interest-amount | string | The accumulated loan interest -interest-balance | string | The amount of loan interest left -state | string | Loan state, possible values: created, accrual, cleared, invalid - -## Return the Balance of the Margin Loan Account - -This endpoint returns the balance of the margin loan account. - -### HTTP Request - -`GET https://api.huobi.pro/v1/margin/accounts/balance` - -```shell -curl "https://api.huobi.pro/v1/margin/accounts/balance" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" - } -``` - -> The above command returns JSON structured like this: - -```json -{ -"data": [ - { - "id": 18264, - "type": "margin", - "state": "working", - "symbol": "btcusdt", - "fl-price": "0", - "fl-type": "safe", - "risk-rate": "475.952571086994250554", - "list": [ - { - "currency": "btc", - "type": "trade", - "balance": "1168.533000000000000000" - }, - { - "currency": "btc", - "type": "frozen", - "balance": "0.000000000000000000" - }, - { - "currency": "btc", - "type": "loan", - "balance": "-2.433000000000000000" - }, - { - "currency": "btc", - "type": "interest", - "balance": "-0.000533000000000000" - }, - { - "currency": "btc", - "type": "transfer-out-available",//可转btc - "balance": "1163.872174670000000000" - }, - { - "currency": "btc", - "type": "loan-available",//可借btc - "balance": "8161.876538350676000000" - } - ] - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -symbol | string | The margin loan pair, e.g. btcusdt, bccbtc -state | string | Loan state, possible values: created, accrual, cleared, invalid -risk-rate | string | The risk rate -fl-price | string | The price which triggers closeout -list | object array | The list of loans and their details - -# Wallet (Deposit and Withdraw) - -TBC - -# Account - -TBC diff --git a/source_v2_cn/index.html.md b/source_v2_cn/index.html.md deleted file mode 100644 index 131196a0c17..00000000000 --- a/source_v2_cn/index.html.md +++ /dev/null @@ -1,1387 +0,0 @@ ---- -title: Huobi API Reference V2 English - -language_tabs: # must be one of https://git.io/vQNgJ - - shell - -toc_footers: - - Sign Up for a Huobi API key - - Login is required for creating an API key - -includes: - -search: true ---- - -# Introduction - -Welcome to the Huobi API! You can use our API to access all market data, trading, and account management endpoints. - -We have language bindings in Shell, and Python! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right. - -# General - -## Request Format - -All API requests are in either GET or POST method. For GET request, all parameters are path parameters. For POST request, all parameters are in POST body and in JSON format. - -## Response Format - -All response will be returned in JSON format. The top level JSON is a wrapper object which provides three metadata in "status", "ch", and "ts". The actual per API response data is in "data" field. - -### Response Wrapper Content - -> Response wrapper content example: - -```json -{ - "status": "ok", - "ch": "market.btcusdt.kline.1day", - "ts": 1499223904680, - "data": // per API response data in nested JSON object -} -``` - -Parameter | Data Type | Description ---------- | --------- | ----------- -status | string | The overall API call result status -ch | string | The data channel this response was originated from. Some API return does not have this field. -ts | int | The timestamp in milliseconds for when the response is created -data | object | The actual response content per API - -## Endpoint Rate Limit - -Each apikey can send maximum of 100 https requests within 10 seconds. Please contact customer support if you believe you need higher limit rate. - -## Authentication - -Some API endpoints require authentication. To be authenticated, you should first acquire an API key and the corresponding secret key. - - - -In order to successfully sign a request, you need to follow below steps - -1. Generate the "Query String" for your query - -2. Use "Query String" and your secret key to to created a signature - -3. Add the signature as a path parameter to your query - -### Generate the "Query String" for your query - -> Add the query path section of the query string - -```shell -[HTTP Method]\n[URL Root]\n[Query Path]\n -``` - -> For example below - -```shell -GET\napi.huobi.pro\n/v1/order/orders\n -``` - -> Add the authentication section of the query string - -```shell -AccessKeyId=[Your API key]&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=[Your Request Timestamp] -``` - -> For example below - -```shell -AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-05-11T15%3A19%3A30 -``` - -> Add the parameter section of the query string, for example - -```shell -&order-id=1234567890 -``` - -> The final query string will be this - -```shell -GET\napi.huobi.pro\n/v1/order/orders\nAccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-05-11T15%3A19%3A30&order-id=1234567890 -``` - -1. Add the query path to the query string - -2. Add mandatory authentication parameters to the query string - -3. Add other path parameters to the query string ordered by parameter name (asc) - - - -### Use "Query String" and your secret key to to created a signature - -> The result signature will look like - -```shell -4F65x5A2bLyMWVQj3Aqp+B4w+ivaA7n5Oi2SuYtCJ9o= -``` - -1. Apply HmacSHA256 hash function with inputs (query string, secret key) to get the hashed string - -2. Encode the hashed string with base-64 - -### Add the signature as a path parameter to your query - -> The final request with signature will look like - -```shell -https://api.huobi.pro/v1/order/orders?AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&order-id=1234567890&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-05-11T15%3A19%3A30&Signature=4F65x5A2bLyMWVQj3Aqp%2BB4w%2BivaA7n5Oi2SuYtCJ9o%3D - -``` - -1. Add all mandatory authentication parameters to your path parameter - -2. Add "&Signature=[Your request signature with URL encode]" to your path parameter - -# Market Data - -## Get Klines(candles) - -This endpoint retrieves all klines in a specific range. - -### HTTP Request - -`GET https://api.huobi.pro/market/history/kline` - -```shell -curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" -``` - -> The above command returns JSON structured like this: - -```json -[ - { - "id": 1499184000, - "amount": 37593.0266, - "count": 0, - "open": 1935.2000, - "close": 1879.0000, - "low": 1856.0000, - "high": 1940.0000, - "vol": 71031537.97866500 - } -] -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -period | string | true | NA | The period of each candle, allowed values are: 1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year -size | integer | false | 150 | The number of data returns, range [1, 2000] - -### Response Content -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The UNIX timestamp in seconds as response id -amount | float | The aggregated trading volume in USDT -count | integer | The number of completed trades -open | float | The opening price -close | float | The closing price -low | float | The low price -high | float | The high price -vol | float | The trading volume in base currency - -## Get Latest Aggregated Ticker - -This endpoint retrieves the latest ticker with some important 24h aggregated market data. - -### HTTP Request - -`GET https://api.huobi.pro/market/detail/merged` - -```shell -curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" -``` - -> The above command returns JSON structured like this: - -```json -{ - "id":1499225271, - "ts":1499225271000, - "close":1885.0000, - "open":1960.0000, - "high":1985.0000, - "low":1856.0000, - "amount":81486.2926, - "count":42122, - "vol":157052744.85708200, - "ask":[1885.0000,21.8804], - "bid":[1884.0000,1.6702] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The UNIX timestamp in seconds as response id -amount | float | The aggregated trading volume in USDT -count | integer | The number of completed trades -open | float | The opening price of last 24 hours -close | float | The closing price of last 24 hours -low | float | The low price of last 24 hours -high | float | The high price of last 24 hours -vol | float | The trading volume in base currency of last 24 hours -bid | object | The current best bid in format [price, quote volume] -ask | object | The current best ask in format [price, quote volume] - -## Get Latest Tickers for All Pairs - -This endpoint retrieves the latest tickers for all supported pairs. - - - -### HTTP Request - -`GET https://api.huobi.pro/market/tickers` - -```shell -curl "https://api.huobi.pro/market/tickers" -``` - -> The above command returns JSON structured like this: - -```json -[ - { - "open":0.044297, // daily Kline,opennig price - "close":0.042178, // daily Kline,closing price - "low":0.040110, // daily Kline,the minimum price - "high":0.045255, // daily Kline,the maxmum price - "amount":12880.8510, - "count":12838, - "vol":563.0388715740, - "symbol":"ethbtc" - }, - { - "open":0.008545, - "close":0.008656, - "low":0.008088, - "high":0.009388, - "amount":88056.1860, - "count":16077, - "vol":771.7975953754, - "symbol":"ltcbtc" - } -] -``` - -### Query Parameters - -This endpoint does not require parameters. - -### Response Content - -Response content is an array of object, each object has below fields. - -Parameter | Data Type | Description ---------- | --------- | ----------- -amount | float | The aggregated trading volume in USDT of last 24 hours -count | integer | The number of completed trades of last 24 hours -open | float | The opening price of last 24 hours -close | float | The closing price of last 24 hours -low | float | The low price of last 24 hours -high | float | The high price of last 24 hours -vol | float | The trading volume in base currency of last 24 hours -symbol | string | The trading pair of this object, e.g. btcusdt, bccbtc - -## Get Market Depth - -This endpoint retrieves the current order book of a specific pair. - -### HTTP Request - -`GET https://api.huobi.pro/market/depth` - -```shell -curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" -``` - -> The above command returns JSON structured like this: - -```json -{ - "version": 31615842081, - "ts": 1489464585407, - "bids": [ - [7964, 0.0678], // [price, amount] - [7963, 0.9162], - [7961, 0.1], - [7960, 12.8898], - [7958, 1.2], - [7955, 2.1009], - [7954, 0.4708], - [7953, 0.0564], - [7951, 2.8031], - [7950, 13.7785], - [7949, 0.125], - [7948, 4], - [7942, 0.4337], - [7940, 6.1612], - [7936, 0.02], - [7935, 1.3575], - [7933, 2.002], - [7932, 1.3449], - [7930, 10.2974], - [7929, 3.2226] - ], - "asks": [ - [7979, 0.0736], - [7980, 1.0292], - [7981, 5.5652], - [7986, 0.2416], - [7990, 1.9970], - [7995, 0.88], - [7996, 0.0212], - [8000, 9.2609], - [8002, 0.02], - [8008, 1], - [8010, 0.8735], - [8011, 2.36], - [8012, 0.02], - [8014, 0.1067], - [8015, 12.9118], - [8016, 2.5206], - [8017, 0.0166], - [8018, 1.3218], - [8019, 0.01], - [8020, 13.6584] - ] - } -``` - -### Query Parameters - -Parameter | Data Type | Required | Allowed Value | Description ---------- | --------- | -------- | ------------- | ----------- -symbol | string | true | All supported trading pair symbols | The trading pair to query, e.g. btcusdt, bccbtc -type | string | true | step0, step1, step2, step3, step4, step5 | TBC - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -ts | integer | The UNIX timestamp in milliseconds -version | integer | TBC -bids | object | The current all bids in format [price, quote volume] -asks | object | The current all asks in format [price, quote volume] - -## Get the Last Trade - -This endpoint retrieves the latest trade with its price, volume, and direction. - -### HTTP Request - -`GET https://api.huobi.pro/market/trade` - -```shell -curl "https://api.huobi.pro/market/trade?symbol=ethusdt" -``` - -> The above command returns JSON structured like this: - -```json -{ - "id": 600848670, - "ts": 1489464451000, - "data": [ - { - "id": 600848670, - "price": 7962.62, - "amount": 0.0122, - "direction": "buy", - "ts": 1489464451000 - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The unique trade id of this trade -amount | float | The trading volume in base currency -price | float | The trading price in quote currency -ts | integer | The UNIX timestamp in milliseconds -direction | string | The direction of the trade: 'buy' or 'sell' - -## Get the Most Recent Trades - -This endpoint retrieves the most recent trades with their price, volume, and direction. - -### HTTP Request - -`GET https://api.huobi.pro/market/history/trade` - -```shell -curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" -``` - -> The above command returns JSON structured like this: - -```json -[ - { - "id":31618787514, - "ts":1544390317905, - "data":[ - { - "amount":9.000000000000000000, - "ts":1544390317905, - "id":3161878751418918529341, - "price":94.690000000000000000, - "direction":"sell" - }, - { - "amount":73.771000000000000000, - "ts":1544390317905, - "id":3161878751418918532514, - "price":94.660000000000000000, - "direction":"sell" - } - ] - }, - { - "id":31618776989, - "ts":1544390311353, - "data":[ - { - "amount":1.000000000000000000, - "ts":1544390311353, - "id":3161877698918918522622, - "price":94.710000000000000000, - "direction":"buy" - } - ] - } -] -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -size | integer | false | 1 | The number of data returns - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The unique trade id of this trade -amount | float | The trading volume in base currency -price | float | The trading price in quote currency -ts | integer | The UNIX timestamp in milliseconds -direction | string | The direction of the trade: 'buy' or 'sell' - -## Get the Last 24h Market Summary - -This endpoint retrieves the summary of trading in the market for the last 24 hours. - -### HTTP Request - -`GET https://api.huobi.pro/market/detail/` - -```shell -curl "https://api.huobi.pro/market/detail?symbol=ethusdt" -``` - -> The above command returns JSON structured like this: - -```json -{ - "amount":613071.438479561, - "open":86.21, - "close":94.35, - "high":98.7, - "id":31619471534, - "count":138909, - "low":84.63, - "version":31619471534, - "vol":5.6617373443873316E7 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The UNIX timestamp in seconds as response id -amount | float | The aggregated trading volume in USDT -count | integer | The number of completed trades -open | float | The opening price of last 24 hours -close | float | The closing price of last 24 hours -low | float | The low price of last 24 hours -high | float | The high price of last 24 hours -vol | float | The trading volume in base currency of last 24 hours -version | integer | TBC - -# Spot Trading - - - -## Place a New Trading Order - -This endpoint place an trading order and send to the exchange to be matched. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/place` - -```shell -curl "https://api.huobi.pro/v1/order/orders/place" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit"} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": "59378" -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -account-id | string | true | NA | The account id used for this spot trading -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -type | string | true | NA | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -amount | string | true | NA | The amount in quote currency to buy / the amount in base currency to sell -price | string | false | NA | The limit price of limit order -source | string | false | api | When trade with margin use 'margin-api' - -### Response Content - - - -## Show All Open Orders - -This endpoint returns all open orders which have not been filled completely. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/openOrders` - -```shell -curl "https://api.huobi.pro/v1/order/openOrders" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit"} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 5454937, - "symbol": "ethusdt", - "account-id": 30925, - "amount": "1.000000000000000000", - "price": "0.453000000000000000", - "created-at": 1530604762277, - "type": "sell-limit", - "filled-amount": "0.0", - "filled-cash-amount": "0.0", - "filled-fees": "0.0", - "source": "web", - "state": "submitted" - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -account-id | string | false | NA | The account id used for this spot trading -symbol | string | false | NA | The trading pair to trade, e.g. btcusdt, bccbtc -side | string | false | both | Filter on the direction of the trade, possible values are: buy, sell. Default is to return all -size | int | false | 10 | The max number of orders to return - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | order id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app -state | string | submitted, partical-filled, cancelling - -## Submit Cancel for an Order - -This endpoint submit a request to cancel an order. - - - -### HTTP Request - -`POST https://api.huobi.pro/v1/order/orders/{order-id}/submitcancel` - -```shell -curl "https://api.huobi.pro/v1/order/orders/59378/submitcancel" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": "59378" -} -``` - -## Submit Cancel for Multiple Orders at Once - -This endpoint submit cancellation for multiple orders at once. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/batchcancel` - -```shell -curl "https://api.huobi.pro/v1/order/orders/batchcancel" -BODY { - "order-ids": [ - "1", "2", "3" - ] -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": { - "success": [ - "1", - "3" - ], - "failed": [ - { - "err-msg": "记录无效", - "order-id": "2", - "err-code": "base-record-invalid" - } - ] - } -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -order-ids | list | true | NA | The order ids to cancel. Max size is 50. - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request - -## Submit Cancel for Multiple Orders at Once - -This endpoint submit cancellation for multiple orders at once. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/batchcancel` - -```shell -curl "https://api.huobi.pro/v1/order/orders/batchcancel" -BODY { - "order-ids": [ - "1", "2", "3" - ] -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": { - "success": [ - "1", - "3" - ], - "failed": [ - { - "err-msg": "记录无效", - "order-id": "2", - "err-code": "base-record-invalid" - } - ] - } -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -order-ids | list | true | NA | The order ids to cancel. Max size is 50. - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request - -## Show the Order Detail of One Order - -This endpoint returns the detail of one order. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/{order-id}` - -```shell -curl "https://api.huobi.pro/v1/order/orders/59378" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": { - "id": 59378, - "symbol": "ethusdt", - "account-id": 100009, - "amount": "10.1000000000", - "price": "100.1000000000", - "created-at": 1494901162595, - "type": "buy-limit", - "field-amount": "10.1000000000", - "field-cash-amount": "1011.0100000000", - "field-fees": "0.0202000000", - "finished-at": 1494901400468, - "user-id": 1000, - "source": "api", - "state": "filled", - "canceled-at": 0, - "exchange": "huobi", - "batch": "" - } -} -``` - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | order id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -account-id | string | The account id which this order belongs to -amount | string | The amount of base currency in this order -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -finished-at | int | The timestamp in milliseconds when the order was changed to a final state. This is not the time the order is matched. -canceled-at | int | The timestamp in milliseconds when the order was canceled, if not canceled then has value of 0 -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app -state | string | Order state: submitted, partical-filled, cancelling, filled, canceled -exchange | string | Internal data -batch | string | Internal data - -## Show the Match Result of an Order - -This endpoint returns the match result of an order. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/{order-id}/matchresult` - -```shell -curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 29553, - "order-id": 59378, - "match-id": 59335, - "symbol": "ethusdt", - "type": "buy-limit", - "source": "api", - "price": "100.1000000000", - "filled-amount": "9.1155000000", - "filled-fees": "0.0182310000", - "created-at": 1494901400435 - } - ] -} -``` - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Internal id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -order-id | string | The order id of this order -match-id | string | The match id of this match -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the match and fill is done -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app - -## Search Past Orders - -This endpoint returns orders based on a specific searching criteria. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders` - -```shell -curl "https://api.huobi.pro/v1/order/orders" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" - } -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 59378, - "symbol": "ethusdt", - "account-id": 100009, - "amount": "10.1000000000", - "price": "100.1000000000", - "created-at": 1494901162595, - "type": "buy-limit", - "field-amount": "10.1000000000", - "field-cash-amount": "1011.0100000000", - "field-fees": "0.0202000000", - "finished-at": 1494901400468, - "user-id": 1000, - "source": "api", - "state": "filled", - "canceled-at": 0, - "exchange": "huobi", - "batch": "" - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -types | string | false | All | The types of order to include in the search -states | string | false | All | The states of order to include in the search -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd -from | string | false | both | Search order id to begin with -direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' -size | int | false | 100 | The max number of orders to return, max value is 100 - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Order id -account-id | integer | Account id -user-id | integer | User id -amount | string | The amount of base currency in this order -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -canceled-at | int | The timestamp in milliseconds when the order was canceled, or 0 if not canceled -canceled-at | int | The timestamp in milliseconds when the order was finished, or 0 if not finished -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app -state | string | submitted, partical-filled, cancelling -exchange | string | Internal data -batch | string | Internal data - -## Search the Match Results - -This endpoint returns the match results of past and open orders based on specific search criteria. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/matchresults` - -```shell -curl "https://api.huobi.pro/v1/order/matchresults" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 29553, - "order-id": 59378, - "match-id": 59335, - "symbol": "ethusdt", - "type": "buy-limit", - "source": "api", - "price": "100.1000000000", - "filled-amount": "9.1155000000", - "filled-fees": "0.0182310000", - "created-at": 1494901400435 - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -types | string | false | All | The types of order to include in the search -states | string | false | All | The states of order to include in the search -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd -from | string | false | NA | Search match result id to begin with -direct | string | false | next | Search direction when 'from' is used, possible values: 'next', 'prev' -size | int | false | 100 | The max number of orders to return - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Internal id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -order-id | string | The order id of this order -match-id | string | The match id of this match -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the match and fill is done -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app - -# Margin Trading - - - - - - - -## Transfer Asset from Spot Trading Account to Margin Account - -This endpoint transfer specific asset from spot trading account to margin account. - -### HTTP Request - -`GET https://api.huobi.pro/v1/dw/transfer-in` - -```shell -curl "https://api.huobi.pro/v1/dw/transfer-in" -BODY -{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Transfer id - -## Transfer Asset from Margin Account to Spot Trading Account - -This endpoint transfer specific asset from margin account to spot trading account. - -### HTTP Request - -`GET https://api.huobi.pro/v1/dw/transfer-out` - -```shell -curl "https://api.huobi.pro/v1/dw/transfer-out" -BODY -{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Transfer id - -## Place a Margin Loan Order - -This endpoint place an order to initiate a margin loan. - -### HTTP Request - -`GET https://api.huobi.pro/v1/margin/orders` - -```shell -curl "https://api.huobi.pro/v1/margin/orders" -BODY -{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Margin order id - -## Repay Margin Loan - -This endpoint repays margin loan with you asset in your margin account. - -### HTTP Request - -`POST https://api.huobi.pro/v1/margin/orders/{order-id}/repay` - -```shell -curl "https://api.huobi.pro/v1/margin/orders/1000/repay" -BODY -{ - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -amount | string | true | NA | The amount of currency to repay - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Margin order id - -## Search Past Margin Orders - -This endpoint returns margin orders based on a specific searching criteria. - -### HTTP Request - -`GET https://api.huobi.pro/v1/margin/loan-orders` - -```shell -curl "https://api.huobi.pro/v1/margin/load-orders" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" - } -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "loan-balance": "0.100000000000000000", - "interest-balance": "0.000200000000000000", - "interest-rate": "0.002000000000000000", - "loan-amount": "0.100000000000000000", - "accrued-at": 1511169724531, - "interest-amount": "0.000200000000000000", - "symbol": "ethbtc", - "currency": "btc", - "id": 394, - "state": "accrual", - "account-id": 17747, - "user-id": 119913, - "created-at": 1511169724531 - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -states | string | false | All | The states of order to include in the search -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd -from | string | false | both | Search order id to begin with -direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' -size | int | false | 100 | The max number of orders to return, max value is 100 - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Order id -account-id | integer | Account id -user-id | integer | User id -symbol | string | The margin loan pair to trade, e.g. btcusdt, bccbtc -currency | string | The currency in the loan -created-at | int | The timestamp in milliseconds when the order was created -accrued-at | int | The timestamp in milliseconds when the last accure happened -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -loan-amount | string | The amount of the origin loan -loan-balance | string | The amount of the loan left -interest-rate | string | The loan interest rate -interest-amount | string | The accumulated loan interest -interest-balance | string | The amount of loan interest left -state | string | Loan state, possible values: created, accrual, cleared, invalid - -## Return the Balance of the Margin Loan Account - -This endpoint returns the balance of the margin loan account. - -### HTTP Request - -`GET https://api.huobi.pro/v1/margin/accounts/balance` - -```shell -curl "https://api.huobi.pro/v1/margin/accounts/balance" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" - } -``` - -> The above command returns JSON structured like this: - -```json -{ -"data": [ - { - "id": 18264, - "type": "margin", - "state": "working", - "symbol": "btcusdt", - "fl-price": "0", - "fl-type": "safe", - "risk-rate": "475.952571086994250554", - "list": [ - { - "currency": "btc", - "type": "trade", - "balance": "1168.533000000000000000" - }, - { - "currency": "btc", - "type": "frozen", - "balance": "0.000000000000000000" - }, - { - "currency": "btc", - "type": "loan", - "balance": "-2.433000000000000000" - }, - { - "currency": "btc", - "type": "interest", - "balance": "-0.000533000000000000" - }, - { - "currency": "btc", - "type": "transfer-out-available",//可转btc - "balance": "1163.872174670000000000" - }, - { - "currency": "btc", - "type": "loan-available",//可借btc - "balance": "8161.876538350676000000" - } - ] - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -symbol | string | The margin loan pair, e.g. btcusdt, bccbtc -state | string | Loan state, possible values: created, accrual, cleared, invalid -risk-rate | string | The risk rate -fl-price | string | The price which triggers closeout -list | object array | The list of loans and their details - -# Wallet (Deposit and Withdraw) - -TBC - -# Account - -TBC diff --git a/source_v2_en/index.html.md b/source_v2_en/index.html.md deleted file mode 100644 index 35707f59c51..00000000000 --- a/source_v2_en/index.html.md +++ /dev/null @@ -1,1387 +0,0 @@ ---- -title: Huobi API Reference V2 Chinese - -language_tabs: # must be one of https://git.io/vQNgJ - - shell - -toc_footers: - - Sign Up for a Huobi API key - - Login is required for creating an API key - -includes: - -search: true ---- - -# Introduction - -Welcome to the Huobi API! You can use our API to access all market data, trading, and account management endpoints. - -We have language bindings in Shell, and Python! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right. - -# General - -## Request Format - -All API requests are in either GET or POST method. For GET request, all parameters are path parameters. For POST request, all parameters are in POST body and in JSON format. - -## Response Format - -All response will be returned in JSON format. The top level JSON is a wrapper object which provides three metadata in "status", "ch", and "ts". The actual per API response data is in "data" field. - -### Response Wrapper Content - -> Response wrapper content example: - -```json -{ - "status": "ok", - "ch": "market.btcusdt.kline.1day", - "ts": 1499223904680, - "data": // per API response data in nested JSON object -} -``` - -Parameter | Data Type | Description ---------- | --------- | ----------- -status | string | The overall API call result status -ch | string | The data channel this response was originated from. Some API return does not have this field. -ts | int | The timestamp in milliseconds for when the response is created -data | object | The actual response content per API - -## Endpoint Rate Limit - -Each apikey can send maximum of 100 https requests within 10 seconds. Please contact customer support if you believe you need higher limit rate. - -## Authentication - -Some API endpoints require authentication. To be authenticated, you should first acquire an API key and the corresponding secret key. - - - -In order to successfully sign a request, you need to follow below steps - -1. Generate the "Query String" for your query - -2. Use "Query String" and your secret key to to created a signature - -3. Add the signature as a path parameter to your query - -### Generate the "Query String" for your query - -> Add the query path section of the query string - -```shell -[HTTP Method]\n[URL Root]\n[Query Path]\n -``` - -> For example below - -```shell -GET\napi.huobi.pro\n/v1/order/orders\n -``` - -> Add the authentication section of the query string - -```shell -AccessKeyId=[Your API key]&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=[Your Request Timestamp] -``` - -> For example below - -```shell -AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-05-11T15%3A19%3A30 -``` - -> Add the parameter section of the query string, for example - -```shell -&order-id=1234567890 -``` - -> The final query string will be this - -```shell -GET\napi.huobi.pro\n/v1/order/orders\nAccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-05-11T15%3A19%3A30&order-id=1234567890 -``` - -1. Add the query path to the query string - -2. Add mandatory authentication parameters to the query string - -3. Add other path parameters to the query string ordered by parameter name (asc) - - - -### Use "Query String" and your secret key to to created a signature - -> The result signature will look like - -```shell -4F65x5A2bLyMWVQj3Aqp+B4w+ivaA7n5Oi2SuYtCJ9o= -``` - -1. Apply HmacSHA256 hash function with inputs (query string, secret key) to get the hashed string - -2. Encode the hashed string with base-64 - -### Add the signature as a path parameter to your query - -> The final request with signature will look like - -```shell -https://api.huobi.pro/v1/order/orders?AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&order-id=1234567890&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-05-11T15%3A19%3A30&Signature=4F65x5A2bLyMWVQj3Aqp%2BB4w%2BivaA7n5Oi2SuYtCJ9o%3D - -``` - -1. Add all mandatory authentication parameters to your path parameter - -2. Add "&Signature=[Your request signature with URL encode]" to your path parameter - -# Market Data - -## Get Klines(candles) - -This endpoint retrieves all klines in a specific range. - -### HTTP Request - -`GET https://api.huobi.pro/market/history/kline` - -```shell -curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" -``` - -> The above command returns JSON structured like this: - -```json -[ - { - "id": 1499184000, - "amount": 37593.0266, - "count": 0, - "open": 1935.2000, - "close": 1879.0000, - "low": 1856.0000, - "high": 1940.0000, - "vol": 71031537.97866500 - } -] -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -period | string | true | NA | The period of each candle, allowed values are: 1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year -size | integer | false | 150 | The number of data returns, range [1, 2000] - -### Response Content -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The UNIX timestamp in seconds as response id -amount | float | The aggregated trading volume in USDT -count | integer | The number of completed trades -open | float | The opening price -close | float | The closing price -low | float | The low price -high | float | The high price -vol | float | The trading volume in base currency - -## Get Latest Aggregated Ticker - -This endpoint retrieves the latest ticker with some important 24h aggregated market data. - -### HTTP Request - -`GET https://api.huobi.pro/market/detail/merged` - -```shell -curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" -``` - -> The above command returns JSON structured like this: - -```json -{ - "id":1499225271, - "ts":1499225271000, - "close":1885.0000, - "open":1960.0000, - "high":1985.0000, - "low":1856.0000, - "amount":81486.2926, - "count":42122, - "vol":157052744.85708200, - "ask":[1885.0000,21.8804], - "bid":[1884.0000,1.6702] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The UNIX timestamp in seconds as response id -amount | float | The aggregated trading volume in USDT -count | integer | The number of completed trades -open | float | The opening price of last 24 hours -close | float | The closing price of last 24 hours -low | float | The low price of last 24 hours -high | float | The high price of last 24 hours -vol | float | The trading volume in base currency of last 24 hours -bid | object | The current best bid in format [price, quote volume] -ask | object | The current best ask in format [price, quote volume] - -## Get Latest Tickers for All Pairs - -This endpoint retrieves the latest tickers for all supported pairs. - - - -### HTTP Request - -`GET https://api.huobi.pro/market/tickers` - -```shell -curl "https://api.huobi.pro/market/tickers" -``` - -> The above command returns JSON structured like this: - -```json -[ - { - "open":0.044297, // daily Kline,opennig price - "close":0.042178, // daily Kline,closing price - "low":0.040110, // daily Kline,the minimum price - "high":0.045255, // daily Kline,the maxmum price - "amount":12880.8510, - "count":12838, - "vol":563.0388715740, - "symbol":"ethbtc" - }, - { - "open":0.008545, - "close":0.008656, - "low":0.008088, - "high":0.009388, - "amount":88056.1860, - "count":16077, - "vol":771.7975953754, - "symbol":"ltcbtc" - } -] -``` - -### Query Parameters - -This endpoint does not require parameters. - -### Response Content - -Response content is an array of object, each object has below fields. - -Parameter | Data Type | Description ---------- | --------- | ----------- -amount | float | The aggregated trading volume in USDT of last 24 hours -count | integer | The number of completed trades of last 24 hours -open | float | The opening price of last 24 hours -close | float | The closing price of last 24 hours -low | float | The low price of last 24 hours -high | float | The high price of last 24 hours -vol | float | The trading volume in base currency of last 24 hours -symbol | string | The trading pair of this object, e.g. btcusdt, bccbtc - -## Get Market Depth - -This endpoint retrieves the current order book of a specific pair. - -### HTTP Request - -`GET https://api.huobi.pro/market/depth` - -```shell -curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" -``` - -> The above command returns JSON structured like this: - -```json -{ - "version": 31615842081, - "ts": 1489464585407, - "bids": [ - [7964, 0.0678], // [price, amount] - [7963, 0.9162], - [7961, 0.1], - [7960, 12.8898], - [7958, 1.2], - [7955, 2.1009], - [7954, 0.4708], - [7953, 0.0564], - [7951, 2.8031], - [7950, 13.7785], - [7949, 0.125], - [7948, 4], - [7942, 0.4337], - [7940, 6.1612], - [7936, 0.02], - [7935, 1.3575], - [7933, 2.002], - [7932, 1.3449], - [7930, 10.2974], - [7929, 3.2226] - ], - "asks": [ - [7979, 0.0736], - [7980, 1.0292], - [7981, 5.5652], - [7986, 0.2416], - [7990, 1.9970], - [7995, 0.88], - [7996, 0.0212], - [8000, 9.2609], - [8002, 0.02], - [8008, 1], - [8010, 0.8735], - [8011, 2.36], - [8012, 0.02], - [8014, 0.1067], - [8015, 12.9118], - [8016, 2.5206], - [8017, 0.0166], - [8018, 1.3218], - [8019, 0.01], - [8020, 13.6584] - ] - } -``` - -### Query Parameters - -Parameter | Data Type | Required | Allowed Value | Description ---------- | --------- | -------- | ------------- | ----------- -symbol | string | true | All supported trading pair symbols | The trading pair to query, e.g. btcusdt, bccbtc -type | string | true | step0, step1, step2, step3, step4, step5 | TBC - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -ts | integer | The UNIX timestamp in milliseconds -version | integer | TBC -bids | object | The current all bids in format [price, quote volume] -asks | object | The current all asks in format [price, quote volume] - -## Get the Last Trade - -This endpoint retrieves the latest trade with its price, volume, and direction. - -### HTTP Request - -`GET https://api.huobi.pro/market/trade` - -```shell -curl "https://api.huobi.pro/market/trade?symbol=ethusdt" -``` - -> The above command returns JSON structured like this: - -```json -{ - "id": 600848670, - "ts": 1489464451000, - "data": [ - { - "id": 600848670, - "price": 7962.62, - "amount": 0.0122, - "direction": "buy", - "ts": 1489464451000 - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The unique trade id of this trade -amount | float | The trading volume in base currency -price | float | The trading price in quote currency -ts | integer | The UNIX timestamp in milliseconds -direction | string | The direction of the trade: 'buy' or 'sell' - -## Get the Most Recent Trades - -This endpoint retrieves the most recent trades with their price, volume, and direction. - -### HTTP Request - -`GET https://api.huobi.pro/market/history/trade` - -```shell -curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" -``` - -> The above command returns JSON structured like this: - -```json -[ - { - "id":31618787514, - "ts":1544390317905, - "data":[ - { - "amount":9.000000000000000000, - "ts":1544390317905, - "id":3161878751418918529341, - "price":94.690000000000000000, - "direction":"sell" - }, - { - "amount":73.771000000000000000, - "ts":1544390317905, - "id":3161878751418918532514, - "price":94.660000000000000000, - "direction":"sell" - } - ] - }, - { - "id":31618776989, - "ts":1544390311353, - "data":[ - { - "amount":1.000000000000000000, - "ts":1544390311353, - "id":3161877698918918522622, - "price":94.710000000000000000, - "direction":"buy" - } - ] - } -] -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -size | integer | false | 1 | The number of data returns - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The unique trade id of this trade -amount | float | The trading volume in base currency -price | float | The trading price in quote currency -ts | integer | The UNIX timestamp in milliseconds -direction | string | The direction of the trade: 'buy' or 'sell' - -## Get the Last 24h Market Summary - -This endpoint retrieves the summary of trading in the market for the last 24 hours. - -### HTTP Request - -`GET https://api.huobi.pro/market/detail/` - -```shell -curl "https://api.huobi.pro/market/detail?symbol=ethusdt" -``` - -> The above command returns JSON structured like this: - -```json -{ - "amount":613071.438479561, - "open":86.21, - "close":94.35, - "high":98.7, - "id":31619471534, - "count":138909, - "low":84.63, - "version":31619471534, - "vol":5.6617373443873316E7 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | The UNIX timestamp in seconds as response id -amount | float | The aggregated trading volume in USDT -count | integer | The number of completed trades -open | float | The opening price of last 24 hours -close | float | The closing price of last 24 hours -low | float | The low price of last 24 hours -high | float | The high price of last 24 hours -vol | float | The trading volume in base currency of last 24 hours -version | integer | TBC - -# Spot Trading - - - -## Place a New Trading Order - -This endpoint place an trading order and send to the exchange to be matched. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/place` - -```shell -curl "https://api.huobi.pro/v1/order/orders/place" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit"} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": "59378" -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -account-id | string | true | NA | The account id used for this spot trading -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -type | string | true | NA | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -amount | string | true | NA | The amount in quote currency to buy / the amount in base currency to sell -price | string | false | NA | The limit price of limit order -source | string | false | api | When trade with margin use 'margin-api' - -### Response Content - - - -## Show All Open Orders - -This endpoint returns all open orders which have not been filled completely. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/openOrders` - -```shell -curl "https://api.huobi.pro/v1/order/openOrders" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit"} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 5454937, - "symbol": "ethusdt", - "account-id": 30925, - "amount": "1.000000000000000000", - "price": "0.453000000000000000", - "created-at": 1530604762277, - "type": "sell-limit", - "filled-amount": "0.0", - "filled-cash-amount": "0.0", - "filled-fees": "0.0", - "source": "web", - "state": "submitted" - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -account-id | string | false | NA | The account id used for this spot trading -symbol | string | false | NA | The trading pair to trade, e.g. btcusdt, bccbtc -side | string | false | both | Filter on the direction of the trade, possible values are: buy, sell. Default is to return all -size | int | false | 10 | The max number of orders to return - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | order id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app -state | string | submitted, partical-filled, cancelling - -## Submit Cancel for an Order - -This endpoint submit a request to cancel an order. - - - -### HTTP Request - -`POST https://api.huobi.pro/v1/order/orders/{order-id}/submitcancel` - -```shell -curl "https://api.huobi.pro/v1/order/orders/59378/submitcancel" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": "59378" -} -``` - -## Submit Cancel for Multiple Orders at Once - -This endpoint submit cancellation for multiple orders at once. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/batchcancel` - -```shell -curl "https://api.huobi.pro/v1/order/orders/batchcancel" -BODY { - "order-ids": [ - "1", "2", "3" - ] -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": { - "success": [ - "1", - "3" - ], - "failed": [ - { - "err-msg": "记录无效", - "order-id": "2", - "err-code": "base-record-invalid" - } - ] - } -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -order-ids | list | true | NA | The order ids to cancel. Max size is 50. - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request - -## Submit Cancel for Multiple Orders at Once - -This endpoint submit cancellation for multiple orders at once. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/batchcancel` - -```shell -curl "https://api.huobi.pro/v1/order/orders/batchcancel" -BODY { - "order-ids": [ - "1", "2", "3" - ] -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": { - "success": [ - "1", - "3" - ], - "failed": [ - { - "err-msg": "记录无效", - "order-id": "2", - "err-code": "base-record-invalid" - } - ] - } -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -order-ids | list | true | NA | The order ids to cancel. Max size is 50. - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request - -## Show the Order Detail of One Order - -This endpoint returns the detail of one order. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/{order-id}` - -```shell -curl "https://api.huobi.pro/v1/order/orders/59378" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": { - "id": 59378, - "symbol": "ethusdt", - "account-id": 100009, - "amount": "10.1000000000", - "price": "100.1000000000", - "created-at": 1494901162595, - "type": "buy-limit", - "field-amount": "10.1000000000", - "field-cash-amount": "1011.0100000000", - "field-fees": "0.0202000000", - "finished-at": 1494901400468, - "user-id": 1000, - "source": "api", - "state": "filled", - "canceled-at": 0, - "exchange": "huobi", - "batch": "" - } -} -``` - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | order id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -account-id | string | The account id which this order belongs to -amount | string | The amount of base currency in this order -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -finished-at | int | The timestamp in milliseconds when the order was changed to a final state. This is not the time the order is matched. -canceled-at | int | The timestamp in milliseconds when the order was canceled, if not canceled then has value of 0 -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app -state | string | Order state: submitted, partical-filled, cancelling, filled, canceled -exchange | string | Internal data -batch | string | Internal data - -## Show the Match Result of an Order - -This endpoint returns the match result of an order. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/{order-id}/matchresult` - -```shell -curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 29553, - "order-id": 59378, - "match-id": 59335, - "symbol": "ethusdt", - "type": "buy-limit", - "source": "api", - "price": "100.1000000000", - "filled-amount": "9.1155000000", - "filled-fees": "0.0182310000", - "created-at": 1494901400435 - } - ] -} -``` - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Internal id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -order-id | string | The order id of this order -match-id | string | The match id of this match -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the match and fill is done -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app - -## Search Past Orders - -This endpoint returns orders based on a specific searching criteria. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders` - -```shell -curl "https://api.huobi.pro/v1/order/orders" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" - } -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 59378, - "symbol": "ethusdt", - "account-id": 100009, - "amount": "10.1000000000", - "price": "100.1000000000", - "created-at": 1494901162595, - "type": "buy-limit", - "field-amount": "10.1000000000", - "field-cash-amount": "1011.0100000000", - "field-fees": "0.0202000000", - "finished-at": 1494901400468, - "user-id": 1000, - "source": "api", - "state": "filled", - "canceled-at": 0, - "exchange": "huobi", - "batch": "" - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -types | string | false | All | The types of order to include in the search -states | string | false | All | The states of order to include in the search -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd -from | string | false | both | Search order id to begin with -direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' -size | int | false | 100 | The max number of orders to return, max value is 100 - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Order id -account-id | integer | Account id -user-id | integer | User id -amount | string | The amount of base currency in this order -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -canceled-at | int | The timestamp in milliseconds when the order was canceled, or 0 if not canceled -canceled-at | int | The timestamp in milliseconds when the order was finished, or 0 if not finished -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app -state | string | submitted, partical-filled, cancelling -exchange | string | Internal data -batch | string | Internal data - -## Search the Match Results - -This endpoint returns the match results of past and open orders based on specific search criteria. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/matchresults` - -```shell -curl "https://api.huobi.pro/v1/order/matchresults" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 29553, - "order-id": 59378, - "match-id": 59335, - "symbol": "ethusdt", - "type": "buy-limit", - "source": "api", - "price": "100.1000000000", - "filled-amount": "9.1155000000", - "filled-fees": "0.0182310000", - "created-at": 1494901400435 - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -types | string | false | All | The types of order to include in the search -states | string | false | All | The states of order to include in the search -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd -from | string | false | NA | Search match result id to begin with -direct | string | false | next | Search direction when 'from' is used, possible values: 'next', 'prev' -size | int | false | 100 | The max number of orders to return - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Internal id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -order-id | string | The order id of this order -match-id | string | The match id of this match -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the match and fill is done -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app - -# Margin Trading - - - - - - - -## Transfer Asset from Spot Trading Account to Margin Account - -This endpoint transfer specific asset from spot trading account to margin account. - -### HTTP Request - -`GET https://api.huobi.pro/v1/dw/transfer-in` - -```shell -curl "https://api.huobi.pro/v1/dw/transfer-in" -BODY -{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Transfer id - -## Transfer Asset from Margin Account to Spot Trading Account - -This endpoint transfer specific asset from margin account to spot trading account. - -### HTTP Request - -`GET https://api.huobi.pro/v1/dw/transfer-out` - -```shell -curl "https://api.huobi.pro/v1/dw/transfer-out" -BODY -{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Transfer id - -## Place a Margin Loan Order - -This endpoint place an order to initiate a margin loan. - -### HTTP Request - -`GET https://api.huobi.pro/v1/margin/orders` - -```shell -curl "https://api.huobi.pro/v1/margin/orders" -BODY -{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Margin order id - -## Repay Margin Loan - -This endpoint repays margin loan with you asset in your margin account. - -### HTTP Request - -`POST https://api.huobi.pro/v1/margin/orders/{order-id}/repay` - -```shell -curl "https://api.huobi.pro/v1/margin/orders/1000/repay" -BODY -{ - "amount": "1.0" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -amount | string | true | NA | The amount of currency to repay - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Margin order id - -## Search Past Margin Orders - -This endpoint returns margin orders based on a specific searching criteria. - -### HTTP Request - -`GET https://api.huobi.pro/v1/margin/loan-orders` - -```shell -curl "https://api.huobi.pro/v1/margin/load-orders" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" - } -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "loan-balance": "0.100000000000000000", - "interest-balance": "0.000200000000000000", - "interest-rate": "0.002000000000000000", - "loan-amount": "0.100000000000000000", - "accrued-at": 1511169724531, - "interest-amount": "0.000200000000000000", - "symbol": "ethbtc", - "currency": "btc", - "id": 394, - "state": "accrual", - "account-id": 17747, - "user-id": 119913, - "created-at": 1511169724531 - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -states | string | false | All | The states of order to include in the search -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd -from | string | false | both | Search order id to begin with -direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' -size | int | false | 100 | The max number of orders to return, max value is 100 - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Order id -account-id | integer | Account id -user-id | integer | User id -symbol | string | The margin loan pair to trade, e.g. btcusdt, bccbtc -currency | string | The currency in the loan -created-at | int | The timestamp in milliseconds when the order was created -accrued-at | int | The timestamp in milliseconds when the last accure happened -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -loan-amount | string | The amount of the origin loan -loan-balance | string | The amount of the loan left -interest-rate | string | The loan interest rate -interest-amount | string | The accumulated loan interest -interest-balance | string | The amount of loan interest left -state | string | Loan state, possible values: created, accrual, cleared, invalid - -## Return the Balance of the Margin Loan Account - -This endpoint returns the balance of the margin loan account. - -### HTTP Request - -`GET https://api.huobi.pro/v1/margin/accounts/balance` - -```shell -curl "https://api.huobi.pro/v1/margin/accounts/balance" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" - } -``` - -> The above command returns JSON structured like this: - -```json -{ -"data": [ - { - "id": 18264, - "type": "margin", - "state": "working", - "symbol": "btcusdt", - "fl-price": "0", - "fl-type": "safe", - "risk-rate": "475.952571086994250554", - "list": [ - { - "currency": "btc", - "type": "trade", - "balance": "1168.533000000000000000" - }, - { - "currency": "btc", - "type": "frozen", - "balance": "0.000000000000000000" - }, - { - "currency": "btc", - "type": "loan", - "balance": "-2.433000000000000000" - }, - { - "currency": "btc", - "type": "interest", - "balance": "-0.000533000000000000" - }, - { - "currency": "btc", - "type": "transfer-out-available",//可转btc - "balance": "1163.872174670000000000" - }, - { - "currency": "btc", - "type": "loan-available",//可借btc - "balance": "8161.876538350676000000" - } - ] - } - ] -} -``` - -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc - -### Response Content - -Parameter | Data Type | Description ---------- | --------- | ----------- -symbol | string | The margin loan pair, e.g. btcusdt, bccbtc -state | string | Loan state, possible values: created, accrual, cleared, invalid -risk-rate | string | The risk rate -fl-price | string | The price which triggers closeout -list | object array | The list of loans and their details - -# Wallet (Deposit and Withdraw) - -TBC - -# Account - -TBC From fbc7dc0f767b01690a28e4f474ac29da0e8d8e21 Mon Sep 17 00:00:00 2001 From: rayxy Date: Mon, 24 Dec 2018 12:45:05 +0000 Subject: [PATCH 003/759] Fix deploy.sh errors --- deploy.sh | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/deploy.sh b/deploy.sh index 61e2a32297f..1e33e096515 100755 --- a/deploy.sh +++ b/deploy.sh @@ -30,6 +30,16 @@ parse_args() { source .env fi + #default version uses 1 if a custom one is not supplied + if [[ -z $version ]]; then + version=1 + fi + + #default language uses en if a custom one is not supplied + if [[ -z $language ]]; then + language=en + fi + # Parse arg flags # If something is exposed as an environment variable, set/overwrite it # here. Otherwise, set/overwrite the internal variable instead. @@ -46,12 +56,6 @@ parse_args() { elif [[ ( $1 = "-m" || $1 = "--message" ) && -n $2 ]]; then commit_message=$2 shift 2 - elif [[ ( $1 = "-V" || $1 = "--version" ) && -n $2 ]]; then - version=$2 - shift 2 - elif [[ ( $1 = "-l" || $1 = "--language" ) && -n $2 ]]; then - language=$2 - shift 2 elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then GIT_DEPLOY_APPEND_HASH=false shift @@ -60,16 +64,6 @@ parse_args() { fi done - #default version uses 1 if a custom one is not supplied - if [[ -z $version ]]; then - version="1" - fi - - #default language uses en if a custom one is not supplied - if [[ -z $language ]]; then - language="en" - fi - # Set internal option vars from the environment and arg flags. All internal # vars should be declared here, with sane defaults if applicable. From e06a89dff11d09b991aab8e9cb7ab7ebc3fbf70a Mon Sep 17 00:00:00 2001 From: rayx Date: Thu, 27 Dec 2018 01:27:58 +0000 Subject: [PATCH 004/759] update configs to reflect version and language --- config.rb | 10 +++++----- deploy.sh | 23 ++++++++++++++++------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/config.rb b/config.rb index ca77f9943e3..b25471d654c 100644 --- a/config.rb +++ b/config.rb @@ -15,11 +15,11 @@ renderer: UniqueHeadCounter # Assets -set :css_dir, '../source_common/stylesheets' -set :js_dir, '../source_common/javascripts' -set :images_dir, '../source_common/images' -set :fonts_dir, '../source_common/fonts' -set :layouts_dir, '../source_common/layouts' +set :css_dir, 'stylesheets' +set :js_dir, 'javascripts' +set :images_dir, 'images' +set :fonts_dir, 'fonts' +set :layouts_dir, 'layouts' # Activate the syntax highlighter activate :syntax diff --git a/deploy.sh b/deploy.sh index 1e33e096515..f999345e32b 100755 --- a/deploy.sh +++ b/deploy.sh @@ -59,6 +59,12 @@ parse_args() { elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then GIT_DEPLOY_APPEND_HASH=false shift + elif [[ $1 = "--source-only" ]]; then + source_only=true + shift + elif [[ $1 = "--push-only" ]]; then + push_only=true + shift else break fi @@ -68,7 +74,7 @@ parse_args() { # vars should be declared here, with sane defaults if applicable. # Source directory & target branch. - deploy_directory=build/v${version}/${language} + deploy_directory=build deploy_branch=gh-pages #if no user identity is already set in the current git environment, use this: @@ -83,8 +89,6 @@ parse_args() { } main() { - parse_args "$@" - enable_expanded_output if ! git diff --exit-code --quiet --cached; then @@ -215,11 +219,16 @@ sanitize() { "$@" 2> >(filter 1>&2) | filter } -if [[ $1 = --source-only ]]; then +parse_args "$@" + +if [[ -n "$source_only" ]]; then + echo "source only" run_build -elif [[ $1 = --push-only ]]; then - main "$@" +elif [[ -n "$source_only" ]]; then + echo "push only" + main else + echo "source and push" run_build - main "$@" + main fi From dee61422651bdc2703c3dd8c147db65c015abdb5 Mon Sep 17 00:00:00 2001 From: rayxy Date: Mon, 31 Dec 2018 10:39:57 +0800 Subject: [PATCH 005/759] completed deposit and withdraw endpoints --- source/index.html.md | 167 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 166 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 47e00290968..47196d53380 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1380,7 +1380,172 @@ list | object array | The list of loans and their details # Wallet (Deposit and Withdraw) -TBC +## Create a Withdraw Request + +This endpoint creates a withdraw request from your spot trading account to an external address. + + + +### HTTP Request + +`GET https://api.huobi.pro/v1/dw/withdraw/api/create` + +```shell +curl "https://api.huobi.pro/v1/dw/withdraw/api/create" +BODY +{ + "address": "0xde709f2102306220921060314715629080e2fb77", + "amount": "0.05", + "currency": "eth", + "fee": "0.01" +} +``` + +> The above command returns JSON structured like this: + +```json +{ + "data": 1000 +} +``` + +### Query Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +address | string | true | NA | The desination address of this withdraw +currency | string | true | NA | The crypto currency to withdraw +amount | string | true | NA | The amount of currency to withdraw +fee | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc +addr-tag | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc + +### Response Content + + + +Parameter | Data Type | Description +--------- | --------- | ----------- +data | integer | Transfer id + + + +## Cancel a Withdraw Request + +This endpoint cancels a previously created withdraw request by its transfer id. + +### HTTP Request + +`GET https://api.huobi.pro/v1/dw/withdraw-virtual/{withdraw-id}/cancel` + +```shell +curl "https://api.huobi.pro/v1/dw/withdraw-virtual/1000/cancel" +``` + +> The above command returns JSON structured like this: + +```json +{ + "status": "ok", + "data": 700 +} +``` + +### Query Parameters + + + +### Response Content + + + +Parameter | Data Type | Description +--------- | --------- | ----------- +data | integer | Withdraw cancel id + +## Search for Existed Withdraws and Deposits + +This endpoint searches for all existed withdraws and deposits and return their latest status. + +### HTTP Request + +`GET https://api.huobi.pro/v1/query/deposit-withdraw` + +```shell +curl "https://api.huobi.pro/v1/query/deposit-withdraw?currency=xrp&type=deposit&from=5&size=12" +``` + +> The above command returns JSON structured like this: + +```json +{ + "data": [ + { + "id": 1171, + "type": "deposit", + "currency": "xrp", + "tx-hash": "ed03094b84eafbe4bc16e7ef766ee959885ee5bcb265872baaa9c64e1cf86c2b", + "amount": 7.457467, + "address": "rae93V8d2mdoUQHwBDBdM4NHCMehRJAsbm", + "address-tag": "100040", + "fee": 0, + "state": "safe", + "created-at": 1510912472199, + "updated-at": 1511145876575 + } + ] +} +``` + +### Path Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +currency | string | true | NA | The crypto currency to withdraw +type | string | true | NA | Define transfer type to search, possible values: [deposit, withdraw] +from | string | true | NA | The transfer id to begin search +size | string | true | NA | The max number of items to return + +### Response Content + +Parameter | Data Type | Description +--------- | --------- | ----------- +id | integer | Transfer id +type | string | Define transfer type to search, possible values: [deposit, withdraw] +currency | string | The crypto currency to withdraw +tx-hash | string | The on-chain transaction hash +amount | integer | The number of crypto asset transfered in its minimum unit +address | string | The deposit or withdraw source address +address-tag | string | The user defined address tag +fee | integer | The amount of fee taken by Huobi in this crypto's minimum unit +state | string | The state of this transfer (see below for details) +created-at | integer | The timestamp in milliseconds for the transfer creation +updated-at | integer | The timestamp in milliseconds for the transfer's latest update + +Possible states of withdraw transfer + +State | Description +--------- | ----------- +submitted | Withdraw request submitted successfully +reexamine | Under examination for withdraw validation +canceled | Withdraw canceled by user +pass | Withdraw validation passed +reject | Withdraw validation rejected +pre-transfer | Withdraw is about to be released +wallet-transfer | On-chain transfer initiated +wallet-reject | Transfer rejected by chain +confirmed | On-chain transfer completed with one confirmation +confirm-error | On-chain transfer faied to get confirmation +repealed | Withdraw terminated by system + +Possible states of deposit transfer + +State | Description +--------- | ----------- +unknown | On-chain transfer has not been received +confirming | On-chain transfer waits for first confirmation +confirmed | On-chain transfer confirmed for at least one block +safe | Multiple on-chain confirmation happened +orphan | Confirmed but currently in an orphan branch # Account From 7ebfb0cf6b80ed08759eb6292fd46b1fd94bf251 Mon Sep 17 00:00:00 2001 From: rayxy Date: Tue, 1 Jan 2019 11:00:21 +0800 Subject: [PATCH 006/759] Add accounts endpoints --- source/index.html.md | 253 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 252 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 47196d53380..740441574fe 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1549,4 +1549,255 @@ orphan | Confirmed but currently in an orphan branch # Account -TBC +## Get all Accounts of the Current User + +This endpoint returns a list of accounts owned by this API user. + +### HTTP Request + +`GET https://api.huobi.pro/v1/account/accounts` + +```shell +curl "https://api.huobi.pro/v1/account/accounts" +``` + +> The above command returns JSON structured like this: + +```json + "data": [ + { + "id": 100009, + "type": "spot", + "state": "working", + "user-id": 1000 + } + ] +``` + +### Query Parameters + + + +### Response Content + +Parameter | Data Type | Description +--------- | --------- | ----------- +id | integer | Unique account id +state | string | Account state, possible values: [working, lock] +type | string | The type of this account, possible values: [spot, margin, otc, point] + +## Get Account Balance of a Specific Account + +This endpoint returns the balance of an account specified by account id. + +### HTTP Request + +`GET https://api.huobi.pro/v1/account/accounts/{account-id}/balance` + +```shell +curl "https://api.huobi.pro/v1/account/accounts/100009/balance" +``` + +> The above command returns JSON structured like this: + +```json +"data": { + "id": 100009, + "type": "spot", + "state": "working", + "list": [ + { + "currency": "usdt", + "type": "trade", + "balance": "500009195917.4362872650" + }, + { + "currency": "usdt", + "type": "frozen", + "balance": "328048.1199920000" + }, + { + "currency": "etc", + "type": "trade", + "balance": "499999894616.1302471000" + } + ], + } +} +``` + +### Path Parameters + + + +### Query Parameters + + + +### Response Content + +Parameter | Data Type | Description +--------- | --------- | ----------- +id | integer | Unique account id +state | string | Account state, possible values: [working, lock] +type | string | The type of this account, possible values: [spot, margin, otc, point] +list | object | The balance details of each currency + +Per list item content + +Parameter | Data Type | Description +--------- | --------- | ----------- +currency | string | The currency of this balance +type | string | The balance type, possible values: [trade, frozen] +balance | string | The balance in the main currency unit + +## Get Account Balance of a Sub-Account + +This endpoint returns the balance of a sub-account specified by sub-account uid. + +### HTTP Request + +`GET https://api.huobi.pro/v1/account/accounts/{sub-account-uid}` + +```shell +curl "https://api.huobi.pro/v1/account/accounts/10758899" +``` + +> The above command returns JSON structured like this: + +```json +"data": [ +{ + "id": 9910049, + "type": "spot", + "list": [ + { + "currency": "btc", + "type": "trade", + "balance": "1.00" + }, + { + "currency": "eth", + "type": "trade", + "balance": "1934.00" + } + ] +}, +{ + "id": 9910050, + "type": "point", + "list": [] +} +] +``` + +### Path Parameters + + + +### Query Parameters + + + +### Response Content + + + +Parameter | Data Type | Description +--------- | --------- | ----------- +id | integer | Unique account id +type | string | The type of this account, possible values: [spot, margin, otc, point] +list | object | The balance details of each currency + +Per list item content + +Parameter | Data Type | Description +--------- | --------- | ----------- +currency | string | The currency of this balance +type | string | The balance type, possible values: [trade, frozen] +balance | string | The balance in the main currency unit + +## Get the Aggregated Balance of all Sub-accounts of the Current User + +This endpoint returns the balances of all the sub-account aggregated. + +### HTTP Request + +`GET https://api.huobi.pro/v1/subuser/aggregate-balance` + +```shell +curl "https://api.huobi.pro/v1/subuser/aggregate-balance" +``` + +> The above command returns JSON structured like this: + +```json + "data": [ + { + "currency": "eos", + "balance": "1954559.809500000000000000" + }, + { + "currency": "btc", + "balance": "0.000000000000000000" + }, + { + "currency": "usdt", + "balance": "2925209.411300000000000000" + } + ] +``` + +### Path Parameters + + + +### Query Parameters + + + +### Response Content + + + +Parameter | Data Type | Description +--------- | --------- | ----------- +currency | string | The currency of this balance +balance | string | The balance in the main currency unit + +## Transfer Asset between Parent and Sub Account + +This endpoint allows user to transfer asset between parent and sub account. + +### HTTP Request + +`POST https://api.huobi.pro/v1/subuser/transfer` + +```shell +curl "https://api.huobi.pro/v1/subuser/transfer" +Body + +``` + +> The above command returns JSON structured like this: + +```json + "data": 12345 +``` + +### Query Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +sub-uid | integer | true | NA | The target sub account uid to transfer to or from +currency | string | true | NA | The crypto currency to transfer +amount | decimal | true | NA | The amount of asset to transfer +type | string | true | NA | The type of transfer, possible values: [master-transfer-in, master-transfer-out, master-point-transfer-in, master-point-transfer-out] + +### Response Content + + + +Parameter | Data Type | Description +--------- | --------- | ----------- +data | integer | Unique transfer id \ No newline at end of file From 5509db9d5ca743a0fa2968e6bc17346222e96bea Mon Sep 17 00:00:00 2001 From: rayxy Date: Wed, 2 Jan 2019 03:10:45 +0800 Subject: [PATCH 007/759] Improve authentication documents --- source/index.html.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 740441574fe..4c99aa1747e 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -53,7 +53,7 @@ data | object | The actual response content per API Each apikey can send maximum of 100 https requests within 10 seconds. Please contact customer support if you believe you need higher limit rate. -## Authentication +# Authentication Some API endpoints require authentication. To be authenticated, you should first acquire an API key and the corresponding secret key. @@ -1380,6 +1380,8 @@ list | object array | The list of loans and their details # Wallet (Deposit and Withdraw) + + ## Create a Withdraw Request This endpoint creates a withdraw request from your spot trading account to an external address. @@ -1549,6 +1551,8 @@ orphan | Confirmed but currently in an orphan branch # Account + + ## Get all Accounts of the Current User This endpoint returns a list of accounts owned by this API user. From 3b13378eed8dbb848790e35a2563397310770760 Mon Sep 17 00:00:00 2001 From: rayxy Date: Wed, 2 Jan 2019 03:32:55 +0800 Subject: [PATCH 008/759] add the common endpoints --- source/index.html.md | 101 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 4c99aa1747e..39765ea1064 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -53,6 +53,107 @@ data | object | The actual response content per API Each apikey can send maximum of 100 https requests within 10 seconds. Please contact customer support if you believe you need higher limit rate. +## Get all Supported Trading Pairs + +This endpoint retrieves all trading pairs supported in Huobi. + +### HTTP Request + +`GET https://api.huobi.pro/v1/common/symbols` + +```shell +curl "https://api.huobi.prov1/common/symbols" +``` + +> The above command returns JSON structured like this: + +```json + "data": [ + { + "base-currency": "btc", + "quote-currency": "usdt", + "price-precision": 2, + "amount-precision": 4, + "symbol-partition": "main", + "symbol": "btcusdt" + } + { + "base-currency": "eth", + "quote-currency": "usdt", + "price-precision": 2, + "amount-precision": 4, + "symbol-partition": "main", + "symbol": "ethusdt" + } + ] +``` + + + +### Response Content + +Parameter | Data Type | Description +--------- | --------- | ----------- +base-currency | integer | The base currency in this pair +quote-currency | float | The quote currency in this pair +price-precision | integer | The number of decimal place for quoting price +amount-precision| float | The number of decimal place for base asset +symbol-partition| float | The trading partition this pair belongs to, possible values: [main,innovation,bifurcation] + +## Get all Supported Trading Currencies + +This endpoint retrieves all trading currencies supported in Huobi. + +### HTTP Request + +`GET https://api.huobi.pro/v1/common/currencys` + +```shell +curl "https://api.huobi.prov1/common/currencys" +``` + +> The above command returns JSON structured like this: + +```json + "data": [ + "usdt", + "eth", + "etc" + ] +``` + + + +### Response Content + + + +## Get the Current System Time + +This endpoint retrieves the system time of Huobi in epoch milliseconds. + +### HTTP Request + +`GET https://api.huobi.pro/v1/common/timestamp` + +```shell +curl "https://api.huobi.prov1/common/timestamp" +``` + +> The above command returns JSON structured like this: + +```json + "data": 1494900087029 +``` + +### Request Parameters + + + +### Response Content + + + # Authentication Some API endpoints require authentication. To be authenticated, you should first acquire an API key and the corresponding secret key. From 012db48ce66e702958a5f9b5b9d5c0246e670cf4 Mon Sep 17 00:00:00 2001 From: rayxy Date: Thu, 3 Jan 2019 12:51:59 +0800 Subject: [PATCH 009/759] Improve parameter wording --- source/index.html.md | 228 +++++++++++++++++-------------------------- 1 file changed, 89 insertions(+), 139 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 39765ea1064..6c5baf31653 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -23,7 +23,7 @@ We have language bindings in Shell, and Python! You can view code examples in th ## Request Format -All API requests are in either GET or POST method. For GET request, all parameters are path parameters. For POST request, all parameters are in POST body and in JSON format. +All API requests are in either GET or POST method. For GET request, all parameters are query string parameters. For POST request, all parameters are in POST body and in JSON format. ## Response Format @@ -42,13 +42,15 @@ All response will be returned in JSON format. The top level JSON is a wrapper ob } ``` -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- status | string | The overall API call result status ch | string | The data channel this response was originated from. Some API return does not have this field. ts | int | The timestamp in milliseconds for when the response is created data | object | The actual response content per API + + ## Endpoint Rate Limit Each apikey can send maximum of 100 https requests within 10 seconds. Please contact customer support if you believe you need higher limit rate. @@ -88,11 +90,13 @@ curl "https://api.huobi.prov1/common/symbols" ] ``` +### Request Parameters + -### Response Content +### Response Fields -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- base-currency | integer | The base currency in this pair quote-currency | float | The quote currency in this pair @@ -122,6 +126,8 @@ curl "https://api.huobi.prov1/common/currencys" ] ``` +### Request Parameters + ### Response Content @@ -274,7 +280,7 @@ curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" ] ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -324,7 +330,7 @@ curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -386,15 +392,15 @@ curl "https://api.huobi.pro/market/tickers" ] ``` -### Query Parameters +### Request Parameters -This endpoint does not require parameters. +No parameters are needed for this endpoint. ### Response Content Response content is an array of object, each object has below fields. -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- amount | float | The aggregated trading volume in USDT of last 24 hours count | integer | The number of completed trades of last 24 hours @@ -470,7 +476,7 @@ curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Allowed Value | Description --------- | --------- | -------- | ------------- | ----------- @@ -481,7 +487,7 @@ type | string | true | step0, step1, step2, step3, step4, step5 | TB -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- ts | integer | The UNIX timestamp in milliseconds version | integer | TBC @@ -518,7 +524,7 @@ curl "https://api.huobi.pro/market/trade?symbol=ethusdt" } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -588,7 +594,7 @@ curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" ] ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -599,7 +605,7 @@ size | integer | false | 1 | The number of data returns -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- id | integer | The unique trade id of this trade amount | float | The trading volume in base currency @@ -635,7 +641,7 @@ curl "https://api.huobi.pro/market/detail?symbol=ethusdt" } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -645,7 +651,7 @@ symbol | string | true | NA | The trading pair to query, e.g. btc -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- id | integer | The UNIX timestamp in seconds as response id amount | float | The aggregated trading volume in USDT @@ -667,7 +673,7 @@ This endpoint place an trading order and send to the exchange to be matched. ### HTTP Request -`GET https://api.huobi.pro/v1/order/orders/place` +`POST https://api.huobi.pro/v1/order/orders/place` ```shell curl "https://api.huobi.pro/v1/order/orders/place" @@ -688,7 +694,7 @@ BODY { } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -745,7 +751,7 @@ BODY { } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -791,55 +797,13 @@ curl "https://api.huobi.pro/v1/order/orders/59378/submitcancel" } ``` -## Submit Cancel for Multiple Orders at Once - -This endpoint submit cancellation for multiple orders at once. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/orders/batchcancel` - -```shell -curl "https://api.huobi.pro/v1/order/orders/batchcancel" -BODY { - "order-ids": [ - "1", "2", "3" - ] -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": { - "success": [ - "1", - "3" - ], - "failed": [ - { - "err-msg": "记录无效", - "order-id": "2", - "err-code": "base-record-invalid" - } - ] - } -} -``` +### Request Parameters -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -order-ids | list | true | NA | The order ids to cancel. Max size is 50. +No parameter is needed for this endpoint. ### Response Content -Parameter | Data Type | Description ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request + ## Submit Cancel for Multiple Orders at Once @@ -847,7 +811,7 @@ This endpoint submit cancellation for multiple orders at once. ### HTTP Request -`GET https://api.huobi.pro/v1/order/orders/batchcancel` +`POST https://api.huobi.pro/v1/order/orders/batchcancel` ```shell curl "https://api.huobi.pro/v1/order/orders/batchcancel" @@ -878,7 +842,7 @@ BODY { } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -886,12 +850,12 @@ order-ids | list | true | NA | The order ids to cancel. Max size ### Response Content -Parameter | Data Type | Description ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request +Field | Data Type | Description +--------- | --------- | ----------- +success | list | The order ids with thier cancel request sent successfully +failed | list | The details of the failed cancel request -## Show the Order Detail of One Order +## Show the Order Detail of an Order This endpoint returns the detail of one order. @@ -929,9 +893,13 @@ curl "https://api.huobi.pro/v1/order/orders/59378" } ``` +### Request Parameters + +No parameter is needed for this endpoint. + ### Response Content -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- id | integer | order id symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc @@ -965,7 +933,6 @@ curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" > The above command returns JSON structured like this: ```json -{ "data": [ { "id": 29553, @@ -980,9 +947,12 @@ curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" "created-at": 1494901400435 } ] -} ``` +### Request Parameters + + + ### Response Content @@ -1048,7 +1018,7 @@ BODY { } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -1063,7 +1033,7 @@ size | int | false | 100 | The max number of orders to return ### Response Content -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- id | integer | Order id account-id | integer | Account id @@ -1116,7 +1086,7 @@ curl "https://api.huobi.pro/v1/order/matchresults" } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -1160,10 +1130,10 @@ This endpoint transfer specific asset from spot trading account to margin accoun ### HTTP Request -`GET https://api.huobi.pro/v1/dw/transfer-in` +`POST https://api.huobi.pro/v1/dw/transfer-in/margin` ```shell -curl "https://api.huobi.pro/v1/dw/transfer-in" +curl "https://api.huobi.pro/v1/dw/transfer-in/margin" BODY { "symbol": "ethusdt", @@ -1180,7 +1150,7 @@ BODY } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -1192,7 +1162,7 @@ amount | string | true | NA | The amount of currency to borrow -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- data | integer | Transfer id @@ -1202,10 +1172,10 @@ This endpoint transfer specific asset from margin account to spot trading accoun ### HTTP Request -`GET https://api.huobi.pro/v1/dw/transfer-out` +`POST https://api.huobi.pro/v1/dw/transfer-out/margin` ```shell -curl "https://api.huobi.pro/v1/dw/transfer-out" +curl "https://api.huobi.pro/v1/dw/transfer-out/margin" BODY { "symbol": "ethusdt", @@ -1222,7 +1192,7 @@ BODY } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -1234,7 +1204,7 @@ amount | string | true | NA | The amount of currency to borrow -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- data | integer | Transfer id @@ -1244,7 +1214,7 @@ This endpoint place an order to initiate a margin loan. ### HTTP Request -`GET https://api.huobi.pro/v1/margin/orders` +`POST https://api.huobi.pro/v1/margin/orders` ```shell curl "https://api.huobi.pro/v1/margin/orders" @@ -1264,7 +1234,7 @@ BODY } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -1276,7 +1246,7 @@ amount | string | true | NA | The amount of currency to borrow -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- data | integer | Margin order id @@ -1304,7 +1274,7 @@ BODY } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -1314,7 +1284,7 @@ amount | string | true | NA | The amount of currency to repay -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- data | integer | Margin order id @@ -1362,21 +1332,21 @@ BODY { } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc states | string | false | All | The states of order to include in the search start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd +end-date | string | false | today | Search ends date, in format yyyy-mm-dd from | string | false | both | Search order id to begin with direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' size | int | false | 100 | The max number of orders to return, max value is 100 ### Response Content -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- id | integer | Order id account-id | integer | Account id @@ -1402,15 +1372,7 @@ This endpoint returns the balance of the margin loan account. `GET https://api.huobi.pro/v1/margin/accounts/balance` ```shell -curl "https://api.huobi.pro/v1/margin/accounts/balance" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" - } +curl "https://api.huobi.pro/v1/margin/accounts/balance?symbol=btcusdt" ``` > The above command returns JSON structured like this: @@ -1463,7 +1425,7 @@ BODY { } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -1491,7 +1453,7 @@ This endpoint creates a withdraw request from your spot trading account to an ex ### HTTP Request -`GET https://api.huobi.pro/v1/dw/withdraw/api/create` +`POST https://api.huobi.pro/v1/dw/withdraw/api/create` ```shell curl "https://api.huobi.pro/v1/dw/withdraw/api/create" @@ -1512,21 +1474,21 @@ BODY } ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- address | string | true | NA | The desination address of this withdraw currency | string | true | NA | The crypto currency to withdraw amount | string | true | NA | The amount of currency to withdraw -fee | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -addr-tag | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc +fee | string | false | NA | The fee to pay with this withdraw +addr-tag | string | false | NA | A tag specified for this address ### Response Content -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- data | integer | Transfer id @@ -1538,7 +1500,7 @@ This endpoint cancels a previously created withdraw request by its transfer id. ### HTTP Request -`GET https://api.huobi.pro/v1/dw/withdraw-virtual/{withdraw-id}/cancel` +`POST https://api.huobi.pro/v1/dw/withdraw-virtual/{withdraw-id}/cancel` ```shell curl "https://api.huobi.pro/v1/dw/withdraw-virtual/1000/cancel" @@ -1553,9 +1515,9 @@ curl "https://api.huobi.pro/v1/dw/withdraw-virtual/1000/cancel" } ``` -### Query Parameters +### Request Parameters - + ### Response Content @@ -1599,7 +1561,7 @@ curl "https://api.huobi.pro/v1/query/deposit-withdraw?currency=xrp&type=deposit& } ``` -### Path Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- @@ -1610,7 +1572,7 @@ size | string | true | NA | The max number of items to return ### Response Content -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- id | integer | Transfer id type | string | Define transfer type to search, possible values: [deposit, withdraw] @@ -1624,7 +1586,7 @@ state | string | The state of this transfer (see below for deta created-at | integer | The timestamp in milliseconds for the transfer creation updated-at | integer | The timestamp in milliseconds for the transfer's latest update -Possible states of withdraw transfer +**List of possible withdraw state** State | Description --------- | ----------- @@ -1640,7 +1602,7 @@ confirmed | On-chain transfer completed with one confirmation confirm-error | On-chain transfer faied to get confirmation repealed | Withdraw terminated by system -Possible states of deposit transfer +**List of possible deposit state** State | Description --------- | ----------- @@ -1679,13 +1641,13 @@ curl "https://api.huobi.pro/v1/account/accounts" ] ``` -### Query Parameters +### Request Parameters ### Response Content -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- id | integer | Unique account id state | string | Account state, possible values: [working, lock] @@ -1731,24 +1693,20 @@ curl "https://api.huobi.pro/v1/account/accounts/100009/balance" } ``` -### Path Parameters - - - -### Query Parameters +### Request Parameters ### Response Content -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- id | integer | Unique account id state | string | Account state, possible values: [working, lock] type | string | The type of this account, possible values: [spot, margin, otc, point] list | object | The balance details of each currency -Per list item content +**Per list item content** Parameter | Data Type | Description --------- | --------- | ----------- @@ -1796,11 +1754,7 @@ curl "https://api.huobi.pro/v1/account/accounts/10758899" ] ``` -### Path Parameters - - - -### Query Parameters +### Request Parameters @@ -1808,15 +1762,15 @@ curl "https://api.huobi.pro/v1/account/accounts/10758899" -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- id | integer | Unique account id type | string | The type of this account, possible values: [spot, margin, otc, point] list | object | The balance details of each currency -Per list item content +**Per list item content** -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- currency | string | The currency of this balance type | string | The balance type, possible values: [trade, frozen] @@ -1853,11 +1807,7 @@ curl "https://api.huobi.pro/v1/subuser/aggregate-balance" ] ``` -### Path Parameters - - - -### Query Parameters +### Request Parameters @@ -1865,7 +1815,7 @@ curl "https://api.huobi.pro/v1/subuser/aggregate-balance" -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- currency | string | The currency of this balance balance | string | The balance in the main currency unit @@ -1890,7 +1840,7 @@ Body "data": 12345 ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- From fcca0258b1cebd746298ce73e3996403d70e070a Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 3 Jan 2019 15:16:46 +0800 Subject: [PATCH 010/759] update margin trading --- source/index.html.md | 987 +++++++++++-------------------------------- 1 file changed, 258 insertions(+), 729 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 6c5baf31653..066286e9bd5 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1,5 +1,5 @@ --- -title: Huobi API Reference V1 English +title: 火币 API 文档 v1.0 language_tabs: # must be one of https://git.io/vQNgJ - shell @@ -13,19 +13,19 @@ includes: search: true --- -# Introduction +# API v1.0 简介 Welcome to the Huobi API! You can use our API to access all market data, trading, and account management endpoints. We have language bindings in Shell, and Python! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right. -# General +# 概述 -## Request Format +## 请求格式 -All API requests are in either GET or POST method. For GET request, all parameters are query string parameters. For POST request, all parameters are in POST body and in JSON format. +All API requests are in either GET or POST method. For GET request, all parameters are path parameters. For POST request, all parameters are in POST body and in JSON format. -## Response Format +## 返回格式 All response will be returned in JSON format. The top level JSON is a wrapper object which provides three metadata in "status", "ch", and "ts". The actual per API response data is in "data" field. @@ -42,125 +42,18 @@ All response will be returned in JSON format. The top level JSON is a wrapper ob } ``` -Field | Data Type | Description +Parameter | Data Type | Description --------- | --------- | ----------- status | string | The overall API call result status ch | string | The data channel this response was originated from. Some API return does not have this field. ts | int | The timestamp in milliseconds for when the response is created data | object | The actual response content per API - - -## Endpoint Rate Limit +## 限频规则 Each apikey can send maximum of 100 https requests within 10 seconds. Please contact customer support if you believe you need higher limit rate. -## Get all Supported Trading Pairs - -This endpoint retrieves all trading pairs supported in Huobi. - -### HTTP Request - -`GET https://api.huobi.pro/v1/common/symbols` - -```shell -curl "https://api.huobi.prov1/common/symbols" -``` - -> The above command returns JSON structured like this: - -```json - "data": [ - { - "base-currency": "btc", - "quote-currency": "usdt", - "price-precision": 2, - "amount-precision": 4, - "symbol-partition": "main", - "symbol": "btcusdt" - } - { - "base-currency": "eth", - "quote-currency": "usdt", - "price-precision": 2, - "amount-precision": 4, - "symbol-partition": "main", - "symbol": "ethusdt" - } - ] -``` - -### Request Parameters - - - -### Response Fields - -Field | Data Type | Description ---------- | --------- | ----------- -base-currency | integer | The base currency in this pair -quote-currency | float | The quote currency in this pair -price-precision | integer | The number of decimal place for quoting price -amount-precision| float | The number of decimal place for base asset -symbol-partition| float | The trading partition this pair belongs to, possible values: [main,innovation,bifurcation] - -## Get all Supported Trading Currencies - -This endpoint retrieves all trading currencies supported in Huobi. - -### HTTP Request - -`GET https://api.huobi.pro/v1/common/currencys` - -```shell -curl "https://api.huobi.prov1/common/currencys" -``` - -> The above command returns JSON structured like this: - -```json - "data": [ - "usdt", - "eth", - "etc" - ] -``` - -### Request Parameters - - - -### Response Content - - - -## Get the Current System Time - -This endpoint retrieves the system time of Huobi in epoch milliseconds. - -### HTTP Request - -`GET https://api.huobi.pro/v1/common/timestamp` - -```shell -curl "https://api.huobi.prov1/common/timestamp" -``` - -> The above command returns JSON structured like this: - -```json - "data": 1494900087029 -``` - -### Request Parameters - - - -### Response Content - - - -# Authentication +## 签名认证 Some API endpoints require authentication. To be authenticated, you should first acquire an API key and the corresponding secret key. @@ -249,9 +142,9 @@ https://api.huobi.pro/v1/order/orders?AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xx 2. Add "&Signature=[Your request signature with URL encode]" to your path parameter -# Market Data +# 行情数据 -## Get Klines(candles) +## K 线数据(蜡烛图) This endpoint retrieves all klines in a specific range. @@ -263,7 +156,7 @@ This endpoint retrieves all klines in a specific range. curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json [ @@ -280,15 +173,15 @@ curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" ] ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +Parameter | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc period | string | true | NA | The period of each candle, allowed values are: 1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year size | integer | false | 150 | The number of data returns, range [1, 2000] -### Response Content +### 响应数据 Parameter | Data Type | Description --------- | --------- | ----------- id | integer | The UNIX timestamp in seconds as response id @@ -300,7 +193,7 @@ low | float | The low price high | float | The high price vol | float | The trading volume in base currency -## Get Latest Aggregated Ticker +## 最新的聚合 Ticker This endpoint retrieves the latest ticker with some important 24h aggregated market data. @@ -312,7 +205,7 @@ This endpoint retrieves the latest ticker with some important 24h aggregated mar curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -330,13 +223,13 @@ curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" } ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +Parameter | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -### Response Content +### 响应数据 Parameter | Data Type | Description --------- | --------- | ----------- @@ -351,7 +244,7 @@ vol | float | The trading volume in base currency of last 24 hours bid | object | The current best bid in format [price, quote volume] ask | object | The current best ask in format [price, quote volume] -## Get Latest Tickers for All Pairs +## 所有交易对的最新 Tickers This endpoint retrieves the latest tickers for all supported pairs. @@ -365,7 +258,7 @@ This endpoint retrieves the latest tickers for all supported pairs. curl "https://api.huobi.pro/market/tickers" ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json [ @@ -392,15 +285,15 @@ curl "https://api.huobi.pro/market/tickers" ] ``` -### Request Parameters +### 请求参数 -No parameters are needed for this endpoint. +This endpoint does not require parameters. -### Response Content +### 响应数据 Response content is an array of object, each object has below fields. -Field | Data Type | Description +Parameter | Data Type | Description --------- | --------- | ----------- amount | float | The aggregated trading volume in USDT of last 24 hours count | integer | The number of completed trades of last 24 hours @@ -411,7 +304,7 @@ high | float | The high price of last 24 hours vol | float | The trading volume in base currency of last 24 hours symbol | string | The trading pair of this object, e.g. btcusdt, bccbtc -## Get Market Depth +## 市场深度数据 This endpoint retrieves the current order book of a specific pair. @@ -423,7 +316,7 @@ This endpoint retrieves the current order book of a specific pair. curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -476,18 +369,18 @@ curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" } ``` -### Request Parameters +### 请求参数 Parameter | Data Type | Required | Allowed Value | Description --------- | --------- | -------- | ------------- | ----------- symbol | string | true | All supported trading pair symbols | The trading pair to query, e.g. btcusdt, bccbtc type | string | true | step0, step1, step2, step3, step4, step5 | TBC -### Response Content +### 响应数据 -Field | Data Type | Description +Parameter | Data Type | Description --------- | --------- | ----------- ts | integer | The UNIX timestamp in milliseconds version | integer | TBC @@ -506,7 +399,7 @@ This endpoint retrieves the latest trade with its price, volume, and direction. curl "https://api.huobi.pro/market/trade?symbol=ethusdt" ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -524,13 +417,13 @@ curl "https://api.huobi.pro/market/trade?symbol=ethusdt" } ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +Parameter | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -### Response Content +### 响应数据 @@ -554,7 +447,7 @@ This endpoint retrieves the most recent trades with their price, volume, and dir curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json [ @@ -594,18 +487,18 @@ curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" ] ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +Parameter | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc size | integer | false | 1 | The number of data returns -### Response Content +### 响应数据 -Field | Data Type | Description +Parameter | Data Type | Description --------- | --------- | ----------- id | integer | The unique trade id of this trade amount | float | The trading volume in base currency @@ -613,7 +506,7 @@ price | float | The trading price in quote currency ts | integer | The UNIX timestamp in milliseconds direction | string | The direction of the trade: 'buy' or 'sell' -## Get the Last 24h Market Summary +## 最近24小时行情数据 This endpoint retrieves the summary of trading in the market for the last 24 hours. @@ -625,7 +518,7 @@ This endpoint retrieves the summary of trading in the market for the last 24 hou curl "https://api.huobi.pro/market/detail?symbol=ethusdt" ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -641,17 +534,17 @@ curl "https://api.huobi.pro/market/detail?symbol=ethusdt" } ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +Parameter | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -### Response Content +### 响应数据 -Field | Data Type | Description +Parameter | Data Type | Description --------- | --------- | ----------- id | integer | The UNIX timestamp in seconds as response id amount | float | The aggregated trading volume in USDT @@ -663,17 +556,17 @@ high | float | The high price of last 24 hours vol | float | The trading volume in base currency of last 24 hours version | integer | TBC -# Spot Trading +# 现货交易 -## Place a New Trading Order +## 下单 This endpoint place an trading order and send to the exchange to be matched. ### HTTP Request -`POST https://api.huobi.pro/v1/order/orders/place` +`GET https://api.huobi.pro/v1/order/orders/place` ```shell curl "https://api.huobi.pro/v1/order/orders/place" @@ -686,7 +579,7 @@ BODY { "type": "buy-limit"} ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -694,18 +587,18 @@ BODY { } ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- account-id | string | true | NA | The account id used for this spot trading -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc +symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc type | string | true | NA | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker amount | string | true | NA | The amount in quote currency to buy / the amount in base currency to sell price | string | false | NA | The limit price of limit order source | string | false | api | When trade with margin use 'margin-api' -### Response Content +### 响应数据 @@ -728,7 +621,7 @@ BODY { "type": "buy-limit"} ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -751,21 +644,21 @@ BODY { } ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- account-id | string | false | NA | The account id used for this spot trading -symbol | string | false | NA | The trading pair to trade, e.g. btcusdt, bccbtc +symbol | string | false | NA | 交易对, e.g. btcusdt, bccbtc side | string | false | both | Filter on the direction of the trade, possible values are: buy, sell. Default is to return all size | int | false | 10 | The max number of orders to return -### Response Content +### 响应数据 -Parameter | Data Type | Description +参数 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | order id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc +symbol | string | 交易对, e.g. btcusdt, bccbtc price | string | The limit price of limit order created-at | int | The timestamp in milliseconds when the order was created type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker @@ -789,7 +682,7 @@ This endpoint submit a request to cancel an order. curl "https://api.huobi.pro/v1/order/orders/59378/submitcancel" ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -797,13 +690,55 @@ curl "https://api.huobi.pro/v1/order/orders/59378/submitcancel" } ``` -### Request Parameters +## Submit Cancel for Multiple Orders at Once -No parameter is needed for this endpoint. +This endpoint submit cancellation for multiple orders at once. -### Response Content +### HTTP Request - +`GET https://api.huobi.pro/v1/order/orders/batchcancel` + +```shell +curl "https://api.huobi.pro/v1/order/orders/batchcancel" +BODY { + "order-ids": [ + "1", "2", "3" + ] +} +``` + +> 以上命令返回的 JSON 结果: + +```json +{ + "data": { + "success": [ + "1", + "3" + ], + "failed": [ + { + "err-msg": "记录无效", + "order-id": "2", + "err-code": "base-record-invalid" + } + ] + } +} +``` + +### 请求参数 + +参数 | 数据类型 | 是否必须 | 默认值 | 描述 +--------- | --------- | -------- | ------- | ----------- +order-ids | list | true | NA | The order ids to cancel. Max size is 50. + +### 响应数据 + +参数 | 数据类型 | 描述 +--------- | --------- | ----------- +success | list | The order ids with thier cancel request sent successfully +failed | list | The details of the failed cancel request ## Submit Cancel for Multiple Orders at Once @@ -811,7 +746,7 @@ This endpoint submit cancellation for multiple orders at once. ### HTTP Request -`POST https://api.huobi.pro/v1/order/orders/batchcancel` +`GET https://api.huobi.pro/v1/order/orders/batchcancel` ```shell curl "https://api.huobi.pro/v1/order/orders/batchcancel" @@ -822,7 +757,7 @@ BODY { } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -842,20 +777,20 @@ BODY { } ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- order-ids | list | true | NA | The order ids to cancel. Max size is 50. -### Response Content +### 响应数据 -Field | Data Type | Description ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request +参数 | 数据类型 | 描述 +--------- | --------- | ----------- +success | list | The order ids with thier cancel request sent successfully +failed | list | The details of the failed cancel request -## Show the Order Detail of an Order +## Show the Order Detail of One Order This endpoint returns the detail of one order. @@ -867,7 +802,7 @@ This endpoint returns the detail of one order. curl "https://api.huobi.pro/v1/order/orders/59378" ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -893,16 +828,12 @@ curl "https://api.huobi.pro/v1/order/orders/59378" } ``` -### Request Parameters - -No parameter is needed for this endpoint. - -### Response Content +### 响应数据 -Field | Data Type | Description +参数 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | order id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc +symbol | string | 交易对, e.g. btcusdt, bccbtc account-id | string | The account id which this order belongs to amount | string | The amount of base currency in this order price | string | The limit price of limit order @@ -930,9 +861,10 @@ This endpoint returns the match result of an order. curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json +{ "data": [ { "id": 29553, @@ -947,20 +879,17 @@ curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" "created-at": 1494901400435 } ] +} ``` -### Request Parameters - - - -### Response Content +### 响应数据 -Parameter | Data Type | Description +参数 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | Internal id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc +symbol | string | 交易对, e.g. btcusdt, bccbtc order-id | string | The order id of this order match-id | string | The match id of this match price | string | The limit price of limit order @@ -990,7 +919,7 @@ BODY { } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -1018,28 +947,28 @@ BODY { } ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc +symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc types | string | false | All | The types of order to include in the search -states | string | false | All | The states of order to include in the search +states | string | false | All | 订单状态 start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd end-date | string | false | today | Search ends date, in format yyyy-mm-dd from | string | false | both | Search order id to begin with direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' size | int | false | 100 | The max number of orders to return, max value is 100 -### Response Content +### 响应数据 -Field | Data Type | Description +参数 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | Order id account-id | integer | Account id user-id | integer | User id amount | string | The amount of base currency in this order -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc +symbol | string | 交易对, e.g. btcusdt, bccbtc price | string | The limit price of limit order created-at | int | The timestamp in milliseconds when the order was created canceled-at | int | The timestamp in milliseconds when the order was canceled, or 0 if not canceled @@ -1065,7 +994,7 @@ This endpoint returns the match results of past and open orders based on specifi curl "https://api.huobi.pro/v1/order/matchresults" ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -1086,27 +1015,27 @@ curl "https://api.huobi.pro/v1/order/matchresults" } ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc +symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc types | string | false | All | The types of order to include in the search -states | string | false | All | The states of order to include in the search +states | string | false | All | 订单状态 start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd end-date | string | false | today | Search ends date, in format yyyy-mm-dd from | string | false | NA | Search match result id to begin with direct | string | false | next | Search direction when 'from' is used, possible values: 'next', 'prev' size | int | false | 100 | The max number of orders to return -### Response Content +### 响应数据 -Parameter | Data Type | Description +参数 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | Internal id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc +symbol | string | 交易对, e.g. btcusdt, bccbtc order-id | string | The order id of this order match-id | string | The match id of this match price | string | The limit price of limit order @@ -1116,7 +1045,7 @@ filled-amount | string | The amount which has been filled filled-fees | string | Transaction fee paid so far source | string | The source where the order was triggered, possible values: sys, web, api, app -# Margin Trading +# 杠杆交易 @@ -1124,16 +1053,16 @@ source | string | The source where the order was triggered, poss -## Transfer Asset from Spot Trading Account to Margin Account +## 从现货账户划转到杠杆账户 -This endpoint transfer specific asset from spot trading account to margin account. +此接口用于将资产从现货账户划转到杠杆账户。 ### HTTP Request -`POST https://api.huobi.pro/v1/dw/transfer-in/margin` +`POST https://api.huobi.pro/v1/dw/transfer-in` ```shell -curl "https://api.huobi.pro/v1/dw/transfer-in/margin" +curl "https://api.huobi.pro/v1/dw/transfer-in" BODY { "symbol": "ethusdt", @@ -1142,7 +1071,7 @@ BODY } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -1150,32 +1079,32 @@ BODY } ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow +symbol | string | true | NA | 交易对, e.g. btcusdt, bchbtc +currency | string | true | NA | 币种 +amount | string | true | NA | 划转数量 -### Response Content +### 响应数据 -Field | Data Type | Description +参数 | 数据类型 | 描述 --------- | --------- | ----------- data | integer | Transfer id -## Transfer Asset from Margin Account to Spot Trading Account +## 从杠杆账户划转到现货账户 -This endpoint transfer specific asset from margin account to spot trading account. +此接口用于将资产从杠杆账户划转到现货账户。 ### HTTP Request -`POST https://api.huobi.pro/v1/dw/transfer-out/margin` +`GET https://api.huobi.pro/v1/dw/transfer-out` ```shell -curl "https://api.huobi.pro/v1/dw/transfer-out/margin" +curl "https://api.huobi.pro/v1/dw/transfer-out" BODY { "symbol": "ethusdt", @@ -1184,7 +1113,7 @@ BODY } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -1192,25 +1121,25 @@ BODY } ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow +symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc +currency | string | true | NA | 币种 +amount | string | true | NA | 划转数量 -### Response Content +### 响应数据 -Field | Data Type | Description +参数 | 数据类型 | 描述 --------- | --------- | ----------- data | integer | Transfer id -## Place a Margin Loan Order +## 申请借贷 -This endpoint place an order to initiate a margin loan. +此接口用于申请借贷. ### HTTP Request @@ -1226,7 +1155,7 @@ BODY } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -1234,25 +1163,25 @@ BODY } ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow +symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc +currency | string | true | NA | 币种 +amount | string | true | NA | 借贷数量 -### Response Content +### 响应数据 -Field | Data Type | Description +参数 | 数据类型 | 描述 --------- | --------- | ----------- data | integer | Margin order id -## Repay Margin Loan +## 归还借贷 -This endpoint repays margin loan with you asset in your margin account. +此接口用于归还借贷. ### HTTP Request @@ -1266,7 +1195,7 @@ BODY } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -1274,27 +1203,27 @@ BODY } ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -amount | string | true | NA | The amount of currency to repay +amount | string | true | NA | 归还币种 -### Response Content +### 响应数据 -Field | Data Type | Description +参数 | 数据类型 | 描述 --------- | --------- | ----------- data | integer | Margin order id -## Search Past Margin Orders +## 查询借贷订单 This endpoint returns margin orders based on a specific searching criteria. ### HTTP Request -`GET https://api.huobi.pro/v1/margin/loan-orders` +`POST https://api.huobi.pro/v1/margin/loan-orders` ```shell curl "https://api.huobi.pro/v1/margin/load-orders" @@ -1308,7 +1237,7 @@ BODY { } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -1332,21 +1261,21 @@ BODY { } ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -states | string | false | All | The states of order to include in the search +symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc +states | string | false | All | 订单状态 start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd +end-date | string | false | today | Search ends date, in format yyyy-mm-dd from | string | false | both | Search order id to begin with direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' size | int | false | 100 | The max number of orders to return, max value is 100 -### Response Content +### 响应数据 -Field | Data Type | Description +参数 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | Order id account-id | integer | Account id @@ -1363,7 +1292,7 @@ interest-amount | string | The accumulated loan interest interest-balance | string | The amount of loan interest left state | string | Loan state, possible values: created, accrual, cleared, invalid -## Return the Balance of the Margin Loan Account +## 借贷账户详情 This endpoint returns the balance of the margin loan account. @@ -1372,66 +1301,74 @@ This endpoint returns the balance of the margin loan account. `GET https://api.huobi.pro/v1/margin/accounts/balance` ```shell -curl "https://api.huobi.pro/v1/margin/accounts/balance?symbol=btcusdt" +curl "https://api.huobi.pro/v1/margin/accounts/balance" +BODY { + "account-id": "100009", + "amount": "10.1", + "price": "100.1", + "source": "api", + "symbol": "ethusdt", + "type": "buy-limit" + } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { "data": [ - { - "id": 18264, - "type": "margin", - "state": "working", - "symbol": "btcusdt", - "fl-price": "0", - "fl-type": "safe", - "risk-rate": "475.952571086994250554", - "list": [ - { - "currency": "btc", - "type": "trade", - "balance": "1168.533000000000000000" - }, - { - "currency": "btc", - "type": "frozen", - "balance": "0.000000000000000000" - }, - { - "currency": "btc", - "type": "loan", - "balance": "-2.433000000000000000" - }, - { - "currency": "btc", - "type": "interest", - "balance": "-0.000533000000000000" - }, - { - "currency": "btc", - "type": "transfer-out-available",//可转btc - "balance": "1163.872174670000000000" - }, - { - "currency": "btc", - "type": "loan-available",//可借btc - "balance": "8161.876538350676000000" - } - ] - } - ] + { + "id": 18264, + "type": "margin", + "state": "working", + "symbol": "btcusdt", + "fl-price": "0", + "fl-type": "safe", + "risk-rate": "475.952571086994250554", + "list": [ + { + "currency": "btc", + "type": "trade", + "balance": "1168.533000000000000000" + }, + { + "currency": "btc", + "type": "frozen", + "balance": "0.000000000000000000" + }, + { + "currency": "btc", + "type": "loan", + "balance": "-2.433000000000000000" + }, + { + "currency": "btc", + "type": "interest", + "balance": "-0.000533000000000000" + }, + { + "currency": "btc", + "type": "transfer-out-available",//可转btc + "balance": "1163.872174670000000000" + }, + { + "currency": "btc", + "type": "loan-available",//可借btc + "balance": "8161.876538350676000000" + } + ] + } + ] } ``` -### Request Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc +symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc -### Response Content +### 响应数据 Parameter | Data Type | Description --------- | --------- | ----------- @@ -1441,418 +1378,10 @@ risk-rate | string | The risk rate fl-price | string | The price which triggers closeout list | object array | The list of loans and their details -# Wallet (Deposit and Withdraw) - - - -## Create a Withdraw Request - -This endpoint creates a withdraw request from your spot trading account to an external address. - - - -### HTTP Request - -`POST https://api.huobi.pro/v1/dw/withdraw/api/create` - -```shell -curl "https://api.huobi.pro/v1/dw/withdraw/api/create" -BODY -{ - "address": "0xde709f2102306220921060314715629080e2fb77", - "amount": "0.05", - "currency": "eth", - "fee": "0.01" -} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": 1000 -} -``` - -### Request Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -address | string | true | NA | The desination address of this withdraw -currency | string | true | NA | The crypto currency to withdraw -amount | string | true | NA | The amount of currency to withdraw -fee | string | false | NA | The fee to pay with this withdraw -addr-tag | string | false | NA | A tag specified for this address - -### Response Content - - - -Field | Data Type | Description ---------- | --------- | ----------- -data | integer | Transfer id - - - -## Cancel a Withdraw Request - -This endpoint cancels a previously created withdraw request by its transfer id. - -### HTTP Request - -`POST https://api.huobi.pro/v1/dw/withdraw-virtual/{withdraw-id}/cancel` +# 钱包(充值与提现) -```shell -curl "https://api.huobi.pro/v1/dw/withdraw-virtual/1000/cancel" -``` - -> The above command returns JSON structured like this: - -```json -{ - "status": "ok", - "data": 700 -} -``` - -### Request Parameters - - - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Withdraw cancel id - -## Search for Existed Withdraws and Deposits - -This endpoint searches for all existed withdraws and deposits and return their latest status. - -### HTTP Request +TBC -`GET https://api.huobi.pro/v1/query/deposit-withdraw` +# 账户相关 -```shell -curl "https://api.huobi.pro/v1/query/deposit-withdraw?currency=xrp&type=deposit&from=5&size=12" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 1171, - "type": "deposit", - "currency": "xrp", - "tx-hash": "ed03094b84eafbe4bc16e7ef766ee959885ee5bcb265872baaa9c64e1cf86c2b", - "amount": 7.457467, - "address": "rae93V8d2mdoUQHwBDBdM4NHCMehRJAsbm", - "address-tag": "100040", - "fee": 0, - "state": "safe", - "created-at": 1510912472199, - "updated-at": 1511145876575 - } - ] -} -``` - -### Request Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -currency | string | true | NA | The crypto currency to withdraw -type | string | true | NA | Define transfer type to search, possible values: [deposit, withdraw] -from | string | true | NA | The transfer id to begin search -size | string | true | NA | The max number of items to return - -### Response Content - -Field | Data Type | Description ---------- | --------- | ----------- -id | integer | Transfer id -type | string | Define transfer type to search, possible values: [deposit, withdraw] -currency | string | The crypto currency to withdraw -tx-hash | string | The on-chain transaction hash -amount | integer | The number of crypto asset transfered in its minimum unit -address | string | The deposit or withdraw source address -address-tag | string | The user defined address tag -fee | integer | The amount of fee taken by Huobi in this crypto's minimum unit -state | string | The state of this transfer (see below for details) -created-at | integer | The timestamp in milliseconds for the transfer creation -updated-at | integer | The timestamp in milliseconds for the transfer's latest update - -**List of possible withdraw state** - -State | Description ---------- | ----------- -submitted | Withdraw request submitted successfully -reexamine | Under examination for withdraw validation -canceled | Withdraw canceled by user -pass | Withdraw validation passed -reject | Withdraw validation rejected -pre-transfer | Withdraw is about to be released -wallet-transfer | On-chain transfer initiated -wallet-reject | Transfer rejected by chain -confirmed | On-chain transfer completed with one confirmation -confirm-error | On-chain transfer faied to get confirmation -repealed | Withdraw terminated by system - -**List of possible deposit state** - -State | Description ---------- | ----------- -unknown | On-chain transfer has not been received -confirming | On-chain transfer waits for first confirmation -confirmed | On-chain transfer confirmed for at least one block -safe | Multiple on-chain confirmation happened -orphan | Confirmed but currently in an orphan branch - -# Account - - - -## Get all Accounts of the Current User - -This endpoint returns a list of accounts owned by this API user. - -### HTTP Request - -`GET https://api.huobi.pro/v1/account/accounts` - -```shell -curl "https://api.huobi.pro/v1/account/accounts" -``` - -> The above command returns JSON structured like this: - -```json - "data": [ - { - "id": 100009, - "type": "spot", - "state": "working", - "user-id": 1000 - } - ] -``` - -### Request Parameters - - - -### Response Content - -Field | Data Type | Description ---------- | --------- | ----------- -id | integer | Unique account id -state | string | Account state, possible values: [working, lock] -type | string | The type of this account, possible values: [spot, margin, otc, point] - -## Get Account Balance of a Specific Account - -This endpoint returns the balance of an account specified by account id. - -### HTTP Request - -`GET https://api.huobi.pro/v1/account/accounts/{account-id}/balance` - -```shell -curl "https://api.huobi.pro/v1/account/accounts/100009/balance" -``` - -> The above command returns JSON structured like this: - -```json -"data": { - "id": 100009, - "type": "spot", - "state": "working", - "list": [ - { - "currency": "usdt", - "type": "trade", - "balance": "500009195917.4362872650" - }, - { - "currency": "usdt", - "type": "frozen", - "balance": "328048.1199920000" - }, - { - "currency": "etc", - "type": "trade", - "balance": "499999894616.1302471000" - } - ], - } -} -``` - -### Request Parameters - - - -### Response Content - -Field | Data Type | Description ---------- | --------- | ----------- -id | integer | Unique account id -state | string | Account state, possible values: [working, lock] -type | string | The type of this account, possible values: [spot, margin, otc, point] -list | object | The balance details of each currency - -**Per list item content** - -Parameter | Data Type | Description ---------- | --------- | ----------- -currency | string | The currency of this balance -type | string | The balance type, possible values: [trade, frozen] -balance | string | The balance in the main currency unit - -## Get Account Balance of a Sub-Account - -This endpoint returns the balance of a sub-account specified by sub-account uid. - -### HTTP Request - -`GET https://api.huobi.pro/v1/account/accounts/{sub-account-uid}` - -```shell -curl "https://api.huobi.pro/v1/account/accounts/10758899" -``` - -> The above command returns JSON structured like this: - -```json -"data": [ -{ - "id": 9910049, - "type": "spot", - "list": [ - { - "currency": "btc", - "type": "trade", - "balance": "1.00" - }, - { - "currency": "eth", - "type": "trade", - "balance": "1934.00" - } - ] -}, -{ - "id": 9910050, - "type": "point", - "list": [] -} -] -``` - -### Request Parameters - - - -### Response Content - - - -Field | Data Type | Description ---------- | --------- | ----------- -id | integer | Unique account id -type | string | The type of this account, possible values: [spot, margin, otc, point] -list | object | The balance details of each currency - -**Per list item content** - -Field | Data Type | Description ---------- | --------- | ----------- -currency | string | The currency of this balance -type | string | The balance type, possible values: [trade, frozen] -balance | string | The balance in the main currency unit - -## Get the Aggregated Balance of all Sub-accounts of the Current User - -This endpoint returns the balances of all the sub-account aggregated. - -### HTTP Request - -`GET https://api.huobi.pro/v1/subuser/aggregate-balance` - -```shell -curl "https://api.huobi.pro/v1/subuser/aggregate-balance" -``` - -> The above command returns JSON structured like this: - -```json - "data": [ - { - "currency": "eos", - "balance": "1954559.809500000000000000" - }, - { - "currency": "btc", - "balance": "0.000000000000000000" - }, - { - "currency": "usdt", - "balance": "2925209.411300000000000000" - } - ] -``` - -### Request Parameters - - - -### Response Content - - - -Field | Data Type | Description ---------- | --------- | ----------- -currency | string | The currency of this balance -balance | string | The balance in the main currency unit - -## Transfer Asset between Parent and Sub Account - -This endpoint allows user to transfer asset between parent and sub account. - -### HTTP Request - -`POST https://api.huobi.pro/v1/subuser/transfer` - -```shell -curl "https://api.huobi.pro/v1/subuser/transfer" -Body - -``` - -> The above command returns JSON structured like this: - -```json - "data": 12345 -``` - -### Request Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -sub-uid | integer | true | NA | The target sub account uid to transfer to or from -currency | string | true | NA | The crypto currency to transfer -amount | decimal | true | NA | The amount of asset to transfer -type | string | true | NA | The type of transfer, possible values: [master-transfer-in, master-transfer-out, master-point-transfer-in, master-point-transfer-out] - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Unique transfer id \ No newline at end of file +TBC From 075c878df77514bebac06758ec397dcfe816fae9 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 3 Jan 2019 15:21:29 +0800 Subject: [PATCH 011/759] update --- source/index.html.md | 987 ++++++++++++++++++++++++++++++++----------- 1 file changed, 729 insertions(+), 258 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 066286e9bd5..6c5baf31653 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1,5 +1,5 @@ --- -title: 火币 API 文档 v1.0 +title: Huobi API Reference V1 English language_tabs: # must be one of https://git.io/vQNgJ - shell @@ -13,19 +13,19 @@ includes: search: true --- -# API v1.0 简介 +# Introduction Welcome to the Huobi API! You can use our API to access all market data, trading, and account management endpoints. We have language bindings in Shell, and Python! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right. -# 概述 +# General -## 请求格式 +## Request Format -All API requests are in either GET or POST method. For GET request, all parameters are path parameters. For POST request, all parameters are in POST body and in JSON format. +All API requests are in either GET or POST method. For GET request, all parameters are query string parameters. For POST request, all parameters are in POST body and in JSON format. -## 返回格式 +## Response Format All response will be returned in JSON format. The top level JSON is a wrapper object which provides three metadata in "status", "ch", and "ts". The actual per API response data is in "data" field. @@ -42,18 +42,125 @@ All response will be returned in JSON format. The top level JSON is a wrapper ob } ``` -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- status | string | The overall API call result status ch | string | The data channel this response was originated from. Some API return does not have this field. ts | int | The timestamp in milliseconds for when the response is created data | object | The actual response content per API -## 限频规则 + + +## Endpoint Rate Limit Each apikey can send maximum of 100 https requests within 10 seconds. Please contact customer support if you believe you need higher limit rate. -## 签名认证 +## Get all Supported Trading Pairs + +This endpoint retrieves all trading pairs supported in Huobi. + +### HTTP Request + +`GET https://api.huobi.pro/v1/common/symbols` + +```shell +curl "https://api.huobi.prov1/common/symbols" +``` + +> The above command returns JSON structured like this: + +```json + "data": [ + { + "base-currency": "btc", + "quote-currency": "usdt", + "price-precision": 2, + "amount-precision": 4, + "symbol-partition": "main", + "symbol": "btcusdt" + } + { + "base-currency": "eth", + "quote-currency": "usdt", + "price-precision": 2, + "amount-precision": 4, + "symbol-partition": "main", + "symbol": "ethusdt" + } + ] +``` + +### Request Parameters + + + +### Response Fields + +Field | Data Type | Description +--------- | --------- | ----------- +base-currency | integer | The base currency in this pair +quote-currency | float | The quote currency in this pair +price-precision | integer | The number of decimal place for quoting price +amount-precision| float | The number of decimal place for base asset +symbol-partition| float | The trading partition this pair belongs to, possible values: [main,innovation,bifurcation] + +## Get all Supported Trading Currencies + +This endpoint retrieves all trading currencies supported in Huobi. + +### HTTP Request + +`GET https://api.huobi.pro/v1/common/currencys` + +```shell +curl "https://api.huobi.prov1/common/currencys" +``` + +> The above command returns JSON structured like this: + +```json + "data": [ + "usdt", + "eth", + "etc" + ] +``` + +### Request Parameters + + + +### Response Content + + + +## Get the Current System Time + +This endpoint retrieves the system time of Huobi in epoch milliseconds. + +### HTTP Request + +`GET https://api.huobi.pro/v1/common/timestamp` + +```shell +curl "https://api.huobi.prov1/common/timestamp" +``` + +> The above command returns JSON structured like this: + +```json + "data": 1494900087029 +``` + +### Request Parameters + + + +### Response Content + + + +# Authentication Some API endpoints require authentication. To be authenticated, you should first acquire an API key and the corresponding secret key. @@ -142,9 +249,9 @@ https://api.huobi.pro/v1/order/orders?AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xx 2. Add "&Signature=[Your request signature with URL encode]" to your path parameter -# 行情数据 +# Market Data -## K 线数据(蜡烛图) +## Get Klines(candles) This endpoint retrieves all klines in a specific range. @@ -156,7 +263,7 @@ This endpoint retrieves all klines in a specific range. curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json [ @@ -173,15 +280,15 @@ curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" ] ``` -### 请求参数 +### Request Parameters -Parameter | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc period | string | true | NA | The period of each candle, allowed values are: 1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year size | integer | false | 150 | The number of data returns, range [1, 2000] -### 响应数据 +### Response Content Parameter | Data Type | Description --------- | --------- | ----------- id | integer | The UNIX timestamp in seconds as response id @@ -193,7 +300,7 @@ low | float | The low price high | float | The high price vol | float | The trading volume in base currency -## 最新的聚合 Ticker +## Get Latest Aggregated Ticker This endpoint retrieves the latest ticker with some important 24h aggregated market data. @@ -205,7 +312,7 @@ This endpoint retrieves the latest ticker with some important 24h aggregated mar curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -223,13 +330,13 @@ curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" } ``` -### 请求参数 +### Request Parameters -Parameter | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -### 响应数据 +### Response Content Parameter | Data Type | Description --------- | --------- | ----------- @@ -244,7 +351,7 @@ vol | float | The trading volume in base currency of last 24 hours bid | object | The current best bid in format [price, quote volume] ask | object | The current best ask in format [price, quote volume] -## 所有交易对的最新 Tickers +## Get Latest Tickers for All Pairs This endpoint retrieves the latest tickers for all supported pairs. @@ -258,7 +365,7 @@ This endpoint retrieves the latest tickers for all supported pairs. curl "https://api.huobi.pro/market/tickers" ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json [ @@ -285,15 +392,15 @@ curl "https://api.huobi.pro/market/tickers" ] ``` -### 请求参数 +### Request Parameters -This endpoint does not require parameters. +No parameters are needed for this endpoint. -### 响应数据 +### Response Content Response content is an array of object, each object has below fields. -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- amount | float | The aggregated trading volume in USDT of last 24 hours count | integer | The number of completed trades of last 24 hours @@ -304,7 +411,7 @@ high | float | The high price of last 24 hours vol | float | The trading volume in base currency of last 24 hours symbol | string | The trading pair of this object, e.g. btcusdt, bccbtc -## 市场深度数据 +## Get Market Depth This endpoint retrieves the current order book of a specific pair. @@ -316,7 +423,7 @@ This endpoint retrieves the current order book of a specific pair. curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -369,18 +476,18 @@ curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" } ``` -### 请求参数 +### Request Parameters Parameter | Data Type | Required | Allowed Value | Description --------- | --------- | -------- | ------------- | ----------- symbol | string | true | All supported trading pair symbols | The trading pair to query, e.g. btcusdt, bccbtc type | string | true | step0, step1, step2, step3, step4, step5 | TBC -### 响应数据 +### Response Content -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- ts | integer | The UNIX timestamp in milliseconds version | integer | TBC @@ -399,7 +506,7 @@ This endpoint retrieves the latest trade with its price, volume, and direction. curl "https://api.huobi.pro/market/trade?symbol=ethusdt" ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -417,13 +524,13 @@ curl "https://api.huobi.pro/market/trade?symbol=ethusdt" } ``` -### 请求参数 +### Request Parameters -Parameter | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -### 响应数据 +### Response Content @@ -447,7 +554,7 @@ This endpoint retrieves the most recent trades with their price, volume, and dir curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json [ @@ -487,18 +594,18 @@ curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" ] ``` -### 请求参数 +### Request Parameters -Parameter | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc size | integer | false | 1 | The number of data returns -### 响应数据 +### Response Content -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- id | integer | The unique trade id of this trade amount | float | The trading volume in base currency @@ -506,7 +613,7 @@ price | float | The trading price in quote currency ts | integer | The UNIX timestamp in milliseconds direction | string | The direction of the trade: 'buy' or 'sell' -## 最近24小时行情数据 +## Get the Last 24h Market Summary This endpoint retrieves the summary of trading in the market for the last 24 hours. @@ -518,7 +625,7 @@ This endpoint retrieves the summary of trading in the market for the last 24 hou curl "https://api.huobi.pro/market/detail?symbol=ethusdt" ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -534,17 +641,17 @@ curl "https://api.huobi.pro/market/detail?symbol=ethusdt" } ``` -### 请求参数 +### Request Parameters -Parameter | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -### 响应数据 +### Response Content -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- id | integer | The UNIX timestamp in seconds as response id amount | float | The aggregated trading volume in USDT @@ -556,17 +663,17 @@ high | float | The high price of last 24 hours vol | float | The trading volume in base currency of last 24 hours version | integer | TBC -# 现货交易 +# Spot Trading -## 下单 +## Place a New Trading Order This endpoint place an trading order and send to the exchange to be matched. ### HTTP Request -`GET https://api.huobi.pro/v1/order/orders/place` +`POST https://api.huobi.pro/v1/order/orders/place` ```shell curl "https://api.huobi.pro/v1/order/orders/place" @@ -579,7 +686,7 @@ BODY { "type": "buy-limit"} ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -587,18 +694,18 @@ BODY { } ``` -### 请求参数 +### Request Parameters -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- account-id | string | true | NA | The account id used for this spot trading -symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc +symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc type | string | true | NA | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker amount | string | true | NA | The amount in quote currency to buy / the amount in base currency to sell price | string | false | NA | The limit price of limit order source | string | false | api | When trade with margin use 'margin-api' -### 响应数据 +### Response Content @@ -621,7 +728,7 @@ BODY { "type": "buy-limit"} ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -644,21 +751,21 @@ BODY { } ``` -### 请求参数 +### Request Parameters -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- account-id | string | false | NA | The account id used for this spot trading -symbol | string | false | NA | 交易对, e.g. btcusdt, bccbtc +symbol | string | false | NA | The trading pair to trade, e.g. btcusdt, bccbtc side | string | false | both | Filter on the direction of the trade, possible values are: buy, sell. Default is to return all size | int | false | 10 | The max number of orders to return -### 响应数据 +### Response Content -参数 | 数据类型 | 描述 +Parameter | Data Type | Description --------- | --------- | ----------- id | integer | order id -symbol | string | 交易对, e.g. btcusdt, bccbtc +symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc price | string | The limit price of limit order created-at | int | The timestamp in milliseconds when the order was created type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker @@ -682,7 +789,7 @@ This endpoint submit a request to cancel an order. curl "https://api.huobi.pro/v1/order/orders/59378/submitcancel" ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -690,55 +797,13 @@ curl "https://api.huobi.pro/v1/order/orders/59378/submitcancel" } ``` -## Submit Cancel for Multiple Orders at Once - -This endpoint submit cancellation for multiple orders at once. +### Request Parameters -### HTTP Request +No parameter is needed for this endpoint. -`GET https://api.huobi.pro/v1/order/orders/batchcancel` +### Response Content -```shell -curl "https://api.huobi.pro/v1/order/orders/batchcancel" -BODY { - "order-ids": [ - "1", "2", "3" - ] -} -``` - -> 以上命令返回的 JSON 结果: - -```json -{ - "data": { - "success": [ - "1", - "3" - ], - "failed": [ - { - "err-msg": "记录无效", - "order-id": "2", - "err-code": "base-record-invalid" - } - ] - } -} -``` - -### 请求参数 - -参数 | 数据类型 | 是否必须 | 默认值 | 描述 ---------- | --------- | -------- | ------- | ----------- -order-ids | list | true | NA | The order ids to cancel. Max size is 50. - -### 响应数据 - -参数 | 数据类型 | 描述 ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request + ## Submit Cancel for Multiple Orders at Once @@ -746,7 +811,7 @@ This endpoint submit cancellation for multiple orders at once. ### HTTP Request -`GET https://api.huobi.pro/v1/order/orders/batchcancel` +`POST https://api.huobi.pro/v1/order/orders/batchcancel` ```shell curl "https://api.huobi.pro/v1/order/orders/batchcancel" @@ -757,7 +822,7 @@ BODY { } ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -777,20 +842,20 @@ BODY { } ``` -### 请求参数 +### Request Parameters -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- order-ids | list | true | NA | The order ids to cancel. Max size is 50. -### 响应数据 +### Response Content -参数 | 数据类型 | 描述 ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request +Field | Data Type | Description +--------- | --------- | ----------- +success | list | The order ids with thier cancel request sent successfully +failed | list | The details of the failed cancel request -## Show the Order Detail of One Order +## Show the Order Detail of an Order This endpoint returns the detail of one order. @@ -802,7 +867,7 @@ This endpoint returns the detail of one order. curl "https://api.huobi.pro/v1/order/orders/59378" ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -828,12 +893,16 @@ curl "https://api.huobi.pro/v1/order/orders/59378" } ``` -### 响应数据 +### Request Parameters + +No parameter is needed for this endpoint. + +### Response Content -参数 | 数据类型 | 描述 +Field | Data Type | Description --------- | --------- | ----------- id | integer | order id -symbol | string | 交易对, e.g. btcusdt, bccbtc +symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc account-id | string | The account id which this order belongs to amount | string | The amount of base currency in this order price | string | The limit price of limit order @@ -861,10 +930,9 @@ This endpoint returns the match result of an order. curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json -{ "data": [ { "id": 29553, @@ -879,17 +947,20 @@ curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" "created-at": 1494901400435 } ] -} ``` -### 响应数据 +### Request Parameters + + + +### Response Content -参数 | 数据类型 | 描述 +Parameter | Data Type | Description --------- | --------- | ----------- id | integer | Internal id -symbol | string | 交易对, e.g. btcusdt, bccbtc +symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc order-id | string | The order id of this order match-id | string | The match id of this match price | string | The limit price of limit order @@ -919,7 +990,7 @@ BODY { } ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -947,28 +1018,28 @@ BODY { } ``` -### 请求参数 +### Request Parameters -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc +symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc types | string | false | All | The types of order to include in the search -states | string | false | All | 订单状态 +states | string | false | All | The states of order to include in the search start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd end-date | string | false | today | Search ends date, in format yyyy-mm-dd from | string | false | both | Search order id to begin with direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' size | int | false | 100 | The max number of orders to return, max value is 100 -### 响应数据 +### Response Content -参数 | 数据类型 | 描述 +Field | Data Type | Description --------- | --------- | ----------- id | integer | Order id account-id | integer | Account id user-id | integer | User id amount | string | The amount of base currency in this order -symbol | string | 交易对, e.g. btcusdt, bccbtc +symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc price | string | The limit price of limit order created-at | int | The timestamp in milliseconds when the order was created canceled-at | int | The timestamp in milliseconds when the order was canceled, or 0 if not canceled @@ -994,7 +1065,7 @@ This endpoint returns the match results of past and open orders based on specifi curl "https://api.huobi.pro/v1/order/matchresults" ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -1015,27 +1086,27 @@ curl "https://api.huobi.pro/v1/order/matchresults" } ``` -### 请求参数 +### Request Parameters -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc +symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc types | string | false | All | The types of order to include in the search -states | string | false | All | 订单状态 +states | string | false | All | The states of order to include in the search start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd end-date | string | false | today | Search ends date, in format yyyy-mm-dd from | string | false | NA | Search match result id to begin with direct | string | false | next | Search direction when 'from' is used, possible values: 'next', 'prev' size | int | false | 100 | The max number of orders to return -### 响应数据 +### Response Content -参数 | 数据类型 | 描述 +Parameter | Data Type | Description --------- | --------- | ----------- id | integer | Internal id -symbol | string | 交易对, e.g. btcusdt, bccbtc +symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc order-id | string | The order id of this order match-id | string | The match id of this match price | string | The limit price of limit order @@ -1045,7 +1116,7 @@ filled-amount | string | The amount which has been filled filled-fees | string | Transaction fee paid so far source | string | The source where the order was triggered, possible values: sys, web, api, app -# 杠杆交易 +# Margin Trading @@ -1053,16 +1124,16 @@ source | string | The source where the order was triggered, poss -## 从现货账户划转到杠杆账户 +## Transfer Asset from Spot Trading Account to Margin Account -此接口用于将资产从现货账户划转到杠杆账户。 +This endpoint transfer specific asset from spot trading account to margin account. ### HTTP Request -`POST https://api.huobi.pro/v1/dw/transfer-in` +`POST https://api.huobi.pro/v1/dw/transfer-in/margin` ```shell -curl "https://api.huobi.pro/v1/dw/transfer-in" +curl "https://api.huobi.pro/v1/dw/transfer-in/margin" BODY { "symbol": "ethusdt", @@ -1071,7 +1142,7 @@ BODY } ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -1079,32 +1150,32 @@ BODY } ``` -### 请求参数 +### Request Parameters -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对, e.g. btcusdt, bchbtc -currency | string | true | NA | 币种 -amount | string | true | NA | 划转数量 +symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc +currency | string | true | NA | The currency to borrow +amount | string | true | NA | The amount of currency to borrow -### 响应数据 +### Response Content -参数 | 数据类型 | 描述 +Field | Data Type | Description --------- | --------- | ----------- data | integer | Transfer id -## 从杠杆账户划转到现货账户 +## Transfer Asset from Margin Account to Spot Trading Account -此接口用于将资产从杠杆账户划转到现货账户。 +This endpoint transfer specific asset from margin account to spot trading account. ### HTTP Request -`GET https://api.huobi.pro/v1/dw/transfer-out` +`POST https://api.huobi.pro/v1/dw/transfer-out/margin` ```shell -curl "https://api.huobi.pro/v1/dw/transfer-out" +curl "https://api.huobi.pro/v1/dw/transfer-out/margin" BODY { "symbol": "ethusdt", @@ -1113,7 +1184,7 @@ BODY } ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -1121,25 +1192,25 @@ BODY } ``` -### 请求参数 +### Request Parameters -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc -currency | string | true | NA | 币种 -amount | string | true | NA | 划转数量 +symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc +currency | string | true | NA | The currency to borrow +amount | string | true | NA | The amount of currency to borrow -### 响应数据 +### Response Content -参数 | 数据类型 | 描述 +Field | Data Type | Description --------- | --------- | ----------- data | integer | Transfer id -## 申请借贷 +## Place a Margin Loan Order -此接口用于申请借贷. +This endpoint place an order to initiate a margin loan. ### HTTP Request @@ -1155,7 +1226,7 @@ BODY } ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -1163,25 +1234,25 @@ BODY } ``` -### 请求参数 +### Request Parameters -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc -currency | string | true | NA | 币种 -amount | string | true | NA | 借贷数量 +symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc +currency | string | true | NA | The currency to borrow +amount | string | true | NA | The amount of currency to borrow -### 响应数据 +### Response Content -参数 | 数据类型 | 描述 +Field | Data Type | Description --------- | --------- | ----------- data | integer | Margin order id -## 归还借贷 +## Repay Margin Loan -此接口用于归还借贷. +This endpoint repays margin loan with you asset in your margin account. ### HTTP Request @@ -1195,7 +1266,7 @@ BODY } ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -1203,27 +1274,27 @@ BODY } ``` -### 请求参数 +### Request Parameters -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- -amount | string | true | NA | 归还币种 +amount | string | true | NA | The amount of currency to repay -### 响应数据 +### Response Content -参数 | 数据类型 | 描述 +Field | Data Type | Description --------- | --------- | ----------- data | integer | Margin order id -## 查询借贷订单 +## Search Past Margin Orders This endpoint returns margin orders based on a specific searching criteria. ### HTTP Request -`POST https://api.huobi.pro/v1/margin/loan-orders` +`GET https://api.huobi.pro/v1/margin/loan-orders` ```shell curl "https://api.huobi.pro/v1/margin/load-orders" @@ -1237,7 +1308,7 @@ BODY { } ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { @@ -1261,21 +1332,21 @@ BODY { } ``` -### 请求参数 +### Request Parameters -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc -states | string | false | All | 订单状态 +symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc +states | string | false | All | The states of order to include in the search start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd +end-date | string | false | today | Search ends date, in format yyyy-mm-dd from | string | false | both | Search order id to begin with direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' size | int | false | 100 | The max number of orders to return, max value is 100 -### 响应数据 +### Response Content -参数 | 数据类型 | 描述 +Field | Data Type | Description --------- | --------- | ----------- id | integer | Order id account-id | integer | Account id @@ -1292,7 +1363,7 @@ interest-amount | string | The accumulated loan interest interest-balance | string | The amount of loan interest left state | string | Loan state, possible values: created, accrual, cleared, invalid -## 借贷账户详情 +## Return the Balance of the Margin Loan Account This endpoint returns the balance of the margin loan account. @@ -1301,74 +1372,66 @@ This endpoint returns the balance of the margin loan account. `GET https://api.huobi.pro/v1/margin/accounts/balance` ```shell -curl "https://api.huobi.pro/v1/margin/accounts/balance" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" - } +curl "https://api.huobi.pro/v1/margin/accounts/balance?symbol=btcusdt" ``` -> 以上命令返回的 JSON 结果: +> The above command returns JSON structured like this: ```json { "data": [ - { - "id": 18264, - "type": "margin", - "state": "working", - "symbol": "btcusdt", - "fl-price": "0", - "fl-type": "safe", - "risk-rate": "475.952571086994250554", - "list": [ - { - "currency": "btc", - "type": "trade", - "balance": "1168.533000000000000000" - }, - { - "currency": "btc", - "type": "frozen", - "balance": "0.000000000000000000" - }, - { - "currency": "btc", - "type": "loan", - "balance": "-2.433000000000000000" - }, - { - "currency": "btc", - "type": "interest", - "balance": "-0.000533000000000000" - }, - { - "currency": "btc", - "type": "transfer-out-available",//可转btc - "balance": "1163.872174670000000000" - }, - { - "currency": "btc", - "type": "loan-available",//可借btc - "balance": "8161.876538350676000000" - } - ] - } - ] + { + "id": 18264, + "type": "margin", + "state": "working", + "symbol": "btcusdt", + "fl-price": "0", + "fl-type": "safe", + "risk-rate": "475.952571086994250554", + "list": [ + { + "currency": "btc", + "type": "trade", + "balance": "1168.533000000000000000" + }, + { + "currency": "btc", + "type": "frozen", + "balance": "0.000000000000000000" + }, + { + "currency": "btc", + "type": "loan", + "balance": "-2.433000000000000000" + }, + { + "currency": "btc", + "type": "interest", + "balance": "-0.000533000000000000" + }, + { + "currency": "btc", + "type": "transfer-out-available",//可转btc + "balance": "1163.872174670000000000" + }, + { + "currency": "btc", + "type": "loan-available",//可借btc + "balance": "8161.876538350676000000" + } + ] + } + ] } ``` -### 请求参数 +### Request Parameters -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc +symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -### 响应数据 +### Response Content Parameter | Data Type | Description --------- | --------- | ----------- @@ -1378,10 +1441,418 @@ risk-rate | string | The risk rate fl-price | string | The price which triggers closeout list | object array | The list of loans and their details -# 钱包(充值与提现) +# Wallet (Deposit and Withdraw) + + + +## Create a Withdraw Request + +This endpoint creates a withdraw request from your spot trading account to an external address. + + + +### HTTP Request + +`POST https://api.huobi.pro/v1/dw/withdraw/api/create` + +```shell +curl "https://api.huobi.pro/v1/dw/withdraw/api/create" +BODY +{ + "address": "0xde709f2102306220921060314715629080e2fb77", + "amount": "0.05", + "currency": "eth", + "fee": "0.01" +} +``` + +> The above command returns JSON structured like this: + +```json +{ + "data": 1000 +} +``` + +### Request Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +address | string | true | NA | The desination address of this withdraw +currency | string | true | NA | The crypto currency to withdraw +amount | string | true | NA | The amount of currency to withdraw +fee | string | false | NA | The fee to pay with this withdraw +addr-tag | string | false | NA | A tag specified for this address + +### Response Content + + + +Field | Data Type | Description +--------- | --------- | ----------- +data | integer | Transfer id + + + +## Cancel a Withdraw Request + +This endpoint cancels a previously created withdraw request by its transfer id. + +### HTTP Request + +`POST https://api.huobi.pro/v1/dw/withdraw-virtual/{withdraw-id}/cancel` -TBC +```shell +curl "https://api.huobi.pro/v1/dw/withdraw-virtual/1000/cancel" +``` + +> The above command returns JSON structured like this: + +```json +{ + "status": "ok", + "data": 700 +} +``` + +### Request Parameters + + + +### Response Content + + + +Parameter | Data Type | Description +--------- | --------- | ----------- +data | integer | Withdraw cancel id + +## Search for Existed Withdraws and Deposits + +This endpoint searches for all existed withdraws and deposits and return their latest status. + +### HTTP Request -# 账户相关 +`GET https://api.huobi.pro/v1/query/deposit-withdraw` -TBC +```shell +curl "https://api.huobi.pro/v1/query/deposit-withdraw?currency=xrp&type=deposit&from=5&size=12" +``` + +> The above command returns JSON structured like this: + +```json +{ + "data": [ + { + "id": 1171, + "type": "deposit", + "currency": "xrp", + "tx-hash": "ed03094b84eafbe4bc16e7ef766ee959885ee5bcb265872baaa9c64e1cf86c2b", + "amount": 7.457467, + "address": "rae93V8d2mdoUQHwBDBdM4NHCMehRJAsbm", + "address-tag": "100040", + "fee": 0, + "state": "safe", + "created-at": 1510912472199, + "updated-at": 1511145876575 + } + ] +} +``` + +### Request Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +currency | string | true | NA | The crypto currency to withdraw +type | string | true | NA | Define transfer type to search, possible values: [deposit, withdraw] +from | string | true | NA | The transfer id to begin search +size | string | true | NA | The max number of items to return + +### Response Content + +Field | Data Type | Description +--------- | --------- | ----------- +id | integer | Transfer id +type | string | Define transfer type to search, possible values: [deposit, withdraw] +currency | string | The crypto currency to withdraw +tx-hash | string | The on-chain transaction hash +amount | integer | The number of crypto asset transfered in its minimum unit +address | string | The deposit or withdraw source address +address-tag | string | The user defined address tag +fee | integer | The amount of fee taken by Huobi in this crypto's minimum unit +state | string | The state of this transfer (see below for details) +created-at | integer | The timestamp in milliseconds for the transfer creation +updated-at | integer | The timestamp in milliseconds for the transfer's latest update + +**List of possible withdraw state** + +State | Description +--------- | ----------- +submitted | Withdraw request submitted successfully +reexamine | Under examination for withdraw validation +canceled | Withdraw canceled by user +pass | Withdraw validation passed +reject | Withdraw validation rejected +pre-transfer | Withdraw is about to be released +wallet-transfer | On-chain transfer initiated +wallet-reject | Transfer rejected by chain +confirmed | On-chain transfer completed with one confirmation +confirm-error | On-chain transfer faied to get confirmation +repealed | Withdraw terminated by system + +**List of possible deposit state** + +State | Description +--------- | ----------- +unknown | On-chain transfer has not been received +confirming | On-chain transfer waits for first confirmation +confirmed | On-chain transfer confirmed for at least one block +safe | Multiple on-chain confirmation happened +orphan | Confirmed but currently in an orphan branch + +# Account + + + +## Get all Accounts of the Current User + +This endpoint returns a list of accounts owned by this API user. + +### HTTP Request + +`GET https://api.huobi.pro/v1/account/accounts` + +```shell +curl "https://api.huobi.pro/v1/account/accounts" +``` + +> The above command returns JSON structured like this: + +```json + "data": [ + { + "id": 100009, + "type": "spot", + "state": "working", + "user-id": 1000 + } + ] +``` + +### Request Parameters + + + +### Response Content + +Field | Data Type | Description +--------- | --------- | ----------- +id | integer | Unique account id +state | string | Account state, possible values: [working, lock] +type | string | The type of this account, possible values: [spot, margin, otc, point] + +## Get Account Balance of a Specific Account + +This endpoint returns the balance of an account specified by account id. + +### HTTP Request + +`GET https://api.huobi.pro/v1/account/accounts/{account-id}/balance` + +```shell +curl "https://api.huobi.pro/v1/account/accounts/100009/balance" +``` + +> The above command returns JSON structured like this: + +```json +"data": { + "id": 100009, + "type": "spot", + "state": "working", + "list": [ + { + "currency": "usdt", + "type": "trade", + "balance": "500009195917.4362872650" + }, + { + "currency": "usdt", + "type": "frozen", + "balance": "328048.1199920000" + }, + { + "currency": "etc", + "type": "trade", + "balance": "499999894616.1302471000" + } + ], + } +} +``` + +### Request Parameters + + + +### Response Content + +Field | Data Type | Description +--------- | --------- | ----------- +id | integer | Unique account id +state | string | Account state, possible values: [working, lock] +type | string | The type of this account, possible values: [spot, margin, otc, point] +list | object | The balance details of each currency + +**Per list item content** + +Parameter | Data Type | Description +--------- | --------- | ----------- +currency | string | The currency of this balance +type | string | The balance type, possible values: [trade, frozen] +balance | string | The balance in the main currency unit + +## Get Account Balance of a Sub-Account + +This endpoint returns the balance of a sub-account specified by sub-account uid. + +### HTTP Request + +`GET https://api.huobi.pro/v1/account/accounts/{sub-account-uid}` + +```shell +curl "https://api.huobi.pro/v1/account/accounts/10758899" +``` + +> The above command returns JSON structured like this: + +```json +"data": [ +{ + "id": 9910049, + "type": "spot", + "list": [ + { + "currency": "btc", + "type": "trade", + "balance": "1.00" + }, + { + "currency": "eth", + "type": "trade", + "balance": "1934.00" + } + ] +}, +{ + "id": 9910050, + "type": "point", + "list": [] +} +] +``` + +### Request Parameters + + + +### Response Content + + + +Field | Data Type | Description +--------- | --------- | ----------- +id | integer | Unique account id +type | string | The type of this account, possible values: [spot, margin, otc, point] +list | object | The balance details of each currency + +**Per list item content** + +Field | Data Type | Description +--------- | --------- | ----------- +currency | string | The currency of this balance +type | string | The balance type, possible values: [trade, frozen] +balance | string | The balance in the main currency unit + +## Get the Aggregated Balance of all Sub-accounts of the Current User + +This endpoint returns the balances of all the sub-account aggregated. + +### HTTP Request + +`GET https://api.huobi.pro/v1/subuser/aggregate-balance` + +```shell +curl "https://api.huobi.pro/v1/subuser/aggregate-balance" +``` + +> The above command returns JSON structured like this: + +```json + "data": [ + { + "currency": "eos", + "balance": "1954559.809500000000000000" + }, + { + "currency": "btc", + "balance": "0.000000000000000000" + }, + { + "currency": "usdt", + "balance": "2925209.411300000000000000" + } + ] +``` + +### Request Parameters + + + +### Response Content + + + +Field | Data Type | Description +--------- | --------- | ----------- +currency | string | The currency of this balance +balance | string | The balance in the main currency unit + +## Transfer Asset between Parent and Sub Account + +This endpoint allows user to transfer asset between parent and sub account. + +### HTTP Request + +`POST https://api.huobi.pro/v1/subuser/transfer` + +```shell +curl "https://api.huobi.pro/v1/subuser/transfer" +Body + +``` + +> The above command returns JSON structured like this: + +```json + "data": 12345 +``` + +### Request Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +sub-uid | integer | true | NA | The target sub account uid to transfer to or from +currency | string | true | NA | The crypto currency to transfer +amount | decimal | true | NA | The amount of asset to transfer +type | string | true | NA | The type of transfer, possible values: [master-transfer-in, master-transfer-out, master-point-transfer-in, master-point-transfer-out] + +### Response Content + + + +Parameter | Data Type | Description +--------- | --------- | ----------- +data | integer | Unique transfer id \ No newline at end of file From 648b964598f51d9122dad2113bb8d3d9a747d040 Mon Sep 17 00:00:00 2001 From: rayxy Date: Sat, 12 Jan 2019 20:33:21 +0800 Subject: [PATCH 012/759] merge changes for frontend changes --- source/layouts/layout.erb | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/source/layouts/layout.erb b/source/layouts/layout.erb index e4f0a5ce74b..d54c5e6e2e8 100644 --- a/source/layouts/layout.erb +++ b/source/layouts/layout.erb @@ -57,16 +57,16 @@ under the License. v1 - 简体中文 + 简体中文
<% if language_tabs.any? %> @@ -137,11 +137,17 @@ under the License. if(url.indexOf('cn') != -1){ //如果是中文环境 lang_btn.innerHTML = 'English'; - lang_btn.href = '/slate/v1/en/'; - v1_url.href = '/slate/v1/cn/'; - v2_url.href = '/slate/v2/cn/'; - lang_btn.style.display = 'block'; + lang_btn.href = url.replace('cn/', 'en/'); + v1_url.href = '/docs/v1/cn/'; + v2_url.href = '/docs/v2/cn/'; + }else{ + //如果是英文环境 + lang_btn.innerHTML = '中文'; + lang_btn.href = url.replace('en/', 'cn/'); + v1_url.href = '/docs/v1/en/'; + v2_url.href = '/docs/v2/en/'; } + lang_btn.style.display = 'block'; function GetUrlRelativePath(){ let url = document.location.toString(); let arrUrl = url.split("//"); From 2024c84fcb4e4b381e48a58526ba5e760c1007e6 Mon Sep 17 00:00:00 2001 From: rayxy Date: Wed, 16 Jan 2019 16:06:21 +0000 Subject: [PATCH 013/759] Update index.html.md Add the changes in the v1_cn version --- source/index.html.md | 302 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 257 insertions(+), 45 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index feeaca758eb..fb749adf4e2 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1,5 +1,5 @@ --- -title: Huobi API Reference +title: Huobi API Reference v1.0 language_tabs: # must be one of https://git.io/vQNgJ - shell @@ -15,39 +15,34 @@ search: true # Introduction -Welcome to the Huobi API! You can use our API to access all market data, trading, and account management endpoints. +Welcome to the Huobi API v1.0! You can use our API to access all market data, trading, and account management endpoints. -We have language bindings in Shell, and Python! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right. +We have code example in Shell! You can view code examples in the dark area to the right. -# General +You can use the drop down list above to change the API version. You can also use the language option at the top right to switch documentation language. -## Request Format +# API Access -All API requests are in either GET or POST method. For GET request, all parameters are path parameters. For POST request, all parameters are in POST body and in JSON format. +## Access URLs -## Response Format +**REST API** -All response will be returned in JSON format. The top level JSON is a wrapper object which provides three metadata in "status", "ch", and "ts". The actual per API response data is in "data" field. +**`https://api.huobi.pro`** -### Response Wrapper Content +**Websocket Market Feed** -> Response wrapper content example: +**`wss://api.huobi.pro/ws`** -```json -{ - "status": "ok", - "ch": "market.btcusdt.kline.1day", - "ts": 1499223904680, - "data": // per API response data in nested JSON object -} -``` +**Websocket Asset and Order** -Parameter | Data Type | Description ---------- | --------- | ----------- -status | string | The overall API call result status -ch | string | The data channel this response was originated from. Some API return does not have this field. -ts | int | The timestamp in milliseconds for when the response is created -data | object | The actual response content per API +**`wss://api.huobi.pro/ws/v1`** + + + ## Endpoint Rate Limit @@ -55,11 +50,19 @@ Each apikey can send maximum of 100 https requests within 10 seconds. Please con ## Authentication -Some API endpoints require authentication. To be authenticated, you should first acquire an API key and the corresponding secret key. +To protect API communication from unauthorized change, all non-public API calls are required to be signed. - +### Create API Key + +To be able to create signature you should first acquire an API key and the corresponding secret key. You can manage you API keys by login to your account at huobi.com and go to "API Management" under "Account" section. + + + + + +### Signature Method + +To sign a call, you need to a few key components of the call to generate a query string, and then a hash is generated with this string, finally the hash is added to the call. In order to successfully sign a request, you need to follow below steps @@ -142,9 +145,216 @@ https://api.huobi.pro/v1/order/orders?AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xx 2. Add "&Signature=[Your request signature with URL encode]" to your path parameter +## Request Format + +All API requests are in either GET or POST method. For GET request, all parameters are path parameters. For POST request, all parameters are in POST body and in JSON format. + +## Response Format + +All response will be returned in JSON format. The top level JSON is a wrapper object which provides three metadata in "status", "ch", and "ts". The actual per API response data is in "data" field. + +### Response Wrapper Content + +> Response wrapper content example: + +```json +{ + "status": "ok", + "ch": "market.btcusdt.kline.1day", + "ts": 1499223904680, + "data": // per API response data in nested JSON object +} +``` + +Parameter | Data Type | Description +--------- | --------- | ----------- +status | string | The overall API call result status +ch | string | The data channel this response was originated from. Some API return does not have this field. +ts | int | The timestamp in milliseconds for when the response is created +data | object | The actual response content per API + +## Error Information + +Each error will have a code and err-msg which explain the details of the error. + +### Market Data API Error Message + +| Error Code | Description | +|-----|-----| +| bad-request | Bad request | +| invalid-parameter | Request parameter is invalid | +| invalid-command | Request options are wrong | + +### Trading API Error Message + +| Error | Description | +|-----|-----| +| base-symbol-error | Trading pair does not exist | +| base-currency-error | Trading currency does not exist | +| base-date-error | Bad date format | +| account-frozen-balance-insufficient-error | Insufficient balance | +| account-transfer-balance-insufficient-error | Insufficient balance for transfer | +| bad-argument | Bad arguments | +| api-signature-not-valid | API signature not valid | +| gateway-internal-error | System is busy | +| ad-ethereum-addresss| Ethereum address is needed | +| order-accountbalance-error| Account balance insufficient | +| order-limitorder-price-error| Price of limit order is invalid | +|order-limitorder-amount-error| Amount of limit order is invalid | +|order-orderprice-precision-error| Price precision not supported | +|order-orderamount-precision-error| Amount prevision not supported | +|order-marketorder-amount-error| Market order amount is invalid| +|order-queryorder-invalid| Cannot find queried order| +|order-orderstate-error|Order status is invalid| +|order-datelimit-error|Order query timeout| +|order-update-error| Order update error| + +## Code Demo + +### Websocket + +[Python3](https://github.com/huobiapi/Websocket-Python3-demo) + +[Node.js](https://github.com/huobiapi/WebSocket-Node.js-demo) + +[PHP](https://github.com/huobiapi/WebSocket-PHP-demo) + +### REST + +[Python3](https://github.com/huobiapi/REST-Python3-demo) + +[Java](https://github.com/huobiapi/REST-Java-demo) + +[Node.js](https://github.com/huobiapi/REST-Node.js-demo) + +[C#](https://github.com/huobiapi/REST-CSharp-demo) + +[go](https://github.com/huobiapi/REST-GO-demo) + +[PHP](https://github.com/huobiapi/REST-PHP-demo) + +[C++](https://github.com/huobiapi/REST-Cpp-demo) + +[Objective-C](https://github.com/huobiapi/REST-ObjectiveC-demo) + +[QTC++](https://github.com/huobiapi/REST-QTCpp-demo) + +[Python2.7](https://github.com/huobiapi/REST-Python2.7-demo) + +[Ruby](https://github.com/huobiapi/REST-Ruby-demo) + +[易语言](https://github.com/huobiapi/REST-YiYuyan-demo) + +# Reference Data + +## Get all Supported Trading Pair + +This endpoint returns all Huobi's supported trading pair. + +```shell +curl "https://api.huobi.pro/v1/common/symbols" +``` + +### HTTP Request + +- GET `/v1/common/symbols` + +### Query Parameters + +No parameter is needed for this endpoint. + +> Responds: + +```json + "data": [ + { + "base-currency": "btc", + "quote-currency": "usdt", + "price-precision": 2, + "amount-precision": 4, + "symbol-partition": "main", + "symbol": "btcusdt" + } + { + "base-currency": "eth", + "quote-currency": "usdt", + "price-precision": 2, + "amount-precision": 4, + "symbol-partition": "main", + "symbol": "ethusdt" + } + ] +``` + +### Response Content + +Field Name | Data Type | Description +--------- | --------- | ----------- +base-currency | string | Base currency in a trading pair +quote-currency | string | Quote currency in a trading pair +price-precision | integer | Quote currency precision when quote price(decimal places) +amount-precision| integer | Base currency precision when quote amount(decimal places) +symbol-partition| string | Trading section, possible values: [main,innovation,bifurcation] + +## Get all Supported Currencies + +This endpoint returns all Huobi's supported trading currencies. + +```shell +curl "https://api.huobi.pro/v1/common/currencys" +``` + +### HTTP Request + +- GET `/v1/common/currencys` + +### Query Parameters + +No parameter is needed for this endpoint. + +> Response: + +```json + "data": [ + "usdt", + "eth", + "etc" + ] +``` + +### Response Content + + + +## Get Current System Time + +This endpoint returns the current system time in milliseconds adjusted to Beijing time zone. + +```shell +curl "https://api.huobi.pro/v1/common/timestamp" +``` + +### HTTP Request + +- GET `/v1/common/timestamp` + +### Query Parameters + +No parameter is needed for this endpoint. + +> Response: + +```json + "data": 1494900087029 +``` + +### Response Content + +The returned "Data" field contains an integer represents the timestamp in milliseconds adjusted to Beijing time. + # Market Data -## Get Klines(candles) +## Get Klines(Candles) This endpoint retrieves all klines in a specific range. @@ -153,9 +363,19 @@ This endpoint retrieves all klines in a specific range. `GET https://api.huobi.pro/market/history/kline` ```shell -curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" +curl https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt ``` +### Query Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc +period | string | true | NA | The period of each candle, allowed values are: 1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year +size | integer | false | 150 | The number of data returns, range [1, 2000] + + + > The above command returns JSON structured like this: ```json @@ -173,14 +393,6 @@ curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" ] ``` -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -period | string | true | NA | The period of each candle, allowed values are: 1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year -size | integer | false | 150 | The number of data returns, range [1, 2000] - ### Response Content Parameter | Data Type | Description --------- | --------- | ----------- @@ -202,9 +414,15 @@ This endpoint retrieves the latest ticker with some important 24h aggregated mar `GET https://api.huobi.pro/market/detail/merged` ```shell -curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" +curl https://api.huobi.pro/market/detail/merged?symbol=ethusdt ``` +### Query Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc + > The above command returns JSON structured like this: ```json @@ -223,12 +441,6 @@ curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" } ``` -### Query Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc - ### Response Content Parameter | Data Type | Description From e815eb8a64361ddd0d9eb1eb8ea2c89117e4ef65 Mon Sep 17 00:00:00 2001 From: rayxy Date: Fri, 18 Jan 2019 11:23:21 +0000 Subject: [PATCH 014/759] Update index.html.md Update according to Rain's suggestions --- source/index.html.md | 2030 ++++++++++++++++++++++-------------------- 1 file changed, 1080 insertions(+), 950 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 74299d6a4dd..c800763c650 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -53,112 +53,7 @@ It is not recommended to use proxy to access Huobi API because it will introduce Each apikey can send maximum of 100 https requests within 10 seconds. Please contact customer support if you believe you need higher limit rate. -## Get all Supported Trading Pairs - -This endpoint retrieves all trading pairs supported in Huobi. - -### HTTP Request - -`GET https://api.huobi.pro/v1/common/symbols` - -```shell -curl "https://api.huobi.prov1/common/symbols" -``` - -> The above command returns JSON structured like this: - -```json - "data": [ - { - "base-currency": "btc", - "quote-currency": "usdt", - "price-precision": 2, - "amount-precision": 4, - "symbol-partition": "main", - "symbol": "btcusdt" - } - { - "base-currency": "eth", - "quote-currency": "usdt", - "price-precision": 2, - "amount-precision": 4, - "symbol-partition": "main", - "symbol": "ethusdt" - } - ] -``` - -### Request Parameters - - - -### Response Fields - -Field | Data Type | Description ---------- | --------- | ----------- -base-currency | integer | The base currency in this pair -quote-currency | float | The quote currency in this pair -price-precision | integer | The number of decimal place for quoting price -amount-precision| float | The number of decimal place for base asset -symbol-partition| float | The trading partition this pair belongs to, possible values: [main,innovation,bifurcation] - -## Get all Supported Trading Currencies - -This endpoint retrieves all trading currencies supported in Huobi. - -### HTTP Request - -`GET https://api.huobi.pro/v1/common/currencys` - -```shell -curl "https://api.huobi.prov1/common/currencys" -``` - -> The above command returns JSON structured like this: - -```json - "data": [ - "usdt", - "eth", - "etc" - ] -``` - -### Request Parameters - - - -### Response Content - - - -## Get the Current System Time - -This endpoint retrieves the system time of Huobi in epoch milliseconds. - -### HTTP Request - -`GET https://api.huobi.pro/v1/common/timestamp` - -```shell -curl "https://api.huobi.prov1/common/timestamp" -``` - -> The above command returns JSON structured like this: - -```json - "data": 1494900087029 -``` - -### Request Parameters - - - -### Response Content - - - -# Authentication +## Authentication To protect API communication from unauthorized change, all non-public API calls are required to be signed. @@ -299,7 +194,7 @@ Each error will have a code and err-msg which explain the details of the error. | Error | Description | |-----|-----| -| base-symbol-error | Trading pair does not exist | +| base-symbol-error | trading symbol does not exist | | base-currency-error | Trading currency does not exist | | base-date-error | Bad date format | | account-frozen-balance-insufficient-error | Insufficient balance | @@ -357,9 +252,9 @@ Each error will have a code and err-msg which explain the details of the error. # Reference Data -## Get all Supported Trading Pair +## Get all Supported trading symbol -This endpoint returns all Huobi's supported trading pair. +This endpoint returns all Huobi's supported trading symbol. ```shell curl "https://api.huobi.pro/v1/common/symbols" @@ -369,7 +264,7 @@ curl "https://api.huobi.pro/v1/common/symbols" - GET `/v1/common/symbols` -### Query Parameters +### Request Parameters No parameter is needed for this endpoint. @@ -400,8 +295,8 @@ No parameter is needed for this endpoint. Field Name | Data Type | Description --------- | --------- | ----------- -base-currency | string | Base currency in a trading pair -quote-currency | string | Quote currency in a trading pair +base-currency | string | Base currency in a trading symbol +quote-currency | string | Quote currency in a trading symbol price-precision | integer | Quote currency precision when quote price(decimal places) amount-precision| integer | Base currency precision when quote amount(decimal places) symbol-partition| string | Trading section, possible values: [main,innovation,bifurcation] @@ -418,7 +313,7 @@ curl "https://api.huobi.pro/v1/common/currencys" - GET `/v1/common/currencys` -### Query Parameters +### Request Parameters No parameter is needed for this endpoint. @@ -448,7 +343,7 @@ curl "https://api.huobi.pro/v1/common/timestamp" - GET `/v1/common/timestamp` -### Query Parameters +### Request Parameters No parameter is needed for this endpoint. @@ -480,7 +375,7 @@ curl https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc +symbol | string | true | NA | The trading symbol to query, e.g. btcusdt, bccbtc period | string | true | NA | The period of each candle, allowed values are: 1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year size | integer | false | 150 | The number of data returns, range [1, 2000] @@ -527,11 +422,11 @@ This endpoint retrieves the latest ticker with some important 24h aggregated mar curl https://api.huobi.pro/market/detail/merged?symbol=ethusdt ``` -### Query Parameters +### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc +symbol | string | true | NA | The trading symbol to query, e.g. btcusdt, bccbtc > The above command returns JSON structured like this: @@ -559,7 +454,7 @@ id | integer | The UNIX timestamp in seconds as response id amount | float | The aggregated trading volume in USDT count | integer | The number of completed trades open | float | The opening price of last 24 hours -close | float | The closing price of last 24 hours +close | float | The last price of last 24 hours low | float | The low price of last 24 hours high | float | The high price of last 24 hours vol | float | The trading volume in base currency of last 24 hours @@ -580,6 +475,10 @@ This endpoint retrieves the latest tickers for all supported pairs. curl "https://api.huobi.pro/market/tickers" ``` +### Request Parameters + +No parameters are needed for this endpoint. + > The above command returns JSON structured like this: ```json @@ -607,10 +506,6 @@ curl "https://api.huobi.pro/market/tickers" ] ``` -### Request Parameters - -No parameters are needed for this endpoint. - ### Response Content Response content is an array of object, each object has below fields. @@ -620,11 +515,11 @@ Field | Data Type | Description amount | float | The aggregated trading volume in USDT of last 24 hours count | integer | The number of completed trades of last 24 hours open | float | The opening price of last 24 hours -close | float | The closing price of last 24 hours +close | float | The last price of last 24 hours low | float | The low price of last 24 hours high | float | The high price of last 24 hours vol | float | The trading volume in base currency of last 24 hours -symbol | string | The trading pair of this object, e.g. btcusdt, bccbtc +symbol | string | The trading symbol of this object, e.g. btcusdt, bccbtc ## Get Market Depth @@ -638,6 +533,27 @@ This endpoint retrieves the current order book of a specific pair. curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" ``` +### Request Parameters + +Parameter | Data Type | Required | Default Value | Description +--------- | --------- | -------- | ------------- | ----------- +symbol | string | true | NA | The trading symbol to query, e.g. btcusdt, bccbtc +depth | integer | false | 20 | The number of market depth to return on each side, possible values: [5, 10, 20] +type | string | true | step0 | Market depth aggregation level, details below + + + +**"type" Details** + +Value | Description +--------- | --------- +step0 | No market depth aggregation +step1 | Aggregation level = precision*10 +step2 | Aggregation level = precision*100 +step3 | Aggregation level = precision*1000 +step4 | Aggregation level = precision*10000 +step5 | Aggregation level = precision*100000 + > The above command returns JSON structured like this: ```json @@ -691,21 +607,14 @@ curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" } ``` -### Request Parameters - -Parameter | Data Type | Required | Allowed Value | Description ---------- | --------- | -------- | ------------- | ----------- -symbol | string | true | All supported trading pair symbols | The trading pair to query, e.g. btcusdt, bccbtc -type | string | true | step0, step1, step2, step3, step4, step5 | TBC - ### Response Content Field | Data Type | Description --------- | --------- | ----------- -ts | integer | The UNIX timestamp in milliseconds -version | integer | TBC +ts | integer | The UNIX timestamp in milliseconds adjusted to Beijing time +version | integer | Internal data bids | object | The current all bids in format [price, quote volume] asks | object | The current all asks in format [price, quote volume] @@ -721,6 +630,12 @@ This endpoint retrieves the latest trade with its price, volume, and direction. curl "https://api.huobi.pro/market/trade?symbol=ethusdt" ``` +### Request Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +symbol | string | true | NA | The trading symbol to query, e.g. btcusdt, bccbtc + > The above command returns JSON structured like this: ```json @@ -739,12 +654,6 @@ curl "https://api.huobi.pro/market/trade?symbol=ethusdt" } ``` -### Request Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc - ### Response Content @@ -754,8 +663,8 @@ Parameter | Data Type | Description id | integer | The unique trade id of this trade amount | float | The trading volume in base currency price | float | The trading price in quote currency -ts | integer | The UNIX timestamp in milliseconds -direction | string | The direction of the trade: 'buy' or 'sell' +ts | integer | The UNIX timestamp in milliseconds adjusted to Beijing time +direction | string | The direction of the taker trade: 'buy' or 'sell' ## Get the Most Recent Trades @@ -769,6 +678,13 @@ This endpoint retrieves the most recent trades with their price, volume, and dir curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" ``` +### Request Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +symbol | string | true | NA | The trading symbol to query, e.g. btcusdt, bccbtc +size | integer | false | 1 | The number of data returns + > The above command returns JSON structured like this: ```json @@ -809,13 +725,6 @@ curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" ] ``` -### Request Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -size | integer | false | 1 | The number of data returns - ### Response Content @@ -825,8 +734,8 @@ Field | Data Type | Description id | integer | The unique trade id of this trade amount | float | The trading volume in base currency price | float | The trading price in quote currency -ts | integer | The UNIX timestamp in milliseconds -direction | string | The direction of the trade: 'buy' or 'sell' +ts | integer | The UNIX timestamp in milliseconds adjusted to Beijing time +direction | string | The direction of the taker trade: 'buy' or 'sell' ## Get the Last 24h Market Summary @@ -840,6 +749,12 @@ This endpoint retrieves the summary of trading in the market for the last 24 hou curl "https://api.huobi.pro/market/detail?symbol=ethusdt" ``` +### Request Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +symbol | string | true | NA | The trading symbol to query, e.g. btcusdt, bccbtc + > The above command returns JSON structured like this: ```json @@ -856,12 +771,6 @@ curl "https://api.huobi.pro/market/detail?symbol=ethusdt" } ``` -### Request Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc - ### Response Content @@ -872,491 +781,291 @@ id | integer | The UNIX timestamp in seconds as response id amount | float | The aggregated trading volume in USDT count | integer | The number of completed trades open | float | The opening price of last 24 hours -close | float | The closing price of last 24 hours +close | float | The last price of last 24 hours low | float | The low price of last 24 hours high | float | The high price of last 24 hours vol | float | The trading volume in base currency of last 24 hours -version | integer | TBC +version | integer | Internal data -# Spot Trading +# Account -## Place a New Trading Order +## Get all Accounts of the Current User -This endpoint place an trading order and send to the exchange to be matched. +This endpoint returns a list of accounts owned by this API user. ### HTTP Request -`POST https://api.huobi.pro/v1/order/orders/place` +`GET https://api.huobi.pro/v1/account/accounts` ```shell -curl "https://api.huobi.pro/v1/order/orders/place" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit"} -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": "59378" -} +curl "https://api.huobi.pro/v1/account/accounts" ``` ### Request Parameters -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -account-id | string | true | NA | The account id used for this spot trading -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -type | string | true | NA | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -amount | string | true | NA | The amount in quote currency to buy / the amount in base currency to sell -price | string | false | NA | The limit price of limit order -source | string | false | api | When trade with margin use 'margin-api' - -### Response Content - - - -## Show All Open Orders - -This endpoint returns all open orders which have not been filled completely. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/openOrders` - -```shell -curl "https://api.huobi.pro/v1/order/openOrders" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit"} -``` + > The above command returns JSON structured like this: ```json -{ "data": [ { - "id": 5454937, - "symbol": "ethusdt", - "account-id": 30925, - "amount": "1.000000000000000000", - "price": "0.453000000000000000", - "created-at": 1530604762277, - "type": "sell-limit", - "filled-amount": "0.0", - "filled-cash-amount": "0.0", - "filled-fees": "0.0", - "source": "web", - "state": "submitted" + "id": 100009, + "type": "spot", + "state": "working", + "user-id": 1000 } ] -} ``` -### Request Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -account-id | string | false | NA | The account id used for this spot trading -symbol | string | false | NA | The trading pair to trade, e.g. btcusdt, bccbtc -side | string | false | both | Filter on the direction of the trade, possible values are: buy, sell. Default is to return all -size | int | false | 10 | The max number of orders to return - ### Response Content -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- -id | integer | order id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app -state | string | submitted, partical-filled, cancelling +id | integer | Unique account id +state | string | Account state, possible values: [working, lock] +type | string | The type of this account, possible values: [spot, margin, otc, point] -## Submit Cancel for an Order + -This endpoint submit a request to cancel an order. +## Get Account Balance of a Specific Account - +This endpoint returns the balance of an account specified by account id. ### HTTP Request -`POST https://api.huobi.pro/v1/order/orders/{order-id}/submitcancel` +`GET https://api.huobi.pro/v1/account/accounts/{account-id}/balance` ```shell -curl "https://api.huobi.pro/v1/order/orders/59378/submitcancel" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": "59378" -} +curl "https://api.huobi.pro/v1/account/accounts/100009/balance" ``` ### Request Parameters -No parameter is needed for this endpoint. - -### Response Content - - - -## Submit Cancel for Multiple Orders at Once - -This endpoint submit cancellation for multiple orders at once. - -### HTTP Request + -`POST https://api.huobi.pro/v1/order/orders/batchcancel` - -```shell -curl "https://api.huobi.pro/v1/order/orders/batchcancel" -BODY { - "order-ids": [ - "1", "2", "3" - ] -} -``` - -> The above command returns JSON structured like this: +> The above command returns JSON structured like this: ```json -{ - "data": { - "success": [ - "1", - "3" - ], - "failed": [ +"data": { + "id": 100009, + "type": "spot", + "state": "working", + "list": [ { - "err-msg": "记录无效", - "order-id": "2", - "err-code": "base-record-invalid" + "currency": "usdt", + "type": "trade", + "balance": "500009195917.4362872650" + }, + { + "currency": "usdt", + "type": "frozen", + "balance": "328048.1199920000" + }, + { + "currency": "etc", + "type": "trade", + "balance": "499999894616.1302471000" } - ] + ], } } ``` -### Request Parameters +### Response Content -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -order-ids | list | true | NA | The order ids to cancel. Max size is 50. +Field | Data Type | Description +--------- | --------- | ----------- +id | integer | Unique account id +state | string | Account state, possible values: [working, lock] +type | string | The type of this account, possible values: [spot, margin, otc, point] +list | object | The balance details of each currency -### Response Content +**Per list item content** -Field | Data Type | Description ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request +Parameter | Data Type | Description +--------- | --------- | ----------- +currency | string | The currency of this balance +type | string | The balance type, possible values: [trade, frozen] +balance | string | The balance in the main currency unit -## Show the Order Detail of an Order +## Get Account Balance of a Sub-Account -This endpoint returns the detail of one order. +This endpoint returns the balance of a sub-account specified by sub-account uid. ### HTTP Request -`GET https://api.huobi.pro/v1/order/orders/{order-id}` +`GET https://api.huobi.pro/v1/account/accounts/{sub-account-uid}` ```shell -curl "https://api.huobi.pro/v1/order/orders/59378" +curl "https://api.huobi.pro/v1/account/accounts/10758899" ``` +### Request Parameters + + + > The above command returns JSON structured like this: ```json -{ - "data": { - "id": 59378, - "symbol": "ethusdt", - "account-id": 100009, - "amount": "10.1000000000", - "price": "100.1000000000", - "created-at": 1494901162595, - "type": "buy-limit", - "field-amount": "10.1000000000", - "field-cash-amount": "1011.0100000000", - "field-fees": "0.0202000000", - "finished-at": 1494901400468, - "user-id": 1000, - "source": "api", - "state": "filled", - "canceled-at": 0, - "exchange": "huobi", - "batch": "" - } +"data": [ +{ + "id": 9910049, + "type": "spot", + "list": [ + { + "currency": "btc", + "type": "trade", + "balance": "1.00" + }, + { + "currency": "eth", + "type": "trade", + "balance": "1934.00" + } + ] +}, +{ + "id": 9910050, + "type": "point", + "list": [] } +] ``` -### Request Parameters +### Response Content -No parameter is needed for this endpoint. + -### Response Content +Field | Data Type | Description +--------- | --------- | ----------- +id | integer | Unique account id +type | string | The type of this account, possible values: [spot, margin, otc, point] +list | object | The balance details of each currency + +**Per list item content** Field | Data Type | Description --------- | --------- | ----------- -id | integer | order id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -account-id | string | The account id which this order belongs to -amount | string | The amount of base currency in this order -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -finished-at | int | The timestamp in milliseconds when the order was changed to a final state. This is not the time the order is matched. -canceled-at | int | The timestamp in milliseconds when the order was canceled, if not canceled then has value of 0 -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app -state | string | Order state: submitted, partical-filled, cancelling, filled, canceled -exchange | string | Internal data -batch | string | Internal data +currency | string | The currency of this balance +type | string | The balance type, possible values: [trade, frozen] +balance | string | The balance in the main currency unit -## Show the Match Result of an Order +## Get the Aggregated Balance of all Sub-accounts of the Current User -This endpoint returns the match result of an order. +This endpoint returns the balances of all the sub-account aggregated. ### HTTP Request -`GET https://api.huobi.pro/v1/order/orders/{order-id}/matchresult` +`GET https://api.huobi.pro/v1/subuser/aggregate-balance` ```shell -curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" +curl "https://api.huobi.pro/v1/subuser/aggregate-balance" ``` > The above command returns JSON structured like this: ```json "data": [ - { - "id": 29553, - "order-id": 59378, - "match-id": 59335, - "symbol": "ethusdt", - "type": "buy-limit", - "source": "api", - "price": "100.1000000000", - "filled-amount": "9.1155000000", - "filled-fees": "0.0182310000", - "created-at": 1494901400435 - } - ] + { + "currency": "eos", + "balance": "1954559.809500000000000000" + }, + { + "currency": "btc", + "balance": "0.000000000000000000" + }, + { + "currency": "usdt", + "balance": "2925209.411300000000000000" + } + ] ``` ### Request Parameters - + ### Response Content - + -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- -id | integer | Internal id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -order-id | string | The order id of this order -match-id | string | The match id of this match -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the match and fill is done -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app +currency | string | The currency of this balance +balance | string | The balance in the main currency unit -## Search Past Orders +## Transfer Asset between Parent and Sub Account -This endpoint returns orders based on a specific searching criteria. +This endpoint allows user to transfer asset between parent and sub account. ### HTTP Request -`GET https://api.huobi.pro/v1/order/orders` +`POST https://api.huobi.pro/v1/subuser/transfer` ```shell -curl "https://api.huobi.pro/v1/order/orders" -BODY { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" - } -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 59378, - "symbol": "ethusdt", - "account-id": 100009, - "amount": "10.1000000000", - "price": "100.1000000000", - "created-at": 1494901162595, - "type": "buy-limit", - "field-amount": "10.1000000000", - "field-cash-amount": "1011.0100000000", - "field-fees": "0.0202000000", - "finished-at": 1494901400468, - "user-id": 1000, - "source": "api", - "state": "filled", - "canceled-at": 0, - "exchange": "huobi", - "batch": "" - } - ] -} +curl -X POST "https://api.huobi.pro/v1/subuser/transfer" -H "Content-Type: application/json" -d '{"sub-uid": 12345, "currency": "btc", "amount": 123.5, "type": "master-transfer-in"}' ``` ### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -types | string | false | All | The types of order to include in the search -states | string | false | All | The states of order to include in the search -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd -from | string | false | both | Search order id to begin with -direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' -size | int | false | 100 | The max number of orders to return, max value is 100 +sub-uid | integer | true | NA | The target sub account uid to transfer to or from +currency | string | true | NA | The crypto currency to transfer +amount | decimal | true | NA | The amount of asset to transfer +type | string | true | NA | The type of transfer, possible values: [master-transfer-in, master-transfer-out, master-point-transfer-in, master-point-transfer-out] + +> The above command returns JSON structured like this: + +```json + "data": 12345 +``` ### Response Content -Field | Data Type | Description + + +Parameter | Data Type | Description --------- | --------- | ----------- -id | integer | Order id -account-id | integer | Account id -user-id | integer | User id -amount | string | The amount of base currency in this order -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -canceled-at | int | The timestamp in milliseconds when the order was canceled, or 0 if not canceled -canceled-at | int | The timestamp in milliseconds when the order was finished, or 0 if not finished -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app -state | string | submitted, partical-filled, cancelling -exchange | string | Internal data -batch | string | Internal data - -## Search the Match Results - -This endpoint returns the match results of past and open orders based on specific search criteria. - -### HTTP Request - -`GET https://api.huobi.pro/v1/order/matchresults` - -```shell -curl "https://api.huobi.pro/v1/order/matchresults" -``` - -> The above command returns JSON structured like this: - -```json -{ - "data": [ - { - "id": 29553, - "order-id": 59378, - "match-id": 59335, - "symbol": "ethusdt", - "type": "buy-limit", - "source": "api", - "price": "100.1000000000", - "filled-amount": "9.1155000000", - "filled-fees": "0.0182310000", - "created-at": 1494901400435 - } - ] -} -``` - -### Request Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -types | string | false | All | The types of order to include in the search -states | string | false | All | The states of order to include in the search -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd -from | string | false | NA | Search match result id to begin with -direct | string | false | next | Search direction when 'from' is used, possible values: 'next', 'prev' -size | int | false | 100 | The max number of orders to return - -### Response Content - - - -Parameter | Data Type | Description ---------- | --------- | ----------- -id | integer | Internal id -symbol | string | The trading pair to trade, e.g. btcusdt, bccbtc -order-id | string | The order id of this order -match-id | string | The match id of this match -price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the match and fill is done -type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -filled-amount | string | The amount which has been filled -filled-fees | string | Transaction fee paid so far -source | string | The source where the order was triggered, possible values: sys, web, api, app +data | integer | Unique transfer id -# Margin Trading +# Wallet (Deposit and Withdraw) - - - +## Create a Withdraw Request -## Transfer Asset from Spot Trading Account to Margin Account +This endpoint creates a withdraw request from your spot trading account to an external address. -This endpoint transfer specific asset from spot trading account to margin account. + ### HTTP Request -`POST https://api.huobi.pro/v1/dw/transfer-in/margin` +`POST https://api.huobi.pro/v1/dw/withdraw/api/create` ```shell -curl "https://api.huobi.pro/v1/dw/transfer-in/margin" -BODY -{ - "symbol": "ethusdt", +curl -X POST -H "Content-Type: application/json" "https://api.huobi.pro/v1/dw/withdraw/api/create" -d +'{ + "address": "0xde709f2102306220921060314715629080e2fb77", + "amount": "0.05", "currency": "eth", - "amount": "1.0" -} + "fee": "0.01" +}' ``` +### Request Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +address | string | true | NA | The desination address of this withdraw +currency | string | true | NA | The crypto currency to withdraw +amount | string | true | NA | The amount of currency to withdraw +fee | string | false | NA | The fee to pay with this withdraw +addr-tag | string | false | NA | A tag specified for this address + > The above command returns JSON structured like this: ```json @@ -1365,14 +1074,6 @@ BODY } ``` -### Request Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow - ### Response Content @@ -1381,306 +1082,598 @@ Field | Data Type | Description --------- | --------- | ----------- data | integer | Transfer id -## Transfer Asset from Margin Account to Spot Trading Account + -This endpoint transfer specific asset from margin account to spot trading account. +## Cancel a Withdraw Request + +This endpoint cancels a previously created withdraw request by its transfer id. ### HTTP Request -`POST https://api.huobi.pro/v1/dw/transfer-out/margin` +`POST https://api.huobi.pro/v1/dw/withdraw-virtual/{withdraw-id}/cancel` ```shell -curl "https://api.huobi.pro/v1/dw/transfer-out/margin" -BODY -{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -} +curl -X POST "https://api.huobi.pro/v1/dw/withdraw-virtual/1000/cancel" ``` +### Request Parameters + + + > The above command returns JSON structured like this: ```json -{ - "data": 1000 +{ + "status": "ok", + "data": 700 } ``` -### Request Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow - ### Response Content -Field | Data Type | Description +Parameter | Data Type | Description --------- | --------- | ----------- -data | integer | Transfer id +data | integer | Withdraw cancel id -## Place a Margin Loan Order +## Search for Existed Withdraws and Deposits -This endpoint place an order to initiate a margin loan. +This endpoint searches for all existed withdraws and deposits and return their latest status. ### HTTP Request -`POST https://api.huobi.pro/v1/margin/orders` +`GET https://api.huobi.pro/v1/query/deposit-withdraw` ```shell -curl "https://api.huobi.pro/v1/margin/orders" -BODY -{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -} +curl "https://api.huobi.pro/v1/query/deposit-withdraw?currency=xrp&type=deposit&from=5&size=12" ``` +### Request Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +currency | string | true | NA | The crypto currency to withdraw +type | string | true | NA | Define transfer type to search, possible values: [deposit, withdraw] +from | string | true | NA | The transfer id to begin search +size | string | true | NA | The max number of items to return + > The above command returns JSON structured like this: ```json { - "data": 1000 + "data": [ + { + "id": 1171, + "type": "deposit", + "currency": "xrp", + "tx-hash": "ed03094b84eafbe4bc16e7ef766ee959885ee5bcb265872baaa9c64e1cf86c2b", + "amount": 7.457467, + "address": "rae93V8d2mdoUQHwBDBdM4NHCMehRJAsbm", + "address-tag": "100040", + "fee": 0, + "state": "safe", + "created-at": 1510912472199, + "updated-at": 1511145876575 + } + ] } ``` -### Request Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc -currency | string | true | NA | The currency to borrow -amount | string | true | NA | The amount of currency to borrow - ### Response Content - - Field | Data Type | Description --------- | --------- | ----------- -data | integer | Margin order id - -## Repay Margin Loan - -This endpoint repays margin loan with you asset in your margin account. - -### HTTP Request - -`POST https://api.huobi.pro/v1/margin/orders/{order-id}/repay` - -```shell -curl "https://api.huobi.pro/v1/margin/orders/1000/repay" -BODY -{ - "amount": "1.0" -} -``` +id | integer | Transfer id +type | string | Define transfer type to search, possible values: [deposit, withdraw] +currency | string | The crypto currency to withdraw +tx-hash | string | The on-chain transaction hash +amount | integer | The number of crypto asset transfered in its minimum unit +address | string | The deposit or withdraw source address +address-tag | string | The user defined address tag +fee | integer | The amount of fee taken by Huobi in this crypto's minimum unit +state | string | The state of this transfer (see below for details) +created-at | integer | The timestamp in milliseconds for the transfer creation +updated-at | integer | The timestamp in milliseconds for the transfer's latest update -> The above command returns JSON structured like this: +**List of possible withdraw state** -```json -{ - "data": 1000 -} -``` +State | Description +--------- | ----------- +submitted | Withdraw request submitted successfully +reexamine | Under examination for withdraw validation +canceled | Withdraw canceled by user +pass | Withdraw validation passed +reject | Withdraw validation rejected +pre-transfer | Withdraw is about to be released +wallet-transfer | On-chain transfer initiated +wallet-reject | Transfer rejected by chain +confirmed | On-chain transfer completed with one confirmation +confirm-error | On-chain transfer faied to get confirmation +repealed | Withdraw terminated by system -### Request Parameters +**List of possible deposit state** -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -amount | string | true | NA | The amount of currency to repay +State | Description +--------- | ----------- +unknown | On-chain transfer has not been received +confirming | On-chain transfer waits for first confirmation +confirmed | On-chain transfer confirmed for at least one block +safe | Multiple on-chain confirmation happened +orphan | Confirmed but currently in an orphan branch -### Response Content +# Trading - + -Field | Data Type | Description ---------- | --------- | ----------- -data | integer | Margin order id + -## Search Past Margin Orders +## Place a New Order -This endpoint returns margin orders based on a specific searching criteria. +This endpoint place a new order and send to the exchange to be matched. ### HTTP Request -`GET https://api.huobi.pro/v1/margin/loan-orders` +`POST https://api.huobi.pro/v1/order/orders/place` ```shell -curl "https://api.huobi.pro/v1/margin/load-orders" -BODY { +curl -X POST -H "Content-Type: application/json" "https://api.huobi.pro/v1/order/orders/place" -d +'{ "account-id": "100009", "amount": "10.1", "price": "100.1", "source": "api", "symbol": "ethusdt", "type": "buy-limit" - } + }' ``` -> The above command returns JSON structured like this: +### Request Parameters -```json -{ - "data": [ - { - "loan-balance": "0.100000000000000000", - "interest-balance": "0.000200000000000000", - "interest-rate": "0.002000000000000000", - "loan-amount": "0.100000000000000000", - "accrued-at": 1511169724531, - "interest-amount": "0.000200000000000000", - "symbol": "ethbtc", - "currency": "btc", - "id": 394, - "state": "accrual", - "account-id": 17747, - "user-id": 119913, - "created-at": 1511169724531 +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +account-id | string | true | NA | The account id used for this spot trading +symbol | string | true | NA | The trading symbol to trade, e.g. btcusdt, bccbtc +type | string | true | NA | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker +amount | string | true | NA | The amount in quote currency to buy / the amount in base currency to sell +price | string | false | NA | The limit price of limit order +source | string | false | api | When trade with margin use 'margin-api' + +> The above command returns JSON structured like this: + +```json +{ + "data": "59378" +} +``` + +### Response Content + + + +## Get All Open Orders + +This endpoint returns all open orders which have not been filled completely. + +### HTTP Request + +`GET https://api.huobi.pro/v1/order/openOrders` + +```shell +curl "https://api.huobi.pro/v1/order/openOrders?account-id=100009&symbol=btcusdt&side=buy&size=5" +``` + +### Request Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +account-id | string | false | NA | The account id used for this spot trading +symbol | string | false | NA | The trading symbol to trade, e.g. btcusdt, bccbtc +side | string | false | both | Filter on the direction of the trade, possible values are: buy, sell. Default is to return all +size | int | false | 10 | The number of orders to return, max number 2000 + +> The above command returns JSON structured like this: + +```json +{ + "data": [ + { + "id": 5454937, + "symbol": "ethusdt", + "account-id": 30925, + "amount": "1.000000000000000000", + "price": "0.453000000000000000", + "created-at": 1530604762277, + "type": "sell-limit", + "filled-amount": "0.0", + "filled-cash-amount": "0.0", + "filled-fees": "0.0", + "source": "web", + "state": "submitted" } ] } ``` +### Response Content + +Parameter | Data Type | Description +--------- | --------- | ----------- +id | integer | order id +symbol | string | The trading symbol to trade, e.g. btcusdt, bccbtc +price | string | The limit price of limit order +created-at | int | The timestamp in milliseconds when the order was created +type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker +filled-amount | string | The amount which has been filled +filled-cash-amount | string | The filled total in quote currency +filled-fees | string | Transaction fee paid so far +source | string | The source where the order was triggered, possible values: sys, web, api, app +state | string | submitted, partical-filled, cancelling + +## Submit Cancel for an Order + +This endpoint submit a request to cancel an order. + + + +### HTTP Request + +`POST https://api.huobi.pro/v1/order/orders/{order-id}/submitcancel` + +```shell +curl -X POST "https://api.huobi.pro/v1/order/orders/59378/submitcancel" +``` + +### Request Parameters + +No parameter is needed for this endpoint. + +> The above command returns JSON structured like this: + +```json +{ + "data": "59378" +} +``` + +### Response Content + + + +## Submit Cancel for Multiple Orders at Once + +This endpoint submit cancellation for multiple orders at once with given ids. + +### HTTP Request + +`POST https://api.huobi.pro/v1/order/orders/batchcancel` + +```shell +curl -X POST -H 'Content-Type: application/json' https://api.huobi.pro/v1/order/orders/batchcancel -d +'{ + "order-ids": [ + "1", "2", "3" + ] +}' +``` + ### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to trade, e.g. btcusdt, bccbtc -states | string | false | All | The states of order to include in the search -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd -end-date | string | false | today | Search ends date, in format yyyy-mm-dd -from | string | false | both | Search order id to begin with -direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' -size | int | false | 100 | The max number of orders to return, max value is 100 +order-ids | list | true | NA | The order ids to cancel. Max size is 50. + +> The above command returns JSON structured like this: + +```json +{ + "data": { + "success": [ + "1", + "3" + ], + "failed": [ + { + "err-msg": "记录无效", + "order-id": "2", + "err-code": "base-record-invalid" + } + ] + } +} +``` + +### Response Content + +Field | Data Type | Description +--------- | --------- | ----------- +success | list | The order ids with thier cancel request sent successfully +failed | list | The details of the failed cancel request + +## Get the Order Detail of an Order + +This endpoint returns the detail of one order. + +### HTTP Request + +`GET https://api.huobi.pro/v1/order/orders/{order-id}` + +```shell +curl "https://api.huobi.pro/v1/order/orders/59378" +``` + +### Request Parameters + +No parameter is needed for this endpoint. + +> The above command returns JSON structured like this: + +```json +{ + "data": { + "id": 59378, + "symbol": "ethusdt", + "account-id": 100009, + "amount": "10.1000000000", + "price": "100.1000000000", + "created-at": 1494901162595, + "type": "buy-limit", + "field-amount": "10.1000000000", + "field-cash-amount": "1011.0100000000", + "field-fees": "0.0202000000", + "finished-at": 1494901400468, + "user-id": 1000, + "source": "api", + "state": "filled", + "canceled-at": 0, + "exchange": "huobi", + "batch": "" + } +} +``` ### Response Content Field | Data Type | Description --------- | --------- | ----------- -id | integer | Order id -account-id | integer | Account id -user-id | integer | User id -symbol | string | The margin loan pair to trade, e.g. btcusdt, bccbtc -currency | string | The currency in the loan +id | integer | order id +symbol | string | The trading symbol to trade, e.g. btcusdt, bccbtc +account-id | string | The account id which this order belongs to +amount | string | The amount of base currency in this order +price | string | The limit price of limit order created-at | int | The timestamp in milliseconds when the order was created -accrued-at | int | The timestamp in milliseconds when the last accure happened +finished-at | int | The timestamp in milliseconds when the order was changed to a final state. This is not the time the order is matched. +canceled-at | int | The timestamp in milliseconds when the order was canceled, if not canceled then has value of 0 type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -loan-amount | string | The amount of the origin loan -loan-balance | string | The amount of the loan left -interest-rate | string | The loan interest rate -interest-amount | string | The accumulated loan interest -interest-balance | string | The amount of loan interest left -state | string | Loan state, possible values: created, accrual, cleared, invalid +filled-amount | string | The amount which has been filled +filled-cash-amount | string | The filled total in quote currency +filled-fees | string | Transaction fee paid so far +source | string | The source where the order was triggered, possible values: sys, web, api, app +state | string | Order state: submitted, partical-filled, cancelling, filled, canceled +exchange | string | Internal data +batch | string | Internal data -## Return the Balance of the Margin Loan Account +## Get the Match Result of an Order -This endpoint returns the balance of the margin loan account. +This endpoint returns the match result of an order. ### HTTP Request -`GET https://api.huobi.pro/v1/margin/accounts/balance` +`GET https://api.huobi.pro/v1/order/orders/{order-id}/matchresult` ```shell -curl "https://api.huobi.pro/v1/margin/accounts/balance?symbol=btcusdt" +curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" +``` + +### Request Parameters + +No parameter is needed for this endpoint. + +> The above command returns JSON structured like this: + +```json + "data": [ + { + "id": 29553, + "order-id": 59378, + "match-id": 59335, + "symbol": "ethusdt", + "type": "buy-limit", + "source": "api", + "price": "100.1000000000", + "filled-amount": "9.1155000000", + "filled-fees": "0.0182310000", + "created-at": 1494901400435 + } + ] ``` +### Response Content + + + +Parameter | Data Type | Description +--------- | --------- | ----------- +id | integer | Internal id +symbol | string | The trading symbol to trade, e.g. btcusdt, bccbtc +order-id | string | The order id of this order +match-id | string | The match id of this match +price | string | The limit price of limit order +created-at | int | The timestamp in milliseconds when the match and fill is done +type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker +filled-amount | string | The amount which has been filled +filled-fees | string | Transaction fee paid so far +source | string | The source where the order was triggered, possible values: sys, web, api, app + +## Search Past Orders + +This endpoint returns orders based on a specific searching criteria. + +### HTTP Request + +`GET https://api.huobi.pro/v1/order/orders` + +```shell +curl "https://api.huobi.pro/v1/order/orders?symbol=ethusdt&type=buy-limit&staet=filled" +``` + +### Request Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +symbol | string | true | NA | The trading symbol to trade, e.g. btcusdt, bccbtc +types | string | false | All | The types of order to include in the search +states | string | false | All | The states of order to include in the search +start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd +end-date | string | false | today | Search ends date, in format yyyy-mm-dd +from | string | false | both | Search order id to begin with +direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' +size | int | false | 100 | The max number of orders to return, max value is 100 + > The above command returns JSON structured like this: ```json { -"data": [ - { - "id": 18264, - "type": "margin", - "state": "working", - "symbol": "btcusdt", - "fl-price": "0", - "fl-type": "safe", - "risk-rate": "475.952571086994250554", - "list": [ - { - "currency": "btc", - "type": "trade", - "balance": "1168.533000000000000000" - }, - { - "currency": "btc", - "type": "frozen", - "balance": "0.000000000000000000" - }, - { - "currency": "btc", - "type": "loan", - "balance": "-2.433000000000000000" - }, - { - "currency": "btc", - "type": "interest", - "balance": "-0.000533000000000000" - }, - { - "currency": "btc", - "type": "transfer-out-available",//可转btc - "balance": "1163.872174670000000000" - }, - { - "currency": "btc", - "type": "loan-available",//可借btc - "balance": "8161.876538350676000000" - } - ] - } - ] + "data": [ + { + "id": 59378, + "symbol": "ethusdt", + "account-id": 100009, + "amount": "10.1000000000", + "price": "100.1000000000", + "created-at": 1494901162595, + "type": "buy-limit", + "field-amount": "10.1000000000", + "field-cash-amount": "1011.0100000000", + "field-fees": "0.0202000000", + "finished-at": 1494901400468, + "user-id": 1000, + "source": "api", + "state": "filled", + "canceled-at": 0, + "exchange": "huobi", + "batch": "" + } + ] } ``` +### Response Content + +Field | Data Type | Description +--------- | --------- | ----------- +id | integer | Order id +account-id | integer | Account id +user-id | integer | User id +amount | string | The amount of base currency in this order +symbol | string | The trading symbol to trade, e.g. btcusdt, bccbtc +price | string | The limit price of limit order +created-at | int | The timestamp in milliseconds when the order was created +canceled-at | int | The timestamp in milliseconds when the order was canceled, or 0 if not canceled +canceled-at | int | The timestamp in milliseconds when the order was finished, or 0 if not finished +type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker +filled-amount | string | The amount which has been filled +filled-cash-amount | string | The filled total in quote currency +filled-fees | string | Transaction fee paid so far +source | string | The source where the order was triggered, possible values: sys, web, api, app +state | string | submitted, partical-filled, cancelling +exchange | string | Internal data +batch | string | Internal data + +## Search the Match Results + +This endpoint returns the match results of past and open orders based on specific search criteria. + +### HTTP Request + +`GET https://api.huobi.pro/v1/order/matchresults` + +```shell +curl "https://api.huobi.pro/v1/order/matchresults?symbol=ethusdt" +``` + ### Request Parameters Parameter | Data Type | Required | Default | Description --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to borrow margin, e.g. btcusdt, bccbtc +symbol | string | true | NA | The trading symbol to trade, e.g. btcusdt, bccbtc +types | string | false | All | The types of order to include in the search +states | string | false | All | The states of order to include in the search +start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd +end-date | string | false | today | Search ends date, in format yyyy-mm-dd +from | string | false | NA | Search match result id to begin with +direct | string | false | next | Search direction when 'from' is used, possible values: 'next', 'prev' +size | int | false | 100 | The number of orders to return, max is 100 + +> The above command returns JSON structured like this: + +```json +{ + "data": [ + { + "id": 29553, + "order-id": 59378, + "match-id": 59335, + "symbol": "ethusdt", + "type": "buy-limit", + "source": "api", + "price": "100.1000000000", + "filled-amount": "9.1155000000", + "filled-fees": "0.0182310000", + "created-at": 1494901400435 + } + ] +} +``` ### Response Content -Parameter | Data Type | Description ---------- | --------- | ----------- -symbol | string | The margin loan pair, e.g. btcusdt, bccbtc -state | string | Loan state, possible values: created, accrual, cleared, invalid -risk-rate | string | The risk rate -fl-price | string | The price which triggers closeout -list | object array | The list of loans and their details + -# Wallet (Deposit and Withdraw) +Parameter | Data Type | Description +--------- | --------- | ----------- +id | integer | Internal id +symbol | string | The trading symbol to trade, e.g. btcusdt, bccbtc +order-id | string | The order id of this order +match-id | string | The match id of this match +price | string | The limit price of limit order +created-at | int | The timestamp in milliseconds when the match and fill is done +type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker +filled-amount | string | The amount which has been filled +filled-fees | string | Transaction fee paid so far +source | string | The source where the order was triggered, possible values: sys, web, api, app + +# Margin Loan -## Create a Withdraw Request + -This endpoint creates a withdraw request from your spot trading account to an external address. +## Transfer Asset from Spot Trading Account to Margin Account - +This endpoint transfer specific asset from spot trading account to margin account. ### HTTP Request -`POST https://api.huobi.pro/v1/dw/withdraw/api/create` +`POST https://api.huobi.pro/v1/dw/transfer-in/margin` ```shell -curl "https://api.huobi.pro/v1/dw/withdraw/api/create" -BODY -{ - "address": "0xde709f2102306220921060314715629080e2fb77", - "amount": "0.05", +curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/dw/transfer-in/margin" -d +'{ + "symbol": "ethusdt", "currency": "eth", - "fee": "0.01" -} + "amount": "1.0" +}' ``` +### Request Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +symbol | string | true | NA | The trading symbol to borrow margin, e.g. btcusdt, bccbtc +currency | string | true | NA | The currency to borrow +amount | string | true | NA | The amount of currency to borrow + > The above command returns JSON structured like this: ```json @@ -1689,16 +1682,6 @@ BODY } ``` -### Request Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -address | string | true | NA | The desination address of this withdraw -currency | string | true | NA | The crypto currency to withdraw -amount | string | true | NA | The amount of currency to withdraw -fee | string | false | NA | The fee to pay with this withdraw -addr-tag | string | false | NA | A tag specified for this address - ### Response Content @@ -1707,367 +1690,514 @@ Field | Data Type | Description --------- | --------- | ----------- data | integer | Transfer id - - -## Cancel a Withdraw Request +## Transfer Asset from Margin Account to Spot Trading Account -This endpoint cancels a previously created withdraw request by its transfer id. +This endpoint transfer specific asset from margin account to spot trading account. ### HTTP Request -`POST https://api.huobi.pro/v1/dw/withdraw-virtual/{withdraw-id}/cancel` +`POST https://api.huobi.pro/v1/dw/transfer-out/margin` ```shell -curl "https://api.huobi.pro/v1/dw/withdraw-virtual/1000/cancel" +curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/dw/transfer-out/margin" +'{ + "symbol": "ethusdt", + "currency": "eth", + "amount": "1.0" +}' ``` +### Request Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +symbol | string | true | NA | The trading symbol to borrow margin, e.g. btcusdt, bccbtc +currency | string | true | NA | The currency to borrow +amount | string | true | NA | The amount of currency to borrow + > The above command returns JSON structured like this: ```json -{ - "status": "ok", - "data": 700 +{ + "data": 1000 } ``` -### Request Parameters - - - ### Response Content -Parameter | Data Type | Description +Field | Data Type | Description --------- | --------- | ----------- -data | integer | Withdraw cancel id +data | integer | Transfer id -## Search for Existed Withdraws and Deposits +## Request a Margin Loan -This endpoint searches for all existed withdraws and deposits and return their latest status. +This endpoint place an order to apply a margin loan. ### HTTP Request -`GET https://api.huobi.pro/v1/query/deposit-withdraw` +`POST https://api.huobi.pro/v1/margin/orders` ```shell -curl "https://api.huobi.pro/v1/query/deposit-withdraw?currency=xrp&type=deposit&from=5&size=12" +curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/margin/orders" +'{ + "symbol": "ethusdt", + "currency": "eth", + "amount": "1.0" +}' ``` +### Request Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +symbol | string | true | NA | The trading symbol to borrow margin, e.g. btcusdt, bccbtc +currency | string | true | NA | The currency to borrow +amount | string | true | NA | The amount of currency to borrow + > The above command returns JSON structured like this: ```json { - "data": [ - { - "id": 1171, - "type": "deposit", - "currency": "xrp", - "tx-hash": "ed03094b84eafbe4bc16e7ef766ee959885ee5bcb265872baaa9c64e1cf86c2b", - "amount": 7.457467, - "address": "rae93V8d2mdoUQHwBDBdM4NHCMehRJAsbm", - "address-tag": "100040", - "fee": 0, - "state": "safe", - "created-at": 1510912472199, - "updated-at": 1511145876575 - } - ] + "data": 1000 } ``` -### Request Parameters - -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -currency | string | true | NA | The crypto currency to withdraw -type | string | true | NA | Define transfer type to search, possible values: [deposit, withdraw] -from | string | true | NA | The transfer id to begin search -size | string | true | NA | The max number of items to return - ### Response Content + + Field | Data Type | Description --------- | --------- | ----------- -id | integer | Transfer id -type | string | Define transfer type to search, possible values: [deposit, withdraw] -currency | string | The crypto currency to withdraw -tx-hash | string | The on-chain transaction hash -amount | integer | The number of crypto asset transfered in its minimum unit -address | string | The deposit or withdraw source address -address-tag | string | The user defined address tag -fee | integer | The amount of fee taken by Huobi in this crypto's minimum unit -state | string | The state of this transfer (see below for details) -created-at | integer | The timestamp in milliseconds for the transfer creation -updated-at | integer | The timestamp in milliseconds for the transfer's latest update +data | integer | Margin order id -**List of possible withdraw state** +## Repay Margin Loan -State | Description ---------- | ----------- -submitted | Withdraw request submitted successfully -reexamine | Under examination for withdraw validation -canceled | Withdraw canceled by user -pass | Withdraw validation passed -reject | Withdraw validation rejected -pre-transfer | Withdraw is about to be released -wallet-transfer | On-chain transfer initiated -wallet-reject | Transfer rejected by chain -confirmed | On-chain transfer completed with one confirmation -confirm-error | On-chain transfer faied to get confirmation -repealed | Withdraw terminated by system +This endpoint repays margin loan with you asset in your margin account. -**List of possible deposit state** +### HTTP Request -State | Description ---------- | ----------- -unknown | On-chain transfer has not been received -confirming | On-chain transfer waits for first confirmation -confirmed | On-chain transfer confirmed for at least one block -safe | Multiple on-chain confirmation happened -orphan | Confirmed but currently in an orphan branch +`POST https://api.huobi.pro/v1/margin/orders/{order-id}/repay` -# Account +```shell +curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/margin/orders/1000/repay" +'{ + "amount": "1.0" +}' +``` - +### Request Parameters -## Get all Accounts of the Current User +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +amount | string | true | NA | The amount of currency to repay -This endpoint returns a list of accounts owned by this API user. +> The above command returns JSON structured like this: + +```json +{ + "data": 1000 +} +``` + +### Response Content + + + +Field | Data Type | Description +--------- | --------- | ----------- +data | integer | Margin order id + +## Search Past Margin Orders + +This endpoint returns margin orders based on a specific searching criteria. ### HTTP Request -`GET https://api.huobi.pro/v1/account/accounts` +`GET https://api.huobi.pro/v1/margin/loan-orders` ```shell -curl "https://api.huobi.pro/v1/account/accounts" +curl "https://api.huobi.pro/v1/margin/load-orders?symbol=ethusdt" ``` +### Request Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +symbol | string | true | NA | The trading symbol to trade, e.g. btcusdt, bccbtc +states | string | false | All | The states of order to include in the search +start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd +end-date | string | false | today | Search ends date, in format yyyy-mm-dd +from | string | false | both | Search order id to begin with +direct | string | false | both | Search direction when 'from' is used, possible values: 'next', 'prev' +size | int | false | 100 | The max number of orders to return, max value is 100 + > The above command returns JSON structured like this: ```json +{ "data": [ { - "id": 100009, - "type": "spot", - "state": "working", - "user-id": 1000 + "loan-balance": "0.100000000000000000", + "interest-balance": "0.000200000000000000", + "interest-rate": "0.002000000000000000", + "loan-amount": "0.100000000000000000", + "accrued-at": 1511169724531, + "interest-amount": "0.000200000000000000", + "symbol": "ethbtc", + "currency": "btc", + "id": 394, + "state": "accrual", + "account-id": 17747, + "user-id": 119913, + "created-at": 1511169724531 } ] +} ``` -### Request Parameters - - - ### Response Content Field | Data Type | Description --------- | --------- | ----------- -id | integer | Unique account id -state | string | Account state, possible values: [working, lock] -type | string | The type of this account, possible values: [spot, margin, otc, point] +id | integer | Order id +account-id | integer | Account id +user-id | integer | User id +symbol | string | The margin loan pair to trade, e.g. btcusdt, bccbtc +currency | string | The currency in the loan +created-at | int | The timestamp in milliseconds when the order was created +accrued-at | int | The timestamp in milliseconds when the last accure happened +type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker +loan-amount | string | The amount of the origin loan +loan-balance | string | The amount of the loan left +interest-rate | string | The loan interest rate +interest-amount | string | The accumulated loan interest +interest-balance | string | The amount of loan interest left +state | string | Loan state, possible values: created, accrual, cleared, invalid -## Get Account Balance of a Specific Account +## Get the Balance of the Margin Loan Account -This endpoint returns the balance of an account specified by account id. +This endpoint returns the balance of the margin loan account. ### HTTP Request -`GET https://api.huobi.pro/v1/account/accounts/{account-id}/balance` +`GET https://api.huobi.pro/v1/margin/accounts/balance` ```shell -curl "https://api.huobi.pro/v1/account/accounts/100009/balance" +curl "https://api.huobi.pro/v1/margin/accounts/balance?symbol=btcusdt" ``` +### Request Parameters + +Parameter | Data Type | Required | Default | Description +--------- | --------- | -------- | ------- | ----------- +symbol | string | true | NA | The trading symbol to borrow margin, e.g. btcusdt, bccbtc + > The above command returns JSON structured like this: ```json -"data": { - "id": 100009, - "type": "spot", - "state": "working", - "list": [ - { - "currency": "usdt", - "type": "trade", - "balance": "500009195917.4362872650" - }, - { - "currency": "usdt", - "type": "frozen", - "balance": "328048.1199920000" - }, - { - "currency": "etc", - "type": "trade", - "balance": "499999894616.1302471000" - } - ], - } +{ +"data": [ + { + "id": 18264, + "type": "margin", + "state": "working", + "symbol": "btcusdt", + "fl-price": "0", + "fl-type": "safe", + "risk-rate": "475.952571086994250554", + "list": [ + { + "currency": "btc", + "type": "trade", + "balance": "1168.533000000000000000" + }, + { + "currency": "btc", + "type": "frozen", + "balance": "0.000000000000000000" + }, + { + "currency": "btc", + "type": "loan", + "balance": "-2.433000000000000000" + }, + { + "currency": "btc", + "type": "interest", + "balance": "-0.000533000000000000" + }, + { + "currency": "btc", + "type": "transfer-out-available",//可转btc + "balance": "1163.872174670000000000" + }, + { + "currency": "btc", + "type": "loan-available",//可借btc + "balance": "8161.876538350676000000" + } + ] + } + ] } ``` -### Request Parameters - - - ### Response Content -Field | Data Type | Description ---------- | --------- | ----------- -id | integer | Unique account id -state | string | Account state, possible values: [working, lock] -type | string | The type of this account, possible values: [spot, margin, otc, point] -list | object | The balance details of each currency +Parameter | Data Type | Description +--------- | --------- | ----------- +symbol | string | The margin loan pair, e.g. btcusdt, bccbtc +state | string | Loan state, possible values: created, accrual, cleared, invalid +risk-rate | string | The risk rate +fl-price | string | The price which triggers closeout +list | object array | The list of loans and their details -**Per list item content** +# ETF Creation and Redemption -Parameter | Data Type | Description ---------- | --------- | ----------- -currency | string | The currency of this balance -type | string | The balance type, possible values: [trade, frozen] -balance | string | The balance in the main currency unit +Huobi's platform allows clients to create ETF holdings with their matching assets, and also allows clients to redempt ETF to comprised assets. -## Get Account Balance of a Sub-Account +## Creation and Redemption Configuration -This endpoint returns the balance of a sub-account specified by sub-account uid. +This endpoint will support the user to get the basic information of ETF creation and redemption, as well as ETF constituents, including max amount of creation, min amount of creation, max amount of redemption, min amount of redemption, creation fee rate, redemption fee rate, eft create/redeem status. ### HTTP Request -`GET https://api.huobi.pro/v1/account/accounts/{sub-account-uid}` +- GET `/etf/swap/config` ```shell -curl "https://api.huobi.pro/v1/account/accounts/10758899" +curl "https://api.huobi.pro/etf/swap/config?etf_name=hb10" ``` -> The above command returns JSON structured like this: +### Request Parameter + +Parameter | Data Type | Required | Description +----- |----- |----- |------ +etf_name | string | true | The name of the ETF, currently only support hb10 + +> Response: ```json -"data": [ -{ - "id": 9910049, - "type": "spot", - "list": [ - { - "currency": "btc", - "type": "trade", - "balance": "1.00" - }, - { - "currency": "eth", - "type": "trade", - "balance": "1934.00" - } - ] -}, { - "id": 9910050, - "type": "point", - "list": [] + "code": 200, + "data": { + "purchase_min_amount": 10000, + "purchase_max_amount": 100000, + "redemption_min_amount": 10000, + "redemption_max_amount": 10000, + "purchase_fee_rate": 0.001, + "redemption_fee_rate": 0.002, + "etf_status":1, + "unit_price": + [ + { + "currency": "eth", + "amount": 19.9 + }, + { + "currency": "btc", + "amount": 9.9 + } + ] + }, + "message": null, + "success": true } -] ``` -### Request Parameters - - - ### Response Content - - -Field | Data Type | Description ---------- | --------- | ----------- -id | integer | Unique account id -type | string | The type of this account, possible values: [spot, margin, otc, point] -list | object | The balance details of each currency - -**Per list item content** - -Field | Data Type | Description ---------- | --------- | ----------- -currency | string | The currency of this balance -type | string | The balance type, possible values: [trade, frozen] -balance | string | The balance in the main currency unit +Field | Data Type | Description | +----------- |------------|----------- | +purchase_min_amount | integer | Minimum creation amounts per request | +purchase_max_amount | integer | Max creation amounts per request | +redemption_min_amount | integer | Minimum redemption amounts per request | +redemption_max_amount | integer | Max redemption amounts per request | +purchase_fee_rate | decimal | Creation fee rate | +redemption_fee_rate | decimal | Redemption fee rate | +etf_status | integer | status of the ETF: Normal(1), Rebalancing Start(2), Creation and Redemption Suspended(3), Creation Suspended(4), Redemption Suspended(5) | +unit_price | array | ETF constitution in format of {amount, currency} -## Get the Aggregated Balance of all Sub-accounts of the Current User +## Order Creation/Redemption -This endpoint returns the balances of all the sub-account aggregated. +This endpoint allow clients to order creation or redemption of ETF. ### HTTP Request -`GET https://api.huobi.pro/v1/subuser/aggregate-balance` +- POST `/etf/swap/in` + +- POST `/etf/swap/out` ```shell -curl "https://api.huobi.pro/v1/subuser/aggregate-balance" +curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/etf/swap/in" -d +'{"etf_name": "hb10", "amount": 10000}' ``` -> The above command returns JSON structured like this: +### Request Parameter -```json - "data": [ - { - "currency": "eos", - "balance": "1954559.809500000000000000" - }, - { - "currency": "btc", - "balance": "0.000000000000000000" - }, - { - "currency": "usdt", - "balance": "2925209.411300000000000000" - } - ] -``` +Parameter | Required | Data Type | Description | +--------- |--------- |-----------|------------ | +etf_name | True | string | ETF name, currently only support hb10 +amount | True | integer | The amount to create or redemption -### Request Parameters +> Response: - +```json +{ + "code": 200, + "data": null, + "message": null, + "success": true +} +``` ### Response Content - - -Field | Data Type | Description ---------- | --------- | ----------- -currency | string | The currency of this balance -balance | string | The balance in the main currency unit - -## Transfer Asset between Parent and Sub Account - -This endpoint allows user to transfer asset between parent and sub account. +Field | Data Type | Description +-----------|-----------|----------- +code | integer | The overall status of the order, please find details in below table +data | object | The data content if available +message | string | The message of the order result +success | boolean | If the order is successful + +**Response code details** + +Code | Description +-- |-- +200 | Successful +10404 | Invalid ETF name +13403 | Insufficient asset to create ETF +13404 | Create and redemption disabled due to system setup +13405 | Create and redemption disabled due to configuration issue +13406 | Invalid API call +13410 | API authentication fails +13500 | System error +13601 | Create and redemption disabled during rebalance +13603 | Create and redemption disabled due to other reason +13604 | Create suspended +13605 | Redemption suspended +13606 | Amount incorrect. For the cases when creation amount or redemption amount is not in the range of min/max amount, this code will be returned. + +## Show Past Creation/Redemption + +This endpoints allows clients to get past creation and redemption.(up to 100 records) ### HTTP Request -`POST https://api.huobi.pro/v1/subuser/transfer` +- GET `/etf/swap/list ` ```shell -curl "https://api.huobi.pro/v1/subuser/transfer" -Body - +curl https://api.huobi.pro/etf/swap/list ``` -> The above command returns JSON structured like this: +### Request Parameter -```json - "data": 12345 -``` +Parameter | Required | Data Type | Description | +--------- |--------- |-----------|------------ | +etf_name | True | string | ETF name, currently only support hb10 +offset | True | integer | The offset of the records, set to 0 for the latest records +limit | True | integer | The number of records to return, max is 100 -### Request Parameters +> Response: -Parameter | Data Type | Required | Default | Description ---------- | --------- | -------- | ------- | ----------- -sub-uid | integer | true | NA | The target sub account uid to transfer to or from -currency | string | true | NA | The crypto currency to transfer -amount | decimal | true | NA | The amount of asset to transfer -type | string | true | NA | The type of transfer, possible values: [master-transfer-in, master-transfer-out, master-point-transfer-in, master-point-transfer-out] +```json +{ + "code": 200, + "data": [ + { + "id": 112222, + "gmt_created": 1528855872323, + "currency": "hb10", + "amount": 11.5, + "type": 1, + "status": 2, + "detail": + { + "used_ currency_list": + [ + { + "currency": "btc", + "amount": 0.666 + }, + { + "currency": "eth", + "amount": 0.666 + } + ], + "rate": 0.002, + "fee": 100.11, + "point_card_amount":1.0, + "obtain_ currency_list": + [ + { + "currency": "hb10", + "amount": 1000 + } + ] + } + }, + { + "id": 112223, + "gmt_created": 1528855872323, + "currency": "hb10", + "amount": 11.5, + "type": 2, + "status": 1, + "detail": + { + "used_ currency_list": + [ + { + "currency": "btc", + "amount": 0.666 + }, + { + "currency": "eth", + "amount": 0.666 + } + ], + "rate": 0.002, + "fee": 100.11, + "point_card_amount":1.0, + "obtain_ currency_list": + [ + { + "currency": "hb10", + "amount": 1000 + } + ] + } + } + ], + "message": null, + "success": true +} +``` ### Response Content - - -Parameter | Data Type | Description ---------- | --------- | ----------- -data | integer | Unique transfer id \ No newline at end of file +Field | Data Type | Description +----------- |-----------|----------- +id | integer | Creation/Redemption id +gmt_created | integer | Operation timestamp +currency | string | ETF name +amount | decimal | Creation/Redmption amount +type | integer | Creation(1), Redemption(2) +status | integer | Operation result +detail | array | Please find details below + +Detail + +Field | Data Type | Description | +----- |----- |----- | +used_currency_list | array | For creation this is the list and amount of underlying assets used for ETF creation. For redemption this is the amount of ETF used for redemption. +rate | decimal | Fee rate +fee | decimal | The actual fee amount +point_card_amount | decimal | Discount from point card +obtain_currency_list | array | For creation this is the amount for ETF created. For redemption this is the list and amount of underlying assets obtained. + +# Websocket Subscription + + - Websocket 文档 + \ No newline at end of file From d8f7e822040a6992fdbb4f7e0ece6e377900ba2f Mon Sep 17 00:00:00 2001 From: rayxy Date: Tue, 22 Jan 2019 15:45:14 +0000 Subject: [PATCH 015/759] Update index.html.md Improve content according to comments --- source/index.html.md | 438 ++++++++++++++++++++----------------------- 1 file changed, 200 insertions(+), 238 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index c800763c650..0ceba0067d6 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -23,8 +23,6 @@ You can use the drop down list above to change the API version. You can also use # API Access -All API requests are in either GET or POST method. For GET request, all parameters are query string parameters. For POST request, all parameters are in POST body and in JSON format. - ## Access URLs **REST API** @@ -40,7 +38,7 @@ All API requests are in either GET or POST method. For GET request, all paramete **`wss://api.huobi.pro/ws/v1`** +# Changelog + +| Live Date Time (UTC+8) | Change Detail | +|----- | ----- | +| 2019.01.17 07:00 | Add subscription parameter `model`.
Subscription does not return frozen balance of sub-account anymore. +| 2018.07.10 11:00 | In `/market/history/kline` the `size` parameter value range changes from [1-1000] to [1-2000]. +| 2018.07.06 16:00 | In `/v1/order/orders/place` add `buy-limit-maker` and `sell-limit-maker` order types.
Add new endpoint: `/v1/order/openOrders`.
Add new endpint: `/v1/order/orders/batchCancelOpenOrders` +| 2018.07.02 16:00 | ETF endpints now support transfer in/out of HB10. +| 2018.06.20 16:00 | Add new endpoint: `/market/tickers`. + # API Access ## Access URLs @@ -301,6 +311,30 @@ Each error will have a code and err-msg which explain the details of the error. [易语言](https://github.com/huobiapi/REST-YiYuyan-demo) +## Common Issue and Solution + +### Unstable Connection to API Service + +* Make sure you are using api.huobi.pro as the URL root to access the API + +* Choose to use AWS Tokyo as your hosting server should help + +### Fail to Sign API Request + +* Check if API key is correct and is still valid (not expired) +* Check if you have previously set whitelist with your API key and your hosting server is in the whitelist +* Check if you are using the correct timestamp in your signature +* Check if you are using the correct encoding in your signature, e.g. base64 for initial signature and URI for final request +* Check if you added parameters in ASCII order when creating the signature string + +### Receive "login-required" + +* Check for parameter `account-id` if you are using account-id from `/v1/account/accounts`. Make sure you are using those id not your UID. + +### Receive "gateway-internal-error" + +* Check if your post request have set header `Content-Type:application/json` + # Reference Data ## Get all Supported Trading Symbol @@ -419,7 +453,7 @@ This endpoint retrieves all klines in a specific range. `GET https://api.huobi.pro/market/history/kline` ```shell -curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" +curl "https://api.huobi.pro/market/history/kline?period=1day&size=200&symbol=btcusdt" ``` ### Query Parameters @@ -502,7 +536,7 @@ symbol | string | true | NA | The trading symbol to query | All Field | Data Type | Description --------- | --------- | ----------- -id | integer | NA +id | integer | The UNIX timestamp in seconds as response id amount | float | The aggregated trading volume in USDT count | integer | The number of completed trades open | float | The opening price of last 24 hours @@ -2257,5 +2291,5 @@ obtain_currency_list | array | For creation this is the amount for ETF crea # Websocket Subscription - - Websocket 文档 + - Websocket Documentation \ No newline at end of file From b6d95c6d25c10bf416a11170e8f3d9c067206e44 Mon Sep 17 00:00:00 2001 From: rayxy Date: Thu, 7 Feb 2019 15:54:18 +0000 Subject: [PATCH 022/759] Update index.html.md Small changes to improve wording --- source/index.html.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index de218847b4e..22951a40a59 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -311,12 +311,11 @@ Each error will have a code and err-msg which explain the details of the error. [易语言](https://github.com/huobiapi/REST-YiYuyan-demo) -## Common Issue and Solution +## Issue and Solution ### Unstable Connection to API Service * Make sure you are using api.huobi.pro as the URL root to access the API - * Choose to use AWS Tokyo as your hosting server should help ### Fail to Sign API Request @@ -347,7 +346,7 @@ curl "https://api.huobi.pro/v1/common/symbols" ### HTTP Request -- GET `/v1/common/symbols` +`GET /v1/common/symbols` ### Request Parameters @@ -396,7 +395,7 @@ curl "https://api.huobi.pro/v1/common/currencys" ### HTTP Request -- GET `/v1/common/currencys` +`GET /v1/common/currencys` ### Request Parameters @@ -426,7 +425,7 @@ curl "https://api.huobi.pro/v1/common/timestamp" ### HTTP Request -- GET `/v1/common/timestamp` +`GET /v1/common/timestamp` ### Request Parameters From 1b4ee14e31148d27dab0b0c4cd05489eae871738 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Fri, 15 Feb 2019 17:34:11 +0800 Subject: [PATCH 023/759] add CI deploy --- deploy.sh | 131 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 90 insertions(+), 41 deletions(-) diff --git a/deploy.sh b/deploy.sh index f999345e32b..46200008878 100755 --- a/deploy.sh +++ b/deploy.sh @@ -21,7 +21,9 @@ Options: run_build() { - bundle exec middleman build --clean --build-dir "build/v${version}/${language}" + build_dir=$build_directory/v$version/$language + echo "build_dir="$build_dir + bundle exec middleman build --clean --build-dir $build_dir } parse_args() { @@ -29,17 +31,8 @@ parse_args() { if [ -e ".env" ]; then source .env fi - - #default version uses 1 if a custom one is not supplied - if [[ -z $version ]]; then - version=1 - fi - - #default language uses en if a custom one is not supplied - if [[ -z $language ]]; then - language=en - fi - + # + check_version_lang # Parse arg flags # If something is exposed as an environment variable, set/overwrite it # here. Otherwise, set/overwrite the internal variable instead. @@ -72,9 +65,9 @@ parse_args() { # Set internal option vars from the environment and arg flags. All internal # vars should be declared here, with sane defaults if applicable. - # Source directory & target branch. - deploy_directory=build + build_directory=build + gh_pages_directory=gh-pages deploy_branch=gh-pages #if no user identity is already set in the current git environment, use this: @@ -88,6 +81,20 @@ parse_args() { append_hash=${GIT_DEPLOY_APPEND_HASH:-true} } +check_version_lang() { + # + branch=$(git describe --contains --all HEAD) + echo "branch="$branch"" + # + language=$(echo $branch | cut -d '_' -f 2) + version=$(echo $branch | cut -d '_' -f 1) + version=${version:1} + # + echo "language="$language"" + echo "version="$version"" + +} + main() { enable_expanded_output @@ -111,52 +118,62 @@ main() { previous_branch=`git rev-parse --abbrev-ref HEAD` - if [ ! -d "$deploy_directory" ]; then - echo "Deploy directory '$deploy_directory' does not exist. Aborting." >&2 + if [ ! -d "$build_directory" ]; then + echo "Build directory '$build_directory' does not exist. Aborting." >&2 return 1 fi # must use short form of flag in ls for compatibility with macOS and BSD - if [[ -z `ls -A "$deploy_directory" 2> /dev/null` && -z $allow_empty ]]; then - echo "Deploy directory '$deploy_directory' is empty. Aborting. If you're sure you want to deploy an empty tree, use the --allow-empty / -e flag." >&2 + if [[ -z `ls -A "$build_directory" 2> /dev/null` && -z $allow_empty ]]; then + echo "Build directory '$build_directory' is empty. Aborting. If you're sure you want to deploy an empty tree, use the --allow-empty / -e flag." >&2 return 1 fi - if git ls-remote --exit-code $repo "refs/heads/$deploy_branch" ; then - # deploy_branch exists in $repo; make sure we have the latest version - - disable_expanded_output - git fetch --force $repo $deploy_branch:$deploy_branch - enable_expanded_output + if [ ! -d $gh_pages_directory ]; then + echo "./gh-pages doesn't exist. Creating now" + mkdir ./$gh_pages_directory + echo "./gh-pages created" + else + echo "./gh-pages exists" fi + # if git ls-remote --exit-code $repo "refs/heads/$deploy_branch" ; then + # # deploy_branch exists in $repo; make sure we have the latest version + + # disable_expanded_output + # git fetch --force $repo $deploy_branch:$deploy_branch + # enable_expanded_output + # fi + # check if deploy_branch exists locally - if git show-ref --verify --quiet "refs/heads/$deploy_branch" - then incremental_deploy + if git show-ref --verify --quiet "refs/heads/$deploy_branch"; then + if git ls-remote --exit-code $repo "refs/heads/$deploy_branch" ; then + # deploy_branch exists in $repo; make sure we have the latest version + + disable_expanded_output + git fetch --force $repo $deploy_branch:$deploy_branch + enable_expanded_output + fi + incremental_deploy else initial_deploy fi restore_head } -initial_deploy() { - git --work-tree "$deploy_directory" checkout --orphan $deploy_branch - git --work-tree "$deploy_directory" add --all - commit+push +handle_deploy_files() { + if [ -d "$gh_pages_directory/$version/$language" ]; then + rm -rf $gh_pages_directory/$version/$language + fi + cp -r $build_directory/* $gh_pages_directory } -incremental_deploy() { - #make deploy_branch the current branch - git symbolic-ref HEAD refs/heads/$deploy_branch - #put the previously committed contents of deploy_branch into the index - git --work-tree "$deploy_directory" reset --mixed --quiet - git --work-tree "$deploy_directory" add --all - +check_diff() { set +o errexit - diff=$(git --work-tree "$deploy_directory" diff --exit-code --quiet HEAD --)$? + diff=$(git --work-tree "$gh_pages_directory" diff --exit-code --quiet HEAD --)$? set -o errexit case $diff in - 0) echo No changes to files in $deploy_directory. Skipping commit.;; + 0) echo No changes to files in $build_directory. Skipping commit.;; 1) commit+push;; *) echo git diff exited with code $diff. Aborting. Staying on branch $deploy_branch so you can debug. To switch back to master, use: git symbolic-ref HEAD refs/heads/master && git reset --mixed >&2 @@ -165,13 +182,43 @@ incremental_deploy() { esac } +initial_deploy() { + echo "initial_deploy..." + git fetch origin $deploy_branch + git --work-tree "$gh_pages_directory" fetch --force $repo $deploy_branch:$deploy_branch + git --work-tree "$gh_pages_directory" checkout $deploy_branch + handle_deploy_files + git --work-tree "$gh_pages_directory" add --all + check_diff +} + +incremental_deploy() { + echo "incremental_deploy..." + #make deploy_branch the current branch + git symbolic-ref HEAD refs/heads/$deploy_branch + #put the previously committed contents of deploy_branch into the index + git --work-tree "$gh_pages_directory" reset --mixed --quiet + handle_deploy_files + git --work-tree "$gh_pages_directory" add --all + check_diff +} + commit+push() { set_user_id - git --work-tree "$deploy_directory" commit -m "$commit_message" + git --work-tree "$gh_pages_directory" commit -m "$commit_message" disable_expanded_output #--quiet is important here to avoid outputting the repo URL, which may contain a secret token - git push --quiet $repo $deploy_branch + if [ $GH_TOKEN ]; then + # deploy by Travis CI + # add github token + repo="https://"$GH_TOKEN"@github.com/huobiapi/docs.git" + git remote add origin-pages $repo + git push --quiet origin-pages $deploy_branch + else + # manual deploy + git push --quiet $repo $deploy_branch + fi enable_expanded_output } @@ -232,3 +279,5 @@ else run_build main fi + + From dbad76d1ea5240f4b193d8178e5e3f91bae8572a Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Fri, 15 Feb 2019 17:34:36 +0800 Subject: [PATCH 024/759] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 10501583560..21e64b5407a 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ test/version_tmp tmp *.DS_STORE build/ +gh-pages/ .cache .vagrant .sass-cache From bac1a18ebdd9e891046cc92e5de946874bbfc627 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Fri, 15 Feb 2019 17:40:38 +0800 Subject: [PATCH 025/759] Update .travis.yml --- .travis.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0d6d210d94a..ee815b0f967 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,16 @@ sudo: false language: ruby rvm: - - 2.3.3 - 2.4.0 +branches: + only: + - v1_cn + - v1_en + - v2_cn + - v2_en + cache: bundler -script: bundle exec middleman build + +script: + - ./deploy.sh From cb32e1ee95dbfef011ea92fff892db66b1f73c55 Mon Sep 17 00:00:00 2001 From: Fred Yu <16685494+FredYuuu@users.noreply.github.com> Date: Tue, 9 Apr 2019 15:10:44 +0800 Subject: [PATCH 026/759] Update index.html.md --- source/index.html.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 9b202342ac1..1c847b93938 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1163,6 +1163,7 @@ address | string | true | NA | The desination address of this wit currency | string | true | NA | The crypto currency to withdraw amount | string | true | NA | The amount of currency to withdraw fee | string | false | NA | The fee to pay with this withdraw +chain | string | false | NA | set "usdterc20" to withdraw USDT(erc20) addr-tag | string | false | NA | A tag specified for this address > The above command returns JSON structured like this: @@ -2301,4 +2302,4 @@ obtain_currency_list | array | For creation this is the amount for ETF crea # Websocket Subscription - Websocket Documentation - \ No newline at end of file + From f31a120d0cddf2d8e9c73ff1ad8caa30640b228b Mon Sep 17 00:00:00 2001 From: "Rain@Huobi" Date: Sat, 13 Apr 2019 14:31:24 +0800 Subject: [PATCH 027/759] Update index.html.md --- source/index.html.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 1c847b93938..f8b65e21eea 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -51,7 +51,7 @@ Sub account can be used to isolate asset and trading. Asset can be transferred b Sub account has its individual login credential and API key. Sub account API can access all reference data and market data endpoints. In addition, sub account API can also access below listed endpoints. @@ -112,7 +112,7 @@ It is not recommended to use proxy to access Huobi API because it will introduce ## Endpoint Rate Limit -Each apikey can send maximum of 100 https requests within 10 seconds. Please contact customer support if you believe you need higher limit rate. +Each API Key can send maximum of 100 https requests within 10 seconds. Please contact customer support if you believe you need higher limit rate. ## Authentication From 661ff29bc4a832f76547de5c06e71dab5e2375f3 Mon Sep 17 00:00:00 2001 From: "Rain@Huobi" Date: Sat, 13 Apr 2019 14:33:08 +0800 Subject: [PATCH 028/759] Update index.html.md --- source/index.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index f8b65e21eea..adbeece3edb 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -51,7 +51,7 @@ Sub account can be used to isolate asset and trading. Asset can be transferred b Sub account has its individual login credential and API key. Sub account API can access all reference data and market data endpoints. In addition, sub account API can also access below listed endpoints. From d19326a0248680322f057a8ffbdc0ae3f671da57 Mon Sep 17 00:00:00 2001 From: "Rain@Huobi" Date: Tue, 16 Apr 2019 10:04:30 +0800 Subject: [PATCH 029/759] Update index.html.md --- source/index.html.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index adbeece3edb..bc958fc467e 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -78,6 +78,7 @@ When sub users tries to access the other APIs not on this list, the system will | Live Date Time (UTC+8) | Change Detail | |----- | ----- | +| 2019.04.16 10:00 | Correct the error. Both account-id and symbol are required for GET /v1/order/openOrders | 2019.01.17 07:00 | Add subscription parameter `model`.
Subscription does not return frozen balance of sub-account anymore. | 2018.07.10 11:00 | In `/market/history/kline` the `size` parameter value range changes from [1-1000] to [1-2000]. | 2018.07.06 16:00 | In `/v1/order/orders/place` add `buy-limit-maker` and `sell-limit-maker` order types.
Add new endpoint: `/v1/order/openOrders`.
Add new endpint: `/v1/order/orders/batchCancelOpenOrders` @@ -1366,8 +1367,8 @@ curl "https://api.huobi.pro/v1/order/openOrders?account-id=100009&symbol=btcusdt Parameter | Data Type | Required | Default | Description | Value Range --------- | --------- | -------- | ------- | ----------- | ----------- -account-id | string | false | NA | The account id used for this trade | NA -symbol | string | false | NA | The trading symbol to trade | All supported trading symbols, e.g. btcusdt, bccbtc +account-id | string | true | NA | The account id used for this trade | NA +symbol | string | true | NA | The trading symbol to trade | All supported trading symbols, e.g. btcusdt, bccbtc side | string | false | NA | Filter on the direction of the trade | buy, sell size | int | false | 10 | The number of orders to return | [1, 2000] @@ -1507,7 +1508,7 @@ curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/order Parameter | Data Type | Required | Default | Description | Value Range --------- | --------- | -------- | ------- | ----------- | ----------- -account-id | string | false | NA | The account id used for this cancel | NA +account-id | string | true | NA | The account id used for this cancel | NA symbol | string | false | NA | The trading symbol to cancel | All supported trading symbols, e.g. btcusdt, bccbtc side | string | false | NA | Filter on the direction of the trade | buy, sell size | int | false | 100 | The number of orders to cancel | [1, 100] From eb2c9c29cdaa51d867fffcedd3b58191175cd8a0 Mon Sep 17 00:00:00 2001 From: "Rain@Huobi" Date: Wed, 17 Apr 2019 20:49:31 +0800 Subject: [PATCH 030/759] Update index.html.md --- source/index.html.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index bc958fc467e..dbe690353d0 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -78,6 +78,7 @@ When sub users tries to access the other APIs not on this list, the system will | Live Date Time (UTC+8) | Change Detail | |----- | ----- | +| 2019.04.17 20:30| Add clarification on the value range for start-date for GET /v1/order/orders | 2019.04.16 10:00 | Correct the error. Both account-id and symbol are required for GET /v1/order/openOrders | 2019.01.17 07:00 | Add subscription parameter `model`.
Subscription does not return frozen balance of sub-account anymore. | 2018.07.10 11:00 | In `/market/history/kline` the `size` parameter value range changes from [1-1000] to [1-2000]. @@ -1669,11 +1670,11 @@ Parameter | Data Type | Required | Default | Description symbol | string | true | NA | The trading symbol to trade | All supported trading symbols, e.g. btcusdt, bccbtc types | string | false | NA | The types of order to include in the search | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc states | string | false | NA | The states of order to include in the search | submitted, partial-filled, partial-canceled, filled, canceled -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd | NA -end-date | string | false | today | Search ends date, in format yyyy-mm-dd | NA +start-date | string | false | -180d | Search starts date, in format yyyy-mm-dd | [-180d, end-date] +end-date | string | false | today | Search ends date, in format yyyy-mm-dd | [start-date, today] from | string | false | NA | Search order id to begin with | NA direct | string | false | both | Search direction when 'from' is used | next, prev -size | int | false | 100 | The number of orders to return | [1, 100] +size | int | false | 1000 | The number of orders to return | [1, 1000] > The above command returns JSON structured like this: From 8fc9cac4041e44dec84d55e1d46105ad6692912f Mon Sep 17 00:00:00 2001 From: "Rain@Huobi" Date: Wed, 17 Apr 2019 20:54:28 +0800 Subject: [PATCH 031/759] Update index.html.md --- source/index.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index dbe690353d0..524718ff038 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1674,7 +1674,7 @@ start-date | string | false | -180d | Search starts date, in format yyy end-date | string | false | today | Search ends date, in format yyyy-mm-dd | [start-date, today] from | string | false | NA | Search order id to begin with | NA direct | string | false | both | Search direction when 'from' is used | next, prev -size | int | false | 1000 | The number of orders to return | [1, 1000] +size | int | false | 100 | The number of orders to return | [1, 1000] > The above command returns JSON structured like this: From fcc8ebdba1adb9f73842a537c3638f0022628ce6 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 29 Apr 2019 19:43:12 +0800 Subject: [PATCH 032/759] Update index.html.md --- source/index.html.md | 77 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 524718ff038..fd3dbd8a276 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -78,6 +78,7 @@ When sub users tries to access the other APIs not on this list, the system will | Live Date Time (UTC+8) | Change Detail | |----- | ----- | +| 2019.04.29 20:30| Add new interface for historical order querying within 48 hours | 2019.04.17 20:30| Add clarification on the value range for start-date for GET /v1/order/orders | 2019.04.16 10:00 | Correct the error. Both account-id and symbol are required for GET /v1/order/openOrders | 2019.01.17 07:00 | Add subscription parameter `model`.
Subscription does not return frozen balance of sub-account anymore. @@ -1724,6 +1725,82 @@ state | string | submitted, partical-filled, cancelling exchange | string | Internal data batch | string | Internal data +## Search Historical Orders within 48 Hours + +This endpoint returns orders based on a specific searching criteria. + +### HTTP Request + +`GET https://api.huobi.pro/v1/order/history` + +```json +{ + "symbol": "btcusdt", + "start-time": "1556417645419", + "end-time": "1556533539282", + "direct": "prev", + "size": "10" +} +``` + +### Request Parameters + +Parameter | Required | Data Type | Description | Default Value | Value Range +--------- | --------- | -------- | ------- | ----------- | ---------- +symbol | false | string | The trading symbol to trade |all |All supported trading symbols, e.g. btcusdt, bccbtc | +start-time | false | long | Start time (included) |The time 48 hours ago |UTC time in millisecond | +end-time | false | long | End time (included) | The query time |UTC time in millisecond | +direct | false | string | Direction of the query. (Note: +If the total number of items in the search result is within the limitation defined in “size”, this field does not take effect.) +| next |prev, next | +size | false | int | Number of items in each response |100 | [10,1000] | + +> The above command returns JSON structured like this: + +```json +{ + "status": "ok", + "data": [ + { + "id": 31215214553, + "symbol": "btcusdt", + "account-id": 4717043, + "amount": "1.000000000000000000", + "price": "1.000000000000000000", + "created-at": 1556533539282, + "type": "buy-limit", + "field-amount": "0.0", + "field-cash-amount": "0.0", + "field-fees": "0.0", + "finished-at": 1556533568953, + "source": "web", + "state": "canceled", + "canceled-at": 1556533568911 + } + ] +} +``` + +### Response Content + +| Field | Required | Data Type | Description | default Value | +| --------- |--------- | --------- | ----------- +| {account-id | true | long | Account ID | | +| amount | true | string | Order size| | +| canceled-at | false | long | Order cancellation time | | +| created-at | true | long | Order creation time| | +| field-amount | true | string | Executed order amount | | +| field-cash-amount | true | string | Executed cash amount | | +| field-fees | true | string | Transaction fee | | +| finished-at | false | long | Last trade time | | +| id | true | long | Order ID | | +| price | true | string | Order price | | +| source | true | string | Order source | api | +| state | true | string | Order status | filled, partial-canceled, canceled | +| symbol | true | string | Trading symbol | btcusdt, ethbtc, rcneth ... | +| type} | true | string | Order type | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker | +| next-time | false | long | Next query “start-time” (in response of “direct” = prev), Next query “end-time” (in response of “direct” = next). Note: Only when the total number of items in the search result exceeded the limitation defined in “size”, this field exists.| UTC time in millisecond | + ## Search Match Results This endpoint returns the match results of past and open orders based on specific search criteria. From 8a95b1f0bdb65426fd10f2e61fb122e309adb9da Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 29 Apr 2019 19:46:11 +0800 Subject: [PATCH 033/759] Update index.html.md --- source/index.html.md | 1 + 1 file changed, 1 insertion(+) diff --git a/source/index.html.md b/source/index.html.md index fd3dbd8a276..ffa17d93846 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -67,6 +67,7 @@ Request Mehtod | Description [GET /v1/order/orders/{order-id}](https://huobiapi.github.io/docs/v1/en/#get-the-order-detail-of-an-order) |Get the details of an order| [GET /v1/order/orders/{order-id}/matchresults](https://huobiapi.github.io/docs/v1/en/#get-the-match-result-of-an-order) |Get detail match results of an order | [GET /v1/order/orders](https://huobiapi.github.io/docs/v1/en/#search-past-orders) | Search for a group of orders, which meet certain criteria (up to 100) | +[GET /v1/order/history](https://huobiapi.github.io/docs/v1/en/#search-historical-orders) | Search for historical orders within 48 hours, which meet certain criteria| [GET /v1/order/matchresults](https://huobiapi.github.io/docs/v1/en/#search-match-results) | Search for the trade records of an account| [GET /v1/order/openOrders](https://huobiapi.github.io/docs/v1/en/#get-all-open-orders) | Get the open orders of an account (up to 500)| From cda814d9ac1315be6612f6db7773400748563a4f Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 29 Apr 2019 19:47:39 +0800 Subject: [PATCH 034/759] Update index.html.md --- source/index.html.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index ffa17d93846..b197098e0e1 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1784,23 +1784,23 @@ size | false | int | Number of items in each response |100 | [10,1000 ### Response Content -| Field | Required | Data Type | Description | default Value | -| --------- |--------- | --------- | ----------- -| {account-id | true | long | Account ID | | -| amount | true | string | Order size| | -| canceled-at | false | long | Order cancellation time | | -| created-at | true | long | Order creation time| | -| field-amount | true | string | Executed order amount | | -| field-cash-amount | true | string | Executed cash amount | | -| field-fees | true | string | Transaction fee | | -| finished-at | false | long | Last trade time | | -| id | true | long | Order ID | | -| price | true | string | Order price | | -| source | true | string | Order source | api | -| state | true | string | Order status | filled, partial-canceled, canceled | -| symbol | true | string | Trading symbol | btcusdt, ethbtc, rcneth ... | -| type} | true | string | Order type | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker | -| next-time | false | long | Next query “start-time” (in response of “direct” = prev), Next query “end-time” (in response of “direct” = next). Note: Only when the total number of items in the search result exceeded the limitation defined in “size”, this field exists.| UTC time in millisecond | +Field | Required | Data Type | Description | default Value | +--------- |--------- | --------- | ----------- +{account-id | true | long | Account ID | | +amount | true | string | Order size| | +canceled-at | false | long | Order cancellation time | | +created-at | true | long | Order creation time| | +field-amount | true | string | Executed order amount | | +field-cash-amount | true | string | Executed cash amount | | +field-fees | true | string | Transaction fee | | +finished-at | false | long | Last trade time | | +id | true | long | Order ID | | +price | true | string | Order price | | +source | true | string | Order source | api | +state | true | string | Order status | filled, partial-canceled, canceled | +symbol | true | string | Trading symbol | btcusdt, ethbtc, rcneth ... | +type} | true | string | Order type | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker | +next-time | false | long | Next query “start-time” (in response of “direct” = prev), Next query “end-time” (in response of “direct” = next). Note: Only when the total number of items in the search result exceeded the limitation defined in “size”, this field exists.| UTC time in millisecond | ## Search Match Results From e4448d9c640e372e56e2cd9e75cc190001ec0609 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 29 Apr 2019 19:55:31 +0800 Subject: [PATCH 035/759] Update index.html.md --- source/index.html.md | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index b197098e0e1..4f34758e296 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1784,23 +1784,24 @@ size | false | int | Number of items in each response |100 | [10,1000 ### Response Content -Field | Required | Data Type | Description | default Value | ---------- |--------- | --------- | ----------- -{account-id | true | long | Account ID | | -amount | true | string | Order size| | -canceled-at | false | long | Order cancellation time | | -created-at | true | long | Order creation time| | -field-amount | true | string | Executed order amount | | -field-cash-amount | true | string | Executed cash amount | | -field-fees | true | string | Transaction fee | | -finished-at | false | long | Last trade time | | -id | true | long | Order ID | | -price | true | string | Order price | | -source | true | string | Order source | api | -state | true | string | Order status | filled, partial-canceled, canceled | -symbol | true | string | Trading symbol | btcusdt, ethbtc, rcneth ... | -type} | true | string | Order type | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker | -next-time | false | long | Next query “start-time” (in response of “direct” = prev), Next query “end-time” (in response of “direct” = next). Note: Only when the total number of items in the search result exceeded the limitation defined in “size”, this field exists.| UTC time in millisecond | +Field | Data Type | Description +--------- | --------- | ----------- + +{account-id | long | Account ID +amount | string | Order size +canceled-at | long | Order cancellation time +created-at | long | Order creation time +field-amount | string | Executed order amount +field-cash-amount | string | Executed cash amount +field-fees | string | Transaction fee +finished-at | long | Last trade time +id | long | Order ID +price | string | Order price +source | string | Order source +state | string | Order status ( filled, partial-canceled, canceled ) +symbol | string | Trading symbol +type} | string | Order type (buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker) +next-time | long | Next query “start-time” (in response of “direct” = prev), Next query “end-time” (in response of “direct” = next). Note: Only when the total number of items in the search result exceeded the limitation defined in “size”, this field exists. UTC time in millisecond ## Search Match Results From 660c725d34ada036f31a0ca802ee39af891b4cdf Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 29 Apr 2019 20:06:07 +0800 Subject: [PATCH 036/759] Update index.html.md --- source/index.html.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 4f34758e296..1790892f816 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1786,22 +1786,22 @@ size | false | int | Number of items in each response |100 | [10,1000 Field | Data Type | Description --------- | --------- | ----------- +{account-id | long | Account ID +amount | string | Order size +canceled-at | long | Order cancellation time +created-at | long | Order creation time +field-amount | string | Executed order amount +field-cash-amount | string | Executed cash amount +field-fees | string | Transaction fee +finished-at | long | Last trade time +id | long | Order ID +price | string | Order price +source | string | Order source +state | string | Order status ( filled, partial-canceled, canceled ) +symbol | string | Trading symbol +type} | string | Order type (buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker) +next-time | long | Next query “start-time” (in response of “direct” = prev), Next query “end-time” (in response of “direct” = next). Note: Only when the total number of items in the search result exceeded the limitation defined in “size”, this field exists. UTC time in millisecond -{account-id | long | Account ID -amount | string | Order size -canceled-at | long | Order cancellation time -created-at | long | Order creation time -field-amount | string | Executed order amount -field-cash-amount | string | Executed cash amount -field-fees | string | Transaction fee -finished-at | long | Last trade time -id | long | Order ID -price | string | Order price -source | string | Order source -state | string | Order status ( filled, partial-canceled, canceled ) -symbol | string | Trading symbol -type} | string | Order type (buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker) -next-time | long | Next query “start-time” (in response of “direct” = prev), Next query “end-time” (in response of “direct” = next). Note: Only when the total number of items in the search result exceeded the limitation defined in “size”, this field exists. UTC time in millisecond ## Search Match Results From f74eaa7132e508ccad5beda319b0bb376bcca292 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 29 Apr 2019 20:09:47 +0800 Subject: [PATCH 037/759] Update index.html.md --- source/index.html.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 1790892f816..1abbb5d8fc1 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -67,7 +67,6 @@ Request Mehtod | Description [GET /v1/order/orders/{order-id}](https://huobiapi.github.io/docs/v1/en/#get-the-order-detail-of-an-order) |Get the details of an order| [GET /v1/order/orders/{order-id}/matchresults](https://huobiapi.github.io/docs/v1/en/#get-the-match-result-of-an-order) |Get detail match results of an order | [GET /v1/order/orders](https://huobiapi.github.io/docs/v1/en/#search-past-orders) | Search for a group of orders, which meet certain criteria (up to 100) | -[GET /v1/order/history](https://huobiapi.github.io/docs/v1/en/#search-historical-orders) | Search for historical orders within 48 hours, which meet certain criteria| [GET /v1/order/matchresults](https://huobiapi.github.io/docs/v1/en/#search-match-results) | Search for the trade records of an account| [GET /v1/order/openOrders](https://huobiapi.github.io/docs/v1/en/#get-all-open-orders) | Get the open orders of an account (up to 500)| @@ -79,7 +78,7 @@ When sub users tries to access the other APIs not on this list, the system will | Live Date Time (UTC+8) | Change Detail | |----- | ----- | -| 2019.04.29 20:30| Add new interface for historical order querying within 48 hours +| 2019.04.29 20:30| Add new interface for historical order querying within | 2019.04.17 20:30| Add clarification on the value range for start-date for GET /v1/order/orders | 2019.04.16 10:00 | Correct the error. Both account-id and symbol are required for GET /v1/order/openOrders | 2019.01.17 07:00 | Add subscription parameter `model`.
Subscription does not return frozen balance of sub-account anymore. @@ -1751,9 +1750,7 @@ Parameter | Required | Data Type | Description | Default Value symbol | false | string | The trading symbol to trade |all |All supported trading symbols, e.g. btcusdt, bccbtc | start-time | false | long | Start time (included) |The time 48 hours ago |UTC time in millisecond | end-time | false | long | End time (included) | The query time |UTC time in millisecond | -direct | false | string | Direction of the query. (Note: -If the total number of items in the search result is within the limitation defined in “size”, this field does not take effect.) -| next |prev, next | +direct | false | string | Direction of the query. (Note: If the total number of items in the search result is within the limitation defined in “size”, this field does not take effect.)| next |prev, next | size | false | int | Number of items in each response |100 | [10,1000] | > The above command returns JSON structured like this: From 51d31cf571a23dd7c3f0d82be75ed498b7bc3769 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 29 Apr 2019 20:13:45 +0800 Subject: [PATCH 038/759] Update index.html.md --- source/index.html.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 1abbb5d8fc1..a690390b936 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -78,7 +78,7 @@ When sub users tries to access the other APIs not on this list, the system will | Live Date Time (UTC+8) | Change Detail | |----- | ----- | -| 2019.04.29 20:30| Add new interface for historical order querying within +| 2019.04.29 20:30| Add new interface for historical order querying within 48 hours (With the launching of this new endpoint, the existing REST endpoint “v1/order/orders” will be kept in service. However, the new endpoint “/v1/order/history” will have better service level than the “/v1/order/orders”, especially when the service loading exceeds the threshold of our system, which means in some extremely cases, “v1/order/orders” would become unavailable, but “/v1/order/history” would be kept alive. Meanwhile, Huobi is planning to have a delegated data service to support users’ demands on long-term history data. Once this new service become available, the “v1/order/orders” will be deprecated. We will keep you informed promptly once the timeline determined.) | 2019.04.17 20:30| Add clarification on the value range for start-date for GET /v1/order/orders | 2019.04.16 10:00 | Correct the error. Both account-id and symbol are required for GET /v1/order/openOrders | 2019.01.17 07:00 | Add subscription parameter `model`.
Subscription does not return frozen balance of sub-account anymore. @@ -1753,6 +1753,8 @@ end-time | false | long | End time (included) | The query time |UTC time in direct | false | string | Direction of the query. (Note: If the total number of items in the search result is within the limitation defined in “size”, this field does not take effect.)| next |prev, next | size | false | int | Number of items in each response |100 | [10,1000] | + + > The above command returns JSON structured like this: ```json From 8e8f83dbc0558cc7fd1605bf0847f14bd81858e0 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 29 Apr 2019 20:15:21 +0800 Subject: [PATCH 039/759] Update index.html.md --- source/index.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index a690390b936..695fa6856db 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -78,7 +78,7 @@ When sub users tries to access the other APIs not on this list, the system will | Live Date Time (UTC+8) | Change Detail | |----- | ----- | -| 2019.04.29 20:30| Add new interface for historical order querying within 48 hours (With the launching of this new endpoint, the existing REST endpoint “v1/order/orders” will be kept in service. However, the new endpoint “/v1/order/history” will have better service level than the “/v1/order/orders”, especially when the service loading exceeds the threshold of our system, which means in some extremely cases, “v1/order/orders” would become unavailable, but “/v1/order/history” would be kept alive. Meanwhile, Huobi is planning to have a delegated data service to support users’ demands on long-term history data. Once this new service become available, the “v1/order/orders” will be deprecated. We will keep you informed promptly once the timeline determined.) +| 2019.04.29 20:30| Add new interface for historical order querying within 48 hours. With the launching of this new endpoint, the existing REST endpoint “v1/order/orders” will be kept in service. However, the new endpoint “/v1/order/history” will have better service level than the “/v1/order/orders”, especially when the service loading exceeds the threshold of our system, which means in some extremely cases, “v1/order/orders” would become unavailable, but “/v1/order/history” would be kept alive. Meanwhile, Huobi is planning to have a delegated data service to support users’ demands on long-term history data. Once this new service become available, the “v1/order/orders” will be deprecated. We will keep you informed promptly once the timeline determined. | 2019.04.17 20:30| Add clarification on the value range for start-date for GET /v1/order/orders | 2019.04.16 10:00 | Correct the error. Both account-id and symbol are required for GET /v1/order/openOrders | 2019.01.17 07:00 | Add subscription parameter `model`.
Subscription does not return frozen balance of sub-account anymore. From d1fe8c2f909ac59f9a977923b36a3d6b7ea3e084 Mon Sep 17 00:00:00 2001 From: Ray Xia Date: Mon, 29 Apr 2019 15:03:56 +0100 Subject: [PATCH 040/759] add websocket documentation --- source/index.html.md | 981 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 970 insertions(+), 11 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 695fa6856db..82b2364dd26 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -95,14 +95,6 @@ When sub users tries to access the other APIs not on this list, the system will **`https://api.huobi.pro`** -**Websocket Market Feed** - -**`wss://api.huobi.pro/ws`** - -**Websocket Asset and Order** - -**`wss://api.huobi.pro/ws/v1`** - @@ -2379,7 +2371,974 @@ fee | decimal | The actual fee amount point_card_amount | decimal | Discount from point card obtain_currency_list | array | For creation this is the amount for ETF created. For redemption this is the list and amount of underlying assets obtained. -# Websocket Subscription +# Websocket Market Data - - Websocket Documentation - +## General + +### Websocket URL + +**Websocket Market Feed** + +**`wss://api.huobi.pro/ws`** + +### Data Format + +All return data of websocket APIs are compressed with GZIP so they need to be unzipped. + +### Heartbeat and Connection + +After connected to Huobi's Websocket server, the server will send heartbeat periodically (currently at 5s interval). The heartbeat message will have an integer in it, e.g. + +> {"ping": 1492420473027} + +When client receives this heartbeat message, it should response with a matching "pong" message which has the same integer in it, e.g. + +> {"pong": 1492420473027} + + + +### Subscribe to Topic + +To receive data you have to send a "sub" message first. + +```json +{ + "sub": "market.btccny.kline.1min", + "id": "id1" +} +``` + +{ + "sub": "topic to sub", + "id": "id generate by client" +} + +After successfully subscribed, you will receied a response to confirm subscription + +```json +{ + "id": "id1", + "status": "ok", + "subbed": "market.btccny.kline.1min", + "ts": 1489474081631 +} +``` + +Then, you will received message when there is update in this topic + +```json +{ + "ch": "market.btccny.kline.1min", + "ts": 1489474082831, + "tick": { + "id": 1489464480, + "amount": 0.0, + "count": 0, + "open": 7962.62, + "close": 7962.62, + "low": 7962.62, + "high": 7962.62, + "vol": 0.0 + } +} +``` + +### Unsubscribe + +To unsubscribe, you need to send below message + +```json +{ + "unsub": "market.btccny.trade.detail", + "id": "id4" +} +``` + +{ + "unsub": "topic to unsub", + "id": "id generate by client" +} + +And you will receive a message to confirm the unsubscribe + +```json +{ + "id": "id4", + "status": "ok", + "unsubbed": "market.btccny.trade.detail", + "ts": 1494326028889 +} +``` + +### Pull Data + +While connected to websocket, you can also use it in pull style by sending message to the server. + +To request pull style data, you send below message + +```json +{ + "req": "market.ethbtc.kline.1min", + "id": "id10" +} +``` + +{ + "req": "topic to req", + "id": "id generate by client" +} + +You will receive a response accordingly and immediately + +```json +{ + "status": "ok", + "rep": "market.btccny.kline.1min", + "tick": [ + { + "amount": 1.6206, + "count": 3, + "id": 1494465840, + "open": 9887.00, + "close": 9885.00, + "low": 9885.00, + "high": 9887.00, + "vol": 16021.632026 + }, + { + "amount": 2.2124, + "count": 6, + "id": 1494465900, + "open": 9885.00, + "close": 9880.00, + "low": 9880.00, + "high": 9885.00, + "vol": 21859.023500 + } + ] +} +``` + +## Market Candlestick + +This topic sends a new candlestick whenever it is available. + +### Topic + +`market.$symbol$.kline.$period$` + +> Subscribe request + +```json +{ + "sub": "market.ethbtc.kline.1min", + "id": "id1" +} +``` + +### Topic Parameter + +Parameter | Data Type | Required | Description | Value Range +--------- | --------- | -------- | ----------- | ----------- +symbol | string | true | The trading symbol to query | All supported trading symbols, e.g. btcusdt, bccbtc +perod | string | true | The period for the candlestick | 1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year + +> Response + +```json +{ + "id": "id1", + "status": "ok", + "subbed": "market.ethbtc.kline.1min", + "ts": 1489474081631 +} +``` + +> Update example + +```json +{ + "ch": "market.ethbtc.kline.1min", + "ts": 1489474082831, + "tick": { + "id": 1489464480, + "amount": 0.0, + "count": 0, + "open": 7962.62, + "close": 7962.62, + "low": 7962.62, + "high": 7962.62, + "vol": 0.0 + } +} +``` + +### Update Content + +Field | Data Type | Description +--------- | --------- | ----------- +id | integer | The UNIX timestamp in seconds as response id +amount | float | The aggregated trading volume in USDT +count | integer | The number of completed trades +open | float | The opening price +close | float | The closing price +low | float | The low price +high | float | The high price +vol | float | The trading volume in base currency + + + +### Pull Request + +Pull request is supported with extra parameters to define the range. + +```json +{ + "req": "market.$symbol.kline.$period", + "id": "id generated by client", + "from": "from time in epoch seconds", + "to": "to time in epoch seconds" +} +``` + +Parameter | Data Type | Required | Default Value | Description | Value Range +--------- | --------- | -------- | ------------- | ----------- | ----------- +from | integer | false | 1501174800(2017-07-28T00:00:00+08:00) | The from time | [1501174800, 2556115200] +to | integer | false | 2556115200(2050-01-01T00:00:00+08:00) | The to time | [1501174800, 2556115200] or ($from, 2556115200] if "from" is set + +## Market Depth + +This topic sends the latest market depth when it is updated. + +### Topic + +`market.$symbol.depth.$type` + +> Subscribe request + +```json +{ + "sub": "market.btcusdt.depth.step0", + "id": "id1" +} +``` + +### Topic Parameter + +Parameter | Data Type | Required | Default Value | Description | Value Range +--------- | --------- | -------- | ------------- | ----------- | ----------- +symbol | string | true | NA | The trading symbol to query | All supported trading symbols, e.g. btcusdt, bccbtc +type | string | true | step0 | Market depth aggregation level, details below | step0, step1, step2, step3, step4, step5 + +**"type" Details** + +Value | Description +--------- | --------- +step0 | No market depth aggregation +step1 | Aggregation level = precision*10 +step2 | Aggregation level = precision*100 +step3 | Aggregation level = precision*1000 +step4 | Aggregation level = precision*10000 +step5 | Aggregation level = precision*100000 + +> Response + +```json +{ + "id": "id1", + "status": "ok", + "subbed": "market.btcusdt.depth.step0", + "ts": 1489474081631 +} +``` + +> Update example + +```json +{ + "ch": "market.btcusdt.depth.step0", + "ts": 1489474082831, + "tick": { + "bids": [ + [9999.3900,0.0098], // [price, amount] + [9992.5947,0.0560] + // more Market Depth data here + ] + "asks": [ + [10010.9800,0.0099] + [10011.3900,2.0000] + //more data here + ] + } +} +``` + +### Update Content + + + +Field | Data Type | Description +--------- | --------- | ----------- +bids | object | The current all bids in format [price, quote volume] +asks | object | The current all asks in format [price, quote volume] + + + +### Pull Request + +Pull request is supported. + +```json +{ + "req": "market.btcusdt.depth.step0", + "id": "id10" +} +``` + +## Trade Detail + +This topic sends the latest completed trade. + +### Topic + +`market.$symbol.trade.detail` + +> Subscribe request + +```json +{ + "sub": "market.btcusdt.trade.detail", + "id": "id1" +} +``` + +### Topic Parameter + +Parameter | Data Type | Required | Default Value | Description | Value Range +--------- | --------- | -------- | ------------- | ----------- | ----------- +symbol | string | true | NA | The trading symbol to query | All supported trading symbols, e.g. btcusdt, bccbtc + +> Response + +```json +{ + "id": "id1", + "status": "ok", + "subbed": "market.btcusdt.trade.detail", + "ts": 1489474081631 +} +``` + +> Update example + +```json +{ + "ch": "market.btcusdt.trade.detail", + "ts": 1489474082831, + "tick": { + "id": 14650745135, + "ts": 1533265950234, + "data": [ + { + "amount": 0.0099, + "ts": 1533265950234, + "id": 146507451359183894799, + "price": 401.74, + "direction": "buy" + } + // more Trade Detail data here + ] + } +} +``` + +### Update Content + +Field | Data Type | Description +--------- | --------- | ----------- +id | integer | The unique trade id of this trade +amount | float | The trading volume in base currency +price | float | The trading price in quote currency +ts | integer | The UNIX timestamp in milliseconds adjusted to Beijing time +direction | string | The direction of the taker trade: 'buy' or 'sell' + +### Pull Request + +Pull request is supported. + +```json +{ + "req": "market.btcusdt.trade.detail", + "id": "id11" +} +``` + +## Market Details + +This topic sends the latest market stats with 24h summary + +### Topic + +`market.$symbol.detail` + +> Subscribe request + +```json +{ + "sub": "market.btcusdt.detail", + "id": "id1" +} +``` + +### Topic Parameter + +Parameter | Data Type | Required | Default Value | Description | Value Range +--------- | --------- | -------- | ------------- | ----------- | ----------- +symbol | string | true | NA | The trading symbol to query | All supported trading symbols, e.g. btcusdt, bccbtc + +> Response + +```json +{ + "id": "id1", + "status": "ok", + "subbed": "market.btcusdt.detail", + "ts": 1489474081631 +} +``` + +> Update example + +```json + "tick": { + "amount": 12224.2922, + "open": 9790.52, + "close": 10195.00, + "high": 10300.00, + "ts": 1494496390000, + "id": 1494496390, + "count": 15195, + "low": 9657.00, + "vol": 121906001.754751 + } +``` + +### Update Content + +Field | Data Type | Description +--------- | --------- | ----------- +id | integer | The UNIX timestamp in seconds as response id +ts | integer | The UNIX timestamp in milliseconds of this tick +amount | float | The aggregated trading volume in USDT in past 24H +count | integer | The number of completed trades in past 24H +open | float | The opening price in past 24H +close | float | The last price +low | float | The low price in past 24H +high | float | The high price in past 24H +vol | float | The trading volume in base currency + +### Pull Request + +Pull request is supported. + +```json +{ + "req": "market.btcusdt.detail", + "id": "id11" +} +``` + +# Websocket Asset and Order + +## General + +### Websocket URL + +**Websocket Asset and Order** + +**`wss://api.huobi.pro/ws/v1`** + +### Data Format + +All return data of websocket APIs are compressed with GZIP so they need to be unzipped. + +### Heartbeat and Connection + +After connected to Huobi's Websocket server, the server will send heartbeat periodically (currently at 5s interval). The heartbeat message will have an integer in it, e.g. + +> {"ping": 1492420473027} + +When client receives this heartbeat message, it should response with a matching "pong" message which has the same integer in it, e.g. + +> {"pong": 1492420473027} + + + +### Subscribe to Topic + +To receive data you have to send a "sub" message first. + +```json +{ + "op": "operation type, 'sub' for subscription, 'unsub' for unsubscription", + "topic": "topic to sub", + "cid": "id generate by client" +} +``` + +After successfully subscribed, you will receied a response to confirm subscription + +```json +{ + "op": "operation type, refer to the operation which triggers this response", + "cid": "id1", + "error-code": 0, // 0 for no error + "topic": "topic to sub if the op is sub", + "ts": 1489474081631 +} +``` + +Then, you will received message when there is update in this topic + +```json +{ + "op": "notify", + "topic": "topic of this notify", + "ts": 1489474082831, + "data": { + // data of specific topic update + } +} +``` + +### Unsubscribe + +To unsubscribe, you need to send below message + +```json +{ + "op": "unsub", + "topic": "accounts", + "cid": "client generated id" +} +``` + +And you will receive a message to confirm the unsubscribe + +```json +{ + "op": "unsub", + "topic": "accounts", + "cid": "id generated by client", + "err-code": 0, + "ts": 1489474081631 +} +``` + +### Pull Data + +After successfully establishing a connection with the WebSocket API. There are 3 topics which are designed particularly for pull style data query. Those are + +* accounts.list +* orders.list +* orders.detail + +The details of how to user those three topic will be explain later in this documents. + +**Rate limt of pull style query** + +The limit is count againt per API key not per connection. When you reached the limit you will receive error with "too many request". + +* accounts.list: once every 25 seconds +* orders.list AND orders.detail: once every 5 seconds + +### Authentication + +Asset and Order topics require authentication. To authenticate yourself, send below message + +```json +{ + "op": "auth", + "AccessKeyId": "e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx", + "SignatureMethod": "HmacSHA256", + "SignatureVersion": "2", + "Timestamp": "2017-05-11T15:19:30", + "Signature": "4F65x5A2bLyMWVQj3Aqp+B4w+ivaA7n5Oi2SuYtCJ9o=", +} +``` + +**The format of Authentication data instruction** + + |filed |type | instruction| + |------------------ |---- | ----------------------------------------------------- + |op |string | required; the type of requested operator is auth + |cid |string | optional; the ID of Client request + |AccessKeyId |string | required; API access key , AccessKey is in APIKEY you applied + |SignatureMethod |string | required; the method of sign, user computes signature basing on the protocol of hash ,the api uses HmacSHA256 + |SignatureVersion |string | required; the version of signature's protocol, the api uses 2 + |Timestamp |string | required; timestamp, the time is you requests (UTC timezone), this value is to avoid that another people intercepts your request. for example :2017-05-11T16:22:06 (UTC timezone)| + |Signature |string |required; signature, the value is computed to make sure that the Authentication is valid and not tampered| + +> **Notice:** +> - Refer to the Authentication[https://huobiapi.github.io/docs/v1/en/#authentication] section to generate the signature +> - The request method in signature's method is `GET` + +## Subscribe to Account Updates + +This topic publishes all balance updates of the current account. + +### Topic + +`accounts` + +> Subscribe request + +```json +{ + "op": "sub", + "cid": "40sG903yz80oDFWr", + "topic": "accounts", + "model": "0" +} +``` + +### Topic Parameter + +Parameter | Data Type | Required | Default Value | Description | Value Range +--------- | --------- | -------- | ------------- | ----------- | ----------- +model | string | false | 0 | Whether to include frozen balance | 1 to include frozen balance, 0 to not + + + +> Response + +```json +{ + "op": "sub", + "cid": "40sG903yz80oDFWr", + "err-code": 0, + "ts": 1489474081631, + "topic": "accounts" +} +``` + +> Update example + +```json +{ + "op": "notify", + "ts": 1522856623232, + "topic": "accounts", + "data": { + "event": "order.place", + "list": [ + { + "account-id": 419013, + "currency": "usdt", + "type": "trade", + "balance": "500009195917.4362872650" + } + ] + } +} + +``` + +### Update Content + +Field | Data Type | Description +--------- | --------- | ----------- +event | string | The event type which triggers this balance updates, including oder.place, order.match, order.refund, order.cancel, order.fee-refund, and other balance transfer event types +account-id| integer | The account id of this individual balance +currency | string | The crypto currency of this balance +type | string | The type of this account, including trade, loan, interest +balance | string | The balance of this account, include frozen balance if "model" was set to 1 in subscription + +## Subscribe to Order Updates + +This topic publishes all order updates of the current account. + +### Topic + +`orders.$symbol` + +> Subscribe request + +```json +{ + "op": "sub", + "cid": "40sG903yz80oDFWr", + "topic": "orders.htusdt", +} +``` + +### Topic Parameter + +Parameter | Data Type | Required | Default Value | Description | Value Range +--------- | --------- | -------- | ------------- | ----------- | ----------- +symbol | string | true | NA | The trading symbol to query | All supported trading symbols, e.g. btcusdt, bccbtc + + + +> Response + +```json +{ + "op": "sub", + "cid": "40sG903yz80oDFWr", + "err-code": 0, + "ts": 1489474081631, + "topic": "orders.htusdt" +} +``` + +> Update example + +```json +{ + "op": "notify", + "topic": "orders.htusdt", + "ts": 1522856623232, + "data": { + "seq-id": 94984, + "order-id": 2039498445, + "symbol": "htusdt", + "account-id": 100077, + "order-amount": "5000.000000000000000000", + "order-price": "1.662100000000000000", + "created-at": 1522858623622, + "order-type": "buy-limit", + "order-source": "api", + "order-state": "filled", + "role": "taker|maker", + "price": "1.662100000000000000", + "filled-amount": "5000.000000000000000000", + "unfilled-amount": "0.000000000000000000", + "filled-cash-amount": "8301.357280000000000000", + "filled-fees": "8.000000000000000000" + } +} +``` + +### Update Content + +Field | Data Type | Description +--------- | --------- | ----------- +seq-id | integer | Internal id +order-id | integer | Order id +symbol | string | The symbol of this order +account-id | string | The account id which this order belongs to +order-amount | string | The amount of base currency in this order +order-price | string | The limit price of limit order +created-at | int | The timestamp in milliseconds when the order was created +order-type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker +order-source | string | The source where the order was triggered, possible values: sys, web, api, app +order-state | string | Order state: submitted, partical-filled, cancelling, filled, canceled +role | string | The role in the trade: taker or maker +price | string | The fill price +filled-amount | string | The amount which has been filled +filled-cash-amount | string | The filled total in quote currency +filled-fees | string | Transaction fee paid so far +unfilled-amount | string | The amount left to be filled in this order + +## Request Account Details + +Query all account data of the current user. + +### Query Topic + +`accounts.list` + +> Query request + +```json +{ + "op": "req", + "cid": "40sG903yz80oDFWr", + "topic": "accounts.list", +} +``` + +### Response + +> Successful + +```json + { + "op": "req", + "topic": "accounts.list", + "cid": "40sG903yz80oDFWr" + "err-code": 0, + "ts": 1489474082831, + "data": [ + { + "id": 419013, + "type": "spot", + "state": "working", + "list": [ + { + "currency": "usdt", + "type": "trade", + "balance": "500009195917.4362872650" + }, + { + "currency": "usdt", + "type": "frozen", + "balance": "9786.6783000000" + } + ] + }, + { + "id": 35535, + "type": "point", + "state": "working", + "list": [ + { + "currency": "eth", + "type": "trade", + "balance": "499999894616.1302471000" + }, + { + "currency": "eth", + "type": "frozen", + "balance": "9786.6783000000" + } + ] + } + ] + } +``` + +> Failed + +```json + { + "op": "req", + "topic": "foo.bar", + "cid": "40sG903yz80oDFWr", + "err-code": 12001, //Response codes,0 represent success;others value is error,the list of Response codes is in appendix + "err-msg": "detail of error message", + "ts": 1489474081631 + } +``` + +## Search Past Orders + +Search past and open orders based on searching criteria. + +### Query Topic + +`order.list` + +> Query request + +```json +{ + "op": "req", + "topic": "orders.list", + "cid": "40sG903yz80oDFWr", + "symbol": "htusdt", + "states": "submitted,partial-filled" +} +``` + +### Request Parameters + +Parameter | Data Type | Required | Default | Description | Value Range +--------- | --------- | -------- | ------- | ----------- | ---------- +account-id | int | true | NA | The trading account id | NA +symbol | string | true | NA | The trading symbol to trade | All supported trading symbols, e.g. btcusdt, bccbtc +types | string | false | NA | The types of order to include in the search | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc +states | string | false | NA | The states of order to include in the search | submitted, partial-filled, partial-canceled, filled, canceled +start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd | NA +end-date | string | false | today | Search ends date, in format yyyy-mm-dd | NA +from | string | false | NA | Search order id to begin with | NA +direct | string | false | both | Search direction when 'from' is used | next, prev +size | int | false | 100 | The number of orders to return | [1, 100] + +### Response + +> Successful + +```json +{ + "op": "req", + "topic": "orders.list", + "cid": "40sG903yz80oDFWr", + "err-code": 0, + "ts": 1522856623232, + "data": [ + { + "id": 2039498445, + "symbol": "htusdt", + "account-id": 100077, + "amount": "5000.000000000000000000", + "price": "1.662100000000000000", + "created-at": 1522858623622, + "type": "buy-limit", + "filled-amount": "5000.000000000000000000", + "filled-cash-amount": "8301.357280000000000000", + "filled-fees": "8.000000000000000000", + "finished-at": 1522858624796, + "source": "api", + "state": "filled", + "canceled-at": 0 + } + ] +} +``` + +## Query Order by Order ID + +Get order details by a given order ID. + +### Query Topic + +`order.detail` + +> Query request + +```json +{ + "op": "req", + "topic": "orders.detail", + "order-id": "2039498445", + "cid": "40sG903yz80oDFWr" +} +``` + +### Request Parameters + +Parameter | Data Type | Required | Default | Description | Value Range +--------- | --------- | -------- | ------- | ----------- | ---------- +order-id | string | true | NA | The trading order id | NA + +### Response + +> Successful + +```json +{ + "op": "req", + "topic": "orders.detail", + "cid": "40sG903yz80oDFWr" + "err-code": 0, + "ts": 1522856623232, + "data": { + "id": 2039498445, + "symbol": "htusdt", + "account-id": 100077, + "amount": "5000.000000000000000000", + "price": "1.662100000000000000", + "created-at": 1522858623622, + "type": "buy-limit", + "filled-amount": "5000.000000000000000000", + "filled-cash-amount": "8301.357280000000000000", + "filled-fees": "8.000000000000000000", + "finished-at": 1522858624796, + "source": "api", + "state": "filled", + "canceled-at": 0 + } +} +``` \ No newline at end of file From a2db2b1f5bbffeab62fc55b32f03f99c87c4b064 Mon Sep 17 00:00:00 2001 From: Ray Xia Date: Mon, 29 Apr 2019 15:09:45 +0100 Subject: [PATCH 041/759] fix a few format issue --- source/index.html.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 82b2364dd26..9f16c564cd5 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2663,9 +2663,9 @@ step5 | Aggregation level = precision*100000 [9999.3900,0.0098], // [price, amount] [9992.5947,0.0560] // more Market Depth data here - ] + ], "asks": [ - [10010.9800,0.0099] + [10010.9800,0.0099], [10011.3900,2.0000] //more data here ] @@ -3167,7 +3167,7 @@ Query all account data of the current user. { "op": "req", "topic": "accounts.list", - "cid": "40sG903yz80oDFWr" + "cid": "40sG903yz80oDFWr", "err-code": 0, "ts": 1489474082831, "data": [ @@ -3321,7 +3321,7 @@ order-id | string | true | NA | The trading order id | NA { "op": "req", "topic": "orders.detail", - "cid": "40sG903yz80oDFWr" + "cid": "40sG903yz80oDFWr", "err-code": 0, "ts": 1522856623232, "data": { From 8184a3f9a297900802cd73d57a2254ba664adb34 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 9 May 2019 10:20:49 +0800 Subject: [PATCH 042/759] Update index.html.md --- source/index.html.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 9f16c564cd5..625effc54ef 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2395,7 +2395,7 @@ When client receives this heartbeat message, it should response with a matching > {"pong": 1492420473027} - + ### Subscribe to Topic @@ -3341,4 +3341,4 @@ order-id | string | true | NA | The trading order id | NA "canceled-at": 0 } } -``` \ No newline at end of file +``` From 4463a346d14db64734debc17a2823fcad25c41ea Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 9 May 2019 10:29:55 +0800 Subject: [PATCH 043/759] Update index.html.md --- source/index.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 625effc54ef..0d2f3a9388d 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2413,7 +2413,7 @@ To receive data you have to send a "sub" message first. "id": "id generate by client" } -After successfully subscribed, you will receied a response to confirm subscription +After successfully subscribed, you will receive a response to confirm subscription ```json { From 049729c0acc8a8ef1cdaa7e99d236544df348853 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 9 May 2019 10:56:33 +0800 Subject: [PATCH 044/759] Update index.html.md --- source/index.html.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 0d2f3a9388d..2c219fd3408 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2540,8 +2540,8 @@ This topic sends a new candlestick whenever it is available. Parameter | Data Type | Required | Description | Value Range --------- | --------- | -------- | ----------- | ----------- -symbol | string | true | The trading symbol to query | All supported trading symbols, e.g. btcusdt, bccbtc -perod | string | true | The period for the candlestick | 1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year +symbol | string | true | Trading symbol | All supported trading symbols, e.g. btcusdt, bccbtc +period | string | true | Candlestick interval | 1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year > Response From 670d69a10a9ac9cdc4e812cc1956ecd33d7a9525 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 9 May 2019 11:47:55 +0800 Subject: [PATCH 045/759] Update index.html.md --- source/index.html.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 2c219fd3408..9406b412041 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2577,14 +2577,14 @@ period | string | true | Candlestick interval | 1min, 5min, 15min, Field | Data Type | Description --------- | --------- | ----------- -id | integer | The UNIX timestamp in seconds as response id -amount | float | The aggregated trading volume in USDT -count | integer | The number of completed trades -open | float | The opening price -close | float | The closing price -low | float | The low price -high | float | The high price -vol | float | The trading volume in base currency +id | integer | UNIX timestamp in seconds as response id +amount | float | Aggregated trading volume in base currency +count | integer | Number of trades +open | float | Opening price +close | float | Closing price +low | float | Low price +high | float | High price +vol | float | Aggregated trading value in quote currency @@ -2603,8 +2603,8 @@ Pull request is supported with extra parameters to define the range. Parameter | Data Type | Required | Default Value | Description | Value Range --------- | --------- | -------- | ------------- | ----------- | ----------- -from | integer | false | 1501174800(2017-07-28T00:00:00+08:00) | The from time | [1501174800, 2556115200] -to | integer | false | 2556115200(2050-01-01T00:00:00+08:00) | The to time | [1501174800, 2556115200] or ($from, 2556115200] if "from" is set +from | integer | false | 1501174800(2017-07-28T00:00:00+08:00) | "From" time (epoch time in second) | [1501174800, 2556115200] +to | integer | false | 2556115200(2050-01-01T00:00:00+08:00) | "To" time (epoch time in second) | [1501174800, 2556115200] or ($from, 2556115200] if "from" is set ## Market Depth From 1903b1d4438ad553338944158a4b0a79712fdd1c Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 9 May 2019 15:54:08 +0800 Subject: [PATCH 046/759] Update index.html.md --- source/index.html.md | 50 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 9406b412041..637d86f8a25 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2577,14 +2577,14 @@ period | string | true | Candlestick interval | 1min, 5min, 15min, Field | Data Type | Description --------- | --------- | ----------- -id | integer | UNIX timestamp in seconds as response id -amount | float | Aggregated trading volume in base currency -count | integer | Number of trades -open | float | Opening price -close | float | Closing price -low | float | Low price -high | float | High price -vol | float | Aggregated trading value in quote currency +id | integer | UNIX epoch timestamp in second as response id +amount | float | Aggregated trading volume during the interval (in base currency) +count | integer | Number of trades during the interval +open | float | Opening price during the interval +close | float | Closing price during the interval +low | float | Low price during the interval +high | float | High price during the interval +vol | float | Aggregated trading value during the interval (in quote currency) @@ -2627,7 +2627,7 @@ This topic sends the latest market depth when it is updated. Parameter | Data Type | Required | Default Value | Description | Value Range --------- | --------- | -------- | ------------- | ----------- | ----------- -symbol | string | true | NA | The trading symbol to query | All supported trading symbols, e.g. btcusdt, bccbtc +symbol | string | true | NA | Trading symbol | All supported trading symbols, e.g. btcusdt, bccbtc type | string | true | step0 | Market depth aggregation level, details below | step0, step1, step2, step3, step4, step5 **"type" Details** @@ -2716,7 +2716,7 @@ This topic sends the latest completed trade. Parameter | Data Type | Required | Default Value | Description | Value Range --------- | --------- | -------- | ------------- | ----------- | ----------- -symbol | string | true | NA | The trading symbol to query | All supported trading symbols, e.g. btcusdt, bccbtc +symbol | string | true | NA | Trading symbol | All supported trading symbols, e.g. btcusdt, bccbtc > Response @@ -2756,11 +2756,11 @@ symbol | string | true | NA | The trading symbol to Field | Data Type | Description --------- | --------- | ----------- -id | integer | The unique trade id of this trade -amount | float | The trading volume in base currency -price | float | The trading price in quote currency -ts | integer | The UNIX timestamp in milliseconds adjusted to Beijing time -direction | string | The direction of the taker trade: 'buy' or 'sell' +id | integer | Unique trade id +amount | float | Last trade volume +price | float | Last trade price +ts | integer | Last trade time (UNIX epoch time in millisecond) +direction | string | Aggressive order side (taker's order side) of the trade: 'buy' or 'sell' ### Pull Request @@ -2794,7 +2794,7 @@ This topic sends the latest market stats with 24h summary Parameter | Data Type | Required | Default Value | Description | Value Range --------- | --------- | -------- | ------------- | ----------- | ----------- -symbol | string | true | NA | The trading symbol to query | All supported trading symbols, e.g. btcusdt, bccbtc +symbol | string | true | NA | Trading symbol | All supported trading symbols, e.g. btcusdt, bccbtc > Response @@ -2827,15 +2827,15 @@ symbol | string | true | NA | The trading symbol to Field | Data Type | Description --------- | --------- | ----------- -id | integer | The UNIX timestamp in seconds as response id -ts | integer | The UNIX timestamp in milliseconds of this tick -amount | float | The aggregated trading volume in USDT in past 24H -count | integer | The number of completed trades in past 24H -open | float | The opening price in past 24H -close | float | The last price -low | float | The low price in past 24H -high | float | The high price in past 24H -vol | float | The trading volume in base currency +id | integer | UNIX epoch timestamp in second as response id +ts | integer | UNIX epoch timestamp in millisecond of this tick +amount | float | Aggregated trading volume in past 24H (in base currency) +count | integer | Number of trades in past 24H +open | float | Opening price in past 24H +close | float | Last price +low | float | Low price in past 24H +high | float | High price in past 24H +vol | float | Aggregated trading value in past 24H (in quote currency) ### Pull Request From e30d8038104341cef57c3ca6adf06e6b259e2842 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 9 May 2019 16:28:05 +0800 Subject: [PATCH 047/759] Update index.html.md --- source/index.html.md | 50 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 637d86f8a25..79a0e529c77 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3076,7 +3076,7 @@ This topic publishes all order updates of the current account. Parameter | Data Type | Required | Default Value | Description | Value Range --------- | --------- | -------- | ------------- | ----------- | ----------- -symbol | string | true | NA | The trading symbol to query | All supported trading symbols, e.g. btcusdt, bccbtc +symbol | string | true | NA | Trading symbol | All supported trading symbols, e.g. btcusdt, bccbtc @@ -3124,22 +3124,22 @@ symbol | string | true | NA | The trading symbol to Field | Data Type | Description --------- | --------- | ----------- -seq-id | integer | Internal id +seq-id | integer | Sequence id order-id | integer | Order id -symbol | string | The symbol of this order -account-id | string | The account id which this order belongs to -order-amount | string | The amount of base currency in this order -order-price | string | The limit price of limit order -created-at | int | The timestamp in milliseconds when the order was created -order-type | string | The order type, possible values are: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker -order-source | string | The source where the order was triggered, possible values: sys, web, api, app -order-state | string | Order state: submitted, partical-filled, cancelling, filled, canceled -role | string | The role in the trade: taker or maker -price | string | The fill price -filled-amount | string | The amount which has been filled -filled-cash-amount | string | The filled total in quote currency +symbol | string | Trading symbol +account-id | string | Account id +order-amount | string | Order amount (in base currency) +order-price | string | Order price +created-at | int | Order creation time (UNIX epoch time in millisecond) +order-type | string | Order type, possible values: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker +order-source | string | Order source, possible values: sys, web, api, app +order-state | string | Order state, possible values: submitted, partical-filled, cancelling, filled, canceled, partial-canceled +role | string | Order role in the trade: taker or maker +price | string | Order execution price +filled-amount | string | Order execution quantity (in base currency) +filled-cash-amount | string | Order execution value (in quote currency) filled-fees | string | Transaction fee paid so far -unfilled-amount | string | The amount left to be filled in this order +unfilled-amount | string | Remaining order quantity ## Request Account Details @@ -3246,15 +3246,15 @@ Search past and open orders based on searching criteria. Parameter | Data Type | Required | Default | Description | Value Range --------- | --------- | -------- | ------- | ----------- | ---------- -account-id | int | true | NA | The trading account id | NA -symbol | string | true | NA | The trading symbol to trade | All supported trading symbols, e.g. btcusdt, bccbtc -types | string | false | NA | The types of order to include in the search | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc -states | string | false | NA | The states of order to include in the search | submitted, partial-filled, partial-canceled, filled, canceled -start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd | NA -end-date | string | false | today | Search ends date, in format yyyy-mm-dd | NA -from | string | false | NA | Search order id to begin with | NA -direct | string | false | both | Search direction when 'from' is used | next, prev -size | int | false | 100 | The number of orders to return | [1, 100] +account-id | int | true | NA | Account id | NA +symbol | string | true | NA | Trading symbol | All supported trading symbols, e.g. btcusdt, bccbtc +types | string | false | NA | Order type | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc +states | string | false | NA | Order state | submitted, partial-filled, partial-canceled, filled, canceled +start-date | string | false | -61d | Start date, in format yyyy-mm-dd | NA +end-date | string | false | today | End date, in format yyyy-mm-dd | NA +from | string | false | NA | Order id to begin with | NA +direct | string | false | next | Searching direction when 'from' is given | next, prev +size | int | false | 100 | Number of items in each return | [1, 100] ### Response @@ -3311,7 +3311,7 @@ Get order details by a given order ID. Parameter | Data Type | Required | Default | Description | Value Range --------- | --------- | -------- | ------- | ----------- | ---------- -order-id | string | true | NA | The trading order id | NA +order-id | string | true | NA | Order id | NA ### Response From 21dc817f51ae63410677d1cac25cd7750d2a7cd8 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 9 May 2019 17:29:53 +0800 Subject: [PATCH 048/759] Update index.html.md --- source/index.html.md | 74 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 79a0e529c77..9b0494d6c30 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3141,6 +3141,80 @@ filled-cash-amount | string | Order execution value (in quote currency) filled-fees | string | Transaction fee paid so far unfilled-amount | string | Remaining order quantity +## Subscribe to Order Updates (NEW) + +This topic publishes all order updates of the current account. By comparing with above subscription topic “orders.$symbol”, the new topic “orders.$symbol.update” should have lower latency but more sequential updates. API users are encouraged to subscribe to this new topic for getting order update ticks, instead of above topic “orders.$symbol”. (The current subscription topic “orders.$symbol” will be still kept in Websocket API service till further notice.) + +### Topic + +`orders.$symbol.update` + +> Subscribe request + +```json +{ + "op": "sub", + "cid": "40sG903yz80oDFWr", + "topic": "orders.htusdt.update" +} +``` + +### Topic Parameter + +Parameter | Data Type | Required | Default Value | Description | Value Range +--------- | --------- | -------- | ------------- | ----------- | ----------- +symbol | string | true | NA | Trading symbol | All supported trading symbols, e.g. btcusdt, bccbtc + + + +> Response + +```json +{ + "op": "sub", + "ts": 1489474081631, + "topic": "orders.htusdt.update", + "err-code": 0, + "cid": "40sG903yz80oDFWr" +} +``` + +> Update example + +```json +{ + "op": "notify", + "ts": 1522856623232, + "topic": "orders.htusdt.update", + "data": { + "unfilled-amount": "0.000000000000000000", + "filled-amount": "5000.000000000000000000", + "price": "1.662100000000000000", + "order-id": 2039498445, + "symbol": "htusdt", + "match-id": 94984, + "filled-cash-amount": "8301.357280000000000000", + "role": "taker|maker", + "order-state": "filled" + } +} +``` + +### Update Content + +Field | Data Type | Description +--------- | --------- | ----------- +match-id | integer | Match id (While order-state = submitted, canceled, partialcanceled,match-id refers to sequence number; While order-state = filled, partial-filled, match-id refers to last match ID.) +order-id | integer | Order id +symbol | string | Trading symbol +order-state | string | Order state, possible values: submitted, partical-filled, cancelling, filled, canceled, partial-canceled +role | string | Order role in the trade: taker or maker (While order-state = submitted, canceled, partialcanceled, a default value “taker” is given to this field; While order-state = filled, partial-filled, role can be either taker or maker.) +price | string | Last price (While order-state = submitted, price refers to order price; While order-state = canceled, partial-canceled, price is zero; While order-state = filled, partial-filled, price reflects the last execution price. (While role = taker, and this taker’s order matching with multiple orders on the opposite side simultaneously, price here refers to average price of the multiple trades.)) +filled-amount | string | Last execution quantity (in base currency) +filled-cash-amount | string | Last execution value (in quote currency) +unfilled-amount | string | Remaining order quantity (While order-state = submitted, unfilled-amount contains the original order size; While order-state = canceled OR partial-canceled, unfilled-amount contains the remaining order quantity; While order-state = filled, if order-type = buymarket, unfilled-amount could possibly contain a minimal value; if order-type <> buy-market, unfilled-amount is zero; While order-state = partial-filled AND role = taker, unfilled-amount is the remaining order quantity; While order-state = partial-filled AND role = maker, unfilled-amount is zero. Huobi will support unfilled amount under this scenario in a later enhancement. Time is to be advised in another notification.) + + ## Request Account Details Query all account data of the current user. From e343aa9459862abe9c8144687b286474bf3275c9 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Wed, 15 May 2019 18:06:19 +0800 Subject: [PATCH 049/759] Update index.html.md --- source/index.html.md | 85 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 695fa6856db..f4ebea1a873 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -69,6 +69,7 @@ Request Mehtod | Description [GET /v1/order/orders](https://huobiapi.github.io/docs/v1/en/#search-past-orders) | Search for a group of orders, which meet certain criteria (up to 100) | [GET /v1/order/matchresults](https://huobiapi.github.io/docs/v1/en/#search-match-results) | Search for the trade records of an account| [GET /v1/order/openOrders](https://huobiapi.github.io/docs/v1/en/#get-all-open-orders) | Get the open orders of an account (up to 500)| +[POST /v1/futures/transfer](https://huobiapi.github.io/docs/v1/en/#fund-transfer-between-spot-and-futures) | Transfer fund between spot account and future contract account of a user.
@@ -150,7 +151,7 @@ under the License. const btn_dm = document.getElementById('btn_dm'); const btn_coin_margined_swap = document.getElementById('btn_coin_margined_swap'); const btn_usdt_swap = document.getElementById('btn_usdt_swap') - const btn_option = document.getElementById('btn_option'); + // const btn_option = document.getElementById('btn_option'); const v1_url = document.getElementById('v1_url'); const url = GetUrlRelativePath(); @@ -161,13 +162,13 @@ under the License. btn_dm.innerHTML = '交割合约'; btn_coin_margined_swap.innerHTML = '币本位永续合约'; btn_usdt_swap.innerHTML = 'USDT本位永续合约'; - btn_option.innerHTML = '期权合约'; + // btn_option.innerHTML = '期权合约'; lang_btn.href = url.replace('cn/', 'en/'); btn_spot.href = btn_spot.href.replace('en/', 'cn/'); btn_dm.href = btn_dm.href.replace('en/', 'cn/'); btn_coin_margined_swap.href = btn_coin_margined_swap.href.replace('en/', 'cn/'); btn_usdt_swap.href = btn_usdt_swap.href.replace('en/', 'cn/'); - btn_option.href = btn_option.href.replace('en/', 'cn/'); + // btn_option.href = btn_option.href.replace('en/', 'cn/'); v1_url.href = '/docs/spot/v1/cn/'; }else{ //如果是英文环境 @@ -177,14 +178,14 @@ under the License. // btn_swap.innerHTML = 'SWAP API'; btn_coin_margined_swap.innerHTML = 'Coin Margined Swap'; btn_usdt_swap.innerHTML = 'USDT Margined Swap'; - btn_option.innerHTML = 'Option'; + // btn_option.innerHTML = 'Option'; lang_btn.href = url.replace('en/', 'cn/'); btn_spot.href = btn_spot.href.replace('cn/', 'en/'); btn_dm.href = btn_dm.href.replace('cn/', 'en/'); // btn_swap.href = btn_swap.href.replace('cn/', 'en/'); btn_coin_margined_swap.href = btn_coin_margined_swap.href.replace('cn/', 'en/'); btn_usdt_swap.href = btn_usdt_swap.href.replace('cn/', 'en/'); - btn_option.href = btn_option.href.replace('cn/', 'en/'); + // btn_option.href = btn_option.href.replace('cn/', 'en/'); v1_url.href = '/docs/spot/v1/en/'; } @@ -193,32 +194,32 @@ under the License. btn_dm.className = 'current'; btn_coin_margined_swap.className = ''; btn_usdt_swap.className = ''; - btn_option.className = ''; - } + // btn_option.className = ''; + } else if(location.href.indexOf('docs/coin_margined_swap/v') > 0){ btn_spot.className = ''; btn_dm.className = ''; - btn_coin_margined_swap.className = 'current'; + btn_coin_margined_swap.className = 'current'; btn_usdt_swap.className = ''; - btn_option.className = ''; + // btn_option.className = ''; } else if(location.href.indexOf('docs/usdt_swap/v') > 0){ - btn_spot.className = ''; + btn_spot.className = ''; btn_dm.className = ''; btn_coin_margined_swap.className = ''; btn_usdt_swap.className = 'current'; - btn_option.className = ''; - } else if(location.href.indexOf('docs/option/v') > 0){ - btn_spot.className = ''; - btn_coin_margined_swap.className = ''; - btn_usdt_swap.className = ''; - btn_dm.className = ''; - btn_option.className = 'current'; + // btn_option.className = ''; + // } else if(location.href.indexOf('docs/option/v') > 0){ + // btn_spot.className = ''; + // btn_coin_margined_swap.className = ''; + // btn_usdt_swap.className = ''; + // btn_dm.className = ''; + // btn_option.className = 'current'; } else { btn_spot.className = 'current'; btn_coin_margined_swap.className = ''; btn_usdt_swap.className = ''; btn_dm.className = ''; - btn_option.className = ''; + // btn_option.className = ''; } lang_btn.style.display = 'block'; function GetUrlRelativePath(){ From 07f15623bcee50486c35aae0219ca6c3b49ada03 Mon Sep 17 00:00:00 2001 From: momocao <43130840+momocao@users.noreply.github.com> Date: Mon, 26 Jul 2021 17:13:07 +0800 Subject: [PATCH 663/759] transaction-types --- source/index.html.md | 587 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 587 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index e18868fdf42..fd68ebf9153 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2195,10 +2195,597 @@ Note 1:
Note 2:
Only when the number of items within the query window (between “start-time” and ”end-time”) exceeded the page limitation (defined by “size”), Huobi server returns “next-id”. Once received “next-id”, API user should –
+ 1) Be aware of that, some items within the query window were not returned due to the page size limitation.
2) In order to get these items from Huobi server, adopt the “next-id” as “from-id” and submit another request, with other request parameters no change.
3) As database record ID, “next-id” and “from-id” are for recurring query purpose and the ID itself does not have any business implication.
+Note 3:
+ +Change type contains a detailed list of account types: + +| transact-types | account types | + +| ------------- | -------- | + +| trade | match-income | 撮合成交收入 | + +| trade | match-payout | 撮合成交支付 | + +| trade | otc-trade | OTC交易资产同步 | + +| trade | point-purchased | 购买点卡 | + +| trade | point-purchased-pay | 购买点卡支付 | + +| trade | member-purchase | 会员购买 | + +| trade | matching-transfer-frozen-to-clearing-v2 | 撮合成交转账冻结子账户到清算子帐户 | + +| trade | matching-transfer-clearing-to-trade-v2 | 撮合成交转账清算子账户到交易子帐户 | + +| trade | otc-options-user-to-principal-clct-v2 | 用户涡轮业务账户到涡轮本金归集账户 | + +| trade | otc-options-income-to-user-v2 | 涡轮收益归集账户到用户涡轮账户 | + +| etf | etf-subscription-apply-transfer | 用户冻结账户转到系统ETF账户 | + +| etf | etf-subscription-apply-cancel | 系统ETF账户转到用户trade账户 | + +| etf | etf-subscription-settle-transfer | 系统ETF账户转到用户trade账户 | + +| etf | etf-subscription-apply-receivable | 系统ETF应付账户转到用户的ETF账户,用于认购申请平账 | + +| etf | etf-subscription-settle-receivable | 用户的ETF账户转到系统ETF应付账户,用于认购结算平账 | + +| etf | etf-subscription-open-position-todo | 系统ETF账户转到建仓的普通账户 | + +| etf | etf-subscription-open-position-done | 建仓的普通账户转到系统ETF账户 | + +| etf | etf-purchase-cancel | 系统ETF账户转到用户trade账户 | + +| etf | etf-purchase-apply-transfer | 用户冻结账户转到系统ETF账户 | + +| etf | etf-purchase-settle-transfer | 系统ETF账户转到用户trade账户 | + +| etf | etf-redemption-cancel | 系统ETF账户转到用户币币账户 | + +| etf | etf-redemption-apply-transfer | 用户冻结账户转到系统ETF账户 | + +| etf | etf-redemption-settle-transfer | 系统ETF账户转到用户币币账户 | + +| transact-fee | matching-transfer-fee-v2 | 撮合成交手续费转账清算子账户到系统子账户 | + +| transact-fee | otc-trade-fee | OTC交易手续费同步 | + +| transact-fee | point-etf-fee-deduction | 抵扣ETF手续费返还币 | + +| transact-fee | otc-charge-in | OTC收费 | + +| transact-fee | otc-charge-out | OTC退费 | + +| transact-fee | etf-subscription-charge-receivable | 用户的ETF账户转到系统ETF应付账户,用于认购手续费平账 | + +| transact-fee | matching-transfer-fee-v3 | 撮合成交手续费转账清算子账户到系统子账户 | + +| fee-deduction | point-fee-deduction-v3 | 抵扣手续费 | + +| fee-deduction | point-fee-deduction-pay-v2 | 抵扣手续费支付 | + +| fee-deduction | point-fee-deduction-pay-v3 | 抵扣手续费支付 | + +| fee-deduction | revert-point-fee-deduction-pay | 抵扣手续费的点卡返还用户 | + +| fee-deduction | point-interest-deduction-pay | 抵扣借贷利息支付点卡 | + +| fee-deduction | point-etf-fee-deduction-pay | 抵扣ETF手续费支付点卡 | + +| fee-deduction | trade-fee-deduction | 抵扣手续费 | + +| fee-deduction | otc-point-pay | OTC点卡支付费用 | + +| fee-deduction | trade-fee-deduction-pay-user-trade-to-match | 抵扣手续费支付-用户交易账户划转到清算账户 | + +| fee-deduction | trade-fee-deduction-user-trade-to-match | 新版抵扣手续费支付-用户交易账户划转到清算账户 | + +| fee-deduction | revert-point-fee-deduction | 抵扣手续费归还系统账户 | + +| fee-deduction | super-margin-interest-deduct-repay | 利息抵扣:用户交易账户转到系统利息账户 | + +| transfer | user-account-transfer-inner-in | 用户内部转账转入 | + +| transfer | user-account-transfer-inner-out | 用户内部转账转出消账 | + +| transfer | mine-account-to-user-account | 矿池账户转用户 | + +| transfer | user-account-to-mine-account | 用户转矿池账户 | + +| transfer | otc-transfer-in | 转账划入OTC | + +| transfer | otc-transfer-in-v2 | 转账划入OTC | + +| transfer | otc-transfer-out | 转账划出OTC | + +| transfer | otc-transfer-out-v2 | 转账划出OTC | + +| transfer | margin-transfer-in | 借贷划转: 现货交易账户转到借贷交易账户 | + +| transfer | margin-transfer-out | 借贷划转: 借贷交易账户转到现货交易账户 | + +| transfer | point-transfer | 点卡转让 | + +| transfer | point-transfer-pay | 点卡转让支付 | + +| transfer | mine-pool-transfer-in | 矿池账户转入 | + +| transfer | mine-pool-transfer-out | 矿池账户转出 | + +| transfer | chat-transfer-in | 转账划入chat | + +| transfer | chat-transfer-in-v2 | 转账划入chat | + +| transfer | chat-transfer-out | 转账划出chat | + +| transfer | chat-transfer-out-v2 | 转账划出chat | + +| transfer | chat-to-otc | chat划转至OTC | + +| transfer | otc-to-chat | OTC划转至chat | + +| transfer | master-transfer-in | 子账户转到母账户 | + +| transfer | master-transfer-out | 母账户转到子账户 | + +| transfer | margin-to-margin | 借贷划转: 逐仓杠杆交易账户转到逐仓杠杆交易账户 | + +| transfer | master-point-transfer-in | 子账户转到母账户,点卡 | + +| transfer | master-point-transfer-out | 母账户转到子账户,点卡 | + +| transfer | sub-transfer | 子子划转 | + +| transfer | sub-point-transfer | 子子点卡划转 | + +| transfer | futures-transfer-in | 转账划入合约账户 | + +| transfer | futures-transfer-in-v2 | 转账划入合约账户V2| + +| transfer | futures-transfer-out | 转账划出合约账户 | + +| transfer | futures-transfer-out-v2 | 转账划出合约账户V2 | + +| transfer | institution-transfer-in | 转账划入机构 | + +| transfer | institution-transfer-in-v2 | 转账划入机构 | + +| transfer | institution-transfer-out | 转账划出机构 | + +| transfer | institution-transfer-out-v2 | 转账划出机构 | + +| transfer | swap-transfer-in | 转账划入合约账户 | + +| transfer | swap-transfer-out | 转账划出合约账户 | + +| transfer | dm-swap-transfer-in | 转账划入反向永续合约账户 | + +| transfer | dm-swap-transfer-out | 转账划出反向永续合约账户 | + +| transfer | option-transfer-in | 转账划入期权账户 | + +| transfer | option-transfer-out | 转账划出期权账户 | + +| transfer | cfd-transfer-in | 转账划入CFD账户 | + +| transfer | cfd-transfer-out | 转账划出CFD账户 | + +| transfer | super-margin-transfer-out | 全仓杠杆交易账户转入 | + +| transfer | super-margin-transfer-in | 全仓杠杆交易账户转出 | + +| transfer | japan-donations-operation-to-system | 运营账户到捐款系统账户 | + +| transfer | japan-donations-system-to-operation | 捐款系统账户到运营账户 | + +| transfer | japan-donations-system-to-user | 日本首里城火灾捐款付款:捐款系统账户 到 普通用户账户 | + +| transfer | japan-donations-user-to-system | 日本首里城火灾捐款收款:普通用户账户 到 捐款系统账户 | + +| transfer | japan-discount-user-to-system | 币币账户 到 折扣抢购系统账户 | + +| transfer | japan-discount-system-to-user | 折扣抢购系统账户 到 币币账户 | + +| transfer | japan-discount-operation-to-system | 运营账户 到 折扣抢购系统账户 | + +| transfer | japan-discount-system-to-operation | 折扣抢购系统账户 到 运营账户 | + +| transfer | directed-card-system-to-operation | 系统定向点卡专项转款账户到运营账户 | + +| transfer | directed-card-operation-to-system | 运营账户到系统定向点卡专项转款账户 | + +| transfer | system-to-user-account | 土耳其兑换系统账户到用户账户 | + +| transfer | user-account-to-system | 用户账户到土耳其兑换系统账户 | + +| transfer | liquidity-account-to-system | 香港流动性运营账户到土耳其兑换系统账户 | + +| transfer | system-to-liquidity-account | 土耳其兑换系统账户到香港流动性运营账户 | + +| transfer | linear-swap-transfer-in | 转账划入正向永续账户 | + +| transfer | linear-swap-transfer-out | 转账划出正向永续账户 | + +| transfer | custody-transfer-in | 转账划入香港站资金账户 | + +| transfer | custody-transfer-out | 转账划出香港站资金账户 | + +| transfer | operation-to-margin-trade | 运营账户到逐仓杠杆账户 | + +| transfer | margin-trade-to-operation | 逐仓杠杆账户到运营账户 | + +| transfer | grid-transfer-in | 网格划转: 现货交易账户转到网格交易账户 | + +| transfer | grid-transfer-out | 网格划转: 网格交易账户转到现货交易账户 | + +| transfer | otc-generic-transfer-in | OTC账户 通用划转划入 | + +| transfer | otc-generic-transfer-out | OTC账户 通用划转转出 | + +| transfer | spot-generic-transfer-in | 币币账户 通用划转划入 | + +| transfer | spot-generic-transfer-out | 币币账户 通用划转转出 | + +| transfer | margin-generic-transfer-in | 逐仓杠杆 通用划转划入 | + +| transfer | margin-generic-transfer-out | 逐仓杠杆 通用划转转出 | + +| transfer | point-generic-transfer-in | 点卡 通用划转划入 | + +| transfer | point-generic-transfer-out | 点卡 通用划转转出 | + +| transfer | minepool-generic-transfer-in | 矿池 通用划转划入 | + +| transfer | minepool-generic-transfer-out | 矿池 通用划转转出 | + +| transfer | super-margin-generic-transfer-in | 全仓杠杆 通用划转划入 | + +| transfer | super-margin-generic-transfer-out | 全仓杠杆 通用划转转出 | + +| transfer | investment-generic-transfer-in | C2C出借账户 通用划转划入 | + +| transfer | investment-generic-transfer-out | C2C出借账户 通用划转转出 | + +| transfer | borrow-generic-transfer-in | C2C借款账户 通用划转划入 | + +| transfer | borrow-generic-transfer-out | C2C借款账户 通用划转转出 | + +| transfer | deposit-earning-generic-transfer-in | Savings理财账户 通用划转划入 | + +| transfer | deposit-earning-generic-transfer-out | Savings理财账户 通用划转转出 | + +| transfer | crypto-loans-generic-transfer-in | 质押借贷 通用划转划入 | + +| transfer | crypto-loans-generic-transfer-out | 质押借贷 通用划转转出 | + +| transfer | grid-trading-generic-transfer-in | 网格交易账户 通用划转划入 | + +| transfer | grid-trading-generic-transfer-out | 网格交易账户 通用划转转出 | + +| transfer | mine-pool-mall-lease-spot-to-settlement-system | 商城算力租赁收款UID划转到商城算力租赁结算系统账户 | + +| transfer | mine-pool-mall-lease-settlement-system-to-spot | 商城算力租赁结算系统账户划转到用户UID币币账户 | + +| transfer | kr-savings-spot-to-clct | 用户币币账户到系统理财归集账户 | + +| transfer | kr-savings-clct-to-transition-spot | 系统理财归集账户到指定财务中转账户(用户账户) | + +| transfer | kr-savings-transition-spot-to-intermediate | 指定财务中转账户(用户账户)到系统理财中间账户 | + +| transfer | kr-savings-return-to-spot | 系统理财归还账户到用户币币账户 | + +| transfer | kr-savings-income-to-spot | 系统理财收益账户到用户币币账户 | + +| transfer | kr-savings-transition-spot-to-clct | 指定财务中转账户(用户账户)到系统理财归集账户 | + +| transfer | jp-coupon-ops-to-sys | 运营账户 到 优惠券系统账户 | + +| transfer | jp-coupon-sys-to-spot | 优惠券系统账户 到 用户币币 | + +| transfer | otc-options-master-transfer-in | 涡轮业务专用:子账户转到母账户 | + +| transfer | otc-options-master-transfer-in-manual | 手工涡轮业务专用:子账户转到母账户 | + +| transfer | otc-options-master-transfer-out | 涡轮业务专用:母账户转到子账户 | + +| transfer | otc-options-master-transfer-out-manual | 手工涡轮业务专用:母账户转到子账户 | + +| transfer | mine-pool-staking-lock | 用户币币转到用户锁仓 | + +| transfer | mine-pool-staking-unlock | 用户锁仓转到用户币币 | + +| transfer | mine-pool-staking-reward-system-to-spot | 系统账户-备付金账户转到用户币币 | + +| transfer | airdrop-user-spot-oneside-in | 空投用户账户入账 | + +| transfer | project-airdrop-user-spot-oneside-in | 项目方空投用户账户入账 | + +| credit | margin-loan-transfer | 申请借贷: 系统现金池转到用户交易账户 | + +| credit | margin-loan-transfer-v2 | 申请借贷: 系统现金池转到用户交易账户 | + +| credit | margin-repay-loan-transfer | 归还借贷本金: 用户交易冻结账户转到系统现金池 | + +| credit | margin-repay-loan-transfer-v2 | 归还借贷本金: 用户交易账户转到系统现金池 | + +| credit | super-margin-loan-transfer | 申请借贷: 系统现金池转到用户交易账户 | + +| credit | super-margin-repay | 还款: 用户交易账户转到系统借贷资金池 | + +| credit | auto-super-margin-repay | 自动还款: 用户交易账户转到系统借贷资金池 | + +| credit | operations-account-recycling-user-trade-principal | 运营账户回收用户交易子账户借款本金转账 | + +| credit | operations-account-to-outside-loan-account | 运营账户->场外借贷用户 | + +| credit | outside-loan-account-to-operations-account | 场外借贷用户->运营账户 | + +| credit | pledged-loan-lending | 质押借贷-借出 | + +| credit | pledged-loan-receiving | 质押借贷-收款 | + +| credit | super-margin-loan-receivable | 申请借贷: 用户应付本金转到系统应收本金 | + +| credit | super-margin-interest-accrued | 借贷计息: 用户应付利息转到系统应收利息 | + +| credit | super-margin-interest-deduct-refund | 利息抵扣: 系统应收利息转到用户应付利息 | + +| credit | super-margin-refund | 还款: 系统应收本金转到用户应付本金 | + +| credit | margin-repay-loan-receivable | 归还借贷本金: 系统应收本金转到用户应付本金 | + +| credit | margin-repay-loan-receivable-v2 | 归还借贷本金: 系统应收本金转到用户应付本金 | + +| credit | otc-options-user-asset-ops-borrow | 财务运营账户到涡轮运营子账户(现货账户)- 借款 | + +| credit | otc-options-user-asset-ops-borrow-debt | 财务运营账户到涡轮运营子账户(涡轮应收本金账户)- 借款 | + +| credit | otc-options-user-asset-ops-repay | 涡轮运营子账户到财务运营账户(现货账户)-还款 | + +| credit | otc-options-user-asset-ops-repay-debt | 涡轮运营子账户到财务运营账户(涡轮应还本金账户)- 还款 | + +| liquidation | margin-auto-repay-interest-transfer | 归还借贷利息: 用户交易账户转到系统实收本金 | + +| liquidation | margin-auto-repay-interest-transfer-v2 | 归还借贷利息: 用户交易账户转到系统实收本金 | + +| liquidation | margin-auto-repay-loan-transfer | 归还借贷本金: 用户交易账户转到系统现金池 | + +| liquidation | margin-auto-repay-loan-transfer-v2 | 归还借贷本金: 用户交易账户转到系统现金池 | + +| interest | margin-repay-interest-transfer | 归还借贷利息: 用户交易冻结账户转到系统实收本金 | + +| interest | margin-repay-interest-transfer-v2 | 归还借贷利息: 用户交易账户转到系统实收本金 | + +| interest | point-interest-deduction | 抵扣借贷利息返还币 | + +| interest | super-margin-interest-repay | 还息:用户交易账户转到系统已收利息 | + +| interest | auto-super-margin-interest-repay | 自动还息:用户交易账户转到系统已收利息 | + +| interest | margin-repay-interest-receivable | 归还借贷利息: 系统应收利息转到用户应付利息 | + +| interest | margin-repay-interest-receivable-v2 | 归还借贷利息: 系统应收利息转到用户应付利息 | + +| interest | margin-interest-accrued | 借贷计息: 用户应付利息转到系统应收利息 | + +| interest | margin-interest-accrued-v2 | 借贷计息: 用户应付利息转到系统应收利息 | + +| deposit | user-account-deposit | 用户账户充值转账 | + +| deposit | user-account-fast-deposit | 用户账户快速充值转账 | + +| deposit | user-credit-loan-to-system | 用户撤销充值,欠费币币账户转账到系统账户 | + +| deposit | user-account-mgt-special-deposit | 用户账户MGT异常充值 | + +| deposit | operations-account-deposit-compensate-expenditure | 充币业务补偿支出 | + +| deposit | operations-account-deposit-compensate-earning | 充币业务补偿收入 | + +| withdraw | user-apply-withdraw | 用户申请提现冻结 | + +| withdraw | user-apply-fiat-withdraw | 用户申请法币Fiat提现冻结 | + +| withdraw | user-account-withdraw | 用户账户提现转账 | + +| withdraw | user-account-fast-withdraw | 用户账户快速提现转账 | + +| withdraw | operations-account-withdraw-compensate-expenditure | 提币业务补偿支出 | + +| withdraw | operations-account-withdraw-compensate-earning | 提币业务补偿收入 | + +| withdraw-fee | system-withdraw-fee-in | 扣用户提现手续费 | + +| withdraw-fee | system-withdraw-fee-out | 返还用户提现手续费 | + +| exchange | stable-currency-transfer-in-v2 | 系统稳定币转给用户 | + +| exchange | stable-currency-transfer-out-v2 | 用户稳定币转给系统 | + +| rebate | negative-maker-sys-oneside-out | 负maker系统账户出账 | + +| rebate | negative-maker-user-oneside-in | 负maker用户账户入账 | + +| etp | etp-purchase-transfer | 申购的USDT: 用户账户转到杠杆代币申购赎回系统账户 | + +| etp | etp-purchase-receivable | 申购的杠杆代币: 杠杆代币申购赎回系统账户-杠杆代币转到用户账户 | + +| etp | etp-purchase-charge | 申购手续费: 用户账户转到杠杆代币收入系统账户 | + +| etp | etp-redemption-transfer | 赎回的杠杆代币: 用户账户转到杠杆代币申购赎回系统账户 | + +| etp | etp-redemption-settle-transfer | 给赎回的USDT: 杠杆代币申购赎回系统账户转到用户账户 | + +| etp | etp-redemption-charge | 赎回手续费: 杠杆代币申购赎回系统账户转到杠杆代币收入系统账户 | + +| etp | etp-management-charge | 划转管理费: 用户账户转到杠杆代币收入系统账户 | + +| etp | etp-cash-concentration | 收入归集: 杠杆代币收入系统账户转到收入归集系统账户 | + +| etp | etp-usdt-hedge-sys-to-user | USDT对冲: 杠杆代币申购赎回系统账户转到用户账户 | + +| etp | etp-usdt-hedge-user-to-sys | USDT对冲: 用户账户转到杠杆代币申购赎回系统账户 | + +| etp | etp-futures-hedge-sys-to-user | 合约对冲: 杠杆代币申购赎回系统账户转到用户账户 | + +| etp | etp-futures-hedge-user-to-sys | 合约对冲: 用户账户转到杠杆代币申购赎回系统账户 | + +| etp | etp-usdt-spot-sys-to-user | 杠杆代币申购赎回系统账户转到用户杠杆代币现货管理账户 | + +| etp | etp-usdt-spot-user-to-sys | 用户杠杆代币现货管理账户转到杠杆代币申购赎回系统账户 | + +| savings | deposit-earning-to-spot | 理财账户转到币币账户 | + +| savings | spot-to-deposit-earning | 币币账户转到理财账户 | + +| savings | deposit-earning-to-collect | 理财账户转到资金归集账户 | + +| savings | collect-to-deposit-earning | 资金归集账户转到理财账户 | + +| savings | operation-to-collect | 运营账户转到资金归集账户 | + +| savings | collect-to-operation | 资金归集账户转到运营账户 | + +| savings | operation-to-interest | 运营账户转到利息支付账户 | + +| savings | interest-to-operation | 利息支付账户转到运营账户 | + +| savings | interest-to-deposit-earning | 利息支付账户转到理财账户 | + +| savings | deposit-earning-to-interest | 理财账户转到利息支付账户 | + +| savings | collect-to-expend | 资金归集账户转到资金支出账户 | + +| savings | expend-to-collect | 资金支出账户转到资金归集账户 | + +| savings | expend-to-operation | 资金支出账户转到运营账户 | + +| savings | operation-to-expend | 运营账户转到资金支出账户 | + +| other-types | operations-account-transfer-in | 运营账户转入转账 | + +| other-types | operations-account-transfer-out | 运营账户转出转账 | + +| other-types | operations-account-user-event-in | 运营账户活动策划转入 | + +| other-types | operations-account-user-event-out | 运营账户活动策划转出 | + +| other-types | operations-account-loan-to-user-trade | 运营账户借款给用户交易子账户转账 | + +| other-types | operations-account-expenditure | 运营账户支出转账 | + +| other-types | inspire-account-to-user-account | 激励账户到用户 | + +| other-types | user-account-to-inspire-account | 用户账户到激励账户 | + +| other-types | activity-account-to-user-account | 活动账户转用户 | + +| other-types | user-account-to-activity-account | 用户转活动账户 | + +| other-types | brokerage-account-to-user-account | 返佣账户转用户 | + +| other-types | user-account-to-brokerage-account | 用户转返佣账户 | + +| other-types | exchange-operation-to-user | 交易所运营账户转到用户trade账户:拨款 | + +| other-types | operations-account-earning | 运营账户收入转账 | + +| other-types | market-account-to-user-account | 市场账户转用户 | + +| other-types | user-account-to-market-account | 用户转市场账户 | + +| other-types | trade-account-to-user-account | 交易账户转用户 | + +| other-types | user-account-to-trade-account | 用户转交易账户 | + +| other-types | backup-account-to-user-account | 备用转用户 | + +| other-types | user-account-to-backup-account | 用户转备用 | + +| other-types | fork-transfer-in | 分叉币转换生成 | + +| other-types | fork-transfer-out | 分叉币转换消耗 | + +| other-types | point-purchased-gift | 购买点卡赠币 | + +| other-types | matching-fee-brokerage | 手续费返佣金 | + +| other-types | matching-fee-brokerage-point | 手续费返佣点卡 | + +| other-types | api-matching-fee-brokerage | 渠道返佣金 | + +| other-types | api-matching-fee-brokerage-point | 渠道返佣点卡 | + +| other-types | matching-fee-cashback | 手续费返现金 | + +| other-types | matching-fee-cashback-point | 手续费返现点卡 | + +| other-types | exchange-fee-to-user | 交易所手续费账户转到邀请人账户 | + +| other-types | otc-adjust-account-in | OTC手动给用户充值 | + +| other-types | otc-adjust-account-out | OTC手动给用户扣款 | + +| other-types | otc-adjust-transfer-in | OTC强制增加用户欠费 | + +| other-types | otc-adjust-transfer-out | OTC强制增加用户资产 | + +| other-types | option-liquidity-borrow | 期权流动性借出 | + +| other-types | option-liquidity-refund | 期权流动性还款 | + +| other-types | option-liquidity-other-borrow | 期权其他借出 | + +| other-types | option-liquidity-other-refund | 期权其他还款 | + +| other-types | linear-swap-liquidity-borrow | 正向永续合约流动性借出 | + +| other-types | linear-swap-liquidity-refund | 正向永续合约流动性还款 | + +| other-types | linear-swap-liquidity-other-borrow | 正向永续合约其他借出 | + +| other-types | linear-swap-liquidity-other-refund | 正向永续合约其他还款 | + +| other-types | otc-options-principal-clct-to-user-asset-ops-v3 | 手工涡轮本金归集账户到涡轮运营母账户 | + +| other-types | otc-options-income-to-user-asset-ops-manual | 手工涡轮收益归集账户到涡轮运营母账户 | + +| other-types | otc-options-user-asset-ops-to-income-manual | 手工涡轮运营母账户到涡轮收益归集账户 | + +| other-types | finance-clear-spot-to-sys-usa-jp | 美/日籍用户清退资产返还收款 | + +| other-types | finance-clear-sys-to-spot-usa-jp | 美/日籍用户清退资产返还借出 | + +| other-types | change-coin-chain-spot-to-sys | 换币换链收入 | + +| other-types | change-coin-chain-sys-to-spot | 换币换链支出 | + +| other-types | huoban-fund-spot-to-sys | 火伴基金收款 | + +| other-types | huoban-fund-sys-to-spot | 火伴基金借出 | + +| other-types | huoban-fund-interest-spot-to-sys | 火伴基金利息收入 | + +| other-types | head-hunting-sys-to-spot | 猎头费支出 | + +| other-types | project-activity-spot-to-sys | 项目方出资活动收入 | + +| other-types | project-activity-sys-to-spot | 项目方出资活动支出 | + +| other-types | operation-to-super-margin-trade | 运营账户转到用户账户-全仓杠杆账户 | + +| other-types | super-margin-trade-to-operation | 用户账户-全仓杠杆账户转到运营账户 | + + + ## Get Account Ledger API Key Permission:Read From b6cb3fc24b41ed5974c0b161112fd102a608cd89 Mon Sep 17 00:00:00 2001 From: momocao <43130840+momocao@users.noreply.github.com> Date: Mon, 26 Jul 2021 17:52:22 +0800 Subject: [PATCH 664/759] depth-400 --- source/index.html.md | 299 +------------------------------------------ 1 file changed, 5 insertions(+), 294 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index fd68ebf9153..49a9a89691f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -30,6 +30,8 @@ table th { | Release Time
(UTC +8) | API | New / Update | Description | | ------------------------ | ---------------------- | --------------- | ------------------------------------- | +| 2021.7.26 | `market.$symbol.mbp.$levels` | Update | Add 400 depth data| +| 2021.7.23 | `GET /v1/account/history` | Update | Detailed in detail the type of change in the account flow interface, that is, "Transact-Types" increases classification, such as Note 3. | | 2021.5.26 | `GET /v1/order/orders/getClientOrder`
`POST /v1/order/orders/place`
`POST/v1/order/orders/submitCancelClientOrder` | Update | For completed orders, clientOrderId will be valid for 2 hours since the order creation (it is still valid for 8 hours concerning other orders).
The uniqueness of the clientOrderId passed in when you place an order will no longer be verified. | | 2021.5.12 | GET `/v2/etp/transactions` | Update | "etpNames" and "transactTypes" are changed to "required" and "Only supports filling in one value" | | 2021.3.1 | `POST /v2/sub-user/deduct-mode` | Add | Set a deduction for master and sub user | @@ -2204,588 +2206,297 @@ Note 3:
Change type contains a detailed list of account types: -| transact-types | account types | - -| ------------- | -------- | - +| Transact Type | Account Type | +| ------------- | -------------------- | | trade | match-income | 撮合成交收入 | - | trade | match-payout | 撮合成交支付 | - | trade | otc-trade | OTC交易资产同步 | - | trade | point-purchased | 购买点卡 | - | trade | point-purchased-pay | 购买点卡支付 | - | trade | member-purchase | 会员购买 | - | trade | matching-transfer-frozen-to-clearing-v2 | 撮合成交转账冻结子账户到清算子帐户 | - | trade | matching-transfer-clearing-to-trade-v2 | 撮合成交转账清算子账户到交易子帐户 | - | trade | otc-options-user-to-principal-clct-v2 | 用户涡轮业务账户到涡轮本金归集账户 | - | trade | otc-options-income-to-user-v2 | 涡轮收益归集账户到用户涡轮账户 | - | etf | etf-subscription-apply-transfer | 用户冻结账户转到系统ETF账户 | - | etf | etf-subscription-apply-cancel | 系统ETF账户转到用户trade账户 | - | etf | etf-subscription-settle-transfer | 系统ETF账户转到用户trade账户 | - | etf | etf-subscription-apply-receivable | 系统ETF应付账户转到用户的ETF账户,用于认购申请平账 | - | etf | etf-subscription-settle-receivable | 用户的ETF账户转到系统ETF应付账户,用于认购结算平账 | - | etf | etf-subscription-open-position-todo | 系统ETF账户转到建仓的普通账户 | - | etf | etf-subscription-open-position-done | 建仓的普通账户转到系统ETF账户 | - | etf | etf-purchase-cancel | 系统ETF账户转到用户trade账户 | - | etf | etf-purchase-apply-transfer | 用户冻结账户转到系统ETF账户 | - | etf | etf-purchase-settle-transfer | 系统ETF账户转到用户trade账户 | - | etf | etf-redemption-cancel | 系统ETF账户转到用户币币账户 | - | etf | etf-redemption-apply-transfer | 用户冻结账户转到系统ETF账户 | - | etf | etf-redemption-settle-transfer | 系统ETF账户转到用户币币账户 | - | transact-fee | matching-transfer-fee-v2 | 撮合成交手续费转账清算子账户到系统子账户 | - | transact-fee | otc-trade-fee | OTC交易手续费同步 | - | transact-fee | point-etf-fee-deduction | 抵扣ETF手续费返还币 | - | transact-fee | otc-charge-in | OTC收费 | - | transact-fee | otc-charge-out | OTC退费 | - | transact-fee | etf-subscription-charge-receivable | 用户的ETF账户转到系统ETF应付账户,用于认购手续费平账 | - | transact-fee | matching-transfer-fee-v3 | 撮合成交手续费转账清算子账户到系统子账户 | - | fee-deduction | point-fee-deduction-v3 | 抵扣手续费 | - | fee-deduction | point-fee-deduction-pay-v2 | 抵扣手续费支付 | - | fee-deduction | point-fee-deduction-pay-v3 | 抵扣手续费支付 | - | fee-deduction | revert-point-fee-deduction-pay | 抵扣手续费的点卡返还用户 | - | fee-deduction | point-interest-deduction-pay | 抵扣借贷利息支付点卡 | - | fee-deduction | point-etf-fee-deduction-pay | 抵扣ETF手续费支付点卡 | - | fee-deduction | trade-fee-deduction | 抵扣手续费 | - | fee-deduction | otc-point-pay | OTC点卡支付费用 | - | fee-deduction | trade-fee-deduction-pay-user-trade-to-match | 抵扣手续费支付-用户交易账户划转到清算账户 | - | fee-deduction | trade-fee-deduction-user-trade-to-match | 新版抵扣手续费支付-用户交易账户划转到清算账户 | - | fee-deduction | revert-point-fee-deduction | 抵扣手续费归还系统账户 | - | fee-deduction | super-margin-interest-deduct-repay | 利息抵扣:用户交易账户转到系统利息账户 | - | transfer | user-account-transfer-inner-in | 用户内部转账转入 | - | transfer | user-account-transfer-inner-out | 用户内部转账转出消账 | - | transfer | mine-account-to-user-account | 矿池账户转用户 | - | transfer | user-account-to-mine-account | 用户转矿池账户 | - | transfer | otc-transfer-in | 转账划入OTC | - | transfer | otc-transfer-in-v2 | 转账划入OTC | - | transfer | otc-transfer-out | 转账划出OTC | - | transfer | otc-transfer-out-v2 | 转账划出OTC | - | transfer | margin-transfer-in | 借贷划转: 现货交易账户转到借贷交易账户 | - | transfer | margin-transfer-out | 借贷划转: 借贷交易账户转到现货交易账户 | - | transfer | point-transfer | 点卡转让 | - | transfer | point-transfer-pay | 点卡转让支付 | - | transfer | mine-pool-transfer-in | 矿池账户转入 | - | transfer | mine-pool-transfer-out | 矿池账户转出 | - | transfer | chat-transfer-in | 转账划入chat | - | transfer | chat-transfer-in-v2 | 转账划入chat | - | transfer | chat-transfer-out | 转账划出chat | - | transfer | chat-transfer-out-v2 | 转账划出chat | - | transfer | chat-to-otc | chat划转至OTC | - | transfer | otc-to-chat | OTC划转至chat | - | transfer | master-transfer-in | 子账户转到母账户 | - | transfer | master-transfer-out | 母账户转到子账户 | - | transfer | margin-to-margin | 借贷划转: 逐仓杠杆交易账户转到逐仓杠杆交易账户 | - | transfer | master-point-transfer-in | 子账户转到母账户,点卡 | - | transfer | master-point-transfer-out | 母账户转到子账户,点卡 | - | transfer | sub-transfer | 子子划转 | - | transfer | sub-point-transfer | 子子点卡划转 | - | transfer | futures-transfer-in | 转账划入合约账户 | - | transfer | futures-transfer-in-v2 | 转账划入合约账户V2| - | transfer | futures-transfer-out | 转账划出合约账户 | - | transfer | futures-transfer-out-v2 | 转账划出合约账户V2 | - | transfer | institution-transfer-in | 转账划入机构 | - | transfer | institution-transfer-in-v2 | 转账划入机构 | - | transfer | institution-transfer-out | 转账划出机构 | - | transfer | institution-transfer-out-v2 | 转账划出机构 | - | transfer | swap-transfer-in | 转账划入合约账户 | - | transfer | swap-transfer-out | 转账划出合约账户 | - | transfer | dm-swap-transfer-in | 转账划入反向永续合约账户 | - | transfer | dm-swap-transfer-out | 转账划出反向永续合约账户 | - | transfer | option-transfer-in | 转账划入期权账户 | - | transfer | option-transfer-out | 转账划出期权账户 | - | transfer | cfd-transfer-in | 转账划入CFD账户 | - | transfer | cfd-transfer-out | 转账划出CFD账户 | - | transfer | super-margin-transfer-out | 全仓杠杆交易账户转入 | - | transfer | super-margin-transfer-in | 全仓杠杆交易账户转出 | - | transfer | japan-donations-operation-to-system | 运营账户到捐款系统账户 | - | transfer | japan-donations-system-to-operation | 捐款系统账户到运营账户 | - | transfer | japan-donations-system-to-user | 日本首里城火灾捐款付款:捐款系统账户 到 普通用户账户 | - | transfer | japan-donations-user-to-system | 日本首里城火灾捐款收款:普通用户账户 到 捐款系统账户 | - | transfer | japan-discount-user-to-system | 币币账户 到 折扣抢购系统账户 | - | transfer | japan-discount-system-to-user | 折扣抢购系统账户 到 币币账户 | - | transfer | japan-discount-operation-to-system | 运营账户 到 折扣抢购系统账户 | - | transfer | japan-discount-system-to-operation | 折扣抢购系统账户 到 运营账户 | - | transfer | directed-card-system-to-operation | 系统定向点卡专项转款账户到运营账户 | - | transfer | directed-card-operation-to-system | 运营账户到系统定向点卡专项转款账户 | - | transfer | system-to-user-account | 土耳其兑换系统账户到用户账户 | - | transfer | user-account-to-system | 用户账户到土耳其兑换系统账户 | - | transfer | liquidity-account-to-system | 香港流动性运营账户到土耳其兑换系统账户 | - | transfer | system-to-liquidity-account | 土耳其兑换系统账户到香港流动性运营账户 | - | transfer | linear-swap-transfer-in | 转账划入正向永续账户 | - | transfer | linear-swap-transfer-out | 转账划出正向永续账户 | - | transfer | custody-transfer-in | 转账划入香港站资金账户 | - | transfer | custody-transfer-out | 转账划出香港站资金账户 | - | transfer | operation-to-margin-trade | 运营账户到逐仓杠杆账户 | - | transfer | margin-trade-to-operation | 逐仓杠杆账户到运营账户 | - | transfer | grid-transfer-in | 网格划转: 现货交易账户转到网格交易账户 | - | transfer | grid-transfer-out | 网格划转: 网格交易账户转到现货交易账户 | - | transfer | otc-generic-transfer-in | OTC账户 通用划转划入 | - | transfer | otc-generic-transfer-out | OTC账户 通用划转转出 | - | transfer | spot-generic-transfer-in | 币币账户 通用划转划入 | - | transfer | spot-generic-transfer-out | 币币账户 通用划转转出 | - | transfer | margin-generic-transfer-in | 逐仓杠杆 通用划转划入 | - | transfer | margin-generic-transfer-out | 逐仓杠杆 通用划转转出 | - | transfer | point-generic-transfer-in | 点卡 通用划转划入 | - | transfer | point-generic-transfer-out | 点卡 通用划转转出 | - | transfer | minepool-generic-transfer-in | 矿池 通用划转划入 | - | transfer | minepool-generic-transfer-out | 矿池 通用划转转出 | - | transfer | super-margin-generic-transfer-in | 全仓杠杆 通用划转划入 | - | transfer | super-margin-generic-transfer-out | 全仓杠杆 通用划转转出 | - | transfer | investment-generic-transfer-in | C2C出借账户 通用划转划入 | - | transfer | investment-generic-transfer-out | C2C出借账户 通用划转转出 | - | transfer | borrow-generic-transfer-in | C2C借款账户 通用划转划入 | - | transfer | borrow-generic-transfer-out | C2C借款账户 通用划转转出 | - | transfer | deposit-earning-generic-transfer-in | Savings理财账户 通用划转划入 | - | transfer | deposit-earning-generic-transfer-out | Savings理财账户 通用划转转出 | - | transfer | crypto-loans-generic-transfer-in | 质押借贷 通用划转划入 | - | transfer | crypto-loans-generic-transfer-out | 质押借贷 通用划转转出 | - | transfer | grid-trading-generic-transfer-in | 网格交易账户 通用划转划入 | - | transfer | grid-trading-generic-transfer-out | 网格交易账户 通用划转转出 | - | transfer | mine-pool-mall-lease-spot-to-settlement-system | 商城算力租赁收款UID划转到商城算力租赁结算系统账户 | - | transfer | mine-pool-mall-lease-settlement-system-to-spot | 商城算力租赁结算系统账户划转到用户UID币币账户 | - | transfer | kr-savings-spot-to-clct | 用户币币账户到系统理财归集账户 | - | transfer | kr-savings-clct-to-transition-spot | 系统理财归集账户到指定财务中转账户(用户账户) | - | transfer | kr-savings-transition-spot-to-intermediate | 指定财务中转账户(用户账户)到系统理财中间账户 | - | transfer | kr-savings-return-to-spot | 系统理财归还账户到用户币币账户 | - | transfer | kr-savings-income-to-spot | 系统理财收益账户到用户币币账户 | - | transfer | kr-savings-transition-spot-to-clct | 指定财务中转账户(用户账户)到系统理财归集账户 | - | transfer | jp-coupon-ops-to-sys | 运营账户 到 优惠券系统账户 | - | transfer | jp-coupon-sys-to-spot | 优惠券系统账户 到 用户币币 | - | transfer | otc-options-master-transfer-in | 涡轮业务专用:子账户转到母账户 | - | transfer | otc-options-master-transfer-in-manual | 手工涡轮业务专用:子账户转到母账户 | - | transfer | otc-options-master-transfer-out | 涡轮业务专用:母账户转到子账户 | - | transfer | otc-options-master-transfer-out-manual | 手工涡轮业务专用:母账户转到子账户 | - | transfer | mine-pool-staking-lock | 用户币币转到用户锁仓 | - | transfer | mine-pool-staking-unlock | 用户锁仓转到用户币币 | - | transfer | mine-pool-staking-reward-system-to-spot | 系统账户-备付金账户转到用户币币 | - | transfer | airdrop-user-spot-oneside-in | 空投用户账户入账 | - | transfer | project-airdrop-user-spot-oneside-in | 项目方空投用户账户入账 | - | credit | margin-loan-transfer | 申请借贷: 系统现金池转到用户交易账户 | - | credit | margin-loan-transfer-v2 | 申请借贷: 系统现金池转到用户交易账户 | - | credit | margin-repay-loan-transfer | 归还借贷本金: 用户交易冻结账户转到系统现金池 | - | credit | margin-repay-loan-transfer-v2 | 归还借贷本金: 用户交易账户转到系统现金池 | - | credit | super-margin-loan-transfer | 申请借贷: 系统现金池转到用户交易账户 | - | credit | super-margin-repay | 还款: 用户交易账户转到系统借贷资金池 | - | credit | auto-super-margin-repay | 自动还款: 用户交易账户转到系统借贷资金池 | - | credit | operations-account-recycling-user-trade-principal | 运营账户回收用户交易子账户借款本金转账 | - | credit | operations-account-to-outside-loan-account | 运营账户->场外借贷用户 | - | credit | outside-loan-account-to-operations-account | 场外借贷用户->运营账户 | - | credit | pledged-loan-lending | 质押借贷-借出 | - | credit | pledged-loan-receiving | 质押借贷-收款 | - | credit | super-margin-loan-receivable | 申请借贷: 用户应付本金转到系统应收本金 | - | credit | super-margin-interest-accrued | 借贷计息: 用户应付利息转到系统应收利息 | - | credit | super-margin-interest-deduct-refund | 利息抵扣: 系统应收利息转到用户应付利息 | - | credit | super-margin-refund | 还款: 系统应收本金转到用户应付本金 | - | credit | margin-repay-loan-receivable | 归还借贷本金: 系统应收本金转到用户应付本金 | - | credit | margin-repay-loan-receivable-v2 | 归还借贷本金: 系统应收本金转到用户应付本金 | - | credit | otc-options-user-asset-ops-borrow | 财务运营账户到涡轮运营子账户(现货账户)- 借款 | - | credit | otc-options-user-asset-ops-borrow-debt | 财务运营账户到涡轮运营子账户(涡轮应收本金账户)- 借款 | - | credit | otc-options-user-asset-ops-repay | 涡轮运营子账户到财务运营账户(现货账户)-还款 | - | credit | otc-options-user-asset-ops-repay-debt | 涡轮运营子账户到财务运营账户(涡轮应还本金账户)- 还款 | - | liquidation | margin-auto-repay-interest-transfer | 归还借贷利息: 用户交易账户转到系统实收本金 | - | liquidation | margin-auto-repay-interest-transfer-v2 | 归还借贷利息: 用户交易账户转到系统实收本金 | - | liquidation | margin-auto-repay-loan-transfer | 归还借贷本金: 用户交易账户转到系统现金池 | - | liquidation | margin-auto-repay-loan-transfer-v2 | 归还借贷本金: 用户交易账户转到系统现金池 | - | interest | margin-repay-interest-transfer | 归还借贷利息: 用户交易冻结账户转到系统实收本金 | - | interest | margin-repay-interest-transfer-v2 | 归还借贷利息: 用户交易账户转到系统实收本金 | - | interest | point-interest-deduction | 抵扣借贷利息返还币 | - | interest | super-margin-interest-repay | 还息:用户交易账户转到系统已收利息 | - | interest | auto-super-margin-interest-repay | 自动还息:用户交易账户转到系统已收利息 | - | interest | margin-repay-interest-receivable | 归还借贷利息: 系统应收利息转到用户应付利息 | - | interest | margin-repay-interest-receivable-v2 | 归还借贷利息: 系统应收利息转到用户应付利息 | - | interest | margin-interest-accrued | 借贷计息: 用户应付利息转到系统应收利息 | - | interest | margin-interest-accrued-v2 | 借贷计息: 用户应付利息转到系统应收利息 | - | deposit | user-account-deposit | 用户账户充值转账 | - | deposit | user-account-fast-deposit | 用户账户快速充值转账 | - | deposit | user-credit-loan-to-system | 用户撤销充值,欠费币币账户转账到系统账户 | - | deposit | user-account-mgt-special-deposit | 用户账户MGT异常充值 | - | deposit | operations-account-deposit-compensate-expenditure | 充币业务补偿支出 | - | deposit | operations-account-deposit-compensate-earning | 充币业务补偿收入 | - | withdraw | user-apply-withdraw | 用户申请提现冻结 | - | withdraw | user-apply-fiat-withdraw | 用户申请法币Fiat提现冻结 | - | withdraw | user-account-withdraw | 用户账户提现转账 | - | withdraw | user-account-fast-withdraw | 用户账户快速提现转账 | - | withdraw | operations-account-withdraw-compensate-expenditure | 提币业务补偿支出 | - | withdraw | operations-account-withdraw-compensate-earning | 提币业务补偿收入 | - | withdraw-fee | system-withdraw-fee-in | 扣用户提现手续费 | - | withdraw-fee | system-withdraw-fee-out | 返还用户提现手续费 | - | exchange | stable-currency-transfer-in-v2 | 系统稳定币转给用户 | - | exchange | stable-currency-transfer-out-v2 | 用户稳定币转给系统 | - | rebate | negative-maker-sys-oneside-out | 负maker系统账户出账 | - | rebate | negative-maker-user-oneside-in | 负maker用户账户入账 | - | etp | etp-purchase-transfer | 申购的USDT: 用户账户转到杠杆代币申购赎回系统账户 | - | etp | etp-purchase-receivable | 申购的杠杆代币: 杠杆代币申购赎回系统账户-杠杆代币转到用户账户 | - | etp | etp-purchase-charge | 申购手续费: 用户账户转到杠杆代币收入系统账户 | - | etp | etp-redemption-transfer | 赎回的杠杆代币: 用户账户转到杠杆代币申购赎回系统账户 | - | etp | etp-redemption-settle-transfer | 给赎回的USDT: 杠杆代币申购赎回系统账户转到用户账户 | - | etp | etp-redemption-charge | 赎回手续费: 杠杆代币申购赎回系统账户转到杠杆代币收入系统账户 | - | etp | etp-management-charge | 划转管理费: 用户账户转到杠杆代币收入系统账户 | - | etp | etp-cash-concentration | 收入归集: 杠杆代币收入系统账户转到收入归集系统账户 | - | etp | etp-usdt-hedge-sys-to-user | USDT对冲: 杠杆代币申购赎回系统账户转到用户账户 | - | etp | etp-usdt-hedge-user-to-sys | USDT对冲: 用户账户转到杠杆代币申购赎回系统账户 | - | etp | etp-futures-hedge-sys-to-user | 合约对冲: 杠杆代币申购赎回系统账户转到用户账户 | - | etp | etp-futures-hedge-user-to-sys | 合约对冲: 用户账户转到杠杆代币申购赎回系统账户 | - | etp | etp-usdt-spot-sys-to-user | 杠杆代币申购赎回系统账户转到用户杠杆代币现货管理账户 | - | etp | etp-usdt-spot-user-to-sys | 用户杠杆代币现货管理账户转到杠杆代币申购赎回系统账户 | - | savings | deposit-earning-to-spot | 理财账户转到币币账户 | - | savings | spot-to-deposit-earning | 币币账户转到理财账户 | - | savings | deposit-earning-to-collect | 理财账户转到资金归集账户 | - | savings | collect-to-deposit-earning | 资金归集账户转到理财账户 | - | savings | operation-to-collect | 运营账户转到资金归集账户 | - | savings | collect-to-operation | 资金归集账户转到运营账户 | - | savings | operation-to-interest | 运营账户转到利息支付账户 | - | savings | interest-to-operation | 利息支付账户转到运营账户 | - | savings | interest-to-deposit-earning | 利息支付账户转到理财账户 | - | savings | deposit-earning-to-interest | 理财账户转到利息支付账户 | - | savings | collect-to-expend | 资金归集账户转到资金支出账户 | - | savings | expend-to-collect | 资金支出账户转到资金归集账户 | - | savings | expend-to-operation | 资金支出账户转到运营账户 | - | savings | operation-to-expend | 运营账户转到资金支出账户 | - | other-types | operations-account-transfer-in | 运营账户转入转账 | - | other-types | operations-account-transfer-out | 运营账户转出转账 | - | other-types | operations-account-user-event-in | 运营账户活动策划转入 | - | other-types | operations-account-user-event-out | 运营账户活动策划转出 | - | other-types | operations-account-loan-to-user-trade | 运营账户借款给用户交易子账户转账 | - | other-types | operations-account-expenditure | 运营账户支出转账 | - | other-types | inspire-account-to-user-account | 激励账户到用户 | - | other-types | user-account-to-inspire-account | 用户账户到激励账户 | - | other-types | activity-account-to-user-account | 活动账户转用户 | - | other-types | user-account-to-activity-account | 用户转活动账户 | - | other-types | brokerage-account-to-user-account | 返佣账户转用户 | - | other-types | user-account-to-brokerage-account | 用户转返佣账户 | - | other-types | exchange-operation-to-user | 交易所运营账户转到用户trade账户:拨款 | - | other-types | operations-account-earning | 运营账户收入转账 | - | other-types | market-account-to-user-account | 市场账户转用户 | - | other-types | user-account-to-market-account | 用户转市场账户 | - | other-types | trade-account-to-user-account | 交易账户转用户 | - | other-types | user-account-to-trade-account | 用户转交易账户 | - | other-types | backup-account-to-user-account | 备用转用户 | - | other-types | user-account-to-backup-account | 用户转备用 | - | other-types | fork-transfer-in | 分叉币转换生成 | - | other-types | fork-transfer-out | 分叉币转换消耗 | - | other-types | point-purchased-gift | 购买点卡赠币 | - | other-types | matching-fee-brokerage | 手续费返佣金 | - | other-types | matching-fee-brokerage-point | 手续费返佣点卡 | - | other-types | api-matching-fee-brokerage | 渠道返佣金 | - | other-types | api-matching-fee-brokerage-point | 渠道返佣点卡 | - | other-types | matching-fee-cashback | 手续费返现金 | - | other-types | matching-fee-cashback-point | 手续费返现点卡 | - | other-types | exchange-fee-to-user | 交易所手续费账户转到邀请人账户 | - | other-types | otc-adjust-account-in | OTC手动给用户充值 | - | other-types | otc-adjust-account-out | OTC手动给用户扣款 | - | other-types | otc-adjust-transfer-in | OTC强制增加用户欠费 | - | other-types | otc-adjust-transfer-out | OTC强制增加用户资产 | - | other-types | option-liquidity-borrow | 期权流动性借出 | - | other-types | option-liquidity-refund | 期权流动性还款 | - | other-types | option-liquidity-other-borrow | 期权其他借出 | - | other-types | option-liquidity-other-refund | 期权其他还款 | - | other-types | linear-swap-liquidity-borrow | 正向永续合约流动性借出 | - | other-types | linear-swap-liquidity-refund | 正向永续合约流动性还款 | - | other-types | linear-swap-liquidity-other-borrow | 正向永续合约其他借出 | - | other-types | linear-swap-liquidity-other-refund | 正向永续合约其他还款 | - | other-types | otc-options-principal-clct-to-user-asset-ops-v3 | 手工涡轮本金归集账户到涡轮运营母账户 | - | other-types | otc-options-income-to-user-asset-ops-manual | 手工涡轮收益归集账户到涡轮运营母账户 | - | other-types | otc-options-user-asset-ops-to-income-manual | 手工涡轮运营母账户到涡轮收益归集账户 | - | other-types | finance-clear-spot-to-sys-usa-jp | 美/日籍用户清退资产返还收款 | - | other-types | finance-clear-sys-to-spot-usa-jp | 美/日籍用户清退资产返还借出 | - | other-types | change-coin-chain-spot-to-sys | 换币换链收入 | - | other-types | change-coin-chain-sys-to-spot | 换币换链支出 | - | other-types | huoban-fund-spot-to-sys | 火伴基金收款 | - | other-types | huoban-fund-sys-to-spot | 火伴基金借出 | - | other-types | huoban-fund-interest-spot-to-sys | 火伴基金利息收入 | - | other-types | head-hunting-sys-to-spot | 猎头费支出 | - | other-types | project-activity-spot-to-sys | 项目方出资活动收入 | - | other-types | project-activity-sys-to-spot | 项目方出资活动支出 | - | other-types | operation-to-super-margin-trade | 运营账户转到用户账户-全仓杠杆账户 | - | other-types | super-margin-trade-to-operation | 用户账户-全仓杠杆账户转到运营账户 | - - ## Get Account Ledger API Key Permission:Read @@ -8088,7 +7799,7 @@ REQ channel supports refreshing message for 5-level, 20-level, and 150-level. | Field Name | Data Type | Mandatory | Default Value | Description | Value Range | | ---------- | --------- | --------- | ------------- | ---------------------------------------------- | ------------------------------------------------------------ | | symbol | string | true | NA | Trading symbol (wildcard inacceptable) | | -| levels | integer | true | NA | Number of price levels (Valid value: 5,20,150) | Only support the number of price levels at 5, 20, or 150 at this point of time. | +| levels | integer | true | NA | Number of price levels (Valid value: 5,20,150,400) | Only support the number of price levels at 5, 20,150 or 400 at this point of time. | > Response (Incremental update subscription) From fdbba4c932e88422a06630abd71387cdccab2ad9 Mon Sep 17 00:00:00 2001 From: momocao <43130840+momocao@users.noreply.github.com> Date: Thu, 29 Jul 2021 17:08:55 +0800 Subject: [PATCH 665/759] ticker --- source/index.html.md | 58 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 49a9a89691f..bff64e20785 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -7601,6 +7601,64 @@ Pull request is supported with extra parameters to define the range. The maximum | from | integer | false | 1501174800(2017-07-28T00:00:00+08:00) | "From" time (epoch time in second) | [1501174800, 2556115200] | | to | integer | false | 2556115200(2050-01-01T00:00:00+08:00) | "To" time (epoch time in second) | [1501174800, 2556115200] or ($from, 2556115200] if "from" is set | +## Market Ticker + +Retrieve the market ticker,data is pushed every 100ms. + +### Topic + +`market.$symbol.ticker` + +> Subscribe request + +```json +{ + "sub": "market.ethbtc.ticker", + "id": "id1" +} +``` + +### Request Parameters + +| Parameter | Data Type | Required | Default | Description | Value Range | +| --------- | --------- | -------- | ------- | --------------------------- | ------------------------------------------------------------ | +| symbol | string | true | NA | The trading symbol to query | All supported trading symbol, e.g. btcusdt, bccbtc.Refer to `/v1/common/symbols` | + +> The above command returns JSON structured like this: + +```json +"data": { + "id":1499225271, + "ts":1499225271000, + "close":1885.0000, + "open":1960.0000, + "high":1985.0000, + "low":1856.0000, + "amount":81486.2926, + "count":42122, + "vol":157052744.85708200, + "ask":[1885.0000,21.8804], + "bid":[1884.0000,1.6702] +} +``` + +### Response Content + +| Field | Data Type | Description | +| ------ | --------- | ------------------------------------------------------------ | +| id | long | The internal identity | +| amount | float | Accumulated trading volume of last 24 hours (rotating 24h), in base currency | +| count | integer | The number of completed trades (rotating 24h) | +| open | float | The opening price of last 24 hours (rotating 24h) | +| close | float | The last price of last 24 hours (rotating 24h) | +| low | float | The lowest price of last 24 hours (rotating 24h) | +| high | float | The highest price of last 24 hours (rotating 24h) | +| vol | float | Accumulated trading value of last 24 hours (rotating 24h), in quote currency | +| bid | object | The current best bid in format [price, size] | +| ask | object | The current best ask in format [price, size] | + +## + ## Market Depth This topic sends the latest market by price order book in snapshot mode at 1-second interval. From bc08ed730349d7e6ce1bd0d0d29f3df87bf41b73 Mon Sep 17 00:00:00 2001 From: jiaaiqiang Date: Thu, 29 Jul 2021 23:14:14 +0800 Subject: [PATCH 666/759] modify order state Description --- source/index.html.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index bff64e20785..ddc34748aa2 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -4639,6 +4639,9 @@ The possible values of "order-state" includes - | order-state | Description | | ----------- | ------------------------------------------------------------ | | -1 | order was already closed in the long past (order state = canceled, partial-canceled, filled, partial-filled) | +| 1 | created | +| 3 | submitted | +| 4 | partial-filled | | 5 | partial-canceled | | 6 | filled | | 7 | canceled | From 1dbb1ddede8aa8d22d13a11cf0877966bffaf647 Mon Sep 17 00:00:00 2001 From: jiaaiqiang Date: Thu, 29 Jul 2021 23:33:49 +0800 Subject: [PATCH 667/759] modify order state Description --- source/index.html.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index ddc34748aa2..b443bbbd7ef 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -4385,6 +4385,9 @@ The possible values of "order-state" includes - | order-state | Description | | ----------- | ------------------------------------------------------------ | | -1 | order was already closed in the long past (order state = cancelled, partially-cancelled, filled, partially-filled) | +| 1 | created | +| 3 | submitted | +| 4 | partial-filled | | 5 | partially-cancelled | | 6 | filled | | 7 | cancelled | From 2a80cc8da62a64b0c19c35da348eca32ca010c97 Mon Sep 17 00:00:00 2001 From: jiaaiqiang Date: Thu, 29 Jul 2021 23:41:36 +0800 Subject: [PATCH 668/759] modify order state Description --- source/index.html.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index b443bbbd7ef..7f78b0b82fe 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -4436,6 +4436,9 @@ curl -X POST -H "Content-Type: application/json" "https://api.huobi.pro/v1/order | ----------- | ------------------------------------------------------------ | | -1 | order was already closed in the long past (order state = cancelled, partially-cancelled, filled, partially-filled) | | 0 | client-order-id not found | +| 1 | created | +| 3 | submitted | +| 4 | partial-filled | | 5 | partially-cancelled | | 6 | filled | | 7 | cancelled | From 3bb36403cdf32ac98dcbd241c7c77208fdd03fbb Mon Sep 17 00:00:00 2001 From: momocao <43130840+momocao@users.noreply.github.com> Date: Fri, 30 Jul 2021 17:32:59 +0800 Subject: [PATCH 669/759] ticker2 --- source/index.html.md | 1 + 1 file changed, 1 insertion(+) diff --git a/source/index.html.md b/source/index.html.md index 7f78b0b82fe..a69b3560639 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -30,6 +30,7 @@ table th { | Release Time
(UTC +8) | API | New / Update | Description | | ------------------------ | ---------------------- | --------------- | ------------------------------------- | +| 2021.7.30 | `market.$symbol.ticker` | Add | Add Market Ticker data | | 2021.7.26 | `market.$symbol.mbp.$levels` | Update | Add 400 depth data| | 2021.7.23 | `GET /v1/account/history` | Update | Detailed in detail the type of change in the account flow interface, that is, "Transact-Types" increases classification, such as Note 3. | | 2021.5.26 | `GET /v1/order/orders/getClientOrder`
`POST /v1/order/orders/place`
`POST/v1/order/orders/submitCancelClientOrder` | Update | For completed orders, clientOrderId will be valid for 2 hours since the order creation (it is still valid for 8 hours concerning other orders).
The uniqueness of the clientOrderId passed in when you place an order will no longer be verified. | From 6799fe31068c2ce14d41b18930ab3d1cdfeaf0dd Mon Sep 17 00:00:00 2001 From: jiaaiqiang Date: Thu, 5 Aug 2021 10:43:28 +0800 Subject: [PATCH 670/759] remove start-date end-date --- source/index.html.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index a69b3560639..6179dfe854e 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2207,8 +2207,8 @@ Note 3:
Change type contains a detailed list of account types: -| Transact Type | Account Type | -| ------------- | -------------------- | +| Transact Type | Account Type | +| ------------- | -------------------- | | trade | match-income | 撮合成交收入 | | trade | match-payout | 撮合成交支付 | | trade | otc-trade | OTC交易资产同步 | @@ -5003,8 +5003,6 @@ curl "https://api.huobi.pro/v1/order/orders?symbol=ethusdt&type=buy-limit&staet= | types | string | false | NA | One or more types of order to include in the search, use comma to separate. | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-stop-limit, sell-stop-limit, buy-limit-fok, sell-limit-fok, buy-stop-limit-fok, sell-stop-limit-fok | | start-time | long | false | -48h | Search starts time, UTC time in millisecond | Value range [((end-time) – 48h), (end-time)], maximum query window size is 48 hours, query window shift should be within past 180 days, query window shift should be within past 2 hours for cancelled order (state = "canceled") | | end-time | long | false | present | Search ends time, UTC time in millisecond | Value range [(present-179d), present], maximum query window size is 48 hours, query window shift should be within past 180 days, queriable range should be within past 2 hours for cancelled order (state = "canceled") | -| start-date | string | false | -1d | Search starts date, in format yyyy-mm-dd | Value range [((end-date) – 1), (end-date)], maximum query window size is 2 days, query window shift should be within past 180 days, query window shift should be within past 2 hours for cancelled order (state = "canceled") | -| end-date | string | false | today | Search ends date, in format yyyy-mm-dd | Value range [(today-179), today], maximum query window size is 2 days, query window shift should be within past 180 days, queriable range should be within past 2 hours for cancelled order (state = "canceled") | | states | string | true | NA | One or more states of order to include in the search, use comma to separate. | All possible order state (refer to introduction in this section) | | from | string | false | NA | Search order id to begin with | NA | | direct | string | false | both | Search direction when 'from' is used | next, prev | @@ -5175,10 +5173,8 @@ curl "https://api.huobi.pro/v1/order/matchresults?symbol=ethusdt" | ---------- | --------- | -------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | symbol | string | true | N/A | The trading symbol to trade | All supported trading symbol, e.g. btcusdt, bccbtc.Refer to `GET /v1/common/symbols` | | types | string | false | all | The types of order to include in the search | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker, buy-stop-limit, sell-stop-limit | -| start-time | false | long | Far point of time of the query window (unix time in millisecond). Searching based on transact-time. The maximum size of the query window is 48 hour. The query window can be shifted within 180 days. | ((end-time) – 48hour) | [((end-time) – 48hour), (end-time)] | -| end-time | false | long | Near point of time of the query window (unix time in millisecond). Searching based on transact-time. The maximum size of the query window is 48 hour. The query window can be shifted within 180 days. | current-time | [(current-time) – 180days,(current-time)] | -| start-date | string | false | -1d | Search starts date (Singapore timezone), in format yyyy-mm-dd | Value range [((end-date) – 1), (end-date)], maximum query window size is 2 days, query window shift should be within past 61 days | -| end-date | string | false | today | Search ends date (Singapore timezone), in format yyyy-mm-dd | Value range [(today-60), today], maximum query window size is 2 days, query window shift should be within past 61 days | +| start-time | false | long | Far point of time of the query window (unix time in millisecond). Searching based on transact-time. The maximum size of the query window is 48 hour. The query window can be shifted within 120 days. | ((end-time) – 48hour) | [((end-time) – 48hour), (end-time)] | +| end-time | false | long | Near point of time of the query window (unix time in millisecond). Searching based on transact-time. The maximum size of the query window is 48 hour. The query window can be shifted within 120 days. | current-time | [(current-time) – 120days,(current-time)] | | from | string | false | N/A | Search internal id to begin with | if search next page, then this should be the last id (not trade-id) of last page; if search previous page, then this should be the first id (not trade-id) of last page | | direct | string | false | next | Search direction when 'from' is used | next, prev | | size | int | false | 100 | The number of orders to return | [1, 500] | From 0466c030b4ad4072338e651f086a0076cd7c903b Mon Sep 17 00:00:00 2001 From: momocao <43130840+momocao@users.noreply.github.com> Date: Thu, 12 Aug 2021 12:34:33 +0800 Subject: [PATCH 671/759] ticker --- source/index.html.md | 65 +++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 6179dfe854e..03f86f88df8 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -30,8 +30,8 @@ table th { | Release Time
(UTC +8) | API | New / Update | Description | | ------------------------ | ---------------------- | --------------- | ------------------------------------- | -| 2021.7.30 | `market.$symbol.ticker` | Add | Add Market Ticker data | -| 2021.7.26 | `market.$symbol.mbp.$levels` | Update | Add 400 depth data| +| 2021.8.12 | `market.$symbol.ticker` | Add | Add Market Ticker data | +| 2021.8.12 | `market.$symbol.mbp.$levels` | Update | Add 400 depth data| | 2021.7.23 | `GET /v1/account/history` | Update | Detailed in detail the type of change in the account flow interface, that is, "Transact-Types" increases classification, such as Note 3. | | 2021.5.26 | `GET /v1/order/orders/getClientOrder`
`POST /v1/order/orders/place`
`POST/v1/order/orders/submitCancelClientOrder` | Update | For completed orders, clientOrderId will be valid for 2 hours since the order creation (it is still valid for 8 hours concerning other orders).
The uniqueness of the clientOrderId passed in when you place an order will no longer be verified. | | 2021.5.12 | GET `/v2/etp/transactions` | Update | "etpNames" and "transactTypes" are changed to "required" and "Only supports filling in one value" | @@ -7619,8 +7619,7 @@ Retrieve the market ticker,data is pushed every 100ms. ```json { - "sub": "market.ethbtc.ticker", - "id": "id1" + "sub": "market.btcusdt.ticker" } ``` @@ -7633,35 +7632,45 @@ Retrieve the market ticker,data is pushed every 100ms. > The above command returns JSON structured like this: ```json -"data": { - "id":1499225271, - "ts":1499225271000, - "close":1885.0000, - "open":1960.0000, - "high":1985.0000, - "low":1856.0000, - "amount":81486.2926, - "count":42122, - "vol":157052744.85708200, - "ask":[1885.0000,21.8804], - "bid":[1884.0000,1.6702] +{ +"ch": "market.btcusdt.ticker", +"ts": 1628587397308, +"tick": { +"open": 44718.5, +"high": 46711, +"low": 44480.81, +"close": 45868.99, +"amount": 22527.427922989766, +"vol": 1030630905.0136755, +"count": 676424, +"bid": 45868.98, +"bidSize": 0.016782, +"ask": 45868.99, +"askSize": 3.1279664455029423, +"lastPrice": 45868.99, +"lastSize": 0.007444 +} } ``` ### Response Content -| Field | Data Type | Description | -| ------ | --------- | ------------------------------------------------------------ | -| id | long | The internal identity | -| amount | float | Accumulated trading volume of last 24 hours (rotating 24h), in base currency | -| count | integer | The number of completed trades (rotating 24h) | -| open | float | The opening price of last 24 hours (rotating 24h) | -| close | float | The last price of last 24 hours (rotating 24h) | -| low | float | The lowest price of last 24 hours (rotating 24h) | -| high | float | The highest price of last 24 hours (rotating 24h) | -| vol | float | Accumulated trading value of last 24 hours (rotating 24h), in quote currency | -| bid | object | The current best bid in format [price, size] | -| ask | object | The current best ask in format [price, size] | +| Field | Data Type | Description | +| --------- | --------- | ------------------------------------------------------------ | +| id | long | The internal identity | +| amount | float | Accumulated trading volume of last 24 hours (rotating 24h), in base currency | +| count | integer | The number of completed trades (rotating 24h) | +| open | float | The opening price of last 24 hours (rotating 24h) | +| close | float | The last price of last 24 hours (rotating 24h) | +| low | float | The lowest price of last 24 hours (rotating 24h) | +| high | float | The highest price of last 24 hours (rotating 24h) | +| vol | float | Accumulated trading value of last 24 hours (rotating 24h), in quote currency | +| bid | float | Best bid price | +| bidSize | float | Best bid size | +| ask | float | Best ask price | +| askSize | float | Best ask size | +| lastPrice | float | Last traded price | +| lastSize | float | Last traded size | ## From 568ac03a6707f9b344688407557053b269569da7 Mon Sep 17 00:00:00 2001 From: jiaaiqiang Date: Wed, 18 Aug 2021 11:04:04 +0800 Subject: [PATCH 672/759] modify email Vip@global-hgroup.com --- source/index.html.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 03f86f88df8..e9944770d5f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -811,8 +811,8 @@ It indicates the request path doesn't exist, please check the path spelling care It is very welcome for market maker who has good market making strategy and large trading volume. If your Huobi Spot account or Contract account has at least 10 BTC, you can send your email to: -- [MM_service@huobi.com](mailto:MM_service@huobi.com) for Huobi Global (spot / leverage) market maker -- [dm_mm@huobi.com](mailto:dm_mm@huobi.com) for Huobi Contract market maker +- [Vip@global-hgroup.com](mailto:Vip@global-hgroup.com) for Huobi Global (spot / leverage) market maker +- [Vip@global-hgroup.com](mailto:Vip@global-hgroup.com) for Huobi Contract market maker And provide below details: @@ -4106,7 +4106,7 @@ curl "https://api.huobi.pro/v1/account/accounts/10758899" | Field | Data Type | Description | Value Range | | ----- | --------- | ------------------------------------ | ------------------------------------- | -| id | integer | Sub account's UID | NA | +| id | integer | account's ID | NA | | type | string | The type of this account | spot, margin, otc, point,super-margin | | list | object | The balance details of each currency | NA | From ccb5dfe3118001321f9a889eda30dfd34a1da3d8 Mon Sep 17 00:00:00 2001 From: momocao <43130840+momocao@users.noreply.github.com> Date: Wed, 18 Aug 2021 18:19:49 +0800 Subject: [PATCH 673/759] announcement --- source/index.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index e9944770d5f..c5f665bc065 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -159,7 +159,7 @@ Welcome to Huobi API! This is the official Huobi API document, and will be continue updating. Huobi will also publish API announcement in advance for any API change. Please subscribe to our announcements so that you can get the latest updates. -You can click Here to view the announcements. If you want to subscribe, please click "Follow" button in the top right of the page. After login and click "Follow" again, then choose the type you want to follow. After you subscribe, the button will be changed to "Following". If you don't have any account, you need to register first in the login dialog. +You can click Here to view the announcements. If you want to subscribe, please click "Follow" button in the top right of the page. After login and click "Follow" again, then choose the type you want to follow. After you subscribe, the button will be changed to "Following". If you don't have any account, you need to register first in the login dialog. **How to read this document** From 29c4c136263bafa37fd2dcd59523e07f155837ae Mon Sep 17 00:00:00 2001 From: momocao <43130840+momocao@users.noreply.github.com> Date: Thu, 19 Aug 2021 15:06:33 +0800 Subject: [PATCH 674/759] seqnum --- source/index.html.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index c5f665bc065..3ad663d21b1 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -30,6 +30,8 @@ table th { | Release Time
(UTC +8) | API | New / Update | Description | | ------------------------ | ---------------------- | --------------- | ------------------------------------- | +| 2021.8.19 | `accounts.update#${mode}` | 优化 | Add “Serial Number of Account Change” parameter:“seqNum” | +| 2021.8.19 | `GET /v1/account/accounts/{account-id}/balance` | 优化 | Add “Serial Number of Account Change” parameter:“seq-num” | | 2021.8.12 | `market.$symbol.ticker` | Add | Add Market Ticker data | | 2021.8.12 | `market.$symbol.mbp.$levels` | Update | Add 400 depth data| | 2021.7.23 | `GET /v1/account/history` | Update | Detailed in detail the type of change in the account flow interface, that is, "Transact-Types" increases classification, such as Note 3. | @@ -1983,16 +1985,19 @@ curl "https://api.huobi.pro/v1/account/accounts/100009/balance" { "currency": "usdt", "type": "trade", + "seq-num": "86872993928", "balance": "500009195917.4362872650" }, { "currency": "usdt", "type": "frozen", + "seq-num": "86872993928", "balance": "328048.1199920000" }, { "currency": "etc", "type": "trade", + "seq-num": "86872993928", "balance": "499999894616.1302471000" } ], @@ -2016,6 +2021,9 @@ curl "https://api.huobi.pro/v1/account/accounts/100009/balance" | currency | string | The currency of this balance | NA | | type | string | The balance type | trade, frozen | | balance | string | The balance in the main currency unit | NA | +| seq-num | string | Serial Number of Account Change | NA | + + ## Get Asset Valuation @@ -8869,6 +8877,7 @@ accounts.update#0: "balance": "23.111", "changeType": "transfer", "accountType":"trade", + "seqNum": "86872993928", "changeTime": 1568601800000 } } @@ -8883,6 +8892,7 @@ accounts.update#1: "available": "2028.699426619837209087", "changeType": "order.match", "accountType":"trade", + "seqNum": "86872993928", "changeTime": 1574393385167 } } @@ -8895,6 +8905,7 @@ accounts.update#1: "balance": "2065.100267619837209301", "changeType": "order.match", "accountType":"trade", + "seqNum": "86872993928", "changeTime": 1574393385122 } } @@ -8911,6 +8922,7 @@ accounts.update#1: | changeType | string | Change type, valid value: order-place,order-match,order-refund,order-cancel,order-fee-refund,margin-transfer,margin-loan,margin-interest,margin-repay,deposit,withdraw,other | | accountType | string | account type, valid value: trade, loan, interest | | changeTime | long | Change time, unix time in millisecond | +| seqNum | long | Serial Number of Account Change | Note:
From 693feb807fc87ad517a99f29415f5ad35e48dbdf Mon Sep 17 00:00:00 2001 From: jiaaiqiang Date: Fri, 3 Sep 2021 20:52:52 +0800 Subject: [PATCH 675/759] modify /v2/account/withdraw/address desc --- source/index.html.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 3ad663d21b1..fbfee2a8f83 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2977,17 +2977,17 @@ This endpoint allows parent user to query withdraw address available for API key ``` ### Response Content -| Field Name | Mandatory | Data Type | Description | Value Range | -| ---------- | --------- | --------- | ------------------------------------------------------------ | ----------- | -| code | true | int | Status code | | -| message | false | string | Error message (if any) | | -| data | true | object | | | -| { currency | true | string | Crypto currency | | -| chain | true | string | Block chain name | | -| note | true | string | The address note | | -| addressTag | false | string | The address tag,if any | | -| address } | true | string | Withdraw address | | -| nextId | false | long | First record ID in next page (only valid if exceeded page size) | | +| Field Name | Mandatory | Data Type | Description | Value Range | +| ----------- | --------- | --------- | ------------------------------------------------------------ | ----------- | +| code | true | int | Status code | | +| message | false | string | Error message (if any) | | +| data | true | object | | | +| [{ currency | true | string | Crypto currency | | +| chain | true | string | Block chain name | | +| note | true | string | The address note | | +| addressTag | false | string | The address tag,if any | | +| address }] | true | string | Withdraw address | | +| nextId | false | long | First record ID in next page (only valid if exceeded page size) | | Note:
Only when the number of items within the query window exceeded the page limitation (defined by “limit”), Huobi server returns “nextId”. Once received “nextId”, API user should –
From e80b40906e4cb3600057e5367bdb35ff659e4811 Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Mon, 6 Sep 2021 10:12:52 +0800 Subject: [PATCH 676/759] *update --- source/index.html.md | 104 +++++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index fbfee2a8f83..8adb7e27728 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -30,8 +30,8 @@ table th { | Release Time
(UTC +8) | API | New / Update | Description | | ------------------------ | ---------------------- | --------------- | ------------------------------------- | -| 2021.8.19 | `accounts.update#${mode}` | 优化 | Add “Serial Number of Account Change” parameter:“seqNum” | -| 2021.8.19 | `GET /v1/account/accounts/{account-id}/balance` | 优化 | Add “Serial Number of Account Change” parameter:“seq-num” | +| 2021.8.19 | `accounts.update#${mode}` | 优化 | Add "Serial Number of Account Change" parameter:"seqNum" | +| 2021.8.19 | `GET /v1/account/accounts/{account-id}/balance` | 优化 | Add "Serial Number of Account Change" parameter:"seq-num" | | 2021.8.12 | `market.$symbol.ticker` | Add | Add Market Ticker data | | 2021.8.12 | `market.$symbol.mbp.$levels` | Update | Add 400 depth data| | 2021.7.23 | `GET /v1/account/history` | Update | Detailed in detail the type of change in the account flow interface, that is, "Transact-Types" increases classification, such as Note 3. | @@ -42,10 +42,10 @@ table th { | 2021.2.28 | Account and Order WebSocket v1 | Delete | Account and WebSocket v1 was offline | | 2021.2.1 | `POST /v2/account/repayment` | Update | Support isolated repayment | | 2021.1.22 19:00 | `GET /v1/order/matchresults` | Add | Add timestamp parameters | -| 2021.1.19 19:00 | `GET /v2/etp/limit` | Add | Add “Get Holding Limit of Leveraged ETP” endpoints | +| 2021.1.19 19:00 | `GET /v2/etp/limit` | Add | Add "Get Holding Limit of Leveraged ETP" endpoints | | 2020.1.8 19:00 | `POST/v2/algo-orders/cancel-all-after` | Add | Add Dead man’s switch endpoints | | 2020.1.5 19:00 | accounts.update#${mode} | Update | added Specify "mode" as 2:
accounts.update#2
Whenever account balance or available balance changed, it will be updated together. | -| 2020.12.16 19:00 | `GET /v1/order/matchresults ` and `GET /v1/order/orders/{order-id}/matchresults` | Update | Add "fee-deduct-state" parameter to indicate the status of “In deduction” and “deduction completed” | +| 2020.12.16 19:00 | `GET /v1/order/matchresults ` and `GET /v1/order/orders/{order-id}/matchresults` | Update | Add "fee-deduct-state" parameter to indicate the status of "In deduction" and "deduction completed" | | 2020.12.14 19:00 | `POST /v2/etp/{transactId}/cancel ` and`POST /v2/etp/batch-cancel` | Add | Add "Submit Cancel for ETP Multiple Orders" and"Submit Cancel for an ETP Order" endpoints | | 2020.11.26 19:00 | `GET /v2/user/uid ` | Add | Add Get UID endpoints | | 2020.10.16 19:00 | `orders#${symbol} ` | Add | Add accountId for order creation event | @@ -145,7 +145,7 @@ table th { | 2019.06.05 20:00 | All APIs that need authentication | Update | Set up 3 permission for API Key: Read, Trade and Withdraw | | 2019.06.10 00:00 | `GET /v1/order/orders`
`GET /v1/order/matchresults` | Update | Adjusted query window as 48 hours | | 2019.05.15 10:00 | `POST /v1/futures/transfer` | New | Allow a user to tranfer fund between spot account and future contract account. | -| 2019.04.29 19:00 | `GET /v1/order/history` | New | Support historical order querying within 48 hours. With the launching of this new endpoint, the existing REST endpoint “v1/order/orders” will be kept in service. However, the new endpoint “/v1/order/history” will have better service level than the “/v1/order/orders”, especially when the service loading exceeds the threshold of our system, which means in some extremely cases, “v1/order/orders” would become unavailable, but “/v1/order/history” would be kept alive. Meanwhile, Huobi is planning to have a delegated data service to support users’ demands on long-term history data. Once this new service become available, the “v1/order/orders” will be deprecated. We will keep you informed promptly once the timeline determined. | +| 2019.04.29 19:00 | `GET /v1/order/history` | New | Support historical order querying within 48 hours. With the launching of this new endpoint, the existing REST endpoint "v1/order/orders" will be kept in service. However, the new endpoint "/v1/order/history" will have better service level than the "/v1/order/orders", especially when the service loading exceeds the threshold of our system, which means in some extremely cases, "v1/order/orders" would become unavailable, but "/v1/order/history" would be kept alive. Meanwhile, Huobi is planning to have a delegated data service to support users’ demands on long-term history data. Once this new service become available, the "v1/order/orders" will be deprecated. We will keep you informed promptly once the timeline determined. | | 2019.04.17 10:00 | `GET /v1/order/orders` | Update | Add clarification on the value range for start-date in documents | | 2019.04.16 10:00 | `GET /v1/order/openOrders` | Update | Correct the documents error. Both account-id and symbol are required | | 2019.01.17 07:00 | Websocket accounts | Update | Add subscription parameter model
Subscription does not return frozen balance of sub-user anymore | @@ -329,18 +329,18 @@ This is a full URL to query one order: `&order-id=1234567890` -**1. The request Method (GET or POST, WebSocket use GET), append line break “\n”** +**1. The request Method (GET or POST, WebSocket use GET), append line break "\n"** `GET\n` -**2. The host with lower case, append line break “\n”** +**2. The host with lower case, append line break "\n"** Example: ` api.huobi.pro\n ` -**3. The path, append line break “\n”** +**3. The path, append line break "\n"** For example, query orders: @@ -388,7 +388,7 @@ Then above parameter should be ordered like below: `order-id=1234567890` -**5. Use char “&” to concatenate all parameters** +**5. Use char "&" to concatenate all parameters** `AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-05-11T15%3A19%3A30&order-id=1234567890` @@ -416,7 +416,7 @@ Then above parameter should be ordered like below: For Rest interface: 1. Put all the parameters in the URL -2. Encode signature by URL encoding and append in the URL with parameter name “Signature”. +2. Encode signature by URL encoding and append in the URL with parameter name "Signature". Finally, the request sent to API should be: @@ -499,7 +499,7 @@ The sub user can access all public API (including basic information and market d | [GET /v2/etp/rebalance](#get-position-rebalance-history) | Get Position Rebalance History | ## Glossary @@ -2205,11 +2205,11 @@ Note 1:
- A paid maker rebate could possibly include rebate from multiple trades.
Note 2:
-Only when the number of items within the query window (between “start-time” and ”end-time”) exceeded the page limitation (defined by “size”), Huobi server returns “next-id”. Once received “next-id”, API user should –
+Only when the number of items within the query window (between "start-time" and "end-time") exceeded the page limitation (defined by "size"), Huobi server returns "next-id". Once received "next-id", API user should –
1) Be aware of that, some items within the query window were not returned due to the page size limitation.
-2) In order to get these items from Huobi server, adopt the “next-id” as “from-id” and submit another request, with other request parameters no change.
-3) As database record ID, “next-id” and “from-id” are for recurring query purpose and the ID itself does not have any business implication.
+2) In order to get these items from Huobi server, adopt the "next-id" as "from-id" and submit another request, with other request parameters no change.
+3) As database record ID, "next-id" and "from-id" are for recurring query purpose and the ID itself does not have any business implication.
Note 3:
@@ -2512,10 +2512,10 @@ API Key Permission:Read This endpoint returns the amount changes of specified user's account.
-Phase 1 release only supports historical assets transfer querying (“transactType” = “transfer”).
+Phase 1 release only supports historical assets transfer querying ("transactType" = "transfer").
-The maximum query window size set by “startTime” & “endTime” is 10-day, which mean a maximum of 10-day records are queriable per request. -The query window can be within the last 180 days, which means, by adjusting “startTime” & “endTime” accordingly, the records in last 180 days are queriable.
+The maximum query window size set by "startTime" & "endTime" is 10-day, which mean a maximum of 10-day records are queriable per request. +The query window can be within the last 180 days, which means, by adjusting "startTime" & "endTime" accordingly, the records in last 180 days are queriable.
### HTTP Request @@ -2585,7 +2585,7 @@ endTime default value: current time | ------------ | --------- | --------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | code | integer | TRUE | Status code | | | message | string | FALSE | Error message (if any) | | -| data | object | TRUE | Sorting as user defined (in request parameter “sort” ) | | +| data | object | TRUE | Sorting as user defined (in request parameter "sort" ) | | | { accountId | integer | TRUE | Account ID | | | currency | string | TRUE | Cryptocurrency | | | transactAmt | number | TRUE | Transaction amount (income positive, expenditure negative) | | @@ -2598,10 +2598,10 @@ endTime default value: current time | nextId | integer | FALSE | First record ID in next page (only valid if exceeded page size. please refer to note 3.) | | Note 3:
-Only when the number of items within the query window (between “startTime” and ”endTime”) exceeded the page limitation (defined by “limit”), Huobi server returns “nextId”. Once received “nextId”, API user should –
+Only when the number of items within the query window (between "startTime" and "endTime") exceeded the page limitation (defined by "limit"), Huobi server returns "nextId". Once received "nextId", API user should –
1) Be aware of that, some items within the query window were not returned due to the page size limitation.
-2) In order to get these items from Huobi server, adopt the “nextId” as “fromId” and submit another request, with other request parameters no change.
-3) As database record ID, “nextId” and “fromId” are for recurring query purpose and the ID itself does not have any business implication.
+2) In order to get these items from Huobi server, adopt the "nextId" as "fromId" and submit another request, with other request parameters no change.
+3) As database record ID, "nextId" and "fromId" are for recurring query purpose and the ID itself does not have any business implication.
## Transfer Fund Between Spot Account and Future Contract Account @@ -2630,7 +2630,7 @@ Transferring from a spot account to a contract account, the type is pro-to-futur | --------- | --------- | -------- | -------------------------- | ------------------------------------ | | currency | TRUE | String | Currency name | Refer to `GET /v1/common/currencys` | | amount | TRUE | Decimal | Amount of fund to transfer | | -| type | TRUE | String | Type of the transfer | “futures-to-pro” or “pro-to-futures” | +| type | TRUE | String | Type of the transfer | "futures-to-pro" or "pro-to-futures" | > Response: @@ -2811,7 +2811,7 @@ Below is the error code, error message and description returned by Account APIs. | 2002 | "invalid field value in `currency`" | Parameter currency is invalid | | 2002 | "invalid field value in `transactTypes`" | Parameter transactTypes is invalid (should be transfer) | | 2002 | "invalid field value in `sort`" | Parameter sort is invalid (should be 'asc' or 'desc') | -| 2002 | "value in `fromId` is not found in record” | Value fromId doesn't exist | +| 2002 | "value in `fromId` is not found in record" | Value fromId doesn't exist | | 2002 | "invalid field value in `accountId`" | Parameter accountId is invalid (should not be empty) | | 2002 | "value in `startTime` exceeded valid range" | Value startTime is later than current time or earlier than 180 days ago | | 2002 | "value in `endTime` exceeded valid range") | Value endTime is earlier than startTime, or 10 days later than startTime | @@ -2990,10 +2990,10 @@ This endpoint allows parent user to query withdraw address available for API key | nextId | false | long | First record ID in next page (only valid if exceeded page size) | | Note:
-Only when the number of items within the query window exceeded the page limitation (defined by “limit”), Huobi server returns “nextId”. Once received “nextId”, API user should –
+Only when the number of items within the query window exceeded the page limitation (defined by "limit"), Huobi server returns "nextId". Once received "nextId", API user should –
1) Be aware of that, some items within the query window were not returned due to the page size limitation.
-2) In order to get these items from Huobi server, adopt the “nextId” as “fromId” and submit another request, with other request parameters no change.
-3) “nextId” and “fromId” are for recurring query purpose and the ID itself does not have any business implication.
+2) In order to get these items from Huobi server, adopt the "nextId" as "fromId" and submit another request, with other request parameters no change.
+3) "nextId" and "fromId" are for recurring query purpose and the ID itself does not have any business implication.
## Create a Withdraw Request @@ -3952,10 +3952,10 @@ endTime valid range: Unlimited
endTime default value: current time
Note 3:
-Only when the number of items within the query window (between “startTime” and ”endTime”) exceeded the page limitation (defined by “limit”), Huobi server returns “nextId”. Once received “nextId”, API user should –
+Only when the number of items within the query window (between "startTime" and "endTime") exceeded the page limitation (defined by "limit"), Huobi server returns "nextId". Once received "nextId", API user should –
1) Be aware of that, some items within the query window were not returned due to the page size limitation.
-2) In order to get these items from Huobi server, adopt the “nextId” as “fromId” and submit another request, with other request parameters no change.
-3) “nextId” and “fromId” are for recurring query purpose and the ID itself does not have any business implication.
+2) In order to get these items from Huobi server, adopt the "nextId" as "fromId" and submit another request, with other request parameters no change.
+3) "nextId" and "fromId" are for recurring query purpose and the ID itself does not have any business implication.
> The above command returns JSON structured like this: @@ -4973,13 +4973,13 @@ Rate Limit (NEW): 50times/2s This endpoint returns orders based on a specific searching criteria. The order created via API will no longer be queryable after being cancelled for more than 2 hours. -- Upon user defined “start-time” AND/OR “end-time”, Huobi server will return historical orders whose order creation time falling into the period. The maximum query window between “start-time” and “end-time” is 48-hour. Oldest order searchable should be within recent 180 days. If either “start-time” or “end-time” is defined, Huobi server will ignore “start-date” and “end-date” regardless they were filled or not. +- Upon user defined "start-time" AND/OR "end-time", Huobi server will return historical orders whose order creation time falling into the period. The maximum query window between "start-time" and "end-time" is 48-hour. Oldest order searchable should be within recent 180 days. If either "start-time" or "end-time" is defined, Huobi server will ignore "start-date" and "end-date" regardless they were filled or not. -- If user does neither define “start-time” nor “end-time”, but “start-date”/”end-date”, the order searching will be based on defined “date range”, as usual. The maximum query window is 2 days, and oldest order searchable should be within recent 180 days. +- If user does neither define "start-time" nor "end-time", but "start-date"/"end-date", the order searching will be based on defined "date range", as usual. The maximum query window is 2 days, and oldest order searchable should be within recent 180 days. -- If user does not define any of “start-time”/”end-time”/”start-date”/”end-date”, by default Huobi server will treat current time as “end-time”, and then return historical orders within recent 48 hours. +- If user does not define any of "start-time"/"end-time"/"start-date"/"end-date", by default Huobi server will treat current time as "end-time", and then return historical orders within recent 48 hours. -Huobi Global suggests API users to search historical orders based on “time” filter instead of “date”. In the near future, Huobi Global would remove “start-date”/”end-date” fields from the endpoint, through another notification. +Huobi Global suggests API users to search historical orders based on "time" filter instead of "date". In the near future, Huobi Global would remove "start-date"/"end-date" fields from the endpoint, through another notification. ### HTTP Request @@ -5105,7 +5105,7 @@ The orders created via API will no longer be queryable after being cancelled for | symbol | false | string | The trading symbol to trade | all | All supported trading symbol, e.g. btcusdt, bccbtc.Refer to `GET /v1/common/symbols` | | start-time | false | long | Start time (included) | The time 48 hours ago | UTC time in millisecond | | end-time | false | long | End time (included) | The query time | UTC time in millisecond | -| direct | false | string | Direction of the query. (Note: If the total number of items in the search result is within the limitation defined in “size”, this field does not take effect.) | next | prev, next | +| direct | false | string | Direction of the query. (Note: If the total number of items in the search result is within the limitation defined in "size", this field does not take effect.) | next | prev, next | | size | false | int | Number of items in each response | 100 | [10,1000] | @@ -5157,7 +5157,7 @@ The orders created via API will no longer be queryable after being cancelled for | stop-price | string | trigger price of stop limit order | | operator | string | operation character of stop price. e.g. get, lte | | type} | string | All possible order type (refer to introduction in this section) | -| next-time | long | Next query “start-time” (in response of “direct” = prev), Next query “end-time” (in response of “direct” = next). Note: Only when the total number of items in the search result exceeded the limitation defined in “size”, this field exists. UTC time in millisecond. | +| next-time | long | Next query "start-time" (in response of "direct" = prev), Next query "end-time" (in response of "direct" = next). Note: Only when the total number of items in the search result exceeded the limitation defined in "size", this field exists. UTC time in millisecond. | ## Search Match Results @@ -5816,7 +5816,7 @@ While repaying the loan, loan interest will be paid first if there is no appoint | { repayId | string | TRUE | repayment ID | | repayTime } | long | TRUE | repayment time (unix time in millisecond) | -Note: Returning “repayId” doesn’t mean the repayment is 100% successful. Please check the transaction record to confirm the repayment status. +Note: Returning "repayId" doesn’t mean the repayment is 100% successful. Please check the transaction record to confirm the repayment status. ## Transfer Asset from Spot Trading Account to Isolated Margin Account(Isolated) @@ -6645,7 +6645,7 @@ Frequency Limit: 2/s Available Accounts: Main and Sub-Accounts -Sort by “repayTime” +Sort by "repayTime" ### HTTP Request @@ -7367,9 +7367,9 @@ API Key Permission: Read
| { subAccountType | string | TRUE | Sub account (trade, lending, earnings, loan, interest, advance) | | currency | string | TRUE | Currency | | acctBalance | string | TRUE | Account balance | -| availBalance | string | FALSE | Available balance (Only valid for sub account “trade”) | -| transferable | string | FALSE | Transferable value (Only valid for sub account “trade”) | -| borrowable }} | string | FALSE | Borrowable value (Only valid for sub account “trade”) | +| availBalance | string | FALSE | Available balance (Only valid for sub account "trade") | +| transferable | string | FALSE | Transferable value (Only valid for sub account "trade") | +| borrowable }} | string | FALSE | Borrowable value (Only valid for sub account "trade") | Note:
• Sub account trade, loan, interest, advance are only valid for borrowing account;
@@ -7786,12 +7786,12 @@ or Suggested downstream data processing:
1) Subscribe to incremental updates and start to cache them;
-2) Request refresh message (with same number of levels), and base on its “seqNum” to align it with the cached incremental message which has the same “prevSeqNum”;
+2) Request refresh message (with same number of levels), and base on its "seqNum" to align it with the cached incremental message which has the same "prevSeqNum";
3) Start to continuously process incremental messages to build up MBP book;
-4) The “prevSeqNum” of the current incremental message must be the same with “seqNum” of the previous message, otherwise it implicates message loss which should require another round of refresh message retrieval and alignment;
+4) The "prevSeqNum" of the current incremental message must be the same with "seqNum" of the previous message, otherwise it implicates message loss which should require another round of refresh message retrieval and alignment;
5) Once received a new price level from incremental message, that price level should be inserted into appropriate position of existing MBP book;
-6) Once received an updated “size” at the existing price level from incremental message, the size should be replaced directly by the new value;
-7) Once received a “size=0” at existing price level from incremental message, that price level should be removed from MBP book;
+6) Once received an updated "size" at the existing price level from incremental message, the size should be replaced directly by the new value;
+7) Once received a "size=0" at existing price level from incremental message, that price level should be removed from MBP book;
8) If one incremental message includes updates of multiple price levels, all of those levels should be updated simultaneously in MBP book.
Currently Huobi Global only supports 5-level/20-level MBP incremental channel and 150-level incremental channel, the differences between them are -
@@ -7942,8 +7942,8 @@ REQ channel supports refreshing message for 5-level, 20-level, and 150-level. | ---------- | --------- | ------------------------------------------------------------ | | seqNum | integer | Sequence number of the message | | prevSeqNum | integer | Sequence number of previous message | -| bids | object | Bid side, (in descending order of “price”), ["price","size"] | -| asks | object | Ask side, (in ascending order of “price”), ["price","size"] | +| bids | object | Bid side, (in descending order of "price"), ["price","size"] | +| asks | object | Ask side, (in ascending order of "price"), ["price","size"] | ## Market By Price (refresh update) @@ -8011,8 +8011,8 @@ User could subscribe to this channel to receive refresh update of Market By Pric | Field Name | Data Type | Description | | ---------- | --------- | ------------------------------------------------------------ | | seqNum | integer | Sequence number of the message | -| bids | object | Bid side, (in descending order of “price”), ["price","size"] | -| asks | object | Ask side, (in ascending order of “price”), ["price","size"] | +| bids | object | Bid side, (in descending order of "price"), ["price","size"] | +| asks | object | Ask side, (in ascending order of "price"), ["price","size"] | ## Best Bid/Offer @@ -8573,7 +8573,7 @@ After order is submitted – Note:
- If a stop limit order is created but not yet triggered, the topic won’t send an update.
- The topic will send creation update for taker's order before it being filled.
-- Stop limit order's type is no longer as “buy-stop-limit” or “sell-stop-limit”, but changing to “buy-limit” or “sell-limit”.
+- Stop limit order's type is no longer as "buy-stop-limit" or "sell-stop-limit", but changing to "buy-limit" or "sell-limit".
```json { @@ -8624,7 +8624,7 @@ After order matching – | execAmt | string | Accumulative amount (for buy-market order it is accumulative value) | Note:
-- Stop limit order's type is no longer as “buy-stop-limit” or “sell-stop-limit”, but changing to “buy-limit” or “sell-limit”.
+- Stop limit order's type is no longer as "buy-stop-limit" or "sell-stop-limit", but changing to "buy-limit" or "sell-limit".
- If a taker’s order matching with multiple orders at opposite side simultaneously, the multiple trades will be disseminated over separately instead of merging into one trade.
```json @@ -8668,7 +8668,7 @@ After order cancellation – | lastActTime | long | Last activity time | Note:
-- Stop limit order's type is no longer as “buy-stop-limit” or “sell-stop-limit”, but changing to “buy-limit” or “sell-limit”.
+- Stop limit order's type is no longer as "buy-stop-limit" or "sell-stop-limit", but changing to "buy-limit" or "sell-limit".
## Subscribe Trade Details & Order Cancellation post Clearing @@ -9723,4 +9723,4 @@ Below is the error code and the description returend by ETP APIs | 80042 | Order cancellation failed, this order is already executed | | 80043 | Order cancellation failed, this order does not exist | | 80045 | Order cancellation failed, the system is busy now, please try again later | -| 80052 | Excedds the maximun query limit 10 | \ No newline at end of file +| 80052 | Excedds the maximun query limit 10 | From a514ca5791b3d2c6131ac2eb619f4e4e150a1039 Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Tue, 7 Sep 2021 16:53:05 +0800 Subject: [PATCH 677/759] *update --- source/index.html.md | 89 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 8adb7e27728..b9e18a8ba32 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -35,6 +35,7 @@ table th { | 2021.8.12 | `market.$symbol.ticker` | Add | Add Market Ticker data | | 2021.8.12 | `market.$symbol.mbp.$levels` | Update | Add 400 depth data| | 2021.7.23 | `GET /v1/account/history` | Update | Detailed in detail the type of change in the account flow interface, that is, "Transact-Types" increases classification, such as Note 3. | +| 2021.6.12 | `GET/v2/account/valuation` | Add | Get The Total Valuation of Platform Assets | 2021.5.26 | `GET /v1/order/orders/getClientOrder`
`POST /v1/order/orders/place`
`POST/v1/order/orders/submitCancelClientOrder` | Update | For completed orders, clientOrderId will be valid for 2 hours since the order creation (it is still valid for 8 hours concerning other orders).
The uniqueness of the clientOrderId passed in when you place an order will no longer be verified. | | 2021.5.12 | GET `/v2/etp/transactions` | Update | "etpNames" and "transactTypes" are changed to "required" and "Only supports filling in one value" | | 2021.3.1 | `POST /v2/sub-user/deduct-mode` | Add | Set a deduction for master and sub user | @@ -2024,6 +2025,94 @@ curl "https://api.huobi.pro/v1/account/accounts/100009/balance" | seq-num | string | Serial Number of Account Change | NA | +## Get The Total Valuation of Platform Assets + +permission type:Read + +API Rate Limit(NEW):3/1s + +Obtain the total asset valuation of the platform account according to the BTC or legal currency denominated unit. + +### HTTP Request + +- GET `/v2/account/valuation` + +### Query Parameters + +| Parameter | Required | Data Type | Description | Value Range | +| ---------- | -------- | ------ | ------------------------------------------------------------ | ------ | +| accountType | false | string | account type, more to see "Account type data dictionary" | +| valuationCurrency | false |string| If not filled, the default is BTC (only BTC supported now, and must be capitalized) | + +> Responds: + +```json +{ + "code": 200, + "data": { + "updated": { + "success": true, + "time": 1629916724000 + }, + "todayProfitRate": "0.004638293764657609", + "totalBalance": "0.06276321", + "todayProfit": "0.00028977", + "profitAccountBalanceList": [ + { + "distributionType": "11", + "balance": 0.05728808, + "success": true, + "accountBalance": "0.05728808" + } + ] + }, + "success": true +} +``` + +### Response Content + +| Parameter | Required | Data Type | Description | +| -------- | -------- | -------- | -------- | +| code | TRUE | int | status code | +| \ | TRUE | object | -------- | +| totalBalance | TRUE | string | total balance | +| todayProfit | TRUE | string | today profit | +| todayProfitRate | TRUE | string | today profit rate | +| \ | TRUE | list | | +| distributionType | TRUE | string | distribution type | +| balance | TRUE | float | balance | +| success | TRUE | boolean | get data successful or not. When fails, the accountBalance and balance are 0 | +| accountBalance | TRUE | string | account balance | +| \ | | | | +| \ | TRUE | list | | +| success | TRUE | boolean | updated today, yes or not | +| time | TRUE | long | updated time | +| \ | | | | +| \ | | | | +| success | TRUE | boolean | | + + +### Account type data dictionary +| code | description | +| ----- |----- | +| 1 | spot | +| 2 | Isolated | +| 3 | cross | +| 4 | coin futures | +| 5 | flat | +| 6 | minepool | +| 7 | coin swaps | +| 8 | investment | +| 9 | borrow | +| 10 | earn | +| 11 | usdt swaps | +| 12 | option | +| 13 | otc-options | +| 14 | crypto-loans | +| 15 | grid-trading | +| 16 | minepool | + ## Get Asset Valuation From eafcad2a274998a7ec509da731100fdf1a9008ad Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Thu, 9 Sep 2021 11:49:22 +0800 Subject: [PATCH 678/759] *update --- source/index.html.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index b9e18a8ba32..1420f913a9e 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -5578,10 +5578,20 @@ Rate Limit (NEW): 20times/2sec
This endpoint only supports order cancellation for those conditional orders which have not triggered yet. To cancel a triggered order, please refer to the endpoints in "Trading" section.
Before a conditional order triggering, it can be only cancelled via this endpoint instead of any endpoint in "Trading" section.
+> Request + +```json +{ + "clientOrderIds": [ + "zy0002","zy0003" + ] +} +``` + ### Request Parameter | Field | Data Type | Mandatory | Default Value| Description | Valid Value | | ----- | ----- | ------ | ---- | ------ | ---- | -| clientOrderIds | string[] | TRUE | | Client order ID (maximum 50 orders are allowed, separated by comma) | | +| clientOrderIds | string[] | TRUE | | Client order ID (maximum 50 orders are allowed, Transfer in the form of as array) | | > Response @@ -5590,7 +5600,8 @@ Before a conditional order triggering, it can be only cancelled via this endpoin "code": 200, "data": { "accepted": [ - "a001" + "zy0002", + "zy0003" ], "rejected": [] } From c521d26cae5923532e234493d9e4525f261529c7 Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Fri, 10 Sep 2021 09:49:42 +0800 Subject: [PATCH 679/759] *update --- source/index.html.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 1420f913a9e..345c81ede98 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -9133,6 +9133,7 @@ Below is the error code and the description from stable coin APIs | exchange-failure | other errors happend in the backend | | Base-user-request-exceed-limit | Operation is too frequently | + + # ETP ## Introduction From 5567ed079a16bf15630573657a9d39d3c2405963 Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Fri, 10 Sep 2021 17:26:05 +0800 Subject: [PATCH 680/759] * Optimized interface example --- source/index.html.md | 3505 +++++++++++++++++++++++++----------------- 1 file changed, 2063 insertions(+), 1442 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 345c81ede98..15aa7eeda88 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1100,12 +1100,14 @@ None. | ----- | --------- | -------- | ----------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | -| data | object | TRUE | | -| { marketStatus | integer | TRUE | Market status (1=normal, 2=halted, 3=cancel-only) | +| \ | object | TRUE | | +| marketStatus | integer | TRUE | Market status (1=normal, 2=halted, 3=cancel-only) | | haltStartTime | long | FALSE | Halt start time (unix time in millisecond) , only valid for marketStatus=halted or cancel-only | | haltEndTime | long | FALSE | Estimated halt end time (unix time in millisecond) , only valid for marketStatus=halted or cancel-only; if this field is not returned during marketStatus=halted or cancel-only, it implicates the halt end time cannot be estimated at this time. | | haltReason | integer | FALSE | Halt reason (2=emergency-maintenance, 3=scheduled-maintenance) , only valid for marketStatus=halted or cancel-only | -| affectedSymbols } | string | FALSE | Affected symbols, separated by comma. If affect all symbols just respond with value ‘all’. Only valid for marketStatus=halted or cancel-only | +| affectedSymbols | string | FALSE | Affected symbols, separated by comma. If affect all symbols just respond with value ‘all’. Only valid for marketStatus=halted or cancel-only | +| \ | | | | + ## Get all Supported Trading Symbol @@ -1117,7 +1119,7 @@ curl "https://api.huobi.pro/v1/common/symbols" ### HTTP Request -`GET /v1/common/symbols` + - GET `/v1/common/symbols` ### Request Parameters @@ -1130,28 +1132,47 @@ No parameter is needed for this endpoint. "status": "ok", "data": [ { - "base-currency": "btc", + "base-currency": "ekt", "quote-currency": "usdt", - "price-precision": 2, - "amount-precision": 6, - "symbol-partition": "main", - "symbol": "btcusdt", + "price-precision": 6, + "amount-precision": 2, + "symbol-partition": "innovation", + "symbol": "ektusdt", "state": "online", "value-precision": 8, - "min-order-amt": 0.0001, - "max-order-amt": 1000, + "min-order-amt": 0.1, + "max-order-amt": 10000000, "min-order-value": 5, - "limit-order-min-order-amt": 0.0001, - "limit-order-max-order-amt": 1000, - "sell-market-min-order-amt": 0.0001, - "sell-market-max-order-amt": 100, - "buy-market-max-order-value": 1000000, - "leverage-ratio": 5, - "super-margin-leverage-ratio": 3, - "funding-leverage-ratio": 3, + "limit-order-min-order-amt": 0.1, + "limit-order-max-order-amt": 10000000, + "limit-order-max-buy-amt": 10000000, + "limit-order-max-sell-amt": 10000000, + "sell-market-min-order-amt": 0.1, + "sell-market-max-order-amt": 1000000, + "buy-market-max-order-value": 200000, "api-trading": "enabled" }, - ...... + { + "base-currency": "snx", + "quote-currency": "husd", + "price-precision": 4, + "amount-precision": 2, + "symbol-partition": "innovation", + "symbol": "snxhusd", + "state": "online", + "value-precision": 8, + "min-order-amt": 0.01, + "max-order-amt": 250000, + "min-order-value": 5, + "limit-order-min-order-amt": 0.01, + "limit-order-max-order-amt": 250000, + "limit-order-max-buy-amt": 250000, + "limit-order-max-sell-amt": 250000, + "sell-market-min-order-amt": 0.01, + "sell-market-max-order-amt": 25000, + "buy-market-max-order-value": 100000, + "api-trading": "enabled" + } ] } ``` @@ -1160,6 +1181,8 @@ No parameter is needed for this endpoint. | Parameter | Required | Data Type | Description | | -------------------------- | -------- | --------- | ------------------------------------------------------------ | +| status | true | string | Request Processing Result("ok","error") | +| \ | true | object | | | base-currency | true | string | Base currency in a trading symbol | | quote-currency | true | string | Quote currency in a trading symbol | | price-precision | true | integer | Quote currency precision when quote price(decimal places)) | @@ -1185,6 +1208,7 @@ No parameter is needed for this endpoint. | rebal-threshold | false | float | The threshold which triggers adhoc position rebalance (evaluated by actual leverage ratio, only valid for ETP symbols) | | init-nav | false | float | Initial NAV (only valid for ETP symbols) | | api-trading | true | string | API trading enabled or not (possible value: enabled, disabled) | +| \ | | | | ## Get all Supported Currencies @@ -1197,7 +1221,7 @@ curl "https://api.huobi.pro/v1/common/currencys" ### HTTP Request -`GET /v1/common/currencys` + - GET `/v1/common/currencys` ### Request Parameters @@ -1206,23 +1230,38 @@ No parameter is needed for this endpoint. > Response: ```json - "data": [ - "usdt", - "eth", - "etc" - ] +{ + "status": "ok", + "data": [ + "usdt", + "btc", + "bch", + "eth", + "xrp", + "ltc", + "ht", + "ada" + ] +} ``` ### Response Content + +| Field Name | Mandatory | Data Type | Description | +| -------------- | -------- | ------- | ---------- | +| status | true | string | Request Processing Result("ok","error") | +| data | true | array | with each string represents a suppported currency | + + ## APIv2 - Currency & Chains API user could query static reference information for each currency, as well as its corresponding chain(s). (Public Endpoint) ### HTTP Request -`GET https://api.huobi.pro/v2/reference/currencies` + - GET `/v2/reference/currencies` ```shell curl "https://api.huobi.pro/v2/reference/currencies?currency=usdt" @@ -1308,7 +1347,7 @@ curl "https://api.huobi.pro/v2/reference/currencies?currency=usdt" "currency":"usdt", "instStatus":"normal" } - ] + ] } ``` @@ -1320,9 +1359,9 @@ curl "https://api.huobi.pro/v2/reference/currencies?currency=usdt" | ----------------------- | --------- | --------- | ------------------------------------------------------------ | ---------------------- | | code | true | int | Status code | | | message | false | string | Error message (if any) | | -| data | true | object | | | -| { currency | true | string | Currency | | -| { chains | true | object | | | +| \ | true | object | | | +| currency | true | string | Currency | | +| \ | true | object | | | | chain | true | string | Chain name | | | displayName | true | string | Chain display name | | | baseChain | false | string | Base chain name | | @@ -1343,8 +1382,11 @@ curl "https://api.huobi.pro/v2/reference/currencies?currency=usdt" | minTransactFeeWithdraw | false | string | Minimal withdraw fee in each request (only applicable to withdrawFeeType = circulated or ratio) | | | maxTransactFeeWithdraw | false | string | Maximum withdraw fee in each request (only applicable to withdrawFeeType = circulated or ratio) | | | transactFeeRateWithdraw | false | string | Withdraw fee in each request (only applicable to withdrawFeeType = ratio) | | -| withdrawStatus} | true | string | Withdraw status | allowed,prohibited | -| instStatus } | true | string | Instrument status | normal,delisted | +| withdrawStatus | true | string | Withdraw status | allowed,prohibited | +| \ | | | | | +| instStatus | true | string | Instrument status | normal,delisted | +| \ | | | | | + ### Status Code @@ -1364,7 +1406,7 @@ curl "https://api.huobi.pro/v1/common/timestamp" ### HTTP Request -`GET /v1/common/timestamp` + - GET `/v1/common/timestamp` ### Request Parameters @@ -1373,12 +1415,19 @@ No parameter is needed for this endpoint. > Response: ```json - "data": 1494900087029 +{ + "status":"ok", + "data":1629715504949 +} ``` ### Response Content -The returned "Data" field contains an integer representing the timestamp in milliseconds adjusted to Singapore time. +| 参数名称 | 是否必须 | 类型 | 描述 | 取值范围 | +| ------ | ------ | ------ | ------ | ------| +| status | true | string | Request Processing Result | +| data | true | long | current system timestamp | + # Market Data @@ -1394,7 +1443,7 @@ This endpoint retrieves all klines in a specific range. ### HTTP Request -`GET https://api.huobi.pro/market/history/kline` + - GET `/market/history/kline` ```shell curl "https://api.huobi.pro/market/history/kline?period=1day&size=200&symbol=btcusdt" @@ -1406,7 +1455,7 @@ curl "https://api.huobi.pro/market/history/kline?period=1day&size=200&symbol=btc | --------- | --------- | -------- | ------- | --------------------------- | ------------------------------------------------------------ | | symbol | string | true | NA | The trading symbol to query | All trading symbol supported, e.g. btcusdt, bccbtcn (to retrieve candlesticks for ETP NAV, symbol = ETP trading symbol + suffix 'nav',for example: btc3lusdtnav) | | period | string | true | NA | The period of each candle | 1min, 5min, 15min, 30min, 60min, 4hour, 1day, 1mon, 1week, 1year | -| size | integer | false | 150 | The number of data returns | [1, 2000] | +| size | integer | false | 150 | The number of data returns | [1-2000] | @@ -1414,24 +1463,43 @@ curl "https://api.huobi.pro/market/history/kline?period=1day&size=200&symbol=btc > The above command returns JSON structured like this: ```json -"data": [ - { - "id": 1499184000, - "amount": 37593.0266, - "count": 0, - "open": 1935.2000, - "close": 1879.0000, - "low": 1856.0000, - "high": 1940.0000, - "vol": 71031537.97866500 - } -] +{ + "ch": "market.btcusdt.kline.5min", + "status": "ok", + "ts": 1629769247172, + "data": [ + { + "id": 1629769200, + "open": 49056.37, + "close": 49025.51, + "low": 49022.86, + "high": 49056.38, + "amount": 3.946281917950917, + "vol": 193489.67275732, + "count": 196 + }, + { + "id": 1629768900, + "open": 48994.61, + "close": 49056.37, + "low": 48966.72, + "high": 49072.46, + "amount": 30.72223099519689, + "vol": 1505870.732227976, + "count": 1504 + } + ] +} ``` ### Response Content | Field | Data Type | Description | | ------ | --------- | -------------------------------------------- | +| status | string | Request Processing Result "ok","error" | +| ch | string | Data belonged channel,Format:market.$symbol.kline.$period | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \ | object | | | id | long | The UNIX timestamp in seconds as response id | | amount | float | Accumulated trading volume, in base currency | | count | integer | The number of completed trades | @@ -1440,6 +1508,8 @@ curl "https://api.huobi.pro/market/history/kline?period=1day&size=200&symbol=btc | low | float | The low price | | high | float | The high price | | vol | float | Accumulated trading value, in quote currency | +| \ | | | + ## Get Latest Aggregated Ticker @@ -1447,7 +1517,7 @@ This endpoint retrieves the latest ticker with some important 24h aggregated mar ### HTTP Request -`GET https://api.huobi.pro/market/detail/merged` + - GET `/market/detail/merged` ```shell curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" @@ -1462,18 +1532,29 @@ curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" > The above command returns JSON structured like this: ```json -"data": { - "id":1499225271, - "ts":1499225271000, - "close":1885.0000, - "open":1960.0000, - "high":1985.0000, - "low":1856.0000, - "amount":81486.2926, - "count":42122, - "vol":157052744.85708200, - "ask":[1885.0000,21.8804], - "bid":[1884.0000,1.6702] +{ + "ch": "market.btcusdt.detail.merged", + "status": "ok", + "ts": 1629788763750, + "tick": { + "id": 272156789143, + "version": 272156789143, + "open": 50080.0, + "close": 49820.92, + "low": 48767.0, + "high": 50500.0, + "amount": 12055.365781937457, + "vol": 5.985618685709001E8, + "count": 420573, + "bid": [ + 49819.48, + 2.58112 + ], + "ask": [ + 49819.49, + 0.002411 + ] + } } ``` @@ -1481,6 +1562,10 @@ curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" | Field | Data Type | Description | | ------ | --------- | ------------------------------------------------------------ | +| status | string | Request Processing Result "ok","error" | +| ch | string | Data belonged channel,Format:market.$symbol.detail.merged | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \ | object | | | id | long | The internal identity | | amount | float | Accumulated trading volume of last 24 hours (rotating 24h), in base currency | | count | integer | The number of completed trades (rotating 24h) | @@ -1491,15 +1576,18 @@ curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" | vol | float | Accumulated trading value of last 24 hours (rotating 24h), in quote currency | | bid | object | The current best bid in format [price, size] | | ask | object | The current best ask in format [price, size] | +| \ | | | + ## Get Latest Tickers for All Pairs This endpoint retrieves the latest tickers for all supported pairs. + ### HTTP Request -`GET https://api.huobi.pro/market/tickers` + - GET `/market/tickers` ```shell curl "https://api.huobi.pro/market/tickers" @@ -1512,36 +1600,40 @@ No parameters are needed for this endpoint. > The above command returns JSON structured like this: ```json -"data": [ - { - "open":0.044297, - "close":0.042178, - "low":0.040110, - "high":0.045255, - "amount":12880.8510, - "count":12838, - "vol":563.0388715740, - "symbol":"ethbtc", - "bid":0.007545, - "bidSize":0.008, - "ask":0.008088, - "askSize":0.009 - }, - { - "open":0.008545, - "close":0.008656, - "low":0.008088, - "high":0.009388, - "amount":88056.1860, - "count":16077, - "vol":771.7975953754, - "symbol":"ltcbtc", - "bid":0.007545, - "bidSize":0.008, - "ask":0.008088, - "askSize":0.009 - } -] +{ + "status":"ok", + "ts":1629789355531, + "data":[ + { + "symbol":"smtusdt", + "open":0.004659, + "high":0.004696, + "low":0.0046, + "close":0.00468, + "amount":36551302.17544405, + "vol":170526.0643855023, + "count":1709, + "bid":0.004651, + "bidSize":54300.341, + "ask":0.004679, + "askSize":1923.4879 + }, + { + "symbol":"ltcht", + "open":12.795626, + "high":12.918053, + "low":12.568926, + "close":12.918053, + "amount":1131.801675005825, + "vol":14506.9381937385, + "count":923, + "bid":12.912687, + "bidSize":0.1068, + "ask":12.927032, + "askSize":5.3228 + } + ] +} ``` ### Response Content @@ -1550,6 +1642,9 @@ Response content is an array of object, each object has below fields. | Field | Data Type | Description | | ------- | --------- | ------------------------------------------------------------ | +| status | string | Request Processing Result "ok","error" | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \ | object | | | amount | float | The aggregated trading volume in last 24 hours (rotating 24h) | | count | integer | The number of completed trades of last 24 hours (rotating 24h) | | open | float | The opening price of a nature day (Singapore time) | @@ -1562,6 +1657,8 @@ Response content is an array of object, each object has below fields. | bidSize | float | Best bid size | | ask | float | Best ask price | | askSize | float | Best ask size | +| \ | | | + ## Get Market Depth @@ -1569,10 +1666,10 @@ This endpoint retrieves the current order book of a specific pair. ### HTTP Request -`GET https://api.huobi.pro/market/depth` + - GET `/market/depth` ```shell -curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" +curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step0" ``` ### Request Parameters @@ -1598,66 +1695,76 @@ curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" > The above command returns JSON structured like this: ```json -"tick": { - "version": 31615842081, - "ts": 1489464585407, - "bids": [ - [7964, 0.0678], - [7963, 0.9162], - [7961, 0.1], - [7960, 12.8898], - [7958, 1.2], - [7955, 2.1009], - [7954, 0.4708], - [7953, 0.0564], - [7951, 2.8031], - [7950, 13.7785], - [7949, 0.125], - [7948, 4], - [7942, 0.4337], - [7940, 6.1612], - [7936, 0.02], - [7935, 1.3575], - [7933, 2.002], - [7932, 1.3449], - [7930, 10.2974], - [7929, 3.2226] - ], - "asks": [ - [7979, 0.0736], - [7980, 1.0292], - [7981, 5.5652], - [7986, 0.2416], - [7990, 1.9970], - [7995, 0.88], - [7996, 0.0212], - [8000, 9.2609], - [8002, 0.02], - [8008, 1], - [8010, 0.8735], - [8011, 2.36], - [8012, 0.02], - [8014, 0.1067], - [8015, 12.9118], - [8016, 2.5206], - [8017, 0.0166], - [8018, 1.3218], - [8019, 0.01], - [8020, 13.6584] - ] - } +{ + "ch": "market.btcusdt.depth.step0", + "status": "ok", + "ts": 1629790438801, + "tick": { + "ts": 1629790438215, + "version": 136107114472, + "bids": [ + [ + 49790.87, + 0.779876 + ], + [ + 49785.9, + 1.82E-4 + ], + [ + 49784.48, + 0.002758 + ], + [ + 49784.29, + 0.05 + ], + [ + 49783.06, + 0.005038 + ] + ], + "asks": [ + [ + 49790.88, + 2.980472 + ], + [ + 49790.89, + 0.006613 + ], + [ + 49792.16, + 0.080302 + ], + [ + 49792.67, + 0.030112 + ], + [ + 49793.23, + 0.043103 + ] + ] + } +} ``` ### Response Content + | Field | Data Type | Description | | ------- | --------- | ------------------------------------------------------------ | +| status | string | Request Processing Result "ok","error" | +| ch | string | Data belonged channel,Format: market.$symbol.depth.$type | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \ | object | | | ts | integer | The UNIX timestamp in milliseconds is adjusted to Singapore time | | version | integer | Internal data | | bids | object | The current all bids in format [price, size] | | asks | object | The current all asks in format [price, size] | - +| \ | | | ## Get the Last Trade @@ -1665,7 +1772,7 @@ This endpoint retrieves the latest trade with its price, volume, and direction. ### HTTP Request -`GET https://api.huobi.pro/market/trade` + - GET `/market/trade` ```shell curl "https://api.huobi.pro/market/trade?symbol=ethusdt" @@ -1680,33 +1787,57 @@ curl "https://api.huobi.pro/market/trade?symbol=ethusdt" > The above command returns JSON structured like this: ```json -"tick": { - "id": 600848670, - "ts": 1489464451000, - "data": [ - { - "id": 600848670, - "trade-id": 102043494568, - "price": 7962.62, - "amount": 0.0122, - "direction": "buy", - "ts": 1489464451000 - } - ] +{ + "ch": "market.btcusdt.trade.detail", + "status": "ok", + "ts": 1629792192037, + "tick": { + "id": 136107843051, + "ts": 1629792191928, + "data": [ + { + "id": 136107843051348400221001656, + "ts": 1629792191928, + "trade-id": 102517374388, + "amount": 0.028416, + "price": 49806.0, + "direction": "buy" + }, + { + "id": 136107843051348400229813302, + "ts": 1629792191928, + "trade-id": 102517374387, + "amount": 0.025794, + "price": 49806.0, + "direction": "buy" + } + ] + } } ``` ### Response Content + | Parameter | Data Type | Description | | --------- | --------- | ------------------------------------------------------------ | +| status | string | Request Processing Result "ok","error" | +| ch | string | Data belonged channel,Format:market.$symbol.trade.detail | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \ | object | | +| id | long | global transaction ID | +| ts | long | Latest Creation Time | +| \ | object | | | id | integer | The unique trade id of this trade (to be obsoleted) | | trade-id | integer | The unique trade id (NEW) | | amount | float | The trading volume in base currency | | price | float | The trading price in quote currency | | ts | integer | The UNIX timestamp in milliseconds adjusted to Singapore time | | direction | string | The direction of the taker trade: 'buy' or 'sell' | +| \ | | | +| \ | | | + ## Get the Most Recent Trades @@ -1714,7 +1845,7 @@ This endpoint retrieves the most recent trades with their price, volume, and dir ### HTTP Request -`GET https://api.huobi.pro/market/history/trade` + - GET `/market/history/trade` ```shell curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" @@ -1725,62 +1856,78 @@ curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" | Parameter | Data Type | Required | Default Value | Description | Value Range | | --------- | --------- | -------- | ------------- | --------------------------- | ------------------------------------------------------------ | | symbol | string | true | NA | The trading symbol to query | All supported trading symbol, e.g. btcusdt, bccbtc.Refer to `GET /v1/common/symbols` | -| size | integer | false | 1 | The number of data returns | [1, 2000] | +| size | integer | false | 1 | The number of data returns | [1-2000] | > The above command returns JSON structured like this: ```json -"data": [ - { - "id":31618787514, - "ts":1544390317905, - "data":[ - { - "amount":9.000000000000000000, - "ts":1544390317905, - "id":3161878751418918529341, - "trade-id": 102043495672, - "price":94.690000000000000000, - "direction":"sell" - }, - { - "amount":73.771000000000000000, - "ts":1544390317905, - "id":3161878751418918532514, - "trade-id": 102043495673, - "price":94.660000000000000000, - "direction":"sell" - } - ] - }, - { - "id":31618776989, - "ts":1544390311353, - "data":[ - { - "amount":1.000000000000000000, - "ts":1544390311353, - "id":3161877698918918522622, - "trade-id": 102043495674, - "price":94.710000000000000000, - "direction":"buy" - } - ] - } +{ + "ch": "market.btcusdt.trade.detail", + "status": "ok", + "ts": 1629793657842, + "data": [ + { + "id": 136108764379, + "ts": 1629793656939, + "data": [ + { + "id": 136108764379348400430265987, + "ts": 1629793656939, + "trade-id": 102517381182, + "amount": 1.24E-4, + "price": 49656.4, + "direction": "buy" + } + ] + }, + { + "id": 136108763320, + "ts": 1629793656198, + "data": [ + { + "id": 136108763320348400439066863, + "ts": 1629793656198, + "trade-id": 102517381181, + "amount": 0.01125, + "price": 49655.0, + "direction": "buy" + }, + { + "id": 136108763320348400429773626, + "ts": 1629793656198, + "trade-id": 102517381180, + "amount": 8.3E-4, + "price": 49651.35, + "direction": "buy" + } + ] + } + ] } ``` ### Response Content + | Field | Data Type | Description | | --------- | --------- | ------------------------------------------------------------ | +| status | string | Request Processing Result "ok","error" | +| ch | string | Data belonged channel,Format:market.$symbol.trade.detail | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \ | object | | +| id | long | global transaction ID | +| ts | long | Latest Creation Time | +| \ | object | | | id | integer | The unique trade id of this trade (to be obsoleted) | | trade-id | integer | The unique trade id (NEW) | | amount | float | The trading volume in base currency | | price | float | The trading price in quote currency | | ts | integer | The UNIX timestamp in milliseconds adjusted to Singapore time | | direction | string | The direction of the taker trade: 'buy' or 'sell' | +| \ | | | +| \ | | | + ## Get the Last 24h Market Summary @@ -1790,7 +1937,7 @@ This endpoint retrieves the summary of trading in the market for the last 24 hou ### HTTP Request -`GET https://api.huobi.pro/market/detail/` + - GET `/market/detail/` ```shell curl "https://api.huobi.pro/market/detail?symbol=ethusdt" @@ -1805,24 +1952,34 @@ curl "https://api.huobi.pro/market/detail?symbol=ethusdt" > The above command returns JSON structured like this: ```json -"tick": { - "amount":613071.438479561, - "open":86.21, - "close":94.35, - "high":98.7, - "id":31619471534, - "count":138909, - "low":84.63, - "version":31619471534, - "vol":5.6617373443873316E7 +{ + "ch": "market.btcusdt.detail", + "status": "ok", + "ts": 1629795484817, + "tick": { + "id": 272164011416, + "low": 48767.0, + "high": 50500.0, + "open": 50266.89, + "close": 49728.71, + "vol": 6.010379336834868E8, + "amount": 12110.642402972368, + "version": 272164011416, + "count": 420452 + } } ``` ### Response Content + | Field | Data Type | Description | | ------- | --------- | ------------------------------------------------------------ | +| status | string | Request Processing Result "ok","error" | +| ch | string | Data belonged channel,Format: market.$symbol.detail | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \ | object | | | id | integer | The internal identity | | amount | float | The aggregated trading volume in USDT of last 24 hours (rotating 24h) | | count | integer | The number of completed trades of last 24 hours (rotating 24h) | @@ -1832,6 +1989,8 @@ curl "https://api.huobi.pro/market/detail?symbol=ethusdt" | high | float | The highest price of last 24 hours (rotating 24h) | | vol | float | The trading volume in base currency of last 24 hours (rotating 24h) | | version | integer | Internal data | +| \ | | | + ## Get real time NAV @@ -1882,14 +2041,21 @@ curl "https://api.huobi.pro/market/etp?symbol=btc3lusdt" | Field Name | Data Type | Description | | -------------- | --------- | -------------------------------------- | +| status | string | Request Processing Result "ok","error" | +| ch | string | Data belonged channel,Format:market.$symbol.etp | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \ | object | | | symbol | string | ETP trading symbol | | nav | float | Latest NAV | | navTime | long | Update time (unix time in millisecond) | | outstanding | float | Outstanding shares | -| basket | object | Basket | -| { currency | float | Currency | -| amount } | float | Amount | +| \ | object | Basket | +| currency | float | Currency | +| amount | float | Amount | +| \ | | | | actualLeverage | float | Actual leverage ratio | +| \ | | | + ## Error Code @@ -1905,6 +2071,7 @@ Below is the error code, error message and description returned by Market data A | invalid-parameter | invalid size,valid range: [1, 2000] | Parameter size range is invalid | | invalid-parameter | request timeout | Request timeout please try again | + # Account ## Introduction @@ -1922,36 +2089,51 @@ This endpoint returns a list of accounts owned by this API user. ### HTTP Request -`GET https://api.huobi.pro/v1/account/accounts` - -```shell -curl "https://api.huobi.pro/v1/account/accounts" -``` + - GET `/v1/account/accounts` ### Request Parameters + > The above command returns JSON structured like this: ```json - "data": [ - { - "id": 100009, - "type": "spot", - "subtype": "", - "state": "working" - } - ] +{ + "status": "ok", + "data": [ + { + "id": 10000001, + "type": "spot", + "subtype": "", + "state": "working" + }, + { + "id": 10000002, + "type": "otc", + "subtype": "", + "state": "working" + }, + { + "id": 10000003, + "type": "point", + "subtype": "", + "state": "working" + } + ] +} ``` ### Response Content | Field | Data Type | Description | Value Range | | ------- | --------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| status | true | string | Request Processing Result | "ok","error" | +| \ | true | object | | | | id | integer | Unique account id | NA | | state | string | Account state | working, lock | | type | string | The type of this account | spot, margin, otc, point, super-margin, investment, borrow | | subtype | string | The type of sub account (applicable only for isolated margin accout) | The corresponding trading symbol (currency pair) the isolated margin is based on, e.g. btcusdt | +| \ | true | object | | | @@ -1964,45 +2146,44 @@ This endpoint returns the balance of an account specified by account id. ### HTTP Request -`GET https://api.huobi.pro/v1/account/accounts/{account-id}/balance` + - GET `/v1/account/accounts/{account-id}/balance` 'account-id': The specified account id to get balance for, can be found by query '/v1/account/accounts' endpoint. -```shell -curl "https://api.huobi.pro/v1/account/accounts/100009/balance" -``` - ### Request Parameters + > The above command returns JSON structured like this: ```json -"data": { - "id": 100009, - "type": "spot", - "state": "working", - "list": [ - { - "currency": "usdt", - "type": "trade", - "seq-num": "86872993928", - "balance": "500009195917.4362872650" - }, - { - "currency": "usdt", - "type": "frozen", - "seq-num": "86872993928", - "balance": "328048.1199920000" - }, - { - "currency": "etc", - "type": "trade", - "seq-num": "86872993928", - "balance": "499999894616.1302471000" - } - ], - } +{ + "status": "ok", + "data": { + "id": 1000001, + "type": "spot", + "state": "working", + "list": [ + { + "currency": "usdt", + "type": "trade", + "balance": "91.850043797676510303", + "seq-num": "477" + }, + { + "currency": "usdt", + "type": "frozen", + "balance": "5.160000000000000015", + "seq-num": "477" + }, + { + "currency": "poly", + "type": "trade", + "balance": "147.928994082840236", + "seq-num": "2" + } + ] + } } ``` @@ -2010,19 +2191,18 @@ curl "https://api.huobi.pro/v1/account/accounts/100009/balance" | Field | Data Type | Description | Value Range | | ----- | --------- | ------------------------------------ | ---------------------------------------------------------- | +| status | string | Request Processing Result | "ok","error" | +| \ | object | | | | id | integer | Unique account id | NA | | state | string | Account state | working, lock | | type | string | The type of this account | spot, margin, otc, point, super-margin, investment, borrow | -| list | object | The balance details of each currency | | - -**Per list item content** - -| Field | Data Type | Description | Value Range | -| -------- | --------- | ------------------------------------- | ------------- | +| \ | Array | | | currency | string | The currency of this balance | NA | -| type | string | The balance type | trade, frozen | +| type | string | The balance type | trade,frozen, loan, interest, lock, bank | | balance | string | The balance in the main currency unit | NA | | seq-num | string | Serial Number of Account Change | NA | +| \ | | | | +| \ | | | | ## Get The Total Valuation of Platform Assets @@ -2151,8 +2331,12 @@ This endpoint returns the valuation of the total assets of the account in btc or | Parameter | Required | Data Type | Description | | --------- | -------- | --------- | ---------------------------------------------------- | +| code | true | string | status code | +| ok | true | string | | +| \ | true | object | | | balance | true | string | The valuation according to the certain fiat currency | | timestamp | true | long | Return time | +| \ | | | | ## Asset Transfer @@ -2209,9 +2393,10 @@ Other transfer functions will be gradually launched later, please take note on A | Field | Required | Data Type | Description | Values | | -------------- | -------- | --------- | -------------- | --------------- | | status | true | string | Request status | "ok" or "error" | -| data | true | list | | | -| {transact-id | true | int | Transfer id | | -| transact-time} | true | long | Transfer time | | +| \ | true | list | | | +| transact-id | true | int | Transfer id | | +| transact-time | true | long | Transfer time | | +| \ | | | | | ## Get Account History @@ -2223,7 +2408,7 @@ This endpoint returns the amount changes of a specified user's account. ### HTTP Request -`GET https://api.huobi.pro/v1/account/history` + - GET `/v1/account/history` ```shell curl "https://api.huobi.pro/v1/account/history?account-id=5260185" @@ -2239,7 +2424,7 @@ curl "https://api.huobi.pro/v1/account/history?account-id=5260185" | start-time | false | long | The start time of the query window (unix time in millisecond). Searching based on transact-time. The maximum size of the query window is 1 hour. The query window can be shifted within 30 days. | ((end-time) – 1hour) | [((end-time) – 1hour), (end-time)] | | end-time | false | long | The end time of the query window (unix time in millisecond). Searching based on transact-time. The maximum size of the query window is 1 hour. The query window can be shifted within 30 days. | current-time | [(current-time) – 29days,(current-time)] | | sort | false | string | Sorting order | asc | asc or desc | -| size | false | int | Maximum number of items in each response | 100 | [1,500] | +| size | false | int | Maximum number of items in each response | 100 | [1-500] | | from-id | false | long | First record ID in this query (only valid for next page querying, see Note 2) | | | > The above command returns JSON structured like this: @@ -2249,26 +2434,27 @@ curl "https://api.huobi.pro/v1/account/history?account-id=5260185" "status": "ok", "data": [ { - "account-id": 5260185, - "currency": "btc", - "transact-amt": "0.002393000000000000", - "transact-type": "transfer", - "record-id": 89373333576, - "avail-balance": "0.002393000000000000", - "acct-balance": "0.002393000000000000", - "transact-time": 1571393524526 + "account-id": 10000001, + "currency": "usdt", + "record-id": 359044707902783794, + "transact-amt": "-10.000000000000000000", + "transact-type": "other-types", + "avail-balance": "81.850043797676510303", + "acct-balance": "97.010043797676510318", + "transact-time": 1629882096557 }, { - "account-id": 5260185, - "currency": "btc", - "transact-amt": "-0.002393000000000000", + "account-id": 10000001, + "currency": "usdt", + "record-id": 359044690723242123, + "transact-amt": "-10.000000000000000000", "transact-type": "transfer", - "record-id": 89373382631, - "avail-balance": "0E-18", - "acct-balance": "0E-18", - "transact-time": 1571393578496 + "avail-balance": "81.850043797676510303", + "acct-balance": "87.010043797676510318", + "transact-time": 1629882096569 } - ] + ], + "next-id": 47996522235 } ``` @@ -2277,17 +2463,19 @@ curl "https://api.huobi.pro/v1/account/history?account-id=5260185" | Field | Data Type | Description | Value Range | | ------------- | --------- | ------------------------------------------------------------ | ----------- | | status | string | Status code | | -| data | object | | | -| { account-id | long | Account ID | | +| \ | object | | | +| account-id | long | Account ID | | | currency | string | Currency | | | transact-amt | string | Amount change (positive value if income, negative value if outcome) | | | transact-type | string | Amount change types | | | avail-balance | string | Available balance | | | acct-balance | string | Account balance | | | transact-time | long | Transaction time (database time) | | -| record-id } | long | Unique record ID in the database | | +| record-id | long | Unique record ID in the database | | +| \ | | | | | next-id | long | First record ID in next page (only valid if exceeded page size, see Note 2) | | + Note 1:
- If ‘transact-type’ is shown as ‘rebate’, it implicates a paid maker rebate.
@@ -2595,6 +2783,7 @@ Change type contains a detailed list of account types: | other-types | operation-to-super-margin-trade | 运营账户转到用户账户-全仓杠杆账户 | | other-types | super-margin-trade-to-operation | 用户账户-全仓杠杆账户转到运营账户 | + ## Get Account Ledger API Key Permission:Read @@ -2608,11 +2797,7 @@ The query window can be within the last 180 days, which means, by adjusting "sta ### HTTP Request -`GET https://api.huobi.pro/v2/account/ledger` - -```shell -curl "https://api.huobi.pro/v2/account/ledger?account-id=5260185" -``` + - GET `/v2/account/ledger` ### Request Parameters @@ -2624,7 +2809,7 @@ curl "https://api.huobi.pro/v2/account/ledger?account-id=5260185" | startTime | long | FALSE | Farthest time (please refer to note 1 for valid range and default value) | | endTime | long | FALSE | Nearest time (please refer to note 2 for valid range and default value) | | sort | string | FALSE | Sorting order (enumerated values: asc, desc) | -| limit | int | FALSE | Maximum number of items in one page (valid range:[1,500]; default value:100) | +| limit | int | FALSE | Maximum number of items in one page (valid range:[1-500]; default value:100) | | fromId | long | FALSE | First record ID in this query (only valid for next page querying. please refer to note 3) | Note 1:
@@ -2639,32 +2824,34 @@ endTime default value: current time ```json { -"code": 200, -"message": "success", -"data": [ - { - "accountId": 5260185, - "currency": "btc", - "transactAmt": 1.000000000000000000, - "transactType": "transfer", - "transferType": "margin-transfer-out", - "transactId": 0, - "transactTime": 1585573286913, - "transferer": 5463409, - "transferee": 5260185 - }, - { - "accountId": 5260185, - "currency": "btc", - "transactAmt": -1.000000000000000000, - "transactType": "transfer", - "transferType": "margin-transfer-in", - "transactId": 0, - "transactTime": 1585573281160, - "transferer": 5260185, - "transferee": 5463409 - } -] + "code": 200, + "message": "success", + "data": [ + { + "accountId": 10000001, + "currency": "usdt", + "transactAmt": 10.000000000000000000, + "transactType": "transfer", + "transferType": "margin-transfer-out", + "transactId": 0, + "transactTime": 1629882331066, + "transferer": 28483123, + "transferee": 13496526 + }, + { + "accountId": 10000001, + "currency": "usdt", + "transactAmt": -10.000000000000000000, + "transactType": "transfer", + "transferType": "margin-transfer-in", + "transactId": 0, + "transactTime": 1629882096562, + "transferer": 13496526, + "transferee": 28483123 + } + ], + "nextId": 1624316679, + "ok": true } ``` @@ -2674,8 +2861,8 @@ endTime default value: current time | ------------ | --------- | --------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | code | integer | TRUE | Status code | | | message | string | FALSE | Error message (if any) | | -| data | object | TRUE | Sorting as user defined (in request parameter "sort" ) | | -| { accountId | integer | TRUE | Account ID | | +| \ | object | TRUE | Sorting as user defined (in request parameter "sort" ) | | +| accountId | integer | TRUE | Account ID | | | currency | string | TRUE | Cryptocurrency | | | transactAmt | number | TRUE | Transaction amount (income positive, expenditure negative) | | | transactType | string | TRUE | Transaction type | | @@ -2684,6 +2871,7 @@ endTime default value: current time | transactTime | integer | TRUE | Transaction time | | | transferer | integer | FALSE | Transferer’s account ID | | | transferee } | integer | FALSE | Transferee’s account ID | | +| \ | | | | | nextId | integer | FALSE | First record ID in next page (only valid if exceeded page size. please refer to note 3.) | | Note 3:
@@ -2704,14 +2892,16 @@ Transferring from a spot account to a contract account, the type is pro-to-futur ### HTTP Request -`POST /v1/futures/transfer` + - POST `/v1/futures/transfer` + +> Request ```json - {"currency": "btc", - "amount": 0.01, +{ + "currency": "btc", + "amount": 0.001, "type": "pro-to-futures" - } - +} ``` ### Request Parameters @@ -2724,10 +2914,19 @@ Transferring from a spot account to a contract account, the type is pro-to-futur > Response: ```json - {"data": 123456, + +{ + "data": 12345, "status": "ok" - } - +} + +> Error response: +{ + "status": "error", + "data": null, + "err-code": "base-msg", + "err-msg": "Insufficient amount available." +} ``` ### Response Content @@ -2791,7 +2990,7 @@ Callable by sub user
### HTTP Request -`GET /v2/point/account` + - GET `/v2/point/account` ### Request Parameters @@ -2819,20 +3018,23 @@ Callable by sub user
"success": true } ``` + ### Response Content | Field | Data Type | Mandatory | Description | | ----- | -------- | -------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | -| data | object | TRUE | | -| { accountId | string | TRUE | Account ID | +| \ | object | TRUE | | +| accountId | string | TRUE | Account ID | | accountStatus | string | TRUE | Account status (working, lock, fl-sys, fl-mgt, fl-end, fl-negative) | | acctBalance | string | TRUE | Account balance | -| groupIds | object | TRUE | Group ID list | -| { groupId | long | TRUE | Group ID | +| \ | object | TRUE | Group ID list | +| groupId | long | TRUE | Group ID | | expiryDate | long | TRUE | Expiration date (unix time in millisecond) | -| remainAmt }} | string | TRUE | Remaining amount | +| remainAmt | string | TRUE | Remaining amount | +| \ | | | | +| \ | | | | Note:
Group ID is the transaction ID generated while parent user exchanging the ‘terminable’ points.
@@ -2853,7 +3055,7 @@ Callable by sub user
### HTTP Request -`POST /v2/point/transfer` + - POST `/v2/point/transfer` ### Request Parameters @@ -2885,9 +3087,10 @@ Note:
| ----- | -------- | -------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | -| data | object | TRUE | | -| { transactId | string | TRUE | Transaction ID | -| transactTime } | long | TRUE | Transaction time (unix time in millisecond) | +| \ | object | TRUE | | +| transactId | string | TRUE | Transaction ID | +| transactTime | long | TRUE | Transaction time (unix time in millisecond) | +| \ | | | ## Error Code @@ -2924,11 +3127,7 @@ Rate Limit (NEW): 20times/2s ### HTTP Request -`GET https://api.huobi.pro/v2/account/deposit/address` - -```shell -curl "https://api.huobi.pro/v2/account/deposit/address?currency=btc" -``` + - GET `/v2/account/deposit/address` ### Request Parameters @@ -2943,10 +3142,25 @@ curl "https://api.huobi.pro/v2/account/deposit/address?currency=btc" "code": 200, "data": [ { + "userId": 12345678, "currency": "btc", - "address": "1PSRjPg53cX7hMRYAXGJnL8mqHtzmQgPUs", + "address": "0xd476b0d77583fbda5180039f1f513b750cb4f527", + "addressTag": "", + "chain": "hbtc" + }, + { + "userId": 12345678, + "currency": "btc", + "address": "16egzDeZiVDJ4D44UbWKN6snLYFjS1aEmJ", "addressTag": "", "chain": "btc" + }, + { + "userId": 12345678, + "currency": "btc", + "address": "0xd476b0d77583fbda5180039f1f513b750cb4f527", + "addressTag": "", + "chain": "hrc20btc" } ] } @@ -2958,11 +3172,13 @@ curl "https://api.huobi.pro/v2/account/deposit/address?currency=btc" | ---------- | --------- | ---------------------- | | code | int | Status code | | message | string | Error message (if any) | -| data | object | | -| { currency | string | Crypto currency | +| \ | object | | +| currency | string | Crypto currency | | address | string | Deposit address | | addressTag | string | Deposit address tag | -| chain } | string | Block chain name | +| chain | string | Block chain name | +| \ | | | | + ## Query Withdraw Quota @@ -2973,11 +3189,8 @@ Rate Limit (NEW): 20times/2s ### HTTP Request -`GET https://api.huobi.pro/v2/account/withdraw/quota` + - GET `/v2/account/withdraw/quota` -```shell -curl "https://api.huobi.pro/v2/account/withdraw/quota?currency=btc" -``` ### Request Parameters @@ -2990,22 +3203,51 @@ curl "https://api.huobi.pro/v2/account/withdraw/quota?currency=btc" ```json { "code": 200, - "data": - { - "currency": "btc", - "chains": [ - { - "chain": "btc", - "maxWithdrawAmt": "200.00000000", - "withdrawQuotaPerDay": "200.00000000", - "remainWithdrawQuotaPerDay": "200.000000000000000000", - "withdrawQuotaPerYear": "700000.00000000", - "remainWithdrawQuotaPerYear": "700000.000000000000000000", - "withdrawQuotaTotal": "7000000.00000000", - "remainWithdrawQuotaTotal": "7000000.000000000000000000" - } - } - ] + "data": { + "currency": "usdt", + "chains": [ + { + "chain": "hrc20usdt", + "maxWithdrawAmt": "2000000.000000000000000000", + "withdrawQuotaPerDay": "4845303.99999991", + "remainWithdrawQuotaPerDay": "4845303.99999991", + "withdrawQuotaPerYear": "-1", + "remainWithdrawQuotaPerYear": "-1", + "withdrawQuotaTotal": "-1", + "remainWithdrawQuotaTotal": "-1" + }, + { + "chain": "trc20usdt", + "maxWithdrawAmt": "1000000.000000000000000000", + "withdrawQuotaPerDay": "4845303.99999991", + "remainWithdrawQuotaPerDay": "4845303.99999991", + "withdrawQuotaPerYear": "-1", + "remainWithdrawQuotaPerYear": "-1", + "withdrawQuotaTotal": "-1", + "remainWithdrawQuotaTotal": "-1" + }, + { + "chain": "usdt", + "maxWithdrawAmt": "600000.000000000000000000", + "withdrawQuotaPerDay": "4845303.99999991", + "remainWithdrawQuotaPerDay": "4845303.99999991", + "withdrawQuotaPerYear": "-1", + "remainWithdrawQuotaPerYear": "-1", + "withdrawQuotaTotal": "-1", + "remainWithdrawQuotaTotal": "-1" + }, + { + "chain": "usdterc20", + "maxWithdrawAmt": "1000000.000000000000000000", + "withdrawQuotaPerDay": "4845303.99999991", + "remainWithdrawQuotaPerDay": "4845303.99999991", + "withdrawQuotaPerYear": "-1", + "remainWithdrawQuotaPerYear": "-1", + "withdrawQuotaTotal": "-1", + "remainWithdrawQuotaTotal": "-1" + } + ] + } } ``` @@ -3015,17 +3257,19 @@ curl "https://api.huobi.pro/v2/account/withdraw/quota?currency=btc" | -------------------------- | --------- | --------------------------------------- | | code | int | Status code | | message | string | Error message (if any) | -| data | object | | +| \ | object | | | currency | string | Crypto currency | -| chains | object | | -| { chain | string | Block chain name | +| \ | object | | +| chain | string | Block chain name | | maxWithdrawAmt | string | Maximum withdraw amount in each request | | withdrawQuotaPerDay | string | Maximum withdraw amount in a day | | remainWithdrawQuotaPerDay | string | Remaining withdraw quota in the day | | withdrawQuotaPerYear | string | Maximum withdraw amount in a year | | remainWithdrawQuotaPerYear | string | Remaining withdraw quota in the year | | withdrawQuotaTotal | string | Maximum withdraw amount in total | -| remainWithdrawQuotaTotal } | string | Remaining withdraw quota in total | +| remainWithdrawQuotaTotal | string | Remaining withdraw quota in total | +| \ | | | | | +| \ | | | | | ## Query withdraw address @@ -3046,7 +3290,7 @@ This endpoint allows parent user to query withdraw address available for API key | currency | true | string | Crypto currency | | btc, ltc, bch, eth, etc ...(refer to GET /v1/common/currencys) | | chain | false | string | Block chain name | When chain is not specified, the reponse would include the records of ALL chains. | | | note | false | string | The note of withdraw address | When note is not specified, the reponse would include the records of ALL notes. | | -| limit | false | int | The number of items to return | 100 | [1,500] | +| limit | false | int | The number of items to return | 100 | [1-500] | | fromId | false | long | First record ID in this query (only valid for next page querying; please refer to note) | NA | | > Response: @@ -3056,12 +3300,13 @@ This endpoint allows parent user to query withdraw address available for API key "data": [ { "currency": "usdt", - "chain": "usdt", - "note": "币安", + "chain": "hrc20usdt", + "note": "tom", "addressTag": "", - "address": "15PrEcqTJRn4haLeby3gJJebtyf4KgWmSd" + "address": "0x3b994f25c4c25e99d4d26364ffc014cce64600ca" } - ] + ], + "next-id": 30137790 } ``` @@ -3070,12 +3315,13 @@ This endpoint allows parent user to query withdraw address available for API key | ----------- | --------- | --------- | ------------------------------------------------------------ | ----------- | | code | true | int | Status code | | | message | false | string | Error message (if any) | | -| data | true | object | | | -| [{ currency | true | string | Crypto currency | | +| \ | true | object | | | +| currency | true | string | Crypto currency | | | chain | true | string | Block chain name | | | note | true | string | The address note | | | addressTag | false | string | The address tag,if any | | | address }] | true | string | Withdraw address | | +| \ | | | | | nextId | false | long | First record ID in next page (only valid if exceeded page size) | | Note:
@@ -3097,16 +3343,17 @@ Parent user creates a withdraw request from spot account to an external address ### HTTP Request -`POST https://api.huobi.pro/v1/dw/withdraw/api/create` + - POST `/v1/dw/withdraw/api/create` -```shell -curl -X POST -H "Content-Type: application/json" "https://api.huobi.pro/v1/dw/withdraw/api/create" -d -'{ +> Request: + +```json +{ "address": "0xde709f2102306220921060314715629080e2fb77", "amount": "0.05", "currency": "eth", "fee": "0.01" -}' +} ``` ### Request Parameters @@ -3131,6 +3378,7 @@ curl -X POST -H "Content-Type: application/json" "https://api.huobi.pro/v1/dw/wi ### Response Content + | Field | Data Type | Description | | ----- | --------- | ----------- | | data | integer | Transfer id | @@ -3146,26 +3394,26 @@ Parent user cancels a previously created withdrawal request by its transfer id. ### HTTP Request -`POST https://api.huobi.pro/v1/dw/withdraw-virtual/{withdraw-id}/cancel` - -```shell -curl -X POST "https://api.huobi.pro/v1/dw/withdraw-virtual/1000/cancel" -``` + - POST `/v1/dw/withdraw-virtual/{withdraw-id}/cancel` 'withdraw-id': the id returned when previously created a withdraw request ### Request Parameters + > The above command returns JSON structured like this: ```json +{ "data": 700 +} ``` ### Response Content + | Parameter | Data Type | Description | | --------- | --------- | ------------------ | | data | integer | Withdraw cancel id | @@ -3180,11 +3428,7 @@ Parent user and sub user search for all existed withdraws and deposits and retur ### HTTP Request -`GET https://api.huobi.pro/v1/query/deposit-withdraw` - -```shell -curl "https://api.huobi.pro/v1/query/deposit-withdraw?currency=xrp&type=deposit&from=5&size=12" -``` + - GET `/v1/query/deposit-withdraw` ### Request Parameters @@ -3193,28 +3437,48 @@ curl "https://api.huobi.pro/v1/query/deposit-withdraw?currency=xrp&type=deposit& | currency | string | false | The crypto currency to withdraw | NA | When currency is not specified, the response would include the records of ALL currencies. | | | type | string | true | Define transfer type to search | | deposit, withdraw, sub user can only use deposit | | | from | string | false | The transfer id to begin search | 1 ~ latest record ID | When 'from' is not specified, the default value would be 1 if 'direct' is 'prev' with the response in ascending order, the default value would be the ID of latest record if 'direct' is 'next' with the response in descending order. | | -| size | string | false | The number of items to return | 1-500 | 100 | | +| size | string | false | The number of items to return | [1-500] | 100 | | | direct | string | false | the order of response | 'prev' (ascending), 'next' (descending) | 'prev' | | > The above command returns JSON structured like this: ```json { - "status": "ok", - "data": [{ - "id": 24383070, - "type": "deposit", - "currency": "usdt", - "chain": "usdterc20", - "tx-hash": "16382690", - "amount": 4.000000000000000000, - "address": "0x138d709030b4e096044d371a27efc5c562889b9b", - "address-tag": "", - "fee": 0, - "state": "safe", - "created-at": 1571303815800, - "updated-at": 1571303815826 - }] + "status":"ok", + "data":[ + { + "id":45182894, + "type":"withdraw", + "sub-type":"FAST", + "currency":"usdt", + "chain":"trc20usdt", + "tx-hash":"", + "amount":400, + "from-addr-tag":"", + "address":"TRwkUYHWgUh23jbKpgTcYHgE9CcBzhGno9", + "address-tag":"", + "fee":0, + "state":"confirmed", + "created-at":1612261330443, + "updated-at":1612261389250 + }, + { + "id":61003926, + "type":"withdraw", + "sub-type":"FAST", + "currency":"usdt", + "chain":"trc20usdt", + "tx-hash":"", + "amount":2, + "from-addr-tag":"", + "address":"TYGvZSD1duPctGaMPSP12Fy8BrQMu2KCdp", + "address-tag":"", + "fee":0, + "state":"confirmed", + "created-at":1621416907639, + "updated-at":1621416907788 + } + ] } ``` @@ -3222,6 +3486,8 @@ curl "https://api.huobi.pro/v1/query/deposit-withdraw?currency=xrp&type=deposit& | Field | Data Type | Description | | ----------- | --------- | ------------------------------------------------------------ | +| status | string | Request Processing Result | "ok" or "error" | +| \ | object | | | | id | integer | Transfer id | | type | string | Define transfer type to search, possible values: [deposit, withdraw] Sub-user can only put "deposit"| | currency | string | The crypto currency to withdraw | @@ -3236,6 +3502,8 @@ curl "https://api.huobi.pro/v1/query/deposit-withdraw?currency=xrp&type=deposit& | error-msg | string | Error description of withdrawal failure, only returned when the type is "withdraw" and the state is "reject", "wallet-reject" and "failed". | | created-at | integer | The timestamp in milliseconds for the transfer creation | | updated-at | integer | The timestamp in milliseconds for the transfer's latest update | +| \ | | | | | + **List of possible deposit state** @@ -3331,7 +3599,7 @@ API Key Permission:Trade ### HTTP Request -- POST /v2/sub-user/deduct-mode +- POST `/v2/sub-user/deduct-mode` ### Request Parameters @@ -3344,14 +3612,20 @@ API Key Permission:Trade ```json { - -"code": 200, -"data": [ - { - "subUid": "132208121", - "deductMode": "sub" - } -] + "code": 200, + "data": [ + { + "subUid": "158069153", + "deductMode": "master" + }, + { + "subUid": "1461901631", + "deductMode": null, + "errCode": 1002, + "errMessage": "forbidden" + } + ], + "ok": true } ``` @@ -3361,13 +3635,13 @@ API Key Permission:Trade | ----------- | -------- | --------- | ----------- | ------------------------------------------------------------ | ---- | | code | | true | int | Status code | | | message | | false | string | Error message (if any) | | -| data | | true | object | | | -| {subUid | | true | string | Sub user's UID | | +|\ | | true | object | | | +| subUid | | true | string | Sub user's UID | | | deductMode | | true | string | deduct mode | | | errCode | | true | string | Error code in case of rejection (only valid when the requested UID being rejected) | | -| errMessage} | | false | string | Error message in case of rejection (only valid when the requested UID being rejected) | | +| errMessage | | false | string | Error message in case of rejection (only valid when the requested UID being rejected) | | +| \ | | | | | -## ## API key query @@ -3389,20 +3663,31 @@ API Key Permission:Read ```json { - "code": 200, - "message": "success", - "data": [ + "code":200, + "message":"success", + "data":[ + { + "accessKey":"160bb889-b7XXXXbe-e0XXXXf5-ghxertfvbf", + "status":"normal", + "note":"host", + "permission":"trade,readOnly", + "ipAddresses":"192.168.0.1,192.168.1.1", + "validDays":-1, + "createTime":1615192704000, + "updateTime":1623030338000 + }, { - "accessKey": "4ba5cdf2-4a92c5da-718ba144-dbuqg6hkte", - "status": "normal", - "note": "62924133", - "permission": "readOnly,trade", - "ipAddresses": "1.1.1.1,1.1.1.2", - "validDays": -1, - "createTime": 1591348751000, - "updateTime": 1591348751000 + "accessKey":"5000d371-edXXXXf5tf-40XXXX8b-ab8e5", + "status":"normal", + "note":"host two", + "permission":"readOnly,trade,withdraw", + "ipAddresses":"", + "validDays":7, + "createTime":1623158078000, + "updateTime":1629875976000 } - ] + ], + "ok":true } ``` @@ -3411,15 +3696,17 @@ API Key Permission:Read | ------------- | -------- | --------- | -------------------------- | --------------------------------------- | | code | true | int | Status code | | | message | false | string | Error message (if any) | | -| data | true | object | | | -| [{ accessKey | true | string | access key | | +| \ | true | object | | | +| accessKey | true | string | access key | | | note | true | string | API key note | | | permission | true | string | API key permission | | | ipAddresses | true | string | API key IP addresses | | | validDays | true | int | API key expire in (days) | If it is -1, it means permanently valid | | status | true | string | API key status | normal, expired | | createTime | true | long | API key creation time | | -| updateTime }] | true | long | API key last modified time | | +| updateTime | true | long | API key last modified time | | +| \ | | | | | + ## Get UID @@ -3463,48 +3750,48 @@ API Key Permission:Trade - POST `/v2/sub-user/creation` -### Request Parameters -| Parameter | Required | Data Type | Description | Default | Value Range | -| ----------- | -------- | --------- | ------------------------------------------------------------ | ------- | ------------------------------------------------------------ | -| userList | true | object | | | | -| [{ userName | true | string | Sub user name, an important identifier of the sub user's identity, requires unique within the huobi platform | NA | The combination of 6 to 20 letters and numbers, or only letters. Letter is not case sensitive. The first character has to be a letter. | -| note }] | false | string | Sub user note, no unique requirements | NA | Up to 20 characters, unlimited character types | - > Request: ```json { -"userList": -[ -{ -"userName":"test123", -"note":"huobi" -}, -{ -"userName":"test456", -"note":"huobi" -} -] + "userList":[ + { + "userName":"test123", + "note":"huobi" + }, + { + "userName":"test456", + "note":"huobi two" + } + ] } ``` +### Request Parameters +| Parameter | Required | Data Type | Description | Default | Value Range | +| ----------- | -------- | --------- | ------------------------------------------------------------ | ------- | ------------------------------------------------------------ | +| \ | true | object | | | | +| userName | true | string | Sub user name, an important identifier of the sub user's identity, requires unique within the huobi platform | NA | The combination of 6 to 20 letters and numbers, or only letters. Letter is not case sensitive. The first character has to be a letter. | +| note | false | string | Sub user note, no unique requirements | NA | Up to 20 characters, unlimited character types | +| \ | | | | | + > Response: ```json { - "code": 200, - "data": [ + "code":200, + "data":[ { - "userName": "test123", - "note": "huobi", - "uid": 123 - }, + "userName":"test123", + "note":"huobi", + "uid":123 + }, { - "userName": "test456", - "note": "huobi", - "errCode": "2002", - "errMessage": "value in user name duplicated with existing record" - } + "userName":"test456", + "note":"huobi two", + "errCode":"2002", + "errMessage":"value in user name duplicated with existing record" + } ] } ``` @@ -3514,12 +3801,14 @@ API Key Permission:Trade | ------------- | -------- | --------- | ------------------------------------------------------------ | ----------- | | code | true | int | Status code | | | message | false | string | Error message (if any) | | -| data | true | object | | | -| [{ userName | true | string | Sub user name | | +| \ | true | object | | | +| userName | true | string | Sub user name | | | note | false | string | Sub user note (only valid for sub-users with note)) | | | uid | false | long | Sub user UID (only valid for successfully created sub users) | | | errCode | false | string | Error code for creation failure (only valid for sub users that failed to create) | | -| errMessage }] | false | string | Cause of creation failure error (only valid for sub users that failed to create) | | +| errMessage | false | string | Cause of creation failure error (only valid for sub users that failed to create) | | +| \ | | | | | + ## Get Sub User's List @@ -3561,9 +3850,10 @@ API Key Permission: Read | ----------- | --------- | --------- | ------------------------------------------------------------ | -------------- | | code | TRUE | int | Status code | | | message | FALSE | string | Error message (if any) | | -| data | TRUE | object | In ascending order of uid, each response contains maximum 100 records | | -| { uid | TRUE | long | Sub user’s UID | | -| userState } | TRUE | string | Sub user’s status | lock, normal | +|\ | TRUE | object | In ascending order of uid, each response contains maximum 100 records | | +| uid | TRUE | long | Sub user’s UID | | +| userState | TRUE | string | Sub user’s status | lock, normal | +| \ | | | | | | nextId | FALSE | long | First record ID in next page (only valid if exceeded page size) | | ## Lock/Unlock Sub User @@ -3575,7 +3865,7 @@ This endpoint allows parent user to lock or unlock a specific sub user. ### HTTP Request -`POST https://api.huobi.pro/v2/sub-user/management` + - POST `/v2/sub-user/management` ### Request Parameters @@ -3588,10 +3878,12 @@ This endpoint allows parent user to lock or unlock a specific sub user. ```json { - "code": 200, - "data": { - "subUid": 12902150, - "userState":"lock"} + "code": 200, + "data": { + "subUid": 245686628, + "userState": "lock" + }, + "ok": true } ``` @@ -3599,8 +3891,12 @@ This endpoint allows parent user to lock or unlock a specific sub user. | Field | Data Type | Description | Value Range | --------- | --------- | ----------- | ----------- +| code | true | int | status code | | +| \ | true | object | | | | subUid | long | sub user UID | NA | userState | string | The state of sub user | lock,normal +| \ | | | | | + ## Get Sub User's Status @@ -3636,9 +3932,11 @@ API Key Permission: Read | ----------- | --------- | --------- | ---------------------- | -------------- | | code | TRUE | int | Status code | | | message | FALSE | string | Error message (if any) | | -| data | TRUE | object | | | -| { uid | TRUE | long | Sub user’s UID | | -| userState } | TRUE | string | Sub user’s status | lock, normal | +| \ | TRUE | object | | | +| uid | TRUE | long | Sub user’s UID | | +| userState | TRUE | string | Sub user’s status | lock, normal | +| \ | TRUE | object | | | + ## Set Tradable Market for Sub Users @@ -3666,11 +3964,18 @@ By default, sub user’s trading permission in spot market is activated. "code": 200, "data": [ { - "subUid": "132208121", + "subUid": "12345678", "accountType": "isolated-margin", "activation": "activated" + }, + { + "subUid": "123456781", + "accountType": "isolated-margin", + "errCode": 1002, + "errMessage": "forbidden" } - ] + ], + "ok": true } ``` @@ -3680,12 +3985,14 @@ By default, sub user’s trading permission in spot market is activated. | ----------- | --------- | --------- | ------ | ------------------------------------------------------------ | ---------------------------- | | code | true | int | - | Status code | | | message | false | string | - | Error message (if any) | | -| data | true | object | | | | -| {subUid | true | string | - | Sub user's UID | - | +| \ | true | object | | | | +| subUid | true | string | - | Sub user's UID | - | | accountType | true | string | - | Account type | isolated-margin,cross-margin | | activation | true | string | - | Account activation | activated,deactivated | | errCode | false | int | - | Error code in case of rejection (only valid when the requested UID being rejected) | | | errMessage} | false | string | - | Error message in case of rejection (only valid when the requested UID being rejected) | | +| \ | | | | | + ## Set Asset Transfer Permission for Sub Users @@ -3715,9 +4022,16 @@ By default, the asset transfer from sub user’s spot account to parent user’s { "accountType": "spot", "transferrable": true, - "subUid": 13220823 + "subUid": 245686628 + }, + { + "accountType": "spot", + "subUid": 2215699261, + "errCode": 2002, + "errMessage": "invalid field value in `2,215,699,261`" } - ] + ], + "ok": true } ``` @@ -3728,12 +4042,14 @@ By default, the asset transfer from sub user’s spot account to parent user’s | ------------- | --------- | --------- | ------ | ------------------------------------------------------------ | -------------- | | code | true | int | - | Status code | | | message | false | string | - | Error message (if any) | | -| data | true | object | | | | -| {subUid | true | long | - | Sub user's UID | - | +| \ | true | object | | | | +| subUid | true | long | - | Sub user's UID | - | | accountType | true | string | - | Account type | spot | | transferrable | true | bool | - | Transferrability | true,false | | errCode | false | int | - | Error code in case of rejection (only valid when the requested UID being rejected) | | -| errMessage} | false | string | - | Error code in case of rejection (only valid when the requested UID being rejected) | | +| errMessage | false | string | - | Error code in case of rejection (only valid when the requested UID being rejected) | | +| \ | | | | | + ## Get Sub User's Account List @@ -3790,17 +4106,20 @@ API Key Permission: Read | ----------------- | --------- | --------- | ------------------------------------------------------------ | ------------------------------------------------- | | code | TRUE | int | Status code | | | message | FALSE | string | Error message (if any) | | -| data | TRUE | object | | | -| { uid | TRUE | long | Sub user’s UID | | +| \ | TRUE | object | | | +| uid | TRUE | long | Sub user’s UID | | | deductMode | TRUE | string | deduct mode | | -| list | TRUE | object | | | -| { accountType | TRUE | string | Account type | spot, isolated-margin, cross-margin, futures,swap | +| \ | TRUE | object | | | +| accountType | TRUE | string | Account type | spot, isolated-margin, cross-margin, futures,swap | | activation | TRUE | string | Account’s activation | activated, deactivated | | transferrable | FALSE | bool | Transfer permission (only valid for accountType=spot) | true, false | -| accountIds | FALSE | object | | | -| { accountId | TRUE | string | Account ID | | +| \ | FALSE | object | | | +| accountId | TRUE | string | Account ID | | | subType | FALSE | string | Account sub type (only valid for accountType=isolated-margin) | | -| accountStatus }}} | TRUE | string | Account status | normal, locked | +| accountStatus | TRUE | string | Account status | normal, locked | +| \ | | | | | +| \ | | | | | +| \ | | | | | ## Sub user API key creation @@ -3831,7 +4150,7 @@ API Key Permission:Trade "secretKey": "c405c550-6fa0583b-fb4bc38e-d317e", "note": "62924133", "permission": "trade,readOnly", - "ipAddresses": "1.1.1.1,1.1.1.2" + "ipAddresses": "192.168.0.1,192.168.1.1" } } ``` @@ -3841,13 +4160,13 @@ API Key Permission:Trade | ------------- | -------- | --------- | ---------------------- | ----------- | | code | true | int | Status code | | | message | false | string | Error message (if any) | | -| data | true | object | | | -| { note | true | string | API key note | | +| \ | true | object | | | +| note | true | string | API key note | | | accessKey | true | string | access key | | | secretKey | true | string | secret key | | | permission | true | string | API key permission | | -| ipAddresses } | true | string | API key IP addresses | | - +| ipAddresses | true | string | API key IP addresses | | +| \ | | | | | ## Sub user API key modification @@ -3874,10 +4193,11 @@ API Key Permission:Trade { "code": 200, "data": { - "note": "test", - "permission": "readOnly", - "ipAddresses": "1.1.1.3" - } + "note": "tom", + "permission": "trade,readOnly", + "ipAddresses": "192.168.1.1" + }, + "ok": true } ``` @@ -3886,10 +4206,12 @@ API Key Permission:Trade | ------------- | -------- | --------- | ------------------------------------------------------------ | ----------- | | code | true | int | Status code | | | message | false | string | Error message (if any) | | -| data | true | object | | | +| \ | true | object | | | | { note | true | string | API key note | | | permission | true | string | API key permission | | -| ipAddresses } | true | string | IPv4/IPv6 host address(es) or IPv4 network address(es) bind to the API key | | +| ipAddresses | true | string | IPv4/IPv6 host address(es) or IPv4 network address(es) bind to the API key | | +| \ | | | | | + ## Sub user API key deletion @@ -3933,11 +4255,7 @@ This endpoint allows user to transfer asset between parent and sub account. ### HTTP Request -`POST https://api.huobi.pro/v1/subuser/transfer` - -```shell -curl -X POST "https://api.huobi.pro/v1/subuser/transfer" -H "Content-Type: application/json" -d '{"sub-uid": 12345, "currency": "btc", "amount": 123.5, "type": "master-transfer-in"}' -``` + - POST `/v1/subuser/transfer` ### Request Parameters @@ -3951,7 +4269,10 @@ curl -X POST "https://api.huobi.pro/v1/subuser/transfer" -H "Content-Type: appli > The above command returns JSON structured like this: ```json - "data": 12345 +{ + "data":123456, + "status":"ok" +} ``` ### Response Content @@ -3960,6 +4281,7 @@ curl -X POST "https://api.huobi.pro/v1/subuser/transfer" -H "Content-Type: appli | Field | Data Type | Description | | ----- | --------- | ------------------ | | data | integer | Unique transfer id | +| status | string | status | "ok" or "error" | | ## Query Deposit Address of Sub User @@ -3971,7 +4293,7 @@ API Key Permission:Read ### HTTP Request -`GET https://api.huobi.pro/v2/sub-user/deposit-address` + - GET `/v2/sub-user/deposit-address` ### Request Parameters @@ -3988,10 +4310,25 @@ API Key Permission:Read "code": 200, "data": [ { + "userId": 12345678, "currency": "btc", - "address": "1PSRjPg53cX7hMRYAXGJnL8mqHtzmQgPUs", + "address": "0x4efee1ca7fc887d921f4bbcc444fbc12c464d87f", + "addressTag": "", + "chain": "hbtc" + }, + { + "userId": 12345678, + "currency": "btc", + "address": "1C4o8WmACM8yHBbJjbdzLbc9ei7WFLFoMk", "addressTag": "", "chain": "btc" + }, + { + "userId": 12345678, + "currency": "btc", + "address": "0x4efee1ca7fc887d921f4bbcc444fbc12c464d87f", + "addressTag": "", + "chain": "hrc20btc" } ] } @@ -4003,12 +4340,12 @@ API Key Permission:Read | ---------- | --------- | ---------------------- | | code | int | Status code | | message | string | Error message (if any) | -| data | object | | -| { currency | string | Crypto currency | +| \ | object | | +| currency | string | Crypto currency | | address | string | Deposit address | | addressTag | string | Deposit address tag | -| chain } | string | Block chain name | - +| chain | string | Block chain name | +| \ | | | | | ## Query Deposit History of Sub User @@ -4018,7 +4355,7 @@ Parent user could query sub user's deposit history via this endpoint. ### HTTP Request -`GET https://api.huobi.pro/v2/sub-user/query-deposit` + - GET `/v2/sub-user/query-deposit` ### Request Parameters @@ -4029,7 +4366,7 @@ Parent user could query sub user's deposit history via this endpoint. |startTime |long |FALSE |Farthest time (please refer to note 1 for valid range and default value) | |endTime |long |FALSE |Nearest time (please refer to note 2 for valid range and default value) | |sort |string |FALSE |Sorting order (enumerated values: asc, desc) | -|limit |int |FALSE |Maximum number of items in one page (valid range:[1,500]; default value:100) | +|limit |int |FALSE |Maximum number of items in one page (valid range:[1-500]; default value:100) | |fromId |long|FALSE|First record ID in this query (only valid for next page querying; please refer to note 3) | Note 1:
@@ -4074,8 +4411,8 @@ Only when the number of items within the query window (between "startTime" and " | ------- | ------- | ------- | ------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | -| data | object | TRUE | | -| { id | long | TRUE | Deposit id | +| \ | object | TRUE | | +| id | long | TRUE | Deposit id | | currency | string | TRUE | Cryptocurrency | | txHash | string | TRUE | The on-chain transaction hash | | chain | string | TRUE | Block chain name | @@ -4084,7 +4421,8 @@ Only when the number of items within the query window (between "startTime" and " | addressTag | string | FALSE | The user defined address tag | | state | string | TRUE | The state of this transfer (see below for details) | | createTime | long | TRUE | The timestamp in milliseconds for the transfer creation | -| updateTime } | long | TRUE | The timestamp in milliseconds for the transfer's latest update | +| updateTime | long | TRUE | The timestamp in milliseconds for the transfer's latest update | +| \ | | | | | | nextId | long | FALSE | First record ID in next page (only valid if exceeded page size) | **List of possible deposit state** @@ -4107,45 +4445,52 @@ This endpoint returns the aggregated balance from all the sub-users. ### HTTP Request -`GET https://api.huobi.pro/v1/subuser/aggregate-balance` + - GET `/v1/subuser/aggregate-balance` -```shell -curl "https://api.huobi.pro/v1/subuser/aggregate-balance" -``` + +### Request Parameters + + +### Response Content > The above command returns JSON structured like this: ```json - "data": [ - { - "currency": "eos", - "type": "spot", - "balance": "1954559.809500000000000000" - }, - { - "currency": "btc", - "type": "spot", - "balance": "0.000000000000000000" - }, - { - "currency": "usdt", - "type": "spot", - "balance": "2925209.411300000000000000" - } - ] +{ + "status": "ok", + "data": [ + { + "currency": "hbpoint", + "balance": "10", + "type": "point" + }, + { + "currency": "ada", + "balance": "0", + "type": "spot" + }, + { + "currency": "usdt", + "balance": "8.08559165", + "type": "spot" + } + ] +} ``` -### Request Parameters - - -### Response Content +### Response Parameters + | Field | Data Type | Description | | -------- | --------- | ------------------------------------------------------------ | +| status | true | string | status | "OK" or "Error" | +| \ | true | list | | | | currency | string | The currency of this balance | | type | string | account type (spot, margin, point,super-margin) | | balance | string | The total balance in the main currency unit including all balance and frozen banlance | +| \ | | | | | | + ## Get Account Balance of a Sub-User @@ -4156,64 +4501,69 @@ This endpoint returns the balance of a sub-user specified by sub-uid. ### HTTP Request -`GET https://api.huobi.pro/v1/account/accounts/{sub-uid}` + - GET `/v1/account/accounts/{sub-uid}` 'sub-uid': The specified sub user id to get balance for. -```shell -curl "https://api.huobi.pro/v1/account/accounts/10758899" -``` - ### Request Parameters |Field Name |Data Type |Mandatory |Description | |------- |------- |------- |------- | -| subUid | long | ture | Sub user UID | +| sub-uid | long | ture | Sub user UID | > The above command returns JSON structured like this: ```json -"data": [ - { - "id": 9910049, - "type": "spot", - "list": [ - { - "currency": "btc", - "type": "trade", - "balance": "1.00" - }, - { - "currency": "eth", - "type": "trade", - "balance": "1934.00" - } - ] - }, - { - "id": 9910050, - "type": "point", - "list": [] - } -] +{ + "status": "ok", + "data": [ + { + "id": 13704588, + "type": "spot", + "state": "working", + "list": [ + { + "currency": "usdt", + "type": "trade", + "balance": "8.0855916572" + } + ], + "symbol": "" + }, + { + "id": 24994285, + "type": "point", + "state": "working", + "list": [ + { + "currency": "hbpoint", + "type": "trade", + "balance": "10" + } + ], + "symbol": "" + } + ] +} ``` ### Response Content + | Field | Data Type | Description | Value Range | | ----- | --------- | ------------------------------------ | ------------------------------------- | +| status | TRUE | string | status | "OK" or "Error" | | +| \ | TRUE | object | | | | | id | integer | account's ID | NA | | type | string | The type of this account | spot, margin, otc, point,super-margin | -| list | object | The balance details of each currency | NA | - -**Per list item content** - -| Field | Data Type | Description | Value Range | -| -------- | --------- | ------------------------------------- | ------------- | -| currency | string | The currency of this balance | NA | -| type | string | The balance type | trade, frozen | -| balance | string | The balance in the main currency unit | NA | +| \ | TRUE | object | | | | +| currency | TRUE | string | The currency of this balance | NA | +| type | TRUE | string | The balance type | trade, frozen | +| balance | TRUE | string | The balance in the main currency unit | NA | +| \ | | | | | | +| symbol | TRUE | string | | | | +| \ | | | | | | ## Error Code @@ -4291,19 +4641,18 @@ This endpoint places a new order and sends to the exchange to be matched. ### HTTP Request -`POST https://api.huobi.pro/v1/order/orders/place` + - POST `/v1/order/orders/place` -```shell -curl -X POST -H "Content-Type: application/json" "https://api.huobi.pro/v1/order/orders/place" -d -'{ - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit", - "client-order-id": "a0001" - }' +```json +{ + "account-id": "100009", + "amount": "10.1", + "price": "100.1", + "source": "api", + "symbol": "ethusdt", + "type": "buy-limit", + "client-order-id": "a0001" +} ``` ### Request Parameters @@ -4323,7 +4672,10 @@ curl -X POST -H "Content-Type: application/json" "https://api.huobi.pro/v1/order > The above command returns JSON structured like this: ```json - "data": "59378" +{ + "status": "ok", + "data": "356501383558845" +} ``` ### Response Content @@ -4353,27 +4705,28 @@ A batch contains at most 10 orders. ### HTTP Request -- POST ` /v1/order/batch-orders` - -```json - [ - { - "account-id": "123456", - "price": "7801", - "amount": "0.001", - "symbol": "btcusdt", - "type": "sell-limit", - "client-order-id": "c1" - }, - { - "account-id": "123456", - "price": "7802", - "amount": "0.001", - "symbol": "btcusdt", - "type": "sell-limit", - "client-order-id": "d2" - } - ] +- POST `/v1/order/batch-orders` + +```json +[ + { + "account-id": "13496526", + "symbol": "adausdt", + "type": "buy-limit-maker", + "amount": "5", + "price": "1", + "source": "spot-api", + "client-order-id": "2345" + }, + { + "account-id": "13496526", + "symbol": "adausdt", + "type": "buy-limit-maker", + "amount": "4", + "price": "1", + "source": "spot-api","client-order-id": "23456" + } +] ``` ### Request Parameters @@ -4409,12 +4762,13 @@ If the order price is greater than the highest buy price in the market, the orde "status": "ok", "data": [ { - "order-id": 61713400772, - "client-order-id": "c1" + "order-id": 361560582529749, + "client-order-id": "2345" }, { - "order-id": 61713400940, - "client-order-id": "d2" + "client-order-id": "23456", + "err-code": "order-value-min-error", + "err-msg": "Order total cannot be lower than: 5 USDT" } ] } @@ -4424,10 +4778,13 @@ If the order price is greater than the highest buy price in the market, the orde | Field | Data Type | Description | | --------------- | --------- | ------------------------------------------- | -| [{order-id | integer | The order id | +| status | string | status | +| \ | object | | +| order-id | integer | The order id | | client-order-id | string | The client order id (if available) | | err-code | string | The error code (only for rejected order) | -| err-msg}] | string | The error message (only for rejected order) | +| err-msg | string | The error message (only for rejected order) | +| \ | | | If client order ID duplicates with a previous order , the endpoint responds that previous order's Id and client order ID. @@ -4439,16 +4796,13 @@ Rate Limit (NEW): 100times/2s This endpoint submits a request to cancel an order. + ### HTTP Request -`POST https://api.huobi.pro/v1/order/orders/{order-id}/submitcancel` + - POST `/v1/order/orders/{order-id}/submitcancel` 'order-id': the previously returned order id when order was created -```shell -curl -X POST "https://api.huobi.pro/v1/order/orders/59378/submitcancel" -``` - ### Request Parameters | Parameter | Data Type | Required | Default | Description | @@ -4459,7 +4813,10 @@ curl -X POST "https://api.huobi.pro/v1/order/orders/59378/submitcancel" > The above command returns JSON structured like this: ```json - "data": "59378" +{ + "status": "ok", + "data": "356501495694025" +} ``` ### Response Content @@ -4471,10 +4828,11 @@ curl -X POST "https://api.huobi.pro/v1/order/orders/59378/submitcancel" ```json { - "status": "error", - "err-code": "order-orderstate-error", - "err-msg": "Incorrect order state", - "order-state":-1 // current order state + "status": "error", + "err-code": "order-orderstate-error", + "err-msg": "Incorrect order state", + "data": null, + "order-state": 7 // current order state } ``` @@ -4503,13 +4861,12 @@ This endpoint submit a request to cancel an order based on client-order-id . ### HTTP Request -`POST https://api.huobi.pro/v1/order/orders/submitCancelClientOrder` + - POST `/v1/order/orders/submitCancelClientOrder` -```shell -curl -X POST -H "Content-Type: application/json" "https://api.huobi.pro/v1/order/orders/submitCancelClientOrder" -d -'{ +```json +{ "client-order-id": "a0001" - }' +} ``` ### Request Parameters @@ -4521,7 +4878,10 @@ curl -X POST -H "Content-Type: application/json" "https://api.huobi.pro/v1/order > The above command returns JSON structured like this: ```json - "data": "59378" +{ + "status": "ok", + "data": 10 +} ``` ### Response Content @@ -4552,10 +4912,16 @@ This endpoint returns all open orders which have not been filled completely. ### HTTP Request -`GET https://api.huobi.pro/v1/order/openOrders` + - GET `/v1/order/openOrders` -```shell -curl "https://api.huobi.pro/v1/order/openOrders?account-id=100009&symbol=btcusdt&side=buy&size=5" +> Request: + +```json +{ + "account-id": "100009", + "symbol": "ethusdt", + "side": "buy" +} ``` ### Request Parameters @@ -4572,28 +4938,34 @@ curl "https://api.huobi.pro/v1/order/openOrders?account-id=100009&symbol=btcusdt > The above command returns JSON structured like this: ```json - "data": [ - { - "id": 5454937, - "symbol": "ethusdt", - "account-id": 30925, - "amount": "1.000000000000000000", - "price": "0.453000000000000000", - "created-at": 1530604762277, - "type": "sell-limit", - "filled-amount": "0.0", - "filled-cash-amount": "0.0", - "filled-fees": "0.0", - "source": "web", - "state": "submitted" - } - ] +{ + "status": "ok", + "data": [ + { + "symbol": "apnusdt", + "source": "web", + "price": "1.555550000000000000", + "created-at": 1630633835224, + "amount": "572.330000000000000000", + "account-id": 13496526, + "filled-cash-amount": "0.0", + "client-order-id": "", + "filled-amount": "0.0", + "filled-fees": "0.0", + "id": 357630527817871, + "state": "submitted", + "type": "sell-limit" + } + ] +} ``` ### Response Content | Field | Data Type | Description | | ------------------ | --------- | ------------------------------------------------------------ | +| status | string | status | +| \ | object | | | id | integer | Order id | | client-order-id | string | Client order id, can be returned from all open orders (if specified). | | symbol | string | The trading symbol to trade, e.g. btcusdt, bccbtc | @@ -4607,6 +4979,8 @@ curl "https://api.huobi.pro/v1/order/openOrders?account-id=100009&symbol=btcusdt | state | string | Order status, valid values: created, submitted, partial-filled | | stop-price | string | false | | operator | string | false | +| \ | | | + ## Submit Cancel for Multiple Orders by Criteria @@ -4620,16 +4994,17 @@ like order status, matchresult, etc. ### HTTP Request -`POST https://api.huobi.pro/v1/order/orders/batchCancelOpenOrders` + - POST `/v1/order/orders/batchCancelOpenOrders` -```shell -curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/order/orders/batchCancelOpenOrders" -d -'{ +> Request + +```json +{ "account-id": "100009", "symbol": "btcusdt,btchusd", "side": "buy", "size": 5 -}' +} ``` | Parameter | Data Type | Required | Default | Description | Value Range | @@ -4643,20 +5018,27 @@ curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/order > The above command returns JSON structured like this: ```json - "data": { - "success-count": 2, - "failed-count": 0, - "next-id": 5454600 - } +{ + "status":"ok", + "data":{ + "success-count":2, + "failed-count":0, + "next-id":5454600 + } +} ``` ### Response Content | Field | Data Type | Description | | ------------- | --------- | ------------------------------------------------------------ | +| status | string | status | +| \ | object | | | success-count | integer | The number of cancel request sent successfully | | failed-count | integer | The number of cancel request failed | | next-id | integer | the next order id that can be cancelled, -1 indicates no open orders | +| \ | | | | + ## Submit Cancel for Multiple Orders by IDs @@ -4668,15 +5050,14 @@ client-order-ids, so that the cancellation is faster, more accurate and more sta ### HTTP Request -`POST https://api.huobi.pro/v1/order/orders/batchcancel` + - POST `/v1/order/orders/batchcancel` -```shell -curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/order/orders/batchcancel" -d -'{ - "client-order-ids": [ - "5983466", "5722939", "5721027", "5719487" - ] -}' +```json +{ + "client-order-ids": [ + "12345", "123456" + ] +} ``` ### Request Parameters @@ -4693,30 +5074,17 @@ curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/order "status": "ok", "data": { "success": [ - "5983466" + "12345" ], "failed": [ { - "err-msg": "Incorrect order state", - "order-state": 7, - "order-id": "", - "err-code": "order-orderstate-error", - "client-order-id": "first" - }, - { - "err-msg": "Incorrect order state", - "order-state": 7, - "order-id": "", - "err-code": "order-orderstate-error", - "client-order-id": "second" - }, - { - "err-msg": "The record is not found.", - "order-id": "", - "err-code": "base-not-found", - "client-order-id": "third" + "err-msg": "Incorrect order state", + "order-state": 7, + "order-id": "357631450723117", + "err-code": "order-orderstate-error", + "client-order-id": "123456" } - ] + ] } } ``` @@ -4725,18 +5093,17 @@ curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/order | Field | Data Type | Description | | -------- | --------- | ------------------------------------------------------------ | -| {success | string[] | Cancelled order list (Can be order ID list or client order list, based on the request) | -| failed} | string[] | Failed order list (Can be order ID list or client order list, based on the request) | - -The failed id list has below fields - -| Fields | Data Type | Description | -| --------------- | --------- | ------------------------------------------------------------ | -| [{ order-id | string | The order id (if the request is based on order-ids) | +| status | string | 状态 | +| \ | object | | +| success | array | Cancelled order list (Can be order ID list or client order list, based on the request) | +| \ | object | Failed order list (Can be order ID list or client order list, based on the request) | +| order-id | string | The order id (if the request is based on order-ids) | | client-order-id | string | The client order id (if the request is based on client-order-ids) | | err-code | string | The error code (only applicable for rejected order) | | err-msg | string | The error message (only applicable for rejected order) | -| order-state }] | string | Current order state (if available) | +| order-state | string | Current order state (if available) | +| \ | | | +| \ | | | The possible values of "order-state" includes - @@ -4784,13 +5151,12 @@ Response: ```json { -"code": 200, -"data": [ - { - "currentTime":"1587971400", - "triggerTime":"1587971460" - } -] + "code": 200, + "message": "success", + "data": { + "currentTime": 1630491627230, + "triggerTime": 1630491637230 + } } ``` @@ -4800,24 +5166,24 @@ Response: ```json { -"code": 200, -"data": [ - { - "currentTime":"1587971400", - "triggerTime":"0" - } -] + "code": 200, + "message": "success", + "data": { + "currentTime": 1630491780445, + "triggerTime": 0 + } } ``` > Turn On/Off Failed -> Response: +Response: ```json { -"code": 2003, -"message": "missing mandatory field" + "code": 2002, + "message": "Invalid constraints error timeout", + "data": null } ``` @@ -4827,13 +5193,12 @@ Response: | ------------- | ------------- | -------- | -------------------------- | | code | true | int | status code | | message | false | string | error description (if any) | -| data | true | object | | -| { currentTime | true | long | current time | -| triggerTime } | true | long | trigger time | +| \ | true | object | | +| currentTime | true | long | current time | +| triggerTime | true | long | trigger time | +| \ | | | | -## - ## Get the Order Detail of an Order API Key Permission:Read
@@ -4843,39 +5208,35 @@ This endpoint returns the detail of a specific order. If an order is created via ### HTTP Request -`GET /v1/order/orders/{order-id}` + - GET `/v1/order/orders/{order-id}` ### Request Parameters | **Name** | **Mandatory** | **Type** | **Description** | | ------------- | ------------- | -------- | -------------------------- | | order-id | true | string | order id when order was created. Place it within path| -```shell -curl "https://api.huobi.pro/v1/order/orders/59378" -``` - - > The above command returns JSON structured like this: ```json -{ - "data": { - "id": 59378, - "symbol": "ethusdt", - "account-id": 100009, - "amount": "10.1000000000", - "price": "100.1000000000", - "created-at": 1494901162595, - "type": "buy-limit", - "field-amount": "10.1000000000", - "field-cash-amount": "1011.0100000000", - "field-fees": "0.0202000000", - "finished-at": 1494901400468, - "user-id": 1000, - "source": "api", - "state": "filled", - "canceled-at": 0 - } +{ + "status": "ok", + "data": { + "id": 357632718898331, + "symbol": "adausdt", + "account-id": 13496526, + "client-order-id": "23456", + "amount": "5.000000000000000000", + "price": "1.000000000000000000", + "created-at": 1630649406687, + "type": "buy-limit-maker", + "field-amount": "0.0", + "field-cash-amount": "0.0", + "field-fees": "0.0", + "finished-at": 0, + "source": "spot-api", + "state": "submitted", + "canceled-at": 0 + } } ``` @@ -4883,6 +5244,8 @@ curl "https://api.huobi.pro/v1/order/orders/59378" | Field | Data Type | Description | | ------------------ | --------- | ------------------------------------------------------------ | +| status | string | status | | +| \ | object | | | | id | integer | order id | | client-order-id | string | Client order id ("client-order-id" (if specified) can be returned from all open orders. "client-order-id" (if specified) can be returned only from closed orders (state <> canceled) created within 7 days. "client-order-id" (if specified) can be returned only from closed orders (state = canceled) created within 8 hours.) | | symbol | string | The trading symbol to trade, e.g. btcusdt, bccbtc | @@ -4900,7 +5263,7 @@ curl "https://api.huobi.pro/v1/order/orders/59378" | state | string | All possible order state (refer to introduction in this section) | | stop-price | string | trigger price of stop limit order | | operator | string | operation character of stop price: gte, lte | - +| \ | | | | | ## Get the Order Detail of an Order (based on client order ID) @@ -4912,39 +5275,36 @@ This endpoint returns the detail of one order by specified client order id (with ### HTTP Request -`GET /v1/order/orders/getClientOrder` - -```shell -curl "https://api.huobi.pro/v1/order/orders/getClientOrder?clientOrderId=a0001" -``` + - GET `/v1/order/orders/getClientOrder` ### Request Parameters | Parameter | Data Type | Required | Default | Description | | ------------- | --------- | -------- | ------- | --------------- | -| order-id | string | true | NA | Client order ID | +| clientOrderId | string | true | NA | Client order ID | > The above command returns JSON structured like this: ```json -{ - "data": { - "id": 59378, - "symbol": "ethusdt", - "account-id": 100009, - "amount": "10.1000000000", - "price": "100.1000000000", - "created-at": 1494901162595, - "type": "buy-limit", - "field-amount": "10.1000000000", - "field-cash-amount": "1011.0100000000", - "field-fees": "0.0202000000", - "finished-at": 1494901400468, - "user-id": 1000, - "source": "api", - "state": "filled", - "canceled-at": 0 - } +{ + "status": "ok", + "data": { + "id": 357632718898331, + "symbol": "adausdt", + "account-id": 13496526, + "client-order-id": "23456", + "amount": "5.000000000000000000", + "price": "1.000000000000000000", + "created-at": 1630649406687, + "type": "buy-limit-maker", + "field-amount": "0.0", + "field-cash-amount": "0.0", + "field-fees": "0.0", + "finished-at": 0, + "source": "spot-api", + "state": "submitted", + "canceled-at": 0 + } } ``` @@ -4952,6 +5312,8 @@ curl "https://api.huobi.pro/v1/order/orders/getClientOrder?clientOrderId=a0001" | Field | Data Type | Description | | ------------------ | --------- | ------------------------------------------------------------ | +| status | string | status | | +| \ | object | | | | id | integer | order id | | client-order-id | string | Client order id (only those orders created within 8 hours can be returned.) | | symbol | string | The trading symbol to trade, e.g. btcusdt, bccbtc | @@ -4969,15 +5331,19 @@ curl "https://api.huobi.pro/v1/order/orders/getClientOrder?clientOrderId=a0001" | state | string | All possible order state (refer to introduction in this section) | | stop-price | string | trigger price of stop limit order | | operator | string | operation character of stop price | +| \ | | | | | + -If the client order ID is not found, following error message will be returned: +> If the client order ID is not found, following error message will be returned: + +```json { "status": "error", "err-code": "base-record-invalid", "err-msg": "record invalid", "data": null } - +``` ## Get the Match Result of an Order @@ -4989,12 +5355,7 @@ This endpoint returns the match result of an order. ### HTTP Request -`GET /v1/order/orders/{order-id}/matchresults` - - -```shell -curl "https://api.huobi.pro/v1/order/orders/59378/matchresults" -``` + - GET `/v1/order/orders/{order-id}/matchresults` ### Request Parameters @@ -5006,32 +5367,39 @@ curl "https://api.huobi.pro/v1/order/orders/59378/matchresults" > The above command returns JSON structured like this: ```json - "data": [ - { - "id": 29553, - "order-id": 59378, - "match-id": 59335, - "trade-id": 100282808529, - "symbol": "ethusdt", - "type": "buy-limit", - "source": "api", - "price": "100.1000000000", - "filled-amount": "9.1155000000", - "filled-fees": "0.0182310000", - "created-at": 1494901400435, - "role": maker, - "filled-points": "0.0", - "fee-deduct-currency": "", - "fee-deduct-state": "done" - } - ] +{ + "status": "ok", + "data": [ + { + "symbol": "polyusdt", + "fee-currency": "poly", + "source": "spot-web", + "order-id": 345487249132375, + "price": "0.338", + "created-at": 1629443051839, + "role": "taker", + "match-id": 5014, + "filled-amount": "147.928994082840236", + "filled-fees": "0", + "filled-points": "0.1", + "fee-deduct-currency": "hbpoint", + "fee-deduct-state": "done", + "trade-id": 1085, + "id": 313288753120940, + "type": "buy-market" + } + ] +} ``` ### Response Content + | Parameter | Data Type | Description | | ------------------- | --------- | ------------------------------------------------------------ | +| status | string | status | | +| \ | object | | | | id | long | Internal id | | symbol | string | The trading symbol to trade, e.g. btcusdt, bccbtc | | order-id | long | The order id of this order | @@ -5048,6 +5416,7 @@ curl "https://api.huobi.pro/v1/order/orders/59378/matchresults" | filled-points | string | deduction amount (unit: in ht or hbpoint) | | fee-deduct-currency | string | deduction type. if blank, the transaction fee is based on original currency; if showing value as "ht", the transaction fee is deducted by HT; if showing value as "hbpoint", the transaction fee is deducted by HB point. | | fee-deduct-state | string | Fee deduction status,In deduction:ongoing,Deduction completed:done | +| \ | | | | | Notes:
@@ -5073,22 +5442,20 @@ Huobi Global suggests API users to search historical orders based on "time" filt ### HTTP Request -`GET /v1/order/orders` + - GET `/v1/order/orders` + +> Request: -```shell -curl "https://api.huobi.pro/v1/order/orders?symbol=ethusdt&type=buy-limit&staet=filled" -``` -> Request ```json - { +{ "account-id": "100009", "amount": "10.1", "price": "100.1", "source": "api", "symbol": "ethusdt", "type": "buy-limit" - } +} ``` @@ -5103,36 +5470,41 @@ curl "https://api.huobi.pro/v1/order/orders?symbol=ethusdt&type=buy-limit&staet= | states | string | true | NA | One or more states of order to include in the search, use comma to separate. | All possible order state (refer to introduction in this section) | | from | string | false | NA | Search order id to begin with | NA | | direct | string | false | both | Search direction when 'from' is used | next, prev | -| size | integer | false | 100 | The number of orders to return | [1, 100] | +| size | integer | false | 100 | The number of orders to return | [1-100] | > The above command returns JSON structured like this: ```json - "data": [ - { - "id": 59378, - "symbol": "ethusdt", - "account-id": 100009, - "amount": "10.1000000000", - "price": "100.1000000000", - "created-at": 1494901162595, - "type": "buy-limit", - "field-amount": "10.1000000000", - "field-cash-amount": "1011.0100000000", - "field-fees": "0.0202000000", - "finished-at": 1494901400468, - "user-id": 1000, - "source": "api", - "state": "filled", - "canceled-at": 0 - } - ] +{ + "status": "ok", + "data": [ + { + "id": 345487249132375, + "symbol": "polyusdt", + "account-id": 13496526, + "client-order-id": "", + "amount": "50.000000000000000000", + "price": "0.0", + "created-at": 1629443051822, + "type": "buy-market", + "field-amount": "147.928994082840236000", + "field-cash-amount": "49.999999999999999768", + "field-fees": "0.295857988165680472", + "finished-at": 1629443051838, + "source": "spot-web", + "state": "filled", + "canceled-at": 0 + } + ] +} ``` ### Response Content | Field | Data Type | Description | | ------------------ | --------- | ------------------------------------------------------------ | +| status | true | string | status | | +| \ | true | object | | | | id | long | Order id | | client-order-id | string | Client order id ("client-order-id" (if specified) can be returned from all open orders. "client-order-id" (if specified) can be returned only from closed orders (state <> canceled) created within 7 days. only those closed orders (state = canceled) created within 8 hours can be returned.) | | account-id | long | Account id | @@ -5153,6 +5525,7 @@ curl "https://api.huobi.pro/v1/order/orders?symbol=ethusdt&type=buy-limit&staet= | batch | string | Internal data | | stop-price | string | trigger price of stop limit order | | operator | string | operation character of stop price | +| \ | | | | | ### Error code for invalid start-date/end-date @@ -5174,7 +5547,7 @@ The orders created via API will no longer be queryable after being cancelled for ### HTTP Request -`GET /v1/order/history` + - GET `/v1/order/history` >Request ```json @@ -5195,8 +5568,7 @@ The orders created via API will no longer be queryable after being cancelled for | start-time | false | long | Start time (included) | The time 48 hours ago | UTC time in millisecond | | end-time | false | long | End time (included) | The query time | UTC time in millisecond | | direct | false | string | Direction of the query. (Note: If the total number of items in the search result is within the limitation defined in "size", this field does not take effect.) | next | prev, next | -| size | false | int | Number of items in each response | 100 | [10,1000] | - +| size | false | int | Number of items in each response | 100 | [10-1000] | > The above command returns JSON structured like this: @@ -5206,20 +5578,38 @@ The orders created via API will no longer be queryable after being cancelled for "status": "ok", "data": [ { - "id": 31215214553, - "symbol": "btcusdt", - "account-id": 4717043, - "amount": "1.000000000000000000", + "id": 357632718898331, + "symbol": "adausdt", + "account-id": 13496526, + "client-order-id": "23456", + "amount": "5.000000000000000000", "price": "1.000000000000000000", - "created-at": 1556533539282, - "type": "buy-limit", + "created-at": 1630649406687, + "type": "buy-limit-maker", "field-amount": "0.0", "field-cash-amount": "0.0", "field-fees": "0.0", - "finished-at": 1556533568953, - "source": "web", - "state": "canceled", - "canceled-at": 1556533568911 + "finished-at": 0, + "source": "spot-api", + "state": "submitted", + "canceled-at": 0 + }, + { + "id": 357632718898330, + "symbol": "adausdt", + "account-id": 13496526, + "client-order-id": "2345", + "amount": "5.000000000000000000", + "price": "1.000000000000000000", + "created-at": 1630649406687, + "type": "buy-limit-maker", + "field-amount": "0.0", + "field-cash-amount": "0.0", + "field-fees": "0.0", + "finished-at": 0, + "source": "spot-api", + "state": "submitted", + "canceled-at": 0 } ] } @@ -5229,6 +5619,8 @@ The orders created via API will no longer be queryable after being cancelled for | Field | Data Type | Description | | ----------------- | --------- | ------------------------------------------------------------ | +| status | string | status | | +| \ | object | | | | {account-id | long | Account ID | | amount | string | Order size | | canceled-at | long | Order cancellation time | @@ -5246,6 +5638,7 @@ The orders created via API will no longer be queryable after being cancelled for | stop-price | string | trigger price of stop limit order | | operator | string | operation character of stop price. e.g. get, lte | | type} | string | All possible order type (refer to introduction in this section) | +| \ | | | | | | next-time | long | Next query "start-time" (in response of "direct" = prev), Next query "end-time" (in response of "direct" = next). Note: Only when the total number of items in the search result exceeded the limitation defined in "size", this field exists. UTC time in millisecond. | @@ -5258,11 +5651,7 @@ This endpoint returns the match results of past and current filled, or partially ### HTTP Request -`GET https://api.huobi.pro/v1/order/matchresults` - -```shell -curl "https://api.huobi.pro/v1/order/matchresults?symbol=ethusdt" -``` + - GET `/v1/order/matchresults` ### Request Parameters @@ -5274,37 +5663,44 @@ curl "https://api.huobi.pro/v1/order/matchresults?symbol=ethusdt" | end-time | false | long | Near point of time of the query window (unix time in millisecond). Searching based on transact-time. The maximum size of the query window is 48 hour. The query window can be shifted within 120 days. | current-time | [(current-time) – 120days,(current-time)] | | from | string | false | N/A | Search internal id to begin with | if search next page, then this should be the last id (not trade-id) of last page; if search previous page, then this should be the first id (not trade-id) of last page | | direct | string | false | next | Search direction when 'from' is used | next, prev | -| size | int | false | 100 | The number of orders to return | [1, 500] | +| size | int | false | 100 | The number of orders to return | [1-500] | > The above command returns JSON structured like this: ```json - "data": [ - { - "id": 29553, - "order-id": 59378, - "match-id": 59335, - "symbol": "ethusdt", - "type": "buy-limit", - "source": "api", - "price": "100.1000000000", - "filled-amount": "9.1155000000", - "filled-fees": "0.0182310000", - "created-at": 1494901400435, - "trade-id": 100282808529, - "role": "taker", - "filled-points": "0.0", - "fee-deduct-currency": "", - "fee-deduct-state": "done" - } - ] +{ + "status": "ok", + "data": [ + { + "symbol": "polyusdt", + "fee-currency": "poly", + "source": "spot-web", + "price": "0.338", + "created-at": 1629443051839, + "role": "taker", + "order-id": 345487249132375, + "match-id": 5014, + "trade-id": 1085, + "filled-amount": "147.928994082840236", + "filled-fees": "0", + "filled-points": "0.1", + "fee-deduct-currency": "hbpoint", + "fee-deduct-state": "done", + "id": 313288753120940, + "type": "buy-market" + } + ] +} ``` ### Response Content + | Field | Data Type | Description | | ------------------- | --------- | ------------------------------------------------------------ | +| status | string | status | | +| \ | object | | | | id | long | Record id, non sequential, it can be used in "from" field for next request | | symbol | string | The trading symbol to trade, e.g. btcusdt, bccbtc | | order-id | long | The order id of this order | @@ -5321,6 +5717,7 @@ curl "https://api.huobi.pro/v1/order/matchresults?symbol=ethusdt" | filled-points | string | deduction amount (unit: in ht or hbpoint) | | fee-deduct-currency | string | deduction type: ht or hbpoint. | | fee-deduct-state | string | Fee deduction status,In deduction:ongoing,Deduction completed:done | +| \ | | | | | Notes:
@@ -5341,10 +5738,6 @@ This endpoint returns the current transaction fee rate applied to the user. API Key Permission:Read -```shell -curl "https://api.huobi.pro/v2/reference/transact-fee-rate?symbols=btcusdt,ethusdt,ltcusdt" -``` - ### HTTP Request `GET /v2/reference/transact-fee-rate` @@ -5359,45 +5752,48 @@ curl "https://api.huobi.pro/v2/reference/transact-fee-rate?symbols=btcusdt,ethus ```json { - "code": "200", - "data": [ - { - "symbol": "btcusdt", - "makerFeeRate":"0.002", - "takerFeeRate":"0.002", - "actualMakerRate": "0.002", - "actualTakerRate":"0.002 - }, - { - "symbol": "ethusdt", - "makerFeeRate":"0.002", - "takerFeeRate":"0.002", - "actualMakerRate": "0.002", - "actualTakerRate":"0.002 - }, - { - "symbol": "ltcusdt", - "makerFeeRate":"0.002", - "takerFeeRate":"0.002", - "actualMakerRate": "0.002", - "actualTakerRate":"0.002 - } - ] + "code": 200, + "data": [ + { + "symbol": "btcusdt", + "actualMakerRate": "0.002", + "actualTakerRate": "0.002", + "takerFeeRate": "0.002", + "makerFeeRate": "0.002" + }, + { + "symbol": "apnusdt", + "actualMakerRate": "0.002", + "actualTakerRate": "0.002", + "takerFeeRate": "0.002", + "makerFeeRate": "0.002" + }, + { + "symbol": "htusdt", + "actualMakerRate": "0.002", + "actualTakerRate": "0.002", + "takerFeeRate": "0.002", + "makerFeeRate": "0.002" + } + ], + "success": true } ``` ### Response Content -| | Field Name | Data Type | Description | | -| ---- | ----------------- | --------- | ------------------------------------------------------------ | ---- | -| | code | integer | Status code | | -| | message | string | Error message (if any) | | -| | data | object | | | -| | { symbol | string | Trading symbol | | -| | makerFeeRate | string | Basic fee rate – passive side (positive value);If maker rebate applicable, revert maker rebate rate (negative value). | | -| | takerFeeRate | string | Basic fee rate – aggressive side | | -| | actualMakerRate | string | Deducted fee rate – passive side (positive value). If deduction is inapplicable or disabled, return basic fee rate.If maker rebate applicable, revert maker rebate rate (negative value). | | -| | actualTakerRate } | string | Deducted fee rate – aggressive side. If deduction is inapplicable or disabled, return basic fee rate. | | +| Field Name | Data Type | Description | | +| ----------------- | --------- | ------------------------------------------------------------ | ---- | +| code | integer | Status code | | +| message | string | Error message (if any) | | +| \ | object | | | +| symbol | string | Trading symbol | | +| makerFeeRate | string | Basic fee rate – passive side (positive value);If maker rebate applicable, revert maker rebate rate (negative value). | | +| takerFeeRate | string | Basic fee rate – aggressive side | | +| actualMakerRate | string | Deducted fee rate – passive side (positive value). If deduction is inapplicable or disabled, return basic fee rate.If maker rebate applicable, revert maker rebate rate (negative value). | | +| actualTakerRate | string | Deducted fee rate – aggressive side. If deduction is inapplicable or disabled, return basic fee rate. | | +| \ | | | | + Note: - If makerFeeRate/actualMakerRate is positive,this field means the transaction fee rate. @@ -5525,7 +5921,8 @@ By comparing with the existing stop limit order, the newly introduced conditiona ## Place a conditional order -POST /v2/algo-orders
+ - POST `/v2/algo-orders` + API Key Permission: Trade
Rate Limit (NEW): 20times/2sec
Conditional order can be only placed via this endpoint instead of any endpoint in "Trading" section.
@@ -5543,7 +5940,7 @@ Conditional order can be only placed via this endpoint instead of any endpoint i | orderType | string | TRUE | | Order type | limit,market | | clientOrderId | string | TRUE | | Client order ID (max length 64-char) | | | stopPrice | string | TRUE | | Stop price | | -| trailingRate | string | FALSE | | Trailing rate (only valid for trailing stop order) | [0.001,0.050] | +| trailingRate | string | FALSE | | Trailing rate (only valid for trailing stop order) | [0.001-0.050] | Note:
• The gap between orderPrice and stopPrice shouldn't exceed the price limit ratio. For example, a limit buy order's price couldn't be higher than 110% of market price, this limitation should be also applicable to orderPrice/stopPrice ratio.
@@ -5567,12 +5964,15 @@ Note:
| ----- | ----- | ------ | ---- | | code | integer | TRUE |Status code | | message | string | FALSE |Error message (if any) | -| data | object | TRUE | | -| { clientOrderId } | string | TRUE |Client order ID | +| \ | object | TRUE | | +| clientOrderId | string | TRUE |Client order ID | +| \ | | | | + ## Cancel conditional orders (before triggering) -POST /v2/algo-orders/cancellation
+ - POST `/v2/algo-orders/cancellation` + API Key Permission: Trade
Rate Limit (NEW): 20times/2sec
This endpoint only supports order cancellation for those conditional orders which have not triggered yet. To cancel a triggered order, please refer to the endpoints in "Trading" section.
@@ -5613,13 +6013,16 @@ Before a conditional order triggering, it can be only cancelled via this endpoin | ----- | ----- | ------ | ---- | | code | integer | TRUE |Status code | | message | string | FALSE |Error message (if any) | -| data | object | TRUE | | -| { accepted | string[] | FALSE | Accepted clientOrderId list | -| rejected } | string[] | TRUE | Rejected clientOrderId list | +| \ | object | TRUE | | +| accepted | string[] | FALSE | Accepted clientOrderId list | +| rejected | string[] | TRUE | Rejected clientOrderId list | +| \ | | | + ## Query open conditional orders (before triggering) -GET /v2/algo-orders/opening
+ - GET `/v2/algo-orders/opening` + API Key Permission: Read
Rate Limit (NEW): 20times/2sec
Search by orderOrigTime
@@ -5644,18 +6047,33 @@ Before a conditional order triggering, it can be queried out through this endpoi "code": 200, "data": [ { - "lastActTime": 1593235832976, - "orderOrigTime": 1593235832937, - "symbol": "btcusdt", - "orderSize": "0.001", - "stopPrice": "5001", - "accountId": 5260185, + "lastActTime": 1630657250326, + "orderOrigTime": 1630657250238, + "symbol": "adausdt", "source": "api", - "clientOrderId": "a001", + "clientOrderId": "123", "orderSide": "buy", "orderType": "limit", + "orderPrice": "0.1", + "orderSize": "100", + "accountId": 13496526, "timeInForce": "gtc", - "orderPrice": "5000", + "stopPrice": "0.1", + "orderStatus": "created" + }, + { + "lastActTime": 1630657243576, + "orderOrigTime": 1630657243534, + "symbol": "adausdt", + "source": "api", + "clientOrderId": "12", + "orderSide": "buy", + "orderType": "limit", + "orderPrice": "0.1", + "orderSize": "100", + "accountId": 13496526, + "timeInForce": "gtc", + "stopPrice": "0.1", "orderStatus": "created" } ] @@ -5667,8 +6085,8 @@ Before a conditional order triggering, it can be queried out through this endpoi | ----- | ----- | ------ | ---- | | code | integer | TRUE |Status code | | message | string | FALSE |Error message (if any) | -| data | object | TRUE |In ascening/descending order defined in 'sort' | -| { accountId | integer | TRUE |Account ID | +| \ | object | TRUE |In ascening/descending order defined in 'sort' | +| accountId | integer | TRUE |Account ID | | source | string | TRUE |Order source (api,web,ios,android,mac,windows,sys) | | clientOrderId | string | TRUE |Client order ID | | symbol | string | TRUE |Trading symbol | @@ -5682,12 +6100,15 @@ Before a conditional order triggering, it can be queried out through this endpoi | trailingRate | string | FALSE | Trailing rate (only valid for trailing stop order) | | orderOrigTime | long | TRUE |Order original time | | lastActTime | long | TRUE |Order last activity time | -| orderStatus } | string | TRUE |Order status (created) | +| orderStatus | string | TRUE |Order status (created) | +| \ | | | | | nextId | long | FALSE |First record ID in next page (only valid if exceeded page size) | + ## Query conditional order history -GET /v2/algo-orders/history
+ - GET `/v2/algo-orders/history` + API Key Permission: Read
Rate Limit (NEW): 20times/2sec
Search by orderOrigTime
@@ -5706,7 +6127,7 @@ The cancelled conditional order before triggering, as well as the conditional or | startTime | long | FALSE | | Farthest time | | endTime | long | FALSE |current time | Nearest time | | | sort | string | FALSE | desc | Sorting order |asc, desc | -| limit | integer | FALSE | 100 | Maximum number of items in one page |[1,500] | +| limit | integer | FALSE | 100 | Maximum number of items in one page |[1-500] | | fromId | long | FALSE | | First record ID in this query (only valid for next page querying) | | > Response @@ -5716,21 +6137,22 @@ The cancelled conditional order before triggering, as well as the conditional or "code": 200, "data": [ { - "orderOrigTime": 1593235832937, - "lastActTime": 1593236344401, - "symbol": "btcusdt", + "orderOrigTime": 1630656758442, + "lastActTime": 1630656880512, + "symbol": "adausdt", "source": "api", + "clientOrderId": "1234567", "orderSide": "buy", "orderType": "limit", + "orderPrice": "0.1", + "orderSize": "100", + "accountId": 13496526, "timeInForce": "gtc", - "clientOrderId": "a001", - "accountId": 5260185, - "orderPrice": "5000", - "orderSize": "0.001", - "stopPrice": "5001", + "stopPrice": "0.1", "orderStatus": "canceled" } - ] + ], + "nextId": 9585084 } ``` @@ -5739,8 +6161,8 @@ The cancelled conditional order before triggering, as well as the conditional or | ----- | ----- | ------ | ---- | | code | integer | TRUE |Status code | | message | string | FALSE |Error message (if any) | -| data | object | TRUE |In ascening/descending order defined in 'sort' | -| { accountId | integer | TRUE |Account ID | +| \ | object | TRUE |In ascening/descending order defined in 'sort' | +| accountId | integer | TRUE |Account ID | | source | string | TRUE |Order source | | clientOrderId | string | TRUE |Client order ID | | orderId | string | FALSE |Order ID (only valid for orderStatus=triggered) | @@ -5759,11 +6181,13 @@ The cancelled conditional order before triggering, as well as the conditional or | orderStatus | string | TRUE |Order status (triggered,canceled,rejected) | | errCode | integer | FALSE |Status code in case of order triggering failure (only valid for orderStatus=rejected) | | errMessage } | string | FALSE |Error message in case of order triggering failure (only valid for orderStatus=rejected) | +| \ | | | | | nextId | long | FALSE |First record ID in next page (only valid if exceeded page size) | ## Query a specific conditional order -GET /v2/algo-orders/specific
+ - GET `/v2/algo-orders/specific` + API Key Permission: Read
Rate Limit (NEW): 20times/2sec
Search by orderOrigTime
@@ -5781,19 +6205,19 @@ The conditional order before triggering, as well as the conditional order failed { "code": 200, "data": { - "lastActTime": 1593236344401, - "orderOrigTime": 1593235832937, - "symbol": "btcusdt", - "orderSize": "0.001", - "stopPrice": "5001", - "accountId": 5260185, + "lastActTime": 1630656880512, + "orderOrigTime": 1630656758442, + "symbol": "adausdt", "source": "api", - "clientOrderId": "a001", + "orderStatus": "canceled", + "clientOrderId": "1234567", "orderSide": "buy", "orderType": "limit", + "orderPrice": "0.1", + "orderSize": "100", + "accountId": 13496526, "timeInForce": "gtc", - "orderPrice": "5000", - "orderStatus": "canceled" + "stopPrice": "0.1" } } ``` @@ -5803,8 +6227,8 @@ The conditional order before triggering, as well as the conditional order failed | ----- | ----- | ------ | ---- | | code | integer | TRUE |Status code | | message | string | FALSE |Error message (if any) | -| data | object | TRUE | | -| { accountId | integer | TRUE |Account ID | +| \ | object | TRUE | | +| accountId | integer | TRUE |Account ID | | source | string | TRUE |Order source | | clientOrderId | string | TRUE |Client order ID | | orderId | string | FALSE |Order ID (only valid for orderStatus=triggered) | @@ -5822,7 +6246,9 @@ The conditional order before triggering, as well as the conditional order failed | orderCreateTime | long | FALSE |Order trigger time (only valid for orderStatus=triggered) | | orderStatus | string | TRUE |Order status (created,triggered,canceled,rejected) | | errCode | integer | FALSE |Status code in case of order triggering failure (only valid for orderStatus=rejected) | -| errMessage } | string | FALSE |Error message in case of order triggering failure (only valid for orderStatus=rejected) | +| errMessage | string | FALSE |Error message in case of order triggering failure (only valid for orderStatus=rejected) | +| \ | | | | + ## Error Code @@ -5870,7 +6296,7 @@ While repaying the loan, loan interest will be paid first if there is no appoint ### HTTP Request -`POST /v2/account/repayment` +- POST `/v2/account/repayment` > Request: @@ -5912,11 +6338,13 @@ While repaying the loan, loan interest will be paid first if there is no appoint | ----------- | ------------- | ------------- | ------------------------------------------ | | code | integer | TRUE | status code | | message | string | FALSE | error description (if any) | -| data | object | TRUE | | -| { repayId | string | TRUE | repayment ID | -| repayTime } | long | TRUE | repayment time (unix time in millisecond) | +| \ | object | TRUE | | +| repayId | string | TRUE | repayment ID | +| repayTime | long | TRUE | repayment time (unix time in millisecond) | +| \ | | | | -Note: Returning "repayId" doesn’t mean the repayment is 100% successful. Please check the transaction record to confirm the repayment status. +### Note: + - Returning "repayId" doesn’t mean the repayment is 100% successful. Please check the transaction record to confirm the repayment status. ## Transfer Asset from Spot Trading Account to Isolated Margin Account(Isolated) @@ -5927,15 +6355,16 @@ This endpoint transfers specific asset from spot trading account to isolated mar ### HTTP Request -`POST https://api.huobi.pro/v1/dw/transfer-in/margin` +- POST `/v1/dw/transfer-in/margin` -```shell -curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/dw/transfer-in/margin" -d -'{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -}' +> Requset + +```json +{ + "symbol": "ethusdt", + "currency": "eth", + "amount": "1.0" +} ``` ### Request Parameters @@ -5949,12 +6378,17 @@ curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/dw/tr > The above command returns JSON structured like this: ```json - "data": 1000 +{ + "status": "ok", + "data": 46971504, + "code": 200 +} ``` ### Response Content + | Field | Data Type | Description | | ----- | --------- | ----------- | | data | integer | Transfer id | @@ -5968,15 +6402,14 @@ This endpoint transfers specific asset from isolated margin account to spot trad ### HTTP Request -`POST https://api.huobi.pro/v1/dw/transfer-out/margin` + - POST `/v1/dw/transfer-out/margin` -```shell -curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/dw/transfer-out/margin" -d -'{ - "symbol": "ethusdt", - "currency": "eth", - "amount": "1.0" -}' +```json +{ + "symbol": "ethusdt", + "currency": "eth", + "amount": "1.0" +} ``` ### Request Parameters @@ -5990,7 +6423,11 @@ curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/dw/tr > The above command returns JSON structured like this: ```json - "data": 1000 +{ + "status": "ok", + "data": 46971504, + "code": 200 +} ``` ### Response Content @@ -6000,6 +6437,7 @@ curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/dw/tr | ----- | --------- | ----------- | | data | integer | Transfer id | + ## Get Loan Interest Rate and Quota(Isolated) API Key Permission: Read
@@ -6011,10 +6449,6 @@ The endpoint returns loan interest rates and quota applied on the user. - GET ` /v1/margin/loan-info` -```shell -curl "https://api.huobi.pro/v1/margin/loan-info?symbols=btcusdt" -``` - ### Request Parameters | Parameter | Data Type | Required | Default | Description | @@ -6026,7 +6460,7 @@ curl "https://api.huobi.pro/v1/margin/loan-info?symbols=btcusdt" ```json { "status": "ok", - "data": + "data": [ { "symbol": "btcusdt", "currencies": [ @@ -6048,6 +6482,7 @@ curl "https://api.huobi.pro/v1/margin/loan-info?symbols=btcusdt" } ] } + ] } ``` @@ -6055,14 +6490,18 @@ curl "https://api.huobi.pro/v1/margin/loan-info?symbols=btcusdt" | Field | Data Type | Description | | -------------- | --------- | ------------------------------------------------------------ | -| { symbol | string | Trading symbol | -| currencies | object | | -| { currencies | string | Currency | +| status | string | status | +| \ | object | | +| symbol | string | Trading symbol | +| \ | object | | +| currency | string | Currency | | interest-rate | string | Basic daily interest rate | | min-loan-amt | string | Minimal loanable amount | | max-loan-amt | string | Maximum loanable amount | | loanable-amt | string | Remaining loanable amount | -| actual-rate }} | string | Actual interest rate (if deduction is inapplicable or disabled, return basic daily interest rate) | +| actual-rate | string | Actual interest rate (if deduction is inapplicable or disabled, return basic daily interest rate) | +| \ | | | +| \ | | | ## Request a Margin Loan(Isolated) @@ -6073,15 +6512,16 @@ This endpoint places an order to apply a margin loan. ### HTTP Request -`POST https://api.huobi.pro/v1/margin/orders` + - POST `/v1/margin/orders` -```shell -curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/margin/orders" -d -'{ +> Request: + +```json +{ "symbol": "ethusdt", "currency": "eth", "amount": "1.0" -}' +} ``` ### Request Parameters @@ -6095,10 +6535,10 @@ curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/margi > The above command returns JSON structured like this: ```json - { - "status": "ok" - "data": 1000 - } +{ + "status": "ok", + "data": 1000 +} ``` ### Response Content @@ -6117,17 +6557,10 @@ This endpoint repays margin loan with your asset in your margin account. ### HTTP Request -`POST https://api.huobi.pro/v1/margin/orders/{order-id}/repay` +- POST `/v1/margin/orders/{order-id}/repay` 'order-id': the previously returned order id when loan order was created -```shell -curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/margin/orders/1000/repay" -d -'{ - "amount": "1.0" -}' -``` - ### Request Parameters | Parameter | Data Type | Required | Default | Description | @@ -6138,7 +6571,9 @@ curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/margi > The above command returns JSON structured like this: ```json +{ "data": 1000 +} ``` ### Response Content @@ -6157,11 +6592,7 @@ This endpoint returns margin orders based on a specific searching criteria. ### HTTP Request -`GET https://api.huobi.pro/v1/margin/loan-orders` - -```shell -curl "https://api.huobi.pro/v1/margin/load-orders?symbol=ethusdt" -``` +- GET `/v1/margin/loan-orders` ### Request Parameters @@ -6213,6 +6644,8 @@ curl "https://api.huobi.pro/v1/margin/load-orders?symbol=ethusdt" | Field | Data Type | Description | | ------------------ | --------- | ------------------------------------------------------------ | +| status | string | status | | +| \ | object | | | | id | integer | Order id | | account-id | integer | Account id | | user-id | integer | User id | @@ -6234,6 +6667,8 @@ curl "https://api.huobi.pro/v1/margin/load-orders?symbol=ethusdt" | updated-at | long | Update time | | hour-interest-rate | string | Hourly interest rate | | day-interest-rate | string | Daily interest rate | +| \ | | | | | + ## Get the Balance of the Margin Loan Account(Isolated) @@ -6244,11 +6679,7 @@ This endpoint returns the balance of the margin loan account. ### HTTP Request -`GET https://api.huobi.pro/v1/margin/accounts/balance` - -```shell -curl "https://api.huobi.pro/v1/margin/accounts/balance?symbol=btcusdt" -``` + - GET `/v1/margin/accounts/balance` ### Request Parameters @@ -6260,63 +6691,71 @@ curl "https://api.huobi.pro/v1/margin/accounts/balance?symbol=btcusdt" > The above command returns JSON structured like this: ```json -"data": [ - { - "id": 18264, - "type": "margin", - "state": "working", - "symbol": "btcusdt", - "fl-price": "0", - "fl-type": "safe", - "risk-rate": "475.952571086994250554", - "list": [ - { - "currency": "btc", - "type": "trade", - "balance": "1168.533000000000000000" - }, - { - "currency": "btc", - "type": "frozen", - "balance": "0.000000000000000000" - }, - { - "currency": "btc", - "type": "loan", - "balance": "-2.433000000000000000" - }, - { - "currency": "btc", - "type": "interest", - "balance": "-0.000533000000000000" - }, - { - "currency": "btc", - "type": "transfer-out-available", - "balance": "1163.872174670000000000" - }, - { - "currency": "btc", - "type": "loan-available", - "balance": "8161.876538350676000000" - } - ] - } -] +{ + "data": [ + { + "id": 18264, + "type": "margin", + "state": "working", + "symbol": "btcusdt", + "fl-price": "0", + "fl-type": "safe", + "risk-rate": "475.952571086994250554", + "list": [ + { + "currency": "btc", + "type": "trade", + "balance": "1168.533000000000000000" + }, + { + "currency": "btc", + "type": "frozen", + "balance": "0.000000000000000000" + }, + { + "currency": "btc", + "type": "loan", + "balance": "-2.433000000000000000" + }, + { + "currency": "btc", + "type": "interest", + "balance": "-0.000533000000000000" + }, + { + "currency": "btc", + "type": "transfer-out-available", + "balance": "1163.872174670000000000" + }, + { + "currency": "btc", + "type": "loan-available", + "balance": "8161.876538350676000000" + } + ] + } + ] +} ``` ### Response Content | Field | Data Type | Description | | ---------- | --------- | ------------------------------------------------------------ | +| \ | true | object | | | +| id | true | int | | | +| type | true | string | | | | symbol | string | The margin loan pair, e.g. btcusdt, bccbtc | | state | string | Loan state, possible values: created, accrual (loaned), cleared (paid), invalid | | risk-rate | string | The risk rate | | fl-price | string | The price which margin closeout was triggered | -| list | array | The list of margin accounts and their details | -| { currency | string | The currency name | +| \ | array | The list of margin accounts and their details | +| currency | string | The currency name | | type | string | The sub account type, possible values: trade, frozen, loan, interest ,transfer-out-available, loan-available | -| balance } | string | The negative balance means the loan or interest that need to repay. All trade balance can be transferred out if transfer-out-available balance is -1 | +| balance | string | The negative balance means the loan or interest that need to repay. All trade balance can be transferred out if transfer-out-available balance is -1 | +| \ | | | | | +| \ | | | | | + ## Transfer Asset from Spot Trading Account to Cross Margin Account(Cross) @@ -6326,14 +6765,15 @@ This endpoint transfers specific asset from spot trading account to cross margin ### HTTP Request -`POST https://api.huobi.pro/v1/cross-margin/transfer-in` + - POST `/v1/cross-margin/transfer-in` -```shell -curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/cross-margin/transfer-in" -d -'{ +> Request: + +```json +{ "currency": "eth", "amount": "1.0" -}' +} ``` ### Request Parameters @@ -6369,16 +6809,15 @@ This endpoint transfers specific asset from cross margin account to spot trading ### HTTP Request -`POST https://api.huobi.pro/v1/cross-margin/transfer-in` + - POST `/v1/cross-margin/transfer-out` -`POST https://api.huobi.pro/v1/cross-margin/transfer-out` +> Request: -```shell -curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/cross-margin/transfer-out" -d -'{ +```json +{ "currency": "eth", "amount": "1.0" -}' +} ``` ### Request Parameters @@ -6404,6 +6843,7 @@ curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/cross | ----- | --------- | ----------- | | data | integer | Transfer id | + ## Get Loan Interest Rate and Quota(Cross) API Key Permission: Read @@ -6414,10 +6854,6 @@ This endpoint returns loan interest rates and loan quota applied on the user. - GET ` /v1/cross-margin/loan-info` -```shell -curl "https://api.huobi.pro/v1/cross-margin/loan-info" -``` - ### Request Parameters Null @@ -6484,7 +6920,8 @@ Null "loanable-amt": "734.21439060", "actual-rate": "0.000343" } - ] + ], + "code": 200 } ``` @@ -6492,12 +6929,16 @@ Null | Field | Data Type | Description | | ------------- | --------- | ------------------------------------------------------------ | -| { currency | string | Currency | +| status | string | status | +| \ | object | | +| currency | string | Currency | | interest-rate | string | Basic daily interest rate | | min-loan-amt | string | Minimal loanable amount | | max-loan-amt | string | Maximum loanable amount | | loanable-amt | string | Remaining loanable amount | -| actual-rate } | string | Actual interest rate post deduction (if deduction is inapplicable or disabled, return basic daily interest rate) | +| actual-rate | string | Actual interest rate post deduction (if deduction is inapplicable or disabled, return basic daily interest rate) | +| \ | | | +| code | int | status code | ## Request a Margin Loan(Cross) @@ -6507,14 +6948,15 @@ This endpoint places an order to apply for a margin loan. ### HTTP Request -`POST https://api.huobi.pro/v1/cross-margin/orders` + - POST `/v1/cross-margin/orders` -```shell -curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/cross-margin/orders" -d -'{ +> Request: + +```json +{ "currency": "eth", "amount": "1.0" -}' +} ``` ### Request Parameters @@ -6538,6 +6980,7 @@ curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/cross | Field | Data Type | Description | | ----- | --------- | --------------- | +| status | string | status | | data | integer | Margin order id | ## Repay Margin Loan(Cross) @@ -6548,21 +6991,23 @@ This endpoint repays margin loan with you asset in your margin account. ### HTTP Request -`POST https://api.huobi.pro/v1/cross-margin/orders/{order-id}/repay` + - POST `/v1/cross-margin/orders/{order-id}/repay` 'order-id': the previously returned order id when loan order was created -```shell -curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/cross-margin/orders/1000/repay" -d -'{ +> Request: + +```json +{ "amount": "1.0" -}' +} ``` ### Request Parameters | Parameter | Data Type | Required | Default | Description | | --------- | --------- | -------- | ------- | ------------------------------- | +| order-id | string | true | Loan order ID (written in url path) | | amount | string | true | NA | The amount of currency to repay | > The above command returns JSON structured like this: @@ -6579,6 +7024,7 @@ curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/v1/cross | Field | Data Type | Description | | ----- | --------- | ----------- | +| status | string | status | | data | null | NA | ## Search Past Margin Orders(Cross) @@ -6589,11 +7035,7 @@ This endpoint returns margin orders based on a specific searching criteria. ### HTTP Request -`GET https://api.huobi.pro/v1/cross-margin/loan-orders` - -```shell -curl "https://api.huobi.pro/v1/cross-margin/loan-orders?symbol=ethusdt" -``` + - GET `/v1/cross-margin/loan-orders` ### Request Parameters @@ -6605,31 +7047,31 @@ curl "https://api.huobi.pro/v1/cross-margin/loan-orders?symbol=ethusdt" | state | string | false | all | Order status | created, accrual (loaned), cleared (paid), invalid | | from | string | false | 0 | Search order id to begin with | NA | | direct | string | false | next | Search direction when 'from' is used | next, prev | -| size | string | false | 10 | The number of orders to return | [10,100] | +| size | string | false | 10 | The number of orders to return | [10-100] | | sub-uid | long | false | If not specified, returns loan order list of current logged in user | Sub user UID | | > The above command returns JSON structured like this: ```json -{ - "status": "ok", - "data": [ - { - "loan-balance": "0.100000000000000000", - "interest-balance": "0.000200000000000000", - "loan-amount": "0.100000000000000000", - "accrued-at": 1511169724531, - "interest-amount": "0.000200000000000000", - "filled-points" : "0.2", - "filled-ht" : "0.2", - "currency": "btc", - "id": 394, - "state": "accrual", - "account-id": 17747, - "user-id": 119913, - "created-at": 1511169724531 - } - ] +{ + "status":"ok", + "data":[ + { + "loan-balance":"0.100000000000000000", + "interest-balance":"0.000200000000000000", + "loan-amount":"0.100000000000000000", + "accrued-at":1511169724531, + "interest-amount":"0.000200000000000000", + "filled-points":"0.2", + "filled-ht":"0.2", + "currency":"btc", + "id":394, + "state":"accrual", + "account-id":17747, + "user-id":119913, + "created-at":1511169724531 + } + ] } ``` @@ -6637,6 +7079,8 @@ curl "https://api.huobi.pro/v1/cross-margin/loan-orders?symbol=ethusdt" | Field | Data Type | Description | | ---------------- | --------- | ------------------------------------------------------------ | +| status | true | string | status | | +| \ | true | object | | | | id | integer | Order id | | account-id | integer | Account id | | user-id | integer | User id | @@ -6650,6 +7094,7 @@ curl "https://api.huobi.pro/v1/cross-margin/loan-orders?symbol=ethusdt" | interest-amount | string | The accumulated loan interest | | interest-balance | string | The amount of loan interest left | | state | string | Loan state, possible values: created, accrual (loaned), cleared (paid), invalid | +| \ | | | | | ## Get the Balance of the Margin Loan Account(Cross) @@ -6659,11 +7104,7 @@ This endpoint returns the balance of the margin loan account. ### HTTP Request -`GET https://api.huobi.pro/v1/cross-margin/accounts/balance` - -```shell -curl "https://api.huobi.pro/v1/cross-margin/accounts/balance?symbol=btcusdt" -``` + - GET `/v1/cross-margin/accounts/balance` ### Request Parameters @@ -6674,48 +7115,47 @@ curl "https://api.huobi.pro/v1/cross-margin/accounts/balance?symbol=btcusdt" > The above command returns JSON structured like this: ```json -{ - "status": "ok", - "data": - { - "id": 18264, - "type": "cross-margin", - "state": "working", - "risk-rate": "1000", - "acct-balance-sum": "12312.123123", - "debt-balance-sum": "1231.2123123", - "list": [ - { - "currency": "btc", - "type": "trade", - "balance": "1168.533000000000000000" - }, - { - "currency": "btc", - "type": "frozen", - "balance": "0.000000000000000000" - }, - { - "currency": "btc", - "type": "loan", - "balance": "-2.433000000000000000" - }, - { - "currency": "btc", - "type": "interest", - "balance": "-0.000533000000000000" - }, - { - "currency": "btc", - "type": "transfer-out-available",//可转btc - "balance": "1163.872174670000000000" - }, - { - "currency": "btc", - "type": "loan-available",//可借btc - "balance": "8161.876538350676000000" - } - ] +{ + "status":"ok", + "data":{ + "id":18264, + "type":"cross-margin", + "state":"working", + "risk-rate":"1000", + "acct-balance-sum":"12312.123123", + "debt-balance-sum":"1231.2123123", + "list":[ + { + "currency":"btc", + "type":"trade", + "balance":"1168.533000000000000000" + }, + { + "currency":"btc", + "type":"frozen", + "balance":"0.000000000000000000" + }, + { + "currency":"btc", + "type":"loan", + "balance":"-2.433000000000000000" + }, + { + "currency":"btc", + "type":"interest", + "balance":"-0.000533000000000000" + }, + { + "currency":"btc", + "type":"transfer-out-available", + "balance":"1163.872174670000000000" + }, + { + "currency":"btc", + "type":"loan-available", + "balance":"8161.876538350676000000" + } + ] } } ``` @@ -6724,17 +7164,20 @@ curl "https://api.huobi.pro/v1/cross-margin/accounts/balance?symbol=btcusdt" | Field | Data Type | Description | | ---------------- | --------- | ------------------------------------------------------------ | +| status | true | string | status | +| \ | true | object | | | id | integer | | | type | integer | | | state | string | account state: working, fl-sys, fl-end, fl-negative | | risk-rate | string | | | acct-balance-sum | string | | | debt-balance-sum | string | | -| list | array | | -| { currency | string | | +| \ | array | | +| currency | string | | | type | string | account type: trade, frozen, loan, interest, transfer-out-available, loan-available | -| balance } | string | The negative balance means the loan or interest that need to repay. All trade balance can be transferred out if transfer-out-available balance is -1 | - +| balance | string | The negative balance means the loan or interest that need to repay. All trade balance can be transferred out if transfer-out-available balance is -1 | +| \ | | | | +| \ | | | | ## Repayment Record Reference @@ -6749,7 +7192,7 @@ Sort by "repayTime" ### HTTP Request -`GET /v2/account/repayment` + - GET `/v2/account/repayment` ### Request Parameters @@ -6761,7 +7204,7 @@ Sort by "repayTime" | startTime | long | FALSE | start time (unix time in millisecond; range: [(endTime – x D), endTime]; default value: (endTime – x D) | | endTime | long | FALSE | end time (unix time in millisecond;range: [(present time – y D), present time]; default value: present time) | | sort | string | FALSE | sort direction (value: asc, desc; default value: desc) | -| limit | integer | FALSE | max return items per page (range: [1,100]; default value: 50) | +| limit | integer | FALSE | max return items per page (range: [1-100]; default value: 50) | | fromId | long | FALSE | search ID from the start (only available when searching for the next page) | > Response: @@ -6795,18 +7238,20 @@ Sort by "repayTime" | --------------- | --------- | --------- | ------------------------------------------------------------ | | code | integer | TRUE | status code | | message | string | FALSE | error description (if any) | -| data | object | TRUE | sorted by the appointed order | -| { repayId | string | TRUE | repayment transaction ID | +| \ | object | TRUE | sorted by the appointed order | +| repayId | string | TRUE | repayment transaction ID | | repayTime | long | TRUE | repayment transaction time (unix time in millisecond) | | accountId | string | TRUE | repayment account ID | | currency | string | TRUE | repayment currency | | repaidAmount | string | TRUE | repaid amount | -| transactIds | object | TRUE | ID list of original loan transactions (arranged by order of repaymen time) | -| { transactId | long | TRUE | original loan transaction ID | +| \ | object | TRUE | ID list of original loan transactions (arranged by order of repaymen time) | +| transactId | long | TRUE | original loan transaction ID | | repaidPrincipal | string | TRUE | principal repaid | | repaidInterest | string | TRUE | interest repaid | | paidHt | string | TRUE | HT paid | -| paidPoint }} | string | TRUE | point paid | +| paidPoint | string | TRUE | point paid | +| \ | | | | +| \ | | | | | nextId | long | FALSE | search the start ID in the next page (return only when there is data in the next page) | ## Error Code @@ -6898,7 +7343,8 @@ The account ID of borrowing account will be generated once the first time asset ## Place a lending/borrowing offer -POST /v2/c2c/offer
+ - POST `/v2/c2c/offer` + API Key Permission: Trade
### Request Parameter @@ -6920,7 +7366,7 @@ Note:
```json { "data": { - "offerId": 14743 + "offerId": 14743, "createTime": 1593172709875 }, "code": 200, @@ -6933,13 +7379,16 @@ Note:
| ----- | --------- | --------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | -| data | object | TRUE | | -| { offerId | string | TRUE | Offer ID | -| createTime } | long | TRUE | Offer creation time (unix time in millisecond) | +| \ | object | TRUE | | +| offerId | string | TRUE | Offer ID | +| createTime | long | TRUE | Offer creation time (unix time in millisecond) | +| \ | | | | + ## Cancel a lending/borrowing offer -POST /v2/c2c/cancellation
+ - POST `/v2/c2c/cancellation` + API Key Permission: Trade
### Request Parameter @@ -6970,20 +7419,24 @@ API Key Permission: Trade
| ----- | --------- | --------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | -| data | object | TRUE | | -| { accepted | object | TRUE | Accepted offer list | -| [ offerId ] | string | FALSE | Offer ID | -| rejected | object | TRUE | Rejected offer list | -| [ offerId | string | FALSE | Offer ID | +| \ | object | TRUE | | +| \ | object | TRUE | Accepted offer list | +| offerId | string | FALSE | Offer ID | +| \| | | | +| \ | object | TRUE | Rejected offer list | +| offerId | string | FALSE | Offer ID | | errCode | integer | FALSE | Error code for rejection | -| errMessage ]} | string | FALSE | Error message for rejection | +| errMessage | string | FALSE | Error message for rejection | +| \ | | | | +| \ | | | | Note:
• The acceptance of offer cancellation does not implicate the success of cancellation. Users should query the relevant offers after the cancellation to confirm their status.
## Cancel all lending/borrowing offers -POST /v2/c2c/cancel-all
+ - POST `/v2/c2c/cancel-all` + API Key Permission: Trade
Maximum 500 offers can be cancelled in a single request. (to be cancelled in descending order of offerId)
@@ -6998,15 +7451,15 @@ Maximum 500 offers can be cancelled in a single request. (to be cancelled in des ```json { - "data": { - "accepted": [ - { - "offerId": "14742" - } - ] - }, - "code": 200, - "success": true + "data":{ + "accepted":[ + { + "offerId":"14742" + } + ] + }, + "code":200, + "success":true } ``` @@ -7015,20 +7468,25 @@ Maximum 500 offers can be cancelled in a single request. (to be cancelled in des | ----- | --------- | --------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | -| data | object | TRUE | | -| { accepted | object | TRUE | Accepted offer list | -| [ offerId ] | string | FALSE | Offer ID | -| rejected | object | TRUE | Rejected offer list | -| [ offerId | string | FALSE | Offer ID | +| \ | object | TRUE | | +| \ | object | TRUE | Accepted offer list | +| offerId | string | FALSE | Offer ID | +| \| | | | +| \ | object | TRUE | Rejected offer list | +| offerId | string | FALSE | Offer ID | | errCode | integer | FALSE | Error code of rejection | -| errMessage ]} | string | FALSE | Error message of rejection | +| errMessage | string | FALSE | Error message of rejection | +| \| | | | +| \ | | | | + Note:
• The acceptance of offer cancellation does not implicate the success of cancellation. Users should query the offer after the cancellation to confirm its status.
## Query lending/borrow offers -GET /v2/c2c/offers
+ - GET `/v2/c2c/offers` + API Key Permission: Read
Searched by createTime
@@ -7041,7 +7499,7 @@ Searched by createTime
| offerStatus | string | TRUE | Offer status (valid value: submitted, filled, partial-filled, canceled, partial-canceled; multiple inputs are allowed, separated by comma) | | startTime | long | FALSE | Farthest time (unix time in millisecond) | | endTime | long | FALSE | Nearest time (unix time in millisecond) | -| limit | integer | FALSE | Maximum number of items in one page (valid range:[1,100]; default value:50) | +| limit | integer | FALSE | Maximum number of items in one page (valid range:[1-100]; default value:50) | | fromId | long | FALSE | First record ID in this query (only valid for next page querying) | > Response @@ -7087,8 +7545,8 @@ Searched by createTime
| ----- | --------- | --------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | -| data | object | TRUE | In decending order of createTime | -| { offerId | string | TRUE | Offer ID | +| \ | object | TRUE | In decending order of createTime | +| offerId | string | TRUE | Offer ID | | createTime | long | TRUE | Offer creation time (unix time in millisecond) | | lastActTime | long | TRUE | Offer update time (unix time in millisecond) | | offerStatus | string | TRUE | Offer status (valid value:submitted, filled, partial-filled, canceled, partial-canceled) | @@ -7099,12 +7557,14 @@ Searched by createTime
| origAmount | string | TRUE | Original offer value | | amount | string | TRUE | Remaining offer value | | interestRate | string | TRUE | Daily interest rate | -| loanTerm } | integer | TRUE | Loan term | +| loanTerm | integer | TRUE | Loan term | +| \
| | | | | nextId | long | FALSE | First record ID in next page (only valid if exceeded page size) | ## Query a lending/borrowing offer -GET /v2/c2c/offer
+ - GET `/v2/c2c/offer` + API Key Permission: Read
### Request Parameter @@ -7152,8 +7612,8 @@ API Key Permission: Read
| ----- | --------- | --------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | -| data | object | TRUE | | -| { offerId | string | TRUE | Offer ID | +| \ | object | TRUE | | +| offerId | string | TRUE | Offer ID | | createTime | long | TRUE | Offer creation time (unix time in millisecond) | | lastActTime | long | TRUE | Offer update time (unix time in millisecond) | | offerStatus | string | TRUE | Offer status (valid value: submitted, filled, partial-filled, canceled, partial-canceled) | @@ -7165,8 +7625,8 @@ API Key Permission: Read
| amount | string | TRUE | Remaining offer value | | interestRate | string | TRUE | Daily interest rate | | loanTerm | integer | TRUE | Loan term | -| transactions | object | TRUE | In descending order of transactTime | -| { transactRate | string | TRUE | Transaction interest rate | +| \ | object | TRUE | In descending order of transactTime | +| transactRate | string | TRUE | Transaction interest rate | | transactAmount | string | TRUE | Transaction value | | transactTime | long | TRUE | Transaction time (unix time in millisecond) | | transactId | long | TRUE | Transaction ID | @@ -7174,11 +7634,15 @@ API Key Permission: Read
| unpaidPrincipal | string | TRUE | Unpaid principal | | unpaidInterest | string | TRUE | Unpaid interest (till query time) | | paidInterest | string | TRUE | Paid interest | -| transactStatus }} | string | TRUE | Repayment status (valid value: pending, closed) | +| transactStatus | string | TRUE | Repayment status (valid value: pending, closed) | +| \
| | | | +| \
| | | | + ## Query lending/borrowing transactions -GET /v2/c2c/transactions
+ - GET `/v2/c2c/transactions` + API Key Permission: Read
Searched by transactTime
@@ -7191,7 +7655,7 @@ Searched by transactTime
| transactStatus | string | TRUE | Repayment status (valid value: pending, closed) | | startTime | long | FALSE | Farthest time (unix time in millisecond) | | endTime | long | FALSE | Nearest time (unix time in millisecond) | -| limit | integer | FALSE | Maximum number of items in one page (valid range:[1,100]; default value:50) | +| limit | integer | FALSE | Maximum number of items in one page (valid range:[1-100]; default value:50) | | fromId | long | FALSE | First record ID in this query (only valid for next page querying) | > Response @@ -7210,7 +7674,7 @@ Searched by transactTime
"piadInterest": "0.00007917", "transactStatus": "closed", "offerId": "14736", - "accountId" "13699363", + "accountId": "13699363", "currency": "usdt", "side": "borrow" } @@ -7225,8 +7689,8 @@ Searched by transactTime
| ----- | --------- | --------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | -| data | object | TRUE | In descending order of transactTime | -| { transactRate | string | TRUE | Transaction interest rate | +| \ | object | TRUE | In descending order of transactTime | +| transactRate | string | TRUE | Transaction interest rate | | transactAmount | string | TRUE | Transaction value | | transactTime | long | TRUE | Transaction time (unix time in millisecond) | | transactId | long | TRUE | Transaction ID | @@ -7238,12 +7702,14 @@ Searched by transactTime
| offerId | string | TRUE | Offer ID | | accountId | string | TRUE | Account ID | | currency | string | TRUE | Cryptocurrency of lending/borrowing | -| side } | string | TRUE | Offer side (valid value: lend, borrow) | +| side | string | TRUE | Offer side (valid value: lend, borrow) | +| \
| | | | | nextId | long | FALSE | First record ID in next page (only valid if exceeded page size) | ## Repay a borrowing offer -POST /v2/c2c/repayment
+ - POST `/v2/c2c/repayment` + API Key Permission: Trade
### Request Parameter @@ -7275,16 +7741,18 @@ Note:
| ----- | --------- | --------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | -| data | object | TRUE | | -| { repayId | string | TRUE | Repayment ID | -| repayTime } | long | TRUE | Repay time (unix time in millisecond) | +| \ | object | TRUE | | +| repayId | string | TRUE | Repayment ID | +| repayTime | long | TRUE | Repay time (unix time in millisecond) | +| \ | | | | Note:
• The receipt of repayment ID does not implicate the success of repayment. User should query the repayment history to confirm its status.
## Query C2C repayments -GET /v2/c2c/repayment
+ - GET `/v2/c2c/repayment` + API Key Permission: Read
Seached by repayTime
@@ -7296,7 +7764,7 @@ Seached by repayTime
| currency | string | FALSE | Cryptocurrency of lending/borrowing (default value: all eligible currencies) | | startTime | long | FALSE | Farthest time (unix time in millisecond) | | endTime | long | FALSE | Nearest time (unix time in millisecond) | -| limit | integer | FALSE | Maximum number of items in one page (valid range:[1,100]; default value:50) | +| limit | integer | FALSE | Maximum number of items in one page (valid range:[1-100]; default value:50) | | fromId | long | FALSE | First record ID in this query (only valid for next page querying) | > Response @@ -7342,21 +7810,24 @@ Seached by repayTime
| ----- | --------- | --------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | -| data | object | TRUE | In descending order of repayTime | -| { repayId | string | TRUE | Repayment ID | +| \ | object | TRUE | In descending order of repayTime | +| repayId | string | TRUE | Repayment ID | | repayTime | long | TRUE | Repay time (unix time in millisecond) | | accountId | string | TRUE | Account ID | | currency | string | TRUE | Currency | | paidAmount | string | TRUE | Paid value | -| transactIds | object | TRUE | Repayment ID list (in ascending order of repayment sequence) | -| { transactId | long | TRUE | Repayment ID | +| \ | object | TRUE | Repayment ID list (in ascending order of repayment sequence) | +| transactId | long | TRUE | Repayment ID | | paidPrincipal | string | TRUE | Paid principal | -| paidInterest }} | string | TRUE | Paid interest | +| paidInterest | string | TRUE | Paid interest | +| \ | | | | +| \ | | | | | nextId | long | FALSE | First record ID in next page (only valid if exceeded page size) | ## Transfer asset -POST /v2/c2c/transfer
+ - POST `/v2/c2c/transfer` + API Key Permission: Trade
### Request Parameter @@ -7369,7 +7840,6 @@ API Key Permission: Trade
Note:
• Only transfers between spot account and specific borrowing account are -GET /v2/c2c/repayment allowed.
> Response @@ -7389,13 +7859,16 @@ GET /v2/c2c/repayment allowed.
| ----- | --------- | --------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | -| data | object | TRUE | | -| { transactId | string | TRUE | Transaction ID | -| transactTime } | long | TRUE | Transaction time (unix time in millisecond) | +| \ | object | TRUE | | +| transactId | string | TRUE | Transaction ID | +| transactTime | long | TRUE | Transaction time (unix time in millisecond) | +| \ | | | | + ## Query C2C account balance -GET /v2/c2c/account
+ - GET `/v2/c2c/account` + API Key Permission: Read
### Request Parameter @@ -7458,22 +7931,25 @@ API Key Permission: Read
| ----- | --------- | --------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | -| data | object | TRUE | | -| { accountId | string | TRUE | Account ID | +| \ | object | TRUE | | +| accountId | string | TRUE | Account ID | | accountStatus | string | TRUE | Account status (working, lock, fl-sys, fl-mgt, fl-end, fl-negative) | | symbol | string | FALSE | Currency pair (Only valid for borrowing account) | | riskRate | string | FALSE | Risk rate (Only valid for borrowing account) | -| subAccountTypes | object | TRUE | Sub account list | -| { subAccountType | string | TRUE | Sub account (trade, lending, earnings, loan, interest, advance) | +| \ | object | TRUE | Sub account list | +| subAccountType | string | TRUE | Sub account (trade, lending, earnings, loan, interest, advance) | | currency | string | TRUE | Currency | | acctBalance | string | TRUE | Account balance | | availBalance | string | FALSE | Available balance (Only valid for sub account "trade") | | transferable | string | FALSE | Transferable value (Only valid for sub account "trade") | -| borrowable }} | string | FALSE | Borrowable value (Only valid for sub account "trade") | +| borrowable | string | FALSE | Borrowable value (Only valid for sub account "trade") | +| \ | | | | +| \ | | | | + Note:
• Sub account trade, loan, interest, advance are only valid for borrowing account;
-• Sub account trade, lending, earnings are only valid for lending account. 
+• Sub account trade, lending, earnings are only valid for lending account.
## Error Code @@ -7559,10 +8035,10 @@ When client receives this heartbeat message, it should respond with a matching " To receive data you have to send a "sub" message first. -{ - "sub": "topic to sub", - "id": "id generate by client" -} +`{` + `"sub": "topic to sub",` + `"id": "id generate by client"` +`}` > Sub response: @@ -7616,10 +8092,10 @@ While connected to websocket, you can also use it in pull style by sending messa To request pull style data, you send below message -{ - "req": "topic to req", - "id": "id generate by client" -} +`{` + `"req": "topic to req",` + `"id": "id generate by client"` +`}` You will receive a response accordingly and immediately @@ -7668,18 +8144,18 @@ This topic sends a new candlestick whenever it is available. ```json { - "ch": "market.ethbtc.kline.1min", - "ts": 1489474082831, //system update time - "tick": { - "id": 1489464480, - "amount": 0.0, - "count": 0, - "open": 7962.62, - "close": 7962.62, - "low": 7962.62, - "high": 7962.62, - "vol": 0.0 - } + "ch":"market.ethbtc.kline.1min", + "ts":1630981694370, + "tick":{ + "id":1630981680, + "open":0.074849, + "close":0.074848, + "low":0.074848, + "high":0.074849, + "amount":2.4448, + "vol":0.1829884187, + "count":3 + } } ``` @@ -7687,6 +8163,9 @@ This topic sends a new candlestick whenever it is available. | Field | Data Type | Description | | ------ | --------- | ------------------------------------------------------------ | +| ch | string | Data belonged channel,Format:market.$symbol.kline.$period | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \ | object | | | id | integer | UNIX epoch timestamp in second as response id | | amount | float | Aggregated trading volume during the interval (in base currency) | | count | integer | Number of trades during the interval | @@ -7695,8 +8174,10 @@ This topic sends a new candlestick whenever it is available. | low | float | Low price during the interval | | high | float | High price during the interval | | vol | float | Aggregated trading value during the interval (in quote currency) | +| \ | | | + ### Pull Request Pull request is supported with extra parameters to define the range. The maximum number of ticks in each response is 300. @@ -7741,23 +8222,23 @@ Retrieve the market ticker,data is pushed every 100ms. ```json { -"ch": "market.btcusdt.ticker", -"ts": 1628587397308, -"tick": { -"open": 44718.5, -"high": 46711, -"low": 44480.81, -"close": 45868.99, -"amount": 22527.427922989766, -"vol": 1030630905.0136755, -"count": 676424, -"bid": 45868.98, -"bidSize": 0.016782, -"ask": 45868.99, -"askSize": 3.1279664455029423, -"lastPrice": 45868.99, -"lastSize": 0.007444 -} + "ch":"market.btcusdt.ticker", + "ts":1630982370526, + "tick":{ + "open":51732, + "high":52785.64, + "low":51000, + "close":52735.63, + "amount":13259.24137056181, + "vol":687640987.4125315, + "count":448737, + "bid":52732.88, + "bidSize":0.036, + "ask":52732.89, + "askSize":0.583653, + "lastPrice":52735.63, + "lastSize":0.03 + } } ``` @@ -7765,6 +8246,9 @@ Retrieve the market ticker,data is pushed every 100ms. | Field | Data Type | Description | | --------- | --------- | ------------------------------------------------------------ | +| ch | string | Data belonged channel,Format:market.$symbol.ticker | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \ | object | | | id | long | The internal identity | | amount | float | Accumulated trading volume of last 24 hours (rotating 24h), in base currency | | count | integer | The number of completed trades (rotating 24h) | @@ -7779,8 +8263,8 @@ Retrieve the market ticker,data is pushed every 100ms. | askSize | float | Best ask size | | lastPrice | float | Last traded price | | lastSize | float | Last traded size | +| \ | | | -## ## Market Depth @@ -7835,32 +8319,50 @@ While type is set as ‘step1’, ‘step2’, ‘step3’, ‘step4’, or ‘s ```json { - "ch": "market.htusdt.depth.step0", - "ts": 1572362902027, //system update time - "tick": { - "bids": [ - [3.7721, 344.86],// [price, size] - [3.7709, 46.66] - ], - "asks": [ - [3.7745, 15.44], - [3.7746, 70.52] - ], - "version": 100434317651, - "ts": 1572362902012 //quote time - } + "ch":"market.btcusdt.depth.step0", + "ts":1630983549503, + "tick":{ + "bids":[ + [ + 52690.69, + 0.36281 + ], + [ + 52690.68, + 0.2 + ] + ], + "asks":[ + [ + 52690.7, + 0.372591 + ], + [ + 52691.26, + 0.13 + ] + ], + "version":136998124622, + "ts":1630983549500 + } } ``` ### Update Content + | Field | Data Type | Description | | ------- | --------- | ------------------------------------------------------------ | +| ch | string | Data belonged channel,Format:market.$symbol.depth.$type | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \| object | | | bids | object | The current all bids in format [price, size] | | asks | object | The current all asks in format [price, size] | | version | integer | Internal data | | ts | integer | The UNIX timestamp in milliseconds adjusted to Singapore time | +| \ | | | + ### Pull Request @@ -7901,13 +8403,16 @@ Currently Huobi Global only supports 5-level/20-level MBP incremental channel an ```json { - "ch": "market.btcusdt.mbp.5", - "ts": 1573199608679, - "tick": { - "seqNum": 100020146795, - "prevSeqNum": 100020146794, - "asks": [ - [645.140000000000000000, 26.755973959140651643] + "ch":"market.btcusdt.mbp.5", + "ts":1630985211662, + "tick":{ + "seqNum":136999309829, + "prevSeqNum":136999309815, + "bids":[ + [ + 52771.08, + 1.804671 + ] ] } } @@ -7999,13 +8504,13 @@ REQ channel supports refreshing message for 5-level, 20-level, and 150-level. { "ch": "market.btcusdt.mbp.5", "ts": 1573199608679, //system update time - "tick": { - "seqNum": 100020146795, - "prevSeqNum": 100020146794, - "asks": [ - [645.140000000000000000, 26.755973959140651643] // [price, size] - ] - } + "tick": { + "seqNum": 100020146795, + "prevSeqNum": 100020146794, + "asks": [ + [645.140000000000000000, 26.755973959140651643] // [price, size] + ] + } } ``` @@ -8152,17 +8657,17 @@ User can receive BBO (Best Bid/Offer) update in tick by tick mode. ```json { - "ch": "market.btcusdt.bbo", - "ts": 1489474082831, //system update time - "tick": { - "symbol": "btcusdt", - "quoteTime": "1489474082811", - "bid": "10008.31", - "bidSize": "0.01", - "ask": "10009.54", - "askSize": "0.3" - "seqId": "1276823698734" - } + "ch":"market.btcusdt.bbo", + "ts":1630994555540, + "tick":{ + "seqId":137005210233, + "ask":52665.02, + "askSize":1.502181, + "bid":52665.01, + "bidSize":0.178567, + "quoteTime":1630994555539, + "symbol":"btcusdt" + } } ``` @@ -8170,6 +8675,9 @@ User can receive BBO (Best Bid/Offer) update in tick by tick mode. | Field | Data Type | Description | | --------- | --------- | --------------- | +| ch | string | Data belonged channel,Format:market.$symbol.kline.$period | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \ | object | | | symbol | string | Trading symbol | | quoteTime | long | Quote time | | bid | float | Best bid | @@ -8177,6 +8685,7 @@ User can receive BBO (Best Bid/Offer) update in tick by tick mode. | ask | float | Best ask | | askSize | float | Best ask size | | seqId | int | Sequence number | +| \ | | | ## Trade Detail @@ -8217,23 +8726,22 @@ This topic sends the latest completed trades. It updates in tick by tick mode. ```json { - "ch": "market.btcusdt.trade.detail", - "ts": 1489474082831, //system update time - "tick": { - "id": 14650745135, - "ts": 1533265950234, //trade time - "data": [ + "ch":"market.btcusdt.trade.detail", + "ts":1630994963175, + "tick":{ + "id":137005445109, + "ts":1630994963173, + "data":[ { - "amount": 0.0099, - "ts": 1533265950234, //trade time - "id": 146507451359183894799, - "tradeId": 102043495674, - "price": 401.74, - "direction": "buy" + "id":137005445109359286410323766, + "ts":1630994963173, + "tradeId":102523573486, + "amount":0.006754, + "price":52648.62, + "direction":"buy" } - // more Trade Detail data here ] - } + } } ``` @@ -8241,12 +8749,21 @@ This topic sends the latest completed trades. It updates in tick by tick mode. | Field | Data Type | Description | | --------- | --------- | ------------------------------------------------------------ | +| ch | string | Data belonged channel,Format:market.$symbol.trade.detail | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \ | object | | +| id | long | global transaction ID | +| ts | long | Latest Creation Time | +| \ | object | | | id | integer | Unique trade id (to be obsoleted) | | tradeId | integer | Unique trade id (NEW) | | amount | float | The volume of the trade (buy side or sell side) | | price | float | The price of the trade | | ts | integer | timestamp (UNIX epoch time in millisecond) | | direction | string | direction of the trade (taker): 'buy' or 'sell' | +| \ | | | +| \ | | | + ### Pull Request @@ -8297,18 +8814,19 @@ This topic sends the latest market stats with 24h summary. It updates in snapsho ```json { - "ch": "market.btcusdt.detail", - "ts": 1494497082831, //system update time - "tick": { - "amount": 12224.2922, - "open": 9790.52, - "close": 10195.00, - "high": 10300.00, - "id": 1494496390, - "count": 15195, - "low": 9657.00, - "vol": 121906001.754751 - } + "ch":"market.btcusdt.detail", + "ts":1630998026649, + "tick":{ + "id":273956868110, + "low":51000, + "high":52924.14, + "open":51823.62, + "close":52379.99, + "vol":727676440.200527, + "amount":13991.028076056185, + "version":273956868110, + "count":471348 + } } ``` @@ -8316,6 +8834,9 @@ This topic sends the latest market stats with 24h summary. It updates in snapsho | Field | Data Type | Description | | ------ | --------- | -------------------------------------------------------- | +| ch | string | Data belonged channel,Format:market.btcusdt.detail | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \| object | | | id | integer | UNIX epoch timestamp in second as response id | | amount | float | Aggregated trading volume in past 24H (in base currency) | | count | integer | Number of trades in past 24H | @@ -8324,6 +8845,9 @@ This topic sends the latest market stats with 24h summary. It updates in snapsho | low | float | Low price in past 24H | | high | float | High price in past 24H | | vol | float | Aggregated trading value in past 24H (in quote currency) | +| version | long | version | +| \| | | + ### Pull Request @@ -8348,18 +8872,51 @@ Pull request is supported. | --------- | --------- | --------- | ------------- | ------------------- | ----------- | | symbol | string | true | NA | ETP traiding symbol | | +> Update example + +```json +{ + "ch":"market.btc3lusdt.etp", + "ts":1630998641232, + "tick":{ + "actualLeverage":2.939514947040537, + "nav":55.96301165128891, + "outstanding":302712.87098475, + "symbol":"btc3lusdt", + "navTime":1630998641232, + "basket":[ + { + "amount":0.003154874364924647, + "currency":"btc" + }, + { + "amount":-108.54109757907857, + "currency":"usdt" + } + ] + } +} +``` + ### Update Content -| 字段 | 数据类型 | 描述 | -| ---- | -------------- | ------ | -| | symbol | string | -| | nav | float | -| | navTime | long | -| | outstanding | float | -| | basket | object | -| | { currency | float | -| | amount } | float | -| | actualLeverage | float | +| Field Name | Data Type | Description | +| -------------- | --------- | -------------------------------------- | +| status | string | Request Processing Result "ok","error" | +| ch | string | Data belonged channel,Format:market.$symbol.etp | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \ | object | | +| symbol | string | ETP trading symbol | +| nav | float | Latest NAV | +| navTime | long | Update time (unix time in millisecond) | +| outstanding | float | Outstanding shares | +| \ | object | Basket | +| currency | float | Currency | +| amount | float | Amount | +| \ | | | +| actualLeverage | float | Actual leverage ratio | +| \ | | | + ## Error Code @@ -8488,12 +9045,11 @@ The signature generation method of Account and Order WebSocket is similar with R Please refer to detailed signature generation steps from: [https://huobiapi.github.io/docs/spot/v1/cn/#c64cd15fdc] -``` -GET\n -api.huobi.pro\n -/ws/v2\n -accessKey=0664b695-rfhfg2mkl3-abbf6c5d-49810&signatureMethod=HmacSHA256&signatureVersion=2.1×tamp=2019-12-05T11%3A53%3A03 -``` +`GET\n` +`api.huobi.pro\n` +`/ws/v2\n` +`accessKey=0664b695-rfhfg2mkl3-abbf6c5d-49810&signatureMethod=HmacSHA256&signatureVersion=2.1×tamp=2019-12-05T11%3A53%3A03` + The final string involved in signature generation should be like below: @@ -8578,15 +9134,15 @@ The field list in order update message can be various per event type, developers "action":"push", "ch":"orders#btcusdt", "data": - { + { "orderSide":"buy", - "lastActTime":1583853365586, - "clientOrderId":"abc123", - "orderStatus":"rejected", - "symbol":"btcusdt", - "eventType":"trigger", - "errCode": 2002, - "errMessage":"invalid.client.order.id (NT)" + "lastActTime":1583853365586, + "clientOrderId":"abc123", + "orderStatus":"rejected", + "symbol":"btcusdt", + "eventType":"trigger", + "errCode": 2002, + "errMessage":"invalid.client.order.id (NT)" } } ``` @@ -8976,8 +9532,8 @@ accounts.update#0: "accountId": 123456, "balance": "23.111", "changeType": "transfer", - "accountType":"trade", - "seqNum": "86872993928", + "accountType":"trade", + "seqNum": "86872993928", "changeTime": 1568601800000 } } @@ -8991,8 +9547,8 @@ accounts.update#1: "accountId": 33385, "available": "2028.699426619837209087", "changeType": "order.match", - "accountType":"trade", - "seqNum": "86872993928", + "accountType":"trade", + "seqNum": "86872993928", "changeTime": 1574393385167 } } @@ -9004,8 +9560,8 @@ accounts.update#1: "accountId": 33385, "balance": "2065.100267619837209301", "changeType": "order.match", - "accountType":"trade", - "seqNum": "86872993928", + "accountType":"trade", + "seqNum": "86872993928", "changeTime": 1574393385122 } } @@ -9067,7 +9623,7 @@ API Key Permission:Read ### HTTP Request -`GET https://api.huobi.pro/v1/stable-coin/quote` + - GET `/v1/stable-coin/quote` ### Request Parameters @@ -9095,7 +9651,7 @@ API Key Permission:Trade ### HTTP Request -`POST https://api.huobi.pro/v1/stable-coin/exchange` + - POST `/v1/stable-coin/exchange` ### Request Parameters @@ -9148,9 +9704,6 @@ This endpoint will return the basic information of ETF creation and redemption, - GET `/etf/swap/config` -```shell -curl "https://api.huobi.pro/etf/swap/config?etf_name=hb10" -``` ### Request Parameter @@ -9426,20 +9979,23 @@ Public data | ----- | ---- | -------- | ----- | | code | integer | TRUE |Status Code | | message | string | FALSE |Error message (if any) | -| data | object | TRUE | | -| { etpName | string | TRUE |ETP code | +| \ | object | TRUE | | +| etpName | string | TRUE |ETP code | | displayName | string | TRUE |ETP display name | -| creationQuota | object | TRUE | | -| { maxCreationValue | int | TRUE |Maximum creation value per request | +| \ | object | TRUE | | +| maxCreationValue | int | TRUE |Maximum creation value per request | | minCreationValue | int | TRUE |Minimal creation value per request | | dailyCreationValue | int | TRUE |Maximum creation value per day | -| creationCurrency } | string | TRUE |Quote currency of creation | +| creationCurrency | string | TRUE |Quote currency of creation | +| \ | | | | | maxRedemptionAmount | int | TRUE |Maximum redemption amount per request | | minRedemptionAmount | int | TRUE |Minimal redemption amount per request | | dailyRedemptionAmount | int | TRUE |Maximum redemption amount per day | | creationFeeRate | float | TRUE |Creation fee rate | | redemptionFeeRate | float | TRUE |Redemption fee rate | -| etpStatus } | string | TRUE |ETP status(normal, creation-only, redemption-only, halted) | +| etpStatus | string | TRUE |ETP status(normal, creation-only, redemption-only, halted) | +| \ | | | | + ## ETP Creation @@ -9464,9 +10020,11 @@ Rate Limit: 2times/sec
| ----- | ---- | -------- | ----- | | code | integer | TRUE |Status Code | | message | string | FALSE |Error message (if any) | -| data | object | TRUE | | -| { transactId | long | TRUE |Transaction ID | -| transactTime } | long | TRUE |Transaction time (unix time in millisecond) | +| \ | object | TRUE | | +| transactId | long | TRUE |Transaction ID | +| transactTime | long | TRUE |Transaction time (unix time in millisecond) | +| \ | | | | + Note:
The receipt of transactId doesn’t implicate the success of creation. User should query creation history to confirm the transaction status post creation.
@@ -9494,9 +10052,11 @@ Rate Limit: 2times/sec
| ----- | ---- | -------- | ----- | | code | integer | TRUE |Status Code | | message | string | FALSE |Error message (if any) | -| data | object | TRUE | | -| { transactId | long | TRUE |Transaction ID | -| transactTime } | long | TRUE |Transaction time (unix time in millisecond) | +| \ | object | TRUE | | +| transactId | long | TRUE |Transaction ID | +| transactTime | long | TRUE |Transaction time (unix time in millisecond) | +| \ | | | | + Note:
The receipt of transactId doesn’t implicate the success of redemption. User should query redemption history to confirm the transaction status post @@ -9523,20 +10083,47 @@ Searching by transactTime
| startTime| long | FALSE |Farthest time (unix time in millisecond; valid value:[(endTime – 10 days), endTime]; default value: (endTime – 10 days))| | endTime| long | FALSE |Nearest time (unix time in millisecond; valid value: [(current time – 180 days), current time]; default value: current time) | | sort| string | FALSE |Sorting order (valid value: asc, desc; default value: desc) | -| limit| integer | FALSE |Maximum number of items in one page (valid range:[1,500]; default value:100) | +| limit| integer | FALSE |Maximum number of items in one page (valid range:[1-500]; default value:100) | | fromId | long | FALSE | First record ID in this query (only valid for next page querying) | Note:
The query window is circled by startTime and endTime. The maximum window size is 10-day. The window can shift within 180-day.
+> Response + +```json +{ + "code": 200, + "data": [ + { + "currency": "btc3l", + "feeCurrency": "usdt", + "transactValue": "90.812020468704123849", + "transactPrice": "77.40447942", + "transactId": "9054329", + "transactTime": 1621405496048, + "transactType": "redemption", + "transactAmount": "1.17321402", + "transactAmountOrig": "1.1733", + "transactValueOrig": null, + "transactFee": "0.090812020468704123", + "transactStatus": "completed", + "errCode": null, + "etpName": "btc3lusdt", + "errMessage": null + } + ] +} +``` + ### Response | Field Name | Data Type | Mandatory | Description | | ----- | ---- | -------- | ----- | | code | integer | TRUE |Status Code | | message | string | FALSE |Error message (if any) | -| data | object | TRUE |in order as user defined in 'sort' | -| { etpName | string | TRUE | ETP code | +| \ | object | TRUE |in order as user defined in 'sort' | +| etpName | string | TRUE | ETP code | | transactId | long | TRUE |Transaction ID | | transactTime | long | TRUE |Transaction time (unix time in millisecond) | | transactType | string | TRUE |Transaction type (valid value: creation, redemption) | @@ -9550,7 +10137,8 @@ The query window is circled by startTime and endTime. The maximum window size is | feeCurrency | string | TRUE | Transaction fee currency | | transactStatus | string | TRUE |Transaction status (valid values: completed, processing, clearing, rejected) | | errCode | integer | FALSE |Error code (only valid for transactStatus=rejected) | -| errMessage } | string | FALSE |Error message (only valid for transactStatus=rejected)| +| errMessage | string | FALSE |Error message (only valid for transactStatus=rejected)| +| \ | | | | | nextId | long | FALSE | First record ID in next page (only valid if exceeded page size) | Note:
@@ -9571,14 +10159,40 @@ Rate Limit: 2times/sec
| ----- | ---- | ------ | ----- | | transactId | long | TRUE |交易ID | +> Response + +```json +{ + "data": { + "currency": "btc3l", + "etpName": "btc3lusdt", + "errCode": null, + "feeCurrency": "usdt", + "transactId": "9054329", + "transactTime": 1621405496048, + "transactType": "redemption", + "transactAmount": "1.17321402", + "transactAmountOrig": "1.1733", + "transactValue": "90.812020468704123849", + "transactValueOrig": null, + "transactPrice": "77.40447942", + "transactFee": "0.090812020468704123", + "transactStatus": "completed", + "errMessage": null + }, + "code": 200, + "success": true +} +``` + ### Response | Field Name | Data Type | Mandatory | Description | | ----- | ---- | -------- | ----- | | code | integer | TRUE |Status Code | | message | string | FALSE |Error message (if any) | -| data | object | TRUE |in order as user defined in 'sort' | -| { etpName | string | TRUE | ETP code | +| \ | object | TRUE |in order as user defined in 'sort' | +| etpName | string | TRUE | ETP code | | transactId | long | TRUE |Transaction ID | | transactTime | long | TRUE |Transaction time (unix time in millisecond) | | transactType | string | TRUE |Transaction type (valid value: creation, redemption) | @@ -9592,7 +10206,9 @@ Rate Limit: 2times/sec
| feeCurrency | string | TRUE | Transaction fee currency | | transactStatus | string | TRUE |Transaction status (valid values: completed, processing, clearing, rejected) | | errCode | integer | FALSE |Error code (only valid for transactStatus=rejected) | -| errMessage } | string | FALSE |Error message (only valid for transactStatus=rejected)| +| errMessage | string | FALSE |Error message (only valid for transactStatus=rejected)| +| \
| | | | + Note:
If user querying occurs just after the transaction, transactAmount、transactValue、transactPrice might be updated as blank.
@@ -9615,7 +10231,7 @@ Searching by rebalTime
| startTime| long | FALSE |Farthest time (unix time in millisecond; valid value:[(endTime – 10 days), endTime]; default value: (endTime – 10 days))| | endTime| long | FALSE |Nearest time (unix time in millisecond; valid value: [(current time – 180 days), current time]; default value: current time) | | sort| string | FALSE |Sorting order (valid value: asc, desc; default value: desc) | -| limit| integer | FALSE |Maximum number of items in one page (valid range:[1,500]; default value:100) | +| limit| integer | FALSE |Maximum number of items in one page (valid range:[1-500]; default value:100) | | fromId | long | FALSE | First record ID in this query (only valid for next page querying) | Note:
@@ -9625,20 +10241,25 @@ The query window is circled by startTime and endTime. The maximum window size is ```json { - "code": 200, - "data": [ - { - "symbol": "btc3lusdt", - "rebalTime": 1594990401594, - "rebalType": "adhoc" - }, - { - "symbol": "btc3lusdt", - "rebalTime": 1595065303552, - "rebalType": "adhoc" - } - ], - "nextId": 2989 + "code":200, + "data":[ + { + "symbol":"btc3lusdt", + "rebalTime":1630944000192, + "rebalType":"daily" + }, + { + "symbol":"btc3lusdt", + "rebalTime":1630857600186, + "rebalType":"daily" + }, + { + "symbol":"btc3lusdt", + "rebalTime":1630771200185, + "rebalType":"daily" + } + ], + "nextId":8168108 } ``` @@ -9648,17 +10269,18 @@ The query window is circled by startTime and endTime. The maximum window size is | ----- | ---- | -------- | ----- | | code | integer | TRUE |Status Code | | message | string | FALSE |Error message (if any) | -| data | object | TRUE |in order as user defined in 'sort' | -| { symbol | string | TRUE |ETP symbol | +| \ | object | TRUE |in order as user defined in 'sort' | +| symbol | string | TRUE |ETP symbol | | rebalTime | long | TRUE |Position rebalance time (unix time in millisecond)| -| rebalType } | string | TRUE |Position rebalance type (valid values: daily, adhoc) | +| rebalType | string | TRUE |Position rebalance type (valid values: daily, adhoc) | +| \ | | | | | nextId | long | FALSE | First record ID in next page (only valid if exceeded page size) | ## Submit Cancel for an ETP Order ### HTTP Request -- POST /v2/etp/{transactId}/cancel +- POST `/v2/etp/{transactId}/cancel` API Key Permission:Trade
Rate Limit (NEW): 1 time /s
@@ -9693,7 +10315,7 @@ Rate Limit (NEW): 1 time /s
### HTTP Request -- POST /v2/etp/batch-cancel +- POST `/v2/etp/batch-cancel` API Key Permission:Trade
Rate Limit (NEW): 1 time /5s
@@ -9737,28 +10359,24 @@ Rate Limit (NEW): 1 time /5s
| ----- | ---- | -------- | ----- | | code | integer | TRUE |Status Code | | message | string | FALSE |Request status | -| data | object | TRUE | | -| { success | string | TRUE |List of successful ETP cancellation transactions | +| \ | object | TRUE | | +| success | array | TRUE |List of successful ETP cancellation transactions | +| \ | object | FALSE | | | errMsg | long | TRUE |Error message of order cancellation failure| | errCode | string | TRUE |Error code of order cancellation failure | -| transactId} | long | FALSE | Transaction ID | - +| transactId | long | FALSE | Transaction ID | +| \ | | | | +| \ | | | | ## Get Holding Limit of Leveraged ETP ### HTTP Request -- GET /v2/etp/limit +- GET `/v2/etp/limit` API Key Permission:Trade
-> Request: - -```json -GET /v2/etp/limit?currency=btc3l,btc3s -``` - ### Request Parameter | Field Name | Data Type | Mandatory | Description | @@ -9769,19 +10387,20 @@ GET /v2/etp/limit?currency=btc3l,btc3s ```json { -"data": [ - { - "remainingAmount": "2", - "currency": "btc3l", - "maxHoldings": "2" - }, - { - "remainingAmount": "12000", - "currency": "btc3s", - "maxHoldings": "12000" - }, -"code": 200, -"success": true + "data": [ + { + "remainingAmount": "48", + "maxHoldings": "48", + "currency": "btc3l" + }, + { + "remainingAmount": "7561552", + "maxHoldings": "7561552", + "currency": "btc3s" + } + ], + "code": 200, + "success": true } ``` @@ -9791,9 +10410,11 @@ GET /v2/etp/limit?currency=btc3l,btc3s | ---------------- | ---------- | -------- | ----------------------- | | code | integer | TRUE | Status Code | | message | string | FALSE | Status message | -| {currency | string | TRUE | Quote currency | +| \ | object | | +| currency | string | TRUE | Quote currency | | maxHoldings | string | TRUE | Holding limit | | remainingAmount} | string | TRUE | Remaining amount | +| \ | | | ## Error Code From 41505fa415f6e151af137149fafa89c67ac2644e Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Fri, 10 Sep 2021 18:18:18 +0800 Subject: [PATCH 681/759] * Optimized interface example --- source/index.html.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 15aa7eeda88..846d39aebab 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2255,7 +2255,7 @@ Obtain the total asset valuation of the platform account according to the BTC or | Parameter | Required | Data Type | Description | | -------- | -------- | -------- | -------- | | code | TRUE | int | status code | -| \ | TRUE | object | -------- | +| \ | TRUE | object | | | totalBalance | TRUE | string | total balance | | todayProfit | TRUE | string | today profit | | todayProfitRate | TRUE | string | today profit rate | @@ -3320,7 +3320,7 @@ This endpoint allows parent user to query withdraw address available for API key | chain | true | string | Block chain name | | | note | true | string | The address note | | | addressTag | false | string | The address tag,if any | | -| address }] | true | string | Withdraw address | | +| address | true | string | Withdraw address | | | \ | | | | | nextId | false | long | First record ID in next page (only valid if exceeded page size) | | @@ -3935,7 +3935,7 @@ API Key Permission: Read | \ | TRUE | object | | | | uid | TRUE | long | Sub user’s UID | | | userState | TRUE | string | Sub user’s status | lock, normal | -| \ | TRUE | object | | | +| \ | | | | | ## Set Tradable Market for Sub Users @@ -3990,7 +3990,7 @@ By default, sub user’s trading permission in spot market is activated. | accountType | true | string | - | Account type | isolated-margin,cross-margin | | activation | true | string | - | Account activation | activated,deactivated | | errCode | false | int | - | Error code in case of rejection (only valid when the requested UID being rejected) | | -| errMessage} | false | string | - | Error message in case of rejection (only valid when the requested UID being rejected) | | +| errMessage | false | string | - | Error message in case of rejection (only valid when the requested UID being rejected) | | | \
| | | | | @@ -5637,7 +5637,7 @@ The orders created via API will no longer be queryable after being cancelled for | symbol | string | Trading symbol | | stop-price | string | trigger price of stop limit order | | operator | string | operation character of stop price. e.g. get, lte | -| type} | string | All possible order type (refer to introduction in this section) | +| type | string | All possible order type (refer to introduction in this section) | | \
| | | | | | next-time | long | Next query "start-time" (in response of "direct" = prev), Next query "end-time" (in response of "direct" = next). Note: Only when the total number of items in the search result exceeded the limitation defined in "size", this field exists. UTC time in millisecond. | @@ -6162,7 +6162,7 @@ The cancelled conditional order before triggering, as well as the conditional or | code | integer | TRUE |Status code | | message | string | FALSE |Error message (if any) | | \ | object | TRUE |In ascening/descending order defined in 'sort' | -| accountId | integer | TRUE |Account ID | +| accountId | integer | TRUE |Account ID | | source | string | TRUE |Order source | | clientOrderId | string | TRUE |Client order ID | | orderId | string | FALSE |Order ID (only valid for orderStatus=triggered) | @@ -6180,7 +6180,7 @@ The cancelled conditional order before triggering, as well as the conditional or | orderCreateTime | long | FALSE |Order trigger time (only valid for orderStatus=triggered) | | orderStatus | string | TRUE |Order status (triggered,canceled,rejected) | | errCode | integer | FALSE |Status code in case of order triggering failure (only valid for orderStatus=rejected) | -| errMessage } | string | FALSE |Error message in case of order triggering failure (only valid for orderStatus=rejected) | +| errMessage | string | FALSE |Error message in case of order triggering failure (only valid for orderStatus=rejected) | | \ | | | | | nextId | long | FALSE |First record ID in next page (only valid if exceeded page size) | @@ -8068,10 +8068,10 @@ Then, you will received messages when there is any update in the subcribed topic To unsubscribe, you need to send below message -{ - "unsub": "topic to unsub", - "id": "id generate by client" -} +`{` + `"unsub": "topic to unsub",` + `"id": "id generate by client"` +`}` > UnSub response: From 5af1a372fa5bfa8c4f63a0b7a9baaef494e6d69d Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Wed, 20 Oct 2021 11:18:52 +0800 Subject: [PATCH 682/759] * Modify the navigation bar --- source/layouts/layout.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/layouts/layout.erb b/source/layouts/layout.erb index dee41772408..a9ba2d4bd08 100644 --- a/source/layouts/layout.erb +++ b/source/layouts/layout.erb @@ -174,10 +174,10 @@ under the License. //如果是英文环境 lang_btn.innerHTML = '中文'; btn_spot.innerHTML = 'Spot'; - btn_dm.innerHTML = 'Futures'; + btn_dm.innerHTML = 'Coin-M Futures'; // btn_swap.innerHTML = 'SWAP API'; - btn_coin_margined_swap.innerHTML = 'Coin Margined Swap'; - btn_usdt_swap.innerHTML = 'USDT Margined Swap'; + btn_coin_margined_swap.innerHTML = 'Coin-M Swaps'; + btn_usdt_swap.innerHTML = 'USDT-M Swaps'; // btn_option.innerHTML = 'Option'; lang_btn.href = url.replace('en/', 'cn/'); btn_spot.href = btn_spot.href.replace('cn/', 'en/'); From 89306b62feeb8cbc571aeb32e2c2a8bb7e2cb90b Mon Sep 17 00:00:00 2001 From: adlong <3140618@163.com> Date: Tue, 2 Nov 2021 08:55:54 +0800 Subject: [PATCH 683/759] update --- source/index.html.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 846d39aebab..37ae1fda750 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -4780,7 +4780,7 @@ If the order price is greater than the highest buy price in the market, the orde | --------------- | --------- | ------------------------------------------- | | status | string | status | | \ | object | | -| order-id | integer | The order id | +| order-id | long | The order id | | client-order-id | string | The client order id (if available) | | err-code | string | The error code (only for rejected order) | | err-msg | string | The error message (only for rejected order) | @@ -4966,11 +4966,11 @@ This endpoint returns all open orders which have not been filled completely. | ------------------ | --------- | ------------------------------------------------------------ | | status | string | status | | \ | object | | -| id | integer | Order id | +| id | long | Order id | | client-order-id | string | Client order id, can be returned from all open orders (if specified). | | symbol | string | The trading symbol to trade, e.g. btcusdt, bccbtc | | price | string | The limit price of limit order | -| created-at | int | The timestamp in milliseconds when the order was created | +| created-at | long | The timestamp in milliseconds when the order was created | | type | string | All possible order type (refer to introduction in this section) | | filled-amount | string | The amount which has been filled | | filled-cash-amount | string | The filled total in quote currency | From c3ef400c3b6eb605fa57573571c8131a85e8a1e4 Mon Sep 17 00:00:00 2001 From: adlong <3140618@163.com> Date: Tue, 2 Nov 2021 09:26:28 +0800 Subject: [PATCH 684/759] update --- source/index.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 37ae1fda750..301d96ff50f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -4774,7 +4774,7 @@ If the order price is greater than the highest buy price in the market, the orde } ``` -### Response Content +### Response Content | Field | Data Type | Description | | --------------- | --------- | ------------------------------------------- | From 63bc417b36c8a257f54718adebf0c79bc044e899 Mon Sep 17 00:00:00 2001 From: adlong <3140618@163.com> Date: Wed, 3 Nov 2021 10:02:19 +0800 Subject: [PATCH 685/759] update --- source/index.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 301d96ff50f..8df4088b149 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -4929,7 +4929,7 @@ This endpoint returns all open orders which have not been filled completely. | Parameter | Data Type | Required | Default | Description | Value Range | | ---------- | --------- | ------------------------------------------------------------ | ------- | ------------------------------------------ | ------------------------------------------------------------ | | account-id | string | true | NA | The account id used for this trade | Refer to `GET /v1/account/accounts` | -| symbol | string | true | NA | The trading symbol to trade | Refer to `GET /v1/common/symbols` | +| symbol | string | false | NA | The trading symbol to trade | Refer to `GET /v1/common/symbols` | | side | string | false | NA | Filter on the direction of the trade | buy, sell | | from | string | false | NA | start order ID the searching to begin with | | | direct | string | false (if field "from" is defined, this field "direct" becomes mandatory) | NA | searching direction | prev - in ascending order from the start order ID; next - in descending order from the start order ID | From 14036689a381c3461c49a1512b76a3eaf1fc16fd Mon Sep 17 00:00:00 2001 From: adlong <3140618@163.com> Date: Wed, 3 Nov 2021 10:11:10 +0800 Subject: [PATCH 686/759] update --- source/index.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 8df4088b149..81a82f0684a 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -4924,7 +4924,7 @@ This endpoint returns all open orders which have not been filled completely. } ``` -### Request Parameters +### Request Parameters | Parameter | Data Type | Required | Default | Description | Value Range | | ---------- | --------- | ------------------------------------------------------------ | ------- | ------------------------------------------ | ------------------------------------------------------------ | From e0f5781e1a94d9664568165df05dea64382a4eaa Mon Sep 17 00:00:00 2001 From: adlong <3140618@163.com> Date: Wed, 3 Nov 2021 10:46:57 +0800 Subject: [PATCH 687/759] updata --- source/index.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 81a82f0684a..108a3029595 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -4928,7 +4928,7 @@ This endpoint returns all open orders which have not been filled completely. | Parameter | Data Type | Required | Default | Description | Value Range | | ---------- | --------- | ------------------------------------------------------------ | ------- | ------------------------------------------ | ------------------------------------------------------------ | -| account-id | string | true | NA | The account id used for this trade | Refer to `GET /v1/account/accounts` | +| account-id | string | false | NA | The account id used for this trade | Refer to `GET /v1/account/accounts` | | symbol | string | false | NA | The trading symbol to trade | Refer to `GET /v1/common/symbols` | | side | string | false | NA | Filter on the direction of the trade | buy, sell | | from | string | false | NA | start order ID the searching to begin with | | From 92dc75c9506831e7e89ac8ffa1629425b2693372 Mon Sep 17 00:00:00 2001 From: adlong <3140618@163.com> Date: Wed, 3 Nov 2021 10:53:30 +0800 Subject: [PATCH 688/759] update --- source/index.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 108a3029595..45170977b07 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -4924,7 +4924,7 @@ This endpoint returns all open orders which have not been filled completely. } ``` -### Request Parameters +### Request Parameters | Parameter | Data Type | Required | Default | Description | Value Range | | ---------- | --------- | ------------------------------------------------------------ | ------- | ------------------------------------------ | ------------------------------------------------------------ | From 53fe8b8e080e8dd88565266c0a9463c4ed97882d Mon Sep 17 00:00:00 2001 From: jiaaiqiang Date: Fri, 5 Nov 2021 15:17:22 +0800 Subject: [PATCH 689/759] remove c2c & kline --- source/index.html.md | 749 +------------------------------------------ 1 file changed, 1 insertion(+), 748 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 45170977b07..0b6724c541c 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -6187,7 +6187,7 @@ The cancelled conditional order before triggering, as well as the conditional or ## Query a specific conditional order - GET `/v2/algo-orders/specific` - + API Key Permission: Read
Rate Limit (NEW): 20times/2sec
Search by orderOrigTime
@@ -7329,663 +7329,6 @@ Sort by "repayTime" ### Q1: I can see I have loanable amount in my margin account, why the API returns no sufficient amount error when I apply margin loan? A: The available amount depends on not only account available amount, but also the system available amount. Due to risk control, the system has a max available amount everyday. If the total loan amount reaches the max value, user will fail to apply for loan, unless someone repays the loan in the same day. Right now we are implementing a more user-friendly solution that provides more accurate information to API users. -# Margin Loan (C2C) - -## Introduction - -C2C margin loan APIs provide the customer-to-customer loan functionality such as lend, borrow, repay, query and transfer. - - - -The rate limit for all the endpoints of c2c margin is set as 2 times/sec.
-All the c2c margin endpoints below are not available by sub user.
-The account ID of borrowing account will be generated once the first time asset transfer (from spot account to the borrowing account) is accomplished on the web interface.
- -## Place a lending/borrowing offer - - - POST `/v2/c2c/offer` - -API Key Permission: Trade
- -### Request Parameter -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| accountId | string | FALSE | Borrowing account ID (Only valid for borrowing offer) | -| currency | string | TRUE | Cryptocurrency of lending/borrowing offer | -| side | string | TRUE | Offer side (lend, borrow) | -| timeInForce | string | FALSE | Time in force (gtc, ioc) | -| amount | string | TRUE | Offer value | -| interestRate | string | TRUE | Daily interest rate | -| loanTerm | integer | TRUE | Loan term (number of days; valid value: 10, 20, 30) | - -Note:
-• Time in force for lending offer must be gtc; time in force for borrowing offer must be ioc.
- -> Response - -```json -{ - "data": { - "offerId": 14743, - "createTime": 1593172709875 - }, - "code": 200, - "success": true -} -``` - -### Response Content -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| code | integer | TRUE | Status code | -| message | string | FALSE | Error message (if any) | -| \ | object | TRUE | | -| offerId | string | TRUE | Offer ID | -| createTime | long | TRUE | Offer creation time (unix time in millisecond) | -| \ | | | | - - -## Cancel a lending/borrowing offer - - - POST `/v2/c2c/cancellation` - -API Key Permission: Trade
- -### Request Parameter -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| offerId | string | TRUE | Offer ID | - -> Response - -```json -{ - "data": { - "rejected": [ - { - "offerId": 14411, - "errCode": 40310, - "errMessage": "order-non-existent(NT)" - } - ] - }, - "code": 200, - "success": true -} -``` - -### Response Content -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| code | integer | TRUE | Status code | -| message | string | FALSE | Error message (if any) | -| \ | object | TRUE | | -| \ | object | TRUE | Accepted offer list | -| offerId | string | FALSE | Offer ID | -| \| | | | -| \ | object | TRUE | Rejected offer list | -| offerId | string | FALSE | Offer ID | -| errCode | integer | FALSE | Error code for rejection | -| errMessage | string | FALSE | Error message for rejection | -| \ | | | | -| \ | | | | - -Note:
-• The acceptance of offer cancellation does not implicate the success of cancellation. Users should query the relevant offers after the cancellation to confirm their status.
- -## Cancel all lending/borrowing offers - - - POST `/v2/c2c/cancel-all` - -API Key Permission: Trade
-Maximum 500 offers can be cancelled in a single request. (to be cancelled in descending order of offerId)
- -### Request Parameter -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| accountId | string | FALSE | Account ID (default value: all accounts) | -| currency | string | FALSE | Cryptocurrency of lending/borrowing offer (default value: all eligible currencies) | -| side | string | FALSE | Offer side (valid value: lend, borrow; default value: both sides) | - -> Response - -```json -{ - "data":{ - "accepted":[ - { - "offerId":"14742" - } - ] - }, - "code":200, - "success":true -} -``` - -### Response Content -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| code | integer | TRUE | Status code | -| message | string | FALSE | Error message (if any) | -| \ | object | TRUE | | -| \ | object | TRUE | Accepted offer list | -| offerId | string | FALSE | Offer ID | -| \| | | | -| \ | object | TRUE | Rejected offer list | -| offerId | string | FALSE | Offer ID | -| errCode | integer | FALSE | Error code of rejection | -| errMessage | string | FALSE | Error message of rejection | -| \| | | | -| \ | | | | - - -Note:
-• The acceptance of offer cancellation does not implicate the success of cancellation. Users should query the offer after the cancellation to confirm its status.
- -## Query lending/borrow offers - - - GET `/v2/c2c/offers` - -API Key Permission: Read
-Searched by createTime
- -### Request Parameter -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| accountId | string | FALSE | Account ID (default value: all C2C accounts) | -| currency | string | FALSE | Cryptocurrency of lending/borrowing offer (default value: all eligible currencies) | -| side | string | FALSE | Offer side (valid value: lend, borrow; default value: both sides) | -| offerStatus | string | TRUE | Offer status (valid value: submitted, filled, partial-filled, canceled, partial-canceled; multiple inputs are allowed, separated by comma) | -| startTime | long | FALSE | Farthest time (unix time in millisecond) | -| endTime | long | FALSE | Nearest time (unix time in millisecond) | -| limit | integer | FALSE | Maximum number of items in one page (valid range:[1-100]; default value:50) | -| fromId | long | FALSE | First record ID in this query (only valid for next page querying) | - -> Response - -```json -{ - "code": 200, - "data": [ - { - "offerId": "14736", - "createTime": 1593175645809, - "lastActTime": 1593176383232, - "offerStatus": "filled", - "accountId": "13699363", - "currency": "usdt", - "side": "borrow", - "timeInForce": "ioc", - "origAmount": "10", - "amount": "0", - "interestRate": "0.0002", - "loanTerm": 20 - }, - { - "offerId": "14732", - "createTime": 1593173423885, - "lastActTime": 1593174884411, - "offerStatus": "filled", - "accountId": "13699363", - "currency": "usdt", - "side": "borrow", - "timeInForce": "ioc", - "origAmount": "10", - "amount": "0", - "interestRate": "0.000192", - "loanTerm": 10 - } - ] -} -``` - -### Response Content -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| code | integer | TRUE | Status code | -| message | string | FALSE | Error message (if any) | -| \ | object | TRUE | In decending order of createTime | -| offerId | string | TRUE | Offer ID | -| createTime | long | TRUE | Offer creation time (unix time in millisecond) | -| lastActTime | long | TRUE | Offer update time (unix time in millisecond) | -| offerStatus | string | TRUE | Offer status (valid value:submitted, filled, partial-filled, canceled, partial-canceled) | -| accountId | string | TRUE | Account ID | -| currency | string | TRUE | Cryptocurrency of lending/borrowing | -| side | string | TRUE | Offer side (valid value: lend, borrow) | -| timeInForce | string | TRUE | Time in force (gtc, ioc) | -| origAmount | string | TRUE | Original offer value | -| amount | string | TRUE | Remaining offer value | -| interestRate | string | TRUE | Daily interest rate | -| loanTerm | integer | TRUE | Loan term | -| \ | | | | -| nextId | long | FALSE | First record ID in next page (only valid if exceeded page size) | - -## Query a lending/borrowing offer - - - GET `/v2/c2c/offer` - -API Key Permission: Read
- -### Request Parameter -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| offerId | string | TRUE | Offer ID | - -> Response - -```json -{ - "code": 200, - "data": { - "lastActTime": 1593176383232, - "offerStatus": "filled", - "origAmount": "10", - "currency": "usdt", - "amount": "0", - "timeInForce": "ioc", - "side": "borrow", - "offerId": "14736", - "accountId": "13699363", - "interestRate": "0.0002", - "loanTerm": 20, - "transactions": [ - { - "transactRate": "0.00019", - "transactAmount": "10", - "transactTime": 1593175646232, - "transactId": 28152, - "aggressor": true, - "unpaidPrincipal": "0", - "unpaidInterest": "0", - "paidInterest": "0.00007917", - "transactStatus": "closed" - } - ], - "createTime": 1593175645809 - } -} -``` - -### Response Content -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| code | integer | TRUE | Status code | -| message | string | FALSE | Error message (if any) | -| \ | object | TRUE | | -| offerId | string | TRUE | Offer ID | -| createTime | long | TRUE | Offer creation time (unix time in millisecond) | -| lastActTime | long | TRUE | Offer update time (unix time in millisecond) | -| offerStatus | string | TRUE | Offer status (valid value: submitted, filled, partial-filled, canceled, partial-canceled) | -| accountId | string | TRUE | Account ID | -| currency | string | TRUE | Cryptocurrency of lending/borrowing | -| side | string | TRUE | Offer side (valid value: lend, borrow) | -| timeInForce | string | TRUE | Time in force (gtc, ioc) | -| origAmount | string | TRUE | Original offer value | -| amount | string | TRUE | Remaining offer value | -| interestRate | string | TRUE | Daily interest rate | -| loanTerm | integer | TRUE | Loan term | -| \ | object | TRUE | In descending order of transactTime | -| transactRate | string | TRUE | Transaction interest rate | -| transactAmount | string | TRUE | Transaction value | -| transactTime | long | TRUE | Transaction time (unix time in millisecond) | -| transactId | long | TRUE | Transaction ID | -| aggressor | boolean | TRUE | Aggressor or not (valid value: true, false) | -| unpaidPrincipal | string | TRUE | Unpaid principal | -| unpaidInterest | string | TRUE | Unpaid interest (till query time) | -| paidInterest | string | TRUE | Paid interest | -| transactStatus | string | TRUE | Repayment status (valid value: pending, closed) | -| \| | | | -| \ | | | | - - -## Query lending/borrowing transactions - - - GET `/v2/c2c/transactions` - -API Key Permission: Read
-Searched by transactTime
- -### Request Parameter -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| accountId | string | FALSE | Account ID (default value: all C2C accounts) | -| currency | string | FALSE | Cryptocurrency of lending/borrowing (default value: all eligible currencies) | -| side | string | FALSE | Offer side (valid value: lend, borrow;default value: both sides) | -| transactStatus | string | TRUE | Repayment status (valid value: pending, closed) | -| startTime | long | FALSE | Farthest time (unix time in millisecond) | -| endTime | long | FALSE | Nearest time (unix time in millisecond) | -| limit | integer | FALSE | Maximum number of items in one page (valid range:[1-100]; default value:50) | -| fromId | long | FALSE | First record ID in this query (only valid for next page querying) | - -> Response - -```json -{ - "data": [ - { - "transactId": 5585, - "transactTime": "1593178102345", - "transactRate": "0.0019", - "transactAmount": "10", - "aggressor": "true", - "unpaidPrincipal": "0", - "unpaidInterest": "0", - "piadInterest": "0.00007917", - "transactStatus": "closed", - "offerId": "14736", - "accountId": "13699363", - "currency": "usdt", - "side": "borrow" - } - ], - "code": 200, - "success": true -} -``` - -### Response Content -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| code | integer | TRUE | Status code | -| message | string | FALSE | Error message (if any) | -| \ | object | TRUE | In descending order of transactTime | -| transactRate | string | TRUE | Transaction interest rate | -| transactAmount | string | TRUE | Transaction value | -| transactTime | long | TRUE | Transaction time (unix time in millisecond) | -| transactId | long | TRUE | Transaction ID | -| aggressor | boolean | TRUE | Aggressor or not (valid value: true, false) | -| unpaidPrincipal | string | TRUE | Unpaid principal | -| unpaidInterest | string | TRUE | Unpaid interest (till query time) | -| paidInterest | string | TRUE | Paid interest | -| transactStatus | string | TRUE | Repayment status (valid value: pending, closed) | -| offerId | string | TRUE | Offer ID | -| accountId | string | TRUE | Account ID | -| currency | string | TRUE | Cryptocurrency of lending/borrowing | -| side | string | TRUE | Offer side (valid value: lend, borrow) | -| \ | | | | -| nextId | long | FALSE | First record ID in next page (only valid if exceeded page size) | - -## Repay a borrowing offer - - - POST `/v2/c2c/repayment` - -API Key Permission: Trade
- -### Request Parameter -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| accountId | string | TRUE | Borrowing account ID | -| currency | string | TRUE | Borrowed currency | -| amount | string | TRUE | Repay value | -| offerId | string | TRUE | Original borrowing offer ID | - -Note:
-• Interest takes higher priority to be repaid.
- -> Response - -```json -{ - "data": { - "repayId": 5585, - "repayTime": "1593178102345" - }, - "code": 200, - "success": true -} -``` - -### Response Content -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| code | integer | TRUE | Status code | -| message | string | FALSE | Error message (if any) | -| \ | object | TRUE | | -| repayId | string | TRUE | Repayment ID | -| repayTime | long | TRUE | Repay time (unix time in millisecond) | -| \ | | | | - -Note:
-• The receipt of repayment ID does not implicate the success of repayment. User should query the repayment history to confirm its status.
- -## Query C2C repayments - - - GET `/v2/c2c/repayment` - -API Key Permission: Read
-Seached by repayTime
- -### Request Parameter -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| repayId | string | FALSE | Repayment ID | -| accountId | string | FALSE | Account ID (default value: all C2C accounts) | -| currency | string | FALSE | Cryptocurrency of lending/borrowing (default value: all eligible currencies) | -| startTime | long | FALSE | Farthest time (unix time in millisecond) | -| endTime | long | FALSE | Nearest time (unix time in millisecond) | -| limit | integer | FALSE | Maximum number of items in one page (valid range:[1-100]; default value:50) | -| fromId | long | FALSE | First record ID in this query (only valid for next page querying) | - -> Response - -```json -{ - "code": 200, - "data": [ - { - "repayId": 2173, - "repayTime": 1593176382960, - "accountId": 13699363, - "currency": "usdt", - "paidAmount": "10.00007917", - "transactIds": [ - { - "transactId": 28152, - "paidPrincipal": "10", - "paidInterest": "0.00007917" - } - ] - }, - { - "repayId": 2171, - "repayTime": 1593174883839, - "accountId": 13699363, - "currency": "usdt", - "paidAmount": "10.00007", - "transactIds": [ - { - "transactId": 28145, - "paidPrincipal": "10", - "paidInterest": "0.00007" - } - ] - } - ] -} -``` - -### Response Content -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| code | integer | TRUE | Status code | -| message | string | FALSE | Error message (if any) | -| \ | object | TRUE | In descending order of repayTime | -| repayId | string | TRUE | Repayment ID | -| repayTime | long | TRUE | Repay time (unix time in millisecond) | -| accountId | string | TRUE | Account ID | -| currency | string | TRUE | Currency | -| paidAmount | string | TRUE | Paid value | -| \ | object | TRUE | Repayment ID list (in ascending order of repayment sequence) | -| transactId | long | TRUE | Repayment ID | -| paidPrincipal | string | TRUE | Paid principal | -| paidInterest | string | TRUE | Paid interest | -| \ | | | | -| \ | | | | -| nextId | long | FALSE | First record ID in next page (only valid if exceeded page size) | - -## Transfer asset - - - POST `/v2/c2c/transfer` - -API Key Permission: Trade
- -### Request Parameter -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| from | string | TRUE | Transfer’s account ID | -| to | string | TRUE | Transferee’s account ID | -| currency | string | TRUE | Currency | -| amount | string | TRUE | Transfer value | - -Note:
-• Only transfers between spot account and specific borrowing account are - -> Response - -```json -{ - "data": { - "transactId": 5585, - "transactTime": "1593178102345" - }, - "code": 200, - "success": true -} -``` - -### Response Content -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| code | integer | TRUE | Status code | -| message | string | FALSE | Error message (if any) | -| \ | object | TRUE | | -| transactId | string | TRUE | Transaction ID | -| transactTime | long | TRUE | Transaction time (unix time in millisecond) | -| \ | | | | - - -## Query C2C account balance - - - GET `/v2/c2c/account` - -API Key Permission: Read
- -### Request Parameter -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| accountId | string | TRUE | Account ID | -| currency | string | FALSE | Currency | - -> Response - -```json -{ - "data": { - "accountId": 13699363, - "accountStatus": "working", - "symbol": "btcusdt", - "riskRate": "10",//riskRate=10 implicates lowest risk - "subAccountTypes": [ - { - "currency": "btc", - "subAccountType": "trade", - "acctBalance": "0.00000029", - "availBalance": "0.00000029", - "transferable": "0.00000029", - "borrowable": "0.01969453" - }, - { - "currency": "usdt", - "subAccountType": "trade", - "acctBalance": "90.27945823", - "availBalance": "90.27945823", - "transferable": "90.27945823", - "borrowable": "180.56423403" - }, - { - "currency": "usdt", - "subAccountType": "loan", - "acctBalance": "0", - "availBalance": "0", - "transferable": "0", - "borrowable": "0" - }, - { - "currency": "usdt", - "subAccountType": "interest", - "acctBalance": "0", - "availBalance": "0", - "transferable": "0", - "borrowable": "0" - } - ] - }, - "code": 200, - "success": true -} -``` - -### Response Content -| Field | Data Type | Mandatory | Description | -| ----- | --------- | --------- | ---------- | -| code | integer | TRUE | Status code | -| message | string | FALSE | Error message (if any) | -| \ | object | TRUE | | -| accountId | string | TRUE | Account ID | -| accountStatus | string | TRUE | Account status (working, lock, fl-sys, fl-mgt, fl-end, fl-negative) | -| symbol | string | FALSE | Currency pair (Only valid for borrowing account) | -| riskRate | string | FALSE | Risk rate (Only valid for borrowing account) | -| \ | object | TRUE | Sub account list | -| subAccountType | string | TRUE | Sub account (trade, lending, earnings, loan, interest, advance) | -| currency | string | TRUE | Currency | -| acctBalance | string | TRUE | Account balance | -| availBalance | string | FALSE | Available balance (Only valid for sub account "trade") | -| transferable | string | FALSE | Transferable value (Only valid for sub account "trade") | -| borrowable | string | FALSE | Borrowable value (Only valid for sub account "trade") | -| \ | | | | -| \ | | | | - - -Note:
-• Sub account trade, loan, interest, advance are only valid for borrowing account;
-• Sub account trade, lending, earnings are only valid for lending account.
- -## Error Code - -Below is the error code and description for C2C margin loan APIs - -| Error Code | Description | -| ---------- | ------------------------------------------------------------ | -| 40301 | Insufficient available balance | -| 40302 | Failed to get the account | -| 40307 | Existence of an ongoing loan order | -| 40309 | Wrong order status | -| 40310 | Order does not exist | -| 40311 | User has OTC loans | -| 40312 | Only normal and bankrupt users can be included | -| 40315 | There is no liquidation or forced liquidation setting | -| 40317 | Failed to get sub-loan order | -| 40319 | No less than the minimum borrowing amount | -| 40320 | borrowing configuration does not exist | -| 40322 | The user has not passed advanced verification | -| 40324 | The amount of repayment exceeds the amount borrowed | -| 40326 | White list users only | -| 40327 | Exceeding the maximum accuracy | -| 40328 | Cannot exceed the maximum amount of borrowing | -| 40329 | Interest rate out of the set range | -| 40330 | Cannot be less than the minimum loan amount | -| 40331 | cannot exceed the maximum loan amount | -| 40332 | Cannot be less than the minimum repayment amount | -| 40333 | the ending time must be greater than the starting time | -| 40335 | in repayment | -| 40336 | This feature is not open to users in China, the United States, Turkey, Japan, Singapore | -| 40337 | C2C lending transaction is not currently available | -| 40339 | Debit and credit function is closed | -| 40340 | The current account ID does not belong to the current user | -| 40345 | This account is not a C2C account | -| 40346 | This order is not allowed to change renew state | - # Websocket Market Data ## Introduction @@ -8105,96 +7448,6 @@ You will receive a response accordingly and immediately The limitation of single connection is 100 ms. -## Market Candlestick - -This topic sends a new candlestick whenever it is available. - -### Topic - -`market.$symbol$.kline.$period$` - -> Subscribe request - -```json -{ - "sub": "market.ethbtc.kline.1min", - "id": "id1" -} -``` - -### Topic Parameter - -| Parameter | Data Type | Required | Description | Value Range | -| --------- | --------- | -------- | -------------------- | ------------------------------------------------------------ | -| symbol | string | true | Trading symbol | All supported trading symbol, e.g. btcusdt, bccbtc. (to retrieve candlesticks for ETP NAV, symbol = ETP trading symbol + suffix 'nav',for example: btc3lusdtnav) | -| period | string | true | Candlestick interval | 1min, 5min, 15min, 30min, 60min, 4hour, 1day, 1mon, 1week, 1year | - -> Response - -```json -{ - "id": "id1", - "status": "ok", - "subbed": "market.ethbtc.kline.1min", - "ts": 1489474081631 //system response time -} -``` - -> Update example - -```json -{ - "ch":"market.ethbtc.kline.1min", - "ts":1630981694370, - "tick":{ - "id":1630981680, - "open":0.074849, - "close":0.074848, - "low":0.074848, - "high":0.074849, - "amount":2.4448, - "vol":0.1829884187, - "count":3 - } -} -``` - -### Update Content - -| Field | Data Type | Description | -| ------ | --------- | ------------------------------------------------------------ | -| ch | string | Data belonged channel,Format:market.$symbol.kline.$period | -| ts | long | Time of Respond Generation, Unit: Millisecond | -| \ | object | | -| id | integer | UNIX epoch timestamp in second as response id | -| amount | float | Aggregated trading volume during the interval (in base currency) | -| count | integer | Number of trades during the interval | -| open | float | Opening price during the interval | -| close | float | Closing price during the interval | -| low | float | Low price during the interval | -| high | float | High price during the interval | -| vol | float | Aggregated trading value during the interval (in quote currency) | -| \ | | | - - - -### Pull Request - -Pull request is supported with extra parameters to define the range. The maximum number of ticks in each response is 300. - -```json -{ - "req": "market.$symbol.kline.$period", - "id": "id generated by client", - "from": "from time in epoch seconds", - "to": "to time in epoch seconds" -} -``` - -| Parameter | Data Type | Required | Default Value | Description | Value Range | -| --------- | --------- | -------- | ------------------------------------- | ---------------------------------- | ------------------------------------------------------------ | -| from | integer | false | 1501174800(2017-07-28T00:00:00+08:00) | "From" time (epoch time in second) | [1501174800, 2556115200] | -| to | integer | false | 2556115200(2050-01-01T00:00:00+08:00) | "To" time (epoch time in second) | [1501174800, 2556115200] or ($from, 2556115200] if "from" is set | ## Market Ticker From 70700db98263bd0f581cb4198b1183e9e26aa321 Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Tue, 30 Nov 2021 10:46:49 +0800 Subject: [PATCH 690/759] *update --- source/index.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 0b6724c541c..5b3c9c1dd18 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -5564,7 +5564,7 @@ The orders created via API will no longer be queryable after being cancelled for | Parameter | Required | Data Type | Description | Default Value | Value Range | | ---------- | -------- | --------- | ------------------------------------------------------------ | --------------------- | ------------------------------------------------------------ | -| symbol | false | string | The trading symbol to trade | all | All supported trading symbol, e.g. btcusdt, bccbtc.Refer to `GET /v1/common/symbols` | +| symbol | false | string | The trading symbol to trade | | All supported trading symbol, e.g. btcusdt, bccbtc.Refer to `GET /v1/common/symbols` | | start-time | false | long | Start time (included) | The time 48 hours ago | UTC time in millisecond | | end-time | false | long | End time (included) | The query time | UTC time in millisecond | | direct | false | string | Direction of the query. (Note: If the total number of items in the search result is within the limitation defined in "size", this field does not take effect.) | next | prev, next | From 720a205417ca95813ae7e3be6d83884dd946ccc0 Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Tue, 30 Nov 2021 15:55:57 +0800 Subject: [PATCH 691/759] *update --- source/index.html.md | 83 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 5b3c9c1dd18..1ec35001955 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -30,8 +30,10 @@ table th { | Release Time
(UTC +8) | API | New / Update | Description | | ------------------------ | ---------------------- | --------------- | ------------------------------------- | -| 2021.8.19 | `accounts.update#${mode}` | 优化 | Add "Serial Number of Account Change" parameter:"seqNum" | -| 2021.8.19 | `GET /v1/account/accounts/{account-id}/balance` | 优化 | Add "Serial Number of Account Change" parameter:"seq-num" | +| 2021.11.30 | `Query withdrawal order by client order id` | Add | Add "Query withdrawal order by client order id" | +| 2021.11.30 | `/v1/dw/withdraw/api/create` | update | Add Request Parameters "client-order-id" | +| 2021.8.19 | `accounts.update#${mode}` | Update | Add "Serial Number of Account Change" parameter:"seqNum" | +| 2021.8.19 | `GET /v1/account/accounts/{account-id}/balance` | Update | Add "Serial Number of Account Change" parameter:"seq-num" | | 2021.8.12 | `market.$symbol.ticker` | Add | Add Market Ticker data | | 2021.8.12 | `market.$symbol.mbp.$levels` | Update | Add 400 depth data| | 2021.7.23 | `GET /v1/account/history` | Update | Detailed in detail the type of change in the account flow interface, that is, "Transact-Types" increases classification, such as Note 3. | @@ -3366,6 +3368,10 @@ Parent user creates a withdraw request from spot account to an external address | fee | string | true | NA | The fee to pay with this withdraw | | chain | string | false | NA | Refer to`GET /v2/reference/currencies`.Set as "usdt" to withdraw USDT to OMNI, set as "trc20usdt" to withdraw USDT to TRX | | addr-tag | string | false | NA | A tag specified for this address | +| client-order-id | string | false | NA | client order id | | + +### Note + - If the client-order-id(the id of withdrawal order) is not empty, idempotent verification will be performed. For the withdrawal request with the same client-order-id, the previously submitted successful withdrawal order id will be directly returned > The above command returns JSON structured like this: @@ -3385,6 +3391,79 @@ Parent user creates a withdraw request from spot account to an external address + +## Query withdrawal order by client order id + +API Key Permission: Read
+ +### HTTP Request + +- GET `/internal/common/ams-dw/query/client-order-id` + +### Request Parameters + +| Parameter | Required | Data Type | Description | Value Range | +| -------- | -------- | ------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| clientOrderId | true | string | client order id (max 32 char) | | + +### Note +- query the information of withdrawal order, which submitted by api interface. (it will return the information of withdrawal order which submitted with client order id. in the other it will return the null that withdrawal order submitted without with client order id) + +> Response: + +```json + + { + "status": "ok", + "data": { + "id": 101123262, + "client-order-id": "1113", + "type": "withdraw", + "sub-type": "FAST", + "currency": "usdt", + "chain": "usdt", + "tx-hash": "", + "amount": 1.200000000000000000, + "from-addr-tag": "", + "address": "1PL24EbWrNNrnMKw1cxAHPsebUz7DdhWTx", + "address-tag": "", + "fee": 0E-18, + "state": "confirmed", + "created-at": 1637758163686, + "updated-at": 1637758251559 + } +} +``` + +### 响应数据 + +| Parameter | Required | Data Type | Description | Value Range | +| -------- | -------- | -------- | ------- | -------- | +| status > | true | stirng | status code | | +| \ | false | long | | | +| address | true | string | address | | +| client-order-id | true | string | client order id | | +| address-tag | true | string | address tag | | +| amount | true | decimal | amount | | +| blockchain-confirm | false | int | the number of blockchain confirmations | | +| chain | false | string | chain | | +| created-at | true | long | created at | | +| currency | true | string | currency | | +| error-code | true | string | error code | | +| error-msg | true | string | error msg | | +| fee | true | decimal | fee | | +| from-addr-tag | true | string | from address tag | | +| from-address | false | string | from address | | +| id | true | long | ID | | +| request-id | true | string | request id | | +| state | true | string | state | | +| tx-hash | true | string | transmit hash | | +| type | true | string | type | | +| updated-at | true | long | updated at | | +| user-id | false | long | user id | | +| wallet-confirm | false | int | the number of wallet confirmations | | +| \ | false | long | | | + ## Cancel a Withdraw Request API Key Permission:Withdraw
From 6fd4ef14f8ed0476b4e4b6a7e6b7712021c5c174 Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Tue, 30 Nov 2021 16:17:42 +0800 Subject: [PATCH 692/759] *update --- source/index.html.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 1ec35001955..058fc4a98eb 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -30,8 +30,8 @@ table th { | Release Time
(UTC +8) | API | New / Update | Description | | ------------------------ | ---------------------- | --------------- | ------------------------------------- | -| 2021.11.30 | `Query withdrawal order by client order id` | Add | Add "Query withdrawal order by client order id" | -| 2021.11.30 | `/v1/dw/withdraw/api/create` | update | Add Request Parameters "client-order-id" | +| 2021.11.30 | `GET /v1/query/withdraw/client-order-id` | Add | Add "Query withdrawal order by client order id" | +| 2021.11.30 | `POST /v1/dw/withdraw/api/create` | update | Add Request Parameters "client-order-id" | | 2021.8.19 | `accounts.update#${mode}` | Update | Add "Serial Number of Account Change" parameter:"seqNum" | | 2021.8.19 | `GET /v1/account/accounts/{account-id}/balance` | Update | Add "Serial Number of Account Change" parameter:"seq-num" | | 2021.8.12 | `market.$symbol.ticker` | Add | Add Market Ticker data | @@ -3398,7 +3398,7 @@ API Key Permission: Read
### HTTP Request -- GET `/internal/common/ams-dw/query/client-order-id` +- GET `/v1/query/withdraw/client-order-id` ### Request Parameters From 3f81701882a743c71e1bccdc81ccc34eda5e2c01 Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Tue, 30 Nov 2021 17:09:14 +0800 Subject: [PATCH 693/759] *update --- source/index.html.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 058fc4a98eb..7d618195923 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -5899,8 +5899,8 @@ Below is the error code and description returned by Trading APIs | cancel-disabled | The symbol is pending and not allowed to cancel order | | order-invalid-price | The order price is invalid, usually exceeds the 10% of latest trade price | | order-accountbalance-error | The account balance is insufficient | -| order-limitorder-price-min-error | Sell price cannot be lower than specific price | -| order-limitorder-price-max-error | Buy price cannot be higher than specific price | +| order-limitorder-price-min-error | Sell price cannot be lower than specific price(limit price to sell cannot be lower than 90% of the market price) | +| order-limitorder-price-max-error | Buy price cannot be higher than specific price(limit price to buy cannot be higher than 110% of the market price) | | order-limitorder-amount-min-error | Limit order amount can not be less than specific number | | order-limitorder-amount-max-error | Limit order amount can not be more than specific number | | order-etp-nav-price-min-error | Order price cannot be lower than specific percentage | @@ -5952,8 +5952,8 @@ Below are common errors: - order-value-min-error: The order price is less than minimum price - order-orderprice-precision-error : The precision for limited order price is wrong - order-orderamount-precision-error : The precision for limited order amount is wrong -- order-limitorder-price-max-error : The limited order price is higher than the threshold -- order-limitorder-price-min-error : The limited order price is lower than the threshold +- order-limitorder-price-max-error : The limited order price is higher than the threshold(limit price to buy cannot be higher than 110% of the market price) +- order-limitorder-price-min-error : The limited order price is lower than the threshold(limit price to sell cannot be lower than 90% of the market price) - order-limitorder-amount-max-error : The limited order amount is larger than the threshold - order-limitorder-amount-min-error : The limited order amount is smaller than the threshold From ee2b5f7137f88e5b5f4060c8f19ce5e9af40d573 Mon Sep 17 00:00:00 2001 From: adlong <3140618@163.com> Date: Fri, 3 Dec 2021 13:41:56 +0800 Subject: [PATCH 694/759] * update --- source/index.html.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 7d618195923..50904e09f8c 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -5509,14 +5509,11 @@ Rate Limit (NEW): 50times/2s This endpoint returns orders based on a specific searching criteria. The order created via API will no longer be queryable after being cancelled for more than 2 hours. - -- Upon user defined "start-time" AND/OR "end-time", Huobi server will return historical orders whose order creation time falling into the period. The maximum query window between "start-time" and "end-time" is 48-hour. Oldest order searchable should be within recent 180 days. If either "start-time" or "end-time" is defined, Huobi server will ignore "start-date" and "end-date" regardless they were filled or not. - -- If user does neither define "start-time" nor "end-time", but "start-date"/"end-date", the order searching will be based on defined "date range", as usual. The maximum query window is 2 days, and oldest order searchable should be within recent 180 days. - -- If user does not define any of "start-time"/"end-time"/"start-date"/"end-date", by default Huobi server will treat current time as "end-time", and then return historical orders within recent 48 hours. - -Huobi Global suggests API users to search historical orders based on "time" filter instead of "date". In the near future, Huobi Global would remove "start-date"/"end-date" fields from the endpoint, through another notification. +- If the user does not fill in the start-time and end-time any parameters, the server will return the historical orders from near to far [now, now - 48 hours]. +- If the user fills in the start-time but does not fill in the end-time parameter, the server will return the historical order from near to far [start-time + 48 hours, start-time]. +- If the user does not fill in the start-time but fills in the end-time parameter, the server will return the historical order from near to far [end-time, end-time - 48 hours]. +- If the user fills in both start-time and end-time parameters, the server will return historical orders from near to far [end-time, start-time]. +- The maximum range of each query is 48 hours, and the last 180 days data can be queried continuously. ### HTTP Request From 8ba1b9b0c4ebbff36b0abe78f8eb7e47a9944d92 Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Fri, 3 Dec 2021 16:05:51 +0800 Subject: [PATCH 695/759] *update --- source/index.html.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 50904e09f8c..57dd1bb5629 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -5543,7 +5543,7 @@ This endpoint returns orders based on a specific searching criteria. The order c | types | string | false | NA | One or more types of order to include in the search, use comma to separate. | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-stop-limit, sell-stop-limit, buy-limit-fok, sell-limit-fok, buy-stop-limit-fok, sell-stop-limit-fok | | start-time | long | false | -48h | Search starts time, UTC time in millisecond | Value range [((end-time) – 48h), (end-time)], maximum query window size is 48 hours, query window shift should be within past 180 days, query window shift should be within past 2 hours for cancelled order (state = "canceled") | | end-time | long | false | present | Search ends time, UTC time in millisecond | Value range [(present-179d), present], maximum query window size is 48 hours, query window shift should be within past 180 days, queriable range should be within past 2 hours for cancelled order (state = "canceled") | -| states | string | true | NA | One or more states of order to include in the search, use comma to separate. | All possible order state (refer to introduction in this section) | +| states | string | true | NA | One or more states of order to include in the search, use comma to separate. | filled, partial-canceled, canceled | | from | string | false | NA | Search order id to begin with | NA | | direct | string | false | both | Search direction when 'from' is used | next, prev | | size | integer | false | 100 | The number of orders to return | [1-100] | @@ -5596,7 +5596,7 @@ This endpoint returns orders based on a specific searching criteria. The order c | filled-cash-amount | string | The filled total in quote currency | | filled-fees | string | Transaction fee (Accurate fees refer to matchresults endpoint) | | source | string | All possible order source (refer to introduction in this section) | -| state | string | All possible order state (refer to introduction in this section) | +| state | string | filled, partial-canceled, canceled | | exchange | string | Internal data | | batch | string | Internal data | | stop-price | string | trigger price of stop limit order | From 5d464a897779ee32bd193f391e4c433e9f8c3609 Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Mon, 13 Dec 2021 11:42:48 +0800 Subject: [PATCH 696/759] *update --- source/index.html.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 57dd1bb5629..1abe0536f0f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -778,6 +778,8 @@ Some http/websocket library may include port in the host, you can try to append 9.The hidden text in API Key and Secret Key may have impact on the signature. +10.Check the byte[] is directly to be Base64 encoded after generated from the HmacSHA256 signature, instead of hexadecimal string to be Base64 encoded. + Right now the official [SDK](https://github.com/HuobiRDCenter) supports multiple languages, you can refer to the signature implementation, or below three signature examples. JAVA signature example | C++ signature example | Python signature example From cb3c48d156e1f6e4b57ff6d44278bc4d9b168dfb Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Tue, 14 Dec 2021 16:05:38 +0800 Subject: [PATCH 697/759] *update --- source/index.html.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 1abe0536f0f..ef1c78a48f1 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -6677,7 +6677,7 @@ This endpoint returns margin orders based on a specific searching criteria. | Parameter | Data Type | Required | Default | Description | Value Range | | ---------- | --------- | -------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -------------------------------------------------- | | symbol | string | true | NA | The trading symbol to trade | The trading symbol, e.g. btcusdt, bccbtc | -| states | string | false | NA | Order status list, multiple state allowed, separated by comma | created, accrual (loaned), cleared (paid), invalid | +| states | string | false | NA | Order status list, multiple state allowed, separated by comma | created, accrual (loaned), cleared (paid), invalid, failed | | start-date | string | false | -61d | Search starts date, in format yyyy-mm-dd | NA | | end-date | string | false | today | Search ends date, in format yyyy-mm-dd | NA | | from | string | false | NA | Search order id to begin with | NA | @@ -6736,7 +6736,7 @@ This endpoint returns margin orders based on a specific searching criteria. | interest-rate | string | The loan interest rate | | interest-amount | string | The accumulated loan interest | | interest-balance | string | The amount of loan interest left | -| state | string | Loan state, possible values: created, accrual (loaned), cleared (paid), invalid | +| state | string | Loan state, possible values: created, accrual (loaned), cleared (paid), invalid, failed | | paid-point | string | Paid Huobi Points for repayment | | paid-coin | string | Paid original cryptocurrency for repayment | | deduct-rate | string | Deduction rate for repayment | From b11966cd965d29ef4f32c2830da580c1d4b2e83e Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Fri, 17 Dec 2021 14:15:54 +0800 Subject: [PATCH 698/759] *update --- source/index.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index ef1c78a48f1..59b41aa97b3 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -7781,7 +7781,7 @@ In the near future, Huobi Global will align the update behavior of 150-level inc ``` But 5-level/20-level incremental channel won’t disseminate any update in such a case.
In the future, Huobi Global will align the update behavior of 150-level incremental channel with 5-level/20-level, which means while there is no order book change at all, the channel will be no longer disseminating messages of blank object any more.
-5) 5-level/20-level incremental channel only supports the following symbols at this stage - btcusdt,ethusdt,xrpusdt,eosusdt,ltcusdt,etcusdt,adausdt,dashusdt,bsvusdt, while 150-level incremental channel supports all symbols.
+5) 5-level/20-level incremental channel only supports the following symbols at this stage - btcusdt,ethusdt,xrpusdt,eosusdt,ltcusdt,etcusdt,adausdt,dashusdt,bsvusdt,htusdt,dotusdt,linkusdt,iotausdt,zecusdt,trxusdt,xmrusdt,arusdt,dfausdt,nftusdt,uniusdt,dogeusdt,solusdt,xecusdt,lunausdt,bchusdt,maticusdt,vetusdt,xlmusdt,filusdt,thetausdt. while 150-level incremental channel supports all symbols.
REQ channel supports refreshing message for 5-level, 20-level, and 150-level. From 7220c99a155238b415eb6fb639600fc2b650bf9f Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Fri, 17 Dec 2021 14:28:53 +0800 Subject: [PATCH 699/759] *update --- source/index.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 59b41aa97b3..aa6a63a98da 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -7781,7 +7781,7 @@ In the near future, Huobi Global will align the update behavior of 150-level inc ``` But 5-level/20-level incremental channel won’t disseminate any update in such a case.
In the future, Huobi Global will align the update behavior of 150-level incremental channel with 5-level/20-level, which means while there is no order book change at all, the channel will be no longer disseminating messages of blank object any more.
-5) 5-level/20-level incremental channel only supports the following symbols at this stage - btcusdt,ethusdt,xrpusdt,eosusdt,ltcusdt,etcusdt,adausdt,dashusdt,bsvusdt,htusdt,dotusdt,linkusdt,iotausdt,zecusdt,trxusdt,xmrusdt,arusdt,dfausdt,nftusdt,uniusdt,dogeusdt,solusdt,xecusdt,lunausdt,bchusdt,maticusdt,vetusdt,xlmusdt,filusdt,thetausdt. while 150-level incremental channel supports all symbols.
+5) 5-level/20-level incremental channel only supports the following symbols at this stage: btcusdt, ethusdt, xrpusdt, eosusdt, ltcusdt, etcusdt, adausdt, dashusdt, bsvusdt, htusdt, dotusdt, linkusdt, iotausdt, zecusdt, trxusdt, xmrusdt, arusdt, dfausdt, nftusdt, uniusdt, dogeusdt, solusdt, xecusdt, lunausdt, bchusdt, maticusdt, vetusdt, xlmusdt, filusdt, thetausdt. while 150-level incremental channel supports all symbols. REQ channel supports refreshing message for 5-level, 20-level, and 150-level. From eee8e712603080423f1f3b473523e1647a2320d4 Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Tue, 21 Dec 2021 10:52:47 +0800 Subject: [PATCH 700/759] *update --- source/index.html.md | 74 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index aa6a63a98da..70e20ee7578 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -7527,6 +7527,80 @@ You will receive a response accordingly and immediately The limitation of single connection is 100 ms. +## Market Candlestick + +This topic sends a new candlestick whenever it is available. + +### Topic + +`market.$symbol$.kline.$period$` + +> Subscribe request + +```json +{ + "sub": "market.ethbtc.kline.1min", + "id": "id1" +} +``` + +### Topic Parameter + +| Parameter | Data Type | Required | Description | Value Range | +| --------- | --------- | -------- | -------------------- | ------------------------------------------------------------ | +| symbol | string | true | Trading symbol | All supported trading symbol, e.g. btcusdt, bccbtc. (to retrieve candlesticks for ETP NAV, symbol = ETP trading symbol + suffix 'nav',for example: btc3lusdtnav) | +| period | string | true | Candlestick interval | 1min, 5min, 15min, 30min, 60min, 4hour, 1day, 1mon, 1week, 1year | + +> Response + +```json +{ + "id": "id1", + "status": "ok", + "subbed": "market.ethbtc.kline.1min", + "ts": 1489474081631 //system response time +} +``` + +> Update example + +```json +{ + "ch":"market.ethbtc.kline.1min", + "ts":1630981694370, + "tick":{ + "id":1630981680, + "open":0.074849, + "close":0.074848, + "low":0.074848, + "high":0.074849, + "amount":2.4448, + "vol":0.1829884187, + "count":3 + } +} +``` + +### Update Content + +| Field | Data Type | Description | +| ------ | --------- | ------------------------------------------------------------ | +| ch | string | Data belonged channel,Format:market.$symbol.kline.$period | +| ts | long | Time of Respond Generation, Unit: Millisecond | +| \ | object | | +| id | integer | UNIX epoch timestamp in second as response id | +| amount | float | Aggregated trading volume during the interval (in base currency) | +| count | integer | Number of trades during the interval | +| open | float | Opening price during the interval | +| close | float | Closing price during the interval | +| low | float | Low price during the interval | +| high | float | High price during the interval | +| vol | float | Aggregated trading value during the interval (in quote currency) | +| \ | | | + + + + ## Market Ticker Retrieve the market ticker,data is pushed every 100ms. From 29a48e43da4bada85b64a1f7c32780e08898f677 Mon Sep 17 00:00:00 2001 From: fuxiaowei Date: Wed, 22 Dec 2021 10:41:09 +0800 Subject: [PATCH 701/759] *update --- source/layouts/layout.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/layouts/layout.erb b/source/layouts/layout.erb index a9ba2d4bd08..247a09808be 100644 --- a/source/layouts/layout.erb +++ b/source/layouts/layout.erb @@ -71,7 +71,7 @@ under the License. 币本位永续合约 - USDT本位永续合约 + USDT本位合约 - Group 54 Copy 2 - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + From 2abd05ba984aa425c41910f79ceea765bf633313 Mon Sep 17 00:00:00 2001 From: zhangyabin Date: Thu, 15 Sep 2022 16:26:29 +0800 Subject: [PATCH 747/759] update date to time --- source/index.html.md | 180 +++++++++++++++++++++---------------------- 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 50d546de08e..b9c5f88f8fa 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -838,7 +838,7 @@ If you encounter API errors, please use below template in your feedback: `4. Raw JSON request (if any)` `5. Raw JSON response` `6. Problem time and frequency (such as, when this problem occurs, whether it is reproducible)` -`7. Pre-signed text (mandatory for authentication issue)` +`7. Pre-signed text (Required for authentication issue)` Below is an example: @@ -1092,7 +1092,7 @@ None. ### Response Content -| Field | Data Type | Mandatory | Description | +| Field | Data Type | Required | Description | | ----- | --------- | -------- | ----------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | @@ -1113,7 +1113,7 @@ API Key Permission:Read - GET `/v2/settings/common/symbols` ### Request Parameters -| Parameter | Data Type | Mandatory | Description | +| Parameter | Data Type | Required | Description | |-----|-----|-----|----- | | ts | long | false | timestamp to get incremental data | @@ -1197,9 +1197,9 @@ API Key Permission:Read | d | direction | int | direction: 1 for long and 2 for short | | elr | etp_leverage_ratio | string | etp leverage ratio | | p | partitions | Object | -| castate | ca state | string | not mandatory. The state of the call auction; it will only be displayed when it is in the 1st and 2nd stage of the call auction. Enumeration values: "ca_1", "ca_2" | -| ca1oa | ca1 open at | long | not mandatory. this information is only available for that symbols configured with call auction. The total number of milliseconds since 0:0:0:00,000 on January 1, 1970 UTC to the present. | -| ca2oa | ca2 open at | long | not mandatory. this information is only available for that symbols configured with call auction. The total number of milliseconds since 0:0:0:00,000 on January 1, 1970 UTC to the present. | +| castate | ca state | string | not Required. The state of the call auction; it will only be displayed when it is in the 1st and 2nd stage of the call auction. Enumeration values: "ca_1", "ca_2" | +| ca1oa | ca1 open at | long | not Required. this information is only available for that symbols configured with call auction. The total number of milliseconds since 0:0:0:00,000 on January 1, 1970 UTC to the present. | +| ca2oa | ca2 open at | long | not Required. this information is only available for that symbols configured with call auction. The total number of milliseconds since 0:0:0:00,000 on January 1, 1970 UTC to the present. | | \
| | | | | ts | ts | String | timestamp of incremental data | | full | full | int | full data flag: 0 for no and 1 for yes | @@ -1214,7 +1214,7 @@ API Key Permission:Read - GET `/v2/settings/common/currencies` ### Request Parameters -| Parameter | Data Type | Mandatory | Description | +| Parameter | Data Type | Required | Description | |-----|-----|-----|----- | | ts | long | false | timestamp to get incremental data | @@ -1306,7 +1306,7 @@ API Key Permission:Read - GET `/v1/settings/common/currencys` ### Request Parameters -| Parameter | Data Type | Mandatory | Description | +| Parameter | Data Type | Required | Description | |-----|-----|-----|----- | | ts | long | false | timestamp to get incremental data | @@ -1415,7 +1415,7 @@ API Key Permission:Read - GET `/v1/settings/common/symbols` ### Request Parameters -| Parameter | Data Type | Mandatory | Description | +| Parameter | Data Type | Required | Description | |-----|-----|-----|----- | | ts | long | false | timestamp to get incremental data | @@ -1498,10 +1498,10 @@ API Key Permission:Read | qcdn | quote_currency_display_name | string | quote currency display name | | elr | etp_leverage_ratio | string | etp leverage ratio | | castate | ca state | string | Not required. The state of the call auction; it will only be displayed when it is in the 1st and 2nd stage of the call auction. Enumeration values: "ca_1", "ca_2" | -| ca1oa | ca1 open at | long | not mandatory. the open time of call auction phase 1, total milliseconds since January 1, 1970 0:0:0:00ms UTC | -| ca1ca | ca1 close at | long | not mandatory. the close time of call auction phase 1, total milliseconds since January 1, 1970 0:0:0:00ms UTC | -| ca2oa | ca2 open at | long | not mandatory. the open time of call auction phase 2, total milliseconds since January 1, 1970 0:0:0:00ms UTC | -| ca2ca | ca2 close at | long | not mandatory. the close time of call auction phase 2, total milliseconds since January 1, 1970 0:0:0:00ms UTC | +| ca1oa | ca1 open at | long | not Required. the open time of call auction phase 1, total milliseconds since January 1, 1970 0:0:0:00ms UTC | +| ca1ca | ca1 close at | long | not Required. the close time of call auction phase 1, total milliseconds since January 1, 1970 0:0:0:00ms UTC | +| ca2oa | ca2 open at | long | not Required. the open time of call auction phase 2, total milliseconds since January 1, 1970 0:0:0:00ms UTC | +| ca2ca | ca2 close at | long | not Required. the close time of call auction phase 2, total milliseconds since January 1, 1970 0:0:0:00ms UTC | | \
| | | | | ts | ts | String | timestamp of incremental data | | full | full | int | full data flag: 0 for no and 1 for yes | @@ -1516,7 +1516,7 @@ API Key Permission:Read - GET `/v1/settings/common/market-symbols` ### Request Parameters -| Parameter | Data Type | Mandatory | Description | +| Parameter | Data Type | Required | Description | |-----|-----|-----|----- | | symbols | string | false | symbols. NA means all symbols, multiple symbols separated with comma | | ts | long | false | timestamp to get incremental data | @@ -1608,7 +1608,7 @@ API Key Permission:Read | in | init-nav | decimal | ETP: init nav | | maxov | max-order-value | decimal | max value of market price order | | flr | funding-leverage-ratio | decimal | C2C: funding leverage ratio | -| castate | ca state | string | not mandatory. The state of the call auction; it will only be displayed when it is in the 1st and 2nd stage of the call auction. Enumeration values: "ca_1", "ca_2" | +| castate | ca state | string | not Required. The state of the call auction; it will only be displayed when it is in the 1st and 2nd stage of the call auction. Enumeration values: "ca_1", "ca_2" | | \ | | | | | ts | ts | String | timestamp of incremental data | | full | full | int | full data flag: 0 for no and 1 for yes | @@ -1622,7 +1622,7 @@ API Key Permission:Read - GET `/v1/settings/common/chains` ### Request Parameters -| Parameter | Data Type | Mandatory | Description | +| Parameter | Data Type | Required | Description | |-----|-----|-----|----- | | show-desc | string | false | show desc, 0: no, 1: all, 2: suspend deposit/withdrawal and chain exchange | | currency | string | false | currency | @@ -1732,7 +1732,7 @@ curl "https://api.huobi.pro/v2/reference/currencies?currency=usdt" ### Request Parameters -| Field Name | Mandatory | Data Type | Description | Value Range | +| Field Name | Required | Data Type | Description | Value Range | | -------------- | --------- | --------- | --------------- | ------------------------------------------------------------ | | currency | false | string | Currency | btc, ltc, bch, eth, etc ...(available currencies in Huobi Global) | | authorizedUser | false | boolean | Authorized user | true or false (if not filled, default value is true) | @@ -1818,7 +1818,7 @@ curl "https://api.huobi.pro/v2/reference/currencies?currency=usdt" ### Response Content -| Field Name | Mandatory | Data Type | Description | Value Range | +| Field Name | Required | Data Type | Description | Value Range | | ----------------------- | --------- | --------- | ------------------------------------------------------------ | ---------------------- | | code | true | int | Status code | | | message | false | string | Error message (if any) | | @@ -2469,7 +2469,7 @@ curl "https://api.huobi.pro/market/etp?symbol=btc3lusdt" ### Request Parameter -| Parameter | Data Type | Mandatory | Default Value | Description | +| Parameter | Data Type | Required | Default Value | Description | | --------- | --------- | --------- | ------------- | ------------------ | | symbol | string | true | NA | ETP trading symbol | @@ -3264,7 +3264,7 @@ The query window can be within the last 180 days, which means, by adjusting "sta ### Request Parameters -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ------------- | --------- | --------- | ------------------------------------------------------------ | | accountId | string | TRUE | Account ID | | currency | string | FALSE | Cryptocurrency (default value: all) | @@ -3320,7 +3320,7 @@ endTime default value: current time ### Response Content -| Field Name | Data Type | Mandatory | Description | Value Rage | +| Field Name | Data Type | Required | Description | Value Rage | | ------------ | --------- | --------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | code | integer | TRUE | Status code | | | message | string | FALSE | Error message (if any) | | @@ -3457,7 +3457,7 @@ Callable by sub user
### Request Parameters -| Field | Data Type | Mandatory | Description | +| Field | Data Type | Required | Description | | ----- | -------- | -------- | ---------- | | subUid | string | FALSE | Sub user’s UID (only valid for scenario of parent user querying sub user’s point balance) | @@ -3484,7 +3484,7 @@ Callable by sub user
### Response Content -| Field | Data Type | Mandatory | Description | +| Field | Data Type | Required | Description | | ----- | -------- | -------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | @@ -3522,7 +3522,7 @@ Callable by sub user
### Request Parameters -| Field | Data Type | Mandatory | Description | +| Field | Data Type | Required | Description | | ----- | -------- | -------- | ---------- | | fromUid | string | TRUE | Transferer’s UID | | toUid | string | TRUE | Transferee’s UID | @@ -3546,7 +3546,7 @@ Note:
``` ### Response Content -| Field | Data Type | Mandatory | Description | +| Field | Data Type | Required | Description | | ----- | -------- | -------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | @@ -3594,7 +3594,7 @@ Rate Limit (NEW): 20times/2s ### Request Parameters -| Field Name | Data Type | Mandatory | Default Value | Description | +| Field Name | Data Type | Required | Default Value | Description | | ---------- | --------- | --------- | ------------- | --------------------------------------------------- | | currency | string | true | N/A | Crypto currency,refer to `GET /v1/common/currencys` | @@ -3657,7 +3657,7 @@ Rate Limit (NEW): 20times/2s ### Request Parameters -| Field Name | Data Type | Mandatory | Default Value | Description | +| Field Name | Data Type | Required | Default Value | Description | | ---------- | --------- | --------- | ------------- | --------------------------------------------------- | | currency | string | true | N/A | Crypto currency,refer to `GET /v1/common/currencys` | @@ -3774,7 +3774,7 @@ This endpoint allows parent user to query withdraw address available for API key ``` ### Response Content -| Field Name | Mandatory | Data Type | Description | Value Range | +| Field Name | Required | Data Type | Description | Value Range | | ----------- | --------- | --------- | ------------------------------------------------------------ | ----------- | | code | true | int | Status code | | | message | false | string | Error message (if any) | | @@ -4084,7 +4084,7 @@ Below is the response code, message and description returned by Wallet APIs. | 1002 | unauthorized | User is unautherized | | 1003 | invalid signature | API signature is wrong | | 2002 | invalid field value in "field name" | Parameter is invalid | -| 2003 | missing mandatory field "field name" | Parameter is missing | +| 2003 | missing Required field "field name" | Parameter is missing | ## FAQ @@ -4362,7 +4362,7 @@ API Key Permission: Read ### Request Parameter -| Field | Mandatory | Data Type | Description | Default Value | Possible Value | +| Field | Required | Data Type | Description | Default Value | Possible Value | | ------ | --------- | --------- | ------------------------------------------------------------ | ------------- | -------------- | | fromId | FALSE | long | First record ID in next page (only valid if exceeded page size) | | | @@ -4386,7 +4386,7 @@ API Key Permission: Read ### Response -| Field | Mandatory | Data Type | Description | Possible Value | +| Field | Required | Data Type | Description | Possible Value | | ----------- | --------- | --------- | ------------------------------------------------------------ | -------------- | | code | TRUE | int | Status code | | | message | FALSE | string | Error message (if any) | | @@ -4450,7 +4450,7 @@ API Key Permission: Read ### Request Parameter -| Field | Mandatory | Data Type | Description | Default Value | Possible Value | +| Field | Required | Data Type | Description | Default Value | Possible Value | | ------ | --------- | --------- | -------------- | ------------- | -------------- | | subUid | TRUE | long | Sub user's UID | | | @@ -4468,7 +4468,7 @@ API Key Permission: Read ### Response -| Field | Mandatory | Data Type | Description | Possible Value | +| Field | Required | Data Type | Description | Possible Value | | ----------- | --------- | --------- | ---------------------- | -------------- | | code | TRUE | int | Status code | | | message | FALSE | string | Error message (if any) | | @@ -4491,7 +4491,7 @@ By default, sub user’s trading permission in spot market is activated. ### Request Parameters -| Parameter | Mandatory | Data Type | Length | Description | Possible Value | +| Parameter | Required | Data Type | Length | Description | Possible Value | | ----------- | --------- | --------- | ------ | --------------------------------------------------------- | ---------------------------- | | subUids | true | string | - | Sub user's UID list (maximum 50 UIDs, separated by comma) | - | | accountType | true | string | - | Account type | isolated-margin,cross-margin | @@ -4521,7 +4521,7 @@ By default, sub user’s trading permission in spot market is activated. ### Response Content -| Parameter | Mandatory | Data Type | Length | Description | Possible Value | +| Parameter | Required | Data Type | Length | Description | Possible Value | | ----------- | --------- | --------- | ------ | ------------------------------------------------------------ | ---------------------------- | | code | true | int | - | Status code | | | message | false | string | - | Error message (if any) | | @@ -4547,7 +4547,7 @@ By default, the asset transfer from sub user’s spot account to parent user’s ### Request Parameters -| Parameter | Mandatory | Data Type | Length | Description | Possible Value | +| Parameter | Required | Data Type | Length | Description | Possible Value | | ------------- | --------- | --------- | ------ | ------------------------------------------------------------ | -------------- | | subUids | true | string | - | Sub user's UID list (maximum 50 UIDs, separated by comma) | - | | accountType | false | string | - | Account type (if not available, adopt default value 'spot') | spot | @@ -4578,7 +4578,7 @@ By default, the asset transfer from sub user’s spot account to parent user’s ### Response Content -| Parameter | Mandatory | Data Type | Length | Description | Possible Value | +| Parameter | Required | Data Type | Length | Description | Possible Value | | ------------- | --------- | --------- | ------ | ------------------------------------------------------------ | -------------- | | code | true | int | - | Status code | | | message | false | string | - | Error message (if any) | | @@ -4603,7 +4603,7 @@ API Key Permission: Read ### Request Parameter -| Field | Mandatory | Data Type | Description | Default Value | Possible Value | +| Field | Required | Data Type | Description | Default Value | Possible Value | | ------ | --------- | --------- | -------------- | ------------- | -------------- | | subUid | TRUE | long | Sub User's UID | | | @@ -4642,7 +4642,7 @@ API Key Permission: Read ### Response -| Field | Mandatory | Data Type | Description | Possible Value | +| Field | Required | Data Type | Description | Possible Value | | ----------------- | --------- | --------- | ------------------------------------------------------------ | ------------------------------------------------- | | code | TRUE | int | Status code | | | message | FALSE | string | Error message (if any) | | @@ -4837,7 +4837,7 @@ API Key Permission:Read ### Request Parameters -| Field Name | Data Type | Mandatory | Default Value | Description | +| Field Name | Data Type | Required | Default Value | Description | | ---------- | --------- | --------- | ------------- | --------------------------------------------------- | | subUid | long | true | N/A | Sub user UID (limited to 1 per request) | | currency | string | true | N/A | Crypto currency,refer to `GET /v1/common/currencys` | @@ -4899,7 +4899,7 @@ Parent user could query sub user's deposit history via this endpoint. ### Request Parameters -|Field Name |Data Type |Mandatory |Description | +|Field Name |Data Type |Required |Description | |------- |------- |------- |------- | | subUid | long | ture | Sub user UID | |currency |string |FALSE |Cryptocurrency (default value: all) | @@ -4947,7 +4947,7 @@ Only when the number of items within the query window (between "startTime" and " ### Response Content -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ------- | ------- | ------- | ------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | @@ -5047,7 +5047,7 @@ This endpoint returns the balance of a sub-user specified by sub-uid. ### Request Parameters -|Field Name |Data Type |Mandatory |Description | +|Field Name |Data Type |Required |Description | |------- |------- |------- |------- | | sub-uid | long | ture | Sub user UID | @@ -5188,7 +5188,7 @@ This endpoint places a new order and sends to the exchange to be matched. "account-id": "100009", "amount": "10.1", "price": "100.1", - "source": "api", + "source": "spot-api", "symbol": "ethusdt", "type": "buy-limit", "client-order-id": "a0001" @@ -5474,7 +5474,7 @@ This endpoint returns all open orders which have not been filled completely. | symbol | string | false | NA | The trading symbol to trade | Refer to `GET /v1/common/symbols` | | side | string | false | NA | Filter on the direction of the trade | buy, sell | | from | string | false | NA | start order ID the searching to begin with | | -| direct | string | false (if field "from" is defined, this field "direct" becomes mandatory) | NA | searching direction | prev - in ascending order from the start order ID; next - in descending order from the start order ID | +| direct | string | false (if field "from" is defined, this field "direct" becomes Required) | NA | searching direction | prev - in ascending order from the start order ID; next - in descending order from the start order ID | | size | int | false | 100 | The number of orders to return | [1, 500] | > The above command returns JSON structured like this: @@ -5731,7 +5731,7 @@ Response: ### Response Content -| **Name** | **Mandatory** | **Type** | **Description** | +| **Name** | **Required** | **Type** | **Description** | | ------------- | ------------- | -------- | -------------------------- | | code | true | int | status code | | message | false | string | error description (if any) | @@ -5753,7 +5753,7 @@ This endpoint returns the detail of a specific order. If an order is created via - GET `/v1/order/orders/{order-id}` ### Request Parameters -| **Name** | **Mandatory** | **Type** | **Description** | +| **Name** | **Required** | **Type** | **Description** | | ------------- | ------------- | -------- | -------------------------- | | order-id | true | string | order id when order was created. Place it within path| @@ -6066,13 +6066,13 @@ This endpoint returns orders based on a specific searching criteria. The order c | operator | string | operation character of stop price | | \ | | | | | -### Error code for invalid start-date/end-date +### Error code for invalid start-time/end-time | err-code | scenarios | | ------------------ | ------------------------------------------------------------ | -| invalid_interval | Start date is later than end date; the date between start date and end date is greater than 2 days | -| invalid_start_date | Start date is a future date; or start date is earlier than 180 days ago. | -| invalid_end_date | end date is a future date; or end date is earlier than 180 days ago. | +| invalid_interval | Start time is later than end time; the time between start time and end time is greater than 2 days | +| invalid_start_time | Start time is a future time; or start time is earlier than 180 days ago. | +| invalid_end_time | end time is a future time; or end time is earlier than 180 days ago. | @@ -6263,13 +6263,13 @@ Notes:
- The calculated maker rebate value inside ‘filled-fees’ would not be paid immediately.
-### Error code for invalid start-date/end-date +### Error code for invalid start-time/end-time | err-code | scenarios | | ------------------ | ------------------------------------------------------------ | -| invalid_interval | Start date is later than end date; the date between start date and end date is greater than 2 days | -| invalid_start_date | Start date is a future date; or start date is earlier than 61 days ago. | -| invalid_end_date | end date is a future date; or end date is earlier than 61 days ago. | +| invalid_interval | Start time is later than end time; the time between start time and end time is greater than 2 days | +| invalid_start_time | Start time is a future time; or start time is earlier than 120 days ago. | +| invalid_end_time | end time is a future time; or end time is earlier than 120 days ago. | ## Get Current Fee Rate Applied to The User @@ -6467,7 +6467,7 @@ Rate Limit (NEW): 20times/2sec
Conditional order can be only placed via this endpoint instead of any endpoint in "Trading" section.
### Request Parameter -| Field | Data Type | Mandatory | Default Value| Description | Valid Value | +| Field | Data Type | Required | Default Value| Description | Valid Value | | ----- | ----- | ------ | ---- | ------ | ---- | | accountId | integer | TRUE | | Account ID |At present only support spot account id, margin account id, super-margin account. C2C margin account id is not supported at this point of time. | | symbol | string | TRUE | | Trading symbol | | @@ -6499,7 +6499,7 @@ Note:
``` ### Response Content -| Field | Data Type | Mandatory | Description | +| Field | Data Type | Required | Description | | ----- | ----- | ------ | ---- | | code | integer | TRUE |Status code | | message | string | FALSE |Error message (if any) | @@ -6528,7 +6528,7 @@ Before a conditional order triggering, it can be only cancelled via this endpoin ``` ### Request Parameter -| Field | Data Type | Mandatory | Default Value| Description | Valid Value | +| Field | Data Type | Required | Default Value| Description | Valid Value | | ----- | ----- | ------ | ---- | ------ | ---- | | clientOrderIds | string[] | TRUE | | Client order ID (maximum 50 orders are allowed, Transfer in the form of as array) | | @@ -6548,7 +6548,7 @@ Before a conditional order triggering, it can be only cancelled via this endpoin ``` ### Response Content -| Field | Data Type | Mandatory | Description | +| Field | Data Type | Required | Description | | ----- | ----- | ------ | ---- | | code | integer | TRUE |Status code | | message | string | FALSE |Error message (if any) | @@ -6569,7 +6569,7 @@ This endpoint only returns those conditional orders which have not triggered wit Before a conditional order triggering, it can be queried out through this endpoint instead of any endpoint in "Trading" section.
### Request Parameter -| Field | Data Type | Mandatory | Default Value| Description | Valid Value | +| Field | Data Type | Required | Default Value| Description | Valid Value | | ----- | ----- | ------ | ---- | ------ | ---- | | accountId | integer | FALSE | all | Account ID | | | symbol | string | FALSE | all | Trading symbol | | @@ -6620,7 +6620,7 @@ Before a conditional order triggering, it can be queried out through this endpoi ``` ### Response Content -| Field | Data Type | Mandatory | Description | +| Field | Data Type | Required | Description | | ----- | ----- | ------ | ---- | | code | integer | TRUE |Status code | | message | string | FALSE |Error message (if any) | @@ -6656,7 +6656,7 @@ To further query the latest status of a successfully triggered conditonal order, The cancelled conditional order before triggering, as well as the conditional order failed to trigger, can be queried out through this endpoint instead of any endpoint in "Trading" section.
### Request Parameter -| Field | Data Type | Mandatory | Default Value| Description | Valid Value | +| Field | Data Type | Required | Default Value| Description | Valid Value | | ----- | ----- | ------ | ---- | ------ | ---- | | accountId | integer | FALSE | all | Account ID | | | symbol | string | TRUE | | Trading symbol | | @@ -6696,7 +6696,7 @@ The cancelled conditional order before triggering, as well as the conditional or ``` ### Response Content -| Field | Data Type | Mandatory | Description | +| Field | Data Type | Required | Description | | ----- | ----- | ------ | ---- | | code | integer | TRUE |Status code | | message | string | FALSE |Error message (if any) | @@ -6734,7 +6734,7 @@ To further query the latest status of a successfully triggered conditonal order, The conditional order before triggering, as well as the conditional order failed to trigger, can be queried out through this endpoint instead of any endpoint in "Trading" section.
### Request Parameter -| Field | Data Type | Mandatory | Default Value| Description | Valid Value | +| Field | Data Type | Required | Default Value| Description | Valid Value | | ----- | ----- | ------ | ---- | ------ | ---- | | clientOrderId | string | TRUE | | Client order ID | | @@ -6762,7 +6762,7 @@ The conditional order before triggering, as well as the conditional order failed ``` ### Response Content -| Field | Data Type | Mandatory | Description | +| Field | Data Type | Required | Description | | ----- | ----- | ------ | ---- | | code | integer | TRUE |Status code | | message | string | FALSE |Error message (if any) | @@ -7144,7 +7144,7 @@ This endpoint returns margin orders based on a specific searching criteria. | from | string | false | NA | Search order id to begin with | NA | | direct | string | false | both | Search direction when 'from' is used | next, prev | | size | int | false | 100 | The number of orders to return | [1, 100] | -| sub-uid | int | false | If not entered, by default it returns margin orders of current user | Sub user ID (mandatory field while parent user querying sub user’s orders) | | +| sub-uid | int | false | If not entered, by default it returns margin orders of current user | Sub user ID (Required field while parent user querying sub user’s orders) | | > The above command returns JSON structured like this: @@ -7225,7 +7225,7 @@ This endpoint returns the balance of the margin loan account. | Parameter | Data Type | Required | Default | Description | | --------- | --------- | -------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | symbol | string | false | NA | The trading symbol, e.g. btcusdt.
If this is empty, then 'transfer-out-available' and 'loan-available' balance type won't be returned | -| sub-uid | int | false | If not entered, by default it returns margin account details of current user | Sub user ID (mandatory field while parent user querying sub user’s margin account details) | +| sub-uid | int | false | If not entered, by default it returns margin account details of current user | Sub user ID (Required field while parent user querying sub user’s margin account details) | > The above command returns JSON structured like this: @@ -8346,7 +8346,7 @@ REQ channel supports refreshing message for 5-level, 20-level, and 150-level. ### Parameters -| Field Name | Data Type | Mandatory | Default Value | Description | Value Range | +| Field Name | Data Type | Required | Default Value | Description | Value Range | | ---------- | --------- | --------- | ------------- | ---------------------------------------------- | ------------------------------------------------------------ | | symbol | string | true | NA | Trading symbol (wildcard inacceptable) | | | levels | integer | true | NA | Number of price levels (Valid value: 5,20,150,400) | Only support the number of price levels at 5, 20,150 or 400 at this point of time. | @@ -8432,7 +8432,7 @@ User could subscribe to this channel to receive refresh update of Market By Pric ### Parameters -| Field Name | Data Type | Mandatory | Default Value | Description | Value Range | +| Field Name | Data Type | Required | Default Value | Description | Value Range | | ---------- | --------- | --------- | ------------- | -------------------------------------- | ----------- | | symbol | string | true | NA | Trading symbol (wildcard inacceptable) | | | levels | integer | true | NA | Number of price levels | 5,10,20 | @@ -8732,7 +8732,7 @@ Pull request is supported. ### Request Parameter -| Parameter | Data Type | Mandatory | Default Value | Description | Valid Value | +| Parameter | Data Type | Required | Default Value | Description | Valid Value | | --------- | --------- | --------- | ------------- | ------------------- | ----------- | | symbol | string | true | NA | ETP traiding symbol | | @@ -8860,7 +8860,7 @@ There are multiple limitations for this version: Authentication request field list -| Field | Mandatory | Data Type | Description | +| Field | Required | Data Type | Description | | ---------------- | --------- | --------- | ------------------------------------------------------------ | | action | true | string | Action type, valid value: "req" | | ch | true | string | Channel, valid value: "auth" | @@ -9611,7 +9611,7 @@ This endpoint will return the basic information of ETF creation and redemption, ### Response Content -| Field | Data Type | Description | Mandatory | +| Field | Data Type | Description | Required | | --------------------- | --------- | ------------------------------------------------------------ | ---------- | | purchase_min_amount | integer | Minimum creation amounts per request | true | | purchase_max_amount | integer | Maximum creation amounts per request | false | @@ -9812,7 +9812,7 @@ Public data ### Request Parameter -| Field Name | Mandatory | Data Type | Description | | +| Field Name | Required | Data Type | Description | | | ---------- | --------- | --------- | ----------------------------- | ---- | | etpName | true | string | ETP code (for example: btc3l) | | @@ -9843,7 +9843,7 @@ Public data ### Response -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | -------- | ----- | | code | integer | TRUE |Status Code | | message | string | FALSE |Error message (if any) | @@ -9876,7 +9876,7 @@ Rate Limit: 2times/sec
### Request Parameter -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | ------ | ----- | | etpName | string | TRUE | ETP code (for example: btc3l) | | value | float | TRUE | Creation value (based on quote currency) | @@ -9884,7 +9884,7 @@ Rate Limit: 2times/sec
### Response -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | -------- | ----- | | code | integer | TRUE |Status Code | | message | string | FALSE |Error message (if any) | @@ -9908,7 +9908,7 @@ Rate Limit: 2times/sec
### Request Parameter -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | ------ | ----- | | etpName | string | TRUE | ETP code (for example: btc3l) | | currency | string | TRUE | Currency of redemption | @@ -9916,7 +9916,7 @@ Rate Limit: 2times/sec
### Response -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | -------- | ----- | | code | integer | TRUE |Status Code | | message | string | FALSE |Error message (if any) | @@ -9942,7 +9942,7 @@ Searching by transactTime
### Request Parameter -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | ------ | ----- | | etpNames | string | TRUE | ETP code,for example: btc3l,Only support one | | currencies | string | FALSE | Quote currency (only valid for transactTypes=creation; multiple inputs acceptable, separated by comma; default value: all available quote currencies under the ETP code) | @@ -9986,7 +9986,7 @@ The query window is circled by startTime and endTime. The maximum window size is ### Response -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | -------- | ----- | | code | integer | TRUE |Status Code | | message | string | FALSE |Error message (if any) | @@ -10023,7 +10023,7 @@ Rate Limit: 2times/sec
### Request Parameter -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | ------ | ----- | | transactId | long | TRUE |交易ID | @@ -10055,7 +10055,7 @@ Rate Limit: 2times/sec
### Response -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | -------- | ----- | | code | integer | TRUE |Status Code | | message | string | FALSE |Error message (if any) | @@ -10092,7 +10092,7 @@ Searching by rebalTime
### Request Parameter -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | ------ | ----- | | symbol | string | TRUE | ETP symbol (for example: btc3lusdt)| | rebalTypes | string | FALSE | Rebalance type (multiple inputs acceptable, separated by comma; valid values: daily, adhoc; default value: all rebalance types) | @@ -10133,7 +10133,7 @@ The query window is circled by startTime and endTime. The maximum window size is ### Response -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | -------- | ----- | | code | integer | TRUE |Status Code | | message | string | FALSE |Error message (if any) | @@ -10155,7 +10155,7 @@ Rate Limit (NEW): 1 time /s
### Request Parameter -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | ------ | ----- | | transactId| long | TRUE | Transaction ID | @@ -10172,7 +10172,7 @@ Rate Limit (NEW): 1 time /s
### Response -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | -------- | ----- | | code | integer | TRUE |Status Code | | message | string | FALSE |Error message (if any) | @@ -10190,7 +10190,7 @@ Rate Limit (NEW): 1 time /5s
### Request Parameter -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | ------ | ----- | | transactId| long[] | TRUE | Transaction ID,eg:"transactId":[65445,65446]| @@ -10223,7 +10223,7 @@ Rate Limit (NEW): 1 time /5s
### Response -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | -------- | ----- | | code | integer | TRUE |Status Code | | message | string | FALSE |Request status | @@ -10247,7 +10247,7 @@ API Key Permission:Trade
### Request Parameter -| Field Name | Data Type | Mandatory | Description | +| Field Name | Data Type | Required | Description | | ----- | ---- | ------ | ----- | | currency | string | TRUE | Currency, support batch query (currency is separated by comma), 10 currencies can be quoted at a time| @@ -10454,7 +10454,7 @@ No parameter is needed for this endpoint. -| Field Name | Mandatory | Data Type | Description | +| Field Name | Required | Data Type | Description | | -------------- | -------- | ------- | ---------- | | status | true | string | Request Processing Result("ok","error") | | data | true | array | with each string represents a suppported currency | From 4f78ca3b5b2299d517444f9ef37adc08478829eb Mon Sep 17 00:00:00 2001 From: zhangyabin Date: Mon, 14 Nov 2022 17:07:34 +0800 Subject: [PATCH 748/759] =?UTF-8?q?=E7=A8=B3=E5=AE=9A=E5=B8=81=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E4=B8=8B=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 81 -------------------------------------------- 1 file changed, 81 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index b9c5f88f8fa..ebcf4241adf 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -9477,87 +9477,6 @@ Below is the return code, return message and the description returend from Asset | 4000 | too.many.request | Request exceed limit (a single instance limit to 50 per second) | | 4000 | too.many.connection | Connection number exceed limit for single API Key (a single instance limit to 10 connections) | -# Stable Coin Exchange - -## Introduction - -Stable coin APIs provide stable coin quote query and exchange. - - - -## Get Exchange Rate - -API Key Permission:Read - -### HTTP Request - - - GET `/v1/stable-coin/quote` - -### Request Parameters - -| Parameter | Data Type | Required | Default | Description | -| --------- | --------- | -------- | ------- | ------------------------------------------------------------ | -| currency | string | true | NA | Stable coin name (PAX/USDC/TUSD).Refer to `GET /v1/common/currencys` | -| amount | string | true | NA | Amount of stable coin to exchange (the value must be an intger.) | -| type | string | true | NA | Type of the exchange (buy/sell) | - -### Response Content - -| Field | Data Type | Description | -| -------------- | --------- | ------------------------------------------------------------ | -| currency | string | Stable coin name (PAX/USDC/TUSD) | -| amount | string | Amount of stable coin to exchange (Due to factors such as the amount of the exchange account, the amount returned may be smaller than the amount requested.) | -| type | string | Type of the exchange (buy/sell) | -| exchangeAmount | string | Amount of HUSD to exchange in or out. When type=buy, exchangeAmount is the HUSD amount the client need to pay; When type=sell, exchangeAmount is the HUSD amount client can gain. | -| exchangeFee | string | Exchange fee (in HUSD) | -| quoteId | string | Stable currency quoteID | -| expiration | string | Term of validity (usually 10 seconds after request) | - -## Exchange Stable Coin - -API Key Permission:Trade - -### HTTP Request - - - POST `/v1/stable-coin/exchange` - -### Request Parameters - -| Parameter | Data Type | Required | Default | Description | -| --------- | --------- | -------- | ------- | ----------------------- | -| quote-id | string | true | NA | stable currency quoteID | - -### Response Content - -| Field | Data Type | Description | -| --------------- | --------- | ------------------------------------ | -| transact-id | long | Exchange record id | -| currency | string | Stable coin name (PAX/USDC/TUSD) | -| amount | string | Amount of stable coin to exchange | -| type | string | Type of the exchange (buy/sell) | -| exchange-amount | string | Amount of HUSD to exchange in or out.When type=buy, exchangeAmount is the HUSD amount the client need to pay; When type=sell, exchangeAmount is the HUSD amount client can gain. | -| exchange-fee | string | Exchange fee (in HUSD) | -| time | long | Timestampe | - -## Error Code - -Below is the error code and the description from stable coin APIs - -| Error Code | Description | -| ------------------------------ | ----------------------------------------------------------- | -| invalid-currency | invalid currency | -| invalid-amount | amount < 1,000 or amount > current quota limit | -| invalid-type | type not 'buy' or 'sell' | -| quote-exceed-price-limit | offered price exceed limit (less than 0.9 or more than 1.1) | -| quote-exceed-time-limit | offered price is timeout | -| quote-failure | other errors in backend causing quote failure | -| invalid-quote-id | Paramemter ‘quote-id’ is invalid | -| insufficient-balance | insufficient balance to buy or sell stable coins | -| insufficient-quota | the quota is exceeded | -| exchange-failure | other errors happend in the backend | -| Base-user-request-exceed-limit | Operation is too frequently | - - -# ETP - -## Introduction - -ETP (Exchange Tradable Products) APIs provide ETP related functionality, such as creation, redemption, query. - -## Get reference data of ETP - -Client can use this endpoint to query ETP's reference data - -### HTTP Request - -- GET `/v2/etp/reference` - -Public data - -### Request Parameter - -| Field Name | Required | Data Type | Description | | -| ---------- | --------- | --------- | ----------------------------- | ---- | -| etpName | true | string | ETP code (for example: btc3l) | | - -> Response: - -```json -{ - "data": { - "etpStatus": "normal", - "creationQuota": { - "maxCreationValue": "10000", - "minCreationValue": "200", - "dailyCreationValue": "50000", - "creationCurrency": "btc3l" - }, - "maxRedemptionAmount": "1000", - "minRedemptionAmount": "50", - "dailyRedemptionAmount": "5000", - "creationFeeRate": "0.0035", - "redemptionFeeRate": "0.0035", - "displayName": "BTC*3/USDT", - "etpName": "btc3l" - }, - "code": 200, - "success": true -} -``` - -### Response - -| Field Name | Data Type | Required | Description | -| ----- | ---- | -------- | ----- | -| code | integer | TRUE |Status Code | -| message | string | FALSE |Error message (if any) | -| \ | object | TRUE | | -| etpName | string | TRUE |ETP code | -| displayName | string | TRUE |ETP display name | -| \ | object | TRUE | | -| maxCreationValue | int | TRUE |Maximum creation value per request | -| minCreationValue | int | TRUE |Minimal creation value per request | -| dailyCreationValue | int | TRUE |Maximum creation value per day | -| creationCurrency | string | TRUE |Quote currency of creation | -| \ | | | | -| maxRedemptionAmount | int | TRUE |Maximum redemption amount per request | -| minRedemptionAmount | int | TRUE |Minimal redemption amount per request | -| dailyRedemptionAmount | int | TRUE |Maximum redemption amount per day | -| creationFeeRate | float | TRUE |Creation fee rate | -| redemptionFeeRate | float | TRUE |Redemption fee rate | -| etpStatus | string | TRUE |ETP status(normal, creation-only, redemption-only, halted) | -| \ | | | | - - -## ETP Creation - -### HTTP Request - -- POST `/v2/etp/creation` - -API Key Permission: Trade
-Rate Limit: 2times/sec
- -### Request Parameter - -| Field Name | Data Type | Required | Description | -| ----- | ---- | ------ | ----- | -| etpName | string | TRUE | ETP code (for example: btc3l) | -| value | float | TRUE | Creation value (based on quote currency) | -| currency | string | TRUE | Quote currency of creation | - -### Response - -| Field Name | Data Type | Required | Description | -| ----- | ---- | -------- | ----- | -| code | integer | TRUE |Status Code | -| message | string | FALSE |Error message (if any) | -| \ | object | TRUE | | -| transactId | long | TRUE |Transaction ID | -| transactTime | long | TRUE |Transaction time (unix time in millisecond) | -| \ | | | | - - -Note:
-The receipt of transactId doesn’t implicate the success of creation. User should query creation history to confirm the transaction status post creation.
- -## ETP Redemption - -### HTTP Request - -- POST `/v2/etp/redemption` - -API Key Permission: Trade
-Rate Limit: 2times/sec
- -### Request Parameter - -| Field Name | Data Type | Required | Description | -| ----- | ---- | ------ | ----- | -| etpName | string | TRUE | ETP code (for example: btc3l) | -| currency | string | TRUE | Currency of redemption | -| amount | float | TRUE | Redemption amount | - -### Response - -| Field Name | Data Type | Required | Description | -| ----- | ---- | -------- | ----- | -| code | integer | TRUE |Status Code | -| message | string | FALSE |Error message (if any) | -| \ | object | TRUE | | -| transactId | long | TRUE |Transaction ID | -| transactTime | long | TRUE |Transaction time (unix time in millisecond) | -| \ | | | | - - -Note:
-The receipt of transactId doesn’t implicate the success of redemption. User should query redemption history to confirm the transaction status post -redemption.
- -## Get ETP Creation & Redemption History - -### HTTP Request - -- GET `/v2/etp/transactions` - -API Key Permission: Read
-Rate Limit: 2times/sec
-Searching by transactTime
- -### Request Parameter - -| Field Name | Data Type | Required | Description | -| ----- | ---- | ------ | ----- | -| etpNames | string | TRUE | ETP code,for example: btc3l,Only support one | -| currencies | string | FALSE | Quote currency (only valid for transactTypes=creation; multiple inputs acceptable, separated by comma; default value: all available quote currencies under the ETP code) | -| transactTypes | string | FALSE | Transaction type,Only support one ,Valid values: completed, processing, clearing, rejected | -| transactStatus | string | FALSE |Transaction status (multiple inputs acceptable, separated by comma; valid values: completed, processing, clearing, rejected; default value: all transaction status) | -| startTime| long | FALSE |Farthest time (unix time in millisecond; valid value:[(endTime – 10 days), endTime]; default value: (endTime – 10 days))| -| endTime| long | FALSE |Nearest time (unix time in millisecond; valid value: [(current time – 180 days), current time]; default value: current time) | -| sort| string | FALSE |Sorting order (valid value: asc, desc; default value: desc) | -| limit| integer | FALSE |Maximum number of items in one page (valid range:[1-500]; default value:100) | -| fromId | long | FALSE | First record ID in this query (only valid for next page querying) | - -Note:
-The query window is circled by startTime and endTime. The maximum window size is 10-day. The window can shift within 180-day.
- -> Response - -```json -{ - "code": 200, - "data": [ - { - "currency": "btc3l", - "feeCurrency": "usdt", - "transactValue": "90.812020468704123849", - "transactPrice": "77.40447942", - "transactId": "9054329", - "transactTime": 1621405496048, - "transactType": "redemption", - "transactAmount": "1.17321402", - "transactAmountOrig": "1.1733", - "transactValueOrig": null, - "transactFee": "0.090812020468704123", - "transactStatus": "completed", - "errCode": null, - "etpName": "btc3lusdt", - "errMessage": null - } - ] -} -``` - -### Response - -| Field Name | Data Type | Required | Description | -| ----- | ---- | -------- | ----- | -| code | integer | TRUE |Status Code | -| message | string | FALSE |Error message (if any) | -| \ | object | TRUE |in order as user defined in 'sort' | -| etpName | string | TRUE | ETP code | -| transactId | long | TRUE |Transaction ID | -| transactTime | long | TRUE |Transaction time (unix time in millisecond) | -| transactType | string | TRUE |Transaction type (valid value: creation, redemption) | -| transactAmount | float | TRUE | Actual transaction amount (in base currency) | -| transactAmountOrig | float | FALSE | Original transaction amount (in base currency; only valid for transactType=redemption) | -| transactValue | float | TRUE | Actual transaction value (in quote currency) | -| transactValueOrig | float | FALSE | Original transaction value (in quote currency; only valid for transactType=creation) | -| transactPrice | float | TRUE | Transaction price (in quote currency) | -| currency | string | TRUE | Quote currency | -| transactFee | float | TRUE | Transaction fee | -| feeCurrency | string | TRUE | Transaction fee currency | -| transactStatus | string | TRUE |Transaction status (valid values: completed, processing, clearing, rejected) | -| errCode | integer | FALSE |Error code (only valid for transactStatus=rejected) | -| errMessage | string | FALSE |Error message (only valid for transactStatus=rejected)| -| \ | | | | -| nextId | long | FALSE | First record ID in next page (only valid if exceeded page size) | - -Note:
-If user querying occurs just after the transaction, transactAmount、transactValue、transactPrice might be updated as blank.
- -## Get Specific ETP Creation or Redemption Record - -### HTTP Request - -- GET `/v2/etp/transaction` - -API Key Permission: Read
-Rate Limit: 2times/sec
- -### Request Parameter - -| Field Name | Data Type | Required | Description | -| ----- | ---- | ------ | ----- | -| transactId | long | TRUE |交易ID | - -> Response - -```json -{ - "data": { - "currency": "btc3l", - "etpName": "btc3lusdt", - "errCode": null, - "feeCurrency": "usdt", - "transactId": "9054329", - "transactTime": 1621405496048, - "transactType": "redemption", - "transactAmount": "1.17321402", - "transactAmountOrig": "1.1733", - "transactValue": "90.812020468704123849", - "transactValueOrig": null, - "transactPrice": "77.40447942", - "transactFee": "0.090812020468704123", - "transactStatus": "completed", - "errMessage": null - }, - "code": 200, - "success": true -} -``` - -### Response - -| Field Name | Data Type | Required | Description | -| ----- | ---- | -------- | ----- | -| code | integer | TRUE |Status Code | -| message | string | FALSE |Error message (if any) | -| \ | object | TRUE |in order as user defined in 'sort' | -| etpName | string | TRUE | ETP code | -| transactId | long | TRUE |Transaction ID | -| transactTime | long | TRUE |Transaction time (unix time in millisecond) | -| transactType | string | TRUE |Transaction type (valid value: creation, redemption) | -| transactAmount | float | TRUE | Actual transaction amount (in base currency) | -| transactAmountOrig | float | FALSE | Original transaction amount (in base currency; only valid for transactType=redemption) | -| transactValue | float | TRUE | Actual transaction value (in quote currency) | -| transactValueOrig | float | FALSE | Original transaction value (in quote currency; only valid for transactType=creation) | -| transactPrice | float | TRUE | Transaction price (in quote currency) | -| currency | string | TRUE | Quote currency | -| transactFee | float | TRUE | Transaction fee | -| feeCurrency | string | TRUE | Transaction fee currency | -| transactStatus | string | TRUE |Transaction status (valid values: completed, processing, clearing, rejected) | -| errCode | integer | FALSE |Error code (only valid for transactStatus=rejected) | -| errMessage | string | FALSE |Error message (only valid for transactStatus=rejected)| -| \ | | | | - - -Note:
-If user querying occurs just after the transaction, transactAmount、transactValue、transactPrice might be updated as blank.
- -## Get Position Rebalance History - -### HTTP Request - -- GET `/v2/etp/rebalance` - -Public data
-Searching by rebalTime
- -### Request Parameter - -| Field Name | Data Type | Required | Description | -| ----- | ---- | ------ | ----- | -| symbol | string | TRUE | ETP symbol (for example: btc3lusdt)| -| rebalTypes | string | FALSE | Rebalance type (multiple inputs acceptable, separated by comma; valid values: daily, adhoc; default value: all rebalance types) | -| startTime| long | FALSE |Farthest time (unix time in millisecond; valid value:[(endTime – 10 days), endTime]; default value: (endTime – 10 days))| -| endTime| long | FALSE |Nearest time (unix time in millisecond; valid value: [(current time – 180 days), current time]; default value: current time) | -| sort| string | FALSE |Sorting order (valid value: asc, desc; default value: desc) | -| limit| integer | FALSE |Maximum number of items in one page (valid range:[1-500]; default value:100) | -| fromId | long | FALSE | First record ID in this query (only valid for next page querying) | - -Note:
-The query window is circled by startTime and endTime. The maximum window size is 10-day. The window can shift within 180-day.
- -> Response - -```json -{ - "code":200, - "data":[ - { - "symbol":"btc3lusdt", - "rebalTime":1630944000192, - "rebalType":"daily" - }, - { - "symbol":"btc3lusdt", - "rebalTime":1630857600186, - "rebalType":"daily" - }, - { - "symbol":"btc3lusdt", - "rebalTime":1630771200185, - "rebalType":"daily" - } - ], - "nextId":8168108 -} -``` - -### Response - -| Field Name | Data Type | Required | Description | -| ----- | ---- | -------- | ----- | -| code | integer | TRUE |Status Code | -| message | string | FALSE |Error message (if any) | -| \ | object | TRUE |in order as user defined in 'sort' | -| symbol | string | TRUE |ETP symbol | -| rebalTime | long | TRUE |Position rebalance time (unix time in millisecond)| -| rebalType | string | TRUE |Position rebalance type (valid values: daily, adhoc) | -| \ | | | | -| nextId | long | FALSE | First record ID in next page (only valid if exceeded page size) | - -## Submit Cancel for an ETP Order - -### HTTP Request - -- POST `/v2/etp/{transactId}/cancel` - -API Key Permission:Trade
-Rate Limit (NEW): 1 time /s
- -### Request Parameter - -| Field Name | Data Type | Required | Description | -| ----- | ---- | ------ | ----- | -| transactId| long | TRUE | Transaction ID | - - - -> Response - -```json -{ -"code": 80042, -"message": "Cancellation of order failed, order does not exist" -} -``` - -### Response - -| Field Name | Data Type | Required | Description | -| ----- | ---- | -------- | ----- | -| code | integer | TRUE |Status Code | -| message | string | FALSE |Error message (if any) | - - - -## Batch Cancellation for ETP Orders - -### HTTP Request - -- POST `/v2/etp/batch-cancel` - -API Key Permission:Trade
-Rate Limit (NEW): 1 time /5s
- -### Request Parameter - -| Field Name | Data Type | Required | Description | -| ----- | ---- | ------ | ----- | -| transactId| long[] | TRUE | Transaction ID,eg:"transactId":[65445,65446]| - -> Response - -```json -{ - "code":200, - "data":{ - "success":[ - "5983466" - ], - "failed":[ - { - "errMsg":"Cancellation of order failed, order does not exist", - "transactId":"65445", - "errCode":80043 - }, - { - "errMsg":"Cancellation of order failed, order does not exist", - "transactId":"65446", - "errCode":80043 - } - ] - }, - "message":null -} - -``` - -### Response - -| Field Name | Data Type | Required | Description | -| ----- | ---- | -------- | ----- | -| code | integer | TRUE |Status Code | -| message | string | FALSE |Request status | -| \ | object | TRUE | | -| success | array | TRUE |List of successful ETP cancellation transactions | -| \ | object | FALSE | | -| errMsg | long | TRUE |Error message of order cancellation failure| -| errCode | string | TRUE |Error code of order cancellation failure | -| transactId | long | FALSE | Transaction ID | -| \ | | | | -| \ | | | | - - -## Get Holding Limit of Leveraged ETP - -### HTTP Request - -- GET `/v2/etp/limit` - -API Key Permission:Trade
- -### Request Parameter - -| Field Name | Data Type | Required | Description | -| ----- | ---- | ------ | ----- | -| currency | string | TRUE | Currency, support batch query (currency is separated by comma), 10 currencies can be quoted at a time| - -> Response - -```json -{ - "data": [ - { - "remainingAmount": "48", - "maxHoldings": "48", - "currency": "btc3l" - }, - { - "remainingAmount": "7561552", - "maxHoldings": "7561552", - "currency": "btc3s" - } - ], - "code": 200, - "success": true -} -``` - -### Response - -| Field | Data Type | Required | Description | -| ---------------- | ---------- | -------- | ----------------------- | -| code | integer | TRUE | Status Code | -| message | string | FALSE | Status message | -| \ | object | | -| currency | string | TRUE | Quote currency | -| maxHoldings | string | TRUE | Holding limit | -| remainingAmount} | string | TRUE | Remaining amount | -| \ | | | - -## Error Code - -Below is the error code and the description returend by ETP APIs - -| Error Code | Description | -| ---------- | ------------------------------------------------------------ | -| 1002 | This feature is not open to users in your country. | -| 2002 | Wrong parameter is passed in symbols | -| 80007 | Subscription closed. Order cancelled | -| 80008 | Redemption closed. Order cancelled. | -| 80009 | The subscription amount shall not be less than specified amount | -| 80010 | The subscription amount shall not be more than specified amount | -| 80011 | The subscription exceeds the daily limit for each user | -| 80012 | The subscription exceeds the daily limit of the platform | -| 80013 | Redemption quantity shall not be less than specified quantity | -| 80014 | Redemption quantity shall not be more than specified quantity | -| 80015 | The redemption exceeds the daily limit for each user | -| 80016 | The redemption exceeds the daily limit of the platform | -| 80018 | Insufficient balances | -| 80019 | Order submission failed, please try again | -| 80021 | Subscription failed due to less than 1 count, Order cancelled | -| 80022 | Redemption failed due to less than 1 count, Order cancelled | -| 80023 | Subscription failed due to price changed, Order cancelled | -| 80024 | Redemption failed due to price changed, Order cancelled | -| 80026 | The system is busy, try again later | -| 80027 | Redemption failed due to no availablity, Order cancelled. | -| 80028 | Order failed, exceeded the holding limit of this currency | -| 80041 | Order cancellation failed, this order is already cancelled | -| 80042 | Order cancellation failed, this order is already executed | -| 80043 | Order cancellation failed, this order does not exist | -| 80045 | Order cancellation failed, the system is busy now, please try again later | -| 80052 | Excedds the maximun query limit 10 | - # Will be offline ## Get all Supported Trading Symbol(V1)(deprecated) From edc150f40bb62ee3d0d2e51d2c0c3d7cb2a9447a Mon Sep 17 00:00:00 2001 From: zhangyabin Date: Mon, 21 Nov 2022 14:26:39 +0800 Subject: [PATCH 750/759] =?UTF-8?q?=E5=93=81=E7=89=8Clogo=E5=8F=98?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/images/logo.svg | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/source/images/logo.svg b/source/images/logo.svg index 39fd7563ea1..2a701b9a177 100644 --- a/source/images/logo.svg +++ b/source/images/logo.svg @@ -1,17 +1,10 @@ - - - - - - - - - - - - - - - - + + + + + + + + + From eff974eff9ca9a11b6d0e75897e22d0ef90defd3 Mon Sep 17 00:00:00 2001 From: zhangyabin Date: Tue, 22 Nov 2022 15:08:13 +0800 Subject: [PATCH 751/759] =?UTF-8?q?=E5=93=81=E7=89=8Clogo=E5=8F=98?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index bad6ea4eebb..37221f1c5df 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -810,7 +810,7 @@ It indicates the request path doesn't exist, please check the path spelling care It is very welcome for market maker who has good market making strategy and large trading volume. If your Huobi Spot account or Contract account has at least 10 BTC, you can send your email to: -- [Vip@global-hgroup.com](mailto:Vip@global-hgroup.com) for Huobi Global (spot / leverage) market maker +- [Vip@global-hgroup.com](mailto:Vip@global-hgroup.com) for Huobi(spot / leverage) market maker - [Vip@global-hgroup.com](mailto:Vip@global-hgroup.com) for Huobi Contract market maker And provide below details: @@ -6456,7 +6456,7 @@ By comparing with the existing stop limit order, the newly introduced conditiona 3) As advanced conditional order, trailing stop order does support additional triggering condition i.e. trailing rate. Only when latest market price breaks stop price, and continues to go up (or down), and then reverts back for a certain percentage which exceeding the pre-defined "trailing rate", this order can be triggered. The valid value range of trailing rate is between 0.1% and 5%.
- + ## Place a conditional order @@ -8260,7 +8260,7 @@ Suggested downstream data processing:
7) Once received a "size=0" at existing price level from incremental message, that price level should be removed from MBP book;
8) If one incremental message includes updates of multiple price levels, all of those levels should be updated simultaneously in MBP book.
-Currently Huobi Global only supports 5-level/20-level MBP incremental channel and 150-level/400-level incremental channel, the differences between them are -
+Currently Huobionly supports 5-level/20-level MBP incremental channel and 150-level/400-level incremental channel, the differences between them are -
1) Different depth of market.
2) 5-level/20-level incremental MBP is a tick by tick feed, which means whenever there is an order book change at that level, it pushes an update; 150-levels/400-level incremental MBP feed is based on the gap between two snapshots at 100ms interval.
3) While there is single side order book update, either bid or ask, the incremental message sent from 5-level/20-level MBP feed only contains that side update.
@@ -8297,7 +8297,7 @@ But the incremental message from 150-levels/400-level MBP feed contains not only } } ``` -In the near future, Huobi Global will align the update behavior of 150-level//400-level incremental channel with 5-level/20-level, which means while single side order book changed (either bid or ask), the update message will be no longer including a blank object for another side.
+In the near future, Huobiwill align the update behavior of 150-level//400-level incremental channel with 5-level/20-level, which means while single side order book changed (either bid or ask), the update message will be no longer including a blank object for another side.
4) While there is nothing change between two snapshots in past 100ms, the 150-levels/400-level incremental MBP feed still sends out a message which contains two blank objects – bids & asks.
```json @@ -8313,7 +8313,7 @@ In the near future, Huobi Global will align the update behavior of 150-level//40 } ``` But 5-level/20-level incremental channel won’t disseminate any update in such a case.
-In the future, Huobi Global will align the update behavior of 150-level/400-level incremental channel with 5-level/20-level, which means while there is no order book change at all, the channel will be no longer disseminating messages of blank object any more.
+In the future, Huobiwill align the update behavior of 150-level/400-level incremental channel with 5-level/20-level, which means while there is no order book change at all, the channel will be no longer disseminating messages of blank object any more.
5) 5-level/20-level incremental channel only supports the following symbols at this stage: btcusdt, ethusdt, xrpusdt, eosusdt, ltcusdt, etcusdt, adausdt, dashusdt, bsvusdt, htusdt, dotusdt, linkusdt, iotausdt, zecusdt, trxusdt, xmrusdt, arusdt, dfausdt, nftusdt, uniusdt, dogeusdt, solusdt, xecusdt, lunausdt, bchusdt, maticusdt, vetusdt, xlmusdt, filusdt, thetausdt. while 150-level/400-level incremental channel supports all symbols. REQ channel supports refreshing message for 5-level, 20-level, and 150-level. From 88254e1f6cd81c855c5741bc0490473317a39247 Mon Sep 17 00:00:00 2001 From: zhangyabin Date: Tue, 22 Nov 2022 15:23:55 +0800 Subject: [PATCH 752/759] =?UTF-8?q?=E5=93=81=E7=89=8Clogo=E5=8F=98?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 37221f1c5df..097a97cf123 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1734,7 +1734,7 @@ curl "https://api.huobi.pro/v2/reference/currencies?currency=usdt" | Field Name | Required | Data Type | Description | Value Range | | -------------- | --------- | --------- | --------------- | ------------------------------------------------------------ | -| currency | false | string | Currency | btc, ltc, bch, eth, etc ...(available currencies in Huobi Global) | +| currency | false | string | Currency | btc, ltc, bch, eth, etc ...(available currencies in Huobi) | | authorizedUser | false | boolean | Authorized user | true or false (if not filled, default value is true) | > Response: From eb9fe71cad1820b0e121d76014ef22fb7dc3fc1c Mon Sep 17 00:00:00 2001 From: zhangyabin Date: Mon, 5 Dec 2022 15:51:17 +0800 Subject: [PATCH 753/759] =?UTF-8?q?etp=E4=B8=8B=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 67 ++------------------------------------------ 1 file changed, 2 insertions(+), 65 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 097a97cf123..aefa40a59ed 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2455,71 +2455,6 @@ curl "https://api.huobi.pro/market/detail?symbol=ethusdt" | \ | | | -## Get real time NAV - -This endpoint returns real time NAV for ETP. - -### HTTP Request - -- GET `/market/etp` - -```shell -curl "https://api.huobi.pro/market/etp?symbol=btc3lusdt" -``` - -### Request Parameter - -| Parameter | Data Type | Required | Default Value | Description | -| --------- | --------- | --------- | ------------- | ------------------ | -| symbol | string | true | NA | ETP trading symbol | - -> Response - -```json -{ - "ch":"market.btc3lusdt.etp", - "status":"ok", - "ts":1597890198849, - "tick":{ - "actualLeverage":2.988538205272293, - "nav":17.463067985747816, - "outstanding":98338.57818006596, - "symbol":"btc3lusdt", - "navTime":1597890198525, - "basket":[ - { - "amount":0.004438693860243208, - "currency":"btc" - }, - { - "amount":-34.725977870927, - "currency":"usdt" - } - ] - } -} -``` - -### Response - -| Field Name | Data Type | Description | -| -------------- | --------- | -------------------------------------- | -| status | string | Request Processing Result "ok","error" | -| ch | string | Data belonged channel,Format:market.$symbol.etp | -| ts | long | Time of Respond Generation, Unit: Millisecond | -| \ | object | | -| symbol | string | ETP trading symbol | -| nav | float | Latest NAV | -| navTime | long | Update time (unix time in millisecond) | -| outstanding | float | Outstanding shares | -| \ | object | Basket | -| currency | float | Currency | -| amount | float | Amount | -| \ | | | -| actualLeverage | float | Actual leverage ratio | -| \ | | | - - ## Error Code Below is the error code, error message and description returned by Market data APIs. @@ -3488,6 +3423,7 @@ Callable by sub user
| ----- | -------- | -------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | +| success | boolean | TRUE | | | \ | object | TRUE | | | accountId | string | TRUE | Account ID | | accountStatus | string | TRUE | Account status (working, lock, fl-sys, fl-mgt, fl-end, fl-negative) | @@ -3550,6 +3486,7 @@ Note:
| ----- | -------- | -------- | ---------- | | code | integer | TRUE | Status code | | message | string | FALSE | Error message (if any) | +| success | boolean | TRUE | | | \ | object | TRUE | | | transactId | string | TRUE | Transaction ID | | transactTime | long | TRUE | Transaction time (unix time in millisecond) | From cf6b37a353850736d7ad45a17c1755ee258febb9 Mon Sep 17 00:00:00 2001 From: zhangyabin Date: Tue, 6 Dec 2022 15:05:49 +0800 Subject: [PATCH 754/759] =?UTF-8?q?etp=E4=B8=8B=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 293 ------------------------------------------- 1 file changed, 293 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index aefa40a59ed..71c9c524ec7 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -8661,63 +8661,6 @@ Pull request is supported. } ``` -## Subscribe ETP Real Time NAV - -### Subscription - -`market.$symbol.etp` - -### Request Parameter - -| Parameter | Data Type | Required | Default Value | Description | Valid Value | -| --------- | --------- | --------- | ------------- | ------------------- | ----------- | -| symbol | string | true | NA | ETP traiding symbol | | - -> Update example - -```json -{ - "ch":"market.btc3lusdt.etp", - "ts":1630998641232, - "tick":{ - "actualLeverage":2.939514947040537, - "nav":55.96301165128891, - "outstanding":302712.87098475, - "symbol":"btc3lusdt", - "navTime":1630998641232, - "basket":[ - { - "amount":0.003154874364924647, - "currency":"btc" - }, - { - "amount":-108.54109757907857, - "currency":"usdt" - } - ] - } -} -``` - -### Update Content - -| Field Name | Data Type | Description | -| -------------- | --------- | -------------------------------------- | -| status | string | Request Processing Result "ok","error" | -| ch | string | Data belonged channel,Format:market.$symbol.etp | -| ts | long | Time of Respond Generation, Unit: Millisecond | -| \ | object | | -| symbol | string | ETP trading symbol | -| nav | float | Latest NAV | -| navTime | long | Update time (unix time in millisecond) | -| outstanding | float | Outstanding shares | -| \ | object | Basket | -| currency | float | Currency | -| amount | float | Amount | -| \ | | | -| actualLeverage | float | Actual leverage ratio | -| \ | | | - ## Error Code @@ -9414,242 +9357,6 @@ Below is the return code, return message and the description returend from Asset | 4000 | too.many.request | Request exceed limit (a single instance limit to 50 per second) | | 4000 | too.many.connection | Connection number exceed limit for single API Key (a single instance limit to 10 connections) | -# ETF (HB10) - -## Introduction - -Huobi's platform allows clients to create ETF holdings with their matching assets, and also allows clients to redempt ETF to comprised assets. - -## Creation and Redemption Configuration - -This endpoint will return the basic information of ETF creation and redemption, as well as ETF constituents, including max amount of creation, min amount of creation, max amount of redemption, min amount of redemption, creation fee rate, redemption fee rate, eft create/redeem status. - -### HTTP Request - -- GET `/etf/swap/config` - - -### Request Parameter - -| Parameter | Data Type | Required | Description | -| --------- | --------- | -------- | ------------------------------------------------ | -| etf_name | string | true | The name of the ETF, currently only support hb10 | - -> Response: - -```json -{ - "code": 200, - "data": { - "purchase_min_amount": 10000, - "purchase_max_amount": 100000, - "redemption_min_amount": 10000, - "redemption_max_amount": 10000, - "purchase_fee_rate": 0.001, - "redemption_fee_rate": 0.002, - "etf_status":1, - "unit_price": - [ - { - "currency": "eth", - "amount": 19.9 - }, - { - "currency": "btc", - "amount": 9.9 - } - ] - }, - "message": null, - "success": true -} -``` - -### Response Content - -| Field | Data Type | Description | Required | -| --------------------- | --------- | ------------------------------------------------------------ | ---------- | -| purchase_min_amount | integer | Minimum creation amounts per request | true | -| purchase_max_amount | integer | Maximum creation amounts per request | false | -| redemption_min_amount | integer | Minimum redemption amounts per request | true | -| redemption_max_amount | integer | Maximum redemption amounts per request | false | -| purchase_fee_rate | decimal | Creation fee rate | ture | -| redemption_fee_rate | decimal | Redemption fee rate | ture | -| etf_status | integer | status of the ETF: Normal(1), Rebalancing Start(2), Creation and Redemption Suspended(3), Creation Suspended(4), Redemption Suspended(5) | ture | -| unit_price | array | ETF constitution in format of {amount, currency} | ture | - -## Order Creation/Redemption - -API Key Permission:Trade - -This endpoint allow clients to order creation or redemption of ETF. - -### HTTP Request - -- POST `/etf/swap/in` - -- POST `/etf/swap/out` - -```shell -curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/etf/swap/in" -d -'{"etf_name": "hb10", "amount": 10000}' - -curl -X POST -H 'Content-Type: application/json' "https://api.huobi.pro/etf/swap/out" -d -'{"etf_name": "hb10", "amount": 10000}' -``` - -### Request Parameter - -| Parameter | Required | Data Type | Description | -| --------- | -------- | --------- | ------------------------------------- | -| etf_name | true | string | ETF name, currently only support hb10 | -| amount | true | integer | The amount to create or redemption | - -> Response: - -```json -{ - "code": 200, - "data": null, - "message": null, - "success": true -} -``` - -### Response Content - -| Field | Data Type | Description | -| ------- | --------- | ------------------------------------------------------------ | -| code | integer | The overall status of the order, please find details in below table | -| data | object | The data content if available | -| message | string | The message of the order result | -| success | boolean | If the order is successful | - -**Response code details** - -| Code | Description | -| ----- | ------------------------------------------------------------ | -| 200 | Successful | -| 10404 | Invalid ETF name | -| 13403 | Insufficient asset to create ETF | -| 13404 | Create and redemption disabled due to system setup | -| 13405 | Create and redemption disabled due to configuration issue | -| 13406 | Invalid API call | -| 13410 | API authentication fails | -| 13500 | System error | -| 13601 | Create and redemption disabled during rebalance | -| 13603 | Create and redemption disabled due to other reason | -| 13604 | Create suspended | -| 13605 | Redemption suspended | -| 13606 | Amount incorrect. For the cases when creation amount or redemption amount is not in the range of min/max amount, this code will be returned. | - -## Show Past Creation/Redemption - -API Key Permission:Read - -This endpoints allows clients to get past creation and redemption.(up to 100 records) - -### HTTP Request - -- GET `/etf/swap/list ` - -```shell -curl "https://api.huobi.pro/etf/swap/list" -``` - -### Request Parameter - -| Parameter | Required | Data Type | Description | | -| --------- | -------- | --------- | ---------------------------------------------------------- | ---- | -| etf_name | true | string | ETF name, currently only support hb10 | | -| offset | true | integer | The offset of the records, set to 0 for the latest records | | -| limit | true | integer | The number of records to return, min is 1, max is 100 | | - -> Response: - -```json -{ - "code": 200, - "data": [ - { - "id": 112222, - "gmt_created": 1528855872323, - "currency": "hb10", - "amount": 11.5, - "type": 1, - "status": 2, - "detail": - { - "used_currency_list": - [ - { - "currency": "btc", - "amount": 0.666 - }, - { - "currency": "eth", - "amount": 0.666 - } - ], - "rate": 0.002, - "fee": 100.11, - "point_card_amount":1.0, - "obtain_currency_list": - [ - { - "currency": "hb10", - "amount": 1000 - } - ] - } - } - ], - "message": null, - "success": true -} -``` - -### Response Content - -| Field | Data Type | Description | -| ----------- | --------- | -------------------------- | -| id | integer | Creation/Redemption id | -| gmt_created | integer | Operation timestamp | -| currency | string | ETF name | -| amount | double | Creation/Redmption amount | -| type | integer | Creation(1), Redemption(2) | -| status | integer | Operation result (-2 if success) | -| detail | array | Please find details below | - -**Fields under "Detail"** - -| Field | Data Type | Description | | -| -------------------- | --------- | ------------------------------------------------------------ | ---- | -| used_currency_list | array | For creation this is the list and amount of underlying assets used for ETF creation. For redemption this is the amount of ETF used for redemption. | | -| rate | decimal | Fee rate | | -| fee | decimal | The actual fee amount | | -| point_card_amount | decimal | Discount from point card | | -| obtain_currency_list | array | For creation this is the amount for ETF created. For redemption this is the list and amount of underlying assets obtained. | | - -## Error Code - -Below is the error code and the description returned by ETF APIs - -| Error Code | Description | -| ---------- | ------------------------------------------------------------ | -| 504 | Missing Parameter: [name] | -| 10404 | The fund does not exist (right now only support hb10) | -| 13404 | Exchange ratio of the coin and ETF is missing | -| 13406 | Non-API calls. The request is rejected | -| 13410 | API signature error | -| 13601 | Position adjustment phase: swap-in and swap-out are suspended | -| 13603 | Swap-in and swap-out have been suspended | -| 13604 | Swap-in has been suspended | -| 13605 | Swap-out has been suspended | -| 13606 | Incorrect transaction share, exceed the limit | - ---> - # Will be offline ## Get all Supported Trading Symbol(V1)(deprecated) From 7ede43a371aa3143abb149bb72c226c78e1c012b Mon Sep 17 00:00:00 2001 From: zhangyabin Date: Tue, 17 Jan 2023 15:07:57 +0800 Subject: [PATCH 755/759] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 1 + 1 file changed, 1 insertion(+) diff --git a/source/index.html.md b/source/index.html.md index 71c9c524ec7..2f00ff2b58b 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -6281,6 +6281,7 @@ Below is the error code and description returned by Trading APIs | Error Code | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | +| forbidden-trade-for-open-protect | The current protection phase is open. You can place orders after the protection period ends (GMT+8) | | base-argument-unsupported | The specified parameter is not supported | | base-system-error | System internel error. For placing or canceling order, it is mostly due to cache issue, please try again later. | | login-required | Signature is missing, or user not find (key and uid not match). | From a1df512b4460b4b4202e75cb30dbd7284b57c3df Mon Sep 17 00:00:00 2001 From: zhangyabin Date: Wed, 8 Feb 2023 14:16:21 +0800 Subject: [PATCH 756/759] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=87=BA=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 2f00ff2b58b..42319e73cfc 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1172,6 +1172,8 @@ API Key Permission:Read | data | \ | Object | | | sc | symbol_code | string | symbol(outside)| | dn | display_name | string | display name | +| si | state_isolated | string | Leverage status of symbol:online,offline| +| scr | state_cross | string | Full leverage status of symbol :online,offline | | bc | base_currency | string | base currency | | bcdn | base_currency_display_name | string | base currency display name | | qc | quote_currency | string | quote currency | From 1c8ebee5295afeefbb0cdcbf9c44d161a05efa89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E6=B5=A9?= Date: Fri, 26 May 2023 23:09:18 +0800 Subject: [PATCH 757/759] =?UTF-8?q?=E6=96=B0api=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/layouts/layout.erb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/layouts/layout.erb b/source/layouts/layout.erb index 820febe86a0..186cad81661 100644 --- a/source/layouts/layout.erb +++ b/source/layouts/layout.erb @@ -73,6 +73,9 @@ under the License. U本位合约 + + new API +