Composable financial contracts with Monte Carlo valuation
Project description
Monte Carlo Contracts
Composable financial contracts with Monte Carlo valuation. This module employs ideas from How to Write a Financial Contract by S. L. Peyton Jones and J-M. Eber. However, the implementation is not based on functional programming but rather using an object oriented approach. Also, this implementation is tailored towards Monte Carlo based cashflow generation whereas the paper favours more general methods.
Features
- Composition of financial contracts using elementary contracts
Zero
,One
,Give
,Scale
,And
,When
,Cond
,Anytime
andUntil
- Boolean and real valued observables (stochastic processes) to be referenced by contracts
- Cashflow generation for composed contracts given simulation models on fixed dategrids
Examples
Install
You can install monte-carlo-contracts
using pip
with
pip3 install monte-carlo-contracts
or you can simply download mcc.py
and then run it using python3
with
python3 mcc.py
History
0.5.0 (2020--11-08)
- BREAKING CHANGE: Add
simulated_rates
toModel
(included in constructor); pass an empty dict forsimulated_rates
to adapt your code - BREAKING CHANGE:
BrownianMotion
andGeometricBrownianMotion
generalized to dynamic mean/drift; passmu_t = lambda t: mu * t
to adapt your code LinearRate
observable supported byTermStructureModel
- First steps towards term structure models
FixedAfter
observable to keep an observable fixed after a condition is true- Observables support arithmetic operations (binary
+
,-
,*
,/
,**
and unary-
) with other observables as well as constants (also right operators work) - Working with Observables example notebook
0.4.0 (2020-11-04)
- Discounting (
Model.discount
) - Evaluation (
Model.evaluate
) - String representations for contracts and observables
0.3.0 (2020-10-23)
- Simulation of basic contract
Until
- Currency conversion of
IndexedCashflows
Or
contract supports multiple currenciesObservableFloat
supports<
,<=
,>
and>=
operators withfloat
or otherObservableFloat
instancesObservableBool
supports~
,&
and|
operators for combined conditions- Equity Options and FX Options examples
0.2.0 (2020-10-11)
- Simulation of basic contracts
Zero
,One
,Give
,Scale
,And
,When
andCond
- Partial simulation of
Or
contract - Float observables
Stock
andFX
- Boolean observables
At
SimulatedCashflows
and model-boundIndexedCashflows
to represent cashflows- Basic
Model
allowing the generation of cashflows for the contracts above
0.1.0 (2020-09-22)
- Created using cookiecutter-pyscript
Credits
Main developer is luphord luphord@protonmail.com. cookiecutter-pyscript is used as project template.
History
0.1.0 (2020-09-22)
- Initial release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for monte-carlo-contracts-0.5.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6eec64d32543ed28ed3c4b425417cad52520718311a3b7c00acb39a5899ec6c8 |
|
MD5 | b9563fcb2b8b42ddb1c0ab999449d601 |
|
BLAKE2b-256 | 47ce032f51515318282fad357e2c5ab515e77122e6421cd89f93d501ffef677d |
Hashes for monte_carlo_contracts-0.5.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 744a2341d0a3b14c8b109f81c17fc1bdf5901b3caade8050f37409457f239061 |
|
MD5 | 7de33082c6faf809044277377bf20370 |
|
BLAKE2b-256 | 20e46800cd75f64b6cbaab38f8da91d7ea202e6fd64ab17f19acf5f1733f3a30 |