Versions in this module Expand all Collapse all v1 v1.0.0 Jun 16, 2026 Changes in this version + const BaseURL + const MaxReconnectAttempts + const PongInterval + const ReconnectWait + const WSAPIBaseURL + const WSBaseURL + var ArrayEventMap = map[string]string + var SingleEventMap = map[string]string + func BuildQueryString(params map[string]interface{}) string + func FormatSymbol(symbol string) string + func GenerateSignature(secretKey, data string) string + func Timestamp() int64 + type APIError struct + Code int + Message string + func (e *APIError) Error() string + type AccountPositionEvent struct + Balances []struct{ ... } + EventTime int64 + EventType string + LastAccountUpdate int64 + type AccountResponse struct + AccountType string + Balances []struct{ ... } + BuyerCommission int64 + CanDeposit bool + CanTrade bool + CanWithdraw bool + MakerCommission int64 + SellerCommission int64 + TakerCommission int64 + UpdateTime int64 + type AggTradeEvent struct + AggTradeID int64 + EventTime int64 + EventType string + FirstTradeID int64 + Ignore bool + IsBuyerMaker bool + LastTradeID int64 + Price string + Quantity string + Symbol string + TradeTime int64 + type BookTickerEvent struct + BestAskPrice string + BestAskQty string + BestBidPrice string + BestBidQty string + Symbol string + UpdateID int64 + type BookTickerResponse struct + AskPrice string + AskQty string + BidPrice string + BidQty string + Symbol string + type CancelOrderResponse struct + ClientOrderID string + CummulativeQuoteQty string + ExecutedQty string + OrderID int64 + OrderListID int64 + OrigClientOrderID string + OrigQty string + Price string + Side string + Status string + Symbol string + TimeInForce string + Type string + type CancelReplaceOrderParams struct + CancelOrderID int64 + CancelOrigClientOrderID string + CancelReplaceMode string + IcebergQty string + NewClientOrderID string + NewOrderRespType string + Price string + Quantity string + Side string + StopPrice string + Symbol string + TimeInForce string + Type string + type CancelReplaceOrderResponse struct + CancelResponse *CancelOrderResponse + CancelResult string + NewOrderResponse *OrderResponse + NewOrderStatus string + func (r *CancelReplaceOrderResponse) UnmarshalJSON(data []byte) error + func (r CancelReplaceOrderResponse) MarshalJSON() ([]byte, error) + type Client struct + APIKey string + BaseURL string + HTTPClient *http.Client + Logger *zap.SugaredLogger + OrderCount mbx.OrderCount + SecretKey string + UsedWeight mbx.UsedWeight + func NewClient() *Client + func (c *Client) AllOrders(ctx context.Context, symbol string, limit int, startTime, endTime int64, ...) ([]OrderResponse, error) + func (c *Client) BookTicker(ctx context.Context, symbol string) (*BookTickerResponse, error) + func (c *Client) CancelOrder(ctx context.Context, symbol string, orderID int64, origClientOrderID string) (*CancelOrderResponse, error) + func (c *Client) CloseUserDataStream(ctx context.Context, listenKey string) error + func (c *Client) Delete(ctx context.Context, endpoint string, params map[string]interface{}, ...) error + func (c *Client) Depth(ctx context.Context, symbol string, limit int) (*DepthResponse, error) + func (c *Client) ExchangeInfo(ctx context.Context) (*ExchangeInfoResponse, error) + func (c *Client) Get(ctx context.Context, endpoint string, params map[string]interface{}, ...) error + func (c *Client) GetAccount(ctx context.Context) (*AccountResponse, error) + func (c *Client) GetOpenOrders(ctx context.Context, symbol string) ([]OrderResponse, error) + func (c *Client) GetOrder(ctx context.Context, symbol string, orderID int64, origClientOrderID string) (*OrderResponse, error) + func (c *Client) KeepAliveUserDataStream(ctx context.Context, listenKey string) error + func (c *Client) Klines(ctx context.Context, symbol, interval string, limit int, ...) ([]KlineResponse, error) + func (c *Client) ModifyOrder(ctx context.Context, p CancelReplaceOrderParams) (*CancelReplaceOrderResponse, error) + func (c *Client) MyTrades(ctx context.Context, symbol string, limit int, startTime, endTime int64, ...) ([]Trade, error) + func (c *Client) PlaceOrder(ctx context.Context, p PlaceOrderParams) (*OrderResponse, error) + func (c *Client) Post(ctx context.Context, endpoint string, params map[string]interface{}, ...) error + func (c *Client) Put(ctx context.Context, endpoint string, params map[string]interface{}, ...) error + func (c *Client) StartUserDataStream(ctx context.Context) (string, error) + func (c *Client) Ticker(ctx context.Context, symbol string) (*TickerResponse, error) + func (c *Client) WithBaseURL(url string) *Client + func (c *Client) WithCredentials(apiKey, secretKey string) *Client + type DepthEvent struct + Asks [][]string + Bids [][]string + EventTime int64 + EventType string + FinalUpdateID int64 + FirstUpdateID int64 + Symbol string + type DepthResponse struct + Asks [][]string + Bids [][]string + LastUpdateID int64 + type ExchangeInfoResponse struct + ServerTime int64 + Symbols []SymbolInfo + Timezone string + type ExecutionReport struct + ClientOrderID string + Commission string + CommissionAsset string + CreationTime int64 + CumQuoteQty string + CumulativeQty string + EventTime int64 + EventType string + ExecutionType string + IcebergQuantity string + Ignore1 int64 + Ignore2 bool + IsMaker bool + IsOrderWorking bool + LastExecPrice string + LastExecutedQty string + LastQuoteQty string + OrderID int64 + OrderListID int64 + OrderStatus string + OrderType string + OriginalClientID string + Price string + Quantity string + QuoteOrderQty string + RejectReason string + Side string + StopPrice string + Symbol string + TimeInForce string + TradeID int64 + TransactTime int64 + type ExecutionReportEvent struct + ClientOrderID string + CommissionAmount string + CommissionAsset string + CreationTime int64 + CumulativeFilledQuantity string + CumulativeQuoteAssetTransactedQuantity string + EventTime int64 + EventType string + ExecutionType string + IcebergQuantity string + Ignore int64 + Ignore2 bool + IsMaker bool + IsOrderWorking bool + LastExecutedPrice string + LastExecutedQuantity string + LastQuoteAssetTransactedQuantity string + OrderID int64 + OrderListID int64 + OrderStatus string + OrderType string + OriginalClientOrderID string + Price string + Quantity string + QuoteOrderQuantity string + RejectReason string + SelfTradePreventionMode string + Side string + StopPrice string + Symbol string + TimeInForce string + TradeID int64 + TransactionTime int64 + WorkingTime int64 + type KlineEvent struct + EventTime int64 + EventType string + Kline struct{ ... } + Symbol string + type KlineResponse []interface + type ListenKeyResponse struct + ListenKey string + type OrderResponse struct + ClientOrderID string + CummulativeQuoteQty string + ExecutedQty string + OrderID int64 + OrderListID int64 + OrigQty string + Price string + Side string + Status string + Symbol string + TimeInForce string + TransactTime int64 + Type string + type PlaceOrderParams struct + IcebergQty string + NewClientOrderID string + NewOrderRespType string + Price string + Quantity string + Side string + StopPrice string + Symbol string + TimeInForce string + Type string + type ServerTimeResponse struct + ServerTime int64 + type Subscription struct + type SymbolInfo struct + BaseAsset string + BaseAssetPrecision int + Filters []map[string]interface{} + QuoteAsset string + QuotePrecision int + Status string + Symbol string + type TickerResponse struct + AskPrice string + AskQty string + BidPrice string + BidQty string + CloseTime int64 + Count int64 + FirstId int64 + HighPrice string + LastId int64 + LastPrice string + LastQty string + LowPrice string + OpenPrice string + OpenTime int64 + PrevClosePrice string + PriceChange string + PriceChangePercent string + QuoteVolume string + Symbol string + Volume string + WeightedAvgPrice string + type Trade struct + Commission string + CommissionAsset string + ID int64 + IsBestMatch bool + IsBuyer bool + IsMaker bool + OrderID int64 + OrderListID int64 + Price string + Qty string + QuoteQty string + Symbol string + Time int64 + type TradeEvent struct + BuyerOrderID int64 + EventTime int64 + EventType string + Ignore bool + IsBuyerMaker bool + Price string + Quantity string + SellerOrderID int64 + Symbol string + TradeID int64 + TradeTime int64 + type WSClient struct + Conn *websocket.Conn + Debug bool + Handler func([]byte) + Logger *zap.SugaredLogger + Mu sync.RWMutex + ReconnectWait time.Duration + URL string + WriteMu sync.Mutex + func NewWSClient(ctx context.Context, url string) *WSClient + func NewWsClient(ctx context.Context, url string) *WSClient + func (c *WSClient) CallSubscription(key string, message []byte) + func (c *WSClient) Close() + func (c *WSClient) Connect() error + func (c *WSClient) IsConnected() bool + func (c *WSClient) SetHandler(stream string, handler func([]byte) error) + func (c *WSClient) SetPostReconnect(handler func()) + func (c *WSClient) Subscribe(stream string, handler func([]byte) error) error + func (c *WSClient) Unsubscribe(stream string) error + func (c *WSClient) WriteJSON(v interface{}) error + type WsAPIClient struct + Conn *websocket.Conn + Debug bool + Done chan struct{} + Logger *zap.SugaredLogger + Mu sync.Mutex + PendingMu sync.Mutex + PendingRequests map[string]chan []byte + ReconnectWait time.Duration + URL string + WriteMu sync.Mutex + func NewWsAPIClient(ctx context.Context) *WsAPIClient + func (c *WsAPIClient) CancelOrderWS(apiKey, secretKey string, symbol string, orderID int64, ...) (*OrderResponse, error) + func (c *WsAPIClient) Close() + func (c *WsAPIClient) Connect() error + func (c *WsAPIClient) IsConnected() bool + func (c *WsAPIClient) ModifyOrderWS(apiKey, secretKey string, p CancelReplaceOrderParams, id string) (*CancelReplaceOrderResponse, error) + func (c *WsAPIClient) PlaceOrderWS(apiKey, secretKey string, p PlaceOrderParams, id string) (*OrderResponse, error) + func (c *WsAPIClient) SendRequest(id string, req interface{}) ([]byte, error) + func (c *WsAPIClient) SetEventHandler(handler func([]byte)) + func (c *WsAPIClient) SetPostReconnect(handler func()) + func (c *WsAPIClient) WithURL(url string) *WsAPIClient + type WsAccountClient struct + Logger *zap.SugaredLogger + func NewWsAccountClient(wsAPI *WsAPIClient, apiKey, apiSecret string) *WsAccountClient + func (c *WsAccountClient) Close() + func (c *WsAccountClient) Connect() error + func (c *WsAccountClient) IsConnected() bool + func (c *WsAccountClient) SubscribeAccountPosition(callback func(*AccountPositionEvent)) + func (c *WsAccountClient) SubscribeExecutionReport(callback func(*ExecutionReportEvent)) + type WsClient = WSClient + type WsDepthEvent struct + Asks [][]string + Bids [][]string + EventTime int64 + EventType string + FinalUpdateID int64 + FinalUpdateIDLast int64 + FirstUpdateID int64 + Symbol string + TransactionTime int64 + type WsMarketClient struct + func NewWsMarketClient(ctx context.Context) *WsMarketClient + func (c *WsMarketClient) SubscribeAggTrade(symbol string, callback func(*AggTradeEvent) error) error + func (c *WsMarketClient) SubscribeAllMiniTicker(callback func([]*WsMiniTickerEvent) error) error + func (c *WsMarketClient) SubscribeBookTicker(symbol string, callback func(*BookTickerEvent) error) error + func (c *WsMarketClient) SubscribeIncrementOrderBook(symbol string, interval string, callback func(*WsDepthEvent) error) error + func (c *WsMarketClient) SubscribeKline(symbol string, interval string, callback func(*KlineEvent) error) error + func (c *WsMarketClient) SubscribeLimitOrderBook(symbol string, levels int, interval string, callback func(*DepthEvent) error) error + func (c *WsMarketClient) SubscribeTrade(symbol string, callback func(*TradeEvent) error) error + func (c *WsMarketClient) UnsubscribeAggTrade(symbol string) error + func (c *WsMarketClient) UnsubscribeBookTicker(symbol string) error + func (c *WsMarketClient) UnsubscribeDepth(symbol string) error + func (c *WsMarketClient) UnsubscribeIncrementOrderBook(symbol string, interval string) error + func (c *WsMarketClient) UnsubscribeKline(symbol string, interval string) error + func (c *WsMarketClient) UnsubscribeLimitOrderBook(symbol string, levels int, interval string) error + func (c *WsMarketClient) UnsubscribeTrade(symbol string) error + type WsMiniTickerEvent struct + ClosePrice string + EventTime int64 + EventType string + HighPrice string + LowPrice string + OpenPrice string + QuoteVolume string + Symbol string + Volume string