Versions in this module Expand all Collapse all v1 v1.0.0 Jun 16, 2026 Changes in this version + const CancelAllTifAbort + const CancelAllTifImmediate + const CancelAllTifScheduled + const CrossMarginMode + const Default10MinAuthExpiry + const Default28DayOrderExpiry + const DefaultIocExpiry + const ExplorerAPIURL + const IsolatedMarginMode + const MainnetAPIURL + const MainnetChainID + const MainnetWSURL + const Minute + const NilTriggerPrice + const OrderTimeInForceGoodTillTime + const OrderTimeInForceImmediateOrCancel + const OrderTimeInForcePostOnly + const OrderTypeLimit + const OrderTypeMarket + const OrderTypeStopLoss + const OrderTypeStopLossLimit + const OrderTypeTakeProfit + const OrderTypeTakeProfitLimit + const OrderTypeTwap + const TxTypeBurnShares + const TxTypeCancelAllOrders + const TxTypeCancelOrder + const TxTypeChangePubKey + const TxTypeCreateOrder + const TxTypeCreatePublicPool + const TxTypeCreateSubAccount + const TxTypeL2CreateGroupedOrders + const TxTypeL2UpdateMargin + const TxTypeMintShares + const TxTypeModifyOrder + const TxTypeTransfer + const TxTypeUpdateLeverage + const TxTypeUpdatePublicPool + const TxTypeWithdraw + var ErrInvalidSignature = fmt.Errorf("invalid signature") + var ErrOrderNotFound = fmt.Errorf("order not found") + func HashCancelAllOrders(lighterChainId uint32, info *CancelAllOrdersInfo) ([]byte, error) + func HashCancelOrder(lighterChainId uint32, info *CancelOrderInfo) ([]byte, error) + func HashCreateOrder(lighterChainId uint32, info *CreateOrderInfo) ([]byte, error) + func HashModifyOrder(lighterChainId uint32, info *ModifyOrderInfo) ([]byte, error) + func HashUpdateLeverage(lighterChainId uint32, info *UpdateLeverageInfo) ([]byte, error) + type APIError struct + Code int + Message string + func (e *APIError) Error() string + type Account struct + AccountIndex int64 + AccountType int8 + Assets []*SpotAsset + AvailableBalance string + CanInvite bool + CancelAllTime int64 + Code int32 + Collateral string + CrossAssetValue string + Description string + Index int64 + L1Address string + Msg string + Name string + PendingOrderCount int64 + PoolInfo *PoolInfo + Positions []*Position + ReferralPointsPercentage string + Shares []*Share + Status uint8 + TotalAssetValue string + TotalIsolatedOrderCount int64 + TotalOrderCount int64 + type AccountActiveOrdersResponse struct + Code int32 + Msg string + NextCursor string + Orders []*Order + type AccountInactiveOrdersResponse struct + Code int32 + Msg string + NextCursor string + Orders []*Order + type AccountInfo struct + AccountIndex int64 + L1Address string + type AccountLimitsResponse struct + CanCreatePublicPool bool + Code int32 + CurrentMakerFeeTick int32 + CurrentTakerFeeTick int32 + MaxLlpPercentage int32 + Msg string + UserTier string + func (r AccountLimitsResponse) AccountTier() AccountTier + type AccountMetadata struct + AccountIndex int64 + CanInvite bool + Description string + Name string + ReferralPointsPercentage string + type AccountMetadataResponse struct + AccountMetadatas []*AccountMetadata + Code int32 + Msg string + type AccountResponse struct + Accounts []*Account + Code int32 + Msg string + type AccountStats struct + AvailableBalance string + BuyingPower string + Collateral string + Leverage string + MarginUsage string + PortfolioValue string + type AccountTier string + const AccountTierPlus + const AccountTierPremium + const AccountTierStandard + const AccountTierUnknown + type AccountTxsResponse struct + Code int32 + Msg string + Txs []Tx + type AccountsByL1AddressResponse struct + Accounts []*Account + Code int32 + Msg string + type Announcement struct + Content string + Id int64 + Timestamp int64 + Title string + type AnnouncementResponse struct + Announcements []Announcement + Code int32 + Msg string + type ApiKey struct + CreatedAt int64 + Index uint32 + Name string + PublicKey string + type ApiKeysResponse struct + ApiKeys []ApiKey + Code int32 + Msg string + type Ask struct + InitialBaseAmount string + OrderExpiry int64 + OrderId string + OrderIndex int64 + OwnerAccountIndex int64 + Price string + RemainingBaseAmount string + type Asset struct + AssetIndex int16 + Decimals uint8 + ExtensionMultiplier int64 + IndexPrice uint32 + L1Address string + L1Decimals uint8 + MarginMode uint8 + MinTransferAmount int64 + MinWithdrawalAmount int64 + Symbol string + TickSize string + type AssetDetailsResponse struct + Assets []*Asset + Code int + Msg string + type Bid struct + InitialBaseAmount string + OrderExpiry int64 + OrderId string + OrderIndex int64 + OwnerAccountIndex int64 + Price string + RemainingBaseAmount string + type Callback func([]byte) + type CancelAllOrdersInfo struct + AccountIndex int64 + ApiKeyIndex uint32 + ExpiredAt int64 + Nonce int64 + Sig []byte + SignedHash string + Time int64 + TimeInForce uint32 + type CancelAllOrdersRequest struct + CancelAllTif uint32 + MarketId int + type CancelOrderInfo struct + AccountIndex int64 + ApiKeyIndex uint32 + ExpiredAt int64 + Index int64 + MarketIndex uint32 + Nonce int64 + Sig []byte + SignedHash string + type CancelOrderRequest struct + MarketId int + OrderId int64 + type CancelOrderResponse struct + Code int32 + Message string + PredictedExecutionTimeMs int64 + TxHash string + type Candlestick struct + Close float64 + CloseRaw float64 + High float64 + HighRaw float64 + LastTradeID int64 + Low float64 + LowRaw float64 + Open float64 + OpenRaw float64 + QuoteVolume float64 + Timestamp int64 + Volume float64 + type CandlesticksResponse struct + Candlesticks []Candlestick + Code int32 + Msg string + Resolution string + type ChangeAccountTierResponse struct + Code int32 + Msg string + type Client struct + AccountIndex int64 + BaseURL string + ChainId uint32 + HTTPClient *http.Client + KeyIndex uint8 + KeyManager common.KeyManager + Logger *zap.SugaredLogger + PrivateKey string + func NewClient() *Client + func (c *Client) CancelOrder(ctx context.Context, req CancelOrderRequest) (*CancelOrderResponse, error) + func (c *Client) ChangeAccountTier(ctx context.Context, newTier string) (*ChangeAccountTierResponse, error) + func (c *Client) CreateAuthToken(deadline time.Time) (string, error) + func (c *Client) CreateToken(ctx context.Context, name, permission string, expiration int64) (string, error) + func (c *Client) GetAccount(ctx context.Context) (*AccountResponse, error) + func (c *Client) GetAccountActiveOrders(ctx context.Context, marketId int) (*AccountActiveOrdersResponse, error) + func (c *Client) GetAccountLimits(ctx context.Context) (*AccountLimitsResponse, error) + func (c *Client) GetAccountMetadata(ctx context.Context) (*AccountMetadataResponse, error) + func (c *Client) GetAccountTxs(ctx context.Context, limit int64) (*AccountTxsResponse, error) + func (c *Client) GetAccountsByL1Address(ctx context.Context, l1Address string) (*AccountsByL1AddressResponse, error) + func (c *Client) GetAllFundingRates(ctx context.Context) ([]FundingRateData, error) + func (c *Client) GetAnnouncements(ctx context.Context) (*AnnouncementResponse, error) + func (c *Client) GetApiKeys(ctx context.Context) (*ApiKeysResponse, error) + func (c *Client) GetAssetDetails(ctx context.Context, assetIndex *int16) (*AssetDetailsResponse, error) + func (c *Client) GetBlockHeight(ctx context.Context) (int64, error) + func (c *Client) GetCandlesticks(ctx context.Context, marketId int, resolution string, ...) (*CandlesticksResponse, error) + func (c *Client) GetExchangeStats(ctx context.Context) (*ExchangeStatsResponse, error) + func (c *Client) GetFundingHistory(ctx context.Context, marketId int, resolution string, ...) (*FundingHistoryResponse, error) + func (c *Client) GetFundingRate(ctx context.Context, marketId int) (*FundingRateData, error) + func (c *Client) GetFundingRates(ctx context.Context) (*FundingRatesResponse, error) + func (c *Client) GetInactiveOrders(ctx context.Context, marketId *int, limit int64) (*AccountInactiveOrdersResponse, error) + func (c *Client) GetL1Metadata(ctx context.Context, l1Address string) (*L1MetadataResponse, error) + func (c *Client) GetNextNonce(ctx context.Context) (int64, error) + func (c *Client) GetOrderBookDetails(ctx context.Context, marketId *int, filter *string) (*OrderBookDetailsResponse, error) + func (c *Client) GetOrderBookOrders(ctx context.Context, marketId int, limit int64) (*OrderBookOrdersResponse, error) + func (c *Client) GetOrderBooks(ctx context.Context, marketId *int) (*OrderBooksResponse, error) + func (c *Client) GetPnL(ctx context.Context, startTimestamp, endTimestamp int64) (*PnlResponse, error) + func (c *Client) GetPositionFunding(ctx context.Context, marketId *int, limit int64, side *string) (*PositionFundingResponse, error) + func (c *Client) GetPublicPoolsMetadata(ctx context.Context, filter string, index, limit int64, accountIndex *int64) (*PublicPoolsMetadataResponse, error) + func (c *Client) GetRecentTrades(ctx context.Context, marketId int, limit int64) (*RecentTradesResponse, error) + func (c *Client) GetReferralPoints(ctx context.Context) (*ReferralPointsResponse, error) + func (c *Client) GetTokens(ctx context.Context) ([]Token, error) + func (c *Client) GetTransferFeeInfo(ctx context.Context, toAccountIndex *int64) (*TransferFeeInfoResponse, error) + func (c *Client) GetWithdrawalDelay(ctx context.Context) (*WithdrawalDelayResponse, error) + func (c *Client) InvalidateNonce() + func (c *Client) ModifyOrder(ctx context.Context, req ModifyOrderRequest) (*ModifyOrderResponse, error) + func (c *Client) PlaceOrder(ctx context.Context, req CreateOrderRequest) (*CreateOrderResponse, error) + func (c *Client) Post(ctx context.Context, path string, payload any, auth bool) ([]byte, error) + func (c *Client) PostForm(ctx context.Context, path string, params map[string]string, auth bool) ([]byte, error) + func (c *Client) RevokeToken(ctx context.Context, tokenId int64) error + func (c *Client) SendTxBatch(ctx context.Context, txs []map[string]string) (*SendTxBatchResponse, error) + func (c *Client) UpdateLeverage(ctx context.Context, marketId int, leverage uint16, marginMode uint8) (*UpdateLeverageResponse, error) + func (c *Client) WithCredentials(privateKey string, accountIndex int64, keyIndex uint8) *Client + type CreateOrderInfo struct + AccountIndex int64 + ApiKeyIndex uint32 + BaseAmount int64 + ClientOrderIndex int64 + ExpiredAt int64 + IsAsk uint32 + MarketIndex uint32 + Nonce int64 + OrderExpiry int64 + Price uint32 + ReduceOnly uint32 + Sig []byte + SignedHash string + TimeInForce uint32 + TriggerPrice uint32 + Type uint32 + type CreateOrderRequest struct + BaseAmount int64 + ClientOrderId int64 + IsAsk uint32 + MarketId int + OrderExpiry int64 + OrderType uint32 + Price uint32 + ReduceOnly uint32 + TimeInForce uint32 + TriggerPrice uint32 + type CreateOrderResponse struct + Code int32 + Message string + PredictedExecutionTimeMs int64 + TxHash string + type CreateTokenRequest struct + AccountIndex int64 + Expiry int64 + Name string + Scopes string + SubAccountAccess bool + type CreateTokenResponse struct + AccountIndex int64 + ApiToken string + Code int + Expiry int64 + Msg string + Name string + Scopes string + SubAccountAccess bool + TokenId int64 + type CrossRiskParameters struct + CloseOutMarginReq string + Collateral string + InitialMarginReq string + MaintenanceMarginReq string + MarketId int + TotalAccountValue string + type DailyReturn struct + DailyReturn float64 + Timestamp int64 + type Deposit struct + Amount string + Status string + Timestamp int64 + TxHash string + type DepositHistoryResponse struct + Code int32 + Deposits []Deposit + Msg string + type Envelope struct + Channel string + LastUpdatedAt int64 + Timestamp int64 + Type string + func (e *Envelope) Unmarshal(v any) error + type ExchangeStatsResponse struct + Code int32 + DailyTradesCount int64 + DailyUsdVolume float64 + Msg string + OrderBookStats []*OrderBookStat + Total int64 + type FundingHistory struct + Change string + FundingId int64 + MarketId uint8 + PositionSide string + PositionSize string + Rate string + Timestamp int64 + type FundingHistoryResponse struct + Code int32 + Fundings []FundingRateHistory + Msg string + Resolution string + type FundingRate struct + Exchange string + MarketId int + Rate float64 + Symbol string + type FundingRateData struct + Exchange string + FundingIntervalHours int64 + FundingRate string + FundingTime int64 + MarketId int + NextFundingTime int64 + Symbol string + type FundingRateHistory struct + Direction string + Rate string + Timestamp int64 + Value string + type FundingRatesResponse struct + Code int32 + FundingRate []*FundingRate + Msg string + type IsolatedRiskParameters struct + CloseOutMarginReq string + Collateral string + InitialMarginReq string + MaintenanceMarginReq string + MarketId int + TotalAccountValue string + type L1Metadata struct + BlockNum uint64 + ChainId uint32 + Timestamp uint64 + type L1MetadataResponse struct + CanInvite bool + L1Address string + ReferralPointsPercentage string + type L2CreateGroupedOrdersTxInfo struct + AccountIndex int64 + ApiKeyIndex uint8 + ExpiredAt int64 + GroupingType uint8 + Nonce int64 + Orders []*CreateOrderInfo + Sig []byte + SignedHash string + func (txInfo *L2CreateGroupedOrdersTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error) + type L2UpdateMarginTxInfo struct + AccountIndex int64 + ApiKeyIndex uint8 + Direction uint8 + ExpiredAt int64 + MarketIndex int16 + Nonce int64 + Sig []byte + SignedHash string + USDCAmount int64 + func (txInfo *L2UpdateMarginTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error) + type LiqInfo struct + Position Position + RiskInfoAfter RiskInfo + RiskInfoBefore RiskInfo + type LiqTrade struct + MakerFee string + Price string + Size string + TakerFee string + type Liquidation struct + Id int64 + Info LiqInfo + MarketId int + Trade LiqTrade + Type string + type LiquidationsResponse struct + Code int32 + Liquidations []Liquidation + Msg string + type MarketType string + const MarketTypePerp + const MarketTypeSpot + type ModifyOrderInfo struct + AccountIndex int64 + ApiKeyIndex uint32 + BaseAmount int64 + ExpiredAt int64 + Index int64 + MarketIndex uint32 + Nonce int64 + Price uint32 + Sig []byte + SignedHash string + TriggerPrice uint32 + type ModifyOrderRequest struct + BaseAmount int64 + MarketId int + OrderIndex int64 + Price uint32 + TriggerPrice uint32 + type ModifyOrderResponse struct + Code int32 + Message string + PredictedExecutionTimeMs int64 + TxHash string + type MsgDispatcher interface + Dispatch func(subscribers map[string]*Subscriber, msg []byte) error + type Notification struct + AccountIndex int64 + Ack bool + AckedAt *string + Content NotificationContent + CreatedAt string + Id string + Kind string + UpdatedAt string + type NotificationContent map[string]interface + type Order struct + BasePrice int64 + BaseSize int64 + BlockHeight int64 + ClientOrderId string + ClientOrderIndex int64 + CreatedAt int64 + FilledBaseAmount string + FilledQuoteAmount string + InitialBaseAmount string + IntegratorFeeCollectorIndex string + IntegratorMakerFee string + IntegratorTakerFee string + IsAsk bool + MarketIndex int + Nonce int64 + OrderExpiry int64 + OrderId string + OrderIndex int64 + OrderType OrderTypeResp + OwnerAccountIndex int + ParentOrderId string + ParentOrderIndex int64 + Price string + ReduceOnly bool + RemainingBaseAmount string + Side string + Status OrderStatus + TimeInForce string + Timestamp int64 + ToCancelOrderId0 string + ToTriggerOrderId0 string + ToTriggerOrderId1 string + ToTriggerOrderId2 string + TransactionTime int64 + TriggerPrice string + TriggerStatus string + TriggerTime int64 + UpdatedAt int64 + type OrderBook struct + BaseAssetId int16 + LiquidationFee string + MakerFee string + MarketId int + MarketType MarketType + MinBaseAmount string + MinQuoteAmount string + OrderQuoteLimit string + QuoteAssetId int16 + Status string + SupportedPriceDecimals uint8 + SupportedQuoteDecimals uint8 + SupportedSizeDecimals uint8 + Symbol string + TakerFee string + type OrderBookDetail struct + BaseAssetId int + CloseoutMarginFraction int + DailyBaseTokenVolume float64 + DailyPriceChange float64 + DailyPriceHigh float64 + DailyPriceLow float64 + DailyQuoteTokenVolume float64 + DailyTradesCount int64 + DefaultInitialMarginFraction int + LastTradePrice float64 + LiquidationFee string + MaintenanceMarginFraction int + MakerFee string + MarketId int + MarketType string + MinBaseAmount string + MinInitialMarginFraction int + MinQuoteAmount string + OpenInterest float64 + PriceDecimals uint8 + QuoteAssetId int + QuoteMultiplier int64 + SizeDecimals uint8 + Status string + SupportedPriceDecimals uint8 + SupportedQuoteDecimals uint8 + SupportedSizeDecimals uint8 + Symbol string + TakerFee string + type OrderBookDetailsResponse struct + Code int32 + Msg string + OrderBookDetails []*OrderBookDetail + SpotOrderBookDetails []*OrderBookDetail + type OrderBookLevel struct + Price string + Size string + type OrderBookOrdersResponse struct + Asks []Ask + Bids []Bid + Code int32 + Msg string + TotalAsks int64 + TotalBids int64 + type OrderBookStat struct + DailyBaseTokenVolume float64 + DailyPriceChange float64 + DailyQuoteTokenVolume float64 + DailyTradesCount int64 + LastTradePrice float64 + Symbol string + type OrderBooksResponse struct + Code int32 + Msg string + OrderBooks []OrderBook + type OrderStatus string + const OrderStatusCanceled + const OrderStatusCanceledChild + const OrderStatusCanceledExpired + const OrderStatusCanceledInvalidBalance + const OrderStatusCanceledLiquidation + const OrderStatusCanceledMarginNotAllowed + const OrderStatusCanceledNotEnoughLiquidity + const OrderStatusCanceledOco + const OrderStatusCanceledPositionNotAllowed + const OrderStatusCanceledPostOnly + const OrderStatusCanceledReduceOnly + const OrderStatusCanceledSelfTrade + const OrderStatusCanceledTooMuchSlippage + const OrderStatusFilled + const OrderStatusInProgress + const OrderStatusOpen + const OrderStatusPartiallyFilled + const OrderStatusPending + const OrderStatusRejected + type OrderTypeResp string + const OrderTypeRespLimit + const OrderTypeRespLiquidation + const OrderTypeRespMarket + const OrderTypeRespStopLoss + const OrderTypeRespStopLossLimit + const OrderTypeRespTakeProfit + const OrderTypeRespTakeProfitLimit + const OrderTypeRespTwap + const OrderTypeRespTwapSub + type Pnl struct + Inflow float64 + Outflow float64 + PoolInflow float64 + PoolOutflow float64 + PoolPnl float64 + PoolTotalShares float64 + Timestamp int64 + TradePnl float64 + type PnlResponse struct + Code int32 + Msg string + Pnl []Pnl + Resolution string + type PoolInfo struct + AnnualPercentageYield float64 + DailyReturn *DailyReturn + MinOperatorShareRate string + OperatorFee string + OperatorShares int64 + SharePrices []*SharePrice + Status uint8 + TotalShares int64 + type Position struct + AllocatedMargin string + AvgEntryPrice string + InitialMarginFraction string + LiquidationPrice string + MarginMode int32 + MarketId int + OpenOrderCount int64 + PendingOrderCount int64 + Position string + PositionTiedOrderCount int64 + PositionValue string + RealizedPnl string + Sign int32 + Symbol string + TotalDiscount string + TotalFundingPaidOut string + UnrealizedPnl string + type PositionFunding struct + Change string + Discount string + FundingId int64 + MarketId int + PositionSide string + PositionSize string + Rate string + Timestamp int64 + type PositionFundingResponse struct + Code int32 + Msg string + PositionFundings []*PositionFunding + type PublicPoolAsset struct + AssetID int16 + Balance string + LockedBalance string + MarginBalance string + MarginMode string + Symbol string + type PublicPoolMetadata struct + AccountIndex int64 + AccountType uint8 + AnnualPercentageYield float64 + Assets []PublicPoolAsset + CreatedAt int64 + L1Address string + MasterAccountIndex int64 + Name string + OperatorFee string + SharpeRatio float64 + Status uint8 + TotalAssetValue string + TotalPerpsValue string + TotalShares int64 + TotalSpotValue string + type PublicPoolsMetadataResponse struct + Code int32 + Msg string + PublicPools []PublicPoolMetadata + type RecentTradesResponse struct + Code int32 + Msg string + Trades []Trade + type ReferralPoints struct + Points string + Rank int64 + TotalPoints string + type ReferralPointsResponse struct + Code int32 + Msg string + ReferralPoints ReferralPoints + type RevokeTokenRequest struct + AccountIndex int64 + TokenId int64 + type RevokeTokenResponse struct + Code int + Msg string + Revoked bool + TokenId int64 + type RiskInfo struct + CrossRiskParameters CrossRiskParameters + IsolatedRiskParameters IsolatedRiskParameters + type SendTxBatchResponse struct + Code int32 + Msg string + Result []string + type Share struct + EntryTimestamp int64 + EntryUsdc string + PrincipalAmount string + PublicPoolIndex int64 + SharesAmount int64 + type SharePrice struct + SharePrice float64 + Timestamp int64 + type SpotAsset struct + AssetId int + Balance string + LockedBalance string + Symbol string + type SpotAvgEntryPrice struct + AssetID int + AssetSize string + AvgEntryPrice string + LastTradeID int64 + type SubscribeRequest struct + Auth *string + Channel string + Type string + type Subscriber struct + Callbacks []Callback + Channel string + func (s *Subscriber) Dispatch(data []byte) + type Token struct + AccountIndex int64 + ApiToken string + Expiry int64 + Name string + Revoked bool + Scopes string + SubAccountAccess bool + TokenID int64 + type TokenListResponse struct + ApiTokens []Token + Code int + Msg string + type Trade struct + AskAccountId int64 + AskAccountPnl string + AskClientId int64 + AskClientIdStr string + AskId int64 + AskIdStr string + BidAccountId int64 + BidAccountPnl string + BidClientId int64 + BidClientIdStr string + BidId int64 + BidIdStr string + BlockHeight int64 + IsMakerAsk bool + MakerEntryQuoteBefore string + MakerFee int32 + MakerInitialMarginFractionBefore int + MakerPositionSignChanged bool + MakerPositionSizeBefore string + MarketId int + Price string + Size string + TakerEntryQuoteBefore string + TakerFee int32 + TakerInitialMarginFractionBefore int + TakerPositionSignChanged bool + TakerPositionSizeBefore string + Timestamp int64 + TradeId int64 + TradeIdStr string + TradeType string + TransactionTime int64 + TxHash string + UsdAmount string + type TradesResponse struct + Code int32 + Msg string + Trades []Trade + type Transfer struct + Amount string + Status string + Timestamp int64 + ToAccount int64 + TxHash string + type TransferFeeInfoResponse struct + Code int32 + Msg string + TransferFeeUSDC int64 + type TransferHistoryResponse struct + Code int32 + Msg string + Transfers []Transfer + type Tx struct + APIKeyIndex int + AccountIndex int64 + BlockHeight int64 + EventInfo string + ExecutedAt int64 + ExpireAt int64 + Hash string + Info string + L1Address string + Nonce int64 + ParentHash string + QueuedAt int64 + SequenceIndex int64 + Status int64 + TransactionIndex int64 + TransactionTime int64 + TxType uint8 + Type uint8 + type TxError struct + Code int + Message string + type TxResponse struct + Code int + Data json.RawMessage + ID string + Message string + PredictedExecutionTimeMs int64 + TxError *TxError + TxHash string + Type string + func (r *TxResponse) Error() string + func (r *TxResponse) IsSuccess() bool + type UpdateLeverageInfo struct + AccountIndex int64 + ApiKeyIndex uint32 + ExpiredAt int64 + InitialMarginFraction uint16 + MarginMode uint8 + MarketIndex uint32 + Nonce int64 + Sig []byte + SignedHash string + type UpdateLeveragePayload struct + Sig []byte + SignedHash string + type UpdateLeverageRequest struct + InitialMarginFraction uint16 + MarginMode uint8 + MarketId int + type UpdateLeverageResponse struct + Code int32 + Msg string + PredictedExecutionTimeMs int64 + TxHash string + type WSConfig struct + Encoding WSEncoding + KeepaliveInterval time.Duration + ReadOnly bool + ReconnectWait time.Duration + URL string + type WSEncoding string + const WSEncodingAuto + const WSEncodingJSON + const WSEncodingMsgpack + type WebsocketClient struct + Conn *websocket.Conn + Logger *zap.SugaredLogger + Mu sync.RWMutex + OnError func(error) + PendingRequests map[string]chan *TxResponse + ReconnectWait time.Duration + Subscriptions map[string]*subscription + URL string + WriteMu sync.Mutex + func NewWebsocketClient(ctx context.Context) *WebsocketClient + func NewWebsocketClientWithConfig(ctx context.Context, cfg WSConfig) *WebsocketClient + func (c *WebsocketClient) CancelAllOrders(ctx context.Context, client *Client, req CancelAllOrdersRequest) (string, error) + func (c *WebsocketClient) CancelOrder(ctx context.Context, client *Client, req CancelOrderRequest) (string, error) + func (c *WebsocketClient) Close() + func (c *WebsocketClient) Connect() error + func (c *WebsocketClient) HandleMessage(message []byte) + func (c *WebsocketClient) ModifyOrder(ctx context.Context, client *Client, req ModifyOrderRequest) (string, error) + func (c *WebsocketClient) PlaceOrder(ctx context.Context, client *Client, req CreateOrderRequest) (string, error) + func (c *WebsocketClient) RegisterPendingRequest(id string) chan *TxResponse + func (c *WebsocketClient) Send(v any) error + func (c *WebsocketClient) Subscribe(channel string, authToken *string, handler func([]byte)) error + func (c *WebsocketClient) SubscribeAccountAll(accountId int64, authToken string, cb func([]byte)) error + func (c *WebsocketClient) SubscribeAccountAllAssets(accountId int64, authToken string, cb func([]byte)) error + func (c *WebsocketClient) SubscribeAccountAllOrders(accountId int64, authToken string, cb func([]byte)) error + func (c *WebsocketClient) SubscribeAccountAllPositions(accountId int64, authToken string, cb func([]byte)) error + func (c *WebsocketClient) SubscribeAccountAllTrades(accountId int64, authToken string, cb func([]byte)) error + func (c *WebsocketClient) SubscribeAccountMarket(marketId int, accountId int64, authToken string, cb func([]byte)) error + func (c *WebsocketClient) SubscribeAccountOrders(marketId int, accountId int64, authToken string, cb func([]byte)) error + func (c *WebsocketClient) SubscribeAccountSpotAvgEntryPrices(accountId int64, authToken string, cb func([]byte)) error + func (c *WebsocketClient) SubscribeAccountTx(accountId int64, authToken string, cb func([]byte)) error + func (c *WebsocketClient) SubscribeAllMarketStats(cb func([]byte)) error + func (c *WebsocketClient) SubscribeAllSpotMarketStats(cb func([]byte)) error + func (c *WebsocketClient) SubscribeHeight(cb func([]byte)) error + func (c *WebsocketClient) SubscribeMarketStats(marketId int, cb func([]byte)) error + func (c *WebsocketClient) SubscribeNotification(accountId int64, authToken string, cb func([]byte)) error + func (c *WebsocketClient) SubscribeOrderBook(marketId int, cb func([]byte)) error + func (c *WebsocketClient) SubscribePoolData(accountId int64, authToken string, cb func([]byte)) error + func (c *WebsocketClient) SubscribePoolInfo(accountId int64, authToken string, cb func([]byte)) error + func (c *WebsocketClient) SubscribeSpotMarketStats(marketId int, cb func([]byte)) error + func (c *WebsocketClient) SubscribeTicker(marketId int, cb func([]byte)) error + func (c *WebsocketClient) SubscribeTrades(marketId int, cb func([]byte)) error + func (c *WebsocketClient) SubscribeUserStats(accountId int64, authToken string, cb func([]byte)) error + func (c *WebsocketClient) UnregisterPendingRequest(id string) + func (c *WebsocketClient) Unsubscribe(channel string) error + func (c *WebsocketClient) UnsubscribeAccountAll(accountId int64) error + func (c *WebsocketClient) UnsubscribeAccountAllAssets(accountId int64) error + func (c *WebsocketClient) UnsubscribeAccountAllOrders(accountId int64) error + func (c *WebsocketClient) UnsubscribeAccountAllPositions(accountId int64) error + func (c *WebsocketClient) UnsubscribeAccountAllTrades(accountId int64) error + func (c *WebsocketClient) UnsubscribeAccountMarket(marketId int, accountId int64) error + func (c *WebsocketClient) UnsubscribeAccountOrders(marketId int, accountId int64) error + func (c *WebsocketClient) UnsubscribeAccountSpotAvgEntryPrices(accountId int64) error + func (c *WebsocketClient) UnsubscribeAccountTx(accountId int64) error + func (c *WebsocketClient) UnsubscribeMarketStats(marketId int) error + func (c *WebsocketClient) UnsubscribeNotification(accountId int64) error + func (c *WebsocketClient) UnsubscribeOrderBook(marketId int) error + func (c *WebsocketClient) UnsubscribePoolData(accountId int64) error + func (c *WebsocketClient) UnsubscribePoolInfo(accountId int64) error + func (c *WebsocketClient) UnsubscribeSpotMarketStats(marketId int) error + func (c *WebsocketClient) UnsubscribeTicker(marketId int) error + func (c *WebsocketClient) UnsubscribeTrades(marketId int) error + func (c *WebsocketClient) UnsubscribeUserStats(accountId int64) error + type Withdraw struct + Amount string + Status string + Timestamp int64 + TxHash string + type WithdrawHistoryResponse struct + Code int32 + Msg string + Withdraws []Withdraw + type WithdrawalDelayResponse struct + Seconds int64 + type WsAccountAllAssetsEvent struct + Assets map[string]*SpotAsset + Channel string + Timestamp int64 + Type string + type WsAccountAllEvent struct + Account int64 + Assets map[string]*SpotAsset + Channel string + DailyTradesCount int64 + DailyVolume float64 + FundingHistories map[string][]FundingHistory + MonthlyTradesCount int64 + MonthlyVolume float64 + Positions map[string]*Position + Shares []Share + TotalTradesCount int64 + TotalVolume float64 + Trades map[string][]Trade + Type string + WeeklyTradesCount int64 + WeeklyVolume float64 + type WsAccountAllOrdersEvent struct + Channel string + Orders map[string][]*Order + Type string + type WsAccountAllPositionsEvent struct + Channel string + Positions map[string]*Position + Shares []Share + Type string + type WsAccountAllTradesEvent struct + Channel string + DailyVolume float64 + MonthlyVolume float64 + TotalVolume float64 + Trades map[string][]Trade + Type string + WeeklyVolume float64 + type WsAccountMarketEvent struct + Account int64 + Assets []*SpotAsset + Channel string + FundingHistory *PositionFunding + Orders []*Order + Position *Position + Trades []Trade + Type string + type WsAccountOrdersEvent struct + Account int64 + Channel string + Nonce int64 + Orders map[string][]*Order + Type string + type WsAccountSpotAvgEntryPricesEvent struct + AvgEntryPrices map[string]SpotAvgEntryPrice + Channel string + Timestamp int64 + Type string + type WsAccountTxEvent struct + Channel string + Txs []Tx + Type string + type WsHeightEvent struct + Channel string + Height int64 + Timestamp int64 + Type string + type WsMarketStatsEvent struct + Channel string + MarketStats struct{ ... } + Timestamp int64 + Type string + type WsNotificationEvent struct + Channel string + Notifs []Notification + Type string + type WsOrderBookEvent struct + Channel string + LastUpdatedAt int64 + Offset int64 + OrderBook struct{ ... } + Timestamp int64 + Type string + type WsPoolDataEvent struct + Account int64 + Channel string + FundingHistories map[string][]PositionFunding + Orders map[string][]*Order + Positions map[string]*Position + Shares []Share + Trades map[string][]Trade + Type string + type WsPoolInfo struct + AnnualPercentageYield float64 + DailyReturns *DailyReturn + MinOperatorShareRate string + OperatorFee string + OperatorShares int64 + SharePrice *SharePrice + Status uint8 + TotalShares int64 + type WsPoolInfoEvent struct + Channel string + PoolInfo *WsPoolInfo + Type string + type WsSpotMarketStats struct + DailyBaseTokenVolume float64 + DailyPriceChange float64 + DailyPriceHigh float64 + DailyPriceLow float64 + DailyQuoteTokenVolume float64 + LastTradePrice string + MarketID int + MidPrice string + type WsSpotMarketStatsEvent struct + Channel string + SpotMarketStats map[string]WsSpotMarketStats + Timestamp int64 + Type string + type WsTickerEvent struct + Channel string + LastUpdatedAt int64 + Ticker struct{ ... } + Timestamp int64 + Type string + type WsTradeEvent struct + Channel string + LiquidationTrades []Trade + Nonce int64 + Trades []Trade + Type string + type WsUserStatsEvent struct + Channel string + Stats struct{ ... } + Type string