Documentation
¶
Index ¶
- Constants
- type CandleSlice
- type Client
- func (c *Client) AllSymbols(ctx context.Context) (s []exchange.Symbol, err error)
- func (c *Client) BuyLimit(symbol, clientOrderId string, price, amount decimal.Decimal) (orderId uint64, err error)
- func (c *Client) BuyMarket(symbol exchange.Symbol, clientOrderId string, total decimal.Decimal) (orderId uint64, err error)
- func (c *Client) BuyStopLimit(symbol, clientOrderId string, price, amount, stopPrice decimal.Decimal) (orderId uint64, err error)
- func (c *Client) CancelOrder(_ string, orderId uint64) error
- func (c *Client) CandleBySize(symbol string, period time.Duration, size int) (hs.Candle, error)
- func (c *Client) CandleFrom(symbol, clientId string, period time.Duration, from, to time.Time) (hs.Candle, error)
- func (c Client) FormatSymbol(base, quote string) string
- func (c *Client) GetAccountInfo() ([]account.AccountInfo, error)
- func (c *Client) GetFee(symbol string) (fee exchange.Fee, err error)
- func (c *Client) GetOrderById(orderId uint64, _ string) (exchange.Order, error)
- func (c *Client) GetSpotAccountId() (int64, error)
- func (c *Client) GetSymbol(ctx context.Context, symbol string) (s exchange.Symbol, err error)
- func (c *Client) GetTimestamp() (int, error)
- func (c *Client) IsFullFilled(symbol string, orderId uint64) (order exchange.Order, filled bool, err error)
- func (c *Client) Last24hVolume(symbol string) (decimal.Decimal, error)
- func (c *Client) LastPrice(symbol string) (decimal.Decimal, error)
- func (c *Client) PlaceOrder(request *order.PlaceOrderRequest) (uint64, error)
- func (c *Client) SellLimit(symbol, clientOrderId string, price, amount decimal.Decimal) (orderId uint64, err error)
- func (c *Client) SellMarket(symbol exchange.Symbol, clientOrderId string, total decimal.Decimal) (orderId uint64, err error)
- func (c *Client) SellStopLimit(symbol, clientOrderId string, price, amount, stopPrice decimal.Decimal) (orderId uint64, err error)
- func (c *Client) SpotAvailableBalance() (map[string]decimal.Decimal, error)
- func (c *Client) SpotBalance() (map[string]decimal.Decimal, error)
- func (c *Client) SpotLimitOrder(orderType, symbol, clientOrderId string, price, amount decimal.Decimal) (uint64, error)
- func (c *Client) SpotMarketOrder(orderType, symbol, clientOrderId string, total decimal.Decimal) (uint64, error)
- func (c *Client) SpotStopLimitOrder(orderType, symbol, clientOrderId, operator string, ...) (uint64, error)
- func (c *Client) SubscribeAccountUpdate(clientId string, responseHandler websocketclientbase.ResponseHandler)
- func (c *Client) SubscribeCandlestick(symbol, clientId string, period time.Duration, ...)
- func (c *Client) SubscribeCandlestickWithReq(symbol, clientId string, period time.Duration, ...)
- func (c *Client) SubscribeLast24hCandlestick(ctx context.Context, symbol, clientId string, ...) error
- func (c *Client) SubscribeOrder(symbol, clientId string, responseHandler exchange.ResponseHandler)
- func (c *Client) SubscribeTradeClear(symbol, clientId string, responseHandler websocketclientbase.ResponseHandler)
- func (c *Client) UnsubscribeAccountUpdate(clientId string)
- func (c *Client) UnsubscribeCandlestick(symbol, clientId string, period time.Duration)
- func (c *Client) UnsubscribeCandlestickWithReq(symbol, clientId string, period time.Duration)
- func (c *Client) UnsubscribeOrder(symbol, clientId string)
- func (c *Client) UnsubscribeTradeClear(symbol, clientId string)
Constants ¶
View Source
const ( OrderTypeBuyMarket = "buy-market" OrderTypeSellMarket = "sell-market" OrderTypeBuyLimit = "buy-limit" OrderTypeSellLimit = "sell-limit" // IOC 全名 Immediate or Cancel(立即成交或撤单), // 指用户下的限价单,如果在指定价格不能立即成交,则撤销未成交的部分。 OrderTypeBuyIoc = "buy-ioc" OrderTypeSellIoc = "sell-ioc" // buy-limit-maker // 当“下单价格”>=“市场最低卖出价”,订单提交后,系统将拒绝接受此订单; // 当“下单价格”<“市场最低卖出价”,提交成功后,此订单将被系统接受。 OrderTypeBuyLimitMaker = "buy-limit-maker" // sell-limit-maker // 当“下单价格”<=“市场最高买入价”,订单提交后,系统将拒绝接受此订单; // 当“下单价格”>“市场最高买入价”,提交成功后,此订单将被系统接受。 OrderTypeSellLimitMaker = "sell-limit-maker" // 用户在下止盈止损订单时,须额外填写触发价 “stop-price” 与触发价运算符“operator”, // 并在订单类型 “type” 中指定订单类型 – “buy-stop-limit” 或 “sell-stop-limit”。 // 其中,触发价运算符为 ”gte” 时,表示当市场最新成交价大于等于此触发价时该止盈止损订单将被触发; // 触发价运算符为 ”lte” 时,表示当市场最新成交价小于等于此触发价时该止盈止损订单将被触发。 // 如果用户设置的触发价及运算符导致下单即被触发,该止盈止损订单将被拒绝接受。 OrderTypeBuyStopLimit = "buy-stop-limit" OrderTypeSellStopLimit = "sell-stop-limit" // - buy-limit-fok(FOK限价买单) // - sell-limit-fok(FOK限价卖单) // - buy-stop-limit-fok(FOK止盈止损限价买单) // - sell-stop-limit-fok(FOK止盈止损限价卖单) // 四个订单类型的订单有效期均为FOK(Fill or Kill), // 意即 – 如该订单下单后不能立即完全成交,则将被立即全部自动撤销。 OrderTypeBuyLimitFok = "buy-limit-fok" OrderTypeSellLimitFok = "sell-limit-fok" OrderTypeBuyStopLimitFok = "buy-stop-limit-fok" OrderTypeSellStopLimitFok = "sell-stop-limit-fok" )
View Source
const CandlestickReqMaxLength = 300
View Source
const (
DefaultHost = "api.huobi.me"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CandleSlice ¶ added in v0.7.18
func (CandleSlice) Len ¶ added in v0.7.18
func (cs CandleSlice) Len() int
func (CandleSlice) Less ¶ added in v0.7.18
func (cs CandleSlice) Less(i, j int) bool
func (CandleSlice) Swap ¶ added in v0.7.18
func (cs CandleSlice) Swap(i, j int)
type Client ¶
type Client struct { Label string AccessKey string SecretKey string Host string SpotAccountId int64 }
func (*Client) AllSymbols ¶ added in v0.13.0
func (*Client) BuyStopLimit ¶ added in v0.10.4
func (*Client) CandleBySize ¶ added in v0.10.14
func (*Client) CandleFrom ¶ added in v0.10.14
func (Client) FormatSymbol ¶ added in v0.17.0
func (*Client) GetAccountInfo ¶
func (c *Client) GetAccountInfo() ([]account.AccountInfo, error)
func (*Client) GetOrderById ¶ added in v0.11.0
func (*Client) GetSpotAccountId ¶
func (*Client) GetTimestamp ¶
func (*Client) IsFullFilled ¶ added in v0.22.0
func (*Client) Last24hVolume ¶ added in v0.24.0
func (*Client) PlaceOrder ¶
func (c *Client) PlaceOrder(request *order.PlaceOrderRequest) (uint64, error)
func (*Client) SellMarket ¶ added in v0.10.9
func (*Client) SellStopLimit ¶ added in v0.10.4
func (*Client) SpotAvailableBalance ¶ added in v0.10.0
func (*Client) SpotBalance ¶ added in v0.16.0
func (*Client) SpotLimitOrder ¶ added in v0.10.4
func (*Client) SpotMarketOrder ¶ added in v0.10.9
func (*Client) SpotStopLimitOrder ¶ added in v0.10.4
func (*Client) SubscribeAccountUpdate ¶
func (c *Client) SubscribeAccountUpdate(clientId string, responseHandler websocketclientbase.ResponseHandler)
func (*Client) SubscribeCandlestick ¶
func (*Client) SubscribeCandlestickWithReq ¶ added in v0.7.0
func (*Client) SubscribeLast24hCandlestick ¶
func (c *Client) SubscribeLast24hCandlestick(ctx context.Context, symbol, clientId string, responseHandler websocketclientbase.ResponseHandler) error
func (*Client) SubscribeOrder ¶
func (c *Client) SubscribeOrder(symbol, clientId string, responseHandler exchange.ResponseHandler)
func (*Client) SubscribeTradeClear ¶
func (c *Client) SubscribeTradeClear(symbol, clientId string, responseHandler websocketclientbase.ResponseHandler)
func (*Client) UnsubscribeAccountUpdate ¶ added in v0.19.0
func (*Client) UnsubscribeCandlestick ¶ added in v0.19.0
func (*Client) UnsubscribeCandlestickWithReq ¶ added in v0.19.0
func (*Client) UnsubscribeOrder ¶ added in v0.19.0
func (*Client) UnsubscribeTradeClear ¶ added in v0.19.0
Click to show internal directories.
Click to hide internal directories.