model

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EvmNetworkFamily    = "NETWORK_FAMILY_EVM"
	SolanaNetworkFamily = "NETWORK_FAMILY_SOLANA"
)

Network family constants

View Source
const (
	BalanceTypeTrading = "TRADING_BALANCES"
	BalanceTypeVault   = "VAULT_BALANCES"
	BalanceTypeTotal   = "TOTAL_BALANCES"
)
View Source
const (
	OrderTypeMarket = "MARKET"
	OrderTypeLimit  = "LIMIT"
	OrderTypeTwap   = "TWAP"
	OrderTypeBlock  = "BLOCK"
)

Order type constants

View Source
const (
	TimeInForceGoodUntilTime      = "GOOD_UNTIL_DATE_TIME"
	TimeInForceGoodUntilCancelled = "GOOD_UNTIL_CANCELLED"
	TimeInForceImmediateOrCancel  = "IMMEDIATE_OR_CANCEL"
)

Time in force constants

View Source
const (
	WalletTypeVault   = "VAULT"
	WalletTypeTrading = "TRADING"
	WalletTypeOnchain = "ONCHAIN"
	WalletTypeOther   = "WALLET_TYPE_OTHER"
)

Wallet type constants

View Source
const (
	WalletDepositTypeWire   = "WIRE"
	WalletDepositTypeSwift  = "SWIFT"
	WalletDepositTypeCrypto = "CRYPTO"
)

Wallet deposit type constants

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountMetadata

type AccountMetadata struct {
	Consensus *Consensus `json:"consensus"`
}

type Accrual

type Accrual struct {
	// The accrual ID
	AccrualId string `json:"accrual_id,omitempty"`

	// The date of accrual in UTC
	Date string `json:"date,omitempty"`

	// The unique ID of the portfolio
	PortfolioId string `json:"portfolio_id,omitempty"`

	// The currency symbol
	Symbol string `json:"symbol,omitempty"`

	// The loan type
	LoanType *LoanType `json:"loan_type,omitempty"`

	// The daily or annualized interest rate for the loan, see rate_type
	InterestRate string `json:"interest_rate,omitempty"`

	// Daily accrual amount in the principal currency
	NominalAccrual string `json:"nominal_accrual,omitempty"`

	// Daily USD accrued interest
	NotionalAccrual string `json:"notional_accrual,omitempty"`

	// Accrual rate used to convert from principal to USD accrual
	ConversionRate string `json:"conversion_rate,omitempty"`

	// Outstanding principal of the loan
	LoanAmount string `json:"loan_amount,omitempty"`

	// Benchmark information
	Benchmark Benchmark `json:"benchmark,omitempty"`

	// Daily interest rate fetched from the benchmark source
	BenchmarkRate string `json:"benchmark_rate,omitempty"`

	// Daily spread offset from the benchmark rate
	Spread string `json:"spread,omitempty"`

	// The rate type
	RateType RateType `json:"rate_type,omitempty"`

	// Outstanding principal of the loan in USD
	LoanAmountNotional string `json:"loan_amount_notional,omitempty"`

	// Settled open borrow as of start-of-day in the principal currency
	NominalOpenBorrowSod string `json:"nominal_open_borrow_sod,omitempty"`

	// Settled open borrow as of start-of-day in USD
	NotionalOpenBorrowSod string `json:"notional_open_borrow_sod,omitempty"`
}

type ActiveLiquidationSummary

type ActiveLiquidationSummary struct {
	LiquidationId   string              `json:"liquidation_id"`
	Status          XMLiquidationStatus `json:"status"`
	ShortfallAmount string              `json:"shortfall_amount"`
}

ActiveLiquidationSummary provides a summary of the active or most recent XM liquidation.

type Activity

type Activity struct {
	Id                  string                `json:"id"`
	ReferenceId         string                `json:"reference_id"`
	Category            string                `json:"category"`
	PrimaryType         string                `json:"type"`
	SecondaryType       string                `json:"secondary_type"`
	Status              string                `json:"status"`
	CreatedBy           string                `json:"created_by"`
	Title               string                `json:"title"`
	Description         string                `json:"description"`
	UserActions         []*UserAction         `json:"user_actions,omitempty"`
	AccountMetadata     *AccountMetadata      `json:"account_metadata,omitempty"`
	OrdersMetadata      *OrdersMetadata       `json:"orders_metadata,omitempty"`
	TransactionMetadata *TransactionsMetadata `json:"transaction_metadata,omitempty"`
	Symbols             []string              `json:"symbols,omitempty"`
	Created             string                `json:"created_at"`
	Updated             string                `json:"updated_at"`
}

type AddressBookEntry

type AddressBookEntry struct {
	Id                    string                   `json:"id"`
	Symbol                string                   `json:"currency_symbol"`
	Name                  string                   `json:"name"`
	Address               string                   `json:"address"`
	AccountIdentifier     string                   `json:"account_identifier"`
	AccountIdentifierName string                   `json:"account_identifier_name"`
	State                 string                   `json:"state"`
	ExplorerLink          string                   `json:"explorer_link"`
	LastUsed              time.Time                `json:"last_used_at"`
	Added                 time.Time                `json:"added_at"`
	AddedBy               *AddressBookEntryAddedBy `json:"added_by"`
	Type                  AddressBookType          `json:"type,omitempty"`
	CounterpartyId        string                   `json:"counterparty_id,omitempty"`
}

type AddressBookEntryAddedBy

type AddressBookEntryAddedBy struct {
	Id        string `json:"id"`
	Name      string `json:"name"`
	AvatarUrl string `json:"avatar_url"`
}

type AddressBookType

type AddressBookType string
const (
	AddressBookTypeUnspecified    AddressBookType = "ADDRESS_BOOK_TYPE_UNSPECIFIED"
	AddressBookTypeAddress        AddressBookType = "ADDRESS_BOOK_TYPE_ADDRESS"
	AddressBookTypeCounterpartyId AddressBookType = "ADDRESS_BOOK_TYPE_COUNTERPARTY_ID"
)

type AdvancedTransfer

type AdvancedTransfer struct {
	Id                 string                `json:"id,omitempty"`
	Type               AdvancedTransferType  `json:"type,omitempty"`
	State              AdvancedTransferState `json:"state,omitempty"`
	FundMovements      []*FundMovement       `json:"fund_movements,omitempty"`
	BlindMatchMetadata *BlindMatchMetadata   `json:"blind_match_metadata,omitempty"`
}

AdvancedTransfer represents a complex transfer operation such as a blind match settlement.

type AdvancedTransferState

type AdvancedTransferState string

AdvancedTransferState represents the lifecycle state of an advanced transfer.

const (
	AdvancedTransferStateCreated    AdvancedTransferState = "ADVANCED_TRANSFER_STATE_CREATED"
	AdvancedTransferStateProcessing AdvancedTransferState = "ADVANCED_TRANSFER_STATE_PROCESSING"
	AdvancedTransferStateDone       AdvancedTransferState = "ADVANCED_TRANSFER_STATE_DONE"
	AdvancedTransferStateCancelled  AdvancedTransferState = "ADVANCED_TRANSFER_STATE_CANCELLED"
	AdvancedTransferStateFailed     AdvancedTransferState = "ADVANCED_TRANSFER_STATE_FAILED"
	AdvancedTransferStateExpired    AdvancedTransferState = "ADVANCED_TRANSFER_STATE_EXPIRED"
)

type AdvancedTransferType

type AdvancedTransferType string

AdvancedTransferType specifies the type of advanced transfer.

const (
	AdvancedTransferTypeBlindMatch AdvancedTransferType = "ADVANCED_TRANSFER_TYPE_BLIND_MATCH"
)

type AggregationType

type AggregationType string
const (
	AggregationTypeUnknown              AggregationType = "UNKNOWN_BALANCE_TYPE"
	AggregationTypeTradingBalances      AggregationType = "TRADING_BALANCES"
	AggregationTypeVaultBalances        AggregationType = "VAULT_BALANCES"
	AggregationTypeTotalBalances        AggregationType = "TOTAL_BALANCES"
	AggregationTypePrimeCustodyBalances AggregationType = "PRIME_CUSTODY_BALANCES"
	AggregationTypeUnifiedTotalBalances AggregationType = "UNIFIED_TOTAL_BALANCES"
)

type Allocation

type Allocation struct {
	RootId        string                   `json:"root_id"`
	ReversalId    string                   `json:"reversal_id"`
	Completed     string                   `json:"allocation_completed_at"`
	UserId        string                   `json:"user_id"`
	ProductId     string                   `json:"product_id"`
	Side          string                   `json:"side"`
	AvgPrice      string                   `json:"avg_price"`
	BaseQuantity  string                   `json:"base_quantity"`
	QuoteValue    string                   `json:"quote_value"`
	FeesAllocated string                   `json:"fees_allocated"`
	Status        string                   `json:"status"`
	Source        string                   `json:"source"`
	OrderIds      []string                 `json:"order_ids"`
	Destinations  []*AllocationDestination `json:"destinations"`
}

type AllocationDestination

type AllocationDestination struct {
	LegId             string `json:"leg_id"`
	SourcePortfolioId string `json:"portfolio_id"`
	AllocationBase    string `json:"allocation_base"`
	AllocationQuote   string `json:"allocation_quote"`
	FeesAllocatedLeg  string `json:"fees_allocated_leg"`
}

type AllocationLeg

type AllocationLeg struct {
	LegId                  string `json:"allocation_leg_id"`
	DestinationPortfolioId string `json:"destination_portfolio_id"`
	Amount                 string `json:"amount"`
}

type AmountDue

type AmountDue struct {
	// The currency this loan is due in
	Currency string `json:"currency,omitempty"`

	// The amount due
	Amount string `json:"amount,omitempty"`

	// The date this settlement is due, expressed in UTC
	DueDate string `json:"due_date,omitempty"`
}

type Asset

type Asset struct {
	Name             string     `json:"name"`
	Symbol           string     `json:"symbol"`
	DecimalPrecision string     `json:"decimal_precision"`
	TradingSupported bool       `json:"trading_supported"`
	ExplorerUrl      string     `json:"explorer_url"`
	Networks         []*Network `json:"networks"`
}

Asset represents a Prime asset

type AssetBalance

type AssetBalance struct {
	// The unique ID of the portfolio
	PortfolioId string `json:"portfolio_id,omitempty"`

	// The currency symbol
	Symbol string `json:"symbol,omitempty"`

	// Balance amount
	Amount string `json:"amount,omitempty"`

	// Notional balance amount
	NotionalAmount string `json:"notional_amount,omitempty"`

	// Conversion rate
	ConversionRate string `json:"conversion_rate,omitempty"`
}

type AssetChange

type AssetChange struct {
	Type       AssetChangeType `json:"type,omitempty"`
	Symbol     string          `json:"symbol,omitempty"`
	Amount     string          `json:"amount,omitempty"`
	Collection *NFTCollection  `json:"collection,omitempty"`
	Item       *NFTItem        `json:"item,omitempty"`
}

AssetChange represents a change in asset for a transaction

type AssetChangeType

type AssetChangeType string

AssetChangeType represents the type of asset change

const (
	AssetChangeTypeBalanceTransfer AssetChangeType = "BALANCE_TRANSFER"
	AssetChangeTypeBalanceApproval AssetChangeType = "BALANCE_APPROVAL"
	AssetChangeTypeItemTransfer    AssetChangeType = "ITEM_TRANSFER"
	AssetChangeTypeItemApproval    AssetChangeType = "ITEM_APPROVAL"
	AssetChangeTypeItemApprovalAll AssetChangeType = "ITEM_APPROVAL_ALL"
)

type Balance

type Balance struct {
	Symbol               string `json:"symbol"`
	Amount               string `json:"amount"`
	Holds                string `json:"holds"`
	BondedAmount         string `json:"bonded_amount"`
	ReservedAmount       string `json:"reserved_amount"`
	UnbondingAmount      string `json:"unbonding_amount"`
	UnvestedAmount       string `json:"unvested_amount"`
	PendingRewardsAmount string `json:"pending_rewards_amount"`
	PastRewardsAmount    string `json:"past_rewards_amount"`
	BondableAmount       string `json:"bondable_amount"`
	WithdrawableAmount   string `json:"withdrawable_amount"`
}

func (Balance) AmountNum

func (b Balance) AmountNum() (amount decimal.Decimal, err error)

func (Balance) HoldsNum

func (b Balance) HoldsNum() (holds decimal.Decimal, err error)

type BalanceWithHolds

type BalanceWithHolds struct {
	Total string `json:"total"`
	Holds string `json:"holds"`
}

type Benchmark

type Benchmark string
const (
	BenchmarkUnset     Benchmark = "BENCHMARK_UNSET"
	BenchmarkZero      Benchmark = "ZERO"
	BenchmarkSofr360   Benchmark = "SOFR_360"
	BenchmarkSofr365   Benchmark = "SOFR_365"
	BenchmarkCryptoRfr Benchmark = "CRYPTO_RFR"
)

type BlindMatchMetadata

type BlindMatchMetadata struct {
	ReferenceId    string `json:"reference_id,omitempty"`
	SettlementDate string `json:"settlement_date,omitempty"`
	TradeDate      string `json:"trade_date,omitempty"`
	SettlementTime string `json:"settlement_time,omitempty"`
}

BlindMatchMetadata contains metadata specific to blind match advanced transfers.

type BlockchainAddress

type BlockchainAddress struct {
	Address           string          `json:"address"`
	AccountIdentifier string          `json:"account_identifier"`
	Network           *NetworkDetails `json:"network"`
}

BlockchainAddress represents a blockchain address

type BuyingPower

type BuyingPower struct {
	// The unique ID of the portfolio
	PortfolioId string `json:"portfolio_id,omitempty"`

	// The symbol for the base currency
	BaseCurrency string `json:"base_currency,omitempty"`

	// The symbol for the quote currency
	QuoteCurrency string `json:"quote_currency,omitempty"`

	// The buying power for the base currency
	BaseBuyingPower string `json:"base_buying_power,omitempty"`

	// The buying power for the quote currency
	QuoteBuyingPower string `json:"quote_buying_power,omitempty"`
}

type Candle

type Candle struct {
	Timestamp string `json:"timestamp"`
	Open      string `json:"open"`
	High      string `json:"high"`
	Low       string `json:"low"`
	Close     string `json:"close"`
	Volume    string `json:"volume"`
}

type CandleGranularity

type CandleGranularity string
const (
	CandleGranularityOneMinute      CandleGranularity = "ONE_MINUTE"
	CandleGranularityFiveMinutes    CandleGranularity = "FIVE_MINUTES"
	CandleGranularityFifteenMinutes CandleGranularity = "FIFTEEN_MINUTES"
	CandleGranularityThirtyMinutes  CandleGranularity = "THIRTY_MINUTES"
	CandleGranularityOneHour        CandleGranularity = "ONE_HOUR"
	CandleGranularityTwoHours       CandleGranularity = "TWO_HOURS"
	CandleGranularityFourHours      CandleGranularity = "FOUR_HOURS"
	CandleGranularitySixHours       CandleGranularity = "SIX_HOURS"
	CandleGranularityOneDay         CandleGranularity = "ONE_DAY"
)

type Commission

type Commission struct {
	Type          string `json:"type"`
	Rate          string `json:"rate"`
	TradingVolume string `json:"trading_volume"`
}

Commission represents commission information

func (Commission) RateNum

func (p Commission) RateNum() (rate decimal.Decimal, err error)

RateNum converts the commission rate string to a decimal

type CommissionDetailTotal

type CommissionDetailTotal struct {
	TotalCommission      string `json:"total_commission,omitempty"`
	ClientCommission     string `json:"client_commission,omitempty"`
	VenueCommission      string `json:"venue_commission,omitempty"`
	CesCommission        string `json:"ces_commission,omitempty"`
	FinancingCommission  string `json:"financing_commission,omitempty"`
	RegulatoryCommission string `json:"regulatory_commission,omitempty"`
	ClearingCommission   string `json:"clearing_commission,omitempty"`
}

CommissionDetailTotal contains a breakdown of all commission charges for an order or fill.

type Consensus

type Consensus struct {
	ApprovalDeadline string `json:"approval_deadline"`
	PassedConsensus  bool   `json:"has_passed_consensus"`
}

type ContractExpiryType

type ContractExpiryType string

ContractExpiryType represents the expiry type of a futures contract.

const (
	ContractExpiryTypeUnspecified ContractExpiryType = "CONTRACT_EXPIRY_TYPE_UNSPECIFIED"
	ContractExpiryTypeExpiring    ContractExpiryType = "CONTRACT_EXPIRY_TYPE_EXPIRING"
	ContractExpiryTypePerpetual   ContractExpiryType = "CONTRACT_EXPIRY_TYPE_PERPETUAL"
)

type Conversion

type Conversion struct {
	// Conversion details
	ConversionDetails []*ConversionDetail `json:"conversion_details,omitempty"`

	// Short collateral
	ShortCollateral *ShortCollateral `json:"short_collateral,omitempty"`

	// The UTC date time used for conversion
	ConversionDatetime string `json:"conversion_datetime,omitempty"`

	// Portfolio ID
	PortfolioId string `json:"portfolio_id,omitempty"`
}

type ConversionDetail

type ConversionDetail struct {
	// The currency symbol
	Symbol string `json:"symbol,omitempty"`

	// Trade finance balance after the conversion
	TfBalance string `json:"tf_balance,omitempty"`

	// Notional trade finance balance after the conversion
	NotionalTfBalance string `json:"notional_tf_balance,omitempty"`

	// Converted balance
	ConvertedBalance string `json:"converted_balance,omitempty"`

	// Notional converted balance
	NotionalConvertedBalance string `json:"notional_converted_balance,omitempty"`

	// Interest rate
	InterestRate string `json:"interest_rate,omitempty"`

	// Conversion rate
	ConversionRate string `json:"conversion_rate,omitempty"`
}

type Counterparty

type Counterparty struct {
	CounterpartyId string `json:"counterparty_id"`
}

Counterparty represents a counterparty for a portfolio

type CounterpartyDestination added in v0.9.0

type CounterpartyDestination struct {
	CounterpartyId string `json:"counterparty_id,omitempty"`
}

CounterpartyDestination represents a destination for a counterparty payment.

type CrossMarginOverview

type CrossMarginOverview struct {
	ControlStatus     XMControlStatus           `json:"control_status"`
	CallStatus        XMEntityCallStatus        `json:"call_status"`
	MarginLevel       XMMarginLevel             `json:"margin_level"`
	MarginSummary     *XMSummary                `json:"margin_summary"`
	ActiveMarginCalls []*XMMarginCall           `json:"active_margin_calls"`
	ActiveLoans       []*XMLoan                 `json:"active_loans"`
	ActiveLiquidation *ActiveLiquidationSummary `json:"active_liquidation,omitempty"`
}

CrossMarginOverview represents the Cross Margin overview for an entity

type CrossMarginPrimeDerivativesEquityBreakdown

type CrossMarginPrimeDerivativesEquityBreakdown struct {
	CashBalance       string `json:"cash_balance,omitempty"`
	UnrealizedPnl     string `json:"unrealized_pnl,omitempty"`
	RealizedPnl       string `json:"realized_pnl,omitempty"`
	AccruedFundingPnl string `json:"accrued_funding_pnl,omitempty"`
}

CrossMarginPrimeDerivativesEquityBreakdown breaks down the components of derivatives equity.

type CrossMarginPrimeMarginSummary

type CrossMarginPrimeMarginSummary struct {
	MarginRequirement          string                                      `json:"margin_requirement,omitempty"`
	MarginRequirementType      PrimeXMMarginRequirementType                `json:"margin_requirement_type,omitempty"`
	AccountEquity              string                                      `json:"account_equity,omitempty"`
	MarginExcessShortfall      string                                      `json:"margin_excess_shortfall,omitempty"`
	ConsumedCredit             string                                      `json:"consumed_credit,omitempty"`
	XmCreditLimit              string                                      `json:"xm_credit_limit,omitempty"`
	XmMarginLimit              string                                      `json:"xm_margin_limit,omitempty"`
	ConsumedMarginLimit        string                                      `json:"consumed_margin_limit,omitempty"`
	SpotEquity                 string                                      `json:"spot_equity,omitempty"`
	FuturesEquity              string                                      `json:"futures_equity,omitempty"`
	GrossMarketValue           string                                      `json:"gross_market_value,omitempty"`
	NetMarketValue             string                                      `json:"net_market_value,omitempty"`
	NetExposure                string                                      `json:"net_exposure,omitempty"`
	GrossLeverage              string                                      `json:"gross_leverage,omitempty"`
	SpotEquityBreakdown        *CrossMarginPrimeSpotEquityBreakdown        `json:"spot_equity_breakdown,omitempty"`
	DerivativesEquityBreakdown *CrossMarginPrimeDerivativesEquityBreakdown `json:"derivatives_equity_breakdown,omitempty"`
	RiskNettingInfo            *CrossMarginPrimeRiskNettingInfo            `json:"risk_netting_info,omitempty"`
	HealthStatus               PrimeXMHealthStatus                         `json:"health_status,omitempty"`
	EquityRatio                string                                      `json:"equity_ratio,omitempty"`
	DeficitRatio               string                                      `json:"deficit_ratio,omitempty"`
	MarginThresholds           *PrimeXMMarginCallThresholds                `json:"margin_thresholds,omitempty"`
	FcmExcessAvailableToReturn string                                      `json:"fcm_excess_available_to_return,omitempty"`
}

CrossMarginPrimeMarginSummary is the cross-margin account summary returned by GetCrossMarginPrimeOverview.

type CrossMarginPrimeRiskNettingInfo

type CrossMarginPrimeRiskNettingInfo struct {
	DcoMarginRequirement                           string                             `json:"dco_margin_requirement,omitempty"`
	PortfolioMarginRequirement                     string                             `json:"portfolio_margin_requirement,omitempty"`
	IntegratedPortfolioMarginRequirement           string                             `json:"integrated_portfolio_margin_requirement,omitempty"`
	IneligibleFuturesMarginRequirement             string                             `json:"ineligible_futures_margin_requirement,omitempty"`
	PmrBreakdown                                   *PrimeXMMarginRequirementBreakdown `json:"pmr_breakdown,omitempty"`
	IpmrBreakdown                                  *PrimeXMMarginRequirementBreakdown `json:"ipmr_breakdown,omitempty"`
	PortfolioMarginOffsetCreditBreakdown           *PrimeXMOffsetCreditBreakdown      `json:"portfolio_margin_offset_credit_breakdown,omitempty"`
	IntegratedPortfolioMarginOffsetCreditBreakdown *PrimeXMOffsetCreditBreakdown      `json:"integrated_portfolio_margin_offset_credit_breakdown,omitempty"`
	XmPositions                                    []*CrossMarginPrimeXMPosition      `json:"xm_positions,omitempty"`
}

CrossMarginPrimeRiskNettingInfo groups XM 2.0 margin requirement components, offset credits, and per-asset rows for the Beta Prime overview.

type CrossMarginPrimeSpotEquityBreakdown

type CrossMarginPrimeSpotEquityBreakdown struct {
	CashBalance      string `json:"cash_balance,omitempty"`
	LongMarketValue  string `json:"long_market_value,omitempty"`
	ShortMarketValue string `json:"short_market_value,omitempty"`
	ShortCollateral  string `json:"short_collateral,omitempty"`
	PendingTransfers string `json:"pending_transfers,omitempty"`
}

CrossMarginPrimeSpotEquityBreakdown breaks down the components of spot equity.

type CrossMarginPrimeXMPosition

type CrossMarginPrimeXMPosition struct {
	Currency               string `json:"currency,omitempty"`
	MarketPrice            string `json:"market_price,omitempty"`
	SpotBalance            string `json:"spot_balance,omitempty"`
	SpotBalanceNotional    string `json:"spot_balance_notional,omitempty"`
	FuturesBalance         string `json:"futures_balance,omitempty"`
	FuturesBalanceNotional string `json:"futures_balance_notional,omitempty"`
	BaseRequirement        string `json:"base_requirement,omitempty"`
	TotalPositionMargin    string `json:"total_position_margin,omitempty"`
	BasisCredit            string `json:"basis_credit,omitempty"`
	FuturesNettedNotional  string `json:"futures_netted_notional,omitempty"`
	FuturesNettingMargin   string `json:"futures_netting_margin,omitempty"`
	LongAmount             string `json:"long_amount,omitempty"`
	ShortAmount            string `json:"short_amount,omitempty"`
	VolatilityAddon        string `json:"volatility_addon,omitempty"`
	LiquidityAddon         string `json:"liquidity_addon,omitempty"`
}

CrossMarginPrimeXMPosition is a single per-asset XM row in the Prime Beta cross-margin model.

type CrossMarginRiskParameters

type CrossMarginRiskParameters struct {
	AssetTier               string `json:"asset_tier,omitempty"`
	BaseRatioLong           string `json:"base_ratio_long,omitempty"`
	BaseRatioShort          string `json:"base_ratio_short,omitempty"`
	VolatilityRateLong      string `json:"volatility_rate_long,omitempty"`
	VolatilityRateShort     string `json:"volatility_rate_short,omitempty"`
	VolatilityLowThreshold  string `json:"volatility_low_threshold,omitempty"`
	VolatilityHighThreshold string `json:"volatility_high_threshold,omitempty"`
	LiquidityALong          string `json:"liquidity_a_long,omitempty"`
	LiquidityAShort         string `json:"liquidity_a_short,omitempty"`
	LiquidityBShort         string `json:"liquidity_b_short,omitempty"`
	LiquidityThreshold      string `json:"liquidity_threshold,omitempty"`
	BasisOffsetCreditRate   string `json:"basis_offset_credit_rate,omitempty"`
}

CrossMarginRiskParameters holds XM 2.0 risk parameters for a single asset tier.

type CryptoDepositInstructions

type CryptoDepositInstructions struct {
	Id                string `json:"id"`
	Name              string `json:"name"`
	Type              string `json:"type"`
	Address           string `json:"address"`
	AccountIdentifier string `json:"account_identifier"`
}

CryptoDepositInstructions represents instructions for crypto deposits

type CustomStablecoinAsset added in v0.9.0

type CustomStablecoinAsset struct {
	Symbol string `json:"symbol,omitempty"`
}

CustomStablecoinAsset contains currency metadata for a custom stablecoin reward program.

type CustomStablecoinRewardDetails added in v0.9.0

type CustomStablecoinRewardDetails struct {
	StartDate string                 `json:"start_date,omitempty"`
	EndDate   string                 `json:"end_date,omitempty"`
	Asset     *CustomStablecoinAsset `json:"asset,omitempty"`
}

CustomStablecoinRewardDetails contains details for a custom stablecoin reward payout.

type DefiBalance

type DefiBalance struct {
	Network     string `json:"network"`
	Protocol    string `json:"protocol"`
	NetUsdValue string `json:"net_usd_value"`
}

type DetailedAddress

type DetailedAddress struct {
	Address1    string `json:"address_1,omitempty"`
	Address2    string `json:"address_2,omitempty"`
	Address3    string `json:"address_3,omitempty"`
	City        string `json:"city,omitempty"`
	State       string `json:"state,omitempty"`
	CountryCode string `json:"country_code,omitempty"`
	PostalCode  string `json:"postal_code,omitempty"`
}

DetailedAddress represents detailed address information

type EditHistory

type EditHistory struct {
	Price            string `json:"price"`
	BaseQuantity     string `json:"base_quantity"`
	QuoteValue       string `json:"quote_value"`
	DisplayBaseSize  string `json:"display_base_size"`
	DisplayQuoteSize string `json:"display_quote_size"`
	StopPrice        string `json:"stop_price"`
	ExpiryTime       string `json:"expiry_time"`
	AcceptTime       string `json:"accept_time"`
	ClientOrderId    string `json:"client_order_id"`
}

EditHistory represents an order edit entry (new format)

type EntityBalance

type EntityBalance struct {
	Symbol        string `json:"symbol"`
	LongAmount    string `json:"long_amount"`
	LongNotional  string `json:"long_notional"`
	ShortAmount   string `json:"short_amount"`
	ShortNotional string `json:"short_notional"`
}

