Documentation ¶
Index ¶
- Variables
- type Account
- type AccountBalance
- type AccountBalanceDetail
- type CancelOrderBatch
- type Detail
- type DetailMerged
- type HUOBIHADAX
- func (h *HUOBIHADAX) CancelAllExchangeOrders() error
- func (h *HUOBIHADAX) CancelExchangeOrder(orderID int64) error
- func (h *HUOBIHADAX) CancelOrder(orderID int64) (int64, error)
- func (h *HUOBIHADAX) CancelOrderBatch(orderIDs []int64) (CancelOrderBatch, error)
- func (h *HUOBIHADAX) CancelWithdraw(withdrawID int64) (int64, error)
- func (h *HUOBIHADAX) GetAccountBalance(accountID string) ([]AccountBalanceDetail, error)
- func (h *HUOBIHADAX) GetAccounts() ([]Account, error)
- func (h *HUOBIHADAX) GetCurrencies() ([]string, error)
- func (h *HUOBIHADAX) GetDepth(symbol, depthType string) (Orderbook, error)
- func (h *HUOBIHADAX) GetExchangeAccountInfo() (exchange.AccountInfo, error)
- func (h *HUOBIHADAX) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error)
- func (h *HUOBIHADAX) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error)
- func (h *HUOBIHADAX) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error)
- func (h *HUOBIHADAX) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error)
- func (h *HUOBIHADAX) GetFee() float64
- 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) GetOrder(orderID int64) (OrderInfo, error)
- func (h *HUOBIHADAX) GetOrderMatchResults(orderID int64) ([]OrderMatchInfo, error)
- func (h *HUOBIHADAX) GetOrderbookEx(p pair.CurrencyPair, 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) GetSymbols() ([]Symbol, error)
- func (h *HUOBIHADAX) GetTickerPrice(p pair.CurrencyPair, 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) 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) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, 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) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, ...) (int64, error)
- func (h *HUOBIHADAX) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.Base, error)
- func (h *HUOBIHADAX) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price, error)
- func (h *HUOBIHADAX) Withdraw(address, currency, addrTag string, amount, fee float64) (int64, error)
- func (h *HUOBIHADAX) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error)
- func (h *HUOBIHADAX) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error)
- func (h *HUOBIHADAX) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error)
- 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
Constants ¶
This section is empty.
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"` State string `json:"working"` 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 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 {
exchange.Base
}
HUOBIHADAX is the overarching type across this package
func (*HUOBIHADAX) CancelAllExchangeOrders ¶
func (h *HUOBIHADAX) CancelAllExchangeOrders() error
CancelAllExchangeOrders cancels all orders associated with a currency pair
func (*HUOBIHADAX) CancelExchangeOrder ¶
func (h *HUOBIHADAX) CancelExchangeOrder(orderID int64) error
CancelExchangeOrder cancels an order by its corresponding ID number
func (*HUOBIHADAX) CancelOrder ¶
func (h *HUOBIHADAX) CancelOrder(orderID int64) (int64, error)
CancelOrder cancels an order on Huobi
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) GetAccountBalance ¶
func (h *HUOBIHADAX) GetAccountBalance(accountID string) ([]AccountBalanceDetail, error)
GetAccountBalance returns the users Huobi account balance
func (*HUOBIHADAX) GetAccounts ¶
func (h *HUOBIHADAX) GetAccounts() ([]Account, error)
GetAccounts returns the Huobi user accounts
func (*HUOBIHADAX) GetCurrencies ¶
func (h *HUOBIHADAX) GetCurrencies() ([]string, error)
GetCurrencies returns a list of currencies supported by Huobi
func (*HUOBIHADAX) GetDepth ¶
func (h *HUOBIHADAX) GetDepth(symbol, depthType string) (Orderbook, error)
GetDepth returns the depth for the specified symbol
func (*HUOBIHADAX) GetExchangeAccountInfo ¶
func (h *HUOBIHADAX) GetExchangeAccountInfo() (exchange.AccountInfo, error)
GetExchangeAccountInfo retrieves balances for all enabled currencies for the HUOBIHADAX exchange - to-do
func (*HUOBIHADAX) GetExchangeDepositAddress ¶
func (h *HUOBIHADAX) GetExchangeDepositAddress(cryptocurrency pair.CurrencyItem) (string, error)
GetExchangeDepositAddress returns a deposit address for a specified currency
func (*HUOBIHADAX) GetExchangeFundTransferHistory ¶
func (h *HUOBIHADAX) GetExchangeFundTransferHistory() ([]exchange.FundHistory, error)
GetExchangeFundTransferHistory returns funding history, deposits and withdrawals
func (*HUOBIHADAX) GetExchangeHistory ¶
func (h *HUOBIHADAX) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error)
GetExchangeHistory returns historic trade data since exchange opening.
func (*HUOBIHADAX) GetExchangeOrderInfo ¶
func (h *HUOBIHADAX) GetExchangeOrderInfo(orderID int64) (exchange.OrderDetail, error)
GetExchangeOrderInfo returns information on a current open order
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) GetOrder ¶
func (h *HUOBIHADAX) GetOrder(orderID int64) (OrderInfo, error)
GetOrder returns order information for the specified order
func (*HUOBIHADAX) GetOrderMatchResults ¶
func (h *HUOBIHADAX) GetOrderMatchResults(orderID int64) ([]OrderMatchInfo, error)
GetOrderMatchResults returns matched order info for the specified order
func (*HUOBIHADAX) GetOrderbookEx ¶
func (h *HUOBIHADAX) GetOrderbookEx(p pair.CurrencyPair, assetType string) (orderbook.Base, error)
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) GetSymbols ¶
func (h *HUOBIHADAX) GetSymbols() ([]Symbol, error)
GetSymbols returns an array of symbols supported by Huobi
func (*HUOBIHADAX) GetTickerPrice ¶
func (h *HUOBIHADAX) GetTickerPrice(p pair.CurrencyPair, assetType string) (ticker.Price, error)
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) 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) ModifyExchangeOrder ¶
func (h *HUOBIHADAX) ModifyExchangeOrder(orderID int64, action exchange.ModifyOrder) (int64, error)
ModifyExchangeOrder 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) SubmitExchangeOrder ¶
func (h *HUOBIHADAX) SubmitExchangeOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (int64, error)
SubmitExchangeOrder submits a new order
func (*HUOBIHADAX) UpdateOrderbook ¶
func (h *HUOBIHADAX) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.Base, error)
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*HUOBIHADAX) UpdateTicker ¶
func (h *HUOBIHADAX) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price, error)
UpdateTicker updates and returns the ticker for a currency pair
func (*HUOBIHADAX) Withdraw ¶
func (h *HUOBIHADAX) Withdraw(address, currency, addrTag string, amount, fee float64) (int64, error)
Withdraw withdraws the desired amount and currency
func (*HUOBIHADAX) WithdrawCryptoExchangeFunds ¶
func (h *HUOBIHADAX) WithdrawCryptoExchangeFunds(address string, cryptocurrency pair.CurrencyItem, amount float64) (string, error)
WithdrawCryptoExchangeFunds returns a withdrawal ID when a withdrawal is submitted
func (*HUOBIHADAX) WithdrawFiatExchangeFunds ¶
func (h *HUOBIHADAX) WithdrawFiatExchangeFunds(currency pair.CurrencyItem, amount float64) (string, error)
WithdrawFiatExchangeFunds returns a withdrawal ID when a withdrawal is submitted
func (*HUOBIHADAX) WithdrawFiatExchangeFundsToInternationalBank ¶
func (h *HUOBIHADAX) WithdrawFiatExchangeFundsToInternationalBank(currency pair.CurrencyItem, amount float64) (string, error)
WithdrawFiatExchangeFundsToInternationalBank 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"` 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 int `json:"account-id"` Amount string `json:"amount"` Price string `json:"price"` CreatedAt int64 `json:"created-at"` Type string `json:"type"` FieldAmount string `json:"field-amount"` FieldCashAmount string `json:"field-cash-amount"` FieldFees string `json:"field-fees"` 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