huobi

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var HBPOINT = NewCurrency("HBPOINT", "")

Functions

This section is empty.

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
}

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) 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() (*FutureAccount, error)

func (*Hbdm) GetKlineRecords

func (dm *Hbdm) GetKlineRecords(contract_type string, currency CurrencyPair, period, size, since int) ([]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) PlaceFutureOrder

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

type HbdmWs

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

func NewHbdmWs

func NewHbdmWs() *HbdmWs

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, size int) 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

type HuoBiPro

type HuoBiPro struct {
	// 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 (*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, size, since int) ([]Kline, error)

倒序

func (*HuoBiPro) GetOneOrder

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

func (*HuoBiPro) GetOrderHistorys

func (hbpro *HuoBiPro) GetOrderHistorys(currency CurrencyPair, currentPage, pageSize int) ([]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)

非个人,整个交易所的交易记录 https://github.com/huobiapi/API_Docs/wiki/REST_api_reference#get-markettrade-获取-trade-detail-数据

func (*HuoBiPro) GetUnfinishOrders

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

func (*HuoBiPro) LimitBuy

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

func (*HuoBiPro) LimitSell

func (hbpro *HuoBiPro) LimitSell(amount, price string, currency CurrencyPair) (*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
	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      int     `json:"lever_rate"`
	OrderId        int64   `json:"order_id"`
	ClientOrderId  int64   `json:"client_order_id"`
	OrderSource    string  `json:"order_source"`
	CreatedAt      int64   `json:"created_at"`
	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 TradeResponse

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

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