Comments (5)
Basically
sum(a/b + c/d + ef) != inv(sum(b/a + d/c +f/e))
When using the oracle, you need one of the accumulators to get a price for token0 and the other to get a price for token1. Will invite you to the oracle example although its not in any finalized state.
from v2-core.
Hmm, this doesn't make sense to me because for any given price (regardless how you got that price) you should be able to take the inverse to get the price the other direction. This means if a price is the output of some moving average formula (doesn't matter which one), then you should be able to take the inverse of that to get the other price.
Happen to have any examples or pro-tips that will help me grok why this is not true?
from v2-core.
@MicahZoltu it's because a price is a ratio of two values with different units. here's a somewhat helpful series of explanations: https://math.stackexchange.com/questions/3107661/why-is-the-inverse-of-an-average-of-numbers-not-the-same-as-the-average-of-the-i
and if you want to look at numbers, here's the most dumbed-down example: https://docs.google.com/spreadsheets/d/1wMzZabuGYknwWvX9pAR4s1yiNyfQ3DDE-c0Vb9xLxuk/edit?usp=sharing
from v2-core.
This does not make my brain happy. It very much dislikes it when intuition disagrees with reality.
from v2-core.
We'll add some clarifications in the comments. Closing in favor of #45
from v2-core.
Related Issues (20)
- Unbalanced liquidity affects prices HOT 2
- Uniswap getPair() does not deliver address(0) HOT 1
- Error Building v2-core HOT 1
- Token migration issue, balance not loading
- Yarn compile has error. HOT 1
- No SPDX License Identifier HOT 2
- Ultraswap
- `CheckContract` for token contracts HOT 3
- .
- how to get the full and right address[] path for swapExactTokensForTokens ? HOT 1
- 0xd5173949c2d40c9863b9aD6B91a4CCAD3c9B05Fe
- Let's earn the bitcoins daily!
- getPair call via Ethers.Contract does not return a pair address HOT 1
- Both Amount0In and Amount0Out Present in Logs
- Store dynamic bytes to call swap function with solidity assembly HOT 3
- Keccak256 init code hash
- yarn test meet error HOT 4
- How to run this?
- Improve Integer Square Root
- getAmountsOut returns amount which is way less than the actual amount showing in UniSwap app
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v2-core.