mattjgalloway / cgtcalc

A UK capital gains tax calculator written in Swift
MIT License
94 stars 16 forks source link

Proceeds calculation, transaction rounding, allowable cost #12

Open embee8 opened 1 year ago

embee8 commented 1 year ago

First of all, thanks a lot for open-sourcing this project!

I have noticed some minor gaps between what the calculator generates and my own calculations of the values that need to go into the capital gains section of the tax return.

What follows is a sample input, output, some extra calculations accompanied by some commentary.

INPUT

BUY 15/05/2022 SHARE_A 100 9.8 0.23 SELL 16/08/2022 SHARE_A 100 12.8 1.54

BUY 15/05/2022 SHARE_B 100 10.2 2.45 SELL 16/08/2022 SHARE_B 100 11.8 4.97

BUY 15/05/2022 SHARE_C 100 53.2 1.67 SELL 16/08/2022 SHARE_C 100 49.3 2.86

BUY 15/05/2022 SHARE_D 100 100.5 3.98 SELL 16/08/2022 SHARE_D 100 111.2 5.02

OUTPUT

SUMMARY

Tax year Gain Proceeds Exemption Loss carry Taxable gain Tax (basic) Tax (higher)
2022/2023 £1116 £18510 £12300 £0 £0 £0 £0

TAX YEAR DETAILS

TAX YEAR 2022/2023

1) SOLD 100 of SHARE_A on 16/08/2022 for GAIN of £298 Matches with:

2) SOLD 100 of SHARE_B on 16/08/2022 for GAIN of £152 Matches with:

3) SOLD 100 of SHARE_C on 16/08/2022 for LOSS of £395 Matches with:

4) SOLD 100 of SHARE_D on 16/08/2022 for GAIN of £1061 Matches with:

TRANSACTIONS

15/05/2022 BOUGHT 100 of SHARE_A at £9.8 with £0.23 expenses 16/08/2022 SOLD 100 of SHARE_A at £12.8 with £1.54 expenses 15/05/2022 BOUGHT 100 of SHARE_B at £10.2 with £2.45 expenses 16/08/2022 SOLD 100 of SHARE_B at £11.8 with £4.97 expenses 15/05/2022 BOUGHT 100 of SHARE_C at £53.2 with £1.67 expenses 16/08/2022 SOLD 100 of SHARE_C at £49.3 with £2.86 expenses 15/05/2022 BOUGHT 100 of SHARE_D at £100.5 with £3.98 expenses 16/08/2022 SOLD 100 of SHARE_D at £111.2 with £5.02 expenses

ASSET EVENTS

NONE

LOGS

[INFO] Begin processing [INFO] No pre-processing of transactions required for SHARE_D. [INFO] Begin processing transactions for SHARE_D. [INFO] Begin matching processor. [INFO] Finished matching processor. Matched 0 and there are 1 disposals left. [INFO] Finished processing transactions for SHARE_D. Created 1 tax events. [INFO] No pre-processing of transactions required for SHARE_C. [INFO] Begin processing transactions for SHARE_C. [INFO] Begin matching processor. [INFO] Finished matching processor. Matched 0 and there are 1 disposals left. [INFO] Finished processing transactions for SHARE_C. Created 1 tax events. [INFO] No pre-processing of transactions required for SHARE_B. [INFO] Begin processing transactions for SHARE_B. [INFO] Begin matching processor. [INFO] Finished matching processor. Matched 0 and there are 1 disposals left. [INFO] Finished processing transactions for SHARE_B. Created 1 tax events. [INFO] No pre-processing of transactions required for SHARE_A. [INFO] Begin processing transactions for SHARE_A. [INFO] Begin matching processor. [INFO] Finished matching processor. Matched 0 and there are 1 disposals left. [INFO] Finished processing transactions for SHARE_A. Created 1 tax events. [INFO] Finished processing

CALCULATIONS

The following H2 headings are values needed for the tax return.

Number of disposals

4

Disposal proceeds

(100 12.8 - 1.54) + (100 11.8 - 4.97) + (100 49.3 - 2.86) + (100 111.2 - 5.02) = 18495.61 // Proceeds from the summary table: £18510 (higher because it includes the fees)

Allowable costs

(100 9.8023) + (100 10.2245) + (100 53.2167) + (100 100.5398) = 17378.33 // The summary table does not include this value

Gains in the year, before losses

// Using the rounded values from the transaction list above Gains (before losses): 298 + 152 + 1061 = 1511

// Using the exact decimal values Gains (before losses): (100 12.8 - 1.54) - ( (100 9.8023) ) + (100 11.8 - 4.97) - ( (100 10.2245) ) + (100 111.2 - 5.02) - ( (100 100.5398) ) = 1511.81

Losses in the year

// Using the rounded values from the transaction list above Losses: -395

// Using the exact decimal values (100 49.3 - 2.86) - ( (100 53.2167) ) = -394.53

Gains, after losses (not required in the tax return)

// Option 1: Using rounded values (this is how the summary table value is calculated) 1511 - 395 = 1116

// Option 2: Using decimal values 1511.81 - 394.53 = 1117.28

// Option 3: Proceeds - allowable cost (practically the same as option 2) 18495.61 - 17378.33 = 1117.28 // If we were to use the proceeds value from the table: 18510 - 17378.33 = 1131.67

Questions

embee8 commented 1 year ago

For reference: HMRC's section 104 calculation example rounds all values, while their internal capital gains manual says:

Rounding is not acceptable in computations where the rounding would impede the proper application of the relevant legislation. Nor may it be applied where it would normally be necessary to go back to the underlying records to do the computation. In such circumstances, there would be no reduction in the compliance burden in allowing the use of round sums. You should not accept rounding in computations of chargeable gains. It will be necessary for taxpayers to refer back to their underlying documentation for the acquisition cost itself. And the precise dates on which expenditure is incurred are needed for indexation allowance purposes. You may however accept rounding for the incidental costs of acquisition and disposal.

mattjgalloway commented 1 year ago

For reference: HMRC's section 104 calculation example rounds all values, while their internal capital gains manual says:

Rounding is not acceptable in computations where the rounding would impede the proper application of the relevant legislation. Nor may it be applied where it would normally be necessary to go back to the underlying records to do the computation. In such circumstances, there would be no reduction in the compliance burden in allowing the use of round sums. You should not accept rounding in computations of chargeable gains. It will be necessary for taxpayers to refer back to their underlying documentation for the acquisition cost itself. And the precise dates on which expenditure is incurred are needed for indexation allowance purposes. You may however accept rounding for the incidental costs of acquisition and disposal.

The start of that manual section on rounding says:

A Press Release of 18 May 1993 announced that subject to certain conditions the Revenue would accept tax computations rounded to the nearest £1,000. The purpose of the practice is to reduce the compliance burden on large businesses which produce their statutory accounts in round thousands.

This practice applies only to computations of business profits.

I think (but I don't know for sure - just what I believe from reading the manual) that this is all related to the rounding to nearest £1000 for businesses.

mattjgalloway commented 1 year ago

Should the total proceeds include or exclude transaction fees?

(100 12.8 - 1.54) + (100 11.8 - 4.97) + (100 49.3 - 2.86) + (100 111.2 - 5.02) = 18495.61 // Proceeds from the summary table: £18510 (higher because it includes the fees)

Your calculation there is removing fees from the proceeds. Why do that? The price field is the price of the shares sold and so that should not contain fees. So I don't see why you're removing fees in your calculation.

Can the summary table include an allowable cost column?

Should be easy to add yes - I'll look at that. I should also make it have a column for gains and losses separately really. Or at least have that on the tax year detailed breakdown.

Your allowable costs calculation is wrong by the way. You need to add on the fees from sale as well. Those are costs you are allowed to add on.

Can the calculator retain the decimal values for each transaction and only round the final gains value, instead of rounding each transaction and accumulating rounding errors?

I could add it as an option perhaps. But given HMRC show their example rounding each calculation, I personally think it's better to stick to the same.