huobi

package
v1.5.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HB_POINT_ACCOUNT = "point"
	HB_SPOT_ACCOUNT  = "spot"
)

Variables

View Source
var (
	FuturesContractInfos []FuturesContractInfo
)
View Source
var HBPOINT = NewCurrency("HBPOINT", "")

Functions

func ParseCurrencyPairFromSpotWsCh added in v1.3.2

func ParseCurrencyPairFromSpotWsCh(ch string) goex.CurrencyPair

func ParseDepthFromResponse added in v1.3.2

func ParseDepthFromResponse(r DepthResponse) goex.Depth

Types

type AccountInfo

type AccountInfo struct {
	Id    string
	Type  string
	State string
}

type BaseResponse

type BaseResponse struct {
	Status  string          `json:"status"`
	Ch      string          `json:"ch"`
	Ts      int64           `json:"ts"`
	ErrCode int             `json:"err_code"`
	ErrMsg  string          `json:"err_msg"`
	Data    json.RawMessage `json:"data"`
}

type DepthResponse

type DepthResponse struct {
	Bids [][]float64
	Asks [][]float64
	Ts   int64 `json:"ts"`
}

type DetailResponse

type DetailResponse struct {
	Id     int64
	Open   float64
	Close  float64
	High   float64
	Low    float64
	Amount float64
	Vol    float64
	Count  int64
}

"id": 1539842340, "mrid": 268041138, "open": 6740.47, "close": 7800, "high": 7800, "low": 6726.13, "amount": 477.1200312075244664773339914558562673572, "vol": 32414, "count": 1716 }

type Hbdm

type Hbdm struct {
	// contains filtered or unexported fields
}

func NewHbdm

func NewHbdm(conf *APIConfig) *Hbdm

func (*Hbdm) FutureCancelOrder

func (dm *Hbdm) FutureCancelOrder(currencyPair CurrencyPair, contractType, orderId string) (bool, error)

func (*Hbdm) GetContractValue

func (dm *Hbdm) GetContractValue(currencyPair CurrencyPair) (float64, error)

func (*Hbdm) GetDeliveryTime

func (dm *Hbdm) GetDeliveryTime() (int, int, int, int)

func (*Hbdm) GetExchangeName

func (dm *Hbdm) GetExchangeName() string

func (*Hbdm) GetExchangeRate

func (dm *Hbdm) GetExchangeRate() (float64, error)

func (*Hbdm) GetFee

func (dm *Hbdm) GetFee() (float64, error)

func (*Hbdm) GetFutureDepth

func (dm *Hbdm) GetFutureDepth(currencyPair CurrencyPair, contractType string, size int) (*Depth, error)

func (*Hbdm) GetFutureEstimatedPrice

func (dm *Hbdm) GetFutureEstimatedPrice(currencyPair CurrencyPair) (float64, error)

func (*Hbdm) GetFutureIndex

func (dm *Hbdm) GetFutureIndex(currencyPair CurrencyPair) (float64, error)

func (*Hbdm) GetFutureOrder

func (dm *Hbdm) GetFutureOrder(orderId string, currencyPair CurrencyPair, contractType string) (*FutureOrder, error)

func (*Hbdm) GetFutureOrderHistory added in v1.3.2

func (dm *Hbdm) GetFutureOrderHistory(pair CurrencyPair, contractType string, optional ...OptionalParameter) ([]FutureOrder, error)

func (*Hbdm) GetFutureOrders

func (dm *Hbdm) GetFutureOrders(orderIds []string, currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)

func (*Hbdm) GetFuturePosition

func (dm *Hbdm) GetFuturePosition(currencyPair CurrencyPair, contractType string) ([]FuturePosition, error)

func (*Hbdm) GetFutureTicker

func (dm *Hbdm) GetFutureTicker(currencyPair CurrencyPair, contractType string) (*Ticker, error)

func (*Hbdm) GetFutureUserinfo

func (dm *Hbdm) GetFutureUserinfo(currencyPair ...CurrencyPair) (*FutureAccount, error)

func (*Hbdm) GetKlineRecords

func (dm *Hbdm) GetKlineRecords(contract_type string, currency CurrencyPair, period KlinePeriod, size int, opt ...OptionalParameter) ([]FutureKline, error)

func (*Hbdm) GetTrades

func (dm *Hbdm) GetTrades(contract_type string, currencyPair CurrencyPair, since int64) ([]Trade, error)

func (*Hbdm) GetUnfinishFutureOrders

func (dm *Hbdm) GetUnfinishFutureOrders(currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)

func (*Hbdm) LimitFuturesOrder added in v1.3.2

func (dm *Hbdm) LimitFuturesOrder(currencyPair CurrencyPair, contractType, price, amount string, openType int, opt ...LimitOrderOptionalParameter) (*FutureOrder, error)

func (*Hbdm) MarketFuturesOrder added in v1.3.2

func (dm *Hbdm) MarketFuturesOrder(currencyPair CurrencyPair, contractType, amount string, openType int) (*FutureOrder, error)

func (*Hbdm) PlaceFutureOrder

func (dm *Hbdm) PlaceFutureOrder(currencyPair CurrencyPair, contractType, price, amount string, openType, matchPrice int, leverRate float64) (string, error)

func (*Hbdm) PlaceFutureOrder2 added in v1.3.2

func (dm *Hbdm) PlaceFutureOrder2(currencyPair CurrencyPair, contractType, price, amount string, openType, matchPrice int, leverRate float64, opt ...LimitOrderOptionalParameter) (*FutureOrder, error)

type HbdmSwap added in v1.3.2

type HbdmSwap struct {
	// contains filtered or unexported fields
}

func NewHbdmSwap added in v1.3.2

func NewHbdmSwap(c *APIConfig) *HbdmSwap

func (*HbdmSwap) FutureCancelOrder added in v1.3.2

func (swap *HbdmSwap) FutureCancelOrder(currencyPair CurrencyPair, contractType, orderId string) (bool, error)

func (*HbdmSwap) GetContractValue added in v1.3.2

func (swap *HbdmSwap) GetContractValue(currencyPair CurrencyPair) (float64, error)

func (*HbdmSwap) GetDeliveryTime added in v1.3.2

func (swap *HbdmSwap) GetDeliveryTime() (int, int, int, int)

func (*HbdmSwap) GetExchangeName added in v1.3.2

func (swap *HbdmSwap) GetExchangeName() string

func (*HbdmSwap) GetFee added in v1.3.2

func (swap *HbdmSwap) GetFee() (float64, error)

func (*HbdmSwap) GetFutureDepth added in v1.3.2

func (swap *HbdmSwap) GetFutureDepth(currencyPair CurrencyPair, contractType string, size int) (*Depth, error)

func (*HbdmSwap) GetFutureEstimatedPrice added in v1.3.2

func (swap *HbdmSwap) GetFutureEstimatedPrice(currencyPair CurrencyPair) (float64, error)

func (*HbdmSwap) GetFutureIndex added in v1.3.2

func (swap *HbdmSwap) GetFutureIndex(currencyPair CurrencyPair) (float64, error)

func (*HbdmSwap) GetFutureOrder added in v1.3.2

func (swap *HbdmSwap) GetFutureOrder(orderId string, currencyPair CurrencyPair, contractType string) (*FutureOrder, error)

func (*HbdmSwap) GetFutureOrderHistory added in v1.3.2

func (swap *HbdmSwap) GetFutureOrderHistory(pair CurrencyPair, contractType string, optional ...OptionalParameter) ([]FutureOrder, error)

func (*HbdmSwap) GetFutureOrders added in v1.3.2

func (swap *HbdmSwap) GetFutureOrders(orderIds []string, currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)

func (*HbdmSwap) GetFuturePosition added in v1.3.2

func (swap *HbdmSwap) GetFuturePosition(currencyPair CurrencyPair, contractType string) ([]FuturePosition, error)

func (*HbdmSwap) GetFutureTicker added in v1.3.2

func (swap *HbdmSwap) GetFutureTicker(currencyPair CurrencyPair, contractType string) (*Ticker, error)

func (*HbdmSwap) GetFutureUserinfo added in v1.3.2

func (swap *HbdmSwap) GetFutureUserinfo(currencyPair ...CurrencyPair) (*FutureAccount, error)

func (*HbdmSwap) GetKlineRecords added in v1.3.2

func (swap *HbdmSwap) GetKlineRecords(contractType string, currency CurrencyPair, period KlinePeriod, size int, opt ...OptionalParameter) ([]FutureKline, error)

func (*HbdmSwap) GetTrades added in v1.3.2

func (swap *HbdmSwap) GetTrades(contractType string, currencyPair CurrencyPair, since int64) ([]Trade, error)

func (*HbdmSwap) GetUnfinishFutureOrders added in v1.3.2

func (swap *HbdmSwap) GetUnfinishFutureOrders(currencyPair CurrencyPair, contractType string) ([]FutureOrder, error)

func (*HbdmSwap) LimitFuturesOrder added in v1.3.2

func (swap *HbdmSwap) LimitFuturesOrder(currencyPair CurrencyPair, contractType, price, amount string, openType int, opt ...LimitOrderOptionalParameter) (*FutureOrder, error)

func (*HbdmSwap) MarketFuturesOrder added in v1.3.2

func (swap *HbdmSwap) MarketFuturesOrder(currencyPair CurrencyPair, contractType, amount string, openType int) (*FutureOrder, error)

func (*HbdmSwap) PlaceFutureOrder added in v1.3.2

func (swap *HbdmSwap) PlaceFutureOrder(currencyPair CurrencyPair, contractType, price, amount string, openType, matchPrice int, leverRate float64) (string, error)

type HbdmSwapWs added in v1.3.2

type HbdmSwapWs struct {
	*WsBuilder
	sync.Once
	// contains filtered or unexported fields
}

func NewHbdmLinearSwapWs added in v1.3.2

func NewHbdmLinearSwapWs() *HbdmSwapWs

构建usdt本位永续合约ws

func NewHbdmSwapWs added in v1.3.2

func NewHbdmSwapWs() *HbdmSwapWs

func (*HbdmSwapWs) DepthCallback added in v1.3.2

func (ws *HbdmSwapWs) DepthCallback(call func(depth *Depth))

func (*HbdmSwapWs) SetCallbacks added in v1.3.2

func (ws *HbdmSwapWs) SetCallbacks(tickerCallback func(*FutureTicker),
	depthCallback func(*Depth),
	tradeCallback func(*Trade, string))

func (*HbdmSwapWs) SubscribeDepth added in v1.3.2

func (ws *HbdmSwapWs) SubscribeDepth(pair CurrencyPair, contract string) error

func (*HbdmSwapWs) SubscribeTicker added in v1.3.2

func (ws *HbdmSwapWs) SubscribeTicker(pair CurrencyPair, contract string) error

func (*HbdmSwapWs) SubscribeTrade added in v1.3.2

func (ws *HbdmSwapWs) SubscribeTrade(pair CurrencyPair, contract string) error

func (*HbdmSwapWs) TickerCallback added in v1.3.2

func (ws *HbdmSwapWs) TickerCallback(call func(ticker *FutureTicker))

func (*HbdmSwapWs) TradeCallback added in v1.3.2

func (ws *HbdmSwapWs) TradeCallback(call func(trade *Trade, contract string))

type HbdmWs

type HbdmWs struct {
	*WsBuilder
	sync.Once
	// contains filtered or unexported fields
}

func NewHbdmWs

func NewHbdmWs() *HbdmWs

func (*HbdmWs) DepthCallback added in v1.3.2

func (hbdmWs *HbdmWs) DepthCallback(call func(depth *Depth))

func (*HbdmWs) SetCallbacks

func (hbdmWs *HbdmWs) SetCallbacks(tickerCallback func(*FutureTicker),
	depthCallback func(*Depth),
	tradeCallback func(*Trade, string))

func (*HbdmWs) SubscribeDepth

func (hbdmWs *HbdmWs) SubscribeDepth(pair CurrencyPair, contract string) error

func (*HbdmWs) SubscribeTicker

func (hbdmWs *HbdmWs) SubscribeTicker(pair CurrencyPair, contract string) error

func (*HbdmWs) SubscribeTrade

func (hbdmWs *HbdmWs) SubscribeTrade(pair CurrencyPair, contract string) error

func (*HbdmWs) TickerCallback added in v1.3.2

func (hbdmWs *HbdmWs) TickerCallback(call func(ticker *FutureTicker))

func (*HbdmWs) TradeCallback added in v1.3.2

func (hbdmWs *HbdmWs) TradeCallback(call func(trade *Trade, contract string))

type HuoBiPro

type HuoBiPro struct {
	Symbols map[string]HuoBiProSymbol
	// contains filtered or unexported fields
}

func NewHuoBiPro

func NewHuoBiPro(client *http.Client, apikey, secretkey, accountId string) *HuoBiPro

func NewHuoBiProPoint

func NewHuoBiProPoint(client *http.Client, apikey, secretkey string) *HuoBiPro

*

  • 点卡账户

func NewHuoBiProSpot

func NewHuoBiProSpot(client *http.Client, apikey, secretkey string) *HuoBiPro

*

*现货交易

func NewHuobiWithConfig added in v1.3.2

func NewHuobiWithConfig(config *APIConfig) *HuoBiPro

func (*HuoBiPro) CancelOrder

func (hbpro *HuoBiPro) CancelOrder(orderId string, currency CurrencyPair) (bool, error)

func (*HuoBiPro) GetAccount

func (hbpro *HuoBiPro) GetAccount() (*Account, error)

func (*HuoBiPro) GetAccountInfo

func (hbpro *HuoBiPro) GetAccountInfo(acc string) (AccountInfo, error)

func (*HuoBiPro) GetCurrenciesList

func (hbpro *HuoBiPro) GetCurrenciesList() ([]string, error)

func (*HuoBiPro) GetCurrenciesPrecision

func (hbpro *HuoBiPro) GetCurrenciesPrecision() ([]HuoBiProSymbol, error)

func (*HuoBiPro) GetDepth

func (hbpro *HuoBiPro) GetDepth(size int, currency CurrencyPair) (*Depth, error)

func (*HuoBiPro) GetExchangeName

func (hbpro *HuoBiPro) GetExchangeName() string

func (*HuoBiPro) GetKlineRecords

func (hbpro *HuoBiPro) GetKlineRecords(currency CurrencyPair, period KlinePeriod, size int, optional ...OptionalParameter) ([]Kline, error)

倒序

func (*HuoBiPro) GetOneOrder

func (hbpro *HuoBiPro) GetOneOrder(orderId string, currency CurrencyPair) (*Order, error)

func (*HuoBiPro) GetOrderHistorys

func (hbpro *HuoBiPro) GetOrderHistorys(currency CurrencyPair, optional ...OptionalParameter) ([]Order, error)

func (*HuoBiPro) GetTicker

func (hbpro *HuoBiPro) GetTicker(currencyPair CurrencyPair) (*Ticker, error)

func (*HuoBiPro) GetTrades

func (hbpro *HuoBiPro) GetTrades(currencyPair CurrencyPair, since int64) ([]Trade, error)

func (*HuoBiPro) GetUnfinishOrders

func (hbpro *HuoBiPro) GetUnfinishOrders(currency CurrencyPair) ([]Order, error)

func (*HuoBiPro) LimitBuy

func (hbpro *HuoBiPro) LimitBuy(amount, price string, currency CurrencyPair, opt ...LimitOrderOptionalParameter) (*Order, error)

func (*HuoBiPro) LimitSell

func (hbpro *HuoBiPro) LimitSell(amount, price string, currency CurrencyPair, opt ...LimitOrderOptionalParameter) (*Order, error)

