0/5
## Spot Price (Mid Price) We are going to talk about the spot price. This is also called the *mid price*, and it is a way of determining the price of one token in terms of another token in an AMM. We can use a simple equation to calculate the spot price: ``` y0 / x0 ``` *y0* is the amount of token Y in the AMM. *x0* is the amount of token X in the AMM. If we want to know the spot price of token Y in terms of token X, we just flip the equation: ``` x0 / y0 ``` Let's look at an example. Let's say token X is ETH, and there are 3,000 ETH in the AMM. Let's also say token Y is DAI, and there are 6 million DAI in the AMM. The spot price of ETH in terms of DAI is then: ``` 6,000,000 / 3,000 = 2,000 DAI / ETH ``` In the next video, we'll show how to derive the equation we just used. We'll do that by looking at a small trade.
A simple introduction to calculating the spot price of a token in an AMM. The lesson covers the concept of spot price, the formula used to calculate spot price, and how that formula is derived.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
How to use Uniswap v2 dex and contracts
Interacting with the Uniswap v2 router and factory
How to create Uniswap v2 liquidity pools
How to add liquidity to Uniswap v2 pools
Swaps, flash swaps, flash swap arbitrage, and time-weighted average price (TWAP)
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on October 9, 2024
Solidity Developer
Uniswap V2Duration: 14min
Duration: 1h 20min
Duration: 10min
Duration: 54min
Duration: 25min
Duration: 26min
Duration: 1h 03min
Duration: 59min
Course Overview
About the course
How to use Uniswap v2 dex and contracts
Interacting with the Uniswap v2 router and factory
How to create Uniswap v2 liquidity pools
How to add liquidity to Uniswap v2 pools
Swaps, flash swaps, flash swap arbitrage, and time-weighted average price (TWAP)
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on October 9, 2024
Testimonials
Read what our students have to say about this course.
Chainlink
Chainlink
Gustavo Gonzalez
Solutions Engineer at OpenZeppelin
Francesco Andreoli
Lead Devrel at Metamask
Albert Hu
DeForm Founding Engineer
Radek
Senior Developer Advocate at Ceramic
Boidushya
WalletConnect
Idris
Developer Relations Engineer at Axelar