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

Support currency conversion #14

Open
samfreedman opened this issue Aug 30, 2023 · 2 comments
Open

Support currency conversion #14

samfreedman opened this issue Aug 30, 2023 · 2 comments

Comments

@samfreedman
Copy link

It would be great if cgtcalc supported automatic currency conversions. My understanding is that, for CGT purposes, any acquisitions of assets in non-sterling currency (eg stock bought in USD) should be calculated in GBP using the exchange rate at the time of acquisition (or the HMRC monthly average rate, or any other equivalent rate as long as you are consistent - I'll happily be pointed at a more accurate explanation though). Equally, disposals should be converted using the same rate from the originating currency back to GBP. This is important to correctly determine the Section 104 pool value.

I've been experimenting with cgtcalc, and have resorted to manually looking up the exchange rate on https://www.xe.com/currencytables/, and doing the conversion maths myself. It would be very helpful if the calculator parsed the provided <AMOUNT> in each row to determine what currency it was in, and used the transaction date to look up the historical conversion rate.

@mattjgalloway
Copy link
Owner

Yes, this would be nice. However would need to assume there's a network connection present, and fetch via some API or screen scraping. From what I've found, there's no decent APIs that are free, and screen scraping I'm not particularly up for maintaining that as it will change from time to time. Also generally not keen on requiring an internet connection.

An alternative would be users providing a table with currency conversions (date and conversion factor). Which is better, but would require people to create such a table.

Personally what I do here, is I keep all my records in GBP, and do the conversion around the time I do the transaction - usually once I've got the trade confirmation. And then I have all my records in GBP anyway. That's what I would recommend others to do.

@deed02392
Copy link

Here's a Python implementation using the free API, provided by HMRC themselves: https://github.com/KapJI/capital-gains-calculator/blob/main/cgt_calc/currency_converter.py

It actually generates a local cache of exchange rates, using monthly averages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants