Solving constant product for price
The constant product is used in decentralized finance. It is used to calculate how much someone gets for currency $Y$ when giving funds of currency $X$. $X$ and $Y$ indicate the size of funds in the corresponding currencies, $a$ stands for the amount of funds of currency $X$ given into the pool, $b$ stands for the amount of funds taken out in currency $Y$. $p$ is the price paid for the transaction.
$k = X * Y$
$k = (X+a) (Y-b)$
$a = (k / (Y-b)) - X$
$p = a / b$
Now my question is: How much does someone have to take out to exactly receive $p$? I.e., for given $X$, $Y$ and $p$, which value for $b$ results in $p$?
29
Answer
Answers can only be viewed under the following conditions:
- The questioner was satisfied with and accepted the answer, or
- The answer was evaluated as being 100% correct by the judge.
1.6K
The answer is accepted.
Join Matchmaticians Affiliate Marketing
Program to earn up to a 50% commission on every question that your affiliated users ask or answer.
- answered
- 175 views
- $20.00
Related Questions
- Disecting Constant Product formula
- Internal Rate of Return vs Discount Rate
-
Mathematical finance question on Portfolio
and Investment Year Methods(question attached below) - Year 12 Finance - Combining Superannuation and withdrawals
- Finding Probability Density Function of a Standard Brownian motion: Conditioning for two different cases
- Finance question with bonds
-
A fund pays 1 at time t = 0, 2 at time t = 2n and 1 at time t = 4n. The
present value of the payments is 3.61. Calculate $(1 + i)^n$. - Solving Constant Product for ratio
If you solve for b, you will get a nonlinear equation and to solve it you need to use numerical methods. If that's what you are looking for, I can explain it more.
I know that's possible to solve for $a$: $a = pY - X$. So I was actually hoping to get a solution for $b$ of similar type.
b does not simplify into a similar closed-form expression because of this nonlinearity. if p, X, Y, and k are known, b can be solved numerically.