Documentation ¶
Index ¶
- Variables
- type Engine
- func (e *Engine) CalculateLiquidityScore(orders []*types.Order, bestBid, bestAsk num.Decimal, ...) num.Decimal
- func (e *Engine) IsProbabilityOfTradingInitialised() bool
- func (e *Engine) OnMinProbabilityOfTradingLPOrdersUpdate(v num.Decimal)
- func (e *Engine) OnProbabilityOfTradingTauScalingUpdate(v num.Decimal)
- func (e *Engine) Payload() *snapshotpb.Payload
- func (e *Engine) Reload(ls *snapshotpb.LiquiditySupplied) error
- func (e *Engine) SetGetStaticPricesFunc(f func() (num.Decimal, num.Decimal, error))
- func (e *Engine) UpdateMarketConfig(riskModel RiskModel, monitor PriceMonitor)
- type PriceMonitor
- type RiskModel
- type StateVarEngine
Constants ¶
This section is empty.
Variables ¶
var ( OffsetIncrement = uint32(1000) // the increment of offsets in the offset slice - 1/PriceIncrementFactor as integer OffsetIncrementAsDecimal = num.DecimalFromInt64(int64(OffsetIncrement)) OffsetOneDecimal = OffsetIncrementAsDecimal.Mul(OffsetIncrementAsDecimal) // an offset of 100% PriceIncrementFactor = num.DecimalOne().Div(num.DecimalFromInt64(int64(OffsetIncrement))) // we calculate the probability of trading in increments of 0.001 from of the best bid/ask )
var (
ErrNoValidOrders = errors.New("no valid orders to cover the liquidity obligation with")
)
ErrNoValidOrders informs that there weren't any valid orders to cover the liquidity obligation with. This could happen when for a given side (buy or sell) limit orders don't supply enough liquidity and there aren't any valid pegged orders (all the prives are invalid) to cover it with.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine provides functionality related to supplied liquidity.
func NewEngine ¶
func NewEngine(riskModel RiskModel, priceMonitor PriceMonitor, asset, marketID string, stateVarEngine StateVarEngine, log *logging.Logger, positionFactor num.Decimal) *Engine
NewEngine returns a reference to a new supplied liquidity calculation engine.
func (*Engine) CalculateLiquidityScore ¶ added in v0.65.0
func (e *Engine) CalculateLiquidityScore( orders []*types.Order, bestBid, bestAsk num.Decimal, minLpPrice, maxLpPrice *num.Uint, ) num.Decimal
CalculateLiquidityScore returns the current liquidity scores (volume-weighted probability of trading).
func (*Engine) IsProbabilityOfTradingInitialised ¶ added in v0.73.0
func (*Engine) OnMinProbabilityOfTradingLPOrdersUpdate ¶
func (*Engine) OnProbabilityOfTradingTauScalingUpdate ¶
func (*Engine) Payload ¶
func (e *Engine) Payload() *snapshotpb.Payload
func (*Engine) Reload ¶
func (e *Engine) Reload(ls *snapshotpb.LiquiditySupplied) error
func (*Engine) SetGetStaticPricesFunc ¶
func (*Engine) UpdateMarketConfig ¶
func (e *Engine) UpdateMarketConfig(riskModel RiskModel, monitor PriceMonitor)
type PriceMonitor ¶
type PriceMonitor interface {
GetValidPriceRange() (num.WrappedDecimal, num.WrappedDecimal)
}
PriceMonitor provides the range of valid prices, that is prices that wouldn't trade the current trading mode
type RiskModel ¶
type RiskModel interface { ProbabilityOfTrading(currentPrice, orderPrice, minPrice, maxPrice num.Decimal, yearFraction num.Decimal, isBid, applyMinMax bool) num.Decimal GetProjectionHorizon() num.Decimal }
RiskModel allows calculation of min/max price range and a probability of trading.