KapJI / capital-gains-calculator

UK capital gains tax calculator which supports transaction history from different brokers
MIT License
112 stars 42 forks source link

Fix spin-offs calculations #524

Closed nihn closed 1 month ago

nihn commented 1 month ago

This diff fixes Spin-Off cost calculations (both for source and dest shares). Details of the calculations can be found in the comment of the main method. As we do not have a good DB for spin-offs the "source" share has to be provided by user during the run, the adjustments to the prices are then explained in generated .pdf file.

Additionally:

I'll add tests after initial review round.

KapJI commented 1 month ago

Can you rebase on the latest revision?

Btw, will it work correct for B&B case like in #511?

nihn commented 1 month ago

I don't think it will change anything for that B&B case as I am not touching stock splits but B&B should be handled correctly in case of spin-offs (AFAICT, as it just modifies the pool price, I am not tax advisor though :)).

nihn commented 1 month ago

Any idea why the signals are failing? I pulled the branch and it works on my machine:

image
vmartinv commented 1 month ago

Any idea why the signals are failing? I pulled the branch and it works on my machine

You're not including the spin_off_handler file in the commit.

nihn commented 1 month ago

You're not including the spin_off_handler file in the commit.

How did it work before is beyond my understanding though, thanks! :D

KapJI commented 1 month ago

Thanks for working on this! 🚀