Skip to content

LP hedge model ​

The Hedging demo page of the web application shows a mathematical LP model next to a real variance position. This page explains what the model measures and what the hedge does not cover. For the steps, see the Hedging demo.

Sources: web/src/lib/lp-model.ts (LP model), web/src/components/demo/use-lp-hedge.ts and hedge-position.ts (test position), and the root file DEMO.md (demo plan).

The LP position is a test position

The LP position is a calculation in the browser from the oracle price. It does not read reserves or LP shares from a deployed DEX pool. The page labels it DUMMY POOL. The variance hedge is a real position in the market contract.

What the model measures ​

The model represents concentrated liquidity around a pool entry price. The default inputs are 100,000 USDC of capital and a range of plus or minus 12%.

At each observed oracle price, the model calculates the token holdings and the cash holdings of the position. It also tracks a reference portfolio. The reference holds the prior LP token quantity over each price move, then rebalances without the execution loss of the LP.

loss from moves=value of the rebalanced reference−LP value

This quantity is loss versus rebalancing, or LVR. It is not the same as total LP profit, loss versus the starting cash amount, or loss versus holding the original token balances.

Why the panel shows loss from moves only ​

An LP also has direction risk, because it holds the token. A normal short perpetual removes that risk. The variance hedge addresses the remaining part, which is the loss from moves. A directional price drop can reduce the LP value even when the variance hedge offsets much of the LVR.

Hedge size ​

Inside the active range, the model uses:

exposure=LP4,contracts=exposure×HY×1m

L is the liquidity of the position, P is the oracle price, H/Y is 7/365, and m is the contract multiplier of 100 USDC.

For 100,000 USDC and a range of plus or minus 12%, the result is 41.0 contracts. The result does not depend on the pool entry price.

Where the hedge size comes from ​

Inside the range from Pl to Pu, the value of a concentrated-liquidity position is:

V(P)=L(2P−PPu−Pl)

The value curve bends down. Its second derivative is:

V″(P)=−L2P3/2

For a small price move ΔP, the position loses the curvature term against the rebalanced reference:

loss from moves≈−12V″(P)ΔP2=LP4(ΔPP)2≈LP4r2

The loss grows with the squared return r2. One long contract receives m(Y/H)r2 for the same move, before the cap and the fixed charge. The two quantities are equal for this number of contracts:

N=LP4⋅HmY

Why the entry price drops out ​

The model sets the range as Pl=P0(1−w) and Pu=P0(1+w) around the entry price P0, and it selects L so that V(P0) is the capital C. Then:

LP0=C2−11+w−1−w

The right side has no price in it. For C=100,000 and w=0.12:

N=100,0004×0.117006×7365×1100≈41.0

This is a local approximation from the curvature of the LP position. It is not a guarantee. The model reports zero exposure outside the range. Range exit, large jumps, the observation cap, funding charges, fees, and limited execution depth affect the result.

How the page matches the two results ​

A new book position gets funding from the second observation after the fill. A closed position gets funding for one more observation. The page uses these rules to measure the LP loss and the hedge funding over the same observations:

EventRule of the page
Hedge order fillsThe page stores a test position in the browser, with the block of the fill and the account result before the order.
First observation after the fillThis price is the pool entry. The funding position becomes active.
Each later observationOne point of the LP loss series and one point of the hedge result series.
Hedge closedThe funding position stays for one more observation.
First observation after the closeThe page ends the test position and keeps the totals.

The page stores the test position in browser localStorage, for one chain, one market, and one account.

The values on the page ​

TileMeaning
LP loss from movesThe LVR of the model over the counted observations
Hedge result after costsThe change of the account result since the hedge order. It includes funding, mark profit and loss, fees, and the spread.
NetHedge result minus LP loss
CoverageHedge result divided by LP loss, limited to the range from 0% to 100%
ObservationsThe number of prices in the model path

The hedge result is the change of the full account result in that market. If the same account makes other trades in that market during the test, those trades change the hedge result.

The panel also shows the initial margin of the hedge. It calculates this value in the browser with a gap limit of 180 seconds, which is the limit of a 60-second market. The contract value can differ by a small amount for a different interval.

What the hedge does not cover ​

  • Directional loss. Use a normal short position for that risk.
  • A move above the cap. A log return above 0.05 in one observation receives the payment of 0.05.
  • A move that the market misses. A long observation gap skips funding. See Oracle and observations.
  • The calm-market cost. In a calm market, the hedge costs more than it pays.

The cost of the hedge ​

These values are from the demo plan, for 41 contracts at a mark of 1.57:

ItemValue
Fixed chargeAbout 919 USDC each day, which is 0.92% of the LP capital each day
Expected loss from moves at 110% volatilityAbout 0.71% of the LP capital each day
DifferenceThe premium that the seller receives

The hedge pays for the part of the loss that was not expected. In the demo, that part is the scripted jump. A real market does not jump at the correct time.

Python scenario results ​

The file simulation/demo_lp_hedge.py runs the demo price path through the Python simulation engine, with a deep book and the MON rules. Its outputs are:

ItemUSDC
LP loss in the 4% fall-334.75
Hedge funding in the 4% fall+341.76
LP loss in the 3% rebound-191.13
Hedge funding in the 3% rebound+192.19
Total LP loss from moves-528.98
Total hedge funding, after the charge+533.09
Trading fees for entry and exit-6.45
Spread paid for entry and exit-12.89
Hedge result after all costs+513.75
Net-15.23

Simulation outputs

These are historical simulation outputs with synthetic prices. The shock inputs are log returns of -0.04 and +0.03. The local chain and the public testnet use different timing and different makers. Do not show the Python totals as measured results of a deployed exchange.

Requirements for a real pool demo ​

A completed pool demonstration needs actual token transfers, measurable pool reserves, and LP ownership. Use mintable test MON and test USDC for controlled reserve changes. Clearly separate test MON from the native test MON that pays gas.

The pool contract, its deployment command, the swap integration, and the reserve reads of the web application remain open work.

Deployed on Monad testnet.