Giter Club home page Giter Club logo

Comments (5)

haydenadams avatar haydenadams commented on May 14, 2024

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.

MicahZoltu avatar MicahZoltu commented on May 14, 2024

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.

NoahZinsmeister avatar NoahZinsmeister commented on May 14, 2024

@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.

MicahZoltu avatar MicahZoltu commented on May 14, 2024

This does not make my brain happy. It very much dislikes it when intuition disagrees with reality.

from v2-core.

haydenadams avatar haydenadams commented on May 14, 2024

We'll add some clarifications in the comments. Closing in favor of #45

from v2-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.