Divide by zero when scaled long price is near zero #507

Closed
opened 2022-06-22 14:11:05 -07:00 by scionaltera · 0 comments
scionaltera commented 2022-06-22 14:11:05 -07:00 (Migrated from github.com)

I suspect this is due to using a coin that has an actual price close to zero and it gets rounded. The method should protect against divide by zero instead of throwing an exception, but what should the spread be in this case?

https://github.com/agonyforge/arbitrader/blob/master/src/main/java/com/agonyforge/arbitrader/service/SpreadService.java#L172

Screenshot_2022-06-22_at_4 44 57_AM

I suspect this is due to using a coin that has an actual price close to zero and it gets rounded. The method should protect against divide by zero instead of throwing an exception, but what should the spread be in this case? https://github.com/agonyforge/arbitrader/blob/master/src/main/java/com/agonyforge/arbitrader/service/SpreadService.java#L172 ![Screenshot_2022-06-22_at_4 44 57_AM](https://user-images.githubusercontent.com/1952888/175136720-29106607-d74b-4271-b195-0c72f5d28dae.png)
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
scion/arbitrader#507
No description provided.