Documentation ¶
Index ¶
- Variables
- type Config
- type Engine
- func (e *Engine) AmendLiquidityProvision(ctx context.Context, lpa *types.LiquidityProvisionAmendment, party string, ...) (returnedErr error)
- func (e *Engine) AmendOrder(ctx context.Context, amendment *types.OrderAmendment, party string, ...) (confirmation *types.OrderConfirmation, returnedErr error)
- func (e *Engine) BlockEnd(ctx context.Context)
- func (e *Engine) CancelLiquidityProvision(ctx context.Context, cancel *types.LiquidityProvisionCancellation, ...) (returnedErr 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) Checkpoint() ([]byte, error)
- func (e *Engine) GetAsset(assetID string) (types.Asset, bool)
- func (e *Engine) GetEquityLikeShareForMarketAndParty(market, party string) (num.Decimal, bool)
- 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) 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) OnMarkPriceUpdateMaximumFrequency(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) OnMarketLiquidityBondPenaltyUpdate(ctx context.Context, d num.Decimal) error
- func (e *Engine) OnMarketLiquidityMaximumLiquidityFeeFactorLevelUpdate(_ context.Context, d num.Decimal) error
- func (e *Engine) OnMarketLiquidityProvidersFeeDistributionTimeStep(_ context.Context, d time.Duration) error
- func (e *Engine) OnMarketLiquidityProvisionShapesMaxSizeUpdate(_ context.Context, v int64) error
- func (e *Engine) OnMarketLiquidityV2BondPenaltyUpdate(ctx 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) OnMarketLiquidityV2SLANonPerformanceBondPenaltyMaxUpdate(_ context.Context, d num.Decimal) error
- func (e *Engine) OnMarketLiquidityV2SLANonPerformanceBondPenaltySlopeUpdate(_ context.Context, d num.Decimal) error
- func (e *Engine) OnMarketLiquidityV2SuppliedStakeToObligationFactorUpdate(_ 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) OnStateLoaded(ctx context.Context) error
- func (e *Engine) OnSuccessorMarketTimeWindowUpdate(ctx context.Context, window time.Duration) error
- func (e *Engine) OnSuppliedStakeToObligationFactorUpdate(_ context.Context, d num.Decimal) 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) SpotsMarketsEnabled() bool
- func (e *Engine) StartOpeningAuction(ctx context.Context, marketID string) error
- func (e *Engine) Stopped() bool
- func (e *Engine) SubmitLiquidityProvision(ctx context.Context, sub *types.LiquidityProvisionSubmission, ...) (returnedErr 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, ...) (confirmation *types.OrderConfirmation, returnedErr 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) UpdateMarket(ctx context.Context, marketConfig *types.Market) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMarketDoesNotExist is returned when the market does not exist. ErrMarketDoesNotExist = errors.New("market does not exist") // 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") )
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:"Liquidity" namespace:"liquidity"` }
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, ) *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, ) (confirmation *types.OrderConfirmation, returnedErr error)
AmendOrder takes order amendment details and attempts to amend the order if it exists and is in a editable state.
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) 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) 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) 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) OnMarkPriceUpdateMaximumFrequency ¶ added in v0.63.0
func (*Engine) OnMarketAuctionMinimumDurationUpdate ¶
func (*Engine) OnMarketCreationQuantumMultipleUpdate ¶
func (*Engine) OnMarketFeeFactorsInfrastructureFeeUpdate ¶
func (*Engine) OnMarketFeeFactorsMakerFeeUpdate ¶
func (*Engine) OnMarketLiquidityBondPenaltyUpdate ¶
func (*Engine) OnMarketLiquidityMaximumLiquidityFeeFactorLevelUpdate ¶
func (*Engine) OnMarketLiquidityProvidersFeeDistributionTimeStep ¶
func (*Engine) OnMarketLiquidityProvisionShapesMaxSizeUpdate ¶
func (*Engine) OnMarketLiquidityV2BondPenaltyUpdate ¶ added in v0.72.0
func (*Engine) OnMarketLiquidityV2EarlyExitPenaltyUpdate ¶ added in v0.72.0
func (*Engine) OnMarketLiquidityV2MaximumLiquidityFeeFactorLevelUpdate ¶ added in v0.72.0
func (*Engine) OnMarketLiquidityV2SLANonPerformanceBondPenaltyMaxUpdate ¶ added in v0.72.0
func (*Engine) OnMarketLiquidityV2SLANonPerformanceBondPenaltySlopeUpdate ¶ added in v0.72.0
func (*Engine) OnMarketLiquidityV2SuppliedStakeToObligationFactorUpdate ¶ added in v0.72.0
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) OnSuccessorMarketTimeWindowUpdate ¶ added in v0.72.0
func (*Engine) OnSuppliedStakeToObligationFactorUpdate ¶
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) SpotsMarketsEnabled ¶ added in v0.72.0
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, ) (confirmation *types.OrderConfirmation, returnedErr error)
SubmitOrder checks the incoming order and submits it to a Vega market.
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)