models

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package models holds the wire types from the contract. JSON field names are the full names; the runtime renames them per type for the lite encoding (liteFrom<T>, fieldLite<T>).

Required fields follow the contract. Input models allow SDK-filled values to be omitted. Only contract-declared partial streams use Partial payload models. JSON strings. Decimal and time.Time retain exact values. Enum fields keep unknown values.

Index

Constants

This section is empty.

Variables

View Source
var AlgoOrderTypeValues = []AlgoOrderType{AlgoOrderTypeChase}

AlgoOrderTypeValues lists every value this SDK knows.

AlgoTriggerFilterValues lists every value this SDK knows.

AssetClassValues lists every value this SDK knows.

BrokerTagValues lists every value this SDK knows.

CDCStatusValues lists every value this SDK knows.

CancelStatusValues lists every value this SDK knows.

CandlestickIntervalValues lists every value this SDK knows.

CandlestickTypeValues lists every value this SDK knows.

View Source
var ChasePriceModeValues = []ChasePriceMode{ChasePriceModeBestBidAsk}

ChasePriceModeValues lists every value this SDK knows.

DayOfWeekValues lists every value this SDK knows.

FundingRateAggregationTypeValues lists every value this SDK knows.

InstrumentSettlementPeriodValues lists every value this SDK knows.

InstrumentStatusValues lists every value this SDK knows.

KindValues lists every value this SDK knows.

MarginTypeValues lists every value this SDK knows.

View Source
var OrderRejectReasonValues = []OrderRejectReason{OrderRejectReasonUnspecified, OrderRejectReasonClientCancel, OrderRejectReasonClientBulkCancel, OrderRejectReasonClientSessionEnd, OrderRejectReasonMarketCancel, OrderRejectReasonIocCancel, OrderRejectReasonAonCancel, OrderRejectReasonFokCancel, OrderRejectReasonExpired, OrderRejectReasonFailPostOnly, OrderRejectReasonFailReduceOnly, OrderRejectReasonMmProtection, OrderRejectReasonSelfTradeProtection, OrderRejectReasonSelfMatchedSubaccount, OrderRejectReasonOverlappingClientOrderID, OrderRejectReasonBelowMargin, OrderRejectReasonLiquidation, OrderRejectReasonInstrumentInvalid, OrderRejectReasonInstrumentDeactivated, OrderRejectReasonSystemFailover, OrderRejectReasonUnauthorised, OrderRejectReasonSessionKeyExpired, OrderRejectReasonSubAccountNotFound, OrderRejectReasonNoTradePermission, OrderRejectReasonUnsupportedTimeInForce, OrderRejectReasonMultiLeggedOrder, OrderRejectReasonExceedMaxPositionSize, OrderRejectReasonExceedMaxSignatureExpiration, OrderRejectReasonMarketOrderWithLimitPrice, OrderRejectReasonClientCancelOnDisconnectTriggered, OrderRejectReasonOcoCounterPartTriggered, OrderRejectReasonReduceOnlyLimit, OrderRejectReasonClientReplace, OrderRejectReasonDeriskMustBeIoc, OrderRejectReasonDeriskMustBeReduceOnly, OrderRejectReasonDeriskNotSupported, OrderRejectReasonInvalidOrderType, OrderRejectReasonCurrencyNotDefined, OrderRejectReasonInvalidChainID, OrderRejectReasonBuilderOrderFeeExceed, OrderRejectReasonBuilderOrderFeeNegative, OrderRejectReasonBuilderOrderBuilderNotAuthorized, OrderRejectReasonBuilderOrderBuilderNotExist, OrderRejectReasonTradePriceWorseThanBankruptcyPrice, OrderRejectReasonTooManyMakerOrders, OrderRejectReasonReduceOnlyNotSupportedForSpotOrder, OrderRejectReasonTpslNotSupportedForSpotOrder, OrderRejectReasonSpotOrderNotSupported, OrderRejectReasonInsufficientBalance, OrderRejectReasonSpotTradingBlockedDuringSocializedLoss, OrderRejectReasonBelowMarginWithPenaltyDeviation, OrderRejectReasonCorporateAction, OrderRejectReasonNotQualifiedMaker, OrderRejectReasonPrivateQuoteRequiresRfq, OrderRejectReasonStablePerpRequiresPriceBound, OrderRejectReasonUnsupportedTriggerBy, OrderRejectReasonRfqNotFound, OrderRejectReasonRestingOrderWouldCross, OrderRejectReasonSessionClosed, OrderRejectReasonRfqTerminated, OrderRejectReasonStablePerpRequiresMultiAssetMode, OrderRejectReasonBorrowLimitExceededAfterTrade, OrderRejectReasonUndeployedLoanAutoExchange, OrderRejectReasonLiquidationAutoExchange, OrderRejectReasonUsdcCollateralDisabled, OrderRejectReasonSfpPostOnlyNotAllowed, OrderRejectReasonVaultNonQuoteInvestmentCurrency, OrderRejectReasonRfqIDRequiresStablePerp, OrderRejectReasonRfqPrivatePoolNotSupported, OrderRejectReasonRfqRequiresIoc, OrderRejectReasonRfqMismatch, OrderRejectReasonRfqAlreadyBound, OrderRejectReasonRfqMakerMustBeEcn, OrderRejectReasonFokNotSupported, OrderRejectReasonMarketOrderNotSupported, OrderRejectReasonStablePerpOrderNotSupported}

OrderRejectReasonValues lists every value this SDK knows.

OrderStatusValues lists every value this SDK knows.

PositionCloseStatusValues lists every value this SDK knows.

PositionMarginTypeValues lists every value this SDK knows.

RepaymentScenarioValues lists every value this SDK knows.

RfqCounterpartyTypeValues lists every value this SDK knows.

RfqSideValues lists every value this SDK knows.

SubAccountModeValues lists every value this SDK knows.

TimeInForceValues lists every value this SDK knows.

TradingScheduleCloseTypeValues lists every value this SDK knows.

TradingSessionTypeValues lists every value this SDK knows.

TransferTypeValues lists every value this SDK knows.

TriggerByValues lists every value this SDK knows.

TriggerTypeValues lists every value this SDK knows.

VaultInvestorActionValues lists every value this SDK knows.

VaultRedemptionReqAgeCategoryValues lists every value this SDK knows.

View Source
var VenueValues = []Venue{VenueOrderbook, VenueRfq}

VenueValues lists every value this SDK knows.

WalletTypeValues lists every value this SDK knows.

WsCandlestickIntervalValues lists every value this SDK knows.

Functions

This section is empty.

Types

type Ack

type Ack struct {
	// Gravity has acknowledged that the request has been successfully received and it will process it in the backend
	Ack bool `json:"ack"`
}

Ack is a wire type.

func (*Ack) UnmarshalJSON

func (v *Ack) UnmarshalJSON(data []byte) error

type AckResponse

type AckResponse struct {
	// The Ack Object
	Result Ack `json:"result"`
}

AckResponse Used to acknowledge a request has been received and will be processed

func (*AckResponse) UnmarshalJSON

func (v *AckResponse) UnmarshalJSON(data []byte) error

type AggregatedAccountSummary

type AggregatedAccountSummary struct {
	// The main account ID of the account to which the summary belongs
	MainAccountID string `json:"main_account_id"`
	// Total equity of the main (+ sub) account, denominated in USD
	TotalEquity Decimal `json:"total_equity"`
	// The list of spot assets owned by this main (+ sub) account, and their balances
	SpotBalances []SpotBalance `json:"spot_balances"`
	// The list of vault investments held by this main account
	VaultInvestments []VaultInvestment `json:"vault_investments"`
	// Deprecated: Use totalSubAccountEquity instead
	TotalSubAccountBalance Decimal `json:"total_sub_account_balance"`
	// Total equity of the sub accounts, denominated in USD
	TotalSubAccountEquity Decimal `json:"total_sub_account_equity"`
	// Total amount of the vault investments, denominated in USD
	TotalVaultInvestmentsBalance Decimal `json:"total_vault_investments_balance"`
	// Total available balance of the main account, denominated in USD
	TotalSubAccountAvailableBalance Decimal `json:"total_sub_account_available_balance"`
	// Total entry (initial investment) amount of the open investments, denominated in USD
	TotalUsdNotionalInvested Decimal `json:"total_usd_notional_invested"`
}

AggregatedAccountSummary is a wire type.

func (*AggregatedAccountSummary) UnmarshalJSON

func (v *AggregatedAccountSummary) UnmarshalJSON(data []byte) error

type AlgoOrder

type AlgoOrder struct {
	// Set by the server. A unique 128-bit identifier for the algo order, assigned by Trade Data
	AlgoOrderID string `json:"algo_order_id,omitempty"`
	// The subaccount initiating the algo order
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The type of the algo order
	Type AlgoOrderType `json:"type"`
	// If True, every sub-order must be a maker order. Chase orders are always post-only
	PostOnly *bool `json:"post_only,omitempty"`
	// If True, every sub-order must reduce the position size, or be cancelled
	ReduceOnly *bool `json:"reduce_only,omitempty"`
	// The single leg traded by this algo order
	Leg AlgoOrderLeg `json:"leg"`
	// Algo order metadata, including the type-specific parameters
	Metadata AlgoOrderMetadata `json:"metadata"`
	// Set by the server. The current state of the algo order
	State *AlgoOrderState `json:"state,omitempty"`
	// The main account ID of the builder
	Builder string `json:"builder"`
	// Builder fee charged for every sub-order, expressed as a percentage (e.g., 0.001 means 0.001%).
	BuilderFee Decimal `json:"builder_fee"`
}

AlgoOrder An algo order is the parent order of an algorithmic execution strategy. Instead of resting on the orderbook itself, it is a set of instructions that GRVT Backend executes on your behalf by placing...

func (*AlgoOrder) UnmarshalJSON

func (v *AlgoOrder) UnmarshalJSON(data []byte) error

type AlgoOrderLeg

type AlgoOrderLeg struct {
	// The instrument to trade
	Instrument string `json:"instrument"`
	// The total number of assets to trade across all sub-orders. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	Size Decimal `json:"size"`
	// Specifies if the algo order is a buy or sell
	IsBuyingAsset bool `json:"is_buying_asset"`
}

AlgoOrderLeg is a wire type.

func (*AlgoOrderLeg) UnmarshalJSON

func (v *AlgoOrderLeg) UnmarshalJSON(data []byte) error

type AlgoOrderMetadata

type AlgoOrderMetadata struct {
	// A unique identifier for the active algo order within a subaccount, specified by the client
	ClientOrderID uint64 `json:"client_order_id,string"`
	// Set by the server. Time at which the algo order was received by GRVT in unix nanoseconds
	CreateTime *time.Time `json:"create_time,omitempty"`
	// Trigger fields. If set, the algo order stays pending until the trigger price is crossed
	Trigger *TriggerOrderMetadata `json:"trigger,omitempty"`
	// Specifies the broker who brokered the algo order
	Broker BrokerTag `json:"broker,omitempty"`
	// Time at which the algo order expires, expressed in unix nanoseconds. Defaults to and must be capped at 90 days
	Expiry *time.Time `json:"expiry,omitempty"`
	// Chase order parameters. Set only when the algo order type is CHASE
	Chase *ChaseAlgoOrderMetadata `json:"chase,omitempty"`
}

AlgoOrderMetadata Metadata fields are used to support Backend only operations.

func (AlgoOrderMetadata) MarshalJSON

func (v AlgoOrderMetadata) MarshalJSON() ([]byte, error)

func (*AlgoOrderMetadata) UnmarshalJSON

func (v *AlgoOrderMetadata) UnmarshalJSON(data []byte) error

type AlgoOrderState

type AlgoOrderState struct {
	// The status of the algo order
	Status OrderStatus `json:"status"`
	// The reason for rejection or cancellation
	RejectReason OrderRejectReason `json:"reject_reason"`
	// The total number of assets traded across all sub-orders
	TradedSize Decimal `json:"traded_size"`
	// The average fill price across all sub-orders
	AvgFillPrice Decimal `json:"avg_fill_price"`
	// Time at which the algo order was triggered in unix nanoseconds, 0 if not triggered yet
	TriggerTime *time.Time `json:"trigger_time,omitempty"`
	// Time at which the algo order was updated by GRVT in unix nanoseconds
	UpdateTime time.Time `json:"update_time"`
	// Chase order state. Set only when the algo order type is CHASE
	Chase *ChaseOrderState `json:"chase,omitempty"`
	// The latest sub-order placed for this algo order, 0 until the first sub-order is placed
	LastSubOrderID string `json:"last_sub_order_id"`
}

AlgoOrderState is a wire type.

func (AlgoOrderState) MarshalJSON

func (v AlgoOrderState) MarshalJSON() ([]byte, error)

func (*AlgoOrderState) UnmarshalJSON

func (v *AlgoOrderState) UnmarshalJSON(data []byte) error

type AlgoOrderType

type AlgoOrderType string

AlgoOrderType Defines the type of an algo order

const (
	// AlgoOrderTypeChase CHASE - A post-only limit order that re-prices toward the best bid/ask until filled or cancelled
	AlgoOrderTypeChase AlgoOrderType = "CHASE"
)

func (AlgoOrderType) Code

func (e AlgoOrderType) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (AlgoOrderType) String

func (e AlgoOrderType) String() string

String returns the wire value.

type AlgoTriggerFilter

type AlgoTriggerFilter string

AlgoTriggerFilter Filters algo orders by whether they carry a trigger condition. Leave the filter unset to apply no trigger filter

const (
	// AlgoTriggerFilterWithTrigger WITH_TRIGGER - Only algo orders that carry a trigger and wait for it to cross before becoming active
	AlgoTriggerFilterWithTrigger AlgoTriggerFilter = "WITH_TRIGGER"
	// AlgoTriggerFilterWithoutTrigger WITHOUT_TRIGGER - Only algo orders that have no trigger and become active on creation
	AlgoTriggerFilterWithoutTrigger AlgoTriggerFilter = "WITHOUT_TRIGGER"
)

func (AlgoTriggerFilter) Code

func (e AlgoTriggerFilter) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (AlgoTriggerFilter) String

func (e AlgoTriggerFilter) String() string

String returns the wire value.

type ApiAddIsolatedPositionMarginRequest

type ApiAddIsolatedPositionMarginRequest struct {
	// The sub account ID to add isolated margin in or remove margin from
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The instrument to add margin into, or remove margin from
	Instrument string `json:"instrument"`
	// The amount of margin to add to the position, positive to add, negative to remove, in the quote asset. Decimal string, e.g. "12.5". Scaled to an integer only...
	Amount Decimal `json:"amount"`
	// The signature of this operation
	Signature Signature `json:"signature"`
}

ApiAddIsolatedPositionMarginRequest The request to add margin to a isolated position

func (*ApiAddIsolatedPositionMarginRequest) UnmarshalJSON

func (v *ApiAddIsolatedPositionMarginRequest) UnmarshalJSON(data []byte) error

type ApiAddIsolatedPositionMarginRequestInput

type ApiAddIsolatedPositionMarginRequestInput struct {
	// The sub account ID to add isolated margin in or remove margin from
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The instrument to add margin into, or remove margin from
	Instrument string `json:"instrument"`
	// The amount of margin to add to the position, positive to add, negative to remove, in the quote asset. Decimal string, e.g. "12.5". Scaled to an integer only...
	Amount Decimal `json:"amount"`
	// The signature of this operation
	Signature *SignatureInput `json:"signature,omitempty"`
}

ApiAddIsolatedPositionMarginRequestInput The request to add margin to a isolated position

func (*ApiAddIsolatedPositionMarginRequestInput) UnmarshalJSON

func (v *ApiAddIsolatedPositionMarginRequestInput) UnmarshalJSON(data []byte) error

type ApiAddIsolatedPositionMarginResponse

type ApiAddIsolatedPositionMarginResponse struct {
	// Whether the margin mode and leverage was set successfully
	Success bool `json:"success"`
}

ApiAddIsolatedPositionMarginResponse The response to add margin to a isolated position

func (*ApiAddIsolatedPositionMarginResponse) UnmarshalJSON

func (v *ApiAddIsolatedPositionMarginResponse) UnmarshalJSON(data []byte) error

type ApiAggregatedAccountSummaryResponse

type ApiAggregatedAccountSummaryResponse struct {
	// The aggregated account summary
	Result AggregatedAccountSummary `json:"result"`
}

ApiAggregatedAccountSummaryResponse The aggregated account summary, that reports the total equity and spot balances of a funding (main) account, and its constituent trading (sub) accounts

func (*ApiAggregatedAccountSummaryResponse) UnmarshalJSON

func (v *ApiAggregatedAccountSummaryResponse) UnmarshalJSON(data []byte) error

type ApiAlgoOrderHistoryRequest

type ApiAlgoOrderHistoryRequest struct {
	// The subaccount ID to filter by
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The algo order type filter to apply. If nil, this defaults to all types. Otherwise, only entries matching the filter will be returned
	Type []AlgoOrderType `json:"type,omitempty"`
	// The start time to apply in nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned
	StartTime *time.Time `json:"start_time,omitempty"`
	// The end time to apply in nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned
	EndTime *time.Time `json:"end_time,omitempty"`
	// The limit to query for. Defaults to 500; Max 1000
	Limit *uint32 `json:"limit,omitempty"`
	// The cursor to indicate when to start the query from
	Cursor string `json:"cursor,omitempty"`
}

ApiAlgoOrderHistoryRequest Retrieves the algo order history for the account. Returns one row per terminated or filled parent algo order, not per sub-order.

func (ApiAlgoOrderHistoryRequest) MarshalJSON

func (v ApiAlgoOrderHistoryRequest) MarshalJSON() ([]byte, error)

func (*ApiAlgoOrderHistoryRequest) UnmarshalJSON

func (v *ApiAlgoOrderHistoryRequest) UnmarshalJSON(data []byte) error

type ApiAlgoOrderHistoryResponse

type ApiAlgoOrderHistoryResponse struct {
	// The algo orders matching the request filter
	Result []AlgoOrder `json:"result"`
	// The cursor to indicate when to start the query from
	Next string `json:"next"`
}

ApiAlgoOrderHistoryResponse is a wire type.

func (ApiAlgoOrderHistoryResponse) NextCursor

func (v ApiAlgoOrderHistoryResponse) NextCursor() string

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiAlgoOrderHistoryResponse) UnmarshalJSON

func (v *ApiAlgoOrderHistoryResponse) UnmarshalJSON(data []byte) error

type ApiAlgoSubOrderHistoryRequest

type ApiAlgoSubOrderHistoryRequest struct {
	// The subaccount ID to filter by
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The `algo_order_id` whose sub-orders are retrieved
	AlgoOrderID string `json:"algo_order_id"`
}

ApiAlgoSubOrderHistoryRequest Retrieves the terminal sub-orders of an algo order. A sub-order appears once it reaches a terminal state: partially filled and superseded, fully filled, cancelled or rejected. Re-price cancels and...

func (*ApiAlgoSubOrderHistoryRequest) UnmarshalJSON

func (v *ApiAlgoSubOrderHistoryRequest) UnmarshalJSON(data []byte) error

type ApiAlgoSubOrderHistoryResponse

type ApiAlgoSubOrderHistoryResponse struct {
	// The sub-orders of the requested algo order
	Result []Order `json:"result"`
}

ApiAlgoSubOrderHistoryResponse is a wire type.

func (*ApiAlgoSubOrderHistoryResponse) UnmarshalJSON

func (v *ApiAlgoSubOrderHistoryResponse) UnmarshalJSON(data []byte) error

type ApiAlgoSubOrderHistoryResponseInput

type ApiAlgoSubOrderHistoryResponseInput struct {
	// The sub-orders of the requested algo order
	Result []OrderInput `json:"result"`
}

ApiAlgoSubOrderHistoryResponseInput is a wire type.

func (*ApiAlgoSubOrderHistoryResponseInput) UnmarshalJSON

func (v *ApiAlgoSubOrderHistoryResponseInput) UnmarshalJSON(data []byte) error

type ApiAuthorizedBuilder

type ApiAuthorizedBuilder struct {
	// The main account ID of the builder
	BuilderAccountID string `json:"builder_account_id"`
	// The maximum fee rate for the authorized builder
	MaxFuturesFeeRate Decimal `json:"max_futures_fee_rate"`
	// The maximum fee rate for the authorized builder
	MaxSpotFeeRate Decimal `json:"max_spot_fee_rate"`
}

ApiAuthorizedBuilder is a wire type.

func (*ApiAuthorizedBuilder) UnmarshalJSON

func (v *ApiAuthorizedBuilder) UnmarshalJSON(data []byte) error

type ApiBuilderFillHistoryRequest

type ApiBuilderFillHistoryRequest struct {
	// The start time to query for in unix nanoseconds
	StartTime *time.Time `json:"start_time,omitempty"`
	// The end time to query for in unix nanoseconds
	EndTime *time.Time `json:"end_time,omitempty"`
	// The limit to query for. Defaults to 500; Max 1000
	Limit *uint32 `json:"limit,omitempty"`
	// The cursor to indicate when to start the next query from
	Cursor string `json:"cursor,omitempty"`
}

ApiBuilderFillHistoryRequest The request to get the historical builder trade of a builder

func (ApiBuilderFillHistoryRequest) MarshalJSON

func (v ApiBuilderFillHistoryRequest) MarshalJSON() ([]byte, error)

func (*ApiBuilderFillHistoryRequest) UnmarshalJSON

func (v *ApiBuilderFillHistoryRequest) UnmarshalJSON(data []byte) error

type ApiBuilderFillHistoryResponse

type ApiBuilderFillHistoryResponse struct {
	// The builder fill history matching the request builder account
	Result []BuilderFillHistory `json:"result"`
	// The cursor to indicate when to start the next query from
	Next string `json:"next,omitempty"`
}

ApiBuilderFillHistoryResponse is a wire type.

func (ApiBuilderFillHistoryResponse) NextCursor

func (v ApiBuilderFillHistoryResponse) NextCursor() string

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiBuilderFillHistoryResponse) UnmarshalJSON

func (v *ApiBuilderFillHistoryResponse) UnmarshalJSON(data []byte) error

type ApiBulkOrdersRequest

type ApiBulkOrdersRequest struct {
	// The subaccount ID of the user creating the request
	SubAccountID uint64 `json:"sub_account_id,string"`
	// Orders to create or replace, supply up to 100 orders
	Orders []Order `json:"orders,omitempty"`
	// The order IDs of the orders to cancel or replace, supply up to 100 orderIDs (if both orderIDs and clientOrderIDs are provided, we will reject the payload)
	OrderIDs []string `json:"order_i_ds,omitempty"`
	// The client order IDs of the orders to cancel or replace, supply up to 100 clientOrderIDs (if both orderIDs and clientOrderIDs are provided, we will reject the...
	ClientOrderIDs Uint64s `json:"client_order_i_ds,omitempty"`
	// Specifies the time-to-live (in milliseconds) for this cancellation.
	TimeToLiveMs *uint64 `json:"time_to_live_ms,omitempty,string"`
}

ApiBulkOrdersRequest Bulk create, cancel, or cancel-replace orders for a single subaccount.

func (*ApiBulkOrdersRequest) UnmarshalJSON

func (v *ApiBulkOrdersRequest) UnmarshalJSON(data []byte) error

type ApiBulkOrdersRequestInput

type ApiBulkOrdersRequestInput struct {
	// The subaccount ID of the user creating the request
	SubAccountID uint64 `json:"sub_account_id,string"`
	// Orders to create or replace, supply up to 100 orders
	Orders []OrderInput `json:"orders,omitempty"`
	// The order IDs of the orders to cancel or replace, supply up to 100 orderIDs (if both orderIDs and clientOrderIDs are provided, we will reject the payload)
	OrderIDs []string `json:"order_i_ds,omitempty"`
	// The client order IDs of the orders to cancel or replace, supply up to 100 clientOrderIDs (if both orderIDs and clientOrderIDs are provided, we will reject the...
	ClientOrderIDs Uint64s `json:"client_order_i_ds,omitempty"`
	// Specifies the time-to-live (in milliseconds) for this cancellation.
	TimeToLiveMs *uint64 `json:"time_to_live_ms,omitempty,string"`
}

ApiBulkOrdersRequestInput Bulk create, cancel, or cancel-replace orders for a single subaccount.

func (*ApiBulkOrdersRequestInput) UnmarshalJSON

func (v *ApiBulkOrdersRequestInput) UnmarshalJSON(data []byte) error

type ApiBulkOrdersResponse

type ApiBulkOrdersResponse struct {
	// The orders in same order as requested
	Orders []Order `json:"orders"`
	// A list of acks for the cancelled orders
	CancelAcks []Ack `json:"cancel_acks"`
}

ApiBulkOrdersResponse is a wire type.

func (*ApiBulkOrdersResponse) UnmarshalJSON

func (v *ApiBulkOrdersResponse) UnmarshalJSON(data []byte) error

type ApiBulkOrdersResponseInput

type ApiBulkOrdersResponseInput struct {
	// The orders in same order as requested
	Orders []OrderInput `json:"orders"`
	// A list of acks for the cancelled orders
	CancelAcks []Ack `json:"cancel_acks"`
}

ApiBulkOrdersResponseInput is a wire type.

func (*ApiBulkOrdersResponseInput) UnmarshalJSON

func (v *ApiBulkOrdersResponseInput) UnmarshalJSON(data []byte) error

type ApiCancelAlgoOrderRequest

type ApiCancelAlgoOrderRequest struct {
	// The subaccount ID cancelling the algo order
	SubAccountID uint64 `json:"sub_account_id,string"`
	// Cancel the algo order with this `algo_order_id`
	AlgoOrderID string `json:"algo_order_id,omitempty"`
	// Cancel the algo order with this `client_order_id`
	ClientOrderID *uint64 `json:"client_order_id,omitempty,string"`
}

ApiCancelAlgoOrderRequest Cancel an algo order for this trading account. This cascades to a full cancel of the sub-order currently resting on the orderbook. Either `algo_order_id` or `client_order_id` must be provided.

func (*ApiCancelAlgoOrderRequest) UnmarshalJSON

func (v *ApiCancelAlgoOrderRequest) UnmarshalJSON(data []byte) error

type ApiCancelAllOrdersRequest

type ApiCancelAllOrdersRequest struct {
	// The subaccount ID cancelling all orders
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be cancelled
	Kind []Kind `json:"kind,omitempty"`
	// The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be cancelled
	Base []string `json:"base,omitempty"`
	// The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be cancelled
	Quote []string `json:"quote,omitempty"`
}

ApiCancelAllOrdersRequest Cancel all orders on the orderbook for this trading account. This may not match new orders in flight.

func (*ApiCancelAllOrdersRequest) UnmarshalJSON

func (v *ApiCancelAllOrdersRequest) UnmarshalJSON(data []byte) error

type ApiCancelOnDisconnectRequest

type ApiCancelOnDisconnectRequest struct {
	// The subaccount ID cancelling the orders for
	SubAccountID uint64 `json:"sub_account_id,string"`
	// Countdown in milliseconds, as a string, e.g. "120000" (120 s). Omitted or under 1000 stops the countdown; above 300999 is rejected (error 6000). See the table...
	CountdownTime *uint64 `json:"countdown_time,omitempty,string"`
}

ApiCancelOnDisconnectRequest Arm, refresh or stop a dead man's switch for one sub-account: if the countdown reaches zero before you call again, the exchange cancels all of that sub-account's open orders.

func (*ApiCancelOnDisconnectRequest) UnmarshalJSON

func (v *ApiCancelOnDisconnectRequest) UnmarshalJSON(data []byte) error

type ApiCancelOrderRequest

type ApiCancelOrderRequest struct {
	// The subaccount ID cancelling the order
	SubAccountID uint64 `json:"sub_account_id,string"`
	// Cancel the order with this `order_id`
	OrderID string `json:"order_id,omitempty"`
	// Cancel the order with this `client_order_id`
	ClientOrderID *uint64 `json:"client_order_id,omitempty,string"`
	// Specifies the time-to-live (in milliseconds) for this cancellation.
	TimeToLiveMs *uint64 `json:"time_to_live_ms,omitempty,string"`
}

ApiCancelOrderRequest Cancel an order on the orderbook for this trading account. Either `order_id` or `client_order_id` must be provided.

func (*ApiCancelOrderRequest) UnmarshalJSON

func (v *ApiCancelOrderRequest) UnmarshalJSON(data []byte) error

type ApiCancelRfqRequest

type ApiCancelRfqRequest struct {
	// The subaccount ID cancelling the RFQ
	SubAccountID uint64 `json:"sub_account_id,string"`
	// Cancel the RFQ with this `rfq_id`
	RfqID string `json:"rfq_id"`
}

ApiCancelRfqRequest Cancels an open RFQ identified by its `rfq_id` before it is accepted or expires.

func (*ApiCancelRfqRequest) UnmarshalJSON

func (v *ApiCancelRfqRequest) UnmarshalJSON(data []byte) error

type ApiCandlestickRequest

type ApiCandlestickRequest struct {
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
	// The interval of each candlestick
	Interval CandlestickInterval `json:"interval"`
	// The type of candlestick data to retrieve. Note: For spot instruments, only `trade` and `mid` are available
	Type CandlestickType `json:"type"`
	// Start time of kline data in unix nanoseconds
	StartTime *time.Time `json:"start_time,omitempty"`
	// End time of kline data in unix nanoseconds
	EndTime *time.Time `json:"end_time,omitempty"`
	// The limit to query for. Defaults to 500; Max 1000
	Limit *uint32 `json:"limit,omitempty"`
	// The cursor to indicate when to start the query from
	Cursor string `json:"cursor,omitempty"`
}

ApiCandlestickRequest Kline/Candlestick bars for an instrument. Klines are uniquely identified by their instrument, type, interval, and open time.

func (ApiCandlestickRequest) MarshalJSON

func (v ApiCandlestickRequest) MarshalJSON() ([]byte, error)

func (*ApiCandlestickRequest) UnmarshalJSON

func (v *ApiCandlestickRequest) UnmarshalJSON(data []byte) error

type ApiCandlestickResponse

type ApiCandlestickResponse struct {
	// The candlestick result set for given interval
	Result []Candlestick `json:"result"`
	// The cursor to indicate when to start the next query from
	Next string `json:"next,omitempty"`
}

ApiCandlestickResponse is a wire type.

func (ApiCandlestickResponse) NextCursor

func (v ApiCandlestickResponse) NextCursor() string

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiCandlestickResponse) UnmarshalJSON

func (v *ApiCandlestickResponse) UnmarshalJSON(data []byte) error

type ApiCollateralAssetInfo

type ApiCollateralAssetInfo struct {
	// The asset
	Currency string `json:"currency"`
	// CVR, expressed in percentage points. 0 = not usable as collateral.
	CollateralValueRatio Decimal `json:"collateral_value_ratio"`
	// CDC limit, native units. 0 = untracked / unlimited.
	CollateralDepositCap Decimal `json:"collateral_deposit_cap"`
	// MBR - per-asset ceiling on the annual borrow rate, expressed in percentage points; the tier borrow rate never exceeds this.
	MaxBorrowRate Decimal `json:"max_borrow_rate"`
	// Effective manual-repay/convert fee = max((1-CVR)/MRR, RFR), expressed in percentage points.
	ManualRepaymentFeeRate Decimal `json:"manual_repayment_fee_rate"`
	// Collateral-deposit-cap utilization status: normal / reduceOnly / autoExchange.
	CdcStatus CDCStatus `json:"cdc_status"`
	// Show this currency only when the sub account holds a balance of it
	ShowOnlyWhenHeld bool `json:"show_only_when_held"`
	// The vault whose shares this currency is; 0 for an ordinary currency.
	VaultID uint64 `json:"vault_id,string"`
}

ApiCollateralAssetInfo Platform-wide collateral configuration and usage for a single asset

func (*ApiCollateralAssetInfo) UnmarshalJSON

func (v *ApiCollateralAssetInfo) UnmarshalJSON(data []byte) error

type ApiCollateralPreferenceStatus

type ApiCollateralPreferenceStatus struct {
	// The currency whose collateral state is being reported
	Currency string `json:"currency"`
	// Whether this currency currently counts as collateral for the sub account
	Enabled bool `json:"enabled"`
	// The sub account cannot turn this currency off as collateral
	Locked bool `json:"locked"`
}

ApiCollateralPreferenceStatus The current effective collateral state of a single currency.

func (*ApiCollateralPreferenceStatus) UnmarshalJSON

func (v *ApiCollateralPreferenceStatus) UnmarshalJSON(data []byte) error

type ApiCreateAlgoOrderRequest

type ApiCreateAlgoOrderRequest struct {
	// The algo order to create
	Order AlgoOrder `json:"order"`
}

ApiCreateAlgoOrderRequest Create an algo order for this trading account. Algo trading must be enabled (opted in) for the sub account before creating an algo order. The algo order is unsigned; GRVT Backend places signed...

func (*ApiCreateAlgoOrderRequest) UnmarshalJSON

func (v *ApiCreateAlgoOrderRequest) UnmarshalJSON(data []byte) error

type ApiCreateAlgoOrderResponse

type ApiCreateAlgoOrderResponse struct {
	// The created algo order
	Result AlgoOrder `json:"result"`
}

ApiCreateAlgoOrderResponse is a wire type.

func (*ApiCreateAlgoOrderResponse) UnmarshalJSON

func (v *ApiCreateAlgoOrderResponse) UnmarshalJSON(data []byte) error

type ApiCreateOrderRequest

type ApiCreateOrderRequest struct {
	// The order to create
	Order Order `json:"order"`
}

ApiCreateOrderRequest Create an order on the orderbook for this trading account. STABLE_PERP orders require the sub-account to be in multi-asset mode.

func (*ApiCreateOrderRequest) UnmarshalJSON

func (v *ApiCreateOrderRequest) UnmarshalJSON(data []byte) error

type ApiCreateOrderRequestInput

type ApiCreateOrderRequestInput struct {
	// The order to create
	Order OrderInput `json:"order"`
}

ApiCreateOrderRequestInput Create an order on the orderbook for this trading account. STABLE_PERP orders require the sub-account to be in multi-asset mode.

func (*ApiCreateOrderRequestInput) UnmarshalJSON

func (v *ApiCreateOrderRequestInput) UnmarshalJSON(data []byte) error

type ApiCreateOrderResponse

type ApiCreateOrderResponse struct {
	// The created order
	Result Order `json:"result"`
}

ApiCreateOrderResponse is a wire type.

func (*ApiCreateOrderResponse) UnmarshalJSON

func (v *ApiCreateOrderResponse) UnmarshalJSON(data []byte) error

type ApiCreateOrderResponseInput

type ApiCreateOrderResponseInput struct {
	// The created order
	Result OrderInput `json:"result"`
}

ApiCreateOrderResponseInput is a wire type.

func (*ApiCreateOrderResponseInput) UnmarshalJSON

func (v *ApiCreateOrderResponseInput) UnmarshalJSON(data []byte) error

type ApiCreateRfqRequest

type ApiCreateRfqRequest struct {
	// The RFQ to create
	Rfq Rfq `json:"rfq"`
}

ApiCreateRfqRequest Creates a new RFQ (Request For Quote): a taker solicits private quotes for a single STABLE_PERP instrument by specifying a size, and optionally a direction (`rfq.side`; omit for a two-way request)...

func (*ApiCreateRfqRequest) UnmarshalJSON

func (v *ApiCreateRfqRequest) UnmarshalJSON(data []byte) error

type ApiCreateRfqRequestInput

type ApiCreateRfqRequestInput struct {
	// The RFQ to create
	Rfq RfqInput `json:"rfq"`
}

ApiCreateRfqRequestInput Creates a new RFQ (Request For Quote): a taker solicits private quotes for a single STABLE_PERP instrument by specifying a size, and optionally a direction (`rfq.side`; omit for a two-way request)...

func (*ApiCreateRfqRequestInput) UnmarshalJSON

func (v *ApiCreateRfqRequestInput) UnmarshalJSON(data []byte) error

type ApiCreateRfqResponse

type ApiCreateRfqResponse struct {
	// The created RFQ
	Rfq Rfq `json:"rfq"`
}

ApiCreateRfqResponse is a wire type.

func (*ApiCreateRfqResponse) UnmarshalJSON

func (v *ApiCreateRfqResponse) UnmarshalJSON(data []byte) error

type ApiCreateRfqResponseInput

type ApiCreateRfqResponseInput struct {
	// The created RFQ
	Rfq RfqInput `json:"rfq"`
}

ApiCreateRfqResponseInput is a wire type.

func (*ApiCreateRfqResponseInput) UnmarshalJSON

func (v *ApiCreateRfqResponseInput) UnmarshalJSON(data []byte) error

type ApiDepositHistoryRequest

type ApiDepositHistoryRequest struct {
	// The token currency to query for, if nil or empty, return all deposits. Otherwise, only entries matching the filter will be returned
	Currency []string `json:"currency"`
	// The start time to query for in unix nanoseconds
	StartTime *time.Time `json:"start_time,omitempty"`
	// The end time to query for in unix nanoseconds
	EndTime *time.Time `json:"end_time,omitempty"`
	// The page size for a single response. Defaults to 500; Max 1000. This caps one page only — omitting it does NOT return everything, it applies the 500 default...
	Limit *uint32 `json:"limit,omitempty"`
	// The cursor to indicate when to start the next query from
	Cursor string `json:"cursor,omitempty"`
	// Main account ID being queried. By default, applies the requestor's main account ID.
	MainAccountID string `json:"main_account_id,omitempty"`
}

ApiDepositHistoryRequest The request to get the historical deposits of an account

func (ApiDepositHistoryRequest) MarshalJSON

func (v ApiDepositHistoryRequest) MarshalJSON() ([]byte, error)

func (*ApiDepositHistoryRequest) UnmarshalJSON

func (v *ApiDepositHistoryRequest) UnmarshalJSON(data []byte) error

type ApiDepositHistoryResponse

type ApiDepositHistoryResponse struct {
	// The deposit history matching the request account
	Result []DepositHistory `json:"result"`
	// The cursor to indicate when to start the next query from
	Next string `json:"next,omitempty"`
}

ApiDepositHistoryResponse is a wire type.

func (ApiDepositHistoryResponse) NextCursor

func (v ApiDepositHistoryResponse) NextCursor() string

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiDepositHistoryResponse) UnmarshalJSON

func (v *ApiDepositHistoryResponse) UnmarshalJSON(data []byte) error

type ApiFillHistoryRequest

type ApiFillHistoryRequest struct {
	// The sub account ID to request for
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned
	Kind []Kind `json:"kind,omitempty"`
	// The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned
	Base []string `json:"base,omitempty"`
	// The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned
	Quote []string `json:"quote,omitempty"`
	// The start time to apply in unix nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned
	StartTime *time.Time `json:"start_time,omitempty"`
	// The end time to apply in unix nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned
	EndTime *time.Time `json:"end_time,omitempty"`
	// The limit to query for. Defaults to 500; Max 1000
	Limit *uint32 `json:"limit,omitempty"`
	// The cursor to indicate when to start the query from
	Cursor string `json:"cursor,omitempty"`
}

ApiFillHistoryRequest Query for all historical fills made by a single account. A single order can be matched multiple times, hence there is no real way to uniquely identify a trade.

func (ApiFillHistoryRequest) MarshalJSON

func (v ApiFillHistoryRequest) MarshalJSON() ([]byte, error)

func (*ApiFillHistoryRequest) UnmarshalJSON

func (v *ApiFillHistoryRequest) UnmarshalJSON(data []byte) error

type ApiFillHistoryResponse

type ApiFillHistoryResponse struct {
	// The private trades matching the request asset
	Result []Fill `json:"result"`
	// The cursor to indicate when to start the query from
	Next string `json:"next"`
}

ApiFillHistoryResponse is a wire type.

func (ApiFillHistoryResponse) NextCursor

func (v ApiFillHistoryResponse) NextCursor() string

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiFillHistoryResponse) UnmarshalJSON

func (v *ApiFillHistoryResponse) UnmarshalJSON(data []byte) error

type ApiFundingAccountSummaryResponse

type ApiFundingAccountSummaryResponse struct {
	// The funding account summary
	Result FundingAccountSummary `json:"result"`
	// Client fee tier at the time of query
	Tier ClientTier `json:"tier"`
}

ApiFundingAccountSummaryResponse The funding account summary, that reports the total equity and spot balances of a funding (main) account

func (*ApiFundingAccountSummaryResponse) UnmarshalJSON

func (v *ApiFundingAccountSummaryResponse) UnmarshalJSON(data []byte) error

type ApiFundingPaymentHistoryRequest

type ApiFundingPaymentHistoryRequest struct {
	// The sub account ID to request for
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The perpetual instrument to filter for
	Instrument string `json:"instrument,omitempty"`
	// The start time to apply in unix nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned
	StartTime *time.Time `json:"start_time,omitempty"`
	// The end time to apply in unix nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned
	EndTime *time.Time `json:"end_time,omitempty"`
	// The limit to query for. Defaults to 500; Max 1000
	Limit *uint32 `json:"limit,omitempty"`
	// The cursor to indicate when to start the query from
	Cursor string `json:"cursor,omitempty"`
	// The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned
	Kind []Kind `json:"kind,omitempty"`
	// The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned
	Base []string `json:"base,omitempty"`
	// The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned
	Quote []string `json:"quote,omitempty"`
}

ApiFundingPaymentHistoryRequest Query for all historical funding payments made by a single account.

func (ApiFundingPaymentHistoryRequest) MarshalJSON

func (v ApiFundingPaymentHistoryRequest) MarshalJSON() ([]byte, error)

func (*ApiFundingPaymentHistoryRequest) UnmarshalJSON

func (v *ApiFundingPaymentHistoryRequest) UnmarshalJSON(data []byte) error

type ApiFundingPaymentHistoryResponse

type ApiFundingPaymentHistoryResponse struct {
	// The funding payments matching the request asset
	Result []FundingPayment `json:"result"`
	// The cursor to indicate when to start the query from
	Next string `json:"next"`
}

ApiFundingPaymentHistoryResponse is a wire type.

func (ApiFundingPaymentHistoryResponse) NextCursor

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiFundingPaymentHistoryResponse) UnmarshalJSON

func (v *ApiFundingPaymentHistoryResponse) UnmarshalJSON(data []byte) error

type ApiFundingRate

type ApiFundingRate struct {
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
	// The funding rate of the instrument, expressed in percentage points. Absent for stable perps, which have `funding_rate_long_apr_pct` and...
	FundingRate *Decimal `json:"funding_rate,omitempty"`
	// The funding timestamp of the funding rate, expressed in unix nanoseconds
	FundingTime time.Time `json:"funding_time"`
	// The mark price of the instrument at funding timestamp. Decimal string, e.g. "65000.5"; up to 9 decimals. For stable perps, the index price the charge used.
	MarkPrice Decimal `json:"mark_price"`
	// Deprecated: Refer to `funding_rate` instead. Will be removed in a future release. Absent for stable perps.
	FundingRate8HAvg *Decimal `json:"funding_rate_8_h_avg,omitempty"`
	// Funding interval in hours (e.g. 1/4/8/etc).
	FundingIntervalHours uint8 `json:"funding_interval_hours"`
	// Stable perps only: the annual rate for retail longs at this charge, in percent a year (`'-5.5'` = retail longs paid 5.5%; positive = retail receives, negative...
	FundingRateLongAprPct *Decimal `json:"funding_rate_long_apr_pct,omitempty"`
	// Stable perps only: the annual rate for retail shorts at this charge, in percent a year (`'-5'` = retail shorts paid 5%; positive = retail receives, negative =...
	FundingRateShortAprPct *Decimal `json:"funding_rate_short_apr_pct,omitempty"`
	// Stable perps only: days of funding the charge covered, 3 on the triple day, else 1. Absent for other kinds.
	FundingMultiplier *uint8 `json:"funding_multiplier,omitempty"`
}

ApiFundingRate is a wire type.

func (ApiFundingRate) MarshalJSON

func (v ApiFundingRate) MarshalJSON() ([]byte, error)

func (*ApiFundingRate) UnmarshalJSON

func (v *ApiFundingRate) UnmarshalJSON(data []byte) error

type ApiFundingRateRequest

type ApiFundingRateRequest struct {
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
	// Start time of funding rate in unix nanoseconds
	StartTime *time.Time `json:"start_time,omitempty"`
	// End time of funding rate in unix nanoseconds
	EndTime *time.Time `json:"end_time,omitempty"`
	// The limit to query for. Defaults to 500; Max 1000
	Limit *uint32 `json:"limit,omitempty"`
	// The cursor to indicate when to start the query from
	Cursor string `json:"cursor,omitempty"`
	// Aggregation method for historical funding rate observations. Defaults to using the instrument-specific funding interval.
	AggType FundingRateAggregationType `json:"agg_type,omitempty"`
}

ApiFundingRateRequest Lookup the historical funding rate of a perpetual future.

func (ApiFundingRateRequest) MarshalJSON

func (v ApiFundingRateRequest) MarshalJSON() ([]byte, error)

func (*ApiFundingRateRequest) UnmarshalJSON

func (v *ApiFundingRateRequest) UnmarshalJSON(data []byte) error

type ApiFundingRateResponse

type ApiFundingRateResponse struct {
	// The funding rate result set for given interval
	Result []ApiFundingRate `json:"result"`
	// The cursor to indicate when to start the next query from
	Next string `json:"next,omitempty"`
}

ApiFundingRateResponse is a wire type.

func (ApiFundingRateResponse) NextCursor

func (v ApiFundingRateResponse) NextCursor() string

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiFundingRateResponse) UnmarshalJSON

func (v *ApiFundingRateResponse) UnmarshalJSON(data []byte) error

type ApiGetAlgoOrderRequest

type ApiGetAlgoOrderRequest struct {
	// The subaccount ID to filter by
	SubAccountID uint64 `json:"sub_account_id,string"`
	// Filter for `algo_order_id`
	AlgoOrderID string `json:"algo_order_id,omitempty"`
	// Filter for `client_order_id`
	ClientOrderID *uint64 `json:"client_order_id,omitempty,string"`
}

ApiGetAlgoOrderRequest Retrieve an algo order for the account. Either `algo_order_id` or `client_order_id` must be provided.

func (*ApiGetAlgoOrderRequest) UnmarshalJSON

func (v *ApiGetAlgoOrderRequest) UnmarshalJSON(data []byte) error

type ApiGetAlgoOrderResponse

type ApiGetAlgoOrderResponse struct {
	// The algo order for the requested filter
	Result AlgoOrder `json:"result"`
}

ApiGetAlgoOrderResponse is a wire type.

func (*ApiGetAlgoOrderResponse) UnmarshalJSON

func (v *ApiGetAlgoOrderResponse) UnmarshalJSON(data []byte) error

type ApiGetAllCollateralAssetInfoResponse

type ApiGetAllCollateralAssetInfoResponse struct {
	// Collateral configuration for every collateral-eligible asset (CVR > 0)
	Assets []ApiCollateralAssetInfo `json:"assets"`
}

ApiGetAllCollateralAssetInfoResponse Response for the collateral asset info endpoint

func (*ApiGetAllCollateralAssetInfoResponse) UnmarshalJSON

func (v *ApiGetAllCollateralAssetInfoResponse) UnmarshalJSON(data []byte) error

type ApiGetAllInitialLeverageRequest

type ApiGetAllInitialLeverageRequest struct {
	// The sub account ID to get the leverage for
	SubAccountID uint64 `json:"sub_account_id,string"`
}

ApiGetAllInitialLeverageRequest The request to get the initial leverage of a sub account

func (*ApiGetAllInitialLeverageRequest) UnmarshalJSON

func (v *ApiGetAllInitialLeverageRequest) UnmarshalJSON(data []byte) error

type ApiGetAllInitialLeverageResponse

type ApiGetAllInitialLeverageResponse struct {
	// The initial leverage of the sub account
	Results []InitialLeverageResult `json:"results"`
}

ApiGetAllInitialLeverageResponse The response to get the initial leverage of a sub account

func (*ApiGetAllInitialLeverageResponse) UnmarshalJSON

func (v *ApiGetAllInitialLeverageResponse) UnmarshalJSON(data []byte) error

type ApiGetAllInstrumentsRequest

type ApiGetAllInstrumentsRequest struct {
	// Fetch only active instruments
	IsActive *bool `json:"is_active,omitempty"`
	// The kind filter to apply. If empty, this defaults to PERPETUAL only. Otherwise, only entries matching the filter will be returned
	Kinds []Kind `json:"kinds,omitempty"`
}

ApiGetAllInstrumentsRequest Fetch all instruments

type ApiGetAllInstrumentsResponse

type ApiGetAllInstrumentsResponse struct {
	// List of instruments
	Result []InstrumentDisplay `json:"result"`
}

ApiGetAllInstrumentsResponse is a wire type.

func (*ApiGetAllInstrumentsResponse) UnmarshalJSON

func (v *ApiGetAllInstrumentsResponse) UnmarshalJSON(data []byte) error

type ApiGetAuthorizedBuildersResponse

type ApiGetAuthorizedBuildersResponse struct {
	// The list of authorized builders
	Results []ApiAuthorizedBuilder `json:"results"`
}

ApiGetAuthorizedBuildersResponse Returns list of authorized builders and the associated fee

func (*ApiGetAuthorizedBuildersResponse) UnmarshalJSON

func (v *ApiGetAuthorizedBuildersResponse) UnmarshalJSON(data []byte) error

type ApiGetCurrencyRequest

type ApiGetCurrencyRequest struct {
}

ApiGetCurrencyRequest Fetch all currencies

type ApiGetCurrencyResponse

type ApiGetCurrencyResponse struct {
	// The list of currencies
	Result []CurrencyDetail `json:"result"`
}

ApiGetCurrencyResponse The list of currencies

func (*ApiGetCurrencyResponse) UnmarshalJSON

func (v *ApiGetCurrencyResponse) UnmarshalJSON(data []byte) error

type ApiGetFilteredInstrumentsRequest

type ApiGetFilteredInstrumentsRequest struct {
	// The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned
	Kind []Kind `json:"kind,omitempty"`
	// The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned
	Base []string `json:"base,omitempty"`
	// The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned
	Quote []string `json:"quote,omitempty"`
	// Request for active instruments only
	IsActive *bool `json:"is_active,omitempty"`
	// The limit to query for. Defaults to 500; Max 100000
	Limit *uint32 `json:"limit,omitempty"`
}

ApiGetFilteredInstrumentsRequest Fetch a list of instruments based on the filters provided

type ApiGetFilteredInstrumentsResponse

type ApiGetFilteredInstrumentsResponse struct {
	// The instruments matching the request filter
	Result []InstrumentDisplay `json:"result"`
}

ApiGetFilteredInstrumentsResponse is a wire type.

func (*ApiGetFilteredInstrumentsResponse) UnmarshalJSON

func (v *ApiGetFilteredInstrumentsResponse) UnmarshalJSON(data []byte) error

type ApiGetInstrumentRequest

type ApiGetInstrumentRequest struct {
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
}

ApiGetInstrumentRequest Fetch a single instrument by supplying the asset or instrument name

func (*ApiGetInstrumentRequest) UnmarshalJSON

func (v *ApiGetInstrumentRequest) UnmarshalJSON(data []byte) error

type ApiGetInstrumentResponse

type ApiGetInstrumentResponse struct {
	// The instrument matching the request asset
	Result InstrumentDisplay `json:"result"`
}

ApiGetInstrumentResponse is a wire type.

func (*ApiGetInstrumentResponse) UnmarshalJSON

func (v *ApiGetInstrumentResponse) UnmarshalJSON(data []byte) error

type ApiGetIsolatedPositionMarginLimitsRequest

type ApiGetIsolatedPositionMarginLimitsRequest struct {
	// The sub account ID to get the margin limits for
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The isolated position asset to get the margin limits for
	Instrument string `json:"instrument"`
}

ApiGetIsolatedPositionMarginLimitsRequest The request to get the max addable and removable amount for an isolated position

func (*ApiGetIsolatedPositionMarginLimitsRequest) UnmarshalJSON

func (v *ApiGetIsolatedPositionMarginLimitsRequest) UnmarshalJSON(data []byte) error

type ApiGetIsolatedPositionMarginLimitsResponse

type ApiGetIsolatedPositionMarginLimitsResponse struct {
	// The isolated position asset
	Instrument string `json:"instrument"`
	// The max addable amount that can be added to the isolated position, in the quote asset. Decimal string, e.g. "12.5".
	MaxAddableAmount Decimal `json:"max_addable_amount"`
	// The max removable amount that can be removed from the isolated position, in the quote asset. Decimal string, e.g. "12.5".
	MaxRemovableAmount Decimal `json:"max_removable_amount"`
}

ApiGetIsolatedPositionMarginLimitsResponse The response to get the max addable and removable amount for an isolated position request

func (*ApiGetIsolatedPositionMarginLimitsResponse) UnmarshalJSON

func (v *ApiGetIsolatedPositionMarginLimitsResponse) UnmarshalJSON(data []byte) error

type ApiGetMarginRulesRequest

type ApiGetMarginRulesRequest struct {
	// The instrument to query margin rules for
	Instrument string `json:"instrument"`
}

ApiGetMarginRulesRequest API request payload to get margin rules for a particular instrument

func (*ApiGetMarginRulesRequest) UnmarshalJSON

func (v *ApiGetMarginRulesRequest) UnmarshalJSON(data []byte) error

type ApiGetMarginRulesResponse

type ApiGetMarginRulesResponse struct {
	// The instrument name
	Instrument string `json:"instrument"`
	// The maximum position size. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	MaxPositionSize Decimal `json:"max_position_size"`
	// List of risk brackets defining margin requirements at different notional tiers
	RiskBrackets []RiskBracket `json:"risk_brackets"`
}

ApiGetMarginRulesResponse API response payload for margin rules of a particular instrument

func (*ApiGetMarginRulesResponse) UnmarshalJSON

func (v *ApiGetMarginRulesResponse) UnmarshalJSON(data []byte) error

type ApiGetOrderRequest

type ApiGetOrderRequest struct {
	// The subaccount ID to filter by
	SubAccountID uint64 `json:"sub_account_id,string"`
	// Filter for `order_id`
	OrderID string `json:"order_id,omitempty"`
	// Filter for `client_order_id`
	ClientOrderID *uint64 `json:"client_order_id,omitempty,string"`
}

ApiGetOrderRequest Retrieve the order for the account. Either `order_id` or `client_order_id` must be provided.

func (*ApiGetOrderRequest) UnmarshalJSON

func (v *ApiGetOrderRequest) UnmarshalJSON(data []byte) error

type ApiGetOrderResponse

type ApiGetOrderResponse struct {
	// The order object for the requested filter
	Result Order `json:"result"`
}

ApiGetOrderResponse is a wire type.

func (*ApiGetOrderResponse) UnmarshalJSON

func (v *ApiGetOrderResponse) UnmarshalJSON(data []byte) error

type ApiGetOrderResponseInput

type ApiGetOrderResponseInput struct {
	// The order object for the requested filter
	Result OrderInput `json:"result"`
}

ApiGetOrderResponseInput is a wire type.

func (*ApiGetOrderResponseInput) UnmarshalJSON

func (v *ApiGetOrderResponseInput) UnmarshalJSON(data []byte) error

type ApiGetSubAccountCollateralPreferenceRequest

type ApiGetSubAccountCollateralPreferenceRequest struct {
	// The sub account ID to fetch collateral preferences for
	SubAccountID uint64 `json:"sub_account_id,string"`
}

ApiGetSubAccountCollateralPreferenceRequest Fetch the per-currency collateral enable/disable state for a Multi-Asset Mode sub account.

func (*ApiGetSubAccountCollateralPreferenceRequest) UnmarshalJSON

func (v *ApiGetSubAccountCollateralPreferenceRequest) UnmarshalJSON(data []byte) error

type ApiGetSubAccountCollateralPreferenceResponse

type ApiGetSubAccountCollateralPreferenceResponse struct {
	// The sub account ID the preferences apply to
	SubAccountID uint64 `json:"sub_account_id,string"`
	// One entry per collateral-eligible currency (CVR configured), with its current effective state.
	Preferences []ApiCollateralPreferenceStatus `json:"preferences"`
}

ApiGetSubAccountCollateralPreferenceResponse The response to get the sub account collateral preference

func (*ApiGetSubAccountCollateralPreferenceResponse) UnmarshalJSON

func (v *ApiGetSubAccountCollateralPreferenceResponse) UnmarshalJSON(data []byte) error

type ApiGetSubAccountsResponse

type ApiGetSubAccountsResponse struct {
	// List of sub-account IDs accessible to the session
	SubAccountIDs Uint64s `json:"sub_account_ids"`
}

ApiGetSubAccountsResponse Response payload containing all sub-accounts accessible within the given auth session

func (*ApiGetSubAccountsResponse) UnmarshalJSON

func (v *ApiGetSubAccountsResponse) UnmarshalJSON(data []byte) error

type ApiGetSupportedAssetsResponse

type ApiGetSupportedAssetsResponse struct {
	// Assets supported in funding wallets
	Funding []SupportedAsset `json:"funding"`
	// Assets supported in spot wallets
	Spot []SupportedAsset `json:"spot"`
	// Assets supported in futures wallets, grouped by mode
	Futures []FuturesWalletAssets `json:"futures"`
}

ApiGetSupportedAssetsResponse Response for the supported assets endpoint

func (*ApiGetSupportedAssetsResponse) UnmarshalJSON

func (v *ApiGetSupportedAssetsResponse) UnmarshalJSON(data []byte) error

type ApiInterestPaymentHistoryRequest

type ApiInterestPaymentHistoryRequest struct {
	// The sub account ID to request for
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The currency filter to apply. If nil, this defaults to all currencies. Otherwise, only entries matching the filter will be returned
	Currency []string `json:"currency,omitempty"`
	// The start time to apply in unix nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned
	StartTime *time.Time `json:"start_time,omitempty"`
	// The end time to apply in unix nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned
	EndTime *time.Time `json:"end_time,omitempty"`
	// The limit to query for. Defaults to 500; Max 1000
	Limit *uint32 `json:"limit,omitempty"`
	// The cursor to indicate when to start the query from
	Cursor string `json:"cursor,omitempty"`
}

ApiInterestPaymentHistoryRequest Query for all historical MAM hourly interest payments charged to a single sub account.

func (ApiInterestPaymentHistoryRequest) MarshalJSON

func (v ApiInterestPaymentHistoryRequest) MarshalJSON() ([]byte, error)

func (*ApiInterestPaymentHistoryRequest) UnmarshalJSON

func (v *ApiInterestPaymentHistoryRequest) UnmarshalJSON(data []byte) error

type ApiInterestPaymentHistoryResponse

type ApiInterestPaymentHistoryResponse struct {
	// The interest payments matching the request
	Result []InterestPayment `json:"result"`
	// The cursor to indicate when to start the query from
	Next string `json:"next"`
}

ApiInterestPaymentHistoryResponse is a wire type.

func (ApiInterestPaymentHistoryResponse) NextCursor

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiInterestPaymentHistoryResponse) UnmarshalJSON

func (v *ApiInterestPaymentHistoryResponse) UnmarshalJSON(data []byte) error

type ApiMiniTickerRequest

type ApiMiniTickerRequest struct {
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
}

ApiMiniTickerRequest Retrieves a single mini ticker value for a single instrument. Please do not use this to repeatedly poll for data -- a websocket subscription is much more performant, and useful.

func (*ApiMiniTickerRequest) UnmarshalJSON

func (v *ApiMiniTickerRequest) UnmarshalJSON(data []byte) error

type ApiMiniTickerResponse

type ApiMiniTickerResponse struct {
	// The mini ticker matching the request asset
	Result MiniTicker `json:"result"`
}

ApiMiniTickerResponse is a wire type.

func (*ApiMiniTickerResponse) UnmarshalJSON

func (v *ApiMiniTickerResponse) UnmarshalJSON(data []byte) error

type ApiOpenAlgoOrdersRequest

type ApiOpenAlgoOrdersRequest struct {
	// The subaccount ID to filter by
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned
	Kind []Kind `json:"kind,omitempty"`
	// The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned
	Base []string `json:"base,omitempty"`
	// The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned
	Quote []string `json:"quote,omitempty"`
	// The algo order type filter to apply. If nil, this defaults to all types. Otherwise, only entries matching the filter will be returned
	Type []AlgoOrderType `json:"type,omitempty"`
	// The trigger filter to apply. If nil, this defaults to all algo orders. Otherwise, `WITH_TRIGGER` returns only algo orders that carry a trigger, and...
	TriggerFilter AlgoTriggerFilter `json:"trigger_filter,omitempty"`
}

ApiOpenAlgoOrdersRequest Retrieves all open algo orders for the account, including algo orders still pending on their trigger.

func (*ApiOpenAlgoOrdersRequest) UnmarshalJSON

func (v *ApiOpenAlgoOrdersRequest) UnmarshalJSON(data []byte) error

type ApiOpenAlgoOrdersResponse

type ApiOpenAlgoOrdersResponse struct {
	// The open algo orders matching the request filter
	Result []AlgoOrder `json:"result"`
}

ApiOpenAlgoOrdersResponse is a wire type.

func (*ApiOpenAlgoOrdersResponse) UnmarshalJSON

func (v *ApiOpenAlgoOrdersResponse) UnmarshalJSON(data []byte) error

type ApiOpenOrdersRequest

type ApiOpenOrdersRequest struct {
	// The subaccount ID to filter by
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned
	Kind []Kind `json:"kind,omitempty"`
	// The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned
	Base []string `json:"base,omitempty"`
	// The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned
	Quote []string `json:"quote,omitempty"`
}

ApiOpenOrdersRequest is a wire type.

func (*ApiOpenOrdersRequest) UnmarshalJSON

func (v *ApiOpenOrdersRequest) UnmarshalJSON(data []byte) error

type ApiOpenOrdersResponse

type ApiOpenOrdersResponse struct {
	// The Open Orders matching the request filter
	Result []Order `json:"result"`
}

ApiOpenOrdersResponse Retrieves all open orders for the account. This may not match new orders in flight.

func (*ApiOpenOrdersResponse) UnmarshalJSON

func (v *ApiOpenOrdersResponse) UnmarshalJSON(data []byte) error

type ApiOpenOrdersResponseInput

type ApiOpenOrdersResponseInput struct {
	// The Open Orders matching the request filter
	Result []OrderInput `json:"result"`
}

ApiOpenOrdersResponseInput Retrieves all open orders for the account. This may not match new orders in flight.

func (*ApiOpenOrdersResponseInput) UnmarshalJSON

func (v *ApiOpenOrdersResponseInput) UnmarshalJSON(data []byte) error

type ApiOrderHistoryRequest

type ApiOrderHistoryRequest struct {
	// The subaccount ID to filter by
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned
	Kind []Kind `json:"kind,omitempty"`
	// The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned
	Base []string `json:"base,omitempty"`
	// The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned
	Quote []string `json:"quote,omitempty"`
	// The start time to apply in nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned
	StartTime *time.Time `json:"start_time,omitempty"`
	// The end time to apply in nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned
	EndTime *time.Time `json:"end_time,omitempty"`
	// The limit to query for. Defaults to 500; Max 1000
	Limit *uint32 `json:"limit,omitempty"`
	// The cursor to indicate when to start the query from
	Cursor string `json:"cursor,omitempty"`
}

ApiOrderHistoryRequest Retrieves the order history for the account.

func (ApiOrderHistoryRequest) MarshalJSON

func (v ApiOrderHistoryRequest) MarshalJSON() ([]byte, error)

func (*ApiOrderHistoryRequest) UnmarshalJSON

func (v *ApiOrderHistoryRequest) UnmarshalJSON(data []byte) error

type ApiOrderHistoryResponse

type ApiOrderHistoryResponse struct {
	// The Open Orders matching the request filter
	Result []Order `json:"result"`
	// The cursor to indicate when to start the query from
	Next string `json:"next"`
}

ApiOrderHistoryResponse is a wire type.

func (ApiOrderHistoryResponse) NextCursor

func (v ApiOrderHistoryResponse) NextCursor() string

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiOrderHistoryResponse) UnmarshalJSON

func (v *ApiOrderHistoryResponse) UnmarshalJSON(data []byte) error

type ApiOrderHistoryResponseInput

type ApiOrderHistoryResponseInput struct {
	// The Open Orders matching the request filter
	Result []OrderInput `json:"result"`
	// The cursor to indicate when to start the query from
	Next string `json:"next"`
}

ApiOrderHistoryResponseInput is a wire type.

func (ApiOrderHistoryResponseInput) NextCursor

func (v ApiOrderHistoryResponseInput) NextCursor() string

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiOrderHistoryResponseInput) UnmarshalJSON

func (v *ApiOrderHistoryResponseInput) UnmarshalJSON(data []byte) error

type ApiOrderbookLevelsRequest

type ApiOrderbookLevelsRequest struct {
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
	// Depth of the order book to be retrieved (10, 50, 100, 500)
	Depth uint32 `json:"depth"`
}

ApiOrderbookLevelsRequest Retrieves aggregated price depth for a single instrument, with a maximum depth of 10 levels. Do not use this to poll for data -- a websocket subscription is much more performant, and useful.

func (*ApiOrderbookLevelsRequest) UnmarshalJSON

func (v *ApiOrderbookLevelsRequest) UnmarshalJSON(data []byte) error

type ApiOrderbookLevelsResponse

type ApiOrderbookLevelsResponse struct {
	// The orderbook levels objects matching the request asset
	Result OrderbookLevels `json:"result"`
}

ApiOrderbookLevelsResponse is a wire type.

func (*ApiOrderbookLevelsResponse) UnmarshalJSON

func (v *ApiOrderbookLevelsResponse) UnmarshalJSON(data []byte) error

type ApiPositionHistory

type ApiPositionHistory struct {
	// Trading account ID which held this position
	SubAccountID uint64 `json:"sub_account_id,string"`
	// Asset this position was for
	Instrument string `json:"instrument"`
	// Timestamp of first trade that opened this lifecycle
	OpenTime time.Time           `json:"open_time"`
	Status   PositionCloseStatus `json:"status"`
	// True if the closed position was long
	IsLong     bool               `json:"is_long"`
	MarginType PositionMarginType `json:"margin_type"`
	// Timestamp when the position lifecycle ended. Omitted when status is `PARTIALLY_CLOSED`
	CloseTime *time.Time `json:"close_time,omitempty"`
	// Average entry price at 9 decimals
	EntryPrice Decimal `json:"entry_price"`
	// Average exit price at 9 decimals
	ExitPrice Decimal `json:"exit_price"`
	// Mark price at close. Omitted when status is `PARTIALLY_CLOSED`
	PositionCloseMarkPrice *Decimal `json:"position_close_mark_price,omitempty"`
	// Cumulative realized PnL in quote currency
	RealizedPnl Decimal `json:"realized_pnl"`
	// Cumulative fees in quote currency
	CumulativeFee Decimal `json:"cumulative_fee"`
	// Cumulative realized funding payment in quote currency
	CumulativeRealizedFundingPayment Decimal `json:"cumulative_realized_funding_payment"`
	// Sum of abs(reducingTradeSize) across all reducing trades
	ClosedVolumeBase Decimal `json:"closed_volume_base"`
	// Sum of abs(reducingTradeSize) * tradePrice across all reducing trades
	ClosedVolumeQuote Decimal `json:"closed_volume_quote"`
	// Max absolute position size reached during lifecycle
	MaxOpenInterestBase Decimal `json:"max_open_interest_base"`
	// Max abs(size) * entryVWAP reached during lifecycle
	MaxOpenInterestQuote Decimal `json:"max_open_interest_quote"`
	// Sum of markPrice * abs(tradeSize) / leverage for position-increasing trades
	CumulativeInitialMargin Decimal `json:"cumulative_initial_margin"`
	// High-water mark of cumulativeInitialMargin during lifecycle
	MaxInitialMargin Decimal `json:"max_initial_margin"`
	// Leverage at time of close. When status is `PARTIALLY_CLOSED`, this is the current leverage
	Leverage Decimal `json:"leverage"`
	// The unrealized PnL of the position, in the quote asset. Decimal string, e.g. "12.5".
	UnrealizedPnl *Decimal `json:"unrealized_pnl,omitempty"`
	// Stock split 'from' ratio (pre-split units); the position size scaled by to/from
	SplitRatioFrom *int32 `json:"split_ratio_from,omitempty"`
	// Stock split 'to' ratio (post-split units)
	SplitRatioTo *int32 `json:"split_ratio_to,omitempty"`
	// Signed position size. Decimal string, e.g. "0.01"; up to the instrument's base_decimals. immediately before the split
	SplitRemainingSize *Decimal `json:"split_remaining_size,omitempty"`
}

ApiPositionHistory A position lifecycle record.

func (ApiPositionHistory) MarshalJSON

func (v ApiPositionHistory) MarshalJSON() ([]byte, error)

func (*ApiPositionHistory) UnmarshalJSON

func (v *ApiPositionHistory) UnmarshalJSON(data []byte) error

type ApiPositionHistoryRequest

type ApiPositionHistoryRequest struct {
	// The sub account ID to request for
	SubAccountID uint64 `json:"sub_account_id,string"`
	// Start of the close-time range in unix nanoseconds. If nil, defaults to no lower bound. Only positions with close_time >= start_time are returned. Does not...
	StartTime *time.Time `json:"start_time,omitempty"`
	// End of the close-time range in unix nanoseconds. If nil, defaults to now. Only positions with close_time <= end_time are returned. Does not apply to partially...
	EndTime *time.Time `json:"end_time,omitempty"`
	// The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only positions matching the filter will be returned
	Kind []Kind `json:"kind,omitempty"`
	// The base filter to apply. If nil, this defaults to all bases. Otherwise, only positions matching the filter will be returned
	Base []string `json:"base,omitempty"`
	// The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only positions matching the filter will be returned
	Quote []string `json:"quote,omitempty"`
	// The limit to query for. Defaults to 500; Max 1000. Applies to fully closed positions only; limit excludes any matching partially-closed positions
	Limit *uint32 `json:"limit,omitempty"`
	// The cursor to indicate when to start the next page query from. Partially closed positions are only returned on the initial page (when cursor is unset)
	Cursor string `json:"cursor,omitempty"`
	// The status filter to apply. If nil, this defaults to all statuses. Otherwise, only positions matching the filter will be returned
	Status []PositionCloseStatus `json:"status,omitempty"`
	// Set to true to filter for long positions. If both is_long and is_short are false (default), positions of both directions are returned
	IsLong *bool `json:"is_long,omitempty"`
	// Set to true to filter for short positions. If both is_long and is_short are false (default), positions of both directions are returned
	IsShort *bool `json:"is_short,omitempty"`
	// The margin type filter to apply. If nil, this defaults to all margin types. Otherwise, only positions matching the filter will be returned
	MarginType []PositionMarginType `json:"margin_type,omitempty"`
}

ApiPositionHistoryRequest Query for position lifecycle records for a single sub account.

func (ApiPositionHistoryRequest) MarshalJSON

func (v ApiPositionHistoryRequest) MarshalJSON() ([]byte, error)

func (*ApiPositionHistoryRequest) UnmarshalJSON

func (v *ApiPositionHistoryRequest) UnmarshalJSON(data []byte) error

type ApiPositionHistoryResponse

type ApiPositionHistoryResponse struct {
	// Position lifecycle records matching the request filters. Partially closed positions appear first (most recently opened first), followed by fully closed...
	Result []ApiPositionHistory `json:"result"`
	// The cursor to indicate when to start the query from
	Next string `json:"next"`
}

ApiPositionHistoryResponse is a wire type.

func (ApiPositionHistoryResponse) NextCursor

func (v ApiPositionHistoryResponse) NextCursor() string

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiPositionHistoryResponse) UnmarshalJSON

func (v *ApiPositionHistoryResponse) UnmarshalJSON(data []byte) error

type ApiPositionsRequest

type ApiPositionsRequest struct {
	// The sub account ID to request for
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The kind filter to apply. If nil, this defaults to all kinds. Otherwise, only entries matching the filter will be returned
	Kind []Kind `json:"kind,omitempty"`
	// The base filter to apply. If nil, this defaults to all bases. Otherwise, only entries matching the filter will be returned
	Base []string `json:"base,omitempty"`
	// The quote filter to apply. If nil, this defaults to all quotes. Otherwise, only entries matching the filter will be returned
	Quote []string `json:"quote,omitempty"`
}

ApiPositionsRequest Query the positions of a sub account

func (*ApiPositionsRequest) UnmarshalJSON

func (v *ApiPositionsRequest) UnmarshalJSON(data []byte) error

type ApiPositionsResponse

type ApiPositionsResponse struct {
	// The positions matching the request filter
	Result []Positions `json:"result"`
}

ApiPositionsResponse is a wire type.

func (*ApiPositionsResponse) UnmarshalJSON

func (v *ApiPositionsResponse) UnmarshalJSON(data []byte) error

type ApiQueryVaultManagerInvestorHistoryRequest

type ApiQueryVaultManagerInvestorHistoryRequest struct {
	// The unique identifier of the vault to filter by
	VaultID uint64 `json:"vault_id,string"`
	// Whether to only return investments made by the manager
	OnlyOwnInvestments bool `json:"only_own_investments"`
	// Optional. Start time in unix nanoseconds
	StartTime *time.Time `json:"start_time,omitempty"`
	// Optional. End time in unix nanoseconds
	EndTime *time.Time `json:"end_time,omitempty"`
}

ApiQueryVaultManagerInvestorHistoryRequest Request for the manager to retrieve the vault investor history for their vault

func (ApiQueryVaultManagerInvestorHistoryRequest) MarshalJSON

func (*ApiQueryVaultManagerInvestorHistoryRequest) UnmarshalJSON

func (v *ApiQueryVaultManagerInvestorHistoryRequest) UnmarshalJSON(data []byte) error

type ApiQueryVaultManagerInvestorHistoryResponse

type ApiQueryVaultManagerInvestorHistoryResponse struct {
	// The list of vault investor history belong to the manager
	Result []ApiVaultInvestorHistory `json:"result"`
}

ApiQueryVaultManagerInvestorHistoryResponse Response to retrieve the vault summary for a given vault

func (*ApiQueryVaultManagerInvestorHistoryResponse) UnmarshalJSON

func (v *ApiQueryVaultManagerInvestorHistoryResponse) UnmarshalJSON(data []byte) error

type ApiSetDeriskToMaintenanceMarginRatioRequest

type ApiSetDeriskToMaintenanceMarginRatioRequest struct {
	// The sub account ID to set the leverage for
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The derisk margin to maintenance margin ratio of this sub account
	Ratio Decimal `json:"ratio"`
	// The signature of this operation
	Signature Signature `json:"signature"`
}

ApiSetDeriskToMaintenanceMarginRatioRequest The request to set the derisk margin to maintenance margin ratio of a sub account

func (*ApiSetDeriskToMaintenanceMarginRatioRequest) UnmarshalJSON

func (v *ApiSetDeriskToMaintenanceMarginRatioRequest) UnmarshalJSON(data []byte) error

type ApiSetDeriskToMaintenanceMarginRatioRequestInput

type ApiSetDeriskToMaintenanceMarginRatioRequestInput struct {
	// The sub account ID to set the leverage for
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The derisk margin to maintenance margin ratio of this sub account
	Ratio Decimal `json:"ratio"`
	// The signature of this operation
	Signature *SignatureInput `json:"signature,omitempty"`
}

ApiSetDeriskToMaintenanceMarginRatioRequestInput The request to set the derisk margin to maintenance margin ratio of a sub account

func (*ApiSetDeriskToMaintenanceMarginRatioRequestInput) UnmarshalJSON

type ApiSetDeriskToMaintenanceMarginRatioResponse

type ApiSetDeriskToMaintenanceMarginRatioResponse struct {
	// Whether the derisk margin to maintenance margin ratio was set successfully
	Success bool `json:"success"`
}

ApiSetDeriskToMaintenanceMarginRatioResponse The response to set the derisk margin to maintenance margin ratio of a sub account

func (*ApiSetDeriskToMaintenanceMarginRatioResponse) UnmarshalJSON

func (v *ApiSetDeriskToMaintenanceMarginRatioResponse) UnmarshalJSON(data []byte) error

type ApiSetInitialLeverageRequest

type ApiSetInitialLeverageRequest struct {
	// The sub account ID to set the leverage for
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The instrument to set the leverage for
	Instrument string `json:"instrument"`
	// The leverage to set for the sub account
	Leverage Decimal `json:"leverage"`
}

ApiSetInitialLeverageRequest The request to set the initial leverage of a sub account.

func (*ApiSetInitialLeverageRequest) UnmarshalJSON

func (v *ApiSetInitialLeverageRequest) UnmarshalJSON(data []byte) error

type ApiSetInitialLeverageResponse

type ApiSetInitialLeverageResponse struct {
	// Whether the leverage was set successfully
	Success bool `json:"success"`
}

ApiSetInitialLeverageResponse The response to set the initial leverage of a sub account.

func (*ApiSetInitialLeverageResponse) UnmarshalJSON

func (v *ApiSetInitialLeverageResponse) UnmarshalJSON(data []byte) error

type ApiSetSubAccountPositionMarginConfigRequest

type ApiSetSubAccountPositionMarginConfigRequest struct {
	// The sub account ID to set the margin type and leverage for
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The instrument of the position to set the margin type and leverage for
	Instrument string `json:"instrument"`
	// The margin type to set for the position
	MarginType PositionMarginType `json:"margin_type"`
	// The leverage to set for the position
	Leverage Decimal `json:"leverage"`
	// The signature of this operation
	Signature Signature `json:"signature"`
}

ApiSetSubAccountPositionMarginConfigRequest Sets the margin type and leverage configuration for a specific position (instrument) within a sub account.

func (*ApiSetSubAccountPositionMarginConfigRequest) UnmarshalJSON

func (v *ApiSetSubAccountPositionMarginConfigRequest) UnmarshalJSON(data []byte) error

type ApiSetSubAccountPositionMarginConfigRequestInput

type ApiSetSubAccountPositionMarginConfigRequestInput struct {
	// The sub account ID to set the margin type and leverage for
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The instrument of the position to set the margin type and leverage for
	Instrument string `json:"instrument"`
	// The margin type to set for the position
	MarginType PositionMarginType `json:"margin_type"`
	// The leverage to set for the position
	Leverage Decimal `json:"leverage"`
	// The signature of this operation
	Signature *SignatureInput `json:"signature,omitempty"`
}

ApiSetSubAccountPositionMarginConfigRequestInput Sets the margin type and leverage configuration for a specific position (instrument) within a sub account.

func (*ApiSetSubAccountPositionMarginConfigRequestInput) UnmarshalJSON

type ApiSetSubAccountPositionMarginConfigResponse

type ApiSetSubAccountPositionMarginConfigResponse struct {
	// Whether the margin type and leverage was acked
	Ack bool `json:"ack"`
}

ApiSetSubAccountPositionMarginConfigResponse The response to set the margin type and leverage for a position

func (*ApiSetSubAccountPositionMarginConfigResponse) UnmarshalJSON

func (v *ApiSetSubAccountPositionMarginConfigResponse) UnmarshalJSON(data []byte) error

type ApiSfpTradingScheduleResponse

type ApiSfpTradingScheduleResponse struct {
	// Session data update timestamp in milliseconds
	UpdateTime int64 `json:"update_time,string"`
	// Legacy: use `schedules` instead. Schedule for the `EQUITY` asset class
	Equity *SfpMarketSchedule `json:"equity,omitempty"`
	// Legacy: use `schedules` instead. Schedule for the `EQUITY_NYSE` asset class
	EquityNyse *SfpMarketSchedule `json:"equity_nyse,omitempty"`
	// Legacy: use `schedules` instead. Schedule for the `EQUITY_NASDAQ` asset class
	EquityNasdaq *SfpMarketSchedule `json:"equity_nasdaq,omitempty"`
	// Legacy: use `schedules` instead. Schedule for the `COMMODITY` asset class
	Commodity *SfpMarketSchedule `json:"commodity,omitempty"`
	// Legacy: use `schedules` instead. Schedule for the `COMMODITY_CME` asset class
	CommodityCme *SfpMarketSchedule `json:"commodity_cme,omitempty"`
	// Trading hours as groups of stable perps sharing them: one per asset class, named after it, then one per instrument schedule, named in cluster config. Each...
	Schedules []SfpTradingScheduleGroup `json:"schedules"`
}

ApiSfpTradingScheduleResponse is a wire type.

func (*ApiSfpTradingScheduleResponse) UnmarshalJSON

func (v *ApiSfpTradingScheduleResponse) UnmarshalJSON(data []byte) error

type ApiSpotBorrowConfig

type ApiSpotBorrowConfig struct {
	Currency string `json:"currency"`
	// BL — max borrowable amount, denominated in the asset. 0 = not borrowable.
	BorrowLimit Decimal `json:"borrow_limit"`
	// BR — annual borrow interest rate at this tier. Never exceeds the asset's maxBorrowRate.
	BorrowRate Decimal `json:"borrow_rate"`
	// CL — max amount counted as collateral, denominated in the asset. 0 = unlimited.
	CollateralLimit Decimal `json:"collateral_limit"`
}

ApiSpotBorrowConfig Per-currency borrow & collateral limits resolved at this account's tier (incl. per-account overrides).

func (*ApiSpotBorrowConfig) UnmarshalJSON

func (v *ApiSpotBorrowConfig) UnmarshalJSON(data []byte) error

type ApiSpotSubAccountSummaryRequest

type ApiSpotSubAccountSummaryRequest struct {
	// The subaccount ID to filter by
	SubAccountID uint64 `json:"sub_account_id,string"`
}

ApiSpotSubAccountSummaryRequest is a wire type.

func (*ApiSpotSubAccountSummaryRequest) UnmarshalJSON

func (v *ApiSpotSubAccountSummaryRequest) UnmarshalJSON(data []byte) error

type ApiSpotSubAccountSummaryResponse

type ApiSpotSubAccountSummaryResponse struct {
	// The spot sub account summary
	Result SpotSubAccount `json:"result"`
}

ApiSpotSubAccountSummaryResponse The spot account summary, that reports the total equity and spot balances of a spot sub account

func (*ApiSpotSubAccountSummaryResponse) UnmarshalJSON

func (v *ApiSpotSubAccountSummaryResponse) UnmarshalJSON(data []byte) error

type ApiSubAccountSummaryRequest

type ApiSubAccountSummaryRequest struct {
	// The subaccount ID to filter by
	SubAccountID uint64 `json:"sub_account_id,string"`
}

ApiSubAccountSummaryRequest is a wire type.

func (*ApiSubAccountSummaryRequest) UnmarshalJSON

func (v *ApiSubAccountSummaryRequest) UnmarshalJSON(data []byte) error

type ApiSubAccountSummaryResponse

type ApiSubAccountSummaryResponse struct {
	// The sub account matching the request sub account
	Result SubAccount `json:"result"`
}

ApiSubAccountSummaryResponse Query for sub-account details, including base currency balance, all derivative positions, margin levels, and P&L.

func (*ApiSubAccountSummaryResponse) UnmarshalJSON

func (v *ApiSubAccountSummaryResponse) UnmarshalJSON(data []byte) error

type ApiTickerRequest

type ApiTickerRequest struct {
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
}

ApiTickerRequest Retrieves a single ticker value for a single instrument. Please do not use this to repeatedly poll for data -- a websocket subscription is much more performant, and useful. Rate limit: Perpetual...

func (*ApiTickerRequest) UnmarshalJSON

func (v *ApiTickerRequest) UnmarshalJSON(data []byte) error

type ApiTickerResponse

type ApiTickerResponse struct {
	// The mini ticker matching the request asset
	Result Ticker `json:"result"`
}

ApiTickerResponse is a wire type.

func (*ApiTickerResponse) UnmarshalJSON

func (v *ApiTickerResponse) UnmarshalJSON(data []byte) error

type ApiTradeHistoryRequest

type ApiTradeHistoryRequest struct {
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
	// The start time to apply in nanoseconds. If nil, this defaults to all start times. Otherwise, only entries matching the filter will be returned
	StartTime *time.Time `json:"start_time,omitempty"`
	// The end time to apply in nanoseconds. If nil, this defaults to all end times. Otherwise, only entries matching the filter will be returned
	EndTime *time.Time `json:"end_time,omitempty"`
	// The limit to query for. Defaults to 500; Max 1000
	Limit *uint32 `json:"limit,omitempty"`
	// The cursor to indicate when to start the query from
	Cursor string `json:"cursor,omitempty"`
}

ApiTradeHistoryRequest Perform historical lookup of public trades in any given instrument.

func (ApiTradeHistoryRequest) MarshalJSON

func (v ApiTradeHistoryRequest) MarshalJSON() ([]byte, error)

func (*ApiTradeHistoryRequest) UnmarshalJSON

func (v *ApiTradeHistoryRequest) UnmarshalJSON(data []byte) error

type ApiTradeHistoryResponse

type ApiTradeHistoryResponse struct {
	// The public trades matching the request asset
	Result []Trade `json:"result"`
	// The cursor to indicate when to start the next query from
	Next string `json:"next,omitempty"`
}

ApiTradeHistoryResponse is a wire type.

func (ApiTradeHistoryResponse) NextCursor

func (v ApiTradeHistoryResponse) NextCursor() string

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiTradeHistoryResponse) UnmarshalJSON

func (v *ApiTradeHistoryResponse) UnmarshalJSON(data []byte) error

type ApiTradeRequest

type ApiTradeRequest struct {
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
	// The limit to query for. Defaults to 500; Max 1000
	Limit uint32 `json:"limit"`
}

ApiTradeRequest Retrieves up to 1000 of the most recent trades in any given instrument. Do not use this to poll for data -- a websocket subscription is much more performant, and useful.

func (*ApiTradeRequest) UnmarshalJSON

func (v *ApiTradeRequest) UnmarshalJSON(data []byte) error

type ApiTradeResponse

type ApiTradeResponse struct {
	// The public trades matching the request asset
	Result []Trade `json:"result"`
}

ApiTradeResponse is a wire type.

func (*ApiTradeResponse) UnmarshalJSON

func (v *ApiTradeResponse) UnmarshalJSON(data []byte) error

type ApiTransferAck

type ApiTransferAck struct {
	// Gravity has acknowledged that the transfer has been successfully processed. If true, a `tx_id` will be returned. If false, an error will be returned.
	Ack bool `json:"ack"`
	// The transaction ID of the transfer. This is only returned if the transfer is successful.
	TxID uint64 `json:"tx_id,string"`
}

ApiTransferAck is a wire type.

func (*ApiTransferAck) UnmarshalJSON

func (v *ApiTransferAck) UnmarshalJSON(data []byte) error

type ApiTransferHistoryRequest

type ApiTransferHistoryRequest struct {
	// The token currency to query for, if nil or empty, return all transfers. Otherwise, only entries matching the filter will be returned
	Currency []string `json:"currency"`
	// The start time to query for in unix nanoseconds
	StartTime *time.Time `json:"start_time,omitempty"`
	// The end time to query for in unix nanoseconds
	EndTime *time.Time `json:"end_time,omitempty"`
	// The page size for a single response. Defaults to 500; Max 1000. This caps one page only — omitting it does NOT return everything, it applies the 500 default...
	Limit *uint32 `json:"limit,omitempty"`
	// The cursor to indicate when to start the next query from
	Cursor string `json:"cursor,omitempty"`
	// The transaction ID to query for
	TxID *uint64 `json:"tx_id,omitempty,string"`
	// Main account ID being queried. By default, applies the requestor's main account ID.
	MainAccountID string `json:"main_account_id,omitempty"`
	// The transfer type to filters for. If the list is empty, return all transfer types.
	TransferTypes []TransferType `json:"transfer_types,omitempty"`
}

ApiTransferHistoryRequest The request to get the historical transfers of an account

func (ApiTransferHistoryRequest) MarshalJSON

func (v ApiTransferHistoryRequest) MarshalJSON() ([]byte, error)

func (*ApiTransferHistoryRequest) UnmarshalJSON

func (v *ApiTransferHistoryRequest) UnmarshalJSON(data []byte) error

type ApiTransferHistoryResponse

type ApiTransferHistoryResponse struct {
	// The transfer history matching the request account
	Result []TransferHistory `json:"result"`
	// The cursor to indicate when to start the next query from
	Next string `json:"next,omitempty"`
}

ApiTransferHistoryResponse is a wire type.

func (ApiTransferHistoryResponse) NextCursor

func (v ApiTransferHistoryResponse) NextCursor() string

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiTransferHistoryResponse) UnmarshalJSON

func (v *ApiTransferHistoryResponse) UnmarshalJSON(data []byte) error

type ApiTransferHistoryResponseInput

type ApiTransferHistoryResponseInput struct {
	// The transfer history matching the request account
	Result []TransferHistoryInput `json:"result"`
	// The cursor to indicate when to start the next query from
	Next string `json:"next,omitempty"`
}

ApiTransferHistoryResponseInput is a wire type.

func (ApiTransferHistoryResponseInput) NextCursor

func (v ApiTransferHistoryResponseInput) NextCursor() string

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiTransferHistoryResponseInput) UnmarshalJSON

func (v *ApiTransferHistoryResponseInput) UnmarshalJSON(data []byte) error

type ApiTransferRequest

type ApiTransferRequest struct {
	// The main account to transfer from
	FromAccountID string `json:"from_account_id"`
	// The subaccount to transfer from (0 if transferring from main account)
	FromSubAccountID uint64 `json:"from_sub_account_id,string"`
	// The main account to deposit into
	ToAccountID string `json:"to_account_id"`
	// The subaccount to transfer to (0 if transferring to main account)
	ToSubAccountID uint64 `json:"to_sub_account_id,string"`
	// The token currency to transfer
	Currency string `json:"currency"`
	// The number of tokens to transfer. Decimal string, e.g. "1500.0"; up to the currency's balance_decimals. Scaled to an integer only inside the signature.
	NumTokens Decimal `json:"num_tokens"`
	// The signature of the transfer
	Signature Signature `json:"signature"`
	// The type of transfer
	TransferType TransferType `json:"transfer_type"`
	// The metadata of the transfer
	TransferMetadata string `json:"transfer_metadata,omitempty"`
	// The wallet type of the from account or subaccount
	FromWalletType WalletType `json:"from_wallet_type,omitempty"`
	// The wallet type of the to account or subaccount
	ToWalletType WalletType `json:"to_wallet_type,omitempty"`
}

ApiTransferRequest Transfer funds:

func (*ApiTransferRequest) UnmarshalJSON

func (v *ApiTransferRequest) UnmarshalJSON(data []byte) error

type ApiTransferRequestInput

type ApiTransferRequestInput struct {
	// The main account to transfer from
	FromAccountID string `json:"from_account_id"`
	// The subaccount to transfer from (0 if transferring from main account)
	FromSubAccountID uint64 `json:"from_sub_account_id,string"`
	// The main account to deposit into
	ToAccountID string `json:"to_account_id"`
	// The subaccount to transfer to (0 if transferring to main account)
	ToSubAccountID uint64 `json:"to_sub_account_id,string"`
	// The token currency to transfer
	Currency string `json:"currency"`
	// The number of tokens to transfer. Decimal string, e.g. "1500.0"; up to the currency's balance_decimals. Scaled to an integer only inside the signature.
	NumTokens Decimal `json:"num_tokens"`
	// The signature of the transfer
	Signature *SignatureInput `json:"signature,omitempty"`
	// The type of transfer
	TransferType TransferType `json:"transfer_type"`
	// The metadata of the transfer
	TransferMetadata string `json:"transfer_metadata,omitempty"`
	// The wallet type of the from account or subaccount
	FromWalletType WalletType `json:"from_wallet_type,omitempty"`
	// The wallet type of the to account or subaccount
	ToWalletType WalletType `json:"to_wallet_type,omitempty"`
}

ApiTransferRequestInput Transfer funds:

func (*ApiTransferRequestInput) UnmarshalJSON

func (v *ApiTransferRequestInput) UnmarshalJSON(data []byte) error

type ApiTransferResponse

type ApiTransferResponse struct {
	// The Transfer response object
	Result ApiTransferAck `json:"result"`
}

ApiTransferResponse Used to acknowledge a transfer request outcome

func (*ApiTransferResponse) UnmarshalJSON

func (v *ApiTransferResponse) UnmarshalJSON(data []byte) error

type ApiVaultBurnTokensRequest

type ApiVaultBurnTokensRequest struct {
	// The unique identifier of the vault to burn tokens from.
	VaultID uint64 `json:"vault_id,string"`
	// The currency used for the burn. This should be the vault's quote currency.
	Currency string `json:"currency"`
	// The number of tokens to burn.
	NumTokens Decimal `json:"num_tokens"`
	// The digital signature from the investing account.
	Signature Signature `json:"signature"`
}

ApiVaultBurnTokensRequest Request payload for burning tokens in a vault.

func (*ApiVaultBurnTokensRequest) UnmarshalJSON

func (v *ApiVaultBurnTokensRequest) UnmarshalJSON(data []byte) error

type ApiVaultBurnTokensRequestInput

type ApiVaultBurnTokensRequestInput struct {
	// The unique identifier of the vault to burn tokens from.
	VaultID uint64 `json:"vault_id,string"`
	// The currency used for the burn. This should be the vault's quote currency.
	Currency string `json:"currency"`
	// The number of tokens to burn.
	NumTokens Decimal `json:"num_tokens"`
	// The digital signature from the investing account.
	Signature *SignatureInput `json:"signature,omitempty"`
}

ApiVaultBurnTokensRequestInput Request payload for burning tokens in a vault.

func (*ApiVaultBurnTokensRequestInput) UnmarshalJSON

func (v *ApiVaultBurnTokensRequestInput) UnmarshalJSON(data []byte) error

type ApiVaultConversionRateRequest

type ApiVaultConversionRateRequest struct {
	// The currency converted from.
	FromCurrency string `json:"from_currency"`
	// The currency converted into.
	ToCurrency string `json:"to_currency"`
	// Optional amount of `fromCurrency`. When set, the response estimates what it converts into.
	FromNumTokens *Decimal `json:"from_num_tokens,omitempty"`
}

ApiVaultConversionRateRequest Request payload for the highest exchange rate the gateway currently accepts for a vault investment or redemption that converts `fromCurrency` into `toCurrency`.

func (*ApiVaultConversionRateRequest) UnmarshalJSON

func (v *ApiVaultConversionRateRequest) UnmarshalJSON(data []byte) error

type ApiVaultConversionRateResponse

type ApiVaultConversionRateResponse struct {
	// The currency converted from.
	FromCurrency string `json:"from_currency"`
	// The currency converted into.
	ToCurrency string `json:"to_currency"`
	// The highest rate accepted now, `toCurrency` per unit of `fromCurrency`, floored to 9 decimal places. It is 1 when both currencies are the same.
	ExchangeRate Decimal `json:"exchange_rate"`
	// The current spot rate from the latest oracle prices, 9 decimal places.
	SpotRate Decimal `json:"spot_rate"`
	// The conversion fee configured for the pair, in centibeeps (1 = 0.0001%).
	FeeRateCentiBeeps uint32 `json:"fee_rate_centi_beeps"`
	// The length of the window the rate is the highest of, in seconds.
	WindowSeconds uint32 `json:"window_seconds"`
	// When the price sample the rate comes from leaves the window, in unix nanoseconds. Show a validity no longer than this.
	ValidUntil time.Time `json:"valid_until"`
	// The time of the newest oracle price the rate uses, in unix nanoseconds.
	EventTime time.Time `json:"event_time"`
	// The amount of `fromCurrency` the request named, if any.
	FromNumTokens *Decimal `json:"from_num_tokens,omitempty"`
	// What `fromNumTokens` converts into at `exchangeRate`, floored to `toCurrency` decimals. Omitted without `fromNumTokens`.
	ToNumTokens *Decimal `json:"to_num_tokens,omitempty"`
}

ApiVaultConversionRateResponse Response payload with the highest exchange rate the gateway currently accepts for the currency pair. Sign it as `exchangeRate`: any rate at or below it passes while the quote is valid.

func (ApiVaultConversionRateResponse) MarshalJSON

func (v ApiVaultConversionRateResponse) MarshalJSON() ([]byte, error)

func (*ApiVaultConversionRateResponse) UnmarshalJSON

func (v *ApiVaultConversionRateResponse) UnmarshalJSON(data []byte) error

type ApiVaultInvestV2Request

type ApiVaultInvestV2Request struct {
	// The unique identifier of the vault to invest in.
	VaultID uint64 `json:"vault_id,string"`
	// The trading account to invest from. 0 means the funding account.
	FromSubAccountID uint64 `json:"from_sub_account_id,string"`
	// FUNDING when `fromSubAccountID` is 0, otherwise SPOT or FUTURES.
	FromWalletType WalletType `json:"from_wallet_type"`
	// The currency debited from the source wallet.
	FromCurrency string `json:"from_currency"`
	// The amount debited from the source wallet, in `fromCurrency`.
	FromNumTokens Decimal `json:"from_num_tokens"`
	// The currency the vault receives. This must be the vault's investment currency.
	ToCurrency string `json:"to_currency"`
	// The signed rate, `toCurrency` per unit of `fromCurrency`, up to 9 decimal places. Exactly 1 when both currencies are the same.
	ExchangeRate Decimal `json:"exchange_rate"`
	// The `VaultInvestV3` signature of the investing account.
	Signature Signature `json:"signature"`
}

ApiVaultInvestV2Request Request payload for investing in a vault from the funding account or from a trading account, converting the source currency into the vault's investment currency when they differ.

func (*ApiVaultInvestV2Request) UnmarshalJSON

func (v *ApiVaultInvestV2Request) UnmarshalJSON(data []byte) error

type ApiVaultInvestV2RequestInput

type ApiVaultInvestV2RequestInput struct {
	// The unique identifier of the vault to invest in.
	VaultID uint64 `json:"vault_id,string"`
	// The trading account to invest from. 0 means the funding account.
	FromSubAccountID uint64 `json:"from_sub_account_id,string"`
	// FUNDING when `fromSubAccountID` is 0, otherwise SPOT or FUTURES.
	FromWalletType WalletType `json:"from_wallet_type"`
	// The currency debited from the source wallet.
	FromCurrency string `json:"from_currency"`
	// The amount debited from the source wallet, in `fromCurrency`.
	FromNumTokens Decimal `json:"from_num_tokens"`
	// The currency the vault receives. This must be the vault's investment currency.
	ToCurrency string `json:"to_currency"`
	// The signed rate, `toCurrency` per unit of `fromCurrency`, up to 9 decimal places. Exactly 1 when both currencies are the same.
	ExchangeRate Decimal `json:"exchange_rate"`
	// The `VaultInvestV3` signature of the investing account.
	Signature *SignatureInput `json:"signature,omitempty"`
}

ApiVaultInvestV2RequestInput Request payload for investing in a vault from the funding account or from a trading account, converting the source currency into the vault's investment currency when they differ.

func (*ApiVaultInvestV2RequestInput) UnmarshalJSON

func (v *ApiVaultInvestV2RequestInput) UnmarshalJSON(data []byte) error

type ApiVaultInvestV2Response

type ApiVaultInvestV2Response struct {
	// Whether the investment was accepted.
	Ack bool `json:"ack"`
	// The transaction ID of the investment once risk confirmed it. 0 when the investment was queued.
	TxID uint64 `json:"tx_id,string"`
	// Cross-exchange vaults only: true when the vault was locked and the investment was queued.
	Enqueued *bool `json:"enqueued,omitempty"`
}

ApiVaultInvestV2Response Response payload for a vault investment.

func (*ApiVaultInvestV2Response) UnmarshalJSON

func (v *ApiVaultInvestV2Response) UnmarshalJSON(data []byte) error

type ApiVaultInvestorHistory

type ApiVaultInvestorHistory struct {
	// Time at which the event was emitted in unix nanoseconds
	EventTime time.Time `json:"event_time"`
	// The off chain account id of the investor, only visible to the manager
	OffChainAccountID string `json:"off_chain_account_id"`
	// The unique identifier of the vault.
	VaultID uint64 `json:"vault_id,string"`
	// The type of transaction that occurred. List of types: vaultInvest, vaultBurnLpToken, vaultRedeem
	Type VaultInvestorAction `json:"type"`
	// The price of the vault LP tokens at the time of the event.
	Price Decimal `json:"price"`
	// The amount of Vault LP tokens invested or redeemed.
	Size Decimal `json:"size"`
	// The realized PnL of the vault.
	RealizedPnl Decimal `json:"realized_pnl"`
	// The performance fee of the vault.
	PerformanceFee Decimal `json:"performance_fee"`
	// The vault leg's currency: the vault's investment currency, which the vault received or paid. Empty on a burn, which moves no tokens.
	TokenCurrency string `json:"token_currency"`
	// The vault leg: the tokens of tokenCurrency the vault received on an invest or paid on a redemption. 0 on a burn, and on a vaultRedeem recorded before its...
	NumTokens Decimal `json:"num_tokens"`
	// The currency that left its owner: on an invest the investor's source currency (the user leg), on a redemption tokenCurrency. A row without conversion has the...
	FromCurrency string `json:"from_currency"`
	// The tokens of fromCurrency that left their owner: on an invest what the investor paid (the user leg), on a redemption numTokens. 0 on a burn, and on a...
	FromNumTokens Decimal `json:"from_num_tokens"`
	// The currency that reached its owner: on a redemption the investor's payout currency (the user leg), on an invest tokenCurrency. A row without conversion has...
	ToCurrency string `json:"to_currency"`
	// The tokens of toCurrency that reached their owner: on a redemption what the investor received (the user leg), on an invest numTokens. 0 on a burn, and on a...
	ToNumTokens Decimal `json:"to_num_tokens"`
	// The conversion fee in toCurrency: the difference between the two legs of a converting invest or redemption. 0 without conversion.
	ConversionFeeNumTokens Decimal `json:"conversion_fee_num_tokens"`
	// The trading sub-account an invest was paid from. 0 for the funding account and on other rows.
	FromSubAccountID uint64 `json:"from_sub_account_id,string"`
	// The wallet an invest was paid from: FUNDING for the funding account, otherwise SPOT or FUTURES. Unspecified on redemptions and burns.
	FromWalletType WalletType `json:"from_wallet_type"`
	// On a redemption, when its redemption request was made, in unix nanoseconds. 0 when unknown and on other rows.
	RequestTime time.Time `json:"request_time"`
}

ApiVaultInvestorHistory The vault investor history returned by the service to client

func (ApiVaultInvestorHistory) MarshalJSON

func (v ApiVaultInvestorHistory) MarshalJSON() ([]byte, error)

func (*ApiVaultInvestorHistory) UnmarshalJSON

func (v *ApiVaultInvestorHistory) UnmarshalJSON(data []byte) error

type ApiVaultInvestorSummaryRequest

type ApiVaultInvestorSummaryRequest struct {
	// The unique identifier of the vault to fetch the summary for.
	VaultID *uint64 `json:"vault_id,omitempty,string"`
}

ApiVaultInvestorSummaryRequest Request payload for fetching the summary of a vault investor.

type ApiVaultInvestorSummaryResponse

type ApiVaultInvestorSummaryResponse struct {
	// The summary of investments in the vault.
	VaultInvestorSummary []VaultInvestorSummary `json:"vault_investor_summary"`
}

ApiVaultInvestorSummaryResponse Response payload for the summary of a vault investor.

func (*ApiVaultInvestorSummaryResponse) UnmarshalJSON

func (v *ApiVaultInvestorSummaryResponse) UnmarshalJSON(data []byte) error

type ApiVaultRedeemCancelRequest

type ApiVaultRedeemCancelRequest struct {
	// The unique identifier of the vault to cancel the redemption from.
	VaultID uint64 `json:"vault_id,string"`
}

ApiVaultRedeemCancelRequest Request payload for canceling a vault redemption.

func (*ApiVaultRedeemCancelRequest) UnmarshalJSON

func (v *ApiVaultRedeemCancelRequest) UnmarshalJSON(data []byte) error

type ApiVaultRedeemV2Request

type ApiVaultRedeemV2Request struct {
	// The unique identifier of the vault to redeem from.
	VaultID uint64 `json:"vault_id,string"`
	// The currency the vault pays. This must be the vault's investment currency.
	FromCurrency string `json:"from_currency"`
	// The currency paid into the funding account: the investment currency, or another currency converted at `exchangeRate`.
	ToCurrency string `json:"to_currency"`
	// The number of shares to redeem.
	NumTokens Decimal `json:"num_tokens"`
	// The signed rate, `toCurrency` per unit of `fromCurrency`, up to 9 decimal places. Exactly 1 when both currencies are the same.
	ExchangeRate Decimal `json:"exchange_rate"`
	// The `VaultRedeemV3` signature of the redeeming account.
	Signature Signature `json:"signature"`
}

ApiVaultRedeemV2Request Request payload for redeeming from a vault, paid in the vault's investment currency or converted into another currency.

func (*ApiVaultRedeemV2Request) UnmarshalJSON

func (v *ApiVaultRedeemV2Request) UnmarshalJSON(data []byte) error

type ApiVaultRedeemV2RequestInput

type ApiVaultRedeemV2RequestInput struct {
	// The unique identifier of the vault to redeem from.
	VaultID uint64 `json:"vault_id,string"`
	// The currency the vault pays. This must be the vault's investment currency.
	FromCurrency string `json:"from_currency"`
	// The currency paid into the funding account: the investment currency, or another currency converted at `exchangeRate`.
	ToCurrency string `json:"to_currency"`
	// The number of shares to redeem.
	NumTokens Decimal `json:"num_tokens"`
	// The signed rate, `toCurrency` per unit of `fromCurrency`, up to 9 decimal places. Exactly 1 when both currencies are the same.
	ExchangeRate Decimal `json:"exchange_rate"`
	// The `VaultRedeemV3` signature of the redeeming account.
	Signature *SignatureInput `json:"signature,omitempty"`
}

ApiVaultRedeemV2RequestInput Request payload for redeeming from a vault, paid in the vault's investment currency or converted into another currency.

func (*ApiVaultRedeemV2RequestInput) UnmarshalJSON

func (v *ApiVaultRedeemV2RequestInput) UnmarshalJSON(data []byte) error

type ApiVaultViewRedemptionQueueRequest

type ApiVaultViewRedemptionQueueRequest struct {
	// The unique identifier of the vault to fetch the redemption queue for.
	VaultID uint64 `json:"vault_id,string"`
}

ApiVaultViewRedemptionQueueRequest Request payload for a vault manager to view the redemption queue for their vault.

func (*ApiVaultViewRedemptionQueueRequest) UnmarshalJSON

func (v *ApiVaultViewRedemptionQueueRequest) UnmarshalJSON(data []byte) error

type ApiVaultViewRedemptionQueueResponse

type ApiVaultViewRedemptionQueueResponse struct {
	// Outstanding vault redemption requests, ordered by descending priority. Excludes requests that have not yet aged past the minimum redemption period.
	RedemptionQueue []VaultRedemptionRequest `json:"redemption_queue"`
	// Number of shares eligible for automated redemption (held in queue for at least the minimum redemption period).
	PendingRedemptionTokenCount Decimal `json:"pending_redemption_token_count"`
	// Number of shares nearing the maximum redemption period (>= 90% of maximum redemption period).
	UrgentRedemptionTokenCount Decimal `json:"urgent_redemption_token_count"`
	// Amount available for automated redemption request servicing (in USD).
	AutoRedeemableBalance Decimal `json:"auto_redeemable_balance"`
	// Current share price (in USD).
	SharePrice Decimal `json:"share_price"`
	// Dedicated section for requests yet to wait at least the minimum redemption period.
	PreMin PreMinRedemptions `json:"pre_min"`
}

ApiVaultViewRedemptionQueueResponse Response payload for a vault manager to view the redemption queue for their vault, ordered by descending priority.

func (*ApiVaultViewRedemptionQueueResponse) UnmarshalJSON

func (v *ApiVaultViewRedemptionQueueResponse) UnmarshalJSON(data []byte) error

type ApiWithdrawalFeeRequest

type ApiWithdrawalFeeRequest struct {
	// Currency ID to express the withdrawal fee in (e.g. USDT id 3).
	TokenCurrency uint16 `json:"token_currency"`
}

ApiWithdrawalFeeRequest Query the flat withdrawal fee for a native (L2 -> L1) bridge withdrawal, expressed in the requested currency

func (*ApiWithdrawalFeeRequest) UnmarshalJSON

func (v *ApiWithdrawalFeeRequest) UnmarshalJSON(data []byte) error

type ApiWithdrawalFeeResponse

type ApiWithdrawalFeeResponse struct {
	// The withdrawal fee. Decimal string, e.g. "1500.0"; up to the currency's balance_decimals.
	WithdrawalFee Decimal `json:"withdrawal_fee"`
	// The currency the withdrawal fee is expressed in.
	TokenCurrency string `json:"token_currency"`
}

ApiWithdrawalFeeResponse The native bridge withdrawal fee, in the requested currency

func (*ApiWithdrawalFeeResponse) UnmarshalJSON

func (v *ApiWithdrawalFeeResponse) UnmarshalJSON(data []byte) error

type ApiWithdrawalHistoryRequest

type ApiWithdrawalHistoryRequest struct {
	// The token currency to query for, if nil or empty, return all withdrawals. Otherwise, only entries matching the filter will be returned
	Currency []string `json:"currency"`
	// The start time to query for in unix nanoseconds
	StartTime *time.Time `json:"start_time,omitempty"`
	// The end time to query for in unix nanoseconds
	EndTime *time.Time `json:"end_time,omitempty"`
	// The page size for a single response. Defaults to 500; Max 1000. This caps one page only — omitting it does NOT return everything, it applies the 500 default...
	Limit *uint32 `json:"limit,omitempty"`
	// The cursor to indicate when to start the next query from
	Cursor string `json:"cursor,omitempty"`
	// Main account ID being queried. By default, applies the requestor's main account ID.
	MainAccountID string `json:"main_account_id,omitempty"`
}

ApiWithdrawalHistoryRequest The request to get the historical withdrawals of an account

func (ApiWithdrawalHistoryRequest) MarshalJSON

func (v ApiWithdrawalHistoryRequest) MarshalJSON() ([]byte, error)

func (*ApiWithdrawalHistoryRequest) UnmarshalJSON

func (v *ApiWithdrawalHistoryRequest) UnmarshalJSON(data []byte) error

type ApiWithdrawalHistoryResponse

type ApiWithdrawalHistoryResponse struct {
	// The withdrawals history matching the request account
	Result []WithdrawalHistory `json:"result"`
	// The cursor to indicate when to start the next query from
	Next string `json:"next,omitempty"`
}

ApiWithdrawalHistoryResponse is a wire type.

func (ApiWithdrawalHistoryResponse) NextCursor

func (v ApiWithdrawalHistoryResponse) NextCursor() string

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiWithdrawalHistoryResponse) UnmarshalJSON

func (v *ApiWithdrawalHistoryResponse) UnmarshalJSON(data []byte) error

type ApiWithdrawalHistoryResponseInput

type ApiWithdrawalHistoryResponseInput struct {
	// The withdrawals history matching the request account
	Result []WithdrawalHistoryInput `json:"result"`
	// The cursor to indicate when to start the next query from
	Next string `json:"next,omitempty"`
}

ApiWithdrawalHistoryResponseInput is a wire type.

func (ApiWithdrawalHistoryResponseInput) NextCursor

NextCursor returns the server's continuation cursor, or empty at the end.

func (*ApiWithdrawalHistoryResponseInput) UnmarshalJSON

func (v *ApiWithdrawalHistoryResponseInput) UnmarshalJSON(data []byte) error

type ApiWithdrawalRequest

type ApiWithdrawalRequest struct {
	// The main account to withdraw from
	FromAccountID string `json:"from_account_id"`
	// The Ethereum wallet to withdraw into
	ToEthAddress string `json:"to_eth_address"`
	// The token currency to withdraw
	Currency string `json:"currency"`
	// The number of tokens to withdraw. Decimal string, e.g. "1500.0"; up to the currency's balance_decimals. Scaled to an integer only inside the signature.
	NumTokens Decimal `json:"num_tokens"`
	// The signature of the withdrawal
	Signature Signature `json:"signature"`
}

ApiWithdrawalRequest Leverage this API to initialize a withdrawal from GRVT's Hyperchain onto Ethereum.

func (*ApiWithdrawalRequest) UnmarshalJSON

func (v *ApiWithdrawalRequest) UnmarshalJSON(data []byte) error

type ApiWithdrawalRequestInput

type ApiWithdrawalRequestInput struct {
	// The main account to withdraw from
	FromAccountID string `json:"from_account_id"`
	// The Ethereum wallet to withdraw into
	ToEthAddress string `json:"to_eth_address"`
	// The token currency to withdraw
	Currency string `json:"currency"`
	// The number of tokens to withdraw. Decimal string, e.g. "1500.0"; up to the currency's balance_decimals. Scaled to an integer only inside the signature.
	NumTokens Decimal `json:"num_tokens"`
	// The signature of the withdrawal
	Signature *SignatureInput `json:"signature,omitempty"`
}

ApiWithdrawalRequestInput Leverage this API to initialize a withdrawal from GRVT's Hyperchain onto Ethereum.

func (*ApiWithdrawalRequestInput) UnmarshalJSON

func (v *ApiWithdrawalRequestInput) UnmarshalJSON(data []byte) error

type AssetClass

type AssetClass string

AssetClass Asset class of an instrument's underlying. The first five values (crypto through index) are general classifications used by Perpetuals for display. The remaining values (equityNasdaq, equityNyse...

const (
	// AssetClassCrypto Digital assets (e.g. BTC, ETH)
	AssetClassCrypto AssetClass = "CRYPTO"
	// AssetClassEquity Equities and equity-linked underlyings (e.g. stocks)
	AssetClassEquity AssetClass = "EQUITY"
	// AssetClassCommodity Physical commodities (e.g. gold, oil)
	AssetClassCommodity AssetClass = "COMMODITY"
	// AssetClassFx Foreign-exchange currency pairs
	AssetClassFx AssetClass = "FX"
	// AssetClassIndex Composite indices tracking a basket of underlyings
	AssetClassIndex AssetClass = "INDEX"
	// AssetClassEquityNasdaq NASDAQ-listed equities — maps to a TradingSchedule entry
	AssetClassEquityNasdaq AssetClass = "EQUITY_NASDAQ"
	// AssetClassEquityNyse NYSE/NYSE Arca-listed equities and ETFs — maps to a TradingSchedule entry
	AssetClassEquityNyse AssetClass = "EQUITY_NYSE"
	// AssetClassEquityKrx Korea Exchange (KRX)-listed equities — maps to a TradingSchedule entry
	AssetClassEquityKrx AssetClass = "EQUITY_KRX"
	// AssetClassCommodityCme CME-traded commodities — maps to a TradingSchedule entry
	AssetClassCommodityCme AssetClass = "COMMODITY_CME"
	// AssetClassPreIpo Pre-IPO instruments — maps to a TradingSchedule entry
	AssetClassPreIpo AssetClass = "PRE_IPO"
)

func (AssetClass) Code

func (e AssetClass) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (AssetClass) String

func (e AssetClass) String() string

String returns the wire value.

type BrokerTag

type BrokerTag string

BrokerTag BrokerTag is a tag for the broker that the order is sent from.

const (
	BrokerTagUnspecified BrokerTag = "UNSPECIFIED"
	// BrokerTagCoinRoutes CoinRoutes
	BrokerTagCoinRoutes BrokerTag = "COIN_ROUTES"
	// BrokerTagAlertatron Alertatron
	BrokerTagAlertatron BrokerTag = "ALERTATRON"
	// BrokerTagOrigami Origami
	BrokerTagOrigami BrokerTag = "ORIGAMI"
)

func (BrokerTag) Code

func (e BrokerTag) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (BrokerTag) String

func (e BrokerTag) String() string

String returns the wire value.

type BuilderFillHistory

type BuilderFillHistory struct {
	// Time at which the event was emitted in unix nanoseconds
	EventTime time.Time `json:"event_time"`
	// The off chain account id
	OffChainAccountID string `json:"off_chain_account_id"`
	// The instrument being represented
	Instrument string `json:"instrument"`
	// The side that the subaccount took on the trade
	IsBuyer bool `json:"is_buyer"`
	// The role that the subaccount took on the trade
	IsTaker bool `json:"is_taker"`
	// The number of assets being traded. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	Size Decimal `json:"size"`
	// The traded price. Decimal string, e.g. "65000.5"; up to 9 decimals.
	Price Decimal `json:"price"`
	// The mark price of the instrument at point of trade. Decimal string, e.g. "65000.5"; up to 9 decimals.
	MarkPrice Decimal `json:"mark_price"`
	// The index price of the instrument at point of trade. Decimal string, e.g. "65000.5"; up to 9 decimals.
	IndexPrice Decimal `json:"index_price"`
	// Builder fee percentage charged for this order. referred to Order.builder builderFee
	FeeRate Decimal `json:"fee_rate"`
	// The builder fee paid on the trade, in the quote asset. Decimal string, e.g. "12.5". referred to Trade.builderFee
	Fee int64 `json:"fee,string"`
}

BuilderFillHistory is a wire type.

func (BuilderFillHistory) MarshalJSON

func (v BuilderFillHistory) MarshalJSON() ([]byte, error)

func (*BuilderFillHistory) UnmarshalJSON

func (v *BuilderFillHistory) UnmarshalJSON(data []byte) error

type CDCStatus

type CDCStatus string

CDCStatus Per-asset collateral-deposit-cap (CDC) utilization status.

const (
	// CDCStatusNormal CDC utilization below the reduce-only threshold.
	CDCStatusNormal CDCStatus = "NORMAL"
	// CDCStatusReduceOnly CDC utilization at or above the reduce-only threshold but below 100% — new collateral deposits are restricted.
	CDCStatusReduceOnly CDCStatus = "REDUCE_ONLY"
	// CDCStatusAutoExchange CDC utilization at or above 100% — subject to auto-exchange.
	CDCStatusAutoExchange CDCStatus = "AUTO_EXCHANGE"
)

func (CDCStatus) Code

func (e CDCStatus) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (CDCStatus) String

func (e CDCStatus) String() string

String returns the wire value.

type CancelStatus

type CancelStatus string

CancelStatus is a wire enum.

const (
	// CancelStatusExpired Cancellation has expired because corresponding order had not arrived within the defined time-to-live window.
	CancelStatusExpired CancelStatus = "EXPIRED"
	// CancelStatusDroppedDuplicate This cancellation request was dropped because its TTL window overlaps with another cancellation request for the same order.
	CancelStatusDroppedDuplicate CancelStatus = "DROPPED_DUPLICATE"
)

func (CancelStatus) Code

func (e CancelStatus) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (CancelStatus) String

func (e CancelStatus) String() string

String returns the wire value.

type CancelStatusFeed

type CancelStatusFeed struct {
	// The subaccount ID that requested the cancellation
	SubAccountID uint64 `json:"sub_account_id,string"`
	// A unique identifier for the active order within a subaccount, specified by the client
	ClientOrderID uint64 `json:"client_order_id,string"`
	// A unique 128-bit identifier for the order, deterministically generated within the GRVT backend
	OrderID string `json:"order_id"`
	// The user-provided reason for cancelling the order
	Reason OrderRejectReason `json:"reason"`
	// Set by the server. Time at which the cancellation status was updated by GRVT in unix nanoseconds
	UpdateTime *time.Time `json:"update_time,omitempty"`
	// Status of the cancellation attempt
	CancelStatus CancelStatus `json:"cancel_status"`
}

CancelStatusFeed is a wire type.

func (CancelStatusFeed) MarshalJSON

func (v CancelStatusFeed) MarshalJSON() ([]byte, error)

func (*CancelStatusFeed) UnmarshalJSON

func (v *CancelStatusFeed) UnmarshalJSON(data []byte) error

type Candlestick

type Candlestick struct {
	// Open time of kline bar in unix nanoseconds
	OpenTime time.Time `json:"open_time"`
	// Close time of kline bar in unix nanosecond
	CloseTime time.Time `json:"close_time"`
	// The open price, expressed in underlying currency resolution units
	Open Decimal `json:"open"`
	// The close price, expressed in underlying currency resolution units
	Close Decimal `json:"close"`
	// The high price, expressed in underlying currency resolution units
	High Decimal `json:"high"`
	// The low price, expressed in underlying currency resolution units
	Low Decimal `json:"low"`
	// The underlying volume transacted. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	VolumeB Decimal `json:"volume_b"`
	// The quote volume transacted, in the quote asset. Decimal string, e.g. "12.5".
	VolumeQ Decimal `json:"volume_q"`
	// The number of trades transacted
	Trades uint32 `json:"trades"`
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
}

Candlestick is a wire type.

func (Candlestick) MarshalJSON

func (v Candlestick) MarshalJSON() ([]byte, error)

func (*Candlestick) UnmarshalJSON

func (v *Candlestick) UnmarshalJSON(data []byte) error

type CandlestickInterval

type CandlestickInterval string

CandlestickInterval is a wire enum.

const (
	// CandlestickIntervalCi1M 1 minute
	CandlestickIntervalCi1M CandlestickInterval = "CI_1_M"
	// CandlestickIntervalCi3M 3 minutes
	CandlestickIntervalCi3M CandlestickInterval = "CI_3_M"
	// CandlestickIntervalCi5M 5 minutes
	CandlestickIntervalCi5M CandlestickInterval = "CI_5_M"
	// CandlestickIntervalCi15M 15 minutes
	CandlestickIntervalCi15M CandlestickInterval = "CI_15_M"
	// CandlestickIntervalCi30M 30 minutes
	CandlestickIntervalCi30M CandlestickInterval = "CI_30_M"
	// CandlestickIntervalCi1H 1 hour
	CandlestickIntervalCi1H CandlestickInterval = "CI_1_H"
	// CandlestickIntervalCi2H 2 hour
	CandlestickIntervalCi2H CandlestickInterval = "CI_2_H"
	// CandlestickIntervalCi4H 4 hour
	CandlestickIntervalCi4H CandlestickInterval = "CI_4_H"
	// CandlestickIntervalCi6H 6 hour
	CandlestickIntervalCi6H CandlestickInterval = "CI_6_H"
	// CandlestickIntervalCi8H 8 hour
	CandlestickIntervalCi8H CandlestickInterval = "CI_8_H"
	// CandlestickIntervalCi12H 12 hour
	CandlestickIntervalCi12H CandlestickInterval = "CI_12_H"
	// CandlestickIntervalCi1D 1 day
	CandlestickIntervalCi1D CandlestickInterval = "CI_1_D"
	// CandlestickIntervalCi3D 3 days
	CandlestickIntervalCi3D CandlestickInterval = "CI_3_D"
	// CandlestickIntervalCi5D 5 days
	CandlestickIntervalCi5D CandlestickInterval = "CI_5_D"
	// CandlestickIntervalCi1W 1 week
	CandlestickIntervalCi1W CandlestickInterval = "CI_1_W"
	// CandlestickIntervalCi2W 2 weeks
	CandlestickIntervalCi2W CandlestickInterval = "CI_2_W"
	// CandlestickIntervalCi3W 3 weeks
	CandlestickIntervalCi3W CandlestickInterval = "CI_3_W"
	// CandlestickIntervalCi4W 4 weeks
	CandlestickIntervalCi4W CandlestickInterval = "CI_4_W"
)

func (CandlestickInterval) Code

func (e CandlestickInterval) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (CandlestickInterval) String

func (e CandlestickInterval) String() string

String returns the wire value.

type CandlestickType

type CandlestickType string

CandlestickType is a wire enum.

const (
	// CandlestickTypeTrade Tracks traded prices
	CandlestickTypeTrade CandlestickType = "TRADE"
	// CandlestickTypeMark Tracks mark prices
	CandlestickTypeMark CandlestickType = "MARK"
	// CandlestickTypeIndex Tracks index prices
	CandlestickTypeIndex CandlestickType = "INDEX"
	// CandlestickTypeMid Tracks book mid prices
	CandlestickTypeMid CandlestickType = "MID"
)

func (CandlestickType) Code

func (e CandlestickType) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (CandlestickType) String

func (e CandlestickType) String() string

String returns the wire value.

type ChaseAlgoOrderMetadata

type ChaseAlgoOrderMetadata struct {
	// How the chase price is determined at each re-price tick
	ChasePriceMode ChasePriceMode `json:"chase_price_mode"`
	// The maximum distance the chase price can move away from the reference price, as an absolute price distance in quote currency units. Decimal string, e.g...
	MaxDistance Decimal `json:"max_distance"`
	// The max distance as a percentage in basis points (1 bp = 0.01%, 100% = 10000), as the user entered it. `0` if the user entered an absolute distance.
	MaxDistanceBps *uint32 `json:"max_distance_bps,omitempty"`
}

ChaseAlgoOrderMetadata Contains the parameters of a chase algo order. `chase_price_mode` defines how the price is derived at each re-price. `max_distance` caps how far the chase price may move away from the reference...

func (*ChaseAlgoOrderMetadata) UnmarshalJSON

func (v *ChaseAlgoOrderMetadata) UnmarshalJSON(data []byte) error

type ChaseOrderState

type ChaseOrderState struct {
	// The number of successful re-prices of this algo order's sub-orders
	RepriceCount uint32 `json:"reprice_count"`
}

ChaseOrderState Contains the runtime state specific to a chase algo order

func (*ChaseOrderState) UnmarshalJSON

func (v *ChaseOrderState) UnmarshalJSON(data []byte) error

type ChasePriceMode

type ChasePriceMode string

ChasePriceMode Defines how a chase order determines its price at each re-price tick

const (
	// ChasePriceModeBestBidAsk BEST_BID_ASK - The chase price equals the best bid (buy) or best ask (sell)
	ChasePriceModeBestBidAsk ChasePriceMode = "BEST_BID_ASK"
)

func (ChasePriceMode) Code

func (e ChasePriceMode) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (ChasePriceMode) String

func (e ChasePriceMode) String() string

String returns the wire value.

type ClientTier

type ClientTier struct {
	Tier            uint8 `json:"tier"`
	FuturesTakerFee int32 `json:"futures_taker_fee"`
	FuturesMakerFee int32 `json:"futures_maker_fee"`
	OptionsTakerFee int32 `json:"options_taker_fee"`
	OptionsMakerFee int32 `json:"options_maker_fee"`
	SpotTakerFee    int32 `json:"spot_taker_fee"`
	SpotMakerFee    int32 `json:"spot_maker_fee"`
	// Per-currency borrow & collateral limits for this tier. Populated only in the funding_account_summary response; empty in raw config contexts.
	SpotBorrowConfigs []ApiSpotBorrowConfig `json:"spot_borrow_configs"`
}

ClientTier is a wire type.

func (*ClientTier) UnmarshalJSON

func (v *ClientTier) UnmarshalJSON(data []byte) error

type CurrencyDetail

type CurrencyDetail struct {
	// The integer value of the currency
	ID uint16 `json:"id"`
	// The name of the currency
	Symbol string `json:"symbol"`
	// The balance decimals of the currency
	BalanceDecimals int8 `json:"balance_decimals"`
	// The quantity multiplier of the currency
	QuantityMultiplier uint64 `json:"quantity_multiplier,string"`
}

CurrencyDetail is a wire type.

func (*CurrencyDetail) UnmarshalJSON

func (v *CurrencyDetail) UnmarshalJSON(data []byte) error

type DayOfWeek

type DayOfWeek string

DayOfWeek Day of the week, used by recurring trading schedule sessions

const (
	// DayOfWeekMonday Monday
	DayOfWeekMonday DayOfWeek = "MONDAY"
	// DayOfWeekTuesday Tuesday
	DayOfWeekTuesday DayOfWeek = "TUESDAY"
	// DayOfWeekWednesday Wednesday
	DayOfWeekWednesday DayOfWeek = "WEDNESDAY"
	// DayOfWeekThursday Thursday
	DayOfWeekThursday DayOfWeek = "THURSDAY"
	// DayOfWeekFriday Friday
	DayOfWeekFriday DayOfWeek = "FRIDAY"
	// DayOfWeekSaturday Saturday
	DayOfWeekSaturday DayOfWeek = "SATURDAY"
	// DayOfWeekSunday Sunday
	DayOfWeekSunday DayOfWeek = "SUNDAY"
)

func (DayOfWeek) Code

func (e DayOfWeek) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (DayOfWeek) String

func (e DayOfWeek) String() string

String returns the wire value.

type Decimal

type Decimal struct {
	// contains filtered or unexported fields
}

Decimal carries an exact decimal without exposing an arithmetic library in the API. Its zero value is zero. Use ParseDecimal for other values.

func MustParseDecimal

func MustParseDecimal(text string) Decimal

MustParseDecimal is ParseDecimal for constants. It panics on invalid input.

func ParseDecimal

func ParseDecimal(text string) (Decimal, error)

func (Decimal) MarshalJSON

func (d Decimal) MarshalJSON() ([]byte, error)

func (Decimal) Rat

func (d Decimal) Rat() *big.Rat

Rat returns an independent exact rational value for callers that need arithmetic.

func (Decimal) String

func (d Decimal) String() string

func (*Decimal) UnmarshalJSON

func (d *Decimal) UnmarshalJSON(data []byte) error

type Deposit

type Deposit struct {
	// The hash of the bridgemint event producing the deposit
	TxHash string `json:"tx_hash"`
	// The account to deposit into
	ToAccountID string `json:"to_account_id"`
	// The token currency to deposit
	Currency string `json:"currency"`
	// The number of tokens to deposit
	NumTokens Decimal `json:"num_tokens"`
}

Deposit is a wire type.

func (*Deposit) UnmarshalJSON

func (v *Deposit) UnmarshalJSON(data []byte) error

type DepositHistory

type DepositHistory struct {
	// The L1 txHash of the deposit
	L1Hash string `json:"l_1_hash"`
	// The L2 txHash of the deposit
	L2Hash string `json:"l_2_hash"`
	// The account to deposit into
	ToAccountID string `json:"to_account_id"`
	// The token currency to deposit
	Currency string `json:"currency"`
	// The number of tokens to deposit
	NumTokens Decimal `json:"num_tokens"`
	// The timestamp when the deposit was initiated on L1 in unix nanoseconds
	InitiatedTime time.Time `json:"initiated_time"`
	// The timestamp when the deposit was confirmed on L2 in unix nanoseconds, empty if the deposit is pending.
	ConfirmedTime time.Time `json:"confirmed_time"`
	// The address of the sender
	FromAddress string `json:"from_address"`
}

DepositHistory is a wire type.

func (DepositHistory) MarshalJSON

func (v DepositHistory) MarshalJSON() ([]byte, error)

func (*DepositHistory) UnmarshalJSON

func (v *DepositHistory) UnmarshalJSON(data []byte) error

type EdgeApiKeyLoginRequest

type EdgeApiKeyLoginRequest struct {
	// The API key created in the GRVT UI.
	APIKey string `json:"api_key"`
}

EdgeApiKeyLoginRequest is a wire type.

func (*EdgeApiKeyLoginRequest) UnmarshalJSON

func (v *EdgeApiKeyLoginRequest) UnmarshalJSON(data []byte) error

type EdgeLoginError

type EdgeLoginError struct {
	// "failure"
	Status string `json:"status"`
	// Human-readable reason.
	Error string `json:"error"`
}

EdgeLoginError is a wire type.

func (*EdgeLoginError) UnmarshalJSON

func (v *EdgeLoginError) UnmarshalJSON(data []byte) error

type EdgeLoginResponse

type EdgeLoginResponse struct {
	// "success" on success.
	Status string `json:"status"`
	// Always empty for API callers.
	Location string `json:"location"`
	// Funding (main) account the key belongs to.
	FundingAccountAddress string `json:"funding_account_address"`
	// Set only when the key was created for a trading (sub) account.
	SubAccountID *uint64 `json:"sub_account_id,omitempty,string"`
}

EdgeLoginResponse is a wire type.

func (*EdgeLoginResponse) UnmarshalJSON

func (v *EdgeLoginResponse) UnmarshalJSON(data []byte) error

type EdgeWalletLoginRequest

type EdgeWalletLoginRequest struct {
	// Wallet address being logged in.
	Address string `json:"address"`
	// WalletLogin EIP-712 signature by that wallet.
	Signature Signature `json:"signature"`
}

EdgeWalletLoginRequest is a wire type.

func (*EdgeWalletLoginRequest) UnmarshalJSON

func (v *EdgeWalletLoginRequest) UnmarshalJSON(data []byte) error

type EdgeWalletLoginRequestInput

type EdgeWalletLoginRequestInput struct {
	// Wallet address being logged in.
	Address string `json:"address"`
	// WalletLogin EIP-712 signature by that wallet.
	Signature *SignatureInput `json:"signature,omitempty"`
}

EdgeWalletLoginRequestInput is a wire type.

func (*EdgeWalletLoginRequestInput) UnmarshalJSON

func (v *EdgeWalletLoginRequestInput) UnmarshalJSON(data []byte) error

type EdgeWalletLoginResponse

type EdgeWalletLoginResponse struct {
	// Funding (main) account linked to the wallet. Note: the public docs show the API-key response shape here; the code returns only this field.
	FundingAccountAddress string `json:"funding_account_address"`
}

EdgeWalletLoginResponse is a wire type.

func (*EdgeWalletLoginResponse) UnmarshalJSON

func (v *EdgeWalletLoginResponse) UnmarshalJSON(data []byte) error

type EmptyRequest

type EmptyRequest struct {
}

EmptyRequest Used for requests that do not require any parameters

type Error

type Error struct {
	// The error code for the request
	Code uint16 `json:"code"`
	// The error message for the request
	Message string `json:"message"`
}

Error An error response

func (*Error) UnmarshalJSON

func (v *Error) UnmarshalJSON(data []byte) error

type Fill

type Fill struct {
	// Time at which the event was emitted in unix nanoseconds
	EventTime time.Time `json:"event_time"`
	// The sub account ID that participated in the trade
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The instrument being represented
	Instrument string `json:"instrument"`
	// The side that the subaccount took on the trade
	IsBuyer bool `json:"is_buyer"`
	// The role that the subaccount took on the trade
	IsTaker bool `json:"is_taker"`
	// The number of assets being traded. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	Size Decimal `json:"size"`
	// The traded price. Decimal string, e.g. "65000.5"; up to 9 decimals.
	Price Decimal `json:"price"`
	// The mark price of the instrument at point of trade. Decimal string, e.g. "65000.5"; up to 9 decimals.
	MarkPrice *Decimal `json:"mark_price,omitempty"`
	// The index price of the instrument at point of trade. Decimal string, e.g. "65000.5"; up to 9 decimals.
	IndexPrice Decimal `json:"index_price"`
	// The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)
	InterestRate Decimal `json:"interest_rate"`
	// [Options] The forward price of the option at point of trade. Decimal string, e.g. "65000.5"; up to 9 decimals.
	ForwardPrice *Decimal `json:"forward_price,omitempty"`
	// The realized PnL of the trade, in the quote asset. Decimal string, e.g. "12.5". (0 if increasing position size)
	RealizedPnl Decimal `json:"realized_pnl"`
	// The fees paid on the trade, in the quote asset. Decimal string, e.g. "12.5". (negative if maker rebate applied)
	Fee Decimal `json:"fee"`
	// The fee rate paid on the trade
	FeeRate Decimal `json:"fee_rate"`
	// A trade identifier, globally unique, and monotonically increasing (not by `1`).
	TradeID string `json:"trade_id"`
	// An order identifier
	OrderID string `json:"order_id"`
	// The venue where the trade occurred
	Venue Venue `json:"venue"`
	// If the trade was a liquidation
	IsLiquidation bool `json:"is_liquidation"`
	// A unique identifier for the active order within a subaccount, specified by the client
	ClientOrderID uint64 `json:"client_order_id,string"`
	// The address (public key) of the wallet signing the payload
	Signer string `json:"signer"`
	// Specifies the broker who brokered the order
	Broker BrokerTag `json:"broker,omitempty"`
	// If the trade is a RPI trade
	IsRpi bool `json:"is_rpi"`
	// The main account ID of the builder. referred to Order.builder
	Builder string `json:"builder"`
	// Builder fee percentage charged for this order. referred to Order.builder builderFee
	BuilderFeeRate Decimal `json:"builder_fee_rate"`
	// The builder fee paid on the trade, in the quote asset. Decimal string, e.g. "12.5". referred to Trade.builderFee
	BuilderFee Decimal `json:"builder_fee"`
	// The currency of the fee paid on the trade
	FeeCurrency string `json:"fee_currency"`
	// If this fill was a MAM repayment/exchange, the scenario (manual / auto / liquidation); unspecified for normal trades.
	RepaymentScenario RepaymentScenario `json:"repayment_scenario"`
	// The RFQ this fill was cleared against. Only set for RFQ venue fills; unset otherwise
	RfqID string `json:"rfq_id,omitempty"`
	// The type of counterparty this fill was matched against (maker quote / resting order / forced-exit netting). Only set for RFQ venue fills; unset otherwise
	CounterpartyType RfqCounterpartyType `json:"counterparty_type,omitempty"`
}

Fill is a wire type.

func (Fill) MarshalJSON

func (v Fill) MarshalJSON() ([]byte, error)

func (*Fill) UnmarshalJSON

func (v *Fill) UnmarshalJSON(data []byte) error

type FundingAccountSummary

type FundingAccountSummary struct {
	// The main account ID of the account to which the summary belongs
	MainAccountID string `json:"main_account_id"`
	// Total equity of the main account, denominated in USD
	TotalEquity Decimal `json:"total_equity"`
	// The list of spot assets owned by this main account, and their balances
	SpotBalances []SpotBalance `json:"spot_balances"`
	// The list of vault investments held by this main account
	VaultInvestments []VaultInvestment `json:"vault_investments"`
	// Total balance of cash (stablecoin) currencies, denominated in USD
	TotalCashBalance Decimal `json:"total_cash_balance"`
	// Total balance of non-cash spot currencies, denominated in USD
	TotalSpotAssetBalance Decimal `json:"total_spot_asset_balance"`
}

FundingAccountSummary The funding account summary, that reports the total equity and spot balances of a funding (main) account

func (*FundingAccountSummary) UnmarshalJSON

func (v *FundingAccountSummary) UnmarshalJSON(data []byte) error

type FundingPayment

type FundingPayment struct {
	// Time at which the event was emitted in unix nanoseconds
	EventTime time.Time `json:"event_time"`
	// The sub account ID that made the funding payment
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The instrument being funded (perpetual or stable perp)
	Instrument string `json:"instrument"`
	// The currency of the funding payment
	Currency string `json:"currency"`
	// The amount of the funding payment. Positive if paid, negative if received
	Amount Decimal `json:"amount"`
	// The transaction ID of the funding payment.
	TxID uint64 `json:"tx_id,string"`
}

FundingPayment is a wire type.

func (FundingPayment) MarshalJSON

func (v FundingPayment) MarshalJSON() ([]byte, error)

func (*FundingPayment) UnmarshalJSON

func (v *FundingPayment) UnmarshalJSON(data []byte) error

type FundingRateAggregationType

type FundingRateAggregationType string

FundingRateAggregationType Specifies different methods of aggregating historical funding rates

const (
	// FundingRateAggregationTypeFundingInterval Default value -- one record returned per funding interval. Query instruments endpoint to learn funding interval of each instrument.
	FundingRateAggregationTypeFundingInterval FundingRateAggregationType = "FUNDING_INTERVAL"
	// FundingRateAggregationTypeOneHourly Returns one record per hour -- normalizes all funding rates to 1h durations, so `fundingRate` value is cumulative and can exceed a funding interval's...
	FundingRateAggregationTypeOneHourly FundingRateAggregationType = "ONE_HOURLY"
	// FundingRateAggregationTypeFourHourly Returns one record per 4 hours -- normalizes all funding rates to 4h durations, so `fundingRate` value is cumulative and can exceed a funding interval's...
	FundingRateAggregationTypeFourHourly FundingRateAggregationType = "FOUR_HOURLY"
	// FundingRateAggregationTypeEightHourly Returns one record for eight hours -- normalizes all funding rates to 8h durations, so `fundingRate` value is cumulative and can exceed a funding interval's...
	FundingRateAggregationTypeEightHourly FundingRateAggregationType = "EIGHT_HOURLY"
)

func (FundingRateAggregationType) Code

Code is the integer used when signing; false for a value this SDK does not know.

func (FundingRateAggregationType) String

String returns the wire value.

type FuturesWalletAssets

type FuturesWalletAssets struct {
	// The sub account mode
	Mode SubAccountMode `json:"mode"`
	// Assets supported under this futures mode
	SupportedAssets []SupportedAsset `json:"supported_assets"`
}

FuturesWalletAssets Supported assets for a futures wallet mode

func (*FuturesWalletAssets) UnmarshalJSON

func (v *FuturesWalletAssets) UnmarshalJSON(data []byte) error

type InitialLeverageResult

type InitialLeverageResult struct {
	// The instrument to get the leverage for
	Instrument string `json:"instrument"`
	// The initial leverage of this instrument
	Leverage Decimal `json:"leverage"`
	// The min leverage user can set for this instrument
	MinLeverage Decimal `json:"min_leverage"`
	// The max leverage user can set for this instrument
	MaxLeverage Decimal `json:"max_leverage"`
	// The margin type of this instrument
	MarginType PositionMarginType `json:"margin_type"`
}

InitialLeverageResult is a wire type.

func (*InitialLeverageResult) UnmarshalJSON

func (v *InitialLeverageResult) UnmarshalJSON(data []byte) error

type InstrumentDisplay

type InstrumentDisplay struct {
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
	// The asset ID used for instrument signing.
	InstrumentHash string `json:"instrument_hash"`
	// The base currency
	Base string `json:"base"`
	// The quote currency
	Quote string `json:"quote"`
	// The kind of instrument
	Kind Kind `json:"kind"`
	// Venues that this instrument can be traded at
	Venues []Venue `json:"venues"`
	// The settlement period of the instrument
	SettlementPeriod InstrumentSettlementPeriod `json:"settlement_period,omitempty"`
	// The smallest denomination of the base asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)
	BaseDecimals int8 `json:"base_decimals"`
	// The smallest denomination of the quote asset supported by GRVT (+3 represents 0.001, -3 represents 1000, 0 represents 1)
	QuoteDecimals int8 `json:"quote_decimals"`
	// The size of a single tick. Decimal string, e.g. "0.1"; up to 9 decimals.
	TickSize Decimal `json:"tick_size"`
	// The minimum contract size. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	MinSize Decimal `json:"min_size"`
	// Creation time in unix nanoseconds
	CreateTime time.Time `json:"create_time"`
	// The maximum position size. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	MaxPositionSize *Decimal `json:"max_position_size,omitempty"`
	// Defines the funding interval to be applied.
	FundingIntervalHours *uint8 `json:"funding_interval_hours,omitempty"`
	// Funding rate cap over the defined `intervalHours`.
	AdjustedFundingRateCap *Decimal `json:"adjusted_funding_rate_cap,omitempty"`
	// Funding rate floor over the defined `intervalHours`.
	AdjustedFundingRateFloor *Decimal `json:"adjusted_funding_rate_floor,omitempty"`
	// The minimum order notional value, in the quote asset. Decimal string, e.g. "12.5".
	MinNotional Decimal `json:"min_notional"`
	// The asset class of the underlying the instrument tracks
	AssetClass AssetClass `json:"asset_class,omitempty"`
	// The current lifecycle/trading status of the instrument
	Status InstrumentStatus `json:"status,omitempty"`
	// The guaranteed exit band, expressed in percentage points
	GuaranteedExitBand *Decimal `json:"guaranteed_exit_band,omitempty"`
	// The spread penalty tolerance, expressed in percentage points
	SpreadPenaltyTolerance *Decimal `json:"spread_penalty_tolerance,omitempty"`
	// Timestamp in unix nanoseconds at which the funding cap adjustment applies
	FundingCapAdjustmentTime *time.Time `json:"funding_cap_adjustment_time,omitempty"`
	// The funding cap adjustment value, expressed as a decimal daily rate
	FundingCapAdjustmentValue *Decimal `json:"funding_cap_adjustment_value,omitempty"`
	// Stable perps only: the weekday whose daily funding charge covers 3 days (the weekend)
	TripleSwapDay DayOfWeek `json:"triple_swap_day,omitempty"`
}

InstrumentDisplay is a wire type.

func (InstrumentDisplay) MarshalJSON

func (v InstrumentDisplay) MarshalJSON() ([]byte, error)

func (*InstrumentDisplay) UnmarshalJSON

func (v *InstrumentDisplay) UnmarshalJSON(data []byte) error

type InstrumentSettlementPeriod

type InstrumentSettlementPeriod string

InstrumentSettlementPeriod is a wire enum.

const (
	// InstrumentSettlementPeriodPerpetual Instrument settles through perpetual funding cycles
	InstrumentSettlementPeriodPerpetual InstrumentSettlementPeriod = "PERPETUAL"
	// InstrumentSettlementPeriodDaily Instrument settles at an expiry date, marked as a daily instrument
	InstrumentSettlementPeriodDaily InstrumentSettlementPeriod = "DAILY"
	// InstrumentSettlementPeriodWeekly Instrument settles at an expiry date, marked as a weekly instrument
	InstrumentSettlementPeriodWeekly InstrumentSettlementPeriod = "WEEKLY"
	// InstrumentSettlementPeriodMonthly Instrument settles at an expiry date, marked as a monthly instrument
	InstrumentSettlementPeriodMonthly InstrumentSettlementPeriod = "MONTHLY"
	// InstrumentSettlementPeriodQuarterly Instrument settles at an expiry date, marked as a quarterly instrument
	InstrumentSettlementPeriodQuarterly InstrumentSettlementPeriod = "QUARTERLY"
)

func (InstrumentSettlementPeriod) Code

Code is the integer used when signing; false for a value this SDK does not know.

func (InstrumentSettlementPeriod) String

String returns the wire value.

type InstrumentStatus

type InstrumentStatus string

InstrumentStatus The lifecycle/trading status of an instrument on the GRVT exchange

const (
	// InstrumentStatusActive Instrument is fully tradable
	InstrumentStatusActive InstrumentStatus = "ACTIVE"
	// InstrumentStatusReduceOnly Only position-reducing orders are accepted (e.g. pre-delist wind-down)
	InstrumentStatusReduceOnly InstrumentStatus = "REDUCE_ONLY"
	// InstrumentStatusMaintenance Trading is temporarily paused for scheduled maintenance; cancel-only
	InstrumentStatusMaintenance InstrumentStatus = "MAINTENANCE"
	// InstrumentStatusHalted Underlying halted at its primary market (LULD, news pending); index and mark frozen
	InstrumentStatusHalted InstrumentStatus = "HALTED"
	// InstrumentStatusClosed Outside trading window: daily maintenance break, weekend, holiday; cancel-only
	InstrumentStatusClosed InstrumentStatus = "CLOSED"
	// InstrumentStatusPending Instrument is created but not yet open for trading (pre-listing)
	InstrumentStatusPending InstrumentStatus = "PENDING"
	// InstrumentStatusDelisted Instrument has been permanently removed
	InstrumentStatusDelisted InstrumentStatus = "DELISTED"
)

func (InstrumentStatus) Code

func (e InstrumentStatus) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (InstrumentStatus) String

func (e InstrumentStatus) String() string

String returns the wire value.

type InterestPayment

type InterestPayment struct {
	// Time at which the interest charge was computed in unix nanoseconds
	EventTime time.Time `json:"event_time"`
	// The sub-account being charged interest
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The currency the interest is charged in
	Currency string `json:"currency"`
	// The interest charged for this hour.
	Amount Decimal `json:"amount"`
	// The last interest charge time accumulated to this amount (HH:05 tick).
	ChargeTime time.Time `json:"charge_time"`
	// The borrowed principal in this currency that the hourly interest was computed on.
	BorrowedAmount Decimal `json:"borrowed_amount"`
}

InterestPayment is a wire type.

func (InterestPayment) MarshalJSON

func (v InterestPayment) MarshalJSON() ([]byte, error)

func (*InterestPayment) UnmarshalJSON

func (v *InterestPayment) UnmarshalJSON(data []byte) error

type JSONRPCRequest

type JSONRPCRequest struct {
	// The JSON RPC version to use for the request
	Jsonrpc string `json:"jsonrpc"`
	// The method to use for the request (eg: `subscribe` / `unsubscribe` / `v1/instrument` )
	Method string `json:"method"`
	// The parameters for the request
	Params json.RawMessage `json:"params"`
	// Optional Field which is used to match the response by the client.
	ID *uint32 `json:"id,omitempty"`
}

JSONRPCRequest All Websocket JSON RPC Requests are housed in this wrapper. You may specify a stream, and a list of feeds to subscribe to.

func (*JSONRPCRequest) UnmarshalJSON

func (v *JSONRPCRequest) UnmarshalJSON(data []byte) error

type JSONRPCResponse

type JSONRPCResponse struct {
	// The JSON RPC version to use for the request
	Jsonrpc string `json:"jsonrpc"`
	// The result for the request
	Result json.RawMessage `json:"result,omitempty"`
	// The error for the request
	Error *Error `json:"error,omitempty"`
	// Optional Field which is used to match the response by the client.
	ID *uint32 `json:"id,omitempty"`
	// The method used in the request for this response (eg: `subscribe` / `unsubscribe` / `v1/instrument` )
	Method string `json:"method"`
}

JSONRPCResponse All Websocket JSON RPC Responses are housed in this wrapper. It returns a confirmation of the JSON RPC subscribe request.

func (*JSONRPCResponse) UnmarshalJSON

func (v *JSONRPCResponse) UnmarshalJSON(data []byte) error

type Kind

type Kind string

Kind The list of asset kinds that are supported on the GRVT exchange

const (
	// KindPerpetual the perpetual asset kind
	KindPerpetual Kind = "PERPETUAL"
	// KindFuture the future asset kind
	KindFuture Kind = "FUTURE"
	// KindCall the call option asset kind
	KindCall Kind = "CALL"
	// KindPut the put option asset kind
	KindPut Kind = "PUT"
	// KindSpotSwap the spot swap asset kind
	KindSpotSwap Kind = "SPOT_SWAP"
	// KindStablePerp Stable Funding Perp on an RWA underlying, USDC-settled
	KindStablePerp Kind = "STABLE_PERP"
)

func (Kind) Code

func (e Kind) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (Kind) String

func (e Kind) String() string

String returns the wire value.

type MarginType

type MarginType string

MarginType is a wire enum.

const (
	// MarginTypeSimpleCrossMargin Simple Cross Margin Mode: all assets have a predictable margin impact, the whole subaccount shares a single margin
	MarginTypeSimpleCrossMargin MarginType = "SIMPLE_CROSS_MARGIN"
	// MarginTypePortfolioCrossMargin Portfolio Cross Margin Mode: asset margin impact is analysed on portfolio level, the whole subaccount shares a single margin
	MarginTypePortfolioCrossMargin MarginType = "PORTFOLIO_CROSS_MARGIN"
)

func (MarginType) Code

func (e MarginType) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (MarginType) String

func (e MarginType) String() string

String returns the wire value.

type MiniTicker

type MiniTicker struct {
	// Time at which the event was emitted in unix nanoseconds
	EventTime *time.Time `json:"event_time,omitempty"`
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument,omitempty"`
	// The mark price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	MarkPrice *Decimal `json:"mark_price,omitempty"`
	// The index price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	IndexPrice *Decimal `json:"index_price,omitempty"`
	// The last traded price of the instrument (also close price). Decimal string, e.g. "65000.5"; up to 9 decimals.
	LastPrice *Decimal `json:"last_price,omitempty"`
	// The number of assets traded in the last trade. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	LastSize *Decimal `json:"last_size,omitempty"`
	// The mid price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	MidPrice *Decimal `json:"mid_price,omitempty"`
	// The best bid price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	BestBidPrice *Decimal `json:"best_bid_price,omitempty"`
	// The number of assets offered on the best bid price of the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	BestBidSize *Decimal `json:"best_bid_size,omitempty"`
	// The best ask price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	BestAskPrice *Decimal `json:"best_ask_price,omitempty"`
	// The number of assets offered on the best ask price of the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	BestAskSize *Decimal `json:"best_ask_size,omitempty"`
}

MiniTicker is a wire type.

func (MiniTicker) MarshalJSON

func (v MiniTicker) MarshalJSON() ([]byte, error)

func (*MiniTicker) UnmarshalJSON

func (v *MiniTicker) UnmarshalJSON(data []byte) error

type Order

type Order struct {
	// Set by the server. A unique 128-bit identifier for the order, deterministically generated within the GRVT backend
	OrderID string `json:"order_id,omitempty"`
	// The subaccount initiating the order
	SubAccountID uint64 `json:"sub_account_id,string"`
	// If the order is a market order
	IsMarket *bool `json:"is_market,omitempty"`
	// Four supported types of orders: GTT, IOC, AON, FOK:
	TimeInForce TimeInForce `json:"time_in_force"`
	// If True, Order must be a maker order. It has to fill the orderbook instead of match it.
	PostOnly *bool `json:"post_only,omitempty"`
	// If True, Order must reduce the position size, or be cancelled
	ReduceOnly *bool `json:"reduce_only,omitempty"`
	// The legs present in this order
	Legs []OrderLeg `json:"legs"`
	// The signature approving this order
	Signature Signature `json:"signature"`
	// Order Metadata, ignored by the smart contract, and unsigned by the client
	Metadata OrderMetadata `json:"metadata"`
	// Set by the server. The current state of the order, ignored by the smart contract, and unsigned by the client
	State *OrderState `json:"state,omitempty"`
	// The main account ID of the builder
	Builder string `json:"builder,omitempty"`
	// Builder fee charged for this order, expressed as a percentage (e.g., 0.001 means 0.001%).
	BuilderFee *Decimal `json:"builder_fee,omitempty"`
}

Order Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.

func (*Order) UnmarshalJSON

func (v *Order) UnmarshalJSON(data []byte) error

type OrderInput

type OrderInput struct {
	// Set by the server. A unique 128-bit identifier for the order, deterministically generated within the GRVT backend
	OrderID string `json:"order_id,omitempty"`
	// The subaccount initiating the order
	SubAccountID *uint64 `json:"sub_account_id,omitempty,string"`
	// If the order is a market order
	IsMarket *bool `json:"is_market,omitempty"`
	// Four supported types of orders: GTT, IOC, AON, FOK:
	TimeInForce TimeInForce `json:"time_in_force"`
	// If True, Order must be a maker order. It has to fill the orderbook instead of match it.
	PostOnly *bool `json:"post_only,omitempty"`
	// If True, Order must reduce the position size, or be cancelled
	ReduceOnly *bool `json:"reduce_only,omitempty"`
	// The legs present in this order
	Legs []OrderLeg `json:"legs"`
	// The signature approving this order
	Signature *SignatureInput `json:"signature,omitempty"`
	// Order Metadata, ignored by the smart contract, and unsigned by the client
	Metadata *OrderMetadataInput `json:"metadata,omitempty"`
	// Set by the server. The current state of the order, ignored by the smart contract, and unsigned by the client
	State *OrderState `json:"state,omitempty"`
	// The main account ID of the builder
	Builder string `json:"builder,omitempty"`
	// Builder fee charged for this order, expressed as a percentage (e.g., 0.001 means 0.001%).
	BuilderFee *Decimal `json:"builder_fee,omitempty"`
}

OrderInput Order is a typed payload used throughout the GRVT platform to express all orderbook, RFQ, and liquidation orders.

func (*OrderInput) UnmarshalJSON

func (v *OrderInput) UnmarshalJSON(data []byte) error

type OrderLeg

type OrderLeg struct {
	// The instrument to trade in this leg
	Instrument string `json:"instrument"`
	// The total number of assets to trade in this leg. Decimal string, e.g. "0.01"; up to the instrument's base_decimals. Scaled to an integer only inside the...
	Size Decimal `json:"size"`
	// The limit price of the order leg. Decimal string, e.g. "65000.5"; up to 9 decimals. Scaled to an integer only inside the signature.
	LimitPrice *Decimal `json:"limit_price,omitempty"`
	// Specifies if the order leg is a buy or sell
	IsBuyingAsset bool `json:"is_buying_asset"`
}

OrderLeg is a wire type.

func (*OrderLeg) UnmarshalJSON

func (v *OrderLeg) UnmarshalJSON(data []byte) error

type OrderMetadata

type OrderMetadata struct {
	// A unique identifier for the active order within a subaccount, specified by the client
	ClientOrderID uint64 `json:"client_order_id,string"`
	// Set by the server. Time at which the order was received by GRVT in unix nanoseconds
	CreateTime *time.Time `json:"create_time,omitempty"`
	// Trigger fields are used to support any type of trigger order such as TP/SL
	Trigger *TriggerOrderMetadata `json:"trigger,omitempty"`
	// Specifies the broker who brokered the order
	Broker BrokerTag `json:"broker,omitempty"`
	// Specifies this order is an ECN order eligible for Market Maker Last Look. Only applicable to STABLE_PERP (SFP) instruments with qualified market makers.
	IsEcn *bool `json:"is_ecn,omitempty"`
	// Maximum allowed slippage from mark price for an IOC limit order, expressed in basis points (800 = 8%).
	SlippageBps *uint16 `json:"slippage_bps,omitempty"`
	// Binds this order to an RFQ (see ApiCreateRfqRequest and the `v1.rfq` / `v1.quote` streams). Optional.
	RfqID string `json:"rfq_id,omitempty"`
	// Maker quotes only. true = a private quote delivered to a single RFQ's taker (appears only on that taker's `v1.quote` book); false = a public quote resting on...
	IsPrivate *bool `json:"is_private,omitempty"`
	// The algo order that created this order as a sub-order.
	AlgoOrderID string `json:"algo_order_id,omitempty"`
}

OrderMetadata Metadata fields are used to support Backend only operations. These operations are not trustless by nature.

func (OrderMetadata) MarshalJSON

func (v OrderMetadata) MarshalJSON() ([]byte, error)

func (*OrderMetadata) UnmarshalJSON

func (v *OrderMetadata) UnmarshalJSON(data []byte) error

type OrderMetadataInput

type OrderMetadataInput struct {
	// A unique identifier for the active order within a subaccount, specified by the client
	ClientOrderID *uint64 `json:"client_order_id,omitempty,string"`
	// Set by the server. Time at which the order was received by GRVT in unix nanoseconds
	CreateTime *time.Time `json:"create_time,omitempty"`
	// Trigger fields are used to support any type of trigger order such as TP/SL
	Trigger *TriggerOrderMetadata `json:"trigger,omitempty"`
	// Specifies the broker who brokered the order
	Broker BrokerTag `json:"broker,omitempty"`
	// Specifies this order is an ECN order eligible for Market Maker Last Look. Only applicable to STABLE_PERP (SFP) instruments with qualified market makers.
	IsEcn *bool `json:"is_ecn,omitempty"`
	// Maximum allowed slippage from mark price for an IOC limit order, expressed in basis points (800 = 8%).
	SlippageBps *uint16 `json:"slippage_bps,omitempty"`
	// Binds this order to an RFQ (see ApiCreateRfqRequest and the `v1.rfq` / `v1.quote` streams). Optional.
	RfqID string `json:"rfq_id,omitempty"`
	// Maker quotes only. true = a private quote delivered to a single RFQ's taker (appears only on that taker's `v1.quote` book); false = a public quote resting on...
	IsPrivate *bool `json:"is_private,omitempty"`
	// The algo order that created this order as a sub-order.
	AlgoOrderID string `json:"algo_order_id,omitempty"`
}

OrderMetadataInput Metadata fields are used to support Backend only operations. These operations are not trustless by nature.

func (OrderMetadataInput) MarshalJSON

func (v OrderMetadataInput) MarshalJSON() ([]byte, error)

func (*OrderMetadataInput) UnmarshalJSON

func (v *OrderMetadataInput) UnmarshalJSON(data []byte) error

type OrderRejectReason

type OrderRejectReason string

OrderRejectReason is a wire enum.

const (
	// OrderRejectReasonUnspecified order is not cancelled or rejected
	OrderRejectReasonUnspecified OrderRejectReason = "UNSPECIFIED"
	// OrderRejectReasonClientCancel client called a Cancel API
	OrderRejectReasonClientCancel OrderRejectReason = "CLIENT_CANCEL"
	// OrderRejectReasonClientBulkCancel client called a Bulk Cancel API
	OrderRejectReasonClientBulkCancel OrderRejectReason = "CLIENT_BULK_CANCEL"
	// OrderRejectReasonClientSessionEnd client called a Session Cancel API, or set the WebSocket connection to 'cancelOrdersOnTerminate'
	OrderRejectReasonClientSessionEnd OrderRejectReason = "CLIENT_SESSION_END"
	// OrderRejectReasonMarketCancel the market order was cancelled after no/partial fill. Lower precedence than other TimeInForce cancel reasons
	OrderRejectReasonMarketCancel OrderRejectReason = "MARKET_CANCEL"
	// OrderRejectReasonIocCancel the IOC order was cancelled after no/partial fill
	OrderRejectReasonIocCancel OrderRejectReason = "IOC_CANCEL"
	// OrderRejectReasonAonCancel the AON order was cancelled as it could not be fully matched
	OrderRejectReasonAonCancel OrderRejectReason = "AON_CANCEL"
	// OrderRejectReasonFokCancel the FOK order was cancelled as it could not be fully matched
	OrderRejectReasonFokCancel OrderRejectReason = "FOK_CANCEL"
	// OrderRejectReasonExpired the order was cancelled as it has expired
	OrderRejectReasonExpired OrderRejectReason = "EXPIRED"
	// OrderRejectReasonFailPostOnly the post-only order could not be posted into the orderbook
	OrderRejectReasonFailPostOnly OrderRejectReason = "FAIL_POST_ONLY"
	// OrderRejectReasonFailReduceOnly the reduce-only order would have caused position size to increase
	OrderRejectReasonFailReduceOnly OrderRejectReason = "FAIL_REDUCE_ONLY"
	// OrderRejectReasonMmProtection the order was cancelled due to market maker protection trigger
	OrderRejectReasonMmProtection OrderRejectReason = "MM_PROTECTION"
	// OrderRejectReasonSelfTradeProtection the order was cancelled due to self-trade protection trigger
	OrderRejectReasonSelfTradeProtection OrderRejectReason = "SELF_TRADE_PROTECTION"
	// OrderRejectReasonSelfMatchedSubaccount the order matched with another order from the same sub account
	OrderRejectReasonSelfMatchedSubaccount OrderRejectReason = "SELF_MATCHED_SUBACCOUNT"
	// OrderRejectReasonOverlappingClientOrderID an active order on your sub account shares the same clientOrderId
	OrderRejectReasonOverlappingClientOrderID OrderRejectReason = "OVERLAPPING_CLIENT_ORDER_ID"
	// OrderRejectReasonBelowMargin the order will bring the sub account below initial margin requirement
	OrderRejectReasonBelowMargin OrderRejectReason = "BELOW_MARGIN"
	// OrderRejectReasonLiquidation the sub account is liquidated (and all open orders are cancelled by Gravity)
	OrderRejectReasonLiquidation OrderRejectReason = "LIQUIDATION"
	// OrderRejectReasonInstrumentInvalid instrument is invalid or not found on Gravity
	OrderRejectReasonInstrumentInvalid OrderRejectReason = "INSTRUMENT_INVALID"
	// OrderRejectReasonInstrumentDeactivated instrument is no longer tradable on Gravity. (typically due to a market halt, or instrument expiry)
	OrderRejectReasonInstrumentDeactivated OrderRejectReason = "INSTRUMENT_DEACTIVATED"
	// OrderRejectReasonSystemFailover system failover resulting in loss of order state
	OrderRejectReasonSystemFailover OrderRejectReason = "SYSTEM_FAILOVER"
	// OrderRejectReasonUnauthorised the credentials used (userSession/apiKeySession/walletSignature) is not authorised to perform the action
	OrderRejectReasonUnauthorised OrderRejectReason = "UNAUTHORISED"
	// OrderRejectReasonSessionKeyExpired the session key used to sign the order expired
	OrderRejectReasonSessionKeyExpired OrderRejectReason = "SESSION_KEY_EXPIRED"
	// OrderRejectReasonSubAccountNotFound the subaccount does not exist
	OrderRejectReasonSubAccountNotFound OrderRejectReason = "SUB_ACCOUNT_NOT_FOUND"
	// OrderRejectReasonNoTradePermission the signature used to sign the order has no trade permission
	OrderRejectReasonNoTradePermission OrderRejectReason = "NO_TRADE_PERMISSION"
	// OrderRejectReasonUnsupportedTimeInForce the order payload does not contain a supported TimeInForce value
	OrderRejectReasonUnsupportedTimeInForce OrderRejectReason = "UNSUPPORTED_TIME_IN_FORCE"
	// OrderRejectReasonMultiLeggedOrder the order has multiple legs, but multiple legs are not supported by this venue
	OrderRejectReasonMultiLeggedOrder OrderRejectReason = "MULTI_LEGGED_ORDER"
	// OrderRejectReasonExceedMaxPositionSize the order would have caused the subaccount to exceed the max position size
	OrderRejectReasonExceedMaxPositionSize OrderRejectReason = "EXCEED_MAX_POSITION_SIZE"
	// OrderRejectReasonExceedMaxSignatureExpiration the signature supplied is more than 30 days in the future
	OrderRejectReasonExceedMaxSignatureExpiration OrderRejectReason = "EXCEED_MAX_SIGNATURE_EXPIRATION"
	// OrderRejectReasonMarketOrderWithLimitPrice the market order has a limit price set
	OrderRejectReasonMarketOrderWithLimitPrice OrderRejectReason = "MARKET_ORDER_WITH_LIMIT_PRICE"
	// OrderRejectReasonClientCancelOnDisconnectTriggered client cancel on disconnect triggered
	OrderRejectReasonClientCancelOnDisconnectTriggered OrderRejectReason = "CLIENT_CANCEL_ON_DISCONNECT_TRIGGERED"
	// OrderRejectReasonOcoCounterPartTriggered the OCO counter part order was triggered
	OrderRejectReasonOcoCounterPartTriggered OrderRejectReason = "OCO_COUNTER_PART_TRIGGERED"
	// OrderRejectReasonReduceOnlyLimit the remaining order size was cancelled because it exceeded current position size
	OrderRejectReasonReduceOnlyLimit OrderRejectReason = "REDUCE_ONLY_LIMIT"
	// OrderRejectReasonClientReplace the order was replaced by a client replace request
	OrderRejectReasonClientReplace OrderRejectReason = "CLIENT_REPLACE"
	// OrderRejectReasonDeriskMustBeIoc the derisk order must be an IOC order
	OrderRejectReasonDeriskMustBeIoc OrderRejectReason = "DERISK_MUST_BE_IOC"
	// OrderRejectReasonDeriskMustBeReduceOnly the derisk order must be a reduce-only order
	OrderRejectReasonDeriskMustBeReduceOnly OrderRejectReason = "DERISK_MUST_BE_REDUCE_ONLY"
	// OrderRejectReasonDeriskNotSupported derisk is not supported
	OrderRejectReasonDeriskNotSupported OrderRejectReason = "DERISK_NOT_SUPPORTED"
	// OrderRejectReasonInvalidOrderType the order type is invalid
	OrderRejectReasonInvalidOrderType OrderRejectReason = "INVALID_ORDER_TYPE"
	// OrderRejectReasonCurrencyNotDefined the currency is not defined
	OrderRejectReasonCurrencyNotDefined OrderRejectReason = "CURRENCY_NOT_DEFINED"
	// OrderRejectReasonInvalidChainID the chain ID is invalid
	OrderRejectReasonInvalidChainID OrderRejectReason = "INVALID_CHAIN_ID"
	// OrderRejectReasonBuilderOrderFeeExceed Builder fee exceed the limit
	OrderRejectReasonBuilderOrderFeeExceed OrderRejectReason = "BUILDER_ORDER_FEE_EXCEED"
	// OrderRejectReasonBuilderOrderFeeNegative Builder fee is below 0
	OrderRejectReasonBuilderOrderFeeNegative OrderRejectReason = "BUILDER_ORDER_FEE_NEGATIVE"
	// OrderRejectReasonBuilderOrderBuilderNotAuthorized Builder is not an authorized builder for client
	OrderRejectReasonBuilderOrderBuilderNotAuthorized OrderRejectReason = "BUILDER_ORDER_BUILDER_NOT_AUTHORIZED"
	// OrderRejectReasonBuilderOrderBuilderNotExist Builder does not exist
	OrderRejectReasonBuilderOrderBuilderNotExist OrderRejectReason = "BUILDER_ORDER_BUILDER_NOT_EXIST"
	// OrderRejectReasonTradePriceWorseThanBankruptcyPrice the trade price is worse than the bankruptcy price
	OrderRejectReasonTradePriceWorseThanBankruptcyPrice OrderRejectReason = "TRADE_PRICE_WORSE_THAN_BANKRUPTCY_PRICE"
	// OrderRejectReasonTooManyMakerOrders the order was cancelled due to matching with too many maker orders
	OrderRejectReasonTooManyMakerOrders OrderRejectReason = "TOO_MANY_MAKER_ORDERS"
	// OrderRejectReasonReduceOnlyNotSupportedForSpotOrder reduce-only order is not supported for spot order
	OrderRejectReasonReduceOnlyNotSupportedForSpotOrder OrderRejectReason = "REDUCE_ONLY_NOT_SUPPORTED_FOR_SPOT_ORDER"
	// OrderRejectReasonTpslNotSupportedForSpotOrder tpsl is not supported for spot order
	OrderRejectReasonTpslNotSupportedForSpotOrder OrderRejectReason = "TPSL_NOT_SUPPORTED_FOR_SPOT_ORDER"
	// OrderRejectReasonSpotOrderNotSupported spot order is not supported
	OrderRejectReasonSpotOrderNotSupported OrderRejectReason = "SPOT_ORDER_NOT_SUPPORTED"
	// OrderRejectReasonInsufficientBalance the subaccount has insufficient balance
	OrderRejectReasonInsufficientBalance OrderRejectReason = "INSUFFICIENT_BALANCE"
	// OrderRejectReasonSpotTradingBlockedDuringSocializedLoss spot trading is blocked during socialized loss (SLOW)
	OrderRejectReasonSpotTradingBlockedDuringSocializedLoss OrderRejectReason = "SPOT_TRADING_BLOCKED_DURING_SOCIALIZED_LOSS"
	// OrderRejectReasonBelowMarginWithPenaltyDeviation the order will bring the sub account below initial margin requirement considering wide price deviation
	OrderRejectReasonBelowMarginWithPenaltyDeviation OrderRejectReason = "BELOW_MARGIN_WITH_PENALTY_DEVIATION"
	// OrderRejectReasonCorporateAction Cancelled by the system due to Corporate Action
	OrderRejectReasonCorporateAction OrderRejectReason = "CORPORATE_ACTION"
	// OrderRejectReasonNotQualifiedMaker the order was rejected because the sub account is not a qualified maker
	OrderRejectReasonNotQualifiedMaker OrderRejectReason = "NOT_QUALIFIED_MAKER"
	// OrderRejectReasonPrivateQuoteRequiresRfq rfq_id is required when is_private = true
	OrderRejectReasonPrivateQuoteRequiresRfq OrderRejectReason = "PRIVATE_QUOTE_REQUIRES_RFQ"
	// OrderRejectReasonStablePerpRequiresPriceBound a signed slippage bound filled in limit_price is required
	OrderRejectReasonStablePerpRequiresPriceBound OrderRejectReason = "STABLE_PERP_REQUIRES_PRICE_BOUND"
	// OrderRejectReasonUnsupportedTriggerBy SFP order only supports trigger_by = index or mid
	OrderRejectReasonUnsupportedTriggerBy OrderRejectReason = "UNSUPPORTED_TRIGGER_BY"
	// OrderRejectReasonRfqNotFound the order was rejected because the referenced RFQ could not be found
	OrderRejectReasonRfqNotFound OrderRejectReason = "RFQ_NOT_FOUND"
	// OrderRejectReasonRestingOrderWouldCross post-only resting placement crosses opposite best resting or index mid
	OrderRejectReasonRestingOrderWouldCross OrderRejectReason = "RESTING_ORDER_WOULD_CROSS"
	// OrderRejectReasonSessionClosed the order was submitted when the trading session was either closed or under maintenance
	OrderRejectReasonSessionClosed OrderRejectReason = "SESSION_CLOSED"
	// OrderRejectReasonRfqTerminated the quote was cancelled because the RFQ it was bound to reached a terminal state — expired, cancelled by the taker, or closed once its taker order filled
	OrderRejectReasonRfqTerminated OrderRejectReason = "RFQ_TERMINATED"
	// OrderRejectReasonStablePerpRequiresMultiAssetMode stable perp orders require a multi-asset-mode sub-account
	OrderRejectReasonStablePerpRequiresMultiAssetMode OrderRejectReason = "STABLE_PERP_REQUIRES_MULTI_ASSET_MODE"
	// OrderRejectReasonBorrowLimitExceededAfterTrade the trade would have left the sub account borrowing more than its tier borrow limit in the traded quote currency
	OrderRejectReasonBorrowLimitExceededAfterTrade OrderRejectReason = "BORROW_LIMIT_EXCEEDED_AFTER_TRADE"
	// OrderRejectReasonUndeployedLoanAutoExchange an undeployed-loan (LTV) auto-exchange executed on the sub account, and all open orders are cancelled by Gravity
	OrderRejectReasonUndeployedLoanAutoExchange OrderRejectReason = "UNDEPLOYED_LOAN_AUTO_EXCHANGE"
	// OrderRejectReasonLiquidationAutoExchange a liquidation auto-exchange executed on the sub account, and all open orders are cancelled by Gravity
	OrderRejectReasonLiquidationAutoExchange OrderRejectReason = "LIQUIDATION_AUTO_EXCHANGE"
	// OrderRejectReasonUsdcCollateralDisabled USDC is not enabled as collateral on the sub account, so USDC-quoted instruments cannot be traded; enable USDC as collateral first
	OrderRejectReasonUsdcCollateralDisabled OrderRejectReason = "USDC_COLLATERAL_DISABLED"
	// OrderRejectReasonSfpPostOnlyNotAllowed post-only orders are not supported on STABLE_PERP for accounts that are not qualified market makers; their orders only take liquidity
	OrderRejectReasonSfpPostOnlyNotAllowed OrderRejectReason = "SFP_POST_ONLY_NOT_ALLOWED"
	// OrderRejectReasonVaultNonQuoteInvestmentCurrency the order was rejected because its sub account is a vault in single-asset margin mode whose investment currency is not its quote currency, and such a vault...
	OrderRejectReasonVaultNonQuoteInvestmentCurrency OrderRejectReason = "VAULT_NON_QUOTE_INVESTMENT_CURRENCY"
	// OrderRejectReasonRfqIDRequiresStablePerp rfq_id was set on an order whose instrument is not a STABLE_PERP; RFQ is a STABLE_PERP-only product
	OrderRejectReasonRfqIDRequiresStablePerp OrderRejectReason = "RFQ_ID_REQUIRES_STABLE_PERP"
	// OrderRejectReasonRfqPrivatePoolNotSupported is_private = true is not supported yet; private per-RFQ quote pools are post-MVP
	OrderRejectReasonRfqPrivatePoolNotSupported OrderRejectReason = "RFQ_PRIVATE_POOL_NOT_SUPPORTED"
	// OrderRejectReasonRfqRequiresIoc the taker order accepting an RFQ must be a bounded IOC order — IOC, carrying a limit price; an acceptance takes liquidity immediately and must not be able to...
	OrderRejectReasonRfqRequiresIoc OrderRejectReason = "RFQ_REQUIRES_IOC"
	// OrderRejectReasonRfqMismatch the order does not match the RFQ it references — wrong instrument, or a side the RFQ did not request
	OrderRejectReasonRfqMismatch OrderRejectReason = "RFQ_MISMATCH"
	// OrderRejectReasonRfqAlreadyBound the RFQ already has a taker order bound to it; an RFQ accepts only one
	OrderRejectReasonRfqAlreadyBound OrderRejectReason = "RFQ_ALREADY_BOUND"
	// OrderRejectReasonRfqMakerMustBeEcn a resting order carrying rfq_id must be an ECN quote (is_ecn = true)
	OrderRejectReasonRfqMakerMustBeEcn OrderRejectReason = "RFQ_MAKER_MUST_BE_ECN"
	// OrderRejectReasonFokNotSupported fill-or-kill is not supported on STABLE_PERP yet
	OrderRejectReasonFokNotSupported OrderRejectReason = "FOK_NOT_SUPPORTED"
	// OrderRejectReasonMarketOrderNotSupported market orders are not supported on STABLE_PERP; a taker order must be a bounded IOC order, carrying a limit price
	OrderRejectReasonMarketOrderNotSupported OrderRejectReason = "MARKET_ORDER_NOT_SUPPORTED"
	// OrderRejectReasonStablePerpOrderNotSupported STABLE_PERP orders are disabled on this cluster
	OrderRejectReasonStablePerpOrderNotSupported OrderRejectReason = "STABLE_PERP_ORDER_NOT_SUPPORTED"
)

func (OrderRejectReason) Code

func (e OrderRejectReason) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (OrderRejectReason) String

func (e OrderRejectReason) String() string

String returns the wire value.

type OrderState

type OrderState struct {
	// The status of the order
	Status OrderStatus `json:"status"`
	// The reason for rejection or cancellation
	RejectReason OrderRejectReason `json:"reject_reason"`
	// The number of assets available for orderbook/RFQ matching. Sorted in same order as Order.Legs
	BookSize []Decimal `json:"book_size"`
	// The total number of assets traded. Sorted in same order as Order.Legs
	TradedSize []Decimal `json:"traded_size"`
	// Time at which the order was updated by GRVT, expressed in unix nanoseconds
	UpdateTime time.Time `json:"update_time"`
	// The average fill price of the order. Sorted in same order as Order.Legs
	AvgFillPrice []Decimal `json:"avg_fill_price"`
}

OrderState is a wire type.

func (OrderState) MarshalJSON

func (v OrderState) MarshalJSON() ([]byte, error)

func (*OrderState) UnmarshalJSON

func (v *OrderState) UnmarshalJSON(data []byte) error

type OrderStateFeed

type OrderStateFeed struct {
	// A unique 128-bit identifier for the order, deterministically generated within the GRVT backend
	OrderID string `json:"order_id"`
	// A unique identifier for the active order within a subaccount, specified by the client
	ClientOrderID uint64 `json:"client_order_id,string"`
	// The order state object being created or updated
	OrderState OrderState `json:"order_state"`
}

OrderStateFeed is a wire type.

func (*OrderStateFeed) UnmarshalJSON

func (v *OrderStateFeed) UnmarshalJSON(data []byte) error

type OrderStatus

type OrderStatus string

OrderStatus is a wire enum.

const (
	// OrderStatusPending Order has been sent to the matching engine and is pending a transition to open/filled/rejected.
	OrderStatusPending OrderStatus = "PENDING"
	// OrderStatusOpen Order is actively matching on the matching engine, could be unfilled or partially filled.
	OrderStatusOpen OrderStatus = "OPEN"
	// OrderStatusFilled Order is fully filled and hence closed. Taker Orders can transition directly from pending to filled, without going through open.
	OrderStatusFilled OrderStatus = "FILLED"
	// OrderStatusRejected Order is rejected by matching engine since if fails a particular check (See OrderRejectReason). Once an order is open, it cannot be rejected.
	OrderStatusRejected OrderStatus = "REJECTED"
	// OrderStatusCancelled Order is cancelled by the user using one of the supported APIs (See OrderRejectReason). Before an order is open, it cannot be cancelled.
	OrderStatusCancelled OrderStatus = "CANCELLED"
)

func (OrderStatus) Code

func (e OrderStatus) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (OrderStatus) String

func (e OrderStatus) String() string

String returns the wire value.

type OrderbookLevel

type OrderbookLevel struct {
	// The price of the level. Decimal string, e.g. "65000.5"; up to 9 decimals.
	Price Decimal `json:"price"`
	// The number of assets offered. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	Size Decimal `json:"size"`
	// The number of open orders at this level
	NumOrders uint32 `json:"num_orders"`
}

OrderbookLevel is a wire type.

func (*OrderbookLevel) UnmarshalJSON

func (v *OrderbookLevel) UnmarshalJSON(data []byte) error

type OrderbookLevels

type OrderbookLevels struct {
	// Time at which the event was emitted in unix nanoseconds
	EventTime time.Time `json:"event_time"`
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
	// The list of best bids up till query depth
	Bids []OrderbookLevel `json:"bids"`
	// The list of best asks up till query depth
	Asks []OrderbookLevel `json:"asks"`
}

OrderbookLevels is a wire type.

func (OrderbookLevels) MarshalJSON

func (v OrderbookLevels) MarshalJSON() ([]byte, error)

func (*OrderbookLevels) UnmarshalJSON

func (v *OrderbookLevels) UnmarshalJSON(data []byte) error

type PartialMiniTicker

type PartialMiniTicker struct {
	// Time at which the event was emitted in unix nanoseconds
	EventTime *time.Time `json:"event_time,omitempty"`
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument,omitempty"`
	// The mark price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	MarkPrice *Decimal `json:"mark_price,omitempty"`
	// The index price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	IndexPrice *Decimal `json:"index_price,omitempty"`
	// The last traded price of the instrument (also close price). Decimal string, e.g. "65000.5"; up to 9 decimals.
	LastPrice *Decimal `json:"last_price,omitempty"`
	// The number of assets traded in the last trade. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	LastSize *Decimal `json:"last_size,omitempty"`
	// The mid price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	MidPrice *Decimal `json:"mid_price,omitempty"`
	// The best bid price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	BestBidPrice *Decimal `json:"best_bid_price,omitempty"`
	// The number of assets offered on the best bid price of the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	BestBidSize *Decimal `json:"best_bid_size,omitempty"`
	// The best ask price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	BestAskPrice *Decimal `json:"best_ask_price,omitempty"`
	// The number of assets offered on the best ask price of the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	BestAskSize *Decimal `json:"best_ask_size,omitempty"`
}

PartialMiniTicker is a wire type.

func (PartialMiniTicker) MarshalJSON

func (v PartialMiniTicker) MarshalJSON() ([]byte, error)

func (*PartialMiniTicker) UnmarshalJSON

func (v *PartialMiniTicker) UnmarshalJSON(data []byte) error

type PartialTicker

type PartialTicker struct {
	// Time at which the event was emitted in unix nanoseconds
	EventTime *time.Time `json:"event_time,omitempty"`
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument,omitempty"`
	// The mark price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	MarkPrice *Decimal `json:"mark_price,omitempty"`
	// The index price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	IndexPrice *Decimal `json:"index_price,omitempty"`
	// The last traded price of the instrument (also close price). Decimal string, e.g. "65000.5"; up to 9 decimals.
	LastPrice *Decimal `json:"last_price,omitempty"`
	// The number of assets traded in the last trade. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	LastSize *Decimal `json:"last_size,omitempty"`
	// The mid price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	MidPrice *Decimal `json:"mid_price,omitempty"`
	// The best bid price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	BestBidPrice *Decimal `json:"best_bid_price,omitempty"`
	// The number of assets offered on the best bid price of the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	BestBidSize *Decimal `json:"best_bid_size,omitempty"`
	// The best ask price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	BestAskPrice *Decimal `json:"best_ask_price,omitempty"`
	// The number of assets offered on the best ask price of the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	BestAskSize *Decimal `json:"best_ask_size,omitempty"`
	// DEPRECATED: To be removed in a future release. Please refer to the field `funding_rate` instead, for the funding rate being applied over...
	FundingRate8hCurr *Decimal `json:"funding_rate_8h_curr,omitempty"`
	// DEPRECATED: To be removed in a future release. Please refer to the field `funding_rate` instead, for the funding rate being applied over...
	FundingRate8hAvg *Decimal `json:"funding_rate_8h_avg,omitempty"`
	// The interest rate of the underlying, expressed in centibeeps (1/100th of a basis point)
	InterestRate *Decimal `json:"interest_rate,omitempty"`
	// [Options] The forward price of the option. Decimal string, e.g. "65000.5"; up to 9 decimals.
	ForwardPrice *Decimal `json:"forward_price,omitempty"`
	// The 24 hour taker buy volume of the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	BuyVolume24hB *Decimal `json:"buy_volume_24h_b,omitempty"`
	// The 24 hour taker sell volume of the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	SellVolume24hB *Decimal `json:"sell_volume_24h_b,omitempty"`
	// The 24 hour taker buy volume of the instrument, in the quote asset. Decimal string, e.g. "12.5".
	BuyVolume24hQ *Decimal `json:"buy_volume_24h_q,omitempty"`
	// The 24 hour taker sell volume of the instrument, in the quote asset. Decimal string, e.g. "12.5".
	SellVolume24hQ *Decimal `json:"sell_volume_24h_q,omitempty"`
	// The 24 hour highest traded price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	HighPrice *Decimal `json:"high_price,omitempty"`
	// The 24 hour lowest traded price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	LowPrice *Decimal `json:"low_price,omitempty"`
	// The 24 hour first traded price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	OpenPrice *Decimal `json:"open_price,omitempty"`
	// The open interest in the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	OpenInterest *Decimal `json:"open_interest,omitempty"`
	// The ratio of accounts that are net long vs net short on this instrument
	LongShortRatio *Decimal `json:"long_short_ratio,omitempty"`
	// The current indicative funding rate for the active interval, expressed in centibeeps. Absent for stable perps, which have `funding_rate_long_apr_pct` and...
	FundingRate *Decimal `json:"funding_rate,omitempty"`
	// Timestamp in nanoseconds when the current funding interval ends
	NextFundingTime *time.Time `json:"next_funding_time,omitempty"`
	// The current status of the instrument
	Status InstrumentStatus `json:"status,omitempty"`
	// The current trading session of the instrument's underlying market
	Session TradingSessionType `json:"session,omitempty"`
	// The long open interest in the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals. Excludes qualified-maker and DMM open interest.
	LongOpenInterest *Decimal `json:"long_open_interest,omitempty"`
	// The short open interest in the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals. Excludes qualified-maker and DMM open interest.
	ShortOpenInterest *Decimal `json:"short_open_interest,omitempty"`
	// Stable perps only: the indicative annual rate for retail longs at the next charge, in percent a year (`'-5.5'` = retail longs pay 5.5%; positive = retail...
	FundingRateLongAprPct *Decimal `json:"funding_rate_long_apr_pct,omitempty"`
	// Stable perps only: the indicative annual rate for retail shorts at the next charge, in percent a year (`'-5'` = retail shorts pay 5%; positive = retail...
	FundingRateShortAprPct *Decimal `json:"funding_rate_short_apr_pct,omitempty"`
}

PartialTicker Derived data such as the below, will not be included by default:

func (PartialTicker) MarshalJSON

func (v PartialTicker) MarshalJSON() ([]byte, error)

func (*PartialTicker) UnmarshalJSON

func (v *PartialTicker) UnmarshalJSON(data []byte) error

type PartialWSMiniTickerFeedDataV1

type PartialWSMiniTickerFeedDataV1 struct {
	// Stream name
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// A mini ticker matching the request filter
	Feed PartialMiniTicker `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

PartialWSMiniTickerFeedDataV1 is a wire type.

func (*PartialWSMiniTickerFeedDataV1) UnmarshalJSON

func (v *PartialWSMiniTickerFeedDataV1) UnmarshalJSON(data []byte) error

type PartialWSTickerFeedDataV1

type PartialWSTickerFeedDataV1 struct {
	// Stream name
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// A ticker matching the request filter
	Feed PartialTicker `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

PartialWSTickerFeedDataV1 is a wire type.

func (*PartialWSTickerFeedDataV1) UnmarshalJSON

func (v *PartialWSTickerFeedDataV1) UnmarshalJSON(data []byte) error

type PositionCloseStatus

type PositionCloseStatus string

PositionCloseStatus is a wire enum.

const (
	// PositionCloseStatusClosed Position fully closed via reducing trade or flip
	PositionCloseStatusClosed PositionCloseStatus = "CLOSED"
	// PositionCloseStatusLiquidated Position closed via liquidation
	PositionCloseStatusLiquidated PositionCloseStatus = "LIQUIDATED"
	// PositionCloseStatusSettled Position closed via settlement
	PositionCloseStatusSettled PositionCloseStatus = "SETTLED"
	// PositionCloseStatusPartiallyClosed Position partially closed
	PositionCloseStatusPartiallyClosed PositionCloseStatus = "PARTIALLY_CLOSED"
	// PositionCloseStatusSplitClosed Lifecycle ended by a stock split; reopened re-denominated
	PositionCloseStatusSplitClosed PositionCloseStatus = "SPLIT_CLOSED"
)

func (PositionCloseStatus) Code

func (e PositionCloseStatus) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (PositionCloseStatus) String

func (e PositionCloseStatus) String() string

String returns the wire value.

type PositionMarginType

type PositionMarginType string

PositionMarginType is a wire enum.

const (
	// PositionMarginTypeIsolated Isolated Margin Mode: each position is allocated a fixed amount of collateral
	PositionMarginTypeIsolated PositionMarginType = "ISOLATED"
	// PositionMarginTypeCross Cross Margin Mode: uses all available funds in your account as collateral across all cross margin positions
	PositionMarginTypeCross PositionMarginType = "CROSS"
)

func (PositionMarginType) Code

func (e PositionMarginType) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (PositionMarginType) String

func (e PositionMarginType) String() string

String returns the wire value.

type Positions

type Positions struct {
	// Time at which the event was emitted in unix nanoseconds
	EventTime time.Time `json:"event_time"`
	// The sub account ID that participated in the trade
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The instrument being represented
	Instrument string `json:"instrument"`
	// The size of the position. Decimal string, e.g. "0.01"; up to the instrument's base_decimals. Negative for short positions
	Size Decimal `json:"size"`
	// The notional value of the position, negative for short assets, in the quote asset. Decimal string, e.g. "12.5".
	Notional Decimal `json:"notional"`
	// The entry price of the position. Decimal string, e.g. "65000.5"; up to 9 decimals.
	EntryPrice Decimal `json:"entry_price"`
	// The exit price of the position. Decimal string, e.g. "65000.5"; up to 9 decimals.
	ExitPrice Decimal `json:"exit_price"`
	// The mark price of the position. Decimal string, e.g. "65000.5"; up to 9 decimals.
	MarkPrice Decimal `json:"mark_price"`
	// The unrealized PnL of the position, in the quote asset. Decimal string, e.g. "12.5".
	UnrealizedPnl Decimal `json:"unrealized_pnl"`
	// The realized PnL of the position, in the quote asset. Decimal string, e.g. "12.5".
	RealizedPnl Decimal `json:"realized_pnl"`
	// The total PnL of the position, in the quote asset. Decimal string, e.g. "12.5".
	TotalPnl Decimal `json:"total_pnl"`
	// The ROI of the position, expressed as a percentage
	Roi Decimal `json:"roi"`
	// The index price of the quote currency. (reported in `USD`)
	QuoteIndexPrice Decimal `json:"quote_index_price"`
	// The estimated liquidation price
	EstLiquidationPrice Decimal `json:"est_liquidation_price"`
	// The current leverage value for this position
	Leverage Decimal `json:"leverage"`
	// The cumulative fee paid on the position, in the quote asset. Decimal string, e.g. "12.5".
	CumulativeFee Decimal `json:"cumulative_fee"`
	// The cumulative realized funding payment of the position, in the quote asset. Decimal string, e.g. "12.5". Positive if paid, negative if received
	CumulativeRealizedFundingPayment Decimal `json:"cumulative_realized_funding_payment"`
	// The margin type of the position
	MarginType PositionMarginType `json:"margin_type"`
	// [IsolatedOnly] The wallet balance reserved for this isolated margin position, in the quote asset. Decimal string, e.g. "12.5". If this positions is liquidated...
	IsolatedBalance *Decimal `json:"isolated_balance,omitempty"`
	// [IsolatedOnly] The initial margin of the isolated margin position, in the quote asset. Decimal string, e.g. "12.5". The `total_equity` required to open more...
	IsolatedIm *Decimal `json:"isolated_im,omitempty"`
	// [IsolatedOnly] The maintenance margin of the isolated margin position, in the quote asset. Decimal string, e.g. "12.5". The `total_equity` required to avoid...
	IsolatedMm *Decimal `json:"isolated_mm,omitempty"`
}

Positions is a wire type.

func (Positions) MarshalJSON

func (v Positions) MarshalJSON() ([]byte, error)

func (*Positions) UnmarshalJSON

func (v *Positions) UnmarshalJSON(data []byte) error

type PreMinRedemptions

type PreMinRedemptions struct {
	// Pre-minimum-age redemption requests, ordered by age (first element is the oldest request that is pre-minimum-age).
	Requests []VaultRedemptionRequest `json:"requests"`
	// Number of shares in the pre-minimum-age section of the vault's redemption queue.
	TokenCount Decimal `json:"token_count"`
}

PreMinRedemptions Vault redemption queue section hidden from main view. All requests here have yet to age past the vault's minimum redemption period.

func (*PreMinRedemptions) UnmarshalJSON

func (v *PreMinRedemptions) UnmarshalJSON(data []byte) error

type RepaymentScenario

type RepaymentScenario string

RepaymentScenario Server-only fee scenario tag for spot orders that repay MAM USDT debt against the insurance fund.

const (
	// RepaymentScenarioManualRepayment User-initiated MAM repay via TDG; uses MRR (/8) divisor for fee.
	RepaymentScenarioManualRepayment RepaymentScenario = "MANUAL_REPAYMENT"
	// RepaymentScenarioAutoRepayment DEPRECATED — replaced by autoRepayBorrowLimit / autoRepayLTV. Kept for capnp ordinal compatibility; no producer emits this value.
	RepaymentScenarioAutoRepayment RepaymentScenario = "AUTO_REPAYMENT"
	// RepaymentScenarioLiquidationRepayment Liquidator MMR>=100% step 2 repayment; uses LRR (/2) divisor for fee.
	RepaymentScenarioLiquidationRepayment RepaymentScenario = "LIQUIDATION_REPAYMENT"
	// RepaymentScenarioAutoRepayBorrowLimit Liquidator borrow-limit auto-repay; uses ARR (/4) divisor for fee. Validator checks BL trigger is still active.
	RepaymentScenarioAutoRepayBorrowLimit RepaymentScenario = "AUTO_REPAY_BORROW_LIMIT"
	// RepaymentScenarioAutoRepayLtv Liquidator undeployed-loan / LTV auto-repay; uses ARR (/4) divisor for fee. Validator checks LTV trigger is still active.
	RepaymentScenarioAutoRepayLtv RepaymentScenario = "AUTO_REPAY_LTV"
	// RepaymentScenarioLiquidationRebalancing Collateral conversion inside a liquidation bundle. Fee-free.
	RepaymentScenarioLiquidationRebalancing RepaymentScenario = "LIQUIDATION_REBALANCING"
)

func (RepaymentScenario) Code

func (e RepaymentScenario) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (RepaymentScenario) String

func (e RepaymentScenario) String() string

String returns the wire value.

type Rfq

type Rfq struct {
	// Set by the server. A unique 128-bit identifier for the RFQ, deterministically generated within the GRVT backend
	RfqID string `json:"rfq_id"`
	// The subaccount initiating the RFQ
	SubAccountID uint64 `json:"sub_account_id,string"`
	// RFQ TTL. The timestamp after which Gravity expires the RFQ, expressed in unix nanoseconds. Default 60s, cap 300s (per-instrument config)
	Expiry time.Time `json:"expiry"`
	// The instrument to trade. Must be kind = STABLE_PERP
	Instrument string `json:"instrument"`
	// Requested size (positive). Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	Size Decimal `json:"size"`
	// Optional — omitted = two-way request. The GRVT UI always fills it; API takers may withhold direction and accept two-way quotes
	Side RfqSide `json:"side,omitempty"`
}

Rfq A Request for Quote (RFQ) lets a taker solicit private quotes on a single instrument from makers.

func (Rfq) MarshalJSON

func (v Rfq) MarshalJSON() ([]byte, error)

func (*Rfq) UnmarshalJSON

func (v *Rfq) UnmarshalJSON(data []byte) error

type RfqCounterpartyType

type RfqCounterpartyType string

RfqCounterpartyType is a wire enum.

const (
	// RfqCounterpartyTypeMakerQuote the counterparty is a maker quote submitted to the RFQ
	RfqCounterpartyTypeMakerQuote RfqCounterpartyType = "MAKER_QUOTE"
	// RfqCounterpartyTypeRestingOrder the counterparty is a resting order on the orderbook
	RfqCounterpartyTypeRestingOrder RfqCounterpartyType = "RESTING_ORDER"
	// RfqCounterpartyTypeForcedExitNetting the counterparty is a forced-exit netting fill
	RfqCounterpartyTypeForcedExitNetting RfqCounterpartyType = "FORCED_EXIT_NETTING"
)

func (RfqCounterpartyType) Code

func (e RfqCounterpartyType) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (RfqCounterpartyType) String

func (e RfqCounterpartyType) String() string

String returns the wire value.

type RfqInput

type RfqInput struct {
	// Set by the server. A unique 128-bit identifier for the RFQ, deterministically generated within the GRVT backend
	RfqID string `json:"rfq_id,omitempty"`
	// The subaccount initiating the RFQ
	SubAccountID uint64 `json:"sub_account_id,string"`
	// RFQ TTL. The timestamp after which Gravity expires the RFQ, expressed in unix nanoseconds. Default 60s, cap 300s (per-instrument config)
	Expiry time.Time `json:"expiry"`
	// The instrument to trade. Must be kind = STABLE_PERP
	Instrument string `json:"instrument"`
	// Requested size (positive). Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	Size Decimal `json:"size"`
	// Optional — omitted = two-way request. The GRVT UI always fills it; API takers may withhold direction and accept two-way quotes
	Side RfqSide `json:"side,omitempty"`
}

RfqInput A Request for Quote (RFQ) lets a taker solicit private quotes on a single instrument from makers.

func (RfqInput) MarshalJSON

func (v RfqInput) MarshalJSON() ([]byte, error)

func (*RfqInput) UnmarshalJSON

func (v *RfqInput) UnmarshalJSON(data []byte) error

type RfqQuoteFeed

type RfqQuoteFeed struct {
	// The RFQ this estimate belongs to. A feed with no levels means the RFQ ended
	RfqID string `json:"rfq_id"`
	// Average fill price to sell the RFQ size. Decimal string, e.g. "65000.5"; up to 9 decimals. Omitted when the bid side is empty
	BestBid *Decimal `json:"best_bid,omitempty"`
	// Average fill price to buy the RFQ size. Decimal string, e.g. "65000.5"; up to 9 decimals. Omitted when the ask side is empty
	BestAsk *Decimal `json:"best_ask,omitempty"`
	// The sell-side estimate (at most one level), from the bids
	BidLevels []RfqQuoteLevel `json:"bid_levels"`
	// The buy-side estimate (at most one level), from the asks
	AskLevels []RfqQuoteLevel `json:"ask_levels"`
}

RfqQuoteFeed is a wire type.

func (*RfqQuoteFeed) UnmarshalJSON

func (v *RfqQuoteFeed) UnmarshalJSON(data []byte) error

type RfqQuoteLevel

type RfqQuoteLevel struct {
	// Average fill price for the size. Decimal string, e.g. "65000.5"; up to 9 decimals. Rounded against the taker: up for asks, down for bids
	Price Decimal `json:"price"`
	// Fillable size, up to the RFQ size. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	Size Decimal `json:"size"`
	// The maker's derived anonymous account id shown to the taker. Real maker identity is never exposed
	MakerAnonAccountID string `json:"maker_anon_account_id"`
	// Distinguishes an AON level (liftable only in full — POST-MVP) from a GTT level
	TimeInForce TimeInForce `json:"time_in_force"`
}

RfqQuoteLevel is a wire type.

func (*RfqQuoteLevel) UnmarshalJSON

func (v *RfqQuoteLevel) UnmarshalJSON(data []byte) error

type RfqSide

type RfqSide string

RfqSide is a wire enum.

const (
	// RfqSideUnspecified omitted = two-way request
	RfqSideUnspecified RfqSide = "UNSPECIFIED"
	// RfqSideBuy the RFQ side is a buy
	RfqSideBuy RfqSide = "BUY"
	// RfqSideSell the RFQ side is a sell
	RfqSideSell RfqSide = "SELL"
)

func (RfqSide) Code

func (e RfqSide) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (RfqSide) String

func (e RfqSide) String() string

String returns the wire value.

type RiskBracket

type RiskBracket struct {
	// 1-indexed tier number
	Tier uint32 `json:"tier"`
	// Lower bound of notional value (inclusive) in quote currency
	NotionalFloor Decimal `json:"notional_floor"`
	// Upper bound of notional value (exclusive) in quote currency, omitted for last tier
	NotionalCap *Decimal `json:"notional_cap,omitempty"`
	// Maintenance margin rate as a decimal (e.g., '0.01' for 1%)
	MaintenanceMarginRate Decimal `json:"maintenance_margin_rate"`
	// Initial margin rate as a decimal (e.g., '0.02' for 2%)
	InitialMarginRate Decimal `json:"initial_margin_rate"`
	// Maximum leverage allowed at this tier (floor of 1 / initial_margin_rate)
	MaxLeverage uint32 `json:"max_leverage"`
	// Cumulative maintenance margin amount in quote currency
	CumulativeMaintenanceAmount Decimal `json:"cumulative_maintenance_amount"`
}

RiskBracket is a wire type.

func (*RiskBracket) UnmarshalJSON

func (v *RiskBracket) UnmarshalJSON(data []byte) error

type SfpMarketSchedule

type SfpMarketSchedule struct {
	// Trading sessions for the current calendar week (Sunday to Saturday in the exchange's local time). The sessions are contiguous with no gaps, and any period when...
	Sessions []TradingSession `json:"sessions"`
	// Market holidays and early closes, past and upcoming, sorted by start time. The market is closed from the start time to the end time of each entry. Empty when...
	Holidays []TradingHolidaySchedule `json:"holidays"`
}

SfpMarketSchedule is a wire type.

func (*SfpMarketSchedule) UnmarshalJSON

func (v *SfpMarketSchedule) UnmarshalJSON(data []byte) error

type SfpTradingScheduleGroup

type SfpTradingScheduleGroup struct {
	// The group name. For stable perps on their asset class hours, the asset class (for example `COMMODITY_CME`)
	Name string `json:"name"`
	// The instruments' asset class. Its holiday calendar sets the group's holidays
	AssetClass AssetClass `json:"asset_class"`
	// The stable perps trading these hours, sorted. Each stable perp with a schedule is in exactly one group
	Instruments []string `json:"instruments"`
	// Trading sessions for the current calendar week (Sunday to Saturday in the exchange's local time). The sessions are contiguous with no gaps, and any period when...
	Sessions []TradingSession `json:"sessions"`
	// Market holidays and early closes, past and upcoming, sorted by start time. The market is closed from the start time to the end time of each entry. Empty when...
	Holidays []TradingHolidaySchedule `json:"holidays"`
}

SfpTradingScheduleGroup is a wire type.

func (*SfpTradingScheduleGroup) UnmarshalJSON

func (v *SfpTradingScheduleGroup) UnmarshalJSON(data []byte) error

type Signature

type Signature struct {
	// The address (public key) of the wallet signing the payload
	Signer string `json:"signer"`
	// Signature R
	R string `json:"r"`
	// Signature S
	S string `json:"s"`
	// Signature V
	V uint8 `json:"v"`
	// Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days
	Expiration time.Time `json:"expiration"`
	// Users can randomly generate this value, used as a signature deconflicting key.
	Nonce uint32 `json:"nonce"`
	// Chain ID used in EIP-712 domain. Zero value fallbacks to GRVT Chain ID.
	ChainID uint64 `json:"chain_id,string"`
}

Signature is a wire type.

func (Signature) MarshalJSON

func (v Signature) MarshalJSON() ([]byte, error)

func (*Signature) UnmarshalJSON

func (v *Signature) UnmarshalJSON(data []byte) error

type SignatureInput

type SignatureInput struct {
	// The address (public key) of the wallet signing the payload
	Signer string `json:"signer,omitempty"`
	// Signature R
	R string `json:"r,omitempty"`
	// Signature S
	S string `json:"s,omitempty"`
	// Signature V
	V *uint8 `json:"v,omitempty"`
	// Timestamp after which this signature expires, expressed in unix nanoseconds. Must be capped at 30 days
	Expiration *time.Time `json:"expiration,omitempty"`
	// Users can randomly generate this value, used as a signature deconflicting key.
	Nonce *uint32 `json:"nonce,omitempty"`
	// Chain ID used in EIP-712 domain. Zero value fallbacks to GRVT Chain ID.
	ChainID *uint64 `json:"chain_id,omitempty,string"`
}

SignatureInput is a wire type.

func (SignatureInput) MarshalJSON

func (v SignatureInput) MarshalJSON() ([]byte, error)

func (*SignatureInput) UnmarshalJSON

func (v *SignatureInput) UnmarshalJSON(data []byte) error

type SpotBalance

type SpotBalance struct {
	// The currency you hold a spot balance in
	Currency string `json:"currency"`
	// This currency's balance in this trading account.
	Balance Decimal `json:"balance"`
	// The index price of this currency. (reported in `USD`)
	IndexPrice Decimal `json:"index_price"`
	// The entry price of this spot currency. (reported in `USD`)
	EntryPrice Decimal `json:"entry_price"`
	// The realized PnL of this spot currency. (reported in `USD`)
	RealizedPnl Decimal `json:"realized_pnl"`
	// The unrealized PnL of this spot currency. (reported in `USD`)
	UnrealizedPnl Decimal `json:"unrealized_pnl"`
	// The available to transfer amount of this spot currency.
	AvailableToTransfer Decimal `json:"available_to_transfer"`
	// The amount borrowed in this currency, inclusive of accrued interest.
	BorrowedAmount *Decimal `json:"borrowed_amount,omitempty"`
}

SpotBalance is a wire type.

func (*SpotBalance) UnmarshalJSON

func (v *SpotBalance) UnmarshalJSON(data []byte) error

type SpotSubAccount

type SpotSubAccount struct {
	// Time at which the event was emitted in unix nanoseconds
	EventTime time.Time `json:"event_time"`
	// The sub account ID this entry refers to
	SubAccountID uint64 `json:"sub_account_id,string"`
	// Total equity of the spot sub account, denominated USD
	TotalEquity Decimal `json:"total_equity"`
	// The list of spot assets owned by this spot sub account, and their balances
	SpotBalances []SpotBalance `json:"spot_balances"`
}

SpotSubAccount is a wire type.

func (SpotSubAccount) MarshalJSON

func (v SpotSubAccount) MarshalJSON() ([]byte, error)

func (*SpotSubAccount) UnmarshalJSON

func (v *SpotSubAccount) UnmarshalJSON(data []byte) error

type StreamReference

type StreamReference struct {
	// The channel to subscribe to (eg: ticker.s / ticker.d)
	Stream string `json:"stream"`
	// The list of selectors for the stream
	Selectors []string `json:"selectors"`
}

StreamReference is a wire type.

func (*StreamReference) UnmarshalJSON

func (v *StreamReference) UnmarshalJSON(data []byte) error

type SubAccount

type SubAccount struct {
	// Time at which the event was emitted in unix nanoseconds
	EventTime time.Time `json:"event_time"`
	// The sub account ID this entry refers to
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The type of margin algorithm this subaccount uses
	MarginType MarginType `json:"margin_type"`
	// The settlement, margin, and reporting currency of this account.
	SettleCurrency string `json:"settle_currency"`
	// The total unrealized PnL of all positions owned by this subaccount, in the quote asset. Decimal string, e.g. "12.5".
	UnrealizedPnl Decimal `json:"unrealized_pnl"`
	// The notional value of your account if all positions are closed, excluding trading fees (reported in `settle_currency`).
	TotalEquity Decimal `json:"total_equity"`
	// The `total_equity` required to open positions in the account (reported in `settle_currency`).
	InitialMargin Decimal `json:"initial_margin"`
	// The `total_equity` required to avoid liquidation of positions in the account (reported in `settle_currency`).
	MaintenanceMargin Decimal `json:"maintenance_margin"`
	// DEPRECATED: use the per-currency `availableToTransfer` of the quote-currency entry in `spotBalances` instead.
	AvailableBalance Decimal `json:"available_balance"`
	// The list of spot assets owned by this sub account, and their balances
	SpotBalances []SpotBalance `json:"spot_balances"`
	// The list of positions owned by this sub account
	Positions []Positions `json:"positions"`
	// The index price of the settle currency. (reported in `USD`)
	SettleIndexPrice Decimal `json:"settle_index_price"`
	// Whether this sub account is a vault
	IsVault *bool `json:"is_vault,omitempty"`
	// Total amount of IM (reported in `settle_currency`) deducted from the vault due to redemptions nearing the end of their redemption period
	VaultImAdditions *Decimal `json:"vault_im_additions,omitempty"`
	// The derisk margin of this sub account
	DeriskMargin Decimal `json:"derisk_margin"`
	// The derisk margin to maintenance margin ratio of this sub account
	DeriskToMaintenanceMarginRatio Decimal `json:"derisk_to_maintenance_margin_ratio"`
	// The total equity of this sub account for cross margin
	TotalCrossEquity Decimal `json:"total_cross_equity"`
	// The unrealized PnL of this sub account for cross margin
	CrossUnrealizedPnl Decimal `json:"cross_unrealized_pnl"`
	// The mode of the sub account
	SubAccountMode SubAccountMode `json:"sub_account_mode"`
	// The margin balance of this sub account for cross margin
	MarginBalance Decimal `json:"margin_balance"`
	// Whether algo trading is enabled for this sub account
	AlgoTradingEnabled bool `json:"algo_trading_enabled"`
}

SubAccount is a wire type.

func (SubAccount) MarshalJSON

func (v SubAccount) MarshalJSON() ([]byte, error)

func (*SubAccount) UnmarshalJSON

func (v *SubAccount) UnmarshalJSON(data []byte) error

type SubAccountMode

type SubAccountMode string

SubAccountMode is a wire enum.

const (
	// SubAccountModeSingleAssetMode Single asset mode: the subaccount is only allowed to hold one asset as collateral
	SubAccountModeSingleAssetMode SubAccountMode = "SINGLE_ASSET_MODE"
)

func (SubAccountMode) Code

func (e SubAccountMode) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (SubAccountMode) String

func (e SubAccountMode) String() string

String returns the wire value.

type SupportedAsset

type SupportedAsset struct {
	// The currency ID of the asset
	AssetID uint16 `json:"asset_id"`
	// The readable currency code of the asset
	AssetCode string `json:"asset_code"`
	// The number of decimals used for balance representation
	BalanceDecimals int8 `json:"balance_decimals"`
	// The asset cannot be transferred between wallets
	TransferDisabled bool `json:"transfer_disabled"`
}

SupportedAsset An asset supported for a given wallet type

func (*SupportedAsset) UnmarshalJSON

func (v *SupportedAsset) UnmarshalJSON(data []byte) error

type TPSLOrderMetadata

type TPSLOrderMetadata struct {
	// Defines the price type (e.g., index price) that activates a Take Profit (TP) or Stop Loss (SL) order
	TriggerBy TriggerBy `json:"trigger_by"`
	// The Trigger Price of the order. Decimal string, e.g. "65000.5"; up to 9 decimals.
	TriggerPrice Decimal `json:"trigger_price"`
	// If True, the order will close the position when the trigger price is reached
	ClosePosition bool `json:"close_position"`
	// If True, the order will be treated as part of a position's split-TP/SL set, subject to aggregate size/count limits.
	IsSplitPosition bool `json:"is_split_position"`
}

TPSLOrderMetadata Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.

func (*TPSLOrderMetadata) UnmarshalJSON

func (v *TPSLOrderMetadata) UnmarshalJSON(data []byte) error

type Ticker

type Ticker struct {
	// Time at which the event was emitted in unix nanoseconds
	EventTime *time.Time `json:"event_time,omitempty"`
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument,omitempty"`
	// The mark price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	MarkPrice *Decimal `json:"mark_price,omitempty"`
	// The index price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	IndexPrice *Decimal `json:"index_price,omitempty"`
	// The last traded price of the instrument (also close price). Decimal string, e.g. "65000.5"; up to 9 decimals.
	LastPrice *Decimal `json:"last_price,omitempty"`
	// The number of assets traded in the last trade. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	LastSize *Decimal `json:"last_size,omitempty"`
	// The mid price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	MidPrice *Decimal `json:"mid_price,omitempty"`
	// The best bid price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	BestBidPrice *Decimal `json:"best_bid_price,omitempty"`
	// The number of assets offered on the best bid price of the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	BestBidSize *Decimal `json:"best_bid_size,omitempty"`
	// The best ask price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	BestAskPrice *Decimal `json:"best_ask_price,omitempty"`
	// The number of assets offered on the best ask price of the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	BestAskSize *Decimal `json:"best_ask_size,omitempty"`
	// DEPRECATED: To be removed in a future release. Please refer to the field `funding_rate` instead, for the funding rate being applied over...
	FundingRate8hCurr *Decimal `json:"funding_rate_8h_curr,omitempty"`
	// DEPRECATED: To be removed in a future release. Please refer to the field `funding_rate` instead, for the funding rate being applied over...
	FundingRate8hAvg *Decimal `json:"funding_rate_8h_avg,omitempty"`
	// The interest rate of the underlying, expressed in centibeeps (1/100th of a basis point)
	InterestRate *Decimal `json:"interest_rate,omitempty"`
	// [Options] The forward price of the option. Decimal string, e.g. "65000.5"; up to 9 decimals.
	ForwardPrice *Decimal `json:"forward_price,omitempty"`
	// The 24 hour taker buy volume of the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	BuyVolume24hB *Decimal `json:"buy_volume_24h_b,omitempty"`
	// The 24 hour taker sell volume of the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	SellVolume24hB *Decimal `json:"sell_volume_24h_b,omitempty"`
	// The 24 hour taker buy volume of the instrument, in the quote asset. Decimal string, e.g. "12.5".
	BuyVolume24hQ *Decimal `json:"buy_volume_24h_q,omitempty"`
	// The 24 hour taker sell volume of the instrument, in the quote asset. Decimal string, e.g. "12.5".
	SellVolume24hQ *Decimal `json:"sell_volume_24h_q,omitempty"`
	// The 24 hour highest traded price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	HighPrice *Decimal `json:"high_price,omitempty"`
	// The 24 hour lowest traded price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	LowPrice *Decimal `json:"low_price,omitempty"`
	// The 24 hour first traded price of the instrument. Decimal string, e.g. "65000.5"; up to 9 decimals.
	OpenPrice *Decimal `json:"open_price,omitempty"`
	// The open interest in the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	OpenInterest *Decimal `json:"open_interest,omitempty"`
	// The ratio of accounts that are net long vs net short on this instrument
	LongShortRatio *Decimal `json:"long_short_ratio,omitempty"`
	// The current indicative funding rate for the active interval, expressed in centibeeps. Absent for stable perps, which have `funding_rate_long_apr_pct` and...
	FundingRate *Decimal `json:"funding_rate,omitempty"`
	// Timestamp in nanoseconds when the current funding interval ends
	NextFundingTime *time.Time `json:"next_funding_time,omitempty"`
	// The current status of the instrument
	Status InstrumentStatus `json:"status,omitempty"`
	// The current trading session of the instrument's underlying market
	Session TradingSessionType `json:"session,omitempty"`
	// The long open interest in the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals. Excludes qualified-maker and DMM open interest.
	LongOpenInterest *Decimal `json:"long_open_interest,omitempty"`
	// The short open interest in the instrument. Decimal string, e.g. "0.01"; up to the instrument's base_decimals. Excludes qualified-maker and DMM open interest.
	ShortOpenInterest *Decimal `json:"short_open_interest,omitempty"`
	// Stable perps only: the indicative annual rate for retail longs at the next charge, in percent a year (`'-5.5'` = retail longs pay 5.5%; positive = retail...
	FundingRateLongAprPct *Decimal `json:"funding_rate_long_apr_pct,omitempty"`
	// Stable perps only: the indicative annual rate for retail shorts at the next charge, in percent a year (`'-5'` = retail shorts pay 5%; positive = retail...
	FundingRateShortAprPct *Decimal `json:"funding_rate_short_apr_pct,omitempty"`
}

Ticker Derived data such as the below, will not be included by default:

func (Ticker) MarshalJSON

func (v Ticker) MarshalJSON() ([]byte, error)

func (*Ticker) UnmarshalJSON

func (v *Ticker) UnmarshalJSON(data []byte) error

type TimeInForce

type TimeInForce string

TimeInForce | | Must Fill All | Can Fill Partial |

const (
	// TimeInForceGoodTillTime GTT - Remains open until it is cancelled, or expired
	TimeInForceGoodTillTime TimeInForce = "GOOD_TILL_TIME"
	// TimeInForceAllOrNone AON - Either fill the whole order or none of it (Block Trades Only)
	TimeInForceAllOrNone TimeInForce = "ALL_OR_NONE"
	// TimeInForceImmediateOrCancel IOC - Fill the order as much as possible, when hitting the orderbook. Then cancel it
	TimeInForceImmediateOrCancel TimeInForce = "IMMEDIATE_OR_CANCEL"
	// TimeInForceFillOrKill FOK - Both AoN and IoC. Either fill the full order when hitting the orderbook, or cancel it
	TimeInForceFillOrKill TimeInForce = "FILL_OR_KILL"
	// TimeInForceRetailPriceImprovement RPI - A GTT + PostOnly maker order, that can only be taken by non-algorithmic UI users.
	TimeInForceRetailPriceImprovement TimeInForce = "RETAIL_PRICE_IMPROVEMENT"
)

func (TimeInForce) Code

func (e TimeInForce) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (TimeInForce) String

func (e TimeInForce) String() string

String returns the wire value.

type Trade

type Trade struct {
	// Time at which the event was emitted in unix nanoseconds
	EventTime time.Time `json:"event_time"`
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
	// If taker was the buyer on the trade
	IsTakerBuyer bool `json:"is_taker_buyer"`
	// The number of assets being traded. Decimal string, e.g. "0.01"; up to the instrument's base_decimals.
	Size Decimal `json:"size"`
	// The traded price. Decimal string, e.g. "65000.5"; up to 9 decimals.
	Price Decimal `json:"price"`
	// The mark price of the instrument at point of trade. Decimal string, e.g. "65000.5"; up to 9 decimals.
	MarkPrice *Decimal `json:"mark_price,omitempty"`
	// The index price of the instrument at point of trade. Decimal string, e.g. "65000.5"; up to 9 decimals.
	IndexPrice Decimal `json:"index_price"`
	// The interest rate of the underlying at point of trade, expressed in centibeeps (1/100th of a basis point)
	InterestRate Decimal `json:"interest_rate"`
	// [Options] The forward price of the option at point of trade. Decimal string, e.g. "65000.5"; up to 9 decimals.
	ForwardPrice *Decimal `json:"forward_price,omitempty"`
	// A trade identifier, globally unique, and monotonically increasing (not by `1`).
	TradeID string `json:"trade_id"`
	// The venue where the trade occurred
	Venue Venue `json:"venue"`
	// If the trade is a RPI trade
	IsRpi bool `json:"is_rpi"`
}

Trade All private RFQs and Private AXEs will be filtered out from the responses

func (Trade) MarshalJSON

func (v Trade) MarshalJSON() ([]byte, error)

func (*Trade) UnmarshalJSON

func (v *Trade) UnmarshalJSON(data []byte) error

type TradingHolidaySchedule

type TradingHolidaySchedule struct {
	// Holiday name
	Name string `json:"name"`
	// `FULL_DAY`: the market is closed for the whole day. `EARLY_CLOSE`: the market trades as normal until the start time, then is closed until the end time
	CloseType TradingScheduleCloseType `json:"close_type"`
	// When the closure begins, as a Unix timestamp in milliseconds. For `FULL_DAY` this is when the closed trading day's session would have opened (the evening...
	StartTime int64 `json:"start_time,string"`
	// When the closed or shortened trading day's session would have closed, as a Unix timestamp in milliseconds. The closure covers the start time up to, but not...
	EndTime int64 `json:"end_time,string"`
}

TradingHolidaySchedule is a wire type.

func (*TradingHolidaySchedule) UnmarshalJSON

func (v *TradingHolidaySchedule) UnmarshalJSON(data []byte) error

type TradingScheduleCloseType

type TradingScheduleCloseType string

TradingScheduleCloseType How the market behaves on a holiday date

const (
	// TradingScheduleCloseTypeFullDay Market is fully closed for the entire day
	TradingScheduleCloseTypeFullDay TradingScheduleCloseType = "FULL_DAY"
	// TradingScheduleCloseTypeEarlyClose Market closes early; see the earlyClose time
	TradingScheduleCloseTypeEarlyClose TradingScheduleCloseType = "EARLY_CLOSE"
)

func (TradingScheduleCloseType) Code

func (e TradingScheduleCloseType) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (TradingScheduleCloseType) String

func (e TradingScheduleCloseType) String() string

String returns the wire value.

type TradingSession

type TradingSession struct {
	// Trading session start time timestamp in milliseconds
	StartTime int64 `json:"start_time,string"`
	// Trading session end time timestamp in milliseconds
	EndTime int64 `json:"end_time,string"`
	// Trading session type
	Type TradingSessionType `json:"type"`
}

TradingSession is a wire type.

func (*TradingSession) UnmarshalJSON

func (v *TradingSession) UnmarshalJSON(data []byte) error

type TradingSessionType

type TradingSessionType string

TradingSessionType Specifies different types of trading sessions

const (
	// TradingSessionTypeRegular Core market hours. Full liquidity.
	TradingSessionTypeRegular TradingSessionType = "REGULAR"
	// TradingSessionTypePreMarket Extended hours before open. Lower liquidity.
	TradingSessionTypePreMarket TradingSessionType = "PRE_MARKET"
	// TradingSessionTypeAfterMarket Extended hours after close. Lower liquidity.
	TradingSessionTypeAfterMarket TradingSessionType = "AFTER_MARKET"
	// TradingSessionTypeOvernight For 24/5 or specific overnight TradFi perps. Minimal liquidity.
	TradingSessionTypeOvernight TradingSessionType = "OVERNIGHT"
	// TradingSessionTypeClose Weekends, holidays, or daily maintenance windows.
	TradingSessionTypeClose TradingSessionType = "CLOSE"
)

func (TradingSessionType) Code

func (e TradingSessionType) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (TradingSessionType) String

func (e TradingSessionType) String() string

String returns the wire value.

type TransferHistory

type TransferHistory struct {
	// The transaction ID of the transfer
	TxID uint64 `json:"tx_id,string"`
	// The account to transfer from
	FromAccountID string `json:"from_account_id"`
	// The subaccount to transfer from (0 if transferring from main account)
	FromSubAccountID uint64 `json:"from_sub_account_id,string"`
	// The account to deposit into
	ToAccountID string `json:"to_account_id"`
	// The subaccount to transfer to (0 if transferring to main account)
	ToSubAccountID uint64 `json:"to_sub_account_id,string"`
	// The token currency to transfer
	Currency string `json:"currency"`
	// The number of tokens to transfer
	NumTokens Decimal `json:"num_tokens"`
	// The signature of the transfer
	Signature Signature `json:"signature"`
	// The timestamp of the transfer in unix nanoseconds
	EventTime time.Time `json:"event_time"`
	// The type of transfer
	TransferType TransferType `json:"transfer_type"`
	// The metadata of the transfer
	TransferMetadata string `json:"transfer_metadata"`
	// The wallet type of the from account or subaccount
	FromWalletType WalletType `json:"from_wallet_type"`
	// The wallet type of the to account or subaccount
	ToWalletType WalletType `json:"to_wallet_type"`
}

TransferHistory is a wire type.

func (TransferHistory) MarshalJSON

func (v TransferHistory) MarshalJSON() ([]byte, error)

func (*TransferHistory) UnmarshalJSON

func (v *TransferHistory) UnmarshalJSON(data []byte) error

type TransferHistoryInput

type TransferHistoryInput struct {
	// The transaction ID of the transfer
	TxID uint64 `json:"tx_id,string"`
	// The account to transfer from
	FromAccountID string `json:"from_account_id"`
	// The subaccount to transfer from (0 if transferring from main account)
	FromSubAccountID uint64 `json:"from_sub_account_id,string"`
	// The account to deposit into
	ToAccountID string `json:"to_account_id"`
	// The subaccount to transfer to (0 if transferring to main account)
	ToSubAccountID uint64 `json:"to_sub_account_id,string"`
	// The token currency to transfer
	Currency string `json:"currency"`
	// The number of tokens to transfer
	NumTokens Decimal `json:"num_tokens"`
	// The signature of the transfer
	Signature SignatureInput `json:"signature"`
	// The timestamp of the transfer in unix nanoseconds
	EventTime time.Time `json:"event_time"`
	// The type of transfer
	TransferType TransferType `json:"transfer_type"`
	// The metadata of the transfer
	TransferMetadata string `json:"transfer_metadata"`
	// The wallet type of the from account or subaccount
	FromWalletType WalletType `json:"from_wallet_type"`
	// The wallet type of the to account or subaccount
	ToWalletType WalletType `json:"to_wallet_type"`
}

TransferHistoryInput is a wire type.

func (TransferHistoryInput) MarshalJSON

func (v TransferHistoryInput) MarshalJSON() ([]byte, error)

func (*TransferHistoryInput) UnmarshalJSON

func (v *TransferHistoryInput) UnmarshalJSON(data []byte) error

type TransferType

type TransferType string

TransferType is a wire enum.

const (
	// TransferTypeUnspecified Deprecated: use `standard` instead. Legacy value for transfers created before transfer types were introduced.
	TransferTypeUnspecified TransferType = "UNSPECIFIED"
	// TransferTypeStandard Standard transfer that has nothing to do with bridging
	TransferTypeStandard TransferType = "STANDARD"
	// TransferTypeFastArbDeposit Fast Arb Deposit Metadata type
	TransferTypeFastArbDeposit TransferType = "FAST_ARB_DEPOSIT"
	// TransferTypeFastArbWithdrawal Fast Arb Withdrawal Metadata type
	TransferTypeFastArbWithdrawal TransferType = "FAST_ARB_WITHDRAWAL"
	// TransferTypeNonNativeBridgeDeposit Transfer type for non native bridging deposit
	TransferTypeNonNativeBridgeDeposit TransferType = "NON_NATIVE_BRIDGE_DEPOSIT"
	// TransferTypeNonNativeBridgeWithdrawal Transfer type for non native bridging withdrawal
	TransferTypeNonNativeBridgeWithdrawal TransferType = "NON_NATIVE_BRIDGE_WITHDRAWAL"
	// TransferTypeAdhocIncentive Transfer type for adhoc incentive
	TransferTypeAdhocIncentive TransferType = "ADHOC_INCENTIVE"
	// TransferTypeReferralIncentive Transfer type for referral incentive
	TransferTypeReferralIncentive TransferType = "REFERRAL_INCENTIVE"
	// TransferTypeTradingDepositYieldIncentive Transfer type for trading deposit yield incentive
	TransferTypeTradingDepositYieldIncentive TransferType = "TRADING_DEPOSIT_YIELD_INCENTIVE"
	// TransferTypeTgeVesting Transfer type for TGE vesting distribution
	TransferTypeTgeVesting TransferType = "TGE_VESTING"
	// TransferTypeTgeAirdrop Transfer type for TGE airdrop distribution
	TransferTypeTgeAirdrop TransferType = "TGE_AIRDROP"
	// TransferTypeFeedbackReward Transfer type for feedback reward distribution
	TransferTypeFeedbackReward TransferType = "FEEDBACK_REWARD"
)

func (TransferType) Code

func (e TransferType) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (TransferType) String

func (e TransferType) String() string

String returns the wire value.

type TriggerBy

type TriggerBy string

TriggerBy Defines the price type that activates a Take Profit (TP) or Stop Loss (SL) order.

const (
	// TriggerByUnspecified no trigger condition
	TriggerByUnspecified TriggerBy = "UNSPECIFIED"
	// TriggerByIndex INDEX - Order is activated when the index price reaches the trigger price
	TriggerByIndex TriggerBy = "INDEX"
	// TriggerByLast LAST - Order is activated when the last trade price reaches the trigger price
	TriggerByLast TriggerBy = "LAST"
	// TriggerByMid MID - Order is activated when the mid price reaches the trigger price
	TriggerByMid TriggerBy = "MID"
	// TriggerByMark MARK - Order is activated when the mark price reaches the trigger price
	TriggerByMark TriggerBy = "MARK"
)

func (TriggerBy) Code

func (e TriggerBy) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (TriggerBy) String

func (e TriggerBy) String() string

String returns the wire value.

type TriggerOrderMetadata

type TriggerOrderMetadata struct {
	// Type of the trigger order. eg: Take Profit, Stop Loss, etc
	TriggerType TriggerType `json:"trigger_type"`
	// Contains metadata for Take Profit (TP) and Stop Loss (SL) trigger orders.
	Tpsl TPSLOrderMetadata `json:"tpsl"`
}

TriggerOrderMetadata Contains metadata related to trigger orders, such as Take Profit (TP) or Stop Loss (SL).

func (*TriggerOrderMetadata) UnmarshalJSON

func (v *TriggerOrderMetadata) UnmarshalJSON(data []byte) error

type TriggerType

type TriggerType string

TriggerType Defines the type of trigger order used in trading, such as Take Profit or Stop Loss.

const (
	// TriggerTypeUnspecified Not a trigger order. The order executes normally without any trigger conditions.
	TriggerTypeUnspecified TriggerType = "UNSPECIFIED"
	// TriggerTypeTakeProfit Take Profit Order - Executes when the price reaches a specified level to secure profits.
	TriggerTypeTakeProfit TriggerType = "TAKE_PROFIT"
	// TriggerTypeStopLoss Stop Loss Order - Executes when the price reaches a specified level to limit losses.
	TriggerTypeStopLoss TriggerType = "STOP_LOSS"
)

func (TriggerType) Code

func (e TriggerType) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (TriggerType) String

func (e TriggerType) String() string

String returns the wire value.

type Uint64s

type Uint64s []uint64

Uint64s is a list of 64-bit integers. The gateway sends them as JSON strings; numbers decode too.

func (Uint64s) MarshalJSON

func (u Uint64s) MarshalJSON() ([]byte, error)

func (*Uint64s) UnmarshalJSON

func (u *Uint64s) UnmarshalJSON(data []byte) error

type VaultInvestment

type VaultInvestment struct {
	// The trading account ID of the vault invested in.
	VaultID uint64 `json:"vault_id,string"`
	// The number of shares held by the investor.
	NumLpTokens Decimal `json:"num_lp_tokens"`
	// The current share price (in USD) of this vault investment.
	SharePrice Decimal `json:"share_price"`
	// The USD notional invested in this vault investment.
	UsdNotionalInvested Decimal `json:"usd_notional_invested"`
	// The owner's Funding, trading and reserved vault shares. Absent on older snapshots.
	ShareBalances *VaultShareBalances `json:"share_balances,omitempty"`
}

VaultInvestment Summarizes a vault investment held by a funding account

func (*VaultInvestment) UnmarshalJSON

func (v *VaultInvestment) UnmarshalJSON(data []byte) error

type VaultInvestorAction

type VaultInvestorAction string

VaultInvestorAction is a wire enum.

const (
	VaultInvestorActionUnspecified      VaultInvestorAction = "UNSPECIFIED"
	VaultInvestorActionVaultInvest      VaultInvestorAction = "VAULT_INVEST"
	VaultInvestorActionVaultBurnLpToken VaultInvestorAction = "VAULT_BURN_LP_TOKEN"
	VaultInvestorActionVaultRedeem      VaultInvestorAction = "VAULT_REDEEM"
)

func (VaultInvestorAction) Code

func (e VaultInvestorAction) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (VaultInvestorAction) String

func (e VaultInvestorAction) String() string

String returns the wire value.

type VaultInvestorSummary

type VaultInvestorSummary struct {
	// The unique identifier of the vault sub account.
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The number of vault LP tokens the investor holds: those in the funding account plus those in every trading account.
	NumLpTokens Decimal `json:"num_lp_tokens"`
	// The average entry price (in USD) of the investor's vault LP tokens: the investor's invested notional divided by numLPTokens.
	AvgEntryPrice Decimal `json:"avg_entry_price"`
	// The current price (in USD) of the vault LP tokens.
	CurrentPrice Decimal `json:"current_price"`
	// The vault's total equity (in USD). The investor's holding is investorEquity.
	TotalEquity Decimal `json:"total_equity"`
	// The all-time realized PnL (in USD) that the investor has received from the vault.
	AllTimeRealizedPnl Decimal `json:"all_time_realized_pnl"`
	// The singleton pending redemption (omitted if none).
	PendingRedemption *VaultRedemption `json:"pending_redemption,omitempty"`
	// True if the requesting account is authorized to burn tokens on this vault, omitted otherwise.
	CanBurn *bool `json:"can_burn,omitempty"`
	// The number of the investor's vault LP tokens still within the vault's minimum investment period.
	NumLpTokensLocked Decimal `json:"num_lp_tokens_locked"`
	// The number of vault LP tokens the investor can request to redeem now: those past the minimum investment period, less any pending redemption.
	NumLpTokensRedeemable Decimal `json:"num_lp_tokens_redeemable"`
	// The investor's vault LP tokens within the minimum investment period, by the time they unlock (earliest first).
	LockedLots []VaultLpLotView `json:"locked_lots"`
	// Where the investor's vault LP tokens sit: the funding account and the trading accounts.
	ShareBalances VaultShareBalances `json:"share_balances"`
	// One entry per trading account holding the vault's LP tokens. Empty when no trading account holds any.
	TradingBalances []VaultShareTradingBalance `json:"trading_balances"`
	// The current valuation (in USD) of all the investor's vault LP tokens: numLPTokens times currentPrice.
	InvestorEquity Decimal `json:"investor_equity"`
	// The investor's unrealized PnL (in USD): investorEquity less the investor's invested notional.
	UnrealizedPnl Decimal `json:"unrealized_pnl"`
}

VaultInvestorSummary Vault investor summary information.

func (*VaultInvestorSummary) UnmarshalJSON

func (v *VaultInvestorSummary) UnmarshalJSON(data []byte) error

type VaultLpLotView

type VaultLpLotView struct {
	// Time in unix nanoseconds from which these LP tokens can be redeemed.
	UnlockTime time.Time `json:"unlock_time"`
	// The number of LP tokens in the lot.
	NumLpTokens Decimal `json:"num_lp_tokens"`
}

VaultLpLotView Vault LP tokens minted together that unlock at the same time.

func (VaultLpLotView) MarshalJSON

func (v VaultLpLotView) MarshalJSON() ([]byte, error)

func (*VaultLpLotView) UnmarshalJSON

func (v *VaultLpLotView) UnmarshalJSON(data []byte) error

type VaultRedemption

type VaultRedemption struct {
	// The number of LP Tokens requested for redemption.
	NumLpTokens Decimal `json:"num_lp_tokens"`
	// The valuation (in USD) of the redemption request.
	RequestValuation Decimal `json:"request_valuation"`
	// Set by the server. Time at which the redemption request was received by GRVT in unix nanoseconds
	RequestTime time.Time `json:"request_time"`
	// Set by the server. Time in unix nanoseconds, beyond which the request will be force-redeemed.
	MaxRedemptionPeriodTimestamp time.Time `json:"max_redemption_period_timestamp"`
	// Omitted for redemption requests to non-cross exchange vaults. True if cancellation is blocked within the CEV allocation allowance for the user's current tier...
	CancelBlocked *bool `json:"cancel_blocked,omitempty"`
	// The currency the request pays into the investor's funding account: the vault's investment currency, unless the request converts.
	ToCurrency string `json:"to_currency"`
	// The signed rate the request is paid at, `to_currency` per unit of the vault's investment currency. 1 when the request does not convert.
	ExchangeRate Decimal `json:"exchange_rate"`
}

VaultRedemption Vault redemption information.

func (VaultRedemption) MarshalJSON

func (v VaultRedemption) MarshalJSON() ([]byte, error)

func (*VaultRedemption) UnmarshalJSON

func (v *VaultRedemption) UnmarshalJSON(data []byte) error

type VaultRedemptionReqAgeCategory

type VaultRedemptionReqAgeCategory string

VaultRedemptionReqAgeCategory Denotes the age category of a given redemption request.

const (
	// VaultRedemptionReqAgeCategoryNormal This request is at least as old as the minimum redemption period, and is eligible for automated redemption.
	VaultRedemptionReqAgeCategoryNormal VaultRedemptionReqAgeCategory = "NORMAL"
	// VaultRedemptionReqAgeCategoryUrgent This request is nearing the maxmimum redemption period and will be factored into pre-order check margin requirements.
	VaultRedemptionReqAgeCategoryUrgent VaultRedemptionReqAgeCategory = "URGENT"
	// VaultRedemptionReqAgeCategoryOverdue This request has exceeded the maximum redemption period and will be considered for forced redemptions.
	VaultRedemptionReqAgeCategoryOverdue VaultRedemptionReqAgeCategory = "OVERDUE"
	// VaultRedemptionReqAgeCategoryPreMin This request has yet to exceed the minimum redemption period, and is not yet eligible for automated redemption.
	VaultRedemptionReqAgeCategoryPreMin VaultRedemptionReqAgeCategory = "PRE_MIN"
)

func (VaultRedemptionReqAgeCategory) Code

Code is the integer used when signing; false for a value this SDK does not know.

func (VaultRedemptionReqAgeCategory) String

String returns the wire value.

type VaultRedemptionRequest

type VaultRedemptionRequest struct {
	// Set by the server. Time at which the redemption request was received by GRVT in unix nanoseconds
	RequestTime time.Time `json:"request_time"`
	// The number of shares to redeem
	NumLpTokens Decimal `json:"num_lp_tokens"`
	// Set by the server. Time in unix nanoseconds, beyond which the request will be force-redeemed.
	MaxRedemptionPeriodTimestamp time.Time `json:"max_redemption_period_timestamp"`
	// Age category of this redemption request.
	AgeCategory VaultRedemptionReqAgeCategory `json:"age_category"`
	// `true` if this request belongs to the vault manager, omitted otherwise.
	IsManager *bool `json:"is_manager,omitempty"`
	// Set by the server. Time in unix nanoseconds, beyond which the request will be eligible for automated redemption.
	EligibleForAutoRedemptionTimestamp time.Time `json:"eligible_for_auto_redemption_timestamp"`
	// The currency the vault pays: the vault's investment currency.
	FromCurrency string `json:"from_currency"`
	// The currency paid into the investor's funding account. Equal to `from_currency` when the request does not convert.
	ToCurrency string `json:"to_currency"`
	// The signed rate the request is paid at, `to_currency` per unit of `from_currency`. 1 when the request does not convert.
	ExchangeRate Decimal `json:"exchange_rate"`
}

VaultRedemptionRequest Representation of a pending redemption request for a given vault.

func (VaultRedemptionRequest) MarshalJSON

func (v VaultRedemptionRequest) MarshalJSON() ([]byte, error)

func (*VaultRedemptionRequest) UnmarshalJSON

func (v *VaultRedemptionRequest) UnmarshalJSON(data []byte) error

type VaultShareBalances

type VaultShareBalances struct {
	// The vault LP tokens in the funding account, including those a pending redemption reserves.
	FundingLpTokenBalance Decimal `json:"funding_lp_token_balance"`
	// The vault LP tokens across all trading accounts: the sum of tradingBalances.
	TradingLpTokenBalance Decimal `json:"trading_lp_token_balance"`
	// The funding account's vault LP tokens a pending redemption reserves.
	PendingRedemptionLpTokenBalance Decimal `json:"pending_redemption_lp_token_balance"`
	// The funding account's vault LP tokens that can move to a trading account now: fundingLpTokenBalance less pendingRedemptionLpTokenBalance. The minimum...
	AvailableToTransfer Decimal `json:"available_to_transfer"`
	// The vault's share currency, used to transfer its LP tokens. Omitted when the vault has none.
	Currency string `json:"currency,omitempty"`
}

VaultShareBalances Where an investor's vault LP tokens sit.

func (*VaultShareBalances) UnmarshalJSON

func (v *VaultShareBalances) UnmarshalJSON(data []byte) error

type VaultShareTradingBalance

type VaultShareTradingBalance struct {
	// The trading account.
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The vault LP tokens in the trading account.
	NumLpTokens Decimal `json:"num_lp_tokens"`
	// The current valuation (in USD) of the trading account's vault LP tokens.
	Equity Decimal `json:"equity"`
	// An estimate of the vault LP tokens that can move back to the funding account without failing the trading account's withdrawal checks.
	AvailableToTransfer Decimal `json:"available_to_transfer"`
	// What the vault LP tokens add to the trading account's margin (in USD): equity times the collateral value ratio. 0 when they don't count as collateral.
	MarginBalanceUsd Decimal `json:"margin_balance_usd"`
}

VaultShareTradingBalance A trading account's holding of a vault's LP tokens.

func (*VaultShareTradingBalance) UnmarshalJSON

func (v *VaultShareTradingBalance) UnmarshalJSON(data []byte) error

type Venue

type Venue string

Venue The list of Trading Venues that are supported on the GRVT exchange

const (
	// VenueOrderbook the trade is cleared on the orderbook venue
	VenueOrderbook Venue = "ORDERBOOK"
	// VenueRfq the trade is cleared on the RFQ venue
	VenueRfq Venue = "RFQ"
)

func (Venue) Code

func (e Venue) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (Venue) String

func (e Venue) String() string

String returns the wire value.

type WSAlgoOrderFeedDataV1

type WSAlgoOrderFeedDataV1 struct {
	// Stream name
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// The algo order object being created or updated
	Feed AlgoOrder `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSAlgoOrderFeedDataV1 is a wire type.

func (*WSAlgoOrderFeedDataV1) UnmarshalJSON

func (v *WSAlgoOrderFeedDataV1) UnmarshalJSON(data []byte) error

type WSAlgoOrderFeedSelectorV1

type WSAlgoOrderFeedSelectorV1 struct {
	// The subaccount ID to filter by
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The instrument filter to apply.
	Instrument string `json:"instrument,omitempty"`
}

WSAlgoOrderFeedSelectorV1 Subscribes to a feed of algo order updates pertaining to algo orders made by your account.

func (*WSAlgoOrderFeedSelectorV1) UnmarshalJSON

func (v *WSAlgoOrderFeedSelectorV1) UnmarshalJSON(data []byte) error

type WSCancelFeedDataV1

type WSCancelFeedDataV1 struct {
	// Stream name
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// Data relating to the status of the cancellation attempt
	Feed CancelStatusFeed `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSCancelFeedDataV1 is a wire type.

func (*WSCancelFeedDataV1) UnmarshalJSON

func (v *WSCancelFeedDataV1) UnmarshalJSON(data []byte) error

type WSCancelFeedSelectorV1

type WSCancelFeedSelectorV1 struct {
	// The subaccount ID to filter by
	SubAccountID uint64 `json:"sub_account_id,string"`
}

WSCancelFeedSelectorV1 Subscribes to a feed of time-to-live expiry events for order cancellations requested by a given subaccount.

func (*WSCancelFeedSelectorV1) UnmarshalJSON

func (v *WSCancelFeedSelectorV1) UnmarshalJSON(data []byte) error

type WSCandlestickFeedDataV1

type WSCandlestickFeedDataV1 struct {
	// Stream name
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// A candlestick entry matching the request filters
	Feed Candlestick `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSCandlestickFeedDataV1 is a wire type.

func (*WSCandlestickFeedDataV1) UnmarshalJSON

func (v *WSCandlestickFeedDataV1) UnmarshalJSON(data []byte) error

type WSCandlestickFeedSelectorV1

type WSCandlestickFeedSelectorV1 struct {
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
	// The interval of each candlestick
	Interval WsCandlestickInterval `json:"interval,omitempty"`
	// The type of candlestick data to retrieve
	Type CandlestickType `json:"type,omitempty"`
}

WSCandlestickFeedSelectorV1 Subscribes to a stream of Kline/Candlestick updates for an instrument. A Kline is uniquely identified by its open time.

func (*WSCandlestickFeedSelectorV1) UnmarshalJSON

func (v *WSCandlestickFeedSelectorV1) UnmarshalJSON(data []byte) error

type WSDepositFeedDataV1

type WSDepositFeedDataV1 struct {
	// The websocket channel to which the response is sent
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// The Deposit object
	Feed Deposit `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSDepositFeedDataV1 Subscribes to a feed of deposit updates.

func (*WSDepositFeedDataV1) UnmarshalJSON

func (v *WSDepositFeedDataV1) UnmarshalJSON(data []byte) error

type WSDepositFeedSelectorV1

type WSDepositFeedSelectorV1 struct {
	// The main account ID to request for
	MainAccountID string `json:"main_account_id"`
}

WSDepositFeedSelectorV1 Subscribes to a feed of deposits. This will execute when there is any deposit to selected account.

func (*WSDepositFeedSelectorV1) UnmarshalJSON

func (v *WSDepositFeedSelectorV1) UnmarshalJSON(data []byte) error

type WSFillFeedDataV1

type WSFillFeedDataV1 struct {
	// The websocket channel to which the response is sent
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// A private trade matching the request filter
	Feed Fill `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSFillFeedDataV1 is a wire type.

func (*WSFillFeedDataV1) UnmarshalJSON

func (v *WSFillFeedDataV1) UnmarshalJSON(data []byte) error

type WSFillFeedSelectorV1

type WSFillFeedSelectorV1 struct {
	// The sub account ID to request for
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The instrument filter to apply.
	Instrument string `json:"instrument,omitempty"`
}

WSFillFeedSelectorV1 Subscribes to a feed of private trade updates. This happens when a trade is executed.

func (*WSFillFeedSelectorV1) UnmarshalJSON

func (v *WSFillFeedSelectorV1) UnmarshalJSON(data []byte) error

type WSListStreamsParams

type WSListStreamsParams struct {
}

WSListStreamsParams List down all the streams this connection has connected to.

type WSListStreamsResult

type WSListStreamsResult struct {
	// The list of stream references the connection is connected to
	StreamReference []StreamReference `json:"stream_reference"`
}

WSListStreamsResult Returns a list of all rooms the client has subscribed to.

func (*WSListStreamsResult) UnmarshalJSON

func (v *WSListStreamsResult) UnmarshalJSON(data []byte) error

type WSMiniTickerFeedDataV1

type WSMiniTickerFeedDataV1 struct {
	// Stream name
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// A mini ticker matching the request filter
	Feed MiniTicker `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSMiniTickerFeedDataV1 is a wire type.

func (*WSMiniTickerFeedDataV1) UnmarshalJSON

func (v *WSMiniTickerFeedDataV1) UnmarshalJSON(data []byte) error

type WSMiniTickerFeedSelectorV1

type WSMiniTickerFeedSelectorV1 struct {
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
	// The minimal rate at which we publish feeds (in milliseconds)
	Rate *uint32 `json:"rate,omitempty"`
}

WSMiniTickerFeedSelectorV1 Subscribes to a mini ticker feed for a single instrument. The `mini.s` channel offers simpler integration. To experience higher publishing rates, please use the `mini.d` channel.

func (*WSMiniTickerFeedSelectorV1) UnmarshalJSON

func (v *WSMiniTickerFeedSelectorV1) UnmarshalJSON(data []byte) error

type WSOrderFeedDataV1

type WSOrderFeedDataV1 struct {
	// Stream name
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// The order object being created or updated
	Feed Order `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSOrderFeedDataV1 is a wire type.

func (*WSOrderFeedDataV1) UnmarshalJSON

func (v *WSOrderFeedDataV1) UnmarshalJSON(data []byte) error

type WSOrderFeedDataV1Input

type WSOrderFeedDataV1Input struct {
	// Stream name
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// The order object being created or updated
	Feed OrderInput `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSOrderFeedDataV1Input is a wire type.

func (*WSOrderFeedDataV1Input) UnmarshalJSON

func (v *WSOrderFeedDataV1Input) UnmarshalJSON(data []byte) error

type WSOrderFeedSelectorV1

type WSOrderFeedSelectorV1 struct {
	// The subaccount ID to filter by
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The instrument filter to apply.
	Instrument string `json:"instrument,omitempty"`
}

WSOrderFeedSelectorV1 Subscribes to a feed of order updates pertaining to orders made by your account.

func (*WSOrderFeedSelectorV1) UnmarshalJSON

func (v *WSOrderFeedSelectorV1) UnmarshalJSON(data []byte) error

type WSOrderStateFeedDataV1

type WSOrderStateFeedDataV1 struct {
	// Stream name
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// The Order State Feed
	Feed OrderStateFeed `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSOrderStateFeedDataV1 is a wire type.

func (*WSOrderStateFeedDataV1) UnmarshalJSON

func (v *WSOrderStateFeedDataV1) UnmarshalJSON(data []byte) error

type WSOrderStateFeedSelectorV1

type WSOrderStateFeedSelectorV1 struct {
	// The subaccount ID to filter by
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The instrument filter to apply.
	Instrument string `json:"instrument,omitempty"`
}

WSOrderStateFeedSelectorV1 Subscribes to a feed of order updates pertaining to orders made by your account.

func (*WSOrderStateFeedSelectorV1) UnmarshalJSON

func (v *WSOrderStateFeedSelectorV1) UnmarshalJSON(data []byte) error

type WSOrderbookLevelsFeedDataV1

type WSOrderbookLevelsFeedDataV1 struct {
	// Stream name
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// An orderbook levels object matching the request filter
	Feed OrderbookLevels `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSOrderbookLevelsFeedDataV1 is a wire type.

func (*WSOrderbookLevelsFeedDataV1) UnmarshalJSON

func (v *WSOrderbookLevelsFeedDataV1) UnmarshalJSON(data []byte) error

type WSOrderbookLevelsFeedSelectorV1

type WSOrderbookLevelsFeedSelectorV1 struct {
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
	// The minimal rate at which we publish feeds (in milliseconds)
	Rate *uint32 `json:"rate,omitempty"`
	// Depth of the order book to be retrieved
	Depth *uint32 `json:"depth,omitempty"`
}

WSOrderbookLevelsFeedSelectorV1 Subscribes to aggregated orderbook updates for a single instrument. The `book.s` channel offers simpler integration. To experience higher publishing rates, please use the `book.d` channel.

func (*WSOrderbookLevelsFeedSelectorV1) UnmarshalJSON

func (v *WSOrderbookLevelsFeedSelectorV1) UnmarshalJSON(data []byte) error

type WSPositionsFeedDataV1

type WSPositionsFeedDataV1 struct {
	// Stream name
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// A Position being created or updated matching the request filter
	Feed Positions `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSPositionsFeedDataV1 is a wire type.

func (*WSPositionsFeedDataV1) UnmarshalJSON

func (v *WSPositionsFeedDataV1) UnmarshalJSON(data []byte) error

type WSPositionsFeedSelectorV1

type WSPositionsFeedSelectorV1 struct {
	// The subaccount ID to filter by
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The instrument filter to apply.
	Instrument string `json:"instrument,omitempty"`
}

WSPositionsFeedSelectorV1 Subscribes to a feed of position updates.

func (*WSPositionsFeedSelectorV1) UnmarshalJSON

func (v *WSPositionsFeedSelectorV1) UnmarshalJSON(data []byte) error

type WSRfqQuoteFeedDataV1

type WSRfqQuoteFeedDataV1 struct {
	// Stream name
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// The taker's private quote book for their open RFQ on this instrument
	Feed RfqQuoteFeed `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSRfqQuoteFeedDataV1 is a wire type.

func (*WSRfqQuoteFeedDataV1) UnmarshalJSON

func (v *WSRfqQuoteFeedDataV1) UnmarshalJSON(data []byte) error

type WSRfqQuoteFeedSelectorV1

type WSRfqQuoteFeedSelectorV1 struct {
	// The subaccount ID to filter by
	SubAccountID uint64 `json:"sub_account_id,string"`
	// The instrument filter to apply.
	Instrument string `json:"instrument,omitempty"`
}

WSRfqQuoteFeedSelectorV1 Taker feed. Subscribe with selector `(sub_account_id, instrument)` to receive your private RFQ quote book — best bid/ask and all private quote levels — for your open RFQ on that instrument.

func (*WSRfqQuoteFeedSelectorV1) UnmarshalJSON

func (v *WSRfqQuoteFeedSelectorV1) UnmarshalJSON(data []byte) error

type WSSubscribeParams

type WSSubscribeParams struct {
	// The channel to subscribe to (eg: ticker.s / ticker.d)
	Stream string `json:"stream"`
	// The list of feeds to subscribe to
	Selectors []string `json:"selectors"`
	// Whether to use the global sequence number for the stream
	UseGlobalSequenceNumber *bool `json:"use_global_sequence_number,omitempty"`
}

WSSubscribeParams All V1 Websocket Subscription Requests are housed in this wrapper. You may specify a stream and a list of feeds to subscribe to.

func (*WSSubscribeParams) UnmarshalJSON

func (v *WSSubscribeParams) UnmarshalJSON(data []byte) error

type WSSubscribeRequestV1Legacy

type WSSubscribeRequestV1Legacy struct {
	// Optional Field which is used to match the response by the client.
	RequestID *uint32 `json:"request_id,omitempty"`
	// The channel to subscribe to (eg: ticker.s / ticker.d)
	Stream string `json:"stream"`
	// The list of feeds to subscribe to
	Feed []string `json:"feed"`
	// The method to use for the request (eg: subscribe / unsubscribe)
	Method string `json:"method"`
	// Whether the request is for full data or lite data
	IsFull *bool `json:"is_full,omitempty"`
}

WSSubscribeRequestV1Legacy All V1 Websocket Requests are housed in this wrapper. You may specify a stream, and a list of feeds to subscribe to.

func (*WSSubscribeRequestV1Legacy) UnmarshalJSON

func (v *WSSubscribeRequestV1Legacy) UnmarshalJSON(data []byte) error

type WSSubscribeResponseV1Legacy

type WSSubscribeResponseV1Legacy struct {
	// Optional Field which is used to match the response by the client.
	RequestID *uint32 `json:"request_id,omitempty"`
	// The channel to subscribe to (eg: ticker.s / ticker.d)
	Stream string `json:"stream"`
	// The list of feeds subscribed to
	Subs []string `json:"subs"`
	// The list of feeds unsubscribed from
	Unsubs []string `json:"unsubs"`
	// The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs`
	NumSnapshots []uint32 `json:"num_snapshots"`
	// The first sequence number to expect for each subscribed feed. Returned in same order as `subs`
	FirstSequenceNumber Uint64s `json:"first_sequence_number"`
	// The sequence number of the most recent message in the stream. Next received sequence number must be larger than this one. Returned in same order as `subs`
	LatestSequenceNumber Uint64s `json:"latest_sequence_number"`
}

WSSubscribeResponseV1Legacy All V1 Websocket Responses are housed in this wrapper. It returns a confirmation of the JSON RPC subscribe request.

func (*WSSubscribeResponseV1Legacy) UnmarshalJSON

func (v *WSSubscribeResponseV1Legacy) UnmarshalJSON(data []byte) error

type WSSubscribeResult

type WSSubscribeResult struct {
	// The channel to subscribe to (eg: ticker.s / ticker.d)
	Stream string `json:"stream"`
	// The list of feeds subscribed to
	Subs []string `json:"subs"`
	// The list of feeds unsubscribed from
	Unsubs []string `json:"unsubs"`
	// The number of snapshot payloads to expect for each subscribed feed. Returned in same order as `subs`
	NumSnapshots []uint32 `json:"num_snapshots"`
	// The first sequence number to expect for each subscribed feed. Returned in same order as `subs`
	FirstSequenceNumber Uint64s `json:"first_sequence_number"`
	// The sequence number of the most recent message in the stream. Next received sequence number must be larger than this one. Returned in same order as `subs`
	LatestSequenceNumber Uint64s `json:"latest_sequence_number"`
}

WSSubscribeResult To ensure you always know if you have missed any payloads, GRVT servers apply the following heuristics to sequence numbers: All snapshot payloads will have a sequence number of `0`. All delta...

func (*WSSubscribeResult) UnmarshalJSON

func (v *WSSubscribeResult) UnmarshalJSON(data []byte) error

type WSTickerFeedDataV1

type WSTickerFeedDataV1 struct {
	// Stream name
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// A ticker matching the request filter
	Feed Ticker `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSTickerFeedDataV1 is a wire type.

func (*WSTickerFeedDataV1) UnmarshalJSON

func (v *WSTickerFeedDataV1) UnmarshalJSON(data []byte) error

type WSTickerFeedSelectorV1

type WSTickerFeedSelectorV1 struct {
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
	// The minimal rate at which we publish feeds (in milliseconds)
	Rate *uint32 `json:"rate,omitempty"`
}

WSTickerFeedSelectorV1 Subscribes to a ticker feed for a single instrument. The `ticker.s` channel offers simpler integration. To experience higher publishing rates, please use the `ticker.d` channel.

func (*WSTickerFeedSelectorV1) UnmarshalJSON

func (v *WSTickerFeedSelectorV1) UnmarshalJSON(data []byte) error

type WSTradeFeedDataV1

type WSTradeFeedDataV1 struct {
	// Stream name
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// A public trade matching the request filter
	Feed Trade `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSTradeFeedDataV1 is a wire type.

func (*WSTradeFeedDataV1) UnmarshalJSON

func (v *WSTradeFeedDataV1) UnmarshalJSON(data []byte) error

type WSTradeFeedSelectorV1

type WSTradeFeedSelectorV1 struct {
	// The readable instrument name: Perpetual: `ETH_USDT_Perp` Future: `BTC_USDT_Fut_20Oct23` Call: `ETH_USDT_Call_20Oct23_2800` Put: `ETH_USDT_Put_20Oct23_2800`
	Instrument string `json:"instrument"`
	// The limit to query for. Valid values are (50, 200, 500, 1000). Default is 50
	Limit *uint32 `json:"limit,omitempty"`
}

WSTradeFeedSelectorV1 Subscribes to a stream of Public Trades for an instrument.

func (*WSTradeFeedSelectorV1) UnmarshalJSON

func (v *WSTradeFeedSelectorV1) UnmarshalJSON(data []byte) error

type WSTransferFeedDataV1

type WSTransferFeedDataV1 struct {
	// The websocket channel to which the response is sent
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// The transfer history matching the requested filters
	Feed TransferHistory `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSTransferFeedDataV1 Subscribes to a feed of transfer updates.

func (*WSTransferFeedDataV1) UnmarshalJSON

func (v *WSTransferFeedDataV1) UnmarshalJSON(data []byte) error

type WSTransferFeedDataV1Input

type WSTransferFeedDataV1Input struct {
	// The websocket channel to which the response is sent
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// The transfer history matching the requested filters
	Feed TransferHistoryInput `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSTransferFeedDataV1Input Subscribes to a feed of transfer updates.

func (*WSTransferFeedDataV1Input) UnmarshalJSON

func (v *WSTransferFeedDataV1Input) UnmarshalJSON(data []byte) error

type WSTransferFeedSelectorV1

type WSTransferFeedSelectorV1 struct {
	// The main account ID to request for
	MainAccountID string `json:"main_account_id"`
	// The sub account ID to request for
	SubAccountID *uint64 `json:"sub_account_id,omitempty,string"`
}

WSTransferFeedSelectorV1 Subscribes to a feed of transfers. This will execute when there is any transfer to or from the selected account.

func (*WSTransferFeedSelectorV1) UnmarshalJSON

func (v *WSTransferFeedSelectorV1) UnmarshalJSON(data []byte) error

type WSUnsubscribeAllParams

type WSUnsubscribeAllParams struct {
}

WSUnsubscribeAllParams All V1 Websocket Unsubscription Request to unsubscribe from all active websocket streams.

type WSUnsubscribeAllResult

type WSUnsubscribeAllResult struct {
	// The list of stream references unsubscribed from
	StreamReference []StreamReference `json:"stream_reference"`
}

WSUnsubscribeAllResult Returns a list of all rooms the client has unsubscribed from.

func (*WSUnsubscribeAllResult) UnmarshalJSON

func (v *WSUnsubscribeAllResult) UnmarshalJSON(data []byte) error

type WSUnsubscribeParams

type WSUnsubscribeParams struct {
	// The channel to unsubscribe from (eg: ticker.s / ticker.d)
	Stream string `json:"stream"`
	// The list of feeds to unsubscribe from
	Selectors []string `json:"selectors"`
	// Whether to use the global sequence number for the stream
	UseGlobalSequenceNumber *bool `json:"use_global_sequence_number,omitempty"`
}

WSUnsubscribeParams All V1 Websocket Unsubscription Requests are housed in this wrapper. You may specify a stream, a list of feeds and whether those feeds use global sequence numbers to unsubscribe from.

func (*WSUnsubscribeParams) UnmarshalJSON

func (v *WSUnsubscribeParams) UnmarshalJSON(data []byte) error

type WSUnsubscribeResult

type WSUnsubscribeResult struct {
	// The channel to subscribe to (eg: ticker.s / ticker.d)
	Stream string `json:"stream"`
	// The list of feeds unsubscribed from
	Unsubs []string `json:"unsubs"`
}

WSUnsubscribeResult Returns a confirmation of all unsubscribes

func (*WSUnsubscribeResult) UnmarshalJSON

func (v *WSUnsubscribeResult) UnmarshalJSON(data []byte) error

type WSWithdrawalFeedDataV1

type WSWithdrawalFeedDataV1 struct {
	// The websocket channel to which the response is sent
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// The Withdrawal object
	Feed Withdrawal `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSWithdrawalFeedDataV1 Subscribes to a feed of withdrawal updates.

func (*WSWithdrawalFeedDataV1) UnmarshalJSON

func (v *WSWithdrawalFeedDataV1) UnmarshalJSON(data []byte) error

type WSWithdrawalFeedDataV1Input

type WSWithdrawalFeedDataV1Input struct {
	// The websocket channel to which the response is sent
	Stream string `json:"stream"`
	// Primary selector
	Selector string `json:"selector"`
	// A sequence number used to determine message order within a stream.
	SequenceNumber uint64 `json:"sequence_number,string"`
	// The Withdrawal object
	Feed WithdrawalInput `json:"feed"`
	// The previous sequence number that determines the message order
	PrevSequenceNumber uint64 `json:"prev_sequence_number,string"`
}

WSWithdrawalFeedDataV1Input Subscribes to a feed of withdrawal updates.

func (*WSWithdrawalFeedDataV1Input) UnmarshalJSON

func (v *WSWithdrawalFeedDataV1Input) UnmarshalJSON(data []byte) error

type WSWithdrawalFeedSelectorV1

type WSWithdrawalFeedSelectorV1 struct {
	// The main account ID to request for
	MainAccountID string `json:"main_account_id"`
}

WSWithdrawalFeedSelectorV1 Subscribes to a feed of withdrawals. This will execute when there is any withdrawal from the selected account.

func (*WSWithdrawalFeedSelectorV1) UnmarshalJSON

func (v *WSWithdrawalFeedSelectorV1) UnmarshalJSON(data []byte) error

type WalletType

type WalletType string

WalletType is a wire enum.

const (
	// WalletTypeFunding Funding wallet
	WalletTypeFunding WalletType = "FUNDING"
	// WalletTypeSpot Spot wallet
	WalletTypeSpot WalletType = "SPOT"
	// WalletTypeFutures Futures wallet
	WalletTypeFutures WalletType = "FUTURES"
)

func (WalletType) Code

func (e WalletType) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (WalletType) String

func (e WalletType) String() string

String returns the wire value.

type Withdrawal

type Withdrawal struct {
	// The subaccount to withdraw from
	FromAccountID string `json:"from_account_id"`
	// The ethereum address to withdraw to
	ToEthAddress string `json:"to_eth_address"`
	// The token currency to withdraw
	Currency string `json:"currency"`
	// The number of tokens to withdraw
	NumTokens Decimal `json:"num_tokens"`
	// The signature of the withdrawal
	Signature Signature `json:"signature"`
}

Withdrawal is a wire type.

func (*Withdrawal) UnmarshalJSON

func (v *Withdrawal) UnmarshalJSON(data []byte) error

type WithdrawalHistory

type WithdrawalHistory struct {
	// The transaction ID of the withdrawal
	TxID uint64 `json:"tx_id,string"`
	// The subaccount to withdraw from
	FromAccountID string `json:"from_account_id"`
	// The ethereum address to withdraw to
	ToEthAddress string `json:"to_eth_address"`
	// The token currency to withdraw
	Currency string `json:"currency"`
	// The number of tokens to withdraw
	NumTokens Decimal `json:"num_tokens"`
	// The signature of the withdrawal
	Signature Signature `json:"signature"`
	// The timestamp of the withdrawal in unix nanoseconds
	EventTime time.Time `json:"event_time"`
	// The finalized withdrawal transaction hash on L1, empty if the withdrawal is 'pending'.
	L1Hash string `json:"l_1_hash,omitempty"`
	// The transaction hash on L2
	L2Hash string `json:"l_2_hash"`
}

WithdrawalHistory is a wire type.

func (WithdrawalHistory) MarshalJSON

func (v WithdrawalHistory) MarshalJSON() ([]byte, error)

func (*WithdrawalHistory) UnmarshalJSON

func (v *WithdrawalHistory) UnmarshalJSON(data []byte) error

type WithdrawalHistoryInput

type WithdrawalHistoryInput struct {
	// The transaction ID of the withdrawal
	TxID uint64 `json:"tx_id,string"`
	// The subaccount to withdraw from
	FromAccountID string `json:"from_account_id"`
	// The ethereum address to withdraw to
	ToEthAddress string `json:"to_eth_address"`
	// The token currency to withdraw
	Currency string `json:"currency"`
	// The number of tokens to withdraw
	NumTokens Decimal `json:"num_tokens"`
	// The signature of the withdrawal
	Signature SignatureInput `json:"signature"`
	// The timestamp of the withdrawal in unix nanoseconds
	EventTime time.Time `json:"event_time"`
	// The finalized withdrawal transaction hash on L1, empty if the withdrawal is 'pending'.
	L1Hash string `json:"l_1_hash,omitempty"`
	// The transaction hash on L2
	L2Hash string `json:"l_2_hash"`
}

WithdrawalHistoryInput is a wire type.

func (WithdrawalHistoryInput) MarshalJSON

func (v WithdrawalHistoryInput) MarshalJSON() ([]byte, error)

func (*WithdrawalHistoryInput) UnmarshalJSON

func (v *WithdrawalHistoryInput) UnmarshalJSON(data []byte) error

type WithdrawalInput

type WithdrawalInput struct {
	// The subaccount to withdraw from
	FromAccountID string `json:"from_account_id"`
	// The ethereum address to withdraw to
	ToEthAddress string `json:"to_eth_address"`
	// The token currency to withdraw
	Currency string `json:"currency"`
	// The number of tokens to withdraw
	NumTokens Decimal `json:"num_tokens"`
	// The signature of the withdrawal
	Signature SignatureInput `json:"signature"`
}

WithdrawalInput is a wire type.

func (*WithdrawalInput) UnmarshalJSON

func (v *WithdrawalInput) UnmarshalJSON(data []byte) error

type WsCandlestickInterval

type WsCandlestickInterval string

WsCandlestickInterval is a wire enum.

const (
	// WsCandlestickIntervalCi1M 1 minute
	WsCandlestickIntervalCi1M WsCandlestickInterval = "CI_1_M"
	// WsCandlestickIntervalCi3M 3 minutes
	WsCandlestickIntervalCi3M WsCandlestickInterval = "CI_3_M"
	// WsCandlestickIntervalCi5M 5 minutes
	WsCandlestickIntervalCi5M WsCandlestickInterval = "CI_5_M"
	// WsCandlestickIntervalCi15M 15 minutes
	WsCandlestickIntervalCi15M WsCandlestickInterval = "CI_15_M"
	// WsCandlestickIntervalCi30M 30 minutes
	WsCandlestickIntervalCi30M WsCandlestickInterval = "CI_30_M"
	// WsCandlestickIntervalCi1H 1 hour
	WsCandlestickIntervalCi1H WsCandlestickInterval = "CI_1_H"
	// WsCandlestickIntervalCi2H 2 hour
	WsCandlestickIntervalCi2H WsCandlestickInterval = "CI_2_H"
	// WsCandlestickIntervalCi4H 4 hour
	WsCandlestickIntervalCi4H WsCandlestickInterval = "CI_4_H"
	// WsCandlestickIntervalCi6H 6 hour
	WsCandlestickIntervalCi6H WsCandlestickInterval = "CI_6_H"
	// WsCandlestickIntervalCi8H 8 hour
	WsCandlestickIntervalCi8H WsCandlestickInterval = "CI_8_H"
	// WsCandlestickIntervalCi12H 12 hour
	WsCandlestickIntervalCi12H WsCandlestickInterval = "CI_12_H"
	// WsCandlestickIntervalCi1D 1 day
	WsCandlestickIntervalCi1D WsCandlestickInterval = "CI_1_D"
	// WsCandlestickIntervalCi3D 3 days
	WsCandlestickIntervalCi3D WsCandlestickInterval = "CI_3_D"
	// WsCandlestickIntervalCi5D 5 days
	WsCandlestickIntervalCi5D WsCandlestickInterval = "CI_5_D"
	// WsCandlestickIntervalCi1W 1 week from Thursday
	WsCandlestickIntervalCi1W WsCandlestickInterval = "CI_1_W"
	// WsCandlestickIntervalCi2W 2 weeks from Thursday
	WsCandlestickIntervalCi2W WsCandlestickInterval = "CI_2_W"
	// WsCandlestickIntervalCi3W 3 weeks from Thursday
	WsCandlestickIntervalCi3W WsCandlestickInterval = "CI_3_W"
	// WsCandlestickIntervalCi4W 4 weeks from Thursday
	WsCandlestickIntervalCi4W WsCandlestickInterval = "CI_4_W"
)

func (WsCandlestickInterval) Code

func (e WsCandlestickInterval) Code() (int64, bool)

Code is the integer used when signing; false for a value this SDK does not know.

func (WsCandlestickInterval) String

func (e WsCandlestickInterval) String() string

String returns the wire value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL