Skip to content
ADVANCED RESEARCH / OPTIONS & HEDGING

Beyond direction.
Understand the risk.

A European straddle, a dynamic delta hedge, and a full view of the assumptions that drive the outcome.

MODEL SIMULATION ONLY · SYNTHETIC DATA · NO HISTORICAL OPTIONS BACKTEST
Explore the lab ↗Inspect the code
01 / MONTE CARLO WORKBENCH

Change the environment.
Compare the hedge.

Precomputed, reproducible scenarios. Outcomes are excess dollar P&L relative to keeping the same $100,000 in cash at 3%, over one 45-step horizon.

MEAN EXCESS P&L
5TH-PERCENTILE P&L95% of simulated outcomes exceed this
AVERAGE OF WORST 5%Signed tail P&L, not a guaranteed loss bound
POSITIVE EXCESS P&LScenario-conditioned simulation frequency

Distribution of outcomes

All 1,500 paths; no observations trimmed.

One path. Different risk profiles.

Always path index 0, not selected for its result.

● Selected hedge● No hedge

Same scenario, all three hedge policies

Hedge policyMean P&L5th percentileMean hedge costsMean borrow costsMean hedge orders

Confidence intervals quantify Monte Carlo sampling error for the mean under this model. They do not measure model risk or uncertainty about future markets.

02 / EXACT REPRICING & GREEKS

Inspect the exposures.

This calculator is independent of the Monte Carlo panel. Change spot, flat implied volatility and remaining term to reprice the original options plus the original stock hedge.

10 contracts per leg × 100 units. Flat 3% rate, no dividends. Greeks are portfolio totals. This panel excludes funding, transaction costs and subsequent hedge trades.

OPTION PORTFOLIO VALUE

Call plus put theoretical mark.

OPTIONS + ORIGINAL HEDGE P&L

Exact mark change from inception; before costs and financing.

NET DELTA

Share-equivalent exposure including the initial hedge.

GAMMA

Change in share-equivalent delta per $1 underlying move.

VEGA / 1 VOL POINT

Approximate option value change per one percentage-point IV rise.

THETA / MODEL STEP

Approximate option value change as 1/252 year passes.

Spot × volatility stress matrix

Exact repricing after 15 steps, with 30 remaining. Original hedge held fixed; before costs and financing. Click a cell to inspect its Greeks above.

IV / spot move−20%−10%0%+10%+20%

The matrix is a deterministic sensitivity map, not a probability forecast.

03 / REPRODUCIBLE SPECIFICATION

The model is part of the result.

Pricing & position

  • Ten European cash-settled calls and ten puts, all struck at $100, with a multiplier of 100. Synthetic non-dividend-paying underlying starts at $100.
  • Black-Scholes marks and deltas use flat 20% implied volatility and a 3% continuously compounded rate. No implied-volatility surface is calibrated.
  • The model term is 45/252 years. The first hedge is placed at inception; daily or every-five-step rebalancing uses only current spot and remaining term.
  • At expiry, settle options at intrinsic value and close the stock hedge. Fractional underlying units are allowed.

Path design

  • Geometric Brownian paths use 12%, 20% or 32% annualized realized-volatility inputs. Drift is fixed at 3%, an illustrative assumption rather than an estimate.
  • The gap scenario adds a deterministic −15% spot jump at step 20 to the 20% volatility scenario. It is a prescribed stress, not a calibrated jump process.
  • Implied volatility remains 20% during every Monte Carlo run, including after the jump. This deliberate simplification can materially affect hedging results.
  • 1,500 independent shock paths per scenario, seed 1729. The same shocks are reused across scenarios and hedge policies; cases are not statistically independent.

Costs & cash ledger

  • Initial equity: $100,000. Pay theoretical premium plus $0.65 per option contract and $0.02 half-spread per option unit: $53 total option-entry costs.
  • Each hedge trade costs 2 basis points of underlying notional, including the final unwind.
  • Positive cash earns 3%; negative cash is financed at 5%. Short underlying positions incur 2% annual stock-borrow cost using prior-step spot and holdings.
  • No expiry settlement fee, tax, dividend, margin constraint, market impact or option-exit spread is modeled.

Interpretation & limits

  • Active-market gains are driven by the assumption that realized volatility exceeds the 20% option-pricing input. This is not evidence that such mispricing is available.
  • Quiet-market losses, discretization error and hedge costs are part of the same experiment. Delta hedging does not remove gamma, vega, funding or jump risk.
  • The gap case favors long convexity by construction. Its simulated success frequency is not a tradable win-rate estimate.
  • These hypothetical European contracts are not SPY American options. Historical option chains, executable bid/ask quotes and venue-specific mechanics would be required for a market backtest.
04 / VALIDATION

Checks behind the calculations.

Pricing is reconciled against a published Black-Scholes example. Put-call parity and finite-difference delta, gamma, vega and theta are checked. A no-hedge cash ledger is reconciled analytically, and changing future prices leaves earlier hedge decisions unchanged.

References: MathWorks: European Black-Scholes pricing and reference example; Options Industry Council: Greeks and their interpretation. These sources explain the pricing framework; they do not validate the profitability of this demonstration.

05 / RESEARCH DELIVERABLE

Take the model apart.

The bundle includes the standard-library Python engine, validation checks, configuration, all 18,000 terminal P&Ls, example path ledgers, stress-grid results and this report. No API key or paid data subscription is needed to reproduce it.

Download options research ↓Python source ↓All simulation P&Ls ↓

python simulation.py --out results --paths 1500
python validate.py

Read the complete Python implementation
"""Edge Quant: European straddle and discrete delta hedge research lab.
MODEL SIMULATION ONLY. No historical options quotes or calibrated forecasts.
Python standard library. Run: python simulation.py --out results --paths 1500
USD. Synthetic non-dividend-paying underlying; European cash-settled options.
Black-Scholes marks use flat 20% IV; realized path volatility is scenario input.
"""
import argparse,csv,json,math,random,statistics
from pathlib import Path

CONFIG={'spot':100.,'strike':100.,'days':45,'steps_per_year':252,'iv':.20,'rate':.03,'borrow_spread':.02,'stock_borrow':.02,'contracts_per_leg':10,'multiplier':100,'initial_cash':100000.,'option_commission':.65,'option_half_spread':.02,'hedge_bps':2.,'seed':1729}
SCENARIOS=[{'id':'quiet','name':'Quiet market','realized_vol':.12,'jump':0.}, {'id':'matched','name':'Volatility matches pricing','realized_vol':.20,'jump':0.}, {'id':'active','name':'High realized volatility','realized_vol':.32,'jump':0.}, {'id':'gap','name':'Downward gap stress','realized_vol':.20,'jump':-.15}]

def normal(x):return .5*(1+math.erf(x/math.sqrt(2)))
def bs(s,k,t,r,v):
 if t<=0:
  call=max(s-k,0.);put=max(k-s,0.);dc=1. if s>k else (0. if s<k else .5)
  return {'call':call,'put':put,'delta':2*dc-1,'gamma':0.,'vega_pp':0.,'theta_day':0.}
 root=math.sqrt(t);d1=(math.log(s/k)+(r+.5*v*v)*t)/(v*root);d2=d1-v*root;disc=math.exp(-r*t);pdf=math.exp(-.5*d1*d1)/math.sqrt(2*math.pi)
 call=s*normal(d1)-k*disc*normal(d2);put=k*disc*normal(-d2)-s*normal(-d1)
 theta=-s*pdf*v/root-r*k*disc*normal(d2)+r*k*disc*normal(-d2)
 return {'call':call,'put':put,'delta':2*normal(d1)-1,'gamma':2*pdf/(s*v*root),'vega_pp':2*s*pdf*root*.01,'theta_day':theta/252}

def portfolio(s,t,iv,c=CONFIG):
 g=bs(s,c['strike'],t,c['rate'],iv);units=c['contracts_per_leg']*c['multiplier']
 return {'value':(g['call']+g['put'])*units,**{k:g[k]*units for k in ['delta','gamma','vega_pp','theta_day']}}

def path_from(shocks,scenario,c=CONFIG):
 dt=1/c['steps_per_year'];s=c['spot'];path=[s];v=scenario['realized_vol']
 for i,z in enumerate(shocks,1):
  # Fixed illustrative drift 3%, equal to the cash rate; not a forecast.
  s*=math.exp((c['rate']-.5*v*v)*dt+v*math.sqrt(dt)*z)
  if scenario['jump'] and i==20:s*=1+scenario['jump']
  path.append(s)
 return path

def simulate(path,cadence,c=CONFIG,keep=False):
 dt=1/c['steps_per_year'];units=c['contracts_per_leg']*c['multiplier'];start=portfolio(path[0],c['days']*dt,c['iv'],c)
 premium=start['value'];option_cost=2*c['contracts_per_leg']*c['option_commission']+2*units*c['option_half_spread']
 cash=c['initial_cash']-premium-option_cost;shares=0.;hedge_cost=0.;borrow=0.;interest=0.;orders=0;rows=[]
 for i,s in enumerate(path):
  if i:
   rate=c['rate'] if cash>=0 else c['rate']+c['borrow_spread'];accrual=cash*math.expm1(rate*dt);cash+=accrual;interest+=accrual
   fee=max(-shares,0)*path[i-1]*c['stock_borrow']*dt;cash-=fee;borrow+=fee
  t=(c['days']-i)*dt;g=portfolio(s,t,c['iv'],c)
  if i==c['days']:
   cash+=g['value'];opt_value=0.;target=0.
  else:
   opt_value=g['value'];target=-g['delta'] if cadence and i%cadence==0 else shares
  traded=target-shares
  fee=abs(traded)*s*c['hedge_bps']/10000
  if abs(traded)>1e-10:orders+=1
  cash-=traded*s+fee;hedge_cost+=fee;shares=target
  equity=cash+shares*s+opt_value
  benchmark=c['initial_cash']*math.exp(c['rate']*i*dt)
  if keep:rows.append({'day':i,'spot':s,'option_value':opt_value,'hedge_shares':shares,'net_delta':shares+g['delta'] if t>0 else 0.,'cash':cash,'equity':equity,'excess_pnl':equity-benchmark,'option_pnl':g['value']-premium,'hedge_cost':hedge_cost,'stock_borrow_cost':borrow,'cash_interest':interest})
 return {'pnl':equity-c['initial_cash']*math.exp(c['rate']*c['days']*dt),'equity':equity,'hedge_cost':hedge_cost,'stock_borrow_cost':borrow,'option_cost':option_cost,'orders':orders,'rows':rows}

def quantile(xs,p):
 a=sorted(xs);at=(len(a)-1)*p;lo=int(at);hi=min(lo+1,len(a)-1);return a[lo]+(a[hi]-a[lo])*(at-lo)

def stats(values):
 n=len(values);mean=statistics.mean(values);se=statistics.stdev(values)/math.sqrt(n);bottom=sorted(values)[:max(1,math.ceil(n*.05))]
 return {'mean':mean,'median':statistics.median(values),'q05':quantile(values,.05),'q95':quantile(values,.95),'tail_mean_05':statistics.mean(bottom),'profit_fraction':sum(x>0 for x in values)/n,'mean_ci95':[mean-1.96*se,mean+1.96*se],'min':min(values),'max':max(values)}

def write_csv(path,rows):
 with path.open('w',newline='') as f:
  w=csv.DictWriter(f,fieldnames=list(rows[0]));w.writeheader();w.writerows(rows)

def run(out,n=1500):
 out=Path(out);out.mkdir(parents=True,exist_ok=True);rng=random.Random(CONFIG['seed']);shocks=[[rng.gauss(0,1) for _ in range(CONFIG['days'])] for _ in range(n)]
 result={'config':CONFIG,'paths_per_case':n,'scenarios':SCENARIOS,'initial_greeks':portfolio(100,45/252,.20),'cases':{}}
 all_pnl=[]
 for scenario in SCENARIOS:
  paths=[path_from(z,scenario) for z in shocks]
  for name,cadence in [('daily',1),('weekly',5),('unhedged',0)]:
   runs=[simulate(path,cadence) for path in paths];values=[x['pnl'] for x in runs];key=scenario['id']+'_'+name
   example=simulate(paths[0],cadence,keep=True);write_csv(out/(key+'_path.csv'),example['rows'])
   result['cases'][key]={'summary':stats(values),'mean_hedge_cost':statistics.mean(x['hedge_cost'] for x in runs),'mean_stock_borrow_cost':statistics.mean(x['stock_borrow_cost'] for x in runs),'mean_orders':statistics.mean(x['orders'] for x in runs),'values':values,'example_path':example['rows']}
   all_pnl.extend({'scenario':scenario['id'],'hedge':name,'path_index':i,'excess_pnl_usd':x['pnl'],'hedge_cost_usd':x['hedge_cost'],'borrow_cost_usd':x['stock_borrow_cost'],'equity_usd':x['equity']} for i,x in enumerate(runs))
 write_csv(out/'all_paths_pnl.csv',all_pnl)
 g0=result['initial_greeks'];initial_hedge=-g0['delta'];stress=[]
 for shift in [-.10,0.,.10,.20]:
  for spot_move in [-.20,-.10,0.,.10,.20]:
   g=portfolio(100*(1+spot_move),30/252,.20+shift)
   stress.append({'spot_move':spot_move,'iv_shift':shift,'iv':.20+shift,'elapsed_days':15,'option_plus_initial_hedge_mtm':g['value']-g0['value']+initial_hedge*100*spot_move})
 result['stress']=stress
 (out/'summary.json').write_text(json.dumps(result,separators=(',',':')))
 (out/'config.json').write_text(json.dumps(CONFIG,indent=2));write_csv(out/'stress_grid.csv',stress)
 return result
if __name__=='__main__':
 a=argparse.ArgumentParser();a.add_argument('--out',default='results');a.add_argument('--paths',type=int,default=1500);args=a.parse_args()
 if args.paths<2:a.error('--paths must be at least 2')
 r=run(args.out,args.paths)
 print(json.dumps({k:{'mean':round(v['summary']['mean'],2),'p05':round(v['summary']['q05'],2),'profit_pct':round(v['summary']['profit_fraction']*100,2)} for k,v in r['cases'].items()},indent=2))
ENGINEERING SCOPE

Need a model you can audit?

Options analytics, hedging simulations and risk dashboards are custom-scoped projects. Start with the instruments, data and decisions your system needs to support.

Build your project brief ↗Back to research examples