Unlocking Explicit Moments for Affine Jump Diffusions¶
- Release:
3.1
ajdmom is a Python library for automatically deriving explicit, closed-form
moment formulas for well-established Affine Jump Diffusion (AJD) processes.
It significantly enhances the usability of AJD models by providing both
unconditional moments and conditional moments, up to any positive integer
order. The supported AJD models include Heston
SV model,
SRJD,
1SVJ,
2FSV,
2FSVJ,
SVVJ,
SVIJ, and
SVCJ.
Extensions to other AJD models are also applicable.
This documentation provides a comprehensive guide to understanding, installing, and
utilizing ajdmom for your quantitative finance and stochastic modeling needs.
Installation¶
To install ajdmom, you can use pip from PyPI:
pip install ajdmom
Alternatively, you can install directly from the GitHub repository:
pip install git+https://github.com/xmlongan/ajdmom
Quick Start¶
To get the formula for the first moment \(\mathbb{E}[y_n]\):
>>> from ajdmom import mdl_1fsv # mdl_1fsv -> mdl_1fsvj, mdl_2fsv, mdl_2fsvj
>>> from pprint import pprint
>>>
>>> m1 = mdl_1fsv.moment_y(1) # 1 in moment_y(1) -> 2,3,4...
>>>
>>> # moment_y() -> cmoment_y() : central moment
>>> # dpoly(m1, wrt), wrt = 'k','theta',... : partial derivative
>>>
>>> msg = "which is a Poly with attribute keyfor = \n{}"
>>> print("moment_y(1) = "); pprint(m1); print(msg.format(m1.keyfor))
moment_y(1) =
{(0, 1, 0, 0, 1, 0, 0, 0): Fraction(-1, 2),
(0, 1, 0, 1, 0, 0, 0, 0): Fraction(1, 1)}
which is a Poly with attribute keyfor =
('e^{-kh}', 'h', 'k^{-}', 'mu', 'theta', 'sigma_v', 'rho', 'sqrt(1-rho^2)')
The two key-value pairs within the returned Poly object from moment_y(1)
correspond to the following expressions:
respectively. Adding together these two terms gives the first moment of the Heston SV model, i.e., \(\mathbb{E}[y_n] = (\mu-\theta/2)h\).
Table of Contents¶
Ongoing Development¶
This code is being developed on an on-going basis at the author’s Github site.
Support¶
For support in using this software, submit an issue.