Versions in this module Expand all Collapse all v1 v1.2.2 Nov 5, 2021 Changes in this version + const BaseHost + const DefaultDepthLimit + const DefaultKlinesLimit + const DefaultOrderLimit + const DefaultResponseWindow + const DefaultSchema + const DefaultTradesLimit + const DefaultUserAgent + const EndpointAccount + const EndpointAccountTrades + const EndpointAggTrades + const EndpointAvgPrice + const EndpointDataStream + const EndpointDepth + const EndpointExchangeInfo + const EndpointHistoricalTrades + const EndpointKlines + const EndpointOpenOrders + const EndpointOrder + const EndpointOrderTest + const EndpointOrdersAll + const EndpointPing + const EndpointTicker24h + const EndpointTickerBook + const EndpointTickerPrice + const EndpointTime + const EndpointTrades + const HeaderAccept + const HeaderApiKey + const HeaderTypeForm + const HeaderTypeJson + const MaxAccountTradesLimit + const MaxDepthLimit + const MaxKlinesLimit + const MaxOrderLimit + const MaxTradesLimit + const OrderRespTypeAsk + const OrderRespTypeFull + const OrderRespTypeResult + var ErrEmptyLimit = errors.New("empty price or quantity") + var ErrEmptyMarket = errors.New("quantity or quote quantity expected") + var ErrEmptyOrderID = errors.New("order id must be set") + var ErrEmptySymbol = errors.New("symbol are missing") + var ErrInvalidJson = errors.New("invalid json") + var ErrNilRequest = errors.New("request is nil") + var ErrNilUnmarshal = errors.New("UnmarshalJSON on nil pointer") + var HeaderOrderCount = []byte("X-Mbx-Order-Count-") + var HeaderRetryAfter = []byte("Retry-After") + var HeaderUsedWeight = []byte("X-Mbx-Used-Weight-") + var RateLimitIntervalLetter = map[byte]RateLimitInterval + type APIError struct + Code int + Msg string + func (e *APIError) Error() string + type AccountInfo struct + AccountType AccountType + Balances []*Balance + BuyerCommission int + CanDeposit bool + CanTrade bool + CanWithdraw bool + MakerCommission int + Permissions []AccountType + SellerCommission int + TakerCommission int + type AccountTrades struct + BestMatch bool + Buyer bool + Commission string + CommissionAsset string + ID int + Maker bool + Price string + Qty string + Time uint64 + type AccountTradesReq struct + EndTime uint64 + FromID int + Limit int + StartTime uint64 + Symbol string + type AccountType string + const AccountTypeMargin + const AccountTypeSpot + type AggregatedTrade struct + BestMatch bool + FirstTradeID int + LastTradeID int + Maker bool + Price string + Quantity string + Time uint64 + TradeID int + type AggregatedTradeReq struct + EndTime uint64 + FromID int + Limit int + StartTime uint64 + Symbol string + type AllOrdersReq struct + EndTime uint64 + Limit int + OrderID uint64 + StartTime uint64 + Symbol string + type AvgPrice struct + Mins int + Price string + type AvgPriceReq struct + Symbol string + type Balance struct + Asset string + Free string + Locked string + type BookTicker struct + AskPrice string + AskQty string + BidPrice string + BidQty string + Symbol string + type BookTickerReq struct + Symbol string + type CancelOpenOrdersReq struct + Symbol string + type CancelOrder struct + ClientOrderID string + CummulativeQuoteQty string + ExecutedQty string + OrderID uint64 + OrderListID int + OrigClientOrderID string + OrigQty string + Price string + Side OrderSide + Status OrderStatus + Symbol string + TimeInForce TimeInForce + Type OrderType + type CancelOrderReq struct + NewClientOrderId string + OrderID uint64 + OrigClientOrderId string + Symbol string + type Client struct + func NewClient(apikey, secret string) *Client + func NewCustomClient(restClient RestClient) *Client + func (c *Client) Account() (*AccountInfo, error) + func (c *Client) AccountTrades(req *AccountTradesReq) (*AccountTrades, error) + func (c *Client) AggregatedTrades(req *AggregatedTradeReq) ([]*AggregatedTrade, error) + func (c *Client) AllOrders(req *AllOrdersReq) ([]*QueryOrder, error) + func (c *Client) AvgPrice(req *AvgPriceReq) (*AvgPrice, error) + func (c *Client) BookTicker(req *BookTickerReq) (*BookTicker, error) + func (c *Client) BookTickers() ([]*BookTicker, error) + func (c *Client) CancelOpenOrders(req *CancelOpenOrdersReq) ([]*CancelOrder, error) + func (c *Client) CancelOrder(req *CancelOrderReq) (*CancelOrder, error) + func (c *Client) DataStream() (string, error) + func (c *Client) DataStreamClose(listenKey string) error + func (c *Client) DataStreamKeepAlive(listenKey string) error + func (c *Client) Depth(req *DepthReq) (*Depth, error) + func (c *Client) ExchangeInfo() (*ExchangeInfo, error) + func (c *Client) ExchangeInfoSymbol(req *ExchangeInfoReq) (*ExchangeInfo, error) + func (c *Client) HistoricalTrades(req *HistoricalTradeReq) ([]*Trade, error) + func (c *Client) Klines(req *KlinesReq) ([]*Klines, error) + func (c *Client) NewOrder(req *OrderReq) (*OrderRespAck, error) + func (c *Client) NewOrderFull(req *OrderReq) (*OrderRespFull, error) + func (c *Client) NewOrderResult(req *OrderReq) (*OrderRespResult, error) + func (c *Client) NewOrderTest(req *OrderReq) error + func (c *Client) OpenOrders(req *OpenOrdersReq) ([]*QueryOrder, error) + func (c *Client) Ping() error + func (c *Client) Price(req *TickerPriceReq) (*SymbolPrice, error) + func (c *Client) Prices() ([]*SymbolPrice, error) + func (c *Client) QueryOrder(req *QueryOrderReq) (*QueryOrder, error) + func (c *Client) ReqWindow(window int) *Client + func (c *Client) Ticker(req *TickerReq) (*TickerStats, error) + func (c *Client) Tickers() ([]*TickerStats, error) + func (c *Client) Time() (*ServerTime, error) + func (c *Client) Trades(req *TradeReq) ([]*Trade, error) + type DatastreamReq struct + ListenKey string + type Depth struct + Asks []DepthElem + Bids []DepthElem + LastUpdateID int + type DepthElem struct + Price decimal.Decimal + Quantity decimal.Decimal + func (b *DepthElem) UnmarshalJSON(data []byte) error + type DepthReq struct + Limit int + Symbol string + type ExchangeFilter struct + MaxNumAlgoOrders int + MaxNumOrders int + Type ExchangeFilterType + type ExchangeFilterType string + const ExchangeFilterTypeMaxAlgoOrders + const ExchangeFilterTypeMaxNumOrders + type ExchangeInfo struct + ExchangeFilters []ExchangeFilter + RateLimits []RateLimit + ServerTime uint64 + Symbols []SymbolInfo + Timezone string + type ExchangeInfoReq struct + Symbol string + type FilterType string + const FilterTypeIcebergParts + const FilterTypeLotSize + const FilterTypeMarketLotSize + const FilterTypeMaxNumAlgoOrders + const FilterTypeMaxNumIcebergOrders + const FilterTypeMaxNumOrders + const FilterTypeMaxPosition + const FilterTypeMinNotional + const FilterTypePercentPrice + const FilterTypePrice + type HistoricalTradeReq struct + FromID int + Limit int + Symbol string + type KlineInterval string + const KlineInterval12hour + const KlineInterval15min + const KlineInterval1day + const KlineInterval1hour + const KlineInterval1min + const KlineInterval1month + const KlineInterval1week + const KlineInterval2hour + const KlineInterval30min + const KlineInterval3day + const KlineInterval3min + const KlineInterval4hour + const KlineInterval5min + const KlineInterval6hour + const KlineInterval8hour + type Klines struct + ClosePrice decimal.Decimal + CloseTime uint64 + High decimal.Decimal + Low decimal.Decimal + OpenPrice decimal.Decimal + OpenTime uint64 + QuoteAssetVolume decimal.Decimal + TakerBuyBaseAssetVolume decimal.Decimal + TakerBuyQuoteAssetVolume decimal.Decimal + Trades int + Volume decimal.Decimal + func (b *Klines) UnmarshalJSON(data []byte) error + type KlinesReq struct + EndTime uint64 + Interval KlineInterval + Limit int + StartTime uint64 + Symbol string + type OpenOrdersReq struct + Symbol string + type OrderFailure string + const OrderFailureAccountInaactive + const OrderFailureAccountSettle + const OrderFailureDuplicate + const OrderFailureInsufficientFunds + const OrderFailureMarketClosed + const OrderFailureNone + const OrderFailurePriceExceed + const OrderFailureUnknownAccount + const OrderFailureUnknownInstrument + const OrderFailureUnknownOrder + type OrderReq struct + IcebergQty string + NewClientOrderId string + OrderRespType OrderRespType + Price string + Quantity string + QuoteQuantity string + Side OrderSide + StopPrice string + Symbol string + TimeInForce TimeInForce + Type OrderType + type OrderRespAck struct + ClientOrderID string + OrderID uint64 + OrderListID int + Symbol string + TransactTime uint64 + type OrderRespFull struct + ClientOrderID string + CummulativeQuoteQty string + ExecutedQty string + Fills []OrderRespFullFill + OrderID uint64 + OrderListID int64 + OrigQty string + Price string + Side OrderSide + Status OrderStatus + Symbol string + TimeInForce string + TransactTime uint64 + Type OrderType + type OrderRespFullFill struct + Commission string + CommissionAsset string + Price string + Qty string + type OrderRespResult struct + ClientOrderID string + CummulativeQuoteQty string + ExecutedQty string + OrderID uint64 + OrderListID int + OrigQty string + Price string + Side OrderSide + Status OrderStatus + Symbol string + TimeInForce string + TransactTime uint64 + Type OrderType + type OrderRespType string + type OrderSide string + const OrderSideBuy + const OrderSideSell + type OrderStatus string + const OrderStatusCanceled + const OrderStatusExpired + const OrderStatusFilled + const OrderStatusNew + const OrderStatusPartial + const OrderStatusPending + const OrderStatusRejected + type OrderType string + const OrderTypeLimit + const OrderTypeLimitMaker + const OrderTypeMarket + const OrderTypeStopLoss + const OrderTypeStopLossLimit + const OrderTypeTakeProfit + const OrderTypeTakeProfitLimit + type QueryOrder struct + ClientOrderID string + CummulativeQuoteQty string + ExecutedQty string + IcebergQty string + OrderID uint64 + OrderListID int + OrigQty string + OrigQuoteOrderQty string + Price string + Side OrderSide + Status OrderStatus + StopPrice string + Symbol string + Time uint64 + TimeInForce TimeInForce + Type OrderType + UpdateTime uint64 + type QueryOrderReq struct + OrderID uint64 + OrigClientOrderId string + Symbol string + type RateLimit struct + Interval RateLimitInterval + IntervalNum int + Limit int + Type RateLimitType + type RateLimitInterval string + const RateLimitIntervalDay + const RateLimitIntervalHour + const RateLimitIntervalMinute + const RateLimitIntervalSecond + type RateLimitType string + const RateLimitTypeOrders + const RateLimitTypeRawRequests + const RateLimitTypeRequestWeight + type RestClient interface + Do func(method, endpoint string, data interface{}, sign bool, stream bool) ([]byte, error) + OrderCount func() map[string]int + RetryAfter func() int + SetWindow func(window int) + UsedWeight func() map[string]int + func NewCustomRestClient(config RestClientConfig) RestClient + func NewRestClient(key, secret string) RestClient + type RestClientConfig struct + APIKey string + APISecret string + HTTPClient *fasthttp.HostClient + ResponseWindow int + type ServerTime struct + ServerTime uint64 + type SymbolInfo struct + BaseAsset string + BaseAssetPrecision int + BaseCommissionPrecision int + Filters []SymbolInfoFilter + IcebergAllowed bool + IsMarginTradingAllowed bool + IsSpotTradingAllowed bool + OCOAllowed bool + OrderTypes []OrderType + Permissions []AccountType + QuoteAsset string + QuoteAssetPrecision int + QuoteCommissionPrecision int + QuoteOrderQtyMarketAllowed bool + QuotePrecision int + Status SymbolStatus + Symbol string + type SymbolInfoFilter struct + AvgPriceMins int + IcebergLimit int + MaxNumAlgoOrders int + MaxNumIcebergOrders int + MaxNumOrders int + MaxPosition string + MaxPrice string + MaxQty string + MinNotional string + MinPrice string + MinQty string + MultiplierDown string + MultiplierUp string + StepSize string + TickSize string + Type FilterType + type SymbolPrice struct + Price string + Symbol string + type SymbolStatus string + const SymbolStatusAuctionMatch + const SymbolStatusBreak + const SymbolStatusEndOfDay + const SymbolStatusHalt + const SymbolStatusPostTrading + const SymbolStatusPreTrading + const SymbolStatusTrading + type TickerPriceReq struct + Symbol string + type TickerReq struct + Symbol string + type TickerStats struct + AskPrice string + BidPrice string + CloseTime uint64 + Count int + FirstID int + HighPrice string + LastID int + LastPrice string + LastQty string + LowPrice string + OpenPrice string + OpenTime uint64 + PrevClosePrice string + PriceChange string + PriceChangePercent string + QuoteVolume string + Volume string + WeightedAvgPrice string + type TimeInForce string + const TimeInForceFOK + const TimeInForceGTC + const TimeInForceIOC + type Trade struct + ID int + IsBestMatch bool + IsBuyerMaker bool + Price string + Qty string + QuoteQty string + Time int64 + type TradeReq struct + Limit int + Symbol string