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) (fym.Candle, error)
- func (c *Client) CandleBySizeContext(ctx context.Context, symbol string, period time.Duration, size int) (fym.Candle, error)
- func (c *Client) CandleFrom(symbol, clientId string, period time.Duration, from, to time.Time) (fym.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) Name() string
- 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) SubscribeTrade(symbol, clientId string, responseHandler exchange.TradeHandler)
- 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) UnsubscribeTrade(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.hbdm.com"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CandleSlice ¶
func (CandleSlice) Len ¶
func (cs CandleSlice) Len() int
func (CandleSlice) Less ¶
func (cs CandleSlice) Less(i, j int) bool
func (CandleSlice) Swap ¶
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 ¶
func (*Client) BuyStopLimit ¶
func (*Client) CandleBySize ¶
func (*Client) CandleBySizeContext ¶
func (*Client) CandleFrom ¶
func (Client) FormatSymbol ¶
func (*Client) GetAccountInfo ¶
func (c *Client) GetAccountInfo() ([]account.AccountInfo, error)
func (*Client) GetOrderById ¶
func (*Client) GetSpotAccountId ¶
func (*Client) GetTimestamp ¶
func (*Client) IsFullFilled ¶
func (*Client) Last24hVolume ¶
func (*Client) PlaceOrder ¶
func (c *Client) PlaceOrder(request *order.PlaceOrderRequest) (uint64, error)
func (*Client) SellMarket ¶
func (*Client) SellStopLimit ¶
func (*Client) SpotAvailableBalance ¶
func (*Client) SpotLimitOrder ¶
func (*Client) SpotMarketOrder ¶
func (*Client) SpotStopLimitOrder ¶
func (*Client) SubscribeAccountUpdate ¶
func (c *Client) SubscribeAccountUpdate(clientId string, responseHandler websocketclientbase.ResponseHandler)
func (*Client) SubscribeCandlestick ¶
func (*Client) SubscribeCandlestickWithReq ¶
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) SubscribeTrade ¶
func (c *Client) SubscribeTrade(symbol, clientId string, responseHandler exchange.TradeHandler)
func (*Client) SubscribeTradeClear ¶
func (c *Client) SubscribeTradeClear(symbol, clientId string, responseHandler websocketclientbase.ResponseHandler)
func (*Client) UnsubscribeAccountUpdate ¶
func (*Client) UnsubscribeCandlestick ¶
func (*Client) UnsubscribeCandlestickWithReq ¶
func (*Client) UnsubscribeOrder ¶
func (*Client) UnsubscribeTrade ¶
func (*Client) UnsubscribeTradeClear ¶
Click to show internal directories.
Click to hide internal directories.