Documentation ¶
Index ¶
- Variables
- type Account
- type AccountBalance
- type AccountBalanceDetail
- type AggregatedBalance
- type CancelOpenOrdersBatch
- type CancelOrderBatch
- type Chain
- type ChainQuota
- type Currency
- type DepositAddress
- type Detail
- type DetailMerged
- type HUOBI
- func (h *HUOBI) AuthenticateWebsocket() error
- func (h *HUOBI) CancelAllOrders(orderCancellation *order.Cancel) (order.CancelAllResponse, error)
- func (h *HUOBI) CancelExistingOrder(orderID int64) (int64, error)
- func (h *HUOBI) CancelOpenOrdersBatch(accountID, symbol string) (CancelOpenOrdersBatch, error)
- func (h *HUOBI) CancelOrder(order *order.Cancel) error
- func (h *HUOBI) CancelOrderBatch(_ []int64) ([]CancelOrderBatch, error)
- func (h *HUOBI) CancelWithdraw(withdrawID int64) (int64, error)
- func (h *HUOBI) FetchAccountInfo() (account.Holdings, error)
- func (h *HUOBI) FetchOrderbook(p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (h *HUOBI) FetchTicker(p currency.Pair, assetType asset.Item) (*ticker.Price, error)
- func (h *HUOBI) FetchTradablePairs(asset asset.Item) ([]string, error)
- func (h *HUOBI) GenerateDefaultSubscriptions()
- func (h *HUOBI) GetAccountBalance(accountID string) ([]AccountBalanceDetail, error)
- func (h *HUOBI) GetAccountID() ([]Account, error)
- func (h *HUOBI) GetAccounts() ([]Account, error)
- func (h *HUOBI) GetActiveOrders(req *order.GetOrdersRequest) ([]order.Detail, error)
- func (h *HUOBI) GetAggregatedBalance() ([]AggregatedBalance, error)
- func (h *HUOBI) GetCurrencies() ([]string, error)
- func (h *HUOBI) GetCurrencyReference(currency string) ([]Currency, error)
- func (h *HUOBI) GetDefaultConfig() (*config.ExchangeConfig, error)
- func (h *HUOBI) GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error)
- func (h *HUOBI) GetDepositHistory(cryptocurrency string) ([]WithdrawDepositHistory, error)
- func (h *HUOBI) GetDepth(obd OrderBookDataRequestParams) (Orderbook, error)
- func (h *HUOBI) GetExchangeHistory(p currency.Pair, assetType asset.Item) ([]exchange.TradeHistory, error)
- func (h *HUOBI) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (h *HUOBI) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (h *HUOBI) GetFundingHistory() ([]exchange.FundHistory, error)
- func (h *HUOBI) GetHistoricCandles(pair currency.Pair, a asset.Item, start, end time.Time, interval time.Duration) (kline.Item, error)
- func (h *HUOBI) GetLatestSpotPrice(symbol string) (float64, error)
- func (h *HUOBI) GetMarginAccountBalance(symbol string) ([]MarginAccountBalance, error)
- func (h *HUOBI) GetMarginLoanOrders(symbol, currency, start, end, states, from, direct, size string) ([]MarginOrder, error)
- func (h *HUOBI) GetMarketDetail(symbol string) (Detail, error)
- func (h *HUOBI) GetMarketDetailMerged(symbol string) (DetailMerged, error)
- func (h *HUOBI) GetOpenOrders(accountID, symbol, side string, size int64) ([]OrderInfo, error)
- func (h *HUOBI) GetOrder(orderID int64) (OrderInfo, error)
- func (h *HUOBI) GetOrderHistory(req *order.GetOrdersRequest) ([]order.Detail, error)
- func (h *HUOBI) GetOrderInfo(orderID string) (order.Detail, error)
- func (h *HUOBI) GetOrderMatchResults(orderID int64) ([]OrderMatchInfo, error)
- func (h *HUOBI) GetOrders(symbol, types, start, end, states, from, direct, size string) ([]OrderInfo, error)
- func (h *HUOBI) GetOrdersMatch(symbol, types, start, end, from, direct, size string) ([]OrderMatchInfo, error)
- func (h *HUOBI) GetSpotKline(arg KlinesRequestParams) ([]KlineItem, error)
- func (h *HUOBI) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)
- func (h *HUOBI) GetSymbols() ([]Symbol, error)
- func (h *HUOBI) GetTickers() (Tickers, error)
- func (h *HUOBI) GetTimestamp() (int64, error)
- func (h *HUOBI) GetTradeHistory(symbol, size string) ([]TradeHistory, error)
- func (h *HUOBI) GetTrades(symbol string) ([]Trade, error)
- func (h *HUOBI) GetWebsocket() (*wshandler.Websocket, error)
- func (h *HUOBI) GetWithdrawalHistory(cryptocurrency string) ([]WithdrawDepositHistory, error)
- func (h *HUOBI) MarginOrder(symbol, currency string, amount float64) (int64, error)
- func (h *HUOBI) MarginRepayment(orderID int64, amount float64) (int64, error)
- func (h *HUOBI) MarginTransfer(symbol, currency string, amount float64, in bool) (int64, error)
- func (h *HUOBI) ModifyOrder(action *order.Modify) (string, error)
- func (h *HUOBI) QueryDepositAddress(cryptocurrency string) (DepositAddress, error)
- func (h *HUOBI) QueryDepositAddresses(cryptocurrency string) ([]DepositAddress, error)
- func (h *HUOBI) QueryWithdrawQuotas(cryptocurrency string) (WithdrawQuota, error)
- func (h *HUOBI) Run()
- func (h *HUOBI) SendAuthenticatedHTTPRequest(method, endpoint string, values url.Values, data, result interface{}, ...) error
- func (h *HUOBI) SendHTTPRequest(path string, result interface{}) error
- func (h *HUOBI) SetDefaults()
- func (h *HUOBI) Setup(exch *config.ExchangeConfig) error
- func (h *HUOBI) SpotNewOrder(arg SpotNewOrderRequestParams) (int64, error)
- func (h *HUOBI) Start(wg *sync.WaitGroup)
- func (h *HUOBI) SubmitOrder(s *order.Submit) (order.SubmitResponse, error)
- func (h *HUOBI) Subscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
- func (h *HUOBI) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
- func (h *HUOBI) Unsubscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
- func (h *HUOBI) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
- func (h *HUOBI) UpdateAccountInfo() (account.Holdings, error)
- func (h *HUOBI) UpdateOrderbook(p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (h *HUOBI) UpdateTicker(p currency.Pair, assetType asset.Item) (*ticker.Price, error)
- func (h *HUOBI) UpdateTradablePairs(forceUpdate bool) error
- func (h *HUOBI) ValidateCredentials() error
- func (h *HUOBI) Withdraw(c currency.Code, address, addrTag string, amount, fee float64) (int64, error)
- func (h *HUOBI) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (h *HUOBI) WithdrawFiatFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (h *HUOBI) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (h *HUOBI) WsConnect() error
- func (h *HUOBI) WsProcessOrderbook(update *WsDepth, symbol string) error
- type KlineItem
- type KlinesRequestParams
- type MarginAccountBalance
- type MarginOrder
- type OrderBookDataRequestParams
- type OrderBookDataRequestParamsType
- type OrderInfo
- type OrderMatchInfo
- type Orderbook
- type RateLimit
- type Response
- type ResponseV2
- type SpotNewOrderRequestParams
- type SpotNewOrderRequestParamsType
- type Symbol
- type Ticker
- type Tickers
- type TimeInterval
- type Trade
- type TradeHistory
- type WithdrawDepositHistory
- type WithdrawQuota
- type WsAuthenticatedAccountsListRequest
- type WsAuthenticatedAccountsListResponse
- type WsAuthenticatedAccountsListResponseData
- type WsAuthenticatedAccountsListResponseDataList
- type WsAuthenticatedAccountsResponse
- type WsAuthenticatedAccountsResponseData
- type WsAuthenticatedAccountsResponseDataList
- type WsAuthenticatedOrderDetailResponse
- type WsAuthenticatedOrderDetailsRequest
- type WsAuthenticatedOrdersListRequest
- type WsAuthenticatedOrdersListResponse
- type WsAuthenticatedOrdersResponse
- type WsAuthenticatedOrdersResponseData
- type WsAuthenticatedOrdersUpdateResponse
- type WsAuthenticatedOrdersUpdateResponseData
- type WsAuthenticatedSubscriptionRequest
- type WsAuthenticationRequest
- type WsDepth
- type WsHeartBeat
- type WsKline
- type WsMessage
- type WsOldOrderUpdate
- type WsPong
- type WsRequest
- type WsResponse
- type WsTick
- type WsTrade
Constants ¶
This section is empty.
Variables ¶
var ( OrderBookDataRequestParamsTypeNone = OrderBookDataRequestParamsType("") OrderBookDataRequestParamsTypeStep0 = OrderBookDataRequestParamsType("step0") OrderBookDataRequestParamsTypeStep1 = OrderBookDataRequestParamsType("step1") OrderBookDataRequestParamsTypeStep2 = OrderBookDataRequestParamsType("step2") OrderBookDataRequestParamsTypeStep3 = OrderBookDataRequestParamsType("step3") OrderBookDataRequestParamsTypeStep4 = OrderBookDataRequestParamsType("step4") OrderBookDataRequestParamsTypeStep5 = OrderBookDataRequestParamsType("step5") )
vars for OrderBookDataRequestParamsTypes
var ( // SpotNewOrderRequestTypeBuyMarket buy market order SpotNewOrderRequestTypeBuyMarket = SpotNewOrderRequestParamsType("buy-market") // SpotNewOrderRequestTypeSellMarket sell market order SpotNewOrderRequestTypeSellMarket = SpotNewOrderRequestParamsType("sell-market") // SpotNewOrderRequestTypeBuyLimit buy limit order SpotNewOrderRequestTypeBuyLimit = SpotNewOrderRequestParamsType("buy-limit") // SpotNewOrderRequestTypeSellLimit sell lmit order SpotNewOrderRequestTypeSellLimit = SpotNewOrderRequestParamsType("sell-limit") )
var ( TimeIntervalMinute = TimeInterval("1min") TimeIntervalFiveMinutes = TimeInterval("5min") TimeIntervalFifteenMinutes = TimeInterval("15min") TimeIntervalThirtyMinutes = TimeInterval("30min") TimeIntervalHour = TimeInterval("60min") TimeIntervalDay = TimeInterval("1day") TimeIntervalWeek = TimeInterval("1week") TimeIntervalMohth = TimeInterval("1mon") TimeIntervalYear = TimeInterval("1year") )
TimeInterval vars
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ID int64 `json:"id"` Type string `json:"type"` State string `json:"state"` UserID int64 `json:"user-id"` }
Account stores the account data
type AccountBalance ¶
type AccountBalance struct { ID int64 `json:"id"` Type string `json:"type"` State string `json:"state"` AccountBalanceDetails []AccountBalanceDetail `json:"list"` }
AccountBalance stores the user all account balance
type AccountBalanceDetail ¶
type AccountBalanceDetail struct { Currency string `json:"currency"` Type string `json:"type"` Balance float64 `json:"balance,string"` }
AccountBalanceDetail stores the user account balance
type AggregatedBalance ¶
type AggregatedBalance struct { Currency string `json:"currency"` Balance float64 `json:"balance,string"` }
AggregatedBalance stores balances of all the sub-account
type CancelOpenOrdersBatch ¶
type CancelOpenOrdersBatch struct { Data struct { FailedCount int `json:"failed-count"` NextID int `json:"next-id"` SuccessCount int `json:"success-count"` } `json:"data"` Status string `json:"status"` ErrorMessage string `json:"err-msg"` }
CancelOpenOrdersBatch stores open order batch response data
type CancelOrderBatch ¶
type CancelOrderBatch struct { Success []string `json:"success"` Failed []struct { OrderID int64 `json:"order-id,string"` ErrorCode string `json:"err-code"` ErrorMessage string `json:"err-msg"` } `json:"failed"` }
CancelOrderBatch stores the cancel order batch data
type Chain ¶
type Chain struct { Chain string `json:"chain"` BaseChain string `json:"baseChain"` BaseChainProtocol string `json:"baseChainProtocol"` WithdrawFeeType string `json:"withdrawFeeType"` IsDynamic bool `json:"isDynamic"` TransactFeeWithdraw string `json:"transactFeeWithdraw"` MinTransactFeeWithdraw string `json:"minTransactFeeWithdraw"` MaxTransactFeeWithdraw string `json:"maxTransactFeeWithdraw"` TransactFeeRateWithdraw string `json:"transactFeeRateWithdraw"` WithdrawStatus string `json:"withdrawStatus"` DepositStatus string `json:"depositStatus"` MinDepositAmt string `json:"minDepositAmt"` MinWithdrawAmt string `json:"minWithdrawAmt"` MaxWithdrawAmt string `json:"maxWithdrawAmt"` WithdrawQuotaPerDay string `json:"withdrawQuotaPerDay"` WithdrawPrecision int64 `json:"withdrawPrecision"` }
Chain ...
type ChainQuota ¶
type ChainQuota struct { Chain string `json:"chain"` MaxWithdrawAmount float64 `json:"maxWithdrawAmt,string"` WithdrawQuotaPerDay float64 `json:"withdrawQuotaPerDay,string"` RemainingWithdrawQuotaPerDay float64 `json:"remainWithdrawQuotaPerDay,string"` WithdrawQuotaPerYear float64 `json:"withdrawQuotaPerYear,string"` RemainingWithdrawQuotaPerYear float64 `json:"remainWithdrawQuotaPerYear,string"` WithdrawQuotaTotal float64 `json:"withdrawQuotaTotal,string"` RemainingWithdrawQuotaTotal float64 `json:"remainWithdrawQuotaTotal,string"` }
ChainQuota stores the users currency chain quota
type DepositAddress ¶
type DepositAddress struct { Currency string `json:"currency"` Address string `json:"address"` AddressTag string `json:"addressTag"` Chain string `json:"chain"` }
DepositAddress stores the users deposit address info
type Detail ¶
type Detail struct { Amount float64 `json:"amount"` Open float64 `json:"open"` Close float64 `json:"close"` High float64 `json:"high"` Timestamp int64 `json:"timestamp"` ID int64 `json:"id"` Count int `json:"count"` Low float64 `json:"low"` Volume float64 `json:"vol"` }
Detail stores the ticker detail data
type DetailMerged ¶
type DetailMerged struct { Detail Version int64 `json:"version"` Ask []float64 `json:"ask"` Bid []float64 `json:"bid"` }
DetailMerged stores the ticker detail merged data
type HUOBI ¶
type HUOBI struct { exchange.Base AccountID string WebsocketConn *wshandler.WebsocketConnection AuthenticatedWebsocketConn *wshandler.WebsocketConnection }
HUOBI is the overarching type across this package
func (*HUOBI) AuthenticateWebsocket ¶
AuthenticateWebsocket sends an authentication message to the websocket
func (*HUOBI) CancelAllOrders ¶
CancelAllOrders cancels all orders associated with a currency pair
func (*HUOBI) CancelExistingOrder ¶
CancelExistingOrder cancels an order on Huobi
func (*HUOBI) CancelOpenOrdersBatch ¶
func (h *HUOBI) CancelOpenOrdersBatch(accountID, symbol string) (CancelOpenOrdersBatch, error)
CancelOpenOrdersBatch cancels a batch of orders -- to-do
func (*HUOBI) CancelOrder ¶
CancelOrder cancels an order by its corresponding ID number
func (*HUOBI) CancelOrderBatch ¶
func (h *HUOBI) CancelOrderBatch(_ []int64) ([]CancelOrderBatch, error)
CancelOrderBatch cancels a batch of orders -- to-do
func (*HUOBI) CancelWithdraw ¶
CancelWithdraw cancels a withdraw request
func (*HUOBI) FetchAccountInfo ¶
FetchAccountInfo retrieves balances for all enabled currencies
func (*HUOBI) FetchOrderbook ¶
FetchOrderbook returns orderbook base on the currency pair
func (*HUOBI) FetchTicker ¶
FetchTicker returns the ticker for a currency pair
func (*HUOBI) FetchTradablePairs ¶
FetchTradablePairs returns a list of the exchanges tradable pairs
func (*HUOBI) GenerateDefaultSubscriptions ¶
func (h *HUOBI) GenerateDefaultSubscriptions()
GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()
func (*HUOBI) GetAccountBalance ¶
func (h *HUOBI) GetAccountBalance(accountID string) ([]AccountBalanceDetail, error)
GetAccountBalance returns the users Huobi account balance
func (*HUOBI) GetAccountID ¶
GetAccountID returns the account ID for trades
func (*HUOBI) GetAccounts ¶
GetAccounts returns the Huobi user accounts
func (*HUOBI) GetActiveOrders ¶
GetActiveOrders retrieves any orders that are active/open
func (*HUOBI) GetAggregatedBalance ¶
func (h *HUOBI) GetAggregatedBalance() ([]AggregatedBalance, error)
GetAggregatedBalance returns the balances of all the sub-account aggregated.
func (*HUOBI) GetCurrencies ¶
GetCurrencies returns a list of currencies supported by Huobi
func (*HUOBI) GetCurrencyReference ¶
GetCurrencyReference returns currency reference by Huobi
func (*HUOBI) GetDefaultConfig ¶
func (h *HUOBI) GetDefaultConfig() (*config.ExchangeConfig, error)
GetDefaultConfig returns a default exchange config
func (*HUOBI) GetDepositAddress ¶
GetDepositAddress returns a deposit address for a specified currency
func (*HUOBI) GetDepositHistory ¶
func (h *HUOBI) GetDepositHistory(cryptocurrency string) ([]WithdrawDepositHistory, error)
GetDepositHistory returns the deposit history
func (*HUOBI) GetDepth ¶
func (h *HUOBI) GetDepth(obd OrderBookDataRequestParams) (Orderbook, error)
GetDepth returns the depth for the specified symbol
func (*HUOBI) GetExchangeHistory ¶
func (h *HUOBI) GetExchangeHistory(p currency.Pair, assetType asset.Item) ([]exchange.TradeHistory, error)
GetExchangeHistory returns historic trade data since exchange opening.
func (*HUOBI) GetFee ¶
func (h *HUOBI) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFee returns an estimate of fee based on type of transaction
func (*HUOBI) GetFeeByType ¶
func (h *HUOBI) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFeeByType returns an estimate of fee based on type of transaction
func (*HUOBI) GetFundingHistory ¶
func (h *HUOBI) GetFundingHistory() ([]exchange.FundHistory, error)
GetFundingHistory returns funding history, deposits and withdrawals
func (*HUOBI) GetHistoricCandles ¶
func (h *HUOBI) GetHistoricCandles(pair currency.Pair, a asset.Item, start, end time.Time, interval time.Duration) (kline.Item, error)
GetHistoricCandles returns candles between a time period for a set time interval
func (*HUOBI) GetLatestSpotPrice ¶
GetLatestSpotPrice returns latest spot price of symbol
symbol: string of currency pair
func (*HUOBI) GetMarginAccountBalance ¶
func (h *HUOBI) GetMarginAccountBalance(symbol string) ([]MarginAccountBalance, error)
GetMarginAccountBalance returns the margin account balances
func (*HUOBI) GetMarginLoanOrders ¶
func (h *HUOBI) GetMarginLoanOrders(symbol, currency, start, end, states, from, direct, size string) ([]MarginOrder, error)
GetMarginLoanOrders returns the margin loan orders
func (*HUOBI) GetMarketDetail ¶
GetMarketDetail returns the ticker for the specified symbol
func (*HUOBI) GetMarketDetailMerged ¶
func (h *HUOBI) GetMarketDetailMerged(symbol string) (DetailMerged, error)
GetMarketDetailMerged returns the ticker for the specified symbol
func (*HUOBI) GetOpenOrders ¶
GetOpenOrders returns a list of orders
func (*HUOBI) GetOrderHistory ¶
GetOrderHistory retrieves account order information Can Limit response to specific order status
func (*HUOBI) GetOrderInfo ¶
GetOrderInfo returns information on a current open order
func (*HUOBI) GetOrderMatchResults ¶
func (h *HUOBI) GetOrderMatchResults(orderID int64) ([]OrderMatchInfo, error)
GetOrderMatchResults returns matched order info for the specified order
func (*HUOBI) GetOrders ¶
func (h *HUOBI) GetOrders(symbol, types, start, end, states, from, direct, size string) ([]OrderInfo, error)
GetOrders returns a list of orders
func (*HUOBI) GetOrdersMatch ¶
func (h *HUOBI) GetOrdersMatch(symbol, types, start, end, from, direct, size string) ([]OrderMatchInfo, error)
GetOrdersMatch returns a list of matched orders
func (*HUOBI) GetSpotKline ¶
func (h *HUOBI) GetSpotKline(arg KlinesRequestParams) ([]KlineItem, error)
GetSpotKline returns kline data KlinesRequestParams contains symbol, period and size
func (*HUOBI) GetSubscriptions ¶
func (h *HUOBI) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)
GetSubscriptions returns a copied list of subscriptions
func (*HUOBI) GetSymbols ¶
GetSymbols returns an array of symbols supported by Huobi
func (*HUOBI) GetTickers ¶
GetTickers returns the ticker for the specified symbol
func (*HUOBI) GetTimestamp ¶
GetTimestamp returns the Huobi server time
func (*HUOBI) GetTradeHistory ¶
func (h *HUOBI) GetTradeHistory(symbol, size string) ([]TradeHistory, error)
GetTradeHistory returns the trades for the specified symbol
func (*HUOBI) GetWebsocket ¶
GetWebsocket returns a pointer to the exchange websocket
func (*HUOBI) GetWithdrawalHistory ¶
func (h *HUOBI) GetWithdrawalHistory(cryptocurrency string) ([]WithdrawDepositHistory, error)
GetWithdrawalHistory returns the withdrawal history
func (*HUOBI) MarginOrder ¶
MarginOrder submits a margin order application
func (*HUOBI) MarginRepayment ¶
MarginRepayment repays a margin amount for a margin ID
func (*HUOBI) MarginTransfer ¶
MarginTransfer transfers assets into or out of the margin account
func (*HUOBI) ModifyOrder ¶
ModifyOrder will allow of changing orderbook placement and limit to market conversion
func (*HUOBI) QueryDepositAddress ¶
func (h *HUOBI) QueryDepositAddress(cryptocurrency string) (DepositAddress, error)
QueryDepositAddress returns the deposit address for a specified currency
func (*HUOBI) QueryDepositAddresses ¶
func (h *HUOBI) QueryDepositAddresses(cryptocurrency string) ([]DepositAddress, error)
QueryDepositAddresses returns the deposit address for a specified currency
func (*HUOBI) QueryWithdrawQuotas ¶
func (h *HUOBI) QueryWithdrawQuotas(cryptocurrency string) (WithdrawQuota, error)
QueryWithdrawQuotas returns the users cryptocurrency withdraw quotas
func (*HUOBI) SendAuthenticatedHTTPRequest ¶
func (h *HUOBI) SendAuthenticatedHTTPRequest(method, endpoint string, values url.Values, data, result interface{}, isVersion2API bool) error
SendAuthenticatedHTTPRequest sends authenticated requests to the HUOBI API
func (*HUOBI) SendHTTPRequest ¶
SendHTTPRequest sends an unauthenticated HTTP request
func (*HUOBI) SetDefaults ¶
func (h *HUOBI) SetDefaults()
SetDefaults sets default values for the exchange
func (*HUOBI) Setup ¶
func (h *HUOBI) Setup(exch *config.ExchangeConfig) error
Setup sets user configuration
func (*HUOBI) SpotNewOrder ¶
func (h *HUOBI) SpotNewOrder(arg SpotNewOrderRequestParams) (int64, error)
SpotNewOrder submits an order to Huobi
func (*HUOBI) SubmitOrder ¶
SubmitOrder submits a new order
func (*HUOBI) Subscribe ¶
func (h *HUOBI) Subscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
Subscribe sends a websocket message to receive data from the channel
func (*HUOBI) SubscribeToWebsocketChannels ¶
func (h *HUOBI) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
SubscribeToWebsocketChannels appends to ChannelsToSubscribe which lets websocket.manageSubscriptions handle subscribing
func (*HUOBI) Unsubscribe ¶
func (h *HUOBI) Unsubscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
Unsubscribe sends a websocket message to stop receiving data from the channel
func (*HUOBI) UnsubscribeToWebsocketChannels ¶
func (h *HUOBI) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
UnsubscribeToWebsocketChannels removes from ChannelsToSubscribe which lets websocket.manageSubscriptions handle unsubscribing
func (*HUOBI) UpdateAccountInfo ¶
UpdateAccountInfo retrieves balances for all enabled currencies for the HUOBI exchange - to-do
func (*HUOBI) UpdateOrderbook ¶
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*HUOBI) UpdateTicker ¶
UpdateTicker updates and returns the ticker for a currency pair
func (*HUOBI) UpdateTradablePairs ¶
UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config
func (*HUOBI) ValidateCredentials ¶
ValidateCredentials validates current credentials used for wrapper functionality
func (*HUOBI) Withdraw ¶
func (h *HUOBI) Withdraw(c currency.Code, address, addrTag string, amount, fee float64) (int64, error)
Withdraw withdraws the desired amount and currency
func (*HUOBI) WithdrawCryptocurrencyFunds ¶
func (h *HUOBI) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted
func (*HUOBI) WithdrawFiatFunds ¶
func (h *HUOBI) WithdrawFiatFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted
func (*HUOBI) WithdrawFiatFundsToInternationalBank ¶
func (h *HUOBI) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted
type KlineItem ¶
type KlineItem struct { ID int64 `json:"id"` Open float64 `json:"open"` Close float64 `json:"close"` Low float64 `json:"low"` High float64 `json:"high"` Amount float64 `json:"amount"` Volume float64 `json:"vol"` Count int `json:"count"` }
KlineItem stores a kline item
type KlinesRequestParams ¶
type KlinesRequestParams struct { Symbol string // Symbol to be used; example btcusdt, bccbtc...... Period TimeInterval // Kline time interval; 1min, 5min, 15min...... Size int // Size; [1-2000] }
KlinesRequestParams represents Klines request data.
type MarginAccountBalance ¶
type MarginAccountBalance struct { ID int `json:"id"` Type string `json:"type"` State string `json:"state"` Symbol string `json:"symbol"` FlPrice string `json:"fl-price"` FlType string `json:"fl-type"` RiskRate string `json:"risk-rate"` List []AccountBalance `json:"list"` }
MarginAccountBalance stores the margin account balance info
type MarginOrder ¶
type MarginOrder struct { Currency string `json:"currency"` Symbol string `json:"symbol"` AccruedAt int64 `json:"accrued-at"` LoanAmount string `json:"loan-amount"` LoanBalance string `json:"loan-balance"` InterestBalance string `json:"interest-balance"` CreatedAt int64 `json:"created-at"` InterestAmount string `json:"interest-amount"` InterestRate string `json:"interest-rate"` AccountID int `json:"account-id"` UserID int `json:"user-id"` UpdatedAt int64 `json:"updated-at"` ID int `json:"id"` State string `json:"state"` }
MarginOrder stores the margin order info
type OrderBookDataRequestParams ¶
type OrderBookDataRequestParams struct { Symbol string `json:"symbol"` // Required; example LTCBTC,BTCUSDT Type OrderBookDataRequestParamsType `json:"type"` // step0, step1, step2, step3, step4, step5 (combined depth 0-5); when step0, no depth is merged }
OrderBookDataRequestParams represents Klines request data.
type OrderBookDataRequestParamsType ¶
type OrderBookDataRequestParamsType string
OrderBookDataRequestParamsType var for request param types
type OrderInfo ¶
type OrderInfo struct { ID int64 `json:"id"` Symbol string `json:"symbol"` AccountID int64 `json:"account-id"` Amount float64 `json:"amount,string"` Price float64 `json:"price,string"` CreatedAt int64 `json:"created-at"` Type string `json:"type"` FieldAmount float64 `json:"field-amount,string"` FieldCashAmount float64 `json:"field-cash-amount,string"` FilledAmount float64 `json:"filled-amount,string"` FilledCashAmount float64 `json:"filled-cash-amount,string"` FilledFees float64 `json:"filled-fees,string"` FinishedAt int64 `json:"finished-at"` UserID int64 `json:"user-id"` Source string `json:"source"` State string `json:"state"` CanceledAt int64 `json:"canceled-at"` Exchange string `json:"exchange"` Batch string `json:"batch"` }
OrderInfo stores the order info
type OrderMatchInfo ¶
type OrderMatchInfo struct { ID int `json:"id"` OrderID int `json:"order-id"` MatchID int `json:"match-id"` Symbol string `json:"symbol"` Type string `json:"type"` Source string `json:"source"` Price string `json:"price"` FilledAmount string `json:"filled-amount"` FilledFees string `json:"filled-fees"` CreatedAt int64 `json:"created-at"` }
OrderMatchInfo stores the order match info
type Orderbook ¶
type Orderbook struct { ID int64 `json:"id"` Timetstamp int64 `json:"ts"` Bids [][]float64 `json:"bids"` Asks [][]float64 `json:"asks"` }
Orderbook stores the orderbook data
type RateLimit ¶
type RateLimit struct { Spot *rate.Limiter FuturesAuth *rate.Limiter FuturesUnauth *rate.Limiter SwapAuth *rate.Limiter SwapUnauth *rate.Limiter FuturesXfer *rate.Limiter }
RateLimit implements the request.Limiter interface
func SetRateLimit ¶
func SetRateLimit() *RateLimit
SetRateLimit returns the rate limit for the exchange
type Response ¶
type Response struct { Status string `json:"status"` Channel string `json:"ch"` Timestamp int64 `json:"ts"` ErrorCode string `json:"err-code"` ErrorMessage string `json:"err-msg"` }
Response stores the Huobi response information
type ResponseV2 ¶
ResponseV2 stores the Huobi generic response info
type SpotNewOrderRequestParams ¶
type SpotNewOrderRequestParams struct { AccountID int `json:"account-id,string"` // Account ID, obtained using the accounts method. Curency trades use the accountid of the ‘spot’ account; for loan asset transactions, please use the accountid of the ‘margin’ account. Amount float64 `json:"amount"` // The limit price indicates the quantity of the order, the market price indicates how much to buy when the order is paid, and the market price indicates how much the coin is sold when the order is sold. Price float64 `json:"price"` // Order price, market price does not use this parameter Source string `json:"source"` // Order source, api: API call, margin-api: loan asset transaction Symbol string `json:"symbol"` // The symbol to use; example btcusdt, bccbtc...... Type SpotNewOrderRequestParamsType `json:"type"` // 订单类型, buy-market: 市价买, sell-market: 市价卖, buy-limit: 限价买, sell-limit: 限价卖 }
SpotNewOrderRequestParams holds the params required to place an order
type SpotNewOrderRequestParamsType ¶
type SpotNewOrderRequestParamsType string
SpotNewOrderRequestParamsType order type
type Symbol ¶
type Symbol struct { BaseCurrency string `json:"base-currency"` QuoteCurrency string `json:"quote-currency"` PricePrecision int `json:"price-precision"` AmountPrecision int `json:"amount-precision"` SymbolPartition string `json:"symbol-partition"` Innovation string `json:"innovation"` State string `json:"state"` ValuePrecision int `json:"value-precision"` MinimumOrderAmount float64 `json:"min-order-amt"` MaximumOrderAmount float64 `json:"max-order-amt"` MinimumOrderValue float64 `json:"min-order-value"` }
Symbol stores the symbol data
type Ticker ¶
type Ticker struct { Amount float64 `json:"amount"` Close float64 `json:"close"` Count int64 `json:"count"` High float64 `json:"high"` Low float64 `json:"low"` Open float64 `json:"open"` Symbol string `json:"symbol"` Volume float64 `json:"vol"` }
Ticker latest ticker data
type Trade ¶
type Trade struct { ID float64 `json:"id"` Price float64 `json:"price"` Amount float64 `json:"amount"` Direction string `json:"direction"` Timestamp int64 `json:"ts"` }
Trade stores the trade data
type TradeHistory ¶
type TradeHistory struct { ID int64 `json:"id"` Timestamp int64 `json:"ts"` Trades []Trade `json:"data"` }
TradeHistory stores the the trade history data
type WithdrawDepositHistory ¶
type WithdrawDepositHistory struct { ID int `json:"id"` Type string `json:"type"` Currency string `json:"currency"` TxID string `json:"tx-hash"` Amount float64 `json:"amount"` Address string `json:"address"` AddressTag string `json:"address-tag"` Fee float64 `json:"fee"` State string `json:"state"` CreatedAt int `json:"created-at"` UpdatedAt int `json:"updated-at"` }
WithdrawDepositHistory ...
{ "id": 1171, "type": "deposit", "currency": "xrp", "tx-hash": "ed03094b84eafbe4bc16e7ef766ee959885ee5bcb265872baaa9c64e1cf86c2b", "amount": 7.457467, "address": "rae93V8d2mdoUQHwBDBdM4NHCMehRJAsbm", "address-tag": "100040", "fee": 0, "state": "safe", "created-at": 1510912472199, "updated-at": 1511145876575 }
type WithdrawQuota ¶
type WithdrawQuota struct { Currency string `json:"currency"` Chains []ChainQuota `json:"chains"` }
WithdrawQuota stores the users withdraw quotas
type WsAuthenticatedAccountsListRequest ¶
type WsAuthenticatedAccountsListRequest struct { Op string `json:"op"` AccessKeyID string `json:"AccessKeyId"` SignatureMethod string `json:"SignatureMethod"` SignatureVersion string `json:"SignatureVersion"` Timestamp string `json:"Timestamp"` Signature string `json:"Signature"` Topic string `json:"topic"` Symbol string `json:"symbol"` ClientID int64 `json:"cid,string,omitempty"` }
WsAuthenticatedAccountsListRequest request for account list authenticated connection
type WsAuthenticatedAccountsListResponse ¶
type WsAuthenticatedAccountsListResponse struct { WsResponse Data []WsAuthenticatedAccountsListResponseData `json:"data"` }
WsAuthenticatedAccountsListResponse response from AccountsList authenticated endpoint
type WsAuthenticatedAccountsListResponseData ¶
type WsAuthenticatedAccountsListResponseData struct { ID int64 `json:"id"` Type string `json:"type"` State string `json:"state"` List []WsAuthenticatedAccountsListResponseDataList `json:"list"` }
WsAuthenticatedAccountsListResponseData account data
type WsAuthenticatedAccountsListResponseDataList ¶
type WsAuthenticatedAccountsListResponseDataList struct { Currency string `json:"currency"` Type string `json:"type"` Balance float64 `json:"balance,string"` }
WsAuthenticatedAccountsListResponseDataList detailed account data
type WsAuthenticatedAccountsResponse ¶
type WsAuthenticatedAccountsResponse struct { WsResponse Data WsAuthenticatedAccountsResponseData `json:"data"` }
WsAuthenticatedAccountsResponse response from Accounts authenticated subscription
type WsAuthenticatedAccountsResponseData ¶
type WsAuthenticatedAccountsResponseData struct { Event string `json:"event"` List []WsAuthenticatedAccountsResponseDataList `json:"list"` }
WsAuthenticatedAccountsResponseData account data
type WsAuthenticatedAccountsResponseDataList ¶
type WsAuthenticatedAccountsResponseDataList struct { AccountID int64 `json:"account-id"` Currency string `json:"currency"` Type string `json:"type"` Balance float64 `json:"balance,string"` }
WsAuthenticatedAccountsResponseDataList detailed account data
type WsAuthenticatedOrderDetailResponse ¶
type WsAuthenticatedOrderDetailResponse struct { WsResponse Data OrderInfo `json:"data"` }
WsAuthenticatedOrderDetailResponse response from OrderDetail authenticated endpoint
type WsAuthenticatedOrderDetailsRequest ¶
type WsAuthenticatedOrderDetailsRequest struct { Op string `json:"op"` AccessKeyID string `json:"AccessKeyId"` SignatureMethod string `json:"SignatureMethod"` SignatureVersion string `json:"SignatureVersion"` Timestamp string `json:"Timestamp"` Signature string `json:"Signature"` Topic string `json:"topic"` OrderID string `json:"order-id"` ClientID int64 `json:"cid,string,omitempty"` }
WsAuthenticatedOrderDetailsRequest request for order details authenticated connection
type WsAuthenticatedOrdersListRequest ¶
type WsAuthenticatedOrdersListRequest struct { Op string `json:"op"` AccessKeyID string `json:"AccessKeyId"` SignatureMethod string `json:"SignatureMethod"` SignatureVersion string `json:"SignatureVersion"` Timestamp string `json:"Timestamp"` Signature string `json:"Signature"` Topic string `json:"topic"` States string `json:"states"` AccountID int64 `json:"account-id"` Symbol string `json:"symbol"` ClientID int64 `json:"cid,string,omitempty"` }
WsAuthenticatedOrdersListRequest request for orderslist authenticated connection
type WsAuthenticatedOrdersListResponse ¶
type WsAuthenticatedOrdersListResponse struct { WsResponse Data []OrderInfo `json:"data"` }
WsAuthenticatedOrdersListResponse response from OrdersList authenticated endpoint
type WsAuthenticatedOrdersResponse ¶
type WsAuthenticatedOrdersResponse struct { WsResponse Data []WsAuthenticatedOrdersResponseData `json:"data"` }
WsAuthenticatedOrdersResponse response from Orders authenticated subscription
type WsAuthenticatedOrdersResponseData ¶
type WsAuthenticatedOrdersResponseData struct { SeqID int64 `json:"seq-id"` OrderID int64 `json:"order-id"` Symbol string `json:"symbol"` AccountID int64 `json:"account-id"` OrderAmount float64 `json:"order-amount,string"` OrderPrice float64 `json:"order-price,string"` CreatedAt int64 `json:"created-at"` OrderType string `json:"order-type"` OrderSource string `json:"order-source"` OrderState string `json:"order-state"` Role string `json:"role"` Price float64 `json:"price,string"` FilledAmount float64 `json:"filled-amount,string"` UnfilledAmount float64 `json:"unfilled-amount,string"` FilledCashAmount float64 `json:"filled-cash-amount,string"` FilledFees float64 `json:"filled-fees,string"` }
WsAuthenticatedOrdersResponseData order data
type WsAuthenticatedOrdersUpdateResponse ¶
type WsAuthenticatedOrdersUpdateResponse struct { WsResponse Data WsAuthenticatedOrdersUpdateResponseData `json:"data"` }
WsAuthenticatedOrdersUpdateResponse response from OrdersUpdate authenticated subscription
type WsAuthenticatedOrdersUpdateResponseData ¶
type WsAuthenticatedOrdersUpdateResponseData struct { UnfilledAmount float64 `json:"unfilled-amount,string"` FilledAmount float64 `json:"filled-amount,string"` Price float64 `json:"price,string"` OrderID int64 `json:"order-id"` Symbol string `json:"symbol"` MatchID int64 `json:"match-id"` FilledCashAmount float64 `json:"filled-cash-amount,string"` Role string `json:"role"` OrderState string `json:"order-state"` OrderType string `json:"order-type"` }
WsAuthenticatedOrdersUpdateResponseData order update data
type WsAuthenticatedSubscriptionRequest ¶
type WsAuthenticatedSubscriptionRequest struct { Op string `json:"op"` AccessKeyID string `json:"AccessKeyId"` SignatureMethod string `json:"SignatureMethod"` SignatureVersion string `json:"SignatureVersion"` Timestamp string `json:"Timestamp"` Signature string `json:"Signature"` Topic string `json:"topic"` ClientID int64 `json:"cid,string,omitempty"` }
WsAuthenticatedSubscriptionRequest request for subscription on authenticated connection
type WsAuthenticationRequest ¶
type WsAuthenticationRequest struct { Op string `json:"op"` AccessKeyID string `json:"AccessKeyId"` SignatureMethod string `json:"SignatureMethod"` SignatureVersion string `json:"SignatureVersion"` Timestamp string `json:"Timestamp"` Signature string `json:"Signature"` ClientID int64 `json:"cid,string,omitempty"` }
WsAuthenticationRequest data for login
type WsDepth ¶
type WsDepth struct { Channel string `json:"ch"` Timestamp int64 `json:"ts"` Tick struct { Bids [][]interface{} `json:"bids"` Asks [][]interface{} `json:"asks"` Timestamp int64 `json:"ts"` Version int64 `json:"version"` } `json:"tick"` }
WsDepth defines market depth websocket response
type WsHeartBeat ¶
type WsHeartBeat struct {
ClientNonce int64 `json:"ping"`
}
WsHeartBeat defines a heartbeat request
type WsKline ¶
type WsKline struct { Channel string `json:"ch"` Timestamp int64 `json:"ts"` Tick struct { ID int64 `json:"id"` Open float64 `json:"open"` Close float64 `json:"close"` Low float64 `json:"low"` High float64 `json:"high"` Amount float64 `json:"amount"` Volume float64 `json:"vol"` Count int64 `json:"count"` } }
WsKline defines market kline websocket response
type WsOldOrderUpdate ¶
type WsOldOrderUpdate struct { WsResponse Data WsAuthenticatedOrdersResponseData `json:"data"` }
WsOldOrderUpdate response from Orders authenticated subscription
type WsRequest ¶
type WsRequest struct { Topic string `json:"req,omitempty"` Subscribe string `json:"sub,omitempty"` Unsubscribe string `json:"unsub,omitempty"` ClientID int64 `json:"cid,string,omitempty"` }
WsRequest defines a request data structure
type WsResponse ¶
type WsResponse struct { Op string `json:"op"` TS int64 `json:"ts"` Status string `json:"status"` ErrorCode int64 `json:"err-code"` ErrorMessage string `json:"err-msg"` Ping int64 `json:"ping"` Channel string `json:"ch"` Rep string `json:"rep"` Topic string `json:"topic"` Subscribed string `json:"subbed"` UnSubscribed string `json:"unsubbed"` ClientID int64 `json:"cid,string"` }
WsResponse defines a response from the websocket connection when there is an error
type WsTick ¶
type WsTick struct { Channel string `json:"ch"` Rep string `json:"rep"` Timestamp int64 `json:"ts"` Tick struct { Amount float64 `json:"amount"` Close float64 `json:"close"` Count float64 `json:"count"` High float64 `json:"high"` ID float64 `json:"id"` Low float64 `json:"low"` Open float64 `json:"open"` Timestamp float64 `json:"ts"` Volume float64 `json:"vol"` } `json:"tick"` }
WsTick stores websocket ticker data
type WsTrade ¶
type WsTrade struct { Channel string `json:"ch"` Timestamp int64 `json:"ts"` Tick struct { ID int64 `json:"id"` Timestamp int64 `json:"ts"` Data []struct { Amount float64 `json:"amount"` Timestamp int64 `json:"ts"` ID float64 `json:"id"` Price float64 `json:"price"` Direction string `json:"direction"` } `json:"data"` } }
WsTrade defines market trade websocket response