# README
GoCryptoTrader package Huobi

This huobi package is part of the GoCryptoTrader codebase.
This is still in active development
You can track ideas, planned features and what's in progress on our GoCryptoTrader Kanban board.
Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack
Huobi Exchange
Current Features
- REST Support
- Websocket Support
How to enable
-
Individual package example below:
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
How to do REST public/private calls
- If enabled via "configuration".json file the exchange will be added to the
IBotExchange array in the
go var bot Bot
and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:
main.go
var h exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "Huobi" {
h = bot.Exchanges[i]
}
}
// Public calls - wrapper functions
// Fetches current ticker information
tick, err := h.UpdateTicker(...)
if err != nil {
// Handle error
}
// Fetches current orderbook information
ob, err := h.UpdateOrderbook(...)
if err != nil {
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := h.GetAccountInfo()
if err != nil {
// Handle error
}
- If enabled via individually importing package, rudimentary example below:
// Public calls
// Fetches current ticker information
ticker, err := h.GetTicker()
if err != nil {
// Handle error
}
// Fetches current orderbook information
ob, err := h.GetOrderBook()
if err != nil {
// Handle error
}
// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true
// GetUserInfo returns account info
accountInfo, err := h.GetUserInfo(...)
if err != nil {
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := h.Trade(...)
if err != nil {
// Handle error
}
Subscriptions
All subscriptions are for spot only.
Default Public Subscriptions:
- Ticker
- Candles ( Interval: 1min )
- Orderbook ( Level: 0 - No aggregation )
- Configure Level: 1-5 for depth aggregation, for example:
{"enabled": true, "channel": "orderbook", "asset": "spot", "levels": 1}
- Trades
Default Authenticated Subscriptions:
- Account Trades
- Account Orders
- Account Updates
Please click GoDocs chevron above to view current GoDoc information for this package
Contribution
Please feel free to submit any pull requests or suggest any desired features to be added.
When submitting a PR, please abide by our coding guidelines:
- Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
- Code must be documented adhering to the official Go commentary guidelines.
- Code must adhere to our coding style.
- Pull requests need to be based on and opened against the
master
branch.
Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:
bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc
# Functions
GetRateLimit returns the rate limit for the exchange.
# Variables
vars for OrderBookDataRequestParamsTypes.
vars for OrderBookDataRequestParamsTypes.
vars for OrderBookDataRequestParamsTypes.
vars for OrderBookDataRequestParamsTypes.
vars for OrderBookDataRequestParamsTypes.
vars for OrderBookDataRequestParamsTypes.
vars for OrderBookDataRequestParamsTypes.
SpotNewOrderRequestTypeBuyLimit buy limit order.
SpotNewOrderRequestTypeBuyMarket buy market order.
SpotNewOrderRequestTypeSellLimit sell limit order.
SpotNewOrderRequestTypeSellMarket sell market order.
# Structs
Account stores the account data.
AccountBalance stores the user all account balance.
AccountBalanceDetail stores the user account balance.
AccountTradeHistoryData stores account trade history for swaps.
AggregatedBalance stores balances of all the sub-account.
AvailableLeverageData stores data of available leverage for account.
BasisData stores basis data for swaps.
BatchOrderData stores data for batch orders.
BatchOrderRequestType stores batch order request data.
BatchTradesData stores batch trades for a given swap contract.
CancelOpenOrdersBatch stores open order batch response data.
CancelOrderBatch stores the cancel order batch data.
CancelOrdersData stores order cancellation data.
CancelTriggerOrdersData stores trigger order cancel data.
ChainQuota stores the users currency chain quota.
CoinMarginedFuturesTrade holds coinmarginedfutures trade data.
CurrenciesChainData stores currency and chain info.
DepositAddress stores the users deposit address info.
Detail stores the ticker detail data.
DetailMerged stores the ticker detail merged data.
EstimatedFundingRateData stores estimated funding rate data.
FAccountTransferData stores internal transfer data for futures.
FAssetsAndPositionsData stores assets and positions data for futures.
FAvailableLeverageData stores available leverage data for futures.
FBasisData stores basis data for futures.
FBatchOrderResponse stores batch order data.
FBatchTradesForContractData stores batch of trades data for a contract.
FCancelOrderData stores cancel order data.
FClawbackRateAndInsuranceData stores clawback rate and insurance data for futures.
FContractIndexPriceInfo stores contract index price.
FContractInfoData gets contract info data for futures.
FContractInfoOnOrderLimit stores contract info on futures order limit.
FContractOIData stores open interest data for futures contracts.
FContractPriceLimits gets limits for futures contracts.
FContractTradingFeeData stores contract trading fee data.
FEstimatedDeliveryPriceInfo stores estimated delivery price data for futures.
FFinancialRecords stores financial records data for futures.
FHistoricalInsuranceRecordsData stores historical records of insurance fund balances for futures.
FinancialRecordData stores an accounts financial records.
FIndexKlineData stores index kline data for futures.
FInfoSystemStatusData stores system status info for futures.
FKlineData stores kline data for futures.
FLastTradeData stores last trade's data for a contract.
FLiquidationOrdersInfo stores data of futures liquidation orders.
FMarketDepth gets orderbook data for futures.
FMarketOverviewData stores overview data for futures.
FOIData gets oi data on futures.
FOpenOrdersData stores open orders data for futures.
FOrderData stores order data for futures.
FOrderDetailsData stores order details for futures orders.
FOrderHistoryData stores order history data.
FOrderInfo stores order info.
FPositionLimitData stores information on futures positions limit.
FSettlementRecords stores user's futures settlement records.
FSingleSubAccountAssetsInfo stores futures assets info for a single subaccount.
FSingleSubAccountPositionsInfo stores futures positions' info for a single subaccount.
FSubAccountAssetsInfo gets subaccounts asset data.
FTieredAdjustmentFactorInfo stores info on adjustment factor for futures.
FTopAccountsLongShortRatio stores long/short ratio for top futures accounts.
FTopPositionsLongShortRatio stores long short ratio for top futures positions.
FTradeHistoryData stores trade history data for futures.
FTransferLimitData stores transfer limit data for futures.
FTransferRecords gets transfer records data.
FTriggerOpenOrders stores trigger open orders data.
FTriggerOrderData stores trigger order data.
FTriggerOrderHistoryData stores trigger order history for futures.
FundingRatesData stores funding rates data.
FUserAccountData stores user account data info for futures.
FUsersPositionsInfo stores positions data for futures.
FuturesBatchTicker holds ticker data.
FuturesTrade is futures trade data.
FWsReqBasisData stores requested basis data for futures websocket.
FWsReqKlineIndex stores requested kline index data for futures websocket.
FWsReqTradeDetail stores requested trade detail data for futures websocket.
FWsRequestKline stores requested kline data for futures websocket.
FWsSubBasisData stores subscribed basis data for futures websocket.
FWsSubContractInfo stores contract info data for futures websocket.
FWsSubEquityUpdates stores account equity updates data for futures websocket.
FWsSubKlineIndex stores subscribed kline index data for futures websocket.
FWsSubLiquidationOrders stores subscribed liquidation orders data for futures websocket.
FWsSubMatchOrderData stores subscribed match order data for futures websocket.
FWsSubOrderData stores subscribed order data for futures websocket.
FWsSubPositionUpdates stores subscribed position updates data for futures websocket.
FWsSubTriggerOrderUpdates stores subscribed trigger order updates data for futures websocket.
HistoricalFundingRateData stores historical funding rates for perpetuals.
HistoricalInsuranceFundBalance stores insurance fund balance data in the past.
HistoricalRateData stores historical rates data.
HUOBI is the overarching type across this package.
InsuranceAndClawbackData stores insurance fund's and clawback rate's data.
InternalAccountTransferData stores transfer data between subaccounts and main account.
InternalAccountTransferRecords stores data for transfer records within the account.
KlineItem stores a kline item.
KlinesRequestParams represents Klines request data.
LastTradeData stores last trade's data of a contract.
LightningCloseOrderData stores order data from a lightning close order.
LiquidationOrdersData stores data of liquidation orders.
MarginAccountBalance stores the margin account balance info.
MarginOrder stores the margin order info.
MarginRatesData stores margin rates data.
MarketOverviewData stores market overview data.
MarketSummary24Hr stores past 24hr market summary data of a given symbol.
OBData stores market depth data.
OpenInterestData stores open interest data.
Orderbook stores the orderbook data.
OrderBookDataRequestParams represents Klines request data.
OrderDetailData acquires order details.
OrderInfo stores the order info.
OrderMatchInfo stores the order match info.
OrderVars stores side, status and type for any order/trade.
PositionLimitData stores position limit data.
PremiumIndexKlineData stores kline data for premium.
Response stores the Huobi response information.
ResponseV2 stores the Huobi generic response info.
SingleSubAccountAssetsInfo stores asset info for a single subaccount.
SingleSubAccountPositionsInfo stores single subaccount's positions data.
SpotNewOrderRequestParams holds the params required to place an order.
SubAccountsAssetData stores asset data for all subaccounts.
SwapAccountInformation stores swap account information.
SwapAssetsAndPositionsData stores positions and assets data for swaps.
SwapFundingRatesResponse holds funding rates and data response.
SwapIndexPriceData gets price of a perpetual swap.
SwapKlineData stores kline data for perpetual swaps.
SwapMarketDepthData stores market depth data.
SwapMarketsData stores market data for swaps.
SwapOpenInterestData stores open interest data for swaps.
SwapOpenOrdersData stores open orders data for swaps.
SwapOrderData stores swap order data.
SwapOrderHistory gets order history for swaps.
SwapOrderInfo stores info for swap orders.
SwapOrderLimitInfo stores information about order limits on a perpetual swap.
SwapPositionInfo stores user's swap positions' info.
SwapPriceLimitsData gets price restrictions on perpetual swaps.
SwapTradingFeeData stores trading fee data for swaps.
SwapWsReqBasisData stores requested basis data for swap websocket.
SwapWsReqEstimatedFunding stores requested estimated funding data for swap websocket.
SwapWsReqPremiumKline stores requested premium kline data for futures websocket.
SwapWsSubBasisData stores subscribed basis data for swap websocket.
SwapWsSubContractInfo stores funding rate data for swap websocket.
SwapWsSubEquityData stores subscribed account data for swap account equity updates through websocket.
SwapWsSubEstimatedFunding stores estimated funding rate data for swap websocket.
SwapWsSubFundingData stores funding rate data for swap websocket.
SwapWsSubLiquidationOrders stores subscribed liquidation orders data for swap futures.
SwapWsSubMatchOrderData stores subscribed match order data for swap websocket.
SwapWsSubOrderData stores subscribed order data for swap websocket.
SwapWsSubPositionUpdates stores subscribed position updates data for swap websocket.
SwapWsSubPremiumKline stores subscribed premium kline data for futures websocket.
SwapWsSubTriggerOrderUpdates stores subscribed trigger order updates data for swap websocket.
Symbol stores the symbol data.
SystemStatusData stores information on system status.
Ticker latest ticker data.
Tickers contain all tickers.
TieredAdjustmentFactorData stores tiered adjustment factor data.
Trade stores the trade data.
TradeHistory stores the trade history data.
TraderSentimentIndexAccountData stores trader sentiment index data.
TraderSentimentIndexPositionData stores trader sentiment index data.
TransferLimitData stores transfer limits.
TransferMarginBetweenAccountsData stores margin transfer data between spot and swap accounts.
TriggerOpenOrdersData stores trigger open orders data.
TriggerOrderData stores trigger order data.
TriggerOrderHistory stores trigger order history data for swaps.
UContractOpenInterest stores open interest data for futures contracts.
WithdrawalData contains details of a withdrawal.
WithdrawalHistory holds withdrawal history data.
WithdrawQuota stores the users withdraw quotas.
WsAccountUpdate contains account updates to balances.
WsDepth defines market depth websocket response.
WsHeartBeat defines a heartbeat request.
WsIncrementalMarketDepth stores incremental market depth data for swap and futures websocket.
WsKline defines market kline websocket response.
WsKlineData stores kline data for futures and swap websocket.
WsMarketBBOData stores BBO data for futures and swap websocket.
WsMarketDepth stores market depth data for futures and swap websocket.
WsMarketDetail stores market detail data for futures and swap websocket.
WsOrderUpdate contains updates to orders.
WsSubTradeDetail stores trade detail data for futures websocket.
WsSwapReqKline stores req kline data for swap websocket.
WsSwapReqTradeDetail stores requested trade detail data for swap websocket.
WsTick stores websocket ticker data.
WsTrade defines market trade websocket response.
WsTradeUpdate contains trade updates to orders.
# Type aliases
OrderBookDataRequestParamsType var for request param types.
SpotNewOrderRequestParamsType order type.