Skip to content

Conversation

@dpaiton
Copy link
Contributor

@dpaiton dpaiton commented Mar 22, 2024

addresses #775

The solution first attempts to directly compute targeted reserve levels:
For some target rate, $r_t$, the pool share reserves, $z_t$, must be:

$$ z_t = \frac{1}{\mu} \left( \frac{k}{\frac{c}{\mu} + \left( (r_t t + 1)^{\frac{1}{T}} \right)^{1 - T}} \right)^{\tfrac{1}{1 - T}} $$

and the pool bond reserves, $y_t$, must be:

$$ y_t = \left( \frac{k}{ \frac{c}{\mu} + \left( \left( r_t t + 1 \right)^{\frac{1}{T}} \right)^{1-T}} \right)^{1-T} \left( r_t t + 1 \right)^{\frac{1}{T}} $$

where $c$ is the vault share price, $\mu$ is the initial vault share price, $t$ is the annualized position duration, and $T$ is the time stretch constant. The corresponding deltas are then:

$$ \Delta x = c * (z_t - z_e) $$

$$ \Delta y = y - y_t - c(\Delta x) $$

If that is not successful, then it performs newtons method to minimize

$$ l(x) = r(x) - r_t $$

for some realized fixed rate, $r(x) = (1 - p(x)) / (p(x) t)$ after a long was opened with $x$ base, where $p(x)$ is the spot price after the long was opened.

@dpaiton dpaiton force-pushed the dpaiton/targeted-long branch from 0cb7ac7 to 8384995 Compare March 22, 2024 08:06
This was linked to issues Mar 26, 2024
@dpaiton dpaiton force-pushed the dpaiton/targeted-long branch 12 times, most recently from cf82bbe to dec0819 Compare April 2, 2024 00:27
@dpaiton dpaiton marked this pull request as ready for review April 2, 2024 00:27
@dpaiton dpaiton force-pushed the dpaiton/targeted-long branch 2 times, most recently from 8a6aa0e to 740c3ab Compare April 2, 2024 00:34
@dpaiton
Copy link
Contributor Author

dpaiton commented Apr 2, 2024

A detailed derivation of the solution can be found in section 2 of the attached document.
get_targeted_long.pdf

@dpaiton dpaiton force-pushed the dpaiton/targeted-long branch from 740c3ab to b31f8a4 Compare April 2, 2024 00:41
@dpaiton dpaiton force-pushed the dpaiton/targeted-long branch from 4af4e6a to 874400d Compare April 5, 2024 15:40
@dpaiton dpaiton force-pushed the dpaiton/targeted-long branch from 874400d to 23c9f83 Compare April 5, 2024 20:05
@dpaiton dpaiton force-pushed the dpaiton/targeted-long branch 2 times, most recently from 4603c43 to 56a26c9 Compare April 5, 2024 20:19
@dpaiton dpaiton force-pushed the dpaiton/targeted-long branch from 56a26c9 to c6ca404 Compare April 5, 2024 20:32
@dpaiton dpaiton enabled auto-merge April 5, 2024 20:38
@dpaiton dpaiton added this pull request to the merge queue Apr 5, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 5, 2024
@dpaiton dpaiton added this pull request to the merge queue Apr 5, 2024
@dpaiton dpaiton removed this pull request from the merge queue due to a manual request Apr 5, 2024
@dpaiton dpaiton force-pushed the dpaiton/targeted-long branch from c6ca404 to e9c4477 Compare April 5, 2024 21:33
@dpaiton dpaiton enabled auto-merge April 5, 2024 21:33
@dpaiton dpaiton added this pull request to the merge queue Apr 5, 2024
Merged via the queue into main with commit ed2bc6d Apr 5, 2024
@dpaiton dpaiton deleted the dpaiton/targeted-long branch April 5, 2024 22:07
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

Successfully merging this pull request may close these issues.

calculate_targeted_long Implement get_targeted_long

3 participants