mattjgalloway / cgtcalc

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

Inconsistent bed-and-breakfast results #7

Closed Zepheus closed 2 years ago

Zepheus commented 2 years ago

With the following inputs:

cgtcalculator.com

B   29/08/2018  GB00B3TYHH97    20  184.65  12.50 0
B   15/03/2019  GB00B3TYHH97    20  181.56  2.00 0
S   05/11/2019  GB00B3TYHH97    40  194.22  12.50 0
B   10/11/2019  GB00B3TYHH97    20  190.19  2.00 0

cgtcalc

BUY 10/11/2019 GB00B3TYHH97 20 190.19 2
SELL 05/11/2019 GB00B3TYHH97 40 194.22 12.5
BUY 15/03/2019 GB00B3TYHH97 20 181.56 2
BUY 29/08/2018 GB00B3TYHH97 20 184.65 12.5

both cgtcalc and cgtcalculator.com disagree on the outputs, more specifically on the section 104 matching not being offset by the breakfast amount (at least in the textual representation, calculation is offset).

cgtcalc outputs the following:

1) SOLD 40 of GB00B3TYHH97 on 05/11/2019 for GAIN of £281
Matches with:
  - BED & BREAKFAST: 20 bought on 10/11/2019 at £190.19
  - SECTION 104: 40 at cost basis of £183.4675
Calculation: (40 * 194.22 - 12.5) - ( (20 * 190.19 + 2) + (20 * 183.4675) ) = 281

where as cgtcalculator.com report the following:

1. SELL: 40 GB00B3TYHH97 on 05/11/2019 at £194.22 gives GAIN of £280.00
Matches with: 
BUY: 10/11/2019 20 GB00B3TYHH97 shares of 20 bought at £190.19
BUY: SECTION 104 HOLDING. 20 GB00B3TYHH97 shares of 40 bought at average price of £183.4675
CALCULATION: Gain = £280.00 = ( 40 * 194.22 - 12.50 )
- ( 20 * 190.19 + 2.00 + 0.00 )
- ( 40 * 183.4675 ) * ( 20 / 40 )

The matching amount for section 104 is before being offset by the breakfast amount (40 vs 20)

mattjgalloway commented 2 years ago

If you look at the calculation from cgtcalculator.com then it appears that they're just splitting out the way they represent the section 104 holding calculation.

i.e. you can simplify this part of their equation:

( 40 * 183.4675 ) * ( 20 / 40 )

to this:

( 20 * 183.4675 )

And then it's exactly the same equation from what I can see (unless I'm missing something?!).

The disposal portion from both is:

(40 * 194.22 - 12.5)

The B&B section of the acquisition is:

(20 * 190.19 + 2)

The section 104 section of the acquisition in both of them is:

(20 * 183.4675)

If I tap both of the equations into my calculator (well, using Spotlight on macOS) I get:

# cgtcalc
(40 * 194.22 - 12.5) - ( (20 * 190.19 + 2) + (20 * 183.4675) ) = £281.15

# cgtcalculator.com
( 40 * 194.22 - 12.50 )
- ( 20 * 190.19 + 2.00 + 0.00 )
- ( 40 * 183.4675 ) * ( 20 / 40 ) = £281.15

So as you can see - they're exactly the same.

I know why cgtcalc is rounding down - because that's what I made it do for each individual gain. But I can't really explain why cgtcalculator.com is rounding down to £280. I think it might be because the disposal is £7756 when rounded down and the acquisition is £7476 when rounded up, leaving a gain of £280. I believe that is a legitimate way of calculating as well. I believe (but as I disclaim many times - I am not a financial expert - so do your own research!) that both ways of calculating the rounding are fine. But inherently here the two calculators are calculating the B&B and section 104 exactly the same, because the equations being used are exactly the same.

@Zepheus - does that help?