LogoLogo
  • Learn about Balancer
  • Background
    • Team Goal
  • Fundamentals
    • White Paper
      • The Value Function
        • USDC WETH WBTC 33/33/33
        • BAL WETH 80/20
        • Price Change Proof
      • Spot & Effective Price
        • Spot Price
        • Effective Price
        • Price Impact
        • Price Impact - With Swap Fees
      • Trading Formulas
        • Out-Given-In
          • Including Swap Fees
        • In-Given-Out
          • Including Swap Fees
        • In-Given-Price
          • In-Given-Price Proof
          • Arbitrage 80/20
          • Arbitrage 50/50
        • Summary
      • Deposits & Withdrawals
        • Deposits
          • Proportional Deposits
            • BAL / WETH 80/20
          • Single Sided Deposits
            • Price Impact; 10,000 BAL
            • Price Impact; 100,000 BAL
          • Multi-token Deposits
            • Price Impact WMATIC / MTA / WETH
            • Price Impact [2] WMATIC / MTA / WETH
        • Withdrawals
          • Proportional Withdrawals
            • BAL/WETH 80/20
          • Singled Sided Withdrawals
            • Withdrawal Price Impact
    • Impermanent Loss
      • 50/50 Pools
      • 80/20 Pools
      • Multi-token Pools
    • veBAL Tokenomics
      • TLDR
      • Vote-Escrowed Governance
      • Financial Implications
        • Boosting BAL Incentives
          • Minimum veBAL for Max Boost
          • Maximum Boost
          • Calculating my Boost
          • Boost Delegation for Contract Wallet
        • Protocol Revenue Distribution
        • Gauge Voting
      • Inflation Schedule
      • veBAL FAQ
  • More Information
    • For Developers
      • GitHub Integration
    • For Support
    • References & Related Content
  • Documented Questions
    • Coming soon
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Fundamentals
  2. White Paper

Trading Formulas

PreviousPrice Impact - With Swap FeesNextOut-Given-In

Last updated 3 years ago

Was this helpful?

Balancer’s trade interface is based on several formulas which give a user the permissions to exchange tokens based on the relationships of the underlying pools. Balancer is host to many pools which contain the same tokens, creating the obstacle of which pool is best to route trades through. The solution is that we as users do not need to concern ourselves with deciding which pool to exchange with. While many tokens are found in several pools, Balancer has developed a Smart Order Router also known as the SOR. The SOR will guide a trade through all the options towards the one which benefits our traders the most.

Why would understanding Balancer Protocol’s trading formulas be important to a user? Every interaction with the Balancer Protocol will be impacted by these equations to some degree. For traders, understanding how the price of assets is calculated can vary across Automated Market Making Platforms. These equations are the foundation of market making on Balancer Protocol and create a massive potential for profitable use cases through arbitrage and liquidity provision. For liquidity providers these same equations will provide a gateway to earning swap fees and making long term positions earn yield by harvesting the surrounding market’s volatility.

Balancer’s formulas for trades as defined by the are the Out-Given-In, In-Given-Out, and the In-Given-Price which will be described below.

The following variables will be used in these equations:

Balancer Labs Documentation:

Swap Guides for Developers
Swaps Fees standard Math
Swap documentation for developers
Smart Order Router
whitepaper