levymodel
exponentialoflevymodel
Exponential of a Lévy process, that is the underlying is S modelled as: S_t = S_0 exp(L_t) and L_t is a Lévy model
levymodel
Description of a generic Lévy model: this involves the definition of the Lévy measure (and truncated Lévy measure) as well as Lévy triplet. Cumulants are also defined for those models which have some.
- class LevyRepresentation(value)[source]
Bases:
EnumAn enumeration.
- ZERO = 1
- CENTER = 2
- ONEONE = 3
- TILDE = 4
- class LevyMeasure[source]
Bases:
objectDefinition of a Lévy measure and its integration against power of x. The main characteristics of the Lévy measure are given directly by the value of its Blumenthal-Getoor index.
- support()[source]
- Returns
the support of the Lévy measure
Note
in theory, this is really \(\mathbb{R}^*\)
- abstract jump_of_finite_activity() bool[source]
- Returns
true if the integral of \(\nu(dx)\) over \(\mathbb{R}\) is finite
- abstract jump_of_finite_variation() bool[source]
- Returns
true if the integral of \(|x| \nu(dx)\) on \(|x| <= 1\) is finite
- finite_first_moment()[source]
- Returns
true if the integral of \(|x| \nu(dx)\) on \(|x| > 1\) is finite
- x_nu(x: float) float[source]
- Returns
the multiplication of x times the Lévy measure
note:: there are a lot of cases where this expression can be simplified
- integrate(a: float, b: float) float[source]
Integrate the levy measure \(\nu(dx)\) between x=a and x=b
- class TruncatedLevyMeasure(levy_measure: LevyMeasure, truncations: tuple[float, float])[source]
Bases:
LevyMeasureThe truncated Lévy measure is the restriction of a Lévy measure to an interval [a, b]
- __init__(levy_measure: LevyMeasure, truncations: tuple[float, float])[source]
- Parameters
levy_measure – considered Lévy measure
truncations – truncation parameters a, b with a < b such as the new measure is the restriction to [a, b]
- support()[source]
- Returns
the support of the Lévy measure
Note
in theory, this is really \(\mathbb{R}^*\)
- jump_of_finite_activity() bool[source]
- Returns
true if the integral of \(\nu(dx)\) over \(\mathbb{R}\) is finite
- jump_of_finite_variation() bool[source]
- Returns
true if the integral of \(|x| \nu(dx)\) on \(|x| <= 1\) is finite
- finite_first_moment()[source]
- Returns
true if the integral of \(|x| \nu(dx)\) on \(|x| > 1\) is finite
- integrate(a: float, b: float) float[source]
Integrate the levy measure \(\nu(dx)\) between x=a and x=b
- class LevyTriplet(sigma: float, nu: LevyMeasure, a: float = 0, representation: LevyRepresentation = LevyRepresentation.ONEONE)[source]
Bases:
objectThe Lévy triplet is defined as (a, sigma, nu) where: - a is the drift of the given representation - sigma is the diffusion coefficient - nu is the Lévy measure
- __init__(sigma: float, nu: LevyMeasure, a: float = 0, representation: LevyRepresentation = LevyRepresentation.ONEONE)[source]
- Parameters
sigma – Brownian coefficient
nu – Lévy measure
a – drift term
representation – Lévy-Khintchine representation
- property sigma
- canonical_drift() float[source]
- Returns
the canonical drift, that is the drift corresponding to the cut-off function \(c(x) = 1\) if \(|x| < 1\)
- center_drift() float[source]
- Returns
centre drift corresponding to the cut-off function :math: c(x) = 1
- set_representation(representation: LevyRepresentation) None[source]
- Parameters
representation – Lévy-Khintchine representation
- class Cumulant(drift: float, parameters: Parameters)[source]
Bases:
ABCExpression of the first 6 cumulants functions of the Lévy model if they exist.
- abstract __init__(drift: float, parameters: Parameters)[source]
- class LevyModel(model_type: ModelType, levy_triplet: LevyTriplet, cumulant: Cumulant)[source]
Bases:
ModelThis class represents a time-homogeneous Lévy model
Note
the simulated process has the same representation as the model, more explicitly the Lévy model L is simulated via the process L (contrary to the
ExponentialOfLévyModelS = exp(L) which is simulated via the log-process L)- process_representation = 1
- __init__(model_type: ModelType, levy_triplet: LevyTriplet, cumulant: Cumulant)[source]
- Parameters
model_type – name of the model
levy_triplet – Lévy triplet
cumulant – cumulant expressions
- truncate_levy_measure(truncations) None[source]
Truncate the Lévy measure: the Lévy measure will return 0 outside the truncations interval
- drift(t: float = 0, x: array = 0) array[source]
zero drift, by default, as the process is directly modelled by the Lévy model
- df(t: float) float[source]
Discount factor function :param t: time t :return: the discount factor at time t
- jump_increment(n) array[source]
Direct simulation of jump increments
- Parameters
n – numbers of jumps to simulate
- Returns
array of the jump values
- abstract levy_exponent_pure_jump(x: complex) complex[source]
The Lévy exponent phi is such that E[exp(x L_t)] = exp(t*phi(x)) where L is the Lévy model with triplet (0, 0, nu).
- Returns
phi(z) where z = ix, that is phi(x) = levy_exponent_pure_jump(ix)
- levy_exponent(x: complex) complex[source]
- Returns
the Lévy exponent phi such that \(\mathbb{E}[exp(u L_t)] = exp(\phi(u)*t)\) where L is the Lévy model with triplet (a, sigma, nu)
- characteristic_function(t: float, x: complex) complex[source]
- Returns
the characteristic function of the process L_t, i.e. E[exp(i u L_t)]
- density(t) Callable[[float], Callable[[array], array]][source]
- Returns
the density function implied by the COS formula of the exponential of the Lévy model