MathFin
Map / Valuation · Static replication and model-free bounds / MathFin.Markets.DeFi.ConcentratedLiquidityVaR

Historical-simulation value-at-risk for a Uniswap v3 concentrated-liquidity position

MathFin.Markets.DeFi.ConcentratedLiquidityVaRMSC 91G70JEL G23 source

Historical-simulation VaR revalues today's position under each of n historical scenarios for the risk factor, treats the resulting n hypothetical losses as equally likely (1/n each), and reports the empirical α-quantile of that loss distribution — the standard methodology of P. Jorion, Value at Risk (3rd ed., 2007), ch. 10 "VAR Methods" — applied here to a Uniswap v3 concentrated-liquidity LP position (MathFin.DeFi.v3PositionValue, MathFin/Markets/DeFi/UniswapMechanics.lean) whose risk factor is the square-root price √P.

This file does not model fees, re-ranging, or multi-day return compounding: a genuine "99%/10-day" VaR additionally needs a horizon-scaling convention applied to the n historical scenarios themselves (e.g. overlapping 10-day log-return windows), which is a modeling choice made upstream of this file on the scenario data, not a theorem about the risk measure. What is formalized is the historical-simulation risk measure applied to the position's deterministic value function, reusing the general finite-law VaR machinery of MathFin.DiscreteVaR (Risk/DiscreteVaR.lean) rather than re-deriving quantile mechanics, together with the already-proved Uniswap v3 virtual-reserve curve (MathFin/Markets/DeFi/UniswapMechanics.lean). The two theorems below rest only on the position's value being nonnegative and linear in liquidity — true of any such value function, not special to the concentrated-liquidity range shape — so they do not yet use the v3 curve's own monotonicity in price. A genuine "VaR is the full revaluation at the empirical price quantile" result is future work, not claimed here.

Main definitions

  • historicalScenarioLoss: the loss of a v3 position, marked today at square-root price s0, under a historical scenario i whose square-root price is scenarios i.
  • clHistoricalVaR: the historical-simulation VaR of the position — MathFin.DiscreteVaR.finiteVaR of historicalScenarioLoss at MathFin.DiscreteVaR.uniformWeights.

Main results

  • clHistoricalVaR_const_mul: historical VaR scales with liquidity restricted to c ≥ 0 (positive homogeneity, the sign restriction VaR itself needs) — scaling the liquidity deployed to a range by a nonnegative factor (holding the range and the historical scenarios fixed) scales its historical-simulation VaR by the same factor, via MathFin.DeFi.v3PositionValue_const_mul (linear in L for any real c) and MathFin.DiscreteVaR.finiteVaR_const_mul.
  • clHistoricalVaR_eq_valueAtRisk: clHistoricalVaR is the library's valueAtRisk of the scenario losses under the equal-weight law Measure.ofWeights, so the general VaR theory applies to it.
  • clHistoricalVaR_le_value: historical VaR never exceeds the position's current mark-to-market value — a concentrated-liquidity LP position is worth at least 0 at every price (v3PositionValue_nonneg), so no historical scenario's loss can exceed today's value, and VaR is attained at a loss value (MathFin.DiscreteVaR.finiteVaR_eq_value_min, via MathFin.DiscreteVaR.finiteVaR_le_of_forall_le).
  • clHistoricalVaR_eq_valueAtRisk_contractValue: the scenario revaluation is the value of the position as a contract, Contract.value of lpPayoff paid at the horizon, under the scenario's Dirac law with deflator 1 (full revaluation at the scenario prices, no discounting), and clHistoricalVaR is the valueAtRisk of the resulting losses.

References

  • H. Adams, N. Zinsmeister, M. Salem, R. Keefer, D. Robinson, Uniswap v3 Core [AdamsEtAl2021], §2, §6.4.1.
  • P. Jorion, Value at Risk: The New Benchmark for Managing Financial Risk, 3rd ed. (2007) [Jorion2007], ch. 10 "VAR Methods" (historical simulation).

Tags

historical simulation, value-at-risk, Uniswap v3, concentrated liquidity, liquidity provider, scenario revaluation, MSC 91G70, JEL G23

Import neighbourhood

Above: what it imports. Below: what imports it.

Corpus entries

mf-uniswap-v3-concentrated-liquidity-historical-var · defi.json · full statement
Historical-Simulation VaR of a Uniswap v3 Concentrated-Liquidity Position

Historical-simulation VaR revalues a Uniswap v3 concentrated-liquidity position (liquidity L >= 0 on square-root price range [a, b], 0 < a <= b, marked today at square-root price s0) under n >= 1 historical square-root-price scenarios, each equally likely (weight 1/n), and reports the empirical alpha-quantile of the resulting loss distribution (alpha in (0, 1)). This VaR never exceeds the position's current mark-to-market value, since the position's value is always nonnegative, and scales linearly with the deployed liquidity: doubling L (same range and scenarios) doubles the VaR. Fees, re-ranging and multi-day return compounding (the horizon-scaling convention a genuine 99%/10-day VaR needs) are not modelled; the n historical scenarios are taken as given data, not derived from a price process. The historical VaR is also the library's valueAtRisk of the scenario-loss random variable under the equal-weight law Measure.ofWeights (weights 1/n), so the general VaR theory applies to it. VaR is not evaluated as the loss at an empirical price quantile: the loss is antitone in the square-root price, and that revaluation result is not proved. The scenario revaluation is also stated through the contract language: the position is the contract Contract.pay T (lpPayoff L a b T), each scenario revalues it by Contract.value under the Dirac law at that scenario with deflator 1 and the scenario price (square-root price)^2 (a full revaluation at the scenario prices, no discounting; scenario square-root prices nonnegative), and the historical VaR is the valueAtRisk of mark minus revaluation under the equal-weight law.

Declarations 6

defMathFin.DeFi.historicalScenarioLosssource
ℝ → ℝ → ℝ → ℝ → {n : ℕ} → (Fin n → ℝ) → Fin n → ℝ

Historical-simulation loss: the loss of a v3 position with liquidity L on range [a, b], marked today at square-root price s0, under historical scenario i's square-root price scenarios i. Positive when the scenario's price move decreases the position's value.

defMathFin.DeFi.clHistoricalVaRsource
ℝ → ℝ → ℝ → ℝ → {n : ℕ} → [NeZero n] → (Fin n → ℝ) → ℝ → ℝ

Historical-simulation VaR of a v3 concentrated-liquidity position: the finiteVaR of historicalScenarioLoss at the equal weights uniformWeights n — the empirical α-quantile of n historical hypothetical losses, each equally likely.

theoremMathFin.DeFi.clHistoricalVaR_const_mulsource
∀ {n : ℕ} [NeZero n] (L a b s0 : ℝ) (scenarios : Fin n → ℝ) {α : ℝ}, α ∈ Set.Ioo 0 1 → ∀ {c : ℝ}, 0 ≤ c → clHistoricalVaR (c * L) a b s0 scenarios α = c * clHistoricalVaR L a b s0 scenarios α

Historical VaR scales with deployed liquidity. Holding the range [a, b], the mark s0 and the historical scenarios fixed, scaling the liquidity L by a nonnegative factor c scales the position's historical-simulation VaR by the same factor: the loss function scales by c pointwise (v3PositionValue_const_mul), and VaR is positively homogeneous in the loss (MathFin.DiscreteVaR.finiteVaR_const_mul).

theoremMathFin.DeFi.clHistoricalVaR_le_valuesource
∀ {n : ℕ} [NeZero n] {L a b : ℝ}, 0 ≤ L → 0 < a → a ≤ b → ∀ (s0 : ℝ) (scenarios : Fin n → ℝ) {α : ℝ}, 0 < α → α ≤ 1 → clHistoricalVaR L a b s0 scenarios α ≤ v3PositionValue L a b s0

Historical VaR never exceeds the position's current value. A v3 position's value is always nonnegative (v3PositionValue_nonneg), so no historical scenario can produce a loss larger than today's mark v3PositionValue L a b s0 — and VaR is attained at a loss value (MathFin.DiscreteVaR.finiteVaR_eq_value_min, via MathFin.DiscreteVaR.finiteVaR_le_of_forall_le).

theoremMathFin.DeFi.clHistoricalVaR_eq_valueAtRisksource
∀ {n : ℕ} [NeZero n] (L a b s0 : ℝ) (scenarios : Fin n → ℝ) {α : ℝ}, α ∈ Set.Ioo 0 1 → clHistoricalVaR L a b s0 scenarios α = valueAtRisk (historicalScenarioLoss L a b s0 scenarios) (Measure.ofWeights Finset.univ fun x => (↑n)⁻¹) α

Historical VaR is the library's valueAtRisk at the empirical law. The scenario losses are a random variable on the n scenarios under the equal-weight law ∑ i, n⁻¹ • δ_i (Measure.ofWeights), and clHistoricalVaR is valueAtRisk of it at level α ∈ (0, 1). So everything proved of valueAtRisk (monotonicity, law invariance, comonotone additivity, the Gaussian closed forms) applies to historical simulation of a v3 position.

theoremMathFin.DeFi.clHistoricalVaR_eq_valueAtRisk_contractValuesource
∀ {n : ℕ} [NeZero n] {L a b : ℝ}, 0 < a → a ≤ b → ∀ (s0 : ℝ) (T : NNReal) (scenarios : Fin n → ℝ), (∀ (i : Fin n), 0 ≤ scenarios i) → ∀ {α : ℝ}, α ∈ Set.Ioo 0 1 → clHistoricalVaR L a b s0 scenarios α = valueAtRisk (fun i => v3PositionValue L a b s0 - Contract.value (Measure.dirac i) (fun x x_1 => 1) (fun x x_1 j => scenarios j ^ 2) (Contract.pay T (lpPayoff L a b T))) (Measure.ofWeights Finset.univ fun x => (↑n)⁻¹) α

Historical VaR is the VaR of the contract's revaluation losses. The position is the contract Contract.pay T (lpPayoff L a b T) of Markets/DeFi/LPContract.lean. Scenario i is the market whose price of X in Y is (scenarios i) ^ 2 (square-root price scenarios i ≥ 0), represented by the Dirac law at i and the deflator 1: the contract's value there is Contract.value of the position, a full revaluation at the scenario price with no discounting. The historical VaR is the valueAtRisk, under the equal-weight law on the scenarios, of the loss v3PositionValue at the mark s0 minus that revaluation. The mark s0 stays the position's value as a function of the square-root price; the scenarios are taken as given data.