Versions in this module Expand all Collapse all v0 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 APIStreamURL + const AuthBaseURL + const BaseURL + const MarketStreamURL + const OrderStatusCanceled + const OrderStatusCancelled + const OrderStatusFilled + const OrderStatusNew + const OrderStatusOpen + const OrderStatusRejected + const OrderStatusUntriggered + func GenRequestID() string + func GenSessionID() string + type APIResponse struct + Code int + Data json.RawMessage + Message string + RequestID string + type Balance struct + Balance string + CrossAvailable string + CrossBalance string + CrossMargin string + CrossUpnl string + Equity string + IsolatedBalance string + IsolatedUpnl string + Locked string + Upnl string + type CancelOrderRequest struct + ClOrdID string + OrderID interface{} + Symbol string + type CancelOrdersRequest struct + ClOrdIDs []string + OrderIDs []interface{} + Symbol string + type ChangeLeverageRequest struct + Leverage int + Symbol string + type ChangeMarginModeRequest struct + MarginMode string + Symbol string + type Client struct + func NewClient() *Client + func (c *Client) CancelMultipleOrders(ctx context.Context, req CancelOrdersRequest) ([]interface{}, error) + func (c *Client) CancelOrder(ctx context.Context, req CancelOrderRequest) (*APIResponse, error) + func (c *Client) ChangeLeverage(ctx context.Context, req ChangeLeverageRequest) (*APIResponse, error) + func (c *Client) ChangeMarginMode(ctx context.Context, req ChangeMarginModeRequest) (*APIResponse, error) + func (c *Client) CreateOrder(ctx context.Context, req CreateOrderRequest, extraHeaders map[string]string) (*APIResponse, error) + func (c *Client) DoPrivate(ctx context.Context, method, endpoint string, payload interface{}, ...) error + func (c *Client) DoPublic(ctx context.Context, method, endpoint string, params url.Values, ...) error + func (c *Client) GetSigner() *Signer + func (c *Client) GetToken(ctx context.Context) (string, error) + func (c *Client) InvalidateToken() + func (c *Client) Login(ctx context.Context) error + func (c *Client) QueryBalances(ctx context.Context) (*Balance, error) + func (c *Client) QueryDepthBook(ctx context.Context, symbol string, limit int) (DepthBook, error) + func (c *Client) QueryFundingRates(ctx context.Context, symbol string, start, end int64) ([]FundingRate, error) + func (c *Client) QueryPositions(ctx context.Context, symbol string) ([]Position, error) + func (c *Client) QueryRecentTrades(ctx context.Context, symbol string, limit int) ([]RecentTrade, error) + func (c *Client) QuerySymbolInfo(ctx context.Context, symbol string) ([]SymbolInfo, error) + func (c *Client) QuerySymbolMarket(ctx context.Context, symbol string) (SymbolMarket, error) + func (c *Client) QuerySymbolPrice(ctx context.Context, symbol string) (SymbolPrice, error) + func (c *Client) QueryUserAllOpenOrders(ctx context.Context, symbol string) ([]Order, error) + func (c *Client) QueryUserOrders(ctx context.Context, symbol string) ([]Order, error) + func (c *Client) QueryUserTrades(ctx context.Context, symbol string, lastID int64, limit int) ([]Trade, error) + func (c *Client) WithCredentials(evmPrivateKeyHex string) (*Client, error) + type CreateOrderRequest struct + ClientOrdID string + OrderType OrderType + Price string + Qty string + ReduceOnly bool + Side OrderSide + Symbol string + TimeInForce TimeInForce + type DepthBook struct + Asks [][]string + Bids [][]string + Symbol string + type Error struct + Code int + Message string + func (e *Error) Error() string + type FundingRate struct + CreatedAt string + FundingRate string + ID int + IndexPrice string + MarkPrice string + Premium string + Symbol string + Time string + UpdatedAt string + type LoginRequest struct + ExpiresSeconds int + Signature string + SignedData string + type LoginResponse struct + Address string + Alias string + Chain string + PerpsAlpha bool + Token string + type Order struct + AvailLocked string + ClOrdID string + ClosedBlock int + CreatedAt string + CreatedBlock int + FillAvgPrice string + FillQty string + ID int + Leverage string + LiqID int + Margin string + OrderType string + Payload string + PositionID int + Price string + Qty string + ReduceOnly bool + Remark string + Side string + Source string + Status string + Symbol string + TimeInForce string + UpdatedAt string + User string + type OrderSide string + const SideBuy + const SideSell + type OrderType string + const OrderTypeLimit + const OrderTypeMarket + type Position struct + BankruptcyPrice string + CreatedAt string + EntryPrice string + EntryValue string + HoldingMargin string + ID int + InitialMargin string + Leverage string + LiqPrice string + MMR string + MaintMargin string + MarginAsset string + MarginMode string + MarkPrice string + PositionValue string + Qty string + RealizedPnL string + Status string + Symbol string + Time string + UpdatedAt string + Upnl string + User string + type PrepareSignInRequest struct + Address string + RequestID string + type PrepareSignInResponse struct + SignedData string + Success bool + type RecentTrade struct + IsBuyerTaker bool + Price string + Qty string + QuoteQty string + Symbol string + Time string + type SignedDataPayload struct + Address string + ChainID int + Domain string + Exp int64 + Iat int64 + IssuedAt string + Message string + Nonce string + RequestID string + Statement string + URI string + Version string + type Signer struct + func NewSigner(evmPrivateKeyHex string) (*Signer, error) + func (s *Signer) GetEVMAddress() string + func (s *Signer) GetRequestID() string + func (s *Signer) SignEVMPersonal(msg string) (string, error) + func (s *Signer) SignRequest(payload string, timestamp int64, requestIDOverride string) map[string]string + type SubscribeAuthChannel struct + Channel string + type SubscribeAuthParams struct + Streams []SubscribeAuthChannel + Token string + type SubscribeParams struct + Channel string + Symbol string + type SubscriptionAuthRequest struct + Auth SubscribeAuthParams + type SubscriptionRequest struct + Subscribe SubscribeParams + type SymbolInfo struct + BaseAsset string + BaseDecimals int + CreatedAt string + DefLeverage string + DepthTicks string + Enabled bool + MakerFee string + MaxLeverage string + MaxOpenOrders string + MaxOrderQty string + MaxPositionSize string + MinOrderQty string + PriceCapRatio string + PriceFloorRatio string + PriceTickDecimals int + QtyTickDecimals int + QuoteAsset string + QuoteDecimals int + Symbol string + TakerFee string + UpdatedAt string + type SymbolMarket struct + Ask1 string + Base string + Bid1 string + FundingRate string + HighPrice24h float64 + IndexPrice string + LastPrice string + LowPrice24h float64 + MarkPrice string + MidPrice string + NextFundingTime string + OpenInterest string + OpenInterestNotional string + Quote string + Spread []string + Symbol string + Time string + Volume24h float64 + VolumeQuote24h float64 + type SymbolPrice struct + Base string + IndexPrice string + LastPrice string + MarkPrice string + MidPrice string + Quote string + SpreadAsk string + SpreadBid string + Symbol string + Time string + type TimeInForce string + const TimeInForceALO + const TimeInForceFOK + const TimeInForceGTC + const TimeInForceIOC + type Trade struct + CreatedAt string + FeeAsset string + FeeQty string + ID int + OrderID int + Pnl string + Price string + Qty string + Side string + Symbol string + UpdatedAt string + User string + Value string + type UserOrdersResponse struct + PageSize int + Result json.RawMessage + Total int + type UserTradesResponse struct + PageSize int + Result json.RawMessage + Total int + type WSDepthData struct + Asks [][]string + Bids [][]string + Symbol string + type WSOrderUpdate struct + type WSPositionUpdate struct + type WSPriceData struct + Base string + IndexPrice string + LastPrice string + MarkPrice string + MidPrice string + Quote string + Spread [2]string + Symbol string + Time string + type WSRequest struct + Header map[string]string + Method string + Params interface{} + RequestID string + SessionID string + type WSResponse struct + Channel string + Code int + Data json.RawMessage + Message string + Method string + RequestID string + Seq int + Symbol string + type WSTradeData struct + type WsAccountClient struct + IsAuth bool + Logger *zap.SugaredLogger + func NewWsAccountClient(ctx context.Context, client *Client) *WsAccountClient + func (c *WsAccountClient) Auth() error + func (c *WsAccountClient) Close() + func (c *WsAccountClient) Connect() error + func (c *WsAccountClient) HandleMsg(data []byte) + func (c *WsAccountClient) Subscribe(channel string, handler func([]byte)) error + func (c *WsAccountClient) SubscribeBalanceUpdate(handler func(*Balance)) error + func (c *WsAccountClient) SubscribeOrderUpdate(handler func(*Order)) error + func (c *WsAccountClient) SubscribePositionUpdate(handler func(*Position)) error + func (c *WsAccountClient) SubscribeTradeUpdate(handler func(*Trade)) error + type WsApiClient struct + IsAuth bool + Logger *zap.SugaredLogger + LoginRequestID string + func NewWsApiClient(ctx context.Context, client *Client) *WsApiClient + func (c *WsApiClient) Auth() error + func (c *WsApiClient) CancelOrder(ctx context.Context, cancelReq *CancelOrderRequest) (*WsApiResponse, error) + func (c *WsApiClient) Close() + func (c *WsApiClient) Connect() error + func (c *WsApiClient) CreateOrder(ctx context.Context, orderReq *CreateOrderRequest) (*WsApiResponse, error) + func (c *WsApiClient) HandleMsg(data []byte) + func (c *WsApiClient) RegisterRequestHandler(requestID string, handler func([]byte) error) + func (c *WsApiClient) UnregisterRequestHandler(requestID string) + type WsApiResponse struct + Code int + Message string + RequestID string + type WsAuthResponse struct + Code int + Msg string + type WsClient struct + HandleMsg func([]byte) + OnReconnect func() error + func NewWsClient(ctx context.Context, url string, logger *zap.SugaredLogger) *WsClient + func (c *WsClient) Close() + func (c *WsClient) Connect() error + func (c *WsClient) IsConnected() bool + func (c *WsClient) SetCredentials(signer *Signer, token string) + func (c *WsClient) SetHandler(handler func([]byte)) + func (c *WsClient) WriteJSON(v interface{}) error + type WsMarketClient struct + IsAuth bool + Logger *zap.SugaredLogger + WsClient *WsClient + func NewWsMarketClient(ctx context.Context) *WsMarketClient + func (c *WsMarketClient) Close() + func (c *WsMarketClient) Connect() error + func (c *WsMarketClient) HandleMsg(data []byte) + func (c *WsMarketClient) Subscribe(channel string, symbol string, handler func([]byte) error) error + func (c *WsMarketClient) SubscribeDepthBook(symbol string, handler func([]byte) error) error + func (c *WsMarketClient) SubscribePrice(symbol string, handler func([]byte) error) error + func (c *WsMarketClient) SubscribePublicTrade(symbol string, handler func([]byte) error) error