type EntityPaymentMethod

type EntityPaymentMethod struct {
	Id                string `json:"id"`
	Symbol            string `json:"symbol"`
	PaymentMethodType string `json:"payment_method_type"`
	Name              string `json:"name"`
	AccountNumber     string `json:"account_number"`
	BankCode          string `json:"bank_code"`
	BankName          string `json:"bank_name,omitempty"`
	BankName2         string `json:"bank_name_2,omitempty"`
}

EntityPaymentMethod represents a payment method for an entity

type EntityPosition

type EntityPosition struct {
	Symbol            string                  `json:"symbol"`
	Long              string                  `json:"long"`
	Short             string                  `json:"short"`
	PositionReference EntityPositionReference `json:"position_reference"`
}

type EntityPositionReference

type EntityPositionReference struct {
	Id   string                      `json:"id"`
	Type EntityPositionReferenceType `json:"type"`
}

type EntityPositionReferenceType

type EntityPositionReferenceType string
const (
	EntityPositionReferenceTypeUnspecified EntityPositionReferenceType = "POSITION_REFERENCE_TYPE_UNSPECIFIED"
	EntityPositionReferenceTypeEntity      EntityPositionReferenceType = "ENTITY"
	EntityPositionReferenceTypePortfolio   EntityPositionReferenceType = "PORTFOLIO"
)

type ErrorMessage

type ErrorMessage struct {
	Value string `json:"message"`
}

ErrorMessage represents a generic error response

type EstimateType

type EstimateType string

EstimateType represents the type of estimate for unstaking

const (
	EstimateTypeUnspecified EstimateType = "UNSPECIFIED"
	EstimateTypeLive        EstimateType = "LIVE"
	EstimateTypeInterim     EstimateType = "INTERIM"
)

type EstimatedNetworkFees

type EstimatedNetworkFees struct {
	LowerBound string `json:"lower_bound,omitempty"`
	UpperBound string `json:"upper_bound,omitempty"`
}

EstimatedNetworkFees represents estimated network fees for a transaction

type ExpiringContractStatus

type ExpiringContractStatus string

ExpiringContractStatus filters expiring futures by their expiry status.

const (
	ExpiringContractStatusUnexpired ExpiringContractStatus = "EXPIRING_CONTRACT_STATUS_UNEXPIRED"
	ExpiringContractStatusExpired   ExpiringContractStatus = "EXPIRING_CONTRACT_STATUS_EXPIRED"
	ExpiringContractStatusAll       ExpiringContractStatus = "EXPIRING_CONTRACT_STATUS_ALL"
)

type FcmBalance

type FcmBalance struct {
	PortfolioId        string `json:"portfolio_id"`
	CfmUsdBalance      string `json:"cfm_usd_balance"`
	UnrealizedPnl      string `json:"unrealized_pnl"`
	DailyRealizedPnl   string `json:"daily_realized_pnl"`
	ExcessLiquidity    string `json:"excess_liquidity"`
	FuturesBuyingPower string `json:"futures_buying_power"`
	InitialMargin      string `json:"initial_margin"`
	MaintenanceMargin  string `json:"maintenance_margin"`
	ClearingAccountId  string `json:"clearing_account_id"`
}

FcmBalance represents FCM balance information for a portfolio

type FcmMarginCall

type FcmMarginCall struct {
	Type            FcmMarginCallType  `json:"type"`
	State           FcmMarginCallState `json:"state"`
	InitialAmount   string             `json:"initial_amount"`
	RemainingAmount string             `json:"remaining_amount"`
	BusinessDate    string             `json:"business_date"`
	CureDeadline    string             `json:"cure_deadline"`
}

FcmMarginCall represents an FCM margin call

type FcmMarginCallState

type FcmMarginCallState string

FcmMarginCallState represents the state of a margin call

const (
	FcmMarginCallStateUnspecified FcmMarginCallState = "FCM_MARGIN_CALL_STATE_UNSPECIFIED"
	FcmMarginCallStateClosed      FcmMarginCallState = "FCM_MARGIN_CALL_STATE_CLOSED"
	FcmMarginCallStateRolledOver  FcmMarginCallState = "FCM_MARGIN_CALL_STATE_ROLLED_OVER"
	FcmMarginCallStateDefault     FcmMarginCallState = "FCM_MARGIN_CALL_STATE_DEFAULT"
	FcmMarginCallStateOfficial    FcmMarginCallState = "FCM_MARGIN_CALL_STATE_OFFICIAL"
)

type FcmMarginCallType

type FcmMarginCallType string

FcmMarginCallType represents the type of margin call

const (
	FcmMarginCallTypeUnspecified FcmMarginCallType = "FCM_MARGIN_CALL_TYPE_UNSPECIFIED"
	FcmMarginCallTypeUrgent      FcmMarginCallType = "FCM_MARGIN_CALL_TYPE_URGENT"
	FcmMarginCallTypeRegular     FcmMarginCallType = "FCM_MARGIN_CALL_TYPE_REGULAR"
)

type FcmMarginHealthState

type FcmMarginHealthState string

FcmMarginHealthState represents the margin health state of an FCM account.

const (
	FcmMarginHealthStateUnspecified    FcmMarginHealthState = "FCM_MARGIN_HEALTH_STATE_UNSPECIFIED"
	FcmMarginHealthStateHealthy        FcmMarginHealthState = "FCM_MARGIN_HEALTH_STATE_HEALTHY"
	FcmMarginHealthStateRestricted     FcmMarginHealthState = "FCM_MARGIN_HEALTH_STATE_RESTRICTED"
	FcmMarginHealthStatePreLiquidation FcmMarginHealthState = "FCM_MARGIN_HEALTH_STATE_PRE_LIQUIDATION"
	FcmMarginHealthStateLiquidation    FcmMarginHealthState = "FCM_MARGIN_HEALTH_STATE_LIQUIDATION"
)

type FcmPosition

type FcmPosition struct {
	ProductId         string `json:"product_id"`
	Side              string `json:"side"`
	NumberOfContracts string `json:"number_of_contracts"`
	DailyRealizedPnl  string `json:"daily_realized_pnl"`
	UnrealizedPnl     string `json:"unrealized_pnl"`
	CurrentPrice      string `json:"current_price"`
	AvgEntryPrice     string `json:"avg_entry_price"`
	ExpirationTime    string `json:"expiration_time"`
}

FcmPosition represents a futures position

type FcmRiskLimits

type FcmRiskLimits struct {
	CfmRiskLimit                  string `json:"cfm_risk_limit"`
	CfmRiskLimitUtilization       string `json:"cfm_risk_limit_utilization"`
	CfmTotalMargin                string `json:"cfm_total_margin"`
	CfmDeltaOte                   string `json:"cfm_delta_ote"`
	CfmUnsettledRealizedPnl       string `json:"cfm_unsettled_realized_pnl"`
	CfmUnsettledAccruedFundingPnl string `json:"cfm_unsettled_accrued_funding_pnl"`
}

FcmRiskLimits represents FCM risk limits for an entity

type FcmScheduledMaintenance

type FcmScheduledMaintenance struct {
	StartTime string `json:"start_time,omitempty"`
	EndTime   string `json:"end_time,omitempty"`
}

FcmScheduledMaintenance contains scheduled maintenance window information.

type FcmSettings

type FcmSettings struct {
	TargetDerivativesExcess string `json:"target_derivatives_excess"`
}

FcmSettings represents FCM settings for an entity

type FcmSweep

type FcmSweep struct {
	Id              string           `json:"id"`
	RequestedAmount *RequestedAmount `json:"requested_amount"`
	ShouldSweepAll  bool             `json:"should_sweep_all"`
	Status          string           `json:"status"`
	ScheduledTime   string           `json:"scheduled_time"`
}

FcmSweep represents a futures sweep

type FcmTradingSessionClosedReason

type FcmTradingSessionClosedReason string

FcmTradingSessionClosedReason represents the reason for FCM trading session closure.

const (
	FcmTradingSessionClosedReasonUndefined           FcmTradingSessionClosedReason = "FCM_TRADING_SESSION_CLOSED_REASON_UNDEFINED"
	FcmTradingSessionClosedReasonRegularMarketClose  FcmTradingSessionClosedReason = "FCM_TRADING_SESSION_CLOSED_REASON_REGULAR_MARKET_CLOSE"
	FcmTradingSessionClosedReasonExchangeMaintenance FcmTradingSessionClosedReason = "FCM_TRADING_SESSION_CLOSED_REASON_EXCHANGE_MAINTENANCE"
	FcmTradingSessionClosedReasonVendorMaintenance   FcmTradingSessionClosedReason = "FCM_TRADING_SESSION_CLOSED_REASON_VENDOR_MAINTENANCE"
)

type FcmTradingSessionDetails

type FcmTradingSessionDetails struct {
	SessionOpen                  bool                          `json:"session_open"`
	OpenTime                     string                        `json:"open_time,omitempty"`
	CloseTime                    string                        `json:"close_time,omitempty"`
	SessionState                 FcmTradingSessionState        `json:"session_state,omitempty"`
	AfterHoursOrderEntryDisabled bool                          `json:"after_hours_order_entry_disabled"`
	ClosedReason                 FcmTradingSessionClosedReason `json:"closed_reason,omitempty"`
	Maintenance                  *FcmScheduledMaintenance      `json:"maintenance,omitempty"`
	SettlementTimestamp          string                        `json:"settlement_timestamp,omitempty"`
	SettlementPrice              string                        `json:"settlement_price,omitempty"`
}

FcmTradingSessionDetails contains trading session details for FCM products.

type FcmTradingSessionState

type FcmTradingSessionState string

FcmTradingSessionState represents the current state of an FCM trading session.

const (
	FcmTradingSessionStateUndefined       FcmTradingSessionState = "FCM_TRADING_SESSION_STATE_UNDEFINED"
	FcmTradingSessionStatePreOpen         FcmTradingSessionState = "FCM_TRADING_SESSION_STATE_PRE_OPEN"
	FcmTradingSessionStatePreOpenNoCancel FcmTradingSessionState = "FCM_TRADING_SESSION_STATE_PRE_OPEN_NO_CANCEL"
	FcmTradingSessionStateOpen            FcmTradingSessionState = "FCM_TRADING_SESSION_STATE_OPEN"
	FcmTradingSessionStateClose           FcmTradingSessionState = "FCM_TRADING_SESSION_STATE_CLOSE"
	FcmTradingSessionStateHalted          FcmTradingSessionState = "FCM_TRADING_SESSION_STATE_HALTED"
)

type FiatDepositInstructions

type FiatDepositInstructions struct {
	Id            string `json:"id"`
	Name          string `json:"name"`
	Type          string `json:"type"`
	AccountNumber string `json:"account_number"`
	RoutingNumber string `json:"routing_number"`
	ReferenceCode string `json:"reference_code"`
}

FiatDepositInstructions represents instructions for fiat deposits

type FundMovement

type FundMovement struct {
	Id       string            `json:"id,omitempty"`
	Source   *TransferLocation `json:"source,omitempty"`
	Target   *TransferLocation `json:"target,omitempty"`
	Currency string            `json:"currency,omitempty"`
	Amount   string            `json:"amount,omitempty"`
}

FundMovement represents a single movement of funds between two counterparties.

type FutureProductDetails

type FutureProductDetails struct {
	ContractCode           string                   `json:"contract_code,omitempty"`
	ContractSize           string                   `json:"contract_size,omitempty"`
	ContractExpiry         string                   `json:"contract_expiry,omitempty"`
	ContractRootUnit       string                   `json:"contract_root_unit,omitempty"`
	ContractExpiryType     ContractExpiryType       `json:"contract_expiry_type,omitempty"`
	RiskManagedBy          RiskManagementType       `json:"risk_managed_by,omitempty"`
	Venue                  string                   `json:"venue,omitempty"`
	GroupDescription       string                   `json:"group_description,omitempty"`
	ContractExpiryTimezone string                   `json:"contract_expiry_timezone,omitempty"`
	GroupShortDescription  string                   `json:"group_short_description,omitempty"`
	PerpetualDetails       *PerpetualProductDetails `json:"perpetual_details,omitempty"`
}

FutureProductDetails contains details specific to futures products.

type Invoice

type Invoice struct {
	Id            string         `json:"id"`
	BillingYear   int32          `json:"billing_year"`
	BillingMonth  int32          `json:"billing_month"`
	DueDate       string         `json:"due_date"`
	InvoiceNumber string         `json:"invoice_number"`
	State         InvoiceState   `json:"state"`
	UsdAmountPaid float64        `json:"usd_amount_paid"`
	UsdAmountOwed float64        `json:"usd_amount_owed"`
	Items         []*InvoiceItem `json:"invoice_items"`
}

type InvoiceItem

type InvoiceItem struct {
	Description    string      `json:"description"`
	CurrencySymbol string      `json:"currency_symbol"`
	InvoiceType    InvoiceType `json:"invoice_type"`
	Rate           float64     `json:"rate"`
	Quantity       float64     `json:"quantity"`
	Price          float64     `json:"price"`
	AverageAuc     float64     `json:"average_auc"`
	Total          float64     `json:"total"`
}

type InvoiceState

type InvoiceState string

InvoiceState represents the state of an invoice

const (
	InvoiceStateUnspecified   InvoiceState = "INVOICE_STATE_UNSPECIFIED"
	InvoiceStateImported      InvoiceState = "INVOICE_STATE_IMPORTED"
	InvoiceStateBilled        InvoiceState = "INVOICE_STATE_BILLED"
	InvoiceStatePartiallyPaid InvoiceState = "INVOICE_STATE_PARTIALLY_PAID"
	InvoiceStatePaid          InvoiceState = "INVOICE_STATE_PAID"
)

type InvoiceType

type InvoiceType string

InvoiceType represents the type of an invoice item

const (
	InvoiceTypeUnspecified   InvoiceType = "INVOICE_TYPE_UNSPECIFIED"
	InvoiceTypeAucFee        InvoiceType = "INVOICE_TYPE_AUC_FEE"
	InvoiceTypeMinimumFee    InvoiceType = "INVOICE_TYPE_MINIMUM_FEE"
	InvoiceTypeWithdrawalFee InvoiceType = "INVOICE_TYPE_WITHDRAWAL_FEE"
	InvoiceTypeNewWalletFee  InvoiceType = "INVOICE_TYPE_NEW_WALLET_FEE"
	InvoiceTypeStakingFee    InvoiceType = "INVOICE_TYPE_STAKING_FEE"
)

type ItemExtractor

type ItemExtractor[R any, I any] func(R) []I

ItemExtractor extracts a slice of items from a response

type LoanInfo

type LoanInfo struct {
	// The unique ID of the portfolio
	PortfolioId string `json:"portfolio_id"`

	// The currency symbol
	Symbol string `json:"symbol"`

	// Balance amount
	Amount string `json:"amount"`

	// Notional balance amount
	NotionalAmount string `json:"notional_amount"`

	// Settlement due date
	DueDate string `json:"due_date"`
}

type LoanType

type LoanType string
const (
	LoanTypeTypeUnspecified     LoanType = "LOAN_TYPE_UNSET"
	LoanTypeBilateralLending    LoanType = "BILATERAL_LENDING"
	LoanTypeTradeFinance        LoanType = "TRADE_FINANCE"
	LoanTypePortfolioMargin     LoanType = "PORTFOLIO_MARGIN"
	LoanTypeShortCollateralLoan LoanType = "SHORT_COLLATERAL_LOAN"
	LoanTypeShortCollateral     LoanType = "SHORT_COLLATERAL"
)

type Locate

type Locate struct {
	// The locate ID
	LocateId string `json:"locate_id,omitempty"`

	// The unique ID of the entity
	EntityId string `json:"entity_id,omitempty"`

	// The unique ID of the portfolio
	PortfolioId string `json:"portfolio_id,omitempty"`

	// The currency symbol
	Symbol string `json:"symbol,omitempty"`

	// The requested locate amount
	RequestedAmount string `json:"requested_amount,omitempty"`

	// The interest rate of PM loan
	InterestRate string `json:"interest_rate,omitempty"`

	// The locate status
	Status string `json:"status,omitempty"`

	// The approved locate amount
	ApprovedAmount string `json:"approved_amount,omitempty"`

	// Deprecated: Use locate_date instead
	ConversionDate string `json:"conversion_date,omitempty"`

	// The date when the locate was submitted in RFC3339 format
	CreatedAt string `json:"created_at,omitempty"`

	// The locate date from the CreateNewLocatesRequest in RFC3339 format
	LocateDate string `json:"locate_date,omitempty"`
}

type LocateAvailability

type LocateAvailability struct {
	// The currency symbol
	Symbol string `json:"symbol"`
	// The available quantity located
	Quantity string `json:"quantity"`
	// The interest rate for located symbol
	Rate string `json:"rate"`
}

type MarginAddOn

type MarginAddOn struct {
	Amount    string          `json:"amount,omitempty"`
	AddOnType MarginAddOnType `json:"add_on_type,omitempty"`
}

MarginAddOn represents a scenario-based margin add-on amount.

type MarginAddOnType

type MarginAddOnType string
const (
	MarginAddOnTypeUnspecified     MarginAddOnType = "MARGIN_ADD_ON_TYPE_UNSPECIFIED"
	MarginAddOnSingleCoinStress    MarginAddOnType = "SINGLE_COIN_STRESS"
	MarginAddOnConcentrationStress MarginAddOnType = "CONCENTRATION_STRESS"
	MarginAddOnMacroStress         MarginAddOnType = "MACRO_STRESS"
	MarginAddOnShortBiasedStress   MarginAddOnType = "SHORT_BIASED_STRESS"
)

type MarginCallRecord

type MarginCallRecord struct {
	// The unique ID of the margin call
	MarginCallId string `json:"margin_call_id"`

	// The initial margin call amount in notional value
	InitialNotionalAmount string `json:"initial_notional_amount"`

	// The outstanding margin call amount in notional value
	OutstandingNotionalAmount string `json:"outstanding_notional_amount"`

	// The time the margin call is created in RFC3339 format
	CreatedAt string `json:"created_at"`

	// The time the margin call is due in RFC3339 format
	DueAt string `json:"due_at"`
}

type MarginInfo

type MarginInfo struct {
	MarginCallRecords []*MarginCallRecord `json:"margin_call_records,omitempty"`
	MarginSummary     *MarginSummary      `json:"margin_summary,omitempty"`
}

type MarginSummary

type MarginSummary struct {
	// The unique ID of the entity
	EntityId string `json:"entity_id,omitempty"`

	// The margin equity at the entity level. Margin Equity = LMV + SMV + Trading Cash Balance + Short Collateral - Pending Withdrawals
	MarginEquity string `json:"margin_equity,omitempty"`

	// USD notional value of required equity in entity portfolios
	MarginRequirement string `json:"margin_requirement,omitempty"`

	// margin_equity - margin_requirement
	ExcessDeficit string `json:"excess_deficit,omitempty"`

	// The raw amount of portfolio margin credit used
	PmCreditConsumed string `json:"pm_credit_consumed,omitempty"`

	// The maximum trade finance credit limit. This field is deprecated and will be removed in the future.
	TfCreditLimit string `json:"tf_credit_limit,omitempty"`

	// The amount of trade finance credit used (USD). This field is deprecated and will be removed in the future.
	TfCreditConsumed string `json:"tf_credit_consumed,omitempty"`

	// TF Asset Adjusted Value (USD). This field is deprecated and will be removed in the future.
	TfAdjustedAssetValue string `json:"tf_adjusted_asset_value,omitempty"`

	// TF Adjusted Liability Value (USD). This field is deprecated and will be removed in the future.
	TfAdjustedLiabilityValue string `json:"tf_adjusted_liability_value,omitempty"`

	// The amount of adjusted credit used. This field is deprecated and will be removed in the future.
	TfAdjustedCreditConsumed string `json:"tf_adjusted_credit_consumed,omitempty"`

	// The amount of adjusted equity. This field is deprecated and will be removed in the future.
	TfAdjustedEquity string `json:"tf_adjusted_equity,omitempty"`

	// Whether or not an entity is frozen due to balance outstanding or other reason
	Frozen bool `json:"frozen,omitempty"`

	// The reason why an entity is frozen
	FrozenReason string `json:"frozen_reason,omitempty"`

	// Whether TF is enabled for the entity. This field is deprecated and will be removed in the future.
	TfEnabled bool `json:"tf_enabled,omitempty"`

	// Whether PM is enabled for the entity
	PmEnabled bool `json:"pm_enabled,omitempty"`

	// Market rates for the list of assets
	MarketRates []*MarketRate `json:"market_rates,omitempty"`

	// Asset Balances across portfolios
	AssetBalances []*AssetBalance `json:"asset_balances,omitempty"`

	// Trade finance debit loan amounts. This field is deprecated and will be removed in the future.
	TfLoans []*LoanInfo `json:"tf_loans,omitempty"`

	// Portfolio Margin debit loan amounts
	PmLoans []*LoanInfo `json:"pm_loans,omitempty"`

	// Short collateral amounts
	ShortCollateral []*LoanInfo `json:"short_collateral,omitempty"`

	// Gross market value (GMV) = LMV + Abs (SMV)
	GrossMarketValue string `json:"gross_market_value,omitempty"`

	// Net Market Value (NMV) = LMV + SMV
	NetMarketValue string `json:"net_market_value,omitempty"`

	// Long Market Value (LMV) = Sum of positive notional for all assets
	LongMarketValue string `json:"long_market_value,omitempty"`

	// Non_Marginable LMV: Sum of positive notional for each non-margin eligible coin
	NonMarginableLongMarketValue string `json:"non_marginable_long_market_value,omitempty"`

	// Short Market Value (SMV) = Sum of negative notional for each margin eligible coin
	ShortMarketValue string `json:"short_market_value,omitempty"`

	// Gross Leverage = GMV / Margin Requirement
	GrossLeverage string `json:"gross_leverage,omitempty"`

	// Net Exposure = (LMV + SMV) / GMV
	NetExposure string `json:"net_exposure,omitempty"`

	// Portfolio stress triggered
	PortfolioStressTriggered MarginAddOnType `json:"portfolio_stress_triggered,omitempty"`

	// PM asset info netted across the entity
	PmAssetInfo []*PmAssetInfo `json:"pm_asset_info,omitempty"`

	// PM limit that monitors gross notional borrowings (crypto + fiat)
	PmCreditLimit string `json:"pm_credit_limit,omitempty"`

	// PM limit that monitors excess deficit
	PmMarginLimit string `json:"pm_margin_limit,omitempty"`

	// The amount of the margin limit that is consumed by the excess deficit
	PmMarginConsumed string `json:"pm_margin_consumed,omitempty"`
}

type MarginSummaryHistorical

type MarginSummaryHistorical struct {
	// The UTC date time used for conversion
	ConversionDatetime string `json:"conversion_datetime,omitempty"`

	// The date used for conversion
	ConversionDate string `json:"conversion_date,omitempty"`

	// The margin summary
	MarginSummary *MarginSummary `json:"margin_summary,omitempty"`
}

type MarketData

type MarketData struct {
	Symbol      string `json:"symbol,omitempty"`
	Vol5d       string `json:"vol_5d,omitempty"`
	Vol30d      string `json:"vol_30d,omitempty"`
	Vol90d      string `json:"vol_90d,omitempty"`
	Adv30d      string `json:"adv_30d,omitempty"`
	WeightedVol string `json:"weighted_vol,omitempty"`
}

MarketData contains volatility and average daily volume data for a single product.

type MarketRate

type MarketRate struct {
	// The currency symbol
	Symbol string `json:"symbol,omitempty"`

	// The current market rate of currency
	Rate string `json:"rate,omitempty"`
}

type MatchMetadata

type MatchMetadata struct {
	ReferenceId    string `json:"reference_id,omitempty"`
	SettlementDate string `json:"settlement_date,omitempty"`
}

MatchMetadata represents metadata for matched transactions

type NFTCollection

type NFTCollection struct {
	Name string `json:"name,omitempty"`
}

NFTCollection represents an NFT collection

type NFTItem

type NFTItem struct {
	Name string `json:"name,omitempty"`
}

NFTItem represents an NFT item

type NaturalPersonName

type NaturalPersonName struct {
	FirstName  string `json:"first_name,omitempty"`
	MiddleName string `json:"middle_name,omitempty"`
	LastName   string `json:"last_name,omitempty"`
}

NaturalPersonName represents natural person name components

type Network

type Network struct {
	Network                *NetworkDetails `json:"network"`
	Name                   string          `json:"name"`
	MaxDecimals            string          `json:"max_decimals"`
	Default                bool            `json:"default"`
	TradingSupported       bool            `json:"trading_supported"`
	VaultSupported         bool            `json:"vault_supported"`
	PrimeCustodySupported  bool            `json:"prime_custody_supported"`
	DestinationTagRequired bool            `json:"destination_tag_required"`
	NetworkLink            string          `json:"network_link"`
	NetworkScopedSymbol    string          `json:"network_scoped_symbol"`
	MinWithdrawalAmount    string          `json:"min_withdrawal_amount"`
	MaxWithdrawalAmount    string          `json:"max_withdrawal_amount"`
	MinDepositAmount       string          `json:"min_deposit_amount"`
}

Network represents network information for an asset

type NetworkDetails

type NetworkDetails struct {
	Id   string `json:"id"`
	Type string `json:"type"`
}

NetworkDetails represents detailed network information

type OnchainActivityType

type OnchainActivityType string
const (
	OnchainActivityTypeUnknown                 OnchainActivityType = "ACTIVITY_TYPE_UNKNOWN"
	OnchainActivityTypeGovernanceVote          OnchainActivityType = "ACTIVITY_TYPE_GOVERNANCE_VOTE"
	OnchainActivityTypeInvitiation             OnchainActivityType = "ACTIVITY_TYPE_INVITATION"
	OnchainActivityTypeWalletChange            OnchainActivityType = "ACTIVITY_TYPE_WALLET_CHANGE"
	OnchainActivityTypeApiKeyChange            OnchainActivityType = "ACTIVITY_TYPE_API_KEY_CHANGE"
	OnchainActivityTypeSettingsChange          OnchainActivityType = "ACTIVITY_TYPE_SETTINGS_CHANGE"
	OnchainActivityTypeBillingPreferenceChange OnchainActivityType = "ACTIVITY_TYPE_BILLING_PREFERENCE_CHANGE"
	OnchainActivityTypePaymentMethodChange     OnchainActivityType = "ACTIVITY_TYPE_PAYMENT_METHOD_CHANGE"
	OnchainActivityTypeWithdrawal              OnchainActivityType = "ACTIVITY_TYPE_WITHDRAWAL"
	OnchainActivityTypeDeposit                 OnchainActivityType = "ACTIVITY_TYPE_DEPOSIT"
	OnchainActivityTypeCreateWallet            OnchainActivityType = "ACTIVITY_TYPE_CREATE_WALLET"
	OnchainActivityTypeRemoveWallet            OnchainActivityType = "ACTIVITY_TYPE_REMOVE_WALLET"
	OnchainActivityTypeUpdateWallet            OnchainActivityType = "ACTIVITY_TYPE_UPDATE_WALLET"
	OnchainActivityTypeCastVote                OnchainActivityType = "ACTIVITY_TYPE_CAST_VOTE"
	OnchainActivityTypeEnableVoting            OnchainActivityType = "ACTIVITY_TYPE_ENABLE_VOTING"
	OnchainActivityTypeStake                   OnchainActivityType = "ACTIVITY_TYPE_STAKE"
	OnchainActivityTypeUnstake                 OnchainActivityType = "ACTIVITY_TYPE_UNSTAKE"
	OnchainActivityTypeChangeValidator         OnchainActivityType = "ACTIVITY_TYPE_CHANGE_VALIDATOR"
	OnchainActivityTypeRestake                 OnchainActivityType = "ACTIVITY_TYPE_RESTAKE"
	OnchainActivityTypeAddressBook             OnchainActivityType = "ACTIVITY_TYPE_ADDRESS_BOOK"
	OnchainActivityTypeTeamMembes              OnchainActivityType = "ACTIVITY_TYPE_TEAM_MEMBERS"
	OnchainActivityTypeBilling                 OnchainActivityType = "ACTIVITY_TYPE_BILLING"
	OnchainActivityTypeSecurity                OnchainActivityType = "ACTIVITY_TYPE_SECURITY"
	OnchainActivityTypeApi                     OnchainActivityType = "ACTIVITY_TYPE_API"
	OnchainActivityTypeSettings                OnchainActivityType = "ACTIVITY_TYPE_SETTINGS"
	OnchainActivityTypeSmartContract           OnchainActivityType = "ACTIVITY_TYPE_SMART_CONTRACT"
	OnchainActivityTypeUserChangeRequestNoPas  OnchainActivityType = "ACTIVITY_TYPE_USER_CHANGE_REQUEST_NO_PAS"
	OnchainActivityTypeWeb3Transaction         OnchainActivityType = "ACTIVITY_TYPE_WEB3_TRANSACTION"
	OnchainActivityTypeWeb3Message             OnchainActivityType = "ACTIVITY_TYPE_WEB3_MESSAGE"
	OnchainActivityTypeClaimRewards            OnchainActivityType = "ACTIVITY_TYPE_CLAIM_REWARDS"
)

type OnchainAddress

type OnchainAddress struct {
	Name     string   `json:"name"`
	Address  string   `json:"address"`
	ChainIds []string `json:"chain_ids"`
}

type OnchainAddressGroup

type OnchainAddressGroup struct {
	Id          string             `json:"id"`
	Name        string             `json:"name"`
	NetworkType OnchainNetworkType `json:"network_type"`
	Addresses   []*OnchainAddress  `json:"addresses"`
	AddedAt     string             `json:"added_at,omitempty"`
}

type OnchainDetail

type OnchainDetail struct {
	SignedTransaction     string          `json:"signed_transaction"`
	RiskAssessment        *RiskAssessment `json:"risk_assessment"`
	ChainId               string          `json:"chain_id"`
	Nonce                 string          `json:"nonce"`
	ReplacedTransactionId string          `json:"replaced_transaction_id"`
	DestinationAddress    string          `json:"destination_address"`
	SkipBroadcast         bool            `json:"skip_broadcast"`
	FailureReason         string          `json:"failure_reason"`
	SigningStatus         string          `json:"signing_status"`
}

OnchainDetail represents on-chain details for a transaction

type OnchainEvmParams

type OnchainEvmParams struct {
	DisableDynamicGas     bool   `json:"disable_dynamic_gas"`
	DisableDynamicNonce   bool   `json:"disable_dynamic_nonce,omitempty"`
	ReplacedTransactionId string `json:"replaced_transaction_id,omitempty"`
	ChainId               string `json:"chain_id"`
}

type OnchainNetworkType

type OnchainNetworkType string
const (
	OnchainNetworkTypeUnspecified OnchainNetworkType = "NETWORK_TYPE_UNSPECIFIED"
	OnchainNetworkTypeEvm         OnchainNetworkType = "NETWORK_TYPE_EVM"
	OnchainNetworkTypeSolana      OnchainNetworkType = "NETWORK_TYPE_SOLANA"
)

type OnchainRpc

type OnchainRpc struct {
	Url           string `json:"url,omitempty"`
	SkipBroadcast bool   `json:"skip_broadcast"`
}

type OnchainTransaction

type OnchainTransaction struct {
	RawUnsignedTransaction string            `json:"raw_unsigned_txn"`
	Rpc                    *OnchainRpc       `json:"rpc,omitempty"`
	EvmParams              *OnchainEvmParams `json:"evm_params,omitempty"`
}

type Order

type Order struct {
	PortfolioId string `json:"portfolio_id"`
	Side        string `json:"side"`

	// A client-generated order ID used for reference purposes (note: order will be rejected if this ID
	// is not unique among all currently active orders)
	ClientOrderId string `json:"client_order_id"`
	ProductId     string `json:"product_id"`
	Type          string `json:"type"`

	// Order size in base asset units (either `base_quantity` or `quote_value` is required)
	BaseQuantity string `json:"base_quantity"`

	// Order size in quote asset units, i.e. the amount the user wants to spend (when buying) or receive (when selling);
	// the quantity in base units will be determined based on the market liquidity and indicated `quote_value` (either
	// `base_quantity` or `quote_value` is required)
	QuoteValue string `json:"quote_value,omitempty"`

	LimitPrice string `json:"limit_price,omitempty"`

	// The start time of the order in UTC (TWAP only)
	StartTime string `json:"start_time,omitempty"`

	// The expiry time of the order in UTC (TWAP and limit GTD only)
	ExpiryTime  string `json:"expiry_time,omitempty"`
	TimeInForce string `json:"time_in_force,omitempty"`

	// An optional self trade prevention id (in the form of a UUID). The value is only honored for certain
	// clients who are permitted to specify a custom self trade prevention id
	StpId string `json:"stp_id,omitempty"`

	// Optionally specify a display size. This is the maximum order size that will show up on venue order books.
	// Specifying a value here effectively makes a LIMIT order into an "iceberg" style order.
	// This property only applies to LIMIT orders and will be ignored for other order types.
	DisplayQuoteSize string `json:"display_quote_size,omitempty"`
	DisplayBaseSize  string `json:"display_base_size,omitempty"`

	// If you pass is_raise_exact = TRUE, you must use quote_value = n where n is the amount you want,
	// so $2000 will then cost you 1 ETH + fee, requiring > 1 ETH
	IsRaiseExact bool `json:"is_raise_exact,omitempty"`

	// Buy Exact order flag. When true, fees for a BUY order sized in quote_value are charged on top of
	// the requested quote_value instead of being carved out of it. Only valid for BUY orders sized in
	// quote_value on SPOT products.
	IsBuyExact bool `json:"is_buy_exact,omitempty"`

	// Used for describe order, create order preview, and list portfolio orders
	Id                    string `json:"id,omitempty"`
	UserId                string `json:"user_id,omitempty"`
	Created               string `json:"created_at,omitempty"`
	FilledQuantity        string `json:"filled_quantity,omitempty"`
	FilledValue           string `json:"filled_value,omitempty"`
	AverageFilledPrice    string `json:"average_filled_price,omitempty"`
	Commission            string `json:"commission,omitempty"`
	ExchangeFee           string `json:"exchange_fee,omitempty"`
	Total                 string `json:"order_total,omitempty"`
	BestBid               string `json:"best_bid,omitempty"`
	BestAsk               string `json:"best_ask,omitempty"`
	Slippage              string `json:"slippage,omitempty"`
	Status                string `json:"status,omitempty"`
	HistoricalPov         string `json:"historical_pov,omitempty"`
	StopPrice             string `json:"stop_price,omitempty"`
	NetAverageFilledPrice string `json:"net_average_filled_price,omitempty"`
	UserContext           string `json:"user_context,omitempty"`
	ClientProductId       string `json:"client_product_id,omitempty"`
	PostOnly              bool   `json:"post_only,omitempty"`
	// Deprecated: Use EditHistory instead
	OrderEditHistory      []*OrderEditHistory    `json:"order_edit_history,omitempty"`
	DisplaySize           string                 `json:"display_size,omitempty"`
	EditHistory           []*EditHistory         `json:"edit_history,omitempty"`
	PegOffsetType         string                 `json:"peg_offset_type,omitempty"`
	Offset                string                 `json:"offset,omitempty"`
	WigLevel              string                 `json:"wig_level,omitempty"`
	ProductType           ProductType            `json:"product_type,omitempty"`
	CommissionDetailTotal *CommissionDetailTotal `json:"commission_detail_total,omitempty"`
}

Order represents a Prime order

type OrderEditHistory

type OrderEditHistory struct {
	Price          string `json:"price"`
	Size           string `json:"size"`
	DisplaySize    string `json:"display_size"`
	StopPrice      string `json:"stop_price"`
	StopLimitPrice string `json:"stop_limit_price"`
	EndTime        string `json:"end_time"`
	AcceptTime     string `json:"accept_time"`
	ClientOrderId  string `json:"client_order_id"`
}

OrderEditHistory represents an order edit entry (deprecated format) Deprecated: Use EditHistory instead

type OrderFill

type OrderFill struct {
	Id                    string                 `json:"id"`
	OrderId               string                 `json:"order_id"`
	Side                  string                 `json:"side"`
	ProductId             string                 `json:"product_id"`
	ClientProductId       string                 `json:"client_product_id"`
	FilledQuantity        string                 `json:"filled_quantity"`
	FilledValue           string                 `json:"filled_value"`
	Price                 string                 `json:"price"`
	Time                  time.Time              `json:"time"`
	Commission            string                 `json:"commission"`
	Venue                 string                 `json:"venue"`
	VenueFees             string                 `json:"venue_fees"`
	CesCommission         string                 `json:"ces_commission"`
	ProductType           ProductType            `json:"product_type,omitempty"`
	CommissionDetailTotal *CommissionDetailTotal `json:"commission_detail_total,omitempty"`
}

OrderFill represents a fill on an order

type OrderSide

type OrderSide string

OrderSide represents the side of an order (buy or sell)

const (
	OrderSideBuy     OrderSide = "BUY"
	OrderSideSell    OrderSide = "SELL"
	OrderSideUnknown OrderSide = "UNKNOWN_ORDER_SIDE"
)

type OrdersMetadata

type OrdersMetadata struct{}

An empty/unimplemented/placeholder object in Prime

type PageIterator

type PageIterator[R PaginatedResponse[R], I any] struct {
	// contains filtered or unexported fields
}

PageIterator provides iteration over paginated responses

func NewPageIterator

func NewPageIterator[R PaginatedResponse[R], I any](
	initial R,
	extractor ItemExtractor[R, I],
) *PageIterator[R, I]

NewPageIterator creates an iterator from an initial response

func NewPageIteratorWithConfig

func NewPageIteratorWithConfig[R PaginatedResponse[R], I any](
	initial R,
	extractor ItemExtractor[R, I],
	config *ServiceConfig,
) *PageIterator[R, I]

NewPageIteratorWithConfig creates an iterator with pagination config

func (*PageIterator[R, I]) Current

func (it *PageIterator[R, I]) Current() R

Current returns the current page response

func (*PageIterator[R, I]) FetchAll

func (it *PageIterator[R, I]) FetchAll(ctx context.Context) ([]I, error)

FetchAll retrieves all items across all pages starting from current page. Respects MaxPages and MaxItems from config if set.

func (*PageIterator[R, I]) ForEach

func (it *PageIterator[R, I]) ForEach(ctx context.Context, fn func(R) error) error

ForEach iterates through all pages starting from current, calling fn for each page. Respects MaxPages from config if set.

func (*PageIterator[R, I]) HasNext

func (it *PageIterator[R, I]) HasNext() bool

HasNext returns true if there are more pages

func (*PageIterator[R, I]) Items

func (it *PageIterator[R, I]) Items() []I

Items returns items from the current page

func (*PageIterator[R, I]) Next

func (it *PageIterator[R, I]) Next(ctx context.Context) (R, error)

Next advances to the next page and returns the new response

func (*PageIterator[R, I]) WithConfig

func (it *PageIterator[R, I]) WithConfig(config *ServiceConfig) *PageIterator[R, I]

WithConfig sets the pagination config and returns the iterator for chaining

type PaginatedResponse

type PaginatedResponse[T any] interface {
	HasNext() bool
	GetNextCursor() string
	Next(ctx context.Context) (T, error)
}

PaginatedResponse is implemented by any response that supports pagination

type Pagination

type Pagination struct {
	NextCursor    string `json:"next_cursor"`
	SortDirection string `json:"sort_direction"`
	HasNext       bool   `json:"has_next"`
}

Pagination represents pagination information in responses

type PaginationMixin

type PaginationMixin struct {
	Pagination *Pagination `json:"pagination"`
}

PaginationMixin provides HasNext and GetNextCursor functionality. Embed this in response structs to avoid duplicating these methods.

func (*PaginationMixin) GetNextCursor

func (m *PaginationMixin) GetNextCursor() string

GetNextCursor returns the cursor for the next page, or empty string if none

func (*PaginationMixin) HasNext

func (m *PaginationMixin) HasNext() bool

HasNext returns true if there are more pages available

type PaginationParams

type PaginationParams struct {
	Cursor        string `json:"cursor"`
	Limit         int32  `json:"limit"`
	SortDirection string `json:"sort_direction"`
}

PaginationParams represents pagination parameters for list requests

func PrepareNextPagination

func PrepareNextPagination(current *PaginationParams, nextCursor string) *PaginationParams

PrepareNextPagination creates pagination params for the next page request. It safely copies existing params (if any) and sets the cursor for the next page.

type PerpetualProductDetails

type PerpetualProductDetails struct {
	OpenInterest   string `json:"open_interest,omitempty"`
	FundingRate    string `json:"funding_rate,omitempty"`
	FundingTime    string `json:"funding_time,omitempty"`
	MaxLeverage    string `json:"max_leverage,omitempty"`
	UnderlyingType string `json:"underlying_type,omitempty"`
}

PerpetualProductDetails contains details specific to perpetual futures products.

type PmAssetInfo

type PmAssetInfo struct {
	// The currency symbol
	Symbol string `json:"symbol,omitempty"`

	// Nominal amount of the currency
	Amount string `json:"amount,omitempty"`

	// Spot price for the currency
	Price string `json:"price,omitempty"`

	// Notional amount of the currency
	NotionalAmount string `json:"notional_amount,omitempty"`

	// Asset tier of the currency
	AssetTier string `json:"asset_tier,omitempty"`

	// Whether the currency is margin eligible
	MarginEligible bool `json:"margin_eligible,omitempty"`

	// Base margin requirement of the currency
	BaseMarginRequirement string `json:"base_margin_requirement,omitempty"`

	// Notional amount of the currency's base margin requirement
	BaseMarginRequirementNotional string `json:"base_margin_requirement_notional,omitempty"`

	// The 30d adv of the currency
	Adv30d string `json:"adv_30d,omitempty"`

	// Historic 5d volatility of the currency
	Hist5dVol string `json:"hist_5d_vol,omitempty"`

	// Historic 30d volatility of the currency
	Hist30dVol string `json:"hist_30d_vol,omitempty"`

	// Historic 90d volatility of the currency
	Hist90dVol string `json:"hist_90d_vol,omitempty"`

	// Volatility margin addon of the currency position
	VolatilityAddon string `json:"volatility_addon,omitempty"`

	// Liquidity margin addon of the currency position
	LiquidityAddon string `json:"liquidity_addon,omitempty"`

	// Total position margin of the currency
	TotalPositionMargin string `json:"total_position_margin,omitempty"`

	// Nominal short position of the currency
	ShortNominal string `json:"short_nominal,omitempty"`

	// Nominal long position of the currency
	LongNominal string `json:"long_nominal,omitempty"`
}

type Portfolio

type Portfolio struct {
	Id             string `json:"id"`
	Name           string `json:"name"`
	EntityId       string `json:"entity_id"`
	EntityName     string `json:"entity_name"`
	OrganizationId string `json:"organization_id"`
}

Portfolio represents a Prime portfolio

type PortfolioStakingMetadata

type PortfolioStakingMetadata struct {
	ExternalId string `json:"external_id,omitempty"`
}

PortfolioStakingMetadata contains optional metadata for portfolio staking operations

type PostTradeCredit

type PostTradeCredit struct {
	Id                     string                      `json:"portfolio_id"`
	Currency               string                      `json:"currency"`
	Limit                  string                      `json:"limit"`
	Utilized               string                      `json:"utilized"`
	Available              string                      `json:"available"`
	Frozen                 bool                        `json:"frozen"`
	AmountsDue             []*PostTradeCreditAmountDue `json:"amounts_due"`
	FrozenReason           string                      `json:"frozen_reason"`
	Enabled                bool                        `json:"enabled"`
	AdjustedCreditUtilized string                      `json:"adjusted_credit_utilized"`
	AdjustedEquity         string                      `json:"adjusted_portfolio_equity"`
}

PostTradeCredit represents post trade credit information for a portfolio

type PostTradeCreditAmountDue

type PostTradeCreditAmountDue struct {
	Currency string    `json:"currency"`
	Amount   string    `json:"amount"`
	DueDate  time.Time `json:"due_date"`
}

PostTradeCreditAmountDue represents an amount due for post trade credit

type PostTradeCreditInfo

type PostTradeCreditInfo struct {
	// The unique ID of the portfolio
	PortfolioId string `json:"portfolio_id,omitempty"`

	// The currency symbol credit is denoted in
	Currency string `json:"currency,omitempty"`

	// The maximum credit limit
	Limit string `json:"limit,omitempty"`

	// The amount of credit used
	Utilized string `json:"utilized,omitempty"`

	// The amount of credit available
	Available string `json:"available,omitempty"`

	// Whether or not a portfolio is frozen due to balance outstanding or other reason
	Frozen bool `json:"frozen,omitempty"`

	// The reason why the portfolio is frozen
	FrozenReason string `json:"frozen_reason,omitempty"`

	// Amounts due
	AmountsDue []*AmountDue `json:"amounts_due,omitempty"`

	// Whether the portfolio has credit enabled
	Enabled bool `json:"enabled,omitempty"`

	// The amount of adjusted credit used
	AdjustedCreditUtilized string `json:"adjusted_credit_utilized,omitempty"`

	// The amount of adjusted portfolio equity
	AdjustedPortfolioEquity string `json:"adjusted_portfolio_equity,omitempty"`
}

type PrimeXMControlStatus

type PrimeXMControlStatus string

PrimeXMControlStatus is the Beta control status for Prime Cross Margin trades and withdrawals.

const (
	PrimeXMControlStatusUnspecified       PrimeXMControlStatus = "XM_CONTROL_STATUS_UNSPECIFIED"
	PrimeXMControlStatusTradesWithdrawals PrimeXMControlStatus = "TRADES_AND_WITHDRAWALS"
	PrimeXMControlStatusTradesOnly        PrimeXMControlStatus = "TRADES_ONLY"
	PrimeXMControlStatusSessionLocked     PrimeXMControlStatus = "SESSION_LOCKED"
)

type PrimeXMHealthStatus

type PrimeXMHealthStatus string

PrimeXMHealthStatus is the Beta health status for Prime Cross Margin.

const (
	PrimeXMHealthStatusHealthy        PrimeXMHealthStatus = "HEALTH_STATUS_HEALTHY"
	PrimeXMHealthStatusWarning        PrimeXMHealthStatus = "HEALTH_STATUS_WARNING"
	PrimeXMHealthStatusCritical       PrimeXMHealthStatus = "HEALTH_STATUS_CRITICAL"
	PrimeXMHealthStatusSuspended      PrimeXMHealthStatus = "HEALTH_STATUS_SUSPENDED"
	PrimeXMHealthStatusRestricted     PrimeXMHealthStatus = "HEALTH_STATUS_RESTRICTED"
	PrimeXMHealthStatusPreLiquidation PrimeXMHealthStatus = "HEALTH_STATUS_PRE_LIQUIDATION"
	PrimeXMHealthStatusLiquidating    PrimeXMHealthStatus = "HEALTH_STATUS_LIQUIDATING"
	PrimeXMHealthStatusInDeficit      PrimeXMHealthStatus = "HEALTH_STATUS_IN_DEFICIT"
)

type PrimeXMMarginCallThresholds

type PrimeXMMarginCallThresholds struct {
	DeficitThreshold     string                    `json:"deficit_threshold,omitempty"`
	WarningThreshold     string                    `json:"warning_threshold,omitempty"`
	CriticalThreshold    string                    `json:"critical_threshold,omitempty"`
	LiquidationThreshold string                    `json:"liquidation_threshold,omitempty"`
	MarginThresholds     []*PrimeXMMarginThreshold `json:"margin_thresholds,omitempty"`
}

PrimeXMMarginCallThresholds holds the threshold values that define each margin level boundary.

type PrimeXMMarginLevel

type PrimeXMMarginLevel string

PrimeXMMarginLevel is the Beta margin level for Prime Cross Margin.

const (
	PrimeXMMarginLevelUnspecified PrimeXMMarginLevel = "XM_MARGIN_LEVEL_UNSPECIFIED"
	PrimeXMMarginLevelHealthy     PrimeXMMarginLevel = "HEALTHY_THRESHOLD"
	PrimeXMMarginLevelWarning     PrimeXMMarginLevel = "WARNING_THRESHOLD"
	PrimeXMMarginLevelUrgent      PrimeXMMarginLevel = "URGENT_MARGIN_CALL_THRESHOLD"
	PrimeXMMarginLevelLiquidation PrimeXMMarginLevel = "LIQUIDATION_THRESHOLD"
	PrimeXMMarginLevelDeficit     PrimeXMMarginLevel = "DEFICIT_THRESHOLD"
)

type PrimeXMMarginRequirementBreakdown

type PrimeXMMarginRequirementBreakdown struct {
	BaseMargin      string `json:"base_margin,omitempty"`
	VolatilityAddon string `json:"volatility_addon,omitempty"`
	LiquidityAddon  string `json:"liquidity_addon,omitempty"`
	OffsetCredit    string `json:"offset_credit,omitempty"`
	FuturesMargin   string `json:"futures_margin,omitempty"`
}

PrimeXMMarginRequirementBreakdown contains the component breakdown of a Prime XM margin requirement.

type PrimeXMMarginRequirementType

type PrimeXMMarginRequirementType string

PrimeXMMarginRequirementType distinguishes the methodology used for the margin requirement in GetCrossMarginPrimeOverview.

const (
	PrimeXMMarginRequirementTypeUnspecified  PrimeXMMarginRequirementType = "MARGIN_REQUIREMENT_TYPE_UNSPECIFIED"
	PrimeXMMarginRequirementTypeDmrPlusPmr   PrimeXMMarginRequirementType = "MARGIN_REQUIREMENT_TYPE_DMR_PLUS_PMR"
	PrimeXMMarginRequirementTypeIpmrPlusIfmr PrimeXMMarginRequirementType = "MARGIN_REQUIREMENT_TYPE_IPMR_PLUS_IFMR"
)

type PrimeXMMarginThreshold

type PrimeXMMarginThreshold struct {
	MarginLevel    PrimeXMMarginLevel         `json:"margin_level,omitempty"`
	ThresholdType  PrimeXMMarginThresholdType `json:"threshold_type,omitempty"`
	ThresholdValue string                     `json:"threshold_value,omitempty"`
}

PrimeXMMarginThreshold pairs a margin level with a specific threshold type and value.

type PrimeXMMarginThresholdType

type PrimeXMMarginThresholdType string

PrimeXMMarginThresholdType identifies whether a threshold is equity-ratio or deficit-ratio based.

const (
	PrimeXMMarginThresholdTypeUnspecified  PrimeXMMarginThresholdType = "MARGIN_THRESHOLD_TYPE_UNSPECIFIED"
	PrimeXMMarginThresholdTypeEquityRatio  PrimeXMMarginThresholdType = "MARGIN_THRESHOLD_EQUITY_RATIO"
	PrimeXMMarginThresholdTypeDeficitRatio PrimeXMMarginThresholdType = "MARGIN_THRESHOLD_DEFICIT_RATIO"
	PrimeXMMarginThresholdTypeNone         PrimeXMMarginThresholdType = "MARGIN_THRESHOLD_NONE"
)

type PrimeXMOffsetCreditBreakdown

type PrimeXMOffsetCreditBreakdown struct {
	BasisCredit      string `json:"basis_credit,omitempty"`
	LongShortCredit  string `json:"long_short_credit,omitempty"`
	LongLongCredit   string `json:"long_long_credit,omitempty"`
	ShortShortCredit string `json:"short_short_credit,omitempty"`
	SameTierCredit   string `json:"same_tier_credit,omitempty"`
	TotalCredit      string `json:"total_credit,omitempty"`
}

PrimeXMOffsetCreditBreakdown breaks down offset credits in the Prime XM model.

type Product

type Product struct {
	Id                       string                    `json:"id"`
	BaseIncrement            string                    `json:"base_increment"`
	QuoteIncrement           string                    `json:"quote_increment"`
	BaseMinSize              string                    `json:"base_min_size"`
	BaseMaxSize              string                    `json:"base_max_size"`
	QuoteMinSize             string                    `json:"quote_min_size"`
	QuoteMaxSize             string                    `json:"quote_max_size"`
	Permissions              []string                  `json:"permissions"`
	PriceIncrement           string                    `json:"price_increment"`
	RfqProductDetails        *RfqProductDetails        `json:"rfq_product_details"`
	ProductType              ProductType               `json:"product_type,omitempty"`
	FcmTradingSessionDetails *FcmTradingSessionDetails `json:"fcm_trading_session_details,omitempty"`
	FutureProductDetails     *FutureProductDetails     `json:"future_product_details,omitempty"`
}

func (Product) BaseIncrementNum

func (p Product) BaseIncrementNum() (amount decimal.Decimal, err error)

func (Product) BaseMaxSizeNum

func (p Product) BaseMaxSizeNum() (amount decimal.Decimal, err error)

func (Product) BaseMinSizeNum

func (p Product) BaseMinSizeNum() (amount decimal.Decimal, err error)

func (Product) QuoteIncrementNum

func (p Product) QuoteIncrementNum() (amount decimal.Decimal, err error)

func (Product) QuoteMaxSizeNum

func (p Product) QuoteMaxSizeNum() (amount decimal.Decimal, err error)

func (Product) QuoteMinSizeNum

func (p Product) QuoteMinSizeNum() (amount decimal.Decimal, err error)

type ProductType

type ProductType string

ProductType represents the general type of product.

const (
	ProductTypeSpot   ProductType = "SPOT"
	ProductTypeFuture ProductType = "FUTURE"
)

type RateType

type RateType string
const (
	RateTypeUnset  RateType = "RATE_TYPE_UNSET"
	RateTypeBps    RateType = "BPS"
	RateTypeApr360 RateType = "APR_360"
	RateTypeApr365 RateType = "APR_365"
	RateTypeApr    RateType = "APR"
)

type RequestedAmount

type RequestedAmount struct {
	Currency string `json:"currency"`
	Amount   string `json:"amount"`
}

RequestedAmount represents a requested amount with currency

type RewardMetadata

type RewardMetadata struct {
	Subtype                       RewardSubtype                  `json:"subtype,omitempty"`
	CustomStablecoinRewardDetails *CustomStablecoinRewardDetails `json:"custom_stablecoin_reward_details,omitempty"`
}

RewardMetadata represents metadata for reward transactions

type RewardSubtype

type RewardSubtype string

RewardSubtype represents the reward subtype

const (
	RewardSubtypeUnknown          RewardSubtype = "REWARD_SUBTYPE_UNKNOWN"
	RewardSubtypeMEV              RewardSubtype = "MEV_REWARD"
	RewardSubtypeInflation        RewardSubtype = "INFLATION_REWARD"
	RewardSubtypeBlock            RewardSubtype = "BLOCK_REWARD"
	RewardSubtypeTransaction      RewardSubtype = "TRANSACTION_REWARD"
	RewardSubtypeStakingFeeRebate RewardSubtype = "STAKING_FEE_REBATE_REWARD"
	RewardSubtypeBuidlDividend    RewardSubtype = "BUIDL_DIVIDEND"
	RewardSubtypeCustomStablecoin RewardSubtype = "CUSTOM_STABLECOIN_REWARD"
)

type RfqProductDetails

type RfqProductDetails struct {
	Tradable     bool   `json:"tradable"`
	MinBaseSize  string `json:"min_base_size"`
	MaxBaseSize  string `json:"max_base_size"`
	MinQuoteSize string `json:"min_quote_size"`
	MaxQuoteSize string `json:"max_quote_size"`
	// Deprecated: Value will be an empty string. Use Min/Max Base/Quote Size instead.
	MinNotionalSize string `json:"min_notional_size"`
	// Deprecated: Value will be an empty string. Use Min/Max Base/Quote Size instead.
	MaxNotionalSize string `json:"max_notional_size"`
}

type RiskAssessment

type RiskAssessment struct {
	ComplianceRiskDetected bool `json:"compliance_risk_detected"`
	SecurityRiskDetected   bool `json:"security_risk_detected"`
}

RiskAssessment represents risk assessment results for a transaction

type RiskManagementType

type RiskManagementType string

RiskManagementType represents how risk is managed for a product.

const (
	RiskManagementTypeUnspecified    RiskManagementType = "RISK_MANAGEMENT_TYPE_UNSPECIFIED"
	RiskManagementTypeManagedByFcm   RiskManagementType = "RISK_MANAGEMENT_TYPE_MANAGED_BY_FCM"
	RiskManagementTypeManagedByVenue RiskManagementType = "RISK_MANAGEMENT_TYPE_MANAGED_BY_VENUE"
)

type SecondaryPermission

type SecondaryPermission string

SecondaryPermission indicates the user's secondary permission.

const (
	SecondaryPermissionVideoApprover SecondaryPermission = "VIDEO_APPROVER"
	SecondaryPermissionTeamApprover  SecondaryPermission = "TEAM_APPROVER"
	SecondaryPermissionWeb3Signer    SecondaryPermission = "WEB3_SIGNER"
)

type ServiceConfig

type ServiceConfig struct {
	// MaxPages is the maximum number of pages to fetch (0 = unlimited)
	MaxPages int
	// MaxItems is the maximum number of items to fetch (0 = unlimited)
	MaxItems int
	// DefaultLimit is the default page size if not specified in the request
	DefaultLimit int32
}

ServiceConfig controls pagination behavior for services

func DefaultServiceConfig

func DefaultServiceConfig() *ServiceConfig

DefaultServiceConfig returns a config with no limits

type ShortCollateral

type ShortCollateral struct {
	// Existing short collateral balance
	OldBalance string `json:"old_balance,omitempty"`

	// New short collateral balance required
	NewBalance string `json:"new_balance,omitempty"`

	// Loan interest rate
	LoanInterestRate string `json:"loan_interest_rate,omitempty"`

	// Collateral interest rate
	CollateralInterestRate string `json:"collateral_interest_rate,omitempty"`
}

type StakeType

type StakeType string

StakeType represents the type of staking operation

const (
	StakeTypeUnspecified    StakeType = "STAKE_TYPE_UNSPECIFIED"
	StakeTypeInitialDeposit StakeType = "STAKE_TYPE_INITIAL_DEPOSIT"
	StakeTypeTopUp          StakeType = "STAKE_TYPE_TOP_UP"
)

type StakingRewardType

type StakingRewardType string

StakingRewardType represents the type of staking reward.

const (
	StakingRewardTypeMevReward         StakingRewardType = "MEV_REWARD"
	StakingRewardTypeInflationReward   StakingRewardType = "INFLATION_REWARD"
	StakingRewardTypeBlockReward       StakingRewardType = "BLOCK_REWARD"
	StakingRewardTypeValidatorReward   StakingRewardType = "VALIDATOR_REWARD"
	StakingRewardTypeTransactionReward StakingRewardType = "TRANSACTION_REWARD"
	StakingRewardTypeStakingFeeRebate  StakingRewardType = "STAKING_FEE_REBATE_REWARD"
	StakingRewardTypeBuildlDividend    StakingRewardType = "BUIDL_DIVIDEND"
)

type StakingStatus

type StakingStatus struct {
	Amount                string    `json:"amount"`
	StakeType             StakeType `json:"stake_type"`
	EstimatedStakeDate    string    `json:"estimated_stake_date"`
	EstimatedHoursToStake int64     `json:"estimated_hours_to_stake"`
	RequestedAt           string    `json:"requested_at"`
}

StakingStatus represents the status of a staking operation

type TFAsset

type TFAsset struct {
	Symbol              string `json:"symbol"`
	AssetAdjustment     string `json:"asset_adjustment"`
	LiabilityAdjustment string `json:"liability_adjustment"`
}

TFAsset represents an asset eligible for Trade Finance

type TierPairRateEntry

type TierPairRateEntry struct {
	TierA string `json:"tier_a,omitempty"`
	TierB string `json:"tier_b,omitempty"`
	Rate  string `json:"rate,omitempty"`
}

TierPairRateEntry represents a single (tier_a, tier_b) → rate entry in an offset credit matrix.

type TieredPricingFee

type TieredPricingFee struct {
	// Asset symbol
	Symbol string `json:"symbol,omitempty"`

	// The fee in bps
	Fee string `json:"fee,omitempty"`
}

type Transaction

type Transaction struct {
	Id                    string                `json:"id"`
	WalletId              string                `json:"wallet_id"`
	PortfolioId           string                `json:"portfolio_id"`
	Type                  string                `json:"type"`
	Status                string                `json:"status"`
	Symbol                string                `json:"symbol"`
	Created               time.Time             `json:"created_at"`
	Completed             time.Time             `json:"completed_at"`
	Amount                string                `json:"amount"`
	TransferFrom          *Transfer             `json:"transfer_from,omitempty"`
	TransferTo            *Transfer             `json:"transfer_to,omitempty"`
	NetworkFees           string                `json:"network_fees"`
	Fees                  string                `json:"fees"`
	FeeSymbol             string                `json:"fee_symbol"`
	BlockchainIds         []string              `json:"blockchain_ids"`
	TransactionId         string                `json:"transaction_id"`
	DestinationSymbol     string                `json:"destination_symbol"`
	EstimatedNetworkFees  *EstimatedNetworkFees `json:"estimated_network_fees,omitempty"`
	Network               string                `json:"network"`
	EstimatedAssetChanges []AssetChange         `json:"estimated_asset_changes"`
	Metadata              *TransactionMetadata  `json:"metadata,omitempty"`
	IdempotencyKey        string                `json:"idempotency_key"`
	OnchainDetails        *OnchainDetail        `json:"onchain_details,omitempty"`
}

Transaction represents a Prime transaction

type TransactionMetadata

type TransactionMetadata struct {
	MatchMetadata           *MatchMetadata           `json:"match_metadata,omitempty"`
	Web3TransactionMetadata *Web3TransactionMetadata `json:"web3_transaction_metadata,omitempty"`
	RewardMetadata          *RewardMetadata          `json:"reward_metadata,omitempty"`
}

TransactionMetadata represents additional metadata for a transaction

type TransactionValidator

type TransactionValidator struct {
	TransactionId    string          `json:"transaction_id"`
	ValidatorAddress string          `json:"validator_address"`
	ValidatorStatus  ValidatorStatus `json:"validator_status"`
}

TransactionValidator represents a transaction-to-validator association

type TransactionsMetadata

type TransactionsMetadata struct {
	Consensus *Consensus `json:"consensus"`
}

type Transfer

type Transfer struct {
	Type              string `json:"type"`
	Value             string `json:"value"`
	Address           string `json:"address"`
	AccountIdentifier string `json:"account_identifier"`
}

Transfer represents a transfer from or to in a transaction

func (Transfer) ValueNum

func (tr Transfer) ValueNum() (amount decimal.Decimal, err error)

ValueNum converts the transfer value string to a decimal

type TransferLocation

type TransferLocation struct {
	Type              TransferLocationType `json:"type,omitempty"`
	Value             string               `json:"value,omitempty"`
	Address           string               `json:"address,omitempty"`
	AccountIdentifier string               `json:"account_identifier,omitempty"`
}

TransferLocation represents a source or target location in a fund movement.

type TransferLocationType

type TransferLocationType string

TransferLocationType identifies the kind of transfer location.

const (
	TransferLocationTypeUnknown           TransferLocationType = "TRANSFER_LOCATION_TYPE_UNKNOWN"
	TransferLocationTypePaymentMethod     TransferLocationType = "PAYMENT_METHOD"
	TransferLocationTypeWallet            TransferLocationType = "WALLET"
	TransferLocationTypeAddress           TransferLocationType = "ADDRESS"
	TransferLocationTypeOther             TransferLocationType = "OTHER"
	TransferLocationTypeMultipleAddresses TransferLocationType = "MULTIPLE_ADDRESSES"
	TransferLocationTypeCounterpartyId    TransferLocationType = "COUNTERPARTY_ID"
)

type TravelRuleData added in v0.9.0

type TravelRuleData struct {
	Beneficiary                   *TravelRuleParty `json:"beneficiary,omitempty"`
	Originator                    *TravelRuleParty `json:"originator,omitempty"`
	IsSelf                        bool             `json:"is_self,omitempty"`
	IsIntermediary                bool             `json:"is_intermediary,omitempty"`
	OptOutOfOwnershipVerification bool             `json:"opt_out_of_ownership_verification,omitempty"`
	AttestVerifiedWalletOwnership bool             `json:"attest_verified_wallet_ownership,omitempty"`
}

TravelRuleData contains travel rule information for withdrawals.

type TravelRuleDate

type TravelRuleDate struct {
	Year  int32 `json:"year,omitempty"`
	Month int32 `json:"month,omitempty"`
	Day   int32 `json:"day,omitempty"`
}

TravelRuleDate represents a date for travel rule (year, month, day)

type TravelRuleParty

type TravelRuleParty struct {
	Name              string               `json:"name,omitempty"`
	NaturalPersonName *NaturalPersonName   `json:"natural_person_name,omitempty"`
	Address           *DetailedAddress     `json:"address,omitempty"`
	WalletType        TravelRuleWalletType `json:"wallet_type,omitempty"`
	VaspId            string               `json:"vasp_id,omitempty"`
	VaspName          string               `json:"vasp_name,omitempty"`
	VaspAddress       *DetailedAddress     `json:"vasp_address,omitempty"`
	PersonalId        string               `json:"personal_id,omitempty"`
	DateOfBirth       *TravelRuleDate      `json:"date_of_birth,omitempty"`
}

TravelRuleParty represents a party in a travel rule transaction

type TravelRuleWalletType

type TravelRuleWalletType string

TravelRuleWalletType represents the type of wallet for travel rule compliance

const (
	TravelRuleWalletTypeUnspecified   TravelRuleWalletType = "TRAVEL_RULE_WALLET_TYPE_UNSPECIFIED"
	TravelRuleWalletTypeVASP          TravelRuleWalletType = "TRAVEL_RULE_WALLET_TYPE_VASP"
	TravelRuleWalletTypeSelfCustodied TravelRuleWalletType = "TRAVEL_RULE_WALLET_TYPE_SELF_CUSTODIED"
)

type UnstakeStatus

type UnstakeStatus struct {
	Amount              string       `json:"amount"`
	EstimateType        EstimateType `json:"estimate_type"`
	EstimateDescription string       `json:"estimate_description"`
	UnstakeType         UnstakeType  `json:"unstake_type"`
	FinishingAt         string       `json:"finishing_at"`
	RemainingHours      int          `json:"remaining_hours"`
	RequestedAt         string       `json:"requested_at"`
}

UnstakeStatus represents the status of an unstake operation (legacy)

type UnstakeType

type UnstakeType string

UnstakeType represents the type of unstaking operation

const (
	UnstakeTypeUnspecified UnstakeType = "UNSTAKE_TYPE_UNSPECIFIED"
	UnstakeTypePartial     UnstakeType = "UNSTAKE_TYPE_PARTIAL"
	UnstakeTypeFull        UnstakeType = "UNSTAKE_TYPE_FULL"
)

type UnstakeValidator

type UnstakeValidator struct {
	ValidatorAddress string           `json:"validator_address"`
	Statuses         []*UnstakeStatus `json:"statuses"`
}

UnstakeValidator represents a validator with unstake statuses (legacy)

type UnstakingStatus

type UnstakingStatus struct {
	Amount              string       `json:"amount"`
	UnstakeType         UnstakeType  `json:"unstake_type"`
	FinishingAt         string       `json:"finishing_at"`
	RemainingHours      int64        `json:"remaining_hours"`
	RequestedAt         string       `json:"requested_at"`
	EstimateType        EstimateType `json:"estimate_type"`
	EstimateDescription string       `json:"estimate_description"`
}

UnstakingStatus represents the status of an unstaking operation (from API spec)

type User

type User struct {
	Id                   string                `json:"id"`
	Name                 string                `json:"name"`
	Email                string                `json:"email"`
	EntityId             string                `json:"entity_id"`
	PortfolioId          string                `json:"portfolio_id,omitempty"`
	Role                 string                `json:"role"`
	Roles                []UserRole            `json:"roles,omitempty"`
	SecondaryPermissions []SecondaryPermission `json:"secondary_permissions,omitempty"`
}

User represents a Prime user

type UserAction

type UserAction struct {
	Action               string                `json:"action"`
	UserId               string                `json:"user_id"`
	Timestamp            string                `json:"timestamp"`
	TransactionsMetadata *TransactionsMetadata `json:"transactions_metadata,omitempty"`
}

type UserRole

type UserRole string

UserRole indicates the user's primary role.

const (
	UserRoleUnknown         UserRole = "USER_ROLE_UNKNOWN"
	UserRoleAuditor         UserRole = "AUDITOR"
	UserRoleSignatory       UserRole = "SIGNATORY"
	UserRoleAdmin           UserRole = "ADMIN"
	UserRoleInitiator       UserRole = "INITIATOR"
	UserRoleReviewer        UserRole = "REVIEWER"
	UserRoleTrader          UserRole = "TRADER"
	UserRoleFullTrader      UserRole = "FULL_TRADER"
	UserRoleTeamManager     UserRole = "TEAM_MANAGER"
	UserRoleApprover        UserRole = "APPROVER"
	UserRoleTaxManager      UserRole = "TAX_MANAGER"
	UserRoleBusinessManager UserRole = "BUSINESS_MANAGER"
)

type ValidatorAllocation

type ValidatorAllocation struct {
	ValidatorAddress string `json:"validator_address"`
	Amount           string `json:"amount"`
}

ValidatorAllocation specifies the validator and amount for staking or unstaking.

type ValidatorProvider added in v0.9.0

type ValidatorProvider string

ValidatorProvider enumerates the ETH validator service providers accepted for unstaking.

const (
	ValidatorProviderUnspecified   ValidatorProvider = "VALIDATOR_PROVIDER_UNSPECIFIED"
	ValidatorProviderCoinbaseCloud ValidatorProvider = "VALIDATOR_PROVIDER_COINBASE_CLOUD"
	ValidatorProviderMavan         ValidatorProvider = "VALIDATOR_PROVIDER_MAVAN"
	ValidatorProviderFigment       ValidatorProvider = "VALIDATOR_PROVIDER_FIGMENT"
	ValidatorProviderCodefi        ValidatorProvider = "VALIDATOR_PROVIDER_CODEFI"
	ValidatorProviderAttestant     ValidatorProvider = "VALIDATOR_PROVIDER_ATTESTANT"
	ValidatorProviderGalaxy        ValidatorProvider = "VALIDATOR_PROVIDER_GALAXY"
)

type ValidatorStakingInfo

type ValidatorStakingInfo struct {
	ValidatorAddress string           `json:"validator_address"`
	Statuses         []*StakingStatus `json:"statuses"`
}

ValidatorStakingInfo represents staking information for a validator

type ValidatorStatus

type ValidatorStatus string

ValidatorStatus represents the status of a validator

const (
	ValidatorStatusUnspecified ValidatorStatus = "VALIDATOR_STATUS_UNSPECIFIED"
	ValidatorStatusPending     ValidatorStatus = "VALIDATOR_STATUS_PENDING"
	ValidatorStatusActive      ValidatorStatus = "VALIDATOR_STATUS_ACTIVE"
	ValidatorStatusExiting     ValidatorStatus = "VALIDATOR_STATUS_EXITING"
	ValidatorStatusExited      ValidatorStatus = "VALIDATOR_STATUS_EXITED"
	ValidatorStatusWithdrawn   ValidatorStatus = "VALIDATOR_STATUS_WITHDRAWN"
)

type ValidatorUnstakePreview

type ValidatorUnstakePreview struct {
	ValidatorAddress           string  `json:"validator_address,omitempty"`
	EstimatedUnstakingAmount   string  `json:"estimated_unstaking_amount,omitempty"`
	UnstakeTimeEstimateInHours float64 `json:"unstake_time_estimate_in_hours,omitempty"`
	EstimatedUnstakeDate       string  `json:"estimated_unstake_date,omitempty"`
}

ValidatorUnstakePreview contains the per-validator breakdown for an unstake preview.

type ValidatorUnstakingInfo

type ValidatorUnstakingInfo struct {
	ValidatorAddress string             `json:"validator_address"`
	Statuses         []*UnstakingStatus `json:"statuses"`
}

ValidatorUnstakingInfo represents unstaking information for a validator

type VisibilityStatus

type VisibilityStatus string
const (
	VisibilityStatusVisible VisibilityStatus = "VISIBLE"
	VisibilityStatusHidden  VisibilityStatus = "HIDDEN"
	VisibilityStatusSpam    VisibilityStatus = "SPAM"
)

type Wallet

type Wallet struct {
	Id         string           `json:"id"`
	Type       string           `json:"type"`
	Name       string           `json:"name"`
	Address    string           `json:"address"`
	Visibility WalletVisibility `json:"visibility"`
	Symbol     string           `json:"symbol"`
	Created    time.Time        `json:"created_at"`
	Network    *NetworkDetails  `json:"network"`
}

Wallet represents a Prime wallet

type WalletStakingMetadata added in v0.9.0

type WalletStakingMetadata struct {
	ExternalId string `json:"external_id,omitempty"`
}

WalletStakingMetadata contains optional metadata for wallet staking requests.

type WalletVisibility

type WalletVisibility string

WalletVisibility represents the visibility state of a wallet

const (
	WalletVisibilityUnspecified WalletVisibility = "WALLET_VISIBILITY_UNSPECIFIED"
	WalletVisibilityVisible     WalletVisibility = "WALLET_VISIBILITY_VISIBLE"
	WalletVisibilityHidden      WalletVisibility = "WALLET_VISIBILITY_HIDDEN"
)

type Web3Asset

type Web3Asset struct {
	Network         string `json:"network"`
	ContractAddress string `json:"contract_address"`
	Symbol          string `json:"symbol"`
	TokenId         string `json:"token_id"`
	Name            string `json:"name"`
}

type Web3Balance

type Web3Balance struct {
	Asset            *Web3Asset       `json:"asset"`
	Amount           string           `json:"amount"`
	VisibilityStatus VisibilityStatus `json:"visibility_status"`
}

type Web3TransactionMetadata

type Web3TransactionMetadata struct {
	Label                 string        `json:"label,omitempty"`
	ConfirmedAssetChanges []AssetChange `json:"confirmed_asset_changes,omitempty"`
}

Web3TransactionMetadata represents metadata for web3 transactions

type WithdrawalPower

type WithdrawalPower struct {
	// The currency symbol
	Symbol string `json:"symbol,omitempty"`

	// Withdrawal power
	Amount string `json:"amount,omitempty"`
}

type XMCallStatus

type XMCallStatus string

XMCallStatus represents the status of a Cross Margin call

const (
	XMCallStatusUnspecified XMCallStatus = "XM_CALL_STATUS_UNSPECIFIED"
	XMCallStatusOpen        XMCallStatus = "OPEN"
	XMCallStatusClosed      XMCallStatus = "CLOSED"
	XMCallStatusAged        XMCallStatus = "AGED"
)

type XMCallType

type XMCallType string

XMCallType represents the type of Cross Margin call

const (
	XMCallTypeUnspecified XMCallType = "XM_CALL_TYPE_UNSPECIFIED"
	XMCallTypeStandard    XMCallType = "STANDARD"
	XMCallTypeUrgent      XMCallType = "URGENT"
)

type XMControlStatus

type XMControlStatus string

XMControlStatus represents the control status for Cross Margin trades and withdrawals

const (
	XMControlStatusUnspecified       XMControlStatus = "XM_CONTROL_STATUS_UNSPECIFIED"
	XMControlStatusTradesWithdrawals XMControlStatus = "TRADES_AND_WITHDRAWALS"
	XMControlStatusTradesOnly        XMControlStatus = "TRADES_ONLY"
	XMControlStatusSessionLocked     XMControlStatus = "SESSION_LOCKED"
)

type XMEntityCallStatus

type XMEntityCallStatus string

XMEntityCallStatus represents the entity call status for Cross Margin

const (
	XMEntityCallStatusUnspecified  XMEntityCallStatus = "XM_ENTITY_CALL_STATUS_UNSPECIFIED"
	XMEntityCallStatusNoCall       XMEntityCallStatus = "ENTITY_NO_CALL"
	XMEntityCallStatusStandardCall XMEntityCallStatus = "ENTITY_OPEN_STANDARD_CALL"
	XMEntityCallStatusUrgentCall   XMEntityCallStatus = "ENTITY_OPEN_URGENT_CALL"
	XMEntityCallStatusAgedCall     XMEntityCallStatus = "ENTITY_AGED_CALL"
	XMEntityCallStatusDebitCall    XMEntityCallStatus = "ENTITY_OPEN_DEBIT_CALL"
)

type XMLiquidationStatus

type XMLiquidationStatus string

XMLiquidationStatus is the current status of an XM liquidation.

const (
	XMLiquidationStatusUnset          XMLiquidationStatus = "XM_LIQUIDATION_STATUS_UNSET"
	XMLiquidationStatusPreLiquidation XMLiquidationStatus = "XM_LIQUIDATION_STATUS_PRE_LIQUIDATION"
	XMLiquidationStatusLiquidating    XMLiquidationStatus = "XM_LIQUIDATION_STATUS_LIQUIDATING"
	XMLiquidationStatusLiquidated     XMLiquidationStatus = "XM_LIQUIDATION_STATUS_LIQUIDATED"
	XMLiquidationStatusCanceled       XMLiquidationStatus = "XM_LIQUIDATION_STATUS_CANCELED"
	XMLiquidationStatusFailed         XMLiquidationStatus = "XM_LIQUIDATION_STATUS_FAILED"
)

type XMLoan

type XMLoan struct {
	LoanId                       string  `json:"loan_id"`
	LoanParty                    XMParty `json:"loan_party"`
	PrincipalCurrency            string  `json:"principal_currency"`
	PrincipalCurrencyMarketPrice string  `json:"principal_currency_market_price"`
	InitialPrincipalAmount       string  `json:"initial_principal_amount"`
	OutstandingPrincipalAmount   string  `json:"outstanding_principal_amount"`
}

XMLoan represents a Cross Margin loan

type XMMarginCall

type XMMarginCall struct {
	MarginCallId              string        `json:"margin_call_id"`
	Currency                  string        `json:"currency"`
	InitialNotionalAmount     string        `json:"initial_notional_amount"`
	OutstandingNotionalAmount string        `json:"outstanding_notional_amount"`
	MarginCallType            XMCallType    `json:"margin_call_type"`
	MarginCallStatus          XMCallStatus  `json:"margin_call_status"`
	CalledWithMarginLevel     XMMarginLevel `json:"called_with_margin_level"`
}

XMMarginCall represents a Cross Margin margin call

type XMMarginLevel

type XMMarginLevel string

XMMarginLevel represents the margin level for Cross Margin

const (
	XMMarginLevelUnspecified XMMarginLevel = "XM_MARGIN_LEVEL_UNSPECIFIED"
	XMMarginLevelHealthy     XMMarginLevel = "HEALTHY_THRESHOLD"
	XMMarginLevelDeficit     XMMarginLevel = "DEFICIT_THRESHOLD"
	XMMarginLevelWarning     XMMarginLevel = "WARNING_THRESHOLD"
	XMMarginLevelUrgent      XMMarginLevel = "URGENT_MARGIN_CALL_THRESHOLD"
	XMMarginLevelLiquidation XMMarginLevel = "LIQUIDATION_THRESHOLD"
)

type XMParty

type XMParty string

XMParty represents a Cross Margin trading venue

const (
	XMPartyUnspecified XMParty = "XM_PARTY_UNSPECIFIED"
	XMPartyCBE         XMParty = "CBE"
	XMPartyFCM         XMParty = "FCM"
)

type XMPosition

type XMPosition struct {
	Currency                   string `json:"currency,omitempty"`
	MarketPrice                string `json:"market_price,omitempty"`
	MarginEligible             bool   `json:"margin_eligible,omitempty"`
	MarketCap                  string `json:"market_cap,omitempty"`
	Adv30Days                  string `json:"adv30_days,omitempty"`
	Hist5dVol                  string `json:"hist5d_vol,omitempty"`
	Hist30dVol                 string `json:"hist30d_vol,omitempty"`
	Hist90dVol                 string `json:"hist90d_vol,omitempty"`
	MarginRequirement          string `json:"margin_requirement,omitempty"`
	SpotBalance                string `json:"spot_balance,omitempty"`
	SpotBalanceNotional        string `json:"spot_balance_notional,omitempty"`
	SpotTotalPositionMargin    string `json:"spot_total_position_margin,omitempty"`
	FuturesBalance             string `json:"futures_balance,omitempty"`
	FuturesBalanceNotional     string `json:"futures_balance_notional,omitempty"`
	FuturesTotalPositionMargin string `json:"futures_total_position_margin,omitempty"`
	GmvBasis                   string `json:"gmv_basis,omitempty"`
	BaseRequirement            string `json:"base_requirement,omitempty"`
	LiqShortsAddOn             string `json:"liq_shorts_add_on,omitempty"`
	LiqLongsAddOn              string `json:"liq_longs_add_on,omitempty"`
	VolShortsAddOn             string `json:"vol_shorts_add_on,omitempty"`
	VolLongsAddOn              string `json:"vol_longs_add_on,omitempty"`
	Vol5daysAddOn              string `json:"vol5days_add_on,omitempty"`
	Vol30daysAddOn             string `json:"vol30days_add_on,omitempty"`
	Vol90daysAddOn             string `json:"vol90days_add_on,omitempty"`
	TotalPositionMargin        string `json:"total_position_margin,omitempty"`
}

XMPosition is a per-asset netted position row used in the XM model calculation.

type XMRiskNettingInfo

type XMRiskNettingInfo struct {
	// DcoMarginRequirement (DMR) is the margin requirement for all futures positions
	// derived from the Derivatives Clearing Organization model.
	DcoMarginRequirement                 string         `json:"dco_margin_requirement,omitempty"`
	PortfolioMarginRequirement           string         `json:"portfolio_margin_requirement,omitempty"`
	IntegratedPortfolioMarginRequirement string         `json:"integrated_portfolio_margin_requirement,omitempty"`
	IneligibleFuturesMarginRequirement   string         `json:"ineligible_futures_margin_requirement,omitempty"`
	PositionMarginRequirement            string         `json:"position_margin_requirement,omitempty"`
	PortfolioMarginAddon                 string         `json:"portfolio_margin_addon,omitempty"`
	IntegratedPositionMarginRequirement  string         `json:"integrated_position_margin_requirement,omitempty"`
	IntegratedPortfolioMarginAddon       string         `json:"integrated_portfolio_margin_addon,omitempty"`
	NettedFuturesNotional                string         `json:"netted_futures_notional,omitempty"`
	TotalGmvBasis                        string         `json:"total_gmv_basis,omitempty"`
	IpmCashBalance                       string         `json:"ipm_cash_balance,omitempty"`
	IntegratedScenarioAddon              *MarginAddOn   `json:"integrated_scenario_addon,omitempty"`
	AllIntegratedScenarioAddons          []*MarginAddOn `json:"all_integrated_scenario_addons,omitempty"`
	XmPositions                          []*XMPosition  `json:"xm_positions,omitempty"`
}

XMRiskNettingInfo groups the XM margin requirement components and per-asset positions.

type XMSummary

type XMSummary struct {
	MarginRequirement     string             `json:"margin_requirement"`
	AccountEquity         string             `json:"account_equity"`
	MarginExcessShortfall string             `json:"margin_excess_shortfall"`
	ConsumedCredit        string             `json:"consumed_credit"`
	XMCreditLimit         string             `json:"xm_credit_limit"`
	XMMarginLimit         string             `json:"xm_margin_limit,omitempty"`
	SpotEquity            string             `json:"spot_equity,omitempty"`
	FuturesEquity         string             `json:"futures_equity,omitempty"`
	RiskNettingInfo       *XMRiskNettingInfo `json:"risk_netting_info,omitempty"`
}

XMSummary represents the Cross Margin margin model summary

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL