Skip to main content

uk-bank-rate

The UK Bank Rate from the Bank of England's own data, using the standard library alone, and honest about the hours after a decision.

pip install uk-bank-rate
from uk_bank_rate import bundled_history, get_bank_rate, rate_on, rates_between

current = get_bank_rate()
covid_low = rate_on(bundled_history, "2020-06-01")
through_2025 = rates_between(bundled_history, "2025-01-01", "2025-12-31")

get_bank_rate() returns the rate today, the day it took effect, the last day the published series covers, the next scheduled decision, and a pending_decision that is set whenever a decision has been announced, or is due, that the published data does not reflect yet, and a beyond_schedule flag for dates past both the data and the published schedule. The Committee announces at 12:00 London time and the series can lag by a working day or two, so a client that reads only the latest row reports the old rate for that whole window without knowing it.

rate_on() answers the rate on any date since 2 January 1975 from a bundled history of every change, with no network call, and rates_between() splits a span into the periods over which the rate held, each with its count of days, for interest at Bank Rate plus a margin. late_payment_rate() gives the rate of statutory interest under the Late Payment of Commercial Debts (Interest) Act 1998, 8% over the Bank Rate in force on the 30 June or 31 December before interest starts to run. Dates come back as datetime.date and rates as Decimal, so interest worked out from them does not drift. Every failure to reach the Bank raises BankRateSourceError with a failure of http, not_csv, empty, timeout or network, an answer that is not the series or whose rows cannot be read included, so a change to the Bank's format is reported rather than read as no data.

The Bank's firewall refuses Python's default urllib user agent with 403 Access Denied, which is why so many hand-written scripts pretend to be a browser. This package sends its own honest one instead, and exports it as USER_AGENT for a custom transport to send. It needs Python 3.11 or later and nothing outside the standard library, apart from tzdata on Windows, which ships no time zone database.

The full guide, the TypeScript package and the design notes are in the repository.

Contains data from the Bank of England Database, licensed under the Open Government Licence v3.0 and copyright the Governor and Company of the Bank of England. Not affiliated with or endorsed by the Bank of England. Code released under the MIT licence.

Developed by Bhupen Varsani.

Metadata

Release files for uk-bank-rate 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uk-bank-rate 0.4.2
File Size Uploaded Provenance Actions
uk_bank_rate-0.4.2.tar.gz 11.8 kB With provenance Details for uk_bank_rate-0.4.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for uk-bank-rate 0.4.2
File Interpreter ABI Platform Actions
uk_bank_rate-0.4.2-py3-none-any.whl Python 3 none any Details for uk_bank_rate-0.4.2-py3-none-any.whl

Total release size: 29.0 kB

Release files / uk_bank_rate-0.4.2.tar.gz

Download URL uk_bank_rate-0.4.2.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
05ca34f84a6595e14aa048a038ba6b680b478d3f2470512ed70fffc35ad54237
BLAKE2b-256 checksum
How to use checksums
4cd49b38738ed0ebb4444ebe784ac6f8e4d74b92b1bd5c16d982b1e2c84993b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / uk_bank_rate-0.4.2-py3-none-any.whl

Download URL uk_bank_rate-0.4.2-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e508d0a1812ac8ab1411493fdd0c7f80e8f3ce7b0abc3560f6b849db7d6981bc
BLAKE2b-256 checksum
How to use checksums
9e1a475e66a203524ee02bc8b089e2bb322c289563b98dfadae174000cab979d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Security for uk-bank-rate 0.4.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for uk_bank_rate-0.4.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page