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

add guardrails to open long & short preventing double max #126

Open
dpaiton opened this issue Jan 17, 2024 · 2 comments
Open

add guardrails to open long & short preventing double max #126

dpaiton opened this issue Jan 17, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@dpaiton
Copy link
Member

dpaiton commented Jan 17, 2024

in our fuzz tests we should prevent allowing two max longs/shorts in row

lets put a check in the interface before calling rust funcs; if bond & share are at certain levels (e.g. close to equal for max long) then we directly return FixedPoint(0) without bothering with the rust func. Similar for max short

we should also catch neg interest in crash reporting and see if it's because max long was too big (calc_max has noise, this results from two max trades in a row)

@wakamex
Copy link
Contributor

wakamex commented Jan 18, 2024

we discussed this a bit, and the most robust solution would be to add guardrails to the rust sdk. that may still be something we want to do, but it's a bigger task, since the logic needs to be mirrored in solidity. we have a lot more flexibility in addressing this issue in python, like running a mock trade at the end.

@dpaiton
Copy link
Member Author

dpaiton commented May 1, 2024

A shortcut was added to max long in #5
A similar one should be added to max short.

@dpaiton dpaiton transferred this issue from delvtech/agent0 Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants