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.3.tar.gz (5.4 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.3-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fiscal-0.2.3.tar.gz
  • Upload date:
  • Size: 5.4 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.3.tar.gz
Algorithm Hash digest
SHA256 24ed6bda79ea3f32c3f79cbc33e6af69febec52b5d0a720c7e4e409c2ee3ae72
MD5 47cad51b89c80582bb1f5b9f4493cd3e
BLAKE2b-256 2a34fc82a18c3240bcdf5344c2f0d7883c4de85d4714eafd9a19a2a474e479ad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fiscal-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 6.1 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 353ed2a2edc73606797b43f4847858aa193591dba5384dc9e32b50236b949ce1
MD5 d4482f0e0d60e36b3fac6154fcce414d
BLAKE2b-256 ba228598305d3cc923e0a8d942534e60f1d2ca7cbfbc45306d57c2a0c11c0cd8

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