-
Notifications
You must be signed in to change notification settings - Fork 625
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 FIFO order used when doing multiple transfers #4446
Comments
Wow what the heck, I've never seen crypto scammers even in github comments.... |
I've remove the Scam/Phishing comments.. Thx 👍🏻 |
Likely bots just picked up on the crypto-related keywords in the post |
A couple questions hopefully for an in-the-know developer (i.e. @Nirus2000 perhaps? Or even @buchen? ;) )
I'm pretty urgently motivated to try to figure something out (US taxes are due in a few months, & as I really rely on PP for tracking & reporting my crypto cost basis, this bug is unfortunately wreaking some havoc on my tax accounting) Thanks in advance |
Ok I spent the past hour trying examples, here's the best I could come up with:
So to summarize, it seems like if you transfer shares into an account that had other shares there beforehand, and you transfer out of that account ever again (whether full or partial), sales/transfers after that may or may not be in the wrong order. Is that correct? |
We need an example file... with transactions. Not with "a" and "b" or 1 and 2... and in and out. |
The example file corresponding to the screenshots is above in the original post (just below the screenshots) - was that one no good (or just unnoticed)? It doesn't show every possible case, but it definitely shows the bug....? Thanks for the reply :) |
To be a little more clear/explicit: in the sample file posted above, the sale at the end sold the lot that was purchased for $2.50, but the expectation was that it sell the one purchased for $1 |
You Transfer out from a to b and on the same date from b to a? I don't quite understand it either... but can you even explain the problem in one comment and not in an essay of 4 comments? |
The bug is not related to the dates. Here, I edited it to have 1 month between every action. Behavior is identical.
The bullets in the very first post concisely explain each transaction in the sample file. 6 transactions, 6 bullets. Also, my previous comment was a one-liner: "the sale at the end sold the lot that was purchased for $2.50, but the expectation was that it sell the one purchased for $1"
It's not other problems. All other follow-ups are just my attempts at trying to understand when the bug occurs & when it doesn't. Feel free to pick one example & ignore others if more information isn't helpful. |
And what ist the issue and witch numbers are wrong? |
"the sale at the end sold the lot that was purchased for $2.50, but the expectation was that it sell the one purchased for $1" Sorry & respectfully, if I'm being unclear I really don't see where...? 🙏 |
Link to that thread is in the 1st sentence of my original post. I'm not sure what you're trying to communicate with that link, but there are also 2 replies to that specific post from Rafa with further details (from Avendo & LOLinger78). I mentioned a bunch of stuff from that thread in my comments above. |
@metal450 : Did you consider making a (Java) testcase checking for the expected behavior? |
Hi - thanks for chiming in. I'm not exactly sure what you mean, but:
That being said, having just seen your related #4461 & #4459 threads, I'm incredibly heartened that someone is at least looking into this related code :) With the recent US crypto tax law changes that make FIFO mandatory, have been feeling in a really tough spot & afraid I'd have to figure out how to migrate my decades' worth of history to some other software where FIFO would follow the law. That this is even being looked into gives me a glimmer of hope :) |
Yes, I meant formalizing your test XML and expected behavior as a coded Java test, which could be run and produce pass/fail result automatically. Writing tests is a pretty boring part of programming, especially open-source, but at the same time, needed to maintain quality, so the only solution is apparently to "crowdsource" them ;-).
Yes, I'm trying to add short trade support to PP, and in my initial hacking I simply ignored any transfer transactions, while in the background thinking how they could be (re)implemented. This ticket brought some things I didn't even think about, so now I'm thinking how to put it all together... |
Ahhh I see, you meant write a unit test. Yeah great idea - my first thought was that it might not be worth having tests that would always fail given the current code if nobody was actually working on this issue, but if you're already progressing toward a solution & need it to be validated, maybe worth trying to figure it out? (I did have immense difficulty even just trying to get Eclipse working when I tried a few years ago unfortunately, haha)
Amazing. Ideally/hopefully as you reimagine transfers/sales, the solution might even be generalized enough that it could support other ordering too (i.e. I know you already saw the my post about Specific Lots - there are forum threads going back at least a few years of people trying to get around that limitation by transferring shares back & forth between temporary accounts). Of course, working FIFO would be immensely valuable by itself. Just throwing that out there as a possible consideration as you're digging through all the ordering code anyway :) |
I'm reporting this bug from the forum here on GH for visibility (apologies if it already exists somewhere in German - I did my best to search but didn't find it).
The issue: transferring an asset between accounts more than once doesn't respect the proper FIFO order. Repro:
This is quite impactful in a variety of scenarios - here's some that have come up on the forum:
test portfolio.xml.txt
The text was updated successfully, but these errors were encountered: