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$?
Maxbry
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.
Martin
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
- 112 views
- $20.00
Related Questions
-
You are given:
(i) X is the current value at time 2 of a 20-year annuity-due of $1 per annum.
(ii) The annual effective interest rate for year t is (1/(8+t)).
Find X. - Disecting Constant Product formula
- Solving Constant Product for price
- Compound Interest with monthly added capital
- Year 12 Finance - Combining Superannuation and withdrawals
- Optimal Control - Calculus of Variations
- Finding Probability Density Function of a Standard Brownian motion: Conditioning for two different cases
- Kelly Criterion for an example
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.