Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateTimeWeightedAverageBookPrice(timeToPrice map[int64]*num.Uint, t int64, markPricePeriod int64) *num.Uint
- func CompositePriceByMedian(prices []*num.Uint, lastUpdate []int64, delta []time.Duration, t int64) *num.Uint
- func CompositePriceByWeight(prices []*num.Uint, weights []num.Decimal, lastUpdateTime []int64, ...) *num.Uint
- func MedianPrice(prices []*num.Uint) *num.Uint
- func PriceFromBookAtTime(C *num.Uint, ...) *num.Uint
- func PriceFromTrades(trades []*types.Trade, decayWeight, lambda, decayPower num.Decimal, t int64) *num.Uint
- type CompositePriceCalculator
- func (mpc *CompositePriceCalculator) CalculateBookMarkPriceAtTimeT(...)
- func (mpc *CompositePriceCalculator) CalculateMarkPrice(t int64, ob *matching.CachedOrderBook, markPriceFrequency time.Duration, ...) *num.Uint
- func (mpc *CompositePriceCalculator) Close(ctx context.Context)
- func (mpc *CompositePriceCalculator) GetUpdateOraclePriceFunc(oracleIndex int) func(ctx context.Context, data common.Data) error
- func (mpc *CompositePriceCalculator) IntoProto() *snapshot.CompositePriceCalculator
- func (mpc *CompositePriceCalculator) NewTrade(trade *types.Trade)
- func (mpc *CompositePriceCalculator) UpdateConfig(ctx context.Context, oe excommon.OracleEngine, ...) error
- 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) BeginBlock(ctx context.Context)
- func (m *Market) BlockEnd(ctx context.Context)
- func (m *Market) CanLeaveOpeningAuction() bool
- 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, ...) (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 common.IDGenerator) (oc *types.OrderCancellationConfirmation, _ error)
- func (m *Market) CancelStopOrder(ctx context.Context, partyID, orderID string) error
- func (m *Market) GetAssetForProposerBonus() string
- func (m *Market) GetCPState() *types.CPMarketState
- func (m *Market) GetEquityShares() *common.EquityShares
- func (m *Market) GetID() string
- func (m *Market) GetInsurancePoolFraction() num.Decimal
- 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) GetParentMarketID() string
- func (m *Market) GetPartiesStats() (stats *types.MarketStats)
- func (m *Market) GetRiskFactors() *types.RiskFactor
- func (m *Market) GetSettlementAsset() string
- func (m *Market) GetState() *types.ExecMarket
- 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) InheritParent(ctx context.Context, pstate *types.CPMarketState)
- func (m *Market) IntoType() types.Market
- func (m *Market) IsOpeningAuction() bool
- func (m *Market) IsPerp() bool
- func (m *Market) IsSucceeded() bool
- func (m *Market) LoadCPState(state *types.CPMarketState)
- func (m *Market) Mkt() *types.Market
- 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) OnFeeFactorsInfrastructureFeeUpdate(ctx context.Context, d num.Decimal)
- func (m *Market) OnFeeFactorsMakerFeeUpdate(ctx context.Context, d num.Decimal)
- func (m *Market) OnIndexPriceUpdateFrequency(ctx context.Context, d time.Duration)
- func (m *Market) OnMarginScalingFactorsUpdate(ctx context.Context, sf *types.ScalingFactors) error
- func (m *Market) OnMarkPriceUpdateMaximumFrequency(ctx context.Context, d time.Duration)
- func (m *Market) OnMarketAuctionMaximumDurationUpdate(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) OnMarketLiquidityV2BondPenaltyFactorUpdate(liquidityV2BondPenaltyFactor 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) 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, riskConfig risk.Config, ...)
- func (m *Market) ResetParentIDAndInsurancePoolFraction()
- func (m *Market) RestoreELS(ctx context.Context, pstate *types.CPMarketState)
- func (m *Market) RollbackInherit(ctx context.Context)
- func (m *Market) SetNextIndexPriceCalc(tm time.Time)
- func (m *Market) SetNextMTM(tm time.Time)
- func (m *Market) SetSucceeded()
- func (m *Market) SetSuccessorELS(state *types.CPMarketState)
- func (m *Market) StartOpeningAuction(ctx context.Context) error
- func (m *Market) StopSnapshots()
- 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, oracleEngine products.OracleEngine) error
- func (m *Market) UpdateMarginMode(ctx context.Context, party string, marginMode types.MarginMode, ...) error
- func (m *Market) UpdateMarketState(ctx context.Context, changes *types.MarketStateUpdateConfiguration) error
- type TargetStakeCalculator
Constants ¶
const ( TradePriceIndex = 0 BookPriceIndex = 1 FirstOraclePriceIndex = 2 )
Variables ¶
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")
Functions ¶
func CalculateTimeWeightedAverageBookPrice ¶ added in v0.74.0
func CalculateTimeWeightedAverageBookPrice(timeToPrice map[int64]*num.Uint, t int64, markPricePeriod int64) *num.Uint
CalculateTimeWeightedAverageBookPrice calculates the time weighted average of the timepoints where book price was calculated.
func CompositePriceByMedian ¶ added in v0.74.0
func CompositePriceByMedian(prices []*num.Uint, lastUpdate []int64, delta []time.Duration, t int64) *num.Uint
CompositePriceByMedian returns the median mark price out of the non stale ones or nil if there is none.
func CompositePriceByWeight ¶ added in v0.74.0
func CompositePriceByWeight(prices []*num.Uint, weights []num.Decimal, lastUpdateTime []int64, delta []time.Duration, t int64) *num.Uint
CompositePriceByWeight calculates the mid price out of the non-stale price by the weights assigned to each mid price.
func MedianPrice ¶ added in v0.74.0
MedianPrice returns the median of the given prices (pBook, pTrades, pOracle1..n).
func PriceFromBookAtTime ¶ added in v0.74.0
func PriceFromBookAtTime(C *num.Uint, initialScalingFactor, slippageFactor, shortRiskFactor, longRiskFactor num.Decimal, orderBook *matching.CachedOrderBook) *num.Uint
PriceFromBookAtTime calculate the mark price as the average price of buying/selling the quantity implied by scaling C by the factors. If there is no bid or ask price for the required quantity, returns nil.
Types ¶
type CompositePriceCalculator ¶ added in v0.74.0
type CompositePriceCalculator struct {
// contains filtered or unexported fields
}
func NewCompositePriceCalculator ¶ added in v0.74.0
func NewCompositePriceCalculator(ctx context.Context, config *types.CompositePriceConfiguration, oe products.OracleEngine, timeService excommon.TimeService) *CompositePriceCalculator
func NewCompositePriceCalculatorFromSnapshot ¶ added in v0.74.0
func NewCompositePriceCalculatorFromSnapshot(ctx context.Context, mp *num.Uint, timeService excommon.TimeService, oe excommon.OracleEngine, mpc *snapshot.CompositePriceCalculator) *CompositePriceCalculator
func (*CompositePriceCalculator) CalculateBookMarkPriceAtTimeT ¶ added in v0.74.0
func (mpc *CompositePriceCalculator) CalculateBookMarkPriceAtTimeT(initialScalingFactor, slippageFactor, shortRiskFactor, longRiskFactor num.Decimal, t int64, ob *matching.CachedOrderBook)
CalculateBookMarkPriceAtTimeT is called every interval (currently at the end of each block) to calculate the mark price implied by the book. If there is insufficient quantity in the book, ignore this price IF the market is in auction set the mark price to the indicative price if not zero.
func (*CompositePriceCalculator) CalculateMarkPrice ¶ added in v0.74.0
func (mpc *CompositePriceCalculator) CalculateMarkPrice(t int64, ob *matching.CachedOrderBook, markPriceFrequency time.Duration, initialScalingFactor, slippageFactor, shortRiskFactor, longRiskFactor num.Decimal) *num.Uint
CalculateMarkPrice is called at the end of each mark price calculation interval and calculates the mark price using the mark price type methodology.
func (*CompositePriceCalculator) Close ¶ added in v0.74.0
func (mpc *CompositePriceCalculator) Close(ctx context.Context)
func (*CompositePriceCalculator) GetUpdateOraclePriceFunc ¶ added in v0.74.0
func (mpc *CompositePriceCalculator) GetUpdateOraclePriceFunc(oracleIndex int) func(ctx context.Context, data common.Data) error
UpdateOraclePrice is called when a new oracle price is available.
func (*CompositePriceCalculator) IntoProto ¶ added in v0.74.0
func (mpc *CompositePriceCalculator) IntoProto() *snapshot.CompositePriceCalculator
func (*CompositePriceCalculator) NewTrade ¶ added in v0.74.0
func (mpc *CompositePriceCalculator) NewTrade(trade *types.Trade)
NewTrade is called to inform the mark price calculator on a new trade. All the trades for a given mark price calculation interval are saved until the end of the interval.
func (*CompositePriceCalculator) UpdateConfig ¶ added in v0.74.0
func (mpc *CompositePriceCalculator) UpdateConfig(ctx context.Context, oe excommon.OracleEngine, config *types.CompositePriceConfiguration) error
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 common.Collateral, oracleEngine products.OracleEngine, mkt *types.Market, timeService common.TimeService, broker common.Broker, auctionState *monitor.AuctionState, stateVarEngine common.StateVarEngine, marketActivityTracker *common.MarketActivityTracker, assetDetails *assets.Asset, peggedOrderNotify func(int64), referralDiscountRewardService fee.ReferralDiscountRewardService, volumeDiscountService fee.VolumeDiscountService, 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.ExecMarket, 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, assetDetails *assets.Asset, marketActivityTracker *common.MarketActivityTracker, peggedOrderNotify func(int64), referralDiscountRewardService fee.ReferralDiscountRewardService, volumeDiscountService fee.VolumeDiscountService, banking common.Banking, ) (*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 ¶
func (m *Market) AmendOrderWithIDGenerator( ctx context.Context, orderAmendment *types.OrderAmendment, party string, idgen common.IDGenerator, ) (oc *types.OrderConfirmation, _ error, )
func (*Market) BeginBlock ¶ added in v0.73.0
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) CancelAllStopOrders ¶
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 ¶
func (m *Market) CancelOrderWithIDGenerator( ctx context.Context, partyID, orderID string, idgen common.IDGenerator, ) (oc *types.OrderCancellationConfirmation, _ error)
func (*Market) CancelStopOrder ¶
func (*Market) GetAssetForProposerBonus ¶ added in v0.73.0
func (*Market) GetCPState ¶
func (m *Market) GetCPState() *types.CPMarketState
func (*Market) GetEquityShares ¶
func (m *Market) GetEquityShares() *common.EquityShares
func (*Market) GetInsurancePoolFraction ¶
func (*Market) GetMarketCounters ¶ added in v0.73.0
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) GetParentMarketID ¶
func (*Market) GetPartiesStats ¶ added in v0.73.0
func (m *Market) GetPartiesStats() (stats *types.MarketStats)
GetPartiesStats is called at the end of the epoch, only once to be sent to the activity streak engine. This is using the calculated at the end of the epoch based on the countrer in the position engine. This is never sent into a snapshot as it relies on the order the epoch callback are executed. We expect the market OnEpoch to be called first, and compute the data, then the activity tracker callback to be called next, and retrieve the data through this method. The stats are reseted before being returned.
func (*Market) GetRiskFactors ¶ added in v0.74.0
func (m *Market) GetRiskFactors() *types.RiskFactor
func (*Market) GetSettlementAsset ¶
func (*Market) GetState ¶
func (m *Market) GetState() *types.ExecMarket
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) InheritParent ¶
func (m *Market) InheritParent(ctx context.Context, pstate *types.CPMarketState)
func (*Market) IsOpeningAuction ¶ added in v0.73.0
func (*Market) IsSucceeded ¶
func (*Market) LoadCPState ¶
func (m *Market) LoadCPState(state *types.CPMarketState)
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) OnEpochEvent ¶ added in v0.73.0
func (*Market) OnEpochRestore ¶ added in v0.73.0
func (*Market) OnFeeFactorsInfrastructureFeeUpdate ¶
func (*Market) OnFeeFactorsMakerFeeUpdate ¶
func (*Market) OnIndexPriceUpdateFrequency ¶
func (*Market) OnMarginScalingFactorsUpdate ¶
func (*Market) OnMarkPriceUpdateMaximumFrequency ¶
func (*Market) OnMarketAuctionMaximumDurationUpdate ¶ added in v0.73.0
func (*Market) OnMarketAuctionMinimumDurationUpdate ¶
func (*Market) OnMarketLiquidityMaximumLiquidityFeeFactorLevelUpdate ¶
func (*Market) OnMarketLiquidityV2BondPenaltyFactorUpdate ¶ added in v0.73.0
func (*Market) OnMarketLiquidityV2EarlyExitPenaltyUpdate ¶ added in v0.73.0
func (*Market) OnMarketLiquidityV2MaximumLiquidityFeeFactorLevelUpdate ¶ added in v0.73.0
func (*Market) OnMarketLiquidityV2ProvidersFeeCalculationTimeStep ¶ added in v0.73.0
func (*Market) OnMarketLiquidityV2SLANonPerformanceBondPenaltyMaxUpdate ¶ added in v0.73.0
func (*Market) OnMarketLiquidityV2SLANonPerformanceBondPenaltySlopeUpdate ¶ added in v0.73.0
func (*Market) OnMarketLiquidityV2StakeToCCYVolume ¶ added in v0.73.0
func (*Market) OnMarketMinLpStakeQuantumMultipleUpdate ¶
func (*Market) OnMarketMinProbabilityOfTradingLPOrdersUpdate ¶
func (*Market) OnMarketPartiesMaximumStopOrdersUpdate ¶
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) 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) ResetParentIDAndInsurancePoolFraction ¶
func (m *Market) ResetParentIDAndInsurancePoolFraction()
func (*Market) RestoreELS ¶
func (m *Market) RestoreELS(ctx context.Context, pstate *types.CPMarketState)
func (*Market) RollbackInherit ¶
func (*Market) SetNextIndexPriceCalc ¶
func (*Market) SetNextMTM ¶
func (*Market) SetSucceeded ¶
func (m *Market) SetSucceeded()
func (*Market) SetSuccessorELS ¶
func (m *Market) SetSuccessorELS(state *types.CPMarketState)
func (*Market) StartOpeningAuction ¶
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)
SubmitOrder 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)
func (*Market) UpdateMarginMode ¶ added in v0.74.0
func (*Market) UpdateMarketState ¶ added in v0.73.0
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.