From f978a185369e090546af0b57e41f03547727f0a7 Mon Sep 17 00:00:00 2001 From: rayxy Date: Mon, 24 Dec 2018 11:39:18 +0000 Subject: [PATCH 001/864] 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/864] 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/864] 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/864] 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 1c362b2137c90117ec578069640c5ed2adba265a Mon Sep 17 00:00:00 2001 From: rayx Date: Thu, 27 Dec 2018 01:32:09 +0000 Subject: [PATCH 005/864] add the config changes for v1 cn --- deploy.sh | 2 +- source/index.html.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy.sh b/deploy.sh index f999345e32b..3483748493c 100755 --- a/deploy.sh +++ b/deploy.sh @@ -37,7 +37,7 @@ parse_args() { #default language uses en if a custom one is not supplied if [[ -z $language ]]; then - language=en + language=cn fi # Parse arg flags diff --git a/source/index.html.md b/source/index.html.md index 47e00290968..427f626a63d 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -13,7 +13,7 @@ includes: search: true --- -# Introduction +# Introduction to API 1.0 Chinese Welcome to the Huobi API! You can use our API to access all market data, trading, and account management endpoints. From 365b11b9027e31b8e310a26e06045ebb632430a7 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 2 Jan 2019 15:12:47 +0800 Subject: [PATCH 006/864] test --- 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 427f626a63d..a56efdeffe9 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -13,7 +13,7 @@ includes: search: true --- -# Introduction to API 1.0 Chinese +# API v1.0 简介 Welcome to the Huobi API! You can use our API to access all market data, trading, and account management endpoints. @@ -49,11 +49,11 @@ ch | string | The data channel this response was originated from. Some 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. From 2a79e96f0c86840329635d0cb985060b4b93a309 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 2 Jan 2019 17:10:21 +0800 Subject: [PATCH 007/864] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 a56efdeffe9..90b5d11731a 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 @@ -19,13 +19,13 @@ Welcome to the Huobi API! You can use our API to access all market data, trading 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. @@ -142,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. @@ -193,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. @@ -244,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. @@ -304,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. @@ -506,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. @@ -556,11 +556,11 @@ 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. @@ -1045,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 +# 杠杆交易 @@ -1378,10 +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) +# 钱包(充值与提现) TBC -# Account +# 账户相关 TBC From 9468dabbf7211368df750de36237960f07ca0531 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 3 Jan 2019 15:22:56 +0800 Subject: [PATCH 008/864] update margin trading --- source/index.html.md | 340 +++++++++++++++++++++---------------------- 1 file changed, 170 insertions(+), 170 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 90b5d11731a..066286e9bd5 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -156,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 [ @@ -173,15 +173,15 @@ curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" ] ``` -### Query 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 @@ -205,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 { @@ -223,13 +223,13 @@ curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" } ``` -### Query 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 --------- | --------- | ----------- @@ -258,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 [ @@ -285,11 +285,11 @@ curl "https://api.huobi.pro/market/tickers" ] ``` -### Query Parameters +### 请求参数 This endpoint does not require parameters. -### Response Content +### 响应数据 Response content is an array of object, each object has below fields. @@ -316,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 { @@ -369,14 +369,14 @@ curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" } ``` -### 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 +### 响应数据 @@ -399,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 { @@ -417,13 +417,13 @@ curl "https://api.huobi.pro/market/trade?symbol=ethusdt" } ``` -### Query Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +Parameter | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -### Response Content +### 响应数据 @@ -447,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 [ @@ -487,14 +487,14 @@ curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" ] ``` -### Query 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 +### 响应数据 @@ -518,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 { @@ -534,13 +534,13 @@ curl "https://api.huobi.pro/market/detail?symbol=ethusdt" } ``` -### Query Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +Parameter | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -### Response Content +### 响应数据 @@ -579,7 +579,7 @@ BODY { "type": "buy-limit"} ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -587,18 +587,18 @@ BODY { } ``` -### 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 +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 +### 响应数据 @@ -621,7 +621,7 @@ BODY { "type": "buy-limit"} ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -644,21 +644,21 @@ BODY { } ``` -### 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 +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 @@ -682,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 { @@ -707,7 +707,7 @@ BODY { } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -727,15 +727,15 @@ BODY { } ``` -### 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 @@ -757,7 +757,7 @@ BODY { } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -777,15 +777,15 @@ BODY { } ``` -### 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 @@ -802,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 { @@ -828,12 +828,12 @@ curl "https://api.huobi.pro/v1/order/orders/59378" } ``` -### 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 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,7 +861,7 @@ 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 { @@ -882,14 +882,14 @@ curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" } ``` -### 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 @@ -919,7 +919,7 @@ BODY { } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -947,28 +947,28 @@ BODY { } ``` -### Query 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 +### 响应数据 -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 +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 @@ -994,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 { @@ -1015,27 +1015,27 @@ curl "https://api.huobi.pro/v1/order/matchresults" } ``` -### Query 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 @@ -1053,13 +1053,13 @@ 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 -`GET https://api.huobi.pro/v1/dw/transfer-in` +`POST https://api.huobi.pro/v1/dw/transfer-in` ```shell curl "https://api.huobi.pro/v1/dw/transfer-in" @@ -1071,7 +1071,7 @@ BODY } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -1079,25 +1079,25 @@ BODY } ``` -### 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 +symbol | string | true | NA | 交易对, e.g. btcusdt, bchbtc +currency | string | true | NA | 币种 +amount | string | true | NA | 划转数量 -### 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 @@ -1113,7 +1113,7 @@ BODY } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -1121,29 +1121,29 @@ BODY } ``` -### 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 +symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc +currency | string | true | NA | 币种 +amount | string | true | NA | 划转数量 -### 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` +`POST https://api.huobi.pro/v1/margin/orders` ```shell curl "https://api.huobi.pro/v1/margin/orders" @@ -1155,7 +1155,7 @@ BODY } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -1163,25 +1163,25 @@ BODY } ``` -### 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 +symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc +currency | string | true | NA | 币种 +amount | string | true | NA | 借贷数量 -### 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 @@ -1195,7 +1195,7 @@ BODY } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -1203,27 +1203,27 @@ BODY } ``` -### Query Parameters +### 请求参数 -Parameter | Data Type | Required | Default | Description +参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -amount | string | true | NA | The amount of currency to repay +amount | string | true | NA | 归还币种 -### 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` +`POST https://api.huobi.pro/v1/margin/loan-orders` ```shell curl "https://api.huobi.pro/v1/margin/load-orders" @@ -1237,7 +1237,7 @@ BODY { } ``` -> The above command returns JSON structured like this: +> 以上命令返回的 JSON 结果: ```json { @@ -1261,21 +1261,21 @@ BODY { } ``` -### 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 +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 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 @@ -1292,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. @@ -1312,63 +1312,63 @@ BODY { } ``` -> 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" + } + ] + } + ] } ``` -### Query 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 --------- | --------- | ----------- From a182137958592efbdbbdafe3a4a89772c986e222 Mon Sep 17 00:00:00 2001 From: rayxy Date: Thu, 3 Jan 2019 17:08:20 +0800 Subject: [PATCH 009/864] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=B9=B6=E4=BF=AE=E6=94=B9=E6=A6=82=E8=BF=B0?= =?UTF-8?q?=E6=88=90=E9=80=9A=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 109 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 108 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 066286e9bd5..54d86dcf6a6 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -19,7 +19,7 @@ Welcome to the Huobi API! You can use our API to access all market data, trading 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. -# 概述 +# 通用 ## 请求格式 @@ -142,6 +142,113 @@ 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 +# 基础接口 + +## 返回所有支持的交易对 + +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] + +## 返回所有支持的币种 + +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 + + + +## 返回当前系统时间 + +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 + + + # 行情数据 ## K 线数据(蜡烛图) From adf82f21a241c3202e078309be3ef3e000c5a327 Mon Sep 17 00:00:00 2001 From: rayxy Date: Thu, 3 Jan 2019 17:27:46 +0800 Subject: [PATCH 010/864] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=AE=80=E4=BB=8B?= =?UTF-8?q?=E9=83=A8=E5=88=86=E7=9A=84=E4=B8=AD=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 54d86dcf6a6..5f07ff8f1bc 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -15,9 +15,11 @@ search: true # API v1.0 简介 -Welcome to the Huobi API! You can use our API to access all market data, trading, and account management endpoints. +欢迎使用火币API v1.0! 你可以使用此API获得市场行情数据,进行交易,并且管理你的账户。 -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. +在文档的右侧是代码实例,目前我们仅提供针对shell的代码实例。 + +你可以通过选择上方下拉菜单的版本号来切换文档对应的API版本。你也可以通过点击右上方的语言按钮来切换文档语言。 # 通用 From 2dbfab0f8c03697bb7a857234ad0c403c64caafd Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 3 Jan 2019 17:35:23 +0800 Subject: [PATCH 011/864] update --- source/index.html.md | 87 +++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 41 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 066286e9bd5..75d36371579 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3,11 +3,10 @@ title: 火币 API 文档 v1.0 language_tabs: # must be one of https://git.io/vQNgJ - shell + - python toc_footers: - - Sign Up for a Huobi API key - - Login is required for creating an API key - + - 获取 APIKEY includes: search: true @@ -42,7 +41,7 @@ All response will be returned in JSON format. The top level JSON is a wrapper ob } ``` -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. @@ -51,14 +50,19 @@ 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. +现货 / 杠杆(api.huobi.pro):10秒100次 + +合约(api.hbdm.com):限制频率为10秒50次 + ## 签名认证 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 @@ -150,7 +154,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/kline?period=1day&size=200&symbol=btcusdt" @@ -177,12 +181,13 @@ curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" Parameter | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc +symbol | string | true | NA | 交易对, 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] ### 响应数据 -Parameter | Data Type | Description + +参数 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | The UNIX timestamp in seconds as response id amount | float | The aggregated trading volume in USDT @@ -193,13 +198,13 @@ low | float | The low price high | float | The high price vol | float | The trading volume in base currency -## 最新的聚合 Ticker +## 聚合行情(Ticker) This endpoint retrieves the latest ticker with some important 24h aggregated market data. ### 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" @@ -227,11 +232,11 @@ curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" Parameter | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc +symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc ### 响应数据 -Parameter | Data Type | Description +参数 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | The UNIX timestamp in seconds as response id amount | float | The aggregated trading volume in USDT @@ -252,7 +257,7 @@ 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" @@ -293,7 +298,7 @@ This endpoint does not require parameters. 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 @@ -310,7 +315,7 @@ 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" @@ -371,29 +376,29 @@ curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" ### 请求参数 -Parameter | Data Type | Required | Allowed Value | Description +参数 | 数据类型 | 是否必须 | 取值范围 | 描述 --------- | --------- | -------- | ------------- | ----------- -symbol | string | true | All supported trading pair symbols | The trading pair to query, e.g. btcusdt, bccbtc +symbol | string | true | All supported trading pair symbols | 交易对, e.g. btcusdt, bccbtc type | string | true | step0, step1, step2, step3, step4, step5 | TBC ### 响应数据 -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` +`GET /market/trade` ```shell curl "https://api.huobi.pro/market/trade?symbol=ethusdt" @@ -421,13 +426,13 @@ curl "https://api.huobi.pro/market/trade?symbol=ethusdt" Parameter | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc +symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc ### 响应数据 -Parameter | Data Type | Description +参数 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | The unique trade id of this trade amount | float | The trading volume in base currency @@ -435,13 +440,13 @@ 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` +`GET /market/history/trade` ```shell curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" @@ -491,14 +496,14 @@ curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" Parameter | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc +symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc size | integer | false | 1 | The number of data returns ### 响应数据 -Parameter | Data Type | Description +参数 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | The unique trade id of this trade amount | float | The trading volume in base currency @@ -512,7 +517,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" @@ -538,13 +543,13 @@ curl "https://api.huobi.pro/market/detail?symbol=ethusdt" Parameter | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc +symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc ### 响应数据 -Parameter | Data Type | Description +参数 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | The UNIX timestamp in seconds as response id amount | float | The aggregated trading volume in USDT @@ -566,7 +571,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` +`GET /v1/order/orders/place` ```shell curl "https://api.huobi.pro/v1/order/orders/place" @@ -602,13 +607,13 @@ source | string | false | api | When trade with margin use 'margin -## 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` +`GET /v1/order/openOrders` ```shell curl "https://api.huobi.pro/v1/order/openOrders" @@ -696,7 +701,7 @@ This endpoint submit cancellation for multiple orders at once. ### HTTP Request -`GET https://api.huobi.pro/v1/order/orders/batchcancel` +`GET /v1/order/orders/batchcancel` ```shell curl "https://api.huobi.pro/v1/order/orders/batchcancel" @@ -746,7 +751,7 @@ This endpoint submit cancellation for multiple orders at once. ### HTTP Request -`GET https://api.huobi.pro/v1/order/orders/batchcancel` +`GET /v1/order/orders/batchcancel` ```shell curl "https://api.huobi.pro/v1/order/orders/batchcancel" @@ -796,7 +801,7 @@ This endpoint returns the detail of one order. ### HTTP Request -`GET https://api.huobi.pro/v1/order/orders/{order-id}` +`GET /v1/order/orders/{order-id}` ```shell curl "https://api.huobi.pro/v1/order/orders/59378" @@ -855,7 +860,7 @@ This endpoint returns the match result of an order. ### HTTP Request -`GET https://api.huobi.pro/v1/order/orders/{order-id}/matchresult` +`GET /v1/order/orders/{order-id}/matchresult` ```shell curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" @@ -905,7 +910,7 @@ This endpoint returns orders based on a specific searching criteria. ### HTTP Request -`GET https://api.huobi.pro/v1/order/orders` +`GET /v1/order/orders` ```shell curl "https://api.huobi.pro/v1/order/orders" @@ -988,7 +993,7 @@ This endpoint returns the match results of past and open orders based on specifi ### HTTP Request -`GET https://api.huobi.pro/v1/order/matchresults` +`GET /v1/order/matchresults` ```shell curl "https://api.huobi.pro/v1/order/matchresults" @@ -1101,7 +1106,7 @@ data | integer | Transfer id ### HTTP Request -`GET https://api.huobi.pro/v1/dw/transfer-out` +`GET /v1/dw/transfer-out` ```shell curl "https://api.huobi.pro/v1/dw/transfer-out" @@ -1298,7 +1303,7 @@ This endpoint returns the balance of the margin loan account. ### HTTP Request -`GET https://api.huobi.pro/v1/margin/accounts/balance` +`GET /v1/margin/accounts/balance` ```shell curl "https://api.huobi.pro/v1/margin/accounts/balance" From 646bd4aa9d566db145b27c4441abf4b2952a00d7 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 3 Jan 2019 18:14:59 +0800 Subject: [PATCH 012/864] update --- source/index.html.md | 446 ++++++++++++++++++++++--------------------- 1 file changed, 227 insertions(+), 219 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 75d36371579..7dc719a0e20 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -41,7 +41,7 @@ All response will be returned in JSON format. The top level JSON is a wrapper ob } ``` -参数 | 数据类型 | 描述 +参数名称| 数据类型 | 描述 --------- | --------- | ----------- 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. @@ -179,7 +179,7 @@ curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" ### 请求参数 -Parameter | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | 交易对, 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 @@ -187,7 +187,7 @@ size | integer | false | 150 | The number of data returns, range [ ### 响应数据 -参数 | 数据类型 | 描述 +参数名称| 数据类型 | 描述 --------- | --------- | ----------- id | integer | The UNIX timestamp in seconds as response id amount | float | The aggregated trading volume in USDT @@ -230,13 +230,13 @@ curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" ### 请求参数 -Parameter | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc ### 响应数据 -参数 | 数据类型 | 描述 +参数名称| 数据类型 | 描述 --------- | --------- | ----------- id | integer | The UNIX timestamp in seconds as response id amount | float | The aggregated trading volume in USDT @@ -298,7 +298,7 @@ This endpoint does not require parameters. Response content is an array of object, each object has below fields. -参数 | 数据类型 | 描述 +参数名称| 数据类型 | 描述 --------- | --------- | ----------- amount | float | The aggregated trading volume in USDT of last 24 hours count | integer | The number of completed trades of last 24 hours @@ -376,7 +376,7 @@ curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" ### 请求参数 -参数 | 数据类型 | 是否必须 | 取值范围 | 描述 +参数名称 | 数据类型 | 是否必需 | 取值范围 | 描述 --------- | --------- | -------- | ------------- | ----------- symbol | string | true | All supported trading pair symbols | 交易对, e.g. btcusdt, bccbtc type | string | true | step0, step1, step2, step3, step4, step5 | TBC @@ -385,7 +385,7 @@ type | string | true | step0, step1, step2, step3, step4, step5 | TB -参数 | 数据类型 | 描述 +参数名称| 数据类型 | 描述 --------- | --------- | ----------- ts | integer | The UNIX timestamp in milliseconds version | integer | TBC @@ -424,7 +424,7 @@ curl "https://api.huobi.pro/market/trade?symbol=ethusdt" ### 请求参数 -Parameter | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc @@ -432,7 +432,7 @@ symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc -参数 | 数据类型 | 描述 +参数名称| 数据类型 | 描述 --------- | --------- | ----------- id | integer | The unique trade id of this trade amount | float | The trading volume in base currency @@ -494,7 +494,7 @@ curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" ### 请求参数 -Parameter | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc size | integer | false | 1 | The number of data returns @@ -503,7 +503,7 @@ size | integer | false | 1 | The number of data returns -参数 | 数据类型 | 描述 +参数名称| 数据类型 | 描述 --------- | --------- | ----------- id | integer | The unique trade id of this trade amount | float | The trading volume in base currency @@ -541,7 +541,7 @@ curl "https://api.huobi.pro/market/detail?symbol=ethusdt" ### 请求参数 -Parameter | 数据类型 | 是否必须 | 默认值 | 描述 +Parameter | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc @@ -549,7 +549,7 @@ symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc -参数 | 数据类型 | 描述 +参数名称| 数据类型 | 描述 --------- | --------- | ----------- id | integer | The UNIX timestamp in seconds as response id amount | float | The aggregated trading volume in USDT @@ -559,7 +559,7 @@ 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 +version | integer | # 现货交易 @@ -594,7 +594,7 @@ BODY { ### 请求参数 -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- account-id | string | true | NA | The account id used for this spot trading symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc @@ -651,7 +651,7 @@ BODY { ### 请求参数 -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- account-id | string | false | NA | The account id used for this spot trading symbol | string | false | NA | 交易对, e.g. btcusdt, bccbtc @@ -660,7 +660,7 @@ size | int | false | 10 | The max number of orders to return ### 响应数据 -参数 | 数据类型 | 描述 +参数名称 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | order id symbol | string | 交易对, e.g. btcusdt, bccbtc @@ -673,7 +673,7 @@ 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. @@ -681,7 +681,7 @@ This endpoint submit 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` ```shell curl "https://api.huobi.pro/v1/order/orders/59378/submitcancel" @@ -734,18 +734,17 @@ BODY { ### 请求参数 -参数 | 数据类型 | 是否必须 | 默认值 | 描述 ---------- | --------- | -------- | ------- | ----------- -order-ids | list | true | NA | The order ids to cancel. Max size is 50. +| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | +| ---- | ---- | ---- | ---- | ---- | ---- | +| order-ids | true | list | 撤销订单ID列表 | |单次不超过50个订单id| ### 响应数据 -参数 | 数据类型 | 描述 ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request +| 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +| ---- | ----- | ---- | ----- | ---- | +| data | false | map | 撤单结果 | | -## Submit Cancel for Multiple Orders at Once +## 批量取消符合条件的订单 This endpoint submit cancellation for multiple orders at once. @@ -784,18 +783,22 @@ BODY { ### 请求参数 -参数 | 数据类型 | 是否必须 | 默认值 | 描述 ---------- | --------- | -------- | ------- | ----------- -order-ids | list | true | NA | The order ids to cancel. Max size is 50. +| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | +| -------- | ---- | ------ | ------------ | ---- | ---- | +| account-id | true | string | 账户ID | | | +| symbol | false | string | 交易对 | | 单个交易对字符串,缺省将返回所有符合条件尚未成交订单 | +| side | false | string | 主动交易方向 | | “buy”或“sell”,缺省将返回所有符合条件尚未成交订单 | +| size | false | int | 所需返回记录数 | 100 | [0, 100] | ### 响应数据 -参数 | 数据类型 | 描述 ---------- | --------- | ----------- -success | list | The order ids with thier cancel request sent successfully -failed | list | The details of the failed cancel request +| 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +| ---- | ---- | ------ | ----- | ---- | +| success-count | true | int | 成功取消的订单数 | | +| failed-count | true | int | 取消失败的订单数 | | +| next-id | true | long | 下一个符合取消条件的订单号 | | -## Show the Order Detail of One Order +## 查询单个订单详情 This endpoint returns the detail of one order. @@ -833,37 +836,41 @@ curl "https://api.huobi.pro/v1/order/orders/59378" } ``` -### 响应数据 +### 请求参数 -参数 | 数据类型 | 描述 ---------- | --------- | ----------- -id | integer | order id -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 -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 +| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | +| -------- | ---- | ------ | ----- | ---- | ---- | +| order-id | true | string | 订单ID,填在path中 | | | + +### 响应数据 -## Show the Match Result of an Order +| 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +| ----------------- | ----- | ------ | ------- | ---- | +| account-id | true | long | 账户 ID | | +| amount | true | string | 订单数量 | | +| canceled-at | false | long | 订单撤销时间 | | +| created-at | true | long | 订单创建时间 | | +| field-amount | true | string | 已成交数量 | | +| field-cash-amount | true | string | 已成交总金额 | | +| field-fees | true | string | 已成交手续费(买入为币,卖出为钱) | | +| finished-at | false | long | 订单变为终结态的时间,不是成交时间,包含“已撤单”状态 | | +| id | true | long | 订单ID | | +| price | true | string | 订单价格 | | +| source | true | string | 订单来源 | api | +| state | true | string | 订单状态 | submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | +| symbol | true | string | 交易对 | btcusdt, bchbtc, rcneth ... | +| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | + +## 某个订单的成交明细 This endpoint returns the match result of an order. ### HTTP Request -`GET /v1/order/orders/{order-id}/matchresult` +`GET /v1/order/orders/{order-id}/matchresults` ```shell -curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" +curl "https://api.huobi.pro/v1/order/orders/59378/matchresults" ``` > 以上命令返回的 JSON 结果: @@ -887,22 +894,28 @@ curl "https://api.huobi.pro/v1/order/orders/59378/matchresult" } ``` +### 请求参数 + +| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | +| -------- | ---- | ------ | ----- | ---- | ---- | +| order-id | true | string | 订单ID,填在path中 | | | + ### 响应数据 -参数 | 数据类型 | 描述 ---------- | --------- | ----------- -id | integer | Internal id -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 -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 +| 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +| ------------- | ---- | ------ | -------- | -------- | +| created-at | true | long | 成交时间 | | +| filled-amount | true | string | 成交数量 | | +| filled-fees | true | string | 成交手续费 | | +| id | true | long | 订单成交记录ID | | +| match-id | true | long | 撮合ID | | +| order-id | true | long | 订单 ID | | +| price | true | string | 成交价格 | | +| source | true | string | 订单来源 | api | +| symbol | true | string | 交易对 | btcusdt, bchbtc, rcneth ... | +| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | ## Search Past Orders @@ -954,38 +967,35 @@ BODY { ### 请求参数 -参数 | 数据类型 | 是否必须 | 默认值 | 描述 ---------- | --------- | -------- | ------- | ----------- -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 | 订单状态 -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 +| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | +| ---------- | ----- | ------ | ------ | ---- | ---- | +| symbol | true | string | 交易对 | |btcusdt, bchbtc, rcneth ... | +| types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | | | +| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | | | +| states | true | string | 查询的订单状态组合,使用','分割 | | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | +| from | false | string | 查询起始 ID | | | +| direct | false | string | 查询方向 | | prev 向前,next 向后 | +| size | false | string | 查询记录大小 | | | ### 响应数据 -参数 | 数据类型 | 描述 ---------- | --------- | ----------- -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 -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 +| 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +| ----------------- | ----- | ------ | ----------------- | ---- | +| account-id | true | long | 账户 ID | | +| amount | true | string | 订单数量 | | +| canceled-at | false | long | 接到撤单申请的时间 | | +| created-at | true | long | 订单创建时间 | | +| field-amount | true | string | 已成交数量 | | +| field-cash-amount | true | string | 已成交总金额 | | +| field-fees | true | string | 已成交手续费(买入为币,卖出为钱) | | +| finished-at | false | long | 最后成交时间 | | +| id | true | long | 订单ID | | +| price | true | string | 订单价格 | | +| source | true | string | 订单来源 | api | +| state | true | string | 订单状态 | submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | +| symbol | true | string | 交易对 | btcusdt, bchbtc, rcneth ... | +| type | true | string | 订单类型 | submit-cancel:已提交撤单申请 ,buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | ## Search the Match Results @@ -1022,33 +1032,32 @@ curl "https://api.huobi.pro/v1/order/matchresults" ### 请求参数 -参数 | 数据类型 | 是否必须 | 默认值 | 描述 ---------- | --------- | -------- | ------- | ----------- -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 | 订单状态 -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 +| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | +| ---------- | ----- | ------ | ------ | ---- | ----------- | +| symbol | true | string | 交易对 | btcusdt, bchbtc, rcneth ... | | +| types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | -61 days | [-61day, now] | +| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | Now | [start-date, now] | +| from | false | string | 查询起始 ID | 订单成交记录ID(最大值) | | +| direct | false | string | 查询方向 | 默认next, 成交记录ID由大到小排序 | prev 向前,next 向后 | +| size | false | string | 查询记录大小 | 100 | <=100 | ### 响应数据 -参数 | 数据类型 | 描述 ---------- | --------- | ----------- -id | integer | Internal id -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 -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 +| 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +| ------------- | ---- | ------ | -------- | ------- | +| created-at | true | long | 成交时间 | | +| filled-amount | true | string | 成交数量 | | +| filled-fees | true | string | 成交手续费 | | +| id | true | long | 订单成交记录ID | | +| match-id | true | long | 撮合ID | | +| order-id | true | long | 订单 ID | | +| price | true | string | 成交价格 | | +| source | true | string | 订单来源 | api | +| symbol | true | string | 交易对 | btcusdt, bchbtc, rcneth ... | +| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | # 杠杆交易 @@ -1064,7 +1073,7 @@ source | string | The source where the order was triggered, poss ### HTTP Request -`POST https://api.huobi.pro/v1/dw/transfer-in` +`POST /v1/dw/transfer-in` ```shell curl "https://api.huobi.pro/v1/dw/transfer-in" @@ -1086,7 +1095,7 @@ BODY ### 请求参数 -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | 交易对, e.g. btcusdt, bchbtc currency | string | true | NA | 币种 @@ -1094,9 +1103,9 @@ amount | string | true | NA | 划转数量 ### 响应数据 - -参数 | 数据类型 | 描述 + +参数名称 | 数据类型 | 描述 --------- | --------- | ----------- data | integer | Transfer id @@ -1128,7 +1137,7 @@ BODY ### 请求参数 -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc currency | string | true | NA | 币种 @@ -1136,9 +1145,8 @@ amount | string | true | NA | 划转数量 ### 响应数据 - -参数 | 数据类型 | 描述 +参数名称 | 数据类型 | 描述 --------- | --------- | ----------- data | integer | Transfer id @@ -1148,7 +1156,7 @@ data | integer | Transfer id ### HTTP Request -`POST https://api.huobi.pro/v1/margin/orders` +`POST /v1/margin/orders` ```shell curl "https://api.huobi.pro/v1/margin/orders" @@ -1170,7 +1178,7 @@ BODY ### 请求参数 -参数 | 数据类型 | 是否必须 | 默认值 | 描述 +参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc currency | string | true | NA | 币种 @@ -1178,9 +1186,9 @@ amount | string | true | NA | 借贷数量 ### 响应数据 - -参数 | 数据类型 | 描述 + +参数名称 | 数据类型 | 描述 --------- | --------- | ----------- data | integer | Margin order id @@ -1190,7 +1198,7 @@ data | integer | Margin order id ### HTTP Request -`POST https://api.huobi.pro/v1/margin/orders/{order-id}/repay` +`POST /v1/margin/orders/{order-id}/repay` ```shell curl "https://api.huobi.pro/v1/margin/orders/1000/repay" @@ -1210,17 +1218,18 @@ BODY ### 请求参数 -参数 | 数据类型 | 是否必须 | 默认值 | 描述 ---------- | --------- | -------- | ------- | ----------- -amount | string | true | NA | 归还币种 +参数名称 | 数据类型 | 是否必需 | 描述 +--------- | --------- | -------- | ----------- +order-id | string | true | 借贷订单 ID,写在 path 中 +amount | string | true | 归还币种 ### 响应数据 - -参数 | 数据类型 | 描述 ---------- | --------- | ----------- -data | integer | Margin order id + +参数名称 | 数据类型 | 描述 +------- | ------- | ----------- +data | integer | Margin order id ## 查询借贷订单 @@ -1228,7 +1237,7 @@ This endpoint returns margin orders based on a specific searching criteria. ### HTTP Request -`POST https://api.huobi.pro/v1/margin/loan-orders` +`POST /v1/margin/loan-orders` ```shell curl "https://api.huobi.pro/v1/margin/load-orders" @@ -1268,34 +1277,33 @@ BODY { ### 请求参数 -参数 | 数据类型 | 是否必须 | 默认值 | 描述 ---------- | --------- | -------- | ------- | ----------- -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 -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 +| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | +| ----- | ----- | ------ | ------- | ---- | ---- | +| symbol | true | string | 交易对 | | | +| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | | | +| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | | | +| states | false | string | 状态 | | | +| from | false | string | 查询起始 ID | | | +| direct | false | string | 查询方向 | | prev 向前,next 向后 | +| size | false | string | 查询记录大小 | | | ### 响应数据 -参数 | 数据类型 | 描述 ---------- | --------- | ----------- -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 +| 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +|-----|-----|-----|-----|------| +| id | true | long | 订单号 | | +| user-id | true | long | 用户ID | | +| account-id | true | long | 账户ID | | +| symbol | true | string | 交易对 | | +| currency | true | string | 币种 | | +| loan-amount | true |string | 借贷本金总额 | | +| loan-balance | true | string | 未还本金 | | +| interest-rate | true | string | 利率 | | +| interest-amount | true | string | 利息总额 | | +| interest-balance | true | string | 未还利息 | | +| created-at | true | long | 借贷发起时间 | | +| accrued-at | true | long | 最近一次计息时间 | | +| state | true | string | 订单状态 |created 未放款,accrual 已放款,cleared 已还清,invalid 异常| ## 借贷账户详情 @@ -1321,67 +1329,67 @@ BODY { ```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": 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" + } + ] + } + ] } ``` ### 请求参数 -参数 | 数据类型 | 是否必须 | 默认值 | 描述 ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc +| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | +|-----|-----|-----|-----|-----|-----| +| symbol | false | string | 交易对,作为get参数 | | | ### 响应数据 -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 +| 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +|-----|-----|-----|-----|------| +| symbol | true | string | 交易对 | | +| state | true | string | 账户状态 | working,fl-sys,fl-mgt,fl-end | +| risk-rate | true | object | 风险率 | | +| fl-price | true | string | 爆仓价 | | +| list | true | array | 子账户列表 | | # 钱包(充值与提现) From 959420a9ad8b3fc9f743bbd69d27a40c536887b3 Mon Sep 17 00:00:00 2001 From: rayxy Date: Fri, 4 Jan 2019 01:30:17 +0800 Subject: [PATCH 013/864] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=80=9A=E7=94=A8?= =?UTF-8?q?=E5=92=8C=E5=9F=BA=E7=A1=80=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 104 ++++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 50 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 5f07ff8f1bc..2561e8cb85c 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -25,15 +25,15 @@ search: true ## 请求格式 -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. +所有的API请求都以GET或者POST形式发出。对于GET请求,所有的参数都在路径参数里;对于POST请求,所有参数则以JSON格式发送在请求主体(body)里。 ## 返回格式 -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. +所有的接口返回都是JSON格式。在JSON最上层有几个表示请求状态和属性的字段:"status", "ch", 和 "ts". 实际的接口返回内容在"data"字段里. -### Response Wrapper Content +### 返回内容格式 -> Response wrapper content example: +> 返回内容将会是以下格式: ```json { @@ -44,34 +44,36 @@ All response will be returned in JSON format. The top level JSON is a wrapper ob } ``` -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 +status | string | API接口返回状态 +ch | string | 接口数据对应的数据流。部分接口没有对应数据流因此不返回此字段 +ts | int | 接口返回的时间戳 +data | object | 接口返回数据主体 ## 限频规则 -Each apikey can send maximum of 100 https requests within 10 seconds. Please contact customer support if you believe you need higher limit rate. +每个API key可以发送至多每10秒100个请求。如需提高API访问限制请联系客服。 ## 签名认证 -Some API endpoints require authentication. To be authenticated, you should first acquire an API key and the corresponding secret key. +部分接口需要通过签名验证以确保数据私有性。 在进行接口签名验证之前,你需要先获得API key和其对应的密钥。 -In order to successfully sign a request, you need to follow below steps +为了完成签名认证,你需要遵循以下步骤 + +1. 为你的接口请求生成一个“请求字符串” -1. Generate the "Query String" for your query +2. 用上一步里生成的“请求字符串”和你的密钥生成一个数字签名 -2. Use "Query String" and your secret key to to created a signature +3. 将生成的数字签名加入到请求的路径参数里 -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 @@ -109,17 +111,19 @@ AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx&SignatureMethod=HmacSHA256&Signatur 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 +请求字符串一开始为空,通过三个步骤陆续增加内容。 + +1. 将接口路径加入请求字符串 -2. Add mandatory authentication parameters to the query string +2. 加入必须的认证参数到请求字符串 -3. Add other path parameters to the query string ordered by parameter name (asc) +3. 加入可选的认证参数到请求字符串。可选参数的添加顺序必须符合参数名的字母排序。 -### Use "Query String" and your secret key to to created a signature +### 用上一步里生成的“请求字符串”和你的密钥生成一个数字签名 > The result signature will look like @@ -127,11 +131,11 @@ The timestamp should be in YYYY-MM-DDThh:mm:ss format with URL encoding. 4F65x5A2bLyMWVQj3Aqp+B4w+ivaA7n5Oi2SuYtCJ9o= ``` -1. Apply HmacSHA256 hash function with inputs (query string, secret key) to get the hashed string +1. 将上一步得到的请求字符串和API私钥作为两个参数,调用HmacSHA256哈希函数来获得哈希值。 -2. Encode the hashed string with base-64 +2. 将此哈希值用base-64编码,得到的值作为此次接口调用的数字签名。 -### Add the signature as a path parameter to your query +### 将生成的数字签名加入到请求的路径参数里 > The final request with signature will look like @@ -140,17 +144,17 @@ https://api.huobi.pro/v1/order/orders?AccessKeyId=e2xxxxxx-99xxxxxx-84xxxxxx-7xx ``` -1. Add all mandatory authentication parameters to your path parameter +1. 把所有必须的认证参数添加到接口调用的路径参数里 -2. Add "&Signature=[Your request signature with URL encode]" to your path parameter +2. 把数字签名在URL编码后加入到路径参数里,参数名为“Signature”。 # 基础接口 ## 返回所有支持的交易对 -This endpoint retrieves all trading pairs supported in Huobi. +此接口返回所有火币支持的交易对。 -### HTTP Request +### HTTP请求 `GET https://api.huobi.pro/v1/common/symbols` @@ -158,7 +162,7 @@ This endpoint retrieves all trading pairs supported in Huobi. curl "https://api.huobi.prov1/common/symbols" ``` -> The above command returns JSON structured like this: +> The above command returns JSON structure like this: ```json "data": [ @@ -181,25 +185,25 @@ curl "https://api.huobi.prov1/common/symbols" ] ``` -### 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] +base-currency | string | 交易对中的基础币种 +quote-currency | string | 交易对中的报价币种 +price-precision | integer | 交易对报价的精度(小数点后位数) +amount-precision| integer | 交易对基础币种计数精度(小数点后位数) +symbol-partition| string | 交易区,可能值: [main,innovation,bifurcation] ## 返回所有支持的币种 -This endpoint retrieves all trading currencies supported in Huobi. +此接口返回所有火币支持的币种。 -### HTTP Request +### HTTP请求 `GET https://api.huobi.pro/v1/common/currencys` @@ -217,19 +221,19 @@ curl "https://api.huobi.prov1/common/currencys" ] ``` -### Request Parameters +### 请求参数 - +此接口不接受任何参数。 -### Response Content +### 返回字段 - + ## 返回当前系统时间 -This endpoint retrieves the system time of Huobi in epoch milliseconds. +此接口返回当前的系统时间,时间是以毫秒为单位的UNIX时间戳。 -### HTTP Request +### HTTP请求 `GET https://api.huobi.pro/v1/common/timestamp` @@ -243,13 +247,13 @@ curl "https://api.huobi.prov1/common/timestamp" "data": 1494900087029 ``` -### Request Parameters +### 请求参数 - +此接口不接受任何参数。 ### Response Content - +返回的“data”对象是一个整数表示返回的时间戳。 # 行情数据 From 471ddafea23169fe8a637ffecbc41a1d65a79cd8 Mon Sep 17 00:00:00 2001 From: rayxy Date: Fri, 4 Jan 2019 16:09:45 +0800 Subject: [PATCH 014/864] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A1=8C=E6=83=85?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 230 +++++++++++++++++++++++-------------------- 1 file changed, 121 insertions(+), 109 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 2561e8cb85c..801f0a3db0e 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -259,9 +259,9 @@ curl "https://api.huobi.prov1/common/timestamp" ## K 线数据(蜡烛图) -This endpoint retrieves all klines in a specific range. +此接口返回历史K线数据。 -### HTTP Request +### HTTP请求 `GET https://api.huobi.pro/market/history/kline` @@ -288,29 +288,30 @@ curl "https://api.huobi.pro/market/kline?period=1day&size=200&symbol=btcusdt" ### 请求参数 -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] ### 响应数据 -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 +id | integer | 以UNIX秒为单位的时间戳,并以此作为此K线柱的id +amount | float | 以基础币种计量的交易量 +count | integer | 交易次数 +open | float | 本阶段开盘价 +close | float | 本阶段收盘价 +low | float | 本阶段最低价 +high | float | 本阶段最高价 +vol | float | 以报价币种计量的交易量 -## 最新的聚合 Ticker +## 24小时聚合 Ticker -This endpoint retrieves the latest ticker with some important 24h aggregated market data. +此接口获取ticker信息同时提供最近24小时的交易聚合信息。 -### HTTP Request +### HTTP请求 `GET https://api.huobi.pro/market/detail/merged` @@ -338,32 +339,32 @@ curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" ### 请求参数 -Parameter | 数据类型 | 是否必须 | 默认值 | 描述 +参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc +symbol | string | true | NA | 交易对, 例如 btcusdt, bccbtc ### 响应数据 -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] +id | integer | 以UNIX秒为单位的时间戳,并以此作为此ticker的id +amount | float | 以基础币种计量的交易量 +count | integer | 交易次数 +open | float | 本阶段开盘价 +close | float | 本阶段收盘价 +low | float | 本阶段最低价 +high | float | 本阶段最高价 +vol | float | 以报价币种计量的交易量 +bid | object | 当前的最高卖价 [price, quote volume] +ask | object | 当前的最低买价 [price, quote volume] ## 所有交易对的最新 Tickers -This endpoint retrieves the latest tickers for all supported pairs. +此交易对获得所有交易对的tickers。 - + -### HTTP Request +### HTTP请求 `GET https://api.huobi.pro/market/tickers` @@ -400,28 +401,28 @@ curl "https://api.huobi.pro/market/tickers" ### 请求参数 -This endpoint does not require parameters. +此接口不接受任何参数。 ### 响应数据 -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 +amount | float | 以基础币种计量的交易量 +count | integer | 交易次数 +open | float | 本阶段开盘价 +close | float | 本阶段收盘价 +low | float | 本阶段最低价 +high | float | 本阶段最高价 +vol | float | 以报价币种计量的交易量 +symbol | string | 交易对,例如btcusdt, bccbtc ## 市场深度数据 -This endpoint retrieves the current order book of a specific pair. +此接口返回指定交易对的当前市场深度数据。 -### HTTP Request +### HTTP请求 `GET https://api.huobi.pro/market/depth` @@ -484,27 +485,38 @@ curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" ### 请求参数 -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 +参数 | 数据类型 | 必须 | 描述 +--------- | --------- | -------- | ------------- +symbol | string | true | 交易对,例如btcusdt, bccbtc +type | string | true | 深度的精细度,具体说明见下方 + +**参数type的各值说明(需补充)** + +取值 | 说明 +--------- | --------- +step0 | +step1 | +step2 | +step3 | +step4 | +step5 | ### 响应数据 - + -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] +ts | integer | UNIX毫秒时间戳 +version | integer | 内部字段 +bids | object | 当前的所有买单 [price, quote volume] +asks | object | 当前的所有卖单 [price, quote volume] -## Get the Last Trade +## 获取最新交易结果 -This endpoint retrieves the latest trade with its price, volume, and direction. +此接口返回指定交易对最新的一个交易记录。 -### HTTP Request +### HTTP请求 `GET https://api.huobi.pro/market/trade` @@ -532,27 +544,27 @@ curl "https://api.huobi.pro/market/trade?symbol=ethusdt" ### 请求参数 -Parameter | 数据类型 | 是否必须 | 默认值 | 描述 +参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc +symbol | string | true | NA | 交易对,例如btcusdt, bccbtc ### 响应数据 - + -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' +id | integer | 唯一交易id +amount | float | 以基础币种为单位的交易量 +price | float | 以报价币种为单位的成交价格 +ts | integer | UNIX毫秒时间戳 +direction | string | 交易方向:“买”或“卖” -## Get the Most Recent Trades +## 获得近期交易记录 -This endpoint retrieves the most recent trades with their price, volume, and direction. +此接口返回指定交易对近期的所有交易记录。 -### HTTP Request +### HTTP请求 `GET https://api.huobi.pro/market/history/trade` @@ -602,28 +614,28 @@ curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" ### 请求参数 -Parameter | 数据类型 | 是否必须 | 默认值 | 描述 +参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | The trading pair to query, e.g. btcusdt, bccbtc -size | integer | false | 1 | The number of data returns +symbol | string | true | NA | 交易对,例如 btcusdt, bccbtc +size | integer | false | 1 | 返回的交易记录数量,最大值2000 ### 响应数据 - + + ## 签名认证 ### 签名说明 @@ -226,6 +199,68 @@ api.huobi.pro\n 2. 把数字签名在URL编码后加入到路径参数里,参数名为“Signature”。 +## 请求格式 + +所有的API请求都以GET或者POST形式发出。对于GET请求,所有的参数都在路径参数里;对于POST请求,所有参数则以JSON格式发送在请求主体(body)里。 + +## 返回格式 + +所有的接口返回都是JSON格式。在JSON最上层有几个表示请求状态和属性的字段:"status", "ch", 和 "ts". 实际的接口返回内容在"data"字段里. + +### 返回内容格式 + +> 返回内容将会是以下格式: + +```json +{ + "status": "ok", + "ch": "market.btcusdt.kline.1day", + "ts": 1499223904680, + "data": // per API response data in nested JSON object +} +``` + +参数名称| 数据类型 | 描述 +--------- | --------- | ----------- +status | string | API接口返回状态 +ch | string | 接口数据对应的数据流。部分接口没有对应数据流因此不返回此字段 +ts | int | 接口返回的调整为北京时间的时间戳,单位毫秒 +data | object | 接口返回数据主体 + +## 错误信息 + +### 行情 API 错误信息 + +| 错误码 | 描述 | +|-----|-----| +| bad-request | 错误请求 | +| invalid-parameter | 参数错误 | +| invalid-command | 指令错误 | +code 的具体解释, 参考对应的 `err-msg`. + +### 交易 API 错误信息 + +| 错误码 | 描述 | +|-----|-----| +| base-symbol-error | 交易对不存在 | +| base-currency-error | 币种不存在 | +| base-date-error | 错误的日期格式 | +| account-frozen-balance-insufficient-error | 余额不足 | +| account-transfer-balance-insufficient-error | 余额不足无法冻结 | +| bad-argument | 无效参数 | +| api-signature-not-valid | API签名错误 | +| gateway-internal-error | 系统繁忙,请稍后再试| +| ad-ethereum-addresss| 请输入有效的以太坊地址| +| order-accountbalance-error| 账户余额不足| +| order-limitorder-price-error|限价单下单价格超出限制 | +|order-limitorder-amount-error|限价单下单数量超出限制 | +|order-orderprice-precision-error|下单价格超出精度限制 | +|order-orderamount-precision-error|下单数量超过精度限制| +|order-marketorder-amount-error|下单数量超出限制| +|order-queryorder-invalid|查询不到此条订单| +|order-orderstate-error|订单状态错误| +|order-datelimit-error|查询超出时间限制| +|order-update-error|订单更新出错| ## 代码示例 From a9610b7ede05d1da1faba1964443fd1b254f1d8b Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 18 Jan 2019 10:06:33 +0800 Subject: [PATCH 035/864] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 131 ++++++++++++++++++++++++++++--------------- 1 file changed, 85 insertions(+), 46 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 5bc52da0c8a..0fb11c73875 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -72,7 +72,7 @@ API 请求在通过 Internet 传输的过程中极有可能被篡改,为了确 - 签名版本(SignatureVersion):签名协议的版本,此处使用2。 -- 时间戳(Timestamp):您发出请求的时间 (UTC 时区) (UTC 时区) (UTC 时区) 。在查询请求中包含此值有助于防止第三方截取您的请求。如:2017-05-11T16:22:06。再次强调是 (UTC 时区) 。 +- 时间戳(Timestamp):您发出请求的时间 (UTC 时区) (UTC 时区) (UTC 时区) 。如:2017-05-11T16:22:06。在查询请求中包含此值有助于防止第三方截取您的请求。 - 必选和可选参数:每个方法都有一组用于定义 API 调用的必需参数和可选参数。可以在每个方法的说明中查看这些参数及其含义。 请一定注意:对于 GET 请求,每个方法自带的参数都需要进行签名运算; 对于 POST 请求,每个方法自带的参数不进行签名认证,即 POST 请求中需要进行签名运算的只有 AccessKeyId、SignatureMethod、SignatureVersion、Timestamp 四个参数,其它参数放在 body 中。 @@ -90,10 +90,13 @@ API Key 包括以下两部分 - `Secret Key` 签名认证加密所使用的密钥(仅申请时可见) + @@ -146,10 +149,10 @@ api.huobi.pro\n `Timestamp=2017-05-11T15%3A19%3A30` @@ -245,6 +248,7 @@ code 的具体解释, 参考对应的 `err-msg`. | base-symbol-error | 交易对不存在 | | base-currency-error | 币种不存在 | | base-date-error | 错误的日期格式 | +| account for id `12,345` and user id `6,543,210` does not exist| `account-id` 错误,请使用GET `/v1/account/accounts` 接口查询 | | account-frozen-balance-insufficient-error | 余额不足 | | account-transfer-balance-insufficient-error | 余额不足无法冻结 | | bad-argument | 无效参数 | @@ -298,6 +302,37 @@ code 的具体解释, 参考对应的 `err-msg`. [易语言](https://github.com/huobiapi/REST-YiYuyan-demo) +## 常见问题 Q & A + +### 经常断线或者丢数据 + +* 请确认是否使用 api.huobi.pro 域名访问火币 API +* 请使用日本云服务器 + +### 签名失败 + +* 检查 API Key 是否有效,是否复制正确,是否有绑定 IP 白名单 +* 检查时间戳是否是 UTC 时间 +* 检查参数是否按字母排序 +* 检查编码 +* 检查签名是否有 base64 编码 +* 检查 GET 是否以表单方式提交 +* 检查 POST 的 url 是否带着签名字段,POST 的数据格式是否是 json 格式 +* 检查签名结果是否有进行 URI 编码 + +### 返回 login-required + +* 检查参数 `account-id` 是否是由 GET `/v1/account/accounts` 接口返回的,而不是填的 uid +* 检查是否 POST 请求是否把业务参数也计算进签名 +* 检查 GET 请求是否将参数按照 ASCII 码表顺序排序 + +### 返回 gateway-internal-error + +* 检查 POST 请求是否在 header 中声明 Content-Type:application/json + + + + # 基础信息 ## 返回所有支持的交易对 @@ -382,7 +417,7 @@ curl "https://api.huobi.pro/v1/common/currencys" ### 返回字段 - + ## 返回当前系统时间 @@ -429,11 +464,11 @@ curl "https://api.huobi.pro/market/history/kline?period=1day&size=200&symbol=btc 参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对, e.g. btcusdt, bchbtc +symbol | string | true | NA | 交易对, e.g. btcusdt, ethbtc 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: @@ -483,7 +518,7 @@ curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" 参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对, 例如 btcusdt, bccbtc +symbol | string | true | NA | 交易对, 例如 btcusdt, ethbtc > Response: @@ -522,7 +557,7 @@ ask | object | 当前的最低买价 [price, quote volume] ## 所有交易对的最新 Tickers -获得所有交易对的 tickers。 +获得所有交易对的 tickers,数据取值区间为24小时滚动。 @@ -545,10 +580,10 @@ curl "https://api.huobi.pro/market/tickers" ```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 + "open":0.044297, // 开盘价 + "close":0.042178, // 收盘价 + "low":0.040110, // 最高价 + "high":0.045255, // 最低价 "amount":12880.8510, "count":12838, "vol":563.0388715740, @@ -574,13 +609,13 @@ curl "https://api.huobi.pro/market/tickers" 字段名称 | 数据类型 | 描述 --------- | --------- | ----------- amount | float | 以基础币种计量的交易量 -count | integer | 交易次数 -open | float | 本阶段开盘价 -close | float | 本阶段最新价 -low | float | 本阶段最低价 -high | float | 本阶段最高价 +count | integer | 交易笔数 +open | float | 开盘价 +close | float | 最新价 +low | float | 最低价 +high | float | 最高价 vol | float | 以报价币种计量的交易量 -symbol | string | 交易对,例如btcusdt, bccbtc +symbol | string | 交易对,例如btcusdt, ethbtc ## 市场深度数据 @@ -598,11 +633,11 @@ curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step1" 参数 | 数据类型 | 必须 | 默认值 | 描述 --------- | --------- | -------- | ------| ------- -symbol | string | true | NA | 交易对,例如btcusdt, bccbtc +symbol | string | true | NA | 交易对,例如btcusdt, ethbtc depth | integer | false | 20 | 返回深度的数量,可取值5,10,20 type | string | true | step0 | 深度的价格聚合度,具体说明见下方 - + **参数type的各值说明(需补充)** @@ -667,7 +702,7 @@ curl "https://api.huobi.pro/market/trade?symbol=ethusdt" 参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对,例如btcusdt, bchbtc +symbol | string | true | NA | 交易对,例如btcusdt, ethbtc > Response: @@ -715,7 +750,7 @@ curl "https://api.huobi.pro/market/history/trade?symbol=ethusdt&size=2" 参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对,例如 btcusdt, bccbtc +symbol | string | true | NA | 交易对,例如 btcusdt, ethbtc size | integer | false | 1 | 返回的交易记录数量,最大值2000 > Response: @@ -760,7 +795,7 @@ size | integer | false | 1 | 返回的交易记录数量,最 ### 响应数据 - + 参数 | 数据类型 | 描述 --------- | --------- | ----------- @@ -786,7 +821,7 @@ curl "https://api.huobi.pro/market/detail?symbol=ethusdt" 参数 | 数据类型 | 是否必须 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对,例如btcusdt, bchbtc +symbol | string | true | NA | 交易对,例如btcusdt, ethbtc > Response: @@ -822,6 +857,8 @@ version | integer | 内部数据 # 账户相关 + + ## 账户信息 查询当前用户的所有账户(account-id)及其相关信息 @@ -1031,7 +1068,7 @@ balance| 是| String| -| 子账户下该币种所有余额(可用余额和冻 参数|是否必填 | 数据类型 | 长度 | 说明 | 取值范围 | -----------|------------|-----------|------------|----------|--| -sub-uid|True| Long| -| 子用户的UID|-| +sub-uid|True| Long| -| 子用户的 UID|-| > Response: @@ -1084,6 +1121,8 @@ balance|-|Decimal|- |账户余额 |-| # 钱包(充值与提现) + + ## 虚拟币提现 @@ -1247,9 +1286,9 @@ balance|-|Decimal|- |账户余额 |-| # 现货 / 杠杆交易 - + - + ## 下单 @@ -1274,8 +1313,8 @@ balance|-|Decimal|- |账户余额 |-| 参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -account-id | string | true | NA | 账户 ID,使用accounts方法获得。现货交易使用‘spot’账户的 account-id;杠杆交易,请使用 ‘margin’ 账户的 account-id -symbol | string | true | NA | 交易对, 例如btcusdt, bccbtc +account-id | string | true | NA | 账户 ID,使用 GET /v1/account/accounts 接口查询。现货交易使用 ‘spot’ 账户的 account-id;杠杆交易,请使用 ‘margin’ 账户的 account-id +symbol | string | true | NA | 交易对, 例如btcusdt, ethbtc type | string | true | NA | 订单类型,包括buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker(说明见下文) amount | string | true | NA | 订单交易量 price | string | false | NA | limit order的交易价格 @@ -1309,7 +1348,7 @@ source | string | false | api | 现货交易填写“api”,杠 此接口发送一个撤销订单的请求。 - + ### HTTP 请求 @@ -1363,7 +1402,7 @@ source | string | false | api | 现货交易填写“api”,杠 参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- account-id | string | false | NA | 账户 ID,使用 GET /v1/account/accounts 接口获得。现货交易使用‘spot’账户的 account-id;杠杆交易,请使用 ‘margin’ 账户的 account-id -symbol | string | false | NA | 交易对, 例如btcusdt, bccbtc +symbol | string | false | NA | 交易对, 例如btcusdt, ethbtc side | string | false | both | 指定只返回某一个方向的订单,可能的值有: buy, sell. 默认两个方向都返回。 size | int | false | 10 | 返回订单的数量,最大值2000。 @@ -1395,7 +1434,7 @@ size | int | false | 10 | 返回订单的数量,最大值2 字段名称 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | 订单id -symbol | string | 交易对, 例如btcusdt, bccbtc +symbol | string | 交易对, 例如btcusdt, ethbtc price | string | limit order的交易价格 created-at | int | 订单创建的调整为北京时间的时间戳,单位毫秒 type | string | 订单类型 @@ -1409,7 +1448,7 @@ state | string | 订单状态,包括submitted, partical-fille 此接口发送批量撤销订单的请求。 - + ### HTTP 请求 @@ -1556,7 +1595,7 @@ state | string | 订单状态,包括submitted, partical-fille | price | true | string | 订单价格 | | | source | true | string | 订单来源 | api | | state | true | string | 订单状态 | submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | -| symbol | true | string | 交易对 | btcusdt, bchbtc, rcneth ... | +| symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | ## 成交明细 @@ -1612,7 +1651,7 @@ state | string | 订单状态,包括submitted, partical-fille | order-id | true | long | 订单 ID | | | price | true | string | 成交价格 | | | source | true | string | 订单来源 | api | -| symbol | true | string | 交易对 | btcusdt, bchbtc, rcneth ... | +| symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | ## 搜索历史订单 @@ -1639,7 +1678,7 @@ state | string | 订单状态,包括submitted, partical-fille | 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | | ---------- | ----- | ------ | ------ | ---- | ---- | -| symbol | true | string | 交易对 | |btcusdt, bchbtc, rcneth ... | +| symbol | true | string | 交易对 | |btcusdt, ethbtc, rcneth ... | | types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | | start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | | | | end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | | | @@ -1694,7 +1733,7 @@ state | string | 订单状态,包括submitted, partical-fille | price | true | string | 订单价格 | | | source | true | string | 订单来源 | api | | state | true | string | 订单状态 | submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | -| symbol | true | string | 交易对 | btcusdt, bchbtc, rcneth ... | +| symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | submit-cancel:已提交撤单申请 ,buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | ## 当前和历史成交 @@ -1710,7 +1749,7 @@ state | string | 订单状态,包括submitted, partical-fille | 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | | ---------- | ----- | ------ | ------ | ---- | ----------- | -| symbol | true | string | 交易对 | btcusdt, bchbtc, rcneth ... | | +| symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | | types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | | start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | -61 days | [-61day, now] | | end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | Now | [start-date, now] | @@ -1743,7 +1782,7 @@ state | string | 订单状态,包括submitted, partical-fille ### 响应数据 - + | 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | | ------------- | ---- | ------ | -------- | ------- | @@ -1755,14 +1794,14 @@ state | string | 订单状态,包括submitted, partical-fille | order-id | true | long | 订单 ID | | | price | true | string | 成交价格 | | | source | true | string | 订单来源 | api | -| symbol | true | string | 交易对 | btcusdt, bchbtc, rcneth ... | +| symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | # 借贷 - + - + ## 资产划转 @@ -1789,7 +1828,7 @@ state | string | 订单状态,包括submitted, partical-fille 参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对, e.g. btcusdt, bchbtc +symbol | string | true | NA | 交易对, e.g. btcusdt, ethbtc currency | string | true | NA | 币种 amount | string | true | NA | 划转数量 @@ -1831,7 +1870,7 @@ data | integer | Transfer id 参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对, e.g. btcusdt, bccbtc +symbol | string | true | NA | 交易对, e.g. btcusdt, ethbtc currency | string | true | NA | 币种 amount | string | true | NA | 借贷数量 From 8133a4e719aedc3ca52a27cec970e76579e3b39a Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 18 Jan 2019 23:22:30 +0800 Subject: [PATCH 036/864] 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 0fb11c73875..98b019339f3 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -20,7 +20,7 @@ search: False 你可以通过选择上方下拉菜单的版本号来切换文档对应的API版本。你也可以通过点击右上方的语言按钮来切换文档语言。 # 接入说明 @@ -322,7 +322,7 @@ code 的具体解释, 参考对应的 `err-msg`. ### 返回 login-required -* 检查参数 `account-id` 是否是由 GET `/v1/account/accounts` 接口返回的,而不是填的 uid +* 检查参数 `account-id` 是否是由 GET `/v1/account/accounts` 接口返回的,而不是填的 UID * 检查是否 POST 请求是否把业务参数也计算进签名 * 检查 GET 请求是否将参数按照 ASCII 码表顺序排序 From cab919d477f96968d2efd27c2da3f374c6b279b6 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 21 Jan 2019 17:32:17 +0800 Subject: [PATCH 037/864] =?UTF-8?q?=E5=86=85=E5=AE=B9=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 180 ++++++++++++++++++++++--------------------- 1 file changed, 91 insertions(+), 89 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 98b019339f3..5f6dcb65890 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -60,7 +60,7 @@ search: False ### 签名说明 -API 请求在通过 Internet 传输的过程中极有可能被篡改,为了确保请求未被更改,除公共接口(基础信息,行情数据)外的私有接口均必须使用您的 API Key 做签名认证,以校验参数或参数值在传输途中是否发生了更改。 +API 请求在通过 internet 传输的过程中极有可能被篡改,为了确保请求未被更改,除公共接口(基础信息,行情数据)外的私有接口均必须使用您的 API Key 做签名认证,以校验参数或参数值在传输途中是否发生了更改。 一个合法的请求由以下几部分组成: @@ -462,11 +462,13 @@ curl "https://api.huobi.pro/market/history/kline?period=1day&size=200&symbol=btc ### 请求参数 -参数 | 数据类型 | 是否必须 | 默认值 | 描述 ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对, e.g. btcusdt, ethbtc -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] +参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 +--------- | --------- | -------- | ------- | ------ | ------ +symbol | string | true | NA | 交易对 | btcusdt, ethbtc... +period | string | true | NA | 返回数据时间粒度,也就是每根蜡烛的时间区间 | 1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year +size | integer | false | 150 | 返回 K 线数据条数 | [1, 2000] + + @@ -516,9 +518,9 @@ curl "https://api.huobi.pro/market/detail/merged?symbol=ethusdt" ### 请求参数 -参数 | 数据类型 | 是否必须 | 默认值 | 描述 ---------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对, 例如 btcusdt, ethbtc +参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 +--------- | --------- | -------- | ------- | ------| ----- +symbol | string | true | NA | 交易对 | btcusdt, ethbtc > Response: @@ -543,7 +545,7 @@ symbol | string | true | NA | 交易对, 例如 btcusdt, ethbtc 字段名称 | 数据类型 | 描述 --------- | --------- | ----------- -id | integer | 调整为北京时间的时间戳,单位毫秒,并以此作为此ticker的id +id | integer | 调整为北京时间的时间戳,单位毫秒,并以此作为此 ticker 的 id amount | float | 以基础币种计量的交易量 count | integer | 交易次数 open | float | 本阶段开盘价 @@ -557,7 +559,7 @@ ask | object | 当前的最低买价 [price, quote volume] ## 所有交易对的最新 Tickers -获得所有交易对的 tickers,数据取值区间为24小时滚动。 +获得所有交易对的 tickers,数据取值时间区间为24小时滚动。 @@ -626,20 +628,20 @@ symbol | string | 交易对,例如btcusdt, ethbtc - 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=step2" ``` ### 请求参数 -参数 | 数据类型 | 必须 | 默认值 | 描述 ---------- | --------- | -------- | ------| ------- -symbol | string | true | NA | 交易对,例如btcusdt, ethbtc -depth | integer | false | 20 | 返回深度的数量,可取值5,10,20 -type | string | true | step0 | 深度的价格聚合度,具体说明见下方 +参数 | 数据类型 | 必须 | 默认值 | 描述 | 默认值 +--------- | --------- | -------- | ------| ---- | --- +symbol | string | true | NA | 交易对 | btcusdt, ethbtc +depth | integer | false | 20 | 返回深度的数量 | 5,10,20 +type | string | true | step0 | 深度的价格聚合度,具体说明见下方 | - + -**参数type的各值说明(需补充)** +**参数type的各值说明** 取值 | 说明 --------- | --------- @@ -861,7 +863,7 @@ version | integer | 内部数据 ## 账户信息 -查询当前用户的所有账户(account-id)及其相关信息 +查询当前用户的所有账户 ID `account-id` 及其相关信息 ### HTTP 请求 @@ -913,7 +915,6 @@ version | integer | 内部数据 查询指定账户的余额,支持以下账户: spot:现货账户, margin:杠杆账户,otc:OTC 账户,point:点卡账户 -å ### HTTP 请求 @@ -979,10 +980,10 @@ list字段说明 参数|是否必填 | 数据类型 | 说明 | 取值范围 | -----------|------------|-----------|------------|----------|-- -sub-uid |True| Long|子账户uid |-| -currency|True| String|币种 |-| -amount|True| Decimal|划转金额|-| -type|True|String|划转类型| master-transfer-in(子账户划转给母账户虚拟币)/ master-transfer-out (母账户划转给子账户虚拟币)/master-point-transfer-in (子账户划转给母账户点卡)/master-point-transfer-out(母账户划转给子账户点卡) | +sub-uid |true| long|子账户uid |-| +currency|true| string|币种 |-| +amount|true| decimal|划转金额|-| +type|true|string|划转类型| master-transfer-in(子账户划转给母账户虚拟币)/ master-transfer-out (母账户划转给子账户虚拟币)/master-point-transfer-in (子账户划转给母账户点卡)/master-point-transfer-out(母账户划转给子账户点卡) | > Response: @@ -997,15 +998,15 @@ type|True|String|划转类型| master-transfer-in(子账户划转给母账户 参数|是否必填 | 数据类型 | 长度 | 说明 | 取值范围 | -----------|------------|-----------|------------|----------|--| -data | True| Int | - | 划转订单id| - | -status | True| | - | 状态| "OK" or "Error" | +data | true| int | - | 划转订单id| - | +status | true| | - | 状态| "OK" or "Error" | ### 错误码 error_code| 说明| 类型| ------------------|------------|-----------| -account-transfer-balance-insufficient-error| 账户余额不足| String| -base-operation-forbidden| 禁止操作(母子账号关系错误时报) |String| +account-transfer-balance-insufficient-error| 账户余额不足| string| +base-operation-forbidden| 禁止操作(母子账号关系错误时报) |string| ## 子账户余额(汇总) @@ -1046,15 +1047,15 @@ base-operation-forbidden| 禁止操作(母子账号关系错误时报) |Stri 参数|是否必填 | 数据类型 | 长度 | 说明 | 取值范围 | -----------|------------|-----------|------------|----------|--| -status | True| | - | 状态| "OK" or "Error" | -data | True| list | - | | - | +status | true| | - | 状态| "OK" or "Error" | +data | true| list | - | | - | - data 参数|是否必填 | 数据类型 | 长度 | 说明 | 取值范围 | -----------|------------|-----------|------------|----------|--| -currency| 是| String| -| 子账户币名|-| -balance| 是| String| -| 子账户下该币种所有余额(可用余额和冻结余额的总和)|-| +currency| 是| string| -| 子账户币名|-| +balance| 是| string| -| 子账户下该币种所有余额(可用余额和冻结余额的总和)|-| ## 子账户余额 @@ -1068,7 +1069,7 @@ balance| 是| String| -| 子账户下该币种所有余额(可用余额和冻 参数|是否必填 | 数据类型 | 长度 | 说明 | 取值范围 | -----------|------------|-----------|------------|----------|--| -sub-uid|True| Long| -| 子用户的 UID|-| +sub-uid|true| long| -| 子用户的 UID|-| > Response: @@ -1107,17 +1108,17 @@ sub-uid|True| Long| -| 子用户的 UID|-| 参数|是否必填 | 数据类型 | 长度 | 说明 | 取值范围 | -----------|------------|-----------|------------|----------|--| -id| - |Long| - |子账户ID|-| -type| - |String| - |账户类型| Spot:现货账户,point:点卡账户| -list| - |Object| - |-|-| +id| - |long| - |子账户ID|-| +type| - |string| - |账户类型| Spot:现货账户,point:点卡账户| +list| - |object| - |-|-| - list 参数|是否必填 | 数据类型 | 长度 | 说明 | 取值范围 | -----------|------------|-----------|------------|----------|--| -currency| - |String| - |币种 |-| -type| - |String| - |账户类型 |trade:交易账户,frozen:冻结账户| -balance|-|Decimal|- |账户余额 |-| +currency| - |string| - |币种 |-| +type| - |string| - |账户类型 |trade:交易账户,frozen:冻结账户| +balance|-|decimal|- |账户余额 |-| # 钱包(充值与提现) @@ -1164,7 +1165,7 @@ balance|-|Decimal|- |账户余额 |-| | 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | | ---- | ----- | ---- | ---- | ---- | -| data | false | long | 提现ID | | +| data | false | long | 提现 ID | | ## 取消提现 @@ -1179,7 +1180,7 @@ balance|-|Decimal|- |账户余额 |-| | 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | | ----------- | ---- | ---- | ------------ | ---- | ---- | -| withdraw-id | true | long | 提现ID,填在path中 | | | +| withdraw-id | true | long | 提现 ID,填在 path 中 | | | > Response: @@ -1209,7 +1210,7 @@ balance|-|Decimal|- |账户余额 |-| | 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | | ----------- | ---- | ---- | ------------ | ---- | ---- | | currency | true | string | 币种 | | | -| type | true | string | deposit 或 withdraw | | | +| type | true | string | 充值或提现 | | deposit 或 withdraw | | from | true | string | 查询起始 ID | | | | size | true | string | 查询记录大小 | | | @@ -1244,7 +1245,7 @@ balance|-|Decimal|- |账户余额 |-| | 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | |-----|-----|-----|-----|------| | id | true | long | | | -| type | true | long | 类型 | 'deposit', 'withdraw' | +| type | true | string | 类型 | 'deposit', 'withdraw' | | currency | true | string | 币种 | | | tx-hash | true |string | 交易哈希 | | | amount | true | long | 个数 | | @@ -1557,7 +1558,8 @@ state | string | 订单状态,包括submitted, partical-fille ```json { - "data": { + "data": + { "id": 59378, "symbol": "ethusdt", "account-id": 100009, @@ -1749,13 +1751,13 @@ state | string | 订单状态,包括submitted, partical-fille | 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | | ---------- | ----- | ------ | ------ | ---- | ----------- | -| symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | +| symbol | true | string | 交易对 | NA | btcusdt, ethbtc, rcneth ... | | types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | -| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | -61 days | [-61day, now] | -| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | Now | [start-date, now] | +| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | -61 days | [-61day, today] | +| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | today | [start-date, today] | | from | false | string | 查询起始 ID | 订单成交记录ID(最大值) | | -| direct | false | string | 查询方向 | 默认next, 成交记录ID由大到小排序 | prev 向前,next 向后 | -| size | false | string | 查询记录大小 | 100 | <=100 | +| direct | false | string | 查询方向 | 默认 next, 成交记录 ID 由大到小排序 | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | +| size | false | string | 查询记录大小 | 100 | [1,100] | > Response: @@ -1789,8 +1791,8 @@ state | string | 订单状态,包括submitted, partical-fille | created-at | true | long | 成交时间 | | | filled-amount | true | string | 成交数量 | | | filled-fees | true | string | 成交手续费 | | -| id | true | long | 订单成交记录ID | | -| match-id | true | long | 撮合ID | | +| id | true | long | 订单成交记录 ID | | +| match-id | true | long | 撮合 ID | | | order-id | true | long | 订单 ID | | | price | true | string | 成交价格 | | | source | true | string | 订单来源 | api | @@ -1807,7 +1809,7 @@ state | string | 订单状态,包括submitted, partical-fille 此接口用于现货账户与杠杆账户的资产互转。 -从现货账户划转至杠杆账户(transfer-in),从杠杆账户划转至现货账户(transfer-out) +从现货账户划转至杠杆账户 `transfer-in`,从杠杆账户划转至现货账户 `transfer-out` ### HTTP 请求 @@ -1910,7 +1912,7 @@ data | integer | Margin order id 参数名称 | 数据类型 | 是否必需 | 描述 --------- | --------- | -------- | ----------- -order-id | string | true | 借贷订单 ID,写在 path 中 +order-id | string | true | 借贷订单 ID,写在 url path 中 amount | string | true | 归还币种 @@ -2094,7 +2096,7 @@ data | integer | Margin order id ## 基本信息 -用户可以通过该接口取得关于 ETF 换入换出的 基本信息,包括一次换入最小量,一次换入最大量,一 次换出最小量,一次换出最大量,换入费率,换出费 率,最新 ETF 换入换出状态,以及 ETF 的成分结构。 +用户可以通过该接口取得关于 ETF 换入换出的 基本信息,包括一次换入最小量,一次换入最大量,一 次换出最小量,一次换出最大量,换入费率,换出费率,最新 ETF 换入换出状态,以及 ETF 的成分结构。 ### HTTP 请求 @@ -2105,7 +2107,7 @@ data | integer | Margin order id 参数|是否必填|数据类型|长度|说明|取值范围| -----|-----|-----|------|-------|------| -etf_name| True | String |- | etf基金名称 | hb10| +etf_name| true | string |- | etf基金名称 | hb10| > Response: @@ -2141,21 +2143,21 @@ etf_name| True | String |- | etf基金名称 | hb10| 参数|是否必填 | 数据类型 | 长度 | 说明 | 取值范围 | -----------|------------|-----------|------------|----------|--| -purchase_min_amount | True| Int | - | 最小单次换入数量| | -purchase_max_amount | False| Int | - | 最大单次换入数量 | | -redemption_min_amount | True| Int | - | 最小单次换出数量 | | -redemption_max_amount | False| Int | - | 最大单次换出数量 | | -purchase_fee_rate | True| double | (5,4) | 换入费率 | | -redemption_fee_rate | True| double | (5,4) | 换出费率 | | -etf_status | True| Int | - | 换入换出状态 | 状态: 正常 – 1; 由调仓引起的换入换出暂停 - 2; 其他原因引起的换入换出暂停 -3; 换入暂停 - 4; 换出暂停– 5 | -unit_price | True| Array | - | ETF成分信息,包含成分币代码和对应的数量 | 调仓会引起成分信息发生变化 | +purchase_min_amount | true| int | - | 最小单次换入数量| | +purchase_max_amount | False| int | - | 最大单次换入数量 | | +redemption_min_amount | true| int | - | 最小单次换出数量 | | +redemption_max_amount | False| int | - | 最大单次换出数量 | | +purchase_fee_rate | true| double | (5,4) | 换入费率 | | +redemption_fee_rate | true| double | (5,4) | 换出费率 | | +etf_status | true| int | - | 换入换出状态 | 状态: 正常 – 1; 由调仓引起的换入换出暂停 - 2; 其他原因引起的换入换出暂停 - 3; 换入暂停 - 4; 换出暂停 – 5 | +unit_price | true| Array | - | ETF成分信息,包含成分币代码和对应的数量 | 调仓会引起成分信息发生变化 | - unit_price 参数|是否必填|数据类型|长度|说明| -----|-----|-----|------|-------| -currency| True | String |- | 成分币币种 | -amount| True | Double |- | 成分币数量 | +currency| true | string |- | 成分币币种 | +amount| true | double |- | 成分币数量 | ## 换入换出 @@ -2173,8 +2175,8 @@ amount| True | Double |- | 成分币数量 | 参数|是否必填 | 数据类型 | 长度 | 说明 | 取值范围 | -----------|------------|-----------|------------|----------|--| -etf_name | True| String | - | etf基金名称| hb10 | -amount | True| Int | - | 换入数量 (POST /etf/swap/in) 或 换出数量 (POST /etf/swap/out) | 换入换出数量的范围请参照接口GET /etf/swap/config 提供的相应范围 | +etf_name | true| string | - | etf基金名称| hb10 | +amount | true| int | - | 换入数量 (POST /etf/swap/in) 或 换出数量 (POST /etf/swap/out) | 换入换出数量的范围请参照接口GET /etf/swap/config 提供的相应范围 | > Response: @@ -2194,10 +2196,10 @@ amount | True| Int | - | 换入数量 (POST /etf/swap/in) 或 换出数量 (PO 参数|是否必填 | 数据类型 | 长度 | 说明 | 取值范围 | -----------|------------|-----------|------------|----------|--| -code | True| Int | - | 结果返回码| 请参照返回码解释表 | -data | True| | - | | | -message | True| | - | | | -success | True| Boolean | - | 请求是否成功| Ture or false | +code | true| int | - | 结果返回码| 请参照返回码解释表 | +data | true| | - | | | +message | true| | - | | | +success | true| Boolean | - | 请求是否成功| true or false | * 返回码解释表 @@ -2230,9 +2232,9 @@ success | True| Boolean | - | 请求是否成功| Ture or false | 参数|是否必填 | 数据类型 | 长度 | 说明 | 取值范围 | -----------|------------|-----------|------------|----------|--| -etf_name | True| String | - | etf基金名称| hb10 | -offset | True| Int | - | 开始位置 | >=0. 比如,当offset=0, 开始位置就 是最新的这一条记录。 | -limit | True| Int | - |最大返回记录条数| >0 and <=100 | +etf_name | true| string | - | etf基金名称| hb10 | +offset | true| int | - | 开始位置 | >=0. 比如,当offset=0, 开始位置就 是最新的这一条记录。 | +limit | true| int | - |最大返回记录条数| [1, 100] | > Response: @@ -2315,30 +2317,30 @@ limit | True| Int | - |最大返回记录条数| >0 and <=100 | 参数|是否必填 | 数据类型 | 长度 | 说明 | 取值范围 | ---|------- |------ |---- |-----|--------| -id | True| Long | - |操作ID | | -gmt_created | True| Long | - |操作时间(毫秒) | | -currency | True| String | - |基金名称 | | -amount | True| Double | - |基金数量 | | -type | True| Int | - |操作类型 | 换入-1;换出-2 | -status | True| Int | - |操作结果状态 | 成功-2| -detail | True| Detail[] | - |详情 | | +id | true| long | - |操作ID | | +gmt_created | true| long | - |操作时间(毫秒) | | +currency | true| string | - |基金名称 | | +amount | true| double | - |基金数量 | | +type | true| int | - |操作类型 | 换入-1;换出-2 | +status | true| int | - |操作结果状态 | 成功-2| +detail | true| Detail[] | - |详情 | | Detail 参数|是否必填|数据类型|长度|说明| -----|-----|-----|------|-------| -used_ currency_list| Ture| Currency[]| -| 换出的资产列表。如果是换入,该参数包括的是用于换入的成分币详情。如果是换出,该参数则是用于换出的基金详情。| -rate|Ture| double| -|费率| -fee|Ture| double| -|实际收取的手续费| -point_card_amount| Ture| double|-|用点卡折扣的手续费| -obtain_ currency_list| Ture| Currency[]| -|换回的资产列表。如果是换入,该参数包括的是用 于换出的基金详情。如果是换出,该参数则是用于 换入的成分币详情。 | +used_ currency_list| ture| Currency[]| -| 换出的资产列表。如果是换入,该参数包括的是用于换入的成分币详情。如果是换出,该参数则是用于换出的基金详情。| +rate|ture| double| -|费率| +fee|ture| double| -|实际收取的手续费| +point_card_amount| ture| double|-|用点卡折扣的手续费| +obtain_ currency_list| ture| Currency[]| -|换回的资产列表。如果是换入,该参数包括的是用 于换出的基金详情。如果是换出,该参数则是用于 换入的成分币详情。 | Currency 参数|是否必填|数据类型|长度|说明| -----|-----|-----|------|-------| -currency| True | String |- | 成分币名称或基金名称 | -amount| True | Double |- | 数量 | +currency| true | string |- | 成分币名称或基金名称 | +amount| true | double |- | 数量 | # Websocket 订阅 From 8957a0d2d7ea4a02aa2beefc2235518c1c77eadf Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 21 Jan 2019 18:00:59 +0800 Subject: [PATCH 038/864] 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 5f6dcb65890..2ecccd36eec 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -13,11 +13,11 @@ search: False # API v1.0 简介 -欢迎使用火币 API v1.0! 你可以使用此API获得市场行情数据,进行交易,并且管理你的账户。 +欢迎使用火币 API v1.0! 你可以使用此 API 获得市场行情数据,进行交易,并且管理你的账户。 在文档的右侧是代码示例,目前我们仅提供针对 `shell` 的代码示例。 -你可以通过选择上方下拉菜单的版本号来切换文档对应的API版本。你也可以通过点击右上方的语言按钮来切换文档语言。 +你可以通过选择上方下拉菜单的版本号来切换文档对应的 API 版本,也可以通过点击右上方的语言按钮来切换文档语言。 ## 限频规则 @@ -52,7 +52,7 @@ search: False - 现货 / 杠杆(api.huobi.pro):10秒100次 From 57f0706f7b2901e0e05cd6930e347317d30d0a4a Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 22 Jan 2019 21:31:38 +0800 Subject: [PATCH 039/864] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=81=9A=E5=B8=82?= =?UTF-8?q?=E5=95=86=E9=A1=B9=E7=9B=AE=E7=AE=80=E4=BB=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 2ecccd36eec..31239ac7c7f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -11,7 +11,9 @@ includes: search: False --- -# API v1.0 简介 +# 简介 + +## API v1.0 欢迎使用火币 API v1.0! 你可以使用此 API 获得市场行情数据,进行交易,并且管理你的账户。 @@ -23,6 +25,23 @@ search: False 在使用中如果遇到问题,请加技术讨论 QQ 群: 火币网API交流群(7) 887876710(加群时请注明 UID 和编程语言),我们将尽力帮您答疑解惑。 +## 做市商项目 + + + +欢迎有优秀 maker 策略且交易量大的用户参与长期做市商项目。如果您的火币现货账户或者合约账户中有折合大于20BTC资产(币币和合约账户分开统计),请提供以下信息发送邮件至: + +- [MM_service@huobi.com](mailto:MM_service@huobi.com) Huobi Global(现货 / 杠杆)做市商申请; +- [dm_mm@huobi.com](mailto:dm_mm@huobi.com) HBDM(合约)做市商申请。 + + +1. 提供 UID (需不存在返佣关系的 UID); +2. 提供其他交易平台 maker 交易量截图证明(比如30天内成交量,或者 VIP 等级等); +3. 请简要阐述做市方法,不需要细节。 + + # 接入说明 ## 接入 URLs From eafd4fecd0aa2d1343d4e4cf0cf1b918530296e3 Mon Sep 17 00:00:00 2001 From: rayxy Date: Tue, 22 Jan 2019 15:51:50 +0000 Subject: [PATCH 040/864] Update screen.css.scss Improve nav section style --- source/stylesheets/screen.css.scss | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/stylesheets/screen.css.scss b/source/stylesheets/screen.css.scss index 1520f0a59c0..cae7641b322 100644 --- a/source/stylesheets/screen.css.scss +++ b/source/stylesheets/screen.css.scss @@ -117,12 +117,13 @@ header{ display: block; width: 100%; height: 40px; - line-height: 40px; + line-height: 10px; box-sizing: border-box; padding: 0 16px; color: #2B3D4A; text-decoration: none; transition: all 300ms linear; + font-size: 12px; } &.active,&:hover{ background-color: #F2F6FA; @@ -258,7 +259,7 @@ header{ list-style: none; margin: 0; padding: 0; - line-height: 48px; + line-height: 32px; } li { @@ -289,7 +290,7 @@ header{ .toc-h2 { padding-left: $nav-padding + $nav-indent; - font-size: 14px; + font-size: 13px; } .toc-footer { From 2f95a5f8d9359de091f9d298403cc26eca284351 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 23 Jan 2019 10:39:33 +0800 Subject: [PATCH 041/864] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=90=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 111 +++++++++++++++++++++++++++---------------- 1 file changed, 70 insertions(+), 41 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 31239ac7c7f..4f9a9be18f1 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -28,7 +28,7 @@ search: False ## 做市商项目 欢迎有优秀 maker 策略且交易量大的用户参与长期做市商项目。如果您的火币现货账户或者合约账户中有折合大于20BTC资产(币币和合约账户分开统计),请提供以下信息发送邮件至: @@ -41,6 +41,35 @@ search: False 2. 提供其他交易平台 maker 交易量截图证明(比如30天内成交量,或者 VIP 等级等); 3. 请简要阐述做市方法,不需要细节。 +## 子账号 + +子账号可以用来隔离资产与交易,资产可以在母子账号之间划转; 子账号用户只能在子账号内进行交易,并且子账号之间资产不能直接划转,只有母账号有划转权限。 + +子账号拥有独立的登陆账号密码和 API Key。 + + + +子账号可以访问所有公共接口,包括基本信息和市场行情,子账号可以访问的私有接口如下: + +接口|说明| +----------------------|---------------------| +[POST /v1/order/orders/place](#fd6ce2a756) |创建并执行订单| +[POST /v1/order/orders/{order-id}/submitcancel](#4e53c0fccd) |撤销一个订单| +[POST /v1/order/orders/batchcancel](#ad00632ed5) |批量撤销订单| +[POST /v1/order/orders/batchCancelOpenOrders](#open-orders) |撤销当前委托订单| +[GET /v1/order/orders/{order-id}](#92d59b6aad) |查询一个订单详情| +[GET /v1/order/orders](#d72a5b49e7) |查询当前委托、历史委托| +[GET /v1/order/openOrders](#95f2078356) |查询当前委托订单| +[GET /v1/order/matchresults](#0fa6055598) |查询成交| +[GET /v1/order/orders/{order-id}/matchresults](#56c6c47284) |查询某个订单的成交明细| +[GET /v1/account/accounts](#bd9157656f) |查询当前用户的所有账户| +[GET /v1/account/accounts/{account-id}/balance](#870c0ab88b) |查询指定账户的余额| + + # 接入说明 @@ -60,10 +89,10 @@ search: False **`wss://api.huobi.pro/ws/v1`** ## 限频规则 @@ -109,13 +138,13 @@ API Key 包括以下两部分 - `Secret Key` 签名认证加密所使用的密钥(仅申请时可见) @@ -168,7 +197,7 @@ api.huobi.pro\n `Timestamp=2017-05-11T15%3A19%3A30` +# 更新日志 + +| 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | +|-----|-----|-----|-----| +| 2019.01.17 07:00 | - Websocket accounts | 修改 | - 增加订阅参数 model;
- 订阅返回的内容中不再推送交易子账户冻结余额的变化。 | +| 2018.07.10 11:00 | - GET `/market/history/kline` | 修改 | - `size` 取值范围由 [1-1000] 修改为 [1-2000]。| +| 2018.07.06 16:00 | - POST `/v1/order/orders/place`| 修改 | - 添加 `buy-limit-maker`,`sell-limit-maker` 两种下单类型支持;
- 新增获取某个帐号下指定交易对或者所有交易对的所有尚未成交订单接口: `/v1/order/openOrders`。 +| 2018.07.06 16:00 | - GET `/v1/order/openOrders`
- POST `/v1/order/orders/batchCancelOpenOrders` | 新增 | - 新增获取某个帐号下指定交易对或者所有交易对的所有尚未成交订单接口;
- 新增批量取消某个帐号下指定的订单列表中所有订单接口。 | +| 2018.07.02 16:00 | - ETF 相关接口 | 新增 | - 本次接口变更主要是支持 HB10 ETF 的换入和换出。 | +| 2018.06.20 16:00 | - GET `/market/tickers` | 新增 | - 新增 Tickers 接口,Tickers 为当前所有交易对行情数据。 | + + # 接入说明 ## 接入 URLs From 103e9395fb72e584223382da438e9961c83981b4 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 24 Jan 2019 18:11:29 +0800 Subject: [PATCH 044/864] =?UTF-8?q?=E5=8B=98=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 5f42c1a9c3f..6e019ee8d04 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1746,7 +1746,7 @@ state | string | 订单状态,包括submitted, partical-fille | end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | | | | states | true | string | 查询的订单状态组合,使用','分割 | | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | | from | false | string | 查询起始 ID | | | -| direct | false | string | 查询方向 | | prev 向前,next 向后 | +| direct | false | string | 查询方向 | | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | | size | false | string | 查询记录大小 | | | @@ -1973,7 +1973,7 @@ data | integer | Margin order id 参数名称 | 数据类型 | 是否必需 | 描述 --------- | --------- | -------- | ----------- order-id | string | true | 借贷订单 ID,写在 url path 中 -amount | string | true | 归还币种 +amount | string | true | 归还币种数量 > Response: @@ -2019,7 +2019,7 @@ data | integer | Margin order id | end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | | | | states | false | string | 状态 | | | | from | false | string | 查询起始 ID | | | -| direct | false | string | 查询方向 | | prev 向前,next 向后 | +| direct | false | string | 查询方向 | | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | | size | false | string | 查询记录大小 | | | > Response: From c7c0da156c4892962581f27c3ae723157eaba42d Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 28 Jan 2019 16:43:40 +0800 Subject: [PATCH 045/864] =?UTF-8?q?=E5=8B=98=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/index.html.md | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 6e019ee8d04..79bc5bcc5fd 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -553,7 +553,7 @@ size | integer | false | 150 | 返回 K 线数据条数 | [1, 2000 字段名称 | 数据类型 | 描述 --------- | --------- | ----------- -id | integer | 调整为北京时间的时间戳,单位毫秒,并以此作为此K线柱的id +id | integer | 调整为北京时间的时间戳,单位秒,并以此作为此K线柱的id amount | float | 以基础币种计量的交易量 count | integer | 交易次数 open | float | 本阶段开盘价 @@ -605,7 +605,7 @@ symbol | string | true | NA | 交易对 | btcusdt, ethbtc 字段名称 | 数据类型 | 描述 --------- | --------- | ----------- -id | integer | 调整为北京时间的时间戳,单位毫秒,并以此作为此 ticker 的 id +id | integer | NA amount | float | 以基础币种计量的交易量 count | integer | 交易次数 open | float | 本阶段开盘价 @@ -1997,18 +1997,7 @@ data | integer | Margin order id ### HTTP 请求 -- POST ` /v1/margin/loan-orders` - -```json -{ - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" -} -``` +- GET ` /v1/margin/loan-orders` ### 请求参数 From f4626adc7961ce36f16cc57516db87d5f7dddecd Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 28 Jan 2019 16:48:53 +0800 Subject: [PATCH 046/864] update --- source/index.html.md | 1 + 1 file changed, 1 insertion(+) diff --git a/source/index.html.md b/source/index.html.md index 79bc5bcc5fd..cbb49e62511 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1977,6 +1977,7 @@ amount | string | true | 归还币种数量 > Response: + ```json { "data": 1000 From 51323766edff0d709b25c51ef34581f871ff4a88 Mon Sep 17 00:00:00 2001 From: rayx Date: Tue, 29 Jan 2019 18:08:51 +0000 Subject: [PATCH 047/864] hide version control dropdown --- source/stylesheets/screen.css.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/stylesheets/screen.css.scss b/source/stylesheets/screen.css.scss index cae7641b322..2fd3f912b8f 100644 --- a/source/stylesheets/screen.css.scss +++ b/source/stylesheets/screen.css.scss @@ -74,7 +74,7 @@ header{ margin-left: 40px; .nav_cell{ position: relative; - display: inline-block; + display: none; .nav_first{ display: inline-block; height: 32px; From c6162aa25b12f908bf00490b1d10a8093f629039 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 13 Feb 2019 17:13:13 +0800 Subject: [PATCH 048/864] update --- .travis.yml | 11 ++++++++++- deploy.sh | 5 ++++- source/index.html.md | 6 +++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0d6d210d94a..919e5de6e63 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,5 +6,14 @@ 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 \ No newline at end of file diff --git a/deploy.sh b/deploy.sh index 3483748493c..d9d86eebbaf 100755 --- a/deploy.sh +++ b/deploy.sh @@ -171,7 +171,10 @@ commit+push() { 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 + # git push --quiet $repo $deploy_branch + # add github token + git remote add origin-pages "https://"$GH_TOKEN"@github.com/huobiapi/docs.git" + git push --quiet origin-pages gh-pages enable_expanded_output } diff --git a/source/index.html.md b/source/index.html.md index cbb49e62511..f6ff61c1b28 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1,5 +1,5 @@ --- -title: 火币 API 文档 v1.0 +title: 火币 API 文档 language_tabs: # must be one of https://git.io/vQNgJ - shell @@ -13,9 +13,9 @@ search: False # 简介 -## API v1.0 +## API 简介 -欢迎使用火币 API v1.0! 你可以使用此 API 获得市场行情数据,进行交易,并且管理你的账户。 +欢迎使用火币 API! 你可以使用此 API 获得市场行情数据,进行交易,并且管理你的账户。 在文档的右侧是代码示例,目前我们仅提供针对 `shell` 的代码示例。 From c2b15ab7dffcb161e8a2cbc8717dd9f638ab1adf Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 13 Feb 2019 17:17:10 +0800 Subject: [PATCH 049/864] delete rvm 2.3.3 --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 919e5de6e63..384a0252be0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ sudo: false language: ruby rvm: - - 2.3.3 - 2.4.0 branches: From ba9db1d54f2474e65ba71f726d7e013511dc8f06 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 15 Feb 2019 17:21:57 +0800 Subject: [PATCH 050/864] CI bug fix --- deploy.sh | 134 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 90 insertions(+), 44 deletions(-) diff --git a/deploy.sh b/deploy.sh index d9d86eebbaf..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=cn - 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,16 +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 - # add github token - git remote add origin-pages "https://"$GH_TOKEN"@github.com/huobiapi/docs.git" - git push --quiet origin-pages gh-pages + 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 } @@ -235,3 +279,5 @@ else run_build main fi + + From 9a5521e661a9cd1b3ef314952953c826c6728697 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 15 Feb 2019 17:24:45 +0800 Subject: [PATCH 051/864] update ingnore dir --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e81d1a643f3..ca2fb2d6f58 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ test/version_tmp tmp *.DS_STORE build/ +gh-pages/ .cache .vagrant .sass-cache From 5e124075f10bb0df3d3664c9397e3233410a39d6 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 15 Feb 2019 17:47:57 +0800 Subject: [PATCH 052/864] update ignore file --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index ca2fb2d6f58..21e64b5407a 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,3 @@ gh-pages/ _yardoc doc/ .idea/ -index.html.md.old From 1ad583a4a50081ee37961adc5e578f68126bbc67 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Tue, 19 Feb 2019 14:53:00 +0800 Subject: [PATCH 053/864] 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 f6ff61c1b28..92c32bcf1fa 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -22,7 +22,7 @@ search: False 你可以通过选择上方下拉菜单的版本号来切换文档对应的 API 版本,也可以通过点击右上方的语言按钮来切换文档语言。 ## 做市商项目 @@ -2401,4 +2401,4 @@ amount| true | double |- | 数量 | 


-
\ No newline at end of file +
From 5bcb98a0435391269282c2114062578ddbcb5f62 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Tue, 19 Feb 2019 18:36:03 +0800 Subject: [PATCH 054/864] Update index.html.md --- 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 92c32bcf1fa..6ab52f203f2 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -395,7 +395,7 @@ code 的具体解释, 参考对应的 `err-msg`. # 基础信息 -## 返回所有支持的交易对 +## 获取所有交易对 此接口返回所有火币全球站支持的交易对。 @@ -445,7 +445,7 @@ price-precision | integer | 交易对报价的精度(小数点后位数) amount-precision| integer | 交易对基础币种计数精度(小数点后位数) symbol-partition| string | 交易区,可能值: [main,innovation,bifurcation] -## 返回所有支持的币种 +## 获取所有币种 此接口返回所有火币全球站支持的币种。 @@ -480,7 +480,7 @@ curl "https://api.huobi.pro/v1/common/currencys" -## 返回当前系统时间 +## 获取当前系统时间 此接口返回当前的系统时间,时间是调整为北京时间的时间戳,单位毫秒。 From 1236f8910c9ee1e1fa80c896eadd35080a3e5219 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 26 Feb 2019 15:35:48 +0800 Subject: [PATCH 055/864] usdterc20 --- source/index.html.md | 1 + 1 file changed, 1 insertion(+) diff --git a/source/index.html.md b/source/index.html.md index 6ab52f203f2..0ce387a4c67 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1209,6 +1209,7 @@ balance|-|decimal|- |账户余额 |-| | amount | true | string | 提币数量 | | | currency | true | string | 资产类型 | btc, ltc, bch, eth, etc ...(火币全球站支持的币种) | | fee | false | string | 转账手续费 | | +| chain | false | string | 提 USDT-ERC20 时需要设置此参数为 "usdterc20",其他币种提现不需要设置此参数 | | | addr-tag|false | string | 虚拟币共享地址tag,适用于xrp,xem,bts,steem,eos,xmr | 格式, "123"类的整数字符串| From 1c326867919554c55f1391e29e18cdeb2c8207c9 Mon Sep 17 00:00:00 2001 From: Fred Yu <16685494+FredYuuu@users.noreply.github.com> Date: Fri, 8 Mar 2019 17:36:19 +0800 Subject: [PATCH 056/864] Update index.html.md --- source/index.html.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 0ce387a4c67..9fb12a3b148 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -326,7 +326,12 @@ code 的具体解释, 参考对应的 `err-msg`. |order-datelimit-error|查询超出时间限制| |order-update-error|订单更新出错| -## 代码示例 +## SDK 与代码示例 + +### SDK + +[Java(Beta)](https://github.com/huobiapi/huobi_Java) + ### Websocket From 9a48a7a5565f3fd75c74a7bb03c41cde4b9481a1 Mon Sep 17 00:00:00 2001 From: Fred Yu <16685494+FredYuuu@users.noreply.github.com> Date: Fri, 8 Mar 2019 17:40:43 +0800 Subject: [PATCH 057/864] 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 9fb12a3b148..685e783b79b 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -330,7 +330,7 @@ code 的具体解释, 参考对应的 `err-msg`. ### SDK -[Java(Beta)](https://github.com/huobiapi/huobi_Java) +[Java (Beta)](https://github.com/huobiapi/huobi_Java) ### Websocket From 6e748adfdd4aa56c542d72d4891c702385ec09f6 Mon Sep 17 00:00:00 2001 From: Fred Yu <16685494+FredYuuu@users.noreply.github.com> Date: Fri, 8 Mar 2019 17:44:54 +0800 Subject: [PATCH 058/864] Update index.html.md --- source/index.html.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 685e783b79b..cee49843e88 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -330,8 +330,7 @@ code 的具体解释, 参考对应的 `err-msg`. ### SDK -[Java (Beta)](https://github.com/huobiapi/huobi_Java) - +[Java](https://github.com/huobiapi/huobi_Java) ### Websocket From 5fa759a7f72dd02a3907af188355586521ce944c Mon Sep 17 00:00:00 2001 From: Fred Yu <16685494+FredYuuu@users.noreply.github.com> Date: Fri, 8 Mar 2019 17:49:04 +0800 Subject: [PATCH 059/864] 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 cee49843e88..f006cdfcde9 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -330,7 +330,7 @@ code 的具体解释, 参考对应的 `err-msg`. ### SDK -[Java](https://github.com/huobiapi/huobi_Java) +Java ### Websocket From 12690614d9c4db3846e08a9e1b28d7291c236b81 Mon Sep 17 00:00:00 2001 From: Fred Yu <16685494+FredYuuu@users.noreply.github.com> Date: Fri, 8 Mar 2019 21:27:50 +0800 Subject: [PATCH 060/864] Update index.html.md --- source/index.html.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index f006cdfcde9..379d03eb930 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -330,8 +330,10 @@ code 的具体解释, 参考对应的 `err-msg`. ### SDK + Java + ### Websocket [Python3](https://github.com/huobiapi/Websocket-Python3-demo) From 7e8f19faed301528c0f3d7a7c8adada26abbd86a Mon Sep 17 00:00:00 2001 From: Fred Yu <16685494+FredYuuu@users.noreply.github.com> Date: Fri, 8 Mar 2019 21:35:09 +0800 Subject: [PATCH 061/864] 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 379d03eb930..73b22cba9a1 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -330,8 +330,8 @@ code 的具体解释, 参考对应的 `err-msg`. ### SDK - Java +[Java](https://github.com/huobiapi/huobi_Java) ### Websocket From 7e2219ca20c8f15ac36884d01603eed7fd8e3617 Mon Sep 17 00:00:00 2001 From: Fred Yu <16685494+FredYuuu@users.noreply.github.com> Date: Fri, 8 Mar 2019 21:43:09 +0800 Subject: [PATCH 062/864] 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 73b22cba9a1..63557aa8610 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -331,6 +331,7 @@ code 的具体解释, 参考对应的 `err-msg`. ### SDK Java + [Java](https://github.com/huobiapi/huobi_Java) From 12a3f214be1ddb0d3828da9b475e31fb5dfa1d41 Mon Sep 17 00:00:00 2001 From: Fred Yu <16685494+FredYuuu@users.noreply.github.com> Date: Fri, 8 Mar 2019 21:59:59 +0800 Subject: [PATCH 063/864] Update index.html.md --- source/index.html.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 63557aa8610..a429b047ef1 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -330,9 +330,8 @@ code 的具体解释, 参考对应的 `err-msg`. ### SDK -Java - [Java](https://github.com/huobiapi/huobi_Java) +[]() ### Websocket From 55b7338ad4ebb30e2e081d16661c8d2286ff05ff Mon Sep 17 00:00:00 2001 From: Fred Yu <16685494+FredYuuu@users.noreply.github.com> Date: Fri, 8 Mar 2019 22:21:34 +0800 Subject: [PATCH 064/864] Update index.html.md --- source/index.html.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index a429b047ef1..5ea1230c138 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -330,8 +330,9 @@ code 的具体解释, 参考对应的 `err-msg`. ### SDK -[Java](https://github.com/huobiapi/huobi_Java) -[]() +| 语言 | 链接 | +|-----|-----| +| Java | [https://github.com/huobiapi/huobi_Java](https://github.com/huobiapi/huobi_Java) | ### Websocket From c0cb0e72170d9cd14d26c0ec008031bb4a4082f4 Mon Sep 17 00:00:00 2001 From: Fred Yu <16685494+FredYuuu@users.noreply.github.com> Date: Fri, 8 Mar 2019 22:29:33 +0800 Subject: [PATCH 065/864] Update index.html.md --- source/index.html.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 5ea1230c138..1873f96b968 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -328,14 +328,12 @@ code 的具体解释, 参考对应的 `err-msg`. ## SDK 与代码示例 -### SDK +**SDK** -| 语言 | 链接 | -|-----|-----| -| Java | [https://github.com/huobiapi/huobi_Java](https://github.com/huobiapi/huobi_Java) | +[Java](https://github.com/huobiapi/huobi_Java) -### Websocket +**Websocket** [Python3](https://github.com/huobiapi/Websocket-Python3-demo) @@ -343,7 +341,7 @@ code 的具体解释, 参考对应的 `err-msg`. [PHP](https://github.com/huobiapi/WebSocket-PHP-demo) -### REST +**REST** [Python3](https://github.com/huobiapi/REST-Python3-demo) From 4d431215c29afd16401e1ca0e999bd39df379d90 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Tue, 12 Mar 2019 18:03:20 +0800 Subject: [PATCH 066/864] 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 1873f96b968..3b3537e620a 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1445,7 +1445,7 @@ source | string | false | api | 现货交易填写“api”,杠 ## 查询当前未成交订单 -查询已提交但是仍未完全成交或被撤销的订单。 +查询已提交但是仍未完全成交或未被撤销的订单。 ```json From 834e202d52179009ecfa931a80b7379ffc86bf36 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Tue, 19 Mar 2019 15:08:36 +0800 Subject: [PATCH 067/864] Update index.html.md --- 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 3b3537e620a..d1e432257ac 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -698,11 +698,11 @@ curl "https://api.huobi.pro/market/depth?symbol=btcusdt&type=step2" ### 请求参数 -参数 | 数据类型 | 必须 | 默认值 | 描述 | 默认值 ---------- | --------- | -------- | ------| ---- | --- -symbol | string | true | NA | 交易对 | btcusdt, ethbtc -depth | integer | false | 20 | 返回深度的数量 | 5,10,20 -type | string | true | step0 | 深度的价格聚合度,具体说明见下方 | +参数 | 数据类型 | 必须 | 默认值 | 描述 | 取值范围 | +--------- | --------- | -------- | ------| ---- | --- | +symbol | string | true | NA | 交易对 | btcusdt, ethbtc...| +depth | integer | false | 20 | 返回深度的数量 | 5,10,20 | +type | string | true | step0 | 深度的价格聚合度,具体说明见下方 | step0,step1,step2,step3,step4,step5 | From fd203eb2d75b7c39bd9f97840cde7d9b79d55bf7 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Wed, 27 Mar 2019 16:58:39 +0800 Subject: [PATCH 068/864] 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 d1e432257ac..b3d937d2bdc 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2145,7 +2145,7 @@ data | integer | Margin order id | state | true | string | 账户状态 | working,fl-sys,fl-mgt,fl-end | | risk-rate | true | object | 风险率 | | | fl-price | true | string | 爆仓价 | | -| list | true | array | 子账号列表 | | +| list | true | array | 杠杆账户列表 | | # ETF(HB10) From 91430e8e7ccb937661e6abc890b162416db20e7b Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Wed, 27 Mar 2019 17:01:58 +0800 Subject: [PATCH 069/864] 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 b3d937d2bdc..6ecc5ba34ec 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2145,7 +2145,7 @@ data | integer | Margin order id | state | true | string | 账户状态 | working,fl-sys,fl-mgt,fl-end | | risk-rate | true | object | 风险率 | | | fl-price | true | string | 爆仓价 | | -| list | true | array | 杠杆账户列表 | | +| list | true | array | 借贷账户详情列表 | | # ETF(HB10) From 922676bd9db1c0fed1e32e5972f7d9ece5e95461 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Tue, 2 Apr 2019 11:40:21 +0800 Subject: [PATCH 070/864] Update index.html.md --- source/index.html.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 6ecc5ba34ec..e680f0b791c 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -328,10 +328,13 @@ code 的具体解释, 参考对应的 `err-msg`. ## SDK 与代码示例 -**SDK** +**SDK(推荐)** [Java](https://github.com/huobiapi/huobi_Java) +[Python3](https://github.com/huobiapi/huobi_Python) + +[C++](https://github.com/huobiapi/huobi_Cpp) **Websocket** From 37cc6d09848dc13bf55747753d56a2788fcb2e43 Mon Sep 17 00:00:00 2001 From: "Rain@Huobi" Date: Sat, 13 Apr 2019 12:26:28 +0800 Subject: [PATCH 071/864] 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 e680f0b791c..f230b78f8cf 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -48,7 +48,7 @@ search: False 子账号拥有独立的登陆账号密码和 API Key。 子账号可以访问所有公共接口,包括基本信息和市场行情,子账号可以访问的私有接口如下: @@ -112,7 +112,7 @@ search: False - 现货 / 杠杆(api.huobi.pro):10秒100次 From ae425b75a658d1e4ed0f1f79f3b79de9178682e8 Mon Sep 17 00:00:00 2001 From: "Rain@Huobi" Date: Tue, 16 Apr 2019 09:56:45 +0800 Subject: [PATCH 072/864] Update index.html.md --- source/index.html.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index f230b78f8cf..9bc95ab5291 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +| 2019.04.16 10:00 | - GET /v1/order/openOrders | 修改 | 文档错误,参数account-id和symbol都是必填参数 | | 2019.01.17 07:00 | - Websocket accounts | 修改 | - 增加订阅参数 model;
- 订阅返回的内容中不再推送交易子账户冻结余额的变化。 | | 2018.07.10 11:00 | - GET `/market/history/kline` | 修改 | - `size` 取值范围由 [1-1000] 修改为 [1-2000]。| | 2018.07.06 16:00 | - POST `/v1/order/orders/place`| 修改 | - 添加 `buy-limit-maker`,`sell-limit-maker` 两种下单类型支持;
- 新增获取某个帐号下指定交易对或者所有交易对的所有尚未成交订单接口: `/v1/order/openOrders`。 @@ -1471,8 +1472,8 @@ source | string | false | api | 现货交易填写“api”,杠 参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -account-id | string | false | NA | 账户 ID,使用 GET /v1/account/accounts 接口获得。现货交易使用‘spot’账户的 account-id;杠杆交易,请使用 ‘margin’ 账户的 account-id -symbol | string | false | NA | 交易对, 例如btcusdt, ethbtc +account-id | string | true | NA | 账户 ID,使用 GET /v1/account/accounts 接口获得。现货交易使用‘spot’账户的 account-id;杠杆交易,请使用 ‘margin’ 账户的 account-id +symbol | string | ture | NA | 交易对, 例如btcusdt, ethbtc side | string | false | both | 指定只返回某一个方向的订单,可能的值有: buy, sell. 默认两个方向都返回。 size | int | false | 10 | 返回订单的数量,最大值2000。 From 765fd7bbe98b7be45e9dccab141cd54eccbe3bf3 Mon Sep 17 00:00:00 2001 From: "Rain@Huobi" Date: Wed, 17 Apr 2019 20:40:05 +0800 Subject: [PATCH 073/864] Update index.html.md --- source/index.html.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 9bc95ab5291..de88a36cac9 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.04.17 10:00| - GET /v1/order/orders |修改|文档优化,增加Start-date限制说明| | 2019.04.16 10:00 | - GET /v1/order/openOrders | 修改 | 文档错误,参数account-id和symbol都是必填参数 | | 2019.01.17 07:00 | - Websocket accounts | 修改 | - 增加订阅参数 model;
- 订阅返回的内容中不再推送交易子账户冻结余额的变化。 | | 2018.07.10 11:00 | - GET `/market/history/kline` | 修改 | - `size` 取值范围由 [1-1000] 修改为 [1-2000]。| @@ -1752,8 +1753,8 @@ state | string | 订单状态,包括submitted, partical-fille | ---------- | ----- | ------ | ------ | ---- | ---- | | symbol | true | string | 交易对 | |btcusdt, ethbtc, rcneth ... | | types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | -| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | | | -| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | | | +| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | -180 days | [-180 days, end-date] | +| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | today | [start-date, today] | | states | true | string | 查询的订单状态组合,使用','分割 | | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | | from | false | string | 查询起始 ID | | | | direct | false | string | 查询方向 | | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | From 9c025552bcd108ac038d1ed861edcb0bb3725f87 Mon Sep 17 00:00:00 2001 From: "Rain@Huobi" Date: Wed, 17 Apr 2019 20:51:48 +0800 Subject: [PATCH 074/864] 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 de88a36cac9..274729a700d 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1758,7 +1758,7 @@ state | string | 订单状态,包括submitted, partical-fille | states | true | string | 查询的订单状态组合,使用','分割 | | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | | from | false | string | 查询起始 ID | | | | direct | false | string | 查询方向 | | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | -| size | false | string | 查询记录大小 | | | +| size | false | string | 查询记录大小 | 100 | [1, 1000] | > Response: From 7e3722a4fedb4433a92fbe86342423ebb3afc501 Mon Sep 17 00:00:00 2001 From: Fred Yu <16685494+FredYuuu@users.noreply.github.com> Date: Mon, 29 Apr 2019 16:18:54 +0800 Subject: [PATCH 075/864] Update index.html.md --- source/index.html.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 274729a700d..d1828ad6661 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1452,7 +1452,6 @@ source | string | false | api | 现货交易填写“api”,杠 查询已提交但是仍未完全成交或未被撤销的订单。 - ```json { "account-id": "100009", @@ -1474,10 +1473,14 @@ source | string | false | api | 现货交易填写“api”,杠 参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- account-id | string | true | NA | 账户 ID,使用 GET /v1/account/accounts 接口获得。现货交易使用‘spot’账户的 account-id;杠杆交易,请使用 ‘margin’ 账户的 account-id -symbol | string | ture | NA | 交易对, 例如btcusdt, ethbtc +symbol | string | ture | NA | 交易对, 例如btcusdt, ethbtc side | string | false | both | 指定只返回某一个方向的订单,可能的值有: buy, sell. 默认两个方向都返回。 size | int | false | 10 | 返回订单的数量,最大值2000。 + + + + > Response: ```json From f2dc21e9a18c86afcd59a7b7975dd242a75c5fa9 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 29 Apr 2019 19:06:56 +0800 Subject: [PATCH 076/864] Update index.html.md --- source/index.html.md | 78 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index d1828ad6661..f790a3c617e 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -61,6 +61,7 @@ search: False [POST /v1/order/orders/batchCancelOpenOrders](#open-orders) |撤销当前委托订单| [GET /v1/order/orders/{order-id}](#92d59b6aad) |查询一个订单详情| [GET /v1/order/orders](#d72a5b49e7) |查询当前委托、历史委托| +[GET /v1/order/history](#d72a5b49e7) |查询最近48小时内历史委托| [GET /v1/order/openOrders](#95f2078356) |查询当前委托订单| [GET /v1/order/matchresults](#0fa6055598) |查询成交| [GET /v1/order/orders/{order-id}/matchresults](#56c6c47284) |查询某个订单的成交明细| @@ -75,6 +76,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.04.29 19:00| - GET /v1/order/history |新增|新增最近48小时内历史订单查询接口| |2019.04.17 10:00| - GET /v1/order/orders |修改|文档优化,增加Start-date限制说明| | 2019.04.16 10:00 | - GET /v1/order/openOrders | 修改 | 文档错误,参数account-id和symbol都是必填参数 | | 2019.01.17 07:00 | - Websocket accounts | 修改 | - 增加订阅参数 model;
- 订阅返回的内容中不再推送交易子账户冻结余额的变化。 | @@ -1812,6 +1814,82 @@ state | string | 订单状态,包括submitted, partical-fille | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | submit-cancel:已提交撤单申请 ,buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +## 搜索最近48小时内历史订单 + +此接口基于搜索条件查询历史订单。 + +### HTTP 请求 + +- GET `/v1/order/history` + +```json +{ + "symbol": "btcusdt", + "start-time": "1556417645419", + "end-time": "1556533539282", + "direct": "prev", + "size": "10" +} +``` + + +### 请求参数 + +| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | +| ---------- | ----- | ------ | ------ | ---- | ---- | +| symbol | false | string | 交易对 |all |btcusdt, ethbtc, rcneth ... | +| start-time | false | long | 查询起始时间(含) |48小时前的时刻 |UTC time in millisecond | +| end-time | false | long | 查询结束时间 | 查询时刻 |UTC time in millisecond | +| direct | false | string | 订单查询方向(注:仅在检索出的总条目数量超出size字段限定时起作用;如果检索出的总条目数量在size 字段限定内,direct 字段不起作用。) | next |prev, next | +| size | false | int | 每次返回条目数量 |100 | [10,1000] | + + + +> Response: + +```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 + } + ] +} +``` + +### 响应数据 + +| 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +| ----------------- | ----- | ------ | ----------------- | ---- | +| {account-id | true | long | 账户 ID | | +| amount | true | string | 订单数量 | | +| canceled-at | false | long | 接到撤单申请的时间 | | +| created-at | true | long | 订单创建时间 | | +| field-amount | true | string | 已成交数量 | | +| field-cash-amount | true | string | 已成交总金额 | | +| field-fees | true | string | 已成交手续费(买入为基础币,卖出为计价币) | | +| finished-at | false | long | 最后成交时间 | | +| id | true | long | 订单ID | | +| price | true | string | 订单价格 | | +| source | true | string | 订单来源 | api | +| state | true | string | 订单状态 | partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | +| symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | +| type} | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-limit-maker, sell-limit-maker | + ## 当前和历史成交 此接口基于搜索条件查询当前和历史成交记录。 From 044cdc542c1aeccb2100cca699a4c43613a6a1b4 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 29 Apr 2019 19:12:01 +0800 Subject: [PATCH 077/864] 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 f790a3c617e..df7b7298aae 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1816,7 +1816,7 @@ state | string | 订单状态,包括submitted, partical-fille ## 搜索最近48小时内历史订单 -此接口基于搜索条件查询历史订单。 +此接口基于搜索条件查询最近48小时内历史订单。 ### HTTP 请求 @@ -1889,6 +1889,7 @@ state | string | 订单状态,包括submitted, partical-fille | state | true | string | 订单状态 | partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type} | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-limit-maker, sell-limit-maker | +| next-time | false | long |下一查询起始时间(当请求字段”direct”为”prev”时有效), 下一查询结束时间(当请求字段”direct”为”next”时有效)。注:仅在检索出的总条目数量超出size字段限定时,此返回字段存在。 |UTC time in millisecond | ## 当前和历史成交 From a4c5b9ef6ffeb2966addc203d4b33fcc426a7f80 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 29 Apr 2019 19:15:59 +0800 Subject: [PATCH 078/864] 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 df7b7298aae..9407fc1a32b 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1839,7 +1839,7 @@ state | string | 订单状态,包括submitted, partical-fille | ---------- | ----- | ------ | ------ | ---- | ---- | | symbol | false | string | 交易对 |all |btcusdt, ethbtc, rcneth ... | | start-time | false | long | 查询起始时间(含) |48小时前的时刻 |UTC time in millisecond | -| end-time | false | long | 查询结束时间 | 查询时刻 |UTC time in millisecond | +| end-time | false | long | 查询结束时间(含) | 查询时刻 |UTC time in millisecond | | direct | false | string | 订单查询方向(注:仅在检索出的总条目数量超出size字段限定时起作用;如果检索出的总条目数量在size 字段限定内,direct 字段不起作用。) | next |prev, next | | size | false | int | 每次返回条目数量 |100 | [10,1000] | From 20ceca7a107de7dfe87effc4eab8be090e5e633d Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 29 Apr 2019 19:17:45 +0800 Subject: [PATCH 079/864] 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 9407fc1a32b..6fe66379d1f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -61,7 +61,7 @@ search: False [POST /v1/order/orders/batchCancelOpenOrders](#open-orders) |撤销当前委托订单| [GET /v1/order/orders/{order-id}](#92d59b6aad) |查询一个订单详情| [GET /v1/order/orders](#d72a5b49e7) |查询当前委托、历史委托| -[GET /v1/order/history](#d72a5b49e7) |查询最近48小时内历史委托| +[GET /v1/order/history](#d72a5b49e8) |查询最近48小时内历史委托| [GET /v1/order/openOrders](#95f2078356) |查询当前委托订单| [GET /v1/order/matchresults](#0fa6055598) |查询成交| [GET /v1/order/orders/{order-id}/matchresults](#56c6c47284) |查询某个订单的成交明细| From 9ecb07a2cbe3ff083366a15daef8953080281558 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 29 Apr 2019 19:18:51 +0800 Subject: [PATCH 080/864] Update index.html.md --- source/index.html.md | 1 - 1 file changed, 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 6fe66379d1f..046441ddb5b 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -61,7 +61,6 @@ search: False [POST /v1/order/orders/batchCancelOpenOrders](#open-orders) |撤销当前委托订单| [GET /v1/order/orders/{order-id}](#92d59b6aad) |查询一个订单详情| [GET /v1/order/orders](#d72a5b49e7) |查询当前委托、历史委托| -[GET /v1/order/history](#d72a5b49e8) |查询最近48小时内历史委托| [GET /v1/order/openOrders](#95f2078356) |查询当前委托订单| [GET /v1/order/matchresults](#0fa6055598) |查询成交| [GET /v1/order/orders/{order-id}/matchresults](#56c6c47284) |查询某个订单的成交明细| From 8a683c3242809fd15291bfeef7c71a55d6409228 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 29 Apr 2019 20:17:43 +0800 Subject: [PATCH 081/864] 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 046441ddb5b..39ede8c794f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,7 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| -|2019.04.29 19:00| - GET /v1/order/history |新增|新增最近48小时内历史订单查询接口| +|2019.04.29 19:00| - GET /v1/order/history |新增|新增最近48小时内历史订单查询节点。新节点的上线后,现有订单查询节点“GET /v1/order/orders”仍将被保留。然而,新节点“GET /v1/order/history”被赋予更高服务等级。极端情况下,当服务荷载超过系统既定阈值时,节点“GET /v1/order/orders”的服务可能会不可用,而新节点“GET /v1/order/history”仍将继续提供服务。另外,火币正在计划支持另一个新节点专门用于用户48小时外的历史订单查询。此新节点上线的同时,现有节点“GET /v1/order/orders”将被弃用。火币将及时告知用户这一变更,一旦变更时间确定。| |2019.04.17 10:00| - GET /v1/order/orders |修改|文档优化,增加Start-date限制说明| | 2019.04.16 10:00 | - GET /v1/order/openOrders | 修改 | 文档错误,参数account-id和symbol都是必填参数 | | 2019.01.17 07:00 | - Websocket accounts | 修改 | - 增加订阅参数 model;
- 订阅返回的内容中不再推送交易子账户冻结余额的变化。 | From 679f832ad8cb2da6f58fb42e577d86c5ca972eff Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Wed, 15 May 2019 15:35:36 +0800 Subject: [PATCH 082/864] Update index.html.md --- source/index.html.md | 92 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 39ede8c794f..a5305ec6da6 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -66,7 +66,7 @@ search: False [GET /v1/order/orders/{order-id}/matchresults](#56c6c47284) |查询某个订单的成交明细| [GET /v1/account/accounts](#bd9157656f) |查询当前用户的所有账户| [GET /v1/account/accounts/{account-id}/balance](#870c0ab88b) |查询指定账户的余额| - +[POST /v1/futures/transfer](#870c0ab88b) |币币与合约账户间的资金划转| @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.05.15 10:00| - POST /v1/futures/transfer |新增|提供币币与合约账户间的资金划转| |2019.04.29 19:00| - GET /v1/order/history |新增|新增最近48小时内历史订单查询节点。新节点的上线后,现有订单查询节点“GET /v1/order/orders”仍将被保留。然而,新节点“GET /v1/order/history”被赋予更高服务等级。极端情况下,当服务荷载超过系统既定阈值时,节点“GET /v1/order/orders”的服务可能会不可用,而新节点“GET /v1/order/history”仍将继续提供服务。另外,火币正在计划支持另一个新节点专门用于用户48小时外的历史订单查询。此新节点上线的同时,现有节点“GET /v1/order/orders”将被弃用。火币将及时告知用户这一变更,一旦变更时间确定。| |2019.04.17 10:00| - GET /v1/order/orders |修改|文档优化,增加Start-date限制说明| | 2019.04.16 10:00 | - GET /v1/order/openOrders | 修改 | 文档错误,参数account-id和symbol都是必填参数 | @@ -1951,6 +1952,95 @@ state | string | 订单状态,包括submitted, partical-fille | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +## 币币现货账户与合约账户划转 + +此接口用户币币现货账户与合约账户之间的资金划转。 + +从现货现货账户转至合约账户,类型为`pro-to-futures`; 从合约账户转至现货账户,类型为`futures-to-pro` + +该接口的访问频次的限制为1分钟10次。 + +### HTTP 请求 + +- POST ` /v1/futures/transfer` + +```json +{ + "currency": "btc", + "amount": "0.001", + "type": "pro-to-futures" +} +``` + +### 请求参数 + +|参数名称 | 数据类型 | 是否必需 | 默认值 | 描述|取值范围 +|--------- | --------- | -------- | ------- | -----------|---------| +|currency | string | true | NA | 币种, e.g. btc|| +|amount | decimal | true | NA | 划转数量|| +|type | string | true | NA | 划转类型| 从合约账户到现货账户:“futures-to-pro”,从现货账户到合约账户: “pro-to-futures”| + + +> Response: + +```json +{ + "data": 12345 + "status": "ok" +} +``` + +### 响应数据 + +参数名称 | 数据类型 | 描述 +------ | ------- | ----- +data | Long | Transfer id +status |string| "ok" or "error" +err-code|string|错误码,具体错误码请见列表 +err-msg|string|错误消息,具体消息内容请列表 + +### err-code列表 + +err-code | err-msg(中文) | err-msg(Englis)|补充说明 +------ | ------- | -----|------------- +|base-msg|||其他错误,具体的err-msg, 请参照对应的错误消息列表。 +|base-currency-error|币种无效|The currency is invalid| +|frequent-invoke|操作过于频繁,请稍后重试。(如果超过1分钟10次,系统返回该error-code)|the operation is too frequent. Please try again later|如果请求次数超过1分钟10次,系统返回该error-code +|banned-by-blacklist|黑名单限制|Blacklist restriction| +|dw-insufficient-balance|可划转余额不足,最大可划转 {0}。(币币账户的余额不足。)|Insufficient balance. You can only transfer {0} at most.|币币账户的余额不足。 +|dw-account-transfer-unavailable|转账暂时不可用|account transfer unavailable|该接口暂时不可用 +|dw-account-transfer-error|由于其他服务不可用导致的划转失败|account transfer error| +|dw-account-transfer-failed|划转失败。请稍后重试或联系客服 |Failed to transfer. Please try again later.|由于系统异常导致的划转失败 +|dw-account-transfer-failed-account-abnormality|账户异常,划转失败。请稍后重试或联系客服|Account abnormality, failed to transfer。Please try again later.| + +### base-msg对应的err-msg列表 +err-code | err-msg(中文) | err-msg(Englis)|补充说明 +------ | ------- | -----|------------- +|base-msg|用户没有入金权限|Unable to transfer in currently. Please contact customer service.| +|base-msg|用户没有出金权限|Unable to transfer out currently. Please contact customer service.| +|base-msg|合约状态异常,无法出入金|Abnormal contracts status. Can’t transfer.| +|base-msg|子账号没有入金权限,请联系客服|Sub-account doesn't own the permissions to transfer in. Please contact customer service.| +|base-msg|子账号没有出金权限,请联系客服|Sub-account doesn't own the permissions to transfer out. Please contact customer service.| +|base-msg|子账号没有划转权限,请登录主账号授权|The sub-account does not have transfer permissions. Please login main account to authorize.| +|base-msg|可划转余额不足|Insufficient amount available.|合约账户的余额不足 +|base-msg|单笔转出的数量不能低于{0}{1}|The single transfer-out amount must be no less than {0}{1}.| +|base-msg|单笔转出的数量不能高于{0}{1}|The single transfer-out amount must be no more than {0}{1}.| +|base-msg|单笔转入的数量不能低于{0}{1}|The single transfer-in amount must be no less than {0}{1}.| +|base-msg|单笔转入的数量不能高于{0}{1}|The single transfer-in amount must be no more than {0}{1}.| +|base-msg|您当日累计转出量超过{0}{1},暂无法转出|Your accumulative transfer-out amount is over the daily maximum, {0}{1}. You can't transfer out for the time being.| +|base-msg|您当日累计转入量超过{0}{1},暂无法转入|Your accumulative transfer-in amount is over the daily maximum, {0}{1}. You can't transfer in for the time being.| +|base-msg|您当日累计净转出量超过{0}{1},暂无法转出|Your accumulative net transfer-out amount is over the daily maximum, {0}{1}. You can't transfer out for the time being.| +|base-msg|您当日累计净转入量超过{0}{1},暂无法转入|Your accumulative net transfer-in amount is over the daily maximum, {0}{1}. You can't transfer in for the time being.| +|base-msg|超过平台当日累计最大转出量限制,暂无法转出|The platform's accumulative transfer-out amount is over the daily maximum. You can't transfer out for the time being.| +|base-msg|超过平台当日累计最大转入量限制,暂无法转入|The platform's accumulative transfer-in amount is over the daily maximum. You can't transfer in for the time being.| +|base-msg|超过平台当日累计最大净转出量限制,暂无法转出|The platform's accumulative net transfer-out amount is over the daily maximum. You can't transfer out for the time being.| +|base-msg|超过平台当日累计最大净转入量限制,暂无法转入|The platform's accumulative net transfer-in amount is over the daily maximum. You can't transfer in for the time being.| +|base-msg|划转失败,请稍后重试或联系客服|Transfer failed. Please try again later or contact customer service.| +|base-msg|服务异常,划转失败,请稍后再试|Abnormal service, transfer failed. Please try again later.| +|base-msg|您尚未开通合约交易,无访问权限|You don’t have access permission as you have not opened contracts trading.| +|base-msg|合约品种不存在|This contract type doesn't exist.|没有相应币种的合约 + + # 借贷 From d49310917fc431d4ddf95f2ecf0e6f188e6d392b Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Wed, 15 May 2019 16:17:32 +0800 Subject: [PATCH 083/864] 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 a5305ec6da6..291770a966b 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -66,7 +66,7 @@ search: False [GET /v1/order/orders/{order-id}/matchresults](#56c6c47284) |查询某个订单的成交明细| [GET /v1/account/accounts](#bd9157656f) |查询当前用户的所有账户| [GET /v1/account/accounts/{account-id}/balance](#870c0ab88b) |查询指定账户的余额| -[POST /v1/futures/transfer](#870c0ab88b) |币币与合约账户间的资金划转| +[POST /v1/futures/transfer](#e227a2a3e8) |币币与合约账户间的资金划转| From 7428da32a9c8eb6155ac15ad399144a3a8aa44eb Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 23 May 2019 18:27:59 +0800 Subject: [PATCH 084/864] Update index.html.md --- source/index.html.md | 1051 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 1049 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 291770a966b..10239f013b3 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2574,9 +2574,1056 @@ Currency currency| true | string |- | 成分币名称或基金名称 | amount| true | double |- | 数量 | -# Websocket 订阅 +# Websocket行情数据 + +## 简介 + +### 接入URL + +**Global站行情请求地址** + +**`wss://api.huobi.pro/ws`** + +请使用中国大陆以外的服务器访问火币 API + +### 数据压缩 + +WebSocket API 返回的所有数据都进行了 GZIP 压缩,需要 client 在收到数据之后解压。 + +### 心跳消息 + +当用户的Websocket客户端连接到火币Websocket服务器后,服务器会定期(当前设为5秒)向其发送`ping`消息并包含一整数值如下: + +> {"ping": 1492420473027} + +当用户的Websocket客户端接收到此心跳消息后,应返回`pong`消息并包含同一整数值: + +> {"pong": 1492420473027} + + + +### 订阅主题 + +成功建立与Websocket服务器的连接后,Websocket客户端发送如下请求以订阅特定主题: + +```json +{ + "sub": "market.btccny.kline.1min", + "id": "id1" +} +``` + +{ + "sub": "topic to sub", + "id": "id generate by client" +} + +成功订阅后,Websocket客户端将收到确认: + +```json +{ + "id": "id1", + "status": "ok", + "subbed": "market.btccny.kline.1min", + "ts": 1489474081631 +} +``` + +之后, 一旦所订阅的主题有更新,Websocket客户端将收到服务器推送的更新消息(push): + +```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 + } +} +``` + +### 取消订阅 + +取消订阅的格式如下: + +```json +{ + "unsub": "market.btccny.trade.detail", + "id": "id4" +} +``` + +{ + "unsub": "topic to unsub", + "id": "id generate by client" +} + +取消订阅成功确认: + +```json +{ + "id": "id4", + "status": "ok", + "unsubbed": "market.btccny.trade.detail", + "ts": 1494326028889 +} +``` + +### 请求数据 + +Websocket服务器同时支持一次性请求数据(pull)。 + +请求数据的格式如下: + +```json +{ + "req": "market.ethbtc.kline.1min", + "id": "id10" +} +``` + +{ + "req": "topic to req", + "id": "id generate by client" +} + +一次性返回的数据: + +```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 + } + ] +} +``` + +## K线数据 + +### 主题订阅 + +一旦K线数据产生,Websocket服务器将通过此订阅主题接口推送至客户端: + +`market.$symbol$.kline.$period$` + +> 订阅请求 + +```json +{ + "sub": "market.ethbtc.kline.1min", + "id": "id1" +} +``` + +### 参数 + +参数 | 数据类型 | 是否必需 | 描述 | 取值范围 +--------- | --------- | -------- | ----------- | ----------- +symbol | string | true | 交易代码 | All supported trading symbols, e.g. btcusdt, bccbtc +period | string | true | K线周期 | 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 + } +} +``` + +### 数据更新字段列表 + +字段 | 数据类型 | 描述 +--------- | --------- | ----------- +id | integer | unix时间,同时作为K线ID +amount | float | 成交量 +count | integer | 成交笔数 +open | float | 开盘价 +close | float | 收盘价(当K线为最晚的一根时,是最新成交价) +low | float | 最低价 +high | float | 最高价 +vol | float | 成交额, 即 sum(每一笔成交价 * 该笔的成交量) + + + +### 数据请求 + +用请求方式一次性获取K线数据需要额外提供以下参数: + +```json +{ + "req": "market.$symbol.kline.$period", + "id": "id generated by client", + "from": "from time in epoch seconds", + "to": "to time in epoch seconds" +} +``` + +参数 | 数据类型 | 是否必需 | 缺省值 | 描述 | 取值范围 +--------- | --------- | -------- | ------------- | ----------- | ----------- +from | integer | false | 1501174800(2017-07-28T00:00:00+08:00) | 起始时间 (epoch time in second) | [1501174800, 2556115200] +to | integer | false | 2556115200(2050-01-01T00:00:00+08:00) | 结束时间 (epoch time in second) | [1501174800, 2556115200] or ($from, 2556115200] if "from" is set + +## 市场深度行情数据 + +当市场深度发生变化时,此主题发送最新市场深度更新数据。 + +### 主题订阅 + +`market.$symbol.depth.$type` + +> Subscribe request + +```json +{ + "sub": "market.btcusdt.depth.step0", + "id": "id1" +} +``` + +### 参数 + +参数 | 数据类型 | 是否必需 | 缺省值 | 描述 | 取值范围 +--------- | --------- | -------- | ------------- | ----------- | ----------- +symbol | string | true | NA | 交易代码 | All supported trading symbols, e.g. btcusdt, bccbtc +type | string | true | step0 | 合并深度类型 | step0, step1, step2, step3, step4, step5 + +**"type" 合并深度类型** + +Value | Description +--------- | --------- +step0 | 不合并深度 +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 + ] + } +} +``` + +### 数据更新字段列表 + + + +字段 | 数据类型 | 描述 +--------- | --------- | ----------- +bids | object | The current all bids in format [price, quote volume] +asks | object | The current all asks in format [price, quote volume] + + + +### 数据请求 + +支持数据请求方式一次性获取市场深度数据: + +```json +{ + "req": "market.btcusdt.depth.step0", + "id": "id10" +} +``` + +## 成交明细 + +### 主题订阅 + +此主题提供市场最新成交明细。 + +`market.$symbol.trade.detail` + +> Subscribe request + +```json +{ + "sub": "market.btcusdt.trade.detail", + "id": "id1" +} +``` + +### 参数 + +参数 | 数据类型 | 是否必需 | 缺省值 | 描述 | 取值范围 +--------- | --------- | -------- | ------------- | ----------- | ----------- +symbol | string | true | NA | 交易代码 | 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 + ] + } +} +``` + +### 数据更新字段列表 + +字段 | 数据类型 | 描述 +--------- | --------- | ----------- +id | integer | 唯一成交ID +amount | float | 成交量 +price | float | 成交价 +ts | integer | 成交时间 (UNIX epoch time in millisecond) +direction | string | 成交主动方 (taker的订单方向) : 'buy' or 'sell' + +### 数据请求 + +支持数据请求方式一次性获取成交明细数据: + +```json +{ + "req": "market.btcusdt.trade.detail", + "id": "id11" +} +``` + +## 市场概要 + +### 主题订阅 + +此主题提供24小时内最新市场概要。 + +`market.$symbol.detail` + +> Subscribe request + +```json +{ + "sub": "market.btcusdt.detail", + "id": "id1" +} +``` + +### 参数 + +参数 | 数据类型 | 是否必需 | 缺省值 | 描述 | 取值范围 +--------- | --------- | -------- | ------------- | ----------- | ----------- +symbol | string | true | NA | 交易代码 | 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 + } +``` + +### 数据更新字段列表 + +字段 | 数据类型 | 描述 +--------- | --------- | ----------- +id | integer | unix时间,同时作为消息ID +ts | integer | unix系统时间 +amount | float | 24小时成交量 +count | integer | 24小时成交笔数 +open | float | 24小时开盘价 +close | float | 最新价 +low | float | 24小时最低价 +high | float | 24小时最高价 +vol | float | 24小时成交额 + +### 数据请求 + +支持数据请求方式一次性获取市场概要数据: + +```json +{ + "req": "market.btcusdt.detail", + "id": "id11" +} +``` + +# Websocket资产及订单 + +## 简介 + +### 接入URL + +**Websocket资产及订单** + +**`wss://api.huobi.pro/ws/v1`** + +请使用中国大陆以外的服务器访问火币 API。 + +### 数据压缩 + +WebSocket API 返回的所有数据都进行了 GZIP 压缩,需要 client 在收到数据之后解压。 + +### 心跳消息 + +当用户的Websocket客户端连接到火币Websocket服务器后,服务器会定期(当前设为5秒)向其发送`ping`消息并包含一整数值如下: + +> {"ping": 1492420473027} + +当用户的Websocket客户端接收到此心跳消息后,应返回`pong`消息并包含同一整数值: + +> {"pong": 1492420473027} + + + +### 订阅主题 + +成功建立与Websocket服务器的连接后,Websocket客户端发送如下请求以订阅特定主题: + +```json +{ + "op": "operation type, 'sub' for subscription, 'unsub' for unsubscription", + "topic": "topic to sub", + "cid": "id generate by client" +} +``` + +成功订阅后,Websocket客户端将收到确认: + +```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 +} +``` + +之后, 一旦所订阅的主题有更新,Websocket客户端将收到服务器推送的更新消息(push): + +```json +{ + "op": "notify", + "topic": "topic of this notify", + "ts": 1489474082831, + "data": { + // data of specific topic update + } +} +``` + +### 取消订阅 + +取消订阅的格式如下: + +```json +{ + "op": "unsub", + "topic": "accounts", + "cid": "client generated id" +} +``` + +取消订阅成功确认: + +```json +{ + "op": "unsub", + "topic": "accounts", + "cid": "id generated by client", + "err-code": 0, + "ts": 1489474081631 +} +``` + +### 请求数据 + +Websocket服务器同时支持一次性请求数据(pull)。 + +当与Websocket服务器成功建立连接后,以下三个主题可供用户请求: + +* accounts.list +* orders.list +* orders.detail + +具体请求方式请见后文。 + +**数据请求限频规则** + +限频规则基于API key而不是连接。当请求频率超出限值时,Websocket客户端将收到"too many request"错误码。以下为各主题当前限频设定: + +* accounts.list: once every 25 seconds +* orders.list AND orders.detail: once every 5 seconds + +### 鉴权 + +资产及订单主题鉴权请求数据格式如下: + +```json +{ + "op": "auth", + "AccessKeyId": "e2xxxxxx-99xxxxxx-84xxxxxx-7xxxx", + "SignatureMethod": "HmacSHA256", + "SignatureVersion": "2", + "Timestamp": "2017-05-11T15:19:30", + "Signature": "4F65x5A2bLyMWVQj3Aqp+B4w+ivaA7n5Oi2SuYtCJ9o=", +} +``` + +**鉴权请求数据格式说明** + + filed |type | instruction| + ------------------ |---- | ----------------------------------------------------- + op |string | 必填;操作名称,鉴权固定值为 auth; + cid |string | 选填;Client 请求唯一 ID + AccessKeyId |string | 必填;API 访问密钥, 您申请的 APIKEY 中的 AccessKey + SignatureMethod |string | 必填;签名方法, 用户计算签名的基于哈希的协议,此处使用 HmacSHA256 + SignatureVersion |string | 必填;签名协议的版本,此处使用 2 + Timestamp |string | 必填;时间戳, 您发出请求的时间 (UTC 时区) (UTC 时区) (UTC 时区) 。在查询请求中包含此值有助于防止第三方截取您的请求。如:2017-05-11T16:22:06。再次强调是 (UTC 时区) + Signature |string |必填;签名, 计算得出的值,用于确保签名有效和未被篡改 + +> **注:** +> - 参考[https://huobiapi.github.io/docs/v1/cn/#c64cd15fdc] 生成有效签名 +> - 签名计算中请求方法固定值为`GET` + +## 订阅账户更新 + +订阅账户资产变动更新。 + +### 主题订阅 + +`accounts` + +> Subscribe request + +```json +{ + "op": "sub", + "cid": "40sG903yz80oDFWr", + "topic": "accounts", + "model": "0" +} +``` + +### 参数 + +参数 | 数据类型 | 是否必需 | 缺省值 | 描述 | 取值范围 +--------- | --------- | -------- | ------------- | ----------- | ----------- +model | string | false | 0 | 是否包含已冻结余额 | 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" + } + ] + } +} + +``` + +### 数据更新字段列表 + +字段 | 数据类型 | 描述 +--------- | --------- | ----------- +event | string | 资产变化通知相关事件说明,比如订单创建(order.place) 、订单成交(order.match)、订单成交退款(order.refund)、订单撤销(order.cancel) 、点卡抵扣交易手续费(order.fee-refund)、杠杆账户划转(margin.transfer)、借贷本金(margin.loan)、借贷计息(margin.interest)、归还借贷本金利息(margin.repay)、其他资产变化(other) +account-id| integer | 账户 id +currency | string | 币种 +type | string | 账户类型, 交易子账户(trade),借贷子账户(loan),利息子账户(interest) +balance | string | 账户余额 (当订阅mode=0时,该余额为可用余额;当订阅mode=1时,该余额为总余额) + +## 订阅订单更新 + +订阅账户下的订单更新。 + +### 主题订阅 + +`orders.$symbol` + +> Subscribe request + +```json +{ + "op": "sub", + "cid": "40sG903yz80oDFWr", + "topic": "orders.htusdt", +} +``` + +### 参数 + +参数 | 数据类型 | 是否必需 | 缺省值 | 描述 | 取值范围 +--------- | --------- | -------- | ------------- | ----------- | ----------- +symbol | string | true | NA | 交易代码 | 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" + } +} +``` + +### 数据更新字段列表 + +字段 | 数据类型 | 描述 +--------- | --------- | ----------- +seq-id | integer | 流水号(不连续) +order-id | integer | 订单 id +symbol | string | 交易对 +account-id | string | 账户 id +order-amount | string | 订单数量 +order-price | string | 订单价格 +created-at | int | 订单创建时间 (UNIX epoch time in millisecond) +order-type | string | 订单类型, 有效取值: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker +order-source | string | 订单来源, 有效取值: sys, web, api, app +order-state | string | 订单状态, 有效取值: submitted, partical-filled, cancelling, filled, canceled, partial-canceled +role | string | 成交角色: taker or maker +price | string | 成交价格 +filled-amount | string | 单次成交数量 +filled-cash-amount | string | 单次未成交数量 +filled-fees | string | 单次成交金额 +unfilled-amount | string | 单次成交手续费(买入为币,卖出为钱) + +## 订阅订单更新 (NEW) + +相比现有用户订单更新推送主题“orders.$symbol”, 新增主题“orders.$symbol.update”拥有更低的数据延迟以及更准确的消息顺序。建议API用户订阅此新主题接收订单更新推送,以替代现有订阅主题 “orders.$symbol”。(现有订阅主题 “orders.$symbol”仍将在Websocket API服务中被保留直至另行通知。) + +### 主题订阅 + +`orders.$symbol.update` + +> Subscribe request + +```json +{ + "op": "sub", + "cid": "40sG903yz80oDFWr", + "topic": "orders.htusdt.update" +} +``` + +### 参数 + +参数 | 数据类型 | 是否必需 | 缺省值 | 描述 | 取值范围 +--------- | --------- | -------- | ------------- | ----------- | ----------- +symbol | string | true | NA | 交易代码 | 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" + } +} +``` + +### 数据更新字段列表 + +Field | Data Type | Description +--------- | --------- | ----------- +match-id | integer | 最近撮合编号(当order-state = submitted, canceled, partial-canceled时,match-id 为消息序列号;当order-state = filled, partial-filled 时,match-id 为最近撮合编号。) +order-id | integer | 订单编号 +symbol | string | 交易代码 +order-state | string | 订单状态, 有效取值: submitted, partical-filled, cancelling, filled, canceled, partial-canceled +role | string | 最近成交角色(当order-state = submitted, canceled, partial-canceled时,role 为缺省值taker;当order-state = filled, partial-filled 时,role 取值为taker 或maker。) +price | string | 最新价(当order-state = submitted 时,price 为订单价格;当order-state = canceled, partial-canceled 时,price 为零;当order-state = filled, partial-filled 时,price 为最近成交价。当role = taker,且该订单同时与多张对手方订单撮合时,price 为多笔成交均价。) +filled-amount | string | 最近成交数量 +filled-cash-amount | string | 最近成交数额 +unfilled-amount | string | 最近未成交数量(当order-state = submitted 时,unfilled-amount 为原始订单量;当order-state = canceled OR partial-canceled 时,unfilled-amount 为未成交数量;当order-state = filled 时,如果 order-type = buy-market,unfilled-amount 可能为一极小值;如果order-type <> buy-market 时,unfilled-amount 为零;当order-state = partial-filled AND role = taker 时,unfilled-amount 为未成交数量;当order-state = partial-filled AND role = maker 时,unfilled-amount 为零。(后续将支持此场景下的未成交量,时间另行通知。)) + + +## 请求用户资产数据 + +查询当前用户的所有账户余额数据。 + +### 数据请求 + +`accounts.list` + +> Query request + +```json +{ + "op": "req", + "cid": "40sG903yz80oDFWr", + "topic": "accounts.list", +} +``` + +### 返回 + +> 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 + } +``` + +## 请求当前及历史订单 + +根据设定条件查询当前委托、历史委托。 + +### 数据请求 + +`order.list` + +> Query request + +```json +{ + "op": "req", + "topic": "orders.list", + "cid": "40sG903yz80oDFWr", + "symbol": "htusdt", + "states": "submitted,partial-filled" +} +``` + +### 参数 + +Parameter | Data Type | Required | Default | Description | Value Range +--------- | --------- | -------- | ------- | ----------- | ---------- +account-id | int | true | NA | 账户 id | NA +symbol | string | true | NA | 交易对 | All supported trading symbols, e.g. btcusdt, bccbtc +types | string | false | NA | 查询的订单类型组合,使用','分割 | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc +states | string | false | NA | 查询的订单状态组合,使用','分割 | submitted, partial-filled, partial-canceled, filled, canceled +start-date | string | false | -61d | 查询开始日期, 日期格式yyyy-mm-dd | NA +end-date | string | false | today | 查询结束日期, 日期格式yyyy-mm-dd | NA +from | string | false | NA | 查询起始 ID | NA +direct | string | false | next | 查询方向 | next, prev +size | int | false | 100 | 查询记录大小 | [1, 100] + +### 返回 + +> 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 + } + ] +} +``` + +## 以订单编号请求订单 + +以订单编号请求订单数据 + +### 数据请求 + +`order.detail` + +> Query request + +```json +{ + "op": "req", + "topic": "orders.detail", + "order-id": "2039498445", + "cid": "40sG903yz80oDFWr" +} +``` + +### 参数 + +参数 | 数据类型 | 是否必需 | 缺省值 | 描述 | 取值范围 +--------- | --------- | -------- | ------- | ----------- | ---------- +order-id | string | true | NA | Order id | NA + +### 返回 + +> 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 + } +} +``` - - Websocket 文档
From 2cf210fbb464fb5a094a62112298820347be49a1 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 24 May 2019 16:00:12 +0800 Subject: [PATCH 085/864] 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 10239f013b3..c38d59d425b 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2969,7 +2969,7 @@ direction | string | 成交主动方 (taker的订单方向) : 'buy' or 'sell' ### 数据请求 -支持数据请求方式一次性获取成交明细数据: +支持数据请求方式一次性获取成交明细数据(仅能获取最多最近300个成交记录): ```json { From 266e37b737a024138ee63498a63b328f17d04658 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 24 May 2019 16:36:17 +0800 Subject: [PATCH 086/864] Update index.html.md --- source/index.html.md | 56 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index c38d59d425b..6d7b354c50a 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3439,6 +3439,13 @@ unfilled-amount | string | 最近未成交数量(当order-state = submi "topic": "accounts.list", } ``` +成功建立和 WebSocket API 的连接之后,向 Server发送如下格式的数据来查询账户数据: + +字段名称 | 类型 | 说明| +----------| --------| -------------------------------------------------------| +op |string | 必填;操作名称,固定值为 req;| +cid |string | 选填;Client 请求唯一 ID| +topic |string |必填;固定值为accounts.list,详细主题列表请参考附录;| ### 返回 @@ -3525,7 +3532,7 @@ unfilled-amount | string | 最近未成交数量(当order-state = submi ### 参数 -Parameter | Data Type | Required | Default | Description | Value Range +参数 | 数据类型 | 是否必需 | 缺省值 | 描述 | 取值范围 --------- | --------- | -------- | ------- | ----------- | ---------- account-id | int | true | NA | 账户 id | NA symbol | string | true | NA | 交易对 | All supported trading symbols, e.g. btcusdt, bccbtc @@ -3537,7 +3544,7 @@ from | string | false | NA | 查询起始 ID | direct | string | false | next | 查询方向 | next, prev size | int | false | 100 | 查询记录大小 | [1, 100] -### 返回 +### 数据更新字段列表 > Successful @@ -3569,6 +3576,24 @@ size | int | false | 100 | 查询记录大小 | } ``` +名称 |数据类型 | 描述| +-------------------- |--------| ------------------------------------| +id |long | 订单ID| +symbol |string |交易对| +account-id |long |账户ID| +amount |string |订单数量| +price |string |订单价格| +created-at |long |订单创建时间| +type |string |订单类型,请参考订单类型说明| +filled-amount |string |已成交数量| +filled-cash-amount |string |已成交总金额| +filled-fees |string |已成交手续费| +finished-at |string |最后成交时间| +source |string |订单来源,请参考订单来源说明| +state |string |订单状态,请参考订单状态说明| +cancel-at |long |撤单时间| + + ## 以订单编号请求订单 以订单编号请求订单数据 @@ -3590,9 +3615,13 @@ size | int | false | 100 | 查询记录大小 | ### 参数 -参数 | 数据类型 | 是否必需 | 缺省值 | 描述 | 取值范围 ---------- | --------- | -------- | ------- | ----------- | ---------- -order-id | string | true | NA | Order id | NA +参数 | 是否必需 | 数据类型 | 描述 | 缺省值 | 取值范围| +----------| ----------| --------| ------------------------------------------------ |--------| ----------| +op |true |string |操作名称,固定值为 req ||| +cid |true |string |Client 请求唯一 ID ||| +topic |false |string |固定值为 orders.detail,详细主题列表请参考附录 ||| +order-id |true |string |订单ID ||| + ### 返回 @@ -3623,7 +3652,22 @@ order-id | string | true | NA | Order id | NA } } ``` - +名称 |数据类型 | 描述| +-------------------- |--------| ------------------------------------| +id |long | 订单ID| +symbol |string |交易对| +account-id |long |账户ID| +amount |string |订单数量| +price |string |订单价格| +created-at |long |订单创建时间| +type |string |订单类型,请参考订单类型说明| +filled-amount |string |已成交数量| +filled-cash-amount |string |已成交总金额| +filled-fees |string |已成交手续费| +finished-at |string |最后成交时间| +source |string |订单来源,请参考订单来源说明| +state |string |订单状态,请参考订单状态说明| +cancel-at |long |撤单时间|
From b532e3f10fd2d5b032a8b9fa33f6868ebb0c9f73 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 24 May 2019 16:53:09 +0800 Subject: [PATCH 087/864] 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 6d7b354c50a..fbaa43c8c75 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3652,7 +3652,7 @@ order-id |true |string |订单ID ||| } } ``` -名称 |数据类型 | 描述| +字段 |数据类型 | 描述| -------------------- |--------| ------------------------------------| id |long | 订单ID| symbol |string |交易对| From 60d446d829534f497cefe55f7866d855cb17ee3a Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 24 May 2019 16:57:13 +0800 Subject: [PATCH 088/864] 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 fbaa43c8c75..34d65c72a06 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3619,7 +3619,7 @@ cancel-at |long |撤单时间| ----------| ----------| --------| ------------------------------------------------ |--------| ----------| op |true |string |操作名称,固定值为 req ||| cid |true |string |Client 请求唯一 ID ||| -topic |false |string |固定值为 orders.detail,详细主题列表请参考附录 ||| +topic |false |string |固定值为 orders.detail ||| order-id |true |string |订单ID ||| From 9e5c75d2953eb68fe742f6b8ab3eac1e012bd47b Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 24 May 2019 17:02:18 +0800 Subject: [PATCH 089/864] 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 34d65c72a06..da517c4cf09 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3576,7 +3576,7 @@ size | int | false | 100 | 查询记录大小 | } ``` -名称 |数据类型 | 描述| +字段 |数据类型 | 描述| -------------------- |--------| ------------------------------------| id |long | 订单ID| symbol |string |交易对| From c9b67101c5c4194fd3cf8a731cc442a37e73c944 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 24 May 2019 17:15:47 +0800 Subject: [PATCH 090/864] Update index.html.md --- source/index.html.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index da517c4cf09..5df86a61ab4 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3510,6 +3510,16 @@ topic |string |必填;固定值为accounts.list,详细主题列表请 } ``` +字段 |数据类型 | 描述| +-------------------- |--------| ------------------------------------| +{ id |long | 账户ID| +type |string |账户类型| +state |string |账户状态| +list |string |账户列表| +{currency |string |子账户资产| +type |string |子账户类型| +balance }} |string |子账户余额| + ## 请求当前及历史订单 根据设定条件查询当前委托、历史委托。 From 486c0c8a0d9dac39b31ea9c072d2a4dada7ae9d2 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 24 May 2019 17:17:21 +0800 Subject: [PATCH 091/864] 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 5df86a61ab4..3211988fe3c 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3516,7 +3516,7 @@ topic |string |必填;固定值为accounts.list,详细主题列表请 type |string |账户类型| state |string |账户状态| list |string |账户列表| -{currency |string |子账户资产| +{currency |string |子账户币种| type |string |子账户类型| balance }} |string |子账户余额| From f473703f8ee8c2375bcc93de2d5dc7d1fad7a96b Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 24 May 2019 17:37:49 +0800 Subject: [PATCH 092/864] 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 3211988fe3c..fc9ec0b3a45 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3441,7 +3441,7 @@ unfilled-amount | string | 最近未成交数量(当order-state = submi ``` 成功建立和 WebSocket API 的连接之后,向 Server发送如下格式的数据来查询账户数据: -字段名称 | 类型 | 说明| +字段 | 数据类型 | 描述| ----------| --------| -------------------------------------------------------| op |string | 必填;操作名称,固定值为 req;| cid |string | 选填;Client 请求唯一 ID| From c09bdeabf14dbb57fe757e8ddc02ac132417b625 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 24 May 2019 17:42:18 +0800 Subject: [PATCH 093/864] Update index.html.md --- 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 fc9ec0b3a45..a01f2b2d13f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3441,11 +3441,11 @@ unfilled-amount | string | 最近未成交数量(当order-state = submi ``` 成功建立和 WebSocket API 的连接之后,向 Server发送如下格式的数据来查询账户数据: -字段 | 数据类型 | 描述| +参数 | 数据类型 | 描述| ----------| --------| -------------------------------------------------------| -op |string | 必填;操作名称,固定值为 req;| +op |string | 必填;操作名称,固定值为 req| cid |string | 选填;Client 请求唯一 ID| -topic |string |必填;固定值为accounts.list,详细主题列表请参考附录;| +topic |string |必填;固定值为accounts.list| ### 返回 From 19a10209675784f2ee22f49302e2afac49235a97 Mon Sep 17 00:00:00 2001 From: "Rain@Huobi" Date: Wed, 29 May 2019 21:29:04 +0800 Subject: [PATCH 094/864] Update index.html.md --- source/index.html.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index a01f2b2d13f..27a2187772f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.06.10 00:00| - GET /v1/order/orders;- GET /v1/order/matchresults |修改|查询窗口调整为48小时,可查询整体时间范围不变| |2019.05.15 10:00| - POST /v1/futures/transfer |新增|提供币币与合约账户间的资金划转| |2019.04.29 19:00| - GET /v1/order/history |新增|新增最近48小时内历史订单查询节点。新节点的上线后,现有订单查询节点“GET /v1/order/orders”仍将被保留。然而,新节点“GET /v1/order/history”被赋予更高服务等级。极端情况下,当服务荷载超过系统既定阈值时,节点“GET /v1/order/orders”的服务可能会不可用,而新节点“GET /v1/order/history”仍将继续提供服务。另外,火币正在计划支持另一个新节点专门用于用户48小时外的历史订单查询。此新节点上线的同时,现有节点“GET /v1/order/orders”将被弃用。火币将及时告知用户这一变更,一旦变更时间确定。| |2019.04.17 10:00| - GET /v1/order/orders |修改|文档优化,增加Start-date限制说明| @@ -1758,8 +1759,8 @@ state | string | 订单状态,包括submitted, partical-fille | ---------- | ----- | ------ | ------ | ---- | ---- | | symbol | true | string | 交易对 | |btcusdt, ethbtc, rcneth ... | | types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | -| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | -180 days | [-180 days, end-date] | -| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | today | [start-date, today] | +| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | -180 days | [-180 days, end-date] (自6月10日起, start-date与end-date的查询窗口最大为2天,如果超出范围,接口会返回错误码。 | +| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | today | [start-date, today] (自6月10日起, start-date与end-date的查询窗口最大为2天,如果超出范围,接口会返回错误码。 | | states | true | string | 查询的订单状态组合,使用','分割 | | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | | from | false | string | 查询起始 ID | | | | direct | false | string | 查询方向 | | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | @@ -1814,6 +1815,13 @@ state | string | 订单状态,包括submitted, partical-fille | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | submit-cancel:已提交撤单申请 ,buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +### start-date, end-date相关错误码 (自6月10日生效) +|错误码|对应错误场景| +|------------|----------------------------------------------| +|invalid_interval| start date小于end date; 或者 start date 与end date之间的时间间隔大于2天| +|invalid_start_date|start date是一个180天之前的日期;或者start date是一个未来的日期| +|invalid_end_date|end date 是一个180天之前的日期;或者end date是一个未来的日期| + ## 搜索最近48小时内历史订单 此接口基于搜索条件查询最近48小时内历史订单。 From f4493196f14a0e350287164d0f184b4539d19753 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Wed, 29 May 2019 21:36:46 +0800 Subject: [PATCH 095/864] Update index.html.md --- source/index.html.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 27a2187772f..1e60392c469 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1816,12 +1816,14 @@ state | string | 订单状态,包括submitted, partical-fille | type | true | string | 订单类型 | submit-cancel:已提交撤单申请 ,buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | ### start-date, end-date相关错误码 (自6月10日生效) + |错误码|对应错误场景| |------------|----------------------------------------------| |invalid_interval| start date小于end date; 或者 start date 与end date之间的时间间隔大于2天| |invalid_start_date|start date是一个180天之前的日期;或者start date是一个未来的日期| |invalid_end_date|end date 是一个180天之前的日期;或者end date是一个未来的日期| + ## 搜索最近48小时内历史订单 此接口基于搜索条件查询最近48小时内历史订单。 From 3bc5594f6a2756642b93c4c846ff35461ac62102 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Thu, 30 May 2019 17:51:13 +0800 Subject: [PATCH 096/864] Update index.html.md --- source/index.html.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 1e60392c469..724734b5faf 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1916,8 +1916,8 @@ state | string | 订单状态,包括submitted, partical-fille | ---------- | ----- | ------ | ------ | ---- | ----------- | | symbol | true | string | 交易对 | NA | btcusdt, ethbtc, rcneth ... | | types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | -| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | -61 days | [-61day, today] | -| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | today | [start-date, today] | +| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | -61 days | [-61day, today] (自6月10日起, start-date与end-date的查询窗口最大为2天,如果超出范围,接口会返回错误码。 || +| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | today | [start-date, today] (自6月10日起, start-date与end-date的查询窗口最大为2天,如果超出范围,接口会返回错误码。 | | | from | false | string | 查询起始 ID | 订单成交记录ID(最大值) | | | direct | false | string | 查询方向 | 默认 next, 成交记录 ID 由大到小排序 | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | | size | false | string | 查询记录大小 | 100 | [1,100] | @@ -1962,6 +1962,15 @@ state | string | 订单状态,包括submitted, partical-fille | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +### start-date, end-date相关错误码 (自6月10日生效) + +|错误码|对应错误场景| +|------------|----------------------------------------------| +|invalid_interval| start date小于end date; 或者 start date 与end date之间的时间间隔大于2天| +|invalid_start_date|start date是一个61天之前的日期;或者start date是一个未来的日期| +|invalid_end_date|end date 是一个61天之前的日期;或者end date是一个未来的日期| + + ## 币币现货账户与合约账户划转 此接口用户币币现货账户与合约账户之间的资金划转。 From 9758964ca15382171e702c077f28998908ed59cf Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Tue, 4 Jun 2019 21:47:33 +0800 Subject: [PATCH 097/864] Update index.html.md --- source/index.html.md | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 724734b5faf..473e6d11350 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -934,8 +934,9 @@ version | integer | 内部数据 -## 账户信息 +## 账户信息 +API Key 权限:查询 查询当前用户的所有账户 ID `account-id` 及其相关信息 ### HTTP 请求 @@ -985,6 +986,7 @@ version | integer | 内部数据 ## 账户余额 +API Key 权限:查询 查询指定账户的余额,支持以下账户: spot:现货账户, margin:杠杆账户,otc:OTC 账户,point:点卡账户 @@ -1043,6 +1045,7 @@ list字段说明 ## 资产划转(母子账号之间) +API Key 权限:交易 母账户执行母子账号之间的划转 ### HTTP 请求 @@ -1083,6 +1086,7 @@ base-operation-forbidden| 禁止操作(母子账号关系错误时报) |stri ## 子账号余额(汇总) +API Key 权限:查询 母账户查询其下所有子账号的各币种汇总余额 ### HTTP 请求 @@ -1132,6 +1136,7 @@ balance| 是| string| -| 子账号下该币种所有余额(可用余额和冻 ## 子账号余额 +API Key 权限:查询 母账户查询子账号各币种账户余额 ### HTTP 请求 @@ -1199,6 +1204,7 @@ balance|-|decimal|- |账户余额 |-| ## 虚拟币提现 +API Key 权限:充提 ### HTTP 请求 @@ -1244,7 +1250,7 @@ balance|-|decimal|- |账户余额 |-| ## 取消提现 - +API Key 权限:充提 ### HTTP 请求 @@ -1274,6 +1280,8 @@ balance|-|decimal|- |账户余额 |-| ## 充提记录 +API Key 权限:查询 +查询充提记录 ### HTTP 请求 @@ -1367,6 +1375,7 @@ balance|-|decimal|- |账户余额 |-| ## 下单 +API Key 权限:交易 发送一个新订单到火币以进行撮合。 ### HTTP 请求 @@ -1421,6 +1430,7 @@ source | string | false | api | 现货交易填写“api”,杠 ## 撤销订单 +API Key 权限:交易 此接口发送一个撤销订单的请求。 @@ -1453,6 +1463,7 @@ source | string | false | api | 现货交易填写“api”,杠 ## 查询当前未成交订单 +API Key 权限:查询 查询已提交但是仍未完全成交或未被撤销的订单。 ```json @@ -1524,6 +1535,7 @@ state | string | 订单状态,包括submitted, partical-fille ## 批量撤销订单(open orders) +API Key 权限:交易 此接口发送批量撤销订单的请求。 @@ -1568,6 +1580,7 @@ state | string | 订单状态,包括submitted, partical-fille ## 批量撤销订单 +API Key 权限:交易 此接口同时为多个订单(基于id)发送取消请求。 ### HTTP 请求 @@ -1617,6 +1630,7 @@ state | string | 订单状态,包括submitted, partical-fille ## 查询订单详情 +API Key 权限:查询 此接口返回指定订单的最新状态和详情。 ### HTTP 请求 @@ -1679,6 +1693,7 @@ state | string | 订单状态,包括submitted, partical-fille ## 成交明细 +API Key 权限:查询 此接口返回指定订单的成交明细。 ### HTTP 请求 @@ -1735,6 +1750,7 @@ state | string | 订单状态,包括submitted, partical-fille ## 搜索历史订单 +API Key 权限:查询 此接口基于搜索条件查询历史订单。 ### HTTP 请求 @@ -1826,6 +1842,7 @@ state | string | 订单状态,包括submitted, partical-fille ## 搜索最近48小时内历史订单 +API Key 权限:查询 此接口基于搜索条件查询最近48小时内历史订单。 ### HTTP 请求 @@ -1903,6 +1920,7 @@ state | string | 订单状态,包括submitted, partical-fille ## 当前和历史成交 +API Key 权限:查询 此接口基于搜索条件查询当前和历史成交记录。 ### HTTP 请求 @@ -1973,6 +1991,7 @@ state | string | 订单状态,包括submitted, partical-fille ## 币币现货账户与合约账户划转 +API Key 权限:交易 此接口用户币币现货账户与合约账户之间的资金划转。 从现货现货账户转至合约账户,类型为`pro-to-futures`; 从合约账户转至现货账户,类型为`futures-to-pro` @@ -2068,6 +2087,7 @@ err-code | err-msg(中文) | err-msg(Englis)|补充说明 ## 资产划转 +API Key 权限:交易 此接口用于现货账户与杠杆账户的资产互转。 从现货账户划转至杠杆账户 `transfer-in`,从杠杆账户划转至现货账户 `transfer-out` @@ -2114,6 +2134,7 @@ data | integer | Transfer id ## 申请借贷 +API Key 权限:交易 此接口用于申请借贷. ### HTTP 请求 @@ -2156,6 +2177,7 @@ data | integer | Margin order id ## 归还借贷 +API Key 权限:交易 此接口用于归还借贷. ### HTTP 请求 @@ -2195,6 +2217,7 @@ data | integer | Margin order id ## 查询借贷订单 +API Key 权限:查询 此接口基于指定搜索条件返回借贷订单。 ### HTTP 请求 @@ -2259,6 +2282,7 @@ data | integer | Margin order id ## 借贷账户详情 +API Key 权限:查询 此接口返回借贷账户详情。 ### HTTP 请求 @@ -2413,6 +2437,7 @@ amount| true | double |- | 成分币数量 | ## 换入换出 +API Key 权限:交易 用户可以通过该接口取得关于 ETF 换入(swap/in)换出(swap/out)的 基本信息,包括一次换入最小量,一次换入最大量,一次换出最小量,一次换出最大量,换入费率,换出费率,最新 ETF 换入换出状态,以及 ETF 的成分结构。 @@ -2472,6 +2497,7 @@ success | true| Boolean | - | 请求是否成功| true or false | ## 操作记录 +API Key 权限:查询 用户可以通过该接口取得关于 ETF 换入换出操 作的明细记录。最多返回 100 条记录。 @@ -3213,6 +3239,7 @@ Websocket服务器同时支持一次性请求数据(pull)。 ## 订阅账户更新 +API Key 权限:查询 订阅账户资产变动更新。 ### 主题订阅 @@ -3284,6 +3311,7 @@ balance | string | 账户余额 (当订阅mode=0时,该余额为可用余 ## 订阅订单更新 +API Key 权限:查询 订阅账户下的订单更新。 ### 主题订阅 @@ -3369,6 +3397,7 @@ unfilled-amount | string | 单次成交手续费(买入为币,卖出 ## 订阅订单更新 (NEW) +API Key 权限:查询 相比现有用户订单更新推送主题“orders.$symbol”, 新增主题“orders.$symbol.update”拥有更低的数据延迟以及更准确的消息顺序。建议API用户订阅此新主题接收订单更新推送,以替代现有订阅主题 “orders.$symbol”。(现有订阅主题 “orders.$symbol”仍将在Websocket API服务中被保留直至另行通知。) ### 主题订阅 @@ -3443,6 +3472,7 @@ unfilled-amount | string | 最近未成交数量(当order-state = submi ## 请求用户资产数据 +API Key 权限:查询 查询当前用户的所有账户余额数据。 ### 数据请求 @@ -3541,6 +3571,7 @@ balance }} |string |子账户余额| ## 请求当前及历史订单 +API Key 权限:查询 根据设定条件查询当前委托、历史委托。 ### 数据请求 @@ -3625,6 +3656,7 @@ cancel-at |long |撤单时间| ## 以订单编号请求订单 +API Key 权限:查询 以订单编号请求订单数据 ### 数据请求 From 59377eea3743198bed7c14f6fcbb7d5136c027b8 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Tue, 4 Jun 2019 22:10:41 +0800 Subject: [PATCH 098/864] Update index.html.md --- source/index.html.md | 72 +++++++++++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 473e6d11350..daa672f4721 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -936,7 +936,8 @@ version | integer | 内部数据 ## 账户信息 -API Key 权限:查询 +API Key 权限:读取 + 查询当前用户的所有账户 ID `account-id` 及其相关信息 ### HTTP 请求 @@ -986,7 +987,8 @@ API Key 权限:查询 ## 账户余额 -API Key 权限:查询 +API Key 权限:读取 + 查询指定账户的余额,支持以下账户: spot:现货账户, margin:杠杆账户,otc:OTC 账户,point:点卡账户 @@ -1046,6 +1048,7 @@ list字段说明 ## 资产划转(母子账号之间) API Key 权限:交易 + 母账户执行母子账号之间的划转 ### HTTP 请求 @@ -1136,7 +1139,8 @@ balance| 是| string| -| 子账号下该币种所有余额(可用余额和冻 ## 子账号余额 -API Key 权限:查询 +API Key 权限:读取 + 母账户查询子账号各币种账户余额 ### HTTP 请求 @@ -1204,7 +1208,8 @@ balance|-|decimal|- |账户余额 |-| ## 虚拟币提现 -API Key 权限:充提 +API Key 权限:提币 + ### HTTP 请求 @@ -1250,7 +1255,7 @@ API Key 权限:充提 ## 取消提现 -API Key 权限:充提 +API Key 权限:提币 ### HTTP 请求 @@ -1280,7 +1285,8 @@ API Key 权限:充提 ## 充提记录 -API Key 权限:查询 +API Key 权限:读取 + 查询充提记录 ### HTTP 请求 @@ -1376,6 +1382,7 @@ API Key 权限:查询 ## 下单 API Key 权限:交易 + 发送一个新订单到火币以进行撮合。 ### HTTP 请求 @@ -1431,6 +1438,7 @@ source | string | false | api | 现货交易填写“api”,杠 ## 撤销订单 API Key 权限:交易 + 此接口发送一个撤销订单的请求。 @@ -1463,7 +1471,8 @@ API Key 权限:交易 ## 查询当前未成交订单 -API Key 权限:查询 +API Key 权限:读取 + 查询已提交但是仍未完全成交或未被撤销的订单。 ```json @@ -1536,6 +1545,7 @@ state | string | 订单状态,包括submitted, partical-fille ## 批量撤销订单(open orders) API Key 权限:交易 + 此接口发送批量撤销订单的请求。 @@ -1581,6 +1591,7 @@ API Key 权限:交易 ## 批量撤销订单 API Key 权限:交易 + 此接口同时为多个订单(基于id)发送取消请求。 ### HTTP 请求 @@ -1630,7 +1641,8 @@ API Key 权限:交易 ## 查询订单详情 -API Key 权限:查询 +API Key 权限:读取 + 此接口返回指定订单的最新状态和详情。 ### HTTP 请求 @@ -1693,7 +1705,8 @@ API Key 权限:查询 ## 成交明细 -API Key 权限:查询 +API Key 权限:读取 + 此接口返回指定订单的成交明细。 ### HTTP 请求 @@ -1750,7 +1763,8 @@ API Key 权限:查询 ## 搜索历史订单 -API Key 权限:查询 +API Key 权限:读取 + 此接口基于搜索条件查询历史订单。 ### HTTP 请求 @@ -1842,7 +1856,8 @@ API Key 权限:查询 ## 搜索最近48小时内历史订单 -API Key 权限:查询 +API Key 权限:读取 + 此接口基于搜索条件查询最近48小时内历史订单。 ### HTTP 请求 @@ -1920,7 +1935,8 @@ API Key 权限:查询 ## 当前和历史成交 -API Key 权限:查询 +API Key 权限:读取 + 此接口基于搜索条件查询当前和历史成交记录。 ### HTTP 请求 @@ -1992,6 +2008,7 @@ API Key 权限:查询 ## 币币现货账户与合约账户划转 API Key 权限:交易 + 此接口用户币币现货账户与合约账户之间的资金划转。 从现货现货账户转至合约账户,类型为`pro-to-futures`; 从合约账户转至现货账户,类型为`futures-to-pro` @@ -2088,6 +2105,7 @@ err-code | err-msg(中文) | err-msg(Englis)|补充说明 ## 资产划转 API Key 权限:交易 + 此接口用于现货账户与杠杆账户的资产互转。 从现货账户划转至杠杆账户 `transfer-in`,从杠杆账户划转至现货账户 `transfer-out` @@ -2135,6 +2153,7 @@ data | integer | Transfer id ## 申请借贷 API Key 权限:交易 + 此接口用于申请借贷. ### HTTP 请求 @@ -2178,6 +2197,7 @@ data | integer | Margin order id ## 归还借贷 API Key 权限:交易 + 此接口用于归还借贷. ### HTTP 请求 @@ -2217,7 +2237,8 @@ data | integer | Margin order id ## 查询借贷订单 -API Key 权限:查询 +API Key 权限:读取 + 此接口基于指定搜索条件返回借贷订单。 ### HTTP 请求 @@ -2282,7 +2303,8 @@ API Key 权限:查询 ## 借贷账户详情 -API Key 权限:查询 +API Key 权限:读取 + 此接口返回借贷账户详情。 ### HTTP 请求 @@ -2438,6 +2460,7 @@ amount| true | double |- | 成分币数量 | ## 换入换出 API Key 权限:交易 + 用户可以通过该接口取得关于 ETF 换入(swap/in)换出(swap/out)的 基本信息,包括一次换入最小量,一次换入最大量,一次换出最小量,一次换出最大量,换入费率,换出费率,最新 ETF 换入换出状态,以及 ETF 的成分结构。 @@ -2497,7 +2520,8 @@ success | true| Boolean | - | 请求是否成功| true or false | ## 操作记录 -API Key 权限:查询 +API Key 权限:读取 + 用户可以通过该接口取得关于 ETF 换入换出操 作的明细记录。最多返回 100 条记录。 @@ -3239,7 +3263,8 @@ Websocket服务器同时支持一次性请求数据(pull)。 ## 订阅账户更新 -API Key 权限:查询 +API Key 权限:读取 + 订阅账户资产变动更新。 ### 主题订阅 @@ -3311,7 +3336,8 @@ balance | string | 账户余额 (当订阅mode=0时,该余额为可用余 ## 订阅订单更新 -API Key 权限:查询 +API Key 权限:读取 + 订阅账户下的订单更新。 ### 主题订阅 @@ -3397,7 +3423,8 @@ unfilled-amount | string | 单次成交手续费(买入为币,卖出 ## 订阅订单更新 (NEW) -API Key 权限:查询 +API Key 权限:读取 + 相比现有用户订单更新推送主题“orders.$symbol”, 新增主题“orders.$symbol.update”拥有更低的数据延迟以及更准确的消息顺序。建议API用户订阅此新主题接收订单更新推送,以替代现有订阅主题 “orders.$symbol”。(现有订阅主题 “orders.$symbol”仍将在Websocket API服务中被保留直至另行通知。) ### 主题订阅 @@ -3472,7 +3499,8 @@ unfilled-amount | string | 最近未成交数量(当order-state = submi ## 请求用户资产数据 -API Key 权限:查询 +API Key 权限:读取 + 查询当前用户的所有账户余额数据。 ### 数据请求 @@ -3571,7 +3599,8 @@ balance }} |string |子账户余额| ## 请求当前及历史订单 -API Key 权限:查询 +API Key 权限:读取 + 根据设定条件查询当前委托、历史委托。 ### 数据请求 @@ -3656,7 +3685,8 @@ cancel-at |long |撤单时间| ## 以订单编号请求订单 -API Key 权限:查询 +API Key 权限:读取 + 以订单编号请求订单数据 ### 数据请求 From 2bcf183717e81666decc249f6d58fb348d2ff3f5 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Tue, 4 Jun 2019 22:24:39 +0800 Subject: [PATCH 099/864] 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 daa672f4721..1fd8fe736bf 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1089,7 +1089,8 @@ base-operation-forbidden| 禁止操作(母子账号关系错误时报) |stri ## 子账号余额(汇总) -API Key 权限:查询 +API Key 权限:读取 + 母账户查询其下所有子账号的各币种汇总余额 ### HTTP 请求 From 3cc1b34bf1a2eada40e9219554e24cf5510bd302 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Wed, 5 Jun 2019 21:17:26 +0800 Subject: [PATCH 100/864] 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 1fd8fe736bf..5647d062aae 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.06.05 20:00| 所有需要验签的接口|优化|访问验签接口时,API Key需要有适当的权限,现有的API Key都默认有全部权限。权限分为3类:读取,交易和提币。每个接口相应的权限类别均已更新在各接口说明中| |2019.06.10 00:00| - GET /v1/order/orders;- GET /v1/order/matchresults |修改|查询窗口调整为48小时,可查询整体时间范围不变| |2019.05.15 10:00| - POST /v1/futures/transfer |新增|提供币币与合约账户间的资金划转| |2019.04.29 19:00| - GET /v1/order/history |新增|新增最近48小时内历史订单查询节点。新节点的上线后,现有订单查询节点“GET /v1/order/orders”仍将被保留。然而,新节点“GET /v1/order/history”被赋予更高服务等级。极端情况下,当服务荷载超过系统既定阈值时,节点“GET /v1/order/orders”的服务可能会不可用,而新节点“GET /v1/order/history”仍将继续提供服务。另外,火币正在计划支持另一个新节点专门用于用户48小时外的历史订单查询。此新节点上线的同时,现有节点“GET /v1/order/orders”将被弃用。火币将及时告知用户这一变更,一旦变更时间确定。| @@ -125,7 +126,7 @@ search: False ### 签名说明 -API 请求在通过 internet 传输的过程中极有可能被篡改,为了确保请求未被更改,除公共接口(基础信息,行情数据)外的私有接口均必须使用您的 API Key 做签名认证,以校验参数或参数值在传输途中是否发生了更改。 +API 请求在通过 internet 传输的过程中极有可能被篡改,为了确保请求未被更改,除公共接口(基础信息,行情数据)外的私有接口均必须使用您的 API Key 做签名认证,以校验参数或参数值在传输途中是否发生了更改。每一个API Key需要有适当的权限才能访问相应的接口。每个新创建的API Key都需要分配权限。权限类型分为:读取,交易,提币。在使用接口前,请查看每个接口的权限类型,并确认你的API Key有相应的权限。 一个合法的请求由以下几部分组成: From 81f6b81d7a8604d8934851c44dafc17a8cdabd2f Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Thu, 6 Jun 2019 21:15:45 +0800 Subject: [PATCH 101/864] Update index.html.md --- source/index.html.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 5647d062aae..3c310bb8734 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.06.06 18:00| GET /v1/query/deposit-withdraw|优化|对充提记录查询接口的请求参数进行优化,该优化向后兼容| |2019.06.05 20:00| 所有需要验签的接口|优化|访问验签接口时,API Key需要有适当的权限,现有的API Key都默认有全部权限。权限分为3类:读取,交易和提币。每个接口相应的权限类别均已更新在各接口说明中| |2019.06.10 00:00| - GET /v1/order/orders;- GET /v1/order/matchresults |修改|查询窗口调整为48小时,可查询整体时间范围不变| |2019.05.15 10:00| - POST /v1/futures/transfer |新增|提供币币与合约账户间的资金划转| @@ -1299,11 +1300,11 @@ API Key 权限:读取 | 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | | ----------- | ---- | ---- | ------------ | ---- | ---- | -| currency | true | string | 币种 | | | +| currency | false | string | 币种 | |缺省时,返回所有币种 | | type | true | string | 充值或提现 | | deposit 或 withdraw | -| from | true | string | 查询起始 ID | | | -| size | true | string | 查询记录大小 | | | - +| from | false | string | 查询起始 ID |缺省时,默认值direct相关。当direct为‘prev’时,from 为1 ,从旧到新升序返回;当direct为’next‘时,from为最新的一条记录的ID,从新到旧降序返回 | | +| size | false | string | 查询记录大小 | 100 |1-500 | +| direct | false | string | 返回记录排序方向 | 缺省时,默认为“prev” (升序) |“prev” (升序)or “next” (降序) | > Response: From 10c7ac31d08ae16073ea581baaddbbdd340b10c3 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Wed, 12 Jun 2019 13:14:08 +0800 Subject: [PATCH 102/864] Update index.html.md --- source/index.html.md | 48 ++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 3c310bb8734..fd689e8aca2 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.06.12 16:00| GET /v1/common/symbols|优化|对交易对基础信息接口返回的内容进行优化,该优化向后兼容| |2019.06.06 18:00| GET /v1/query/deposit-withdraw|优化|对充提记录查询接口的请求参数进行优化,该优化向后兼容| |2019.06.05 20:00| 所有需要验签的接口|优化|访问验签接口时,API Key需要有适当的权限,现有的API Key都默认有全部权限。权限分为3类:读取,交易和提币。每个接口相应的权限类别均已更新在各接口说明中| |2019.06.10 00:00| - GET /v1/order/orders;- GET /v1/order/matchresults |修改|查询窗口调整为48小时,可查询整体时间范围不变| @@ -431,21 +432,31 @@ curl "https://api.huobi.pro/v1/common/symbols" ```json "data": [ + {"base-currency":"etc", + "quote-currency":"usdt", + "price-precision":6, + "amount-precision":4, + "symbol-partition":"default", + "symbol":"etcusdt", + "state":"online", + "value-precision":8, + "min-order-amt":0.001, + "max-order-amt":10000, + "min-order-value":0.0001 + }, { - "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" + "base-currency":"ltc", + "quote-currency":"usdt", + "price-precision":6, + "amount-precision":4, + "symbol-partition":"main", + "symbol":"ltcusdt", + "state":"online", + "value-precision":8, + "min-order-amt":0.001, + "max-order-amt":10000, + "min-order-value":100, + "leverage-ratio":4 } ] ``` @@ -458,7 +469,14 @@ base-currency | string | 交易对中的基础币种 quote-currency | string | 交易对中的报价币种 price-precision | integer | 交易对报价的精度(小数点后位数) amount-precision| integer | 交易对基础币种计数精度(小数点后位数) -symbol-partition| string | 交易区,可能值: [main,innovation,bifurcation] +symbol-partition| string | 交易区,可能值: [main,innovation] +symbol | string | 交易对 +state | string | 交易对状态;可能值: [online,offline,suspend] online - 已上线;offline - 交易对已下线,不可交易;suspend -- 交易暂停 +value-precision | integer | 交易对交易金额的精度(小数点后位数) +min-order-amt | long | 交易对最小下单量 (下单量指当订单类型为限价单或sell-market时,下单接口传的'amount') +max-order-amt | long | 交易对最大下单量 +min-order-value | long | 最小下单金额 (下单金额指当订单类型为限价单时,下单接口传入的(amount * price)。当订单类型为buy-market时,下单接口传的'amount') +leverage-ratio | int | 交易对杠杆最大倍数 ## 获取所有币种 From 96078963dbf0cac2e3bc5eb3eb586ed3504e1460 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Tue, 18 Jun 2019 20:58:32 +0800 Subject: [PATCH 103/864] Update index.html.md --- source/index.html.md | 111 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index fd689e8aca2..a302385f4a1 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.06.17 16:00| GET /v1/stable_coin/exchange_rate; POST /v1/stable_coin/exchange |新增|新增接口支持用户随时获取最新的稳定币兑换汇率信息,并对稳定币执行兑入或兑出。 |2019.06.12 16:00| GET /v1/common/symbols|优化|对交易对基础信息接口返回的内容进行优化,该优化向后兼容| |2019.06.06 18:00| GET /v1/query/deposit-withdraw|优化|对充提记录查询接口的请求参数进行优化,该优化向后兼容| |2019.06.05 20:00| 所有需要验签的接口|优化|访问验签接口时,API Key需要有适当的权限,现有的API Key都默认有全部权限。权限分为3类:读取,交易和提币。每个接口相应的权限类别均已更新在各接口说明中| @@ -1065,6 +1066,7 @@ list字段说明 | currency | true | string | 币种 | | | type | true | string | 类型 | trade: 交易余额,frozen: 冻结余额 | + ## 资产划转(母子账号之间) API Key 权限:交易 @@ -1223,6 +1225,115 @@ currency| - |string| - |币种 |-| type| - |string| - |账户类型 |trade:交易账户,frozen:冻结账户| balance|-|decimal|- |账户余额 |-| +# 稳定币兑换 + + + +## 稳定币兑换汇率 + +API Key 权限:只读 + +查询稳定币兑换汇率 + +### HTTP 请求 + +- GET ` /v1/stable_coin/exchange_rate` + +### 请求参数 + +N/A + +> Response: + +```json +{"currency":"usdc", + "buy-rate":"0.8000", + "buy-quota":"0", + "sell-rate":"1.2002", + "sell-quota":"100002857.70540000", + "state":3, + "time":1560343605749}, +{"currency":"tusd", + "buy-rate":"0.9800", + "buy-quota":"210991800.00000000", + "sell-rate":"1.0000", + "sell-quota":"0", + "state":1, + "time":1560343605749} +} +``` + +### 响应数据 + +| 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +| ---- | ----- | ---- | ---- | ---- | +|currency|是|string|稳定币币种|| +|buy_rate|是| string| 兑入汇率,即用户方使用HUSD买入查询稳定币的汇率|| +|buy_quota|是| string| 兑入限额,即当前平台支持用户方可以买入的稳定币最大数量|| +|sell_rate|是| string| 兑出汇率,即用户方使用查询稳定币买入HUSD的汇率 || +|sell_quota|是 |string| 兑出限额,即当前平台支持用户方可以卖出的稳定币最大数量| | +|state|是| int| 稳定币兑入兑出状态| 1-支持兑入兑出、2-不支持兑入兑出、 3-支持兑入不支持兑出、4-支持兑出不 支持兑入| +|time|是|long|时间戳|| + +## 稳定币兑换 + +API Key 权限:交易 + +稳定币兑换 + +### HTTP 请求 + +- POST ` /v1/stable_coin/exchange` + +```json +{"currency":"pax", + "type":"buy", + "amount":"1.96", +} +``` +### 请求参数 + +|参数|是否必填 | 数据类型 | 说明 | 取值范围 | +|------|-------|--------|--------|----------| + |currency|是| string| 稳定币币种 | | + |amount|是| string |兑入或兑出的稳定币金额数量| | + |type|是| string| 兑换方向| buy兑入/sell兑出 | + +> Response: + +```json +{"id":2529, + "currency":"pax", + "type":"buy", + "amount":"1.96", + "rate":"1", + "exchange_amount":"1.96", + "time":1560342471413} +} +``` + +### 响应数据 + +| 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +| ---- | ----- | ---- | ---- | ---- | +|id|是| long| 兑换记录 ID| | +|currency|是|string|稳定币币种|| +|type|是| string| 兑换方向| buy兑入/sell兑出 | +|amount|是| string |兑入或兑出的稳定币金额数量| | +|rate|是| string |兑换费率,即此次兑换操作的汇率|| +|exchange_amount|是| String| 成功兑入或兑出的 HUSD 数量 || +|time|是|long|时间戳|| + +### 错误码 + +|err-code|err-message| +|invalid-currency| 币种无效 | +|invalid-amount |amount<1 或 amount>最大值 99999999999999999.99999999| +|invalid-type| type不为 buy或 sell| +|Insufficient_balance| 账户可用余额不足| +|insufficient-quota |稳定币限额不足/超出稳定币限额| +|exchange-failure |后端其他错误引起的兑换失败| + # 钱包(充值与提现) From 75bed853f349e5d1a1ca6dbeb7de6aebc57351b3 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Tue, 18 Jun 2019 21:06:56 +0800 Subject: [PATCH 104/864] 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 a302385f4a1..aec27c205de 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1295,9 +1295,9 @@ API Key 权限:交易 |参数|是否必填 | 数据类型 | 说明 | 取值范围 | |------|-------|--------|--------|----------| - |currency|是| string| 稳定币币种 | | - |amount|是| string |兑入或兑出的稳定币金额数量| | - |type|是| string| 兑换方向| buy兑入/sell兑出 | +|currency|是| string| 稳定币币种 | | +|amount|是| string |兑入或兑出的稳定币金额数量| | +|type|是| string| 兑换方向| buy兑入/sell兑出 | > Response: @@ -1327,6 +1327,7 @@ API Key 权限:交易 ### 错误码 |err-code|err-message| +| ---- | ----- | |invalid-currency| 币种无效 | |invalid-amount |amount<1 或 amount>最大值 99999999999999999.99999999| |invalid-type| type不为 buy或 sell| From 143f89f8f8d2db564a369f7e4b4746b4b8fccdb9 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 19 Jun 2019 17:46:35 +0800 Subject: [PATCH 105/864] 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 aec27c205de..a23f1787f09 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2082,7 +2082,7 @@ API Key 权限:读取 | 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | | ---------- | ----- | ------ | ------ | ---- | ----------- | | symbol | true | string | 交易对 | NA | btcusdt, ethbtc, rcneth ... | -| types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +| types | false | string | 查询的订单类型组合,使用','分割 | all | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | | start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | -61 days | [-61day, today] (自6月10日起, start-date与end-date的查询窗口最大为2天,如果超出范围,接口会返回错误码。 || | end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | today | [start-date, today] (自6月10日起, start-date与end-date的查询窗口最大为2天,如果超出范围,接口会返回错误码。 | | | from | false | string | 查询起始 ID | 订单成交记录ID(最大值) | | From 74bf8a29923738f94c508b4f4b88d6722e94d0b9 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Thu, 20 Jun 2019 15:49:08 +0800 Subject: [PATCH 106/864] Update index.html.md --- source/index.html.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index a23f1787f09..547582fcd5f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.06.14 16:00| POST /v1/dw/withdraw/api/create|优化|支持快速提币 |2019.06.17 16:00| GET /v1/stable_coin/exchange_rate; POST /v1/stable_coin/exchange |新增|新增接口支持用户随时获取最新的稳定币兑换汇率信息,并对稳定币执行兑入或兑出。 |2019.06.12 16:00| GET /v1/common/symbols|优化|对交易对基础信息接口返回的内容进行优化,该优化向后兼容| |2019.06.06 18:00| GET /v1/query/deposit-withdraw|优化|对充提记录查询接口的请求参数进行优化,该优化向后兼容| @@ -1343,7 +1344,9 @@ API Key 权限:交易 API Key 权限:提币 - + + + ### HTTP 请求 From f24517b71f6acaf4d9f50bf7e31008ff4a76491e Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 20 Jun 2019 16:10:34 +0800 Subject: [PATCH 107/864] Update index.html.md --- 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 547582fcd5f..f6f70316bc6 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3553,9 +3553,9 @@ order-state | string | 订单状态, 有效取值: submitted, partica role | string | 成交角色: taker or maker price | string | 成交价格 filled-amount | string | 单次成交数量 -filled-cash-amount | string | 单次未成交数量 -filled-fees | string | 单次成交金额 -unfilled-amount | string | 单次成交手续费(买入为币,卖出为钱) +unfilled-amount | string | 单次未成交数量 +filled-cash-amount | string | 单次成交金额 +filled-fees | string | 单次成交手续费(买入为币,卖出为钱) ## 订阅订单更新 (NEW) From 52cb764cc76b3f9f700f7c8454459d68abe81519 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 25 Jun 2019 17:30:18 +0800 Subject: [PATCH 108/864] 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 f6f70316bc6..fc944bb2b21 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3494,7 +3494,7 @@ API Key 权限:读取 参数 | 数据类型 | 是否必需 | 缺省值 | 描述 | 取值范围 --------- | --------- | -------- | ------------- | ----------- | ----------- -symbol | string | true | NA | 交易代码 | All supported trading symbols, e.g. btcusdt, bccbtc +symbol | string | true | NA | 交易代码 | All supported trading symbols, e.g. btcusdt, bccbtc. 支持通配符"*". > Response @@ -3581,7 +3581,7 @@ API Key 权限:读取 参数 | 数据类型 | 是否必需 | 缺省值 | 描述 | 取值范围 --------- | --------- | -------- | ------------- | ----------- | ----------- -symbol | string | true | NA | 交易代码 | All supported trading symbols, e.g. btcusdt, bccbtc +symbol | string | true | NA | 交易代码 | All supported trading symbols, e.g. btcusdt, bccbtc. 支持通配符"*". From abe0e832cef32b9017cb8ec18fbc9428a5a8fb66 Mon Sep 17 00:00:00 2001 From: Huobi-API Date: Mon, 8 Jul 2019 11:12:42 +0800 Subject: [PATCH 109/864] Update index.html.md --- source/index.html.md | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index fc944bb2b21..ccdd51d116d 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.07.08 12:00| Websocket 订单资产推送接口|优化|优化Websocket 订单资产推送接口[心跳和限频](#5ea2e0cde2-3)。 |2019.06.14 16:00| POST /v1/dw/withdraw/api/create|优化|支持快速提币 |2019.06.17 16:00| GET /v1/stable_coin/exchange_rate; POST /v1/stable_coin/exchange |新增|新增接口支持用户随时获取最新的稳定币兑换汇率信息,并对稳定币执行兑入或兑出。 |2019.06.12 16:00| GET /v1/common/symbols|优化|对交易对基础信息接口返回的内容进行优化,该优化向后兼容| @@ -2807,6 +2808,7 @@ WebSocket API 返回的所有数据都进行了 GZIP 压缩,需要 client 在 + ### 订阅主题 成功建立与Websocket服务器的连接后,Websocket客户端发送如下请求以订阅特定主题: @@ -3276,7 +3278,21 @@ WebSocket API 返回的所有数据都进行了 GZIP 压缩,需要 client 在 ### 心跳消息 -当用户的Websocket客户端连接到火币Websocket服务器后,服务器会定期(当前设为5秒)向其发送`ping`消息并包含一整数值如下: + **2019/07/08之后** + +当用户的Websocket客户端连接到火币Websocket服务器后,服务器会定期(当前设为20秒)向其发送`ping`消息并包含一整数值如下: + +> {"ping": 1492420473027} + +当用户的Websocket客户端接收到此心跳消息后,应返回`pong`消息并包含同一整数值: + +> {"pong": 1492420473027} + + + +**2019/07/08之前** + +当用户的Websocket客户端连接到火币Websocket服务器后,服务器会定期(设为30秒)向其发送`ping`消息并包含一整数值如下: > {"ping": 1492420473027} @@ -3359,7 +3375,16 @@ Websocket服务器同时支持一次性请求数据(pull)。 具体请求方式请见后文。 -**数据请求限频规则** +### 限频 + +**数据请求(sub)限频规则** + +限频规则基于API key而不是连接。当sub数量超出限值时,Websocket客户端将收到"too many request"错误码。具体规则如下: + +单个连接每秒最多50次sub和50次unsub。 +单个连接sub总量限制100个,sub总量达到限额后不允许再sub,但每次unsub可以减少sub总量的计数。比如:30个sub后unsub 1个,此时sub总量count为29,还有71个sub总量可用。 + +**数据请求(req)限频规则** 限频规则基于API key而不是连接。当请求频率超出限值时,Websocket客户端将收到"too many request"错误码。以下为各主题当前限频设定: From 7bbad7a35c717986c5b55344e4d7e2727ff61502 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 11 Jul 2019 19:07:22 +0800 Subject: [PATCH 110/864] Update index.html.md --- source/index.html.md | 99 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 98 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index ccdd51d116d..1ed39b9eb06 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1533,7 +1533,8 @@ API Key 权限:交易 "price": "100.1", "source": "api", "symbol": "ethusdt", - "type": "buy-limit" + "type": "buy-limit", + "client-order-id": "a0001" } ``` @@ -1547,6 +1548,7 @@ type | string | true | NA | 订单类型,包括buy-market, s amount | string | true | NA | 订单交易量 price | string | false | NA | limit order的交易价格 source | string | false | api | 现货交易填写“api”,杠杆交易填写“margin-api” +client-order-id| string | false | NA | 用户自编订单号 **buy-limit-maker** @@ -1605,6 +1607,37 @@ API Key 权限:交易 返回的主数据对象是一个对应下单单号的字符串。 +## 撤销订单(基于client order ID) + +API Key 权限:交易 + +此接口发送一个撤销订单的请求。 + + + + +### HTTP 请求 + +- POST ` /v1/order/orders/submitCancelClientOrder` + + +### 请求参数 + +| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | +| -------- | ---- | ------ | ------------ | ---- | ---- | +| client-order-id | true | string | 用户自编订单号 | | | + + +> Response: + +```json +{ + "data": "59378" +} +``` +### 响应数据 + +返回的主数据对象是一个对应下单单号的字符串。 ## 查询当前未成交订单 @@ -1794,6 +1827,70 @@ API Key 权限:读取 | order-id | true | string | 订单ID,填在path中 | | | +> Response: + +```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": "" + } +} +``` + +### 响应数据 + +| 字段名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +| ----------------- | ----- | ------ | ------- | ---- | +| account-id | true | long | 账户 ID | | +| amount | true | string | 订单数量 | | +| canceled-at | false | long | 订单撤销时间 | | +| created-at | true | long | 订单创建时间 | | +| field-amount | true | string | 已成交数量 | | +| field-cash-amount | true | string | 已成交总金额 | | +| field-fees | true | string | 已成交手续费(买入为币,卖出为钱) | | +| finished-at | false | long | 订单变为终结态的时间,不是成交时间,包含“已撤单”状态 | | +| id | true | long | 订单ID | | +| price | true | string | 订单价格 | | +| source | true | string | 订单来源 | api | +| state | true | string | 订单状态 | submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | +| symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | +| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | + +## 查询订单详情(基于client order ID) + +API Key 权限:读取 + +此接口返回指定订单的最新状态和详情。 + +### HTTP 请求 + +- GET /v1/order/orders/getClientOrder` + + +### 请求参数 + +| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | +| -------- | ---- | ------ | ----- | ---- | ---- | +| clientOrderId | true | string | 用户自编订单号 | | | + + > Response: ```json From 3c1ccd0fdbce538b49f8f241580e732beed7fa40 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 11 Jul 2019 19:09:38 +0800 Subject: [PATCH 111/864] 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 1ed39b9eb06..3a8ecfdfd8c 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1881,7 +1881,7 @@ API Key 权限:读取 ### HTTP 请求 -- GET /v1/order/orders/getClientOrder` +- GET `/v1/order/orders/getClientOrder` ### 请求参数 From 35defcfd2b9ad9fa58b808ad3a20d6ab389f523b Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 11 Jul 2019 19:13:05 +0800 Subject: [PATCH 112/864] Update index.html.md --- source/index.html.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 3a8ecfdfd8c..7f25ad12f18 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1620,6 +1620,12 @@ API Key 权限:交易 - POST ` /v1/order/orders/submitCancelClientOrder` +```json +{ + "client-order-id": "a0001" +} +``` + ### 请求参数 @@ -1883,6 +1889,11 @@ API Key 权限:读取 - GET `/v1/order/orders/getClientOrder` +```json +{ + "client-order-id": "a0001" +} +``` ### 请求参数 From 81a308c4110dc5666ccd21b885b9ef6087f6ad81 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 11 Jul 2019 19:14:29 +0800 Subject: [PATCH 113/864] 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 7f25ad12f18..9b0c1b5bf96 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1891,7 +1891,7 @@ API Key 权限:读取 ```json { - "client-order-id": "a0001" + "clientOrderId": "a0001" } ``` From dd3cf92c2f71267dea668e2805aae1767b88feaf Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 12 Jul 2019 10:21:39 +0800 Subject: [PATCH 114/864] 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 9b0c1b5bf96..acf9846bfd0 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.07.11 20:00| 下单/撤单/查询可基于client order ID。 |2019.07.08 12:00| Websocket 订单资产推送接口|优化|优化Websocket 订单资产推送接口[心跳和限频](#5ea2e0cde2-3)。 |2019.06.14 16:00| POST /v1/dw/withdraw/api/create|优化|支持快速提币 |2019.06.17 16:00| GET /v1/stable_coin/exchange_rate; POST /v1/stable_coin/exchange |新增|新增接口支持用户随时获取最新的稳定币兑换汇率信息,并对稳定币执行兑入或兑出。 From 7519cc7030ce4d6404b84a34baea252ca8f06fa9 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 12 Jul 2019 10:24:37 +0800 Subject: [PATCH 115/864] 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 acf9846bfd0..f30e5d8c986 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,7 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| -|2019.07.11 20:00| 下单/撤单/查询可基于client order ID。 +|2019.07.11 20:00| POST /v1/order/orders/place; POST /v1/order/orders/submitCancelClientOrder; GET /v1/order/orders/getClientOrder|优化/新增|下单/撤单/查询可基于client order ID。 |2019.07.08 12:00| Websocket 订单资产推送接口|优化|优化Websocket 订单资产推送接口[心跳和限频](#5ea2e0cde2-3)。 |2019.06.14 16:00| POST /v1/dw/withdraw/api/create|优化|支持快速提币 |2019.06.17 16:00| GET /v1/stable_coin/exchange_rate; POST /v1/stable_coin/exchange |新增|新增接口支持用户随时获取最新的稳定币兑换汇率信息,并对稳定币执行兑入或兑出。 From 97afa9bb9f568c7707bfdd7dbb03d3e36eff87fe Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 12 Jul 2019 18:01:14 +0800 Subject: [PATCH 116/864] Update index.html.md --- source/index.html.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index f30e5d8c986..666aa60b4bc 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1575,6 +1575,14 @@ client-order-id| string | false | NA | 用户自编订单号 返回的主数据对象是一个对应下单单号的字符串。 +如client order ID(24小时内)被复用,返回如下错误信息 – +{ + "status": "error", + "err-code": "order-orderstate-error", + "err-msg": "Incorrect order state", + "data": null +} + ## 撤销订单 API Key 权限:交易 @@ -1902,7 +1910,6 @@ API Key 权限:读取 | -------- | ---- | ------ | ----- | ---- | ---- | | clientOrderId | true | string | 用户自编订单号 | | | - > Response: ```json @@ -1949,6 +1956,14 @@ API Key 权限:读取 | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +如client order ID不存在,返回如下错误信息 +{ + "status": "error", + "err-code": "base-record-invalid", + "err-msg": "record invalid", + "data": null +} + ## 成交明细 API Key 权限:读取 From d699d54cbec7b4fba3ecf707d3fb93c1b6e982ce Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 12 Jul 2019 18:08:00 +0800 Subject: [PATCH 117/864] 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 666aa60b4bc..43c678ae472 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1549,7 +1549,7 @@ type | string | true | NA | 订单类型,包括buy-market, s amount | string | true | NA | 订单交易量 price | string | false | NA | limit order的交易价格 source | string | false | api | 现货交易填写“api”,杠杆交易填写“margin-api” -client-order-id| string | false | NA | 用户自编订单号 +client-order-id| string | false | NA | 用户自编订单号(须在24小时内保持唯一性) **buy-limit-maker** From 667499cc857b4ebba7ee185a0cdecacd86b3140f Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 15 Jul 2019 15:41:38 +0800 Subject: [PATCH 118/864] 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 43c678ae472..4ea30de8625 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2055,7 +2055,7 @@ API Key 权限:读取 | states | true | string | 查询的订单状态组合,使用','分割 | | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | | from | false | string | 查询起始 ID | | | | direct | false | string | 查询方向 | | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | -| size | false | string | 查询记录大小 | 100 | [1, 1000] | +| size | false | string | 查询记录大小 | 100 | [1, 100] | > Response: From 29e31525fec55cb5293e036d156e5d1f8175ace9 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 22 Jul 2019 11:38:55 +0800 Subject: [PATCH 119/864] Update index.html.md --- source/index.html.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 4ea30de8625..e00e727e4d4 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.07.22 12:00| GET /v1/order/orders/{order-id}/matchresults; GET /v1/order/matchresults|新增|新增成交角色"role"字段以标识每笔成交角色是"taker"还是"maker"。 |2019.07.11 20:00| POST /v1/order/orders/place; POST /v1/order/orders/submitCancelClientOrder; GET /v1/order/orders/getClientOrder|优化/新增|下单/撤单/查询可基于client order ID。 |2019.07.08 12:00| Websocket 订单资产推送接口|优化|优化Websocket 订单资产推送接口[心跳和限频](#5ea2e0cde2-3)。 |2019.06.14 16:00| POST /v1/dw/withdraw/api/create|优化|支持快速提币 @@ -1998,7 +1999,8 @@ API Key 权限:读取 "price": "100.1000000000", "filled-amount": "9.1155000000", "filled-fees": "0.0182310000", - "created-at": 1494901400435 + "created-at": 1494901400435, + "role": "maker" } ... ] @@ -2021,6 +2023,7 @@ API Key 权限:读取 | source | true | string | 订单来源 | api | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +| role | true | string | 成交角色 |maker,taker | ## 搜索历史订单 @@ -2217,7 +2220,6 @@ API Key 权限:读取 | direct | false | string | 查询方向 | 默认 next, 成交记录 ID 由大到小排序 | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | | size | false | string | 查询记录大小 | 100 | [1,100] | - > Response: ```json @@ -2233,7 +2235,8 @@ API Key 权限:读取 "price": "100.1000000000", "filled-amount": "9.1155000000", "filled-fees": "0.0182310000", - "created-at": 1494901400435 + "created-at": 1494901400435, + "role": taker } ... ] @@ -2256,6 +2259,7 @@ API Key 权限:读取 | source | true | string | 订单来源 | api | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +| role | true | string | 成交角色 |maker,taker | ### start-date, end-date相关错误码 (自6月10日生效) From 5d5c228f3a03d48456bbd49b5315453a5c31aac9 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 23 Jul 2019 15:37:15 +0800 Subject: [PATCH 120/864] 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 e00e727e4d4..51afd4a7bb0 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -22,7 +22,7 @@ search: False 你可以通过选择上方下拉菜单的版本号来切换文档对应的 API 版本,也可以通过点击右上方的语言按钮来切换文档语言。 ## 做市商项目 From 5b208bb816568b7c208b7329971d716089a8bfef Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 23 Jul 2019 18:42:23 +0800 Subject: [PATCH 121/864] Update index.html.md --- source/index.html.md | 49 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 51afd4a7bb0..96c1d1e38f1 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -540,9 +540,56 @@ curl "https://api.huobi.pro/v1/common/timestamp" "data": 1494900087029 ``` +## 获取用户当前手续费率 + +Api用户查询交易对费率,一次限制最多查10个交易对,子用户的费率和母用户保持一致 + +```shell +curl "https://api.huobi.pro/v1/fee/fee-rate/get" +``` + +### HTTP 请求 + +- GET `/v1/fee/fee-rate/get` + +### 请求参数 + +参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 +--------- | --------- | -------- | ------- | ------ | ------ +symbols | string | true | NA | 交易对,可多填,逗号分隔 | 如"btcusdt,ethusdt" + +> Response: + +```json +{ + "status": "ok", + "data": [ + { + "symbol": "btcusdt", + "maker-fee":"0.0001", + "taker-fee":"0.0002" + }, + { + "symbol": "ethusdt", + "maker-fee":"0.002", + "taker-fee":"0.002" + }, + { + "symbol": "ltcusdt", + "maker-fee":"0.0015", + "taker-fee":"0.0018" + } + ] +} +``` ### 响应数据 -返回的“data”对象是一个整数表示返回的调整为北京时间的时间戳,单位毫秒。 +字段名称 | 数据类型 | 描述 +--------- | --------- | ----------- +status | string |Y | 响应状态 +err-code | string |N | 响应码 +err-msg | string |N | 响应信息 +data|list|Y|交易对费率列表 # 行情数据 From ac59fa4c8bc303947bbdf6a125e30b258d495879 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 23 Jul 2019 18:43:52 +0800 Subject: [PATCH 122/864] 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 96c1d1e38f1..e3e7b9038c2 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -584,8 +584,8 @@ symbols | string | true | NA | 交易对,可多填,逗号分 ``` ### 响应数据 -字段名称 | 数据类型 | 描述 ---------- | --------- | ----------- +字段名称 | 数据类型 | 是否强制| 描述 +--------- | --------- | -----------| ----------- status | string |Y | 响应状态 err-code | string |N | 响应码 err-msg | string |N | 响应信息 From b84946db0abe31be01736d4b2ee82296a0576cf4 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 23 Jul 2019 18:49:35 +0800 Subject: [PATCH 123/864] Update index.html.md --- source/index.html.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index e3e7b9038c2..f7992ba3b93 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -591,6 +591,19 @@ err-code | string |N | 响应码 err-msg | string |N | 响应信息 data|list|Y|交易对费率列表 +### List +属性| 数据类型| 说明 +--------- | --------- | ------ +symbol| string| 交易对 +maker-fee| string| 挂单手续费 +taker-fee| string| 吃单手续费 + +### 响应码 +响应码| 说明| 类型| 备注 +--------- | --------- | ------ | ------ +base-symbol-error| 无效的交易对| string - +base-too-many-symbol| 最大支持 10 个交易对| string - + # 行情数据 ## K 线数据(蜡烛图) From c392335b155199677521e937a794e51fc686756d Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 23 Jul 2019 18:54:19 +0800 Subject: [PATCH 124/864] 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 f7992ba3b93..770ddf70674 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -545,7 +545,7 @@ curl "https://api.huobi.pro/v1/common/timestamp" Api用户查询交易对费率,一次限制最多查10个交易对,子用户的费率和母用户保持一致 ```shell -curl "https://api.huobi.pro/v1/fee/fee-rate/get" +curl "https://api.huobi.pro/v1/fee/fee-rate/get?symbols=btcusdt,ethusdt,ltcusdt" ``` ### HTTP 请求 From d7820f78dd93dd2687c6695bb15f2f947d6a4e34 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 23 Jul 2019 20:02:45 +0800 Subject: [PATCH 125/864] Update index.html.md --- source/index.html.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 770ddf70674..0bc2b1bfde9 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.07.23 20:00| GET /v1/fee/fee-rate/get|新增|新增费率查询接口。 |2019.07.22 12:00| GET /v1/order/orders/{order-id}/matchresults; GET /v1/order/matchresults|新增|新增成交角色"role"字段以标识每笔成交角色是"taker"还是"maker"。 |2019.07.11 20:00| POST /v1/order/orders/place; POST /v1/order/orders/submitCancelClientOrder; GET /v1/order/orders/getClientOrder|优化/新增|下单/撤单/查询可基于client order ID。 |2019.07.08 12:00| Websocket 订单资产推送接口|优化|优化Websocket 订单资产推送接口[心跳和限频](#5ea2e0cde2-3)。 @@ -601,8 +602,8 @@ taker-fee| string| 吃单手续费 ### 响应码 响应码| 说明| 类型| 备注 --------- | --------- | ------ | ------ -base-symbol-error| 无效的交易对| string - -base-too-many-symbol| 最大支持 10 个交易对| string - +base-symbol-error| 无效的交易对| string| - +base-too-many-symbol| 最大支持 10 个交易对| string| - # 行情数据 From b59511b04ad2aaf79350796353649fb6d644e97a Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 23 Jul 2019 20:25:34 +0800 Subject: [PATCH 126/864] 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 0bc2b1bfde9..0e3eb106dbb 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -596,8 +596,8 @@ data|list|Y|交易对费率列表 属性| 数据类型| 说明 --------- | --------- | ------ symbol| string| 交易对 -maker-fee| string| 挂单手续费 -taker-fee| string| 吃单手续费 +maker-fee| string| 挂单手续费率 +taker-fee| string| 吃单手续费率 ### 响应码 响应码| 说明| 类型| 备注 From f564c55be43fafd3a59bacbccdf5a3a09f60c359 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 23 Jul 2019 20:29:57 +0800 Subject: [PATCH 127/864] Update index.html.md --- source/index.html.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 0e3eb106dbb..1c46fda1441 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -545,6 +545,8 @@ curl "https://api.huobi.pro/v1/common/timestamp" Api用户查询交易对费率,一次限制最多查10个交易对,子用户的费率和母用户保持一致 +API Key 权限:读取 + ```shell curl "https://api.huobi.pro/v1/fee/fee-rate/get?symbols=btcusdt,ethusdt,ltcusdt" ``` From 12dc3bba3a04744ac6e46724bd44339d23e84045 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 23 Jul 2019 20:52:29 +0800 Subject: [PATCH 128/864] Update index.html.md --- source/index.html.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 1c46fda1441..857395c1560 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.07.23 21:00| "GET /v1/order/orders/{order-id}/matchresult" & "GET /v1/order/matchresults"|新增|新增手续费抵扣详情字段。 |2019.07.23 20:00| GET /v1/fee/fee-rate/get|新增|新增费率查询接口。 |2019.07.22 12:00| GET /v1/order/orders/{order-id}/matchresults; GET /v1/order/matchresults|新增|新增成交角色"role"字段以标识每笔成交角色是"taker"还是"maker"。 |2019.07.11 20:00| POST /v1/order/orders/place; POST /v1/order/orders/submitCancelClientOrder; GET /v1/order/orders/getClientOrder|优化/新增|下单/撤单/查询可基于client order ID。 @@ -2063,7 +2064,9 @@ API Key 权限:读取 "filled-amount": "9.1155000000", "filled-fees": "0.0182310000", "created-at": 1494901400435, - "role": "maker" + "role": "maker", + "filled-points": "0.0", + "fee-deduct-currency": "" } ... ] @@ -2087,6 +2090,8 @@ API Key 权限:读取 | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | | role | true | string | 成交角色 |maker,taker | +| filled-points | true | string | 抵扣数量 | | +| fee-deduct-currency | true | string | 抵扣类型 |ht,hbpoint | ## 搜索历史订单 @@ -2299,7 +2304,9 @@ API Key 权限:读取 "filled-amount": "9.1155000000", "filled-fees": "0.0182310000", "created-at": 1494901400435, - "role": taker + "role": taker, + "filled-points": "0.0", + "fee-deduct-currency": "" } ... ] @@ -2323,6 +2330,8 @@ API Key 权限:读取 | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | | role | true | string | 成交角色 |maker,taker | +| filled-points | true | string | 抵扣数量 | | +| fee-deduct-currency | true | string | 抵扣类型 |ht,hbpoint | ### start-date, end-date相关错误码 (自6月10日生效) From 659606fc3870fb6acc1a4dbcfc5f1fb641897456 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 1 Aug 2019 15:35:03 +0800 Subject: [PATCH 129/864] Update index.html.md --- source/index.html.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 857395c1560..b0d0486b2a5 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3253,6 +3253,9 @@ step3 | Aggregation level = precision*1000 step4 | Aggregation level = precision*10000 step5 | Aggregation level = precision*100000 +当type值为‘step0’时,默认深度为150档; +当type值为‘step1’,‘step2’,‘step3’,‘step4’,‘step5’时,默认深度为20档。 + > Response ```json From ae6562240be8d041ec1584d5b198b427e57db0b4 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 1 Aug 2019 17:02:07 +0800 Subject: [PATCH 130/864] Update index.html.md --- source/index.html.md | 131 +++++++++++++++++++++---------------------- 1 file changed, 65 insertions(+), 66 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index b0d0486b2a5..8f2c20f7d56 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -542,72 +542,6 @@ curl "https://api.huobi.pro/v1/common/timestamp" "data": 1494900087029 ``` -## 获取用户当前手续费率 - -Api用户查询交易对费率,一次限制最多查10个交易对,子用户的费率和母用户保持一致 - -API Key 权限:读取 - -```shell -curl "https://api.huobi.pro/v1/fee/fee-rate/get?symbols=btcusdt,ethusdt,ltcusdt" -``` - -### HTTP 请求 - -- GET `/v1/fee/fee-rate/get` - -### 请求参数 - -参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 ---------- | --------- | -------- | ------- | ------ | ------ -symbols | string | true | NA | 交易对,可多填,逗号分隔 | 如"btcusdt,ethusdt" - -> Response: - -```json -{ - "status": "ok", - "data": [ - { - "symbol": "btcusdt", - "maker-fee":"0.0001", - "taker-fee":"0.0002" - }, - { - "symbol": "ethusdt", - "maker-fee":"0.002", - "taker-fee":"0.002" - }, - { - "symbol": "ltcusdt", - "maker-fee":"0.0015", - "taker-fee":"0.0018" - } - ] -} -``` -### 响应数据 - -字段名称 | 数据类型 | 是否强制| 描述 ---------- | --------- | -----------| ----------- -status | string |Y | 响应状态 -err-code | string |N | 响应码 -err-msg | string |N | 响应信息 -data|list|Y|交易对费率列表 - -### List -属性| 数据类型| 说明 ---------- | --------- | ------ -symbol| string| 交易对 -maker-fee| string| 挂单手续费率 -taker-fee| string| 吃单手续费率 - -### 响应码 -响应码| 说明| 类型| 备注 ---------- | --------- | ------ | ------ -base-symbol-error| 无效的交易对| string| - -base-too-many-symbol| 最大支持 10 个交易对| string| - - # 行情数据 ## K 线数据(蜡烛图) @@ -2432,6 +2366,71 @@ err-code | err-msg(中文) | err-msg(Englis)|补充说明 |base-msg|您尚未开通合约交易,无访问权限|You don’t have access permission as you have not opened contracts trading.| |base-msg|合约品种不存在|This contract type doesn't exist.|没有相应币种的合约 +## 获取用户当前手续费率 + +Api用户查询交易对费率,一次限制最多查10个交易对,子用户的费率和母用户保持一致 + +API Key 权限:读取 + +```shell +curl "https://api.huobi.pro/v1/fee/fee-rate/get?symbols=btcusdt,ethusdt,ltcusdt" +``` + +### HTTP 请求 + +- GET `/v1/fee/fee-rate/get` + +### 请求参数 + +参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 +--------- | --------- | -------- | ------- | ------ | ------ +symbols | string | true | NA | 交易对,可多填,逗号分隔 | 如"btcusdt,ethusdt" + +> Response: + +```json +{ + "status": "ok", + "data": [ + { + "symbol": "btcusdt", + "maker-fee":"0.0001", + "taker-fee":"0.0002" + }, + { + "symbol": "ethusdt", + "maker-fee":"0.002", + "taker-fee":"0.002" + }, + { + "symbol": "ltcusdt", + "maker-fee":"0.0015", + "taker-fee":"0.0018" + } + ] +} +``` +### 响应数据 + +字段名称 | 数据类型 | 是否强制| 描述 +--------- | --------- | -----------| ----------- +status | string |Y | 响应状态 +err-code | string |N | 响应码 +err-msg | string |N | 响应信息 +data|list|Y|交易对费率列表 + +### List +属性| 数据类型| 说明 +--------- | --------- | ------ +symbol| string| 交易对 +maker-fee| string| 挂单手续费率 +taker-fee| string| 吃单手续费率 + +### 响应码 +响应码| 说明| 类型| 备注 +--------- | --------- | ------ | ------ +base-symbol-error| 无效的交易对| string| - +base-too-many-symbol| 最大支持 10 个交易对| string| - # 借贷 From 905f92827743876b72243751a5c654f8a981fead Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 2 Aug 2019 17:18:50 +0800 Subject: [PATCH 131/864] 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 8f2c20f7d56..f453bc39138 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.08.02 18:00| "orders.$symbol.update"|优化|修改对字段"unfilled-amount"的描述。 |2019.07.23 21:00| "GET /v1/order/orders/{order-id}/matchresult" & "GET /v1/order/matchresults"|新增|新增手续费抵扣详情字段。 |2019.07.23 20:00| GET /v1/fee/fee-rate/get|新增|新增费率查询接口。 |2019.07.22 12:00| GET /v1/order/orders/{order-id}/matchresults; GET /v1/order/matchresults|新增|新增成交角色"role"字段以标识每笔成交角色是"taker"还是"maker"。 @@ -3857,7 +3858,7 @@ role | string | 最近成交角色(当order-state = submitte price | string | 最新价(当order-state = submitted 时,price 为订单价格;当order-state = canceled, partial-canceled 时,price 为零;当order-state = filled, partial-filled 时,price 为最近成交价。当role = taker,且该订单同时与多张对手方订单撮合时,price 为多笔成交均价。) filled-amount | string | 最近成交数量 filled-cash-amount | string | 最近成交数额 -unfilled-amount | string | 最近未成交数量(当order-state = submitted 时,unfilled-amount 为原始订单量;当order-state = canceled OR partial-canceled 时,unfilled-amount 为未成交数量;当order-state = filled 时,如果 order-type = buy-market,unfilled-amount 可能为一极小值;如果order-type <> buy-market 时,unfilled-amount 为零;当order-state = partial-filled AND role = taker 时,unfilled-amount 为未成交数量;当order-state = partial-filled AND role = maker 时,unfilled-amount 为零。(后续将支持此场景下的未成交量,时间另行通知。)) +unfilled-amount | string | 最近未成交数量(当order-state = submitted 时,unfilled-amount 为原始订单量;当order-state = canceled OR partial-canceled 时,unfilled-amount 为未成交数量;当order-state = filled 时,如果 order-type = buy-market,unfilled-amount 可能为一极小值;如果order-type <> buy-market 时,unfilled-amount 为零;当order-state = partial-filled AND role = taker 时,unfilled-amount 为未成交数量;当order-state = partial-filled AND role = maker 时,unfilled-amount 为未成交数量。) ## 请求用户资产数据 From 180246df54b860c33c6fb09d9a7cb56f33217300 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 6 Aug 2019 15:39:08 +0800 Subject: [PATCH 132/864] Update index.html.md --- 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 f453bc39138..87792ca5be5 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3841,7 +3841,9 @@ symbol | string | true | NA | 交易代码 "match-id": 94984, "filled-cash-amount": "8301.357280000000000000", "role": "taker|maker", - "order-state": "filled" + "order-state": "filled", + "client-order-id": "a0001", + "order-type": "buy-limit" } } ``` @@ -3859,6 +3861,8 @@ price | string | 最新价(当order-state = submitted 时,p filled-amount | string | 最近成交数量 filled-cash-amount | string | 最近成交数额 unfilled-amount | string | 最近未成交数量(当order-state = submitted 时,unfilled-amount 为原始订单量;当order-state = canceled OR partial-canceled 时,unfilled-amount 为未成交数量;当order-state = filled 时,如果 order-type = buy-market,unfilled-amount 可能为一极小值;如果order-type <> buy-market 时,unfilled-amount 为零;当order-state = partial-filled AND role = taker 时,unfilled-amount 为未成交数量;当order-state = partial-filled AND role = maker 时,unfilled-amount 为未成交数量。) +client-order-id|string|用户自编订单号 +order-type|string|订单类型,包括buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker ## 请求用户资产数据 From b34fec7582d37635bc2784672d25b15599385c5e Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 6 Aug 2019 15:50:34 +0800 Subject: [PATCH 133/864] 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 87792ca5be5..65cf1c88268 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.08.06 15:00| "orders.$symbol.update"|新增|新增字段"client-order-id"和"order-type"。 |2019.08.02 18:00| "orders.$symbol.update"|优化|修改对字段"unfilled-amount"的描述。 |2019.07.23 21:00| "GET /v1/order/orders/{order-id}/matchresult" & "GET /v1/order/matchresults"|新增|新增手续费抵扣详情字段。 |2019.07.23 20:00| GET /v1/fee/fee-rate/get|新增|新增费率查询接口。 From bdeba296e41bbb0794f6d9b3a9aa94e6d2d0bafb Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 6 Aug 2019 17:57:31 +0800 Subject: [PATCH 134/864] 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 65cf1c88268..dc6dd613042 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,7 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| -|2019.08.06 15:00| "orders.$symbol.update"|新增|新增字段"client-order-id"和"order-type"。 +|2019.08.05 18:00| "orders.$symbol.update"|新增|新增字段"client-order-id"和"order-type"。 |2019.08.02 18:00| "orders.$symbol.update"|优化|修改对字段"unfilled-amount"的描述。 |2019.07.23 21:00| "GET /v1/order/orders/{order-id}/matchresult" & "GET /v1/order/matchresults"|新增|新增手续费抵扣详情字段。 |2019.07.23 20:00| GET /v1/fee/fee-rate/get|新增|新增费率查询接口。 From ca81ae7715b0d24abff366434847a6d7e05fcf37 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 16 Aug 2019 11:40:46 +0800 Subject: [PATCH 135/864] 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 dc6dd613042..4302c388171 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3592,7 +3592,7 @@ Websocket服务器同时支持一次性请求数据(pull)。 限频规则基于API key而不是连接。当请求频率超出限值时,Websocket客户端将收到"too many request"错误码。以下为各主题当前限频设定: -* accounts.list: once every 25 seconds +* accounts.list: once every 2 seconds * orders.list AND orders.detail: once every 5 seconds ### 鉴权 From d65ced4f0c0bc9811b3d93cbf04d4859c69f975a Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 21 Aug 2019 17:11:22 +0800 Subject: [PATCH 136/864] Update index.html.md --- 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 4302c388171..fa365b43021 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.08.21 18:00| "GET /v1/order/openOrders"|优化|修改请求字段列表。 |2019.08.05 18:00| "orders.$symbol.update"|新增|新增字段"client-order-id"和"order-type"。 |2019.08.02 18:00| "orders.$symbol.update"|优化|修改对字段"unfilled-amount"的描述。 |2019.07.23 21:00| "GET /v1/order/orders/{order-id}/matchresult" & "GET /v1/order/matchresults"|新增|新增手续费抵扣详情字段。 @@ -1684,11 +1685,9 @@ API Key 权限:读取 account-id | string | true | NA | 账户 ID,使用 GET /v1/account/accounts 接口获得。现货交易使用‘spot’账户的 account-id;杠杆交易,请使用 ‘margin’ 账户的 account-id symbol | string | ture | NA | 交易对, 例如btcusdt, ethbtc side | string | false | both | 指定只返回某一个方向的订单,可能的值有: buy, sell. 默认两个方向都返回。 -size | int | false | 10 | 返回订单的数量,最大值2000。 - - - - +from | string | false | |查询起始 ID +direct | string | false | |查询方向 (prev - 以起始ID升序检索;next - 以起始ID降序检索) +size | int | false | 100 | 返回订单的数量,最大值500。 > Response: From 585a7dd3605217bb50fd2220d93077e335263c40 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 21 Aug 2019 17:14:15 +0800 Subject: [PATCH 137/864] Update index.html.md --- source/index.html.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index fa365b43021..78f25be384e 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1665,11 +1665,8 @@ API Key 权限:读取 ```json { "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", "symbol": "ethusdt", - "type": "buy-limit" + "side": "buy" } ``` From d81abf717903a28711740f88a3268bf14bae460d Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 21 Aug 2019 17:28:25 +0800 Subject: [PATCH 138/864] 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 78f25be384e..3d98c3fa2da 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1683,7 +1683,7 @@ account-id | string | true | NA | 账户 ID,使用 GET /v1/account/ symbol | string | ture | NA | 交易对, 例如btcusdt, ethbtc side | string | false | both | 指定只返回某一个方向的订单,可能的值有: buy, sell. 默认两个方向都返回。 from | string | false | |查询起始 ID -direct | string | false | |查询方向 (prev - 以起始ID升序检索;next - 以起始ID降序检索) +direct | string | false (如字段'from'已设定,此字段'direct'为必填) | |查询方向 (prev - 以起始ID升序检索;next - 以起始ID降序检索) size | int | false | 100 | 返回订单的数量,最大值500。 > Response: From 52ffad1e32746d3e7a69e733ad441ae50d2d850b Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 29 Aug 2019 21:02:38 +0800 Subject: [PATCH 139/864] Update index.html.md --- source/index.html.md | 52 +++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 3d98c3fa2da..39387fd0ce1 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1537,7 +1537,9 @@ API Key 权限:交易 "source": "api", "symbol": "ethusdt", "type": "buy-limit", - "client-order-id": "a0001" + "client-order-id": "a0001", + "stop-price": "100", + "operator": "lte" } ``` @@ -1547,11 +1549,14 @@ API Key 权限:交易 --------- | --------- | -------- | ------- | ----------- account-id | string | true | NA | 账户 ID,使用 GET /v1/account/accounts 接口查询。现货交易使用 ‘spot’ 账户的 account-id;杠杆交易,请使用 ‘margin’ 账户的 account-id symbol | string | true | NA | 交易对, 例如btcusdt, ethbtc -type | string | true | NA | 订单类型,包括buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker(说明见下文) +type | string | true | NA | 订单类型,包括buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker, buy-stop-limit, sell-stop-limit(说明见下文) amount | string | true | NA | 订单交易量 price | string | false | NA | limit order的交易价格 source | string | false | api | 现货交易填写“api”,杠杆交易填写“margin-api” client-order-id| string | false | NA | 用户自编订单号(须在24小时内保持唯一性) +stop-price|string|false|NA|止盈止损订单触发价格 +operator|string|false|NA|止盈止损订单触发价运算符 gte – greater than and equal (>=), lte – less than and equal (<=) + **buy-limit-maker** @@ -1722,7 +1727,9 @@ filled-amount | string | 订单中已成交部分的数量 filled-cash-amount | string | 订单中已成交部分的总价格 filled-fees | string | 已交交易手续费总额 source | string | 现货交易填写“api” -state | string | 订单状态,包括submitted, partical-filled, cancelling +state | string | 订单状态,包括submitted, partical-filled, cancelling, created +stop-price|string|止盈止损订单触发价格 +operator|string|止盈止损订单触发价运算符 ## 批量撤销订单(open orders) @@ -1881,9 +1888,12 @@ API Key 权限:读取 | id | true | long | 订单ID | | | price | true | string | 订单价格 | | | source | true | string | 订单来源 | api | -| state | true | string | 订单状态 | submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | +| state | true | string | 订单状态 | submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销, created | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | -| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | +| stop-price | false | string | 止盈止损订单触发价格 | | +| operator | false | string | 止盈止损订单触发价运算符 | gte,lte | + ## 查询订单详情(基于client order ID) @@ -1949,9 +1959,11 @@ API Key 权限:读取 | id | true | long | 订单ID | | | price | true | string | 订单价格 | | | source | true | string | 订单来源 | api | -| state | true | string | 订单状态 | submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | +| state | true | string | 订单状态 | submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销,created | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | -| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | +| stop-price | false | string | 止盈止损订单触发价格 | | +| operator | false | string | 止盈止损订单触发价运算符 | gte,lte | 如client order ID不存在,返回如下错误信息 { @@ -2020,7 +2032,7 @@ API Key 权限:读取 | price | true | string | 成交价格 | | | source | true | string | 订单来源 | api | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | -| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | | role | true | string | 成交角色 |maker,taker | | filled-points | true | string | 抵扣数量 | | | fee-deduct-currency | true | string | 抵扣类型 |ht,hbpoint | @@ -2052,15 +2064,16 @@ API Key 权限:读取 | 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | | ---------- | ----- | ------ | ------ | ---- | ---- | | symbol | true | string | 交易对 | |btcusdt, ethbtc, rcneth ... | -| types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +| types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | | start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | -180 days | [-180 days, end-date] (自6月10日起, start-date与end-date的查询窗口最大为2天,如果超出范围,接口会返回错误码。 | | end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | today | [start-date, today] (自6月10日起, start-date与end-date的查询窗口最大为2天,如果超出范围,接口会返回错误码。 | -| states | true | string | 查询的订单状态组合,使用','分割 | | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | +| states | true | string | 查询的订单状态组合,使用','分割 | | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销,created| | from | false | string | 查询起始 ID | | | | direct | false | string | 查询方向 | | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | | size | false | string | 查询记录大小 | 100 | [1, 100] | + > Response: ```json @@ -2105,9 +2118,11 @@ API Key 权限:读取 | id | true | long | 订单ID | | | price | true | string | 订单价格 | | | source | true | string | 订单来源 | api | -| state | true | string | 订单状态 | submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | +| state | true | string | 订单状态 | submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销,created | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | -| type | true | string | 订单类型 | submit-cancel:已提交撤单申请 ,buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +| type | true | string | 订单类型 | submit-cancel:已提交撤单申请 ,buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | +| stop-price | false | string | 止盈止损订单触发价格 | | +| operator | false | string | 止盈止损订单触发价运算符 | gte,lte | ### start-date, end-date相关错误码 (自6月10日生效) @@ -2194,9 +2209,12 @@ API Key 权限:读取 | source | true | string | 订单来源 | api | | state | true | string | 订单状态 | partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销 | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | +| stop-price | false | string | 止盈止损订单触发价格 | | +| operator | false | string | 止盈止损订单触发价运算符 | gte,lte | | type} | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-limit-maker, sell-limit-maker | | next-time | false | long |下一查询起始时间(当请求字段”direct”为”prev”时有效), 下一查询结束时间(当请求字段”direct”为”next”时有效)。注:仅在检索出的总条目数量超出size字段限定时,此返回字段存在。 |UTC time in millisecond | + ## 当前和历史成交 API Key 权限:读取 @@ -2260,7 +2278,7 @@ API Key 权限:读取 | price | true | string | 成交价格 | | | source | true | string | 订单来源 | api | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | -| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | | role | true | string | 成交角色 |maker,taker | | filled-points | true | string | 抵扣数量 | | | fee-deduct-currency | true | string | 抵扣类型 |ht,hbpoint | @@ -3990,8 +4008,8 @@ API Key 权限:读取 --------- | --------- | -------- | ------- | ----------- | ---------- account-id | int | true | NA | 账户 id | NA symbol | string | true | NA | 交易对 | All supported trading symbols, e.g. btcusdt, bccbtc -types | string | false | NA | 查询的订单类型组合,使用','分割 | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc -states | string | false | NA | 查询的订单状态组合,使用','分割 | submitted, partial-filled, partial-canceled, filled, canceled +types | string | false | NA | 查询的订单类型组合,使用','分割 | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-stop-limit,sell-stop-limit +states | string | false | NA | 查询的订单状态组合,使用','分割 | submitted, partial-filled, partial-canceled, filled, canceled,created start-date | string | false | -61d | 查询开始日期, 日期格式yyyy-mm-dd | NA end-date | string | false | today | 查询结束日期, 日期格式yyyy-mm-dd | NA from | string | false | NA | 查询起始 ID | NA @@ -4046,6 +4064,8 @@ finished-at |string |最后成交时间| source |string |订单来源,请参考订单来源说明| state |string |订单状态,请参考订单状态说明| cancel-at |long |撤单时间| +stop-price | string | 止盈止损订单触发价格 | +operator | string | 止盈止损订单触发价运算符 | ## 以订单编号请求订单 @@ -4124,6 +4144,8 @@ finished-at |string |最后成交时间| source |string |订单来源,请参考订单来源说明| state |string |订单状态,请参考订单状态说明| cancel-at |long |撤单时间| +stop-price | string | 止盈止损订单触发价格 | +operator | string | 止盈止损订单触发价运算符 |
From b87aedd4db8114c44c1475d42cd6a26c56e70afe Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 29 Aug 2019 21:04:10 +0800 Subject: [PATCH 140/864] 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 39387fd0ce1..c2269b87a6a 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.08.29 21:00| 下单、查询、订阅接口|新增|支持止盈止损订单类型。 |2019.08.21 18:00| "GET /v1/order/openOrders"|优化|修改请求字段列表。 |2019.08.05 18:00| "orders.$symbol.update"|新增|新增字段"client-order-id"和"order-type"。 |2019.08.02 18:00| "orders.$symbol.update"|优化|修改对字段"unfilled-amount"的描述。 From d3215dbd25560d957fdaa1329c25f80f7d4d6c49 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 29 Aug 2019 21:14:57 +0800 Subject: [PATCH 141/864] Update index.html.md --- source/index.html.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index c2269b87a6a..88190faa19f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1538,9 +1538,7 @@ API Key 权限:交易 "source": "api", "symbol": "ethusdt", "type": "buy-limit", - "client-order-id": "a0001", - "stop-price": "100", - "operator": "lte" + "client-order-id": "a0001" } ``` From b426a5bf55142ffba15bddad83694f96e6837144 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 29 Aug 2019 21:24:22 +0800 Subject: [PATCH 142/864] 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 88190faa19f..9ab3730e7d3 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2230,7 +2230,7 @@ API Key 权限:读取 | 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | | ---------- | ----- | ------ | ------ | ---- | ----------- | | symbol | true | string | 交易对 | NA | btcusdt, ethbtc, rcneth ... | -| types | false | string | 查询的订单类型组合,使用','分割 | all | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单 | +| types | false | string | 查询的订单类型组合,使用','分割 | all | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit, sell-stop-limit | | start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | -61 days | [-61day, today] (自6月10日起, start-date与end-date的查询窗口最大为2天,如果超出范围,接口会返回错误码。 || | end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | today | [start-date, today] (自6月10日起, start-date与end-date的查询窗口最大为2天,如果超出范围,接口会返回错误码。 | | | from | false | string | 查询起始 ID | 订单成交记录ID(最大值) | | From 5b151897f0eb259a72afc1e060e02055f4a0c13d Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 29 Aug 2019 22:19:26 +0800 Subject: [PATCH 143/864] 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 9ab3730e7d3..4ddbc80ae60 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3876,7 +3876,7 @@ filled-amount | string | 最近成交数量 filled-cash-amount | string | 最近成交数额 unfilled-amount | string | 最近未成交数量(当order-state = submitted 时,unfilled-amount 为原始订单量;当order-state = canceled OR partial-canceled 时,unfilled-amount 为未成交数量;当order-state = filled 时,如果 order-type = buy-market,unfilled-amount 可能为一极小值;如果order-type <> buy-market 时,unfilled-amount 为零;当order-state = partial-filled AND role = taker 时,unfilled-amount 为未成交数量;当order-state = partial-filled AND role = maker 时,unfilled-amount 为未成交数量。) client-order-id|string|用户自编订单号 -order-type|string|订单类型,包括buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker +order-type|string|订单类型,包括buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker,buy-stop-limit,sell-stop-limit ## 请求用户资产数据 From 1097400993468eda6f7ca5d90d3cb67e886d90c2 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 30 Aug 2019 10:59:11 +0800 Subject: [PATCH 144/864] 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 4ddbc80ae60..68ea846a9e3 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3789,7 +3789,7 @@ account-id | string | 账户 id order-amount | string | 订单数量 order-price | string | 订单价格 created-at | int | 订单创建时间 (UNIX epoch time in millisecond) -order-type | string | 订单类型, 有效取值: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker +order-type | string | 订单类型, 有效取值: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker,buy-stop-limit,sell-stop-limit order-source | string | 订单来源, 有效取值: sys, web, api, app order-state | string | 订单状态, 有效取值: submitted, partical-filled, cancelling, filled, canceled, partial-canceled role | string | 成交角色: taker or maker From 5aec1a69e428d973c8dd5dd3e76c3affea76e34e Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 30 Aug 2019 18:12:38 +0800 Subject: [PATCH 145/864] 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 68ea846a9e3..005b0187685 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3217,6 +3217,7 @@ vol | float | 成交额, 即 sum(每一笔成交价 * 该笔的成交 ### 数据请求 用请求方式一次性获取K线数据需要额外提供以下参数: +(每次最多返回300条) ```json { From 02f1433ea301cdefe65f6fd14400014edb3230c6 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 2 Sep 2019 16:27:58 +0800 Subject: [PATCH 146/864] Update index.html.md --- source/index.html.md | 111 +------------------------------------------ 1 file changed, 1 insertion(+), 110 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 005b0187685..d4a638f0ee5 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.09.02 16:00| 删除稳定币兑换相关节点。 |2019.08.29 21:00| 下单、查询、订阅接口|新增|支持止盈止损订单类型。 |2019.08.21 18:00| "GET /v1/order/openOrders"|优化|修改请求字段列表。 |2019.08.05 18:00| "orders.$symbol.update"|新增|新增字段"client-order-id"和"order-type"。 @@ -1231,116 +1232,6 @@ currency| - |string| - |币种 |-| type| - |string| - |账户类型 |trade:交易账户,frozen:冻结账户| balance|-|decimal|- |账户余额 |-| -# 稳定币兑换 - - - -## 稳定币兑换汇率 - -API Key 权限:只读 - -查询稳定币兑换汇率 - -### HTTP 请求 - -- GET ` /v1/stable_coin/exchange_rate` - -### 请求参数 - -N/A - -> Response: - -```json -{"currency":"usdc", - "buy-rate":"0.8000", - "buy-quota":"0", - "sell-rate":"1.2002", - "sell-quota":"100002857.70540000", - "state":3, - "time":1560343605749}, -{"currency":"tusd", - "buy-rate":"0.9800", - "buy-quota":"210991800.00000000", - "sell-rate":"1.0000", - "sell-quota":"0", - "state":1, - "time":1560343605749} -} -``` - -### 响应数据 - -| 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | -| ---- | ----- | ---- | ---- | ---- | -|currency|是|string|稳定币币种|| -|buy_rate|是| string| 兑入汇率,即用户方使用HUSD买入查询稳定币的汇率|| -|buy_quota|是| string| 兑入限额,即当前平台支持用户方可以买入的稳定币最大数量|| -|sell_rate|是| string| 兑出汇率,即用户方使用查询稳定币买入HUSD的汇率 || -|sell_quota|是 |string| 兑出限额,即当前平台支持用户方可以卖出的稳定币最大数量| | -|state|是| int| 稳定币兑入兑出状态| 1-支持兑入兑出、2-不支持兑入兑出、 3-支持兑入不支持兑出、4-支持兑出不 支持兑入| -|time|是|long|时间戳|| - -## 稳定币兑换 - -API Key 权限:交易 - -稳定币兑换 - -### HTTP 请求 - -- POST ` /v1/stable_coin/exchange` - -```json -{"currency":"pax", - "type":"buy", - "amount":"1.96", -} -``` -### 请求参数 - -|参数|是否必填 | 数据类型 | 说明 | 取值范围 | -|------|-------|--------|--------|----------| -|currency|是| string| 稳定币币种 | | -|amount|是| string |兑入或兑出的稳定币金额数量| | -|type|是| string| 兑换方向| buy兑入/sell兑出 | - -> Response: - -```json -{"id":2529, - "currency":"pax", - "type":"buy", - "amount":"1.96", - "rate":"1", - "exchange_amount":"1.96", - "time":1560342471413} -} -``` - -### 响应数据 - -| 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | -| ---- | ----- | ---- | ---- | ---- | -|id|是| long| 兑换记录 ID| | -|currency|是|string|稳定币币种|| -|type|是| string| 兑换方向| buy兑入/sell兑出 | -|amount|是| string |兑入或兑出的稳定币金额数量| | -|rate|是| string |兑换费率,即此次兑换操作的汇率|| -|exchange_amount|是| String| 成功兑入或兑出的 HUSD 数量 || -|time|是|long|时间戳|| - -### 错误码 - -|err-code|err-message| -| ---- | ----- | -|invalid-currency| 币种无效 | -|invalid-amount |amount<1 或 amount>最大值 99999999999999999.99999999| -|invalid-type| type不为 buy或 sell| -|Insufficient_balance| 账户可用余额不足| -|insufficient-quota |稳定币限额不足/超出稳定币限额| -|exchange-failure |后端其他错误引起的兑换失败| - # 钱包(充值与提现) From c3589097810379a9ccb626e6d308b18cd4dab714 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 2 Sep 2019 18:17:30 +0800 Subject: [PATCH 147/864] 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 d4a638f0ee5..e8d27fad517 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1639,7 +1639,7 @@ API Key 权限:交易 | 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | | -------- | ---- | ------ | ------------ | ---- | ---- | | account-id | true | string | 账户ID | | | -| symbol | false | string | 交易对 | | 单个交易对字符串,缺省将返回所有符合条件尚未成交订单 | +| symbol | false | string | 交易对 | | 交易代码列表(最多10 个symbols,多个交易代码间以逗号分隔),缺省将返回所有符合条件尚未成交订单 | | side | false | string | 主动交易方向 | | “buy”或“sell”,缺省将返回所有符合条件尚未成交订单 | | size | false | int | 所需返回记录数 | 100 | [0,100] | From 68654bbec147edd7a16812fbfdda8bb998d4c834 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 2 Sep 2019 18:24:31 +0800 Subject: [PATCH 148/864] 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 e8d27fad517..26c17d8ad62 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.09.02 18:00| 在节点POST /v1/order/orders/batchCancelOpenOrders中更改请求字段"symbol"的描述 |2019.09.02 16:00| 删除稳定币兑换相关节点。 |2019.08.29 21:00| 下单、查询、订阅接口|新增|支持止盈止损订单类型。 |2019.08.21 18:00| "GET /v1/order/openOrders"|优化|修改请求字段列表。 From ab25828ce146d47d5d1af648f3241a22acbfa0ec Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 3 Sep 2019 10:07:39 +0800 Subject: [PATCH 149/864] 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 26c17d8ad62..4e95659ac69 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,7 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| -|2019.09.02 18:00| 在节点POST /v1/order/orders/batchCancelOpenOrders中更改请求字段"symbol"的描述 +|2019.09.02 18:00| POST /v1/order/orders/batchCancelOpenOrders|优化|更改请求字段"symbol"的描述 |2019.09.02 16:00| 删除稳定币兑换相关节点。 |2019.08.29 21:00| 下单、查询、订阅接口|新增|支持止盈止损订单类型。 |2019.08.21 18:00| "GET /v1/order/openOrders"|优化|修改请求字段列表。 @@ -1640,7 +1640,7 @@ API Key 权限:交易 | 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | | -------- | ---- | ------ | ------------ | ---- | ---- | | account-id | true | string | 账户ID | | | -| symbol | false | string | 交易对 | | 交易代码列表(最多10 个symbols,多个交易代码间以逗号分隔),缺省将返回所有符合条件尚未成交订单 | +| symbol | false | string | 交易代码列表(最多10 个symbols,多个交易代码间以逗号分隔) | all | | | side | false | string | 主动交易方向 | | “buy”或“sell”,缺省将返回所有符合条件尚未成交订单 | | size | false | int | 所需返回记录数 | 100 | [0,100] | From 19add729ba585b9c8a260a6696caf91af2eab3a2 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 9 Sep 2019 09:39:33 +0800 Subject: [PATCH 150/864] Update index.html.md --- source/index.html.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 4e95659ac69..60afdcb8836 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.09.09 10:00| GET /v1/order/orders; GET /v1/order/matchresults |修改|修改请求字段start-date与end-date的默认值及取值范围的描述| |2019.09.02 18:00| POST /v1/order/orders/batchCancelOpenOrders|优化|更改请求字段"symbol"的描述 |2019.09.02 16:00| 删除稳定币兑换相关节点。 |2019.08.29 21:00| 下单、查询、订阅接口|新增|支持止盈止损订单类型。 @@ -1956,8 +1957,8 @@ API Key 权限:读取 | ---------- | ----- | ------ | ------ | ---- | ---- | | symbol | true | string | 交易对 | |btcusdt, ethbtc, rcneth ... | | types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | -| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | -180 days | [-180 days, end-date] (自6月10日起, start-date与end-date的查询窗口最大为2天,如果超出范围,接口会返回错误码。 | -| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | today | [start-date, today] (自6月10日起, start-date与end-date的查询窗口最大为2天,如果超出范围,接口会返回错误码。 | +| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | -1d 查询结束日期的前1天 | 取值范围 [((end-date) – 1), (end-date)] 查询窗口最大为2天,窗口平移范围为最近180天,已完全撤销的历史订单的查询窗口平移范围只有最近7天 | +| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | today | 取值范围 [(today-179), today] 查询窗口最大为2天,窗口平移范围为最近180天,已完全撤销的历史订单的查询窗口平移范围只有最近7天 | | states | true | string | 查询的订单状态组合,使用','分割 | | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销,created| | from | false | string | 查询起始 ID | | | | direct | false | string | 查询方向 | | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | @@ -2015,7 +2016,7 @@ API Key 权限:读取 | stop-price | false | string | 止盈止损订单触发价格 | | | operator | false | string | 止盈止损订单触发价运算符 | gte,lte | -### start-date, end-date相关错误码 (自6月10日生效) +### start-date, end-date相关错误码 |错误码|对应错误场景| |------------|----------------------------------------------| @@ -2123,8 +2124,8 @@ API Key 权限:读取 | ---------- | ----- | ------ | ------ | ---- | ----------- | | symbol | true | string | 交易对 | NA | btcusdt, ethbtc, rcneth ... | | types | false | string | 查询的订单类型组合,使用','分割 | all | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit, sell-stop-limit | -| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | -61 days | [-61day, today] (自6月10日起, start-date与end-date的查询窗口最大为2天,如果超出范围,接口会返回错误码。 || -| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | today | [start-date, today] (自6月10日起, start-date与end-date的查询窗口最大为2天,如果超出范围,接口会返回错误码。 | | +| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | -1d 查询结束日期的前1天 | 取值范围 [((end-date) – 1), (end-date)] 查询窗口最大为2天,窗口平移范围为最近61天 | +| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | today | 取值范围 [(today-60), today] 查询窗口最大为2天,窗口平移范围为最近61天 | | from | false | string | 查询起始 ID | 订单成交记录ID(最大值) | | | direct | false | string | 查询方向 | 默认 next, 成交记录 ID 由大到小排序 | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | | size | false | string | 查询记录大小 | 100 | [1,100] | @@ -2174,7 +2175,7 @@ API Key 权限:读取 | filled-points | true | string | 抵扣数量 | | | fee-deduct-currency | true | string | 抵扣类型 |ht,hbpoint | -### start-date, end-date相关错误码 (自6月10日生效) +### start-date, end-date相关错误码 |错误码|对应错误场景| |------------|----------------------------------------------| From 0775611a0190ff4c37b42f3a47b0a6c3f55fda1a Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 9 Sep 2019 09:41:32 +0800 Subject: [PATCH 151/864] Update index.html.md --- 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 60afdcb8836..9e249124a5d 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1957,8 +1957,8 @@ API Key 权限:读取 | ---------- | ----- | ------ | ------ | ---- | ---- | | symbol | true | string | 交易对 | |btcusdt, ethbtc, rcneth ... | | types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | -| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | -1d 查询结束日期的前1天 | 取值范围 [((end-date) – 1), (end-date)] 查询窗口最大为2天,窗口平移范围为最近180天,已完全撤销的历史订单的查询窗口平移范围只有最近7天 | -| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | today | 取值范围 [(today-179), today] 查询窗口最大为2天,窗口平移范围为最近180天,已完全撤销的历史订单的查询窗口平移范围只有最近7天 | +| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | -1d 查询结束日期的前1天 | 取值范围 [((end-date) – 1), (end-date)] ,查询窗口最大为2天,窗口平移范围为最近180天,已完全撤销的历史订单的查询窗口平移范围只有最近7天 | +| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | today | 取值范围 [(today-179), today] ,查询窗口最大为2天,窗口平移范围为最近180天,已完全撤销的历史订单的查询窗口平移范围只有最近7天 | | states | true | string | 查询的订单状态组合,使用','分割 | | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销,created| | from | false | string | 查询起始 ID | | | | direct | false | string | 查询方向 | | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | @@ -2124,8 +2124,8 @@ API Key 权限:读取 | ---------- | ----- | ------ | ------ | ---- | ----------- | | symbol | true | string | 交易对 | NA | btcusdt, ethbtc, rcneth ... | | types | false | string | 查询的订单类型组合,使用','分割 | all | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit, sell-stop-limit | -| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | -1d 查询结束日期的前1天 | 取值范围 [((end-date) – 1), (end-date)] 查询窗口最大为2天,窗口平移范围为最近61天 | -| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | today | 取值范围 [(today-60), today] 查询窗口最大为2天,窗口平移范围为最近61天 | +| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | -1d 查询结束日期的前1天 | 取值范围 [((end-date) – 1), (end-date)] ,查询窗口最大为2天,窗口平移范围为最近61天 | +| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | today | 取值范围 [(today-60), today] ,查询窗口最大为2天,窗口平移范围为最近61天 | | from | false | string | 查询起始 ID | 订单成交记录ID(最大值) | | | direct | false | string | 查询方向 | 默认 next, 成交记录 ID 由大到小排序 | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | | size | false | string | 查询记录大小 | 100 | [1,100] | From 910d422986b6333ef311e6ec2e344969a89e6d7f Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 9 Sep 2019 10:20:59 +0800 Subject: [PATCH 152/864] 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 9e249124a5d..650b3eff8ac 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1957,8 +1957,8 @@ API Key 权限:读取 | ---------- | ----- | ------ | ------ | ---- | ---- | | symbol | true | string | 交易对 | |btcusdt, ethbtc, rcneth ... | | types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | -| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | -1d 查询结束日期的前1天 | 取值范围 [((end-date) – 1), (end-date)] ,查询窗口最大为2天,窗口平移范围为最近180天,已完全撤销的历史订单的查询窗口平移范围只有最近7天 | -| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | today | 取值范围 [(today-179), today] ,查询窗口最大为2天,窗口平移范围为最近180天,已完全撤销的历史订单的查询窗口平移范围只有最近7天 | +| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | -1d 查询结束日期的前1天 | 取值范围 [((end-date) – 1), (end-date)] ,查询窗口最大为2天,窗口平移范围为最近180天,已完全撤销的历史订单的查询窗口平移范围只有最近7天(state="canceled") | +| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | today | 取值范围 [(today-179), today] ,查询窗口最大为2天,窗口平移范围为最近180天,已完全撤销的历史订单的查询窗口平移范围只有最近7天(state="canceled") | | states | true | string | 查询的订单状态组合,使用','分割 | | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销,created| | from | false | string | 查询起始 ID | | | | direct | false | string | 查询方向 | | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | From 295700acdfc349773d2208fba916599109cd717d Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 9 Sep 2019 10:54:19 +0800 Subject: [PATCH 153/864] Update index.html.md --- 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 650b3eff8ac..a7a868c5dc0 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.09.09 11:00| POST /v1/order/orders/submitCancelClientOrder |修改|修改返回数据描述| |2019.09.09 10:00| GET /v1/order/orders; GET /v1/order/matchresults |修改|修改请求字段start-date与end-date的默认值及取值范围的描述| |2019.09.02 18:00| POST /v1/order/orders/batchCancelOpenOrders|优化|更改请求字段"symbol"的描述 |2019.09.02 16:00| 删除稳定币兑换相关节点。 @@ -1546,12 +1547,22 @@ API Key 权限:交易 ```json { - "data": "59378" + "data": "10" } ``` ### 响应数据 -返回的主数据对象是一个对应下单单号的字符串。 +字段名称 | 数据类型 | 描述 +--------- | --------- | ----------- +data | integer | 撤单状态码 + +撤单状态码 +0 - 订单没找到 +5 - 部分撤销 +6 - 已成交 +7 - 已撤销 +10 - 正在撤销 + ## 查询当前未成交订单 From bc9b4d655129b18f752a154dac99b31294060a85 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 9 Sep 2019 13:07:44 +0800 Subject: [PATCH 154/864] Update index.html.md --- 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 a7a868c5dc0..86b74c8218f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1557,10 +1557,10 @@ API Key 权限:交易 data | integer | 撤单状态码 撤单状态码 -0 - 订单没找到 -5 - 部分撤销 -6 - 已成交 -7 - 已撤销 +0 - 订单没找到; +5 - 部分撤销; +6 - 已成交; +7 - 已撤销; 10 - 正在撤销 From 531dab45e71bb311280cd9ef820e752a79f28391 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 9 Sep 2019 18:00:15 +0800 Subject: [PATCH 155/864] Update index.html.md --- 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 86b74c8218f..2cc1c89ada8 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1630,7 +1630,7 @@ filled-amount | string | 订单中已成交部分的数量 filled-cash-amount | string | 订单中已成交部分的总价格 filled-fees | string | 已交交易手续费总额 source | string | 现货交易填写“api” -state | string | 订单状态,包括submitted, partical-filled, cancelling, created +state | string | 订单状态,包括submitted, partial-filled, cancelling, created stop-price|string|止盈止损订单触发价格 operator|string|止盈止损订单触发价运算符 @@ -3696,7 +3696,7 @@ order-price | string | 订单价格 created-at | int | 订单创建时间 (UNIX epoch time in millisecond) order-type | string | 订单类型, 有效取值: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker,buy-stop-limit,sell-stop-limit order-source | string | 订单来源, 有效取值: sys, web, api, app -order-state | string | 订单状态, 有效取值: submitted, partical-filled, cancelling, filled, canceled, partial-canceled +order-state | string | 订单状态, 有效取值: submitted, partial-filled, cancelling, filled, canceled, partial-canceled role | string | 成交角色: taker or maker price | string | 成交价格 filled-amount | string | 单次成交数量 @@ -3774,7 +3774,7 @@ Field | Data Type | Description match-id | integer | 最近撮合编号(当order-state = submitted, canceled, partial-canceled时,match-id 为消息序列号;当order-state = filled, partial-filled 时,match-id 为最近撮合编号。) order-id | integer | 订单编号 symbol | string | 交易代码 -order-state | string | 订单状态, 有效取值: submitted, partical-filled, cancelling, filled, canceled, partial-canceled +order-state | string | 订单状态, 有效取值: submitted, partial-filled, cancelling, filled, canceled, partial-canceled role | string | 最近成交角色(当order-state = submitted, canceled, partial-canceled时,role 为缺省值taker;当order-state = filled, partial-filled 时,role 取值为taker 或maker。) price | string | 最新价(当order-state = submitted 时,price 为订单价格;当order-state = canceled, partial-canceled 时,price 为零;当order-state = filled, partial-filled 时,price 为最近成交价。当role = taker,且该订单同时与多张对手方订单撮合时,price 为多笔成交均价。) filled-amount | string | 最近成交数量 From aa719083899757997ce9f7f3ffaa6a15e6fbd879 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 9 Sep 2019 18:13:19 +0800 Subject: [PATCH 156/864] 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 2cc1c89ada8..123e96a99e7 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1443,7 +1443,7 @@ API Key 权限:交易 account-id | string | true | NA | 账户 ID,使用 GET /v1/account/accounts 接口查询。现货交易使用 ‘spot’ 账户的 account-id;杠杆交易,请使用 ‘margin’ 账户的 account-id symbol | string | true | NA | 交易对, 例如btcusdt, ethbtc type | string | true | NA | 订单类型,包括buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker, buy-stop-limit, sell-stop-limit(说明见下文) -amount | string | true | NA | 订单交易量 +amount | string | true | NA | 订单交易量(市价买单此字段为订单交易额) price | string | false | NA | limit order的交易价格 source | string | false | api | 现货交易填写“api”,杠杆交易填写“margin-api” client-order-id| string | false | NA | 用户自编订单号(须在24小时内保持唯一性) From a81bd82391240d6c998420fa00da224f0a7fd28b Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 9 Sep 2019 19:35:34 +0800 Subject: [PATCH 157/864] 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 123e96a99e7..1a811435eda 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1937,7 +1937,7 @@ API Key 权限:读取 | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | | role | true | string | 成交角色 |maker,taker | -| filled-points | true | string | 抵扣数量 | | +| filled-points | true | string | 抵扣数量(可为ht或hbpoints) | | | fee-deduct-currency | true | string | 抵扣类型 |ht,hbpoint | ## 搜索历史订单 @@ -2183,7 +2183,7 @@ API Key 权限:读取 | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | | role | true | string | 成交角色 |maker,taker | -| filled-points | true | string | 抵扣数量 | | +| filled-points | true | string | 抵扣数量(可为ht或hbpoints) | | | fee-deduct-currency | true | string | 抵扣类型 |ht,hbpoint | ### start-date, end-date相关错误码 From bf5c932a2fe18f8a9243ec26084b78253a6274e5 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 9 Sep 2019 19:38:40 +0800 Subject: [PATCH 158/864] 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 1a811435eda..faeaa9b6251 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1937,7 +1937,7 @@ API Key 权限:读取 | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | | role | true | string | 成交角色 |maker,taker | -| filled-points | true | string | 抵扣数量(可为ht或hbpoints) | | +| filled-points | true | string | 抵扣数量(可为ht或hbpoint) | | | fee-deduct-currency | true | string | 抵扣类型 |ht,hbpoint | ## 搜索历史订单 @@ -2183,7 +2183,7 @@ API Key 权限:读取 | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | | role | true | string | 成交角色 |maker,taker | -| filled-points | true | string | 抵扣数量(可为ht或hbpoints) | | +| filled-points | true | string | 抵扣数量(可为ht或hbpoint) | | | fee-deduct-currency | true | string | 抵扣类型 |ht,hbpoint | ### start-date, end-date相关错误码 From 972cfe4de50354f407af8fce87d3340206520890 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 10 Sep 2019 09:48:57 +0800 Subject: [PATCH 159/864] 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 faeaa9b6251..1048739d9f7 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1938,7 +1938,7 @@ API Key 权限:读取 | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | | role | true | string | 成交角色 |maker,taker | | filled-points | true | string | 抵扣数量(可为ht或hbpoint) | | -| fee-deduct-currency | true | string | 抵扣类型 |ht,hbpoint | +| fee-deduct-currency | true | string | 抵扣类型 |如果为空,代表扣除的手续费是原币;如果为"ht",代表抵扣手续费的是HT;如果为"hbpoint",代表抵扣手续费的是点卡 | ## 搜索历史订单 From 527f4b1d8b749ea8e68ac2ebdf5e3b96f56c9331 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 10 Sep 2019 10:05:32 +0800 Subject: [PATCH 160/864] Update index.html.md --- source/index.html.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 1048739d9f7..16eff46a6df 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1630,7 +1630,7 @@ filled-amount | string | 订单中已成交部分的数量 filled-cash-amount | string | 订单中已成交部分的总价格 filled-fees | string | 已交交易手续费总额 source | string | 现货交易填写“api” -state | string | 订单状态,包括submitted, partial-filled, cancelling, created +state | string | 订单状态,包括submitted, partial-filled, created stop-price|string|止盈止损订单触发价格 operator|string|止盈止损订单触发价运算符 @@ -1791,7 +1791,7 @@ API Key 权限:读取 | id | true | long | 订单ID | | | price | true | string | 订单价格 | | | source | true | string | 订单来源 | api | -| state | true | string | 订单状态 | submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销, created | +| state | true | string | 订单状态 | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销, created | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | | stop-price | false | string | 止盈止损订单触发价格 | | @@ -1862,7 +1862,7 @@ API Key 权限:读取 | id | true | long | 订单ID | | | price | true | string | 订单价格 | | | source | true | string | 订单来源 | api | -| state | true | string | 订单状态 | submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销,created | +| state | true | string | 订单状态 | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销,created | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | | stop-price | false | string | 止盈止损订单触发价格 | | @@ -2021,7 +2021,7 @@ API Key 权限:读取 | id | true | long | 订单ID | | | price | true | string | 订单价格 | | | source | true | string | 订单来源 | api | -| state | true | string | 订单状态 | submitting , submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销,created | +| state | true | string | 订单状态 | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销,created | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | type | true | string | 订单类型 | submit-cancel:已提交撤单申请 ,buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | | stop-price | false | string | 止盈止损订单触发价格 | | @@ -3696,7 +3696,7 @@ order-price | string | 订单价格 created-at | int | 订单创建时间 (UNIX epoch time in millisecond) order-type | string | 订单类型, 有效取值: buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker,buy-stop-limit,sell-stop-limit order-source | string | 订单来源, 有效取值: sys, web, api, app -order-state | string | 订单状态, 有效取值: submitted, partial-filled, cancelling, filled, canceled, partial-canceled +order-state | string | 订单状态, 有效取值: submitted, partial-filled, filled, canceled, partial-canceled role | string | 成交角色: taker or maker price | string | 成交价格 filled-amount | string | 单次成交数量 @@ -3774,7 +3774,7 @@ Field | Data Type | Description match-id | integer | 最近撮合编号(当order-state = submitted, canceled, partial-canceled时,match-id 为消息序列号;当order-state = filled, partial-filled 时,match-id 为最近撮合编号。) order-id | integer | 订单编号 symbol | string | 交易代码 -order-state | string | 订单状态, 有效取值: submitted, partial-filled, cancelling, filled, canceled, partial-canceled +order-state | string | 订单状态, 有效取值: submitted, partial-filled, filled, canceled, partial-canceled role | string | 最近成交角色(当order-state = submitted, canceled, partial-canceled时,role 为缺省值taker;当order-state = filled, partial-filled 时,role 取值为taker 或maker。) price | string | 最新价(当order-state = submitted 时,price 为订单价格;当order-state = canceled, partial-canceled 时,price 为零;当order-state = filled, partial-filled 时,price 为最近成交价。当role = taker,且该订单同时与多张对手方订单撮合时,price 为多笔成交均价。) filled-amount | string | 最近成交数量 From 61dcbda42f069a9f915111890dad252331691733 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 10 Sep 2019 10:08:34 +0800 Subject: [PATCH 161/864] 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 16eff46a6df..e59f4ab7cf6 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.09.10 10:00| 除节点POST /v1/order/orders/submitCancelClientOrder以外,去除了其它节点中订单状态取值submitting以及cancelling| |2019.09.09 11:00| POST /v1/order/orders/submitCancelClientOrder |修改|修改返回数据描述| |2019.09.09 10:00| GET /v1/order/orders; GET /v1/order/matchresults |修改|修改请求字段start-date与end-date的默认值及取值范围的描述| |2019.09.02 18:00| POST /v1/order/orders/batchCancelOpenOrders|优化|更改请求字段"symbol"的描述 From 4166f1a6f570cc01f20c6dde984fa51be3317cf7 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 10 Sep 2019 10:15:09 +0800 Subject: [PATCH 162/864] 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 e59f4ab7cf6..38198fe3e33 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,7 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| -|2019.09.10 10:00| 除节点POST /v1/order/orders/submitCancelClientOrder以外,去除了其它节点中订单状态取值submitting以及cancelling| +|2019.09.10 10:00| 除节点POST /v1/order/orders/submitCancelClientOrder以外,去除了其它节点中订单状态取值submitting以及cancelling|修改|除节点POST /v1/order/orders/submitCancelClientOrder以外,去除了其它节点中订单状态取值submitting以及cancelling| |2019.09.09 11:00| POST /v1/order/orders/submitCancelClientOrder |修改|修改返回数据描述| |2019.09.09 10:00| GET /v1/order/orders; GET /v1/order/matchresults |修改|修改请求字段start-date与end-date的默认值及取值范围的描述| |2019.09.02 18:00| POST /v1/order/orders/batchCancelOpenOrders|优化|更改请求字段"symbol"的描述 From 3f9d115483361aacc9d7ff4bdafcb0414e68869a Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 12 Sep 2019 16:38:47 +0800 Subject: [PATCH 163/864] Update index.html.md --- source/index.html.md | 103 +++++++++++++++++++++++++++++-------------- 1 file changed, 70 insertions(+), 33 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 38198fe3e33..ea8fb57a73f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -17,7 +17,7 @@ search: False 欢迎使用火币 API! 你可以使用此 API 获得市场行情数据,进行交易,并且管理你的账户。 -在文档的右侧是代码示例,目前我们仅提供针对 `shell` 的代码示例。 +在文档的右侧是代码,目前我们仅提供针对 `shell` 的代码示例。 你可以通过选择上方下拉菜单的版本号来切换文档对应的 API 版本,也可以通过点击右上方的语言按钮来切换文档语言。 @@ -75,6 +75,8 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.09.11 17:00| GET v1/stable-coin/quote,POST v1/stable-coin/exchange |新增|新增稳定币兑换节点| +|2019.09.11 16:00| 删除部分代码示例 |删除|删除部分代码示例| |2019.09.10 10:00| 除节点POST /v1/order/orders/submitCancelClientOrder以外,去除了其它节点中订单状态取值submitting以及cancelling|修改|除节点POST /v1/order/orders/submitCancelClientOrder以外,去除了其它节点中订单状态取值submitting以及cancelling| |2019.09.09 11:00| POST /v1/order/orders/submitCancelClientOrder |修改|修改返回数据描述| |2019.09.09 10:00| GET /v1/order/orders; GET /v1/order/matchresults |修改|修改请求字段start-date与end-date的默认值及取值范围的描述| @@ -360,39 +362,9 @@ code 的具体解释, 参考对应的 `err-msg`. [C++](https://github.com/huobiapi/huobi_Cpp) -**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) +https://github.com/huobiapi?tab=repositories ## 常见问题 Q & A @@ -1407,7 +1379,72 @@ API Key 权限:读取 | confirm-error | 区块确认错误 | | repealed | 已撤销 | +# 稳定币兑换 + +## 稳定币兑换价格查询 + +GET v1/stable-coin/quote +API Key 权限:读取 + +### 请求参数 + +| 参数名称 | 是否必须 | 类型 | 描述 |取值范围 | +| ---------- | ---- | ------ | ------ | ---- | +| currency | true | string | 与HUSD兑换的稳定币币种 | USDT/PAX/USDC/TUSD | +| amount | true | string | 与HUSD兑换的稳定币币种数量 |amount必须为整数 | +| type | true | string | 兑换方向 |buy兑入/sell兑出 | + +### 响应数据 + +| 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +| ---- | ----- | ---- | ---- | ---- | +| currency | true | string | 与HUSD兑换的稳定币币种 | USDT/PAX/USDC/TUSD | +| amount | true | string | 与HUSD兑换的稳定币币种数量 |因兑换账户额度等因素影响,返回的amount可能会比请求的amount小 | +| type | true | string | 兑换方向 |buy兑入/sell兑出 | +| exchange-amount | true | string | 匹配的HUSD数量 |type=buy时,exchange-amount为用户所需支付的husd数量;type=sell时,exchange-amount为用户可获得的husd数量 | +| quote-id | true | string | 该次稳定币报价唯一ID | | +| expiration | true | string | 确认兑换有效期 |时间(一般为接口请求时间向后延伸10秒) | + +### 错误码 + +| 响应码 | 说明 | +| ---- | ----- | +| invalid-currency | 币种无效 | +| invalid-amount | 币种数量小于最低值(10万)或大于当前可兑换额度 | +| invalid-type | type不为sell或buy | +| quote-failure | 后端其他错误引起的后端其他错误引起的价格查询失败 | + +## 兑换稳定币 + +POST v1/stable-coin/exchange +API Key 权限:交易 + +### 请求参数 + +| 参数名称 | 是否必须 | 类型 | 描述 |取值范围 | +| ---------- | ---- | ------ | ------ | ---- | +| quote-id | true | string | 该次稳定币报价唯一ID | | + +### 响应数据 + +| 参数名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +| ---- | ----- | ---- | ---- | ---- | +| transact-id | true | long | 兑换记录ID | | +| currency | true | string | 与HUSD兑换的稳定币币种 | USDT/PAX/USDC/TUSD | +| amount | true | string | 与HUSD兑换的稳定币币种数量 | | +| type | true | string | 兑换方向 |buy兑入/sell兑出 | +| exchange-amount | true | string | 匹配的HUSD数量 |type=buy时,exchange-amount为用户所需支付的husd数量;type=sell时,exchange-amount为用户可获得的husd数量 | +| time | true | long | 时间戳 | | + +### 错误码 +| 响应码 | 说明 | +| ---- | ----- | +| invalid-quote-id | 无效的quote-id | +| insufficient-balance | 可用余额不足 | +| insufficient-quota | 稳定币限额不足/超出稳定币限额 | +| exchange-failure | 后端其他错误引起的兑换失败 | +| Base-user-request-exceed-limit | 您的操作太频繁,请稍后再试 | # 现货 / 杠杆交易 From 1d63704084aceffe18ed7e74aa24d85fbe26302a Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 12 Sep 2019 17:08:37 +0800 Subject: [PATCH 164/864] 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 ea8fb57a73f..871a825a0a6 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -77,7 +77,7 @@ search: False |-----|-----|-----|-----| |2019.09.11 17:00| GET v1/stable-coin/quote,POST v1/stable-coin/exchange |新增|新增稳定币兑换节点| |2019.09.11 16:00| 删除部分代码示例 |删除|删除部分代码示例| -|2019.09.10 10:00| 除节点POST /v1/order/orders/submitCancelClientOrder以外,去除了其它节点中订单状态取值submitting以及cancelling|修改|除节点POST /v1/order/orders/submitCancelClientOrder以外,去除了其它节点中订单状态取值submitting以及cancelling| +|2019.09.10 10:00| 除节点"POST /v1/order/orders/submitCancelClientOrder" & "GET /v1/order/openOrders"以外,去除了其它节点中订单状态取值submitting以及cancelling|修改|除节点"POST /v1/order/orders/submitCancelClientOrder" & "GET /v1/order/openOrders"以外,去除了其它节点中订单状态取值submitting以及cancelling| |2019.09.09 11:00| POST /v1/order/orders/submitCancelClientOrder |修改|修改返回数据描述| |2019.09.09 10:00| GET /v1/order/orders; GET /v1/order/matchresults |修改|修改请求字段start-date与end-date的默认值及取值范围的描述| |2019.09.02 18:00| POST /v1/order/orders/batchCancelOpenOrders|优化|更改请求字段"symbol"的描述 @@ -1668,7 +1668,7 @@ filled-amount | string | 订单中已成交部分的数量 filled-cash-amount | string | 订单中已成交部分的总价格 filled-fees | string | 已交交易手续费总额 source | string | 现货交易填写“api” -state | string | 订单状态,包括submitted, partial-filled, created +state | string | 订单状态,包括submitted, partial-filled, cancelling, created stop-price|string|止盈止损订单触发价格 operator|string|止盈止损订单触发价运算符 From d6f928fd9d712b5c0bf9fe2e581ab1e1286f1e1d Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 16 Sep 2019 15:03:52 +0800 Subject: [PATCH 165/864] Update index.html.md --- source/index.html.md | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 871a825a0a6..a226d93a27c 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.09.16 15:00| GET /v2/account/deposit/address |新增|新增APIv2节点 - 充币地址查询| |2019.09.11 17:00| GET v1/stable-coin/quote,POST v1/stable-coin/exchange |新增|新增稳定币兑换节点| |2019.09.11 16:00| 删除部分代码示例 |删除|删除部分代码示例| |2019.09.10 10:00| 除节点"POST /v1/order/orders/submitCancelClientOrder" & "GET /v1/order/openOrders"以外,去除了其它节点中订单状态取值submitting以及cancelling|修改|除节点"POST /v1/order/orders/submitCancelClientOrder" & "GET /v1/order/openOrders"以外,去除了其它节点中订单状态取值submitting以及cancelling| @@ -1212,6 +1213,59 @@ balance|-|decimal|- |账户余额 |-| +## APIv2 充币地址查询 + +此节点用于查询特定币种(IOTA除外)在其所在区块链中的充币地址 + +API Key 权限:读取 + + + +### HTTP 请求 + +- GET ` /v2/account/deposit/address` + +```json +{ + "currency": "btc" +} +``` + +### 请求参数 + +| 字段名称 | 是否必需 | 类型 | 字段描述 |取值范围 | +| ---------- | ---- | ------ | ------ | ---- | +| currency | true | string | 币种 | btc, ltc, bch, eth, etc ...(火币全球站支持的币种) | + +> Response: + +```json +{ + "code": 200, + "data": [ + { + "currency": "btc", + "address": "1PSRjPg53cX7hMRYAXGJnL8mqHtzmQgPUs", + "addressTag": "", + "chain": "btc" + } + ] +} +``` + +### 响应数据 + + +| 字段名称 | 是否必需 | 数据类型 | 字段描述 | 取值范围 | +| ---- | ----- | ---- | ---- | ---- | +| code| true | int | 状态码 | | +| message| false | string | 错误描述(如有) | | +| data| true | object | | | +| {currency | true | string | 币种 | | +| address| true | string | 充币地址 | | +| addressTag| true | string | 充币地址标签 | | +| chain }| true | string | 链名称 | | + ## 虚拟币提现 API Key 权限:提币 From 5cf33f03f5151ede977f7b2fe0ff893943baca10 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 16 Sep 2019 15:47:15 +0800 Subject: [PATCH 166/864] Update index.html.md --- source/index.html.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index a226d93a27c..ba54a6ba442 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1225,17 +1225,15 @@ API Key 权限:读取 - GET ` /v2/account/deposit/address` -```json -{ - "currency": "btc" -} +```shell +curl "https://api.huobi.pro/v2/account/deposit/address?currency=btc" ``` ### 请求参数 | 字段名称 | 是否必需 | 类型 | 字段描述 |取值范围 | | ---------- | ---- | ------ | ------ | ---- | -| currency | true | string | 币种 | btc, ltc, bch, eth, etc ...(火币全球站支持的币种) | +| currency | true | string | 币种 | btc, ltc, bch, eth, etc ...(火币全球站支持的币种) | > Response: From 5c1d193e9c4f527e2110a9727fb7a055b91e06e2 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 17 Sep 2019 10:14:03 +0800 Subject: [PATCH 167/864] Update index.html.md --- source/index.html.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index ba54a6ba442..d89aa0f3198 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1264,6 +1264,17 @@ curl "https://api.huobi.pro/v2/account/deposit/address?currency=btc" | addressTag| true | string | 充币地址标签 | | | chain }| true | string | 链名称 | | +### 状态码 + +| 状态码 | 错误信息 | 错误场景描述 | +| ---- | ----- | ---- | +| 200| success | 请求成功 | +| 500| error | 系统错误 | +| 1002| unauthorized | 未授权 | +| 1003| invalid signature | 验签失败 | +| 2002| invalid field value in | 非法字段取值 | +| 2003| missing mandatory field | 强制字段缺失 | + ## 虚拟币提现 API Key 权限:提币 From e257e67d084dc6b0470519fd877ec4c380105556 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 17 Sep 2019 10:22:15 +0800 Subject: [PATCH 168/864] 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 d89aa0f3198..d3992e07cc9 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1272,8 +1272,8 @@ curl "https://api.huobi.pro/v2/account/deposit/address?currency=btc" | 500| error | 系统错误 | | 1002| unauthorized | 未授权 | | 1003| invalid signature | 验签失败 | -| 2002| invalid field value in | 非法字段取值 | -| 2003| missing mandatory field | 强制字段缺失 | +| 2002| invalid field value in "field name" | 非法字段取值 | +| 2003| missing mandatory field "field name" | 强制字段缺失 | ## 虚拟币提现 From d2b1648834f26106bf529c343c8bc7a76e72762d Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 17 Sep 2019 10:25:41 +0800 Subject: [PATCH 169/864] 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 d3992e07cc9..108321f0d03 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1543,7 +1543,7 @@ API Key 权限:交易 --------- | --------- | -------- | ------- | ----------- account-id | string | true | NA | 账户 ID,使用 GET /v1/account/accounts 接口查询。现货交易使用 ‘spot’ 账户的 account-id;杠杆交易,请使用 ‘margin’ 账户的 account-id symbol | string | true | NA | 交易对, 例如btcusdt, ethbtc -type | string | true | NA | 订单类型,包括buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker, buy-stop-limit, sell-stop-limit(说明见下文) +type | string | true | NA | 订单类型,包括buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker(说明见下文), buy-stop-limit, sell-stop-limit amount | string | true | NA | 订单交易量(市价买单此字段为订单交易额) price | string | false | NA | limit order的交易价格 source | string | false | api | 现货交易填写“api”,杠杆交易填写“margin-api” From 906c681f23e1c7e9e58b86d6eb47d074428c3b26 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 17 Sep 2019 14:16:42 +0800 Subject: [PATCH 170/864] 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 108321f0d03..007b8250ee2 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -631,8 +631,8 @@ close | float | 本阶段最新价 low | float | 本阶段最低价 high | float | 本阶段最高价 vol | float | 以报价币种计量的交易量 -bid | object | 当前的最高卖价 [price, quote volume] -ask | object | 当前的最低买价 [price, quote volume] +bid | object | 当前的最高买价 [price, quote volume] +ask | object | 当前的最低卖价 [price, quote volume] ## 所有交易对的最新 Tickers From ff5406bcf42b0645f40ea940ec37fbcea2ea4352 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 17 Sep 2019 16:47:53 +0800 Subject: [PATCH 171/864] 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 007b8250ee2..99326169d6c 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1407,7 +1407,7 @@ API Key 权限:读取 | type | true | string | 类型 | 'deposit', 'withdraw' | | currency | true | string | 币种 | | | tx-hash | true |string | 交易哈希 | | -| amount | true | long | 个数 | | +| amount | true | float | 个数 | | | address | true | string | 地址 | | | address-tag | true | string | 地址标签 | | | fee | true | long | 手续费 | | @@ -4019,7 +4019,7 @@ start-date | string | false | -61d | 查询开始日期, 日期格式yy end-date | string | false | today | 查询结束日期, 日期格式yyyy-mm-dd | NA from | string | false | NA | 查询起始 ID | NA direct | string | false | next | 查询方向 | next, prev -size | int | false | 100 | 查询记录大小 | [1, 100] +size | string | false | 100 | 查询记录大小 | [1, 100] ### 数据更新字段列表 From f4ab878231badd7f4bf8c954e422c34186bcc527 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 18 Sep 2019 14:44:52 +0800 Subject: [PATCH 172/864] Update index.html.md --- source/index.html.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 99326169d6c..181c34181cb 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1894,7 +1894,7 @@ API Key 权限:读取 | source | true | string | 订单来源 | api | | state | true | string | 订单状态 | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销, created | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | -| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | +| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-limit-maker, sell-limit-maker, buy-stop-limit,sell-stop-limit | | stop-price | false | string | 止盈止损订单触发价格 | | | operator | false | string | 止盈止损订单触发价运算符 | gte,lte | @@ -1965,7 +1965,7 @@ API Key 权限:读取 | source | true | string | 订单来源 | api | | state | true | string | 订单状态 | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销,created | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | -| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | +| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-limit-maker, sell-limit-maker, buy-stop-limit,sell-stop-limit | | stop-price | false | string | 止盈止损订单触发价格 | | | operator | false | string | 止盈止损订单触发价运算符 | gte,lte | @@ -2036,7 +2036,7 @@ API Key 权限:读取 | price | true | string | 成交价格 | | | source | true | string | 订单来源 | api | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | -| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | +| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-limit-maker, sell-limit-maker, buy-stop-limit,sell-stop-limit | | role | true | string | 成交角色 |maker,taker | | filled-points | true | string | 抵扣数量(可为ht或hbpoint) | | | fee-deduct-currency | true | string | 抵扣类型 |如果为空,代表扣除的手续费是原币;如果为"ht",代表抵扣手续费的是HT;如果为"hbpoint",代表抵扣手续费的是点卡 | @@ -2068,7 +2068,7 @@ API Key 权限:读取 | 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | | ---------- | ----- | ------ | ------ | ---- | ---- | | symbol | true | string | 交易对 | |btcusdt, ethbtc, rcneth ... | -| types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | +| types | false | string | 查询的订单类型组合,使用','分割 | | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-limit-maker, sell-limit-maker, buy-stop-limit,sell-stop-limit | | start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | -1d 查询结束日期的前1天 | 取值范围 [((end-date) – 1), (end-date)] ,查询窗口最大为2天,窗口平移范围为最近180天,已完全撤销的历史订单的查询窗口平移范围只有最近7天(state="canceled") | | end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd。 以订单生成时间进行查询 | today | 取值范围 [(today-179), today] ,查询窗口最大为2天,窗口平移范围为最近180天,已完全撤销的历史订单的查询窗口平移范围只有最近7天(state="canceled") | | states | true | string | 查询的订单状态组合,使用','分割 | | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销,created| @@ -2124,7 +2124,7 @@ API Key 权限:读取 | source | true | string | 订单来源 | api | | state | true | string | 订单状态 | submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销,created | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | -| type | true | string | 订单类型 | submit-cancel:已提交撤单申请 ,buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | +| type | true | string | 订单类型 | submit-cancel:已提交撤单申请 ,buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-limit-maker, sell-limit-maker, buy-stop-limit,sell-stop-limit | | stop-price | false | string | 止盈止损订单触发价格 | | | operator | false | string | 止盈止损订单触发价运算符 | gte,lte | @@ -2215,7 +2215,7 @@ API Key 权限:读取 | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | | stop-price | false | string | 止盈止损订单触发价格 | | | operator | false | string | 止盈止损订单触发价运算符 | gte,lte | -| type} | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-limit-maker, sell-limit-maker | +| type} | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-limit-maker, sell-limit-maker, buy-limit-maker, sell-limit-maker | | next-time | false | long |下一查询起始时间(当请求字段”direct”为”prev”时有效), 下一查询结束时间(当请求字段”direct”为”next”时有效)。注:仅在检索出的总条目数量超出size字段限定时,此返回字段存在。 |UTC time in millisecond | @@ -2235,7 +2235,7 @@ API Key 权限:读取 | 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | | ---------- | ----- | ------ | ------ | ---- | ----------- | | symbol | true | string | 交易对 | NA | btcusdt, ethbtc, rcneth ... | -| types | false | string | 查询的订单类型组合,使用','分割 | all | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit, sell-stop-limit | +| types | false | string | 查询的订单类型组合,使用','分割 | all | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-limit-maker, sell-limit-maker, buy-stop-limit, sell-stop-limit | | start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | -1d 查询结束日期的前1天 | 取值范围 [((end-date) – 1), (end-date)] ,查询窗口最大为2天,窗口平移范围为最近61天 | | end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | today | 取值范围 [(today-60), today] ,查询窗口最大为2天,窗口平移范围为最近61天 | | from | false | string | 查询起始 ID | 订单成交记录ID(最大值) | | @@ -2282,7 +2282,7 @@ API Key 权限:读取 | price | true | string | 成交价格 | | | source | true | string | 订单来源 | api | | symbol | true | string | 交易对 | btcusdt, ethbtc, rcneth ... | -| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-stop-limit,sell-stop-limit | +| type | true | string | 订单类型 | buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖, buy-ioc:IOC买单, sell-ioc:IOC卖单, buy-limit-maker, sell-limit-maker, buy-stop-limit,sell-stop-limit | | role | true | string | 成交角色 |maker,taker | | filled-points | true | string | 抵扣数量(可为ht或hbpoint) | | | fee-deduct-currency | true | string | 抵扣类型 |ht,hbpoint | @@ -4013,7 +4013,7 @@ API Key 权限:读取 --------- | --------- | -------- | ------- | ----------- | ---------- account-id | int | true | NA | 账户 id | NA symbol | string | true | NA | 交易对 | All supported trading symbols, e.g. btcusdt, bccbtc -types | string | false | NA | 查询的订单类型组合,使用','分割 | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-stop-limit,sell-stop-limit +types | string | false | NA | 查询的订单类型组合,使用','分割 | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker, buy-stop-limit,sell-stop-limit states | string | false | NA | 查询的订单状态组合,使用','分割 | submitted, partial-filled, partial-canceled, filled, canceled,created start-date | string | false | -61d | 查询开始日期, 日期格式yyyy-mm-dd | NA end-date | string | false | today | 查询结束日期, 日期格式yyyy-mm-dd | NA From 08fef61d4760bf6ccf1a50a7ac9d80ceab5e9c71 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 18 Sep 2019 16:15:51 +0800 Subject: [PATCH 173/864] Update index.html.md --- source/index.html.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 181c34181cb..420c157f037 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3019,11 +3019,13 @@ WebSocket API 返回的所有数据都进行了 GZIP 压缩,需要 client 在 当用户的Websocket客户端连接到火币Websocket服务器后,服务器会定期(当前设为5秒)向其发送`ping`消息并包含一整数值如下: -> {"ping": 1492420473027} +> {"ping": 1492420473027} (行情) +> {‘op’:'ping','ts':1568687994092} (资产) 当用户的Websocket客户端接收到此心跳消息后,应返回`pong`消息并包含同一整数值: -> {"pong": 1492420473027} +> {"pong": 1492420473027} (行情) +> {‘op’:'pong','ts':1568687994092} (资产) From d26aaca054caa833786df04fe6050547bf2fad82 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 18 Sep 2019 16:18:45 +0800 Subject: [PATCH 174/864] 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 420c157f037..8c75e184c35 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3020,12 +3020,12 @@ WebSocket API 返回的所有数据都进行了 GZIP 压缩,需要 client 在 当用户的Websocket客户端连接到火币Websocket服务器后,服务器会定期(当前设为5秒)向其发送`ping`消息并包含一整数值如下: > {"ping": 1492420473027} (行情) -> {‘op’:'ping','ts':1568687994092} (资产) +> {‘op’:'ping','ts':1568687994092} (资产及订单) 当用户的Websocket客户端接收到此心跳消息后,应返回`pong`消息并包含同一整数值: > {"pong": 1492420473027} (行情) -> {‘op’:'pong','ts':1568687994092} (资产) +> {‘op’:'pong','ts':1568687994092} (资产及订单) From 1e2b155fff49441be4ff65f5b8759a2472bccc76 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 18 Sep 2019 16:37:33 +0800 Subject: [PATCH 175/864] 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 8c75e184c35..87aa4f27cc5 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3644,7 +3644,7 @@ Websocket服务器同时支持一次性请求数据(pull)。 Signature |string |必填;签名, 计算得出的值,用于确保签名有效和未被篡改 > **注:** -> - 参考[https://huobiapi.github.io/docs/v1/cn/#c64cd15fdc] 生成有效签名 +> - 参考[https://huobiapi.github.io/docs/spot/v1/cn/#c64cd15fdc] 生成有效签名 > - 签名计算中请求方法固定值为`GET` ## 订阅账户更新 From 874ee340f751662352b4c013b3327beab5776b8c Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 18 Sep 2019 16:56:29 +0800 Subject: [PATCH 176/864] Update index.html.md --- source/index.html.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 87aa4f27cc5..d5814fb623f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1657,12 +1657,17 @@ API Key 权限:交易 --------- | --------- | ----------- data | integer | 撤单状态码 -撤单状态码 -0 - 订单没找到; -5 - 部分撤销; -6 - 已成交; -7 - 已撤销; -10 - 正在撤销 +撤单状态码 - + +-1: client-order-id not found +0: order already closed +3: submitted +4: partial-filled +5: partial-canceled +6: filled +7: canceled +8: failed +10: cancelling ## 查询当前未成交订单 From 183a1a0866bab45a58ef1bb819f7392e25098529 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 18 Sep 2019 17:30:17 +0800 Subject: [PATCH 177/864] 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 d5814fb623f..8f13bc83d18 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1659,8 +1659,8 @@ data | integer | 撤单状态码 撤单状态码 - --1: client-order-id not found -0: order already closed +-1: order already closed +0: client-order-id not found 3: submitted 4: partial-filled 5: partial-canceled From 51311c6a0461970723b8a62d6a6e8677ed3a630a Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 18 Sep 2019 19:45:46 +0800 Subject: [PATCH 178/864] Update index.html.md --- source/index.html.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 8f13bc83d18..b97909456d1 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -75,6 +75,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.09.18 20:00| GET /v1/subuser/aggregate-balance, GET /v1/account/accounts/{sub-uid}, GET /v1/margin/loan-orders, GET /v1/margin/accounts/balance |新增|支持子用户逐仓杠杆交易| |2019.09.16 15:00| GET /v2/account/deposit/address |新增|新增APIv2节点 - 充币地址查询| |2019.09.11 17:00| GET v1/stable-coin/quote,POST v1/stable-coin/exchange |新增|新增稳定币兑换节点| |2019.09.11 16:00| 删除部分代码示例 |删除|删除部分代码示例| @@ -1115,14 +1116,17 @@ API Key 权限:读取 "data": [ { "currency": "eos", + "type": "spot", "balance": "1954559.809500000000000000" }, { "currency": "btc", + "type": "spot", "balance": "0.000000000000000000" }, { "currency": "usdt", + "type": "spot", "balance": "2925209.411300000000000000" }, ... @@ -1142,6 +1146,7 @@ data | true| list | - | | - | 参数|是否必填 | 数据类型 | 长度 | 说明 | 取值范围 | -----------|------------|-----------|------------|----------|--| currency| 是| string| -| 子账号币名|-| +type| 是 |string| - |账户类型| spot:现货账户,point:点卡账户, margin:逐仓杠杆账户| balance| 是| string| -| 子账号下该币种所有余额(可用余额和冻结余额的总和)|-| ## 子账号余额 @@ -1198,7 +1203,7 @@ sub-uid|true| long| -| 子用户的 UID|-| 参数|是否必填 | 数据类型 | 长度 | 说明 | 取值范围 | -----------|------------|-----------|------------|----------|--| id| - |long| - |子账号 UID|-| -type| - |string| - |账户类型| Spot:现货账户,point:点卡账户| +type| - |string| - |账户类型| spot:现货账户,point:点卡账户, margin:逐仓杠杆账户| list| - |object| - |-|-| - list @@ -2617,6 +2622,7 @@ API Key 权限:读取 | from | false | string | 查询起始 ID | | | | direct | false | string | 查询方向 | | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | | size | false | string | 查询记录大小 | | | +| sub-uid | false | int | 子用户编号(母用户查询子用户借贷订单时,此字段必填) |如不填,缺省查询当前用户借贷订单 | | > Response: @@ -2688,6 +2694,7 @@ API Key 权限:读取 | 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | |---------|---------|-----|-----|-------|--------| | symbol | false | string | 交易对,作为get参数 | | | +| sub-uid | false | int | 子用户编号(母用户查询子用户借贷详情时,此字段必填) | 如不填,缺省查询当前用户借贷详情 | | > Response: From 55c0b9e361abe74a49a8869cc9581fb07a375248 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 19 Sep 2019 09:52:40 +0800 Subject: [PATCH 179/864] Update index.html.md --- source/index.html.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index b97909456d1..b3638201f15 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -67,6 +67,13 @@ search: False [GET /v1/account/accounts](#bd9157656f) |查询当前用户的所有账户| [GET /v1/account/accounts/{account-id}/balance](#870c0ab88b) |查询指定账户的余额| [POST /v1/futures/transfer](#e227a2a3e8) |币币与合约账户间的资金划转| +[POST /v1/dw/transfer-in/margin](#0d3c2e7382)|从币币交易账户划转至杠杆账户| +[POST /v1/dw/transfer-out/margin](#0d3c2e7382)|从杠杆账户划转至币币交易账户| +[POST /v1/margin/orders](#48cca1ce88)|申请借贷| +[POST /v1/margin/orders/{order-id}/repay](#48aa7c8199)|归还借贷| +[GET /v1/margin/loan-orders](#e52396720a)|查询借贷记录| +[GET /v1/margin/accounts/balance](#6e79ba8e80)|查询杠杆账户余额| + From c6630f45c0eeabc41d4d38bb28b14ea416e7e308 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 19 Sep 2019 10:15:31 +0800 Subject: [PATCH 180/864] 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 b3638201f15..60ca8ef62ec 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -82,6 +82,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.09.19 10:00| websocket 订阅主题 orders.$symbol.update |优化|当taker订单同时与多张对手方订单成交时,此订阅主题将推送逐笔更新| |2019.09.18 20:00| GET /v1/subuser/aggregate-balance, GET /v1/account/accounts/{sub-uid}, GET /v1/margin/loan-orders, GET /v1/margin/accounts/balance |新增|支持子用户逐仓杠杆交易| |2019.09.16 15:00| GET /v2/account/deposit/address |新增|新增APIv2节点 - 充币地址查询| |2019.09.11 17:00| GET v1/stable-coin/quote,POST v1/stable-coin/exchange |新增|新增稳定币兑换节点| @@ -3898,7 +3899,7 @@ order-id | integer | 订单编号 symbol | string | 交易代码 order-state | string | 订单状态, 有效取值: submitted, partial-filled, filled, canceled, partial-canceled role | string | 最近成交角色(当order-state = submitted, canceled, partial-canceled时,role 为缺省值taker;当order-state = filled, partial-filled 时,role 取值为taker 或maker。) -price | string | 最新价(当order-state = submitted 时,price 为订单价格;当order-state = canceled, partial-canceled 时,price 为零;当order-state = filled, partial-filled 时,price 为最近成交价。当role = taker,且该订单同时与多张对手方订单撮合时,price 为多笔成交均价。) +price | string | 最新价(当order-state = submitted 时,price 为订单价格;当order-state = canceled, partial-canceled 时,price 为零;当order-state = filled, partial-filled 时,price 为最近成交价。) filled-amount | string | 最近成交数量 filled-cash-amount | string | 最近成交数额 unfilled-amount | string | 最近未成交数量(当order-state = submitted 时,unfilled-amount 为原始订单量;当order-state = canceled OR partial-canceled 时,unfilled-amount 为未成交数量;当order-state = filled 时,如果 order-type = buy-market,unfilled-amount 可能为一极小值;如果order-type <> buy-market 时,unfilled-amount 为零;当order-state = partial-filled AND role = taker 时,unfilled-amount 为未成交数量;当order-state = partial-filled AND role = maker 时,unfilled-amount 为未成交数量。) From cbb337c4c983568ef1063b227f3801e6449114fd Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 19 Sep 2019 10:31:01 +0800 Subject: [PATCH 181/864] Update index.html.md --- 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 60ca8ef62ec..b79a0b9817b 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1670,17 +1670,17 @@ API Key 权限:交易 --------- | --------- | ----------- data | integer | 撤单状态码 -撤单状态码 - - --1: order already closed -0: client-order-id not found -3: submitted -4: partial-filled -5: partial-canceled -6: filled -7: canceled -8: failed -10: cancelling +Status Code | Description +--------- | ----------- +-1| order was already closed in the long past (order state = canceled, partial-canceled, filled, partial-filled) +0| client-order-id not found +3| submitted +4| partial-filled +5| partial-canceled +6| filled +7| canceled +8| failed +10| cancelling ## 查询当前未成交订单 From 79336b18b73c7fe1a7da5d674d39694241235be8 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 19 Sep 2019 16:18:15 +0800 Subject: [PATCH 182/864] Update index.html.md --- source/index.html.md | 65 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index b79a0b9817b..583513b11ec 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -82,6 +82,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.09.19 16:00| websocket订阅主题“market.$symbol.bbo” |新增|新增买一卖一逐笔推送| |2019.09.19 10:00| websocket 订阅主题 orders.$symbol.update |优化|当taker订单同时与多张对手方订单成交时,此订阅主题将推送逐笔更新| |2019.09.18 20:00| GET /v1/subuser/aggregate-balance, GET /v1/account/accounts/{sub-uid}, GET /v1/margin/loan-orders, GET /v1/margin/accounts/balance |新增|支持子用户逐仓杠杆交易| |2019.09.16 15:00| GET /v2/account/deposit/address |新增|新增APIv2节点 - 充币地址查询| @@ -1679,7 +1680,6 @@ Status Code | Description 5| partial-canceled 6| filled 7| canceled -8| failed 10| cancelling @@ -3352,6 +3352,69 @@ asks | object | The current all asks in format [price, quote volume] } ``` +## BBO逐笔推送 + +当买一价、买一量、卖一价、卖一量,其中任一数据发生变化时,此主题推送逐笔更新。 + +### 主题订阅 + +`market.$symbol.bbo` + +> Subscribe request + +```json +{ + "sub": "market.btcusdt.bbo", + "id": "id1" +} +``` + +### 参数 + +参数 | 数据类型 | 是否必需 | 缺省值 | 描述 | 取值范围 +--------- | --------- | -------- | ------------- | ----------- | ----------- +symbol | string | true | NA | 交易代码 | All supported trading symbols, e.g. btcusdt, bccbtc + +> Response + +```json +{ + "id": "id1", + "status": "ok", + "subbed": "market.btcusdt.bbo", + "ts": 1489474081631 +} +``` + +> Update example + +```json +{ + "ch": "market.btcusdt.bbo", + "ts": 1489474082831, + "tick": { + "symbol": "btcusdt", + "quoteTime": "1489474082811", + "bid": "10008.31", + "bidSize": "0.01", + "ask": "10009.54", + "askSize": "0.3" + } +} +``` + +### 数据更新字段列表 + +字段 | 数据类型 | 描述 +--------- | --------- | ----------- +symbol | string | 交易代码 +quoteTime | long | 盘口更新时间 +bid | float | 买一价 +bidSize | float | 买一量 +ask | float | 卖一价 +askSize | float | 卖一量 + + ## 成交明细 ### 主题订阅 From 95bb174414c7db93c8c4a38a65408ea0199e65ca Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 19 Sep 2019 16:52:35 +0800 Subject: [PATCH 183/864] 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 583513b11ec..893fabc4a4a 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3352,7 +3352,7 @@ asks | object | The current all asks in format [price, quote volume] } ``` -## BBO逐笔推送 +## 买一卖一逐笔行情 当买一价、买一量、卖一价、卖一量,其中任一数据发生变化时,此主题推送逐笔更新。 From b324d9e3a012deb583cd0197c2a6a1302a66c96b Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 19 Sep 2019 17:43:33 +0800 Subject: [PATCH 184/864] Update index.html.md --- source/index.html.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 893fabc4a4a..356edd92ff2 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1675,8 +1675,6 @@ Status Code | Description --------- | ----------- -1| order was already closed in the long past (order state = canceled, partial-canceled, filled, partial-filled) 0| client-order-id not found -3| submitted -4| partial-filled 5| partial-canceled 6| filled 7| canceled From d3b9de753e2edb813492df47bec1e93c12b0303c Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 20 Sep 2019 10:32:08 +0800 Subject: [PATCH 185/864] Update index.html.md --- source/index.html.md | 121 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 356edd92ff2..cfa2c64240c 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -511,6 +511,127 @@ curl "https://api.huobi.pro/v1/common/currencys" +## APIv2 币链参考信息 + +此节点用于查询各币种及其所在区块链的静态参考信息(公共数据) + +### HTTP 请求 + +- GET `/v2/reference/currencies` + +```shell +curl "https://api.huobi.pro/v2/reference/currencies?currency=btc" +``` + +### 请求参数 + +| 字段名称 | 是否必需 | 类型 | 字段描述 |取值范围 | +| ---------- | ---- | ------ | ------ | ---- | +| currency | false | string | 币种 | btc, ltc, bch, eth, etc ...(火币全球站支持的币种) | +| authorizedUser | false | boolean | 已认证用户 | true or false (如不填,缺省为true) | + +> Response: + +```json +{ + "code":200, + "data":[ + { + "chains":[ + { + "chain":"trc20usdt", + "depositStatus":"allowed", + "maxTransactFeeWithdraw":"0.00000000", + "maxWithdrawAmt":"280000.00000000", + "minDepositAmt":"100", + "minTransactFeeWithdraw":"0.00000000", + "minWithdrawAmt":"0.01", + "numOfConfirmations":999, + "numOfFastConfirmations":999, + "withdrawFeeType":"circulated", + "withdrawPrecision":5, + "withdrawQuotaPerDay":"280000.00000000", + "withdrawQuotaPerYear":"2800000.00000000", + "withdrawQuotaTotal":"2800000.00000000", + "withdrawStatus":"allowed" + }, + { + "chain":"usdt", + "depositStatus":"allowed", + "maxWithdrawAmt":"19000.00000000", + "minDepositAmt":"0.0001", + "minWithdrawAmt":"2", + "numOfConfirmations":30, + "numOfFastConfirmations":15, + "transactFeeRateWithdraw":"0.00100000", + "withdrawFeeType":"ratio", + "withdrawPrecision":7, + "withdrawQuotaPerDay":"90000.00000000", + "withdrawQuotaPerYear":"111000.00000000", + "withdrawQuotaTotal":"1110000.00000000", + "withdrawStatus":"allowed" + }, + { + "chain":"usdterc20", + "depositStatus":"allowed", + "maxWithdrawAmt":"18000.00000000", + "minDepositAmt":"100", + "minWithdrawAmt":"1", + "numOfConfirmations":999, + "numOfFastConfirmations":999, + "transactFeeWithdraw":"0.00000000", + "withdrawFeeType":"fixed", + "withdrawPrecision":6, + "withdrawQuotaPerDay":"180000.00000000", + "withdrawQuotaPerYear":"200000.00000000", + "withdrawQuotaTotal":"300000.00000000", + "withdrawStatus":"allowed" + } + ], + "currency":"usdt", + "instStatus":"normal" + } + ] +} + +``` + +### 响应数据 + + +| 字段名称 | 是否必需 | 数据类型 | 字段描述 | 取值范围 | +| ---- | ----- | ---- | ---- | ---- | +| code| true | int | 状态码 | | +| message| false | string | 错误描述(如有) | | +| data| true | object | | | +| { currency | true | string | 币种 | | +| { chains| true | object | | | +| chain| true | string | 链名称 | | +| numOfConfirmations| true | int | 安全上账所需确认次数(达到确认次数后允许提币) | | +| numOfFastConfirmations| true | int | 快速上账所需确认次数(达到确认次数后允许交易但不允许提币) | | +| minDepositAmt| true | string | 单次最小充币金额 | | +| depositStatus| true | string | 充币状态 | allowed,prohibited | +| minWithdrawAmt| true | string | 单次最小提币金额 | | +| maxWithdrawAmt| true | string | 单次最大提币金额 | | +| withdrawQuotaPerDay| true | string | 当日提币额度 | | +| withdrawQuotaPerYear| true | string | 当年提币额度 | | +| withdrawQuotaTotal| true | string |总提币额度 | | +| withdrawPrecision| true | int |提币精度 | | +| withdrawFeeType| true | string |提币手续费类型(特定币种在特定链上的提币手续费类型唯一) | fixed,circulated,ratio | +| transactFeeWithdraw| false | string |单次提币手续费(仅对固定类型有效,feeType=fixed) | | +| minTransactFeeWithdraw| false | string |最小单次提币手续费(仅对区间类型有效,feeType=circulated) | | +| maxTransactFeeWithdraw| false | string |最大单次提币手续费(仅对区间类型和有上限的比例类型有效,feeType=circulated or ratio) | | +| transactFeeRateWithdraw| false | string |单次提币手续费率(仅对比例类型有效,feeType=ratio) | | +| withdrawStatus}| true | string | 提币状态 | allowed,prohibited | +| instStatus }| true | string | 币种状态 | normal,delisted | + +### 状态码 + +| 状态码 | 错误信息 | 错误场景描述 | +| ---- | ----- | ---- | +| 200| success | 请求成功 | +| 500| error | 系统错误 | +| 2002| invalid field value in "field name" | 非法字段取值 | ## 获取当前系统时间 From 20bd54f272e4f87a2051561cd2a6cbd70f202c2b Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 20 Sep 2019 10:33:14 +0800 Subject: [PATCH 186/864] 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 cfa2c64240c..e6b6fd9000d 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -82,6 +82,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.09.20 10:00| GET /v2/reference/currencies |新增|新增币链参考信息节点| |2019.09.19 16:00| websocket订阅主题“market.$symbol.bbo” |新增|新增买一卖一逐笔推送| |2019.09.19 10:00| websocket 订阅主题 orders.$symbol.update |优化|当taker订单同时与多张对手方订单成交时,此订阅主题将推送逐笔更新| |2019.09.18 20:00| GET /v1/subuser/aggregate-balance, GET /v1/account/accounts/{sub-uid}, GET /v1/margin/loan-orders, GET /v1/margin/accounts/balance |新增|支持子用户逐仓杠杆交易| From 32f0f7633f64151a3da6859440cf27310d89cddf Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 20 Sep 2019 11:14:58 +0800 Subject: [PATCH 187/864] Update index.html.md --- 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 e6b6fd9000d..5672459e367 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -521,7 +521,7 @@ curl "https://api.huobi.pro/v1/common/currencys" - GET `/v2/reference/currencies` ```shell -curl "https://api.huobi.pro/v2/reference/currencies?currency=btc" +curl "https://api.huobi.pro/v2/reference/currencies?currency=usdt" ``` ### 请求参数 @@ -542,10 +542,10 @@ curl "https://api.huobi.pro/v2/reference/currencies?currency=btc" { "chain":"trc20usdt", "depositStatus":"allowed", - "maxTransactFeeWithdraw":"0.00000000", + "maxTransactFeeWithdraw":"1.00000000", "maxWithdrawAmt":"280000.00000000", "minDepositAmt":"100", - "minTransactFeeWithdraw":"0.00000000", + "minTransactFeeWithdraw":"0.10000000", "minWithdrawAmt":"0.01", "numOfConfirmations":999, "numOfFastConfirmations":999, @@ -580,7 +580,7 @@ curl "https://api.huobi.pro/v2/reference/currencies?currency=btc" "minWithdrawAmt":"1", "numOfConfirmations":999, "numOfFastConfirmations":999, - "transactFeeWithdraw":"0.00000000", + "transactFeeWithdraw":"0.10000000", "withdrawFeeType":"fixed", "withdrawPrecision":6, "withdrawQuotaPerDay":"180000.00000000", From e21f345bdd8020222a89130fa4c8747215aefbcb Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 23 Sep 2019 14:36:07 +0800 Subject: [PATCH 188/864] Update index.html.md --- source/index.html.md | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 5672459e367..e6cab1028fd 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -82,6 +82,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.09.23 15:00| POST /v1/order/orders/{order-id}/submitcancel & POST /v1/order/orders/batchCancelOpenOrders |优化|优化错误码返回| |2019.09.20 10:00| GET /v2/reference/currencies |新增|新增币链参考信息节点| |2019.09.19 16:00| websocket订阅主题“market.$symbol.bbo” |新增|新增买一卖一逐笔推送| |2019.09.19 10:00| websocket 订阅主题 orders.$symbol.update |优化|当taker订单同时与多张对手方订单成交时,此订阅主题将推送逐笔更新| @@ -1753,6 +1754,26 @@ API Key 权限:交易 返回的主数据对象是一个对应下单单号的字符串。 +### 错误码 +```json +{ + "status": "error", + "err-code": "order-orderstate-error", + "err-msg": "订单状态错误", + "order-state":-1 // 当前订单状态 +} +``` +其中,order-state的可能取值包括 - + +order-state | Description +--------- | ----------- +-1| order was already closed in the long past (order state = canceled, partial-canceled, filled, partial-filled) +0| client-order-id not found +5| partial-canceled +6| filled +7| canceled +10| cancelling + ## 撤销订单(基于client order ID) API Key 权限:交易 @@ -1919,6 +1940,36 @@ API Key 权限:交易 | failed-count | true | int | 取消失败的订单数 | | | next-id | true | long | 下一个符合取消条件的订单号 | | +### 错误码 + +```json +{ + "status": "ok", + "data": { + "success": ["123","456"], + "failed": [ + { + "err-msg": "订单状态错误", + "order-id": "12345678", + "err-code": "order-orderstate-error", + "order-state":-1 // 当前订单状态 + } + ] + } +} +``` + +其中,order-state的可能取值包括 - + +order-state | Description +--------- | ----------- +-1| order was already closed in the long past (order state = canceled, partial-canceled, filled, partial-filled) +0| client-order-id not found +5| partial-canceled +6| filled +7| canceled +10| cancelling + ## 批量撤销订单 API Key 权限:交易 From e04304dcd19c6fc8f356aa4216e1d16cd0faa199 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 23 Sep 2019 14:46:56 +0800 Subject: [PATCH 189/864] 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 e6cab1028fd..b44e80732f8 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1817,7 +1817,7 @@ data | integer | 撤单状态码 Status Code | Description --------- | ----------- -1| order was already closed in the long past (order state = canceled, partial-canceled, filled, partial-filled) -0| client-order-id not found +0| order-id not found 5| partial-canceled 6| filled 7| canceled @@ -1964,7 +1964,7 @@ API Key 权限:交易 order-state | Description --------- | ----------- -1| order was already closed in the long past (order state = canceled, partial-canceled, filled, partial-filled) -0| client-order-id not found +0| order-id not found 5| partial-canceled 6| filled 7| canceled From 2974a44a6533420d543bb30f2d879e80c95681ad Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 23 Sep 2019 14:52:57 +0800 Subject: [PATCH 190/864] 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 b44e80732f8..731b7f52711 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1942,6 +1942,7 @@ API Key 权限:交易 ### 错误码 +> Response: ```json { "status": "ok", @@ -1959,7 +1960,7 @@ API Key 权限:交易 } ``` -其中,order-state的可能取值包括 - +返回字段列表中,order-state的可能取值包括 - order-state | Description --------- | ----------- From 6d5e912594f258b19953d1725495314e851fcec2 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 23 Sep 2019 15:13:25 +0800 Subject: [PATCH 191/864] Update index.html.md --- source/index.html.md | 65 ++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 731b7f52711..1f79ad54d77 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -82,7 +82,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| -|2019.09.23 15:00| POST /v1/order/orders/{order-id}/submitcancel & POST /v1/order/orders/batchCancelOpenOrders |优化|优化错误码返回| +|2019.09.23 15:00| POST /v1/order/orders/{order-id}/submitcancel & POST /v1/order/orders/batchcancel |优化|优化错误码返回| |2019.09.20 10:00| GET /v2/reference/currencies |新增|新增币链参考信息节点| |2019.09.19 16:00| websocket订阅主题“market.$symbol.bbo” |新增|新增买一卖一逐笔推送| |2019.09.19 10:00| websocket 订阅主题 orders.$symbol.update |优化|当taker订单同时与多张对手方订单成交时,此订阅主题将推送逐笔更新| @@ -1940,37 +1940,6 @@ API Key 权限:交易 | failed-count | true | int | 取消失败的订单数 | | | next-id | true | long | 下一个符合取消条件的订单号 | | -### 错误码 - -> Response: -```json -{ - "status": "ok", - "data": { - "success": ["123","456"], - "failed": [ - { - "err-msg": "订单状态错误", - "order-id": "12345678", - "err-code": "order-orderstate-error", - "order-state":-1 // 当前订单状态 - } - ] - } -} -``` - -返回字段列表中,order-state的可能取值包括 - - -order-state | Description ---------- | ----------- --1| order was already closed in the long past (order state = canceled, partial-canceled, filled, partial-filled) -0| order-id not found -5| partial-canceled -6| filled -7| canceled -10| cancelling - ## 批量撤销订单 API Key 权限:交易 @@ -2010,6 +1979,7 @@ API Key 权限:交易 "err-msg": "记录无效", "order-id": "2", "err-code": "base-record-invalid" + "order-state":-1 // 当前订单状态 } ] } @@ -2022,6 +1992,37 @@ API Key 权限:交易 | ---- | ----- | ---- | | data | map | 撤单结果 +### 错误码 + +> Response: +```json +{ + "status": "ok", + "data": { + "success": ["123","456"], + "failed": [ + { + "err-msg": "订单状态错误", + "order-id": "12345678", + "err-code": "order-orderstate-error", + "order-state":-1 // 当前订单状态 + } + ] + } +} +``` + +返回字段列表中,order-state的可能取值包括 - + +order-state | Description +--------- | ----------- +-1| order was already closed in the long past (order state = canceled, partial-canceled, filled, partial-filled) +0| order-id not found +5| partial-canceled +6| filled +7| canceled +10| cancelling + ## 查询订单详情 API Key 权限:读取 From f00052cc77f7d361cd83e8761b2ede031085bc4a Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 23 Sep 2019 15:26:23 +0800 Subject: [PATCH 192/864] Update index.html.md --- source/index.html.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 1f79ad54d77..93940b90771 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1755,6 +1755,9 @@ API Key 权限:交易 返回的主数据对象是一个对应下单单号的字符串。 ### 错误码 + +> Response: + ```json { "status": "error", @@ -1763,7 +1766,8 @@ API Key 权限:交易 "order-state":-1 // 当前订单状态 } ``` -其中,order-state的可能取值包括 - + +返回字段列表中,order-state的可能取值包括 - order-state | Description --------- | ----------- @@ -1995,6 +1999,7 @@ API Key 权限:交易 ### 错误码 > Response: + ```json { "status": "ok", From 9b48946342a0031c82485282da043635b4203eac Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 23 Sep 2019 15:52:27 +0800 Subject: [PATCH 193/864] Update index.html.md --- 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 93940b90771..1778ef30bd5 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -620,10 +620,10 @@ curl "https://api.huobi.pro/v2/reference/currencies?currency=usdt" | withdrawQuotaTotal| true | string |总提币额度 | | | withdrawPrecision| true | int |提币精度 | | | withdrawFeeType| true | string |提币手续费类型(特定币种在特定链上的提币手续费类型唯一) | fixed,circulated,ratio | -| transactFeeWithdraw| false | string |单次提币手续费(仅对固定类型有效,feeType=fixed) | | -| minTransactFeeWithdraw| false | string |最小单次提币手续费(仅对区间类型有效,feeType=circulated) | | -| maxTransactFeeWithdraw| false | string |最大单次提币手续费(仅对区间类型和有上限的比例类型有效,feeType=circulated or ratio) | | -| transactFeeRateWithdraw| false | string |单次提币手续费率(仅对比例类型有效,feeType=ratio) | | +| transactFeeWithdraw| false | string |单次提币手续费(仅对固定类型有效,withdrawFeeType=fixed) | | +| minTransactFeeWithdraw| false | string |最小单次提币手续费(仅对区间类型有效,withdrawFeeType=circulated) | | +| maxTransactFeeWithdraw| false | string |最大单次提币手续费(仅对区间类型和有上限的比例类型有效,withdrawFeeType=circulated or ratio) | | +| transactFeeRateWithdraw| false | string |单次提币手续费率(仅对比例类型有效,withdrawFeeType=ratio) | | | withdrawStatus}| true | string | 提币状态 | allowed,prohibited | | instStatus }| true | string | 币种状态 | normal,delisted | From 3eeffcff9407af2d7810182ea012e9ef3b3ea257 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 23 Sep 2019 18:37:10 +0800 Subject: [PATCH 194/864] 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 1778ef30bd5..4c8d54805ac 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2938,7 +2938,7 @@ API Key 权限:读取 |-----|-----|-----|-----|------| | symbol | true | string | 交易对 | | | state | true | string | 账户状态 | working,fl-sys,fl-mgt,fl-end | -| risk-rate | true | object | 风险率 | | +| risk-rate | true | string | 风险率 | | | fl-price | true | string | 爆仓价 | | | list | true | array | 借贷账户详情列表 | | From ee92575a3996ba885974491f12bf2418b3746497 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 24 Sep 2019 10:05:56 +0800 Subject: [PATCH 195/864] Update index.html.md --- source/index.html.md | 1 - 1 file changed, 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 4c8d54805ac..285455f8e73 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -85,7 +85,6 @@ search: False |2019.09.23 15:00| POST /v1/order/orders/{order-id}/submitcancel & POST /v1/order/orders/batchcancel |优化|优化错误码返回| |2019.09.20 10:00| GET /v2/reference/currencies |新增|新增币链参考信息节点| |2019.09.19 16:00| websocket订阅主题“market.$symbol.bbo” |新增|新增买一卖一逐笔推送| -|2019.09.19 10:00| websocket 订阅主题 orders.$symbol.update |优化|当taker订单同时与多张对手方订单成交时,此订阅主题将推送逐笔更新| |2019.09.18 20:00| GET /v1/subuser/aggregate-balance, GET /v1/account/accounts/{sub-uid}, GET /v1/margin/loan-orders, GET /v1/margin/accounts/balance |新增|支持子用户逐仓杠杆交易| |2019.09.16 15:00| GET /v2/account/deposit/address |新增|新增APIv2节点 - 充币地址查询| |2019.09.11 17:00| GET v1/stable-coin/quote,POST v1/stable-coin/exchange |新增|新增稳定币兑换节点| From 166c4632c5b5b791b35ad8ad343ac70515acd219 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 24 Sep 2019 18:53:05 +0800 Subject: [PATCH 196/864] 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 285455f8e73..69480916555 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -4276,7 +4276,7 @@ API Key 权限:读取 account-id | int | true | NA | 账户 id | NA symbol | string | true | NA | 交易对 | All supported trading symbols, e.g. btcusdt, bccbtc types | string | false | NA | 查询的订单类型组合,使用','分割 | buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker, buy-stop-limit,sell-stop-limit -states | string | false | NA | 查询的订单状态组合,使用','分割 | submitted, partial-filled, partial-canceled, filled, canceled,created +states | string | true | NA | 查询的订单状态组合,使用','分割 | submitted, partial-filled, partial-canceled, filled, canceled,created start-date | string | false | -61d | 查询开始日期, 日期格式yyyy-mm-dd | NA end-date | string | false | today | 查询结束日期, 日期格式yyyy-mm-dd | NA from | string | false | NA | 查询起始 ID | NA From a1543c2e771e923140bfccb90f6911d46eef05e3 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 25 Sep 2019 20:15:30 +0800 Subject: [PATCH 197/864] Update index.html.md --- source/index.html.md | 75 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 69480916555..692acb3aea5 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1411,6 +1411,81 @@ curl "https://api.huobi.pro/v2/account/deposit/address?currency=btc" | 2002| invalid field value in "field name" | 非法字段取值 | | 2003| missing mandatory field "field name" | 强制字段缺失 | +## APIv2 提币额度查询 + +此节点用于查询各币种提币额度 + +API Key 权限:读取 + +### HTTP 请求 + +- GET ` /v2/account/withdraw/quota` + +```shell +curl "https://api.huobi.pro/v2/account/withdraw/quota?currency=btc" +``` + +### 请求参数 + +| 字段名称 | 是否必需 | 类型 | 字段描述 |取值范围 | +| ---------- | ---- | ------ | ------ | ---- | +| currency | false | string | 币种 | btc, ltc, bch, eth, etc ...(火币全球站支持的币种) | + +> Response: + +```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" + } + ] + } + ] +} +``` + +### 响应数据 + + +| 字段名称 | 是否必需 | 数据类型 | 字段描述 | 取值范围 | +| ---- | ----- | ---- | ---- | ---- | +| code| true | int | 状态码 | | +| message| false | string | 错误描述(如有) | | +| data| true | object | | | +| {currency | true | string | 币种 | | +| chains| true | object | | | +| { chain | true | string | 链名称 | | +| maxWithdrawAmt | true | string | 单次最大提币金额 | | +| withdrawQuotaPerDay | true | string | 当日提币额度 | | +| remainWithdrawQuotaPerDay | true | string | 当日提币剩余额度 | | +| withdrawQuotaPerYear | true | string | 当年提币额度 | | +| remainWithdrawQuotaPerYear | true | string | 当年提币剩余额度 | | +| withdrawQuotaTotal | true | string | 总提币额度 | | +| remainWithdrawQuotaTotal }} | true | string | 总提币剩余额度 | | + +### 状态码 + +| 状态码 | 错误信息 | 错误场景描述 | +| ---- | ----- | ---- | +| 200| success | 请求成功 | +| 500| error | 系统错误 | +| 1002| unauthorized | 未授权 | +| 1003| invalid signature | 验签失败 | +| 2002| invalid field value in "field name" | 非法字段取值 | + + ## 虚拟币提现 API Key 权限:提币 From 8377bec7d2427cc893f84cb86b765350a1186ade Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 25 Sep 2019 20:25:12 +0800 Subject: [PATCH 198/864] 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 692acb3aea5..52cb27c8ccf 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -82,6 +82,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.09.25 20:00| GET /v2/account/withdraw/quota |新增|新增提币额度查询节点| |2019.09.23 15:00| POST /v1/order/orders/{order-id}/submitcancel & POST /v1/order/orders/batchcancel |优化|优化错误码返回| |2019.09.20 10:00| GET /v2/reference/currencies |新增|新增币链参考信息节点| |2019.09.19 16:00| websocket订阅主题“market.$symbol.bbo” |新增|新增买一卖一逐笔推送| From 74c1e20b8f82b205fc644531c1b17b9d56f7cb36 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 27 Sep 2019 14:45:47 +0800 Subject: [PATCH 199/864] Update index.html.md --- source/index.html.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 52cb27c8ccf..7b1fb312a18 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1847,7 +1847,6 @@ API Key 权限:交易 order-state | Description --------- | ----------- -1| order was already closed in the long past (order state = canceled, partial-canceled, filled, partial-filled) -0| client-order-id not found 5| partial-canceled 6| filled 7| canceled @@ -1896,7 +1895,7 @@ data | integer | 撤单状态码 Status Code | Description --------- | ----------- -1| order was already closed in the long past (order state = canceled, partial-canceled, filled, partial-filled) -0| order-id not found +0| client-order-id not found 5| partial-canceled 6| filled 7| canceled @@ -2097,7 +2096,6 @@ API Key 权限:交易 order-state | Description --------- | ----------- -1| order was already closed in the long past (order state = canceled, partial-canceled, filled, partial-filled) -0| order-id not found 5| partial-canceled 6| filled 7| canceled From 0d6489a2e120980cceb786a0c059ee5afdf2dbaa Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 27 Sep 2019 19:19:33 +0800 Subject: [PATCH 200/864] Update index.html.md --- source/index.html.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 7b1fb312a18..eab0a943074 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1430,7 +1430,7 @@ curl "https://api.huobi.pro/v2/account/withdraw/quota?currency=btc" | 字段名称 | 是否必需 | 类型 | 字段描述 |取值范围 | | ---------- | ---- | ------ | ------ | ---- | -| currency | false | string | 币种 | btc, ltc, bch, eth, etc ...(火币全球站支持的币种) | +| currency | true | string | 币种 | btc, ltc, bch, eth, etc ...(火币全球站支持的币种) | > Response: @@ -1440,7 +1440,7 @@ curl "https://api.huobi.pro/v2/account/withdraw/quota?currency=btc" "data": [ { "currency": "btc", - "chains": [ + "chains": { "chain": "btc", "maxWithdrawAmt": "200.00000000", @@ -1450,8 +1450,7 @@ curl "https://api.huobi.pro/v2/account/withdraw/quota?currency=btc" "remainWithdrawQuotaPerYear": "700000.000000000000000000", "withdrawQuotaTotal": "7000000.00000000", "remainWithdrawQuotaTotal": "7000000.000000000000000000" - } - ] + } } ] } @@ -1465,7 +1464,7 @@ curl "https://api.huobi.pro/v2/account/withdraw/quota?currency=btc" | code| true | int | 状态码 | | | message| false | string | 错误描述(如有) | | | data| true | object | | | -| {currency | true | string | 币种 | | +| currency | true | string | 币种 | | | chains| true | object | | | | { chain | true | string | 链名称 | | | maxWithdrawAmt | true | string | 单次最大提币金额 | | @@ -1474,7 +1473,7 @@ curl "https://api.huobi.pro/v2/account/withdraw/quota?currency=btc" | withdrawQuotaPerYear | true | string | 当年提币额度 | | | remainWithdrawQuotaPerYear | true | string | 当年提币剩余额度 | | | withdrawQuotaTotal | true | string | 总提币额度 | | -| remainWithdrawQuotaTotal }} | true | string | 总提币剩余额度 | | +| remainWithdrawQuotaTotal } | true | string | 总提币剩余额度 | | ### 状态码 From b947cc5af581868854464fb7c583caa87b024d12 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 9 Oct 2019 10:15:19 +0800 Subject: [PATCH 201/864] 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 eab0a943074..79e9ad71c3d 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -171,7 +171,7 @@ API 请求在通过 internet 传输的过程中极有可能被篡改,为了确 - 签名版本(SignatureVersion):签名协议的版本,此处使用2。 -- 时间戳(Timestamp):您发出请求的时间 (UTC 时区) (UTC 时区) (UTC 时区) 。如:2017-05-11T16:22:06。在查询请求中包含此值有助于防止第三方截取您的请求。 +- 时间戳(Timestamp):您发出请求的时间 (UTC 时间) 。如:2017-05-11T16:22:06。在查询请求中包含此值有助于防止第三方截取您的请求。 - 必选和可选参数:每个方法都有一组用于定义 API 调用的必需参数和可选参数。可以在每个方法的说明中查看这些参数及其含义。 请一定注意:对于 GET 请求,每个方法自带的参数都需要进行签名运算; 对于 POST 请求,每个方法自带的参数不进行签名认证,即 POST 请求中需要进行签名运算的只有 AccessKeyId、SignatureMethod、SignatureVersion、Timestamp 四个参数,其它参数放在 body 中。 @@ -1514,7 +1514,7 @@ API Key 权限:提币 | address | true | string | 提现地址 |仅支持在官网上相应币种[地址列表](https://www.hbg.com/zh-cn/withdraw_address/) 中的地址 | | amount | true | string | 提币数量 | | | currency | true | string | 资产类型 | btc, ltc, bch, eth, etc ...(火币全球站支持的币种) | -| fee | false | string | 转账手续费 | | +| fee | true | string | 转账手续费 | | | chain | false | string | 提 USDT-ERC20 时需要设置此参数为 "usdterc20",其他币种提现不需要设置此参数 | | | addr-tag|false | string | 虚拟币共享地址tag,适用于xrp,xem,bts,steem,eos,xmr | 格式, "123"类的整数字符串| From 71b57b8d4568f64ae40073f533533875914cf73e Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 9 Oct 2019 16:20:47 +0800 Subject: [PATCH 202/864] Update index.html.md --- source/index.html.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index 79e9ad71c3d..34c38b484ef 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -82,10 +82,11 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.10.09 20:00| “GET /market/trade”,“GET /market/history/trade”,“market.$symbol.trade.detail”|优化|新增返回字段trade id| |2019.09.25 20:00| GET /v2/account/withdraw/quota |新增|新增提币额度查询节点| |2019.09.23 15:00| POST /v1/order/orders/{order-id}/submitcancel & POST /v1/order/orders/batchcancel |优化|优化错误码返回| |2019.09.20 10:00| GET /v2/reference/currencies |新增|新增币链参考信息节点| -|2019.09.19 16:00| websocket订阅主题“market.$symbol.bbo” |新增|新增买一卖一逐笔推送| +|2019.09.19 16:00| websocket订阅主题“/market/trade.$symbol.bbo” |新增|新增买一卖一逐笔推送| |2019.09.18 20:00| GET /v1/subuser/aggregate-balance, GET /v1/account/accounts/{sub-uid}, GET /v1/margin/loan-orders, GET /v1/margin/accounts/balance |新增|支持子用户逐仓杠杆交易| |2019.09.16 15:00| GET /v2/account/deposit/address |新增|新增APIv2节点 - 充币地址查询| |2019.09.11 17:00| GET v1/stable-coin/quote,POST v1/stable-coin/exchange |新增|新增稳定币兑换节点| @@ -926,6 +927,7 @@ symbol | string | true | NA | 交易对,例如btcusdt, ethbtc "data": [ { "id": 600848670, + "trade-id": 102043494568, "price": 7962.62, "amount": 0.0122, "direction": "buy", @@ -942,6 +944,7 @@ symbol | string | true | NA | 交易对,例如btcusdt, ethbtc 字段名称 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | 唯一交易id +trade-id|integer|唯一成交ID amount | float | 以基础币种为单位的交易量 price | float | 以报价币种为单位的成交价格 ts | integer | 调整为北京时间的时间戳,单位毫秒 @@ -977,6 +980,7 @@ size | integer | false | 1 | 返回的交易记录数量,最 { "amount":9.000000000000000000, "ts":1544390317905, + "trade-id": 102043483472, "id":3161878751418918529341, "price":94.690000000000000000, "direction":"sell" @@ -984,6 +988,7 @@ size | integer | false | 1 | 返回的交易记录数量,最 { "amount":73.771000000000000000, "ts":1544390317905, + "trade-id": 102043483473 "id":3161878751418918532514, "price":94.660000000000000000, "direction":"sell" @@ -997,6 +1002,7 @@ size | integer | false | 1 | 返回的交易记录数量,最 { "amount":1.000000000000000000, "ts":1544390311353, + "trade-id": 102043494568, "id":3161877698918918522622, "price":94.710000000000000000, "direction":"buy" @@ -1013,6 +1019,7 @@ size | integer | false | 1 | 返回的交易记录数量,最 参数 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | 唯一交易id +trade-id|integer|唯一成交ID amount | float | 以基础币种为单位的交易量 price | float | 以报价币种为单位的成交价格 ts | integer | 调整为北京时间的时间戳,单位毫秒 @@ -3713,6 +3720,7 @@ symbol | string | true | NA | 交易代码 "amount": 0.0099, "ts": 1533265950234, "id": 146507451359183894799, + "trade-id": 102043494568, "price": 401.74, "direction": "buy" } @@ -3727,6 +3735,7 @@ symbol | string | true | NA | 交易代码 字段 | 数据类型 | 描述 --------- | --------- | ----------- id | integer | 唯一成交ID +tradeId|integer|唯一成交ID amount | float | 成交量 price | float | 成交价 ts | integer | 成交时间 (UNIX epoch time in millisecond) From a807117c9a6081a7ae3ed8dfc1386fc908b12878 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 10 Oct 2019 09:55:44 +0800 Subject: [PATCH 203/864] 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 34c38b484ef..82bf8ed5da8 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1628,7 +1628,7 @@ API Key 权限:读取 | amount | true | float | 个数 | | | address | true | string | 地址 | | | address-tag | true | string | 地址标签 | | -| fee | true | long | 手续费 | | +| fee | true | float | 手续费 | | | state | true | string | 状态 | 状态参见下表 | | created-at | true | long | 发起时间 | | | updated-at | true | long | 最后更新时间 | | From ca3d126bfa3891edc929116f8734d435e95fa3d0 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 10 Oct 2019 17:23:35 +0800 Subject: [PATCH 204/864] Update index.html.md --- source/index.html.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 82bf8ed5da8..3e762963b3e 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -943,8 +943,8 @@ symbol | string | true | NA | 交易对,例如btcusdt, ethbtc 字段名称 | 数据类型 | 描述 --------- | --------- | ----------- -id | integer | 唯一交易id -trade-id|integer|唯一成交ID +id | integer | 唯一交易id(将被废弃) +trade-id|integer|唯一成交ID(NEW) amount | float | 以基础币种为单位的交易量 price | float | 以报价币种为单位的成交价格 ts | integer | 调整为北京时间的时间戳,单位毫秒 @@ -1018,8 +1018,8 @@ size | integer | false | 1 | 返回的交易记录数量,最 参数 | 数据类型 | 描述 --------- | --------- | ----------- -id | integer | 唯一交易id -trade-id|integer|唯一成交ID +id | integer | 唯一交易id(将被废弃) +trade-id|integer|唯一成交ID(NEW) amount | float | 以基础币种为单位的交易量 price | float | 以报价币种为单位的成交价格 ts | integer | 调整为北京时间的时间戳,单位毫秒 @@ -3720,7 +3720,7 @@ symbol | string | true | NA | 交易代码 "amount": 0.0099, "ts": 1533265950234, "id": 146507451359183894799, - "trade-id": 102043494568, + "tradeId": 102043494568, "price": 401.74, "direction": "buy" } @@ -3734,8 +3734,8 @@ symbol | string | true | NA | 交易代码 字段 | 数据类型 | 描述 --------- | --------- | ----------- -id | integer | 唯一成交ID -tradeId|integer|唯一成交ID +id | integer | 唯一成交ID(将被废弃) +tradeId|integer|唯一成交ID(NEW) amount | float | 成交量 price | float | 成交价 ts | integer | 成交时间 (UNIX epoch time in millisecond) From b7df97ec48c3a17eecc0484fa123d7450367a204 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 11 Oct 2019 10:35:43 +0800 Subject: [PATCH 205/864] Update index.html.md --- source/index.html.md | 304 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 291 insertions(+), 13 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 3e762963b3e..540b590125f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -82,6 +82,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.10.11 10:00| 支持全仓杠杆资金划转、借贷、还贷、查询借贷订单、查询账户余额等相关节点 |新增|新增全仓杠杆相关节点| |2019.10.09 20:00| “GET /market/trade”,“GET /market/history/trade”,“market.$symbol.trade.detail”|优化|新增返回字段trade id| |2019.09.25 20:00| GET /v2/account/withdraw/quota |新增|新增提币额度查询节点| |2019.09.23 15:00| POST /v1/order/orders/{order-id}/submitcancel & POST /v1/order/orders/batchcancel |优化|优化错误码返回| @@ -2727,19 +2728,19 @@ taker-fee| string| 吃单手续费率 base-symbol-error| 无效的交易对| string| - base-too-many-symbol| 最大支持 10 个交易对| string| - -# 借贷 +# 借贷(逐仓杠杆) - + ## 资产划转 API Key 权限:交易 -此接口用于现货账户与杠杆账户的资产互转。 +此接口用于现货账户与逐仓杠杆账户的资产互转。 -从现货账户划转至杠杆账户 `transfer-in`,从杠杆账户划转至现货账户 `transfer-out` +从现货账户划转至逐仓杠杆账户 `transfer-in`,从逐仓杠杆账户划转至现货账户 `transfer-out` ### HTTP 请求 @@ -2760,7 +2761,7 @@ API Key 权限:交易 参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -symbol | string | true | NA | 交易对, e.g. btcusdt, ethbtc +symbol | string | true | NA | 交易对, e.g. btcusdt, ethbtc currency | string | true | NA | 币种 amount | string | true | NA | 划转数量 @@ -2776,7 +2777,7 @@ amount | string | true | NA | 划转数量 ### 响应数据 -参数名称 | 数据类型 | 描述 +参数名称 | 数据类型 | 描述 ------ | ------- | ----- data | integer | Transfer id @@ -2861,7 +2862,7 @@ amount | string | true | 归还币种数量 ### 响应数据 -参数名称 | 数据类型 | 描述 +参数名称 | 数据类型 | 描述 ------- | ------- | ----------- data | integer | Margin order id @@ -2945,12 +2946,7 @@ API Key 权限:读取 ```json { - "account-id": "100009", - "amount": "10.1", - "price": "100.1", - "source": "api", - "symbol": "ethusdt", - "type": "buy-limit" + "symbol": "ethusdt" } ``` @@ -3021,6 +3017,288 @@ API Key 权限:读取 | fl-price | true | string | 爆仓价 | | | list | true | array | 借贷账户详情列表 | | +# 借贷(全仓杠杆) + + + + + +## 资产划转 + +API Key 权限:交易 + +此接口用于现货账户与全仓杠杆账户的资产互转。 + +从现货账户划转至全仓杠杆账户 `transfer-in`,从全仓杠杆账户划转至现货账户 `transfer-out` + +### HTTP 请求 + +- POST ` /v1/cross-margin/transfer-in` +- POST ` /v1/cross-margin/transfer-out` + +```json +{ + "currency": "eth", + "amount": "1.0" +} +``` + + +### 请求参数 + +参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 +--------- | --------- | -------- | ------- | ----------- +currency | string | true | NA | 币种 +amount | string | true | NA | 划转数量 + + +> Response: + +```json +{ + "status": "ok", + "data": 1000 +} +``` + +### 响应数据 + + +参数名称 | 数据类型 | 描述 +------ | ------- | ----- +data | integer | Transfer id + + +## 申请借贷 + +API Key 权限:交易 + +此接口用于申请借贷. + +### HTTP 请求 + +- POST ` /v1/cross-margin/orders` + +```json +{ + "currency": "eth", + "amount": "1.0" +} +``` + + +### 请求参数 + +参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 +--------- | --------- | -------- | ------- | ----------- +currency | string | true | NA | 币种 +amount | string | true | NA | 借贷数量 + +> Response: + +```json +{ + "status": "ok", + "data": 1000 +} +``` + + +### 响应数据 + +字段名称| 数据类型 | 描述 +-------| ------ | ---- +data | integer | Margin order id + + + +## 归还借贷 + +API Key 权限:交易 + +此接口用于归还借贷. + +### HTTP 请求 + +- POST ` /v1/cross-margin/orders/{order-id}/repay` + +```json +{ + "amount": "1.0" +} +``` + + +### 请求参数 + +参数名称 | 数据类型 | 是否必需 | 描述 +--------- | --------- | -------- | ----------- +order-id | string | true | 借贷订单 ID,写在 url path 中 +amount | string | true | 归还币种数量 + + +> Response: + +```json +{ + "status": "ok", + "data": null +} +``` + +### 响应数据 + + +参数名称 | 数据类型 | 描述 +------- | ------- | ----------- +data | integer | Margin order id + + +## 查询借贷订单 + +API Key 权限:读取 + +此接口基于指定搜索条件返回借贷订单。 + +### HTTP 请求 + +- GET ` /v1/cross-margin/loan-orders` + +### 请求参数 + +| 参数名称 | 是否必须 | 类型 | 描述 | 默认值 | 取值范围 | +| ----- | ----- | ------ | ------- | ---- | ---- | +| start-date | false | string | 查询开始日期, 日期格式yyyy-mm-dd | | | +| end-date | false | string | 查询结束日期, 日期格式yyyy-mm-dd | | | +| currency | false | string | 币种 | | +| state | false | string | 状态 |all |created 未放款,accrual 已放款,cleared 已还清,invalid 异常 +| from | false | string | 查询起始 ID | 0 | | +| direct | false | string | 查询方向 | | prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) | +| size | false | string | 查询记录大小 | 10 |[10,100] | + +> Response: + +```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 + } + ] +} +``` + +### 响应数据 + + +| 字段名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +|-----|-----|-----|-----|------| +| id | true | long | 订单号 | | +| user-id | true | long | 用户ID | | +| account-id | true | long | 账户ID | | +| currency | true | string | 币种 | | +| loan-amount | true |string | 借贷本金总额 | | +| loan-balance | true | string | 未还本金 | | +| interest-amount | true | string | 利息总额 | | +| interest-balance | true | string | 未还利息 | | +| filled-points | true | string | 点卡抵扣数量 | | +| filled-ht | true | string | HT抵扣数量 | | +| created-at | true | long | 借贷发起时间 | | +| accrued-at | true | long | 最近一次计息时间 | | +| state | true | string | 订单状态 |created 未放款,accrual 已放款,cleared 已还清,invalid 异常| + + +## 借贷账户详情 + +API Key 权限:读取 + +此接口返回借贷账户详情。 + +### HTTP 请求 + +- GET `/v1/cross-margin/accounts/balance` + +### 请求参数 + +无 + +> Response: + +```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" + } + ] + } + ] +} +``` + +### 响应数据 + +| 字段名称 | 是否必须 | 数据类型 | 描述 | 取值范围 | +|-----|-----|-----|-----|------| +| id | true | integer | Account ID 账户编号 | | +| type | true | integer | 账户类型 (margin or cross-margin) |cross-margin | +| state | true | string | 账户状态 | working,fl-sys,fl-end,fl-negative | +| risk-rate | true | string | 风险率 | | +| acct-balance-sum | true | string | 总持有usdt折合 | | +| debt-balance-sum | true | string | 总负债usdt折合 | | +| list | true | array | 借贷账户详情列表 | | +| { currency | true | string | 币种| | +| type | true | string | 账户类型| trade,frozen,loan,interest,transfer-out-available,loan-available| +| balance | true | string | 余额(注:当type= transfer-out-available时,如果balance=-1,意味着该币种余额可全部转出)| | # ETF(HB10) From e5b2fab0ca808136db9fe66e7600715baf57c345 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 11 Oct 2019 10:41:35 +0800 Subject: [PATCH 206/864] 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 540b590125f..6cc54fced6e 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3298,7 +3298,7 @@ API Key 权限:读取 | list | true | array | 借贷账户详情列表 | | | { currency | true | string | 币种| | | type | true | string | 账户类型| trade,frozen,loan,interest,transfer-out-available,loan-available| -| balance | true | string | 余额(注:当type= transfer-out-available时,如果balance=-1,意味着该币种余额可全部转出)| | +| balance } | true | string | 余额(注:当type= transfer-out-available时,如果balance=-1,意味着该币种余额可全部转出)| | # ETF(HB10) From e58047dd85141f2ff45d770c4b96af6c5f244705 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 11 Oct 2019 14:24:36 +0800 Subject: [PATCH 207/864] 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 6cc54fced6e..4450ea5429c 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1127,7 +1127,7 @@ API Key 权限:读取 | ----- | ---- | ------ | ----- | ---- | | id | true | long | account-id | | | state | true | string | 账户状态 | working:正常, lock:账户被锁定 | -| type | true | string | 账户类型 | spot:现货账户, margin:杠杆账户,otc:OTC 账户,point:点卡账户 | +| type | true | string | 账户类型 | spot:现货账户, margin:逐仓杠杆账户,otc:OTC 账户,point:点卡账户,super-margin:全仓杠杆账户 | @@ -1180,7 +1180,7 @@ spot:现货账户, margin:杠杆账户,otc:OTC 账户,point:点卡 | ----- | ----- | ------ | ----- | ----- | | id | true | long | 账户 ID | | | state | true | string | 账户状态 | working:正常 lock:账户被锁定 | -| type | true | string | 账户类型 | spot:现货账户, margin:杠杆账户,otc:OTC 账户,point:点卡账户 | +| type | true | string | 账户类型 | spot:现货账户, margin:逐仓杠杆账户,otc:OTC 账户,point:点卡账户,super-margin:全仓杠杆账户 | | list | false | Array | 子账号数组 | | list字段说明 From e0255bf846876f61e5064007bdc848139ac003ba Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 11 Oct 2019 15:48:02 +0800 Subject: [PATCH 208/864] 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 4450ea5429c..2f706332cc1 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -4338,7 +4338,7 @@ event | string | 资产变化通知相关事件说明,比如订单创 account-id| integer | 账户 id currency | string | 币种 type | string | 账户类型, 交易子账户(trade),借贷子账户(loan),利息子账户(interest) -balance | string | 账户余额 (当订阅mode=0时,该余额为可用余额;当订阅mode=1时,该余额为总余额) +balance | string | 账户余额 (当订阅model=0时,该余额为可用余额;当订阅model=1时,该余额为总余额) ## 订阅订单更新 From 5f02e5478e6b2b3e133ff1c97d268eec2e2d25ae Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Sat, 12 Oct 2019 10:08:02 +0800 Subject: [PATCH 209/864] Update index.html.md --- source/index.html.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 2f706332cc1..a8c0b0fdaa1 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1129,7 +1129,7 @@ API Key 权限:读取 | state | true | string | 账户状态 | working:正常, lock:账户被锁定 | | type | true | string | 账户类型 | spot:现货账户, margin:逐仓杠杆账户,otc:OTC 账户,point:点卡账户,super-margin:全仓杠杆账户 | - + ## 账户余额 @@ -1137,7 +1137,7 @@ API Key 权限:读取 查询指定账户的余额,支持以下账户: -spot:现货账户, margin:杠杆账户,otc:OTC 账户,point:点卡账户 +spot:现货账户, margin:逐仓杠杆账户,otc:OTC 账户,point:点卡账户,super-margin:全仓杠杆账户 ### HTTP 请求 @@ -1732,7 +1732,7 @@ API Key 权限:交易 - + ## 下单 @@ -1760,12 +1760,12 @@ API Key 权限:交易 参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -account-id | string | true | NA | 账户 ID,使用 GET /v1/account/accounts 接口查询。现货交易使用 ‘spot’ 账户的 account-id;杠杆交易,请使用 ‘margin’ 账户的 account-id +account-id | string | true | NA | 账户 ID,使用 GET /v1/account/accounts 接口查询。现货交易使用 ‘spot’ 账户的 account-id;逐仓杠杆交易,请使用 ‘margin’ 账户的 account-id;全仓杠杆交易,请使用 ‘super-margin’ 账户的 account-id symbol | string | true | NA | 交易对, 例如btcusdt, ethbtc type | string | true | NA | 订单类型,包括buy-market, sell-market, buy-limit, sell-limit, buy-ioc, sell-ioc, buy-limit-maker, sell-limit-maker(说明见下文), buy-stop-limit, sell-stop-limit amount | string | true | NA | 订单交易量(市价买单此字段为订单交易额) price | string | false | NA | limit order的交易价格 -source | string | false | api | 现货交易填写“api”,杠杆交易填写“margin-api” +source | string | false | api | 现货交易填写“api”,逐仓杠杆交易填写“margin-api”,全仓杠杆交易填写“super-margin-api” client-order-id| string | false | NA | 用户自编订单号(须在24小时内保持唯一性) stop-price|string|false|NA|止盈止损订单触发价格 operator|string|false|NA|止盈止损订单触发价运算符 gte – greater than and equal (>=), lte – less than and equal (<=) @@ -1932,7 +1932,7 @@ API Key 权限:读取 参数名称 | 数据类型 | 是否必需 | 默认值 | 描述 --------- | --------- | -------- | ------- | ----------- -account-id | string | true | NA | 账户 ID,使用 GET /v1/account/accounts 接口获得。现货交易使用‘spot’账户的 account-id;杠杆交易,请使用 ‘margin’ 账户的 account-id +account-id | string | true | NA | 账户 ID,使用 GET /v1/account/accounts 接口获得。现货交易使用‘spot’账户的 account-id;逐仓杠杆交易,请使用 ‘margin’ 账户的 account-id;全仓杠杆交易,请使用 ‘super-margin’ 账户的 account-id symbol | string | ture | NA | 交易对, 例如btcusdt, ethbtc side | string | false | both | 指定只返回某一个方向的订单,可能的值有: buy, sell. 默认两个方向都返回。 from | string | false | |查询起始 ID From 7db0af77ad7b66081b5220bc5d03451d1242f917 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Sat, 12 Oct 2019 11:30:49 +0800 Subject: [PATCH 210/864] 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 a8c0b0fdaa1..5cc577beb2d 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1521,9 +1521,9 @@ API Key 权限:提币 | ---------- | ---- | ------ | ------ | ---- | | address | true | string | 提现地址 |仅支持在官网上相应币种[地址列表](https://www.hbg.com/zh-cn/withdraw_address/) 中的地址 | | amount | true | string | 提币数量 | | -| currency | true | string | 资产类型 | btc, ltc, bch, eth, etc ...(火币全球站支持的币种) | +| currency | true | string | 资产类型 | btc, ltc, bch, eth, etc ...(火币全球站支持的币种) | | fee | true | string | 转账手续费 | | -| chain | false | string | 提 USDT-ERC20 时需要设置此参数为 "usdterc20",其他币种提现不需要设置此参数 | | +| chain | false | string | 提USDT至OMNI时须设置此参数为"usdt",提USDT至TRX时须设置此参数为"trc20usdt",其他币种提现无须设置此参数 | | | addr-tag|false | string | 虚拟币共享地址tag,适用于xrp,xem,bts,steem,eos,xmr | 格式, "123"类的整数字符串| From 70cca910cc39a6556b41ef057658bbfecde5180b Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Sat, 12 Oct 2019 11:35:46 +0800 Subject: [PATCH 211/864] 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 5cc577beb2d..fe8631a64f3 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -82,6 +82,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.10.12 11:00| POST /v1/dw/withdraw/api/create |优化|设置ERC20为USDT的默认链| |2019.10.11 10:00| 支持全仓杠杆资金划转、借贷、还贷、查询借贷订单、查询账户余额等相关节点 |新增|新增全仓杠杆相关节点| |2019.10.09 20:00| “GET /market/trade”,“GET /market/history/trade”,“market.$symbol.trade.detail”|优化|新增返回字段trade id| |2019.09.25 20:00| GET /v2/account/withdraw/quota |新增|新增提币额度查询节点| From 12cac709eadc698764d4aaf2903f780b50d249d1 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 15 Oct 2019 10:48:29 +0800 Subject: [PATCH 212/864] 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 fe8631a64f3..6a3b83debad 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1767,7 +1767,7 @@ type | string | true | NA | 订单类型,包括buy-market, s amount | string | true | NA | 订单交易量(市价买单此字段为订单交易额) price | string | false | NA | limit order的交易价格 source | string | false | api | 现货交易填写“api”,逐仓杠杆交易填写“margin-api”,全仓杠杆交易填写“super-margin-api” -client-order-id| string | false | NA | 用户自编订单号(须在24小时内保持唯一性) +client-order-id| string | false | NA | 用户自编订单号(最大长度64个字符,须在24小时内保持唯一性) stop-price|string|false|NA|止盈止损订单触发价格 operator|string|false|NA|止盈止损订单触发价运算符 gte – greater than and equal (>=), lte – less than and equal (<=) From fcece46f488d289627e70a498e6ee3d11870bfd7 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 15 Oct 2019 18:49:21 +0800 Subject: [PATCH 213/864] Update index.html.md --- source/index.html.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 6a3b83debad..2dd14317be1 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1169,8 +1169,7 @@ spot:现货账户, margin:逐仓杠杆账户,otc:OTC 账户,point: "type": "frozen", "balance": "348.1199920000" } - ], - "user-id": 10000 + ] } } ``` From 586ce206d6357fa635d4869de623312114b1afec Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 18 Oct 2019 19:40:39 +0800 Subject: [PATCH 214/864] Update index.html.md --- source/index.html.md | 68 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 2dd14317be1..3267ef09126 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1191,6 +1191,74 @@ list字段说明 | currency | true | string | 币种 | | | type | true | string | 类型 | trade: 交易余额,frozen: 冻结余额 | +## 账户流水 + +API Key 权限:读取 + +该节点基于用户账户ID返回账户流水。 + +### HTTP Request + +- GET `/v1/account/history` + +### 请求参数 + +| 参数名称 | 是否必需 | 数据类型 | 描述 | 缺省值|取值范围 | +--------- | --------- | -------- | ------- | ----------- | ---------- +account-id | true | string | 账户编号 | | | +currency | false | string | 币种 | | | +transact-types | false | string | 变动类型,可多选 | all |trade,etf, transact-fee, deduction, transfer, credit, liquidation, interest, deposit-withdraw, withdraw-fee, exchange, other-types | +start-time | false | long | 远点时间 unix time in millisecond. 以transact-time为key进行检索. 查询窗口最大为1小时. 窗口平移范围为最近30天. | ((end-time) – 1hour) | [((end-time) – 1hour), (end-time)] | +end-time | false | long | 近点时间unix time in millisecond. 以transact-time为key进行检索. 查询窗口最大为1小时. 窗口平移范围为最近30天. | current-time |[(current-time) – 29days,(current-time)]| +sort | false | string | 检索方向 | asc |asc or desc| +size | false | int | 最大条目数量 | 100 |[1,500]| + +> Response: + +```json +{ + "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": 5260185, + "currency": "btc", + "transact-amt": "-0.002393000000000000", + "transact-type": "transfer", + "record-id": 89373382631, + "avail-balance": "0E-18", + "acct-balance": "0E-18", + "transact-time": 1571393578496 + } + ] +} +``` + +### 响应数据 + +字段名称 | 数据类型 | 描述 | 取值范围 +--------- | --------- | ----------- | ----------- +status | string | 状态码 | +data | object | | +{ account-id | long | 账户编号| +currency | string | 币种| +transact-amt | string | 变动金额(入账为正 or 出账为负) | +transact-type | string | 变动类型 | +avail-balance | string | 可用余额 | +acct-balance | string | 账户余额 | +transact-time | long | 交易时间(数据库记录时间) | +record-id } | string | 数据库记录编号(全局唯一) | + + ## 资产划转(母子账号之间) From 6f2db4c9d12761df63320980f770c99e74963716 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 21 Oct 2019 11:24:40 +0800 Subject: [PATCH 215/864] 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 3267ef09126..4544124d158 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -82,6 +82,7 @@ search: False | 生效时间(北京时间 UTC+8) | 接口 | 新增 / 修改 | 摘要 | |-----|-----|-----|-----| +|2019.10.18 19:00| GET /v1/account/history |新增|新增账户流水查询节点| |2019.10.12 11:00| POST /v1/dw/withdraw/api/create |优化|设置ERC20为USDT的默认链| |2019.10.11 10:00| 支持全仓杠杆资金划转、借贷、还贷、查询借贷订单、查询账户余额等相关节点 |新增|新增全仓杠杆相关节点| |2019.10.09 20:00| “GET /market/trade”,“GET /market/history/trade”,“market.$symbol.trade.detail”|优化|新增返回字段trade id| From dbede2fcf70634e0e176d57a697b19a14eb641db Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 22 Oct 2019 10:07:58 +0800 Subject: [PATCH 216/864] 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 4544124d158..18f0ac31e59 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -4772,7 +4772,7 @@ API Key 权限:读取 ### 数据请求 -`order.detail` +`orders.detail` > Query request From c306c70b9626b780fc4204ac682ad64335f46e98 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Tue, 22 Oct 2019 17:11:53 +0800 Subject: [PATCH 217/864] 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 18f0ac31e59..975345f4afb 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1695,6 +1695,7 @@ API Key 权限:读取 | type | true | string | 类型 | 'deposit', 'withdraw' | | currency | true | string | 币种 | | | tx-hash | true |string | 交易哈希 | | +| chain | true | string | 链名称 | | | amount | true | float | 个数 | | | address | true | string | 地址 | | | address-tag | true | string | 地址标签 | | From 4dae4a52f5f39c2d1c99e9772618cd5a566a8aa1 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Wed, 23 Oct 2019 11:46:12 +0800 Subject: [PATCH 218/864] 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 975345f4afb..6794385cdba 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -680,7 +680,7 @@ curl "https://api.huobi.pro/market/history/kline?period=1day&size=200&symbol=btc 参数 | 数据类型 | 是否必须 | 默认值 | 描述 | 取值范围 --------- | --------- | -------- | ------- | ------ | ------ symbol | string | true | NA | 交易对 | btcusdt, ethbtc... -period | string | true | NA | 返回数据时间粒度,也就是每根蜡烛的时间区间 | 1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year +period | string | true | NA | 返回数据时间粒度,也就是每根蜡烛的时间区间 | 1min, 5min, 15min, 30min, 60min, 4hour, 1day, 1mon, 1week, 1year size | integer | false | 150 | 返回 K 线数据条数 | [1, 2000] @@ -3799,7 +3799,7 @@ Websocket服务器同时支持一次性请求数据(pull)。 参数 | 数据类型 | 是否必需 | 描述 | 取值范围 --------- | --------- | -------- | ----------- | ----------- symbol | string | true | 交易代码 | All supported trading symbols, e.g. btcusdt, bccbtc -period | string | true | K线周期 | 1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year +period | string | true | K线周期 | 1min, 5min, 15min, 30min, 60min, 4hour, 1day, 1mon, 1week, 1year > Response From 8488096880f4f1b177ab3bfb33d2209834b9b76c Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 24 Oct 2019 15:59:11 +0800 Subject: [PATCH 219/864] Update index.html.md --- source/index.html.md | 60 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/source/index.html.md b/source/index.html.md index 6794385cdba..98a2c4abee8 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3138,6 +3138,66 @@ amount | string | true | NA | 划转数量 ------ | ------- | ----- data | integer | Transfer id +## 查询借贷利率 + +API Key 权限:读取 + +此接口返回用户级别的借贷利率。 + +### HTTP 请求 + +- GET ` /v1/cross-margin/interest-rate` + +### 请求参数 + +Null + +> Response: + +```json +{ + "status": "ok", + "data": [ + { + "currency": "bch", + "interest-rate": "0.001" + }, + { + "currency": "btc", + "interest-rate": "0.001" + }, + { + "currency": "eos", + "interest-rate": "0.001" + }, + { + "currency": "eth", + "interest-rate": "0.001" + }, + { + "currency": "ltc", + "interest-rate": "0.001" + }, + { + "currency": "usdt", + "interest-rate": "0.001" + }, + { + "currency": "xrp", + "interest-rate": "0.001" + } + ] +} +``` + +### 响应数据 + + +参数名称 | 数据类型 | 描述 +------ | ------- | ----- +currency | string | 币种 +interest-rate|string|借贷利率 + ## 申请借贷 From 820c6c54b53d42047b83044ead3b29a5f47a1d2d Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Thu, 24 Oct 2019 17:10:55 +0800 Subject: [PATCH 220/864] Update index.html.md --- source/index.html.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 98a2c4abee8..37e40576d86 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -2216,9 +2216,7 @@ API Key 权限:读取 "user-id": 1000, "source": "api", "state": "filled", - "canceled-at": 0, - "exchange": "huobi", - "batch": "" + "canceled-at": 0 } } ``` @@ -2287,9 +2285,7 @@ API Key 权限:读取 "user-id": 1000, "source": "api", "state": "filled", - "canceled-at": 0, - "exchange": "huobi", - "batch": "" + "canceled-at": 0 } } ``` @@ -2444,9 +2440,7 @@ API Key 权限:读取 "user-id": 1000, "source": "api", "state": "filled", - "canceled-at": 0, - "exchange": "huobi", - "batch": "" + "canceled-at": 0 } ... ] From e1eaa40c46f5e0738291e3aa0c3b3870f5308c44 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Fri, 25 Oct 2019 18:19:01 +0800 Subject: [PATCH 221/864] Update index.html.md --- source/index.html.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index 37e40576d86..4e1dfd0e3d4 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1865,13 +1865,7 @@ operator|string|false|NA|止盈止损订单触发价运算符 gte – greater th 返回的主数据对象是一个对应下单单号的字符串。 -如client order ID(24小时内)被复用,返回如下错误信息 – -{ - "status": "error", - "err-code": "order-orderstate-error", - "err-msg": "Incorrect order state", - "data": null -} +如client order ID(在24小时内)被复用,节点返回先前订单的client order ID。 ## 撤销订单 From 1318cbd383e825b7b6b06fc392f261df0b66d5dd Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 28 Oct 2019 09:29:25 +0800 Subject: [PATCH 222/864] 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 4e1dfd0e3d4..df8c2d0fcc2 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1130,6 +1130,7 @@ API Key 权限:读取 | id | true | long | account-id | | | state | true | string | 账户状态 | working:正常, lock:账户被锁定 | | type | true | string | 账户类型 | spot:现货账户, margin:逐仓杠杆账户,otc:OTC 账户,point:点卡账户,super-margin:全仓杠杆账户 | +| subtype | false | string | 子账户类型(仅对逐仓杠杆账户有效) | 逐仓杠杆交易所基于的特定交易对,例如btcusdt | From b4cb4f2f75dd4e57c2ed09ccc9dbca3bcfa2e550 Mon Sep 17 00:00:00 2001 From: fanguangpingathuobi <44834195+fanguangpingathuobi@users.noreply.github.com> Date: Mon, 28 Oct 2019 09:48:13 +0800 Subject: [PATCH 223/864] 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 df8c2d0fcc2..481f3c3900d 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -1130,7 +1130,7 @@ API Key 权限:读取 | id | true | long | account-id | | | state | true | string | 账户状态 | working:正常, lock:账户被锁定 | | type | true | string | 账户类型 | spot:现货账户, margin:逐仓杠杆账户,otc:OTC 账户,point:点卡账户,super-margin:全仓杠杆账户 | -| subtype | false | string | 子账户类型(仅对逐仓杠杆账户有效) | 逐仓杠杆交易所基于的特定交易对,例如btcusdt | +| subtype | false | string | 子账户类型(仅对逐仓杠杆账户有效) | 逐仓杠杆交易标的,例如btcusdt | From 9aa6134c34500fb607006c5fe0cac9fc1d307686 Mon Sep 17 00:00:00 2001 From: Sunny <56392757+huobiwangyuzhi@users.noreply.github.com> Date: Wed, 30 Oct 2019 10:45:36 +0800 Subject: [PATCH 224/864] 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 481f3c3900d..2535ab76705 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3270,7 +3270,7 @@ amount | string | true | 归还币种数量 参数名称 | 数据类型 | 描述 ------- | ------- | ----------- -data | integer | Margin order id +data | null | null ## 查询借贷订单 From 4bf48b43a058bafce4ca1a29ed8a1fd3ebf37af8 Mon Sep 17 00:00:00 2001 From: Sunny <56392757+huobiwangyuzhi@users.noreply.github.com> Date: Wed, 30 Oct 2019 10:58:42 +0800 Subject: [PATCH 225/864] 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 2535ab76705..d9f19907b9f 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3270,7 +3270,7 @@ amount | string | true | 归还币种数量 参数名称 | 数据类型 | 描述 ------- | ------- | ----------- -data | null | null +data | null | - ## 查询借贷订单 From f33683cfd35abd8a6e8410e60c9432fbf7f17ade Mon Sep 17 00:00:00 2001 From: Sunny <56392757+huobiwangyuzhi@users.noreply.github.com> Date: Wed, 30 Oct 2019 11:49:29 +0800 Subject: [PATCH 226/864] Update index.html.md --- source/index.html.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/source/index.html.md b/source/index.html.md index d9f19907b9f..80e0d45b1e6 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3967,19 +3967,19 @@ step5 | Aggregation level = precision*100000 ```json { - "ch": "market.btcusdt.depth.step0", - "ts": 1489474082831, + "ch": "market.htusdt.depth.step0", + "ts": 1572362902027, "tick": { "bids": [ - [9999.3900,0.0098], // [price, amount] - [9992.5947,0.0560] - // more Market Depth data here + [3.7721, 344.86], + [3.7709, 46.66] ], "asks": [ - [10010.9800,0.0099], - [10011.3900,2.0000] - //more data here - ] + [3.7745, 15.44], + [3.7746, 70.52] + ], + "version": 100434317651, + "ts": 1572362902012 } } ``` @@ -3992,6 +3992,8 @@ step5 | Aggregation level = precision*100000 --------- | --------- | ----------- bids | object | The current all bids in format [price, quote volume] asks | object | The current all asks in format [price, quote volume] +version | integer | 内部字段 +ts | integer | 北京时间的时间戳,单位毫秒 From 895915cbff4c884bf01bcfc56bc23fd5c3da679c Mon Sep 17 00:00:00 2001 From: Sunny <56392757+huobiwangyuzhi@users.noreply.github.com> Date: Wed, 30 Oct 2019 11:55:05 +0800 Subject: [PATCH 227/864] 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 80e0d45b1e6..8c63002d951 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3990,8 +3990,8 @@ step5 | Aggregation level = precision*100000 字段 | 数据类型 | 描述 --------- | --------- | ----------- -bids | object | The current all bids in format [price, quote volume] -asks | object | The current all asks in format [price, quote volume] +bids | object | 当前的所有买单 [price, quote volume] +asks | object | 当前的所有卖单 [price, quote volume] version | integer | 内部字段 ts | integer | 北京时间的时间戳,单位毫秒 From 3bfc91804b7dd2035d1676d278ed82d522d99ac8 Mon Sep 17 00:00:00 2001 From: Sunny <56392757+huobiwangyuzhi@users.noreply.github.com> Date: Wed, 30 Oct 2019 14:14:26 +0800 Subject: [PATCH 228/864] 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 8c63002d951..db99f65303d 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -3971,8 +3971,8 @@ step5 | Aggregation level = precision*100000 "ts": 1572362902027, "tick": { "bids": [ - [3.7721, 344.86], - [3.7709, 46.66] + [3.7721, 344.86],// [price, quote volume] + [3.7709, 46.66] ], "asks": [ [3.7745, 15.44], From 012e5fdcfaf883eedb7fa3900dc8f93d6a9f1507 Mon Sep 17 00:00:00 2001 From: Sunny <56392757+huobiwangyuzhi@users.noreply.github.com> Date: Fri, 1 Nov 2019 15:04:05 +0800 Subject: [PATCH 229/864] Update index.html.md --- source/index.html.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/index.html.md b/source/index.html.md index db99f65303d..820b44d77d4 100644 --- a/source/index.html.md +++ b/source/index.html.md @@ -129,19 +129,22 @@ search: False # 接入说明 ## 接入 URLs - +您可以自行比较使用api.huobi.pro和api-aws.huobi.pro两个域名的延迟情况,选择延迟低的进行使用。 **REST API** **`https://api.huobi.pro`** +**`https://api-aws.huobi.pro`** **Websocket Feed(行情)** **`wss://api.huobi.pro/ws`** +**`wss://api-aws.huobi.pro/ws`** **Websocket Feed(资产和订单)** **`wss://api.huobi.pro/ws/v1`** +**`wss://api-aws.huobi.pro/ws/v1`**