Limit search to available items
Book Cover
E-book
Author Ottina, Miguel, author

Title Automated market makers : a practical guide to decentralized exchanges and cryptocurrency trading / Miguel Ottina, Peter Johannes Steffensen, Jesper Kristensen
Published New York : Apress, 2023

Copies

Description 1 online resource : illustrations
Contents Intro -- Table of Contents -- About the Authors -- About This Book -- Chapter 1: Introduction to AMMs -- 1.1 Preliminary Notions -- 1.2 Historical Overview -- 1.3 Summary -- Chapter 2: Uniswap v2 -- 2.1 Trading in a Uniswap v2 pool -- 2.1.1 Spot Price -- 2.1.2 Accounting for Fees -- 2.2 Impact of the Trades on the Price -- 2.2.1 A Simple Example -- 2.2.2 Analysis of Two Consecutive Trades -- 2.2.3 Impact of the Trade Size on the Average Purchase Price -- 2.2.4 Impact of the Trade Size on the Average Sell Price -- 2.2.5 Impact of the Trade Size on the Price Growth Ratio
2.3 Providing Liquidity -- 2.3.1 Minting LP Tokens -- Starting the Pool -- 2.3.2 Burning LP Tokens -- Distribution of Fees -- 2.3.3 Pool Value and Impermanent Loss -- Computing Impermanent Loss Without Fees -- Accounting for Fees -- 2.3.4 LP Token Swap -- Common Token Case -- No In-Common Token Case: Oracle Swap -- 2.4 Motivating DEX Aggregators -- 2.5 Summary -- Chapter 3: Balancer -- 3.1 The Constant Value Function -- 3.2 Spot Price -- 3.2.1 Constant Value Distribution -- 3.3 Trading Formulae -- 3.4 Providing Liquidity -- 3.4.1 All-Asset Deposit -- 3.4.2 Single-Asset Deposit
3.4.3 All-Asset Withdrawal -- 3.4.4 Single-Asset Withdrawal -- 3.5 Pool Tokens Swap -- 3.5.1 Swap of Pool Tokens That Belong to Pools of Different Types -- 3.6 Summary -- Chapter 4: Curve Finance -- 4.1 The StableSwap Invariant -- 4.2 Mathematical Preliminaries -- 4.2.1 Finding the Parameter D -- 4.3 Trading Formulae -- 4.3.1 Taking Fee into Consideration -- 4.4 All-Asset Deposit -- 4.5 All-Asset Withdrawal -- 4.6 Single-Asset Withdrawal -- 4.7 StableSwap LP Token Swap -- 4.8 Summary -- Chapter 5: Uniswap v3 -- 5.1 Ticks -- 5.1.1 Initialized Ticks -- 5.1.2 Tick Spacing
5.2 Liquidity Providers' Position -- 5.3 Impermanent Loss -- 5.4 Multiple Positions -- 5.5 Protocol Implementation -- 5.5.1 Variables -- 5.5.2 Fees -- 5.5.3 Trades -- 5.5.4 The swap Function -- 5.5.5 Example -- 5.6 LP Tokens -- 5.6.1 Minting LP Tokens -- 5.6.2 Modifying the Position: Part I -- 5.6.3 Update the Position -- 5.6.4 Tick Class -- 5.6.5 Burning LP Tokens -- 5.7 Analysis of Liquidity Provisioning -- 5.7.1 Capital Efficiency -- 5.7.2 Independence with Respect to Other Liquidity Providers -- 5.8 Summary -- References -- Index
Summary Explore Automated Market Makers (AMMs), the underlying protocols used by decentralized exchanges (DEX) to allow users to perform trades of cryptocurrencies in a decentralized way with no middlemen. This book provides a thorough study and a clear-cut exposition of the principal AMMs (Uniswap v2 and v3, Balancer, and Curve). You'll receive a detailed description of how these AMMs work, unveiling the mathematics behind them and showing plenty of examples as well as novel proofs for several interesting facts. Each chapter describes an AMM's core idea and derives the mathematical formulas used in the code, giving careful explanations of the logical thinking involved and detailing the steps needed to reach those formulas. All these explanations are complemented with thoughtfully chosen examples which further help to enlighten the readers on how the formulae work. In addition, the relevant parts of the codes of the AMMs are shown after explaining each formula so that the actual implementation of the formulae can be seen. In a traditional trading market a buy order has to be matched with a sell order to achieve a trade. However, for an AMM, users trade against the protocol itself, a smart contract, or a community pool of funds. In simple terms this is an open source computer program in which mathematical formulas define prices. Automated Market Makers examines this critical point revealing that no banks or intermediaries are necessary, giving crucial financial access to a much larger crowd, regardless of who they are with less barriers to access. What You'll Learn Understand the principals of decentralized finance (DeFi) Grasp mathematical formulae that underpin decentralized exchanges Work with Solidity programming language Review current industry best practices Who This Book Is For Those new to Blockchain and Cryptocurrency trading, who want to learn more about AMMs Developers who want to dive deeper into the core features of AMM platforms Investors and venture capitalists who want to know more about new emerging technologies
Bibliography Includes bibliographical references (pages 281-287) and index
Subject Electronic trading of securities.
Cryptocurrencies.
Finance -- Data processing.
Blockchains (Databases)
cryptocurrencies.
Blockchains (Databases)
Cryptocurrencies
Electronic trading of securities
Finance -- Data processing
Form Electronic book
Author Steffensen, Peter Johannes, author
Kristensen, Jesper, author
ISBN 9781484286166
1484286162