Python library yieldcurves
A Python library for financial yield curves. Typical banking business methods are provided like interpolation, compounding, discounting and fx.
Example Usage
>>> from curves.interpolation import linear >>> from yieldcurves import YieldCurve
>>> time_grid = [0, 2] >>> rate_grid = [.03, .05] >>> curve = linear(time_grid, rate_grid) >>> yc = YieldCurve(curve) >>> yc.zero(0, 1) 0.040000000000000036
>>> yc.df(0, 1) 0.9607894391523232
Or use datetime
>>> from yieldcurves import DateCurve >>> from datetime import date
>>> start = date(2013, 1, 1) >>> mid = date(2014, 1, 1) >>> end = date(2015, 1, 1)
>>> dc = DateCurve.from_interpolation([start, end], [.03, .05], origin=start) >>> dc.zero(start, mid) 0.03999999999999998
>>> dc.df(start, mid) 0.9608157444936446
The framework works fine with native datetime but we recommend businessdate package for more convenient functionality to roll out date schedules.
>>> from businessdate import BusinessDate, BusinessSchedule
So, build a date schedule.
>>> today = BusinessDate(20201031) >>> schedule = BusinessSchedule(today, today + "8q", step="1q") >>> schedule [BusinessDate(20201031), BusinessDate(20210131), BusinessDate(20210430), BusinessDate(20210731), BusinessDate(20211031), BusinessDate(20220131), BusinessDate(20220430), BusinessDate(20220731), BusinessDate(20221031)]
Documentation
More documentation available at https://yieldcurves.readthedocs.io
Install
The latest stable version can always be installed or updated via pip:
$ pip install yieldcurves
Development Version
The latest development version can be installed directly from GitHub:
$ pip install --upgrade git+https://github.com/sonntagsgesicht/yieldcurves.git
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 yieldcurves 0.2.9
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 |
|---|---|---|---|---|
| yieldcurves-0.2.9.zip | 45.3 kB | Without provenance | Details for yieldcurves-0.2.9.zip |
Release files / yieldcurves-0.2.9.zip
| Download URL | yieldcurves-0.2.9.zip |
|---|---|
| Size | 45.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aac6d42e5f3ef4c3181fb41bc60b8c919555297adad33f1ee61f2b1b16cf2470
|
|
BLAKE2b-256 checksum How to use checksums |
908a40c3c59fb3ca2a65a67b1bb7160141305d2f6033c7acc5b7a8af59fa7e07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Security for yieldcurves 0.2.9
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.