Pydantic QuantLib
QuantLib Python Objects with Typing
Free software: MIT license
Documentation: https://pydantic-quantlib.readthedocs.io.
Features
This package uses pydantic to wrap QuantLib to provide a set of Typed class factories.
The pydantic models are auto-generated from the QuantLib SWIG bindings. The autogen code is available on request.
In the following example we construct a European Option.
import pydantic_quantlib as pql
payoff = pql.PlainVanillaPayoff(type=pql.OptionType.Put, strike=40)
european_exercise = pql.EuropeanExercise(date=pql.Date(d=4, m=1, y=2022))
european_option = pql.VanillaOptionBase(payoff=payoff, exercise=european_exercise)
The option can be converted to the usual QuantLib object for computation as seen in this fuller example.
>>> european_option.to_quantlib()
'<QuantLib.QuantLib.VanillaOption; proxy of <Swig Object of type 'ext::shared_ptr< VanillaOption > *' at 0x7f6559ddabd0> >'
it can also be printed:
>>> print(european_option)
'PlainVanillaPayoff(type=<OptionType.Put: -1>, strike=40.0) exercise=EuropeanExercise(date=Date0(d=4.0, m=1.0, y=2022.0))'
it can be converted to JSON:
>>> european_option.json()
'{"resource_name": "VanillaOption", "payoff": {"resource_name": "PlainVanillaPayoff", "type": -1, "strike": 40.0}, "exercise": {"resource_name": "EuropeanExercise", "date": {"resource_name": "Date", "d": 4, "m": 1, "y": 2022}}}'
and it can be loaded from JSON:
>>> json_repr = '{"resource_name": "VanillaOption", "payoff": {"resource_name": "PlainVanillaPayoff", "type": -1, "strike": 40.0}, "exercise": {"resource_name": "EuropeanExercise", "date": {"resource_name": "Date", "d": 4, "m": 1, "y": 2022}}}'
>>> pql.VanillaOption.parse_obj(json.loads(json_repr))
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2021-01-04)
First release on PyPI.
Metadata
Release files for pydantic-quantlib 0.3.0
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 |
|---|---|---|---|---|
| pydantic_quantlib-0.3.0.tar.gz | 48.6 kB | Without provenance | Details for pydantic_quantlib-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydantic_quantlib-0.3.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for pydantic_quantlib-0.3.0-py2.py3-none-any.whl |
Total release size: 85.5 kB
Release files / pydantic_quantlib-0.3.0.tar.gz
| Download URL | pydantic_quantlib-0.3.0.tar.gz |
|---|---|
| Size | 48.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d903407af2aafb850a71ca106f53e4612759b8f1c1ed3991158e4fb4ff92ac9
|
|
BLAKE2b-256 checksum How to use checksums |
b5aeb658ec168e5105274c15b0c1582016bfb022f0adc76c0a56f9e88097bdff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.5
|
Release files / pydantic_quantlib-0.3.0-py2.py3-none-any.whl
| Download URL | pydantic_quantlib-0.3.0-py2.py3-none-any.whl |
|---|---|
| Size | 36.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
9c19a06fa9f6f70d7342134ee00dd05b17fa56fe2151e423f42e73c1b02dc087
|
|
BLAKE2b-256 checksum How to use checksums |
54d6ea2d0c2f04704399bdac5bab4702262c0c32adf6d0be3b77e2dfc7876294
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.5
|
Security for pydantic-quantlib 0.3.0
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.