Documentation ¶
Index ¶
- Constants
- Variables
- type Assets
- type AuctionState
- type Broker
- type Collateral
- type Config
- type EligibilityChecker
- 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) GetAsset(assetID string) (types.Asset, bool)
- func (e *Engine) GetEquityLikeShareForMarketAndParty(market, party string) (num.Decimal, bool)
- func (e *Engine) GetMarket(market string) (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) Keys() []string
- func (e *Engine) LoadState(ctx context.Context, payload *types.Payload) ([]types.StateProvider, error)
- func (e *Engine) MarketExists(market string) bool
- 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) OnMarketLiquidityTargetStakeTriggeringRatio(ctx 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) OnMarketProbabilityOfTradingTauScalingUpdate(ctx context.Context, d num.Decimal) error
- func (e *Engine) OnMarketTargetStakeScalingFactorUpdate(_ context.Context, d num.Decimal) error
- func (e *Engine) OnMarketTargetStakeTimeWindowUpdate(_ context.Context, d time.Duration) 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) 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) 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) UpdateMarket(ctx context.Context, marketConfig *types.Market) error
- type EpochEngine
- type EquityShares
- func (es *EquityShares) AllShares() map[string]num.Decimal
- func (es *EquityShares) AvgEntryValuation(id string) num.Decimal
- func (es *EquityShares) AvgTradeValue(avg num.Decimal) *EquityShares
- func (es EquityShares) Changed() bool
- func (es *EquityShares) GetState() *types.EquityShare
- func (es *EquityShares) GetTotalVStake() num.Decimal
- func (es *EquityShares) OpeningAuctionEnded()
- func (es *EquityShares) SetPartyStake(id string, newStakeU *num.Uint)
- func (es *EquityShares) SharesExcept(except map[string]struct{}) map[string]num.Decimal
- func (es *EquityShares) SharesFromParty(party string) num.Decimal
- func (es *EquityShares) UpdateVStake()
- type ExpiringOrders
- func (a ExpiringOrders) Changed() bool
- func (a *ExpiringOrders) Expire(ts int64) []string
- func (a *ExpiringOrders) GetExpiryingOrderCount() int
- func (a *ExpiringOrders) GetState() []*types.Order
- func (a *ExpiringOrders) Insert(orderID string, ts int64)
- func (a *ExpiringOrders) RemoveOrder(expiresAt int64, orderID string) bool
- type FeeSplitter
- func (fs *FeeSplitter) AddTradeValue(v *num.Uint)
- func (fs *FeeSplitter) AvgTradeValue() num.Decimal
- func (fs *FeeSplitter) Changed() bool
- func (fs *FeeSplitter) Elapsed() time.Duration
- func (fs *FeeSplitter) GetState() *types.FeeSplitter
- func (fs *FeeSplitter) MarketValueProxy(mvwl time.Duration, totalStakeU *num.Uint) num.Decimal
- func (fs *FeeSplitter) SetCurrentTime(t time.Time) error
- func (fs *FeeSplitter) TimeWindowStart(t time.Time)
- type IDGenerator
- type LiquidityMonitor
- type Market
- func (m *Market) AmendLiquidityProvision(ctx context.Context, lpa *types.LiquidityProvisionAmendment, party string, ...) (err 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) BondPenaltyFactorUpdate(ctx context.Context, d num.Decimal)
- func (m *Market) CanLeaveOpeningAuction() bool
- func (m *Market) CancelAllOrders(ctx context.Context, partyID string) ([]*types.OrderCancellationConfirmation, error)
- func (m *Market) CancelLiquidityProvision(ctx context.Context, cancel *types.LiquidityProvisionCancellation, ...) (err 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 IDGenerator) (oc *types.OrderCancellationConfirmation, _ error)
- func (m *Market) GetID() string
- func (m *Market) GetMarketData() types.MarketData
- func (m *Market) GetMarketState() types.MarketState
- func (m *Market) GetTotalLPShapeCount() uint64
- func (m *Market) GetTotalOpenPositionCount() uint64
- func (m *Market) GetTotalOrderBookLevelCount() uint64
- func (m *Market) GetTotalPeggedOrderCount() uint64
- func (m *Market) Hash() []byte
- func (m *Market) IntoType() types.Market
- func (m *Market) OnAuctionEnded()
- func (m *Market) OnFeeFactorsInfrastructureFeeUpdate(ctx context.Context, d num.Decimal) error
- func (m *Market) OnFeeFactorsMakerFeeUpdate(ctx context.Context, d num.Decimal) error
- func (m *Market) OnMarginScalingFactorsUpdate(ctx context.Context, sf *types.ScalingFactors) error
- func (m *Market) OnMarkPriceUpdateMaximumFrequency(ctx context.Context, d time.Duration)
- func (m *Market) OnMarketAuctionMinimumDurationUpdate(ctx context.Context, d time.Duration)
- func (m *Market) OnMarketLiquidityMaximumLiquidityFeeFactorLevelUpdate(d num.Decimal)
- func (m *Market) OnMarketLiquidityProvidersFeeDistribitionTimeStep(d time.Duration)
- func (m *Market) OnMarketLiquidityProvisionShapesMaxSizeUpdate(v int64) error
- func (m *Market) OnMarketLiquidityTargetStakeTriggeringRatio(ctx context.Context, d num.Decimal)
- func (m *Market) OnMarketMinLpStakeQuantumMultipleUpdate(_ context.Context, d num.Decimal)
- func (m *Market) OnMarketMinProbabilityOfTradingLPOrdersUpdate(_ context.Context, d num.Decimal)
- 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) OnOpeningAuctionFirstUncrossingPrice()
- func (m *Market) OnSuppliedStakeToObligationFactorUpdate(d num.Decimal)
- 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, riskConfig risk.Config, ...)
- func (m *Market) StartOpeningAuction(ctx context.Context) error
- func (m *Market) SubmitLiquidityProvision(ctx context.Context, sub *types.LiquidityProvisionSubmission, ...) (err 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) Update(ctx context.Context, config *types.Market, oracleEngine products.OracleEngine) error
- type MarketActivityTracker
- func (mat *MarketActivityTracker) AddValueTraded(marketID string, value *num.Uint)
- func (mat *MarketActivityTracker) Checkpoint() ([]byte, error)
- func (mat *MarketActivityTracker) GetAllMarketIDs() []string
- func (mat *MarketActivityTracker) GetFeePartyScores(market string, feeType types.TransferType) []*types.PartyContibutionScore
- func (mat *MarketActivityTracker) GetMarketScores(asset string, markets []string, dispatchMetric vega.DispatchMetric) []*types.MarketContributionScore
- func (mat *MarketActivityTracker) GetMarketsWithEligibleProposer(asset string, markets []string, payoutAsset string, funder string) []*types.MarketContributionScore
- func (mat *MarketActivityTracker) GetProposer(market string) string
- func (mat *MarketActivityTracker) GetState(k string) ([]byte, []types.StateProvider, error)
- func (mat *MarketActivityTracker) IsMarketEligibleForBonus(market string, payoutAsset string, marketsInScope []string, funder string) bool
- func (mat *MarketActivityTracker) Keys() []string
- func (mat *MarketActivityTracker) Load(ctx context.Context, data []byte) error
- func (mat *MarketActivityTracker) LoadState(ctx context.Context, p *types.Payload) ([]types.StateProvider, error)
- func (mat *MarketActivityTracker) MarkPaidProposer(market, payoutAsset string, marketsInScope []string, funder string)
- func (mat *MarketActivityTracker) MarketProposed(asset, marketID, proposer string)
- func (mat *MarketActivityTracker) Name() types.CheckpointName
- func (mat *MarketActivityTracker) Namespace() types.SnapshotNamespace
- func (mat *MarketActivityTracker) RemoveMarket(marketID string)
- func (mat *MarketActivityTracker) SetEligibilityChecker(eligibilityChecker EligibilityChecker)
- func (mat *MarketActivityTracker) Stopped() bool
- func (mat *MarketActivityTracker) UpdateFeesFromTransfers(market string, transfers []*types.Transfer)
- type MarketCollateral
- type OracleEngine
- type OrderReferenceCheck
- type PeggedOrders
- func (p *PeggedOrders) AmendParked(amended *types.Order)
- func (p *PeggedOrders) Changed() bool
- func (p *PeggedOrders) EnterAuction(ctx context.Context) []events.Event
- func (p *PeggedOrders) GetAllParkedForParty(party string) (orders []*types.Order)
- func (p *PeggedOrders) GetParkedByID(id string) *types.Order
- func (p *PeggedOrders) GetParkedIDs() []string
- func (p *PeggedOrders) GetParkedOrdersCount() int
- func (p *PeggedOrders) GetState() *types.PeggedOrdersState
- func (p *PeggedOrders) IsParked(id string) bool
- func (p *PeggedOrders) Park(o *types.Order)
- func (p *PeggedOrders) RemoveAllForParty(ctx context.Context, party string, status types.OrderStatus) (orders []*types.Order, evts []events.Event)
- func (p *PeggedOrders) Settled() []*types.Order
- func (p *PeggedOrders) Unpark(oid string)
- type PriceMonitor
- type StateVarEngine
- type TargetStakeCalculator
- type TimeService
Constants ¶
const ( // PriceMoveMid used to indicate that the mid price has moved. PriceMoveMid = 1 // PriceMoveBestBid used to indicate that the best bid price has moved. PriceMoveBestBid = 2 // PriceMoveBestAsk used to indicate that the best ask price has moved. PriceMoveBestAsk = 4 // PriceMoveAll used to indicate everything has moved. PriceMoveAll = PriceMoveMid + PriceMoveBestBid + PriceMoveBestAsk )
const InitialOrderVersion = 1
InitialOrderVersion is set on `Version` field for every new order submission read from the network.
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") )
var ( // ErrMarketClosed signals that an action have been tried to be applied on a closed market. ErrMarketClosed = errors.New("market closed") // ErrPartyDoNotExists signals that the party used does not exists. ErrPartyDoNotExists = errors.New("party does not exist") // ErrMarginCheckFailed signals that a margin check for a position failed. ErrMarginCheckFailed = errors.New("margin check failed") // ErrMarginCheckInsufficient signals that a margin had not enough funds. ErrMarginCheckInsufficient = errors.New("insufficient margin") // ErrMissingGeneralAccountForParty ... ErrMissingGeneralAccountForParty = errors.New("missing general account for party") // ErrNotEnoughVolumeToZeroOutNetworkOrder ... ErrNotEnoughVolumeToZeroOutNetworkOrder = errors.New("not enough volume to zero out network order") // ErrInvalidAmendRemainQuantity signals incorrect remaining qty for a reduce by amend. ErrInvalidAmendRemainQuantity = errors.New("incorrect remaining qty for a reduce by amend") // ErrEmptyMarketID is returned if processed market has an empty id. ErrEmptyMarketID = errors.New("invalid market id (empty)") // ErrInvalidOrderType is returned if processed order has an invalid order type. ErrInvalidOrderType = errors.New("invalid order type") // ErrInvalidExpiresAtTime is returned if the expire time is before the createdAt time. ErrInvalidExpiresAtTime = errors.New("invalid expiresAt time") // ErrGFAOrderReceivedDuringContinuousTrading is returned is a gfa order hits the market when the market is in continuous trading state. ErrGFAOrderReceivedDuringContinuousTrading = errors.New("gfa order received during continuous trading") // ErrGFNOrderReceivedAuctionTrading is returned if a gfn order hits the market when in auction state. ErrGFNOrderReceivedAuctionTrading = errors.New("gfn order received during auction trading") // ErrIOCOrderReceivedAuctionTrading is returned if a ioc order hits the market when in auction state. ErrIOCOrderReceivedAuctionTrading = errors.New("ioc order received during auction trading") // ErrFOKOrderReceivedAuctionTrading is returned if a fok order hits the market when in auction state. ErrFOKOrderReceivedAuctionTrading = errors.New("fok order received during auction trading") // ErrUnableToReprice we are unable to get a price required to reprice. ErrUnableToReprice = errors.New("unable to reprice") // ErrOrderNotFound we cannot find the order in the market. ErrOrderNotFound = errors.New("unable to find the order in the market") // ErrTradingNotAllowed no trading related functionalities are allowed in the current state. ErrTradingNotAllowed = errors.New("trading not allowed") // ErrCommitmentSubmissionNotAllowed no commitment submission are permitted in the current state. ErrCommitmentSubmissionNotAllowed = errors.New("commitment submission not allowed") // ErrNotEnoughStake is returned when a LP update results in not enough commitment. ErrNotEnoughStake = errors.New("commitment submission rejected, not enough stake") // ErrPartyNotLiquidityProvider is returned when a LP update or cancel does not match an LP party. ErrPartyNotLiquidityProvider = errors.New("party is not a liquidity provider") // ErrPartyAlreadyLiquidityProvider is returned when a LP is submitted by a party which is already LP. ErrPartyAlreadyLiquidityProvider = errors.New("party is already a liquidity provider") // ErrCannotRejectMarketNotInProposedState. ErrCannotRejectMarketNotInProposedState = errors.New("cannot reject a market not in proposed state") // ErrCannotStateOpeningAuctionForMarketNotInProposedState. ErrCannotStartOpeningAuctionForMarketNotInProposedState = errors.New("cannot start the opening auction for a market not in proposed state") // ErrCannotRepriceDuringAuction. ErrCannotRepriceDuringAuction = errors.New("cannot reprice during auction") )
var ErrBondSlashing = errors.New("bond slashing")
ErrBondSlashing - just indicates that we had to penalize the party due to insufficient funds, and as such, we have to cancel their LP.
var ErrCommitmentAmountTooLow = errors.New("commitment amount is too low")
var (
ErrSnapshotKeyDoesNotExist = errors.New("unknown key for market activity tracker snapshot")
)
Functions ¶
This section is empty.
Types ¶
type AuctionState ¶
type AuctionState interface { price.AuctionState lmon.AuctionState // are we in auction, and what auction are we in? InAuction() bool IsOpeningAuction() bool IsPriceAuction() bool IsLiquidityAuction() bool IsFBA() bool IsMonitorAuction() bool // is it the start/end of an auction AuctionStart() bool CanLeave() bool // when does the auction start/end ExpiresAt() *time.Time Start() time.Time // signal we've started/ended the auction AuctionStarted(ctx context.Context, time time.Time) *events.Auction AuctionExtended(ctx context.Context, time time.Time) *events.Auction ExtendAuction(delta types.AuctionDuration) Left(ctx context.Context, now time.Time) *events.Auction // get some data Mode() types.MarketTradingMode Trigger() types.AuctionTrigger ExtensionTrigger() types.AuctionTrigger // UpdateMinDuration works out whether or not the current auction period (if applicable) should be extended UpdateMinDuration(ctx context.Context, d time.Duration) *events.Auction // Snapshot GetState() *types.AuctionState Changed() bool }
AuctionState ...
type Collateral ¶
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 EligibilityChecker ¶
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 TimeService, collateral Collateral, oracle OracleEngine, broker Broker, stateVarEngine StateVarEngine, marketActivityTracker *MarketActivityTracker, assets 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 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 IDGenerator, ) (_ []*types.OrderCancellationConfirmation, returnedErr error)
CancelOrder takes order details and attempts to cancel if it exists in matching engine, stores etc.
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) MarketExists ¶
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) OnMarketLiquidityTargetStakeTriggeringRatio ¶
func (*Engine) OnMarketMarginScalingFactorsUpdate ¶
func (*Engine) OnMarketMinProbabilityOfTradingForLPOrdersUpdate ¶
func (*Engine) OnMarketProbabilityOfTradingTauScalingUpdate ¶
func (*Engine) OnMarketTargetStakeScalingFactorUpdate ¶
func (*Engine) OnMarketTargetStakeTimeWindowUpdate ¶
func (*Engine) OnMarketValueWindowLengthUpdate ¶
func (*Engine) OnMaxPeggedOrderUpdate ¶ added in v0.63.0
func (*Engine) OnMinLpStakeQuantumMultipleUpdate ¶
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) 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) 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 IDGenerator, orderID string, ) (confirmation *types.OrderConfirmation, returnedErr error)
SubmitOrder checks the incoming order and submits it to a Vega market.
type EpochEngine ¶
type EquityShares ¶
type EquityShares struct {
// contains filtered or unexported fields
}
EquityShares module controls the Equity sharing algorithm described on the spec: https://github.com/vegaprotocol/product/blob/02af55e048a92a204e9ee7b7ae6b4475a198c7ff/specs/0042-setting-fees-and-rewarding-lps.md#calculating-liquidity-provider-equity-like-share
func NewEquityShares ¶
func NewEquityShares(mvp num.Decimal) *EquityShares
func NewEquitySharesFromSnapshot ¶
func NewEquitySharesFromSnapshot(state *types.EquityShare) *EquityShares
func (*EquityShares) AllShares ¶
func (es *EquityShares) AllShares() map[string]num.Decimal
AllShares returns the ratio of equity for each party on the market.
func (*EquityShares) AvgEntryValuation ¶
func (es *EquityShares) AvgEntryValuation(id string) num.Decimal
AvgEntryValuation returns the Average Entry Valuation for a given party.
func (*EquityShares) AvgTradeValue ¶ added in v0.55.0
func (es *EquityShares) AvgTradeValue(avg num.Decimal) *EquityShares
func (EquityShares) Changed ¶
func (es EquityShares) Changed() bool
func (*EquityShares) GetState ¶
func (es *EquityShares) GetState() *types.EquityShare
func (*EquityShares) GetTotalVStake ¶ added in v0.56.0
func (es *EquityShares) GetTotalVStake() num.Decimal
func (*EquityShares) OpeningAuctionEnded ¶
func (es *EquityShares) OpeningAuctionEnded()
OpeningAuctionEnded signal to the EquityShare that the opening auction has ended.
func (*EquityShares) SetPartyStake ¶
func (es *EquityShares) SetPartyStake(id string, newStakeU *num.Uint)
SetPartyStake sets LP values for a given party.
func (*EquityShares) SharesExcept ¶
func (es *EquityShares) SharesExcept(except map[string]struct{}) map[string]num.Decimal
SharesExcept returns the ratio of equity for each party on the market, except the ones listed in parameter.
func (*EquityShares) SharesFromParty ¶
func (es *EquityShares) SharesFromParty(party string) num.Decimal
SharesFromParty returns the equity-like shares of a given party on the market.
func (*EquityShares) UpdateVStake ¶ added in v0.55.0
func (es *EquityShares) UpdateVStake()
type ExpiringOrders ¶
type ExpiringOrders struct {
// contains filtered or unexported fields
}
func NewExpiringOrders ¶
func NewExpiringOrders() *ExpiringOrders
func NewExpiringOrdersFromState ¶
func NewExpiringOrdersFromState(orders []*types.Order) *ExpiringOrders
func (ExpiringOrders) Changed ¶
func (a ExpiringOrders) Changed() bool
func (*ExpiringOrders) Expire ¶
func (a *ExpiringOrders) Expire(ts int64) []string
func (*ExpiringOrders) GetExpiryingOrderCount ¶
func (a *ExpiringOrders) GetExpiryingOrderCount() int
func (*ExpiringOrders) GetState ¶
func (a *ExpiringOrders) GetState() []*types.Order
func (*ExpiringOrders) Insert ¶
func (a *ExpiringOrders) Insert( orderID string, ts int64, )
func (*ExpiringOrders) RemoveOrder ¶
func (a *ExpiringOrders) RemoveOrder(expiresAt int64, orderID string) bool
type FeeSplitter ¶
type FeeSplitter struct {
// contains filtered or unexported fields
}
func NewFeeSplitter ¶
func NewFeeSplitter() *FeeSplitter
func NewFeeSplitterFromSnapshot ¶
func NewFeeSplitterFromSnapshot(fs *types.FeeSplitter, now time.Time) *FeeSplitter
func (*FeeSplitter) AddTradeValue ¶
func (fs *FeeSplitter) AddTradeValue(v *num.Uint)
func (*FeeSplitter) AvgTradeValue ¶ added in v0.55.0
func (fs *FeeSplitter) AvgTradeValue() num.Decimal
func (*FeeSplitter) Changed ¶
func (fs *FeeSplitter) Changed() bool
func (*FeeSplitter) Elapsed ¶
func (fs *FeeSplitter) Elapsed() time.Duration
Elapsed returns the distance (in duration) from TimeWindowStart and CurrentTime.
func (*FeeSplitter) GetState ¶
func (fs *FeeSplitter) GetState() *types.FeeSplitter
func (*FeeSplitter) MarketValueProxy ¶
MarketValueProxy returns the market value proxy according to the spec: https://github.com/vegaprotocol/product/blob/master/specs/0042-setting-fees-and-rewarding-lps.md
func (*FeeSplitter) SetCurrentTime ¶
func (fs *FeeSplitter) SetCurrentTime(t time.Time) error
func (*FeeSplitter) TimeWindowStart ¶
func (fs *FeeSplitter) TimeWindowStart(t time.Time)
TimeWindowStart starts or restarts (if active) a current time window. This sets the internal timers to `t` and resets the accumulated trade values.
type IDGenerator ¶
type IDGenerator interface {
NextID() string
}
type LiquidityMonitor ¶
type LiquidityMonitor interface { CheckLiquidity(as lmon.AuctionState, t time.Time, currentStake *num.Uint, trades []*types.Trade, rf types.RiskFactor, markPrice *num.Uint, bestStaticBidVolume, bestStaticAskVolume uint64, persistent bool) bool SetMinDuration(d time.Duration) UpdateTargetStakeTriggerRatio(ctx context.Context, ratio num.Decimal) UpdateParameters(*types.LiquidityMonitoringParameters) }
LiquidityMonitor.
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( ctx context.Context, log *logging.Logger, riskConfig risk.Config, positionConfig positions.Config, settlementConfig settlement.Config, matchingConfig matching.Config, feeConfig fee.Config, liquidityConfig liquidity.Config, collateralEngine MarketCollateral, oracleEngine products.OracleEngine, mkt *types.Market, timeService TimeService, broker Broker, as *monitor.AuctionState, stateVarEngine StateVarEngine, marketActivityTracker *MarketActivityTracker, assetDetails *assets.Asset, peggedOrderNotify func(int64), ) (*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.ExecMarket, riskConfig risk.Config, positionConfig positions.Config, settlementConfig settlement.Config, matchingConfig matching.Config, feeConfig fee.Config, liquidityConfig liquidity.Config, collateralEngine MarketCollateral, oracleEngine products.OracleEngine, timeService TimeService, broker Broker, stateVarEngine StateVarEngine, assetDetails *assets.Asset, marketActivityTracker *MarketActivityTracker, peggedOrderNotify func(int64), ) (*Market, error)
func (*Market) AmendLiquidityProvision ¶
func (m *Market) AmendLiquidityProvision(ctx context.Context, lpa *types.LiquidityProvisionAmendment, party string, deterministicID string) (err 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 ¶ added in v0.55.0
func (m *Market) AmendOrderWithIDGenerator( ctx context.Context, orderAmendment *types.OrderAmendment, party string, idgen IDGenerator, ) (oc *types.OrderConfirmation, _ error, )
func (*Market) BondPenaltyFactorUpdate ¶
func (*Market) CanLeaveOpeningAuction ¶
CanLeaveOpeningAuction checks if the market can leave the opening auction based on whether floating point consensus has been reached on all 3 vars.
func (*Market) CancelAllOrders ¶
func (*Market) CancelLiquidityProvision ¶
func (m *Market) CancelLiquidityProvision(ctx context.Context, cancel *types.LiquidityProvisionCancellation, party string) (err error)
CancelLiquidityProvision forwards a LiquidityProvisionCancel to the Liquidity Engine.
func (*Market) CancelOrder ¶
func (*Market) CancelOrderWithIDGenerator ¶ added in v0.55.0
func (m *Market) CancelOrderWithIDGenerator( ctx context.Context, partyID, orderID string, idgen IDGenerator, ) (oc *types.OrderCancellationConfirmation, _ error)
func (*Market) GetMarketData ¶
func (m *Market) GetMarketData() types.MarketData
func (*Market) GetMarketState ¶
func (m *Market) GetMarketState() types.MarketState
func (*Market) GetTotalLPShapeCount ¶ added in v0.63.0
GetTotalLPShapeCount returns the total number of LP shapes.
func (*Market) GetTotalOpenPositionCount ¶ added in v0.63.0
GetTotalOpenPositionCount returns the total number of open positions.
func (*Market) GetTotalOrderBookLevelCount ¶ added in v0.63.0
GetTotalOrderBookLevelCount returns the total number of levels in the order book.
func (*Market) GetTotalPeggedOrderCount ¶ added in v0.63.0
GetTotalPeggedOrderCount returns the total number of pegged orders.
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) OnFeeFactorsInfrastructureFeeUpdate ¶
func (*Market) OnFeeFactorsMakerFeeUpdate ¶
func (*Market) OnMarginScalingFactorsUpdate ¶
func (*Market) OnMarkPriceUpdateMaximumFrequency ¶ added in v0.63.0
func (*Market) OnMarketAuctionMinimumDurationUpdate ¶
func (*Market) OnMarketLiquidityMaximumLiquidityFeeFactorLevelUpdate ¶
func (*Market) OnMarketLiquidityProvidersFeeDistribitionTimeStep ¶
func (*Market) OnMarketLiquidityProvisionShapesMaxSizeUpdate ¶
func (*Market) OnMarketLiquidityTargetStakeTriggeringRatio ¶
func (*Market) OnMarketMinLpStakeQuantumMultipleUpdate ¶
func (*Market) OnMarketMinProbabilityOfTradingLPOrdersUpdate ¶
func (*Market) OnMarketProbabilityOfTradingTauScalingUpdate ¶
func (*Market) OnMarketTargetStakeScalingFactorUpdate ¶
func (*Market) OnMarketTargetStakeTimeWindowUpdate ¶
func (*Market) OnMarketValueWindowLengthUpdate ¶
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) OnSuppliedStakeToObligationFactorUpdate ¶
func (*Market) OnTick ¶
OnTick notifies the market of a new time event/update. todo: make this a more generic function name e.g. OnTimeUpdateEvent
func (*Market) ReloadConf ¶
func (m *Market) ReloadConf( matchingConfig matching.Config, riskConfig risk.Config, positionConfig positions.Config, settlementConfig settlement.Config, feeConfig fee.Config, )
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) StartOpeningAuction ¶
func (*Market) SubmitLiquidityProvision ¶
func (m *Market) SubmitLiquidityProvision( ctx context.Context, sub *types.LiquidityProvisionSubmission, party, deterministicID string, ) (err 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 ¶ added in v0.55.0
func (m *Market) SubmitOrderWithIDGeneratorAndOrderID( ctx context.Context, orderSubmission *types.OrderSubmission, party string, idgen IDGenerator, orderID string, ) (oc *types.OrderConfirmation, _ error)
SubmitOrder submits the given order.
type MarketActivityTracker ¶
type MarketActivityTracker struct {
// contains filtered or unexported fields
}
MarketActivityTracker tracks how much fees are paid and received for a market by parties by epoch.
func NewMarketActivityTracker ¶
func NewMarketActivityTracker(log *logging.Logger, epochEngine EpochEngine) *MarketActivityTracker
NewFeesTracker instantiates the fees tracker.
func (*MarketActivityTracker) AddValueTraded ¶
func (mat *MarketActivityTracker) AddValueTraded(marketID string, value *num.Uint)
AddValueTraded records the value of a trade done in the given market.
func (*MarketActivityTracker) Checkpoint ¶
func (mat *MarketActivityTracker) Checkpoint() ([]byte, error)
func (*MarketActivityTracker) GetAllMarketIDs ¶
func (mat *MarketActivityTracker) GetAllMarketIDs() []string
GetAllMarketIDs returns all the current market IDs.
func (*MarketActivityTracker) GetFeePartyScores ¶
func (mat *MarketActivityTracker) GetFeePartyScores(market string, feeType types.TransferType) []*types.PartyContibutionScore
GetFeePartyScores returns the fraction each of the participants paid/received in the given fee of the market in the relevant period.
func (*MarketActivityTracker) GetMarketScores ¶
func (mat *MarketActivityTracker) GetMarketScores(asset string, markets []string, dispatchMetric vega.DispatchMetric) []*types.MarketContributionScore
GetMarketScores calculates the aggregate share of the asset/market in contribution to the metric out of either all the markets of the asset or the subset specified.
func (*MarketActivityTracker) GetMarketsWithEligibleProposer ¶
func (mat *MarketActivityTracker) GetMarketsWithEligibleProposer(asset string, markets []string, payoutAsset string, funder string) []*types.MarketContributionScore
GetMarketsWithEligibleProposer gets all the markets within the given asset (or just all the markets in scope passed as a parameter) that are eligible for proposer bonus.
func (*MarketActivityTracker) GetProposer ¶
func (mat *MarketActivityTracker) GetProposer(market string) string
GetProposer returns the proposer of the market or empty string if the market doesn't exist.
func (*MarketActivityTracker) GetState ¶
func (mat *MarketActivityTracker) GetState(k string) ([]byte, []types.StateProvider, error)
func (*MarketActivityTracker) IsMarketEligibleForBonus ¶ added in v0.55.0
func (mat *MarketActivityTracker) IsMarketEligibleForBonus(market string, payoutAsset string, marketsInScope []string, funder string) bool
IsMarketEligibleForBonus returns true is the market proposer is eligible for market proposer bonus and has not been paid for the combination of payout asset and marketsInScope. The proposer is not market as having been paid until told to do so (if actually paid).
func (*MarketActivityTracker) Keys ¶
func (mat *MarketActivityTracker) Keys() []string
func (*MarketActivityTracker) Load ¶
func (mat *MarketActivityTracker) Load(ctx context.Context, data []byte) error
func (*MarketActivityTracker) LoadState ¶
func (mat *MarketActivityTracker) LoadState(ctx context.Context, p *types.Payload) ([]types.StateProvider, error)
func (*MarketActivityTracker) MarkPaidProposer ¶
func (mat *MarketActivityTracker) MarkPaidProposer(market, payoutAsset string, marketsInScope []string, funder string)
MarkProposerPaid marks the proposer of the market as having been paid proposer bonus.
func (*MarketActivityTracker) MarketProposed ¶
func (mat *MarketActivityTracker) MarketProposed(asset, marketID, proposer string)
MarketProposed is called when the market is proposed and adds the market to the tracker.
func (*MarketActivityTracker) Name ¶
func (mat *MarketActivityTracker) Name() types.CheckpointName
func (*MarketActivityTracker) Namespace ¶
func (mat *MarketActivityTracker) Namespace() types.SnapshotNamespace
func (*MarketActivityTracker) RemoveMarket ¶
func (mat *MarketActivityTracker) RemoveMarket(marketID string)
removeMarket is called when the market is removed from the network. It is not immediately removed to give a chance for rewards to be paid at the end of the epoch for activity during the epoch. Instead it is marked for removal and will be removed at the beginning of the next epoch.
func (*MarketActivityTracker) SetEligibilityChecker ¶
func (mat *MarketActivityTracker) SetEligibilityChecker(eligibilityChecker EligibilityChecker)
func (*MarketActivityTracker) Stopped ¶
func (mat *MarketActivityTracker) Stopped() bool
func (*MarketActivityTracker) UpdateFeesFromTransfers ¶
func (mat *MarketActivityTracker) UpdateFeesFromTransfers(market string, transfers []*types.Transfer)
UpdateFeesFromTransfers takes a slice of transfers and if they represent fees it updates the market fee tracker. market is guaranteed to exist in the mapping as it is added when proposed.
type MarketCollateral ¶
type MarketCollateral interface { Deposit(ctx context.Context, party, asset string, amount *num.Uint) (*types.LedgerMovement, error) Withdraw(ctx context.Context, party, asset string, amount *num.Uint) (*types.LedgerMovement, error) EnableAsset(ctx context.Context, asset types.Asset) error GetPartyGeneralAccount(party, asset string) (*types.Account, error) GetPartyBondAccount(market, partyID, asset string) (*types.Account, error) BondUpdate(ctx context.Context, market string, transfer *types.Transfer) (*types.LedgerMovement, error) MarginUpdateOnOrder(ctx context.Context, marketID string, update events.Risk) (*types.LedgerMovement, events.Margin, error) GetPartyMargin(pos events.MarketPosition, asset, marketID string) (events.Margin, error) GetPartyMarginAccount(market, party, asset string) (*types.Account, error) RollbackMarginUpdateOnOrder(ctx context.Context, marketID string, assetID string, transfer *types.Transfer) (*types.LedgerMovement, error) GetOrCreatePartyBondAccount(ctx context.Context, partyID, marketID, asset string) (*types.Account, error) CreatePartyMarginAccount(ctx context.Context, partyID, marketID, asset string) (string, error) FinalSettlement(ctx context.Context, marketID string, transfers []*types.Transfer) ([]*types.LedgerMovement, error) ClearMarket(ctx context.Context, mktID, asset string, parties []string) ([]*types.LedgerMovement, error) HasGeneralAccount(party, asset string) bool ClearPartyMarginAccount(ctx context.Context, party, market, asset string) (*types.LedgerMovement, error) CanCoverBond(market, party, asset string, amount *num.Uint) bool Hash() []byte TransferFeesContinuousTrading(ctx context.Context, marketID string, assetID string, ft events.FeesTransfer) ([]*types.LedgerMovement, error) TransferFees(ctx context.Context, marketID string, assetID string, ft events.FeesTransfer) ([]*types.LedgerMovement, error) MarginUpdate(ctx context.Context, marketID string, updates []events.Risk) ([]*types.LedgerMovement, []events.Margin, []events.Margin, error) MarkToMarket(ctx context.Context, marketID string, transfers []events.Transfer, asset string) ([]events.Margin, []*types.LedgerMovement, error) RemoveDistressed(ctx context.Context, parties []events.MarketPosition, marketID, asset string) (*types.LedgerMovement, error) GetMarketLiquidityFeeAccount(market, asset string) (*types.Account, error) GetAssetQuantum(asset string) (num.Decimal, error) }
type OracleEngine ¶
type OracleEngine interface { ListensToSigners(oracles.OracleData) bool Subscribe(context.Context, oracles.OracleSpec, oracles.OnMatchedOracleData) (oracles.SubscriptionID, oracles.Unsubscriber) Unsubscribe(context.Context, oracles.SubscriptionID) }
OracleEngine ...
type OrderReferenceCheck ¶
func (OrderReferenceCheck) HasMoved ¶
func (o OrderReferenceCheck) HasMoved(changes uint8) bool
type PeggedOrders ¶
type PeggedOrders struct {
// contains filtered or unexported fields
}
func NewPeggedOrders ¶
func NewPeggedOrders(log *logging.Logger, ts TimeService) *PeggedOrders
func NewPeggedOrdersFromSnapshot ¶
func NewPeggedOrdersFromSnapshot( log *logging.Logger, ts TimeService, state *types.PeggedOrdersState, ) *PeggedOrders
func (*PeggedOrders) AmendParked ¶
func (p *PeggedOrders) AmendParked(amended *types.Order)
func (*PeggedOrders) Changed ¶
func (p *PeggedOrders) Changed() bool
func (*PeggedOrders) EnterAuction ¶ added in v0.62.0
func (p *PeggedOrders) EnterAuction(ctx context.Context) []events.Event
func (*PeggedOrders) GetAllParkedForParty ¶
func (p *PeggedOrders) GetAllParkedForParty(party string) (orders []*types.Order)
func (*PeggedOrders) GetParkedByID ¶
func (p *PeggedOrders) GetParkedByID(id string) *types.Order
func (*PeggedOrders) GetParkedIDs ¶
func (p *PeggedOrders) GetParkedIDs() []string
func (*PeggedOrders) GetParkedOrdersCount ¶
func (p *PeggedOrders) GetParkedOrdersCount() int
func (*PeggedOrders) GetState ¶
func (p *PeggedOrders) GetState() *types.PeggedOrdersState
func (*PeggedOrders) IsParked ¶
func (p *PeggedOrders) IsParked(id string) bool
func (*PeggedOrders) Park ¶
func (p *PeggedOrders) Park(o *types.Order)
func (*PeggedOrders) RemoveAllForParty ¶
func (p *PeggedOrders) RemoveAllForParty( ctx context.Context, party string, status types.OrderStatus, ) (orders []*types.Order, evts []events.Event)
func (*PeggedOrders) Settled ¶
func (p *PeggedOrders) Settled() []*types.Order
func (*PeggedOrders) Unpark ¶
func (p *PeggedOrders) Unpark(oid string)
type PriceMonitor ¶
type PriceMonitor interface { OnTimeUpdate(now time.Time) CheckPrice(ctx context.Context, as price.AuctionState, trades []*types.Trade, persistent bool) bool GetCurrentBounds() []*types.PriceMonitoringBounds SetMinDuration(d time.Duration) GetValidPriceRange() (num.WrappedDecimal, num.WrappedDecimal) // Snapshot GetState() *types.PriceMonitor Changed() bool IsBoundFactorsInitialised() bool Initialised() bool UpdateSettings(risk.Model, *types.PriceMonitoringSettings) }
PriceMonitor interface to handle price monitoring/auction triggers @TODO the interface shouldn't be imported here.
type StateVarEngine ¶
type StateVarEngine interface { RegisterStateVariable(asset, market, name string, converter statevar.Converter, startCalculation func(string, statevar.FinaliseCalculation), trigger []statevar.EventType, result func(context.Context, statevar.StateVariableResult) error) error UnregisterStateVariable(asset, market string) NewEvent(asset, market string, eventType statevar.EventType) ReadyForTimeTrigger(asset, mktID string) }
type TargetStakeCalculator ¶
type TargetStakeCalculator interface { types.StateProvider RecordOpenInterest(oi uint64, now time.Time) error GetTargetStake(rf types.RiskFactor, now time.Time, markPrice *num.Uint) *num.Uint GetTheoreticalTargetStake(rf types.RiskFactor, now time.Time, markPrice *num.Uint, trades []*types.Trade) *num.Uint UpdateScalingFactor(sFactor num.Decimal) error UpdateTimeWindow(tWindow time.Duration) StopSnapshots() UpdateParameters(types.TargetStakeParameters) }
TargetStakeCalculator interface.
type TimeService ¶
Source Files ¶
- auction.go
- bond_topup.go
- collateral.go
- config.go
- engine.go
- engine_snapshot.go
- equity_shares.go
- equity_shares_snapshot.go
- expiring_orders.go
- expiring_orders_snapshot.go
- fees.go
- liquidity_provision.go
- margin.go
- market.go
- market_activity_tracker.go
- market_activity_tracker_checkpoint.go
- market_activity_tracker_snapshot.go
- market_callbacks.go
- market_snapshot.go
- pegged_orders.go
- reference_price_moves.go
- special_orders.go