Versions in this module Expand all Collapse all v0 v0.2.1 Mar 26, 2026 v0.2.0 Mar 25, 2026 Changes in this version type Client + OrderCount mbx.OrderCount + UsedWeight mbx.UsedWeight + 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 (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) Subscribe(stream string, handler func([]byte) error) error + func (c *WSClient) Unsubscribe(stream string) error + func (c *WSClient) WriteJSON(v interface{}) error v0.1.4 Mar 13, 2026 v0.1.3 Mar 13, 2026 v0.1.2 Mar 13, 2026 v0.1.1 Mar 13, 2026 v0.1.0 Mar 13, 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 GenerateSignature(secretKey, data string) string + func Timestamp() int64 + type APIError struct + Code int + Message string + func (e *APIError) Error() string + type AccountConfigUpdateEvent struct + AccountConfig struct{ ... } + EventTime int64 + EventType string + MultiAssetsConfig struct{ ... } + TransactionTime int64 + type AccountResponse struct + Assets []struct{ ... } + CanDeposit bool + CanTrade bool + CanWithdraw bool + FeeTier int + MaxWithdrawAmount string + Positions []struct{ ... } + TotalInitialMargin string + TotalMaintMargin string + TotalMarginBalance string + TotalOpenOrderInitialMargin string + TotalPositionInitialMargin string + TotalUnrealizedProfit string + TotalWalletBalance string + UpdateTime int64 + type AccountUpdateEvent struct + EventTime int64 + EventType string + TransactionTime int64 + UpdateData struct{ ... } + type AggTrade struct + FirstTradeID int64 + ID int64 + IsBuyerMaker bool + LastTradeID int64 + Price string + Quantity string + Timestamp int64 + type BalanceResponse struct + AccountAlias string + Asset string + AvailableBalance string + Balance string + CrossUnPnl string + CrossWalletBalance string + MaxWithdrawAmount string + type CancelAllOrdersParams struct + Symbol string + type CancelOrderParams struct + OrderID string + OrigClientOrderID string + Symbol string + type Client struct + APIKey string + BaseURL string + HTTPClient *http.Client + Logger *zap.SugaredLogger + SecretKey string + func NewClient() *Client + func (c *Client) CancelAllOpenOrders(ctx context.Context, p CancelAllOrdersParams) error + func (c *Client) CancelOrder(ctx context.Context, p CancelOrderParams) (*OrderResponse, error) + func (c *Client) ChangeLeverage(ctx context.Context, symbol string, leverage int) (*LeverageResponse, error) + func (c *Client) ChangeMarginType(ctx context.Context, symbol string, marginType string) error + func (c *Client) ChangeMultiAssetsMode(ctx context.Context, multiAssetsMargin bool) error + func (c *Client) ChangePositionMode(ctx context.Context, dualSidePosition bool) error + func (c *Client) CloseListenKey(ctx context.Context) error + func (c *Client) ContinousKlines(ctx context.Context, symbol, contractType string, interval string, limit int, ...) ([]KlineResponse, error) + func (c *Client) CreateListenKey(ctx context.Context) (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) GetAggTrades(ctx context.Context, symbol string, limit int) ([]AggTrade, error) + func (c *Client) GetAllFundingRates(ctx context.Context) ([]FundingRateData, error) + func (c *Client) GetBalance(ctx context.Context) ([]BalanceResponse, error) + func (c *Client) GetFeeRate(ctx context.Context, symbol string) (*FeeRateResponse, error) + func (c *Client) GetFundingInfo(ctx context.Context) ([]FundingInfo, error) + func (c *Client) GetFundingRate(ctx context.Context, symbol string) (*FundingRateData, error) + func (c *Client) GetMultiAssetsMode(ctx context.Context) (*MultiAssetsModeResponse, 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) GetPositionMode(ctx context.Context) (*PositionModeResponse, error) + func (c *Client) GetPositionRisk(ctx context.Context, symbol string) ([]PositionRiskResponse, error) + func (c *Client) KeepAliveListenKey(ctx context.Context) error + func (c *Client) Klines(ctx context.Context, symbol, interval string, limit int, ...) ([]KlineResponse, error) + func (c *Client) MarkPrice(ctx context.Context, symbol string) (*MarkPriceResponse, error) + func (c *Client) ModifyOrder(ctx context.Context, p ModifyOrderParams) (*OrderResponse, 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) Ticker(ctx context.Context, symbol string) (*TickerResponse, error) + func (c *Client) WithCredentials(apiKey, secretKey string) *Client + type DepthResponse struct + Asks [][]string + Bids [][]string + E int64 + LastUpdateID int64 + T int64 + type ExchangeInfoResponse struct + ExchangeFilters []interface{} + RateLimits []interface{} + ServerTime int64 + Symbols []SymbolInfo + Timezone string + type FeeRateResponse struct + MakerCommissionRate string + RpiCommissionRate string + Symbol string + TakerCommissionRate string + type FundingInfo struct + AdjustedFundingRateCap string + AdjustedFundingRateFloor string + FundingIntervalHours int64 + Symbol string + type FundingRateData struct + FundingIntervalHours int64 + FundingTime int64 + LastFundingRate string + NextFundingTime int64 + Symbol string + type KlineResponse []interface + type LeverageResponse struct + Leverage int + MaxNotionalValue string + Symbol string + type ListenKeyResponse struct + ListenKey string + type MarginTypeResponse struct + Code int + Msg string + type MarkPriceResponse struct + EstimatedSettlePrice string + IndexPrice string + LastFundingRate string + MarkPrice string + NextFundingTime int64 + Symbol string + type ModifyOrderParams struct + OrderID int64 + OrigClientOrderID string + Price string + PriceMatch string + Quantity string + Side string + Symbol string + type MsgDispatcher interface + Dispatch func(data []byte) error + type MultiAssetsModeResponse struct + MultiAssetsMargin bool + type OrderResponse struct + ActivatePrice string + AvgPrice string + ClientOrderID string + ClosePosition bool + CumQty string + CumQuote string + ExecutedQty string + OrderID int64 + OrigQty string + OrigType string + PositionSide string + Price string + PriceProtect bool + PriceRate string + ReduceOnly bool + Side string + Status string + StopPrice string + Symbol string + TimeInForce string + Type string + UpdateTime int64 + WorkingType string + type OrderUpdateEvent struct + EventTime int64 + EventType string + Order struct{ ... } + TransactionTime int64 + type PlaceOrderParams struct + ActivationPrice string + CallbackRate string + ClosePosition bool + NewClientOrderID string + PositionSide string + Price string + PriceProtect bool + Quantity string + ReduceOnly bool + Side string + StopPrice string + Symbol string + TimeInForce string + Type string + WorkingType string + type PositionModeResponse struct + DualSidePosition bool + type PositionRiskResponse struct + EntryPrice string + IsAutoAddMargin string + IsolatedMargin string + IsolatedWallet string + Leverage string + LiquidationPrice string + MarginType string + MarkPrice string + MaxNotionalValue string + Notional string + PositionAmt string + PositionSide string + Symbol string + UnRealizedProfit string + UpdateTime int64 + type ServerTimeResponse struct + ServerTime int64 + type Subscription struct + type SymbolInfo struct + BaseAsset string + BaseAssetPrecision int + ContractType string + DeliveryDate int64 + Filters []map[string]interface{} + LiquidationFee string + MaintMarginPercent string + MarginAsset string + MarketTakeBound string + OnboardDate int64 + OrderType []string + Pair string + PricePrecision int + QuantityPrecision int + QuoteAsset string + QuotePrecision int + RequiredMarginPercent string + SettlePlan int64 + Status string + Symbol string + TimeInForce []string + TriggerProtect string + UnderlyingSubType []string + UnderlyingType string + type TickerResponse struct + CloseTime int64 + Count int64 + FirstId int64 + HighPrice string + LastId int64 + LastPrice string + LastQty string + LowPrice string + OpenPrice string + OpenTime int64 + PriceChange string + PriceChangePercent string + QuoteVolume string + Symbol string + Volume string + WeightedAvgPrice string + type Trade struct + Commission string + CommissionAsset string + ID int64 + IsBuyer bool + IsMaker bool + OrderID int64 + PositionSide string + Price string + Qty string + QuoteQty string + RealizedPnl string + Symbol string + Time int64 + type TradeLiteEvent struct + ClientOrderID string + EventTime int64 + EventType string + IsMaker bool + LastFilledPrice string + LastFilledQty string + OrderID int64 + OriginalPrice string + OriginalQty string + Side string + Symbol string + TradeID int64 + TransactionTime int64 + 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) CancelAllOrdersWS(apiKey, secretKey string, p CancelAllOrdersParams, id string) error + func (c *WsAPIClient) CancelOrderWS(apiKey, secretKey string, p CancelOrderParams, id string) (*OrderResponse, error) + func (c *WsAPIClient) Close() + func (c *WsAPIClient) Connect() error + func (c *WsAPIClient) IsConnected() bool + func (c *WsAPIClient) ModifyOrderWS(apiKey, secretKey string, p ModifyOrderParams, id string) (*OrderResponse, 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) WithURL(url string) *WsAPIClient + type WsAccountClient struct + Client *Client + KeepAliveInt time.Duration + ListenKey string + func NewWsAccountClient(ctx context.Context, apiKey, apiSecret string) *WsAccountClient + func (c *WsAccountClient) Close() + func (c *WsAccountClient) Connect() error + func (c *WsAccountClient) SubscribeAccountConfigUpdate(callback func(*AccountConfigUpdateEvent)) + func (c *WsAccountClient) SubscribeAccountUpdate(callback func(*AccountUpdateEvent)) + func (c *WsAccountClient) SubscribeOrderUpdate(callback func(*OrderUpdateEvent)) + func (c *WsAccountClient) WithURL(url string) *WsAccountClient + type WsAggTradeEvent struct + AggTradeID int64 + EventTime int64 + EventType string + FirstTradeID int64 + IsBuyerMaker bool + LastTradeID int64 + Price string + Quantity string + Symbol string + TradeTime int64 + type WsBookTickerEvent struct + BestAskPrice string + BestAskQty string + BestBidPrice string + BestBidQty string + EventTime int64 + EventType string + Symbol string + UpdateID 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 (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) Subscribe(stream string, handler func([]byte) error) error + func (c *WsClient) Unsubscribe(stream string) error + func (c *WsClient) WriteJSON(v interface{}) error + type WsDepthEvent struct + Asks [][]interface{} + Bids [][]interface{} + EventTime int64 + EventType string + FinalUpdateID int64 + FinalUpdateIDLast int64 + FirstUpdateID int64 + Symbol string + TransactionTime int64 + type WsKlineEvent struct + EventTime int64 + EventType string + Kline struct{ ... } + Symbol string + type WsMarkPriceEvent struct + EstimatedSettlePrice string + EventTime int64 + EventType string + FundingRate string + IndexPrice string + MarkPrice string + NextFundingTime int64 + Symbol string + type WsMarketClient struct + func NewWsMarketClient(ctx context.Context) *WsMarketClient + func (c *WsMarketClient) SubscribeAggTrade(symbol string, callback func(*WsAggTradeEvent) error) error + func (c *WsMarketClient) SubscribeAllMiniTicker(callback func([]*WsMiniTickerEvent) error) error + func (c *WsMarketClient) SubscribeBookTicker(symbol string, callback func(*WsBookTickerEvent) 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(*WsKlineEvent) error) error + func (c *WsMarketClient) SubscribeLimitOrderBook(symbol string, levels int, interval string, callback func(*WsDepthEvent) error) error + func (c *WsMarketClient) SubscribeMarkPrice(symbol string, interval string, callback func(*WsMarkPriceEvent) error) error + func (c *WsMarketClient) UnsubscribeAggTrade(symbol string) error + func (c *WsMarketClient) UnsubscribeBookTicker(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) UnsubscribeMarkPrice(symbol string, interval string) error + type WsMiniTickerEvent struct + ClosePrice string + EventTime int64 + EventType string + HighPrice string + LowPrice string + OpenPrice string + QuoteVol string + Symbol string + Volume string