Class IncrementalGreeks
price(S, t) ≈ price₀ + Δ₀·(S−S₀) + ½·Γ₀·(S−S₀)² + Θ₀·(t − t₀) delta(S) ≈ Δ₀ + Γ₀·(S−S₀)
This is how live options risk actually stays tick-fresh: the quadratic
error term is O((S−S₀)³·speed), negligible for the sub-0.5% moves between
anchor refreshes, and needsReprice(double) tells the slow path when the
spot has drifted far enough to re-anchor (a pricing-thread job, not the
tick thread's).
Single-threaded by design — one instance per position per risk thread.
reprice(BlackScholes.OptionType, double, double, double, double, double, double) allocates (it calls BlackScholes.greeks(BlackScholes.OptionType, double, double, double, double, double, double)); it is
the anchor operation. onTick(double) never allocates.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance; the explicit form of the default constructor. -
Method Summary
Modifier and TypeMethodDescriptiondoubleThe spot the expansion is anchored at (NaN before the first reprice).doubleTick-fresh delta estimate.doubleTick-fresh price estimate (per unit; scale by position externally).doublegamma()Anchor gamma (constant between reprices — second order is the anchor's).booleanneedsReprice(double maxSpotDrift) Whether spot has drifted beyondmaxSpotDriftfrom the anchor — the signal for the slow path toreprice(BlackScholes.OptionType, double, double, double, double, double, double).voidonTick(double spot) The hot path with no time elapsed since the anchor: delta-gamma update only.voidonTick(double spot, double yearsSinceAnchor) The hot path: delta-gamma-theta update from the anchor,voidreprice(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears) Full reprice: re-anchors the expansion.doubletheta()Anchor theta.doublevega()Anchor vega — vol risk only changes on reprice, not per tick.
-
Constructor Details
-
IncrementalGreeks
public IncrementalGreeks()Creates an instance; the explicit form of the default constructor.
-
-
Method Details
-
reprice
public void reprice(BlackScholes.OptionType type, double spot, double strike, double rate, double carry, double vol, double timeYears) Full reprice: re-anchors the expansion. Call from the pricing/slow thread — at start-up, onneedsReprice(double), on vol or rate marks. -
onTick
public void onTick(double spot) The hot path with no time elapsed since the anchor: delta-gamma update only. UseonTick(double, double)when ticks arrive over a meaningful fraction of a day, or the estimate misses the time decay. -
onTick
public void onTick(double spot, double yearsSinceAnchor) The hot path: delta-gamma-theta update from the anchor,price ≈ price₀ + Δ₀·dS + ½Γ₀·dS² + Θ₀·dt
with
dt = yearsSinceAnchorand Θ₀ = ∂V/∂t per year asBlackScholes.theta(BlackScholes.OptionType, double, double, double, double, double, double)defines it (negative for a long vanilla). Delta is updated by gamma only; its time drift (charm) is not included. No allocation, no transcendental math. -
needsReprice
public boolean needsReprice(double maxSpotDrift) Whether spot has drifted beyondmaxSpotDriftfrom the anchor — the signal for the slow path toreprice(BlackScholes.OptionType, double, double, double, double, double, double). The tick thread only reads a flag-style comparison; it never re-anchors itself. -
estimatedPrice
public double estimatedPrice()Tick-fresh price estimate (per unit; scale by position externally). -
estimatedDelta
public double estimatedDelta()Tick-fresh delta estimate. -
gamma
public double gamma()Anchor gamma (constant between reprices — second order is the anchor's). -
vega
public double vega()Anchor vega — vol risk only changes on reprice, not per tick. -
theta
public double theta()Anchor theta. -
anchorSpot
public double anchorSpot()The spot the expansion is anchored at (NaN before the first reprice).
-