Versions in this module Expand all Collapse all v0 v0.1.4 Mar 13, 2026 Changes in this version + type OrderStatusValue string + const StatusCanceled + const StatusDelistedCanceled + const StatusFilled + const StatusLiquidatedCanceled + const StatusMarginCanceled + const StatusMinTradeNtlRejected + const StatusOpen + const StatusOpenInterestCapCanceled + const StatusReduceOnlyCanceled + const StatusRejected + const StatusScheduledCancel + const StatusSelfTradeCanceled + const StatusSiblingFilledCanceled + const StatusTickRejected + const StatusTriggered + const StatusVaultWithdrawalCanceled v0.1.3 Mar 13, 2026 v0.1.2 Mar 13, 2026 v0.1.1 Mar 13, 2026 v0.1.0 Mar 13, 2026 Changes in this version + const MainnetAPIURL + var ErrCredentialsRequired = fmt.Errorf("credentials required") + func FloatToString(x float64) (string, error) + func FloatToUsdInt(value float64) int + func GetTimestampMs() int64 + func IsWalletDoesNotExistError(err error) bool + type APIError struct + Code int + Data any + Message string + func (e APIError) Error() string + type APIResponse struct + Response ... + Status string + type ActiveStakingDiscount struct + BpsOfMaxSupply string + Discount string + type BatchModifyAction struct + Modifies []ModifyOrderAction + Type string + type Builder struct + Builder string + Fee int + type CancelOrderAction struct + Cancels []CancelOrderWire + Type string + type CancelOrderWire struct + Asset int + OrderId int64 + type Client struct + AccountAddr string + BaseURL string + Debug bool + ExpiresAfter *int64 + Http *http.Client + LastNonce atomic.Int64 + Logger *zap.SugaredLogger + PrivateKey *ecdsa.PrivateKey + Vault string + func NewClient() *Client + func (c *Client) GetNextNonce() int64 + func (c *Client) GetUserFees(ctx context.Context) (*UserFees, error) + func (c *Client) Post(ctx context.Context, path string, payload any) ([]byte, error) + func (c *Client) PostAction(ctx context.Context, action any, sig SignatureResult, nonce int64) ([]byte, error) + func (c *Client) WithAccount(accountAddr string) *Client + func (c *Client) WithCredentials(privateKey string, vault *string) *Client + type CreateOrderAction struct + Builder *Builder + Grouping string + Orders []OrderWire + Type string + type DailyUserVlm struct + Date string + Exchange string + UserAdd string + UserCross string + type FeeSchedule struct + ActiveReferralDiscount string + ActiveStakingDiscount ActiveStakingDiscount + Add string + Cross string + FeeTrialReward string + ReferralDiscount string + SpotAdd string + SpotCross string + StakingDiscountTiers []StakingDiscountTier + StakingLink StakingLink + Tiers Tiers + UserAddRate string + UserCrossRate string + UserSpotAddRate string + UserSpotCrossRate string + type Grouping string + const GroupingNA + const GroupingNormalTpsl + const GroupingPositionTpls + type MM struct + Add string + MakerFractionCutoff string + type MixedArray []MixedValue + func (ma *MixedArray) UnmarshalJSON(data []byte) error + func (ma MixedArray) FirstError() error + type MixedValue json.RawMessage + func (mv *MixedValue) Array() ([]json.RawMessage, bool) + func (mv *MixedValue) Object() (map[string]any, bool) + func (mv *MixedValue) Parse(v any) error + func (mv *MixedValue) String() (string, bool) + func (mv *MixedValue) Type() string + func (mv *MixedValue) UnmarshalJSON(data []byte) error + func (mv MixedValue) MarshalJSON() ([]byte, error) + type ModifyOrderAction struct + Oid any + Order OrderWire + Type string + type OrderTypeWire struct + Limit *OrderTypeWireLimit + Trigger *OrderTypeWireTrigger + type OrderTypeWireLimit struct + Tif Tif + type OrderTypeWireTrigger struct + IsMarket bool + Tpsl Tpsl + TriggerPx string + type OrderWire struct + Asset int + Cloid *string + IsBuy bool + LimitPx string + OrderType OrderTypeWire + ReduceOnly bool + Size string + type PostResult struct + Error error + Response WsPostResponsePayload + type Side string + const SideAsk + const SideBid + type SignatureResult struct + R string + S string + V int + func SignAgent(privateKey *ecdsa.PrivateKey, agentAddress, agentName string, nonce int64, ...) (SignatureResult, error) + func SignApproveBuilderFee(privateKey *ecdsa.PrivateKey, builderAddress string, maxFeeRate float64, ...) (SignatureResult, error) + func SignConvertToMultiSigUserAction(privateKey *ecdsa.PrivateKey, signers []string, threshold int, timestamp int64, ...) (SignatureResult, error) + func SignL1Action(privateKey *ecdsa.PrivateKey, action any, vaultAddress string, timestamp int64, ...) (SignatureResult, error) + func SignMultiSigAction(privateKey *ecdsa.PrivateKey, innerAction map[string]any, signers []string, ...) (SignatureResult, error) + func SignPerpDexClassTransferAction(privateKey *ecdsa.PrivateKey, dex, token string, amount float64, toPerp bool, ...) (SignatureResult, error) + func SignSpotTransferAction(privateKey *ecdsa.PrivateKey, amount float64, destination, token string, ...) (SignatureResult, error) + func SignTokenDelegateAction(privateKey *ecdsa.PrivateKey, token string, amount float64, ...) (SignatureResult, error) + func SignUsdClassTransferAction(privateKey *ecdsa.PrivateKey, amount float64, toPerp bool, timestamp int64, ...) (SignatureResult, error) + func SignUsdTransferAction(privateKey *ecdsa.PrivateKey, amount float64, destination string, ...) (SignatureResult, error) + func SignUserSignedAction(privateKey *ecdsa.PrivateKey, action map[string]any, ...) (SignatureResult, error) + func SignWithdrawFromBridgeAction(privateKey *ecdsa.PrivateKey, destination string, amount, fee float64, ...) (SignatureResult, error) + type StakingDiscountTier struct + BpsOfMaxSupply string + Discount string + type StakingLink struct + StakingUser string + Type string + type Tiers struct + MM []MM + Vip []Vip + type Tif string + const TifFok + const TifGtc + const TifIoc + type Tpsl string + const StopLoss + const TakeProfit + type UpdateIsolatedMarginAction struct + Asset int + IsBuy bool + Ntli int + Type string + type UpdateLeverageAction struct + Asset int + IsCross bool + Leverage int + Type string + type UsdClassTransferAction struct + Amount float64 + ToPerp bool + Type string + type UserFees struct + DailyUserVlm []DailyUserVlm + FeeSchedule FeeSchedule + type ValidationError struct + Field string + Message string + func (e ValidationError) Error() string + type Vip struct + Add string + Cross string + NtlCutoff string + SpotAdd string + SpotCross string + type WebsocketClient struct + AccountAddr string + Conn *websocket.Conn + Debug bool + LastNonce atomic.Int64 + Logger *zap.SugaredLogger + Mu sync.RWMutex + NextPostID atomic.Int64 + PingInterval time.Duration + PostChannels map[int64]chan PostResult + PrivateKey *ecdsa.PrivateKey + ReconnectWait time.Duration + URL string + Vault string + WriteMu sync.Mutex + func NewWebsocketClient(ctx context.Context) *WebsocketClient + func (c *WebsocketClient) Close() + func (c *WebsocketClient) Connect() error + func (c *WebsocketClient) GetNextNonce() int64 + func (c *WebsocketClient) PostAction(action any, sig SignatureResult, nonce int64) (chan PostResult, error) + func (c *WebsocketClient) PostRequest(payload WsPostRequestPayload) (chan PostResult, error) + func (c *WebsocketClient) SendCommand(cmd any) error + func (c *WebsocketClient) Subscribe(channel string, subscription any, handler func(WsMessage)) error + func (c *WebsocketClient) Unsubscribe(channel string, subscription any) error + func (c *WebsocketClient) WithCredentials(privateKey string, vault *string) *WebsocketClient + func (c *WebsocketClient) WithURL(u string) *WebsocketClient + type WsAllMids struct + Mids map[string]string + type WsBbo struct + Bbo []WsLevel + Coin string + Time int64 + type WsCandle struct + C string + H string + I string + L string + N int64 + O string + S string + T int64 + TClose int64 + V string + type WsL2Book struct + Coin string + Levels [][]WsLevel + Time int64 + type WsLevel struct + N int + Px string + Sz string + type WsLiquidation struct + Lid int64 + LiquidatedAccountValue string + LiquidatedNtlPos string + LiquidatedUser string + Liquidator string + type WsMessage struct + Channel string + Data json.RawMessage + type WsNonUserCancel struct + Coin string + Oid int64 + type WsOrder struct + Cliod string + Coin string + LimitPx string + Oid int64 + OrigSz string + Side string + Sz string + Timestamp int64 + type WsOrderUpdate struct + Order WsOrder + Status string + StatusTimestamp int64 + type WsPostRequest struct + ID int64 + Method string + Request WsPostRequestPayload + type WsPostRequestPayload struct + Payload any + Type string + type WsPostResponse struct + ID int64 + Response WsPostResponsePayload + type WsPostResponsePayload struct + Payload json.RawMessage + Type string + type WsSubscribeRequest struct + Method string + Subscription any + type WsSubscriptionResponse struct + Method string + Subscription json.RawMessage + type WsTrade struct + Coin string + Hash string + Px string + Side string + Sz string + Tid int64 + Time int64 + Users []string + type WsUserEvent struct + Fills []WsUserFill + Funding *WsUserFunding + Liquidation *WsLiquidation + NonUserCancel []WsNonUserCancel + type WsUserFill struct + BuilderFee string + ClosedPnl string + Coin string + Crossed bool + Dir string + Fee string + FeeToken string + Hash string + Liquidation *WsLiquidation + Oid int64 + Px string + Side string + StartPosition string + Sz string + Tid int64 + Time int64 + type WsUserFills struct + Fills []WsUserFill + IsSnapshot bool + User string + type WsUserFunding struct + Coin string + FundingRate string + Szi string + Time int64 + Usdc string + type WsUserLiquidations struct + Coin string + Px string + Sz string + Tid int64 + Time int64 + Usdc string + type WsUserNonFundingLedgerUpdates struct + Coin string + Time int64 + Type string + Usdc string