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

Try catch around price calculation #786

Merged

Conversation

jarry-xiao
Copy link
Contributor

@jarry-xiao jarry-xiao commented Dec 21, 2023

I've reverted the price calculation back to the original with a try catch around the BN casting. This seems safest w.r.t. making sure the math is correct

The only time an overflow occurs is in the case of a stink offer where the quantity is in between 2^53 and 2^64. I think it should be reasonable to avoid anything in this range, but let me know if you disagree.

I'm also adding test scripts for a couple different mainnet markets to assure that the resulting bid-ask spread is reasonable.

Sorry about any issues that this may have caused you system - hopefully this unambiguously solves the issues.

image

@crispheaney crispheaney merged commit a2956ec into drift-labs:master Dec 22, 2023
9 of 11 checks passed
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.

2 participants