Documentation ¶
Index ¶
- Constants
- Variables
- type Account
- type AccountBalance
- type AccountBalanceDetail
- type AggregatedBalance
- type CancelOpenOrdersBatch
- type CancelOrderBatch
- type Detail
- type DetailMerged
- type HUOBIHADAX
- func (h *HUOBIHADAX) AuthenticateWebsocket() error
- func (h *HUOBIHADAX) CancelAllOrders(orderCancellation *exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error)
- func (h *HUOBIHADAX) CancelExistingOrder(orderID int64) (int64, error)
- func (h *HUOBIHADAX) CancelOpenOrdersBatch(accountID, symbol string) (CancelOpenOrdersBatch, error)
- func (h *HUOBIHADAX) CancelOrder(order *exchange.OrderCancellation) error
- func (h *HUOBIHADAX) CancelOrderBatch(orderIDs []int64) (CancelOrderBatch, error)
- func (h *HUOBIHADAX) CancelWithdraw(withdrawID int64) (int64, error)
- func (h *HUOBIHADAX) GenerateDefaultSubscriptions()
- func (h *HUOBIHADAX) GetAccountBalance(accountID string) ([]AccountBalanceDetail, error)
- func (h *HUOBIHADAX) GetAccountID() ([]Account, error)
- func (h *HUOBIHADAX) GetAccountInfo() (exchange.AccountInfo, error)
- func (h *HUOBIHADAX) GetAccounts() ([]Account, error)
- func (h *HUOBIHADAX) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
- func (h *HUOBIHADAX) GetAggregatedBalance() ([]AggregatedBalance, error)
- func (h *HUOBIHADAX) GetCurrencies() ([]string, error)
- func (h *HUOBIHADAX) GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error)
- func (h *HUOBIHADAX) GetDepositWithdrawalHistory(associatedID, currency string, isDeposit bool, size int64) ([]History, error)
- func (h *HUOBIHADAX) GetDepth(symbol, depthType string) (Orderbook, error)
- func (h *HUOBIHADAX) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error)
- func (h *HUOBIHADAX) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (h *HUOBIHADAX) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (h *HUOBIHADAX) GetFundingHistory() ([]exchange.FundHistory, error)
- func (h *HUOBIHADAX) GetLatestSpotPrice(symbol string) (float64, error)
- func (h *HUOBIHADAX) GetMarginAccountBalance(symbol string) ([]MarginAccountBalance, error)
- func (h *HUOBIHADAX) GetMarginLoanOrders(symbol, currency, start, end, states, from, direct, size string) ([]MarginOrder, error)
- func (h *HUOBIHADAX) GetMarketDetail(symbol string) (Detail, error)
- func (h *HUOBIHADAX) GetMarketDetailMerged(symbol string) (DetailMerged, error)
- func (h *HUOBIHADAX) GetOpenOrders(accountID, symbol, side string, size int) ([]OrderInfo, error)
- func (h *HUOBIHADAX) GetOrder(orderID int64) (OrderInfo, error)
- func (h *HUOBIHADAX) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
- func (h *HUOBIHADAX) GetOrderInfo(orderID string) (exchange.OrderDetail, error)
- func (h *HUOBIHADAX) GetOrderMatchResults(orderID int64) ([]OrderMatchInfo, error)
- func (h *HUOBIHADAX) GetOrderbookEx(p currency.Pair, assetType string) (orderbook.Base, error)
- func (h *HUOBIHADAX) GetOrders(symbol, types, start, end, states, from, direct, size string) ([]OrderInfo, error)
- func (h *HUOBIHADAX) GetOrdersMatch(symbol, types, start, end, from, direct, size string) ([]OrderMatchInfo, error)
- func (h *HUOBIHADAX) GetSpotKline(arg KlinesRequestParams) ([]KlineItem, error)
- func (h *HUOBIHADAX) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)
- func (h *HUOBIHADAX) GetSymbols() ([]Symbol, error)
- func (h *HUOBIHADAX) GetTickerPrice(p currency.Pair, assetType string) (ticker.Price, error)
- func (h *HUOBIHADAX) GetTimestamp() (int64, error)
- func (h *HUOBIHADAX) GetTradeHistory(symbol, size string) ([]TradeHistory, error)
- func (h *HUOBIHADAX) GetTrades(symbol string) ([]Trade, error)
- func (h *HUOBIHADAX) GetWebsocket() (*wshandler.Websocket, error)
- func (h *HUOBIHADAX) MarginOrder(symbol, currency string, amount float64) (int64, error)
- func (h *HUOBIHADAX) MarginRepayment(orderID int64, amount float64) (int64, error)
- func (h *HUOBIHADAX) MarginTransfer(symbol, currency string, amount float64, in bool) (int64, error)
- func (h *HUOBIHADAX) ModifyOrder(action *exchange.ModifyOrder) (string, error)
- func (h *HUOBIHADAX) Run()
- func (h *HUOBIHADAX) SendAuthenticatedHTTPPostRequest(method, endpoint, postBodyValues string, result interface{}) error
- func (h *HUOBIHADAX) SendAuthenticatedHTTPRequest(method, endpoint string, values url.Values, result interface{}) error
- func (h *HUOBIHADAX) SendHTTPRequest(path string, result interface{}) error
- func (h *HUOBIHADAX) SetDefaults()
- func (h *HUOBIHADAX) Setup(exch *config.ExchangeConfig)
- func (h *HUOBIHADAX) SpotNewOrder(arg SpotNewOrderRequestParams) (int64, error)
- func (h *HUOBIHADAX) Start(wg *sync.WaitGroup)
- func (h *HUOBIHADAX) SubmitOrder(p currency.Pair, side exchange.OrderSide, orderType exchange.OrderType, ...) (exchange.SubmitOrderResponse, error)
- func (h *HUOBIHADAX) Subscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
- func (h *HUOBIHADAX) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
- func (h *HUOBIHADAX) Unsubscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
- func (h *HUOBIHADAX) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
- func (h *HUOBIHADAX) UpdateOrderbook(p currency.Pair, assetType string) (orderbook.Base, error)
- func (h *HUOBIHADAX) UpdateTicker(p currency.Pair, assetType string) (ticker.Price, error)
- func (h *HUOBIHADAX) Withdraw(c currency.Code, address, addrTag string, amount, fee float64) (int64, error)
- func (h *HUOBIHADAX) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (h *HUOBIHADAX) WithdrawFiatFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (h *HUOBIHADAX) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (h *HUOBIHADAX) WsConnect() error
- func (h *HUOBIHADAX) WsHandleData()
- func (h *HUOBIHADAX) WsProcessOrderbook(update *WsDepth, symbol string) error
- type History
- type KlineItem
- type KlinesRequestParams
- type MarginAccountBalance
- type MarginOrder
- type OrderInfo
- type OrderMatchInfo
- type Orderbook
- type Response
- type SpotNewOrderRequestParams
- type SpotNewOrderRequestParamsType
- type Symbol
- type TimeInterval
- type Trade
- type TradeHistory
- type WsAuthenticatedAccountsListRequest
- type WsAuthenticatedAccountsListResponse
- type WsAuthenticatedAccountsListResponseData
- type WsAuthenticatedAccountsListResponseDataList
- type WsAuthenticatedAccountsResponse
- type WsAuthenticatedAccountsResponseData
- type WsAuthenticatedAccountsResponseDataList
- type WsAuthenticatedDataResponse
- type WsAuthenticatedOrderDetailResponse
- type WsAuthenticatedOrderDetailsRequest
- type WsAuthenticatedOrdersListRequest
- type WsAuthenticatedOrdersListResponse
- type WsAuthenticatedOrdersListResponseData
- type WsAuthenticatedOrdersResponse
- type WsAuthenticatedOrdersResponseData
- type WsAuthenticatedOrdersUpdateResponse
- type WsAuthenticatedOrdersUpdateResponseData
- type WsAuthenticatedSubscriptionRequest
- type WsAuthenticationRequest
- type WsDepth
- type WsHeartBeat
- type WsKline
- type WsMessage
- type WsPong
- type WsRequest
- type WsResponse
- type WsTrade
Constants ¶
const (
HuobiHadaxSocketIOAddress = "wss://api.hadax.com/ws"
)
WS URL values
Variables ¶
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 limit 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"` SubType string `json:"subtype"` State string `json:"state"` }
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 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 int `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 int `json:"version"` Ask []float64 `json:"ask"` Bid []float64 `json:"bid"` }
DetailMerged stores the ticker detail merged data
type HUOBIHADAX ¶
type HUOBIHADAX struct { WebsocketConn *wshandler.WebsocketConnection AuthenticatedWebsocketConn *wshandler.WebsocketConnection exchange.Base }
HUOBIHADAX is the overarching type across this package
func (*HUOBIHADAX) AuthenticateWebsocket ¶
func (h *HUOBIHADAX) AuthenticateWebsocket() error
AuthenticateWebsocket sends an authentication message to the websocket
func (*HUOBIHADAX) CancelAllOrders ¶
func (h *HUOBIHADAX) CancelAllOrders(orderCancellation *exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error)
CancelAllOrders cancels all orders associated with a currency pair
func (*HUOBIHADAX) CancelExistingOrder ¶
func (h *HUOBIHADAX) CancelExistingOrder(orderID int64) (int64, error)
CancelExistingOrder cancels an order on Huobi
func (*HUOBIHADAX) CancelOpenOrdersBatch ¶
func (h *HUOBIHADAX) CancelOpenOrdersBatch(accountID, symbol string) (CancelOpenOrdersBatch, error)
CancelOpenOrdersBatch cancels a batch of orders -- to-do
func (*HUOBIHADAX) CancelOrder ¶
func (h *HUOBIHADAX) CancelOrder(order *exchange.OrderCancellation) error
CancelOrder cancels an order by its corresponding ID number
func (*HUOBIHADAX) CancelOrderBatch ¶
func (h *HUOBIHADAX) CancelOrderBatch(orderIDs []int64) (CancelOrderBatch, error)
CancelOrderBatch cancels a batch of orders -- to-do
func (*HUOBIHADAX) CancelWithdraw ¶
func (h *HUOBIHADAX) CancelWithdraw(withdrawID int64) (int64, error)
CancelWithdraw cancels a withdraw request
func (*HUOBIHADAX) GenerateDefaultSubscriptions ¶
func (h *HUOBIHADAX) GenerateDefaultSubscriptions()
GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()
func (*HUOBIHADAX) GetAccountBalance ¶
func (h *HUOBIHADAX) GetAccountBalance(accountID string) ([]AccountBalanceDetail, error)
GetAccountBalance returns the users Huobi account balance
func (*HUOBIHADAX) GetAccountID ¶
func (h *HUOBIHADAX) GetAccountID() ([]Account, error)
GetAccountID returns the account info
func (*HUOBIHADAX) GetAccountInfo ¶
func (h *HUOBIHADAX) GetAccountInfo() (exchange.AccountInfo, error)
GetAccountInfo retrieves balances for all enabled currencies for the HUOBIHADAX exchange
func (*HUOBIHADAX) GetAccounts ¶
func (h *HUOBIHADAX) GetAccounts() ([]Account, error)
GetAccounts returns the Huobi user accounts
func (*HUOBIHADAX) GetActiveOrders ¶
func (h *HUOBIHADAX) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
GetActiveOrders retrieves any orders that are active/open
func (*HUOBIHADAX) GetAggregatedBalance ¶
func (h *HUOBIHADAX) GetAggregatedBalance() ([]AggregatedBalance, error)
GetAggregatedBalance returns the balances of all the sub-account aggregated.
func (*HUOBIHADAX) GetCurrencies ¶
func (h *HUOBIHADAX) GetCurrencies() ([]string, error)
GetCurrencies returns a list of currencies supported by Huobi
func (*HUOBIHADAX) GetDepositAddress ¶
func (h *HUOBIHADAX) GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error)
GetDepositAddress returns a deposit address for a specified currency
func (*HUOBIHADAX) GetDepositWithdrawalHistory ¶
func (h *HUOBIHADAX) GetDepositWithdrawalHistory(associatedID, currency string, isDeposit bool, size int64) ([]History, error)
GetDepositWithdrawalHistory returns deposit or withdrawal data
func (*HUOBIHADAX) GetDepth ¶
func (h *HUOBIHADAX) GetDepth(symbol, depthType string) (Orderbook, error)
GetDepth returns the depth for the specified symbol
func (*HUOBIHADAX) GetExchangeHistory ¶
func (h *HUOBIHADAX) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error)
GetExchangeHistory returns historic trade data since exchange opening.
func (*HUOBIHADAX) GetFee ¶
func (h *HUOBIHADAX) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFee returns an estimate of fee based on type of transaction
func (*HUOBIHADAX) GetFeeByType ¶
func (h *HUOBIHADAX) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFeeByType returns an estimate of fee based on type of transaction
func (*HUOBIHADAX) GetFundingHistory ¶
func (h *HUOBIHADAX) GetFundingHistory() ([]exchange.FundHistory, error)
GetFundingHistory returns funding history, deposits and withdrawals
func (*HUOBIHADAX) GetLatestSpotPrice ¶
func (h *HUOBIHADAX) GetLatestSpotPrice(symbol string) (float64, error)
GetLatestSpotPrice returns latest spot price of symbol
symbol: string of currency pair
func (*HUOBIHADAX) GetMarginAccountBalance ¶
func (h *HUOBIHADAX) GetMarginAccountBalance(symbol string) ([]MarginAccountBalance, error)
GetMarginAccountBalance returns the margin account balances
func (*HUOBIHADAX) GetMarginLoanOrders ¶
func (h *HUOBIHADAX) GetMarginLoanOrders(symbol, currency, start, end, states, from, direct, size string) ([]MarginOrder, error)
GetMarginLoanOrders returns the margin loan orders
func (*HUOBIHADAX) GetMarketDetail ¶
func (h *HUOBIHADAX) GetMarketDetail(symbol string) (Detail, error)
GetMarketDetail returns the ticker for the specified symbol
func (*HUOBIHADAX) GetMarketDetailMerged ¶
func (h *HUOBIHADAX) GetMarketDetailMerged(symbol string) (DetailMerged, error)
GetMarketDetailMerged returns the ticker for the specified symbol
func (*HUOBIHADAX) GetOpenOrders ¶
func (h *HUOBIHADAX) GetOpenOrders(accountID, symbol, side string, size int) ([]OrderInfo, error)
GetOpenOrders returns a list of orders
func (*HUOBIHADAX) GetOrder ¶
func (h *HUOBIHADAX) GetOrder(orderID int64) (OrderInfo, error)
GetOrder returns order information for the specified order
func (*HUOBIHADAX) GetOrderHistory ¶
func (h *HUOBIHADAX) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
GetOrderHistory retrieves account order information Can Limit response to specific order status
func (*HUOBIHADAX) GetOrderInfo ¶
func (h *HUOBIHADAX) GetOrderInfo(orderID string) (exchange.OrderDetail, error)
GetOrderInfo returns information on a current open order
func (*HUOBIHADAX) GetOrderMatchResults ¶
func (h *HUOBIHADAX) GetOrderMatchResults(orderID int64) ([]OrderMatchInfo, error)
GetOrderMatchResults returns matched order info for the specified order
func (*HUOBIHADAX) GetOrderbookEx ¶
GetOrderbookEx returns orderbook base on the currency pair
func (*HUOBIHADAX) GetOrders ¶
func (h *HUOBIHADAX) GetOrders(symbol, types, start, end, states, from, direct, size string) ([]OrderInfo, error)
GetOrders returns a list of orders
func (*HUOBIHADAX) GetOrdersMatch ¶
func (h *HUOBIHADAX) GetOrdersMatch(symbol, types, start, end, from, direct, size string) ([]OrderMatchInfo, error)
GetOrdersMatch returns a list of matched orders
func (*HUOBIHADAX) GetSpotKline ¶
func (h *HUOBIHADAX) GetSpotKline(arg KlinesRequestParams) ([]KlineItem, error)
GetSpotKline returns kline data KlinesRequestParams holds the Kline request params
func (*HUOBIHADAX) GetSubscriptions ¶
func (h *HUOBIHADAX) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)
GetSubscriptions returns a copied list of subscriptions
func (*HUOBIHADAX) GetSymbols ¶
func (h *HUOBIHADAX) GetSymbols() ([]Symbol, error)
GetSymbols returns an array of symbols supported by Huobi
func (*HUOBIHADAX) GetTickerPrice ¶
GetTickerPrice returns the ticker for a currency pair
func (*HUOBIHADAX) GetTimestamp ¶
func (h *HUOBIHADAX) GetTimestamp() (int64, error)
GetTimestamp returns the Huobi server time
func (*HUOBIHADAX) GetTradeHistory ¶
func (h *HUOBIHADAX) GetTradeHistory(symbol, size string) ([]TradeHistory, error)
GetTradeHistory returns the trades for the specified symbol
func (*HUOBIHADAX) GetTrades ¶
func (h *HUOBIHADAX) GetTrades(symbol string) ([]Trade, error)
GetTrades returns the trades for the specified symbol
func (*HUOBIHADAX) GetWebsocket ¶
func (h *HUOBIHADAX) GetWebsocket() (*wshandler.Websocket, error)
GetWebsocket returns a pointer to the exchange websocket
func (*HUOBIHADAX) MarginOrder ¶
func (h *HUOBIHADAX) MarginOrder(symbol, currency string, amount float64) (int64, error)
MarginOrder submits a margin order application
func (*HUOBIHADAX) MarginRepayment ¶
func (h *HUOBIHADAX) MarginRepayment(orderID int64, amount float64) (int64, error)
MarginRepayment repays a margin amount for a margin ID
func (*HUOBIHADAX) MarginTransfer ¶
func (h *HUOBIHADAX) MarginTransfer(symbol, currency string, amount float64, in bool) (int64, error)
MarginTransfer transfers assets into or out of the margin account
func (*HUOBIHADAX) ModifyOrder ¶
func (h *HUOBIHADAX) ModifyOrder(action *exchange.ModifyOrder) (string, error)
ModifyOrder will allow of changing orderbook placement and limit to market conversion
func (*HUOBIHADAX) SendAuthenticatedHTTPPostRequest ¶
func (h *HUOBIHADAX) SendAuthenticatedHTTPPostRequest(method, endpoint, postBodyValues string, result interface{}) error
SendAuthenticatedHTTPPostRequest sends authenticated requests to the HUOBI API
func (*HUOBIHADAX) SendAuthenticatedHTTPRequest ¶
func (h *HUOBIHADAX) SendAuthenticatedHTTPRequest(method, endpoint string, values url.Values, result interface{}) error
SendAuthenticatedHTTPRequest sends authenticated requests to the HUOBI API
func (*HUOBIHADAX) SendHTTPRequest ¶
func (h *HUOBIHADAX) SendHTTPRequest(path string, result interface{}) error
SendHTTPRequest sends an unauthenticated HTTP request
func (*HUOBIHADAX) SetDefaults ¶
func (h *HUOBIHADAX) SetDefaults()
SetDefaults sets default values for the exchange
func (*HUOBIHADAX) Setup ¶
func (h *HUOBIHADAX) Setup(exch *config.ExchangeConfig)
Setup sets user configuration
func (*HUOBIHADAX) SpotNewOrder ¶
func (h *HUOBIHADAX) SpotNewOrder(arg SpotNewOrderRequestParams) (int64, error)
SpotNewOrder submits an order to Huobi
func (*HUOBIHADAX) Start ¶
func (h *HUOBIHADAX) Start(wg *sync.WaitGroup)
Start starts the OKEX go routine
func (*HUOBIHADAX) SubmitOrder ¶
func (h *HUOBIHADAX) SubmitOrder(p currency.Pair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (exchange.SubmitOrderResponse, error)
SubmitOrder submits a new order
func (*HUOBIHADAX) Subscribe ¶
func (h *HUOBIHADAX) Subscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
Subscribe sends a websocket message to receive data from the channel
func (*HUOBIHADAX) SubscribeToWebsocketChannels ¶
func (h *HUOBIHADAX) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
SubscribeToWebsocketChannels appends to ChannelsToSubscribe which lets websocket.manageSubscriptions handle subscribing
func (*HUOBIHADAX) Unsubscribe ¶
func (h *HUOBIHADAX) Unsubscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
Unsubscribe sends a websocket message to stop receiving data from the channel
func (*HUOBIHADAX) UnsubscribeToWebsocketChannels ¶
func (h *HUOBIHADAX) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
UnsubscribeToWebsocketChannels removes from ChannelsToSubscribe which lets websocket.manageSubscriptions handle unsubscribing
func (*HUOBIHADAX) UpdateOrderbook ¶
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*HUOBIHADAX) UpdateTicker ¶
UpdateTicker updates and returns the ticker for a currency pair
func (*HUOBIHADAX) Withdraw ¶
func (h *HUOBIHADAX) Withdraw(c currency.Code, address, addrTag string, amount, fee float64) (int64, error)
Withdraw withdraws the desired amount and currency
func (*HUOBIHADAX) WithdrawCryptocurrencyFunds ¶
func (h *HUOBIHADAX) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted
func (*HUOBIHADAX) WithdrawFiatFunds ¶
func (h *HUOBIHADAX) WithdrawFiatFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted
func (*HUOBIHADAX) WithdrawFiatFundsToInternationalBank ¶
func (h *HUOBIHADAX) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted
func (*HUOBIHADAX) WsConnect ¶
func (h *HUOBIHADAX) WsConnect() error
WsConnect initiates a new websocket connection
func (*HUOBIHADAX) WsHandleData ¶
func (h *HUOBIHADAX) WsHandleData()
WsHandleData handles data read from the websocket connection
func (*HUOBIHADAX) WsProcessOrderbook ¶
func (h *HUOBIHADAX) WsProcessOrderbook(update *WsDepth, symbol string) error
WsProcessOrderbook processes new orderbook data
type History ¶
type History struct { ID int64 `json:"id"` Type string `json:"type"` Currency string `json:"currency"` TxHash string `json:"tx-hash"` Amount float64 `json:"amount"` Address string `json:"address"` Fee float64 `json:"fee"` State string `json:"state"` CreatedAt int64 `json:"created-at"` UpdatedAt int64 `json:"Updated-at"` }
History defines currency deposit or withdrawal data
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"` Vol float64 `json:"vol"` Count int `json:"count"` }
KlineItem stores a kline item
type KlinesRequestParams ¶
type KlinesRequestParams struct { Symbol string // Symbol; btcusdt, bccbtc...... Period TimeInterval // Kline data 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 OrderInfo ¶
type OrderInfo struct { ID int `json:"id"` Symbol string `json:"symbol"` AccountID float64 `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"` Fieldees float64 `json:"field-fees,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 int `json:"user-id"` Source string `json:"source"` State string `json:"state"` CanceledAt int `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 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 SpotNewOrderRequestParams ¶
type SpotNewOrderRequestParams struct { AccountID int `json:"account-id"` // 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"` // Order type as listed below (buy-market, sell-market etc) }
SpotNewOrderRequestParams holds the params required to place an order
type SpotNewOrderRequestParamsType ¶
type SpotNewOrderRequestParamsType string
SpotNewOrderRequestParamsType order types
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"` }
Symbol stores the symbol 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 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 currency.Pair `json:"symbol"` ClientID int64 `json:"cid,string,omitempty"` }
WsAuthenticatedAccountsListRequest request for account list authenticated connection
type WsAuthenticatedAccountsListResponse ¶
type WsAuthenticatedAccountsListResponse struct { WsAuthenticatedDataResponse 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 { WsAuthenticatedDataResponse 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 WsAuthenticatedDataResponse ¶
type WsAuthenticatedDataResponse struct { Op string `json:"op,omitempty"` Ts int64 `json:"ts,omitempty"` Topic string `json:"topic,omitempty"` ErrorCode int64 `json:"err-code,omitempty"` ErrorMessage string `json:"err-msg,omitempty"` Ping int64 `json:"ping,omitempty"` ClientID int64 `json:"cid,string,omitempty"` }
WsAuthenticatedDataResponse response from authenticated connection
type WsAuthenticatedOrderDetailResponse ¶
type WsAuthenticatedOrderDetailResponse struct { WsAuthenticatedDataResponse Data WsAuthenticatedOrdersListResponseData `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 currency.Pair `json:"symbol"` ClientID int64 `json:"cid,string,omitempty"` }
WsAuthenticatedOrdersListRequest request for orderslist authenticated connection
type WsAuthenticatedOrdersListResponse ¶
type WsAuthenticatedOrdersListResponse struct { WsAuthenticatedDataResponse Data []WsAuthenticatedOrdersListResponseData `json:"data"` }
WsAuthenticatedOrdersListResponse response from OrdersList authenticated endpoint
type WsAuthenticatedOrdersListResponseData ¶
type WsAuthenticatedOrdersListResponseData struct { ID int64 `json:"id"` Symbol currency.Pair `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"` FilledAmount float64 `json:"filled-amount,string"` FilledCashAmount float64 `json:"filled-cash-amount,string"` FilledFees float64 `json:"filled-fees,string"` FinishedAt int64 `json:"finished-at"` Source string `json:"source"` State string `json:"state"` CanceledAt int64 `json:"canceled-at"` }
WsAuthenticatedOrdersListResponseData contains order details
type WsAuthenticatedOrdersResponse ¶
type WsAuthenticatedOrdersResponse struct { WsAuthenticatedDataResponse 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 currency.Pair `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 { WsAuthenticatedDataResponse 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 currency.Pair `json:"symbol"` MatchID int64 `json:"match-id"` FilledCashAmount float64 `json:"filled-cash-amount,string"` Role string `json:"role"` OrderState string `json:"order-state"` }
WsAuthenticatedOrdersUpdateResponseData order updatedata
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 WsRequest ¶
type WsRequest struct { Topic string `json:"req,omitempty"` Subscribe string `json:"sub,omitempty"` Unsubscribe string `json:"unsub,omitempty"` ClientGeneratedID string `json:"id,omitempty"` }
WsRequest defines a request data structure
type WsResponse ¶
type WsResponse struct { TS int64 `json:"ts"` Status string `json:"status"` ErrorCode interface{} `json:"err-code"` ErrorMessage string `json:"err-msg"` Ping int64 `json:"ping"` Channel string `json:"ch"` Subscribed string `json:"subbed"` }
WsResponse defines a response from the websocket connection when there is an error
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