Asset Models (FX/Equity/Inflation)

Asset Model Types

DiffFusion.AssetModel — Type
abstract type AssetModel <: ComponentModel end

An AssetModel aims at modelling spot prices of tradeable assets like FX, shares and indices.

We implement several additional functions to handle quanto adjustments.

source
DiffFusion.AssetVolatility — Type
abstract type AssetVolatility end

A functor calculating the state-independent volatility function sigma(u) for the interval (s,t).

source

Lognormal Model

DiffFusion.LognormalAssetModel — Type
struct LognormalAssetModel <: AssetModel
    alias::String
    sigma_x::BackwardFlatVolatility{ModelValue}
    state_alias::Vector{String}
    factor_alias::Vector{String}
    correlation_holder::CorrelationHolder{ModelValue}
    quanto_model::Union{AssetModel, Nothing}}
end

A LognormalAssetModel is a model for simulating a spot price in a generalised Black-Scholes framework.

source
DiffFusion.lognormal_asset_model — Function
lognormal_asset_model(
    alias::String,
    sigma_x::BackwardFlatVolatility,
    ch::CorrelationHolder,
    quanto_model::Union{AssetModel, Nothing}
    )

Create a LognormalAssetModel.

source
lognormal_asset_model(
    alias::String,
    dom_model::Union{GaussianHjmModel, Nothing},
    for_model::Union{GaussianHjmModel, Nothing},
    ch::Union{CorrelationHolder, Nothing},
    option_times::AbstractVector,
    asset_volatilities::AbstractVector,
    )

Calibrate an asset model to implied lognormal volatilities.

source

CEV Model

DiffFusion.CevAssetModel — Type
struct CevAssetModel <: AssetModel
    alias::String
    sigma_x::BackwardFlatVolatility{ModelValue}
    skew_x::BackwardFlatParameter{ModelValue}
    state_alias::Vector{String}
    factor_alias::Vector{String}
    correlation_holder::CorrelationHolder{ModelValue}
    quanto_model::Union{AssetModel, Nothing}
end

A CevAssetModel is a model for simulating an asset price in a Constant Elasticity of Variance model.

source
DiffFusion.cev_asset_model — Function
cev_asset_model(
    alias::String,
    sigma_x::BackwardFlatVolatility,
    skew_x::BackwardFlatParameter,
    ch::CorrelationHolder,
    quanto_model::Union{AssetModel, Nothing}
    )

Create a CevAssetModel.

source

Model Functions for Payoff Evaluation

DiffFusion.log_asset — Function
log_asset(m::Model, model_alias::String, t::ModelTime, X::ModelState)

Retrieve the normalised state variable from an asset model.

Returns a vector of size (p,) for X with size (n,p).

source
log_asset(m::CevAssetModel, model_alias::String, t::ModelTime, X::ModelState)

Retrieve the normalised state variable from an asset model.

source
log_asset(m::LognormalAssetModel, model_alias::String, t::ModelTime, X::ModelState)

Retrieve the normalised state variable from an asset model.

source
log_asset(m::CompositeModel, alias::String, t::ModelTime, X::ModelState)

Retrieve the normalised state variable from an asset model.

source
DiffFusion.log_asset_convexity_adjustment — Function
log_asset_convexity_adjustment(
    m::Model,
    dom_alias::String,
    for_alias::String,
    ast_alias::String,
    t::ModelTime,
    T0::ModelTime,
    T1::ModelTime,
    T2::ModelTime,
    )

Calculate the YoY convexity adjustment term for OU models.

Returns a scalar quantity.

source
log_asset_convexity_adjustment(
    m::CompositeModel,
    dom_alias::String,
    for_alias::String,
    ast_alias::String,
    t::ModelTime,
    T0::ModelTime,
    T1::ModelTime,
    T2::ModelTime,
    )

Calculate the YoY convexity adjustment term for OU models.

Returns a scalar quantity.

source
log_asset_convexity_adjustment(
    dom_model::GaussianHjmModel,
    for_model::GaussianHjmModel,
    ast_model::LognormalAssetModel,
    t::ModelTime,
    T0::ModelTime,
    T1::ModelTime,
    T2::ModelTime,
    )

Calculate convexity adjustment for year-on-year coupons of tradeable assets.

source

Additional Asset Model Functions

DiffFusion.asset_volatility — Function
asset_volatility(
    m::AssetModel,
    s::ModelTime,
    t::ModelTime,
    X::Union{ModelState, Nothing} = nothing,
    )

Return an AssetVolatility functor.

source
asset_volatility(
    m::CevAssetModel,
    s::ModelTime,
    t::ModelTime,
    X::Union{ModelState, Nothing} = nothing,
    )

Return a state-independent volatility function sigma(u) for the interval (s,t).

source
asset_volatility(
    m::LognormalAssetModel,
    s::ModelTime,
    t::ModelTime,
    X::Union{ModelState, Nothing} = nothing,
    )

Return an LognormalAssetVolatility functor for the interval (s,t).

source
DiffFusion.quanto_drift — Function
quanto_drift(
    dom_factor_alias::AbstractVector,
    quanto_model::Nothing,
    s::ModelTime,
    t::ModelTime,
    X::Union{ModelState, Nothing} = nothing,
    )

Return a zero quanto adjustment function alpha(u).

source
quanto_drift(
    dom_factor_alias::AbstractVector,
    quanto_model::AssetModel,
    s::ModelTime,
    t::ModelTime,
    X::Union{ModelState, Nothing} = nothing,
    )

Return a function alpha(u) that allows to calculate the quanto adjustment on the time interval (s,t).

source
DiffFusion.asset_variance — Function
asset_variance(
    m::Model,
    ast_alias::Union{String, Nothing},
    dom_alias::Union{String, Nothing},
    for_alias::Union{String, Nothing},
    t::ModelTime,
    T::ModelTime,
    X::ModelState,
    )

Calculate the lognormal model variance of an asset spot price over the time period [t,T]. If Model is state-dependent then variance calculation takes into account model state X.

source
asset_variance(
    m::CompositeModel,
    ast_alias::Union{String, Nothing},
    dom_alias::Union{String, Nothing},
    for_alias::Union{String, Nothing},
    t::ModelTime,
    T::ModelTime,
    X::ModelState,
    )

Calculate the lognormal model variance of an asset spot price over the time period [t,T].

source
asset_variance(
    ast_model::LognormalAssetModel,
    dom_model::Union{GaussianHjmModel, Nothing},
    for_model::Union{GaussianHjmModel, Nothing},
    ch::CorrelationHolder,
    s::ModelTime,
    t::ModelTime,
    X::Union{ModelState, Nothing} = nothing,
    )

Calculate lognormal variance in hybrid asset model.

The method is defined for a LognormalAssetModel. It should also work for other asset models. But then we need to calculate a vector and this requires more testing.

source
asset_variance(
    p::AbstractPath,
    t::ModelTime,
    T::ModelTime,
    key::String,
    )

Calculate the lognormal model variance of an asset spot price over the time period [t,T].

source
asset_variance(
    p::Path,
    t::ModelTime,
    T::ModelTime,
    key::String,
    )

Calculate the lognormal model variance of an asset spot price over the time period [t,T].

source