Versions in this module Expand all Collapse all v0 v0.2.1 Mar 26, 2026 v0.2.0 Mar 25, 2026 v0.1.4 Mar 13, 2026 v0.1.3 Mar 13, 2026 v0.1.2 Mar 13, 2026 v0.1.1 Mar 13, 2026 Changes in this version + const ChainID + const EdgeURL + const MarketDataURL + const OrderStatusCancelled + const OrderStatusFilled + const OrderStatusOpen + const OrderStatusPending + const OrderStatusRejected + const PingPeriod + const PongWait + const PriceMultiplier + const ReconnectWait + const StreamDeposit + const StreamFill + const StreamKline + const StreamMiniTickerDelta + const StreamMiniTickerSnap + const StreamOrderCancel + const StreamOrderState + const StreamOrderUpdate + const StreamOrderbookDelta + const StreamOrderbookSnap + const StreamPositions + const StreamTickerDelta + const StreamTickerSnap + const StreamTrade + const StreamTransfer + const StreamWithdrawal + const TradeDataURL + const WriteWait + const WssMarketURL + const WssTradeRpcURL + const WssTradeURL + var OrderTypes = apitypes.Types + var SignTimeInForceMap = map[TimeInForce]int + func GetEIP712Domain(chainID string) apitypes.TypedDataDomain + func SignOrder(order *OrderRequest, privateKeyHex string, chainID string, ...) error + type AccountSummary struct + AvailableBalance string + DeriskMargin string + DeriskToMaintenanceMarginRatio string + EventTime string + InitialMargin string + IsValue *bool + MaintenanceMargin string + MarginType string + Position []Position + SettleCurrency string + SettleIndexPrice string + SpotBalance []struct{ ... } + SubAccountID string + TotalEquity string + UnrealizedPnl string + VaultImAdditions string + type AccountSummaryResponse struct + Result struct{ ... } + type CancelAllOrderRequest struct + Base *[]string + Kind *[]string + Quote *[]string + SubAccountID string + type CancelAllOrderResponse struct + Result struct{ ... } + type CancelOrderRequest struct + ClientOrderID *string + OrderID *string + SubAccountID string + TimeToLiveMS *string + type CancelOrderResponse struct + Result struct{ ... } + type Client struct + ApiKey string + ChainID string + EdgeURL string + HttpClient *http.Client + MarketDataURL string + PrivateKey string + SubAccountID string + TradeDataURL string + func NewClient() *Client + func (c *Client) CancelAllOrders(ctx context.Context) error + func (c *Client) CancelOrder(ctx context.Context, orderID string) error + func (c *Client) CreateOrder(ctx context.Context, req *CreateOrderRequest, ...) (*CreateOrderResponse, error) + func (c *Client) GetAccountSummary(ctx context.Context) (*GetAccountSummaryResponse, error) + func (c *Client) GetAllFundingRates(ctx context.Context) ([]FundingRateData, error) + func (c *Client) GetAllInitialLeverage(ctx context.Context) (*GetAllInitialLeverageResponse, error) + func (c *Client) GetFundingAccountSummary(ctx context.Context) (*GetFundingAccountSummaryResponse, error) + func (c *Client) GetFundingRate(ctx context.Context, instrument string) (*FundingRateData, error) + func (c *Client) GetHistoricalFundingRate(ctx context.Context, instrument string, startTime *string, endTime *string, ...) (*GetFundingRateResponse, error) + func (c *Client) GetInstruments(ctx context.Context) ([]Instrument, error) + func (c *Client) GetKLine(ctx context.Context, instrument string, interval string, klineType string, ...) (*GetKLineResponse, error) + func (c *Client) GetMiniTicker(ctx context.Context, instrument string) (*GetMiniTickerResponse, error) + func (c *Client) GetOpenOrders(ctx context.Context, symbol string) ([]Order, error) + func (c *Client) GetOrderBook(ctx context.Context, instrument string, limit int) (*GetOrderBookResponse, error) + func (c *Client) GetTicker(ctx context.Context, instrument string) (*GetTickerResponse, error) + func (c *Client) GetTrade(ctx context.Context, instrument string, limit int) (*GetTradeResponse, error) + func (c *Client) Login(ctx context.Context) error + func (c *Client) Post(ctx context.Context, url string, payload interface{}, signed bool) ([]byte, error) + func (c *Client) SetLeverage(ctx context.Context, instrument string, leverage int) (*SetLeverageResponse, error) + func (c *Client) WithCredentials(apiKey, subAccountID, privateKey string) *Client + type CreateOrderRequest struct + Order OrderRequest + type CreateOrderResponse struct + Result Order + type FundingAccountSummary struct + MainAccountId string + SpotBalances []SpotBalance + TotalEquity string + VaultInvestments []VaultInvestment + type FundingRate struct + FundingIntervalHours string + FundingRate float64 + FundingTime string + Instrument string + MarkPrice string + type FundingRateData struct + FundingIntervalHours int64 + FundingRate string + FundingTime string + Instrument string + NextFundingTime string + type GetAccountSummaryRequest struct + SubAccountID string + type GetAccountSummaryResponse struct + Result AccountSummary + type GetAllInitialLeverageRequest struct + SubAccountID string + type GetAllInitialLeverageResponse struct + Results []Leverage + type GetFundingAccountSummaryResponse struct + Result FundingAccountSummary + Tier Tier + type GetFundingRateRequest struct + AggType *string + Cursor *string + EndTime *string + Instrument string + Limit *int64 + StartTime *string + type GetFundingRateResponse struct + Next string + Result []FundingRate + type GetInstrumentsResponse struct + Result []Instrument + type GetKLineRequest struct + Cursor *string + EndTime *string + Instrument string + Interval string + KlineType string + Limit *int64 + StartTime *string + type GetKLineResponse struct + Next string + Result []KLine + type GetMiniTickerRequest struct + Instrument string + type GetMiniTickerResponse struct + Result MiniTicker + type GetOpenOrdersRequest struct + Base *[]string + Kind *[]string + Quote *[]string + SubAccountID string + type GetOpenOrdersResponse struct + Result []Order + type GetOrderBookRequest struct + Depth int + Instrument string + type GetOrderBookResponse struct + Result OrderBook + type GetPositionsResponse struct + Result []Position + type GetTickerRequest struct + Instrument string + type GetTickerResponse struct + Result Ticker + type GetTradeRequest struct + Instrument string + Limit int + type GetTradeResponse struct + Result []Trade + type GrvtError struct + Code int + Message string + Status int + func (e *GrvtError) Error() string + type Instrument struct + AdjustedFundingRateCap string + AdjustedFundingRateFloor string + Base string + BaseDecimals int + CreateTime string + FundingIntervalHours int64 + Instrument string + InstrumentHash string + Kind string + MaxPositionSize string + MinSize string + Quote string + QuoteDecimals int + SettlementPeriod string + TickSize string + Venues []string + type KLine struct + Close string + CloseTime string + High string + Instrument string + Low string + Open string + OpenTime string + Traders int64 + VolumeB string + VolumeQ string + type KlineInterval string + const KlineInterval12h + const KlineInterval15m + const KlineInterval1d + const KlineInterval1h + const KlineInterval1m + const KlineInterval1w + const KlineInterval2h + const KlineInterval2w + const KlineInterval30m + const KlineInterval3d + const KlineInterval3m + const KlineInterval3w + const KlineInterval4h + const KlineInterval4w + const KlineInterval5d + const KlineInterval5m + const KlineInterval8h + type KlineType string + const KlineTypeIndex + const KlineTypeMark + const KlineTypeMid + const KlineTypeTrade + type Leverage struct + Instrument string + Leverage string + MaxLeverage string + MinLeverage string + type LoginRequest struct + ApiKey string + type MiniTicker struct + BestAskPrice string + BestAskSize string + BestBidPrice string + BestBidSize string + EventTime string + IndexPrice string + Instrument string + LastPrice string + MarkPrice string + MidPrice string + type MiniTickerDeltaRate int + const MiniTickerDeltaRate0 + const MiniTickerDeltaRate100 + const MiniTickerDeltaRate1000 + const MiniTickerDeltaRate200 + const MiniTickerDeltaRate50 + const MiniTickerDeltaRate500 + const MiniTickerDeltaRate5000 + type MiniTickerSnapRate int + const MiniTickerSnapRate1000 + const MiniTickerSnapRate200 + const MiniTickerSnapRate500 + const MiniTickerSnapRate5000 + type Order struct + IsMarket bool + Legs []OrderLeg + Metadata OrderMetadata + OrderID string + PostOnly bool + ReduceOnly bool + Signature OrderSignature + State OrderState + SubAccountID string + TimeInForce TimeInForce + type OrderBook struct + Asks []OrderBookLevel + Bids []OrderBookLevel + EventTime string + Instrument string + type OrderBookDeltaRate int + const OrderBookDeltaRate100 + const OrderBookDeltaRate1000 + const OrderBookDeltaRate50 + const OrderBookDeltaRate500 + type OrderBookLevel struct + NumOrders int64 + Price string + Size string + type OrderBookSnapDepth int + const OrderBookSnapDepth10 + const OrderBookSnapDepth100 + const OrderBookSnapDepth50 + const OrderBookSnapDepth500 + type OrderBookSnapRate int + const OrderBookSnapRate1000 + const OrderBookSnapRate500 + type OrderLeg struct + Instrument string + IsBuyintAsset bool + LimitPrice string + Size string + type OrderMetadata struct + Broker string + ClientOrderID string + CreatedTime string + Tigger OrderTrigger + type OrderRequest struct + IsMarket bool + Legs []OrderLeg + Metadata OrderMetadata + PostOnly bool + ReduceOnly bool + Signature OrderSignature + SubAccountID uint64 + TimeInForce TimeInForce + type OrderSignature struct + ChainID string + Expiration string + Nonce uint32 + R string + S string + Signer string + V int + type OrderState struct + AvgFillPrice []string + BookSize []string + RejectReason string + Status OrderStatus + TradedSize []string + UpdateTime string + type OrderStatus string + type OrderTpsl struct + ClosePosition bool + TriggerBy string + TriggerPrice string + type OrderTrigger struct + Tpsl OrderTpsl + TriggerType string + type Position struct + CumulativeFee string + CumulativeRealizedFundingPayment string + EntryPrice string + EstLiquidationPrice string + EventTime string + ExitPrice string + Instrument string + Leverage string + MarkPrice string + Notional string + QuoteIndexPrice string + RealizedPnl string + Roi string + Size string + SubAccountID string + TotalPnl string + UnrealizedPnl string + type SetLeverageRequest struct + Instrument string + Leverage int + SubAccountID string + type SetLeverageResponse struct + Success string + type SpotBalance struct + Balance string + Currency string + IndexPrice string + type Ticker struct + BestAskPrice string + BestAskSize string + BestBidPrice string + BestBidSize string + BuyVolume24hB string + BuyVolume24hQ string + EventTime string + ForwardPrice string + FundingRate string + FundingRate8hAvg string + FundingRate8hCurr string + HighPrice string + IndexPrice string + Instrument string + InterestRate string + LastPrice string + LongShortRatio string + LowPrice string + MarkPrice string + MidPrice string + NextFundingTime string + OpenInterest string + OpenPrice string + SellVolume24hB string + SellVolume24hQ string + type TickerDeltaRate int + const TickerDeltaRate100 + const TickerDeltaRate1000 + const TickerDeltaRate200 + const TickerDeltaRate500 + const TickerDeltaRate5000 + type TickerSnapRate int + const TickerSnapRate1000 + const TickerSnapRate500 + const TickerSnapRate5000 + type Tier struct + FuturesMakerFee int64 + FuturesTakerFee int64 + OptionsMakerFee int64 + OptionsTakerFee int64 + Tier int64 + type TimeInForce string + const AON + const FOK + const GTT + const IOC + type Trade struct + EventTime string + ForwardPrice string + IndexPrice string + Instrument string + InterestRate float64 + IsRpi bool + IsTakerBuyer bool + MarkPrice string + Price string + Size string + TradeId string + Venue string + type TradeLimit int + const TradeLimit1000 + const TradeLimit200 + const TradeLimit50 + const TradeLimit500 + type VaultInvestment struct + NumLpTokens string + SharePrice string + UsdNotionalInvested string + VaultId string + type WebsocketClient struct + Conn *websocket.Conn + Debug bool + Logger *zap.SugaredLogger + Mu sync.RWMutex + URL string + WriteMu sync.Mutex + func NewAccountRpcWebsocketClient(ctx context.Context, client *Client) *WebsocketClient + func NewAccountWebsocketClient(ctx context.Context, client *Client) *WebsocketClient + func NewMarketWebsocketClient(ctx context.Context, client *Client) *WebsocketClient + func (c *WebsocketClient) CancelAllOrders(ctx context.Context, req *CancelAllOrderRequest) (*CancelAllOrderResponse, error) + func (c *WebsocketClient) CancelOrder(ctx context.Context, req *CancelOrderRequest) (*CancelOrderResponse, error) + func (c *WebsocketClient) Close() + func (c *WebsocketClient) Connect() error + func (c *WebsocketClient) PlaceOrder(ctx context.Context, req *OrderRequest) (*CreateOrderResponse, error) + func (c *WebsocketClient) SendRPC(method string, params interface{}) (*WsRpcResponse, error) + func (c *WebsocketClient) Subscribe(stream, selector string, callback func([]byte) error) error + func (c *WebsocketClient) SubscribeDeposit(callback func(WsFeeData[WsDeposit]) error) error + func (c *WebsocketClient) SubscribeFill(instrument string, callback func(WsFeeData[WsFill]) error) error + func (c *WebsocketClient) SubscribeKline(instrument string, interval KlineInterval, typ KlineType, ...) error + func (c *WebsocketClient) SubscribeMiniTickerDelta(instrument string, interval MiniTickerDeltaRate, ...) error + func (c *WebsocketClient) SubscribeMiniTickerSnap(instrument string, interval MiniTickerSnapRate, ...) error + func (c *WebsocketClient) SubscribeOrderCancel(instrument string, callback func(WsFeeData[WsCancelOrderStatus]) error) error + func (c *WebsocketClient) SubscribeOrderState(instrument string, callback func(WsFeeData[WsOrderState]) error) error + func (c *WebsocketClient) SubscribeOrderUpdate(instrument string, callback func(WsFeeData[Order]) error) error + func (c *WebsocketClient) SubscribeOrderbookDelta(instrument string, interval OrderBookDeltaRate, ...) error + func (c *WebsocketClient) SubscribeOrderbookSnap(instrument string, interval OrderBookSnapRate, depth OrderBookSnapDepth, ...) error + func (c *WebsocketClient) SubscribePositions(instrument string, callback func(WsFeeData[Position]) error) error + func (c *WebsocketClient) SubscribeTickerDelta(instrument string, interval TickerDeltaRate, ...) error + func (c *WebsocketClient) SubscribeTickerSnap(instrument string, interval TickerSnapRate, ...) error + func (c *WebsocketClient) SubscribeTrade(instrument string, limit TradeLimit, callback func(WsFeeData[Trade]) error) error + func (c *WebsocketClient) SubscribeTransfer(callback func(WsFeeData[WsTransfer]) error) error + func (c *WebsocketClient) SubscribeWithdrawal(callback func(WsFeeData[WsWithdrawal]) error) error + func (c *WebsocketClient) Unsubscribe(stream, selector string) error + func (c *WebsocketClient) UnsubscribeKline(instrument string, interval KlineInterval, typ KlineType) error + func (c *WebsocketClient) UnsubscribeMiniTickerDelta(instrument string, interval MiniTickerDeltaRate) error + func (c *WebsocketClient) UnsubscribeMiniTickerSnap(instrument string, interval MiniTickerSnapRate) error + func (c *WebsocketClient) UnsubscribeOrderbookDelta(instrument string, interval OrderBookDeltaRate) error + func (c *WebsocketClient) UnsubscribeOrderbookSnap(instrument string, interval OrderBookSnapRate, depth OrderBookSnapDepth) error + func (c *WebsocketClient) UnsubscribeTickerDelta(instrument string, interval TickerDeltaRate) error + func (c *WebsocketClient) UnsubscribeTickerSnap(instrument string, interval TickerSnapRate) error + func (c *WebsocketClient) UnsubscribeTrade(instrument string, limit TradeLimit) error + type WsCancelOrderStatus struct + CancelStatus string + ClientOrderID string + OrderID string + Reason string + SubAccountID string + UpdateTime string + type WsCreateOrderParams struct + Order WsOrderBody + type WsDeposit struct + Currency string + NumTokens string + ToAccountID string + TxHash string + type WsFeeData struct + Feed T + Selector string + SequenceNumber string + Stream string + type WsFill struct + Broker string + ClientOrderID string + EventTime string + Fee string + FeeRate string + ForwardPrice string + IndexPrice string + Instrument string + InterestRate float64 + IsBuyer bool + IsRpi bool + IsTaker bool + MarkPrice string + OrderID string + Price string + RealizedPnl string + Signer string + Size string + SubAccountID string + TradeID string + Venue string + type WsLiteRpcRequest struct + Id uint32 + JsonRpc string + Method string + Params interface{} + type WsOrderBody struct + IsMarket bool + Legs []WsOrderLeg + Metadata WsOrderMetadata + PostOnly bool + ReduceOnly bool + Signature WsOrderSignature + SubAccountID string + TimeInForce TimeInForce + type WsOrderLeg struct + Instrument string + IsBuyingContract bool + LimitPrice string + Size string + type WsOrderMetadata struct + ClientOrderID string + CreatedTime string + type WsOrderSignature struct + ChainID string + Expiration string + Nonce uint32 + R string + S string + Signer string + V int + type WsOrderState struct + ClientOrderID string + OrderID string + OrderState OrderState + type WsRequest struct + Id int64 + JsonRpc string + Method string + Params *WsRequestParams + type WsRequestParams struct + Selectors []string + Stream string + type WsRequestResponse struct + Id int64 + JsonRpc string + Method string + Result struct{ ... } + type WsRpcError struct + Code int + Data string + Message string + type WsRpcRequest struct + Id uint64 + JsonRpc string + Method string + Params interface{} + type WsRpcResponse struct + Error *WsRpcError + Id uint32 + JsonRpc string + Result json.RawMessage + type WsTransfer struct + Currency string + EventTime string + FromAccountID string + FromSubAccountID string + NumTokens string + Signature OrderSignature + ToAccountID string + ToSubAccountID string + TransferType string + TxId string + type WsWithdrawal struct + Currency string + FromAccountID string + NumTokens string + Signature OrderSignature + ToEthAddress string