Record Class BenchmarkExecutor.MarketState
java.lang.Object
java.lang.Record
com.quantfinlib.execution.BenchmarkExecutor.MarketState
- Record Components:
mid- current mid (for reference/markout)spread- bid/ask spread in price units (cost)volatility- normalized vol-regime signal, ~0..1displayedDepth- size available to take now (liquidity cap)expectedVolumeFractionElapsed- VWAP curve: fraction of the day's volume expected to have traded by nowalpha- normalized expected-move signal in [-1, 1] (+ = up)impactBps- estimated impact of a full child in bps (MarketImpactModel/ml.MarketImpactPredictoroutput); damps aggression alongside the spread — trading into your own impact is a cost like crossing one
- Enclosing class:
BenchmarkExecutor
public static record BenchmarkExecutor.MarketState(double mid, double spread, double volatility, double displayedDepth, double expectedVolumeFractionElapsed, double alpha, double impactBps)
extends Record
A snapshot of the real-time inputs a benchmark algo evaluates. All
fields are optional in the sense that a neutral value disables that
input:
spread=0, volatility=0, alpha=0,
displayedDepth=+∞ (no liquidity cap),
expectedVolumeFractionElapsed=schedule fraction (VWAP falls
back to TWAP), impactBps=0. NaN in any field is treated as
its neutral value — a transient bad input must degrade the input,
never silently stall the parent.
Units contract (normalized, so the shipped models plug in directly):
volatility— a normalized volatility-REGIME signal, ~0 calm to ~1 extreme:microstructure.VolatilityCurve.regime(bucket, currentVol)produces exactly this (elevated vs the time-of-day baseline). Feeding a raw per-√second return (~1e-4) would make the term inert;alpha— a normalized expected-move signal in [-1, 1] (+ = up):SignalEngine.alpha()plugs in directly. A raw price-return forecast must be rescaled (÷ its typical magnitude) first;displayedDepth— size dealable NOW (displayed top of book). FeedingHiddenLiquidityDetector.estimatedTrueDepthis a conscious choice to size against inferred reserve, not a drop-in.
-
Constructor Summary
ConstructorsConstructorDescriptionMarketState(double mid, double spread, double volatility, double displayedDepth, double expectedVolumeFractionElapsed, double alpha, double impactBps) Creates an instance of aMarketStaterecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoublealpha()Returns the value of thealpharecord component.doubleReturns the value of thedisplayedDepthrecord component.final booleanIndicates whether some other object is "equal to" this one.doubleReturns the value of theexpectedVolumeFractionElapsedrecord component.final inthashCode()Returns a hash code value for this object.doubleReturns the value of theimpactBpsrecord component.doublemid()Returns the value of themidrecord component.neutral(double mid, double scheduleFraction) A neutral state: no spread/vol/alpha/impact, unlimited depth, VWAP=TWAP.doublespread()Returns the value of thespreadrecord component.final StringtoString()Returns a string representation of this record class.doubleReturns the value of thevolatilityrecord component.
-
Constructor Details
-
MarketState
public MarketState(double mid, double spread, double volatility, double displayedDepth, double expectedVolumeFractionElapsed, double alpha, double impactBps) Creates an instance of aMarketStaterecord class.- Parameters:
mid- the value for themidrecord componentspread- the value for thespreadrecord componentvolatility- the value for thevolatilityrecord componentdisplayedDepth- the value for thedisplayedDepthrecord componentexpectedVolumeFractionElapsed- the value for theexpectedVolumeFractionElapsedrecord componentalpha- the value for thealpharecord componentimpactBps- the value for theimpactBpsrecord component
-
-
Method Details
-
neutral
A neutral state: no spread/vol/alpha/impact, unlimited depth, VWAP=TWAP. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
mid
-
spread
-
volatility
public double volatility()Returns the value of thevolatilityrecord component.- Returns:
- the value of the
volatilityrecord component
-
displayedDepth
public double displayedDepth()Returns the value of thedisplayedDepthrecord component.- Returns:
- the value of the
displayedDepthrecord component
-
expectedVolumeFractionElapsed
public double expectedVolumeFractionElapsed()Returns the value of theexpectedVolumeFractionElapsedrecord component.- Returns:
- the value of the
expectedVolumeFractionElapsedrecord component
-
alpha
-
impactBps
-