Weighted Math
“Balancer's Weighted Math equation is a generalization of the x ∗ y = k constant product formula recommended for Automated Market Makers (AMMs) - Vitalik Buterin.
Balancer's generalization accounts for cases with n≥2 tokens as well as weightings that are not an even 50/50 split. “ © Balancer’s docs
Weighted Math is designed to facilitate swaps between any assets, regardless of their price correlation. Prices are determined by:
Pool balances
Pool weights
Amount of tokens being swapped
This mechanism ensures efficient and flexible trading across various assets within the InterSwap ecosystem.
As the price of each token changes, regular and arbitrage traders rebalance the pool by making swaps. This process:
- Maintains the desired weighting of the value held by each token
- Ensures liquidity pools remain efficient and balanced
- Generates trading fees for liquidity providers This self-regulating mechanism helps sustain stable and optimal trading conditions within InterSwap's ecosystem.
The value function
is defined as:Where
ranges over the tokens in the pool.
is the balance of the token in the pool.
is the normalized weight of the tokens, such that the sum of all normalized weights is 1.
Formulas above is taken from balancer.fi docs.