Python library businessdate
A fast, efficient Python library for generating business dates for simple and fast date operations.
>>> from businessdate import BusinessDate
>>> BusinessDate(2017,12,31) + '2 weeks'
BusinessDate(20180114)
>>> BusinessDate(20171231) + '2w' # same but shorter
BusinessDate(20180114)
>>> BusinessDate(20180114).to_date()
datetime.date(2018, 1, 14)
Typical banking business features are provided like holiday adjustments to move dates away from weekend days or holidays. As well as functionality to get year fractions depending on day count conventions as the lengths of interest payment periods.
Beside dates business periods can be created for time intervals like 10Y, 3 Months or 2b. Those periods can easily be added to or subtracted from business dates.
Moreover range style schedule generator are provided to systematic build a list of dates. Such are used to set up a payment schedule of loan and financial derivatives.
Example Usage
>>> from datetime import date
>>> from businessdate import BusinessDate, BusinessPeriod
>>> BusinessDate(year=2014, month=1, day=11)
BusinessDate(20140111)
>>> BusinessDate(date(2014,1,11))
BusinessDate(20140111)
>>> BusinessDate(20140111)
BusinessDate(20140111)
>>> BusinessDate('20140111')
BusinessDate(20140111)
>>> BusinessDate('2015-12-31')
BusinessDate(20151231)
>>> BusinessDate('31.12.2015')
BusinessDate(20151231)
>>> BusinessDate('12/31/2015')
BusinessDate(20151231)
>>> BusinessDate(42369)
BusinessDate(20151231)
>>> BusinessDate(20140101) + BusinessPeriod('1Y3M')
BusinessDate(20150401)
>>> BusinessDate(20140101) + '1Y3M'
BusinessDate(20150401)
>>> BusinessDate(20170101) - '1Y1D'
BusinessDate(20151231)
>>> BusinessDate() == BusinessDate(date.today())
True
>>> BusinessDate('1Y3M20140101')
BusinessDate(20150401)
For more examples see the documentation.
Install
The latest stable version can always be installed or updated via pip:
$ pip install businessdate
Development Version
The latest development version can be installed directly from GitHub:
$ pip install --upgrade git+https://github.com/sonntagsgesicht/businessdate.git
or downloaded from https://github.com/sonntagsgesicht/businessdate.
ToDo
decide which base class or inheritance for BusisnessDate is better:
BaseDateFloat (float inheritance)
BaseDateDatetimeDate (datetime.date inheritance)
2. store businessdays adjustment convention and holidays as private property of BusinessDate. The information should not get lost under BusinessPeriod operation. Decide which date determines convention and holidays of a BusinessRange.
Contributions
Issues and Pull Requests are always welcome.
License
Code and documentation are available according to the Apache Software License (see LICENSE).
Metadata
Release files for businessdate 0.7.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| businessdate-0.7.2.zip | 51.5 kB | Without provenance | Details for businessdate-0.7.2.zip |
Release files / businessdate-0.7.2.zip
| Download URL | businessdate-0.7.2.zip |
|---|---|
| Size | 51.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bac47be2ddd06dc8b6939ad049eb652d0e4871e17b09f45f994d40ba72745481
|
|
BLAKE2b-256 checksum How to use checksums |
b8256519312be78a35c3864f58e33c1f8af30257597c0f0d4053fe183ee15d48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.11
|
Security for businessdate 0.7.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.