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

Fix bed&breakfast calculation when stock is split #511

Open
sygi opened this issue May 6, 2024 · 7 comments
Open

Fix bed&breakfast calculation when stock is split #511

sygi opened this issue May 6, 2024 · 7 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@sygi
Copy link

sygi commented May 6, 2024

The stock split action in the code is considered a 0-priced acquisition. This works as long as there is no bed&breakfast to consider (no sale in the previous 30 days).

It would be nice to fix the calculation to handle this case as well, or, at a very least, to throw an error to avoid silently incorrect calculation.

@vmartinv vmartinv added help wanted Extra attention is needed bug Something isn't working labels May 7, 2024
@vmartinv
Copy link
Collaborator

vmartinv commented Jun 9, 2024

Can you add some minimal examples to test in whatever csv format you are using? Alongside what should be correct reported gain/loss, these cases would help:

  • Buy, sell, split, buy within 30 days
  • Buy, sell, split within 30 days
  • Buy, sell, split, buy after 30 days

Also I believe this is still a hard case because if you sell everything the stock split won't even show up in your export, and there's no way to detect it or warn about that.

@sygi
Copy link
Author

sygi commented Jul 2, 2024

I attach a CSV file with an example split. I also created a test here: #541 which shows where the problem lies (the library consider a split as an 0-cost acquisition).
schwab.csv

@vmartinv
Copy link
Collaborator

vmartinv commented Jul 2, 2024

I attach a CSV file with an example split. I also created a test here: #541 which shows where the problem lies (the library consider a split as an 0-cost acquisition). schwab.csv

I wouldn't worry about fixing it at the moment, I had one idea about it. Just having the 3 examples I listed would be helpful

@sygi
Copy link
Author

sygi commented Jul 3, 2024

Please find the three examples attached. Note that no2 and 3 are actually the same in terms of cgt, as both split and buy after 30 days are tax neutral.

schwab2_5_00.csv
schwab_5_00.csv
schwab_18_00.csv

@KapJI
Copy link
Owner

KapJI commented Jul 3, 2024

I guess the first thing we should do is detect b&b when split is involved and abort as unsupported case. Until someone figure out how to calculate this cases properly.

@alexpung
Copy link

alexpung commented Jul 7, 2024

@sygi
Copy link
Author

sygi commented Jul 7, 2024

Yes, this is what I advocate above and propose strategies for implementing of #541

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants