Skip to main content

No project description provided

Project description

Fiscal

A simple, systematic tax liability calculator

Fiscal is a simple, systematic tax calculator with soft-coded rate bands. Specifically, Fiscal aims to side-step the commonly-seen behaviour of using 'if' statements in tax calculators, and relying on hard-coded tax bands.

Fiscal, broken down

There are two key elements to Fiscal.

  1. Bands - a stream of pairwise tuples (a threshold, a percentage) with an 'allocator'. The allocator dictates the manner in which taxable amounts are allocated between the threshold element of each band - the two predominant forms of allocator are provided:

    • 'step', which reflects the most common allocation; and
    • 'slab', which represents taxes for which the sole applicable rate is determined by the taxable amount (as in old stamp duty and early SDLT).
  2. Liabilities - a calculation of liability stored in a 'breakdown' - a three-element tuple made up of:

    • the amount allocated to the band;
    • the percentage referable to that band; and
    • the product of the amount and the percentage.

Allocators - examples

To draw an example from Stamp Duty Land Tax (SDLT), a land transfer tax in England (and previously throughout the UK).

SDLT - stepped calculation

The applicable bands for a commercial transaction were, after 17 March 2017, as follows:

Threshold Percentage
£150,000 0%
£100,000 2%
Surplus 5%

This can be represented by a band as follows:

stepped_bands = SteppedBands(((150_000, 0),(100_000, 2),("Infinity", 5)))

The bands are allocated on the step basis, so £1m would be allocated as follows:

Threshold Percentage Liability
£150,000 0% £0
£100,000 2% £2,000
£750,000 5% £37,500
allocation = stepped_bands.allocate(1_000_000)
assert allocation == (
    (Decimal("150000"), Decimal("0")),
    (Decimal("100000"), Decimal("2")),
    (Decimal("750000"), Decimal("5")),
) # True

The allocation is intended to be called within an instance of the Liability object.

SDLT - slabbed calculation

Prior to 17 March 2017, the applicable SDLT rates for a commercial transaction were as follows:

Threshold Percentage
£150,000 0%
£100,000 1%
£250,000 3%
Surplus 4%

The bands were allocated on the 'slab' basis. This means that the taxable amount is compared with the cumulative thresholds, which are as follows:

Cumulative Threshold Percentage
£150,000 0%
£250,000 1%
£500,000 3%
Surplus 4%

The first cumulative threshold to equal or exceed the taxable amount determines the applicable percentage. So where the taxable amount was £200,000, the applicable percentage was 1%.

Cumulative Threshold Amount Percentage
£150,000 0%
£250,000 £200,000 1%
£500,000 3%
Surplus 4%

Where the taxable amount was £300,000, the applicable percentage was 3%.

Cumulative Threshold Amount Percentage
£150,000 0%
£250,000 1%
£500,000 £300,000 3%
Surplus 4%

Thresholds were inclusive, so where the taxable amount was £500,000, the applicable percentage was still 3%.

Cumulative Threshold Amount Percentage
£150,000 0%
£250,000 1%
£500,000 £500,000 3%
Surplus 4%

But where the taxable amount was £500,001, the applicable percentage was 4%.

Cumulative Threshold Amount Percentage
£150,000 0%
£250,000 1%
£500,000 3%
Surplus £500,001 4%

Liabilities - examples

Liabilities represent the calculation the follows the allocation of a taxable amount into the correct bands.

Those liabilities are then aggregated into a total liability. So by way of example, if calculating the current (9 February 2022) SDLT liability (non-residential property) for a £1m sum, the steps would be as follows.

bands = SteppedBands((150_000, 0),(100_000, 2),("Infinity", 5))
liab = Liability(bands=bands, amount=1_000_000)

The breakdown of liability would look as below:

assert liab.breakdown == (
        (Decimal("150000"), Decimal("0"), Decimal("0")),
        (Decimal("100000"), Decimal("2"), Decimal("2000")),
        (Decimal("750000"), Decimal("5"), Decimal("37500")),
    ) # True
assert liab.total == Decimal("39500") # True

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fiscal-0.2.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fiscal-0.2.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file fiscal-0.2.1.tar.gz.

File metadata

  • Download URL: fiscal-0.2.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.1 Linux/5.15.0-58-generic

File hashes

Hashes for fiscal-0.2.1.tar.gz
Algorithm Hash digest
SHA256 97137b483b55b68a8d894b3abc2496022171c6a36fc96f603ec631e0bfce3ab2
MD5 94207d5774903c21f2c3b9e99ad54ab4
BLAKE2b-256 c57c6f466a5d56990f18e6e7dce940ab7f2452c1979cf8b498b67145bf8e18b5

See more details on using hashes here.

File details

Details for the file fiscal-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: fiscal-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.1 Linux/5.15.0-58-generic

File hashes

Hashes for fiscal-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fb144c49529375e244c535f65f15802c1d13198d581b3caf8fb21bdbefc77e99
MD5 58a06b58f0f42d40bee2b37bdee422ac
BLAKE2b-256 ad72b8f39c6476eee50f7f064f3a055dba0059b4c8879173f3c165aac940b5e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page