Closed dsystems-io closed 8 months ago
Hey @dsystems-io thanks a lot for opening a detailed issue with a traceback included! Weird, we have never seen this division by zero error before. What exact settings did you use for accounting to generate this report?
Is it the average cost basis method that did it? Does it happen with other methods?
Any more logs around the error? More details on what events were being processed?
We can also have more real time and you can chat with other users and the dev team via discord: https://discord.rotki.com/
Hey @LefterisJP . I've attached a screenshot of the accounting settings. I tried again with FIFO instead of ACB and it worked. Seems to only affect the ACB method. There weren't any other logs around the error, just a repetition of the first line of the logs I posted with different addresses and times.
So I went back and fixed all the missing prices. Now I still get the same error, but there are no more "Failed to find price for EIP..." messages. Here's the entirety of the log now:
[11/01/2024 22:21:52 PST] ERROR rotkehlchen.api.rest Greenlet with id 140276300690880: Greenlet for task 34 dies with exception: [<class 'decimal.DivisionByZero'>]. Exception Name: <class 'decimal.DivisionByZero'> Exception Info: [<class 'decimal.DivisionByZero'>] Traceback: File "src/gevent/greenlet.py", line 908, in gevent._gevent_cgreenlet.Greenlet.run File "rotkehlchen/api/rest.py", line 417, in _do_query_async File "rotkehlchen/api/rest.py", line 1532, in process_history File "rotkehlchen/rotkehlchen.py", line 847, in process_history File "rotkehlchen/accounting/accountant.py", line 167, in process_history File "rotkehlchen/accounting/accountant.py", line 307, in _process_event File "rotkehlchen/exchanges/data_structures.py", line 393, in process File "rotkehlchen/accounting/pot.py", line 269, in add_out_event File "rotkehlchen/accounting/cost_basis/base.py", line 698, in spend_asset File "rotkehlchen/accounting/cost_basis/base.py", line 601, in reduce_asset_amount File "rotkehlchen/accounting/cost_basis/base.py", line 378, in consume_result File "rotkehlchen/fval.py", line 98, in truediv
hey @dsystems-io thanks! This is gonna be easier if you hop in discord to chat. The reason for not enough logs is probably you don't have debug logs activated. You can do it by following what's said here: https://rotki.readthedocs.io/en/latest/contribute.html#id2
Then we could have some more context on the type of event that creates this error and perhaps the order in which we get into the division by zero.
Closing this issue as we have reproduced and log this and handle it better.
This can happen if you somehow have negative amounts in events and use ACB. Should be fixed if you find and fix those negative amount events.
Problem Definition
Profit and Loss Generator throws an error after generation. The resulting report shows $0.00 under "Taxable PnL" for all lines, despite taxable amount > 0. Error message shows:
I have Etherscan and Coinbase API's hooked up.
Logs
Address subbed with 0x000. This line was repeated over 100 times with different addresses and timestamps.
System Description
Operating system: PopOS 22.04 Rotki version: 1.31.2