Skip to main content

    Calculation method

    How MoonMath calculates stablecoin depeg

    Stablecoin Depeg & LP Stress Simulator — What happens to a wallet or LP position if a stablecoin loses its peg?

    The formula

    A balanced position fixes the invariant in native units; after external prices move, a fully arbitraged constant-product pool holds √(k × priceB ÷ priceA) of one asset and the mirror of it in the other. The loss is that value against simply holding both halves.

    What it reads

    • The position value in dollars
    • A scenario price for each of the two assets, each bounded to a plausible band

    What it assumes

    • Both assets are assumed to start at exactly one dollar, so each reserve owns half the position
    • The pool is assumed fully arbitraged to the new external price ratio
    • No repeg and no future trade is assumed
    • Trading fees, incentives, gas and exit costs are all excluded

    What this does not establish

    • It does not forecast a depeg or its probability — the prices are a scenario the reader supplies
    • It does not model the mechanism of a depeg, its duration, or a recovery
    • It says nothing about the redeemability of either asset with its issuer
    • The loss shown is against holding both halves, not against any other strategy

    Run it

    Compare a balanced stablecoin wallet with a full-range constant-product LP after one or both assets move away from one dollar. Stablecoin price loss and LP rebalancing loss are shown separately.

    Open the Stablecoin Depeg calculator

    How the market itself works

    This page describes MoonMath's arithmetic. The mechanics section describes the market: how an order book forms a price, why order-book depth is not the same thing as pool liquidity, and what a public book does and does not let you observe.

    Read the market mechanics