{"modulePath":"github.com/QuantProcessing/exchanges","version":"v1.0.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package lighter\n\n## Constants\n\n```go\nconst (\n\tMainnetAPIURL  = \"https://mainnet.zklighter.elliot.ai\"\n\tExplorerAPIURL = \"https://explorer.elliot.ai/api\"\n)\n```\n\n```go\nconst (\n\tTxTypeChangePubKey          = 8\n\tTxTypeCreateSubAccount      = 9\n\tTxTypeCreatePublicPool      = 10\n\tTxTypeUpdatePublicPool      = 11\n\tTxTypeTransfer              = 12\n\tTxTypeWithdraw              = 13\n\tTxTypeCreateOrder           = 14\n\tTxTypeCancelOrder           = 15\n\tTxTypeCancelAllOrders       = 16\n\tTxTypeModifyOrder           = 17\n\tTxTypeMintShares            = 18\n\tTxTypeBurnShares            = 19\n\tTxTypeUpdateLeverage        = 20\n\tTxTypeL2CreateGroupedOrders = 28\n\tTxTypeL2UpdateMargin        = 29\n\n\tOrderTypeLimit           = 0\n\tOrderTypeMarket          = 1\n\tOrderTypeStopLoss        = 2\n\tOrderTypeStopLossLimit   = 3\n\tOrderTypeTakeProfit      = 4\n\tOrderTypeTakeProfitLimit = 5\n\tOrderTypeTwap            = 6\n\n\tOrderTimeInForceImmediateOrCancel = 0\n\tOrderTimeInForceGoodTillTime      = 1\n\tOrderTimeInForcePostOnly          = 2\n\n\tCancelAllTifImmediate = 0\n\tCancelAllTifScheduled = 1\n\tCancelAllTifAbort     = 2\n\n\tNilTriggerPrice         = 0\n\tDefault28DayOrderExpiry = -1\n\tDefaultIocExpiry        = 0\n\tDefault10MinAuthExpiry  = -1\n\tMinute                  = 60\n\n\tCrossMarginMode    = 0\n\tIsolatedMarginMode = 1\n\n\tMainnetChainID = 304\n)\n```\nConstants\n\n```go\nconst (\n\tMainnetWSURL = \"wss://mainnet.zklighter.elliot.ai/stream\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\tErrInvalidSignature = fmt.Errorf(\"invalid signature\")\n\tErrOrderNotFound    = fmt.Errorf(\"order not found\")\n)\n```\nCommon error types\n\n## Functions\n\n```go\nfunc HashCancelAllOrders(lighterChainId uint32, info *CancelAllOrdersInfo) ([]byte, error)\n```\nHashCancelAllOrders computes the hash for a CancelAllOrders transaction. Based on official SDK hash order: chainId, txType, nonce, expiredAt, accountIndex, apiKeyIndex, timeInForce, time\n\n```go\nfunc HashCancelOrder(lighterChainId uint32, info *CancelOrderInfo) ([]byte, error)\n```\nHashCancelOrder computes the hash for a CancelOrder transaction.\n\n```go\nfunc HashCreateOrder(lighterChainId uint32, info *CreateOrderInfo) ([]byte, error)\n```\nHashCreateOrder computes the hash for a CreateOrder transaction.\n\n```go\nfunc HashModifyOrder(lighterChainId uint32, info *ModifyOrderInfo) ([]byte, error)\n```\nHashModifyOrder computes the hash for a ModifyOrder transaction.\n\n```go\nfunc HashUpdateLeverage(lighterChainId uint32, info *UpdateLeverageInfo) ([]byte, error)\n```\nHashUpdateLeverage computes the hash for an UpdateLeverage transaction.\n\n## Types\n\n```go\ntype APIError struct {\n\tCode    int    `json:\"code\"`\n\tMessage string `json:\"message\"`\n}\n```\nAPIError represents an error response from the API\n\n```go\nfunc (e *APIError) Error() string\n```\n\n```go\ntype Account struct {\n\tCode                     int32        `json:\"code\"`\n\tMsg                      string       `json:\"message\"`\n\tAccountType              int8         `json:\"account_type\"`\n\tIndex                    int64        `json:\"index\"`\n\tL1Address                string       `json:\"l1_address\"`\n\tCancelAllTime            int64        `json:\"cancel_all_time\"`\n\tTotalOrderCount          int64        `json:\"total_order_count\"`\n\tTotalIsolatedOrderCount  int64        `json:\"total_isolated_order_count\"`\n\tPendingOrderCount        int64        `json:\"pending_order_count\"`\n\tAvailableBalance         string       `json:\"available_balance\"`\n\tStatus                   uint8        `json:\"status\"`\n\tCollateral               string       `json:\"collateral\"`\n\tAccountIndex             int64        `json:\"account_index\"`\n\tName                     string       `json:\"name\"`\n\tDescription              string       `json:\"description\"`\n\tCanInvite                bool         `json:\"can_invite\"`\n\tReferralPointsPercentage string       `json:\"referral_points_percentage\"`\n\tPositions                []*Position  `json:\"positions\"`\n\tAssets                   []*SpotAsset `json:\"assets\"`\n\tTotalAssetValue          string       `json:\"total_asset_value\"`\n\tCrossAssetValue          string       `json:\"cross_asset_value\"`\n\tPoolInfo                 *PoolInfo    `json:\"pool_info\"`\n\tShares                   []*Share     `json:\"shares\"`\n}\n```\n\n```go\ntype AccountActiveOrdersResponse struct {\n\tCode       int32    `json:\"code\"`\n\tMsg        string   `json:\"message\"`\n\tNextCursor string   `json:\"next_cursor\"`\n\tOrders     []*Order `json:\"orders\"`\n}\n```\n\n```go\ntype AccountInactiveOrdersResponse struct {\n\tCode       int32    `json:\"code\"`\n\tMsg        string   `json:\"message\"`\n\tNextCursor string   `json:\"next_cursor\"`\n\tOrders     []*Order `json:\"orders\"`\n}\n```\n\n```go\ntype AccountInfo struct {\n\tAccountIndex int64  `json:\"account_index\"`\n\tL1Address    string `json:\"l1_address\"`\n}\n```\nAccountInfo represents account information\n\n```go\ntype AccountLimitsResponse struct {\n\tCode                int32  `json:\"code\"`\n\tMsg                 string `json:\"message\"`\n\tMaxLlpPercentage    int32  `json:\"max_llp_percentage\"`\n\tUserTier            string `json:\"user_tier\"`\n\tCanCreatePublicPool bool   `json:\"can_create_public_pool\"`\n\tCurrentMakerFeeTick int32  `json:\"current_maker_fee_tick\"`\n\tCurrentTakerFeeTick int32  `json:\"current_taker_fee_tick\"`\n}\n```\n\n```go\nfunc (r AccountLimitsResponse) AccountTier() AccountTier\n```\n\n```go\ntype AccountMetadata struct {\n\tAccountIndex             int64  `json:\"account_index\"`\n\tName                     string `json:\"name\"`\n\tDescription              string `json:\"description\"`\n\tCanInvite                bool   `json:\"can_invite\"`\n\tReferralPointsPercentage string `json:\"referral_points_percentage\"`\n}\n```\n\n```go\ntype AccountMetadataResponse struct {\n\tCode             int32              `json:\"code\"`\n\tMsg              string             `json:\"message\"`\n\tAccountMetadatas []*AccountMetadata `json:\"account_metadatas\"`\n}\n```\n\n```go\ntype AccountResponse struct {\n\tCode     int32      `json:\"code\"`\n\tMsg      string     `json:\"message\"`\n\tAccounts []*Account `json:\"accounts\"`\n}\n```\n\n```go\ntype AccountStats struct {\n\tCollateral       string `json:\"collateral\"`\n\tPortfolioValue   string `json:\"portfolio_value\"`\n\tLeverage         string `json:\"leverage\"`\n\tAvailableBalance string `json:\"available_balance\"`\n\tMarginUsage      string `json:\"margin_usage\"`\n\tBuyingPower      string `json:\"buying_power\"`\n}\n```\nAccountStats represents account statistics\n\n```go\ntype AccountTier string\n```\n\n```go\nconst (\n\tAccountTierUnknown  AccountTier = \"\"\n\tAccountTierStandard AccountTier = \"standard\"\n\tAccountTierPremium  AccountTier = \"premium\"\n\tAccountTierPlus     AccountTier = \"plus\"\n)\n```\n\n```go\ntype AccountTxsResponse struct {\n\tCode int32  `json:\"code\"`\n\tMsg  string `json:\"message\"`\n\tTxs  []Tx   `json:\"txs\"`\n}\n```\n\n```go\ntype AccountsByL1AddressResponse struct {\n\tCode     int32      `json:\"code\"`\n\tMsg      string     `json:\"message\"`\n\tAccounts []*Account `json:\"accounts\"`\n}\n```\n\n```go\ntype Announcement struct {\n\tId        int64  `json:\"id\"`\n\tTitle     string `json:\"title\"`\n\tContent   string `json:\"content\"`\n\tTimestamp int64  `json:\"timestamp\"`\n}\n```\n\n```go\ntype AnnouncementResponse struct {\n\tCode          int32          `json:\"code\"`\n\tMsg           string         `json:\"message\"`\n\tAnnouncements []Announcement `json:\"announcements\"`\n}\n```\n\n```go\ntype ApiKey struct {\n\tIndex     uint32 `json:\"index\"`\n\tPublicKey string `json:\"public_key\"`\n\tName      string `json:\"name\"`\n\tCreatedAt int64  `json:\"created_at\"`\n}\n```\n\n```go\ntype ApiKeysResponse struct {\n\tCode    int32    `json:\"code\"`\n\tMsg     string   `json:\"message\"`\n\tApiKeys []ApiKey `json:\"api_keys\"`\n}\n```\n\n```go\ntype Ask struct {\n\tOrderIndex          int64  `json:\"order_index\"`\n\tOrderId             string `json:\"order_id\"`\n\tOwnerAccountIndex   int64  `json:\"owner_account_index\"`\n\tInitialBaseAmount   string `json:\"initial_base_amount\"`\n\tRemainingBaseAmount string `json:\"remaining_base_amount\"`\n\tPrice               string `json:\"price\"`\n\tOrderExpiry         int64  `json:\"order_expiry\"`\n}\n```\n\n```go\ntype Asset struct {\n\tAssetIndex          int16  `json:\"asset_index\"`\n\tSymbol              string `json:\"symbol\"`\n\tL1Decimals          uint8  `json:\"l1_decimals\"`\n\tDecimals            uint8  `json:\"decimals\"`\n\tExtensionMultiplier int64  `json:\"extension_multiplier\"`\n\tMinTransferAmount   int64  `json:\"min_transfer_amount\"`\n\tMinWithdrawalAmount int64  `json:\"min_withdrawal_amount\"`\n\tMarginMode          uint8  `json:\"margin_mode\"`\n\tIndexPrice          uint32 `json:\"index_price\"`\n\tL1Address           string `json:\"l1_address\"`\n\tTickSize            string `json:\"tick_size\"`\n}\n```\n\n```go\ntype AssetDetailsResponse struct {\n\tCode   int      `json:\"code\"`\n\tMsg    string   `json:\"message\"`\n\tAssets []*Asset `json:\"assets_details\"`\n}\n```\n\n```go\ntype Bid struct {\n\tOrderIndex          int64  `json:\"order_index\"`\n\tOrderId             string `json:\"order_id\"`\n\tOwnerAccountIndex   int64  `json:\"owner_account_index\"`\n\tInitialBaseAmount   string `json:\"initial_base_amount\"`\n\tRemainingBaseAmount string `json:\"remaining_base_amount\"`\n\tPrice               string `json:\"price\"`\n\tOrderExpiry         int64  `json:\"order_expiry\"`\n}\n```\n\n```go\ntype Callback func([]byte)\n```\nCallback is a function that processes WebSocket messages\n\n```go\ntype CancelAllOrdersInfo struct {\n\tNonce        int64\n\tExpiredAt    int64\n\tAccountIndex int64\n\tApiKeyIndex  uint32\n\tTimeInForce  uint32 // 0=ImmediateCancelAll, 1=ScheduledCancelAll, 2=AbortScheduledCancelAll\n\tTime         int64  // 0 for Immediate, scheduled time for Scheduled, 0 for Abort\n\n\t// For WebSocket operations\n\tSig        []byte `json:\"Sig,omitempty\"`\n\tSignedHash string `json:\"-\"`\n}\n```\nCancelAllOrdersInfo contains information needed to sign a cancel all orders transaction Based on official SDK: [https://github.com/elliottech/lighter-go/blob/main/types/txtypes/cancel\\_all\\_orders.go](https://github.com/elliottech/lighter-go/blob/main/types/txtypes/cancel_all_orders.go)\n\n```go\ntype CancelAllOrdersRequest struct {\n\tMarketId     int    `json:\"market_id\"`\n\tCancelAllTif uint32 `json:\"cancel_all_tif,omitempty\"`\n}\n```\nCancelAllOrdersRequest represents the payload for cancelling all orders\n\n```go\ntype CancelOrderInfo struct {\n\tNonce        int64\n\tExpiredAt    int64\n\tAccountIndex int64\n\tApiKeyIndex  uint32\n\tMarketIndex  uint32\n\tIndex        int64\n\n\t// For WebSocket operations\n\tSig        []byte `json:\"Sig,omitempty\"`\n\tSignedHash string `json:\"-\"`\n}\n```\nCancelOrderInfo contains information needed to sign a cancel order transaction\n\n```go\ntype CancelOrderRequest struct {\n\tMarketId int   `json:\"market_id\"`\n\tOrderId  int64 `json:\"order_id\"`\n}\n```\nCancelOrderRequest represents the payload for cancelling an order\n\n```go\ntype CancelOrderResponse struct {\n\tCode                     int32  `json:\"code\"`\n\tMessage                  string `json:\"message\"`\n\tTxHash                   string `json:\"tx_hash\"`\n\tPredictedExecutionTimeMs int64  `json:\"predicted_execution_time_ms\"`\n}\n```\nCancelOrderResponse represents the response from cancelling an order\n\n```go\ntype Candlestick struct {\n\tTimestamp   int64   `json:\"t\"`\n\tOpen        float64 `json:\"o\"`\n\tHigh        float64 `json:\"h\"`\n\tLow         float64 `json:\"l\"`\n\tClose       float64 `json:\"c\"`\n\tVolume      float64 `json:\"v\"`\n\tQuoteVolume float64 `json:\"V\"`\n\tLastTradeID int64   `json:\"i\"`\n\tCloseRaw    float64 `json:\"C,omitempty\"`\n\tHighRaw     float64 `json:\"H,omitempty\"`\n\tLowRaw      float64 `json:\"L,omitempty\"`\n\tOpenRaw     float64 `json:\"O,omitempty\"`\n}\n```\n\n```go\ntype CandlesticksResponse struct {\n\tCode         int32         `json:\"code\"`\n\tMsg          string        `json:\"message\"`\n\tResolution   string        `json:\"r\"`\n\tCandlesticks []Candlestick `json:\"c\"`\n}\n```\n\n```go\ntype ChangeAccountTierResponse struct {\n\tCode int32  `json:\"code\"`\n\tMsg  string `json:\"message\"`\n}\n```\n\n```go\ntype Client struct {\n\tBaseURL    string\n\tHTTPClient *http.Client\n\tLogger     *zap.SugaredLogger\n\n\tPrivateKey   string\n\tAccountIndex int64\n\tKeyIndex     uint8\n\tChainId      uint32\n\tKeyManager   common.KeyManager\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewClient() *Client\n```\n\n```go\nfunc (c *Client) CancelOrder(ctx context.Context, req CancelOrderRequest) (*CancelOrderResponse, error)\n```\nCancelOrder cancels an order\n\n```go\nfunc (c *Client) ChangeAccountTier(ctx context.Context, newTier string) (*ChangeAccountTierResponse, error)\n```\nChangeAccountTier changes account tier\n\n```go\nfunc (c *Client) CreateAuthToken(deadline time.Time) (string, error)\n```\n\n```go\nfunc (c *Client) CreateToken(ctx context.Context, name, permission string, expiration int64) (string, error)\n```\nCreateToken creates a new API token\n\n```go\nfunc (c *Client) GetAccount(ctx context.Context) (*AccountResponse, error)\n```\nGetAccount fetches account information\n\n```go\nfunc (c *Client) GetAccountActiveOrders(ctx context.Context, marketId int) (*AccountActiveOrdersResponse, error)\n```\nGetAccountActiveOrders fetches active orders for the account\n\n```go\nfunc (c *Client) GetAccountLimits(ctx context.Context) (*AccountLimitsResponse, error)\n```\nGetAccountLimits fetches account limits\n\n```go\nfunc (c *Client) GetAccountMetadata(ctx context.Context) (*AccountMetadataResponse, error)\n```\nGetAccountMetadata fetches account metadata\n\n```go\nfunc (c *Client) GetAccountTxs(ctx context.Context, limit int64) (*AccountTxsResponse, error)\n```\nGetAccountTxs fetches account transactions\n\n```go\nfunc (c *Client) GetAccountsByL1Address(ctx context.Context, l1Address string) (*AccountsByL1AddressResponse, error)\n```\nGetAccountsByL1Address fetches accounts by L1 address\n\n```go\nfunc (c *Client) GetAllFundingRates(ctx context.Context) ([]FundingRateData, error)\n```\nGetAllFundingRates retrieves funding rates for all symbols Returns per-hour funding rates (Lighter uses 1-hour interval natively)\n\n```go\nfunc (c *Client) GetAnnouncements(ctx context.Context) (*AnnouncementResponse, error)\n```\nGetAnnouncements fetches announcements\n\n```go\nfunc (c *Client) GetApiKeys(ctx context.Context) (*ApiKeysResponse, error)\n```\nGetApiKeys fetches API keys\n\n```go\nfunc (c *Client) GetAssetDetails(ctx context.Context, assetIndex *int16) (*AssetDetailsResponse, error)\n```\nGetAssetDetails fetches asset details\n\n```go\nfunc (c *Client) GetBlockHeight(ctx context.Context) (int64, error)\n```\n\n```go\nfunc (c *Client) GetCandlesticks(ctx context.Context, marketId int, resolution string, startTimestamp, endTimestamp, countBack int64) (*CandlesticksResponse, error)\n```\nGetCandlesticks fetches candles.\n\n```go\nfunc (c *Client) GetExchangeStats(ctx context.Context) (*ExchangeStatsResponse, error)\n```\nGetExchangeStats fetches exchange statistics\n\n```go\nfunc (c *Client) GetFundingHistory(ctx context.Context, marketId int, resolution string, startTimestamp, endTimestamp, countBack int64) (*FundingHistoryResponse, error)\n```\nGetFundingHistory fetches historical funding rates.\n\n```go\nfunc (c *Client) GetFundingRate(ctx context.Context, marketId int) (*FundingRateData, error)\n```\nGetFundingRate retrieves the funding rate for a specific market id Returns per-hour funding rate (Lighter uses 1-hour interval natively)\n\n```go\nfunc (c *Client) GetFundingRates(ctx context.Context) (*FundingRatesResponse, error)\n```\nGetFundingRates fetches current funding rates\n\n```go\nfunc (c *Client) GetInactiveOrders(ctx context.Context, marketId *int, limit int64) (*AccountInactiveOrdersResponse, error)\n```\nGetInactiveOrders fetches inactive orders\n\n```go\nfunc (c *Client) GetL1Metadata(ctx context.Context, l1Address string) (*L1MetadataResponse, error)\n```\nGetL1Metadata fetches authenticated L1 metadata for an address.\n\n```go\nfunc (c *Client) GetNextNonce(ctx context.Context) (int64, error)\n```\nGetNextNonce fetches the next nonce for the account, using a local cache to handle high concurrency\n\n```go\nfunc (c *Client) GetOrderBookDetails(ctx context.Context, marketId *int, filter *string) (*OrderBookDetailsResponse, error)\n```\nGetOrderBookDetails fetches order book details\n\n```go\nfunc (c *Client) GetOrderBookOrders(ctx context.Context, marketId int, limit int64) (*OrderBookOrdersResponse, error)\n```\nGetOrderBookOrders fetches detailed order book orders\n\n```go\nfunc (c *Client) GetOrderBooks(ctx context.Context, marketId *int) (*OrderBooksResponse, error)\n```\nGetOrderBooks fetches order books\n\n```go\nfunc (c *Client) GetPnL(ctx context.Context, startTimestamp, endTimestamp int64) (*PnlResponse, error)\n```\nGetPnL fetches account PnL\n\n```go\nfunc (c *Client) GetPositionFunding(ctx context.Context, marketId *int, limit int64, side *string) (*PositionFundingResponse, error)\n```\nGetPositionFunding fetches position funding history\n\n```go\nfunc (c *Client) GetPublicPoolsMetadata(ctx context.Context, filter string, index, limit int64, accountIndex *int64) (*PublicPoolsMetadataResponse, error)\n```\nGetPublicPoolsMetadata fetches public pools metadata.\n\n```go\nfunc (c *Client) GetRecentTrades(ctx context.Context, marketId int, limit int64) (*RecentTradesResponse, error)\n```\nGetRecentTrades fetches recent trades\n\n```go\nfunc (c *Client) GetReferralPoints(ctx context.Context) (*ReferralPointsResponse, error)\n```\nGetReferralPoints fetches referral points\n\n```go\nfunc (c *Client) GetTokens(ctx context.Context) ([]Token, error)\n```\nGetTokens lists all active tokens for the account Notice: This api not return api\\_token filed, what a shit......\n\n```go\nfunc (c *Client) GetTransferFeeInfo(ctx context.Context, toAccountIndex *int64) (*TransferFeeInfoResponse, error)\n```\nGetTransferFeeInfo fetches authenticated transfer fee info.\n\n```go\nfunc (c *Client) GetWithdrawalDelay(ctx context.Context) (*WithdrawalDelayResponse, error)\n```\nGetWithdrawalDelay fetches withdrawal delay.\n\n```go\nfunc (c *Client) InvalidateNonce()\n```\nInvalidateNonce clears the local nonce cache so the next write request refreshes from the exchange after a rejected transaction.\n\n```go\nfunc (c *Client) ModifyOrder(ctx context.Context, req ModifyOrderRequest) (*ModifyOrderResponse, error)\n```\nModifyOrder modifies an existing order\n\n```go\nfunc (c *Client) PlaceOrder(ctx context.Context, req CreateOrderRequest) (*CreateOrderResponse, error)\n```\nPlaceOrder places a new order\n\n```go\nfunc (c *Client) Post(ctx context.Context, path string, payload any, auth bool) ([]byte, error)\n```\n\n```go\nfunc (c *Client) PostForm(ctx context.Context, path string, params map[string]string, auth bool) ([]byte, error)\n```\nPostForm sends a multipart/form-data request\n\n```go\nfunc (c *Client) RevokeToken(ctx context.Context, tokenId int64) error\n```\nRevokeToken revokes an API token\n\n```go\nfunc (c *Client) SendTxBatch(ctx context.Context, txs []map[string]string) (*SendTxBatchResponse, error)\n```\nSendTxBatch sends a batch of transactions\n\n```go\nfunc (c *Client) UpdateLeverage(ctx context.Context, marketId int, leverage uint16, marginMode uint8) (*UpdateLeverageResponse, error)\n```\nUpdateLeverage updates leverage\n\n```go\nfunc (c *Client) WithCredentials(privateKey string, accountIndex int64, keyIndex uint8) *Client\n```\n\n```go\ntype CreateOrderInfo struct {\n\tNonce            int64\n\tExpiredAt        int64\n\tAccountIndex     int64\n\tApiKeyIndex      uint32\n\tMarketIndex      uint32\n\tClientOrderIndex int64\n\tBaseAmount       int64\n\tPrice            uint32\n\tIsAsk            uint32\n\tType             uint32\n\tTimeInForce      uint32\n\tReduceOnly       uint32\n\tTriggerPrice     uint32\n\tOrderExpiry      int64\n\n\t// For WebSocket operations\n\tSig        []byte `json:\"Sig,omitempty\"`\n\tSignedHash string `json:\"-\"`\n}\n```\nCreateOrderInfo contains information needed to sign a create order transaction\n\n```go\ntype CreateOrderRequest struct {\n\tMarketId      int    `json:\"market_id\"`\n\tPrice         uint32 `json:\"price\"`\n\tBaseAmount    int64  `json:\"base_amount\"`\n\tIsAsk         uint32 `json:\"is_ask\"`\n\tOrderType     uint32 `json:\"order_type\"`\n\tClientOrderId int64  `json:\"client_order_id,omitempty\"`\n\tTimeInForce   uint32 `json:\"time_in_force,omitempty\"`\n\tReduceOnly    uint32 `json:\"reduce_only\"`\n\tTriggerPrice  uint32 `json:\"trigger_price\"`\n\tOrderExpiry   int64  `json:\"order_expiry\"`\n}\n```\nCreateOrderRequest represents the payload for creating an order\n\n```go\ntype CreateOrderResponse struct {\n\tCode                     int32  `json:\"code\"`\n\tMessage                  string `json:\"message\"`\n\tTxHash                   string `json:\"tx_hash\"`\n\tPredictedExecutionTimeMs int64  `json:\"predicted_execution_time_ms\"`\n}\n```\nCreateOrderResponse represents the response from creating an order\n\n```go\ntype CreateTokenRequest struct {\n\tName             string `json:\"name\"`\n\tAccountIndex     int64  `json:\"account_index\"`\n\tExpiry           int64  `json:\"expiry\"` // Milliseconds, 0 for max?\n\tSubAccountAccess bool   `json:\"sub_account_access\"`\n\tScopes           string `json:\"scopes,omitempty\"`\n}\n```\n\n```go\ntype CreateTokenResponse struct {\n\tCode             int    `json:\"code\"`\n\tMsg              string `json:\"message\"`\n\tTokenId          int64  `json:\"token_id\"`\n\tApiToken         string `json:\"api_token\"`\n\tName             string `json:\"name\"`\n\tAccountIndex     int64  `json:\"account_index\"`\n\tExpiry           int64  `json:\"expiry\"`\n\tSubAccountAccess bool   `json:\"sub_account_access\"`\n\tScopes           string `json:\"scopes\"`\n}\n```\n\n```go\ntype CrossRiskParameters struct {\n\tMarketId             int    `json:\"market_id\"`\n\tCollateral           string `json:\"collateral\"`\n\tTotalAccountValue    string `json:\"total_account_value\"`\n\tInitialMarginReq     string `json:\"initial_margin_req\"`\n\tMaintenanceMarginReq string `json:\"maintenance_margin_req\"`\n\tCloseOutMarginReq    string `json:\"close_out_margin_req\"`\n}\n```\n\n```go\ntype DailyReturn struct {\n\tTimestamp   int64   `json:\"timestamp\"`\n\tDailyReturn float64 `json:\"daily_return\"`\n}\n```\n\n```go\ntype Deposit struct {\n\tTxHash    string `json:\"tx_hash\"`\n\tAmount    string `json:\"amount\"`\n\tTimestamp int64  `json:\"timestamp\"`\n\tStatus    string `json:\"status\"`\n}\n```\n\n```go\ntype DepositHistoryResponse struct {\n\tCode     int32     `json:\"code\"`\n\tMsg      string    `json:\"message\"`\n\tDeposits []Deposit `json:\"deposits\"`\n}\n```\n\n```go\ntype Envelope struct {\n\tType          string\n\tChannel       string\n\tTimestamp     int64\n\tLastUpdatedAt int64\n\t// contains filtered or unexported fields\n}\n```\nEnvelope is the normalized message shape used by the WebSocket client after decoding either JSON text frames or msgpack binary frames.\n\n```go\nfunc (e *Envelope) Unmarshal(v any) error\n```\n\n```go\ntype ExchangeStatsResponse struct {\n\tCode             int32            `json:\"code\"`\n\tMsg              string           `json:\"message\"`\n\tTotal            int64            `json:\"total\"`\n\tOrderBookStats   []*OrderBookStat `json:\"order_book_stats\"`\n\tDailyUsdVolume   float64          `json:\"daily_usd_volume\"`\n\tDailyTradesCount int64            `json:\"daily_trades_count\"`\n}\n```\n\n```go\ntype FundingHistory struct {\n\tTimestamp    int64  `json:\"timestamp\"`\n\tMarketId     uint8  `json:\"market_id\"`\n\tFundingId    int64  `json:\"funding_id\"`\n\tChange       string `json:\"change\"`\n\tRate         string `json:\"rate\"`\n\tPositionSize string `json:\"position_size\"`\n\tPositionSide string `json:\"position_side\"`\n}\n```\nFundingHistory represents a funding payment\n\n```go\ntype FundingHistoryResponse struct {\n\tCode       int32                `json:\"code\"`\n\tMsg        string               `json:\"message\"`\n\tResolution string               `json:\"resolution\"`\n\tFundings   []FundingRateHistory `json:\"fundings\"`\n}\n```\n\n```go\ntype FundingRate struct {\n\tMarketId int     `json:\"market_id\"`\n\tExchange string  `json:\"exchange\"`\n\tSymbol   string  `json:\"symbol\"`\n\tRate     float64 `json:\"rate\"`\n}\n```\n\n```go\ntype FundingRateData struct {\n\tSymbol               string `json:\"symbol\"`\n\tMarketId             int    `json:\"market_id\"`\n\tExchange             string `json:\"exchange\"`             // Exchange name (lighter, binance, bybit, hyperliquid)\n\tFundingRate          string `json:\"rate\"`                 // Changed from fundingRate to rate to match API\n\tFundingIntervalHours int64  `json:\"fundingIntervalHours\"` // Always 1 for Lighter\n\tFundingTime          int64  `json:\"fundingTime\"`          // Current hour start (calculated)\n\tNextFundingTime      int64  `json:\"nextFundingTime\"`      // Next hour start (calculated)\n}\n```\nFundingRateData contains standardized funding rate information\n\n```go\ntype FundingRateHistory struct {\n\tTimestamp int64  `json:\"timestamp\"`\n\tValue     string `json:\"value\"`\n\tRate      string `json:\"rate\"`\n\tDirection string `json:\"direction\"`\n}\n```\n\n```go\ntype FundingRatesResponse struct {\n\tCode        int32          `json:\"code\"`\n\tMsg         string         `json:\"message\"`\n\tFundingRate []*FundingRate `json:\"funding_rates\"`\n}\n```\n\n```go\ntype IsolatedRiskParameters struct {\n\tMarketId             int    `json:\"market_id\"`\n\tCollateral           string `json:\"collateral\"`\n\tTotalAccountValue    string `json:\"total_account_value\"`\n\tInitialMarginReq     string `json:\"initial_margin_req\"`\n\tMaintenanceMarginReq string `json:\"maintenance_margin_req\"`\n\tCloseOutMarginReq    string `json:\"close_out_margin_req\"`\n}\n```\n\n```go\ntype L1Metadata struct {\n\tChainId   uint32 `json:\"chain_id\"`\n\tBlockNum  uint64 `json:\"block_num\"`\n\tTimestamp uint64 `json:\"timestamp\"`\n}\n```\n\n```go\ntype L1MetadataResponse struct {\n\tL1Address                string `json:\"l1_address\"`\n\tCanInvite                bool   `json:\"can_invite\"`\n\tReferralPointsPercentage string `json:\"referral_points_percentage\"`\n}\n```\n\n```go\ntype L2CreateGroupedOrdersTxInfo struct {\n\tAccountIndex int64\n\tApiKeyIndex  uint8\n\tGroupingType uint8\n\n\tOrders []*CreateOrderInfo\n\n\tExpiredAt int64\n\tNonce     int64\n\n\t// For WebSocket operations\n\tSig        []byte `json:\"Sig,omitempty\"`\n\tSignedHash string `json:\"-\"`\n}\n```\n\n```go\nfunc (txInfo *L2CreateGroupedOrdersTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)\n```\n\n```go\ntype L2UpdateMarginTxInfo struct {\n\tAccountIndex int64\n\tApiKeyIndex  uint8\n\n\tMarketIndex int16\n\tUSDCAmount  int64\n\tDirection   uint8\n\n\tExpiredAt int64\n\tNonce     int64\n\n\t// For WebSocket operations\n\tSig        []byte `json:\"Sig,omitempty\"`\n\tSignedHash string `json:\"-\"`\n}\n```\n\n```go\nfunc (txInfo *L2UpdateMarginTxInfo) Hash(lighterChainId uint32, extra ...g.Element) (msgHash []byte, err error)\n```\n\n```go\ntype LiqInfo struct {\n\tPosition       Position `json:\"position\"`\n\tRiskInfoBefore RiskInfo `json:\"risk_info_before\"`\n\tRiskInfoAfter  RiskInfo `json:\"risk_info_after\"`\n}\n```\n\n```go\ntype LiqTrade struct {\n\tPrice    string `json:\"price\"`\n\tSize     string `json:\"size\"`\n\tTakerFee string `json:\"taker_fee\"`\n\tMakerFee string `json:\"maker_fee\"`\n}\n```\n\n```go\ntype Liquidation struct {\n\tId       int64    `json:\"id\"`\n\tMarketId int      `json:\"market_id\"`\n\tType     string   `json:\"type\"`\n\tTrade    LiqTrade `json:\"trade\"`\n\tInfo     LiqInfo  `json:\"info\"`\n}\n```\n\n```go\ntype LiquidationsResponse struct {\n\tCode         int32         `json:\"code\"`\n\tMsg          string        `json:\"message\"`\n\tLiquidations []Liquidation `json:\"liquidations\"`\n}\n```\n\n```go\ntype MarketType string\n```\n\n```go\nconst (\n\tMarketTypePerp MarketType = \"perp\"\n\tMarketTypeSpot MarketType = \"spot\"\n)\n```\n\n```go\ntype ModifyOrderInfo struct {\n\tNonce        int64\n\tExpiredAt    int64\n\tAccountIndex int64\n\tApiKeyIndex  uint32\n\tMarketIndex  uint32\n\tIndex        int64\n\tBaseAmount   int64\n\tPrice        uint32\n\tTriggerPrice uint32\n\n\t// For WebSocket operations\n\tSig        []byte `json:\"Sig,omitempty\"`\n\tSignedHash string `json:\"-\"`\n}\n```\nModifyOrderInfo contains information needed to sign a modify order transaction\n\n```go\ntype ModifyOrderRequest struct {\n\tMarketId     int\n\tOrderIndex   int64\n\tBaseAmount   int64\n\tPrice        uint32\n\tTriggerPrice uint32\n}\n```\nModifyOrderRequest represents a modify order request\n\n```go\ntype ModifyOrderResponse struct {\n\tCode                     int32  `json:\"code\"`\n\tMessage                  string `json:\"message\"`\n\tTxHash                   string `json:\"tx_hash\"`\n\tPredictedExecutionTimeMs int64  `json:\"predicted_execution_time_ms\"`\n}\n```\n\n```go\ntype MsgDispatcher interface {\n\tDispatch(subscribers map[string]*Subscriber, msg []byte) error\n}\n```\nMsgDispatcher interface for handling different message types\n\n```go\ntype Notification struct {\n\tId           string              `json:\"id\"`\n\tCreatedAt    string              `json:\"created_at\"`\n\tUpdatedAt    string              `json:\"updated_at\"`\n\tKind         string              `json:\"kind\"` // \"liquidation\", \"deleverage\", \"announcement\"\n\tAccountIndex int64               `json:\"account_index\"`\n\tContent      NotificationContent `json:\"content\"`\n\tAck          bool                `json:\"ack\"`\n\tAckedAt      *string             `json:\"acked_at\"`\n}\n```\nNotification represents a notification\n\n```go\ntype NotificationContent map[string]interface{}\n```\nNotificationContent can be different types based on notification kind\n\n```go\ntype Order struct {\n\tOrderIndex                  int64         `json:\"order_index\"`\n\tClientOrderIndex            int64         `json:\"client_order_index\"`\n\tOrderId                     string        `json:\"order_id\"`\n\tClientOrderId               string        `json:\"client_order_id\"`\n\tMarketIndex                 int           `json:\"market_index\"`\n\tOwnerAccountIndex           int           `json:\"owner_account_index\"`\n\tInitialBaseAmount           string        `json:\"initial_base_amount\"`\n\tPrice                       string        `json:\"price\"`\n\tNonce                       int64         `json:\"nonce\"`\n\tRemainingBaseAmount         string        `json:\"remaining_base_amount\"`\n\tIsAsk                       bool          `json:\"is_ask\"`\n\tBaseSize                    int64         `json:\"base_size\"`\n\tBasePrice                   int64         `json:\"base_price\"`\n\tFilledBaseAmount            string        `json:\"filled_base_amount\"`\n\tFilledQuoteAmount           string        `json:\"filled_quote_amount\"`\n\tSide                        string        `json:\"side\"`\n\tOrderType                   OrderTypeResp `json:\"type\"`\n\tTimeInForce                 string        `json:\"time_in_force\"`\n\tReduceOnly                  bool          `json:\"reduce_only\"`\n\tTriggerPrice                string        `json:\"trigger_price\"`\n\tOrderExpiry                 int64         `json:\"order_expiry\"`\n\tStatus                      OrderStatus   `json:\"status\"`\n\tTriggerStatus               string        `json:\"trigger_status\"`\n\tTriggerTime                 int64         `json:\"trigger_time\"`\n\tParentOrderIndex            int64         `json:\"parent_order_index\"`\n\tParentOrderId               string        `json:\"parent_order_id\"`\n\tToTriggerOrderId0           string        `json:\"to_trigger_order_id_0\"`\n\tToTriggerOrderId1           string        `json:\"to_trigger_order_id_1\"`\n\tToTriggerOrderId2           string        `json:\"to_trigger_order_id_2\"`\n\tToCancelOrderId0            string        `json:\"to_cancel_order_id_0\"`\n\tIntegratorFeeCollectorIndex string        `json:\"integrator_fee_collector_index\"`\n\tIntegratorTakerFee          string        `json:\"integrator_taker_fee\"`\n\tIntegratorMakerFee          string        `json:\"integrator_maker_fee\"`\n\tBlockHeight                 int64         `json:\"block_height\"`\n\tTimestamp                   int64         `json:\"timestamp\"`\n\tCreatedAt                   int64         `json:\"created_at\"`\n\tUpdatedAt                   int64         `json:\"updated_at\"`\n\tTransactionTime             int64         `json:\"transaction_time\"`\n}\n```\nOrder represents an order in the system\n\n```go\ntype OrderBook struct {\n\tSymbol                 string     `json:\"symbol\"`\n\tMarketId               int        `json:\"market_id\"`\n\tStatus                 string     `json:\"status\"`\n\tTakerFee               string     `json:\"taker_fee\"`\n\tMakerFee               string     `json:\"maker_fee\"`\n\tLiquidationFee         string     `json:\"liquidation_fee\"`\n\tMinBaseAmount          string     `json:\"min_base_amount\"`\n\tMinQuoteAmount         string     `json:\"min_quote_amount\"`\n\tSupportedSizeDecimals  uint8      `json:\"supported_size_decimals\"`\n\tSupportedPriceDecimals uint8      `json:\"supported_price_decimals\"`\n\tSupportedQuoteDecimals uint8      `json:\"supported_quote_decimals\"`\n\tMarketType             MarketType `json:\"market_type\"`\n\tBaseAssetId            int16      `json:\"base_asset_id\"`\n\tQuoteAssetId           int16      `json:\"quote_asset_id\"`\n\tOrderQuoteLimit        string     `json:\"order_quote_limit\"`\n}\n```\n\n```go\ntype OrderBookDetail struct {\n\tSymbol                       string  `json:\"symbol\"`\n\tMarketId                     int     `json:\"market_id\"`\n\tMarketType                   string  `json:\"market_type\"`\n\tBaseAssetId                  int     `json:\"base_asset_id\"`\n\tQuoteAssetId                 int     `json:\"quote_asset_id\"`\n\tStatus                       string  `json:\"status\"`\n\tTakerFee                     string  `json:\"taker_fee\"`\n\tMakerFee                     string  `json:\"maker_fee\"`\n\tLiquidationFee               string  `json:\"liquidation_fee\"`\n\tMinBaseAmount                string  `json:\"min_base_amount\"`\n\tMinQuoteAmount               string  `json:\"min_quote_amount\"`\n\tSupportedSizeDecimals        uint8   `json:\"supported_size_decimals\"`\n\tSupportedPriceDecimals       uint8   `json:\"supported_price_decimals\"`\n\tSupportedQuoteDecimals       uint8   `json:\"supported_quote_decimals\"`\n\tSizeDecimals                 uint8   `json:\"size_decimals\"`\n\tPriceDecimals                uint8   `json:\"price_decimals\"`\n\tQuoteMultiplier              int64   `json:\"quote_multiplier\"`\n\tDefaultInitialMarginFraction int     `json:\"default_initial_margin_fraction\"`\n\tMinInitialMarginFraction     int     `json:\"min_initial_margin_fraction\"`\n\tMaintenanceMarginFraction    int     `json:\"maintenance_margin_fraction\"`\n\tCloseoutMarginFraction       int     `json:\"closeout_margin_fraction\"`\n\tLastTradePrice               float64 `json:\"last_trade_price\"`\n\tDailyTradesCount             int64   `json:\"daily_trades_count\"`\n\tDailyBaseTokenVolume         float64 `json:\"daily_base_token_volume\"`\n\tDailyQuoteTokenVolume        float64 `json:\"daily_quote_token_volume\"`\n\tDailyPriceLow                float64 `json:\"daily_price_low\"`\n\tDailyPriceHigh               float64 `json:\"daily_price_high\"`\n\tDailyPriceChange             float64 `json:\"daily_price_change\"`\n\tOpenInterest                 float64 `json:\"open_interest\"`\n}\n```\n\n```go\ntype OrderBookDetailsResponse struct {\n\tCode                 int32              `json:\"code\"`\n\tMsg                  string             `json:\"message\"`\n\tOrderBookDetails     []*OrderBookDetail `json:\"order_book_details\"`\n\tSpotOrderBookDetails []*OrderBookDetail `json:\"spot_order_book_details\"`\n}\n```\n\n```go\ntype OrderBookLevel struct {\n\tPrice string `json:\"price\"`\n\tSize  string `json:\"size\"`\n}\n```\n\n```go\ntype OrderBookOrdersResponse struct {\n\tCode      int32  `json:\"code\"`\n\tMsg       string `json:\"message\"`\n\tTotalAsks int64  `json:\"total_asks\"`\n\tAsks      []Ask  `json:\"asks\"`\n\tTotalBids int64  `json:\"total_bids\"`\n\tBids      []Bid  `json:\"bids\"`\n}\n```\nMarket Data types\n\n```go\ntype OrderBookStat struct {\n\tSymbol                string  `json:\"symbol\"`\n\tLastTradePrice        float64 `json:\"last_trade_price\"`\n\tDailyTradesCount      int64   `json:\"daily_trades_count\"`\n\tDailyBaseTokenVolume  float64 `json:\"daily_base_token_volume\"`\n\tDailyQuoteTokenVolume float64 `json:\"daily_quote_token_volume\"`\n\tDailyPriceChange      float64 `json:\"daily_price_change\"`\n}\n```\n\n```go\ntype OrderBooksResponse struct {\n\tCode       int32       `json:\"code\"`\n\tMsg        string      `json:\"message\"`\n\tOrderBooks []OrderBook `json:\"order_books\"`\n}\n```\n\n```go\ntype OrderStatus string\n```\n\n```go\nconst (\n\t// OrderStatus\n\tOrderStatusInProgress                 OrderStatus = \"in-progress\"\n\tOrderStatusPending                    OrderStatus = \"pending\"\n\tOrderStatusOpen                       OrderStatus = \"open\"\n\tOrderStatusFilled                     OrderStatus = \"filled\"\n\tOrderStatusCanceled                   OrderStatus = \"canceled\"\n\tOrderStatusCanceledPostOnly           OrderStatus = \"canceled-post-only\"\n\tOrderStatusCanceledReduceOnly         OrderStatus = \"canceled-reduce-only\"\n\tOrderStatusCanceledPositionNotAllowed OrderStatus = \"canceled-position-not-allowed\"\n\tOrderStatusCanceledMarginNotAllowed   OrderStatus = \"canceled-margin-not-allowed\"\n\tOrderStatusCanceledTooMuchSlippage    OrderStatus = \"canceled-too-much-slippage\"\n\tOrderStatusCanceledNotEnoughLiquidity OrderStatus = \"canceled-not-enough-liquidity\"\n\tOrderStatusCanceledSelfTrade          OrderStatus = \"canceled-self-trade\"\n\tOrderStatusCanceledExpired            OrderStatus = \"canceled-expired\"\n\tOrderStatusCanceledOco                OrderStatus = \"canceled-oco\"\n\tOrderStatusCanceledChild              OrderStatus = \"canceled-child\"\n\tOrderStatusCanceledLiquidation        OrderStatus = \"canceled-liquidation\"\n\tOrderStatusCanceledInvalidBalance     OrderStatus = \"canceled-invalid-balance\"\n\n\t// lighter not provided\n\tOrderStatusRejected        OrderStatus = \"rejected\"\n\tOrderStatusPartiallyFilled OrderStatus = \"partially-filled\"\n)\n```\n\n```go\ntype OrderTypeResp string\n```\n\n```go\nconst (\n\tOrderTypeRespLimit           OrderTypeResp = \"limit\"\n\tOrderTypeRespMarket          OrderTypeResp = \"market\"\n\tOrderTypeRespStopLoss        OrderTypeResp = \"stop-loss\"\n\tOrderTypeRespStopLossLimit   OrderTypeResp = \"stop-loss-limit\"\n\tOrderTypeRespTakeProfit      OrderTypeResp = \"take-profit\"\n\tOrderTypeRespTakeProfitLimit OrderTypeResp = \"take-profit-limit\"\n\tOrderTypeRespTwap            OrderTypeResp = \"twap\"\n\tOrderTypeRespTwapSub         OrderTypeResp = \"twap-sub\"\n\tOrderTypeRespLiquidation     OrderTypeResp = \"liquidation\"\n)\n```\n\n```go\ntype Pnl struct {\n\tTimestamp       int64   `json:\"timestamp\"`\n\tTradePnl        float64 `json:\"trade_pnl\"`\n\tInflow          float64 `json:\"inflow\"`\n\tOutflow         float64 `json:\"outflow\"`\n\tPoolPnl         float64 `json:\"pool_pnl\"`\n\tPoolInflow      float64 `json:\"pool_inflow\"`\n\tPoolOutflow     float64 `json:\"pool_outflow\"`\n\tPoolTotalShares float64 `json:\"pool_total_shares\"`\n}\n```\n\n```go\ntype PnlResponse struct {\n\tCode       int32  `json:\"code\"`\n\tMsg        string `json:\"message\"`\n\tResolution string `json:\"resolution\"`\n\tPnl        []Pnl  `json:\"pnl\"`\n}\n```\n\n```go\ntype PoolInfo struct {\n\tStatus                uint8         `json:\"status\"`\n\tOperatorFee           string        `json:\"operator_fee\"`\n\tMinOperatorShareRate  string        `json:\"min_operator_share_rate\"`\n\tTotalShares           int64         `json:\"total_shares\"`\n\tOperatorShares        int64         `json:\"operator_shares\"`\n\tAnnualPercentageYield float64       `json:\"annual_percentage_yield\"`\n\tDailyReturn           *DailyReturn  `json:\"daily_return\"`\n\tSharePrices           []*SharePrice `json:\"share_prices\"`\n}\n```\n\n```go\ntype Position struct {\n\tMarketId               int    `json:\"market_id\"`\n\tSymbol                 string `json:\"symbol\"`\n\tInitialMarginFraction  string `json:\"initial_margin_fraction\"`\n\tOpenOrderCount         int64  `json:\"open_order_count\"`\n\tPendingOrderCount      int64  `json:\"pending_order_count\"`\n\tPositionTiedOrderCount int64  `json:\"position_tied_order_count\"`\n\tSign                   int32  `json:\"sign\"`\n\tPosition               string `json:\"position\"`\n\tAvgEntryPrice          string `json:\"avg_entry_price\"`\n\tPositionValue          string `json:\"position_value\"`\n\tUnrealizedPnl          string `json:\"unrealized_pnl\"`\n\tRealizedPnl            string `json:\"realized_pnl\"`\n\tLiquidationPrice       string `json:\"liquidation_price\"`\n\tTotalFundingPaidOut    string `json:\"total_funding_paid_out\"`\n\tMarginMode             int32  `json:\"margin_mode\"`\n\tAllocatedMargin        string `json:\"allocated_margin\"`\n\tTotalDiscount          string `json:\"total_discount\"`\n}\n```\n\n```go\ntype PositionFunding struct {\n\tTimestamp    int64  `json:\"timestamp\"`\n\tMarketId     int    `json:\"market_id\"`\n\tFundingId    int64  `json:\"funding_id\"`\n\tChange       string `json:\"change\"`\n\tRate         string `json:\"rate\"`\n\tPositionSize string `json:\"position_size\"`\n\tPositionSide string `json:\"position_side\"`\n\tDiscount     string `json:\"discount\"`\n}\n```\n\n```go\ntype PositionFundingResponse struct {\n\tCode             int32              `json:\"code\"`\n\tMsg              string             `json:\"message\"`\n\tPositionFundings []*PositionFunding `json:\"position_fundings\"`\n}\n```\n\n```go\ntype PublicPoolAsset struct {\n\tSymbol        string `json:\"symbol\"`\n\tAssetID       int16  `json:\"asset_id\"`\n\tBalance       string `json:\"balance\"`\n\tLockedBalance string `json:\"locked_balance\"`\n\tMarginBalance string `json:\"margin_balance\"`\n\tMarginMode    string `json:\"margin_mode\"`\n}\n```\n\n```go\ntype PublicPoolMetadata struct {\n\tAccountIndex          int64             `json:\"account_index\"`\n\tAccountType           uint8             `json:\"account_type\"`\n\tName                  string            `json:\"name\"`\n\tL1Address             string            `json:\"l1_address\"`\n\tAnnualPercentageYield float64           `json:\"annual_percentage_yield\"`\n\tStatus                uint8             `json:\"status\"`\n\tOperatorFee           string            `json:\"operator_fee\"`\n\tTotalAssetValue       string            `json:\"total_asset_value\"`\n\tTotalShares           int64             `json:\"total_shares\"`\n\tAssets                []PublicPoolAsset `json:\"assets\"`\n\tCreatedAt             int64             `json:\"created_at\"`\n\tMasterAccountIndex    int64             `json:\"master_account_index\"`\n\tSharpeRatio           float64           `json:\"sharpe_ratio\"`\n\tTotalPerpsValue       string            `json:\"total_perps_value\"`\n\tTotalSpotValue        string            `json:\"total_spot_value\"`\n}\n```\n\n```go\ntype PublicPoolsMetadataResponse struct {\n\tCode        int32                `json:\"code\"`\n\tMsg         string               `json:\"message\"`\n\tPublicPools []PublicPoolMetadata `json:\"public_pools\"`\n}\n```\n\n```go\ntype RecentTradesResponse struct {\n\tCode   int32   `json:\"code\"`\n\tMsg    string  `json:\"message\"`\n\tTrades []Trade `json:\"trades\"`\n}\n```\n\n```go\ntype ReferralPoints struct {\n\tPoints      string `json:\"points\"`\n\tTotalPoints string `json:\"total_points\"`\n\tRank        int64  `json:\"rank\"`\n}\n```\n\n```go\ntype ReferralPointsResponse struct {\n\tCode           int32          `json:\"code\"`\n\tMsg            string         `json:\"message\"`\n\tReferralPoints ReferralPoints `json:\"referral_points\"`\n}\n```\n\n```go\ntype RevokeTokenRequest struct {\n\tTokenId      int64 `json:\"token_id\"`\n\tAccountIndex int64 `json:\"account_index\"`\n}\n```\n\n```go\ntype RevokeTokenResponse struct {\n\tCode    int    `json:\"code\"`\n\tMsg     string `json:\"message\"`\n\tTokenId int64  `json:\"token_id\"`\n\tRevoked bool   `json:\"revoked\"`\n}\n```\n\n```go\ntype RiskInfo struct {\n\tCrossRiskParameters    CrossRiskParameters    `json:\"cross_risk_parameters\"`\n\tIsolatedRiskParameters IsolatedRiskParameters `json:\"isolated_risk_parameters\"`\n}\n```\n\n```go\ntype SendTxBatchResponse struct {\n\tCode   int32    `json:\"code\"`\n\tMsg    string   `json:\"message\"`\n\tResult []string `json:\"result\"`\n}\n```\n\n```go\ntype Share struct {\n\tPublicPoolIndex int64  `json:\"public_pool_index\"`\n\tSharesAmount    int64  `json:\"shares_amount\"`\n\tEntryUsdc       string `json:\"entry_usdc\"`\n\tPrincipalAmount string `json:\"principal_amount\"`\n\tEntryTimestamp  int64  `json:\"entry_timestamp\"`\n}\n```\n\n```go\ntype SharePrice struct {\n\tTimestamp  int64   `json:\"timestamp\"`\n\tSharePrice float64 `json:\"share_price\"`\n}\n```\n\n```go\ntype SpotAsset struct {\n\tSymbol        string `json:\"symbol\"`\n\tAssetId       int    `json:\"asset_id\"`\n\tBalance       string `json:\"balance\"`\n\tLockedBalance string `json:\"locked_balance\"`\n}\n```\n\n```go\ntype SpotAvgEntryPrice struct {\n\tAssetID       int    `json:\"asset_id\"`\n\tAvgEntryPrice string `json:\"avg_entry_price\"`\n\tAssetSize     string `json:\"asset_size\"`\n\tLastTradeID   int64  `json:\"last_trade_id\"`\n}\n```\n\n```go\ntype SubscribeRequest struct {\n\tType    string  `json:\"type\"`\n\tChannel string  `json:\"channel\"`\n\tAuth    *string `json:\"auth,omitempty\"`\n}\n```\nSubscribeRequest represents a WebSocket subscription request\n\n```go\ntype Subscriber struct {\n\tChannel   string\n\tCallbacks []Callback\n}\n```\nSubscriber manages subscriptions for a channel\n\n```go\nfunc (s *Subscriber) Dispatch(data []byte)\n```\n\n```go\ntype Token struct {\n\tTokenID          int64  `json:\"token_id\"`\n\tApiToken         string `json:\"api_token\"`\n\tName             string `json:\"name\"`\n\tExpiry           int64  `json:\"expiry\"`\n\tAccountIndex     int64  `json:\"account_index\"`\n\tSubAccountAccess bool   `json:\"sub_account_access\"`\n\tScopes           string `json:\"scopes\"`\n\tRevoked          bool   `json:\"revoked\"`\n}\n```\nToken structs for API Management\n\n```go\ntype TokenListResponse struct {\n\tCode      int     `json:\"code\"`\n\tMsg       string  `json:\"message\"`\n\tApiTokens []Token `json:\"api_tokens\"`\n}\n```\n\n```go\ntype Trade struct {\n\tTradeId                          int64  `json:\"trade_id\"`\n\tTradeIdStr                       string `json:\"trade_id_str\"`\n\tTxHash                           string `json:\"tx_hash\"`\n\tTradeType                        string `json:\"type\"`\n\tMarketId                         int    `json:\"market_id\"`\n\tSize                             string `json:\"size\"`\n\tPrice                            string `json:\"price\"`\n\tUsdAmount                        string `json:\"usd_amount\"`\n\tAskId                            int64  `json:\"ask_id\"`\n\tAskIdStr                         string `json:\"ask_id_str\"`\n\tBidId                            int64  `json:\"bid_id\"`\n\tBidIdStr                         string `json:\"bid_id_str\"`\n\tAskClientId                      int64  `json:\"ask_client_id\"`\n\tAskClientIdStr                   string `json:\"ask_client_id_str\"`\n\tBidClientId                      int64  `json:\"bid_client_id\"`\n\tBidClientIdStr                   string `json:\"bid_client_id_str\"`\n\tAskAccountId                     int64  `json:\"ask_account_id\"`\n\tBidAccountId                     int64  `json:\"bid_account_id\"`\n\tIsMakerAsk                       bool   `json:\"is_maker_ask\"`\n\tBlockHeight                      int64  `json:\"block_height\"`\n\tTimestamp                        int64  `json:\"timestamp\"`\n\tTakerFee                         int32  `json:\"taker_fee\"`\n\tTakerPositionSizeBefore          string `json:\"taker_position_size_before\"`\n\tTakerEntryQuoteBefore            string `json:\"taker_entry_quote_before\"`\n\tTakerInitialMarginFractionBefore int    `json:\"taker_initial_margin_fraction_before\"`\n\tTakerPositionSignChanged         bool   `json:\"taker_position_sign_changed\"`\n\tMakerFee                         int32  `json:\"maker_fee\"`\n\tMakerPositionSizeBefore          string `json:\"maker_position_size_before\"`\n\tMakerEntryQuoteBefore            string `json:\"maker_entry_quote_before\"`\n\tMakerInitialMarginFractionBefore int    `json:\"maker_initial_margin_fraction_before\"`\n\tMakerPositionSignChanged         bool   `json:\"maker_position_sign_changed\"`\n\tTransactionTime                  int64  `json:\"transaction_time\"`\n\tAskAccountPnl                    string `json:\"ask_account_pnl\"`\n\tBidAccountPnl                    string `json:\"bid_account_pnl\"`\n}\n```\n\n```go\ntype TradesResponse struct {\n\tCode   int32   `json:\"code\"`\n\tMsg    string  `json:\"message\"`\n\tTrades []Trade `json:\"trades\"`\n}\n```\n\n```go\ntype Transfer struct {\n\tTxHash    string `json:\"tx_hash\"`\n\tAmount    string `json:\"amount\"`\n\tTimestamp int64  `json:\"timestamp\"`\n\tStatus    string `json:\"status\"`\n\tToAccount int64  `json:\"to_account\"`\n}\n```\n\n```go\ntype TransferFeeInfoResponse struct {\n\tCode            int32  `json:\"code\"`\n\tMsg             string `json:\"message\"`\n\tTransferFeeUSDC int64  `json:\"transfer_fee_usdc\"`\n}\n```\n\n```go\ntype TransferHistoryResponse struct {\n\tCode      int32      `json:\"code\"`\n\tMsg       string     `json:\"message\"`\n\tTransfers []Transfer `json:\"transfers\"`\n}\n```\n\n```go\ntype Tx struct {\n\tType             uint8  `json:\"type\"`\n\tHash             string `json:\"hash\"`\n\tTxType           uint8  `json:\"tx_type\"`\n\tInfo             string `json:\"info\"`\n\tEventInfo        string `json:\"event_info\"`\n\tStatus           int64  `json:\"status\"`\n\tTransactionIndex int64  `json:\"transaction_index\"`\n\tL1Address        string `json:\"l1_address\"`\n\tAccountIndex     int64  `json:\"account_index\"`\n\tNonce            int64  `json:\"nonce\"`\n\tExpireAt         int64  `json:\"expire_at\"`\n\tBlockHeight      int64  `json:\"block_height\"`\n\tQueuedAt         int64  `json:\"queued_at\"`\n\tExecutedAt       int64  `json:\"executed_at\"`\n\tSequenceIndex    int64  `json:\"sequence_index\"`\n\tParentHash       string `json:\"parent_hash\"`\n\tAPIKeyIndex      int    `json:\"api_key_index\"`\n\tTransactionTime  int64  `json:\"transaction_time\"`\n}\n```\n\n```go\ntype TxError struct {\n\tCode    int    `json:\"code\"`\n\tMessage string `json:\"message\"`\n}\n```\n\n```go\ntype TxResponse struct {\n\tID                       string          `json:\"id\"`\n\tType                     string          `json:\"type\"`\n\tCode                     int             `json:\"code\"`              // 200 = success, others = error\n\tMessage                  string          `json:\"message,omitempty\"` // Error message if code != 200\n\tTxHash                   string          `json:\"tx_hash,omitempty\"`\n\tPredictedExecutionTimeMs int64           `json:\"predicted_execution_time_ms,omitempty\"`\n\tData                     json.RawMessage `json:\"data,omitempty\"`\n\n\tTxError *TxError `json:\"error,omitempty\"`\n}\n```\nTxResponse represents a WebSocket transaction response from Lighter\n\n```go\nfunc (r *TxResponse) Error() string\n```\nError returns the error message if the response is not successful\n\n```go\nfunc (r *TxResponse) IsSuccess() bool\n```\nIsSuccess returns true if the response indicates success\n\n```go\ntype UpdateLeverageInfo struct {\n\tNonce                 int64\n\tExpiredAt             int64\n\tAccountIndex          int64\n\tApiKeyIndex           uint32\n\tMarketIndex           uint32\n\tInitialMarginFraction uint16\n\tMarginMode            uint8\n\n\t// For WebSocket operations\n\tSig        []byte `json:\"Sig,omitempty\"`\n\tSignedHash string `json:\"-\"`\n}\n```\nUpdateLeverageInfo contains information needed to sign an update leverage transaction\n\n```go\ntype UpdateLeveragePayload struct {\n\t*UpdateLeverageInfo\n\tSig        []byte `json:\"Sig\"`\n\tSignedHash string `json:\"-\"`\n}\n```\n\n```go\ntype UpdateLeverageRequest struct {\n\tMarketId              int    `json:\"market_id\"`\n\tInitialMarginFraction uint16 `json:\"initial_margin_fraction\"`\n\tMarginMode            uint8  `json:\"margin_mode\"` // 0: Cross, 1: Isolated\n}\n```\nUpdateLeverageRequest represents the payload for updating leverage\n\n```go\ntype UpdateLeverageResponse struct {\n\tCode                     int32  `json:\"code\"`\n\tMsg                      string `json:\"message\"`\n\tTxHash                   string `json:\"tx_hash\"`\n\tPredictedExecutionTimeMs int64  `json:\"predicted_execution_time_ms\"`\n}\n```\nUpdateLeverageResponse represents the response from updating leverage\n\n```go\ntype WSConfig struct {\n\tURL               string\n\tReadOnly          bool\n\tEncoding          WSEncoding\n\tKeepaliveInterval time.Duration\n\tReconnectWait     time.Duration\n}\n```\n\n```go\ntype WSEncoding string\n```\n\n```go\nconst (\n\tWSEncodingAuto    WSEncoding = \"auto\"\n\tWSEncodingJSON    WSEncoding = \"json\"\n\tWSEncodingMsgpack WSEncoding = \"msgpack\"\n)\n```\n\n```go\ntype WebsocketClient struct {\n\tURL  string\n\tConn *websocket.Conn\n\n\tMu      sync.RWMutex\n\tWriteMu sync.Mutex\n\t// Subscriptions maps channel name -\u003e subscription (auth + handler)\n\tSubscriptions map[string]*subscription\n\t// PendingRequests maps request ID -\u003e response channel for transaction tracking\n\tPendingRequests map[string]chan *TxResponse\n\n\tLogger *zap.SugaredLogger\n\n\t// Reconnect logic\n\tReconnectWait time.Duration\n\n\t// Error handling\n\tOnError func(error)\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewWebsocketClient(ctx context.Context) *WebsocketClient\n```\n\n```go\nfunc NewWebsocketClientWithConfig(ctx context.Context, cfg WSConfig) *WebsocketClient\n```\n\n```go\nfunc (c *WebsocketClient) CancelAllOrders(ctx context.Context, client *Client, req CancelAllOrdersRequest) (string, error)\n```\nCancelAllOrders cancels all orders via WebSocket\n\n```go\nfunc (c *WebsocketClient) CancelOrder(ctx context.Context, client *Client, req CancelOrderRequest) (string, error)\n```\nCancelOrder cancels an order via WebSocket\n\n```go\nfunc (c *WebsocketClient) Close()\n```\n\n```go\nfunc (c *WebsocketClient) Connect() error\n```\n\n```go\nfunc (c *WebsocketClient) HandleMessage(message []byte)\n```\n\n```go\nfunc (c *WebsocketClient) ModifyOrder(ctx context.Context, client *Client, req ModifyOrderRequest) (string, error)\n```\nModifyOrder modifies an order via WebSocket\n\n```go\nfunc (c *WebsocketClient) PlaceOrder(ctx context.Context, client *Client, req CreateOrderRequest) (string, error)\n```\nPlaceOrder places a new order via WebSocket\n\n```go\nfunc (c *WebsocketClient) RegisterPendingRequest(id string) chan *TxResponse\n```\nRegisterPendingRequest creates a response channel for a request ID with timeout\n\n```go\nfunc (c *WebsocketClient) Send(v any) error\n```\n\n```go\nfunc (c *WebsocketClient) Subscribe(channel string, authToken *string, handler func([]byte)) error\n```\nSubscribe registers a handler for a channel.\n\n```go\nfunc (c *WebsocketClient) SubscribeAccountAll(accountId int64, authToken string, cb func([]byte)) error\n```\nSubscribeAccountAll subscribes to all account data\n\n```go\nfunc (c *WebsocketClient) SubscribeAccountAllAssets(accountId int64, authToken string, cb func([]byte)) error\n```\nSubscribeAccountAllAssets subscribes to spot asset balances for a specific account.\n\n```go\nfunc (c *WebsocketClient) SubscribeAccountAllOrders(accountId int64, authToken string, cb func([]byte)) error\n```\nSubscribeAccountAllOrders subscribes to all account orders\n\n```go\nfunc (c *WebsocketClient) SubscribeAccountAllPositions(accountId int64, authToken string, cb func([]byte)) error\n```\nSubscribeAccountAllPositions subscribes to all account positions\n\n```go\nfunc (c *WebsocketClient) SubscribeAccountAllTrades(accountId int64, authToken string, cb func([]byte)) error\n```\nSubscribeAccountAllTrades subscribes to all account trades\n\n```go\nfunc (c *WebsocketClient) SubscribeAccountMarket(marketId int, accountId int64, authToken string, cb func([]byte)) error\n```\nSubscribeAccountMarket subscribes to account data for a specific market\n\n```go\nfunc (c *WebsocketClient) SubscribeAccountOrders(marketId int, accountId int64, authToken string, cb func([]byte)) error\n```\nSubscribeAccountOrders subscribes to account orders for a specific market\n\n```go\nfunc (c *WebsocketClient) SubscribeAccountSpotAvgEntryPrices(accountId int64, authToken string, cb func([]byte)) error\n```\nSubscribeAccountSpotAvgEntryPrices subscribes to spot average entry price updates.\n\n```go\nfunc (c *WebsocketClient) SubscribeAccountTx(accountId int64, authToken string, cb func([]byte)) error\n```\nSubscribeAccountTx subscribes to account transactions\n\n```go\nfunc (c *WebsocketClient) SubscribeAllMarketStats(cb func([]byte)) error\n```\nSubscribeAllMarketStats subscribes to market stats for all markets\n\n```go\nfunc (c *WebsocketClient) SubscribeAllSpotMarketStats(cb func([]byte)) error\n```\nSubscribeAllSpotMarketStats subscribes to spot market stats for all spot markets\n\n```go\nfunc (c *WebsocketClient) SubscribeHeight(cb func([]byte)) error\n```\nSubscribeHeight subscribes to blockchain height updates\n\n```go\nfunc (c *WebsocketClient) SubscribeMarketStats(marketId int, cb func([]byte)) error\n```\nSubscribeMarketStats subscribes to market stats for a specific market\n\n```go\nfunc (c *WebsocketClient) SubscribeNotification(accountId int64, authToken string, cb func([]byte)) error\n```\nSubscribeNotification subscribes to account notifications\n\n```go\nfunc (c *WebsocketClient) SubscribeOrderBook(marketId int, cb func([]byte)) error\n```\nSubscribeOrderBook subscribes to the order book channel for a specific market\n\n```go\nfunc (c *WebsocketClient) SubscribePoolData(accountId int64, authToken string, cb func([]byte)) error\n```\nSubscribePoolData subscribes to pool activity data for a public pool account.\n\n```go\nfunc (c *WebsocketClient) SubscribePoolInfo(accountId int64, authToken string, cb func([]byte)) error\n```\nSubscribePoolInfo subscribes to pool metadata updates for a public pool account.\n\n```go\nfunc (c *WebsocketClient) SubscribeSpotMarketStats(marketId int, cb func([]byte)) error\n```\nSubscribeSpotMarketStats subscribes to spot market stats for a specific market\n\n```go\nfunc (c *WebsocketClient) SubscribeTicker(marketId int, cb func([]byte)) error\n```\nSubscribeTicker subscribes to the best bid/offer ticker channel for a specific market\n\n```go\nfunc (c *WebsocketClient) SubscribeTrades(marketId int, cb func([]byte)) error\n```\nSubscribeTrades subscribes to the trades channel for a specific market\n\n```go\nfunc (c *WebsocketClient) SubscribeUserStats(accountId int64, authToken string, cb func([]byte)) error\n```\nSubscribeUserStats subscribes to user statistics\n\n```go\nfunc (c *WebsocketClient) UnregisterPendingRequest(id string)\n```\nUnregisterPendingRequest removes a pending request\n\n```go\nfunc (c *WebsocketClient) Unsubscribe(channel string) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeAccountAll(accountId int64) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeAccountAllAssets(accountId int64) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeAccountAllOrders(accountId int64) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeAccountAllPositions(accountId int64) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeAccountAllTrades(accountId int64) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeAccountMarket(marketId int, accountId int64) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeAccountOrders(marketId int, accountId int64) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeAccountSpotAvgEntryPrices(accountId int64) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeAccountTx(accountId int64) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeMarketStats(marketId int) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeNotification(accountId int64) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeOrderBook(marketId int) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribePoolData(accountId int64) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribePoolInfo(accountId int64) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeSpotMarketStats(marketId int) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeTicker(marketId int) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeTrades(marketId int) error\n```\n\n```go\nfunc (c *WebsocketClient) UnsubscribeUserStats(accountId int64) error\n```\n\n```go\ntype Withdraw struct {\n\tTxHash    string `json:\"tx_hash\"`\n\tAmount    string `json:\"amount\"`\n\tTimestamp int64  `json:\"timestamp\"`\n\tStatus    string `json:\"status\"`\n}\n```\n\n```go\ntype WithdrawHistoryResponse struct {\n\tCode      int32      `json:\"code\"`\n\tMsg       string     `json:\"message\"`\n\tWithdraws []Withdraw `json:\"withdraws\"`\n}\n```\n\n```go\ntype WithdrawalDelayResponse struct {\n\tSeconds int64 `json:\"seconds\"`\n}\n```\n\n```go\ntype WsAccountAllAssetsEvent struct {\n\tChannel   string                `json:\"channel\"`\n\tType      string                `json:\"type\"`\n\tTimestamp int64                 `json:\"timestamp\"`\n\tAssets    map[string]*SpotAsset `json:\"assets\"`\n}\n```\n\n```go\ntype WsAccountAllEvent struct {\n\tChannel            string                      `json:\"channel\"`\n\tType               string                      `json:\"type\"`\n\tAccount            int64                       `json:\"account\"`\n\tAssets             map[string]*SpotAsset       `json:\"assets\"`\n\tDailyTradesCount   int64                       `json:\"daily_trades_count\"`\n\tDailyVolume        float64                     `json:\"daily_volume\"`\n\tWeeklyTradesCount  int64                       `json:\"weekly_trades_count\"`\n\tWeeklyVolume       float64                     `json:\"weekly_volume\"`\n\tMonthlyTradesCount int64                       `json:\"monthly_trades_count\"`\n\tMonthlyVolume      float64                     `json:\"monthly_volume\"`\n\tTotalTradesCount   int64                       `json:\"total_trades_count\"`\n\tTotalVolume        float64                     `json:\"total_volume\"`\n\tFundingHistories   map[string][]FundingHistory `json:\"funding_histories\"`\n\tPositions          map[string]*Position        `json:\"positions\"`\n\tShares             []Share                     `json:\"shares\"`\n\tTrades             map[string][]Trade          `json:\"trades\"`\n}\n```\nWsAccountAllEvent represents all account data\n\n```go\ntype WsAccountAllOrdersEvent struct {\n\tChannel string              `json:\"channel\"`\n\tType    string              `json:\"type\"`\n\tOrders  map[string][]*Order `json:\"orders\"`\n}\n```\nWsAccountAllOrdersEvent represents all account orders\n\n```go\ntype WsAccountAllPositionsEvent struct {\n\tChannel   string               `json:\"channel\"`\n\tType      string               `json:\"type\"`\n\tPositions map[string]*Position `json:\"positions\"`\n\tShares    []Share              `json:\"shares\"`\n}\n```\nWsAccountAllPositionsEvent represents all account positions\n\n```go\ntype WsAccountAllTradesEvent struct {\n\tChannel       string             `json:\"channel\"`\n\tType          string             `json:\"type\"`\n\tTrades        map[string][]Trade `json:\"trades\"`\n\tTotalVolume   float64            `json:\"total_volume\"`\n\tMonthlyVolume float64            `json:\"monthly_volume\"`\n\tWeeklyVolume  float64            `json:\"weekly_volume\"`\n\tDailyVolume   float64            `json:\"daily_volume\"`\n}\n```\nWsAccountAllTradesEvent represents all account trades\n\n```go\ntype WsAccountMarketEvent struct {\n\tChannel        string           `json:\"channel\"`\n\tType           string           `json:\"type\"`\n\tAccount        int64            `json:\"account\"`\n\tAssets         []*SpotAsset     `json:\"assets\"`\n\tFundingHistory *PositionFunding `json:\"funding_history\"`\n\tPosition       *Position        `json:\"position\"`\n\tOrders         []*Order         `json:\"orders\"`\n\tTrades         []Trade          `json:\"trades\"`\n}\n```\nWsAccountMarketEvent represents account data for a specific market\n\n```go\ntype WsAccountOrdersEvent struct {\n\tChannel string              `json:\"channel\"`\n\tType    string              `json:\"type\"`\n\tAccount int64               `json:\"account\"`\n\tNonce   int64               `json:\"nonce\"`\n\tOrders  map[string][]*Order `json:\"orders\"`\n}\n```\nWsAccountOrdersEvent represents account orders for a specific market\n\n```go\ntype WsAccountSpotAvgEntryPricesEvent struct {\n\tChannel        string                       `json:\"channel\"`\n\tType           string                       `json:\"type\"`\n\tTimestamp      int64                        `json:\"timestamp\"`\n\tAvgEntryPrices map[string]SpotAvgEntryPrice `json:\"avg_entry_prices\"`\n}\n```\n\n```go\ntype WsAccountTxEvent struct {\n\tChannel string `json:\"channel\"`\n\tType    string `json:\"type\"`\n\tTxs     []Tx   `json:\"txs\"`\n}\n```\nWsAccountTxEvent represents account transaction updates\n\n```go\ntype WsHeightEvent struct {\n\tChannel   string `json:\"channel\"`\n\tType      string `json:\"type\"`\n\tHeight    int64  `json:\"height\"`\n\tTimestamp int64  `json:\"timestamp\"`\n}\n```\nWsHeightEvent represents blockchain height updates\n\n```go\ntype WsMarketStatsEvent struct {\n\tChannel     string `json:\"channel\"`\n\tType        string `json:\"type\"`\n\tTimestamp   int64  `json:\"timestamp\"`\n\tMarketStats struct {\n\t\tMarketId              uint8   `json:\"market_id\"`\n\t\tIndexPrice            string  `json:\"index_price\"`\n\t\tMarkPrice             string  `json:\"mark_price\"`\n\t\tOpenInterest          string  `json:\"open_interest\"`\n\t\tLastTradePrice        string  `json:\"last_trade_price\"`\n\t\tCurrentFundingRate    string  `json:\"current_funding_rate\"`\n\t\tFundingRate           string  `json:\"funding_rate\"`\n\t\tFundingTimestamp      int64   `json:\"funding_timestamp\"`\n\t\tDailyBaseTokenVolume  float64 `json:\"daily_base_token_volume\"`\n\t\tDailyQuoteTokenVolume float64 `json:\"daily_quote_token_volume\"`\n\t\tDailyPriceLow         float64 `json:\"daily_price_low\"`\n\t\tDailyPriceHigh        float64 `json:\"daily_price_high\"`\n\t\tDailyPriceChange      float64 `json:\"daily_price_change\"`\n\t} `json:\"market_stats\"`\n}\n```\nWsMarketStatsEvent represents market statistics update\n\n```go\ntype WsNotificationEvent struct {\n\tChannel string         `json:\"channel\"`\n\tType    string         `json:\"type\"`\n\tNotifs  []Notification `json:\"notifs\"`\n}\n```\nWsNotificationEvent represents notification updates\n\n```go\ntype WsOrderBookEvent struct {\n\tChannel       string `json:\"channel\"`\n\tOffset        int64  `json:\"offset\"`\n\tType          string `json:\"type\"`\n\tTimestamp     int64  `json:\"timestamp\"`\n\tLastUpdatedAt int64  `json:\"last_updated_at\"`\n\tOrderBook     struct {\n\t\tCode          int64            `json:\"code\"`\n\t\tAsks          []OrderBookLevel `json:\"asks\"`\n\t\tBids          []OrderBookLevel `json:\"bids\"`\n\t\tOffset        int64            `json:\"offset\"`\n\t\tNonce         int64            `json:\"nonce\"`\n\t\tBeginNonce    int64            `json:\"begin_nonce\"`\n\t\tLastUpdatedAt int64            `json:\"last_updated_at\"`\n\t} `json:\"order_book\"`\n}\n```\nWsOrderBookEvent represents an order book update\n\n```go\ntype WsPoolDataEvent struct {\n\tChannel          string                       `json:\"channel\"`\n\tType             string                       `json:\"type\"`\n\tAccount          int64                        `json:\"account\"`\n\tTrades           map[string][]Trade           `json:\"trades\"`\n\tOrders           map[string][]*Order          `json:\"orders\"`\n\tPositions        map[string]*Position         `json:\"positions\"`\n\tShares           []Share                      `json:\"shares\"`\n\tFundingHistories map[string][]PositionFunding `json:\"funding_histories\"`\n}\n```\n\n```go\ntype WsPoolInfo struct {\n\tStatus                uint8        `json:\"status\"`\n\tOperatorFee           string       `json:\"operator_fee\"`\n\tMinOperatorShareRate  string       `json:\"min_operator_share_rate\"`\n\tTotalShares           int64        `json:\"total_shares\"`\n\tOperatorShares        int64        `json:\"operator_shares\"`\n\tAnnualPercentageYield float64      `json:\"annual_percentage_yield\"`\n\tDailyReturns          *DailyReturn `json:\"daily_returns\"`\n\tSharePrice            *SharePrice  `json:\"share_prices\"`\n}\n```\n\n```go\ntype WsPoolInfoEvent struct {\n\tChannel  string      `json:\"channel\"`\n\tType     string      `json:\"type\"`\n\tPoolInfo *WsPoolInfo `json:\"pool_info\"`\n}\n```\n\n```go\ntype WsSpotMarketStats struct {\n\tMarketID              int     `json:\"market_id\"`\n\tMidPrice              string  `json:\"mid_price\"`\n\tLastTradePrice        string  `json:\"last_trade_price\"`\n\tDailyBaseTokenVolume  float64 `json:\"daily_base_token_volume\"`\n\tDailyQuoteTokenVolume float64 `json:\"daily_quote_token_volume\"`\n\tDailyPriceLow         float64 `json:\"daily_price_low\"`\n\tDailyPriceHigh        float64 `json:\"daily_price_high\"`\n\tDailyPriceChange      float64 `json:\"daily_price_change\"`\n}\n```\n\n```go\ntype WsSpotMarketStatsEvent struct {\n\tChannel         string                       `json:\"channel\"`\n\tType            string                       `json:\"type\"`\n\tTimestamp       int64                        `json:\"timestamp\"`\n\tSpotMarketStats map[string]WsSpotMarketStats `json:\"spot_market_stats\"`\n}\n```\n\n```go\ntype WsTickerEvent struct {\n\tChannel       string `json:\"channel\"`\n\tType          string `json:\"type\"`\n\tTimestamp     int64  `json:\"timestamp\"`\n\tLastUpdatedAt int64  `json:\"last_updated_at\"`\n\tTicker        struct {\n\t\tA OrderBookLevel `json:\"a\"`\n\t\tB OrderBookLevel `json:\"b\"`\n\t} `json:\"ticker\"`\n}\n```\n\n```go\ntype WsTradeEvent struct {\n\tChannel           string  `json:\"channel\"`\n\tType              string  `json:\"type\"`\n\tNonce             int64   `json:\"nonce\"`\n\tTrades            []Trade `json:\"trades\"`\n\tLiquidationTrades []Trade `json:\"liquidation_trades\"`\n}\n```\nWsTradeEvent represents trade updates\n\n```go\ntype WsUserStatsEvent struct {\n\tChannel string `json:\"channel\"`\n\tType    string `json:\"type\"`\n\tStats   struct {\n\t\tCollateral         string       `json:\"collateral\"`\n\t\tPortfolioValue     string       `json:\"portfolio_value\"`\n\t\tLeverage           string       `json:\"leverage\"`\n\t\tAvailableBalance   string       `json:\"available_balance\"`\n\t\tMarginUsage        string       `json:\"margin_usage\"`\n\t\tBuyingPower        string       `json:\"buying_power\"`\n\t\tAccountTradingMode int          `json:\"account_trading_mode\"`\n\t\tCrossStats         AccountStats `json:\"cross_stats\"`\n\t\tTotalStats         AccountStats `json:\"total_stats\"`\n\t} `json:\"stats\"`\n}\n```\nWsUserStatsEvent represents user statistics update\n\n","path":"github.com/QuantProcessing/exchanges/sdk/lighter","name":"lighter","synopsis":"","isRedistributable":true}
