Documentation ¶
Index ¶
- Constants
- Variables
- type HoldingAccountTracker
- func (hat *HoldingAccountTracker) GetCurrentHolding(orderID string) (*num.Uint, *num.Uint)
- func (hat *HoldingAccountTracker) GetState(key string) ([]byte, []types.StateProvider, error)
- func (hat *HoldingAccountTracker) Keys() []string
- func (hat *HoldingAccountTracker) LoadState(_ context.Context, payload *types.Payload) ([]types.StateProvider, error)
- func (hat *HoldingAccountTracker) Namespace() types.SnapshotNamespace
- func (hat *HoldingAccountTracker) ReleaseAllFromHoldingAccount(ctx context.Context, orderID, party, asset string) (*types.LedgerMovement, error)
- func (hat *HoldingAccountTracker) ReleaseFeeFromHoldingAccount(ctx context.Context, orderID, party, asset string) (*types.LedgerMovement, error)
- func (hat *HoldingAccountTracker) ReleaseQuantityHoldingAccount(ctx context.Context, orderID, party, asset string, quantity *num.Uint, ...) (*types.LedgerMovement, error)
- func (hat *HoldingAccountTracker) ReleaseQuantityHoldingAccountAuctionEnd(ctx context.Context, orderID, party, asset string, quantity *num.Uint, ...) (*types.LedgerMovement, error)
- func (hat *HoldingAccountTracker) StopSnapshots()
- func (hat *HoldingAccountTracker) Stopped() bool
- func (hat *HoldingAccountTracker) TransferFeeToHoldingAccount(ctx context.Context, orderID, party, asset string, feeQuantity *num.Uint) (*types.LedgerMovement, error)
- func (hat *HoldingAccountTracker) TransferToHoldingAccount(ctx context.Context, orderID, party, asset string, quantity *num.Uint, ...) (*types.LedgerMovement, error)
- type IDGen
- type Market
- func (m *Market) AmendAMM(context.Context, *types.AmendAMM, string) error
- func (m *Market) AmendLiquidityProvision(ctx context.Context, lpa *types.LiquidityProvisionAmendment, party string, ...) error
- func (m *Market) AmendOrder(ctx context.Context, orderAmendment *types.OrderAmendment, party string, ...) (oc *types.OrderConfirmation, _ error)
- func (m *Market) AmendOrderWithIDGenerator(ctx context.Context, orderAmendment *types.OrderAmendment, party string, ...) (oc *types.OrderConfirmation, _ error)
- func (m *Market) BeginBlock(_ context.Context)
- func (m *Market) BlockEnd(ctx context.Context)
- func (m *Market) CanLeaveOpeningAuction() bool
- func (m *Market) CancelAMM(context.Context, *types.CancelAMM, string) error
- func (m *Market) CancelAllOrders(ctx context.Context, partyID string) ([]*types.OrderCancellationConfirmation, error)
- func (m *Market) CancelAllStopOrders(ctx context.Context, partyID string) error
- func (m *Market) CancelLiquidityProvision(ctx context.Context, cancel *types.LiquidityProvisionCancellation, ...) error
- func (m *Market) CancelOrder(ctx context.Context, partyID, orderID string, deterministicID string) (oc *types.OrderCancellationConfirmation, _ error)
- func (m *Market) CancelOrderWithIDGenerator(ctx context.Context, partyID, orderID string, idgen common.IDGenerator) (oc *types.OrderCancellationConfirmation, _ error)
- func (m *Market) CancelStopOrder(ctx context.Context, partyID, orderID string) error
- func (m *Market) CheckOrderSubmissionForSpam(orderSubmission *types.OrderSubmission, party string, ...) error
- func (m *Market) EnterLongBlockAuction(ctx context.Context, duration int64)
- func (m *Market) GetAssetForProposerBonus() string
- func (m *Market) GetAssets() []string
- func (m *Market) GetEquityShares() *common.EquityShares
- func (m *Market) GetEquitySharesForParty(partyID string) num.Decimal
- func (m *Market) GetFillPrice(volume uint64, side types.Side) (*num.Uint, error)
- func (m *Market) GetID() string
- func (m *Market) GetMarketCounters() *types.MarketCounters
- func (m *Market) GetMarketData() types.MarketData
- func (m *Market) GetMarketState() types.MarketState
- func (m *Market) GetNewStateProviders() []types.StateProvider
- func (m *Market) GetNextMTM() time.Time
- func (m *Market) GetPartiesStats() *types.MarketStats
- func (m *Market) GetQuoteAsset() string
- func (m *Market) GetState() *types.ExecSpotMarket
- func (m *Market) GetTotalLPShapeCount() uint64
- func (m *Market) GetTotalOpenPositionCount() uint64
- func (m *Market) GetTotalOrderBookLevelCount() uint64
- func (m *Market) GetTotalPeggedOrderCount() uint64
- func (m *Market) GetTotalStopOrderCount() uint64
- func (m *Market) Hash() []byte
- func (m *Market) IntoType() types.Market
- func (m *Market) IsOpeningAuction() bool
- func (m *Market) Mkt() *types.Market
- func (m *Market) OnAMMMinCommitmentQuantumUpdate(ctx context.Context, c *num.Uint)
- func (m *Market) OnAuctionEnded()
- func (m *Market) OnEpochEvent(ctx context.Context, epoch types.Epoch)
- func (m *Market) OnEpochRestore(ctx context.Context, epoch types.Epoch)
- func (m *Market) OnFeeFactorsBuyBackFeeUpdate(ctx context.Context, d num.Decimal)
- func (m *Market) OnFeeFactorsInfrastructureFeeUpdate(ctx context.Context, d num.Decimal)
- func (m *Market) OnFeeFactorsMakerFeeUpdate(ctx context.Context, d num.Decimal)
- func (m *Market) OnFeeFactorsTreasuryFeeUpdate(ctx context.Context, d num.Decimal)
- func (m *Market) OnMarkPriceUpdateMaximumFrequency(ctx context.Context, d time.Duration)
- func (m *Market) OnMarketAMMMaxCalculationLevels(ctx context.Context, c *num.Uint)
- func (m *Market) OnMarketAuctionMaximumDurationUpdate(ctx context.Context, d time.Duration)
- func (m *Market) OnMarketAuctionMinimumDurationUpdate(ctx context.Context, d time.Duration)
- func (m *Market) OnMarketLiquidityEquityLikeShareFeeFractionUpdate(d num.Decimal)
- func (m *Market) OnMarketLiquidityV2BondPenaltyFactorUpdate(d num.Decimal)
- func (m *Market) OnMarketLiquidityV2EarlyExitPenaltyUpdate(d num.Decimal)
- func (m *Market) OnMarketLiquidityV2MaximumLiquidityFeeFactorLevelUpdate(d num.Decimal)
- func (m *Market) OnMarketLiquidityV2ProvidersFeeCalculationTimeStep(d time.Duration)
- func (m *Market) OnMarketLiquidityV2SLANonPerformanceBondPenaltyMaxUpdate(d num.Decimal)
- func (m *Market) OnMarketLiquidityV2SLANonPerformanceBondPenaltySlopeUpdate(d num.Decimal)
- func (m *Market) OnMarketLiquidityV2StakeToCCYVolume(d num.Decimal)
- func (m *Market) OnMarketMinLpStakeQuantumMultipleUpdate(_ context.Context, d num.Decimal)
- func (m *Market) OnMarketMinProbabilityOfTradingLPOrdersUpdate(_ context.Context, d num.Decimal)
- func (m *Market) OnMarketPartiesMaximumStopOrdersUpdate(ctx context.Context, u *num.Uint)
- func (m *Market) OnMarketProbabilityOfTradingTauScalingUpdate(_ context.Context, d num.Decimal)
- func (m *Market) OnMarketTargetStakeScalingFactorUpdate(d num.Decimal) error
- func (m *Market) OnMarketTargetStakeTimeWindowUpdate(d time.Duration)
- func (m *Market) OnMarketValueWindowLengthUpdate(d time.Duration)
- func (m *Market) OnMinimalHoldingQuantumMultipleUpdate(multiplier num.Decimal) error
- func (m *Market) OnOpeningAuctionFirstUncrossingPrice()
- func (m *Market) OnTick(ctx context.Context, t time.Time) bool
- func (m *Market) PostRestore(ctx context.Context) error
- func (m *Market) Reject(ctx context.Context) error
- func (m *Market) ReloadConf(matchingConfig matching.Config, feeConfig fee.Config)
- func (m *Market) SetNextMTM(tm time.Time)
- func (m *Market) StartOpeningAuction(ctx context.Context) error
- func (m *Market) StopSnapshots()
- func (m *Market) SubmitAMM(context.Context, *types.SubmitAMM, string) error
- func (m *Market) SubmitLiquidityProvision(ctx context.Context, sub *types.LiquidityProvisionSubmission, ...) error
- func (m *Market) SubmitOrder(ctx context.Context, orderSubmission *types.OrderSubmission, party string, ...) (oc *types.OrderConfirmation, _ error)
- func (m *Market) SubmitOrderWithIDGeneratorAndOrderID(ctx context.Context, orderSubmission *types.OrderSubmission, party string, ...) (oc *types.OrderConfirmation, _ error)
- func (m *Market) SubmitStopOrdersWithIDGeneratorAndOrderIDs(ctx context.Context, submission *types.StopOrdersSubmission, party string, ...) (*types.OrderConfirmation, error)
- func (m *Market) Update(ctx context.Context, config *types.Market) error
- func (m *Market) UpdateMarketState(ctx context.Context, changes *types.MarketStateUpdateConfiguration) error
- func (m *Market) ValidateSettlementData(_ *num.Uint) bool
- type TargetStakeCalculator
Constants ¶
const ( BaseAssetIndex = 0 QuoteAssetIndex = 1 )
Variables ¶
var ErrCommitmentAmountTooLow = errors.New("commitment amount is too low")
Functions ¶
This section is empty.
Types ¶
type HoldingAccountTracker ¶
type HoldingAccountTracker struct {
// contains filtered or unexported fields
}
func NewHoldingAccountTracker ¶
func NewHoldingAccountTracker(marketID string, log *logging.Logger, collateral common.Collateral) *HoldingAccountTracker
func (*HoldingAccountTracker) GetCurrentHolding ¶
func (*HoldingAccountTracker) GetState ¶
func (hat *HoldingAccountTracker) GetState(key string) ([]byte, []types.StateProvider, error)
func (*HoldingAccountTracker) Keys ¶
func (hat *HoldingAccountTracker) Keys() []string
func (*HoldingAccountTracker) LoadState ¶
func (hat *HoldingAccountTracker) LoadState(_ context.Context, payload *types.Payload) ([]types.StateProvider, error)
func (*HoldingAccountTracker) Namespace ¶
func (hat *HoldingAccountTracker) Namespace() types.SnapshotNamespace
func (*HoldingAccountTracker) ReleaseAllFromHoldingAccount ¶
func (hat *HoldingAccountTracker) ReleaseAllFromHoldingAccount(ctx context.Context, orderID, party, asset string) (*types.LedgerMovement, error)
func (*HoldingAccountTracker) ReleaseFeeFromHoldingAccount ¶
func (hat *HoldingAccountTracker) ReleaseFeeFromHoldingAccount(ctx context.Context, orderID, party, asset string) (*types.LedgerMovement, error)
func (*HoldingAccountTracker) ReleaseQuantityHoldingAccount ¶
func (*HoldingAccountTracker) ReleaseQuantityHoldingAccountAuctionEnd ¶ added in v0.75.0
func (*HoldingAccountTracker) StopSnapshots ¶
func (hat *HoldingAccountTracker) StopSnapshots()
func (*HoldingAccountTracker) Stopped ¶
func (hat *HoldingAccountTracker) Stopped() bool
func (*HoldingAccountTracker) TransferFeeToHoldingAccount ¶
func (hat *HoldingAccountTracker) TransferFeeToHoldingAccount(ctx context.Context, orderID, party, asset string, feeQuantity *num.Uint) (*types.LedgerMovement, error)
func (*HoldingAccountTracker) TransferToHoldingAccount ¶
type Market ¶
type Market struct {
// contains filtered or unexported fields
}
Market represents an instance of a market in vega and is in charge of calling the engines in order to process all transactions.
func NewMarket ¶
func NewMarket( log *logging.Logger, matchingConfig matching.Config, feeConfig fee.Config, liquidityConfig liquidity.Config, collateralEngine common.Collateral, mkt *types.Market, timeService common.TimeService, broker common.Broker, as common.AuctionState, stateVarEngine common.StateVarEngine, marketActivityTracker *common.MarketActivityTracker, baseAssetDetails *assets.Asset, quoteAssetDetails *assets.Asset, peggedOrderNotify func(int64), referralDiscountRewardService fee.ReferralDiscountRewardService, volumeDiscountService fee.VolumeDiscountService, volumeRebateService fee.VolumeRebateService, banking common.Banking, ) (*Market, error)
NewMarket creates a new market using the market framework configuration and creates underlying engines.
func NewMarketFromSnapshot ¶
func NewMarketFromSnapshot( ctx context.Context, log *logging.Logger, em *types.ExecSpotMarket, riskConfig risk.Config, positionConfig positions.Config, settlementConfig settlement.Config, matchingConfig matching.Config, feeConfig fee.Config, liquidityConfig liquidity.Config, collateralEngine common.Collateral, oracleEngine products.OracleEngine, timeService common.TimeService, broker common.Broker, stateVarEngine common.StateVarEngine, baseAssetDetails *assets.Asset, quoteAssetDetails *assets.Asset, marketActivityTracker *common.MarketActivityTracker, peggedOrderNotify func(int64), referralDiscountRewardService fee.ReferralDiscountRewardService, volumeDiscountService fee.VolumeDiscountService, volumeRebateService fee.VolumeRebateService, banking common.Banking, ) (*Market, error)
func (*Market) AmendLiquidityProvision ¶
func (m *Market) AmendLiquidityProvision(ctx context.Context, lpa *types.LiquidityProvisionAmendment, party string, deterministicID string) error
AmendLiquidityProvision forwards a LiquidityProvisionAmendment to the Liquidity Engine.
func (*Market) AmendOrder ¶
func (m *Market) AmendOrder(ctx context.Context, orderAmendment *types.OrderAmendment, party string, deterministicID string) (oc *types.OrderConfirmation, _ error)
AmendOrder amend an existing order from the order book.
func (*Market) AmendOrderWithIDGenerator ¶
func (m *Market) AmendOrderWithIDGenerator(ctx context.Context, orderAmendment *types.OrderAmendment, party string, idgen common.IDGenerator) (oc *types.OrderConfirmation, _ error)
AmendOrderWithIDGenerator amends an order.
func (*Market) BeginBlock ¶
func (*Market) CanLeaveOpeningAuction ¶
CanLeaveOpeningAuction checks if the market can leave the opening auction based on whether floating point consensus has been reached on all 2 vars.
func (*Market) CancelAllOrders ¶
func (m *Market) CancelAllOrders(ctx context.Context, partyID string) ([]*types.OrderCancellationConfirmation, error)
CancelAllOrders cancels all orders in the market.
func (*Market) CancelAllStopOrders ¶
func (*Market) CancelLiquidityProvision ¶
func (m *Market) CancelLiquidityProvision(ctx context.Context, cancel *types.LiquidityProvisionCancellation, party string) error
CancelLiquidityProvision forwards a LiquidityProvisionCancel to the Liquidity Engine.
func (*Market) CancelOrder ¶
func (m *Market) CancelOrder(ctx context.Context, partyID, orderID string, deterministicID string) (oc *types.OrderCancellationConfirmation, _ error)
CancelOrder canels a single order in the market.
func (*Market) CancelOrderWithIDGenerator ¶
func (m *Market) CancelOrderWithIDGenerator(ctx context.Context, partyID, orderID string, idgen common.IDGenerator) (oc *types.OrderCancellationConfirmation, _ error)
CancelOrderWithIDGenerator cancels an order in the market.
func (*Market) CancelStopOrder ¶
func (*Market) CheckOrderSubmissionForSpam ¶ added in v0.77.0
func (*Market) EnterLongBlockAuction ¶ added in v0.77.0
func (*Market) GetAssetForProposerBonus ¶
func (*Market) GetEquityShares ¶
func (m *Market) GetEquityShares() *common.EquityShares
func (*Market) GetEquitySharesForParty ¶ added in v0.78.0
func (*Market) GetFillPrice ¶ added in v0.75.0
func (*Market) GetMarketCounters ¶
func (m *Market) GetMarketCounters() *types.MarketCounters
func (*Market) GetMarketData ¶
func (m *Market) GetMarketData() types.MarketData
func (*Market) GetMarketState ¶
func (m *Market) GetMarketState() types.MarketState
func (*Market) GetNewStateProviders ¶
func (m *Market) GetNewStateProviders() []types.StateProvider
func (*Market) GetNextMTM ¶
func (*Market) GetPartiesStats ¶
func (m *Market) GetPartiesStats() *types.MarketStats
func (*Market) GetQuoteAsset ¶
func (*Market) GetState ¶
func (m *Market) GetState() *types.ExecSpotMarket
func (*Market) GetTotalLPShapeCount ¶
GetTotalLPShapeCount returns the total number of LP shapes.
func (*Market) GetTotalOpenPositionCount ¶
GetTotalOpenPositionCount returns the total number of open positions.
func (*Market) GetTotalOrderBookLevelCount ¶
GetTotalOrderBookLevelCount returns the total number of levels in the order book.
func (*Market) GetTotalPeggedOrderCount ¶
GetTotalPeggedOrderCount returns the total number of pegged orders.
func (*Market) GetTotalStopOrderCount ¶
GetTotalStopOrderCount returns the total number of stop orders.
func (*Market) IsOpeningAuction ¶
func (*Market) OnAMMMinCommitmentQuantumUpdate ¶ added in v0.77.0
func (*Market) OnAuctionEnded ¶
func (m *Market) OnAuctionEnded()
OnAuctionEnded is called whenever an auction is ended and emits an event to the state var engine.
func (*Market) OnEpochRestore ¶
func (*Market) OnFeeFactorsBuyBackFeeUpdate ¶ added in v0.77.8
func (*Market) OnFeeFactorsInfrastructureFeeUpdate ¶
func (*Market) OnFeeFactorsMakerFeeUpdate ¶
func (*Market) OnFeeFactorsTreasuryFeeUpdate ¶ added in v0.77.8
func (*Market) OnMarkPriceUpdateMaximumFrequency ¶
func (*Market) OnMarketAMMMaxCalculationLevels ¶ added in v0.77.0
func (*Market) OnMarketAuctionMaximumDurationUpdate ¶
func (*Market) OnMarketAuctionMinimumDurationUpdate ¶
func (*Market) OnMarketLiquidityEquityLikeShareFeeFractionUpdate ¶ added in v0.77.0
func (*Market) OnMarketLiquidityV2BondPenaltyFactorUpdate ¶
func (*Market) OnMarketLiquidityV2EarlyExitPenaltyUpdate ¶
func (*Market) OnMarketLiquidityV2MaximumLiquidityFeeFactorLevelUpdate ¶
func (*Market) OnMarketLiquidityV2ProvidersFeeCalculationTimeStep ¶
func (*Market) OnMarketLiquidityV2SLANonPerformanceBondPenaltyMaxUpdate ¶
func (*Market) OnMarketLiquidityV2SLANonPerformanceBondPenaltySlopeUpdate ¶
func (*Market) OnMarketLiquidityV2StakeToCCYVolume ¶
func (*Market) OnMarketMinLpStakeQuantumMultipleUpdate ¶
func (*Market) OnMarketMinProbabilityOfTradingLPOrdersUpdate ¶
func (*Market) OnMarketPartiesMaximumStopOrdersUpdate ¶
func (*Market) OnMarketProbabilityOfTradingTauScalingUpdate ¶
func (*Market) OnMarketTargetStakeScalingFactorUpdate ¶
func (*Market) OnMarketTargetStakeTimeWindowUpdate ¶
func (*Market) OnMarketValueWindowLengthUpdate ¶
func (*Market) OnMinimalHoldingQuantumMultipleUpdate ¶ added in v0.77.0
func (*Market) OnOpeningAuctionFirstUncrossingPrice ¶
func (m *Market) OnOpeningAuctionFirstUncrossingPrice()
OnOpeningAuctionFirstUncrossingPrice is triggered when the opening auction sees an uncrossing price for the first time and emits an event to the state variable engine.
func (*Market) PostRestore ¶
PostRestore restores market price in orders after snapshot reload.
func (*Market) ReloadConf ¶
ReloadConf will trigger a reload of all the config settings in the market and all underlying engines this is required when hot-reloading any config changes, eg. logger level.
func (*Market) SetNextMTM ¶
func (*Market) StartOpeningAuction ¶
StartOpeningAuction kicks off opening auction.
func (*Market) StopSnapshots ¶
func (m *Market) StopSnapshots()
func (*Market) SubmitLiquidityProvision ¶
func (m *Market) SubmitLiquidityProvision(ctx context.Context, sub *types.LiquidityProvisionSubmission, party, deterministicID string) error
SubmitLiquidityProvision forwards a LiquidityProvisionSubmission to the Liquidity Engine.
func (*Market) SubmitOrder ¶
func (m *Market) SubmitOrder(ctx context.Context, orderSubmission *types.OrderSubmission, party string, deterministicID string) (oc *types.OrderConfirmation, _ error)
SubmitOrder submits the given order.
func (*Market) SubmitOrderWithIDGeneratorAndOrderID ¶
func (m *Market) SubmitOrderWithIDGeneratorAndOrderID(ctx context.Context, orderSubmission *types.OrderSubmission, party string, idgen common.IDGenerator, orderID string, checkForTriggers bool) (oc *types.OrderConfirmation, _ error)
SubmitOrderWithIDGeneratorAndOrderID submits the given order.
func (*Market) SubmitStopOrdersWithIDGeneratorAndOrderIDs ¶
func (m *Market) SubmitStopOrdersWithIDGeneratorAndOrderIDs( ctx context.Context, submission *types.StopOrdersSubmission, party string, idgen common.IDGenerator, fallsBelowID, risesAboveID *string, ) (*types.OrderConfirmation, error)