Python library shortrate
Risk factor model library python style.
Example Usage
from businessdate import BusinessDate, BusinessRange
from dcf import ZeroRateCurve, FxCurve
from timewave import Consumer, Engine
from shortrate import RiskFactorProducer, GBMFxCurve, HullWhiteCurve, HullWhiteFxCurve, HullWhiteMultiCurrencyCurve
s = BusinessDate()
t = s + '10y'
g = BusinessRange(s, t, '6M')
d = ZeroRateCurve([s], [0.05])
f = ZeroRateCurve([s], [0.04])
x = FxCurve([s], [.8], domestic_curve=d, foreign_curve=f)
r = GBMFxCurve.build(x, volatility=0.2)
print r.evolve(1., s, s + '1y', 0.01)
print r.get_fx_rate(s + '3y'), r._factor_date
print r.evolve(1., s + '1y', s + '5y', 0.1)
print r.get_fx_rate(s + '7y'), r._factor_date
hwd = HullWhiteCurve.build(d, mean_reversion=0.01, volatility=0.03, terminal_date=t)
hwf = HullWhiteCurve.build(f, mean_reversion=0.01, volatility=0.03, terminal_date=t)
hwx = HullWhiteFxCurve.build(r, hwd, hwf)
hwxf = HullWhiteMultiCurrencyCurve.build(hwf, hwd, hwx)
print hwd.evolve(1., s, s + '1y', 0.01)
print hwf.evolve(1., s, s + '1y', 0.02)
print hwx.evolve(1., s, s + '1y', (0.01, 0.02, 0.01))
print hwxf.evolve(1., s, s + '1y', 0.02)
func = (lambda x: hwd.get_cash_rate(t - '1y'))
c = Consumer(lambda x: func(x.date))
res = Engine(RiskFactorProducer(hwd), c).run(g, 100)
print res
Install
The latest stable version can always be installed or updated via pip:
$ pip install shortrate
If the above fails, please try easy_install instead:
$ easy_install shortrate
Development Version
The latest development version can be installed directly from GitHub:
$ pip install --upgrade git+https://github.com/pbrisk/shortrate.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 shortrate 0.3
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 |
|---|---|---|---|---|
| shortrate-0.3.tar.gz | 18.4 kB | Without provenance | Details for shortrate-0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shortrate-0.3-py3-none-any.whl | Python 3 | none | any | Details for shortrate-0.3-py3-none-any.whl |
Total release size: 36.5 kB
Release files / shortrate-0.3.tar.gz
| Download URL | shortrate-0.3.tar.gz |
|---|---|
| Size | 18.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6faaae989d393ea031872da9193888f54bab847efc2c1147c0091e5b9b0fd384
|
|
BLAKE2b-256 checksum How to use checksums |
08822377833a937f3d456c9ab4a1cb9806b9378f95cad3ef849b538b24360213
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4
|
Release files / shortrate-0.3-py3-none-any.whl
| Download URL | shortrate-0.3-py3-none-any.whl |
|---|---|
| Size | 18.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7fadf48bbd3874456af2fb4bac273cc837a4c4b0801fc22aa3582446c5d3de71
|
|
BLAKE2b-256 checksum How to use checksums |
93a61a257826b37986d82a9295559bbb5f528df73cb38a3265ceb5e57034be35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4
|
Security for shortrate 0.3
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.