Asset Models (FX/Equity/Inflation)
Asset Model Types
DiffFusion.AssetModel
— Typeabstract 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.
Lognormal Model
DiffFusion.LognormalAssetModel
— Typestruct LognormalAssetModel <: AssetModel
alias::String
sigma_x::BackwardFlatVolatility
state_alias::AbstractVector
factor_alias::AbstractVector
correlation_holder::CorrelationHolder
quanto_model::Union{AssetModel, Nothing}
end
A LognormalAssetModel
is a model for simulating a spot price in a generalised Black-Scholes framework.
DiffFusion.lognormal_asset_model
— Functionlognormal_asset_model(
alias::String,
sigma_x::BackwardFlatVolatility,
ch::CorrelationHolder,
quanto_model::Union{AssetModel, Nothing}
)
Create a LognormalAssetModel.
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.
CEV Model
DiffFusion.CevAssetModel
— Typestruct CevAssetModel <: AssetModel
alias::String
sigma_x::BackwardFlatVolatility
skew_x::BackwardFlatParameter
state_alias::AbstractVector
factor_alias::AbstractVector
correlation_holder::CorrelationHolder
quanto_model::Union{AssetModel, Nothing}
end
A CevAssetModel
is a model for simulating an asset price in a Constant Elasticity of Variance model.
DiffFusion.cev_asset_model
— Functioncev_asset_model(
alias::String,
sigma_x::BackwardFlatVolatility,
skew_x::BackwardFlatParameter,
ch::CorrelationHolder,
quanto_model::Union{AssetModel, Nothing}
)
Create a CevAssetModel.
Model Functions for Payoff Evaluation
DiffFusion.log_asset
— Functionlog_asset(m::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).
log_asset(m::CevAssetModel, model_alias::String, t::ModelTime, X::ModelState)
Retrieve the normalised state variable from an asset model.
log_asset(m::LognormalAssetModel, model_alias::String, t::ModelTime, X::ModelState)
Retrieve the normalised state variable from an asset model.
log_asset(m::CompositeModel, alias::String, t::ModelTime, X::ModelState)
Retrieve the normalised state variable from an asset model.
DiffFusion.log_asset_convexity_adjustment
— Functionlog_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.
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.
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.
Additional Asset Model Functions
DiffFusion.asset_volatility
— Functionasset_volatility(
m::AssetModel,
s::ModelTime,
t::ModelTime,
X::Union{ModelState, Nothing} = nothing,
)
Return a state-independent volatility function sigma(u) for the interval (s,t).
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).
asset_volatility(
m::LognormalAssetModel,
s::ModelTime,
t::ModelTime,
X::Union{ModelState, Nothing} = nothing,
)
Return a state-independent volatility function sigma(u) for the interval (s,t).
DiffFusion.correlation_holder
— Methodcorrelation_holder(m::AssetModel)
Return the correlation holder term structure.
DiffFusion.quanto_drift
— Functionquanto_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).
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).
DiffFusion.asset_variance
— Functionasset_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.
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].
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.
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].
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].