• Spot
  • 现货
中文
  • Change Log # Change Log   Release Time(UTC +8)|API|Initialize / Update|Description | ------------- | ------------- | ------------- | ------------- | 2018.6.10|- |Initialize|Initializes the current version of the interface
    • Introduction # Introduction Welcome to Hotcoin API! This is the official Hotcoin API document, and will be continue updating. Hotcoin will also publish API announcement in advance for any API change. Please subscribe to our announcements so that you can get the latest updates. Below is the content for Spot API document: ### Access Instructions Before you use API, you need to login the website to create API Key with proper permissions. The API key is shared for all instruments in Huobi including spot, futures, swap, options. The permissions are described as follows: * **Read permission**:It is used to query the data, such as order query, trade query. * **Trade permission**:It is used to create order, cancel order and transfer, etc. * **Withdraw permission**:It is used to create withdraw order, cancel withdraw order, etc. ### Security Authentication AccessKey is the access key to API,SecretKey is the secret key of user signature for requests. Important note: These two keys are closely related to account security, and should not be disclosed to others at any time Demo [Java](https://github.com/hotcoinex/openapi/blob/master/ApiDemo.java) | [Python3](https://github.com/hotcoinex/openapi/blob/master/ApiDemo.py) | [Php](https://github.com/hotcoinex/openapi/blob/master/Demo.php) ### Legal request structure Based on the consideration of security, all API request must be calculated by signature algorithm except market API. A legel request consists of below parts: - Request-URI Method, i.e. the address access to server: hkapi.hotcoin.top followed by method name, take hkapi.hotcoin.top/v1/order/place for instance. - API AccessKeyId is the The AccessKey in the APIKEY you requested. - Signature Method is the hash-based protocol of calculating signatures by users, HmacSHA256 is applied here. - SignatureVersion is the version of the signature protocol, 2 is applied here. - Timestamp is the time you made the request (UTC Time Zone). Including the value in query request helps preventing third parties from interception of your request.For example:2017-05-11T16:22:06.123Z.Again,(UTC Time Zone) is stressed here.For required parameters and optional parameters ,these parameters and their meanings can be viewed in the description of each method. - Signature the value calculated by signature is used for ensuring that the signature is valid and not tampered. > https://api.hotcoinfin.com/v1/order/place? AccessKeyId=AccessKeyHotcoin123456789 &symbol=btc_gavc &type=buy &tradePrice=40000 &tradeAmount=0.1 &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2017-05-11T16:22:06.123Z &Signature=calculated value ### Signature Algorithm API request can be tempered at great risk while it is sent through the Internet. To ensure that the request is not tempered, we will require users to sign in every request (except market API) for verifying the authticity of parameters or the values of parameters. Sign Steps: Standards for Requests of Calculating Signatures: Establish a standard for requests of calculating signatures because when using HMAC to calculate signature, total different results will be achieved as different contents are calculated. So before calculating signatures, please make a standard. Examples of the request of order placement will be given as follows. >https://api.hotcoinfin.com/v1/order/place? AccessKeyId=AccessKeyHotcoin123456789 &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2017-05-11T16:22:06.123Z &symbol=btc_gavc &type=buy &tradePrice=40000 &tradeAmount=0.1 The request Method (GET or POST, WebSocket use GET), append line break "\n" GET\n The host with lower case, append line break \n. api.hotcoinfin.com\n. The path, append line break "\n" /v1/order/place\n Sorting parameters by order of ASCII code (Encoding by UTF-8 format and URI format,hexadecimal characters must be capitalized,for example‘:’ will be encoded as '%3A',space key will be encoded as '%20'). For example,here is the original order of the request parameters after encoded. >AccessKeyId=AccessKeyHotcoin123456789 &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2017-05-11T16:22:06.123Z &symbol=btc_gavc &type=buy &tradePrice=40000 &tradeAmount=0.1 Above parameter should be ordered like below: >AccessKeyId=AccessKeyHotcoin123456789 SignatureMethod=HmacSHA256 SignatureVersion=2 Timestamp=2017-05-11T16%3A22%3A06.123Z& symbol=btc_gavc tradeAmount=0.01 tradePrice=40000 type=buy Use char “&” to concatenate all parameters. >AccessKeyId=AccessKeyHotcoin123456789 &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2017-05-11T16%3A22%3A06.123Z &symbol=btc_gavc &tradeAmount=0.1 &tradePrice=40000 &type=buy The final strings for signature calculation is as follows: >GET\n api.hotcoinfin.com\n /v1/order/place\n AccessKeyId=AccessKeyHotcoin123456789 &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2017-05-11T16%3A22%3A06.123Z &symbol=btc_gavc &tradeAmount=0.1 &tradePrice=40000 &type=buy Calculation of signature algorithm,transfer the following two parameters to the cryptographic hash function: Strings for signature calculation >GET\n api.hotcoinfin.com\n /v1/order/place\n AccessKeyId=AccessKeyHotcoin123456789 &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2017-05-11T16%3A22%3A06.123Z &symbol=btc_gavc &tradeAmount=0.1 &tradePrice=40000 &type=buy SecretKey for execute signature SecretKeyHotcoin123456789 Obtained result of signature calculation and encoded with Base64 2oEC+yhkHTsNkgPUq4ZB/5mlY7EZAtUDWOQ5EO01D+I= Add the above values as the value of parameter Signature to the API request. The value must be encoded with URI when this parameter is added to the request. symbol rules:base currency + quote currency.In BTC/USDT,symbol is btc_usdt;While in ETH/BTC, symbol is eth_btc, and so on. Finally, the API request sent to the server should be: >https://api.hotcoinfin.com/v1/order/place ?AccessKeyId=AccessKeyHotcoin123456789 &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2017-05-11T16%3A22%3A06.123Z &symbol=btc_gavc &tradeAmount=0.1 &tradePrice=40000&type=buy &Signature=2oEC%2ByhkHTsNkgPUq4ZB%2F5mlY7EZAtUDWOQ5EO01D%2BI%3D
      • Reference Data

        Reference Data

        Get all trade pairs

        https://hkapi.hotcoin.top/v1/common/symbols
        
        curl "https://hkapi.hotcoin.top/v1/common/symbols"
        
        • GET /v1/common/symbols

        Request parameters:

        Response data:

        Parameter Mandatory Data Type Description Default Value Range
        code y int Status code   success:200
        msg y string message    
        time y long Current millisseconds    
        data y array symbols list    

        data:

        {
            "code":"200",
            "time":1567045034,
            "data":[
                {
                    "baseCurrency":"etc",
                    "quoteCurrency":"usdt",
                    "pricePrecision":6,
                    "amountPrecision":4,
                    "symbolPartition":"main",
                    "symbol":"etc_usdt",
                    "state":"online",
                    "minOrderCount":0.001,
                    "maxOrderCount":10000,
                    "minOrderPrice":0.0001,
                    "maxOrderPrice":10000
                },
                {
                    "baseCurrency":"ltc",
                    "quoteCurrency":"usdt",
                    "pricePrecision":6,
                    "amountPrecision":4,
                    "symbolPartition":"innovation",
                    "symbol":"ltc_usdt",
                    "state":"online",
                    "minOrderCount":0.001,
                    "maxOrderCount":10000,
                    "minOrderPrice":0.0001,
                    "maxOrderPrice":10000
                }
            ]
        }
        
        
        
        Field Type Data Type description
        baseCurrency string baseCurrency code
        quoteCurrency string quoteCurrency code
        pricePrecision integer price precision
        amountPrecision integer quantity precision
        symbolPartition string symbol Partition, example:[main,innovation]
        symbol string trade pair code
        state string trade pair status [enable,disable]
        minOrderCount decimal min order count
        maxOrderCount decimal max order count
        minOrderPrice decimal min order price
        maxOrderPrice decimal max order price
        • Market Data # Market Data   ### Real-time Ticker data - GET /v1/market/ticker ```json https://hkapi.hotcoin.top/v1/market/ticker curl "https://hkapi.hotcoin.top/v1/market/ticker" ``` **Request parameters:** Parameter|Mandatory| Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- status|y|string|Status code||success:ok,failed:error timestamp|y|long|Current millisseconds|| ticker|y|list|data|| **Response data:** ```json { "status":"ok", "timestamp":1567045034, "ticker":[ { "symbol":"btc_usdt", "last":"10000.00000000", "buy":"9999.00000000", "sell":"10001.00000000", "high":"11000.00000000", "low":"9000.00000000", "vol":"10000000.0000", "change":"10.10" } ] } ``` Parameter|Mandatory| Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- symbol|y|string|Trading pair||sellShortName_buyShortName,eg:btc_usdt last|y|number|latest price|| buy|y|number|buy|| sell|y|number|sell|| high|y|number|high || low|y|number|low|| vol|y|number|vol|| change|y|number|change||   ### Obtain kline data - GET /v1/ticker ```json https://hkapi.hotcoin.top/v1/ticker?symbol=btc_usdt&step=60 curl "https://hkapi.hotcoin.top/v1/ticker?symbol=btc_usdt&step=60" ``` **Request parameters:** Parameter|Mandatory| Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- step|y|int|Time:Sec||60(1min),300(5mins),900(15mins),1800(30mins),3600(1h),86400(1d),604800(1w),2592000(1mon) symbol|y|string|pairs||btc_gavc **Response data:** ```json { "code":200, "msg":"success", "time":1527838104874, "data":[ [ 1527820200000, 54598.5, 54598.5, 54598.5, 54598.5, 0 ], [ 1527820200000, 54598.5, 54598.5, 54598.5, 54598.5, 0 ] ] } ``` Parameter|Mandatory| Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|Status code msg|n|string|return message time|y|long|Current millisseconds data|y|array(array(number))|Kline data **data:**
          [[
          1527820200000, //int time
          54598.5, //number O
          54598.5, //number H
          54598.5, //number L
          54598.5, //number C
          0.0000 //number Vol
          ],
          ......
          ]
            ### Obtain Deep Data - GET /v1/depth ```json https://hkapi.hotcoin.top/v1/depth?symbol=btc_usdt&step=60 curl "https://hkapi.hotcoin.top/v1/depth?symbol=btc_usdt&step=60" ``` **Request parameters:** Parameter|Mandatory| Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- symbol|y|string|Trading pair||Example:btc_gavc step|n|int|Add the Parameter to check latest Kline data,Data Type is time,unit is sec.||60,3*60,5*60,15*60,30*60,60*60(1h),24*60*60(1d),7*24*60*60(1w),30*24*60*60(1mon) **Response data:** ```json { "code":200, "msg":"success", "time":1527837164605, "data":{ "period":{ "data":[ [ 1527837120000, 54598.5, 54598.5, 54598.5, 54598.5, 0 ] ], "marketFrom":"btc_gavc", "type":60, "coinVol":"btc_gavc" }, "depth":{ "date":1527837163, "asks":[ [ 57373.8, 0.0387 ], [ 57751.26, 0.0128 ], [ 57751.26, 0.0128 ] ], "bids":[ [ 57373.8, 0.0387 ], [ 57751.26, 0.0128 ], [ 57751.26, 0.0128 ] ], "lastPrice":54598.5 } } } ``` Parameter|Mandatory| Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|Status code msg|n|string|return message time|y|long|Current millisseconds data|y|object|Trading deep date **data:** Parameter|Mandatory| Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- depth|y|object period|n|object|Vaule only displayed when uploading step **depth:** Parameter|Mandatory| Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- bids|y|array(array(long))|buy,[price(transaction price), amount(transaction vol)] asks|y|array(array(long))|sell,[price(transaction price), amount(transaction vol)] date|y|long|Timestamp lastPrice|y|number|Latest price **period:** Parameter|Mandatory| Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- marketFrom|y|string|Input symbol coinVol|y|string|Input symbol type|y|long|Input step,time data|y|array(array)|Last kline data,same with format above by only one   ### Obtain real-time data - GET /v1/trade ```json https://hkapi.hotcoin.top/v1/trade?symbol=btc_usdt&count=60 curl "https://hkapi.hotcoin.top/v1/trade?symbol=btc_usdt&count=60" ``` **Request parameters:** Parameter|Mandatory| Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- AccessKeyId|y|string|Access key SignatureVersion|y|string|Version SignatureMethod|y|string|Signature Method||HmacSHA256 Signature|y|string|ApiSecret Timestamp|y|string|Timestamp count|y|int|Trades items||0 symbol|y|string|Trading pair||example:btc_gavc **Response data:** ```json { "code":200, "msg":"success", "time":1536315868962, "data":{ "sellSymbol":"BTC", "buySymbol":"GAVC", "trades":[ { "price":0.007, "amount":66491.04, "id":1, "time":"02:45:08", "en_type":"ask", "type":"sell" }, { "price":0.007, "amount":66491.04, "id":1, "time":"02:45:08", "en_type":"ask", "type":"sell" } ] } } ``` Parameter|Mandatory| Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|Status code msg|n|string|return message time|y|long|Current millisseconds data|y|object|Real-time transactions **data:** Parameter|Mandatory| Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- trades|y|array(object)|trades data sellSymbol|y|string|sellSymbol buySymbol|y|string|buySymbol **trades:** Parameter|Mandatory| Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- price|y|long|transaction price amount|y|string|transaction amount id|y|string|transaction id time|y|string|transaction time en_type|y|string|direction||"bid"(buy),"ask"(sell) type|y|string|transaction Data Type||"buy","sell"
          • Account

            Account

             

            Obtain User Balance

            • GET /v1/balance
            https://hkapi.hotcoin.top/v1/balance?AccessKeyId=""
            
            curl "https://hkapi.hotcoin.top/v1/balance?AccessKeyId=''"
            

            Request parameters:

            Parameter Mandatory Data Type Description Default Value Range
            AccessKeyId y string Access key    

            Response data:

            {
               "code": 200,
               "msg": "success",
               "time": 1527835756743,
               "data":    {
                  "netassets": 0,
                  "wallet": [
                     {
            			"uid":1100011,
            			"coinId":1,
            			"symbol":"BTC",
            			"total":1000.0000000000,
            			"frozen":1000.0000000000,
            			"coinName":"BTC",
            			"shortName":"BTC"
            		},
            		{
            			"uid":1100011,
            			"coinId":2,
            			"symbol":"LTC",
            			"total":1000.0000000000,
            			"frozen":1000.0000000000,
            			"coinName":"LTC",
            			"shortName":"LTC"
            		},
            		{
            			"uid":1100011,
            			"coinId":4,
            			"symbol":"ETH",
            			"total":1000.0000000000,
            			"frozen":0E-10,
            			"coinName":"ETH",
            			"shortName":"ETH"
            		}
                  ],
                  "totalassets": 0
               }
            }
            
            
            Parameter Mandatory Data Type Description Default Value Range
            code y int Status code    
            msg n string Return message    
            time y long Current millisseconds    
            data y object Transaction deep data    

            data:

            Parameter Mandatory Data Type Description Default Value Range
            netassets y number net assets,unit: gavc    
            totalassets y number total assets,unit:gavc    
            wallet y array(object) wallet list    

            wallet:

            Parameter Mandatory Data Type Description Default Value Range
            coinName y long Currency    
            uid y int User ID    
            coinId y int Currency ID    
            total y number Available    
            frozen y number On orders    
            symbol y string Currency symbol    
            shortName y string Abbreviation    
            • Trading # Trading ### Place order - POST /v1/order/place **Request parameters:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- symbol|y|string|Trading pair| |example:btc_usdt type|y|string|Type| | "buy" ,”sell" tradeAmount|y|number|amount|| tradePrice|y|number |price|| **Response data:** ```json { "code":200, "msg":"order success", "time":1536306331399, "data":{ "ID":18194813 } } ``` Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|Status code||success:200,failed:300 msg|y|string|message|| time|y|long|Current millisseconds|| data|y|object|data|| **msg range** English | | ------------ |Illegal request | Illegal tradeAmount value | Illegal tradePrice value | Illegal symbol format **data:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- ID|y|bigint|order id||   ### Order Cancel Note:Cancel order requests is under asynchronous pattern,call interface /v1/order/detailById is required for order status query. - POST /v1/order/cancel **Request parameters:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- id|y|bigint |Order id | | **Response data:** ```json { "code": 200, "msg": "Cancel Success", "time": 1536306495984, "data": null } ``` Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|Status code||success:200,failed:300 msg|y|string|message|| time|y|long|Current millisseconds||   ### Order Details - GET /v1/order/detailById ```json https://hkapi.hotcoin.top/v1/order/detailById curl "https://hkapi.hotcoin.top/v1/order/detailById" ``` **Request parameters:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- id|y|bigint |order id | | leverAcctid |n|string |Fields not required innon-leverorder,Sub-account id,clientId in line with API| | **Response data:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|Status code|| msg|n|string|message|| time|y|long|Current millisseconds|| data|y|object|order details|| **data:** ```json { "code": 200, "msg": "success", "time": 1536306896294, "data": { "types": "bug", "leftcount": 0.01, "fees": 0, "last": 0, "count": 0.01, "successamount": 0, "source": "API", "type": 0, "price": 40000, "buysymbol": "", "id": 18194814, "time": "2018-09-07 15:48:44", "sellsymbol": "", "statusCode":1, "status": "unsettled" } } ``` Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- types|y|string|order type| |Buy 、Sell leftcount|y|number|Unfill|| fees|y|number|Fee|| last|y|number|Current order latest price|| count|y|number|amount|| successamount|y|number|Total transaction|| source|y|string|Source | |API、WEB、APP type|y|int|Data Type code| |0(Buy),1(Sell) price|y|number|Price || buysymbol|n|string|Buy symbol|| sellsymbol|n|string|Sell symbol|| time|y|string|Establish time|| statusCode|y|int|Status code| |1 Unfilled 2 Partial filled 3 Filled 4 Revoking 5 Cancelled status|y|int|Status| |Unfill,Partial filled,Filled,Revoking,Cancelled   ### Transaction details - GET /v1/order/counterpartiesById ```json https://hkapi.hotcoin.top/v1/order/counterpartiesById curl "https://hkapi.hotcoin.top/v1/order/counterpartiesById" ``` **Request parameters:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- id|y|bigint |order id | | **Response data:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|Status code|| msg|n|string|message|| time|y|long|Current millisseconds|| data|y|object|Order detail|| **data:** ```json { "code":200, "data":{ "entrusts":[ { "amount":1.2042000000, "count":2.2300000000, "createTime":"2019-05-27 18:15:12", "entrustId":431879850, "entrustType":0, "id":101192723, "isSelfTrade":1, "matchId":431879852, "prize":0.5400000000, "sysmbol":"btc_gavc" } ] }, "msg":"success", "time":1568690580787 } ``` Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- entrusts|y|array(object)|BBO list|| **wallet:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- id|y|bigint|Primary key ID|| isSelfTrade|y|int|Self-trade Option 0 n 1 y|| sysmbol|y|string|Trading pairs|| entrustType|y|int|orderData Type 0 Buy 1 Sell|| entrustId|y|bigint|order id|| matchId|y|bigint|Transaction ID|| amount|y|number|Total Transaction|| prize|y|number|Price|| count|y|number|Amount|| createTime|y|string|Create time||   ### Obtain order list - GET /v1/order/entrust ```json https://hkapi.hotcoin.top/v1/order/entrust curl "https://hkapi.hotcoin.top/v1/order/entrust" ``` **Request parameters:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- symbol|y|string |Trading pairs| |example:btc_usdt type|n|int|Data Type|0|0 is all 1 iscurrent 2 is history page|n|int|page|1| count|y|int|items|7|[1-100] max 100 items **Response data:** ```json { "code": 200, "msg": "Obtain success!", "time": 1527841588334, "data":{ "entrutsHis": [ { "types": "Buy", "leftcount": 1.0E-4, "fees": 0, "last": 0, "count": 1.0E-4, "successamount": 0, "source": "WEB", "type": 1, "price": 1.0E7, "buysymbol": "GAVC", "id": 947644, "time": "2018-06-27 17:45:14", "sellsymbol": "BTC", "status": "Cancelled" }, { "types": "Buy", "leftcount": 1.0E-4, "fees": 0, "last": 0, "count": 1.0E-4, "successamount": 0, "source": "WEB", "type": 1, "price": 1.0E7, "buysymbol": "GAVC", "id": 947645, "time": "2018-06-27 17:45:14", "sellsymbol": "BTC", "status": "Cancelled" } ], "entrutsCur": [ { "types": "Buy", "leftcount": 0.01, "fees": 0, "last": 0, "count": 0.01, "successamount": 0, "source": "API", "type": 0, "price": 40000, "buysymbol": "GAVC", "id": 18194814, "time": "2018-09-07 15:48:44", "sellsymbol": "BTC", "status": "Unfill" }, { "types": "Sell", "leftcount": 0.01, "fees": 0, "last": 0, "count": 0.01, "successamount": 0, "source": "API", "type": 0, "price": 40000, "buysymbol": "GAVC", "id": 18194814, "time": "2018-09-07 15:48:44", "sellsymbol": "BTC", "status": "Unfill" } ] } } ``` Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|Status code|| msg|n|string|Return message|| time|y|long|Current millisseconds|| data|y|object|Order details|| **data:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- entrutsCur|n|array(object)|Current order|| entrutsHis|n|array(object)|History order|| **entrutsCur 及 entrutsHis Data Type is the same:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- id|y|bigint|Order id time|y|string|Order time types|y|string|Order Type|| Buy、Sell source|y|string|Order source||"WEB","APP","API" price|y|number|Order price count|y|number|Order amount leftcount|y|number|Unfill amount last|y|number|Transaction price successamount|y|number|Total Transaction fees|y|number|fee status|y|string|Order Status||Unfill,Partial filled,Filled,Revoking,Cancelled type|y|int|Order Data Type|| 0( "Buy"),1( "Sell") buysymbol|y|string|Currency Data Type symbol sellsymbol|y|string|Currency Data Type symbol   ### Current&History Transaction Record - GET /v1/order/matchresults ```json https://hkapi.hotcoin.top/v1/order/matchresults curl "https://hkapi.hotcoin.top/v1/order/matchresults" ``` **Request parameters:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- symbol|y|string|Trading pairs||example:btc_usdt types|n|string|query order Data Type compositio,separate by','||0:buy, 1:sell startDate|n|string|Inquire start date, date form yyyy-mm-dd|-1d Inquire the day before end data|Value Range [((endDate) – 1), (endDate)] ,Max inquery date is 2 days in query window, inquery ranges of nearly 61 days endDate|n|string|Inqery end date, date form yyyy-mm-dd|today|Value Range [(today-60), today] ,Max inquery date is 2 days in query window, inquery ranges of nearly 61 days from|n|string|Inquire start&end ID|order history record ID(max)| direct|n|string|Direction|default next, transaction record ID orders from big to small|prev forward,time(or ID)positive sequence;next backward,time(or ID)reverse) size|n|string| query record scope|100|[1,100] **Response data:** ```json { "code":200, "data":{ "entrustdetail":[ { "createdAt":1623134000577, "filledAmount":"1.20", "filledFees":"2.2300", "id":43187, "matchId":123456, "orderId":431879852, "type":"1", "price":"0.5400000000", "role":"taker" } ] }, "msg":"success", "time":1568690580787 } ``` Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|Status code msg|n|string|return message time|y|long|Current millisseconds data|y|object|Real-time transactions **data:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- entrustdetail|n|array(object)|Transaction Record **entrustdetail:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- createdAt|y|long|Transaction time filledAmount|y|string|Transaction amount filledFees|y|string|Transaction fee id|y|long|Transaction record id matchId|y|long|Matchmaking id orderId|y|long|Order id price|y|string|Transaction price type|y|string|Order Data Type||0:buy, 1:sell role|y|string|Transaction role||taker,maker   ### Batch Cancels - POST /v1/order/batchCancelOrders `Note: The API only for submit cancel request,actual result need to confirm by order Status,matchmaking Status.` **Request parameters:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- orderIds|y|String|Revoke order ID list||Shall not exceeds 100 order ID each time Example"2232,1232,2321" **Response data:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|Status code msg|n|string|Return message data|y|object|   ### Batch Cancels(OpenOrders) - POST /v1/order/batchCancelOpenOrders `Note: The API only for submit cancel request,actual result need to confirm by order Status,matchmaking Status.` **Request parameters:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- symbol|y|String|Transaction code list( Max 10 symbols,separate by commas between various trade codes),btc_usdt, eth_btc...|| side|n|String|Direction||when buy -buy direction sell -sell direction is empty,obtain orders of all directions to revoke. **Response data:** ```json { "code":200, "data":{ "successCount": 1, "failCount": 1 }, "msg":"success" } ``` Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|Status code msg|n|string|Return message data|y|object| **data:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- {successCount|y|int|Success cancel amount failCount}|y|int|Cancelled failed amount   ### Batch Orders API Key Access:Trading,Maximum 10 orders for a single batch - POST /v1/order/batchOrders **Request parameters:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- orders|y|object|Order list|| **orders:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- [{symbol|y|string|Trading pairs||example:btc_usdt type|y|string|Data Type||"buy" ,”sell" tradeAmount|y|number|Amount|| tradePrice}]|y|number|Price|| **Response data:** ```json { "code": 200, "msg": "success", "time": 1527841588334, "data":{ "list": [ { "ID":123456, "errcode": "", "errmsg": "" }, { "ID":1234567, "errcode": "", "errmsg": "" } ] } } ``` Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|Status code msg|n|string|Return message data|y|object| **data:** Parameter|Mandatory|Data Type|Description|Default|Value Range ------------- | ------------- | ------------- | ------------- | ------------- | ------------- [{ID|y|bigint|Order id|| errcode|n|string|return error code errmsg}]|n|string|Return error Description
              • 更新日志 # 更新日志   生效时间(UTC +8)|接口|变化|摘要| ------------- | ------------- | ------------- | ------------- | 2018.6.10|- |初始化|初始化当前版本接口
                • 简介 # 简介 欢迎使用热币 API! 此文档是热币API的唯一官方文档,热币API提供的功能和服务会在此文档持续更新,并会发布公告进行通知,建议您关注和订阅我们的公告,及时获取相关信息。 以下是现货API文档各章节主要内容: ### 接入准备 如需使用API ,请先登录网页端,完成API key的申请和权限配置,再据此文档详情进行开发和交易。 权限说明如下: * **读取权限**:读取权限用于对数据的查询接口,例如:订单查询、成交查询等。 * **交易权限**:交易权限用于下单、撤单、划转类接口。 * **提币权限**:提币权限用于创建提币订单、取消提币订单操作。 ### 安全认证 AccessKey为API 访问密钥,SecretKey为用户对请求进行签名的密钥。 重要提示:这两个密钥与账号安全紧密相关,无论何时都请勿向其它人透露 示例 [Java](https://github.com/hotcoinex/openapi/blob/master/ApiDemo.java) | [Python3](https://github.com/hotcoinex/openapi/blob/master/ApiDemo.py) | [Php](https://github.com/hotcoinex/openapi/blob/master/Demo.php) ### 合法请求结构 基于安全考虑,除行情API 外的 API 请求都必须进行签名运算。一个合法的请求由以下几部分组成: - 方法请求地址,即访问服务器地址:api.hotcoinfin.com后面跟上方法名,比如api.hotcoinfin.com/v1/order/place。 - API 访问密钥(AccessKeyId) 您申请的 APIKEY 中的AccessKey。 - 签名方法(SignatureMethod) 用户计算签名的基于哈希的协议,此处使用 HmacSHA256。 - 签名版本(SignatureVersion) 签名协议的版本,此处使用2。 - 时间戳(Timestamp) 您发出请求的时间 (UTC 时区)。在查询请求中包含此值有助于防止第三方截取您的请求。如:2017-05-11T16:22:06.123Z。再次强调是 (UTC 时区) 调用的必需参数和可选参数。可以在每个方法的说明中查看这些参数及其含义。 - 签名计算得出的值,用于确保签名有效和未被篡改。 > https://api.hotcoinfin.com/v1/order/place? AccessKeyId=AccessKeyHotcoin123456789 &symbol=btc_gavc &type=buy &tradePrice=40000 &tradeAmount=0.1 &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2017-05-11T16:22:06.123Z &Signature=calculated value ### 签名运算 API 请求在通过 Internet 发送的过程中极有可能被篡改。为了确保请求未被更改,我们会要求用户在每个请求中带上签名,来校验参数或参数值在传输途中是否发生了更改。 计算签名所需的步骤: 规范要计算签名的请求 因为使用 HMAC 进行签名计算时,使用不同内容计算得到的结果会完全不同。所以在进行签名计算前,请先对请求进行规范化处理。下面以下单请求为例进行说明 >https://api.hotcoinfin.com/v1/order/place? AccessKeyId=AccessKeyHotcoin123456789 &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2017-05-11T16:22:06.123Z &symbol=btc_gavc &type=buy &tradePrice=40000 &tradeAmount=0.1 请求方法(GET 或 POST),后面添加换行符\n。 GET\n 添加小写的访问地址,后面添加换行符\n。 api.hotcoinfin.com\n 访问方法的路径,后面添加换行符\n。 /v1/order/place\n 按照ASCII码的顺序对参数名进行排序(使用 UTF-8 编码,且进行了 URI 编码,十六进制字符必须大写,如‘:’会被编码为'%3A',空格被编码为'%20')。 例如,下面是请求参数的原始顺序,进行过编码后。 >AccessKeyId=AccessKeyHotcoin123456789 &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2017-05-11T16:22:06.123Z &symbol=btc_gavc &type=buy &tradePrice=40000 &tradeAmount=0.1 这些参数会被排序为: >AccessKeyId=AccessKeyHotcoin123456789 SignatureMethod=HmacSHA256 SignatureVersion=2 Timestamp=2017-05-11T16%3A22%3A06.123Z& symbol=btc_gavc tradeAmount=0.01 tradePrice=40000 type=buy 按照以上顺序,将各参数使用字符’&’连接。 >AccessKeyId=AccessKeyHotcoin123456789 &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2017-05-11T16%3A22%3A06.123Z &symbol=btc_gavc &tradeAmount=0.1 &tradePrice=40000 &type=buy 组成最终的要进行签名计算的字符串如下: >GET\n api.hotcoinfin.com\n /v1/order/place\n AccessKeyId=AccessKeyHotcoin123456789 &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2017-05-11T16%3A22%3A06.123Z &symbol=btc_gavc &tradeAmount=0.1 &tradePrice=40000 &type=buy 计算签名,将以下两个参数传入加密哈希函数: 要进行签名计算的字符串 >GET\n api.hotcoinfin.com\n /v1/order/place\n AccessKeyId=AccessKeyHotcoin123456789 &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2017-05-11T16%3A22%3A06.123Z &symbol=btc_gavc &tradeAmount=0.1 &tradePrice=40000 &type=buy 进行签名的密钥(SecretKey) SecretKeyHotcoin123456789 得到签名计算结果并进行 Base64编码 2oEC+yhkHTsNkgPUq4ZB/5mlY7EZAtUDWOQ5EO01D+I= 将上述值作为参数Signature的取值添加到 API 请求中。 将此参数添加到请求时,必须将该值进行 URI 编码。 symbol 规则: 基础币种+计价币种。如BTC/USDT,symbol为btc_usdt;ETH/BTC, symbol为eth_btc。以此类推。 最终,发送到服务器的 API 请求应该为: >https://api.hotcoinfin.com/v1/order/place ?AccessKeyId=AccessKeyHotcoin123456789 &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2017-05-11T16%3A22%3A06.123Z &symbol=btc_gavc &tradeAmount=0.1 &tradePrice=40000&type=buy &Signature=2oEC%2ByhkHTsNkgPUq4ZB%2F5mlY7EZAtUDWOQ5EO01D%2BI%3D
                  • 基础信息

                    基础信息

                    获取所有交易对

                    https://hkapi.hotcoin.top/v1/common/symbols
                    
                    curl "https://hkapi.hotcoin.top/v1/common/symbols"
                    
                    • GET /v1/common/symbols

                    请求参数:

                    响应数据:

                    参数名称 是否必须 类型 描述 默认值 取值范围
                    code y int 状态码   成功:200
                    msg y string 消息    
                    time y long 当前毫秒数    
                    data y array symbols列表    

                    data:

                    {
                       "code": "200",
                       "time": 1567045034,
                       "data": [
                       {"baseCurrency":"etc",
                        "quoteCurrency":"usdt",
                        "pricePrecision":6,
                        "amountPrecision":4,
                        "symbolPartition":"main",
                        "symbol":"etc_usdt",
                        "state":"online",
                        "minOrderCount":0.001,
                        "maxOrderCount":10000,
                        "minOrderPrice":0.0001,
                        "maxOrderPrice":10000
                        },
                        {
                        "baseCurrency":"ltc",
                        "quoteCurrency":"usdt",
                        "pricePrecision":6,
                        "amountPrecision":4,
                        "symbolPartition":"innovation",
                        "symbol":"ltc_usdt",
                        "state":"online",
                        "minOrderCount":0.001,
                        "maxOrderCount":10000,
                        "minOrderPrice":0.0001,
                        "maxOrderPrice":10000
                        }
                      ]
                    }
                    
                    字段类型 数据类型 描述 description(英文)
                    baseCurrency string 交易中的基础币种 baseCurrency code
                    quoteCurrency string 交易中的报价币种 quoteCurrency code
                    pricePrecision integer 交易对报价的精度(小数点后位数) price precision
                    amountPrecision integer 交易对基础币种计数精度(小数点) quantity precision
                    symbolPartition string 交易区,可能值: [main,innovation] symbol Partition, example:[main,innovation]
                    symbol string 交易对 trade pair code
                    state string 交易对状态 enable - 正常;disable-禁用 trade pair status [enable,disable]
                    minOrderCount decimal 交易对最小下单量 (下单量指当订单类型为限价单时,下单接口传的’tradeAmount’) min order count
                    maxOrderCount decimal 交易对最大下单量 (下单量指当订单类型为限价单时,下单接口传的’tradeAmount’) max order count
                    minOrderPrice decimal 最小下单价格(下单金额指当订单类型为限价单时,下单接口传入的‘price’) min order price
                    maxOrderPrice decimal 最大下单价格(下单金额指当订单类型为限价单时,下单接口传入的‘price’) max order price
                    • 行情数据 # 行情数据   ### 实时ticker数据 - GET /v1/market/ticker ```json https://hkapi.hotcoin.top/v1/market/ticker curl "https://hkapi.hotcoin.top/v1/market/ticker" ``` **请求参数:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- status|y|string|状态码||成功:ok,失败:error timestamp|y|long|当前毫秒数|| ticker|y|list|数据|| **响应数据:** ```json { "status":"ok", "timestamp":1567045034, "ticker":[ { "symbol":"btc_usdt", "last":"10000.00000000", "buy":"9999.00000000", "sell":"10001.00000000", "high":"11000.00000000", "low":"9000.00000000", "vol":"10000000.0000", "change":"10.10" } ] } ``` 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- symbol|y|string|交易对symbol||卖币种简称_买币种简称简称,eg:btc_usdt last|y|number|最新价|| buy|y|number|买一价|| sell|y|number|卖一价|| high|y|number|24小时最高价 || low|y|number|24小时最低价|| vol|y|number|24小时成交量|| change|y|number|24小时涨跌幅||   ### 获取k线数据 - GET /v1/ticker ```json https://hkapi.hotcoin.top/v1/ticker?symbol=btc_usdt&step=60 curl "https://hkapi.hotcoin.top/v1/ticker?symbol=btc_usdt&step=60" ``` **请求参数:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- step|y|int|时间:秒||60(1分钟),300(5分钟),900(15分钟),1800(30分钟),3600(1小时),86400(1天),604800(1周),2592000(1月) symbol|y|string|交易对||例:btc_gavc **响应数据:** ```json { "code":200, "msg":"成功", "time":1527838104874, "data":[ [ 1527820200000, 54598.5, 54598.5, 54598.5, 54598.5, 0 ], [ 1527820200000, 54598.5, 54598.5, 54598.5, 54598.5, 0 ] ] } ``` 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|状态码 msg|n|string|返回消息 time|y|long|当前毫秒数 data|y|array(array(number))|K线数据 **data:**
                      [[
                      1527820200000, //int 时间
                      54598.5, //number 开
                      54598.5, //number 高
                      54598.5, //number 低
                      54598.5, //number 收
                      0.0000 //number 量
                      ],
                      ......
                      ]
                        ### 获取深度数据 - GET /v1/depth ```json https://hkapi.hotcoin.top/v1/depth?symbol=btc_usdt&step=60 curl "https://hkapi.hotcoin.top/v1/depth?symbol=btc_usdt&step=60" ``` **请求参数:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- symbol|y|string|交易对||例:btc_gavc step|n|int|加上此参数可查最新一个k线数据,类型为时间,单位秒||60,3*60,5*60,15*60,30*60,60*60(1小时),24*60*60(1天),7*24*60*60(1周),30*24*60*60(1月) **响应数据:** ```json { "code":200, "msg":"成功", "time":1527837164605, "data":{ "period":{ "data":[ [ 1527837120000, 54598.5, 54598.5, 54598.5, 54598.5, 0 ] ], "marketFrom":"btc_gavc", "type":60, "coinVol":"btc_gavc" }, "depth":{ "date":1527837163, "asks":[ [ 57373.8, 0.0387 ], [ 57751.26, 0.0128 ], [ 57751.26, 0.0128 ] ], "bids":[ [ 57373.8, 0.0387 ], [ 57751.26, 0.0128 ], [ 57751.26, 0.0128 ] ], "lastPrice":54598.5 } } } ``` 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|状态码 msg|n|string|返回消息 time|y|long|当前毫秒数 data|y|object|交易深度数据 **data:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- depth|y|object period|n|object|传step时才有值 **depth:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- bids|y|array(array(long))|买盘,[price(成交价), amount(成交量)] asks|y|array(array(long))|卖盘,[price(成交价), amount(成交量)] date|y|long|时间戳 lastPrice|y|number|最新成交价 **period:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- marketFrom|y|string|入参symbol coinVol|y|string|入参symbol type|y|long|入参step,时间 data|y|array(array)|最后一个k线数据,格式同上,但只有一个   ### 获取实时成交数据 - GET /v1/trade ```json https://hkapi.hotcoin.top/v1/trade?symbol=btc_usdt&count=60 curl "https://hkapi.hotcoin.top/v1/trade?symbol=btc_usdt&count=60" ``` **请求参数:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- count|y|int|Trades条数||0 symbol|y|string|交易对||例:btc_gavc **响应数据:** ```json { "code":200, "msg":"成功", "time":1536315868962, "data":{ "sellSymbol":"BTC", "buySymbol":"GAVC", "trades":[ { "price":0.007, "amount":66491.04, "id":1, "time":"02:45:08", "en_type":"ask", "type":"卖出" }, { "price":0.007, "amount":66491.04, "id":1, "time":"02:45:08", "en_type":"ask", "type":"卖出" } ] } } ``` 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|状态码 msg|n|string|返回消息 time|y|long|当前毫秒数 data|y|object|实时成交数据 **data:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- trades|y|array(object)|trades数据 sellSymbol|y|string|sellSymbol buySymbol|y|string|buySymbol **trades:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- price|y|long|成交价钱 amount|y|string|成交数量 id|y|string|成交id time|y|string|成交时间 en_type|y|string|成交方向||"bid"(买入),"ask"(卖出) type|y|string|成交类型||"买入","卖出"
                      • 账户相关

                        账户相关

                         

                        获取用户余额

                        • GET /v1/balance
                        https://hkapi.hotcoin.top/v1/balance?AccessKeyId=""
                        
                        curl "https://hkapi.hotcoin.top/v1/balance?AccessKeyId=''"
                        

                        请求参数:

                        参数名称 是否必须 类型 描述 默认值 取值范围
                        AccessKeyId y string 访问key    

                        响应数据:

                        {
                           "code": 200,
                           "msg": "成功",
                           "time": 1527835756743,
                           "data":    {
                              "netassets": 0,
                              "wallet": [
                                 {
                        			"uid":1100011,
                        			"coinId":1,
                        			"symbol":"BTC",
                        			"total":1000.0000000000,
                        			"frozen":1000.0000000000,
                        			"coinName":"比特币",
                        			"shortName":"BTC"
                        		},
                        		{
                        			"uid":1100011,
                        			"coinId":2,
                        			"symbol":"LTC",
                        			"total":1000.0000000000,
                        			"frozen":1000.0000000000,
                        			"coinName":"莱特币",
                        			"shortName":"LTC"
                        		},
                        		{
                        			"uid":1100011,
                        			"coinId":4,
                        			"symbol":"ETH",
                        			"total":1000.0000000000,
                        			"frozen":0E-10,
                        			"coinName":"以太坊",
                        			"shortName":"ETH"
                        		}
                              ],
                              "totalassets": 0
                           }
                        }
                        
                        
                        参数名称 是否必须 类型 描述 默认值 取值范围
                        code y int 状态码    
                        msg n string 返回消息    
                        time y long 当前毫秒数    
                        data y object 交易深度数据    

                        data:

                        参数名称 是否必须 类型 描述 默认值 取值范围
                        netassets y number 净资产,单位为gavc    
                        totalassets y number 总资产,单位为gavc    
                        wallet y array(object) 钱包列表    

                        wallet:

                        参数名称 是否必须 类型 描述 默认值 取值范围
                        coinName y long 币种名称    
                        uid y int 用户ID    
                        coinId y int 币种ID    
                        total y number 可用    
                        frozen y number 冻结    
                        symbol y string 币种symbol    
                        shortName y string 币种简称    
                        • 现货/杠杆交易 # 现货/杠杆交易 ### 下单 - POST /v1/order/place **请求参数:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- symbol|y|string|交易对| |例:btc_usdt type|y|string|类型| | "buy" ,”sell" tradeAmount|y|number|数量|| tradePrice|y|number |价钱|| **响应数据:** ```json { "code":200, "msg":"委托成功", "time":1536306331399, "data":{ "ID":18194813 } } ``` 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|状态码||成功:200,失败:300 msg|y|string|消息|| time|y|long|当前毫秒数|| data|y|object|数据|| **msg 范围** 中文 | English | ------------ | ------------ 非法请求 |Illegal request 请使用正确的数量| Illegal tradeAmount value 请使用正确的价格| Illegal tradePrice value 币种ID错误| Illegal symbol format **data:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- ID|y|bigint|订单id||   ### 订单取消 注:撤销订单请求为异步报单模式,需要调用/v1/order/detailById接口查询订单状态进行确认。 - POST /v1/order/cancel **请求参数:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- id|y|bigint |委单id | | **响应数据:** ```json { "code": 200, "msg": "取消成功", "time": 1536306495984, "data": null } ``` 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|状态码||成功:200,失败:300 msg|y|string|消息|| time|y|long|当前毫秒数||   ### 委单详情 - GET /v1/order/detailById ```json https://hkapi.hotcoin.top/v1/order/detailById curl "https://hkapi.hotcoin.top/v1/order/detailById" ``` **请求参数:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- id|y|bigint |委单id | | leverAcctid |n|string |非杠杆下单无需传词字段,杠杆子账户id,对应开户接口的clientId| | **响应数据:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|状态码|| msg|n|string|消息|| time|y|long|当前毫秒数|| data|y|object|委单详情|| **data:** ```json { "code": 200, "msg": "成功", "time": 1536306896294, "data": { "types": "买单", "leftcount": 0.01, "fees": 0, "last": 0, "count": 0.01, "successamount": 0, "source": "API", "type": 0, "price": 40000, "buysymbol": "", "id": 18194814, "time": "2018-09-07 15:48:44", "sellsymbol": "", "statusCode":1, "status": "未成交" } } ``` 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- types|y|string|委单类型| |买单 、卖单 leftcount|y|number|未成交|| fees|y|number|手续费|| last|y|number|当前委单最新成交价|| count|y|number|数量|| successamount|y|number|已成交总价 || source|y|string|来源 | |API、WEB、APP type|y|int|类型代码| |0(买单),1(卖单) price|y|number|价钱 || buysymbol|n|string|买符号|| sellsymbol|n|string|卖符号|| time|y|string|创建时间|| statusCode|y|int|状态码| |1 未成交 2 部分成交 3 完全成交 4 撤单处理中 5 已撤销 status|y|int|状态| |未成交、部分成交、完全成交、撤单处理中、已撤销   ### 成交详情 - GET /v1/order/counterpartiesById ```json https://hkapi.hotcoin.top/v1/order/counterpartiesById curl "https://hkapi.hotcoin.top/v1/order/counterpartiesById" ``` **请求参数:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- id|y|bigint |委单id | | **响应数据:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|状态码|| msg|n|string|消息|| time|y|long|当前毫秒数|| data|y|object|委单详情|| **data:** ```json { "code":200, "data":{ "entrusts":[ { "amount":1.2042000000, "count":2.2300000000, "createTime":"2019-05-27 18:15:12", "entrustId":431879850, "entrustType":0, "id":101192723, "isSelfTrade":1, "matchId":431879852, "prize":0.5400000000, "sysmbol":"btc_gavc" } ] }, "msg":"成功", "time":1568690580787 } ``` 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- entrusts|y|array(object)|对手单列表|| **wallet:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- id|y|bigint|主键ID|| isSelfTrade|y|int|是否自成交 0 否 1 是|| sysmbol|y|string|交易对|| entrustType|y|int|委单类型 0 买单 1 卖单|| entrustId|y|bigint|委单ID|| matchId|y|bigint|成交ID|| amount|y|number|成交总价|| prize|y|number|价格|| count|y|number|数量|| createTime|y|string|创建时间||   ### 获取委单列表 - GET /v1/order/entrust ```json https://hkapi.hotcoin.top/v1/order/entrust curl "https://hkapi.hotcoin.top/v1/order/entrust" ``` **请求参数:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- symbol|y|string |交易对| |例:btc_usdt type|n|int|类型|0|0表示全部 1表示当前 2表示历史 page|n|int|页码|1| count|y|int|条数|7|[1-100] 最大100条 **响应数据:** ```json { "code": 200, "msg": "获取成功!", "time": 1527841588334, "data":{ "entrutsHis": [ { "types": "买单", "leftcount": 1.0E-4, "fees": 0, "last": 0, "count": 1.0E-4, "successamount": 0, "source": "WEB", "type": 1, "price": 1.0E7, "buysymbol": "GAVC", "id": 947644, "time": "2018-06-27 17:45:14", "sellsymbol": "BTC", "status": "已撤销" }, { "types": "买单", "leftcount": 1.0E-4, "fees": 0, "last": 0, "count": 1.0E-4, "successamount": 0, "source": "WEB", "type": 1, "price": 1.0E7, "buysymbol": "GAVC", "id": 947645, "time": "2018-06-27 17:45:14", "sellsymbol": "BTC", "status": "已撤销" } ], "entrutsCur": [ { "types": "买单", "leftcount": 0.01, "fees": 0, "last": 0, "count": 0.01, "successamount": 0, "source": "API", "type": 0, "price": 40000, "buysymbol": "GAVC", "id": 18194814, "time": "2018-09-07 15:48:44", "sellsymbol": "BTC", "status": "未成交" }, { "types": "卖单", "leftcount": 0.01, "fees": 0, "last": 0, "count": 0.01, "successamount": 0, "source": "API", "type": 0, "price": 40000, "buysymbol": "GAVC", "id": 18194814, "time": "2018-09-07 15:48:44", "sellsymbol": "BTC", "status": "未成交" } ] } } ``` 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|状态码|| msg|n|string|消息|| time|y|long|当前毫秒数|| data|y|object|委单详情|| **data:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- entrutsCur|n|array(object)|当前委单|| entrutsHis|n|array(object)|历史委单|| **entrutsCur 及 entrutsHis类型相同:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- id|y|bigint|委单id time|y|string|下单时间 types|y|string|委单类型|| 买单、卖单 source|y|string|委单来源||"WEB","APP","API" price|y|number|下单价格 count|y|number|下单数量 leftcount|y|number|未成交数量 last|y|number|成交价格 successamount|y|number|成交总价 fees|y|number|手续费 status|y|string|委单状态||未成交、部分成交、完全成交、撤单处理中、已撤销 type|y|int|委单类型|| 0( "买单"),1( "卖单") buysymbol|y|string|币种类型符号 sellsymbol|y|string|币种类型符号   ### 当前和历史成交记录 - GET /v1/order/matchresults ```json https://hkapi.hotcoin.top/v1/order/matchresults curl "https://hkapi.hotcoin.top/v1/order/matchresults" ``` **请求参数:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- symbol|y|string|交易对||例:btc_usdt types|n|string|查询的订单类型组合,使用','分割||0:买, 1:卖 startDate|n|string|查询开始日期, 日期格式yyyy-mm-dd|-1d 查询结束日期的前1天|取值范围 [((endDate) – 1), (endDate)] ,查询窗口最大为2天,窗口平移范围为最近61天 endDate|n|string|查询结束日期, 日期格式yyyy-mm-dd|today|取值范围 [(today-60), today] ,查询窗口最大为2天,窗口平移范围为最近61天 from|n|string|查询起始 ID|订单成交记录ID(最大值)| direct|n|string|查询方向|默认 next, 成交记录 ID 由大到小排序|prev 向前,时间(或 ID)正序;next 向后,时间(或 ID)倒序) size|n|string| 查询记录大小|100|[1,100] **响应数据:** ```json { "code":200, "data":{ "entrustdetail":[ { "createdAt":1623134000577, "filledAmount":"1.20", "filledFees":"2.2300", "id":43187, "matchId":123456, "orderId":431879852, "type":"1", "price":"0.5400000000", "role":"taker" } ] }, "msg":"成功", "time":1568690580787 } ``` 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|状态码 msg|n|string|返回消息 time|y|long|当前毫秒数 data|y|object|实时成交数据 **data:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- entrustdetail|n|array(object)|成交记录 **entrustdetail:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- createdAt|y|long|成交时间 filledAmount|y|string|成交数量 filledFees|y|string|成交手续费 id|y|long|订单成交记录id matchId|y|long|撮合id orderId|y|long|订单id price|y|string|成交价格 type|y|string|订单类型||0:买, 1:卖 role|y|string|成交角色||taker,maker   ### 批量撤单 - POST /v1/order/batchCancelOrders `注意:此接口只提交取消请求,实际取消结果需要通过订单状态,撮合状态等接口来确认。` **请求参数:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- orderIds|y|String|撤销订单ID列表||单次不超过100个订单id 例如 "2232,1232,2321" **响应数据:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|状态码 msg|n|string|返回消息 data|y|object|   ### 批量撤单(OpenOrders) - POST /v1/order/batchCancelOpenOrders `注意:此接口只提交取消请求,实际取消结果需要通过订单状态,撮合状态等接口来确认。` **请求参数:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- symbol|y|String|交易代码列表(最多10 个symbols,多个交易代码间以逗号分隔),btc_usdt, eth_btc...(|| side|n|String|交易方向||buy -买方向 sell -卖方向 为空时,则获取所有方向的委单进行撤销。 **响应数据:** ```json { "code":200, "data":{ "successCount": 1, "failCount": 1 }, "msg":"成功" } ``` 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|状态码 msg|n|string|返回消息 data|y|object| **data:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- {successCount|y|int|成功撤销数量 failCount}|y|int|撤销失败数量   ### 批量下单 API Key 权限:交易 ,一个批量最多10张订单 - POST /v1/order/batchOrders **请求参数:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- orders|y|object|订单列表|| **orders:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- [{symbol|y|string|交易对||例:btc_usdt type|y|string|类型||"buy" ,”sell" tradeAmount|y|number|数量|| tradePrice}]|y|number|价钱|| **响应数据:** ```json { "code": 200, "msg": "成功", "time": 1527841588334, "data":{ "list": [ { "ID":123456, "errcode": "", "errmsg": "" }, { "ID":1234567, "errcode": "", "errmsg": "" } ] } } ``` 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- code|y|int|状态码 msg|n|string|返回消息 data|y|object| **data:** 参数名称|是否必须|类型|描述|默认值|取值范围 ------------- | ------------- | ------------- | ------------- | ------------- | ------------- [{ID|y|bigint|订单id|| errcode|n|string|返回错误码 errmsg}]|n|string|返回错误描述
                          json