Logo

Coding preview

Delta-Hedged P&L Attribution

What this preview is

About this preview

Delta-Hedged P&L Attribution is a medium quant coding problem on option theory in Python, asked at Quant.

Unlock full access to getcracked

Join to unlock this problem, detailed solutions, and our complete library of quant finance interview prep.

Implementing delta-hedged options P&L attribution in Python

This medium-difficulty coding problem tests whether you can translate the Black-Scholes Greeks and daily P&L decomposition into clean, correct Python. It's the kind of task you'd encounter in a quant trading or options-analytics role: take raw Greeks from a market-data feed, apply the first-order P&L formula, and produce daily attribution breakdowns that traders use to understand where their money came from.

The core challenge is applying the formula accurately: theta decays by a fixed fraction of the year, gamma P&L is a quadratic function of the realized spot move, and vega P&L is linear in the vol change. Rounding and handling empty inputs matter for production robustness. Strong solutions compute all three components cleanly, return the correct structure, and handle the time-scaling constant without mistakes.

  • Greeks and their units in options markets
  • First-order P&L decomposition and the Greeks formula
  • Time-value conventions (252 trading days per year)
  • Precision and data structure handling