Skip to content
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

Wrap max long & targeted long to something like calculate_max_valid_long(max_budget, target_rate) #30

Open
dpaiton opened this issue Apr 5, 2024 · 1 comment
Assignees

Comments

@dpaiton
Copy link
Member

dpaiton commented Apr 5, 2024

We want an easy-to-use fn that always returns a valid long that is maximally profitable. For example:

if fixed_rate > variable_rate {
  target_rate = variable_rate;
  agent.open_long(hyperdrive.max_valid_long(agent.budget, target_rate);
}

The max_valid_long fn would be guaranteed to be valid, and return a long that is as close to the target as possible without exceeding it. In the event that the long to achieve the target rate produces an insolvent pool, it will return the maximum long.

This is different from the existing calculate_targeted_long, which will throw an error if the long to hit the target_rate produces an insolvent pool.

@dpaiton dpaiton self-assigned this Apr 5, 2024
@dpaiton dpaiton changed the title Wrap max long & targeted long to something like calculate_max_valid_long_with_budget_and_rate_constraints Wrap max long & targeted long to something like calculate_max_valid_long(max_budget, target_rate) Apr 5, 2024
@ryangoree ryangoree transferred this issue from delvtech/hyperdrive May 1, 2024
@dpaiton
Copy link
Member Author

dpaiton commented Aug 9, 2024

Blocked by #21

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

No branches or pull requests

1 participant