Documentation
¶
Index ¶
- Constants
- Variables
- func ParseCurrencyPairFromSpotWsCh(ch string) common.TradingPair
- func ParseDepthFromResponse(r DepthResponse) common.Depth
- type AccountInfo
- type BaseResponse
- type DepthResponse
- type DetailResponse
- type Hbdm
- func (dm *Hbdm) FutureCancelOrder(currencyPair common.TradingPair, contractType, orderId string) (bool, error)
- func (dm *Hbdm) GetContractValue(currencyPair common.TradingPair) (float64, error)
- func (dm *Hbdm) GetDeliveryTime() (int, int, int, int)
- func (dm *Hbdm) GetExchangeName() string
- func (dm *Hbdm) GetExchangeRate() (float64, error)
- func (dm *Hbdm) GetFee() (float64, error)
- func (dm *Hbdm) GetFutureDepth(currencyPair common.TradingPair, contractType string, size int) (*common.Depth, error)
- func (dm *Hbdm) GetFutureEstimatedPrice(currencyPair common.TradingPair) (float64, error)
- func (dm *Hbdm) GetFutureIndex(currencyPair common.TradingPair) (float64, error)
- func (dm *Hbdm) GetFutureOrder(orderId string, currencyPair common.TradingPair, contractType string) (*common.FutureOrder, error)
- func (dm *Hbdm) GetFutureOrders(orderIds []string, currencyPair common.TradingPair, contractType string) ([]common.FutureOrder, error)
- func (dm *Hbdm) GetFuturePosition(currencyPair common.TradingPair, contractType string) ([]common.FuturePosition, error)
- func (dm *Hbdm) GetFutureTicker(currencyPair common.TradingPair, contractType string) (*common.Ticker, error)
- func (dm *Hbdm) GetFutureUserinfo(currencyPair ...common.TradingPair) (*common.FutureAccount, error)
- func (dm *Hbdm) GetKlineRecords(contract_type string, currency common.TradingPair, period, size, since int) ([]common.FutureKline, error)
- func (dm *Hbdm) GetTrades(contract_type string, currencyPair common.TradingPair, since int64) ([]common.Trade, error)
- func (dm *Hbdm) GetUnfinishFutureOrders(currencyPair common.TradingPair, contractType string) ([]common.FutureOrder, error)
- func (dm *Hbdm) LimitFuturesOrder(currencyPair common.TradingPair, contractType, price, amount string, ...) (*common.FutureOrder, error)
- func (dm *Hbdm) MarketFuturesOrder(currencyPair common.TradingPair, contractType, amount string, openType int) (*common.FutureOrder, error)
- func (dm *Hbdm) PlaceFutureOrder(currencyPair common.TradingPair, contractType, price, amount string, ...) (string, error)
- func (dm *Hbdm) PlaceFutureOrder2(currencyPair common.TradingPair, contractType, price, amount string, ...) (*common.FutureOrder, error)
- type HbdmWs
- func (hbdmWs *HbdmWs) DepthCallback(call func(depth *common.Depth))
- func (hbdmWs *HbdmWs) SetCallbacks(tickerCallback func(*common.FutureTicker), depthCallback func(*common.Depth), ...)
- func (hbdmWs *HbdmWs) SubscribeDepth(pair common.TradingPair, contract string) error
- func (hbdmWs *HbdmWs) SubscribeTicker(pair common.TradingPair, contract string) error
- func (hbdmWs *HbdmWs) SubscribeTrade(pair common.TradingPair, contract string) error
- func (hbdmWs *HbdmWs) TickerCallback(call func(ticker *common.FutureTicker))
- func (hbdmWs *HbdmWs) TradeCallback(call func(trade *common.Trade, contract string))
- type HuoBiPro
- func NewHuoBiPro(client *http.Client, apikey, secretkey, accountId string) *HuoBiPro
- func NewHuoBiProPoint(client *http.Client, apikey, secretkey string) *HuoBiPro
- func NewHuoBiProSpot(client *http.Client, apikey, secretkey string) *HuoBiPro
- func NewHuobiWithConfig(config *common.APIConfig) *HuoBiPro
- func (hbpro *HuoBiPro) CancelOrder(orderId string, currency common.TradingPair) (bool, error)
- func (hbpro *HuoBiPro) GetAccount() (*common.Account, error)
- func (hbpro *HuoBiPro) GetAccountInfo(acc string) (AccountInfo, error)
- func (hbpro *HuoBiPro) GetCurrenciesList() ([]string, error)
- func (hbpro *HuoBiPro) GetCurrenciesPrecision() ([]HuoBiProSymbol, error)
- func (hbpro *HuoBiPro) GetDepth(size int, currency common.TradingPair) (*common.Depth, error)
- func (hbpro *HuoBiPro) GetExchangeName() string
- func (hbpro *HuoBiPro) GetKlineRecords(currency common.TradingPair, period, size, since int) ([]common.Kline, error)
- func (hbpro *HuoBiPro) GetOneOrder(orderId string, currency common.TradingPair) (*common.Order, error)
- func (hbpro *HuoBiPro) GetOrderHistorys(currency common.TradingPair, currentPage, pageSize int) ([]common.Order, error)
- func (hbpro *HuoBiPro) GetTicker(currencyPair common.TradingPair) (*common.Ticker, error)
- func (hbpro *HuoBiPro) GetTrades(currencyPair common.TradingPair, since int64) ([]common.Trade, error)
- func (hbpro *HuoBiPro) GetUnfinishOrders(currency common.TradingPair) ([]common.Order, error)
- func (hbpro *HuoBiPro) LimitBuy(amount, price string, currency common.TradingPair, ...) (*common.Order, error)
- func (hbpro *HuoBiPro) LimitSell(amount, price string, currency common.TradingPair, ...) (*common.Order, error)
- func (hbpro *HuoBiPro) MarketBuy(amount, price string, currency common.TradingPair) (*common.Order, error)
- func (hbpro *HuoBiPro) MarketSell(amount, price string, currency common.TradingPair) (*common.Order, error)
- type HuoBiProSymbol
- type OrderInfo
- type SpotWs
- func (ws *SpotWs) DepthCallback(call func(depth *common.Depth))
- func (ws *SpotWs) SubscribeDepth(pair common.TradingPair) error
- func (ws *SpotWs) SubscribeTicker(pair common.TradingPair) error
- func (ws *SpotWs) SubscribeTrade(pair common.TradingPair) error
- func (ws *SpotWs) TickerCallback(call func(ticker *common.Ticker))
- func (ws *SpotWs) TradeCallback(call func(trade *common.Trade))
- type TradeResponse
- type WsResponse
Constants ¶
View Source
const ( HB_POINT_ACCOUNT = "point" HB_SPOT_ACCOUNT = "spot" )
Variables ¶
View Source
var (
FuturesContractInfos []common.FuturesContractInfo
)
View Source
var HBPOINT = common.NewCurrency("HBPOINT", "")
Functions ¶
func ParseCurrencyPairFromSpotWsCh ¶
func ParseCurrencyPairFromSpotWsCh(ch string) common.TradingPair
func ParseDepthFromResponse ¶
func ParseDepthFromResponse(r DepthResponse) common.Depth
Types ¶
type AccountInfo ¶
type BaseResponse ¶
type DepthResponse ¶
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 (*Hbdm) FutureCancelOrder ¶
func (*Hbdm) GetContractValue ¶
func (dm *Hbdm) GetContractValue(currencyPair common.TradingPair) (float64, error)
func (*Hbdm) GetExchangeName ¶
func (*Hbdm) GetExchangeRate ¶
func (*Hbdm) GetFutureDepth ¶
func (*Hbdm) GetFutureEstimatedPrice ¶
func (dm *Hbdm) GetFutureEstimatedPrice(currencyPair common.TradingPair) (float64, error)
func (*Hbdm) GetFutureIndex ¶
func (dm *Hbdm) GetFutureIndex(currencyPair common.TradingPair) (float64, error)
func (*Hbdm) GetFutureOrder ¶
func (dm *Hbdm) GetFutureOrder(orderId string, currencyPair common.TradingPair, contractType string) (*common.FutureOrder, error)
func (*Hbdm) GetFutureOrders ¶
func (dm *Hbdm) GetFutureOrders(orderIds []string, currencyPair common.TradingPair, contractType string) ([]common.FutureOrder, error)
func (*Hbdm) GetFuturePosition ¶
func (dm *Hbdm) GetFuturePosition(currencyPair common.TradingPair, contractType string) ([]common.FuturePosition, error)
func (*Hbdm) GetFutureTicker ¶
func (*Hbdm) GetFutureUserinfo ¶
func (dm *Hbdm) GetFutureUserinfo(currencyPair ...common.TradingPair) (*common.FutureAccount, error)
func (*Hbdm) GetKlineRecords ¶
func (dm *Hbdm) GetKlineRecords(contract_type string, currency common.TradingPair, period, size, since int) ([]common.FutureKline, error)
func (*Hbdm) GetUnfinishFutureOrders ¶
func (dm *Hbdm) GetUnfinishFutureOrders(currencyPair common.TradingPair, contractType string) ([]common.FutureOrder, error)
func (*Hbdm) LimitFuturesOrder ¶
func (dm *Hbdm) LimitFuturesOrder(currencyPair common.TradingPair, contractType, price, amount string, openType int, opt ...common.LimitOrderOptionalParameter) (*common.FutureOrder, error)
func (*Hbdm) MarketFuturesOrder ¶
func (dm *Hbdm) MarketFuturesOrder(currencyPair common.TradingPair, contractType, amount string, openType int) (*common.FutureOrder, error)
func (*Hbdm) PlaceFutureOrder ¶
func (*Hbdm) PlaceFutureOrder2 ¶
func (dm *Hbdm) PlaceFutureOrder2(currencyPair common.TradingPair, contractType, price, amount string, openType, matchPrice int, leverRate float64, opt ...common.LimitOrderOptionalParameter) (*common.FutureOrder, error)
type HbdmWs ¶
func (*HbdmWs) DepthCallback ¶
func (*HbdmWs) SetCallbacks ¶
func (*HbdmWs) SubscribeDepth ¶
func (hbdmWs *HbdmWs) SubscribeDepth(pair common.TradingPair, contract string) error
func (*HbdmWs) SubscribeTicker ¶
func (hbdmWs *HbdmWs) SubscribeTicker(pair common.TradingPair, contract string) error
func (*HbdmWs) SubscribeTrade ¶
func (hbdmWs *HbdmWs) SubscribeTrade(pair common.TradingPair, contract string) error
func (*HbdmWs) TickerCallback ¶
func (hbdmWs *HbdmWs) TickerCallback(call func(ticker *common.FutureTicker))
type HuoBiPro ¶
type HuoBiPro struct {
Symbols map[string]HuoBiProSymbol
// contains filtered or unexported fields
}
func NewHuoBiPro ¶
func NewHuobiWithConfig ¶
func (*HuoBiPro) CancelOrder ¶
func (*HuoBiPro) GetAccountInfo ¶
func (hbpro *HuoBiPro) GetAccountInfo(acc string) (AccountInfo, error)
func (*HuoBiPro) GetCurrenciesList ¶
func (*HuoBiPro) GetCurrenciesPrecision ¶
func (hbpro *HuoBiPro) GetCurrenciesPrecision() ([]HuoBiProSymbol, error)
func (*HuoBiPro) GetExchangeName ¶
func (*HuoBiPro) GetKlineRecords ¶
func (hbpro *HuoBiPro) GetKlineRecords(currency common.TradingPair, period, size, since int) ([]common.Kline, error)
倒序
func (*HuoBiPro) GetOneOrder ¶
func (*HuoBiPro) GetOrderHistorys ¶
func (*HuoBiPro) GetTrades ¶
func (hbpro *HuoBiPro) GetTrades(currencyPair common.TradingPair, since int64) ([]common.Trade, error)
非个人,整个交易所的交易记录 https://github.com/huobiapi/API_Docs/wiki/REST_api_reference#get-markettrade-获取-trade-detail-数据
func (*HuoBiPro) GetUnfinishOrders ¶
func (*HuoBiPro) LimitBuy ¶
func (hbpro *HuoBiPro) LimitBuy(amount, price string, currency common.TradingPair, opt ...common.LimitOrderOptionalParameter) (*common.Order, error)
func (*HuoBiPro) LimitSell ¶
func (hbpro *HuoBiPro) LimitSell(amount, price string, currency common.TradingPair, opt ...common.LimitOrderOptionalParameter) (*common.Order, error)
func (*HuoBiPro) MarketSell ¶
type HuoBiProSymbol ¶
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"`
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 ¶
func (*SpotWs) DepthCallback ¶
func (*SpotWs) SubscribeDepth ¶
func (ws *SpotWs) SubscribeDepth(pair common.TradingPair) error
func (*SpotWs) SubscribeTicker ¶
func (ws *SpotWs) SubscribeTicker(pair common.TradingPair) error
func (*SpotWs) SubscribeTrade ¶
func (ws *SpotWs) SubscribeTrade(pair common.TradingPair) error
func (*SpotWs) TickerCallback ¶
func (*SpotWs) TradeCallback ¶
type TradeResponse ¶
type WsResponse ¶
type WsResponse struct {
Ch string
Ts int64
Tick json.RawMessage
}
Click to show internal directories.
Click to hide internal directories.