alexpung / UK-Investment-tax-calculator

Capital gain and dividend tax calculator for UK tax
https://alexpung.github.io/UK-Investment-tax-calculator/
Other
10 stars 1 forks source link

Does not recognise any tax events / Help with Flex queries #9

Closed ltkn closed 10 months ago

ltkn commented 1 year ago

Hi there,

I tried to follow the doc the best I could but although the upload of XML file works great it doesn't recognise any events. Number of tax events: 0

Could you please help with the exact config of Flex queries maybe some screenshot or exact fields to select ?

I traded few spot currencies GBP/USD, and some CME futures, both are in the XML files.

What Am I missing? thanks!

alexpung commented 1 year ago

Thanks for the interest in this project.

Currently only dividend and stock trades are parsed. Futures require special handling due to open/closing rules so this is not implemented yet - should be ready before the reporting deadline for last tax year. FX in theory is the same rules as stocks, although I don't know what count as "acquisitions" and "disposals".

You can have an idea what is being parsed here https://github.com/alexpung/UK-Investment-tax-calculator/tree/master/BlazorApp-Investment%20Tax%20Calculator/Parser/InteractiveBrokersXml

I am currently working on the testing creating a sample of minimal xml files and the expected output. Once I have finished the samples would be available in the unit test folder.

ltkn commented 1 year ago

thanks a lot! will take a look hopefully c# shouldn't be too hard to understand for a java guy :)

I didn't know futures require special handling, it will be my first self assessment with capital gains, have a lot of homework to do but thankfully have still some time with the deadline.

I think you're right FX should be similar, I assume you can also do some extract from paper trading? but if it's not possible I'm happy to privately share my xml file.

alexpung commented 1 year ago

Here is a sample of xml and the expected output. https://github.com/alexpung/UK-Investment-tax-calculator/tree/master/UnitTest/System%20Test/Interactive%20brokers

alexpung commented 1 year ago

I have updated the doc for better understanding of this project.

ltkn commented 1 year ago

Thank you so much, it helps a lot! I haven’t started with shares but is shorting supported in tax calculation? Just to give an example to make it crystal clear shorting Tesla. I’m still catching up with different tax rules. I’d love to see simple FX and also some futures being supported. For futures from what I read so far the calculation seems simpler (no same day, bed breakfast etc..) at least for most popular futures like CME ES, MES, NQ, MNQ, MCL the one that don’t require physical delivery and are financially settled.

alexpung commented 1 year ago

Shorting is supported. The system put the short trade in another bucket when it encounter them, and when later buy trade comes along (if shares not yet exhausted in same day/b&b matching earlier) then the buy trade will match with the short sale trade.

If not all shorts are matched in the short trade, it will make a note "{UnmatchedQty} units of disposals are not matched (short sale)."

Disposal 2: Sold 100 units of DEF on 05-May-2021 for £858.71. Total gain (loss): £427.42 All units of the disposals are matched with acquitions Trade details: Sold 100 unit(s) of DEF on 05-May-2021 for $1,000.00 = £860.00 Fx rate = 0.86 with total expense £1.29, Net proceed: £858.71 Expenses: Commission: $1.50 = £1.29 Fx rate = 0.86
Trade matching: Cover unmatched disposal: Matched 100 units of the disposal. Acquition cost is £431.29 Matched trade: Bought 100 unit(s) of DEF on 06-Dec-2021 for $500.00 = £430.00 Fx rate = 0.86 with total expense £1.29, Total cost: £431.29 Expenses: Commission: $1.50 = £1.29 Fx rate = 0.86
Gain for this match is £858.71 - £431.29 = £427.42

For futures from what I read so far the calculation seems simpler (no same day, bed breakfast etc..) at least for most popular futures like CME ES, MES, NQ, MNQ, MCL the one that don’t require physical delivery and are financially settled.

Can you give citation of that? From the HMRC manual I think it is still a security (when opening a short position, the short position itself is an acquisition of a security with opposite payout from the long contract) and normal matching rules still applies.

alexpung commented 12 months ago

You can try out the latest version which handle future contracts that are opened and closed before expiry.

Knuj0 commented 10 months ago

Hi, thought I'd leave a quick feedback from my experience I have recently given the App a try but unfortunately it only Imports Dividends ignoring Futures and Stocks. Fact that it is importing Dividends makes me thing xml file is good and the problem is somewhere else. FYI: Section104.txt and Trades Calculations.txt are empty whereas Dividends Summeary.txt has been populated with correct details