-
Notifications
You must be signed in to change notification settings - Fork 20
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
Incorrect proceeds because sale price not used #65
Comments
Makes sense, and thanks for filing this. This probably also affects cases where multiple sales are made on the same day at different prices. I haven't looked yet, but I assume we'd have to either replace the CONVERT and do the conversion ourselves, or replace the SQL itself. If you've taken a look, ideas/PR welcome. |
I don't know how to fix this through SQL alone, so I've only looked at doing the conversion ourselves.
afaik, from IRS's point of view no gains are realized (unless perhaps there is a small transaction fee as common for crypto), but the SQL query will record 10 USD in proceeds. The issue of course is that
This should be handled as a sale of 0.01 HOOL.
This should be handled as a sale of 1 HOOL. |
Agreed. Thanks for fleshing this out. I'd noticed this long ago, and probably should've included a note somewhere at least. Yes, Context for anyone reading along: this last point is an edge case only affects the "What not to buy" analysis by sometimes producing false positives. |
Consider the following ledger
The correct proceeds from the sale are clearly 20 USD.
The SQL query in the
recently_sold_at_loss
method uses the CONVERT method to compute the proceeds from the 01-13 sale.However by inspection CONVERT, while lives at line 153 of core/convert.py, looks up the most recent price available rather than the sale price (which it does not have access to anyway). In the absence of a
price
entry that exactly agrees with the sale price, the proceeds are incorrect.Furthermore, if no price entry exists for that commodity up until the sale date, an exception is raised because CONVERT gives up on the conversion and reports the proceeds in terms of the commodity sold, rather than USD. This leads to the Inventory object having multiple positions.
The text was updated successfully, but these errors were encountered: