hAMM

Hedged Automated Market Making (hAMM) is the liquidity solution for contract calculation, which is inspired by Automated Market Making (AMM).

The goal for AMM is "price discovery", the key formula of which is xy=kx*y=k, presented as a curve of price (such as AMM for Uniswap) or surface of price (such as generalized-AMM for Balancer).

However, margin trading is significantly different from spot trading.

In spot trading, it means using aa amount of asset A to exchange for bb amount of asset B, while in margin trading, it means depositing mm amount of margin to withdraw ee amount of equity, which fluctuates over time.

Obviously, when e>me>m, the profit of a position comes from the loss of opposite positions.

Thus, the goal for hAMM is "position hedged", the formula is as follows:

X+Y=0X+Y=0
  • XX is always positive as the sum of total long positions.

  • YY is always negetive as the sum of total short positions.

The formula means that the sum of total long positions XX equals to the sum of total short positions YY in certain derivative.

Both hAMM and AMM take the same path to achieve their goal, i.e., each deviation and imbalance of the system caused by transactions would create reasonable arbitrage possibilities, which would attract external arbitrageurs to trade for risk-free profits, therefore restore the system back to a balanced state.

All mechanisms pertaining to Derify protocol are centered around the key formula of X+Y=0X+Y=0.