capital-gains-calculator
capital-gains-calculator copied to clipboard
Fix bed&breakfast calculation when stock is split
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.
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.
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 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
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.
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.
I am quite sure you do the b&b matching rules with the matching quantity adjusted for the share split ratio. https://www.gov.uk/government/publications/share-reorganisations-company-takeovers-and-capital-gains-tax-hs285-self-assessment-helpsheet/hs285-share-reorganisations-company-takeovers-and-capital-gains-tax-2021
Yes, this is what I advocate above and propose strategies for implementing of #541