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

Investigate 2 errors emitted in the optimizer #561

Open
barakman opened this issue Apr 20, 2024 · 0 comments
Open

Investigate 2 errors emitted in the optimizer #561

barakman opened this issue Apr 20, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@barakman
Copy link
Collaborator

Bug Description

There are 2 different errors which are occasionally emitted in the optimizer:
The 1st error:

RuntimeWarning: overflow encountered in exp
p = np.exp(plog10 * np.log(10))

The 2nd error:

RuntimeWarning: invalid value encountered in scalar divide
p = pvec[self.tknx] / pvec[self.tkny]

Neither one of these errors ends up with an uncaught exception, i.e., both are handled gracefully in some way.

The result is a potentially-undesired behavior of the system.

Severity

High

Steps to Reproduce

Both errors are consistently reproducible in test_901_TestMultiTriangleModeSlow.py:

  • The 1st error occurs in function test_test_combos
  • The 2nd error occurs in function test_test_find_arbitrage_single

PR #546 attempts to handle the 1st error, so it may serve as a starting-point.

The 2nd error appears to be just a matter of the price of one of the two tokens (and sometimes the prices of both of them) being zero, which is pretty much invalid to begin with.
So a special handling of this specific scenario should possibly be applied here, perhaps at a much earlier point, before even entering optimizer's code.
Alternatively, the initial state could actually be a valid one, but with some inaccurate or incorrect calculation along the way ultimately leading to an invalid (zero) price.

@barakman barakman added the bug Something isn't working label Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants