Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formalize the definitions of all the prices #55

Open
robcxyz opened this issue Jun 25, 2024 · 4 comments
Open

Formalize the definitions of all the prices #55

robcxyz opened this issue Jun 25, 2024 · 4 comments

Comments

@robcxyz
Copy link
Contributor

robcxyz commented Jun 25, 2024

There is a lot of confusion around what the definition of a "price" is in balanced. As I see it, there are categories like this:

  • Oracle price = As supplied by an oracle
  • Pool prices = Price of LP tokens being traded in a pool
  • Path traced token prices = Prices resolved through an oracle across different paths through pools. Each path is able to resolve the price of a single token according to a single oracle-ized token price which in balanced's case is ICX. There are practically infinite numbers of these prices in a sufficiently complex system such as balanced.
    • These paths need to be calculated dynamically as pools are added / removed / depleted
  • Liquidity weighted path traced price = This is a single path through pools with the highest liquidity and thus have the highest confidence in prices. Using this path, we avoid paths through pools which potentially run through depleted pools that give inaccurate prices.
    • This is what we do now
    • When we talk about what the price is of a token, this is what we are talking about right now.
    • If the token has an oracle, these prices are not the same and should never equal each other as the oracle price is not what is realized in the platform. It is up to the LPs to keep the peg but that is not always the case.
  • Average liquidity weighted price path traced price = Given multiple routes to calculate the price, we could take the top N number of prices and do a weighted average based on some metric to inform the confidence in the traced price. The metric should have a strong impact if the path includes a pool which is depleted and thus should be given a much lower weight than paths through pools with similar amount of liquidity
    • This is the plan for the future but will take some work

If we build an SDK for balanced, we'll need to have a clear definition is for each of these as price discovery will be one of the most important functionalities of said SDK.

@FezBox
Copy link

FezBox commented Jun 26, 2024

@robcxyz, who needs to supply the above?

@robcxyz
Copy link
Contributor Author

robcxyz commented Jun 26, 2024

@FezBox - No sure I follow. Supply what?

@FezBox
Copy link

FezBox commented Jun 26, 2024

To me, the above is written up, showing how it works currently and also suggestions on how to move forward, but Its also asking for clarity on a few things.

Well, that's how I read it. So my first question is, are you dependent on anyone or anything in order to work on this?

or is the above just for your reference?

@robcxyz
Copy link
Contributor Author

robcxyz commented Jun 27, 2024

@FezBox - This is just for me - no questions here

This was the start of me formalizing some of this in the docs somewhere and having a place to point if people are confused about what "price" means as in balanced there are numerous definitions - everything has multiple prices....

This is part of designing an SDK as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants