-
Notifications
You must be signed in to change notification settings - Fork 0
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
calc abs max short guess #202
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dpaiton
force-pushed
the
dpaiton/calc-abs-max-short
branch
3 times, most recently
from
November 25, 2024 18:11
0cbfffe
to
4cc1f81
Compare
dpaiton
force-pushed
the
dpaiton/calc-abs-max-short
branch
from
December 3, 2024 22:45
57159bb
to
12f2a29
Compare
dpaiton
force-pushed
the
dpaiton/calc-abs-max-short
branch
from
December 16, 2024 16:36
9fbc55d
to
89d3725
Compare
dpaiton
force-pushed
the
dpaiton/calc-abs-max-short
branch
from
December 17, 2024 19:06
6d6e635
to
ee792ad
Compare
jrhea
approved these changes
Dec 17, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
improves the function for calculating the absolute max short.
We use a linear approximation that passes the test 99.67% of the time (7441/7465 passed). There is an additional loop to ensure the remaining tests pass. Future work should be to fix the linear estimate to remove this loop -- it should not be required if the theory & code are correct.
Additional changes:
calculate_absolute_max_short
. This was failing in cases when solidity was successful and erroneous. The new (rust) starting point obtained by the approximate estimate can succeed when the old (solidity) function fails, and it can also result in a lower final value than the solidity version. Follow-up PRs will add more tests that concretely demonstrate tolerances for final solvency after opening the max short. Once we are happy with the Rust version, we can port the code back over to Solidity & add back the parity tests.calculate_spot_price
tocalculate_spot_price_down
and added a*_up
version -- this is helpful for over/under estimating the price in the approximation code.solvency_after_short
Derivation of approximate function