func (*HuoBiPro) MarketBuy

func (hbpro *HuoBiPro) MarketBuy(amount, price string, currency CurrencyPair) (*Order, error)

func (*HuoBiPro) MarketSell

func (hbpro *HuoBiPro) MarketSell(amount, price string, currency CurrencyPair) (*Order, error)

type HuoBiProSymbol

type HuoBiProSymbol struct {
	BaseCurrency    string
	QuoteCurrency   string
	PricePrecision  float64
	AmountPrecision float64
	MinAmount       float64
	MinValue        float64
	SymbolPartition string
	Symbol          string
}

type OrderInfo

type OrderInfo struct {
	Symbol         string  `json:"symbol"`
	ContractType   string  `json:"contract_type"`
	ContractCode   string  `json:"contract_code"`
	Volume         float64 `json:"volume"`
	Price          float64 `json:"price"`
	OrderPriceType string  `json:"order_price_type"`
	Direction      string  `json:"direction"`
	Offset         string  `json:"offset"`
	LeverRate      float64 `json:"lever_rate"`
	OrderId        int64   `json:"order_id"`
	ClientOrderId  int64   `json:"client_order_id"`
	OrderSource    string  `json:"order_source"`
	CreatedAt      int64   `json:"created_at"`
	CreateDate     int64   `json:"create_date"` //for swap contract
	TradeVolume    float64 `json:"trade_volume"`
	TradeTurnover  float64 `json:"trade_turnover"`
	Fee            float64 `json:"fee"`
	TradeAvgPrice  float64 `json:"trade_avg_price"`
	MarginFrozen   float64 `json:"margin_frozen"`
	Status         int     `json:"status"`
}

type SpotWs added in v1.3.2

type SpotWs struct {
	*WsBuilder
	sync.Once
	// contains filtered or unexported fields
}

func NewSpotWs added in v1.3.2

func NewSpotWs() *SpotWs

func (*SpotWs) DepthCallback added in v1.3.2

func (ws *SpotWs) DepthCallback(call func(depth *Depth))

func (*SpotWs) SubscribeDepth added in v1.3.2

func (ws *SpotWs) SubscribeDepth(pair CurrencyPair) error

func (*SpotWs) SubscribeTicker added in v1.3.2

func (ws *SpotWs) SubscribeTicker(pair CurrencyPair) error

func (*SpotWs) SubscribeTrade added in v1.3.2

func (ws *SpotWs) SubscribeTrade(pair CurrencyPair) error

func (*SpotWs) TickerCallback added in v1.3.2

func (ws *SpotWs) TickerCallback(call func(ticker *Ticker))

func (*SpotWs) TradeCallback added in v1.3.2

func (ws *SpotWs) TradeCallback(call func(trade *Trade))

type TradeResponse

type TradeResponse struct {
	Id   int64
	Ts   int64
	Data []struct {
		Id        int64
		Amount    float64
		Price     float64
		Direction string
		Ts        int64
	}
}

type Wallet added in v1.3.2

type Wallet struct {
	// contains filtered or unexported fields
}

func NewWallet added in v1.3.2

func NewWallet(c *APIConfig) *Wallet

func (*Wallet) GetAccount added in v1.3.2

func (w *Wallet) GetAccount() (*Account, error)

获取钱包资产

func (*Wallet) GetDepositHistory added in v1.3.2

func (w *Wallet) GetDepositHistory(currency *Currency) ([]DepositWithdrawHistory, error)

func (*Wallet) GetWithDrawHistory added in v1.3.2

func (w *Wallet) GetWithDrawHistory(currency *Currency) ([]DepositWithdrawHistory, error)

func (*Wallet) Transfer added in v1.3.2

func (w *Wallet) Transfer(param TransferParameter) error

func (*Wallet) Withdrawal added in v1.3.2

func (w *Wallet) Withdrawal(param WithdrawParameter) (withdrawId string, err error)

type WsResponse

type WsResponse struct {
	Ch   string
	Ts   int64
	Tick json.RawMessage
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL