Documentation ¶
Index ¶
- Variables
- type Config
- type Engine
- func (e *Engine) AmendAMM(ctx context.Context, submit *types.AmendAMM, deterministicID string) error
- func (e *Engine) AmendLiquidityProvision(ctx context.Context, lpa *types.LiquidityProvisionAmendment, party string, ...) error
- func (e *Engine) AmendOrder(ctx context.Context, amendment *types.OrderAmendment, party string, ...) (*types.OrderConfirmation, error)
- func (e *Engine) BeginBlock(ctx context.Context)
- func (e *Engine) BlockEnd(ctx context.Context)
- func (e *Engine) CancelAMM(ctx context.Context, cancel *types.CancelAMM, deterministicID string) error
- func (e *Engine) CancelLiquidityProvision(ctx context.Context, cancel *types.LiquidityProvisionCancellation, ...) error
- func (e *Engine) CancelOrder(ctx context.Context, cancel *types.OrderCancellation, party string, ...) (_ []*types.OrderCancellationConfirmation, returnedErr error)
- func (e *Engine) CancelStopOrders(ctx context.Context, cancel *types.StopOrdersCancellation, party string, ...) error
- func (e *Engine) CheckCanSubmitOrderOrLiquidityCommitment(party, market string) error
- func (e *Engine) CheckOrderSubmissionForSpam(orderSubmission *types.OrderSubmission, party string) error
- func (e *Engine) Checkpoint() ([]byte, error)
- func (e *Engine) GetEquityLikeShareForMarketAndParty(market, party string) (num.Decimal, bool)
- func (e *Engine) GetFillPriceForMarket(marketID string, volume uint64, side types.Side) (*num.Uint, error)
- func (e *Engine) GetMarket(market string, settled bool) (types.Market, bool)
- func (e *Engine) GetMarketCounters() map[string]*types.MarketCounters
- func (e *Engine) GetMarketData(mktID string) (types.MarketData, error)
- func (e *Engine) GetMarketState(mktID string) (types.MarketState, error)
- func (e *Engine) GetMarketStats() map[string]*types.MarketStats
- func (e *Engine) GetState(_ string) ([]byte, []types.StateProvider, error)
- func (e *Engine) Hash() []byte
- func (e *Engine) IsEligibleForProposerBonus(marketID string, value *num.Uint) bool
- func (e *Engine) IsSucceeded(mktID string) bool
- func (e *Engine) Keys() []string
- func (e *Engine) Load(ctx context.Context, data []byte) error
- func (e *Engine) LoadState(ctx context.Context, payload *types.Payload) ([]types.StateProvider, error)
- func (e *Engine) MarketExists(market string) bool
- func (e *Engine) Name() types.CheckpointName
- func (e *Engine) Namespace() types.SnapshotNamespace
- func (e *Engine) OnChainIDUpdate(cID uint64) error
- func (e *Engine) OnEpochEvent(ctx context.Context, epoch types.Epoch)
- func (e *Engine) OnEpochRestore(ctx context.Context, epoch types.Epoch)
- func (e *Engine) OnInternalCompositePriceUpdateFrequency(ctx context.Context, d time.Duration) error
- func (e *Engine) OnMarkPriceUpdateMaximumFrequency(ctx context.Context, d time.Duration) error
- func (e *Engine) OnMarketAMMMaxCalculationLevels(ctx context.Context, c *num.Uint) error
- func (e *Engine) OnMarketAMMMinCommitmentQuantum(ctx context.Context, c *num.Uint) error
- func (e *Engine) OnMarketAuctionMaximumDurationUpdate(ctx context.Context, d time.Duration) error
- func (e *Engine) OnMarketAuctionMinimumDurationUpdate(ctx context.Context, d time.Duration) error
- func (e *Engine) OnMarketCreationQuantumMultipleUpdate(ctx context.Context, d num.Decimal) error
- func (e *Engine) OnMarketFeeFactorsInfrastructureFeeUpdate(ctx context.Context, d num.Decimal) error
- func (e *Engine) OnMarketFeeFactorsMakerFeeUpdate(ctx context.Context, d num.Decimal) error
- func (e *Engine) OnMarketLiquidityEquityLikeShareFeeFractionUpdate(_ context.Context, d num.Decimal) error
- func (e *Engine) OnMarketLiquidityMaximumLiquidityFeeFactorLevelUpdate(_ context.Context, d num.Decimal) error
- func (e *Engine) OnMarketLiquidityV2BondPenaltyUpdate(_ context.Context, d num.Decimal) error
- func (e *Engine) OnMarketLiquidityV2EarlyExitPenaltyUpdate(_ context.Context, d num.Decimal) error
- func (e *Engine) OnMarketLiquidityV2MaximumLiquidityFeeFactorLevelUpdate(_ context.Context, d num.Decimal) error
- func (e *Engine) OnMarketLiquidityV2ProvidersFeeCalculationTimeStep(_ context.Context, d time.Duration) error
- func (e *Engine) OnMarketLiquidityV2SLANonPerformanceBondPenaltyMaxUpdate(_ context.Context, d num.Decimal) error
- func (e *Engine) OnMarketLiquidityV2SLANonPerformanceBondPenaltySlopeUpdate(_ context.Context, d num.Decimal) error
- func (e *Engine) OnMarketLiquidityV2StakeToCCYVolumeUpdate(_ context.Context, d num.Decimal) error
- func (e *Engine) OnMarketMarginScalingFactorsUpdate(ctx context.Context, v interface{}) error
- func (e *Engine) OnMarketMinProbabilityOfTradingForLPOrdersUpdate(ctx context.Context, d num.Decimal) error
- func (e *Engine) OnMarketPartiesMaximumStopOrdersUpdate(ctx context.Context, u *num.Uint) error
- func (e *Engine) OnMarketProbabilityOfTradingTauScalingUpdate(ctx context.Context, d num.Decimal) error
- func (e *Engine) OnMarketValueWindowLengthUpdate(_ context.Context, d time.Duration) error
- func (e *Engine) OnMaxPeggedOrderUpdate(ctx context.Context, max *num.Uint) error
- func (e *Engine) OnMinLpStakeQuantumMultipleUpdate(ctx context.Context, d num.Decimal) error
- func (e *Engine) OnMinimalHoldingQuantumMultipleUpdate(_ context.Context, multiplier num.Decimal) error
- func (e *Engine) OnMinimalMarginQuantumMultipleUpdate(_ context.Context, multiplier num.Decimal) error
- func (e *Engine) OnStateLoaded(ctx context.Context) error
- func (e *Engine) OnSuccessorMarketTimeWindowUpdate(ctx context.Context, window time.Duration) error
- func (e *Engine) OnTick(ctx context.Context, t time.Time)
- func (e *Engine) RejectMarket(ctx context.Context, marketID string) error
- func (e *Engine) ReloadConf(cfg Config)
- func (e *Engine) RestoreMarket(ctx context.Context, marketConfig *types.Market) error
- func (e *Engine) StartOpeningAuction(ctx context.Context, marketID string) error
- func (e *Engine) Stopped() bool
- func (e *Engine) SubmitAMM(ctx context.Context, submit *types.SubmitAMM, deterministicID string) error
- func (e *Engine) SubmitLiquidityProvision(ctx context.Context, sub *types.LiquidityProvisionSubmission, ...) error
- func (e *Engine) SubmitMarket(ctx context.Context, marketConfig *types.Market, proposer string, ...) error
- func (e *Engine) SubmitOrder(ctx context.Context, submission *types.OrderSubmission, party string, ...) (*types.OrderConfirmation, error)
- func (e *Engine) SubmitSpotMarket(ctx context.Context, marketConfig *types.Market, proposer string, ...) error
- func (e *Engine) SubmitStopOrders(ctx context.Context, submission *types.StopOrdersSubmission, party string, ...) (*types.OrderConfirmation, error)
- func (e *Engine) SucceedMarket(ctx context.Context, successor, parent string) error
- func (e *Engine) UpdateMarginMode(ctx context.Context, party, marketID string, marginMode types.MarginMode, ...) error
- func (e *Engine) UpdateMarket(ctx context.Context, marketConfig *types.Market) error
- func (e *Engine) UpdateMarketState(ctx context.Context, changes *types.MarketStateUpdateConfiguration) error
- func (e *Engine) UpdateSpotMarket(ctx context.Context, marketConfig *types.Market) error
- func (e *Engine) ValidateSettlementData(mID string, data *num.Uint) bool
- func (e *Engine) VerifyUpdateMarketState(changes *types.MarketStateUpdateConfiguration) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMarketDoesNotExist is returned when the market does not exist. ErrMarketDoesNotExist = errors.New("market does not exist") // ErrNotAFutureMarket is returned when the market isn't a future market. ErrNotAFutureMarket = errors.New("not a future market") // ErrNoMarketID is returned when invalid (empty) market id was supplied during market creation. ErrNoMarketID = errors.New("no valid market id was supplied") // ErrInvalidOrderCancellation is returned when an incomplete order cancellation request is used. ErrInvalidOrderCancellation = errors.New("invalid order cancellation") // ErrSuccessorMarketDoesNotExists is returned when SucceedMarket call is made with an invalid successor market ID. ErrSuccessorMarketDoesNotExist = errors.New("successor market does not exist") // ErrParentMarketNotEnactedYet is returned when trying to enact a successor market that is still in proposed state. ErrParentMarketNotEnactedYet = errors.New("parent market in proposed state, can't enact successor") // ErrInvalidStopOrdersCancellation is returned when an incomplete stop orders cancellation request is used. ErrInvalidStopOrdersCancellation = errors.New("invalid stop orders cancellation") // ErrMarketIDRequiredWhenOrderIDSpecified is returned when a stop order cancellation is emitted without an order id. ErrMarketIDRequiredWhenOrderIDSpecified = errors.New("market id required when order id specified") // ErrStopOrdersNotAcceptedDuringOpeningAuction is returned if a stop order is submitted when the market is in the opening auction. ErrStopOrdersNotAcceptedDuringOpeningAuction = errors.New("stop orders are not accepted during the opening auction") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Level encoding.LogLevel `long:"log-level"` Matching matching.Config `group:"Matching" namespace:"matching"` Risk risk.Config `group:"Risk" namespace:"risk"` Position positions.Config `group:"Position" namespace:"position"` Settlement settlement.Config `group:"Settlement" namespace:"settlement"` Fee fee.Config `group:"Fee" namespace:"fee"` Liquidity liquidity.Config `group:"LiquidityV2" namespace:"liquidityV2"` }
Config is the configuration of the execution package.
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig creates an instance of the package specific configuration, given a pointer to a logger instance to be used for logging within the package.
type Engine ¶
type Engine struct { Config // contains filtered or unexported fields }
Engine is the execution engine.
func NewEngine ¶
func NewEngine( log *logging.Logger, executionConfig Config, ts common.TimeService, collateral common.Collateral, oracle common.OracleEngine, broker common.Broker, stateVarEngine common.StateVarEngine, marketActivityTracker *common.MarketActivityTracker, assets common.Assets, referralDiscountRewardService fee.ReferralDiscountRewardService, volumeDiscountService fee.VolumeDiscountService, banking common.Banking, parties common.Parties, delayTransactionsTarget common.DelayTransactionsTarget, ) *Engine
NewEngine takes stores and engines and returns a new execution engine to process new orders, etc.
func (*Engine) AmendLiquidityProvision ¶
func (*Engine) AmendOrder ¶
func (e *Engine) AmendOrder(ctx context.Context, amendment *types.OrderAmendment, party string, idgen common.IDGenerator) (*types.OrderConfirmation, error)
AmendOrder takes order amendment details and attempts to amend the order if it exists and is in a editable state.
func (*Engine) BeginBlock ¶ added in v0.73.0
func (*Engine) CancelLiquidityProvision ¶
func (*Engine) CancelOrder ¶
func (e *Engine) CancelOrder( ctx context.Context, cancel *types.OrderCancellation, party string, idgen common.IDGenerator, ) (_ []*types.OrderCancellationConfirmation, returnedErr error)
CancelOrder takes order details and attempts to cancel if it exists in matching engine, stores etc.
func (*Engine) CancelStopOrders ¶ added in v0.72.0
func (e *Engine) CancelStopOrders(ctx context.Context, cancel *types.StopOrdersCancellation, party string, idgen common.IDGenerator) error
func (*Engine) CheckCanSubmitOrderOrLiquidityCommitment ¶ added in v0.77.0
func (*Engine) CheckOrderSubmissionForSpam ¶ added in v0.77.0
func (e *Engine) CheckOrderSubmissionForSpam(orderSubmission *types.OrderSubmission, party string) error
func (*Engine) Checkpoint ¶ added in v0.72.0
func (*Engine) GetEquityLikeShareForMarketAndParty ¶
GetEquityLikeShareForMarketAndParty return the equity-like shares of the given party in the given market. If the market doesn't exist, it returns false.
func (*Engine) GetFillPriceForMarket ¶ added in v0.75.0
func (*Engine) GetMarketCounters ¶ added in v0.63.0
func (e *Engine) GetMarketCounters() map[string]*types.MarketCounters
GetMarketCounters returns the per-market counts used for gas estimation.
func (*Engine) GetMarketData ¶
func (e *Engine) GetMarketData(mktID string) (types.MarketData, error)
func (*Engine) GetMarketState ¶
func (e *Engine) GetMarketState(mktID string) (types.MarketState, error)
func (*Engine) GetMarketStats ¶ added in v0.73.0
func (e *Engine) GetMarketStats() map[string]*types.MarketStats
func (*Engine) IsEligibleForProposerBonus ¶
IsEligibleForProposerBonus checks if the given value is greater than that market quantum * quantum_multiplier.
func (*Engine) IsSucceeded ¶ added in v0.72.0
func (*Engine) MarketExists ¶
func (*Engine) Name ¶ added in v0.72.0
func (e *Engine) Name() types.CheckpointName
func (*Engine) Namespace ¶
func (e *Engine) Namespace() types.SnapshotNamespace
func (*Engine) OnChainIDUpdate ¶ added in v0.74.0
func (*Engine) OnEpochEvent ¶ added in v0.73.0
func (*Engine) OnEpochRestore ¶ added in v0.73.0
func (*Engine) OnInternalCompositePriceUpdateFrequency ¶ added in v0.74.0
func (*Engine) OnMarkPriceUpdateMaximumFrequency ¶ added in v0.63.0
func (*Engine) OnMarketAMMMaxCalculationLevels ¶ added in v0.77.0
func (*Engine) OnMarketAMMMinCommitmentQuantum ¶ added in v0.77.0
func (*Engine) OnMarketAuctionMaximumDurationUpdate ¶ added in v0.73.0
func (*Engine) OnMarketAuctionMinimumDurationUpdate ¶
func (*Engine) OnMarketCreationQuantumMultipleUpdate ¶
func (*Engine) OnMarketFeeFactorsInfrastructureFeeUpdate ¶
func (*Engine) OnMarketFeeFactorsMakerFeeUpdate ¶
func (*Engine) OnMarketLiquidityEquityLikeShareFeeFractionUpdate ¶ added in v0.77.0
func (*Engine) OnMarketLiquidityMaximumLiquidityFeeFactorLevelUpdate ¶
func (e *Engine) OnMarketLiquidityMaximumLiquidityFeeFactorLevelUpdate(_ context.Context, d num.Decimal) error
to be removed and replaced by its v2 counterpart. in use only for future.
func (*Engine) OnMarketLiquidityV2BondPenaltyUpdate ¶ added in v0.72.0
OnMarketLiquidityV2BondPenaltyUpdate stores net param on execution engine and applies to markets at the start of new epoch.
func (*Engine) OnMarketLiquidityV2EarlyExitPenaltyUpdate ¶ added in v0.72.0
OnMarketLiquidityV2EarlyExitPenaltyUpdate stores net param on execution engine and applies to markets at the start of new epoch.
func (*Engine) OnMarketLiquidityV2MaximumLiquidityFeeFactorLevelUpdate ¶ added in v0.72.0
func (e *Engine) OnMarketLiquidityV2MaximumLiquidityFeeFactorLevelUpdate(_ context.Context, d num.Decimal) error
OnMarketLiquidityV2MaximumLiquidityFeeFactorLevelUpdate stores net param on execution engine and applies at the start of new epoch.
func (*Engine) OnMarketLiquidityV2ProvidersFeeCalculationTimeStep ¶ added in v0.73.0
func (e *Engine) OnMarketLiquidityV2ProvidersFeeCalculationTimeStep(_ context.Context, d time.Duration) error
OnMarketLiquidityV2ProvidersFeeCalculationTimeStep stores net param on execution engine and applies to markets at the start of new epoch.
func (*Engine) OnMarketLiquidityV2SLANonPerformanceBondPenaltyMaxUpdate ¶ added in v0.72.0
func (e *Engine) OnMarketLiquidityV2SLANonPerformanceBondPenaltyMaxUpdate(_ context.Context, d num.Decimal) error
OnMarketLiquidityV2SLANonPerformanceBondPenaltyMaxUpdate stores net param on execution engine and applies to markets at the start of new epoch.
func (*Engine) OnMarketLiquidityV2SLANonPerformanceBondPenaltySlopeUpdate ¶ added in v0.72.0
func (e *Engine) OnMarketLiquidityV2SLANonPerformanceBondPenaltySlopeUpdate(_ context.Context, d num.Decimal) error
OnMarketLiquidityV2SLANonPerformanceBondPenaltySlopeUpdate stores net param on execution engine and applies to markets at the start of new epoch.
func (*Engine) OnMarketLiquidityV2StakeToCCYVolumeUpdate ¶ added in v0.73.0
OnMarketLiquidityV2StakeToCCYVolumeUpdate stores net param on execution engine and applies to markets at the start of new epoch.
func (*Engine) OnMarketMarginScalingFactorsUpdate ¶
func (*Engine) OnMarketMinProbabilityOfTradingForLPOrdersUpdate ¶
func (*Engine) OnMarketPartiesMaximumStopOrdersUpdate ¶ added in v0.72.0
func (*Engine) OnMarketProbabilityOfTradingTauScalingUpdate ¶
func (*Engine) OnMarketValueWindowLengthUpdate ¶
func (*Engine) OnMaxPeggedOrderUpdate ¶ added in v0.63.0
func (*Engine) OnMinLpStakeQuantumMultipleUpdate ¶
func (*Engine) OnMinimalHoldingQuantumMultipleUpdate ¶ added in v0.77.0
func (*Engine) OnMinimalMarginQuantumMultipleUpdate ¶ added in v0.77.0
func (*Engine) OnSuccessorMarketTimeWindowUpdate ¶ added in v0.72.0
func (*Engine) RejectMarket ¶
RejectMarket will stop the execution of the market and refund into the general account any funds in margins accounts from any parties This works only if the market is in a PROPOSED STATE.
func (*Engine) ReloadConf ¶
ReloadConf updates the internal configuration of the execution engine and its dependencies.
func (*Engine) RestoreMarket ¶
RestoreMarket restores a new market from proposal checkpoint.
func (*Engine) StartOpeningAuction ¶
StartOpeningAuction will start the opening auction of the given market. This will work only if the market is currently in a PROPOSED state.
func (*Engine) SubmitLiquidityProvision ¶
func (*Engine) SubmitMarket ¶
func (e *Engine) SubmitMarket(ctx context.Context, marketConfig *types.Market, proposer string, oos time.Time) error
SubmitMarket submits a new market configuration to the network.
func (*Engine) SubmitOrder ¶
func (e *Engine) SubmitOrder(ctx context.Context, submission *types.OrderSubmission, party string, idgen common.IDGenerator, orderID string) (*types.OrderConfirmation, error)
SubmitOrder checks the incoming order and submits it to a Vega market.
func (*Engine) SubmitSpotMarket ¶ added in v0.73.0
func (e *Engine) SubmitSpotMarket(ctx context.Context, marketConfig *types.Market, proposer string, oos time.Time) error
SubmitSpotMarket submits a new spot market configuration to the network.
func (*Engine) SubmitStopOrders ¶ added in v0.72.0
func (e *Engine) SubmitStopOrders( ctx context.Context, submission *types.StopOrdersSubmission, party string, idgen common.IDGenerator, fallsBelowID *string, risesAboveID *string, ) (*types.OrderConfirmation, error)
func (*Engine) SucceedMarket ¶ added in v0.72.0
func (*Engine) UpdateMarginMode ¶ added in v0.74.0
func (*Engine) UpdateMarket ¶
UpdateMarket will update an existing market configuration.
func (*Engine) UpdateMarketState ¶ added in v0.73.0
func (*Engine) UpdateSpotMarket ¶ added in v0.73.0
UpdateSpotMarket will update an existing market configuration.
func (*Engine) ValidateSettlementData ¶ added in v0.77.0
func (*Engine) VerifyUpdateMarketState ¶ added in v0.73.0
func (e *Engine) VerifyUpdateMarketState(changes *types.MarketStateUpdateConfiguration) error
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
mocks_amm
Package mocks_amm is a generated GoMock package.
|
Package mocks_amm is a generated GoMock package. |
mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |