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: Process

Simulation 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

process_drift() array[source]

Drift of the simulated process

bound_supremum()[source]
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

reset_one_simulation_cost() None[source]

Reset the simulation cost

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

simulate_one_path()[source]

Simulate (only) one path of the non-deterministic part of the underlying

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: Process

Defines a simulation process for jump models (with a diffusive part and a pure jump part)

There are 2 ways to simulate the jumps:
  1. simulate the jumping times and then simulate the corresponding jump values

  2. 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]
intensity()[source]

Intensity of the jump process

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

reset_one_simulation_cost()[source]

Set simulation cost to 0

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: object

Simulation method

__init__(process: LevyProcess)[source]
one_simulation_cost(_) float[source]

Cost of the simulation of onr Monte-Carlo path

reset_one_simulation_cost()[source]

Set the simulation cost to 0

pre_computation(mc_paths: int, product: Product)[source]

Pre-compute auxiliary objevts

simulate_one_path() StochasticPath[source]

Simulate one Monte-Carlo path

simulate_jumps() array[source]

Simulation of the jump component

simulate_diffusion(sqrt_dts) array[source]

Simulation of the diffusive component

class SimulationFixedTimes(process: LevyProcess)[source]

Bases: Simulation

Simulation of the process at (predefined) fixed times

__init__(process: LevyProcess)[source]
pre_computation(mc_paths: int, product: Product)[source]

Pre-compute auxiliary objevts

simulate_one_path() StochasticPath[source]

Simulation of the path for deterministic payoff dates

simulate_jumps()[source]

Simulation of the jump component

simulate_diffusion(sqrt_dts)[source]

Simulation of the diffusive component

class SimulationWithJumpTimes(process: LevyProcess)[source]

Bases: Simulation

Simulation of the process at the stochastic jump times

__init__(process: LevyProcess)[source]
pre_computation(mc_paths: int, product: Product)[source]

Pre-compute auxiliary objevts

simulate_one_path() StochasticPath[source]

Simulation of the path for stochastic payoff dates

simulate_jumps()[source]

Simulation of the jump component

simulate_diffusion(sqrt_dts)[source]

Simulation of the diffusive component

class SimulationMaximumStep(process: LevyProcess, epsilon: float)[source]

Bases: SimulationWithJumpTimes

Simulation 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

static create_build_finer_grid_fun(epsilon: float, maturity: float)[source]
pre_computation(mc_paths: int, product: Product)[source]

Pre-compute auxiliary objevts

simulate_jumps()[source]

Simulation of the jump component

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: Enum

Type 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: ABC

General 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

dimension() int[source]

Number of modelled underlyings

process_drift() array[source]

Drift of the simulated process

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 reset_one_simulation_cost() None[source]

Reset the simulation cost

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

df(t: float) float[source]

Discount factor function

Parameters

t – maturity

Returns

the discount factor at time t