process
levycopulaseries
Lévy copula simulated via a series representation as described in ‘Lévy copulas: review of recent results’, by Peter Tankov
This implementation only supports 2d Levy processes with fine variation.
- class LevyCopula2dSeriesRepresentation(levy_copula_model: LevyCopulaModel, tau: float)[source]
Bases:
ProcessSimulation of a Lévy copula via a series representation
- __init__(levy_copula_model: LevyCopulaModel, tau: float)[source]
- Parameters
levy_copula_model – Lévy copula model
tau – cut-off of the series representation
- df(t)[source]
Discount factor function
- Parameters
t – maturity
- Returns
the discount factor at time t
- initialisation(product: Product, max_step_epsilon: Optional[float] = None) None[source]
Initialisation of the process from the characteristics of the product in scope
- Parameters
product – financial product
max_step_epsilon – if epsilon != None then jump times with max step epsilon are used to build the time discretisation steps
- one_simulation_cost(product) float[source]
Returns: the simulating cost corresponding to the numbers of uniform random variables simulated
levyprocess
Definition of a stochastic process for a Lévy model
- simulate_diffusion_with_brownian_increments(scaled_stddev, brownian_increments)[source]
- Parameters
scaled_stddev – standard deviation
brownian_increments – standard Brownian increments
- Returns
vector of cumulative Brownian increments
- class LevyProcess(model: Union[LevyModel, LevyCopulaModel])[source]
Bases:
ProcessDefines a simulation process for jump models (with a diffusive part and a pure jump part)
- There are 2 ways to simulate the jumps:
simulate the jumping times and then simulate the corresponding jump values
simulate the number of jumps between t and s and then simulate the jump values
When the payoff has stochastic dates (for example for credit models) or the whole path is needed (barrier option) then option 1. is chosen otherwise we just go with option 2. as the simulation is slightly faster (because there is no need to simulate the jump times)
- __init__(model: Union[LevyModel, LevyCopulaModel])[source]
- nb_jump_dt(dt) int[source]
Direct simulation of the numbers of jumps between 0 and dt
- Parameters
dt – time increment
- Returns
number of jumps
- jump_times(dt: float) array[source]
Direct simulation of the jump times
- Parameters
dt – time increment
- Returns
array of the jump times
- static jump_times_from_nb_of_jumps(dt: float, n: int) array[source]
Simulation of n jump times in [0, dt)
- Parameters
dt – time increment
n – number of jumps
- Returns
jump times
- one_simulation_cost(product) float[source]
- Parameters
product – product to price
- Returns
the cost of simulating one Monte-Carlo path
- initialisation(product: Product, max_step_epsilon: Optional[float] = None)[source]
Initialisation of auxiliary objects
- pre_computation(mc_paths: int, product: Product)[source]
Pre-computation of random variables and other quantities
- simulate_one_path() StochasticPath[source]
Simulation of one Monte-Carlo path
- class Simulation(process: LevyProcess)[source]
Bases:
objectSimulation method
- __init__(process: LevyProcess)[source]
- simulate_one_path() StochasticPath[source]
Simulate one Monte-Carlo path
- class SimulationFixedTimes(process: LevyProcess)[source]
Bases:
SimulationSimulation of the process at (predefined) fixed times
- __init__(process: LevyProcess)[source]
- simulate_one_path() StochasticPath[source]
Simulation of the path for deterministic payoff dates
- class SimulationWithJumpTimes(process: LevyProcess)[source]
Bases:
SimulationSimulation of the process at the stochastic jump times
- __init__(process: LevyProcess)[source]
- simulate_one_path() StochasticPath[source]
Simulation of the path for stochastic payoff dates
- class SimulationMaximumStep(process: LevyProcess, epsilon: float)[source]
Bases:
SimulationWithJumpTimesSimulation of the path at the stochastic times of the path but a step size of size epsilon is added for any time increment greater than epsilon (that is the maximum times grid is epsilon)
- __init__(process: LevyProcess, epsilon: float)[source]
- Parameters
process – Lévy process
epsilon – minimum time increment
process
Defines the simulated process for a Lévy model
The natural case is to simulate a model from its definition, that is by simulating its underlying variables; nevertheless, this is generally not possible. One can also approximate the jump part by a discrete Continuous-Time Markov Chain (CTMC) and simulate this chain via Monte-Carlo methods.
- class ProcessRepresentation(value)[source]
Bases:
EnumType of the underlying representation of the process, often the log-process is simulated as it is both easier and faster to do so.
- IDENDITY = 1
- LOG = 2
- class Process(model: Model, process_representation: ProcessRepresentation)[source]
Bases:
ABCGeneral stochastic process interface
- __init__(model: Model, process_representation: ProcessRepresentation)[source]
- initialisation(product: Product, max_step_epsilon: float = None) None[source]
Initialisation of the process from the characteristics of the product in scope
- Parameters
product – financial product
max_step_epsilon – if epsilon != None then jump times with max step epsilon are used to build the time discretisation steps
- deterministic_path(times: array) array[source]
- Parameters
times – times of the path
- Returns
the deterministic part of the path
- abstract one_simulation_cost(product) float[source]
Returns: the simulating cost corresponding to the numbers of uniform random variables simulated
- abstract pre_computation(mc_paths: int, product: Product) None[source]
Pre-computation, for example simulate the random variables if possible :param mc_paths: number of Monte-Carlo paths :param product: financial product to price
- abstract simulate_one_path() StochasticPath[source]
Simulate (only) one path of the non-deterministic part of the underlying