Attribution: Discord Salsaman1007 and GitHub CondorCommodore.
License: MIT.
A compact gamma scalp model centered on:
- Black-Scholes straddle math
- Portfolio delta from straddle plus MES hedge
- Threshold-based hedge decisions
- SML anchor leaning
- SAL halt/resume behavior
gamma-math-only.ts: the shareable coregamma-math-only-smoke.ts: a minimal smoke testpackage.json: minimal setup for running the smoke test
Import the core and initialize it with a first price tick:
import { createGammaMathOnly } from "./gamma-math-only.js";
const model = createGammaMathOnly({
iv: 0.19,
straddleQuantity: 2,
deltaThreshold: 0.1,
rehedgeThreshold: 0.1,
hedgeAmplifier: 1,
minHedgeContracts: 1,
optionStrikeIncrement: 5,
optionUnderlyingScale: 1,
spxMultiplier: 100,
mesPointValue: 5,
overshootTarget: 0.8,
anchorLevel: 6450,
anchorRadius: 40,
salLevel: 6500,
});
model.init({ tick: 1, tsMs: Date.now(), mid: 6450 });
const event = model.processTick({ tick: 2, tsMs: Date.now() + 1000, mid: 6490 });If event is non-null, the model thinks a hedge should occur. The event includes:
hedgeDirectionhedgeContractsportfolioDeltaBeforeportfolioDeltaAftertargetDelta
Run:
npm install
npm run smokeThis verifies threshold behavior, SML leaning, and SAL halt/resume.