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, $b$ stands for the amount of funds of currency $X$ taken from the pool, $a$ stands for the amount of funds one has to give in currency $Y$ in return. $p$ is the price paid for the transaction.
$k = X Y$
$a = (XY / (X-b)) - X$
$p = a/b$
For a two-step trade covering intermediate currency $T$ (The pool sizes can differ when $T$ is paired with different currencies, which is why there are $T_1$ and $T_2$), when buying amount $b$:
$k_2 = T_2Y$
$k_1 = XT_1$
$t = (T_2Y / (T_2 - b)) - T_2 $
$a = (X T_1 / (X - t)) - X $
$p = a/b$
My question is: How do I solve that second set of formulas, those using $T_1$ and $T_2$, for $b$? Meaning, how much do I need to take to get a specific price $p$?
Known variables are $X$, $T_1$, $T_2$, $Y$ and $p$.
Answer
- The questioner was satisfied with and accepted the answer, or
- The answer was evaluated as being 100% correct by the judge.
1 Attachment
- answered
- 182 views
- $30.00
Related Questions
-
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
- Amortization Table
- Year 12 Finance - Home loans
- Finding Probability Density Function of a Standard Brownian motion: Conditioning for two different cases
- Kelly Criterion for an example
- Finance question with bonds
-
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.
If p is known, why do you want to get a specific price p?
I want to solve for b
Notice that these are different equations compared to the last problem. Do you want me to try to answer it?
It's like: The more I buy, the higher the price gets. And what I want to know is how much I can buy until the price reaches a specific value.
Yes the equations are slightly different. The previous question was about how to much one can sell, this one is about how much one can buy. The previous one was from a to b, this is one from b to a, so it's backwards.
These equations are slightly more difficult. Would you consider increasing the bounty?
Yes, done.