Quick Contact Information

Email: focusedtuition@aol.com

Wednesday, July 12, 2017

Capital Gains Tax Methods in Python 3.6.0

An M.Tax student recently approached me with an optimisation problem in relation to Capital Gains Tax. Specifically, the problem relates to the attribution of capital losses to capital gains and the choice between the Discount and the Indexation method for assets purchased prior to September 1999 and have been held for at least 12 months.

The question appears under Example 18 of the ATO publication "Personal Investors Guide to Capital Gains Tax 2016" (LINK).

EXAMPLE 18: Clare made capital gains from shares she bought before 11.45am <by legal time in the ACT> on 21 September 1999 and had capital losses carried forward from a previous year.


Clare sold a parcel of 500 shares last March for \$12,500, that is, for \$25 each. She had acquired the shares in March 1995 for \$7,500, that is, for \$15 each, including stamp duty and brokerage costs. There were no brokerage costs on sale. Clare had no other capital gains or capital losses for the current income year, although she has \$3,500 unapplied net capital losses carried forward from earlier income years.

Because Clare owned the shares for more than 12 months and acquired the shares before September 1999 she can use the discount method or the indexation method to work out her capital gain, whichever gives her a better result. Clare firstly works out her net capital gain by applying both the indexation method and the discount method to the whole parcel of shares <Figure 1>:


If we were to adopt the naive approach and assume the methods are mutually exclusive, then clearly the Discount Method offers a materially better outcome.

However, because each share is a separate asset, Clare can use different methods to work out her capital gains for shares within the parcel. The lowest net capital gain would result from her applying the indexation method to sufficient shares to absorb the capital loss, or as much of the capital loss as she can, and apply the discount method to any remaining shares. Clare therefore applies the indexation method to the sale of 396** shares and the discount method to the remaining 104 shares. She works out her net capital gain as follows <Figure 2>:


Note that the problem description clearly states \$3500 in prior years carry forward capital losses but the example applied \$3503 in capital losses across the two methods. Barring that irregularity, The net capital gain under the discount method should be \$520 which brings the total net capital gain across the two methods to \$523, i.e. \$520 + \$3. Clearly, the hybrid method beats a pure Indexation or Discount Method but there is more work involved in fully exploring the different ways we allocate the number of shares and losses to each method.

Of course, the last thing we'd want is to pay a human to go through all the different permutations of share and capital loss attributions across the two methods. We are effectively carrying out a 2-dimensional goal seek to identify a global minimum. Here's some code in Python to automate the process:


And here are the Python results:


I've summarised the comparison between the ATO's calculation <with adjustments to correct their error> and Python:


Close enough!


** To calculate this, Clare worked out the capital gain made on each share using the indexation method, i.e. \$4,422 ÷ 500 = 8.84, and divided the capital loss by this amount, i.e. \$3,500 ÷ 8.84 = 396). The ATO is kinda cheating here as it knows, in this case, that the losses are best absorbed by the Indexation Method. This is one of the differences between an Expert System and an Optimisation Engine. Expert systems use hardwired business rules to screen out sections of the exploration landscape but they are difficult to scale.