-
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
add market valuation functions #153
Conversation
I'm not sure about how we'd want to write tests for these functions, as they're basically estimates. Any direction is appreciated! |
…_value_short_long
c5099bd
to
a0f6fd5
Compare
I like Mihai's second suggestion, |
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.
Thanks a lot for this, it'll be helpful for several different applications! I made comments on the long/close.rs
file; prop those to short & I'll give it another look.
There's a couple things I've been able to drill down on while testing this function:
I suspect small rounding-related inaccuracies when computing Example failure using
Example failure without that line:
Both tests used a tolerance of 1e10 (to ensure it failed a bunch of times)
Would we be okay with the tests passing with "large" discrepancies between |
After reworking these to match their Thanks @dpaiton for all the help in getting these completed! |
Chainsync uses `calc_close_*` for estimating closeout value, which could fail if the pool is in a situation where positions cannot be closed. We ware working on a general solution for this here: delvtech/hyperdrive-rs#153 This PR is a temporary solution that approximates the closeout value using spot price.
Resolved Issues
Adds
calculate_value_long
andcalculate_value_short
functions as described in #138 (#138)Description
formula for
value_long
:formula for
value_short
:Review Checklists
Please check each item before approving the pull request. While going
through the checklist, it is recommended to leave comments on items that are
referenced in the checklist to make sure that they are reviewed.
covering the full input space?
ensure that Rust matches Solidity?