diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 5aa4cad..1d30d6c 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.7","generation_timestamp":"2024-11-28T16:50:49","documenter_version":"1.8.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.7","generation_timestamp":"2024-11-28T17:41:04","documenter_version":"1.8.0"}} \ No newline at end of file diff --git a/dev/additional_functions/additional_functions/index.html b/dev/additional_functions/additional_functions/index.html index a41e23d..13e0f27 100644 --- a/dev/additional_functions/additional_functions/index.html +++ b/dev/additional_functions/additional_functions/index.html @@ -1,2 +1,2 @@ -Additional Functions · [∂F]

Additional Functions

In this section we document additional functions.

DiffFusion.aliasFunction
alias(ts::Termstructure)

Return the term structure's alias.

source
alias(m::Model)

Return the model's own alias. This is the default implementation.

source
alias(m::MarkovFutureModel)

Return the model's own alias. This is the default implementation.

source
alias(c::Context)

Return the alias of a Context object.

source
alias(leg::CashFlowLeg)

Return the leg alias

source

Aliases for Common Abstract Data Types

+Additional Functions · [∂F]

Additional Functions

In this section we document additional functions.

DiffFusion.aliasFunction
alias(ts::Termstructure)

Return the term structure's alias.

source
alias(m::Model)

Return the model's own alias. This is the default implementation.

source
alias(m::MarkovFutureModel)

Return the model's own alias. This is the default implementation.

source
alias(c::Context)

Return the alias of a Context object.

source
alias(leg::CashFlowLeg)

Return the leg alias

source

Aliases for Common Abstract Data Types

diff --git a/dev/analytics/analytics/index.html b/dev/analytics/analytics/index.html index 55f2935..686f388 100644 --- a/dev/analytics/analytics/index.html +++ b/dev/analytics/analytics/index.html @@ -4,36 +4,36 @@ term::ModelTime, mdl::Model, ctx::Context - )

Return the scaling vector of a reference rate.

A reference rate is specified as a stochastic process random variable Y = A' X + b. Here, X reprsents the model state variable, A is the resulting scaling vector and b is a deterministic function (not relevant for this purpose).

Reference rates are continuous compounded zero rates and FX rates (or asset prices). Reference rates are identified by a context_key. In addition, zero rates are specified by a positive term. For FX rates we require term equal to zero.

Reference rates for other asset classes are to be added.

The model context ctx is used to identify corresponding model parameters and state variables of the model.

source
reference_rate_scaling(
+    )

Return the scaling vector of a reference rate.

A reference rate is specified as a stochastic process random variable Y = A' X + b. Here, X reprsents the model state variable, A is the resulting scaling vector and b is a deterministic function (not relevant for this purpose).

Reference rates are continuous compounded zero rates and FX rates (or asset prices). Reference rates are identified by a context_key. In addition, zero rates are specified by a positive term. For FX rates we require term equal to zero.

Reference rates for other asset classes are to be added.

The model context ctx is used to identify corresponding model parameters and state variables of the model.

source
reference_rate_scaling(
     keys_and_terms::AbstractVector,
     mdl::Model,
     ctx::Context
-    )

Return the scaling matrix of a reference rates. The scaling matrix represents a list of scaling vectors represented as matrix.

keys_and_terms is a list of tuples. For each tuple, the first element represents the context_key of the reference rate. The second element represents the term of the reference rate.

source
DiffFusion.reference_rate_covarianceFunction
reference_rate_covariance(
+    )

Return the scaling matrix of a reference rates. The scaling matrix represents a list of scaling vectors represented as matrix.

keys_and_terms is a list of tuples. For each tuple, the first element represents the context_key of the reference rate. The second element represents the term of the reference rate.

source
DiffFusion.reference_rate_covarianceFunction
reference_rate_covariance(
     Y1::AbstractVecOrMat,
     Y2::AbstractVecOrMat,
     mdl::Model,
     ch::CorrelationHolder,
     s::ModelTime,
     t::ModelTime,
-    )

Calculate the covariance matrix for two vector or matrices of reference rates.

source
reference_rate_covariance(
+    )

Calculate the covariance matrix for two vector or matrices of reference rates.

source
reference_rate_covariance(
     Y1::Tuple,
     Y2::Tuple,
     mdl::Model,
     ch::CorrelationHolder,
     s::ModelTime,
     t::ModelTime,
-    )

Calculate the scalar covariance for two reference rates.

Reference rates are encoded as tuples Y1 and Y2. The first element of a tuple is the context_key. The second element of the tuple is the term.

source
reference_rate_covariance(
+    )

Calculate the scalar covariance for two reference rates.

Reference rates are encoded as tuples Y1 and Y2. The first element of a tuple is the context_key. The second element of the tuple is the term.

source
reference_rate_covariance(
     keys_and_terms::AbstractVector,
     ctx::Context,
     mdl::Model,
     ch::CorrelationHolder,
     s::ModelTime,
     t::ModelTime,
-    )

Calculate covariance matrix for a list of reference rates.

keys_and_terms is a list of tuples. For each tuple, the first element represents the context_key of the reference rate. The second element represents the term of the reference rate.

source
DiffFusion.reference_rate_volatility_and_correlationFunction
reference_rate_volatility_and_correlation(
+    )

Calculate covariance matrix for a list of reference rates.

keys_and_terms is a list of tuples. For each tuple, the first element represents the context_key of the reference rate. The second element represents the term of the reference rate.

source
DiffFusion.reference_rate_volatility_and_correlationFunction
reference_rate_volatility_and_correlation(
     keys_and_terms::AbstractVector,
     ctx::Context,
     mdl::Model,
     ch::CorrelationHolder,
     s::ModelTime,
     t::ModelTime,
-    )

Calculate the volatility vector and correlation matrix for a list of reference rates.

keys_and_terms is a list of tuples. For each tuple, the first element represents the context_key of the reference rate. The second element represents the term of the reference rate.

source
+ )

Calculate the volatility vector and correlation matrix for a list of reference rates.

keys_and_terms is a list of tuples. For each tuple, the first element represents the context_key of the reference rate. The second element represents the term of the reference rate.

source diff --git a/dev/examples/examples/index.html b/dev/examples/examples/index.html index 4702c1f..cadc5e0 100644 --- a/dev/examples/examples/index.html +++ b/dev/examples/examples/index.html @@ -1,5 +1,5 @@ -Example Models and Portfolios · [∂F]

Example Models and Portfolios

We add example models, term structures, pricing context and product configurations in an Examples sub-module. The examples are encoded as YAML files. They should help users to easily set up simulations for ad-hoc testing and analysis.

In this section we document data and functions to work with the product and model examples.

DiffFusion.Examples.loadFunction
load(name::String)

Return a list of dictionaries representing a DiffFusion example.

Example details can be modified by changing the dictionary entries.

source
DiffFusion.Examples.buildFunction
build(dict_list::Vector{OrderedDict{String, Any}})

Return a dictionary of objects and configurations representing a DiffFusion example.

The resulting dictionary is supposed to be queried and amended by methods operating on examples.

source

Model Setup

DiffFusion.Examples.simulation!Function
simulation!(example::OrderedDict{String,Any})

Return a Monte Carlo simulation for a given example.

If no simulation exists it is created.

source

Product Setup

DiffFusion.Examples.fixed_rate_legFunction
fixed_rate_leg(
+Example Models and Portfolios · [∂F]

Example Models and Portfolios

We add example models, term structures, pricing context and product configurations in an Examples sub-module. The examples are encoded as YAML files. They should help users to easily set up simulations for ad-hoc testing and analysis.

In this section we document data and functions to work with the product and model examples.

DiffFusion.Examples.loadFunction
load(name::String)

Return a list of dictionaries representing a DiffFusion example.

Example details can be modified by changing the dictionary entries.

source
DiffFusion.Examples.buildFunction
build(dict_list::Vector{OrderedDict{String, Any}})

Return a dictionary of objects and configurations representing a DiffFusion example.

The resulting dictionary is supposed to be queried and amended by methods operating on examples.

source

Model Setup

DiffFusion.Examples.simulation!Function
simulation!(example::OrderedDict{String,Any})

Return a Monte Carlo simulation for a given example.

If no simulation exists it is created.

source

Product Setup

DiffFusion.Examples.fixed_rate_legFunction
fixed_rate_leg(
     alias::String,
     effective_time::ModelTime,
     maturity_time::ModelTime,
@@ -9,7 +9,7 @@
     discount_curve_key::String,
     fx_key::Union{String, Nothing} = nothing,
     payer_receiver = 1.0,
-    )

Create a fixed rate cash flow leg.

source
DiffFusion.Examples.simple_rate_legFunction
simple_rate_leg(
     alias::String,
     effective_time::ModelTime,
     maturity_time::ModelTime,
@@ -21,7 +21,7 @@
     discount_curve_key::String,
     fx_key::Union{String, Nothing} = nothing,
     payer_receiver = 1.0,
-    )

Create a Libor cash flow leg.

source
DiffFusion.Examples.compounded_rate_legFunction
compounded_rate_leg(
     alias::String,
     effective_time::ModelTime,
     maturity_time::ModelTime,
@@ -33,14 +33,14 @@
     discount_curve_key::String,
     fx_key::Union{String, Nothing} = nothing,
     payer_receiver = 1.0,
-    )

Create a RFR compounded leg.

source
DiffFusion.Examples.portfolio!Function
portfolio!(
     example::OrderedDict{String,Any},
     n_swaps::Int = 10,
     n_swaptions::Int = 0,
-    )

Create a portfolio of swaps and swaptions and store it in the dictionary.

source
+ )

Create a portfolio of swaps and swaptions and store it in the dictionary.

source
diff --git a/dev/function_index/function_index/index.html b/dev/function_index/function_index/index.html index a48214b..fc84d1e 100644 --- a/dev/function_index/function_index/index.html +++ b/dev/function_index/function_index/index.html @@ -1,2 +1,2 @@ -Index · [∂F]

Index

+Index · [∂F]

Index

diff --git a/dev/index.html b/dev/index.html index 329c567..a7736ef 100644 --- a/dev/index.html +++ b/dev/index.html @@ -75,4 +75,4 @@ # Output: # 1×7×1 Array{Float64, 3}: # [:, :, 1] = -# 0.0 7.98524 9.44371 147.817 148.527 0.0 0.0

Scenario valuations are further documented in the Scenarios section.

Further Examples

The best way to become familiar with the DiffFusion framework is to have a look at the test suite.

An example for exposure simulation of a Vanilla swap portfolio is implemented in the scenario generation component test.

Individual examples on model, simulation and product setup can be found in the unit tests.

+# 0.0 7.98524 9.44371 147.817 148.527 0.0 0.0

Scenario valuations are further documented in the Scenarios section.

Further Examples

The best way to become familiar with the DiffFusion framework is to have a look at the test suite.

An example for exposure simulation of a Vanilla swap portfolio is implemented in the scenario generation component test.

Individual examples on model, simulation and product setup can be found in the unit tests.

diff --git a/dev/introduction/overview/index.html b/dev/introduction/overview/index.html index b04aeab..5fec2f3 100644 --- a/dev/introduction/overview/index.html +++ b/dev/introduction/overview/index.html @@ -1,2 +1,2 @@ -Overview · [∂F]

Overview

On this page, we give an overview of the DiffFusion.jl modelling framework.

Some features mentioned here are still under development and will be added going forward. If you want to check the status of particular features, please get in touch.

What Is the Purpose of the Framework?

Scenario-based financial instrument pricing is at the core of most risk management processes and methods. The DiffFusion.jl modelling framework provides a flexible and computationally efficient simulation and pricing engine. It contains state-of-the art model implementations for single and multi-factor models.

The framework is designed for regular large-scale portfolio simulations as well as ad-hoc and interactive pricing and risk calculation analysis. As such, the framework can be used in production processes as well for benchmarking and model validation purposes.

DiffFusion.jl is decomposed into the following components:

  • scenario generation,
  • scenario-based financial instrument pricing and sensitivity calculation, as well as
  • scenario-based risk measure calculation.

The components can be used independently. However, they develop their full potential when combined together.

Scenario Generation

Scenario generation is based on Monte Carlo simulation of risk factors. Risk factors are represented by generic model state variables. The evolution of the model state variables is based on diffusion models.

The diffusion models in the DiffFusion.jl framework represent market standard risk neutral valuation models. For details on the specific models, see the model section. A key objective of the framework is flexibility regarding the choice model. For example, you can combine multi-factor rates models for major currencies with single-factor rates models for other currencies.

Component models for e.g. interest rates, exchange rates and equities are combined into a cross-asset hybrid model. The joint evolution of the hybrid model state variables is then calculated by Monte Carlo simulation.

The Monte Carlo method in the DiffFusion.jl framework uses bias-free simulation of random variables whenever the model allows for. This approach provides flexibility on the chosen time grid and allows simulating long time-horizons without sacrificing simulation accuracy. Random numbers are drawn from efficient pseudo-random number generators or low-discrepancy sequences.

Financial Instrument Pricing and Sensitivity Calculation

Financial instruments in the DiffFusion.jl framework are represented as a layered composition of payoffs, cash flows and cash flow legs. Each layer adds a level of abstraction and common functionality. Cash flow legs are finally combined into products and portfolios.

The layered design of portfolios and products allows for a very flexible extendability of the framework for new products and feature. Exotic products can easily be integrated since payoffs and payoff-scripting are integral functionalities by design.

Portfolios and products are agnostic to the simulation model and Monte Carlo method. The link between model, simulation and market data is established via a separate entity that holds the context details. This feature also contributes to the flexibility and extendability of the framework.

Future risk-neutral prices of portfolios and products are calculated using the simulated state variables and the corresponding models. We implement analytical pricing methods whenever available and appropriate. American Monte-Carlo methods will be available for complex products.

Sensitivities of future prices can be calculated efficiently using Algorithmic Differentiation (AD) methods. AD methods are directly available in the Julia language. For more details on AD in Julia, see the Julia section.

Risk Measure Calculation

Scenario prices for portfolios and products are stored in a three-dimensional scenario cube. The axes of the cube are simulated scenarios, future observation times and individual product legs. With these data we calculate risk measures like expected exposure and potential future exposure. New risk measures can easily be added to the framework. Alternatively, scenario cubes can also be processed by client applications or directly by the user.

What Models and Products Are Covered?

The DiffFusion.jl framework covers models for interest rates, exchange rates, equities/indices, inflation, and commodity futures. All models can be combined into hybrid models for joint simulation.

Financial products are composed of cash flows. Cash flows for linear products and Vanilla options are directly available in the framework. New cash flow types can easily be added.

Component Models

We make extensive use of the Heath-Jarrow-Morton (HJM) framework for the component models. This approach yields most analytical tractability for simulation, pricing and model calibration. More complex model variants can be easily added to the framework.

Interest rates are modelled as multi-factor Gaussian HJM models. Such models allow for a rich set of simulated yield curves involving curve shifts, slopes and curvatures. The models can be calibration to the full surface of at-the-money swaptions. In its single-factor form, the model reduces to the classical Hull-White interest rate model.

Exchange rates are modelled in a classical Black-Scholes-type model. Exchange rate models are linked to the corresponding domestic and foreign interest rate models. Calibration of the models takes into account the joint evolution of exchange rates as well as corresponding interest rates.

Equities and indices are modelled analogous to exchange rates. In that context, the foreign interest rate model is replaced by a dividend yield term structure. The framework allows for a modelling of discrete dividend and dividend yields.

Inflation models are designed following the foreign currency analogy. As a consequence, inflation models are also analogous to exchange rate models. This approach covers the classical Jarrow-Yildirim three-factor model as well as the two-factor Dodgson-Kainth model. Initial inflation forward curves are direct inputs to the model. This allows for modelling seasonality.

Commodity futures are modelled following the HJM framework applied for interest rates. As a consequence, we can cover single-factor models and multi-factor models. This allows for a modelling of futures volatility term structures. Initial futures curves are direct input to the model and can incorporate commodity-specific features like seasonality patterns.

Cash Flows and Legs

The DiffFusion.jl framework already includes standard fixed income and interest rate cash flows for principal payments, fixed rates and floating rates. Options on forward-looking and backward-looking interest rates are also available.

Linear FX and cross currency instruments are covered by the interest rate cash flows and exchange rate conversion. Additional principal payments in mark-to-market cross currency swaps are handled by a specific leg type.

European and Bermudan swaptions are are also modelled as cash flow legs. For European swaptions we use analytical scenario pricers. Bermudan swaptions scenario prices are calculated by means of American Monte Carlo methods.

Further cash flow typed and leg types will be added going forward.

Why Do We Use Julia Language?

Risk factor simulation and scenario-based financial instrument pricing are computationally expensive calculations. Efficient implementation of such calculations requires fast compiled machine code, ability to parallelize and distribute calculations as well as support for high-performance computing hardware like GPU. The Julia language natively fulfils all these requirements.

Development in Julia language is lightweight and similar to languages like Python. As a result, new functionalities can easily be added within the framework or attached by client applications or user interaction.

Sensitivity calculation is critical for risk management processes. For exposure simulations, sensitivity calculations can be particularly challenging from a computational perspective. These challenges are addressed by Automatic Differentiation (AD) methods. Julia language supports forward mode and reverse mode AD via operator overloading and source transformation. We leverage these language features and provide efficient and accurate Delta and Vega calculations.

The DiffFusion.jl framework can be incorporated as package in Julia application and user code. Furthermore, the framework can be used e.g. in Jupyter notebooks, Python code and R code via Julia's interfaces to these environments.

The DiffFusion.jl framework can also run fully independent, e.g. in a Docker container. A corresponding server application is implemented in the DiffFusionServer.jl project.

Related Literature and References

+Overview · [∂F]

Overview

On this page, we give an overview of the DiffFusion.jl modelling framework.

Some features mentioned here are still under development and will be added going forward. If you want to check the status of particular features, please get in touch.

What Is the Purpose of the Framework?

Scenario-based financial instrument pricing is at the core of most risk management processes and methods. The DiffFusion.jl modelling framework provides a flexible and computationally efficient simulation and pricing engine. It contains state-of-the art model implementations for single and multi-factor models.

The framework is designed for regular large-scale portfolio simulations as well as ad-hoc and interactive pricing and risk calculation analysis. As such, the framework can be used in production processes as well for benchmarking and model validation purposes.

DiffFusion.jl is decomposed into the following components:

  • scenario generation,
  • scenario-based financial instrument pricing and sensitivity calculation, as well as
  • scenario-based risk measure calculation.

The components can be used independently. However, they develop their full potential when combined together.

Scenario Generation

Scenario generation is based on Monte Carlo simulation of risk factors. Risk factors are represented by generic model state variables. The evolution of the model state variables is based on diffusion models.

The diffusion models in the DiffFusion.jl framework represent market standard risk neutral valuation models. For details on the specific models, see the model section. A key objective of the framework is flexibility regarding the choice model. For example, you can combine multi-factor rates models for major currencies with single-factor rates models for other currencies.

Component models for e.g. interest rates, exchange rates and equities are combined into a cross-asset hybrid model. The joint evolution of the hybrid model state variables is then calculated by Monte Carlo simulation.

The Monte Carlo method in the DiffFusion.jl framework uses bias-free simulation of random variables whenever the model allows for. This approach provides flexibility on the chosen time grid and allows simulating long time-horizons without sacrificing simulation accuracy. Random numbers are drawn from efficient pseudo-random number generators or low-discrepancy sequences.

Financial Instrument Pricing and Sensitivity Calculation

Financial instruments in the DiffFusion.jl framework are represented as a layered composition of payoffs, cash flows and cash flow legs. Each layer adds a level of abstraction and common functionality. Cash flow legs are finally combined into products and portfolios.

The layered design of portfolios and products allows for a very flexible extendability of the framework for new products and feature. Exotic products can easily be integrated since payoffs and payoff-scripting are integral functionalities by design.

Portfolios and products are agnostic to the simulation model and Monte Carlo method. The link between model, simulation and market data is established via a separate entity that holds the context details. This feature also contributes to the flexibility and extendability of the framework.

Future risk-neutral prices of portfolios and products are calculated using the simulated state variables and the corresponding models. We implement analytical pricing methods whenever available and appropriate. American Monte-Carlo methods will be available for complex products.

Sensitivities of future prices can be calculated efficiently using Algorithmic Differentiation (AD) methods. AD methods are directly available in the Julia language. For more details on AD in Julia, see the Julia section.

Risk Measure Calculation

Scenario prices for portfolios and products are stored in a three-dimensional scenario cube. The axes of the cube are simulated scenarios, future observation times and individual product legs. With these data we calculate risk measures like expected exposure and potential future exposure. New risk measures can easily be added to the framework. Alternatively, scenario cubes can also be processed by client applications or directly by the user.

What Models and Products Are Covered?

The DiffFusion.jl framework covers models for interest rates, exchange rates, equities/indices, inflation, and commodity futures. All models can be combined into hybrid models for joint simulation.

Financial products are composed of cash flows. Cash flows for linear products and Vanilla options are directly available in the framework. New cash flow types can easily be added.

Component Models

We make extensive use of the Heath-Jarrow-Morton (HJM) framework for the component models. This approach yields most analytical tractability for simulation, pricing and model calibration. More complex model variants can be easily added to the framework.

Interest rates are modelled as multi-factor Gaussian HJM models. Such models allow for a rich set of simulated yield curves involving curve shifts, slopes and curvatures. The models can be calibration to the full surface of at-the-money swaptions. In its single-factor form, the model reduces to the classical Hull-White interest rate model.

Exchange rates are modelled in a classical Black-Scholes-type model. Exchange rate models are linked to the corresponding domestic and foreign interest rate models. Calibration of the models takes into account the joint evolution of exchange rates as well as corresponding interest rates.

Equities and indices are modelled analogous to exchange rates. In that context, the foreign interest rate model is replaced by a dividend yield term structure. The framework allows for a modelling of discrete dividend and dividend yields.

Inflation models are designed following the foreign currency analogy. As a consequence, inflation models are also analogous to exchange rate models. This approach covers the classical Jarrow-Yildirim three-factor model as well as the two-factor Dodgson-Kainth model. Initial inflation forward curves are direct inputs to the model. This allows for modelling seasonality.

Commodity futures are modelled following the HJM framework applied for interest rates. As a consequence, we can cover single-factor models and multi-factor models. This allows for a modelling of futures volatility term structures. Initial futures curves are direct input to the model and can incorporate commodity-specific features like seasonality patterns.

Cash Flows and Legs

The DiffFusion.jl framework already includes standard fixed income and interest rate cash flows for principal payments, fixed rates and floating rates. Options on forward-looking and backward-looking interest rates are also available.

Linear FX and cross currency instruments are covered by the interest rate cash flows and exchange rate conversion. Additional principal payments in mark-to-market cross currency swaps are handled by a specific leg type.

European and Bermudan swaptions are are also modelled as cash flow legs. For European swaptions we use analytical scenario pricers. Bermudan swaptions scenario prices are calculated by means of American Monte Carlo methods.

Further cash flow typed and leg types will be added going forward.

Why Do We Use Julia Language?

Risk factor simulation and scenario-based financial instrument pricing are computationally expensive calculations. Efficient implementation of such calculations requires fast compiled machine code, ability to parallelize and distribute calculations as well as support for high-performance computing hardware like GPU. The Julia language natively fulfils all these requirements.

Development in Julia language is lightweight and similar to languages like Python. As a result, new functionalities can easily be added within the framework or attached by client applications or user interaction.

Sensitivity calculation is critical for risk management processes. For exposure simulations, sensitivity calculations can be particularly challenging from a computational perspective. These challenges are addressed by Automatic Differentiation (AD) methods. Julia language supports forward mode and reverse mode AD via operator overloading and source transformation. We leverage these language features and provide efficient and accurate Delta and Vega calculations.

The DiffFusion.jl framework can be incorporated as package in Julia application and user code. Furthermore, the framework can be used e.g. in Jupyter notebooks, Python code and R code via Julia's interfaces to these environments.

The DiffFusion.jl framework can also run fully independent, e.g. in a Docker container. A corresponding server application is implemented in the DiffFusionServer.jl project.

Related Literature and References

diff --git a/dev/introduction/simulation_framework/index.html b/dev/introduction/simulation_framework/index.html index 15a09db..d30f519 100644 --- a/dev/introduction/simulation_framework/index.html +++ b/dev/introduction/simulation_framework/index.html @@ -207,4 +207,4 @@ H^{k}\left(s,t\right) &= H\left(s,t\right),\\ \Sigma^{k}\left(u\right)^{\top} &= H\left(u,t\right)\sigma\left(u\right)^{\top}. -\end{aligned}\]

+\end{aligned}\]

diff --git a/dev/models/asset_models/index.html b/dev/models/asset_models/index.html index 89c5cab..ce67564 100644 --- a/dev/models/asset_models/index.html +++ b/dev/models/asset_models/index.html @@ -1,24 +1,24 @@ -Asset Models (FX/Equity/Inflation) · [∂F]

Asset Models (FX/Equity/Inflation)

Asset Model Types

DiffFusion.AssetModelType
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

Lognormal Model

DiffFusion.LognormalAssetModelType
struct LognormalAssetModel <: AssetModel
+Asset Models (FX/Equity/Inflation) · [∂F]

Asset Models (FX/Equity/Inflation)

Asset Model Types

DiffFusion.AssetModelType
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

Lognormal Model

DiffFusion.LognormalAssetModelType
struct 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.

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

Create a LognormalAssetModel.

source
lognormal_asset_model(
+    )

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

CEV Model

DiffFusion.CevAssetModelType
struct CevAssetModel <: AssetModel
     alias::String
     sigma_x::BackwardFlatVolatility
     skew_x::BackwardFlatParameter
@@ -26,13 +26,13 @@
     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.

source
DiffFusion.cev_asset_modelFunction
cev_asset_model(
+end

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

source
DiffFusion.cev_asset_modelFunction
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_assetFunction
log_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).

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

Model Functions for Payoff Evaluation

DiffFusion.log_assetFunction
log_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).

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_adjustmentFunction
log_asset_convexity_adjustment(
     m::Model,
     dom_alias::String,
     for_alias::String,
@@ -41,7 +41,7 @@
     T0::ModelTime,
     T1::ModelTime,
     T2::ModelTime,
-    )

Calculate the YoY convexity adjustment term for OU models.

Returns a scalar quantity.

source
log_asset_convexity_adjustment(
+    )

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,
@@ -50,7 +50,7 @@
     T0::ModelTime,
     T1::ModelTime,
     T2::ModelTime,
-    )

Calculate the YoY convexity adjustment term for OU models.

Returns a scalar quantity.

source
log_asset_convexity_adjustment(
+    )

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,
@@ -58,34 +58,34 @@
     T0::ModelTime,
     T1::ModelTime,
     T2::ModelTime,
-    )

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

source

Additional Asset Model Functions

Additional Asset Model Functions

DiffFusion.asset_volatilityFunction
asset_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).

source
asset_volatility(
+    )

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

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(
+    )

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 a state-independent volatility function sigma(u) for the interval (s,t).

source
DiffFusion.quanto_driftFunction
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(
+    )

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_varianceFunction
asset_variance(
+    )

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

source
DiffFusion.asset_varianceFunction
asset_variance(
     m::Model,
     ast_alias::Union{String, Nothing},
     dom_alias::Union{String, Nothing},
@@ -93,7 +93,7 @@
     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(
+    )

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},
@@ -101,7 +101,7 @@
     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(
+    )

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},
@@ -109,14 +109,14 @@
     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(
+    )

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(
+    )

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
+ )

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

source
diff --git a/dev/models/credit_models/index.html b/dev/models/credit_models/index.html index 4b10f98..5f27d48 100644 --- a/dev/models/credit_models/index.html +++ b/dev/models/credit_models/index.html @@ -1,2 +1,2 @@ -Credit Spread Models · [∂F]

Credit Spread Models

Model Types

Model Functions for Simulation

+Credit Spread Models · [∂F]

Credit Spread Models

Model Types

Model Functions for Simulation

diff --git a/dev/models/cross_asset_models/index.html b/dev/models/cross_asset_models/index.html index ba2265c..888c628 100644 --- a/dev/models/cross_asset_models/index.html +++ b/dev/models/cross_asset_models/index.html @@ -3,10 +3,10 @@ models::Tuple state_alias factor_alias -model_dict::Dict{String,Int}

For concrete types, see SimpleModel and DiagonalModel.

source
DiffFusion.SimpleModelType
struct SimpleModel <: Model
+model_dict::Dict{String,Int}

For concrete types, see SimpleModel and DiagonalModel.

source
DiffFusion.SimpleModelType
struct SimpleModel <: Model
     alias::String
     models::Tuple
     state_alias
     factor_alias
     model_dict::Dict{String,Int}
-end

A SimpleModel represents a collection of (coupled) state-independent component models.

It is supposed to be used with a simple_simulation() method.

source
DiffFusion.simple_modelFunction

simple_model(alias::String, models::AbstractVector)

Create a SimpleModel.

source
DiffFusion.DiagonalModelType

DiagonalModel represents a collection of (coupled) component models. For the component models we assume that the models are either state-independent models or diagonal models in the sense that the correlation matrix is state-independent.

For state-independent models we avoid repeated Theta and Sigma calculation.

The model is used as a hybrid model for simulation and payoff evaluation.

source
DiffFusion.diagonal_modelFunction
diagonal_model(alias::String, models::AbstractVector)

Create a DiagonalModel.

source
+end

A SimpleModel represents a collection of (coupled) state-independent component models.

It is supposed to be used with a simple_simulation() method.

source
DiffFusion.simple_modelFunction

simple_model(alias::String, models::AbstractVector)

Create a SimpleModel.

source
DiffFusion.DiagonalModelType

DiagonalModel represents a collection of (coupled) component models. For the component models we assume that the models are either state-independent models or diagonal models in the sense that the correlation matrix is state-independent.

For state-independent models we avoid repeated Theta and Sigma calculation.

The model is used as a hybrid model for simulation and payoff evaluation.

source
DiffFusion.diagonal_modelFunction
diagonal_model(alias::String, models::AbstractVector)

Create a DiagonalModel.

source
diff --git a/dev/models/futures_models/index.html b/dev/models/futures_models/index.html index 7fbfb87..ad02f73 100644 --- a/dev/models/futures_models/index.html +++ b/dev/models/futures_models/index.html @@ -1,7 +1,7 @@ Future Price Models · [∂F]

Future Price Models

Future Price Model Types

DiffFusion.MarkovFutureModelType
struct MarkovFutureModel <: SeparableHjmModel
     hjm_model::GaussianHjmModel
-end

A Markov model for Future prices with piece-wise constant benchmark price volatility and constant mean reversion.

We implement an object adapter for the GaussianHjmModel to re-use implementation for common modelling parts.

The MarkovFutureModel differs from the GaussianHjmModel essentially only by the drift Theta.

Moreover, we do not require the integrated state variable and want to identify correlations with Future prices instead of forward rates.

source
DiffFusion.markov_future_modelFunction
markov_future_model(
+end

A Markov model for Future prices with piece-wise constant benchmark price volatility and constant mean reversion.

We implement an object adapter for the GaussianHjmModel to re-use implementation for common modelling parts.

The MarkovFutureModel differs from the GaussianHjmModel essentially only by the drift Theta.

Moreover, we do not require the integrated state variable and want to identify correlations with Future prices instead of forward rates.

source
DiffFusion.markov_future_modelFunction
markov_future_model(
     alias::String,
     delta::ParameterTermstructure,
     chi::ParameterTermstructure,
@@ -9,4 +9,4 @@
     correlation_holder::Union{CorrelationHolder, Nothing},
     quanto_model::Union{AssetModel, Nothing},
     scaling_type::BenchmarkTimesScaling = ForwardRateScaling,
-    )

Create a Gausian Markov model for Future prices.

source

Model Functions for Payoff Evaluation

DiffFusion.log_futureFunction
log_future(m::Model, alias::String, t::ModelTime, T::ModelTime, X::ModelState)

Calculate the Future price term h(t,T)'[x(t) + 0.5y(t)(1 - h(t,T))].

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

Calculate the Future price term h(t,T)'[x(t) + 0.5y(t)(1 - h(t,T))].

source
log_future(m::MarkovFutureModel, alias::String, t::ModelTime, T::ModelTime, X::ModelState)

Calculate the Future price term (h(t,T)'[x(t) + 0.5y(t)(1 - h(t,T))])'.

source
+ )

Create a Gausian Markov model for Future prices.

source

Model Functions for Payoff Evaluation

DiffFusion.log_futureFunction
log_future(m::Model, alias::String, t::ModelTime, T::ModelTime, X::ModelState)

Calculate the Future price term h(t,T)'[x(t) + 0.5y(t)(1 - h(t,T))].

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

Calculate the Future price term h(t,T)'[x(t) + 0.5y(t)(1 - h(t,T))].

source
log_future(m::MarkovFutureModel, alias::String, t::ModelTime, T::ModelTime, X::ModelState)

Calculate the Future price term (h(t,T)'[x(t) + 0.5y(t)(1 - h(t,T))])'.

source
diff --git a/dev/models/models/index.html b/dev/models/models/index.html index 63c7026..32edbfb 100644 --- a/dev/models/models/index.html +++ b/dev/models/models/index.html @@ -1,188 +1,188 @@ -Common Model Functions · [∂F]

Common Model Functions

Abstract Model Types

DiffFusion.ModelType
abstract type Model end

An abstract base model type. This type covers component models and hybrid composite models.

source
DiffFusion.ComponentModelType
abstract type ComponentModel <: Model end

An abstract component model type. This type implements the common interface of all component models.

source

State Variable

A model allows to simulate a stochastic process $\left(X_t\right)$. For a given $t$ the vector $X_t$ is represented by a ModelState.

DiffFusion.ModelStateType
struct ModelState
+Common Model Functions · [∂F]

Common Model Functions

Abstract Model Types

DiffFusion.ModelType
abstract type Model end

An abstract base model type. This type covers component models and hybrid composite models.

source
DiffFusion.ComponentModelType
abstract type ComponentModel <: Model end

An abstract component model type. This type implements the common interface of all component models.

source

State Variable

A model allows to simulate a stochastic process $\left(X_t\right)$. For a given $t$ the vector $X_t$ is represented by a ModelState.

DiffFusion.ModelStateType
struct ModelState
     X::AbstractMatrix
     idx::Dict{String,Int}
-end

A ModelState is a matrix of state variables decorated by a dictionary of alias strings and optional additional parameters.

It allows to decouple simulation of state variables and usage of state variables.

X is of size (n, p) where n represents the number of state aliases and p represents the number of paths. A matrix with a large number of paths is typically used when calling model functions for payoff evaluation.

A single realisation of risk factors is represented by an (n, 1) matrix. We use (n,1) matrix instead of (n,) vector to avoid size-dependent switches.

idx is a dictionary with n entries. Keys represent state state alias entries and values represent the corresponding positions in X.

params is a struct or dictionary that holds additional pre-calculated state-independent data which is used in subsequent Theta and Sigma calculations. This aims at avoiding duplicate calculations for state-dependent Theta and Sigma calculations. The params is supposed to be calculated by method simulation_parameters(...).

source
DiffFusion.model_stateFunction
model_state(X::AbstractMatrix, idx::Dict{String,Int})

Create a ModelState object and make sure it is consistent.

source
model_state(X::AbstractMatrix, m::Model, params = nothing)

Create a model state for a given model.

source

Auxilliary Methods

DiffFusion.aliasMethod
alias(m::Model)

Return the model's own alias. This is the default implementation.

source
DiffFusion.model_aliasFunction
model_alias(m::Model)

Return the aliases modelled by a model.

Typically, this coincides with the model's own alias. For composite models this is a list of component model aliases.

source
model_alias(m::CompositeModel)

Return the aliases modelled by a model.

Typical this coincides with the model's own alias. For composite models this is a list of component model aliases.

source
DiffFusion.factor_aliasFunction
factor_alias(m::Model)

Return a list of risk factor alias strings that represent the components of the multi-variate Brownian motion risk factors.

source
DiffFusion.parameter_gridFunction
parameter_grid(m::Model)

Return a list of times representing the (joint) grid points of piece-wise constant model parameters.

This method is intended to be used in conjunction with time-integration mehods that require smooth integrand functions.

source
parameter_grid(models::AbstractVector)

Return a list of times representing the (joint) grid points of piece-wise constant model parameters.

This method is intended to be used in conjunction with time-integration mehods that require smooth integrand functions.

source
parameter_grid(m::CevAssetModel)

Return a list of times representing the (joint) grid points of piece-wise constant model parameters.

This method is intended to be used in conjunction with time-integration mehods that require smooth integrand functions.

source
parameter_grid(m::LognormalAssetModel)

Return a list of times representing the (joint) grid points of piece-wise constant model parameters.

This method is intended to be used in conjunction with time-integration mehods that require smooth integrand functions.

source
parameter_grid(m::CompositeModel)

Return a list of times representing the (joint) grid points of piece-wise constant model parameters.

This method is intended to be used in conjunction with time-integration mehods that require smooth integrand functions.

source
parameter_grid(m::GaussianHjmModel)

Return a list of times representing the (joint) grid points of piece-wise constant model parameters.

This method is intended to be used in conjunction with time-integration mehods that require smooth integrand functions.

source
parameter_grid(m::MarkovFutureModel)

Return a list of times representing the (joint) grid points of piece-wise constant model parameters.

This method is intended to be used in conjunction with time-integration mehods that require smooth integrand functions.

source

Model Functions for Simulation

DiffFusion.ThetaFunction
Theta(
+end

A ModelState is a matrix of state variables decorated by a dictionary of alias strings and optional additional parameters.

It allows to decouple simulation of state variables and usage of state variables.

X is of size (n, p) where n represents the number of state aliases and p represents the number of paths. A matrix with a large number of paths is typically used when calling model functions for payoff evaluation.

A single realisation of risk factors is represented by an (n, 1) matrix. We use (n,1) matrix instead of (n,) vector to avoid size-dependent switches.

idx is a dictionary with n entries. Keys represent state state alias entries and values represent the corresponding positions in X.

params is a struct or dictionary that holds additional pre-calculated state-independent data which is used in subsequent Theta and Sigma calculations. This aims at avoiding duplicate calculations for state-dependent Theta and Sigma calculations. The params is supposed to be calculated by method simulation_parameters(...).

source
DiffFusion.model_stateFunction
model_state(X::AbstractMatrix, idx::Dict{String,Int})

Create a ModelState object and make sure it is consistent.

source
model_state(X::AbstractMatrix, m::Model, params = nothing)

Create a model state for a given model.

source

Auxilliary Methods

DiffFusion.aliasMethod
alias(m::Model)

Return the model's own alias. This is the default implementation.

source
DiffFusion.model_aliasFunction
model_alias(m::Model)

Return the aliases modelled by a model.

Typically, this coincides with the model's own alias. For composite models this is a list of component model aliases.

source
model_alias(m::CompositeModel)

Return the aliases modelled by a model.

Typical this coincides with the model's own alias. For composite models this is a list of component model aliases.

source
DiffFusion.factor_aliasFunction
factor_alias(m::Model)

Return a list of risk factor alias strings that represent the components of the multi-variate Brownian motion risk factors.

source
DiffFusion.parameter_gridFunction
parameter_grid(m::Model)

Return a list of times representing the (joint) grid points of piece-wise constant model parameters.

This method is intended to be used in conjunction with time-integration mehods that require smooth integrand functions.

source
parameter_grid(models::AbstractVector)

Return a list of times representing the (joint) grid points of piece-wise constant model parameters.

This method is intended to be used in conjunction with time-integration mehods that require smooth integrand functions.

source
parameter_grid(m::CevAssetModel)

Return a list of times representing the (joint) grid points of piece-wise constant model parameters.

This method is intended to be used in conjunction with time-integration mehods that require smooth integrand functions.

source
parameter_grid(m::LognormalAssetModel)

Return a list of times representing the (joint) grid points of piece-wise constant model parameters.

This method is intended to be used in conjunction with time-integration mehods that require smooth integrand functions.

source
parameter_grid(m::CompositeModel)

Return a list of times representing the (joint) grid points of piece-wise constant model parameters.

This method is intended to be used in conjunction with time-integration mehods that require smooth integrand functions.

source
parameter_grid(m::GaussianHjmModel)

Return a list of times representing the (joint) grid points of piece-wise constant model parameters.

This method is intended to be used in conjunction with time-integration mehods that require smooth integrand functions.

source
parameter_grid(m::MarkovFutureModel)

Return a list of times representing the (joint) grid points of piece-wise constant model parameters.

This method is intended to be used in conjunction with time-integration mehods that require smooth integrand functions.

source

Model Functions for Simulation

DiffFusion.ThetaFunction
Theta(
     m::Model,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return the deterministic drift component for simulation over the time period [s, t]. If Theta is state-dependent a state vector X must be supplied. The method returns a vector of length(state_alias).

source
Theta(
+    )

Return the deterministic drift component for simulation over the time period [s, t]. If Theta is state-dependent a state vector X must be supplied. The method returns a vector of length(state_alias).

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

Return the deterministic drift component for simulation over the time period [s, t].

source
Theta(
+    )

Return the deterministic drift component for simulation over the time period [s, t].

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

Return the deterministic drift component for simulation over the time period [s, t].

source
Theta(
+    )

Return the deterministic drift component for simulation over the time period [s, t].

source
Theta(
     m::CoxIngersollRossModel,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return the deterministic drift component for simulation over the time period [s, t].

source
Theta(
+    )

Return the deterministic drift component for simulation over the time period [s, t].

source
Theta(
     m::SimpleModel,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return the deterministic drift component for simulation over the time period [s, t].

source
Theta(
+    )

Return the deterministic drift component for simulation over the time period [s, t].

source
Theta(
     m::DiagonalModel,
     s::ModelTime,
     t::ModelTime,
     X::ModelState,
-    )

Return the deterministic drift component for simulation over the time period [s, t].

source
Theta(
+    )

Return the deterministic drift component for simulation over the time period [s, t].

source
Theta(
     m::GaussianHjmModel,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return the deterministic drift component for simulation over the time period [s, t]. If Theta is state-dependent a state vector X must be supplied. The method returns a vector of length(state_alias).

source
Theta(
+    )

Return the deterministic drift component for simulation over the time period [s, t]. If Theta is state-dependent a state vector X must be supplied. The method returns a vector of length(state_alias).

source
Theta(
     m::MarkovFutureModel,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return the deterministic drift component for simulation over the time period [s, t]. If Theta is state-dependent a state vector X must be supplied. The method returns a vector of length(state_alias).

source
DiffFusion.H_TFunction
H_T(
+    )

Return the deterministic drift component for simulation over the time period [s, t]. If Theta is state-dependent a state vector X must be supplied. The method returns a vector of length(state_alias).

source
DiffFusion.H_TFunction
H_T(
     m::Model,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return the transposed of the convection matrix H for simulation over the time period [s, t]. If H is state-dependent a state vector X must be supplied. We use the transposed of H to

  • allow for efficient sparse CSC matrix insertion and
  • allow for efficient multiplication X' * H' = (H * X)'.

The state vector X may effectively be a subset of all states. To accommodate this, we use a dedicated list of state aliases state_alias_H for the result matrix. The method returns a (sparse) matrix of size (length(state_alias_H), length(state_alias)).

source
H_T(
+    )

Return the transposed of the convection matrix H for simulation over the time period [s, t]. If H is state-dependent a state vector X must be supplied. We use the transposed of H to

  • allow for efficient sparse CSC matrix insertion and
  • allow for efficient multiplication X' * H' = (H * X)'.

The state vector X may effectively be a subset of all states. To accommodate this, we use a dedicated list of state aliases state_alias_H for the result matrix. The method returns a (sparse) matrix of size (length(state_alias_H), length(state_alias)).

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

Return the transposed of the convection matrix H for simulation over the time period [s, t].

source
H_T(
+    )

Return the transposed of the convection matrix H for simulation over the time period [s, t].

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

Return the transposed of the convection matrix H for simulation over the time period [s, t].

source
H_T(
+    )

Return the transposed of the convection matrix H for simulation over the time period [s, t].

source
H_T(
     m::CoxIngersollRossModel,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return the transposed of the convection matrix H for simulation over the time period [s, t].

There is no benefit in allowing HT to be state-dependent. If HT would need to be state-dependent then it should be incorporated into Theta.

source
H_T(
+    )

Return the transposed of the convection matrix H for simulation over the time period [s, t].

There is no benefit in allowing HT to be state-dependent. If HT would need to be state-dependent then it should be incorporated into Theta.

source
H_T(
     m::SimpleModel,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return the transposed of the convection matrix H for simulation over the time period [s, t].

source
H_T(
+    )

Return the transposed of the convection matrix H for simulation over the time period [s, t].

source
H_T(
     m::DiagonalModel,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return the transposed of the convection matrix H for simulation over the time period [s, t].

source
H_T(
+    )

Return the transposed of the convection matrix H for simulation over the time period [s, t].

source
H_T(
     m::GaussianHjmModel,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return the transposed of the convection matrix H for simulation over the time period [s, t].

source
H_T(
+    )

Return the transposed of the convection matrix H for simulation over the time period [s, t].

source
H_T(
     m::MarkovFutureModel,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return the transposed of the convection matrix H for simulation over the time period [s, t].

source
DiffFusion.Sigma_TFunction
Sigma_T(
+    )

Return the transposed of the convection matrix H for simulation over the time period [s, t].

source
DiffFusion.Sigma_TFunction
Sigma_T(
     m::Model,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return a matrix-valued function representing the volatility matrix function.

The signature of the resulting function is (u::ModelTime). Here, u represents the observation time.

The state vector is required if Sigma(u) depends on X_s.

The result of an evaluation of Sigma_T(...)(u) is a matrix of size (length(state_alias), length(factor_alias_Sigma)).

The Brownian motion relevant for a model may effectively be a subset of all Brownian motions. To accommodate this, we use a dedicated list of factor aliases factor_alias_Sigma for the size of the result matrix of a function evaluation.

The transposed '_T' is convention to simplify notation for covariance calculation.

source
Sigma_T(
+    )

Return a matrix-valued function representing the volatility matrix function.

The signature of the resulting function is (u::ModelTime). Here, u represents the observation time.

The state vector is required if Sigma(u) depends on X_s.

The result of an evaluation of Sigma_T(...)(u) is a matrix of size (length(state_alias), length(factor_alias_Sigma)).

The Brownian motion relevant for a model may effectively be a subset of all Brownian motions. To accommodate this, we use a dedicated list of factor aliases factor_alias_Sigma for the size of the result matrix of a function evaluation.

The transposed '_T' is convention to simplify notation for covariance calculation.

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

Return a matrix-valued function representing the volatility matrix function.

The signature of the resulting function is (u::ModelTime). Here, u represents the observation time.

source
Sigma_T(
+    )

Return a matrix-valued function representing the volatility matrix function.

The signature of the resulting function is (u::ModelTime). Here, u represents the observation time.

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

Return a matrix-valued function representing the volatility matrix function.

The signature of the resulting function is (u::ModelTime). Here, u represents the observation time.

source
Sigma_T(
+    )

Return a matrix-valued function representing the volatility matrix function.

The signature of the resulting function is (u::ModelTime). Here, u represents the observation time.

source
Sigma_T(
     m::CoxIngersollRossModel,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return a matrix-valued function representing the volatility matrix function.

source
Sigma_T(
+    )

Return a matrix-valued function representing the volatility matrix function.

source
Sigma_T(
     m::SimpleModel,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return a matrix-valued function representing the volatility matrix function.

The signature of the resulting function is (u::ModelTime). Here, u represents the observation time.

source
Sigma_T(
+    )

Return a matrix-valued function representing the volatility matrix function.

The signature of the resulting function is (u::ModelTime). Here, u represents the observation time.

source
Sigma_T(
     m::DiagonalModel,
     s::ModelTime,
     t::ModelTime,
     X::ModelState,
-    )

Return a matrix-valued function representing the volatility matrix function.

The signature of the resulting function is (u::ModelTime). Here, u represents the observation time.

source
Sigma_T(
+    )

Return a matrix-valued function representing the volatility matrix function.

The signature of the resulting function is (u::ModelTime). Here, u represents the observation time.

source
Sigma_T(
     m::GaussianHjmModel,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return a matrix-valued function representing the volatility matrix function.

source
Sigma_T(
+    )

Return a matrix-valued function representing the volatility matrix function.

source
Sigma_T(
     m::MarkovFutureModel,
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Return a matrix-valued function representing the volatility matrix function.

source
DiffFusion.state_dependent_ThetaFunction
state_dependent_Theta(m::Model)

Return whether Theta requires a state vector input X.

source
state_dependent_Theta(m::CevAssetModel)

Return whether Theta requires a state vector input X.

source
state_dependent_Theta(m::LognormalAssetModel)

Return whether Theta requires a state vector input X.

source

Return whether Theta requires a state vector input X.

source
state_dependent_Theta(m::CompositeModel)

Return whether Theta requires a state vector input X.

source
state_dependent_Theta(m::GaussianHjmModel)

Return whether Theta requires a state vector input X.

source
state_dependent_Theta(m::MarkovFutureModel)

Return whether Theta requires a state vector input X.

source
DiffFusion.state_dependent_HFunction
state_dependent_H(m::Model)

Return whether H requires a state vector input X.

source
state_dependent_H(m::CevAssetModel)

Return whether H requires a state vector input X.

source
state_dependent_H(m::LognormalAssetModel)

Return whether H requires a state vector input X.

source

Return whether H requires a state vector input X.

source
state_dependent_H(m::CompositeModel)

Return whether H requires a state vector input X.

source
state_dependent_H(m::GaussianHjmModel)

Return whether H requires a state vector input X.

source
state_dependent_H(m::MarkovFutureModel)

Return whether H requires a state vector input X.

source
DiffFusion.state_dependent_SigmaFunction
state_dependent_Sigma(m::Model)

Return whether Sigma requires a state vector input X.

source
state_dependent_Sigma(m::CevAssetModel)

Return whether Sigma requires a state vector input X.

source
state_dependent_Sigma(m::LognormalAssetModel)

Return whether Sigma requires a state vector input X.

source

Return whether Sigma requires a state vector input X.

source
state_dependent_Sigma(m::CompositeModel)

Return whether Sigma requires a state vector input X.

source
state_dependent_Sigma(m::GaussianHjmModel)

Return whether Sigma requires a state vector input X.

source
state_dependent_Sigma(m::MarkovFutureModel)

Return whether Sigma requires a state vector input X.

source
DiffFusion.state_alias_HFunction
state_alias_H(m::Model)

Return a list of state alias strings required for (H * X) calculation.

source
state_alias_H(m::CevAssetModel)

Return a list of state alias strings required for (H * X) calculation.

source
state_alias_H(m::LognormalAssetModel)

Return a list of state alias strings required for (H * X) calculation.

source

Return a list of state alias strings required for (H * X) calculation.

source
state_alias_H(m::CompositeModel)

Return a list of state alias strings required for (H * X) calculation.

source
state_alias_H(m::GaussianHjmModel)

Return a list of state alias strings required for (H * X) calculation.

source
state_alias_H(m::MarkovFutureModel)

Return a list of state alias strings required for (H * X) calculation.

source
DiffFusion.factor_alias_SigmaFunction
factor_alias_Sigma(m::Model)

Return a list of factor alias strings required for (Sigma(u)' Gamma Sigma(u)) calculation.

source
factor_alias_Sigma(m::CevAssetModel)

Return a list of factor alias strings required for (Sigma(u)^T Gamma Sigma(u)) calculation.

source
factor_alias_Sigma(m::LognormalAssetModel)

Return a list of factor alias strings required for (Sigma(u)^T Gamma Sigma(u)) calculation.

source

Return a list of factor alias strings required for (Sigma(u)^T Gamma Sigma(u)) calculation.

source
factor_alias_Sigma(m::CompositeModel)

Return a list of factor alias strings required for (Sigma(u)^T Gamma Sigma(u)) calculation.

source
factor_alias_Sigma(m::GaussianHjmModel)

Return a list of factor alias strings required for (Sigma(u)^T Gamma Sigma(u)) calculation.

source
factor_alias_Sigma(m::MarkovFutureModel)

Return a list of factor alias strings required for (Sigma(u)^T Gamma Sigma(u)) calculation.

source
DiffFusion.state_dependent_ThetaFunction
state_dependent_Theta(m::Model)

Return whether Theta requires a state vector input X.

source
state_dependent_Theta(m::CevAssetModel)

Return whether Theta requires a state vector input X.

source
state_dependent_Theta(m::LognormalAssetModel)

Return whether Theta requires a state vector input X.

source

Return whether Theta requires a state vector input X.

source
state_dependent_Theta(m::CompositeModel)

Return whether Theta requires a state vector input X.

source
state_dependent_Theta(m::GaussianHjmModel)

Return whether Theta requires a state vector input X.

source
state_dependent_Theta(m::MarkovFutureModel)

Return whether Theta requires a state vector input X.

source
DiffFusion.state_dependent_HFunction
state_dependent_H(m::Model)

Return whether H requires a state vector input X.

source
state_dependent_H(m::CevAssetModel)

Return whether H requires a state vector input X.

source
state_dependent_H(m::LognormalAssetModel)

Return whether H requires a state vector input X.

source

Return whether H requires a state vector input X.

source
state_dependent_H(m::CompositeModel)

Return whether H requires a state vector input X.

source
state_dependent_H(m::GaussianHjmModel)

Return whether H requires a state vector input X.

source
state_dependent_H(m::MarkovFutureModel)

Return whether H requires a state vector input X.

source
DiffFusion.state_dependent_SigmaFunction
state_dependent_Sigma(m::Model)

Return whether Sigma requires a state vector input X.

source
state_dependent_Sigma(m::CevAssetModel)

Return whether Sigma requires a state vector input X.

source
state_dependent_Sigma(m::LognormalAssetModel)

Return whether Sigma requires a state vector input X.

source

Return whether Sigma requires a state vector input X.

source
state_dependent_Sigma(m::CompositeModel)

Return whether Sigma requires a state vector input X.

source
state_dependent_Sigma(m::GaussianHjmModel)

Return whether Sigma requires a state vector input X.

source
state_dependent_Sigma(m::MarkovFutureModel)

Return whether Sigma requires a state vector input X.

source
DiffFusion.state_alias_HFunction
state_alias_H(m::Model)

Return a list of state alias strings required for (H * X) calculation.

source
state_alias_H(m::CevAssetModel)

Return a list of state alias strings required for (H * X) calculation.

source
state_alias_H(m::LognormalAssetModel)

Return a list of state alias strings required for (H * X) calculation.

source

Return a list of state alias strings required for (H * X) calculation.

source
state_alias_H(m::CompositeModel)

Return a list of state alias strings required for (H * X) calculation.

source
state_alias_H(m::GaussianHjmModel)

Return a list of state alias strings required for (H * X) calculation.

source
state_alias_H(m::MarkovFutureModel)

Return a list of state alias strings required for (H * X) calculation.

source
DiffFusion.factor_alias_SigmaFunction
factor_alias_Sigma(m::Model)

Return a list of factor alias strings required for (Sigma(u)' Gamma Sigma(u)) calculation.

source
factor_alias_Sigma(m::CevAssetModel)

Return a list of factor alias strings required for (Sigma(u)^T Gamma Sigma(u)) calculation.

source
factor_alias_Sigma(m::LognormalAssetModel)

Return a list of factor alias strings required for (Sigma(u)^T Gamma Sigma(u)) calculation.

source

Return a list of factor alias strings required for (Sigma(u)^T Gamma Sigma(u)) calculation.

source
factor_alias_Sigma(m::CompositeModel)

Return a list of factor alias strings required for (Sigma(u)^T Gamma Sigma(u)) calculation.

source
factor_alias_Sigma(m::GaussianHjmModel)

Return a list of factor alias strings required for (Sigma(u)^T Gamma Sigma(u)) calculation.

source
factor_alias_Sigma(m::MarkovFutureModel)

Return a list of factor alias strings required for (Sigma(u)^T Gamma Sigma(u)) calculation.

source
DiffFusion.covarianceFunction
covariance(
     m::Model,
     ch::Union{CorrelationHolder, Nothing},
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
-    )

Calculate the covariance matrix over a time interval.

source
DiffFusion.volatility_and_correlationFunction
volatility_and_correlation(
     m::Model,
     ch::Union{CorrelationHolder, Nothing},
     s::ModelTime,
     t::ModelTime,
     X::Union{ModelState, Nothing} = nothing,
     vol_eps::ModelValue = 1.0e-8,  # avoid division by zero
-    )

Calculate the volatility vector and correlation matrix over a time interval.

source
DiffFusion.simulation_parametersFunction
simulation_parameters(
     m::Model,
     ch::Union{CorrelationHolder, Nothing},
     s::ModelTime,
     t::ModelTime,
-    )

Pre-calculate parameters that are used in state-dependent Theta and Sigma calculation.

source
simulation_parameters(
+    )

Pre-calculate parameters that are used in state-dependent Theta and Sigma calculation.

source
simulation_parameters(
     m::CevAssetModel,
     ch::Union{CorrelationHolder, Nothing},
     s::ModelTime,
     t::ModelTime,
-    )

Pre-calculate parameters that are used in state-dependent Theta and Sigma calculation.

source
simulation_parameters(
+    )

Pre-calculate parameters that are used in state-dependent Theta and Sigma calculation.

source
simulation_parameters(
     m::GaussianHjmModel,
     ch::Union{CorrelationHolder, Nothing},
     s::ModelTime,
     t::ModelTime,
-    )

Pre-calculate parameters that are used in state-dependent Theta and Sigma calculation.

For LognormalAssetModel there are no valuations that should be cached.

source
simulation_parameters(
+    )

Pre-calculate parameters that are used in state-dependent Theta and Sigma calculation.

For LognormalAssetModel there are no valuations that should be cached.

source
simulation_parameters(
     m::CevAssetModel,
     ch::Union{CorrelationHolder, Nothing},
     s::ModelTime,
     t::ModelTime,
-    )

Pre-calculate parameters that are used in state-dependent Theta and Sigma calculation.

source
simulation_parameters(
+    )

Pre-calculate parameters that are used in state-dependent Theta and Sigma calculation.

source
simulation_parameters(
     m::DiagonalModel,
     ch::Union{CorrelationHolder, Nothing},
     s::ModelTime,
     t::ModelTime,
-    )

Pre-calculate parameters that are used in state-dependent Theta and Sigma calculation.

source
simulation_parameters(
+    )

Pre-calculate parameters that are used in state-dependent Theta and Sigma calculation.

source
simulation_parameters(
     m::GaussianHjmModel,
     ch::Union{CorrelationHolder, Nothing},
     s::ModelTime,
     t::ModelTime,
-    )

Pre-calculate parameters that are used in state-dependent Theta and Sigma calculation.

For GaussianHjmModel there are no valuations that should be cached.

source
DiffFusion.diagonal_volatilityFunction
diagonal_volatility(
+    )

Pre-calculate parameters that are used in state-dependent Theta and Sigma calculation.

For GaussianHjmModel there are no valuations that should be cached.

source
DiffFusion.diagonal_volatilityFunction
diagonal_volatility(
     m::Model,
     s::ModelTime,
     t::ModelTime,
     X::ModelState,
-    )

Calculate the path-dependent volatilities for a given model.

X is supposed to hold a state matrix of size (n, p). Here, n is length(state_alias(m)) and p is the number of paths.

The method returns a matrix of size (n, p).

source
diagonal_volatility(
+    )

Calculate the path-dependent volatilities for a given model.

X is supposed to hold a state matrix of size (n, p). Here, n is length(state_alias(m)) and p is the number of paths.

The method returns a matrix of size (n, p).

source
diagonal_volatility(
     m::CevAssetModel,
     s::ModelTime,
     t::ModelTime,
     X::ModelState,
-    )

Calculate the path-dependent volatilities for CevAssetModel.

X is supposed to hold a state matrix of size (n, p). Here, n is length(state_alias(m)) and p is the number of paths.

The method returns a matrix of size (n, p).

source
diagonal_volatility(
+    )

Calculate the path-dependent volatilities for CevAssetModel.

X is supposed to hold a state matrix of size (n, p). Here, n is length(state_alias(m)) and p is the number of paths.

The method returns a matrix of size (n, p).

source
diagonal_volatility(
     m::CoxIngersollRossModel,
     s::ModelTime,
     t::ModelTime,
     X::ModelState,
-    )

Calculate the path-dependent volatilities for CoxIngersollRossModel.

X is supposed to hold a state matrix of size (n, p). Here, n is length(state_alias(m)) and p is the number of paths.

The method returns a matrix of size (n, p).

source
diagonal_volatility(
+    )

Calculate the path-dependent volatilities for CoxIngersollRossModel.

X is supposed to hold a state matrix of size (n, p). Here, n is length(state_alias(m)) and p is the number of paths.

The method returns a matrix of size (n, p).

source
diagonal_volatility(
     m::DiagonalModel,
     s::ModelTime,
     t::ModelTime,
     X::ModelState,
-    )

Calculate the path-dependent volatilities for a given model.

X is supposed to hold a state matrix of size (n, p). Here, n is length(state_alias(m)) and p is the number of paths.

The method returns a matrix of size (n, p).

source
+ )

Calculate the path-dependent volatilities for a given model.

X is supposed to hold a state matrix of size (n, p). Here, n is length(state_alias(m)) and p is the number of paths.

The method returns a matrix of size (n, p).

source
diff --git a/dev/models/rates_models/index.html b/dev/models/rates_models/index.html index 81ce4bf..de919eb 100644 --- a/dev/models/rates_models/index.html +++ b/dev/models/rates_models/index.html @@ -1,5 +1,5 @@ -Interest Rates Models · [∂F]

Interest Rates Models

Model Types

DiffFusion.SeparableHjmModelType
abstract type SeparableHjmModel <: ComponentModel end

An abstract type for separable HJM models.

This type covers common functions for Gaussian and Quasi-Gaussian models.

The SeparableHjmModel is supposed to hold a constant vector-valued ParameterTermstructure for mean reversion chi and benchmark rate times delta.

source
DiffFusion.GaussianHjmModelType
struct GaussianHjmModel <: SeparableHjmModel
+Interest Rates Models · [∂F]

Interest Rates Models

Model Types

DiffFusion.SeparableHjmModelType
abstract type SeparableHjmModel <: ComponentModel end

An abstract type for separable HJM models.

This type covers common functions for Gaussian and Quasi-Gaussian models.

The SeparableHjmModel is supposed to hold a constant vector-valued ParameterTermstructure for mean reversion chi and benchmark rate times delta.

source
DiffFusion.GaussianHjmModelType
struct GaussianHjmModel <: SeparableHjmModel
     alias::String
     delta::ParameterTermstructure
     chi::ParameterTermstructure
@@ -10,7 +10,7 @@
     correlation_holder::Union{CorrelationHolder, Nothing}
     quanto_model::Union{AssetModel, Nothing}
     scaling_type::BenchmarkTimesScaling
-end

A Gaussian HJM model with piece-wise constant benchmark rate volatility and constant mean reversion.

source
DiffFusion.gaussian_hjm_modelFunction
gaussian_hjm_model(
     alias::String,
     delta::ParameterTermstructure,
     chi::ParameterTermstructure,
@@ -18,22 +18,22 @@
     correlation_holder::Union{CorrelationHolder, Nothing},
     quanto_model::Union{AssetModel, Nothing},
     scaling_type::BenchmarkTimesScaling = ForwardRateScaling,
-    )

Create a Gausian HJM model.

source

Model Functions for Simulation

Model Functions for Simulation

DiffFusion.func_yFunction
func_y(
     y0::AbstractMatrix,
     chi::AbstractVector,
     sigmaT::AbstractMatrix,
     s::ModelTime,
     t::ModelTime,
-    )

Calculate variance/auxiliary state variable $y(t)$ given $y(s)=y_0$.

In this function we assume that sigma is constant over the time interval $(s,t)$.

source
func_y(m::GaussianHjmModel, t::ModelTime)

Calculate variance/auxiliary state variable y(t).

source
DiffFusion.chi_hjmFunction
chi_hjm(m::SeparableHjmModel)

Return vector of constant mean reversion rates.

source
chi_hjm(m::MarkovFutureModel)

Return vector of constant mean reversion rates.

source
DiffFusion.benchmark_timesFunction
benchmark_times(m::SeparableHjmModel)

Return vector of reference/benchmark times

source
benchmark_times(m::MarkovFutureModel)

Return vector of reference/benchmark times

source
DiffFusion.H_hjmFunction
H_hjm(chi::AbstractVector, s::ModelTime, t::ModelTime)

Diagonal entries of $H(s,t)$.

source
H_hjm(m::SeparableHjmModel, s::ModelTime, t::ModelTime)

Diagonal entries of $H(s,t)$.

source
DiffFusion.G_hjmFunction
G_hjm(chi::AbstractVector, s::ModelTime, t::ModelTime)

Vector function $G(s,t)$.

source
G_hjm(m::SeparableHjmModel, s::ModelTime, t::ModelTime)

Vector function $G(s,t)$.

source
G_hjm(chi::AbstractVector, s::ModelTime, T::AbstractVector)

Vector function $G(s,t)$ as matrix of size (d,k) where k = length(T)

source
G_hjm(m::SeparableHjmModel, s::ModelTime, T::AbstractVector)

Vector function $G(s,t)$.

source
DiffFusion.BenchmarkTimesScalingType
@enum(
+    )

Calculate variance/auxiliary state variable $y(t)$ given $y(s)=y_0$.

In this function we assume that sigma is constant over the time interval $(s,t)$.

source
func_y(m::GaussianHjmModel, t::ModelTime)

Calculate variance/auxiliary state variable y(t).

source
DiffFusion.chi_hjmFunction
chi_hjm(m::SeparableHjmModel)

Return vector of constant mean reversion rates.

source
chi_hjm(m::MarkovFutureModel)

Return vector of constant mean reversion rates.

source
DiffFusion.benchmark_timesFunction
benchmark_times(m::SeparableHjmModel)

Return vector of reference/benchmark times

source
benchmark_times(m::MarkovFutureModel)

Return vector of reference/benchmark times

source
DiffFusion.H_hjmFunction
H_hjm(chi::AbstractVector, s::ModelTime, t::ModelTime)

Diagonal entries of $H(s,t)$.

source
H_hjm(m::SeparableHjmModel, s::ModelTime, t::ModelTime)

Diagonal entries of $H(s,t)$.

source
DiffFusion.G_hjmFunction
G_hjm(chi::AbstractVector, s::ModelTime, t::ModelTime)

Vector function $G(s,t)$.

source
G_hjm(m::SeparableHjmModel, s::ModelTime, t::ModelTime)

Vector function $G(s,t)$.

source
G_hjm(chi::AbstractVector, s::ModelTime, T::AbstractVector)

Vector function $G(s,t)$ as matrix of size (d,k) where k = length(T)

source
G_hjm(m::SeparableHjmModel, s::ModelTime, T::AbstractVector)

Vector function $G(s,t)$.

source
DiffFusion.BenchmarkTimesScalingType
@enum(
     BenchmarkTimesScaling,
     ForwardRateScaling,
     ZeroRateScaling,
     DiagonalScaling,
-)

Specify scaling methods to be used for state variable x volatility function.

ForwardRateScaling (default) uses forward rates as benchmark rates. For refrence, see Andersen/Piterbarg, Interest Rate Modeling, 2010, Prop. 13.3.2.

ZeroRateScaling uses continous compounded zero rates as benchmark rates. See https://ssrn.com/abstract=4638188 for details.

DiagonalScaling uses identity matrix (i.e. no scaling).

source
DiffFusion.benchmark_times_scalingFunction
benchmark_times_scaling(
+)

Specify scaling methods to be used for state variable x volatility function.

ForwardRateScaling (default) uses forward rates as benchmark rates. For refrence, see Andersen/Piterbarg, Interest Rate Modeling, 2010, Prop. 13.3.2.

ZeroRateScaling uses continous compounded zero rates as benchmark rates. See https://ssrn.com/abstract=4638188 for details.

DiagonalScaling uses identity matrix (i.e. no scaling).

source
DiffFusion.benchmark_times_scalingFunction
benchmark_times_scaling(
     chi::AbstractVector,
     delta::AbstractVector,
     scaling_type::BenchmarkTimesScaling = ForwardRate::BenchmarkTimesScaling
-    )

Calculate volatility scaling matrix depending on the scaling type.

source
DiffFusion.func_Theta_xFunction
func_Theta_x(
     chi::AbstractVector,
     y::Function,       # (u) -> Matrix
     sigmaT::Function,  # (u) -> Matrix
@@ -41,7 +41,7 @@
     s::ModelTime,
     t::ModelTime,
     param_grid::Union{AbstractVector, Nothing},
-    )

Calculate Theta function for state variable x.

In this function we assume for the interval $(s,t)$ that - variance $y(s)$ is known, - volatility $σ$ is state-independent and - quanto adjustment alpha is state-independent.

source
DiffFusion.func_Theta_x_integrate_yFunction
func_Theta_x_integrate_y(
+    )

Calculate Theta function for state variable x.

In this function we assume for the interval $(s,t)$ that - variance $y(s)$ is known, - volatility $σ$ is state-independent and - quanto adjustment alpha is state-independent.

source
DiffFusion.func_Theta_x_integrate_yFunction
func_Theta_x_integrate_y(
     chi::AbstractVector,
     y::Function,       # (u) -> Matrix
     sigmaT::Function,  # (u) -> Matrix
@@ -49,7 +49,7 @@
     s::ModelTime,
     t::ModelTime,
     param_grid::Union{AbstractVector, Nothing},
-    )

Calculate Theta function for state variable $x$.

Avoidance of explicit $σ^\top σ$ dependence may help with integrating over jumps in piece-wise constant volatility.

In this function we assume for the interval $(s,t)$ that - variance $y$ is state-independent, - volatility $σ$ is state-independent and - quanto adjustment $α$ is state-independent.

source
DiffFusion.func_Theta_sFunction
func_Theta_s(
+    )

Calculate Theta function for state variable $x$.

Avoidance of explicit $σ^\top σ$ dependence may help with integrating over jumps in piece-wise constant volatility.

In this function we assume for the interval $(s,t)$ that - variance $y$ is state-independent, - volatility $σ$ is state-independent and - quanto adjustment $α$ is state-independent.

source
DiffFusion.func_Theta_sFunction
func_Theta_s(
     chi::AbstractVector,
     y::Function,       # (u) -> Matrix
     sigmaT::Function,  # (u) -> Matrix
@@ -57,7 +57,7 @@
     s::ModelTime,
     t::ModelTime,
     param_grid::Union{AbstractVector, Nothing},
-    )

Calculate Theta function for integrated state variable $s$.

In this function we assume for the interval $(s,t)$ that - variance $y$ state-independent, - volatility $σ$ is state-independent and - quanto adjustment $α$ is state-independent.

source
DiffFusion.func_ThetaFunction
func_Theta(
+    )

Calculate Theta function for integrated state variable $s$.

In this function we assume for the interval $(s,t)$ that - variance $y$ state-independent, - volatility $σ$ is state-independent and - quanto adjustment $α$ is state-independent.

source
DiffFusion.func_ThetaFunction
func_Theta(
     chi::AbstractVector,
     y::Function,       # (u) -> Matrix
     sigmaT::Function,  # (u) -> Matrix
@@ -65,74 +65,74 @@
     s::ModelTime,
     t::ModelTime,
     param_grid::Union{AbstractVector, Nothing},
-    )

Calculate Theta function for component model state variable $X$.

In this function we assume for the interval $(s,t)$ that - variance $y$ state-independent, - volatility $σ$ is state-independent and - quanto adjustment $α$ is state-independent.

source
DiffFusion.func_H_TFunction
func_H_T(chi::AbstractVector, s::ModelTime, t::ModelTime)

Calculate $H$ function for component model.

source
DiffFusion.func_H_T_denseFunction
func_H_T_dense(chi::AbstractVector, s::ModelTime, t::ModelTime)

Alternative $H$ function implementation for debugging.

source
DiffFusion.func_Sigma_TFunction
func_Sigma_T(
+    )

Calculate Theta function for component model state variable $X$.

In this function we assume for the interval $(s,t)$ that - variance $y$ state-independent, - volatility $σ$ is state-independent and - quanto adjustment $α$ is state-independent.

source
DiffFusion.func_H_TFunction
func_H_T(chi::AbstractVector, s::ModelTime, t::ModelTime)

Calculate $H$ function for component model.

source
DiffFusion.func_H_T_denseFunction
func_H_T_dense(chi::AbstractVector, s::ModelTime, t::ModelTime)

Alternative $H$ function implementation for debugging.

source
DiffFusion.func_Sigma_TFunction
func_Sigma_T(
     chi::AbstractVector,
     sigmaT::Function,
     s::ModelTime,
     t::ModelTime
-    )

Calculate $Σ(u)^\top$ function for component model.

In this function we assume for the interval $(s,t)$ that - volatility $σ$ is state-independent.

source

Model Functions for Payoff Evaluation

DiffFusion.log_bank_accountFunction
log_bank_account(m::Model, alias::String, t::ModelTime, X::ModelState)

Retrieve the integral over sum of state variables s(t) from interest rate model.

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

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

Retrieve the integral over sum of state variables s(t) from interest rate model.

source
log_bank_account(m::GaussianHjmModel, model_alias::String, t::ModelTime, X::ModelState)

Retrieve the integral over sum of state variables s(t) from interest rate model.

source
DiffFusion.log_zero_bondFunction
log_zero_bond(m::Model, alias::String, t::ModelTime, T::ModelTime, X::ModelState)

Calculate the zero bond term [G(t,T)' x(t) + 0.5 G(t,T)' y(t) G(t,T)]' from rates model.

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

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

Calculate the zero bond term [G(t,T)' x(t) + 0.5 G(t,T)' y(t) G(t,T)]' from rates model.

source
log_zero_bond(m::GaussianHjmModel, model_alias::String, t::ModelTime, T::ModelTime, X::ModelState)

Calculate the zero bond term [G(t,T)' x(t) + 0.5 G(t,T)' y(t) G(t,T)]' from rates model.

source
DiffFusion.log_zero_bondsFunction
log_zero_bonds(m::Model, alias::String, t::ModelTime, T::AbstractVector, X::ModelState)

Calculate the zero bond terms [G(t,T)' x(t) + 0.5 G(t,T)' y(t) G(t,T)]' from rates model.

source
log_zero_bonds(m::CompositeModel, alias::String, t::ModelTime, T::AbstractVector, X::ModelState)

Calculate the zero bond terms [G(t,T)' x(t) + 0.5 G(t,T)' y(t) G(t,T)]' from rates model.

source
log_zero_bonds(m::GaussianHjmModel, model_alias::String, t::ModelTime, T::AbstractVector, X::ModelState)

Calculate the zero bond terms [G(t,T)' x(t) + 0.5 G(t,T)' y(t) G(t,T)]' from rates model.

source
DiffFusion.log_compounding_factorFunction
log_compounding_factor(
+    )

Calculate $Σ(u)^\top$ function for component model.

In this function we assume for the interval $(s,t)$ that - volatility $σ$ is state-independent.

source

Model Functions for Payoff Evaluation

DiffFusion.log_bank_accountFunction
log_bank_account(m::Model, alias::String, t::ModelTime, X::ModelState)

Retrieve the integral over sum of state variables s(t) from interest rate model.

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

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

Retrieve the integral over sum of state variables s(t) from interest rate model.

source
log_bank_account(m::GaussianHjmModel, model_alias::String, t::ModelTime, X::ModelState)

Retrieve the integral over sum of state variables s(t) from interest rate model.

source
DiffFusion.log_zero_bondFunction
log_zero_bond(m::Model, alias::String, t::ModelTime, T::ModelTime, X::ModelState)

Calculate the zero bond term [G(t,T)' x(t) + 0.5 G(t,T)' y(t) G(t,T)]' from rates model.

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

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

Calculate the zero bond term [G(t,T)' x(t) + 0.5 G(t,T)' y(t) G(t,T)]' from rates model.

source
log_zero_bond(m::GaussianHjmModel, model_alias::String, t::ModelTime, T::ModelTime, X::ModelState)

Calculate the zero bond term [G(t,T)' x(t) + 0.5 G(t,T)' y(t) G(t,T)]' from rates model.

source
DiffFusion.log_zero_bondsFunction
log_zero_bonds(m::Model, alias::String, t::ModelTime, T::AbstractVector, X::ModelState)

Calculate the zero bond terms [G(t,T)' x(t) + 0.5 G(t,T)' y(t) G(t,T)]' from rates model.

source
log_zero_bonds(m::CompositeModel, alias::String, t::ModelTime, T::AbstractVector, X::ModelState)

Calculate the zero bond terms [G(t,T)' x(t) + 0.5 G(t,T)' y(t) G(t,T)]' from rates model.

source
log_zero_bonds(m::GaussianHjmModel, model_alias::String, t::ModelTime, T::AbstractVector, X::ModelState)

Calculate the zero bond terms [G(t,T)' x(t) + 0.5 G(t,T)' y(t) G(t,T)]' from rates model.

source
DiffFusion.log_compounding_factorFunction
log_compounding_factor(
     m::Model,
     model_alias::String,
     t::ModelTime,
     T1::ModelTime,
     T2::ModelTime,
     X::ModelState,
-    )

Calculate the forward compounding factor term [G(t,T2) - G(t,T1)]' x(t) + 0.5 * [G(t,T2)' y(t) G(t,T2) - G(t,T1)' y(t) G(t,T1)].

This is used for Libor forward rate calculation.

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

source
log_compounding_factor(
+    )

Calculate the forward compounding factor term [G(t,T2) - G(t,T1)]' x(t) + 0.5 * [G(t,T2)' y(t) G(t,T2) - G(t,T1)' y(t) G(t,T1)].

This is used for Libor forward rate calculation.

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

source
log_compounding_factor(
     m::CompositeModel,
     alias::String,
     t::ModelTime,
     T1::ModelTime,
     T2::ModelTime,
     X::ModelState,
-    )

Calculate the forward compounding factor term [G(t,T2) - G(t,T1)]' x(t) + 0.5 * [G(t,T2)' y(t) G(t,T2) - G(t,T1)' y(t) G(t,T1)].

This is used for Libor forward rate calculation.

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

source
log_compounding_factor(
+    )

Calculate the forward compounding factor term [G(t,T2) - G(t,T1)]' x(t) + 0.5 * [G(t,T2)' y(t) G(t,T2) - G(t,T1)' y(t) G(t,T1)].

This is used for Libor forward rate calculation.

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

source
log_compounding_factor(
     m::GaussianHjmModel,
     model_alias::String,
     t::ModelTime,
     T1::ModelTime,
     T2::ModelTime,
     X::ModelState,
-    )

Calculate the forward compounding factor term [G(t,T2) - G(t,T1)]' x(t) + 0.5 * [G(t,T2)' y(t) G(t,T2) - G(t,T1)' y(t) G(t,T1)].

This is used for Libor forward rate calculation.

source
DiffFusion.forward_rate_varianceFunction
forward_rate_variance(
+    )

Calculate the forward compounding factor term [G(t,T2) - G(t,T1)]' x(t) + 0.5 * [G(t,T2)' y(t) G(t,T2) - G(t,T1)' y(t) G(t,T1)].

This is used for Libor forward rate calculation.

source
DiffFusion.forward_rate_varianceFunction
forward_rate_variance(
     m::Model,
     alias::String,
     t::ModelTime,
     T::ModelTime,
     T0::ModelTime,
     T1::ModelTime,
-    )

Calculate the lognormal variance for a compounding factor of a forward-looking or backward-looking forward rate.

source
forward_rate_variance(
+    )

Calculate the lognormal variance for a compounding factor of a forward-looking or backward-looking forward rate.

source
forward_rate_variance(
     m::CompositeModel,
     alias::String,
     t::ModelTime,
     T::ModelTime,
     T0::ModelTime,
     T1::ModelTime,
-    )

Calculate the lognormal variance for a compounding factor of a forward-looking or backward-looking forward rate.

source
forward_rate_variance(
+    )

Calculate the lognormal variance for a compounding factor of a forward-looking or backward-looking forward rate.

source
forward_rate_variance(
     m::GaussianHjmModel,
     t::ModelTime,
     T::ModelTime,
     T0::ModelTime,
     T1::ModelTime,
-    )

Calculate the lognormal variance for a compounding factor of a forward-looking or backward-looking forward rate.

Time t is the observation time, T is the rate fixing time or option exercise time, T0 is the rate period start time, and T1 is the rate period end time.

If t ≤ T0 then we calculate the variance for a forward-looking rate. If t = T1 then we calculate the variance for a backward-looking rate.

source
forward_rate_variance(
+    )

Calculate the lognormal variance for a compounding factor of a forward-looking or backward-looking forward rate.

Time t is the observation time, T is the rate fixing time or option exercise time, T0 is the rate period start time, and T1 is the rate period end time.

If t ≤ T0 then we calculate the variance for a forward-looking rate. If t = T1 then we calculate the variance for a backward-looking rate.

source
forward_rate_variance(
     m::GaussianHjmModel,
     alias::String,
     t::ModelTime,
     T::ModelTime,
     T0::ModelTime,
     T1::ModelTime,
-    )

Calculate the lognormal variance for a compounding factor of a forward-looking or backward-looking forward rate.

This function implements the Model interface function.

source
forward_rate_variance(
+    )

Calculate the lognormal variance for a compounding factor of a forward-looking or backward-looking forward rate.

This function implements the Model interface function.

source
forward_rate_variance(
 p::AbstractPath,
 t::ModelTime,
 T::ModelTime,
 T0::ModelTime,
 T1::ModelTime,
 key::String,
-)

Calculate the lognormal variance for a compounding factor of a forward-looking or backward-looking forward rate.

source
forward_rate_variance(
+)

Calculate the lognormal variance for a compounding factor of a forward-looking or backward-looking forward rate.

source
forward_rate_variance(
 p::Path,
 t::ModelTime,
 T::ModelTime,
 T0::ModelTime,
 T1::ModelTime,
 key::String,
-)

Calculate the lognormal variance for a compounding factor of a forward-looking or backward-looking forward rate.

source
DiffFusion.swap_rate_varianceFunction
swap_rate_variance(
+)

Calculate the lognormal variance for a compounding factor of a forward-looking or backward-looking forward rate.

source
DiffFusion.swap_rate_varianceFunction
swap_rate_variance(
     m::Model,
     alias::String,
     yts::YieldTermstructure,
@@ -141,7 +141,7 @@
     swap_times::AbstractVector,
     yf_weights::AbstractVector,
     X::ModelState,
-    )

Calculate the normal model variance of a swap rate via Gaussian swap rate approximation.

source
swap_rate_variance(
+    )

Calculate the normal model variance of a swap rate via Gaussian swap rate approximation.

source
swap_rate_variance(
     m::CompositeModel,
     alias::String,
     yts::YieldTermstructure,
@@ -150,7 +150,7 @@
     swap_times::AbstractVector,
     yf_weights::AbstractVector,
     X::ModelState,
-    )

Calculate the normal model variance of a swap rate via Gaussian swap rate approximation.

source
swap_rate_variance(
+    )

Calculate the normal model variance of a swap rate via Gaussian swap rate approximation.

source
swap_rate_variance(
     yts::YieldTermstructure,
     m::GaussianHjmModel,
     t::ModelTime,
@@ -158,7 +158,7 @@
     swap_times::AbstractVector,
     yf_weights::AbstractVector,
     SX::ModelState,
-    )

Calculate the normal model variance of a swap rate via Gaussian swap rate approximation.

Observation time is t, Option expiry time is T.

See method swap_rate_gradient for details on further input parameters.

source
swap_rate_variance(
+    )

Calculate the normal model variance of a swap rate via Gaussian swap rate approximation.

Observation time is t, Option expiry time is T.

See method swap_rate_gradient for details on further input parameters.

source
swap_rate_variance(
     m::GaussianHjmModel,
     alias::String,
     yts::YieldTermstructure,
@@ -167,32 +167,32 @@
     swap_times::AbstractVector,
     yf_weights::AbstractVector,
     X::ModelState,
-    )

Calculate the normal model variance of a swap rate via Gaussian swap rate approximation.

This function is implements the Model interface function.

See method swap_rate_gradient for details on further input parameters.

source
swap_rate_variance(
+    )

Calculate the normal model variance of a swap rate via Gaussian swap rate approximation.

This function is implements the Model interface function.

See method swap_rate_gradient for details on further input parameters.

source
swap_rate_variance(
     p::AbstractPath,
     t::ModelTime,
     T::ModelTime,
     swap_times::AbstractVector,
     yf_weights::AbstractVector,
     key::String,
-    )

Calculate the normal model variance of a swap rate via Gaussian swap rate approximation.

source
swap_rate_variance(
+    )

Calculate the normal model variance of a swap rate via Gaussian swap rate approximation.

source
swap_rate_variance(
     p::Path,
     t::ModelTime,
     T::ModelTime,
     swap_times::AbstractVector,
     yf_weights::AbstractVector,
     key::String,
-    )

Calculate the normal model variance of a swap rate via Gaussian swap rate approximation.

source

Swap Rate Volatility Calculation

Swap Rate Volatility Calculation

DiffFusion.GaussianHjmModelVolatilityType
struct GaussianHjmModelVolatility
     scaling_matrix::AbstractMatrix
     sigma_f::BackwardFlatVolatility
     DfT::AbstractMatrix
-end

A dedicated matrix-valued volatility term structure for Gaussian HJM Models.

source
DiffFusion.swap_rate_gradientFunction
swap_rate_gradient(
     yts::YieldTermstructure,
     m::GaussianHjmModel,
     t::ModelTime,
     swap_times::AbstractVector,
     yf_weights::AbstractVector,
     SX::ModelState,
-    )

The gradient dS/dx in a Gaussian HJM model.

Returns a matrix of size (p, d). Here, p is the number of paths in SX and d is the number of factors of the GHJM model, i.e., d = length(factor_alias(m)).

Observation time is t. The swap rate is specified by swap_times and yf_weights. swap_times[begin] is the start time of the first (floating rate) coupon period. swap_times[k] for k>begin represent the pay times of the fixed leg coupons. yf_weights are the year fractions of the fixed leg coupons.

The swap rate is constructed assuming single-curve setting without tenor basis. yts is the initial (discounting) yield curve.

The swap rate gradient depends on the simulated model state at t. The model state is encoded in SX.

source
DiffFusion.swap_rate_instantaneous_covarianceFunction
swap_rate_instantaneous_covariance(
+    )

The gradient dS/dx in a Gaussian HJM model.

Returns a matrix of size (p, d). Here, p is the number of paths in SX and d is the number of factors of the GHJM model, i.e., d = length(factor_alias(m)).

Observation time is t. The swap rate is specified by swap_times and yf_weights. swap_times[begin] is the start time of the first (floating rate) coupon period. swap_times[k] for k>begin represent the pay times of the fixed leg coupons. yf_weights are the year fractions of the fixed leg coupons.

The swap rate is constructed assuming single-curve setting without tenor basis. yts is the initial (discounting) yield curve.

The swap rate gradient depends on the simulated model state at t. The model state is encoded in SX.

source
DiffFusion.swap_rate_instantaneous_covarianceFunction
swap_rate_instantaneous_covariance(
     yts::YieldTermstructure,
     m::GaussianHjmModel,
     t::ModelTime,
@@ -201,14 +201,14 @@
     swap_times_2::AbstractVector,
     yf_weights_2::AbstractVector,
     SX::ModelState,
-    )

Calculate the instantaneous covariance of two swap rates.

See method swap_rate_gradient for details on the input parameters.

source
DiffFusion.swap_rate_volatility²Function
swap_rate_volatility²(
+    )

Calculate the instantaneous covariance of two swap rates.

See method swap_rate_gradient for details on the input parameters.

source
DiffFusion.swap_rate_volatility²Function
swap_rate_volatility²(
     yts::YieldTermstructure,
     m::GaussianHjmModel,
     t::ModelTime,
     swap_times::AbstractVector,
     yf_weights::AbstractVector,
     SX::ModelState,
-    )

Calculate the square of swap rate volatility (or instantaneous variance).

See method swap_rate_gradient for details on the input parameters.

source
DiffFusion.swap_rate_covarianceFunction
swap_rate_covariance(
+    )

Calculate the square of swap rate volatility (or instantaneous variance).

See method swap_rate_gradient for details on the input parameters.

source
DiffFusion.swap_rate_covarianceFunction
swap_rate_covariance(
     yts::YieldTermstructure,
     m::GaussianHjmModel,
     t::ModelTime,
@@ -218,7 +218,7 @@
     swap_times_2::AbstractVector,
     yf_weights_2::AbstractVector,
     SX::ModelState,
-    )

Calculate the covariance of two swap rates over the time intervall (t,T).

See method swap_rate_gradient for details on the input parameters.

source
DiffFusion.swap_rate_correlationFunction
swap_rate_correlation(
+    )

Calculate the covariance of two swap rates over the time intervall (t,T).

See method swap_rate_gradient for details on the input parameters.

source
DiffFusion.swap_rate_correlationFunction
swap_rate_correlation(
     yts::YieldTermstructure,
     m::GaussianHjmModel,
     t::ModelTime,
@@ -228,33 +228,33 @@
     swap_times_2::AbstractVector,
     yf_weights_2::AbstractVector,
     SX::ModelState,
-    )

Calculate the correlation of two swap rates via Gaussian swap rate approximation over the time intervall (t,T).

See method swap_rate_gradient for details on further input parameters.

source
DiffFusion.model_implied_volatiltiesFunction
model_implied_volatilties(
+    )

Calculate the correlation of two swap rates via Gaussian swap rate approximation over the time intervall (t,T).

See method swap_rate_gradient for details on further input parameters.

source
DiffFusion.model_implied_volatiltiesFunction
model_implied_volatilties(
     yts::YieldTermstructure,
     m::GaussianHjmModel,
     option_times::AbstractVector,
     swap_times::AbstractMatrix,
     swap_weights::AbstractMatrix,
     SX::Union{ModelState, Nothing} = nothing
-    )

Calculate model-implied swap rate volatilities in Gaussian HJM model.

option_times are the option expiry times.

swap_times is a matrix of vectors. Each element represents swap times as specified in swap_rate_gradient.

swap_weights is a matrix of vectors. Each element represents year fraction weights as specified in swap_rate_gradient.

See method swap_rate_gradient for details on further input parameters.

source
model_implied_volatilties(
+    )

Calculate model-implied swap rate volatilities in Gaussian HJM model.

option_times are the option expiry times.

swap_times is a matrix of vectors. Each element represents swap times as specified in swap_rate_gradient.

swap_weights is a matrix of vectors. Each element represents year fraction weights as specified in swap_rate_gradient.

See method swap_rate_gradient for details on further input parameters.

source
model_implied_volatilties(
     yts::YieldTermstructure,
     m::GaussianHjmModel,
     option_times::AbstractVector,
     swap_times::AbstractVector,
     swap_weights::AbstractVector,
     SX::Union{ModelState, Nothing} = nothing
-    )

Calculate model-implied swap rate volatilities in Gaussian HJM model.

option_times are the option expiry times.

swap_times is a vector of vectors. Each element represents time offsets that are added to option_times in order to form swap_times as specified in swap_rate_gradient.

swap_weights is a vector of vectors. Each element represents year fraction weights as specified in swap_rate_gradient. swap_weights are assumed equal per expiry time.

See method swap_rate_gradient for details on further input parameters.

source
model_implied_volatilties(
+    )

Calculate model-implied swap rate volatilities in Gaussian HJM model.

option_times are the option expiry times.

swap_times is a vector of vectors. Each element represents time offsets that are added to option_times in order to form swap_times as specified in swap_rate_gradient.

swap_weights is a vector of vectors. Each element represents year fraction weights as specified in swap_rate_gradient. swap_weights are assumed equal per expiry time.

See method swap_rate_gradient for details on further input parameters.

source
model_implied_volatilties(
     yts::YieldTermstructure,
     m::GaussianHjmModel,
     option_times::AbstractVector,
     swap_maturities::AbstractVector,
     SX::Union{ModelState, Nothing} = nothing
-    )

Calculate model-implied swap rate volatilities in Gaussian HJM model.

option_times are the option expiry times.

swap_maturities is a list of swap tenors. Swap times and year fraction weights are calculated from swap_maturities assuming an annual schedule.

See method swap_rate_gradient for details on further input parameters.

source
model_implied_volatilties(
+    )

Calculate model-implied swap rate volatilities in Gaussian HJM model.

option_times are the option expiry times.

swap_maturities is a list of swap tenors. Swap times and year fraction weights are calculated from swap_maturities assuming an annual schedule.

See method swap_rate_gradient for details on further input parameters.

source
model_implied_volatilties(
     ast_model::LognormalAssetModel,
     dom_model::Union{GaussianHjmModel, Nothing},
     for_model::Union{GaussianHjmModel, Nothing},
     ch::CorrelationHolder,
     option_times::AbstractVector,
-    )

Calculate model-implied volatilities in hybrid asset model.

source

Model Calibration

Model Calibration

DiffFusion.gaussian_hjm_modelMethod
gaussian_hjm_model(
     alias::String,
     ch::Union{CorrelationHolder, Nothing},
     option_times::AbstractVector,
@@ -263,7 +263,7 @@
     yts::YieldTermstructure;
     max_iter::Integer = 5,
     volatility_regularisation::ModelValue = 0.0,
-    )

Calibrate a model with flat volatilities and mean reversion to strips of co-initial normal volatilities.

source
DiffFusion.gaussian_hjm_modelMethod
gaussian_hjm_model(
     alias::String,
     delta::ParameterTermstructure,
     chi::ParameterTermstructure,
@@ -274,4 +274,4 @@
     yts::YieldTermstructure;
     max_iter::Integer = 5,
     volatility_regularisation::ModelValue = 0.0,
-    )

Calibrate a model with piece-wise constant volatilities to strips of co-initial normal volatilities.

Mean reversion (and correlations) are exogeneously specified.

source
+ )

Calibrate a model with piece-wise constant volatilities to strips of co-initial normal volatilities.

Mean reversion (and correlations) are exogeneously specified.

source
diff --git a/dev/payoffs/amc_payoffs/index.html b/dev/payoffs/amc_payoffs/index.html index 72b59f5..8936f62 100644 --- a/dev/payoffs/amc_payoffs/index.html +++ b/dev/payoffs/amc_payoffs/index.html @@ -1,18 +1,18 @@ -American Monte Carlo · [∂F]

American Monte Carlo

DiffFusion.AmcPayoffType
abstract type AmcPayoff <: Payoff end

AmcPayoff is used to implement common methods for AMC payoffs. Concrete AMC payoffs are assumed to hold a fields links::AmcPayoffLinks and regr::AmcPayoffRegression.

An AMC payoff is special and does not fit into the structure of unary/binary nodes. Instead, we have several edges to other payoffs with observation times before (x and y) and after (z) its own observation time.

source
DiffFusion.AmcPayoffLinksType
struct AmcPayoffLinks
+American Monte Carlo · [∂F]

American Monte Carlo

DiffFusion.AmcPayoffType
abstract type AmcPayoff <: Payoff end

AmcPayoff is used to implement common methods for AMC payoffs. Concrete AMC payoffs are assumed to hold a fields links::AmcPayoffLinks and regr::AmcPayoffRegression.

An AMC payoff is special and does not fit into the structure of unary/binary nodes. Instead, we have several edges to other payoffs with observation times before (x and y) and after (z) its own observation time.

source
DiffFusion.AmcPayoffLinksType
struct AmcPayoffLinks
     obs_time::ModelTime
     x::AbstractVector
     y::AbstractVector
     z::AbstractVector
     curve_key::String
-end

An AmcPayoffLinks object holds common data fields for an American Monte Carlo (AMC) payoff.

Here, obs_time is the observation time of the AMC payoff and x, y, z are related Payoff vectors. The elements of x and y represent random variables with observation times after obs_time. The elements of z represent random variables with observation time (at or) before obs_time. z is the vector of regression variables.

The parameter curve_key is used to specify a discount curve for numeraire price calculation.

We calculate $X$ as the sum of discounted payoff values of x and $Y$ as the sum of discounted payoff values of y. $Z = [ Z_1, Z_2, ... ]$ represent the (undiscounted) values of the regression variables from the payoff vector z.

Then we estimate the trigger variable

$T = E[ X - Y | Z_1, Z_2, ... ]$

An actual AMC payoff uses $X$, $Y$, and $T$ to calculate its values.

source
DiffFusion.AmcPayoffRegressionType
mutable struct AmcPayoffRegression
+end

An AmcPayoffLinks object holds common data fields for an American Monte Carlo (AMC) payoff.

Here, obs_time is the observation time of the AMC payoff and x, y, z are related Payoff vectors. The elements of x and y represent random variables with observation times after obs_time. The elements of z represent random variables with observation time (at or) before obs_time. z is the vector of regression variables.

The parameter curve_key is used to specify a discount curve for numeraire price calculation.

We calculate $X$ as the sum of discounted payoff values of x and $Y$ as the sum of discounted payoff values of y. $Z = [ Z_1, Z_2, ... ]$ represent the (undiscounted) values of the regression variables from the payoff vector z.

Then we estimate the trigger variable

$T = E[ X - Y | Z_1, Z_2, ... ]$

An actual AMC payoff uses $X$, $Y$, and $T$ to calculate its values.

source
DiffFusion.AmcPayoffRegressionType
mutable struct AmcPayoffRegression
     path::Union{AbstractPath, Nothing}
     make_regression::Union{Function, Nothing}
     regression::Any
-end

AmcPayoffRegression holds the common data fields to regression and regression calibration for AMC payoffs. These data fields are supposed to be updated subsequent creation of the object. As a consequence, AmcPayoffRegression is declared mutable.

The element path is a Monte Carlo path. This element is typically linked to a simulation and a context mapping.

make_regression is a function/functor with signature

make_regression(C::AbstractMatrix, O::AbstractVector) -> obj.

This function is typically a lambda for polynomial_regression (or similar) where parameters like maximum polynomial degree are fixed.

The result of make_regression is stored in the regression field. For the result object regression we assume that a method

predict(regression, C)

is defined. The method predict is supposed to return a prediction for a matrix of controls C. See PolynomialRegression as an example.

source
DiffFusion.AmcMaxType
struct AmcMax <: AmcPayoff
+end

AmcPayoffRegression holds the common data fields to regression and regression calibration for AMC payoffs. These data fields are supposed to be updated subsequent creation of the object. As a consequence, AmcPayoffRegression is declared mutable.

The element path is a Monte Carlo path. This element is typically linked to a simulation and a context mapping.

make_regression is a function/functor with signature

make_regression(C::AbstractMatrix, O::AbstractVector) -> obj.

This function is typically a lambda for polynomial_regression (or similar) where parameters like maximum polynomial degree are fixed.

The result of make_regression is stored in the regression field. For the result object regression we assume that a method

predict(regression, C)

is defined. The method predict is supposed to return a prediction for a matrix of controls C. See PolynomialRegression as an example.

source
DiffFusion.AmcMaxType
struct AmcMax <: AmcPayoff
     links::AmcPayoffLinks
     regr::AmcPayoffRegression
-end

An AmcMax payoff is used to model long call rights.

It calculates the expectation of maximum of (sum of) discounted payoffs x and (sum of) discounted payoffs y. Expectation is calculated conditional on information at obs_time. This is approximated by regression variable payoffs z.

source
DiffFusion.AmcMaxMethod
AmcMax(
+end

An AmcMax payoff is used to model long call rights.

It calculates the expectation of maximum of (sum of) discounted payoffs x and (sum of) discounted payoffs y. Expectation is calculated conditional on information at obs_time. This is approximated by regression variable payoffs z.

source
DiffFusion.AmcMaxMethod
AmcMax(
     obs_time::ModelTime,
     x::AbstractVector,
     y::AbstractVector,
@@ -20,10 +20,10 @@
     path::Union{AbstractPath, Nothing},
     make_regression::Union{Function, Nothing},
     curve_key::String,
-    )

Create an AmcMax payoff.

source
DiffFusion.AmcMinType
struct AmcMin <: AmcPayoff
     links::AmcPayoffLinks
     regr::AmcPayoffRegression
-end

An AmcMin payoff is used to model short call rights.

It calculates the expectation of minimum of (sum of) discounted payoffs x and (sum of) discounted payoffs y. Expectation is calculated conditional on information at obs_time. This is approximated by regression variable payoffs z.

source
DiffFusion.AmcMinMethod
AmcMin(
+end

An AmcMin payoff is used to model short call rights.

It calculates the expectation of minimum of (sum of) discounted payoffs x and (sum of) discounted payoffs y. Expectation is calculated conditional on information at obs_time. This is approximated by regression variable payoffs z.

source
DiffFusion.AmcMinMethod
AmcMin(
     obs_time::ModelTime,
     x::AbstractVector,
     y::AbstractVector,
@@ -31,10 +31,10 @@
     path::Union{AbstractPath, Nothing},
     make_regression::Union{Function, Nothing},
     curve_key::String,
-    )

Create an AmcMin payoff.

source
DiffFusion.AmcOneType
struct AmcOne <: AmcPayoff
     links::AmcPayoffLinks
     regr::AmcPayoffRegression
-end

An AmcOne payoff is used to model the indicator variable $1_{(X > Y)}$.

It calculates the expectation of maximum of (sum of) discounted payoffs x and (sum of) discounted payoffs y. Expectation is calculated conditional on information at obs_time. This is approximated by regression variable payoffs z.

source
DiffFusion.AmcOneMethod
AmcOne(
+end

An AmcOne payoff is used to model the indicator variable $1_{(X > Y)}$.

It calculates the expectation of maximum of (sum of) discounted payoffs x and (sum of) discounted payoffs y. Expectation is calculated conditional on information at obs_time. This is approximated by regression variable payoffs z.

source
DiffFusion.AmcOneMethod
AmcOne(
     obs_time::ModelTime,
     x::AbstractVector,
     y::AbstractVector,
@@ -42,38 +42,38 @@
     path::Union{AbstractPath, Nothing},
     make_regression::Union{Function, Nothing},
     curve_key::String,
-    )

Create an AmcOne payoff.

source
DiffFusion.AmcSumType
struct AmcSum <: AmcPayoff
     links::AmcPayoffLinks
     regr::AmcPayoffRegression
-end

An AmcSum payoff is used to model general conditional expectations

$B(t) E[ X(T)/B(T) | Z(t) ]$

AmcSum payoffs are typically used to calculate future model prices in exposure simulation applications.

source
DiffFusion.AmcSumMethod
AmcSum(
+end

An AmcSum payoff is used to model general conditional expectations

$B(t) E[ X(T)/B(T) | Z(t) ]$

AmcSum payoffs are typically used to calculate future model prices in exposure simulation applications.

source
DiffFusion.AmcSumMethod
AmcSum(
     obs_time::ModelTime,
     x::AbstractVector,
     z::AbstractVector,
     path::Union{AbstractPath, Nothing},
     make_regression::Union{Function, Nothing},
     curve_key::String,
-    )

Create an AmcSum payoff.

source
DiffFusion.reset_regression!Function
reset_regression!(
     p::AmcPayoff,
     path::Union{AbstractPath, Nothing} = nothing,
     make_regression::Union{Function, Nothing}  = nothing,
-    )

Reset the regression properties for an AMC payoffs.

This method is used to allow setting and updating AMC regression after payoff creation.

source
reset_regression!(
+    )

Reset the regression properties for an AMC payoffs.

This method is used to allow setting and updating AMC regression after payoff creation.

source
reset_regression!(
     p::UnaryNode,
     path::Union{AbstractPath, Nothing} = nothing,
     make_regression::Union{Function, Nothing}  = nothing,
-    )

Delegate resetting the regression properties to child payoff.

source
reset_regression!(
+    )

Delegate resetting the regression properties to child payoff.

source
reset_regression!(
     p::BinaryNode,
     path::Union{AbstractPath, Nothing} = nothing,
     make_regression::Union{Function, Nothing}  = nothing,
-    )

Delegate resetting the regression properties to child payoffs.

source
reset_regression!(
+    )

Delegate resetting the regression properties to child payoffs.

source
reset_regression!(
     p::Union{Leaf, CompoundedRate, Optionlet, Swaption},
     path::Union{AbstractPath, Nothing} = nothing,
     make_regression::Union{Function, Nothing}  = nothing,
-    )

Ignore resetting the regression properties for Leaf and similar payoffs.

Note that some rates payoffs and rates options are no Leafs.

source
reset_regression!(
+    )

Ignore resetting the regression properties for Leaf and similar payoffs.

Note that some rates payoffs and rates options are no Leafs.

source
reset_regression!(
     p::Payoff,
     path::Union{AbstractPath, Nothing} = nothing,
     make_regression::Union{Function, Nothing}  = nothing,
-    )

Throw an error if reset_regression! is not implemented for concrete payoff.

source
reset_regression!(
+    )

Throw an error if reset_regression! is not implemented for concrete payoff.

source
reset_regression!(
     leg::BermudanSwaptionLeg,
     path::Union{AbstractPath, Nothing} = nothing,
     make_regression::Union{Function, Nothing}  = nothing,
-    )

Reset the regression properties for the AMC payoffs of the BermudanSwaptionLeg.

This method is used to allow setting and updating AMC regression after leg creation.

source
DiffFusion.has_amc_payoffFunction
has_amc_payoff(p::AmcPayoff)

Determine whether a payoff is or contains an AMC payoff.

AMC payoffs require special treatment e.g. for sensitivity calculation.

source
has_amc_payoff(p::UnaryNode)

Determine whether a payoff is or contains an AMC payoff.

source
has_amc_payoff(p::BinaryNode)

Determine whether a payoff is or contains an AMC payoff.

source
has_amc_payoff(p::Union{Leaf, CompoundedRate, Optionlet, Swaption})

Determine whether a payoff is or contains an AMC payoff.

source
has_amc_payoff(p::Payoff)

Determine whether a payoff is or contains an AMC payoff.

source
has_amc_payoff(payoffs::AbstractVector)

Determine whether any payoff is or contains an AMC payoff.

source
+ )

Reset the regression properties for the AMC payoffs of the BermudanSwaptionLeg.

This method is used to allow setting and updating AMC regression after leg creation.

source
DiffFusion.has_amc_payoffFunction
has_amc_payoff(p::AmcPayoff)

Determine whether a payoff is or contains an AMC payoff.

AMC payoffs require special treatment e.g. for sensitivity calculation.

source
has_amc_payoff(p::UnaryNode)

Determine whether a payoff is or contains an AMC payoff.

source
has_amc_payoff(p::BinaryNode)

Determine whether a payoff is or contains an AMC payoff.

source
has_amc_payoff(p::Union{Leaf, CompoundedRate, Optionlet, Swaption})

Determine whether a payoff is or contains an AMC payoff.

source
has_amc_payoff(p::Payoff)

Determine whether a payoff is or contains an AMC payoff.

source
has_amc_payoff(payoffs::AbstractVector)

Determine whether any payoff is or contains an AMC payoff.

source
diff --git a/dev/payoffs/asset_payoffs/index.html b/dev/payoffs/asset_payoffs/index.html index 27c4a3e..3079ec0 100644 --- a/dev/payoffs/asset_payoffs/index.html +++ b/dev/payoffs/asset_payoffs/index.html @@ -2,34 +2,34 @@ Assets and Futures · [∂F]

Assets and Futures

The following payoffs are used to model FX, Equity, Inflation and Futures instruments.

DiffFusion.AssetType
struct Asset <: Leaf
     obs_time::ModelTime
     key::String
-end

The price of a tradeable asset S(t) at observation time t.

A tradeable asset is typically an FX rate, equity/index price or spot inflation index.

source
DiffFusion.ForwardAssetType
struct ForwardAsset <: Leaf
+end

The price of a tradeable asset S(t) at observation time t.

A tradeable asset is typically an FX rate, equity/index price or spot inflation index.

source
DiffFusion.ForwardAssetType
struct ForwardAsset <: Leaf
     obs_time::ModelTime
     maturity_time::ModelTime
     key::String
-end

The forward price E_t[S(T)] of a tradeable asset S at observation time t and with maturity time T. Expectation is calculated in T-forward measure.

source
DiffFusion.ForwardIndexType
struct ForwardIndex <: Leaf
+end

The forward price E_t[S(T)] of a tradeable asset S at observation time t and with maturity time T. Expectation is calculated in T-forward measure.

source
DiffFusion.ForwardIndexType
struct ForwardIndex <: Leaf
     obs_time::ModelTime
     maturity_time::ModelTime
     key::String
-end

Expectation Et^T[ST] of a tradeable asset.

This is used in particular for inflation modelling.

source
DiffFusion.FutureIndexType
struct FutureIndex <: Leaf
+end

Expectation Et^T[ST] of a tradeable asset.

This is used in particular for inflation modelling.

source
DiffFusion.FutureIndexType
struct FutureIndex <: Leaf
     obs_time::ModelTime
     maturity_time::ModelTime
     key::String
-end

Risk-neutral expectation Et^T[ST] of a price index.

This is used in particular for Future modelling.

source

Convexity Adjustment

Convexity Adjustment

DiffFusion.AssetConvexityAdjustmentType
struct AssetConvexityAdjustment <: Leaf
     obs_time::ModelTime
     first_time::ModelTime
     second_time::ModelTime
     pay_time::ModelTime
     key::String
-end

Convexity adjustment factor for YoY asset payoffs.

source
DiffFusion.IndexConvexityAdjustmentType
struct IndexConvexityAdjustment <: Leaf
     obs_time::ModelTime
     first_time::ModelTime
     second_time::ModelTime
     pay_time::ModelTime
     key::String
-end

Convexity adjustment factor for YoY index payoffs.

source

Asset Option Payoffs

Asset Option Payoffs

DiffFusion.VanillaAssetOptionType
struct VanillaAssetOption <: Payoff
     obs_time::ModelTime
     expiry_time::ModelTime
     forward_price::ForwardAsset
     strike_price::Payoff
     call_put::ModelValue
-end

The time-t forward price of an option paying [ϕ(F-K)]^+. Forward asset price F is determined at expiry_time.

Option forward price is calculated as expectation in T-forward measure where T corresponds to the expiry time. Conditioning (for time-t price) is on information at obs_time.

Strike price strike_price must be time-t (obs_time) measurable. Otherwise, we look into the future.

source
+end

The time-t forward price of an option paying [ϕ(F-K)]^+. Forward asset price F is determined at expiry_time.

Option forward price is calculated as expectation in T-forward measure where T corresponds to the expiry time. Conditioning (for time-t price) is on information at obs_time.

Strike price strike_price must be time-t (obs_time) measurable. Otherwise, we look into the future.

source diff --git a/dev/payoffs/payoffs/index.html b/dev/payoffs/payoffs/index.html index 558b141..ab2073e 100644 --- a/dev/payoffs/payoffs/index.html +++ b/dev/payoffs/payoffs/index.html @@ -1,40 +1,40 @@ -Payoffs · [∂F]

Payoffs

In this section we document the payoff scripting framework.

Interface

DiffFusion.PayoffType
abstract type Payoff end

A Payoff is a random variable X in our stochastic model.

It represents a market object that can be evaluated in conjunction with a given path.

We are interested in realisations of a payoff at a given path, i.e. X(omega). Moreover, for risk-neutral valuation we are also interested in discounted payoffs at a given path.

We implement a Payoff as a root of a computational graph. The nodes of the computational graph are itself Payoff objects which represent mathematical operations or use the path omega to determine its realisations.

source
DiffFusion.LeafType
abstract type Leaf <: Payoff end

A Leaf is a particular Payoff which has no outgoing links to other Payoff objects. A Leaf typically uses the path to determine its realisations.

We assume that a Leaf has a field obs_time.

source
DiffFusion.UnaryNodeType
abstract type UnaryNode <: Payoff end

A UnaryNode is a particular Payoff which has exactly one outgoing link to another Payoff object.

We assume that the reference to the outgoing Payoff object is a field denoted x.

A UnaryNode is typically a decorator of the linked Payoff.

source
DiffFusion.BinaryNodeType
abstract type BinaryNode <: Payoff end

A BinaryNode is a particular Payoff which has exactly two outgoing links to other Payoff objects.

We assume that the references to the outgoing Payoff objects are fields denoted x and y.

A BinaryNode is typically a mathematical operation.

source
DiffFusion.obs_timeMethod
obs_time(p::Payoff)

A Payoff is typically observed at a particular time. In that sense, a Payoff is an $F_t$-measurable random variable.

The observation time represents the time, after which the payoff is known.

source
DiffFusion.obs_timesMethod
obs_times(p::Payoff)

A payoff is typically linked to other payoffs and forms a DAG. This function returns all observation times associated with a given payoff.

This functionality is required to determine relevant simulation grid points.

source
DiffFusion.atMethod
at(p::Payoff, path::AbstractPath)

Evaluate a Payoff at a given path, X(omega).

Depending on the functionality associated with the path, this function typically returns a vector of realisations.

This function is invoked when using call operator on a Payoff,

(p::Payoff)(path::AbstractPath) = at(p::Payoff, path::AbstractPath)
source

Basic Payoffs

DiffFusion.FixedType
struct Fixed <: Leaf
+Payoffs · [∂F]

Payoffs

In this section we document the payoff scripting framework.

Interface

DiffFusion.PayoffType
abstract type Payoff end

A Payoff is a random variable X in our stochastic model.

It represents a market object that can be evaluated in conjunction with a given path.

We are interested in realisations of a payoff at a given path, i.e. X(omega). Moreover, for risk-neutral valuation we are also interested in discounted payoffs at a given path.

We implement a Payoff as a root of a computational graph. The nodes of the computational graph are itself Payoff objects which represent mathematical operations or use the path omega to determine its realisations.

source
DiffFusion.LeafType
abstract type Leaf <: Payoff end

A Leaf is a particular Payoff which has no outgoing links to other Payoff objects. A Leaf typically uses the path to determine its realisations.

We assume that a Leaf has a field obs_time.

source
DiffFusion.UnaryNodeType
abstract type UnaryNode <: Payoff end

A UnaryNode is a particular Payoff which has exactly one outgoing link to another Payoff object.

We assume that the reference to the outgoing Payoff object is a field denoted x.

A UnaryNode is typically a decorator of the linked Payoff.

source
DiffFusion.BinaryNodeType
abstract type BinaryNode <: Payoff end

A BinaryNode is a particular Payoff which has exactly two outgoing links to other Payoff objects.

We assume that the references to the outgoing Payoff objects are fields denoted x and y.

A BinaryNode is typically a mathematical operation.

source
DiffFusion.obs_timeMethod
obs_time(p::Payoff)

A Payoff is typically observed at a particular time. In that sense, a Payoff is an $F_t$-measurable random variable.

The observation time represents the time, after which the payoff is known.

source
DiffFusion.obs_timesMethod
obs_times(p::Payoff)

A payoff is typically linked to other payoffs and forms a DAG. This function returns all observation times associated with a given payoff.

This functionality is required to determine relevant simulation grid points.

source
DiffFusion.atMethod
at(p::Payoff, path::AbstractPath)

Evaluate a Payoff at a given path, X(omega).

Depending on the functionality associated with the path, this function typically returns a vector of realisations.

This function is invoked when using call operator on a Payoff,

(p::Payoff)(path::AbstractPath) = at(p::Payoff, path::AbstractPath)
source

Basic Payoffs

DiffFusion.PayType
struct Pay <: UnaryNode
     x::Payoff
     obs_time::ModelTime
     test_times::Bool
-end

A Pay payoff allows the user to modify the observation time of a given payoff. This is relevant for discounting.

Typically, we use Pay to specify the pay time for a payoff.

source
DiffFusion.CacheType
mutable struct Cache <: UnaryNode
+end

A Pay payoff allows the user to modify the observation time of a given payoff. This is relevant for discounting.

Typically, we use Pay to specify the pay time for a payoff.

source
DiffFusion.CacheType
mutable struct Cache <: UnaryNode
     x::Payoff
     path::Union{AbstractPath, Nothing}
     value::Union{AbstractVector, Nothing}
-end

A Cache payoff aims at avoiding repeated calculations of the same payoff.

If a Payoff object is referenced by several parent Payoff objects then each call of at() of the parent object triggers a call of at() of the child object that all return the same value(s).

A Cache payoff checks whether the payoff was already evaluated and if yes then returns a cached value.

source

Mathematical Operations

The following payoffs are created by operator overloading of +, -, *, / and logical operators.

DiffFusion.AddType
struct Add <: BinaryNode
+end

A Cache payoff aims at avoiding repeated calculations of the same payoff.

If a Payoff object is referenced by several parent Payoff objects then each call of at() of the parent object triggers a call of at() of the child object that all return the same value(s).

A Cache payoff checks whether the payoff was already evaluated and if yes then returns a cached value.

source

Mathematical Operations

The following payoffs are created by operator overloading of +, -, *, / and logical operators.

DiffFusion.SubType
struct Sub <: BinaryNode
     x::Payoff
     y::Payoff
-end

Subtraction of payoffs.

source
DiffFusion.MulType
struct Mul <: BinaryNode
     x::Payoff
     y::Payoff
-end

Multiplication of payoffs.

source

Mathematical Functions

Mathematical Functions

DiffFusion.ExpType
struct Exp <: UnaryNode
     x::Payoff
-end

Function exp() applied to payoff.

source
DiffFusion.LogType
struct Log <: UnaryNode
     x::Payoff
-end

Function log() applied to payoff.

source

Common Payoff Methods Overview

DiffFusion.obs_timeFunction
obs_time(p::Payoff)

A Payoff is typically observed at a particular time. In that sense, a Payoff is an $F_t$-measurable random variable.

The observation time represents the time, after which the payoff is known.

source
obs_time(p::Leaf)

Return the observation time for a Leaf object.

source
obs_time(p::UnaryNode)

Return the observation time of the linked payoff.

source
obs_time(p::BinaryNode)

Derive the observation time from linked payoffs.

source
obs_time(p::Fixed)

Observation time for Fixed payoffs is zero because they are deterministic.

source
obs_time(p::ScalarValue)

Observation time for ScalarValue payoffs is zero because they are deterministic.

source
obs_time(p::Pay)

Return decorating observation time.

source
obs_time(p::CompoundedRate)

Calculate observation time for CompoundedRate payoff.

source
obs_time(p::Optionlet)

Return Optionlet observation time.

source
obs_time(p::Swaption)

Return Swaption observation time.

source
obs_time(p::AmcPayoff)

Return the AMC payoff observation time

source
obs_time(p::VanillaAssetOption)

Return VanillaAssetOption observation time.

source
obs_time(p::BarrierAssetOption)

Return BarrierAssetOption observation time.

source
DiffFusion.obs_timesFunction
obs_times(p::Payoff)

A payoff is typically linked to other payoffs and forms a DAG. This function returns all observation times associated with a given payoff.

This functionality is required to determine relevant simulation grid points.

source
obs_times(p::Leaf)

Derive the set of observation times from the single observation time of the Leaf object.

source
obs_times(p::UnaryNode)

Return all observation times of the linked payoff.

source
obs_times(p::BinaryNode)

Derive all observation times from linked payoff.

source
obs_times(p::Pay)

Return all observation times of the linked payoff.

source
obs_times(p::CompoundedRate)

Calculate all observation times (i.e. event times) for CompoundedRate payoff.

source
obs_times(p::Optionlet)

Return all Optionlet observation times.

source
obs_times(p::Swaption)

Return all Swaption observation times.

source
obs_times(p::AmcPayoff)

Return observation times of all referenced payoffs.

source
obs_times(p::VanillaAssetOption)

Return all VanillaAssetOption observation times.

source
obs_times(p::BarrierAssetOption)

Return all BarrierAssetOption observation times.

source
DiffFusion.atFunction
at(p::Payoff, path::AbstractPath)

Evaluate a Payoff at a given path, X(omega).

Depending on the functionality associated with the path, this function typically returns a vector of realisations.

This function is invoked when using call operator on a Payoff,

(p::Payoff)(path::AbstractPath) = at(p::Payoff, path::AbstractPath)
source
at(p::Numeraire, path::AbstractPath)

Derive the numeraire price at a given path.

source
at(p::BankAccount, path::AbstractPath)

Derive the bank account price at a given path.

source
at(p::ZeroBond, path::AbstractPath)

Derive the zero bond price at a given path.

source
at(p::Asset, path::AbstractPath)

Derive the asset price at a given path.

source
at(p::ForwardAsset, path::AbstractPath)

Derive the asset price at a given path.

source
at(p::Fixing, path::AbstractPath)

Derive the fixing value at a given path.

source
at(p::Fixed, path::AbstractPath)

Return the deterministic value broadcasted to the length of the path.

source
at(p::ScalarValue, path::AbstractPath)

Return the deterministic scalar value.

This aims at avoiding some unnecessary allocations.

source
at(p::AssetConvexityAdjustment, path::AbstractPath)

Derive the YoY payoff convexity adjustment at a given path.

source
at(p::ForwardIndex, path::AbstractPath)

Derive forward index value at a given path.

source
at(p::IndexConvexityAdjustment, path::AbstractPath)

Derive the YoY payoff convexity adjustment at a given path.

source
at(p::FutureIndex, path::AbstractPath)

Derive forward index value at a given path.

source
at(p::Pay, path::AbstractPath)

Derive payoff of the child payoff.

source
at(p::Cache, path::AbstractPath)

Derive payoff of the child payoff only if not yet calculated.

source
at(p::Exp, path::AbstractPath)

Evaluate exp-function.

source
at(p::Log, path::AbstractPath)

Evaluate log-function.

source

Addition.

source

Subtraction.

source

Multiplication.

source

Division.

source

Maximum

source

Minimum

source

Logical

source
at(p::LiborRate, path::AbstractPath)

Derive the forward Libor rate at a given path.

source
at(p::CompoundedRate, path::AbstractPath)

Derive the compounded backward looking rate at a given path.

source
at(p::Optionlet, path::AbstractPath)

Evaluate a Optionlet at a given path, X(omega).

source
at(p::Swaption, path::AbstractPath)

Evaluate a Swaption at a given path, X(omega).

source
at(links::AmcPayoffLinks, regr::AmcPayoffRegression, path::AbstractPath)

Calculate the common components of AMC payoffs for a given valuation path.

source
at(p::AmcMax, path::AbstractPath)

Evaluate an AmcMax payoff at a given path.

source
at(p::AmcMin, path::AbstractPath)

Evaluate an AmcMin payoff at a given path.

source
at(p::AmcOne, path::AbstractPath)

Evaluate an AmcOne payoff at a given path.

source
at(p::AmcSum, path::AbstractPath)

Evaluate an AmcSum payoff at a given path.

source
at(p::VanillaAssetOption, path::AbstractPath)

Evaluate a VanillaAssetOption at a given path, X(omega).

source
at(p::BarrierAssetOption, path::AbstractPath)

Evaluate a BarrierAssetOption at a given path, X(omega).

source
Base.stringFunction
string(p::Numeraire)

Formatted (and shortened) output for Numeraire payoff.

source
string(p::BankAccount)

Formatted (and shortened) output for BankAccount payoff.

source
string(p::ZeroBond)

Formatted (and shortened) output for ZeroBond payoff.

source
string(p::Asset)

Formatted (and shortened) output for Asset payoff.

source
string(p::ForwardAsset)

Formatted (and shortened) output for ForwardAsset payoff.

source
string(p::Fixing)

Formatted (and shortened) output for Fixing payoff.

source
string(p::Fixed)

Formatted (and shortened) output for deterministic payoff.

source
string(p::ScalarValue)

Formatted (and shortened) output for deterministic payoff.

source
string(p::AssetConvexityAdjustment)

Formatted (and shortened) output for AssetConvexityAdjustment payoff.

source
string(p::ForwardIndex)

Formatted (and shortened) output for ForwardIndex payoff.

source
string(p::IndexConvexityAdjustment)

Formatted (and shortened) output for IndexConvexityAdjustment payoff.

source
string(p::FutureIndex)

Formatted (and shortened) output for FutureIndex payoff.

source
string(p::Pay)

Formatted (and shortened) output for Pay payoff.

source
string(p::Cache)

Formatted (and shortened) output for Cache payoff.

source
string(p::Exp)

Formatted output for Exp payoff.

source
string(p::Log)

Formatted output for Log payoff.

source

Formatted addition.

source

Formatted subtraction.

source

Formatted multiplication.

source

Formatted division.

source

Formatted maximum.

source

Formatted minimum.

source

Formatted logical.

source
string(p::LiborRate)

Formatted (and shortened) output for LiborRate payoff.

source
string(p::CompoundedRate)

Formatted (and shortened) output for CompoundedRate payoff.

source
string(p::Optionlet)

Formatted (and shortened) output for Optionlet payoff.

source
string(p::Swaption)

Formatted (and shortened) output for Swaption payoff.

source
string(links::AmcPayoffLinks)

Formatted (and shortened) output for AMC payoff links.

source
string(p::AmcMax)

Formatted (and shortened) output for AmcMax payoff.

source
string(p::AmcMin)

Formatted (and shortened) output for AmcMin payoff.

source
string(p::AmcOne)

Formatted (and shortened) output for AmcOne payoff.

source
string(p::AmcSum)

Formatted (and shortened) output for AmcSum payoff.

source
string(p::VanillaAssetOption)

Formatted (and shortened) output for VanillaAssetOption payoff.

source
string(p::VanillaAssetOption)

Formatted (and shortened) output for VanillaAssetOption payoff.

source
+end

Path-wise minimum

source

Common Payoff Methods Overview

DiffFusion.obs_timeFunction
obs_time(p::Payoff)

A Payoff is typically observed at a particular time. In that sense, a Payoff is an $F_t$-measurable random variable.

The observation time represents the time, after which the payoff is known.

source
obs_time(p::Leaf)

Return the observation time for a Leaf object.

source
obs_time(p::UnaryNode)

Return the observation time of the linked payoff.

source
obs_time(p::BinaryNode)

Derive the observation time from linked payoffs.

source
obs_time(p::Fixed)

Observation time for Fixed payoffs is zero because they are deterministic.

source
obs_time(p::ScalarValue)

Observation time for ScalarValue payoffs is zero because they are deterministic.

source
obs_time(p::Pay)

Return decorating observation time.

source
obs_time(p::CompoundedRate)

Calculate observation time for CompoundedRate payoff.

source
obs_time(p::Optionlet)

Return Optionlet observation time.

source
obs_time(p::Swaption)

Return Swaption observation time.

source
obs_time(p::AmcPayoff)

Return the AMC payoff observation time

source
obs_time(p::VanillaAssetOption)

Return VanillaAssetOption observation time.

source
obs_time(p::BarrierAssetOption)

Return BarrierAssetOption observation time.

source
DiffFusion.obs_timesFunction
obs_times(p::Payoff)

A payoff is typically linked to other payoffs and forms a DAG. This function returns all observation times associated with a given payoff.

This functionality is required to determine relevant simulation grid points.

source
obs_times(p::Leaf)

Derive the set of observation times from the single observation time of the Leaf object.

source
obs_times(p::UnaryNode)

Return all observation times of the linked payoff.

source
obs_times(p::BinaryNode)

Derive all observation times from linked payoff.

source
obs_times(p::Pay)

Return all observation times of the linked payoff.

source
obs_times(p::CompoundedRate)

Calculate all observation times (i.e. event times) for CompoundedRate payoff.

source
obs_times(p::Optionlet)

Return all Optionlet observation times.

source
obs_times(p::Swaption)

Return all Swaption observation times.

source
obs_times(p::AmcPayoff)

Return observation times of all referenced payoffs.

source
obs_times(p::VanillaAssetOption)

Return all VanillaAssetOption observation times.

source
obs_times(p::BarrierAssetOption)

Return all BarrierAssetOption observation times.

source
DiffFusion.atFunction
at(p::Payoff, path::AbstractPath)

Evaluate a Payoff at a given path, X(omega).

Depending on the functionality associated with the path, this function typically returns a vector of realisations.

This function is invoked when using call operator on a Payoff,

(p::Payoff)(path::AbstractPath) = at(p::Payoff, path::AbstractPath)
source
at(p::Numeraire, path::AbstractPath)

Derive the numeraire price at a given path.

source
at(p::BankAccount, path::AbstractPath)

Derive the bank account price at a given path.

source
at(p::ZeroBond, path::AbstractPath)

Derive the zero bond price at a given path.

source
at(p::Asset, path::AbstractPath)

Derive the asset price at a given path.

source
at(p::ForwardAsset, path::AbstractPath)

Derive the asset price at a given path.

source
at(p::Fixing, path::AbstractPath)

Derive the fixing value at a given path.

source
at(p::Fixed, path::AbstractPath)

Return the deterministic value broadcasted to the length of the path.

source
at(p::ScalarValue, path::AbstractPath)

Return the deterministic scalar value.

This aims at avoiding some unnecessary allocations.

source
at(p::AssetConvexityAdjustment, path::AbstractPath)

Derive the YoY payoff convexity adjustment at a given path.

source
at(p::ForwardIndex, path::AbstractPath)

Derive forward index value at a given path.

source
at(p::IndexConvexityAdjustment, path::AbstractPath)

Derive the YoY payoff convexity adjustment at a given path.

source
at(p::FutureIndex, path::AbstractPath)

Derive forward index value at a given path.

source
at(p::Pay, path::AbstractPath)

Derive payoff of the child payoff.

source
at(p::Cache, path::AbstractPath)

Derive payoff of the child payoff only if not yet calculated.

source
at(p::Exp, path::AbstractPath)

Evaluate exp-function.

source
at(p::Log, path::AbstractPath)

Evaluate log-function.

source

Addition.

source

Subtraction.

source

Multiplication.

source

Division.

source

Maximum

source

Minimum

source

Logical

source
at(p::LiborRate, path::AbstractPath)

Derive the forward Libor rate at a given path.

source
at(p::CompoundedRate, path::AbstractPath)

Derive the compounded backward looking rate at a given path.

source
at(p::Optionlet, path::AbstractPath)

Evaluate a Optionlet at a given path, X(omega).

source
at(p::Swaption, path::AbstractPath)

Evaluate a Swaption at a given path, X(omega).

source
at(links::AmcPayoffLinks, regr::AmcPayoffRegression, path::AbstractPath)

Calculate the common components of AMC payoffs for a given valuation path.

source
at(p::AmcMax, path::AbstractPath)

Evaluate an AmcMax payoff at a given path.

source
at(p::AmcMin, path::AbstractPath)

Evaluate an AmcMin payoff at a given path.

source
at(p::AmcOne, path::AbstractPath)

Evaluate an AmcOne payoff at a given path.

source
at(p::AmcSum, path::AbstractPath)

Evaluate an AmcSum payoff at a given path.

source
at(p::VanillaAssetOption, path::AbstractPath)

Evaluate a VanillaAssetOption at a given path, X(omega).

source
at(p::BarrierAssetOption, path::AbstractPath)

Evaluate a BarrierAssetOption at a given path, X(omega).

source
Base.stringFunction
string(p::Numeraire)

Formatted (and shortened) output for Numeraire payoff.

source
string(p::BankAccount)

Formatted (and shortened) output for BankAccount payoff.

source
string(p::ZeroBond)

Formatted (and shortened) output for ZeroBond payoff.

source
string(p::Asset)

Formatted (and shortened) output for Asset payoff.

source
string(p::ForwardAsset)

Formatted (and shortened) output for ForwardAsset payoff.

source
string(p::Fixing)

Formatted (and shortened) output for Fixing payoff.

source
string(p::Fixed)

Formatted (and shortened) output for deterministic payoff.

source
string(p::ScalarValue)

Formatted (and shortened) output for deterministic payoff.

source
string(p::AssetConvexityAdjustment)

Formatted (and shortened) output for AssetConvexityAdjustment payoff.

source
string(p::ForwardIndex)

Formatted (and shortened) output for ForwardIndex payoff.

source
string(p::IndexConvexityAdjustment)

Formatted (and shortened) output for IndexConvexityAdjustment payoff.

source
string(p::FutureIndex)

Formatted (and shortened) output for FutureIndex payoff.

source
string(p::Pay)

Formatted (and shortened) output for Pay payoff.

source
string(p::Cache)

Formatted (and shortened) output for Cache payoff.

source
string(p::Exp)

Formatted output for Exp payoff.

source
string(p::Log)

Formatted output for Log payoff.

source

Formatted addition.

source

Formatted subtraction.

source

Formatted multiplication.

source

Formatted division.

source

Formatted maximum.

source

Formatted minimum.

source

Formatted logical.

source
string(p::LiborRate)

Formatted (and shortened) output for LiborRate payoff.

source
string(p::CompoundedRate)

Formatted (and shortened) output for CompoundedRate payoff.

source
string(p::Optionlet)

Formatted (and shortened) output for Optionlet payoff.

source
string(p::Swaption)

Formatted (and shortened) output for Swaption payoff.

source
string(links::AmcPayoffLinks)

Formatted (and shortened) output for AMC payoff links.

source
string(p::AmcMax)

Formatted (and shortened) output for AmcMax payoff.

source
string(p::AmcMin)

Formatted (and shortened) output for AmcMin payoff.

source
string(p::AmcOne)

Formatted (and shortened) output for AmcOne payoff.

source
string(p::AmcSum)

Formatted (and shortened) output for AmcSum payoff.

source
string(p::VanillaAssetOption)

Formatted (and shortened) output for VanillaAssetOption payoff.

source
string(p::VanillaAssetOption)

Formatted (and shortened) output for VanillaAssetOption payoff.

source
diff --git a/dev/payoffs/rates_payoffs/index.html b/dev/payoffs/rates_payoffs/index.html index 7f689fb..ef5972b 100644 --- a/dev/payoffs/rates_payoffs/index.html +++ b/dev/payoffs/rates_payoffs/index.html @@ -2,28 +2,28 @@ Interest Rates · [∂F]

Interest Rates

Building Blocks

DiffFusion.NumeraireType
struct Numeraire <: Leaf
     obs_time::ModelTime
     curve_key::String
-end

The price of our numeraire asset price N(t) at observation time t.

Typically, this coincides with the bank account price in numeraire (i.e. domestic) currency.

source
DiffFusion.BankAccountType
struct BankAccount <: Leaf
+end

The price of our numeraire asset price N(t) at observation time t.

Typically, this coincides with the bank account price in numeraire (i.e. domestic) currency.

source
DiffFusion.BankAccountType
struct BankAccount <: Leaf
     obs_time::ModelTime
     key::String
-end

The price of a continuous compounded bank account B(t) at observation time t and with unit notional at inception.

source
DiffFusion.ZeroBondType
struct ZeroBond <: Leaf
+end

The price of a continuous compounded bank account B(t) at observation time t and with unit notional at inception.

source
DiffFusion.ZeroBondType
struct ZeroBond <: Leaf
     obs_time::ModelTime
     maturity_time::ModelTime
     key::String
-end

The price of a zero coupon bond P(t,T) with observation time t and bond maturity time T.

source
DiffFusion.FixingType
struct Fixing <: Leaf
+end

The price of a zero coupon bond P(t,T) with observation time t and bond maturity time T.

source
DiffFusion.FixingType
struct Fixing <: Leaf
     obs_time::ModelTime
     key::String
-end

The value of an index fixing Idx(t) at observation time t.

The value is obtained from a term structure linked to the path.

source

Rates Payoffs

DiffFusion.LiborRateType
struct LiborRate <: Leaf
+end

The value of an index fixing Idx(t) at observation time t.

The value is obtained from a term structure linked to the path.

source

Rates Payoffs

DiffFusion.LiborRateType
struct LiborRate <: Leaf
     obs_time::ModelTime
     start_time::ModelTime
     end_time::ModelTime
     year_fraction::ModelValue
     key::String
-end

A simple compounded forward Libor rate.

source
DiffFusion.LiborRateMethod
LiborRate(
    obs_time::ModelTime,
    start_time::ModelTime,
    end_time::ModelTime,
    key::String,
-   )

A simple compounded forward Libor rate with year fraction from model time.

source
DiffFusion.CompoundedRateType
struct CompoundedRate <: Payoff
     obs_time::ModelTime
     start_time::ModelTime
     end_time::ModelTime
@@ -31,27 +31,27 @@
     fixed_compounding::Union{Payoff, Nothing}
     key::String
     fixed_type::DataType  # distinguish from constructors
-end

A continuously compounded backward looking rate.

This is a proxy for daily compounded RFR coupon rates.

For obstime less starttime it is equivalent to a Libor rate.

source
DiffFusion.CompoundedRateMethod
CompoundedRate(
+end

A continuously compounded backward looking rate.

This is a proxy for daily compounded RFR coupon rates.

For obstime less starttime it is equivalent to a Libor rate.

source
DiffFusion.CompoundedRateMethod
CompoundedRate(
     obs_time::ModelTime,
     start_time::ModelTime,
     end_time::ModelTime,
     key::String,
     fixed_compounding::Union{Payoff, Nothing} = nothing,
-    )

A continuously compounded backward looking rate with year fraction from model time.

source
DiffFusion.OptionletType
struct Optionlet <: Payoff
+    )

A continuously compounded backward looking rate with year fraction from model time.

source
DiffFusion.OptionletType
struct Optionlet <: Payoff
     obs_time::ModelTime
     expiry_time::ModelTime
     gearing_factor::Payoff
     forward_rate::Union{LiborRate, CompoundedRate}
     strike_rate::Payoff
     call_put::ModelValue
-end

The time-t forward price of an option paying [ϕ(R-K)]^+. Rate R is determined at expiry_time. The rate R can be forward-looking or backward-looking.

forward price is calculated as expectation in T-forward measure where T corresponds to the period end time. Conditioning (for time-t price) is on information at obs_time.

The rate R is written in terms of a compounding factor C and R = [G C - 1]/τ. Here, G is an additional gearing factor to capture past OIS fixings.

Then, option payoff becomes G/τ [ϕ(C - (1 + τK)/G)]^+.

source
DiffFusion.OptionletType
Optionlet(
+end

The time-t forward price of an option paying [ϕ(R-K)]^+. Rate R is determined at expiry_time. The rate R can be forward-looking or backward-looking.

forward price is calculated as expectation in T-forward measure where T corresponds to the period end time. Conditioning (for time-t price) is on information at obs_time.

The rate R is written in terms of a compounding factor C and R = [G C - 1]/τ. Here, G is an additional gearing factor to capture past OIS fixings.

Then, option payoff becomes G/τ [ϕ(C - (1 + τK)/G)]^+.

source
DiffFusion.OptionletType
Optionlet(
     obs_time_::ModelTime,
     expiry_time::ModelTime,
     forward_rate::Union{LiborRate, CompoundedRate},
     strike_rate::Payoff,
     call_put::ModelValue,
     gearing_factor::Payoff = ScalarValue(1.0),
-    )

Create an Optionlet payoff.

source
DiffFusion.SwaptionType
struct Swaption <: Payoff
     obs_time::ModelTime
     expiry_time::ModelTime
     settlement_time::ModelTime
@@ -64,7 +64,7 @@
     disc_key::String
     zcb_pay_times::AbstractVector
     rate_type::DataType  # to distinguish from functions
-end

Time-t forward price of an option paying An⋅[ϕ(S-K)]^+. Swap rate S is determined at expiry_time. Floating rates in S can be forward looking of backward looking rates.

Forward price is calculated in T-forward measure where T corresponds to settlement_time. Conditioning (for time-t price) is on information at obs_time.

source
DiffFusion.SwaptionMethod
Swaption(
+end

Time-t forward price of an option paying An⋅[ϕ(S-K)]^+. Swap rate S is determined at expiry_time. Floating rates in S can be forward looking of backward looking rates.

Forward price is calculated in T-forward measure where T corresponds to settlement_time. Conditioning (for time-t price) is on information at obs_time.

source
DiffFusion.SwaptionMethod
Swaption(
     obs_time_::ModelTime,
     expiry_time::ModelTime,
     settlement_time::ModelTime,
@@ -74,4 +74,4 @@
     fixed_rate::ModelValue,
     payer_receiver::ModelValue,
     disc_key::String,
-    )

Create a Swaption payoff.

source
+ )

Create a Swaption payoff.

source diff --git a/dev/pricing_configuration/context/index.html b/dev/pricing_configuration/context/index.html index 767ab60..5411f11 100644 --- a/dev/pricing_configuration/context/index.html +++ b/dev/pricing_configuration/context/index.html @@ -7,27 +7,27 @@ forward_indices::Dict{String, ForwardIndexEntry} future_indices::Dict{String, FutureIndexEntry} fixings::Dict{String, FixingEntry} -end

A Context represents a mapping from market references (keys) to model and term structure references (aliases).

Links are represented as key/alias pairs. market references are used in the specification of payoffs and products. Model and term structure references are used to set up models and model parameters.

In simple settings there can be a one-to-one mapping between market references and model/term structure references. However, more realistic settings benefit from an additional mapping. For example, discount factors for two (or more) market reference (say EUR ESTR and EUR Euribor) can be calculated from a single model (with model reference EUR) and two (or more) yield curves (with term structure reference ESTR and Euribor).

A Context

source

Context Entries

DiffFusion.ContextEntryType
abstract type ContextEntry end

A ContextEntry represents a mapping from a context key to model aliases and term structure aliases.

We use the convention that keys are UPPERCASE strings. This aims at helping to distinguish between keys and alias.

source
DiffFusion.NumeraireEntryType
struct NumeraireEntry <: ContextEntry
+end

A Context represents a mapping from market references (keys) to model and term structure references (aliases).

Links are represented as key/alias pairs. market references are used in the specification of payoffs and products. Model and term structure references are used to set up models and model parameters.

In simple settings there can be a one-to-one mapping between market references and model/term structure references. However, more realistic settings benefit from an additional mapping. For example, discount factors for two (or more) market reference (say EUR ESTR and EUR Euribor) can be calculated from a single model (with model reference EUR) and two (or more) yield curves (with term structure reference ESTR and Euribor).

A Context

  • adds a layer of abstraction to disentangle models and products and

  • links models and term structures according to business logic.

source

Context Entries

DiffFusion.ContextEntryType
abstract type ContextEntry end

A ContextEntry represents a mapping from a context key to model aliases and term structure aliases.

We use the convention that keys are UPPERCASE strings. This aims at helping to distinguish between keys and alias.

source
DiffFusion.NumeraireEntryType
struct NumeraireEntry <: ContextEntry
     context_key::String
     model_alias::Union{String, Nothing}
     termstructure_dict::Dict{String,String}
-end

A NumeraireEntry represents a link to an interest rate model and yield curves used for numeraire calculation.

We opt to allow for different yield curves in numeraire application. This should allow e.g. AMC methods wih trade-specific discounting.

An empty model alias (nothing) represents a deterministic model.

The termstructure_dict maps term structure keys to term structure aliases.

We use the convention that keys are UPPERCASE strings. This aims at helping to distinguish between keys and alias.

source
DiffFusion.numeraire_entryFunction
numeraire_entry(
+end

A NumeraireEntry represents a link to an interest rate model and yield curves used for numeraire calculation.

We opt to allow for different yield curves in numeraire application. This should allow e.g. AMC methods wih trade-specific discounting.

An empty model alias (nothing) represents a deterministic model.

The termstructure_dict maps term structure keys to term structure aliases.

We use the convention that keys are UPPERCASE strings. This aims at helping to distinguish between keys and alias.

source
DiffFusion.numeraire_entryFunction
numeraire_entry(
     context_key::String,
     model_alias::Union{String, Nothing} = nothing,
     termstructure_dict::Union{AbstractDict, Nothing} = nothing,
-    )

Simplify NumeraireEntry setup.

source
numeraire_entry(
+    )

Simplify NumeraireEntry setup.

source
numeraire_entry(
     context_key::String,
     model_alias::Union{String, Nothing},
     termstructure_alias::String,
-    )

Simplify NumeraireEntry setup.

source
DiffFusion.RatesEntryType
struct RatesEntry <: ContextEntry
+    )

Simplify NumeraireEntry setup.

source
DiffFusion.RatesEntryType
struct RatesEntry <: ContextEntry
     context_key::String
     model_alias::Union{String, Nothing}
     termstructure_dict::Dict{String,String}
-end

A RatesEntry represents a link to an interest rate model and yield curves used for zero coupon bond calculation.

An empty model alias (nothing) represents a deterministic model.

The termstructure_dict maps term structure keys to term structure aliases.

We use the convention that keys are UPPERCASE strings. This aims at helping to distinguish between keys and alias.

source
DiffFusion.rates_entryFunction
rates_entry(
+end

A RatesEntry represents a link to an interest rate model and yield curves used for zero coupon bond calculation.

An empty model alias (nothing) represents a deterministic model.

The termstructure_dict maps term structure keys to term structure aliases.

We use the convention that keys are UPPERCASE strings. This aims at helping to distinguish between keys and alias.

source
DiffFusion.rates_entryFunction
rates_entry(
     context_key::String,
     model_alias::Union{String, Nothing} = nothing,
     termstructure_dict::Union{AbstractDict, Nothing} = nothing,
-    )

Simplify RatesEntry setup.

source

ratesentry( contextkey::String, modelalias::Union{String, Nothing}, termstructurealias::String, )

Simplify RatesEntry setup.

source
DiffFusion.AssetEntryType
struct AssetEntry <: ContextEntry
+    )

Simplify RatesEntry setup.

source

ratesentry( contextkey::String, modelalias::Union{String, Nothing}, termstructurealias::String, )

Simplify RatesEntry setup.

source
DiffFusion.AssetEntryType
struct AssetEntry <: ContextEntry
     context_key::String
     asset_model_alias::Union{String, Nothing}
     domestic_model_alias::Union{String, Nothing}
@@ -35,7 +35,7 @@
     asset_spot_alias::String
     domestic_termstructure_dict::Dict{String,String}
     foreign_termstructure_dict::Dict{String,String}
-end

An AssetEntry represents a link to an asset model, two interest rate models and yield curves. This entry is used to calculate future simulated asset values.

We use the foreign currency analogy to represent tradeable assets.

An empty model alias (nothing) represents a deterministic model.

domestic_termstructure_dict and foreign_termstructure_dict map term structure keys to term structure aliases.

We use the convention that keys are UPPERCASE strings. This aims at helping to distinguish between keys and alias.

source
DiffFusion.asset_entryFunction
asset_entry(
+end

An AssetEntry represents a link to an asset model, two interest rate models and yield curves. This entry is used to calculate future simulated asset values.

We use the foreign currency analogy to represent tradeable assets.

An empty model alias (nothing) represents a deterministic model.

domestic_termstructure_dict and foreign_termstructure_dict map term structure keys to term structure aliases.

We use the convention that keys are UPPERCASE strings. This aims at helping to distinguish between keys and alias.

source
DiffFusion.asset_entryFunction
asset_entry(
     context_key::String,
     asset_model_alias::Union{String, Nothing} = nothing,
     domestic_model_alias::Union{String, Nothing} = nothing,
@@ -43,7 +43,7 @@
     asset_spot_alias::Union{String, Nothing} = nothing,
     domestic_termstructure_dict::Union{AbstractDict, Nothing} = nothing,
     foreign_termstructure_dict::Union{AbstractDict, Nothing} = nothing,
-    )

Simplify AssetEntry setup.

source
asset_entry(
+    )

Simplify AssetEntry setup.

source
asset_entry(
     context_key::String,
     asset_model_alias::Union{String, Nothing} = nothing,
     domestic_model_alias::Union{String, Nothing} = nothing,
@@ -51,33 +51,33 @@
     asset_spot_alias::Union{String, Nothing} = nothing,
     domestic_termstructure_alias::String,
     foreign_termstructure_alias::String,
-    )

Simplify AssetEntry setup.

source
DiffFusion.ForwardIndexEntryType
struct ForwardIndexEntry <: ContextEntry
+    )

Simplify AssetEntry setup.

source
DiffFusion.ForwardIndexEntryType
struct ForwardIndexEntry <: ContextEntry
     context_key::String
     asset_model_alias::Union{String, Nothing}
     domestic_model_alias::Union{String, Nothing}
     foreign_model_alias::Union{String, Nothing}
     forward_index_alias::String
-end

A ForwardIndexEntry represents a link to an asset model, two interest rate models and a forward index curves. This entry is used to calculate future simulated forward asset prices.

We use the foreign currency analogy to represent tradeable assets.

An empty model alias (nothing) represents a deterministic model.

forward_index_alias represents the link to the forward index curve.

We use the convention that keys are UPPERCASE strings. This aims at helping to distinguish between keys and alias.

source
DiffFusion.forward_index_entryFunction
forward_index_entry(
+end

A ForwardIndexEntry represents a link to an asset model, two interest rate models and a forward index curves. This entry is used to calculate future simulated forward asset prices.

We use the foreign currency analogy to represent tradeable assets.

An empty model alias (nothing) represents a deterministic model.

forward_index_alias represents the link to the forward index curve.

We use the convention that keys are UPPERCASE strings. This aims at helping to distinguish between keys and alias.

source
DiffFusion.forward_index_entryFunction
forward_index_entry(
     context_key::String,
     asset_model_alias::Union{String, Nothing} = nothing,
     domestic_model_alias::Union{String, Nothing} = nothing,
     foreign_model_alias::Union{String, Nothing} = nothing,
     forward_index_alias::Union{String, Nothing} = nothing,
-    )

Simplify ForwardIndexEntry setup.

source
DiffFusion.FutureIndexEntryType
struct FutureIndexEntry <: ContextEntry
+    )

Simplify ForwardIndexEntry setup.

source
DiffFusion.FutureIndexEntryType
struct FutureIndexEntry <: ContextEntry
     context_key::String
     future_model_alias::Union{String, Nothing}
     future_index_alias::String
-end

A FutureIndexEntry represents a link to a Futures model and a future index curve. This entry is used to calculate future simulated Future prices.

Key proposition is that the Future price is a martingale in the corresponding domestic risk-neutral measure.

An empty model alias (nothing) represents a deterministic model.

future_index_alias represents the link to the Future index curve.

We use the convention that keys are UPPERCASE strings. This aims at helping to distinguish between keys and alias.

source
DiffFusion.future_index_entryFunction
future_index_entry(
+end

A FutureIndexEntry represents a link to a Futures model and a future index curve. This entry is used to calculate future simulated Future prices.

Key proposition is that the Future price is a martingale in the corresponding domestic risk-neutral measure.

An empty model alias (nothing) represents a deterministic model.

future_index_alias represents the link to the Future index curve.

We use the convention that keys are UPPERCASE strings. This aims at helping to distinguish between keys and alias.

source
DiffFusion.future_index_entryFunction
future_index_entry(
     context_key::String,
     future_model_alias::Union{String, Nothing} = nothing,
     future_index_alias::String = nothing,
-    )

Simplify FutureIndexEntry setup.

source
DiffFusion.FixingEntryType
struct FixingEntry <: ContextEntry
+    )

Simplify FutureIndexEntry setup.

source
DiffFusion.FixingEntryType
struct FixingEntry <: ContextEntry
     context_key::String
     termstructure_alias::String
-end

A FixingEntry represents a link to a parameter term structure used to obtain fixings for indices etc.

source
DiffFusion.fixing_entryFunction
fixing_entry(
+end

A FixingEntry represents a link to a parameter term structure used to obtain fixings for indices etc.

source
DiffFusion.fixing_entryFunction
fixing_entry(
     context_key::String,
     termstructure_alias::Union{String, Nothing} = nothing,
-    )

Simplify FixingEntry setup.

source
DiffFusion.keyMethod
key(ce::ContextEntry)

Return the context key of a context entry.

source

Context Creation

DiffFusion.contextFunction
context(
+    )

Simplify FixingEntry setup.

source
DiffFusion.keyMethod
key(ce::ContextEntry)

Return the context key of a context entry.

source

Context Creation

DiffFusion.contextFunction
context(
     alias::String,
     num_entry::NumeraireEntry,
     rates_entries::Union{AbstractVector, Nothing} = nothing,
@@ -85,4 +85,4 @@
     forward_index_entries::Union{AbstractVector, Nothing} = nothing,
     future_index_entries::Union{AbstractVector, Nothing} = nothing,
     fixing_entries::Union{AbstractVector, Nothing} = nothing,
-    )

Simplify Context setup.

source
DiffFusion.simple_contextFunction
simple_context(alias::String, alias_list::AbstractVector)

Generate a simple Context based on a list of currency aliases.

User must ensure that aliases can be referenced as normalised keys.

source
DiffFusion.deterministic_model_contextFunction
deterministic_model_context(alias::String, alias_list::AbstractVector)

Generate a simple Context for fully deterministic modelling based on a list of currency aliases.

User must ensure that aliases can be referenced as normalised keys.

source
DiffFusion.context_keysFunction
context_keys(key::String)

Parse the context entry key and term structure keys from an input key string.

We implement a simple syntax for input key strings:

context_key:[ts_key_1][-,+][ts_key_2]

Result is a tuple of the form

(context_key, ts_key_1, ts_key_2, [-,+])

Elements that are not found are returned as emptycontextkey value.

We apply normalisation of keys to mitigate risk of key errors by the user.

source
+ )

Simplify Context setup.

source
DiffFusion.simple_contextFunction
simple_context(alias::String, alias_list::AbstractVector)

Generate a simple Context based on a list of currency aliases.

User must ensure that aliases can be referenced as normalised keys.

source
DiffFusion.deterministic_model_contextFunction
deterministic_model_context(alias::String, alias_list::AbstractVector)

Generate a simple Context for fully deterministic modelling based on a list of currency aliases.

User must ensure that aliases can be referenced as normalised keys.

source
DiffFusion.context_keysFunction
context_keys(key::String)

Parse the context entry key and term structure keys from an input key string.

We implement a simple syntax for input key strings:

context_key:[ts_key_1][-,+][ts_key_2]

Result is a tuple of the form

(context_key, ts_key_1, ts_key_2, [-,+])

Elements that are not found are returned as emptycontextkey value.

We apply normalisation of keys to mitigate risk of key errors by the user.

source
diff --git a/dev/pricing_configuration/paths/index.html b/dev/pricing_configuration/paths/index.html index b7e36e2..cfe286c 100644 --- a/dev/pricing_configuration/paths/index.html +++ b/dev/pricing_configuration/paths/index.html @@ -1,62 +1,62 @@ -Simulated Paths · [∂F]

Simulated Paths

The concept of a path adds a layer of abstraction. On the one-hand side we have models and simulations. These objects are specified by the mathematical details of stochastic processes. On the other hand-side we have payoffs and products. These objects are specified by the business context.

A path is used to link business context and payoff evaluation to models and simulations.

Path Creation

DiffFusion.AbstractPathType
abstract type AbstractPath end

An AbstractPath specifies the interface for path implementations.

This aims at providing the flexibility to add other types of paths in the future.

source
DiffFusion.PathType
struct Path <: AbstractPath
+Simulated Paths · [∂F]

Simulated Paths

The concept of a path adds a layer of abstraction. On the one-hand side we have models and simulations. These objects are specified by the mathematical details of stochastic processes. On the other hand-side we have payoffs and products. These objects are specified by the business context.

A path is used to link business context and payoff evaluation to models and simulations.

Path Creation

DiffFusion.AbstractPathType
abstract type AbstractPath end

An AbstractPath specifies the interface for path implementations.

This aims at providing the flexibility to add other types of paths in the future.

source
DiffFusion.PathType
struct Path <: AbstractPath
     sim::Simulation
     ts_dict::Dict{String,<:Termstructure}
     state_alias_dict::Dict{String,Int}
     context::Context
     interpolation::PathInterpolation
-end

A Path combines a model, simulated model states and term structures. The interface to market references is established by a valuation context.

Paths are used by payoffs to calculate simulated zero bonds, asset prices and further building blocks of financial instrument payoffs.

source
DiffFusion.pathFunction
path(
+end

A Path combines a model, simulated model states and term structures. The interface to market references is established by a valuation context.

Paths are used by payoffs to calculate simulated zero bonds, asset prices and further building blocks of financial instrument payoffs.

source
DiffFusion.pathFunction
path(
     sim::Simulation,
     ts_dict::Dict{String,<:Termstructure},
     cxt::Context,
     ip::PathInterpolation = NoPathInterpolation
-    )

Create a Path object.

source
path(
+    )

Create a Path object.

source
path(
     sim::Simulation,
     ts::Vector{Termstructure},
     cxt::Context,
     ip::PathInterpolation = NoPathInterpolation
-    )

Create a Path object from a list of term structures.

source
DiffFusion.PathInterpolationType
@enum(
     PathInterpolation,
     NoPathInterpolation,
     LinearPathInterpolation,
-)

PathInterpolation encodes how simulated states can be interpolates.

source

Path Functions

DiffFusion.numeraireFunction
numeraire(p::AbstractPath, t::ModelTime, curve_key::String)

Calculate the numeraire in the domestic currency.

We allow for curve-specific numeraire calculation e.g. to allow for trade-specific discounting in AMC valuation.

source
numeraire(p::Path, t::ModelTime, curve_key::String)

Calculate the numeraire in the domestic currency.

We allow for curve-specific numeraire calculation e.g. to allow for trade-specific discounting in AMC valuation.

source
DiffFusion.bank_accountFunction
bank_account(p::AbstractPath, t::ModelTime, key::String)

Calculate a continuous compounded bank account value.

source
bank_account(p::Path, t::ModelTime, key::String)

Calculate a continuous compounded bank account value.

source
DiffFusion.zero_bondFunction
zero_bond(p::AbstractPath, t::ModelTime, T::ModelTime, key::String)

Calculate a zero coupon bond price.

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

Calculate a zero coupon bond price.

source

Path Functions

DiffFusion.numeraireFunction
numeraire(p::AbstractPath, t::ModelTime, curve_key::String)

Calculate the numeraire in the domestic currency.

We allow for curve-specific numeraire calculation e.g. to allow for trade-specific discounting in AMC valuation.

source
numeraire(p::Path, t::ModelTime, curve_key::String)

Calculate the numeraire in the domestic currency.

We allow for curve-specific numeraire calculation e.g. to allow for trade-specific discounting in AMC valuation.

source
DiffFusion.bank_accountFunction
bank_account(p::AbstractPath, t::ModelTime, key::String)

Calculate a continuous compounded bank account value.

source
bank_account(p::Path, t::ModelTime, key::String)

Calculate a continuous compounded bank account value.

source
DiffFusion.zero_bondFunction
zero_bond(p::AbstractPath, t::ModelTime, T::ModelTime, key::String)

Calculate a zero coupon bond price.

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

Calculate a zero coupon bond price.

source
DiffFusion.zero_bondsFunction
zero_bonds(
     yts::YieldTermstructure,
     m::GaussianHjmModel,
     t::ModelTime,
     T::AbstractVector,
     SX::ModelState,
-    )

Zero bond price reconstruction.

Returns a vector of length p where p is the number of paths in SX.

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

Calculate a zero coupon bond prices.

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

Calculate zero coupon bond prices.

source
DiffFusion.compounding_factorFunction
compounding_factor(p::AbstractPath, t::ModelTime, T1::ModelTime, T2::ModelTime, key::String)

Calculate a compounding factor P(t,T1) / P(t,T2).

source
compounding_factor(p::Path, t::ModelTime, T1::ModelTime, T2::ModelTime, key::String)

Calculate a compounding factor P(t,T1) / P(t,T2).

source
DiffFusion.assetFunction
asset(p::AbstractPath, t::ModelTime, key::String)

Calculate asset price.

source
asset(p::Path, t::ModelTime, key::String)

Calculate asset price.

source
DiffFusion.forward_assetFunction
forward_asset(p::AbstractPath, t::ModelTime, T::ModelTime, key::String)

Calculate forward asset price as expectation in T-forward measure.

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

Calculate forward asset price as expectation in T-forward measure, conditional on time-t.

source
DiffFusion.fixingFunction
fixing(p::AbstractPath, t::ModelTime, key::String)

Return a fixing from a term structure.

This is used to handle fixings for indices etc.

source
fixing(p::Path, t::ModelTime, key::String)

Return a fixing from a term structure.

source
DiffFusion.asset_convexity_adjustmentFunction
asset_convexity_adjustment(
+    )

Zero bond price reconstruction.

Returns a vector of length p where p is the number of paths in SX.

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

Calculate a zero coupon bond prices.

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

Calculate zero coupon bond prices.

source
DiffFusion.compounding_factorFunction
compounding_factor(p::AbstractPath, t::ModelTime, T1::ModelTime, T2::ModelTime, key::String)

Calculate a compounding factor P(t,T1) / P(t,T2).

source
compounding_factor(p::Path, t::ModelTime, T1::ModelTime, T2::ModelTime, key::String)

Calculate a compounding factor P(t,T1) / P(t,T2).

source
DiffFusion.assetFunction
asset(p::AbstractPath, t::ModelTime, key::String)

Calculate asset price.

source
asset(p::Path, t::ModelTime, key::String)

Calculate asset price.

source
DiffFusion.forward_assetFunction
forward_asset(p::AbstractPath, t::ModelTime, T::ModelTime, key::String)

Calculate forward asset price as expectation in T-forward measure.

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

Calculate forward asset price as expectation in T-forward measure, conditional on time-t.

source
DiffFusion.fixingFunction
fixing(p::AbstractPath, t::ModelTime, key::String)

Return a fixing from a term structure.

This is used to handle fixings for indices etc.

source
fixing(p::Path, t::ModelTime, key::String)

Return a fixing from a term structure.

source
DiffFusion.asset_convexity_adjustmentFunction
asset_convexity_adjustment(
     p::AbstractPath,
     t::ModelTime,
     T0::ModelTime,
     T1::ModelTime,
     T2::ModelTime,
     key::String
-    )

Return the convexity adjustment for a YoY asset payoff.

source
asset_convexity_adjustment(
+    )

Return the convexity adjustment for a YoY asset payoff.

source
asset_convexity_adjustment(
     p::Path,
     t::ModelTime,
     T0::ModelTime,
     T1::ModelTime,
     T2::ModelTime,
     key::String
-    )

Return the convexity adjustment for a YoY asset payoff.

source
DiffFusion.forward_indexFunction
forward_index(p::AbstractPath, t::ModelTime, T::ModelTime, key::String)

Expectation Et^T[ST] of a tradeable asset.

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

Expectation Et^T[ST] of a tradeable asset.

source
DiffFusion.forward_indexFunction
forward_index(p::AbstractPath, t::ModelTime, T::ModelTime, key::String)

Expectation Et^T[ST] of a tradeable asset.

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

Expectation Et^T[ST] of a tradeable asset.

source
DiffFusion.index_convexity_adjustmentFunction
index_convexity_adjustment(
     p::AbstractPath,
     t::ModelTime,
     T0::ModelTime,
     T1::ModelTime,
     T2::ModelTime,
     key::String
-    )

Return the convexity adjustment for a YoY index payoff.

source
index_convexity_adjustment(
+    )

Return the convexity adjustment for a YoY index payoff.

source
index_convexity_adjustment(
     p::Path,
     t::ModelTime,
     T0::ModelTime,
     T1::ModelTime,
     T2::ModelTime,
     key::String
-    )

Return the convexity adjustment for a YoY index payoff.

source
DiffFusion.future_indexFunction
future_index(p::AbstractPath, t::ModelTime, T::ModelTime, key::String)

Expectation E_t^Q[F(T,T)] of a Future index/price.

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

Expectation E_t^Q[F(T,T)] of a Future index/price.

source

Auxiliary methods

Base.lengthFunction
length(p::AbstractPath)

Return the number of realisations represented by the AbstractPath object.

We assume that model functions applied to an AbstractPath return a vector of length(p) where p is the number realisations.

source
length(p::Path)

Derive the number of realisations from the linked simulation.

source
DiffFusion.state_variableFunction
state_variable(sim::Simulation, t::ModelTime, ip::PathInterpolation)

Derive a state variable for a given observation time.

source
DiffFusion.future_indexFunction
future_index(p::AbstractPath, t::ModelTime, T::ModelTime, key::String)

Expectation E_t^Q[F(T,T)] of a Future index/price.

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

Expectation E_t^Q[F(T,T)] of a Future index/price.

source

Auxiliary methods

Base.lengthFunction
length(p::AbstractPath)

Return the number of realisations represented by the AbstractPath object.

We assume that model functions applied to an AbstractPath return a vector of length(p) where p is the number realisations.

source
length(p::Path)

Derive the number of realisations from the linked simulation.

source
DiffFusion.state_variableFunction
state_variable(sim::Simulation, t::ModelTime, ip::PathInterpolation)

Derive a state variable for a given observation time.

source
DiffFusion.discountFunction
discount(
     t::ModelTime,
     ts_dict::Dict{String,Termstructure},
     first_alias::String,
     second_alias::Union{String,Nothing} = nothing,
     operation::Union{String,Nothing} = nothing,
-    )

Derive the discount factor for one or two of curve alias and a curve operation.

source
+ )

Derive the discount factor for one or two of curve alias and a curve operation.

source
diff --git a/dev/products/cash_flows/index.html b/dev/products/cash_flows/index.html index 4345b44..9b92935 100644 --- a/dev/products/cash_flows/index.html +++ b/dev/products/cash_flows/index.html @@ -1,21 +1,21 @@ -Cash Flow and Coupons · [∂F]

Cash Flow and Coupons

Cash flows and coupons are the building blocks for financial instruments.

Basic Cash Flows

DiffFusion.CashFlowType
abstract type CashFlow end

A CashFlow represents a general payment in an unspecified currency.

In a simulation, we calculate discounted expected cash flows in a consistent numeraire currency.

The CashFlow object is inspired by QuantLib's CashFlow interface.

We apply the convention that cash flows are formulated for unit notionals. Actual notionals are applied at the level of legs. This design aims at simplifying MTM cross currency swap legs with notional exchange.

source
DiffFusion.FixedCashFlowType
struct FixedCashFlow <: CashFlow
+Cash Flow and Coupons · [∂F]

Cash Flow and Coupons

Cash flows and coupons are the building blocks for financial instruments.

Basic Cash Flows

DiffFusion.CashFlowType
abstract type CashFlow end

A CashFlow represents a general payment in an unspecified currency.

In a simulation, we calculate discounted expected cash flows in a consistent numeraire currency.

The CashFlow object is inspired by QuantLib's CashFlow interface.

We apply the convention that cash flows are formulated for unit notionals. Actual notionals are applied at the level of legs. This design aims at simplifying MTM cross currency swap legs with notional exchange.

source
DiffFusion.FixedCashFlowType
struct FixedCashFlow <: CashFlow
     pay_time::ModelTime
     amount::ModelValue
-end

A simple deterministic cash flow (normalised to one unit notional)

source
DiffFusion.CombinedCashFlowType
struct CombinedCashFlow <: CashFlow
     first::CashFlow
     second::CashFlow
     op::Function
-end

A composition of two cash flows in a single cash flow.

This CashFlow type is intended e.g. for spreads and caplets/floorlets.

source
DiffFusion.combined_cashflowFunction
combined_cashflow(
+end

A composition of two cash flows in a single cash flow.

This CashFlow type is intended e.g. for spreads and caplets/floorlets.

source

Coupons

DiffFusion.CouponType
abstract type Coupon <: CashFlow end

A Coupon is a payment that is composed of an (effective) coupon rate and a year fraction.

source

Interest Rate Coupons

Coupons

DiffFusion.CouponType
abstract type Coupon <: CashFlow end

A Coupon is a payment that is composed of an (effective) coupon rate and a year fraction.

source

Interest Rate Coupons

DiffFusion.FixedRateCouponType
struct FixedRateCoupon <: Coupon
     pay_time::ModelTime
     fixed_rate::ModelValue
     year_fraction::ModelValue
     first_time::Union{ModelTime,Nothing}
-end

A fixed rate coupon.

source
DiffFusion.SimpleRateCouponType
struct SimpleRateCoupon <: Coupon
     fixing_time::ModelTime
     start_time::ModelTime
     end_time::ModelTime
@@ -24,30 +24,30 @@
     curve_key::String
     fixing_key::Union{String, Nothing}
     spread_rate::Union{ModelValue, Nothing}
-end

A (legacy) Libor or Euribor rate coupon.

source
DiffFusion.CompoundedRateCouponType
struct CompoundedRateCoupon <: Coupon
     period_times::AbstractVector
     period_year_fractions::AbstractVector
     pay_time::ModelTime
     curve_key::String
     fixing_key::Union{String, Nothing}
     spread_rate::Union{ModelValue, Nothing}
-end

A backward-looking compounded RFR coupon.

source

Caplets and Floorlets

Caplets and Floorlets

DiffFusion.OptionletCouponType
struct OptionletCoupon <: Coupon
     expiry_time::ModelTime
     coupon::Union{SimpleRateCoupon, CompoundedRateCoupon}
     strike_rate::ModelValue
     call_put::ModelValue
     coupon_type::DataType  # distinguish constructors
-end

A caplet or floorlet coupon on a forward-looking or backward-looking rate.

source
DiffFusion.OptionletCouponMethod
OptionletCoupon(
     expiry_time::ModelTime,
     coupon::Union{SimpleRateCoupon, CompoundedRateCoupon},
     strike_rate::ModelValue,
     call_put::ModelValue,
-    )

Create an OptionletCoupon object from an underlying SimpleRateCoupon or CompoundedRateCoupon.

Option expiry_time is specified by user.

source
DiffFusion.OptionletCouponMethod
OptionletCoupon(
+    )

Create an OptionletCoupon object from an underlying SimpleRateCoupon or CompoundedRateCoupon.

Option expiry_time is specified by user.

source
DiffFusion.OptionletCouponMethod
OptionletCoupon(
     expiry_time::ModelTime,
     coupon::Union{SimpleRateCoupon, CompoundedRateCoupon},
     strike_rate::ModelValue,
     call_put::ModelValue,
-    )

Create an OptionletCoupon object from an underlying SimpleRateCoupon or CompoundedRateCoupon.

Option expiry_time is determined from underlying coupon.

source

Inflation Coupons

DiffFusion.RelativeReturnCouponType
struct RelativeReturnCoupon <: Coupon
+    )

Create an OptionletCoupon object from an underlying SimpleRateCoupon or CompoundedRateCoupon.

Option expiry_time is determined from underlying coupon.

source

Inflation Coupons

DiffFusion.RelativeReturnCouponType
struct RelativeReturnCoupon <: Coupon
     first_time::ModelTime
     second_time::ModelTime
     pay_time::ModelTime
@@ -55,16 +55,16 @@
     asset_key::String
     curve_key_dom::String
     curve_key_for::String
-end

A RelativeReturnCoupon pays a coupon with rate (S2/S1 - 1) / dT. Here, S1 and S2 are spot asset prices.

Such a coupon is typical for year-on-year type instruments.

source
DiffFusion.RelativeReturnIndexCouponType
struct RelativeReturnIndexCoupon <: Coupon
+end

A RelativeReturnCoupon pays a coupon with rate (S2/S1 - 1) / dT. Here, S1 and S2 are spot asset prices.

Such a coupon is typical for year-on-year type instruments.

source
DiffFusion.RelativeReturnIndexCouponType
struct RelativeReturnIndexCoupon <: Coupon
     first_time::ModelTime
     second_time::ModelTime
     pay_time::ModelTime
     year_fraction::ModelValue
     forward_index_key::String
-end

A RelativeReturnIndexCoupon pays a coupon with rate (I2/I1 - 1) / dT. Here, I1 and I2 are spot (index) prices for which a forward index curve is available.

Such a coupon is typical for year-on-year type instruments.

source

Vanilla Options

DiffFusion.VanillaAssetOptionFlowType
struct VanillaAssetOptionFlow <: CashFlow
+end

A RelativeReturnIndexCoupon pays a coupon with rate (I2/I1 - 1) / dT. Here, I1 and I2 are spot (index) prices for which a forward index curve is available.

Such a coupon is typical for year-on-year type instruments.

source

Vanilla Options

DiffFusion.VanillaAssetOptionFlowType
struct VanillaAssetOptionFlow <: CashFlow
     expiry_time::ModelTime
     pay_time::ModelTime
     strike_price::ModelValue
     call_put::ModelValue
     asset_key::String
-end

A CashFlow representing a Call or Put option on an Asset.

source

Cash Flow and Coupon Methods

DiffFusion.pay_timeMethod
pay_time(cf::CashFlow)

Return the payment time for a CashFlow.

This represents a default implementation

This method is used to calculate discounted expected values.

source
DiffFusion.pay_timeMethod
pay_time(cf::OptionletCoupon)

Return the payment time for a OptionletCoupon.

This coincides with the payment time of the underlying coupon.

source
DiffFusion.first_timeFunction
first_time(cf::Coupon)

Derive the first event time of the Coupon.

This time is used in conjunction with call rights to determine whether a coupon period is already broken.

source
first_time(cf::FixedRateCoupon)

Derive the first event time of the FixedRateCoupon.

source
first_time(cf::SimpleRateCoupon)

Derive the first event time of the SimpleRateCoupon.

source
first_time(cf::CompoundedRateCoupon)

Derive the first event time of the CompoundedRateCoupon.

source
DiffFusion.amountFunction
amount(cf::CashFlow)

Return the payoff representing the simulated cash flow amount of the payment.

This method is intended to be used for general payoffs in conjunction with AMC.

source
amount(cf::Coupon)

Calculate payment amount for a Coupon.

source
amount(cf::FixedCashFlow)

Return FixedCashFlow amount.

source
amount(cf::CombinedCashFlow)

Return the payoff representing the simulated cash flow amount of the payment.

source
amount(cf::VanillaAssetOptionFlow)

Return the payoff of the VanillaAssetOptionFlow.

source
amount(cf::BarrierAssetOptionFlow)

Return the payoff of the BarrierAssetOptionFlow.

source
DiffFusion.expected_amountFunction
expected_amount(cf::CashFlow, obs_time::ModelTime)

Return the payoff representing the simulated expected amount of the payment.

Expectation is calculated in $T$-forward measure of cash flow currency with $T$ being the payment time and conditioning on observation time.

This method is intended to be used for analytical pricers.

source
expected_amount(cf::Coupon, obs_time::ModelTime)

Calculate expected payment amount for a Coupon.

source
expected_amount(cf::FixedCashFlow, obs_time::ModelTime)

Return FixedCashFlow expected amount.

source
expected_amount(cf::CombinedCashFlow, obs_time::ModelTime)

Return the payoff representing the simulated expected amount of the payment.

source
expected_amount(cf::VanillaAssetOptionFlow, obs_time::ModelTime)

Return the payoff representing the simulated expected amount of the VanillaAssetOptionFlow.

This implementation is an approximation and does not capture payment delay convexity adjustments.

source
expected_amount(cf::BarrierAssetOptionFlow, obs_time::ModelTime)

Return the payoff representing the simulated expected amount of the BarrierAssetOptionFlow.

This implementation is an approximation and does not capture payment delay convexity adjustments.

source
DiffFusion.year_fractionFunction
year_fraction(cf::Coupon)

Derive the year fraction for a Coupon.

source
year_fraction(cf::FixedRateCoupon)

Return FixedRateCoupon year_fraction.

source
year_fraction(cf::SimpleRateCoupon)

Return SimpleRateCoupon year_fraction.

source
year_fraction(cf::CompoundedRateCoupon)

Return CompoundedRateCoupon year_fraction.

source
year_fraction(cf::OptionletCoupon)

Return OptionletCoupon year_fraction.

source
year_fraction(cf::RelativeReturnCoupon)

Return RelativeReturnCoupon year_fraction.

source
year_fraction(cf::RelativeReturnIndexCoupon)

Return RelativeReturnIndexCoupon year_fraction.

source
DiffFusion.coupon_rateFunction
coupon_rate(cf::Coupon)

Return a payoff for the realised simulated effective coupon rate.

source
coupon_rate(cf::FixedRateCoupon)

Return FixedRateCoupon rate.

source
coupon_rate(cf::SimpleRateCoupon)

Return SimpleRateCoupon rate.

source
coupon_rate(cf::CompoundedRateCoupon)

Return CompoundedRateCoupon rate.

source
coupon_rate(cf::OptionletCoupon)

Return OptionletCoupon rate.

source
coupon_rate(cf::RelativeReturnCoupon)

Return RelativeReturnCoupon rate.

source
coupon_rate(cf::RelativeReturnIndexCoupon)

Return RelativeReturnIndexCoupon rate.

source
DiffFusion.forward_rateMethod
forward_rate(cf::Coupon, obs_time::ModelTime)

Return a payoff for the effective forward rate of the coupon.

Expectation is calculated in T-forward measure of cash flow currency with T being the payment time and conditioning on observation time.

This method is intended to be used for analytical pricers.

source
DiffFusion.forward_rateMethod
forward_rate(cf::RelativeReturnIndexCoupon, obs_time::ModelTime)

Return RelativeReturnIndexCoupon forward rate.

source
+end

A CashFlow representing a Call or Put option on an Asset.

source

Cash Flow and Coupon Methods

DiffFusion.pay_timeMethod
pay_time(cf::CashFlow)

Return the payment time for a CashFlow.

This represents a default implementation

This method is used to calculate discounted expected values.

source
DiffFusion.pay_timeMethod
pay_time(cf::OptionletCoupon)

Return the payment time for a OptionletCoupon.

This coincides with the payment time of the underlying coupon.

source
DiffFusion.first_timeFunction
first_time(cf::Coupon)

Derive the first event time of the Coupon.

This time is used in conjunction with call rights to determine whether a coupon period is already broken.

source
first_time(cf::FixedRateCoupon)

Derive the first event time of the FixedRateCoupon.

source
first_time(cf::SimpleRateCoupon)

Derive the first event time of the SimpleRateCoupon.

source
first_time(cf::CompoundedRateCoupon)

Derive the first event time of the CompoundedRateCoupon.

source
DiffFusion.amountFunction
amount(cf::CashFlow)

Return the payoff representing the simulated cash flow amount of the payment.

This method is intended to be used for general payoffs in conjunction with AMC.

source
amount(cf::Coupon)

Calculate payment amount for a Coupon.

source
amount(cf::FixedCashFlow)

Return FixedCashFlow amount.

source
amount(cf::CombinedCashFlow)

Return the payoff representing the simulated cash flow amount of the payment.

source
amount(cf::VanillaAssetOptionFlow)

Return the payoff of the VanillaAssetOptionFlow.

source
amount(cf::BarrierAssetOptionFlow)

Return the payoff of the BarrierAssetOptionFlow.

source
DiffFusion.expected_amountFunction
expected_amount(cf::CashFlow, obs_time::ModelTime)

Return the payoff representing the simulated expected amount of the payment.

Expectation is calculated in $T$-forward measure of cash flow currency with $T$ being the payment time and conditioning on observation time.

This method is intended to be used for analytical pricers.

source
expected_amount(cf::Coupon, obs_time::ModelTime)

Calculate expected payment amount for a Coupon.

source
expected_amount(cf::FixedCashFlow, obs_time::ModelTime)

Return FixedCashFlow expected amount.

source
expected_amount(cf::CombinedCashFlow, obs_time::ModelTime)

Return the payoff representing the simulated expected amount of the payment.

source
expected_amount(cf::VanillaAssetOptionFlow, obs_time::ModelTime)

Return the payoff representing the simulated expected amount of the VanillaAssetOptionFlow.

This implementation is an approximation and does not capture payment delay convexity adjustments.

source
expected_amount(cf::BarrierAssetOptionFlow, obs_time::ModelTime)

Return the payoff representing the simulated expected amount of the BarrierAssetOptionFlow.

This implementation is an approximation and does not capture payment delay convexity adjustments.

source
DiffFusion.year_fractionFunction
year_fraction(cf::Coupon)

Derive the year fraction for a Coupon.

source
year_fraction(cf::FixedRateCoupon)

Return FixedRateCoupon year_fraction.

source
year_fraction(cf::SimpleRateCoupon)

Return SimpleRateCoupon year_fraction.

source
year_fraction(cf::CompoundedRateCoupon)

Return CompoundedRateCoupon year_fraction.

source
year_fraction(cf::OptionletCoupon)

Return OptionletCoupon year_fraction.

source
year_fraction(cf::RelativeReturnCoupon)

Return RelativeReturnCoupon year_fraction.

source
year_fraction(cf::RelativeReturnIndexCoupon)

Return RelativeReturnIndexCoupon year_fraction.

source
DiffFusion.coupon_rateFunction
coupon_rate(cf::Coupon)

Return a payoff for the realised simulated effective coupon rate.

source
coupon_rate(cf::FixedRateCoupon)

Return FixedRateCoupon rate.

source
coupon_rate(cf::SimpleRateCoupon)

Return SimpleRateCoupon rate.

source
coupon_rate(cf::CompoundedRateCoupon)

Return CompoundedRateCoupon rate.

source
coupon_rate(cf::OptionletCoupon)

Return OptionletCoupon rate.

source
coupon_rate(cf::RelativeReturnCoupon)

Return RelativeReturnCoupon rate.

source
coupon_rate(cf::RelativeReturnIndexCoupon)

Return RelativeReturnIndexCoupon rate.

source
DiffFusion.forward_rateMethod
forward_rate(cf::Coupon, obs_time::ModelTime)

Return a payoff for the effective forward rate of the coupon.

Expectation is calculated in T-forward measure of cash flow currency with T being the payment time and conditioning on observation time.

This method is intended to be used for analytical pricers.

source
DiffFusion.forward_rateMethod
forward_rate(cf::RelativeReturnIndexCoupon, obs_time::ModelTime)

Return RelativeReturnIndexCoupon forward rate.

source
diff --git a/dev/products/products/index.html b/dev/products/products/index.html index b079acb..5b850bc 100644 --- a/dev/products/products/index.html +++ b/dev/products/products/index.html @@ -1,26 +1,26 @@ -Basic Products · [∂F]

Basic Products

Financial instruments are decomposed into legs.

A product is a collection of one or more legs.

Basic Cash Flow Legs

DiffFusion.CashFlowLegType
abstract type CashFlowLeg end

A CashFlowLeg combines CashFlow objects in a single currency and adds notional and payer/receiver information and discounting.

We apply the convention that notionals are non-negative and cash flows are modelled from the receiving counter party perspective. This does include the exceptions of negative spread cash flows or negative notional exchange cash flows.

source
DiffFusion.DeterministicCashFlowLegType
struct DeterministicCashFlowLeg <: CashFlowLeg
+Basic Products · [∂F]

Basic Products

Financial instruments are decomposed into legs.

A product is a collection of one or more legs.

Basic Cash Flow Legs

DiffFusion.CashFlowLegType
abstract type CashFlowLeg end

A CashFlowLeg combines CashFlow objects in a single currency and adds notional and payer/receiver information and discounting.

We apply the convention that notionals are non-negative and cash flows are modelled from the receiving counter party perspective. This does include the exceptions of negative spread cash flows or negative notional exchange cash flows.

source
DiffFusion.DeterministicCashFlowLegType
struct DeterministicCashFlowLeg <: CashFlowLeg
     alias::String
     cashflows::AbstractVector
     notionals::AbstractVector
     curve_key::String
     fx_key::Union{String, Nothing}
     payer_receiver::ModelValue
-end

A DeterministicCashFlowLeg models legs with deterministic notionals.

source
DiffFusion.cashflow_legFunction
cashflow_leg(
     alias::String,
     cashflows::AbstractVector,
     notionals::AbstractVector,
     curve_key::Union{String, Nothing} = nothing,
     fx_key::Union{String, Nothing} = nothing,
     payer_receiver = 1.0,
-    )

Create a DeterministicCashFlowLeg.

source
cashflow_leg(
+    )

Create a DeterministicCashFlowLeg.

source
cashflow_leg(
     alias::String,
     cashflows::AbstractVector,
     notional::ModelValue,
     curve_key::Union{String, Nothing} = nothing,
     fx_key::Union{String, Nothing} = nothing,
     payer_receiver = 1.0,
-    )

Create a constant notional CashFlowLeg.

source

Cross Currency Swap Legs

Cross Currency Swap Legs

DiffFusion.MtMCashFlowLegType
struct MtMCashFlowLeg <: CashFlowLeg
     alias::String
     cashflows::AbstractVector
     intitial_notional::ModelValue
@@ -31,7 +31,7 @@
     fx_reset_times::AbstractVector
     fx_pay_times::AbstractVector
     payer_receiver::ModelValue
-end

A mark-to-market (MtM) cross currency cash flow leg adds notional resets to the cash flow payments.

Notional resets are calculated from FX rates at reset times.

We consider a setting with numeraire currency, domestic currency and foreign currency.

Cash flows are denominated in domestic currency. Initial notional is expressed in foreign currency and simulation is modelled in numeraire currency.

We denote fx_key_for the FOR-NUM asset key and fx_key_dom the DOM-NUM asset key.

FX rates for notional exchange are fixed at fx_reset_times and notional cash flows are exchanged at fx_pay_times. The very first notional exchange is not modelled because it is either in the past or foreign and domestic notional exchange offset each other.

As a consequence, we have one fx_reset_time and one fx_pay_time per cash flow. The fx_reset_time is at (or before) the start of the coupon period and fx_pay_time is at (or after) the end of the coupon period.

source
DiffFusion.mtm_cashflow_legFunction
mtm_cashflow_leg(
+end

A mark-to-market (MtM) cross currency cash flow leg adds notional resets to the cash flow payments.

Notional resets are calculated from FX rates at reset times.

We consider a setting with numeraire currency, domestic currency and foreign currency.

Cash flows are denominated in domestic currency. Initial notional is expressed in foreign currency and simulation is modelled in numeraire currency.

We denote fx_key_for the FOR-NUM asset key and fx_key_dom the DOM-NUM asset key.

FX rates for notional exchange are fixed at fx_reset_times and notional cash flows are exchanged at fx_pay_times. The very first notional exchange is not modelled because it is either in the past or foreign and domestic notional exchange offset each other.

As a consequence, we have one fx_reset_time and one fx_pay_time per cash flow. The fx_reset_time is at (or before) the start of the coupon period and fx_pay_time is at (or after) the end of the coupon period.

source
DiffFusion.mtm_cashflow_legFunction
mtm_cashflow_leg(
     alias::String,
     cashflows::AbstractVector,
     intitial_notional::ModelValue,
@@ -42,23 +42,23 @@
     fx_reset_times::AbstractVector,
     fx_pay_times::AbstractVector,
     payer_receiver::ModelValue,
-    )

Create a MTM cash flow leg.

source
mtm_cashflow_leg(
+    )

Create a MTM cash flow leg.

source
mtm_cashflow_leg(
     alias::String,
     leg::DeterministicCashFlowLeg,
     intitial_notional::ModelValue,  # in foreign currency
     initial_reset_time::ModelValue,
     curve_key_for::String,
     fx_key_for::Union{String, Nothing},
-    )

Create a MtM cash flow leg from a deterministic leg.

source

Cash and Assets

Cash and Assets

DiffFusion.CashBalanceLegType
struct CashBalance <: CashFlowLeg
     alias::String
     notional::ModelValue
     fx_key::Union{String, Nothing}
     payer_receiver::ModelValue
     maturity_time::Union{Nothing, ModelTime}
-end

A CashLeg represents a constant cash balance in domestic or foreign corrency.

source
DiffFusion.cash_balance_legFunction
cash_balance_leg(
     alias::String,
     notional::ModelValue,
     fx_key::Union{String, Nothing} = nothing,
     payer_receiver::ModelValue = +1.0,
     maturity_time::Union{Nothing, ModelTime} = nothing
-    )

Create a CashBalance object.

source
DiffFusion.AssetLegType

An AssetLeg represents a position in a tradeable asset. Such tradeable asset can be, e.g., a share price, index price or an (FOR-DOM) FX rate where DOM currency differs from numeraire currency.

source

Cash Flow Leg Functions

Future Cash Flows (Undiscounted)

DiffFusion.future_cashflowsMethod
future_cashflows(leg::CashFlowLeg, obs_time::ModelTime)

Calculate the list of future undiscounted payoffs in numeraire currency.

source
DiffFusion.future_cashflowsMethod
future_cashflows(leg::DeterministicCashFlowLeg, obs_time::ModelTime)

Calculate the list of future undiscounted payoffs in numeraire currency.

source
DiffFusion.future_cashflowsMethod
future_cashflows(leg::MtMCashFlowLeg, obs_time::ModelTime)

Calculate the list of future undiscounted payoffs in numeraire currency.

source
DiffFusion.future_cashflowsMethod
future_cashflows(leg::AssetLeg, obs_time::ModelTime)

Calculate the list of future undiscounted payoffs in numeraire currency.

source
DiffFusion.future_cashflowsMethod
future_cashflows(leg::CashBalanceLeg, obs_time::ModelTime)

Calculate the list of future undiscounted payoffs in numeraire currency.

source

Discounted Cash Flows

DiffFusion.discounted_cashflowsMethod
discounted_cashflows(leg::DeterministicCashFlowLeg, obs_time::ModelTime)

Calculate the list of future discounted payoffs in numeraire currency.

source
+ )

Create a CashBalance object.

source
DiffFusion.AssetLegType

An AssetLeg represents a position in a tradeable asset. Such tradeable asset can be, e.g., a share price, index price or an (FOR-DOM) FX rate where DOM currency differs from numeraire currency.

source

Cash Flow Leg Functions

Future Cash Flows (Undiscounted)

DiffFusion.future_cashflowsMethod
future_cashflows(leg::CashFlowLeg, obs_time::ModelTime)

Calculate the list of future undiscounted payoffs in numeraire currency.

source
DiffFusion.future_cashflowsMethod
future_cashflows(leg::DeterministicCashFlowLeg, obs_time::ModelTime)

Calculate the list of future undiscounted payoffs in numeraire currency.

source
DiffFusion.future_cashflowsMethod
future_cashflows(leg::MtMCashFlowLeg, obs_time::ModelTime)

Calculate the list of future undiscounted payoffs in numeraire currency.

source
DiffFusion.future_cashflowsMethod
future_cashflows(leg::AssetLeg, obs_time::ModelTime)

Calculate the list of future undiscounted payoffs in numeraire currency.

source
DiffFusion.future_cashflowsMethod
future_cashflows(leg::CashBalanceLeg, obs_time::ModelTime)

Calculate the list of future undiscounted payoffs in numeraire currency.

source

Discounted Cash Flows

DiffFusion.discounted_cashflowsMethod
discounted_cashflows(leg::DeterministicCashFlowLeg, obs_time::ModelTime)

Calculate the list of future discounted payoffs in numeraire currency.

source
diff --git a/dev/products/swaptions/index.html b/dev/products/swaptions/index.html index e0e32f7..06caa08 100644 --- a/dev/products/swaptions/index.html +++ b/dev/products/swaptions/index.html @@ -3,7 +3,7 @@ SwaptionSettlement, SwaptionCashSettlement, SwaptionPhysicalSettlement, -)

SwaptionSettlement specifies whether swaption terminates at settlement time or whether it is converted into a physicl swap.

For SwaptionCashSettlement the cash price is calculated as model price, i.e. physical price at expiry.

source
DiffFusion.SwaptionLegType
struct SwaptionLeg <: CashFlowLeg
+)

SwaptionSettlement specifies whether swaption terminates at settlement time or whether it is converted into a physicl swap.

For SwaptionCashSettlement the cash price is calculated as model price, i.e. physical price at expiry.

source
DiffFusion.SwaptionLegType
struct SwaptionLeg <: CashFlowLeg
     alias::String
     #
     expiry_time::ModelTime
@@ -23,7 +23,7 @@
     fixed_weights::AbstractVector
     fixed_rate::ModelValue
     exercise_indicator::Payoff
-end

A European swaption referencing a Vanilla swap with forward looking or backward looking rates.

source
DiffFusion.SwaptionLegType
SwaptionLeg(
+end

A European swaption referencing a Vanilla swap with forward looking or backward looking rates.

source
DiffFusion.SwaptionLegType
SwaptionLeg(
     alias::String,
     #
     expiry_time::ModelTime,
@@ -38,19 +38,19 @@
     swpt_disc_curve_key::String = swap_disc_curve_key,
     swpt_fx_key::Union{String, Nothing} = nothing,
     swpt_long_short::ModelValue = +1.0,
-    )

Create a swaption object.

source
DiffFusion.future_cashflowsMethod
future_cashflows(leg::SwaptionLeg, obs_time::ModelTime)

Calculate the list of future undiscounted payoffs in numeraire currency.

source
DiffFusion.discounted_cashflowsMethod
discounted_cashflows(leg::SwaptionLeg, obs_time::ModelTime)

Calculate the list of future discounted payoffs in numeraire currency.

source

Bermudan Swaption

DiffFusion.BermudanExerciseType
struct BermudanExercise
+    )

Create a swaption object.

source
DiffFusion.future_cashflowsMethod
future_cashflows(leg::SwaptionLeg, obs_time::ModelTime)

Calculate the list of future undiscounted payoffs in numeraire currency.

source
DiffFusion.discounted_cashflowsMethod
discounted_cashflows(leg::SwaptionLeg, obs_time::ModelTime)

Calculate the list of future discounted payoffs in numeraire currency.

source

Bermudan Swaption

DiffFusion.BermudanExerciseType
struct BermudanExercise
     exercise_time::ModelTime
     cashflow_legs::AbstractVector
     make_regression_variables::Function
-end

A container holding the information about an exercise event of a BermudanSwaptionLeg.

Here, exercise_time is the individual option exercise time and cashflow_legs is a list of CashFlowLegs.

The cash flows in the cash flow legs are supposed to start after exercise_time. That is, the BermudanExercise manages the lag between option exercise and option settlement.

make_regression_variables is a function with signature

(exercise_time) -> [ regr_payoff_1, ..., regr_payoff_N ].

The function takes observation time as input to allow for re-usable fuctions. It returns a list of regression payoffs used for this particular exercise.

The result of the function is passed on to the AmcPayoff creation.

source
DiffFusion.bermudan_exerciseMethod
bermudan_exercise(
+end

A container holding the information about an exercise event of a BermudanSwaptionLeg.

Here, exercise_time is the individual option exercise time and cashflow_legs is a list of CashFlowLegs.

The cash flows in the cash flow legs are supposed to start after exercise_time. That is, the BermudanExercise manages the lag between option exercise and option settlement.

make_regression_variables is a function with signature

(exercise_time) -> [ regr_payoff_1, ..., regr_payoff_N ].

The function takes observation time as input to allow for re-usable fuctions. It returns a list of regression payoffs used for this particular exercise.

The result of the function is passed on to the AmcPayoff creation.

source
DiffFusion.bermudan_exerciseMethod
bermudan_exercise(
     exercise_time::ModelTime,
     cashflow_legs::AbstractVector,
     make_regression_variables::Function,
-    )

Create a BermudanExercise and check for valid inputs.

source
DiffFusion.make_bermudan_exercisesFunction
make_bermudan_exercises(
+    )

Create a BermudanExercise and check for valid inputs.

source
DiffFusion.make_bermudan_exercisesFunction
make_bermudan_exercises(
     fixed_leg::DeterministicCashFlowLeg,
     float_leg::DeterministicCashFlowLeg,
     exercise_time::AbstractVector,
-    )

Create a list of BermudanExercises from Vanilla swap legs.

source
DiffFusion.BermudanSwaptionLegType

A Bermudan swaption implemented as a CashFlowLeg.

alias is the leg alias.

bermudan_exercises is a list of BermudanExercises in ascending order.

option_long_short is +1 for a long option position (buy) and -1 for a short option position (sell).

numeraire_curve_key is a discount curve key used for numeraie calculation in AmcPayoffs.

hold_values is a list of Payoffs per BermudanExercise that represent the option prices if not exercised.

exercise_triggers is a list of Payoffs per BermudanExercise that represent the indicator whether option was not exercised at respective exercise time.

make_regression_variables is a function with signature

(obs_time) -> [ regr_payoff_1, ..., regr_payoff_N ].

The function takes observation time as input to allow for re-usable fuctions. It returns a list of regression payoffs used for regression to current observation time.

The result of the function make_regression_variables is passed on to the AmcPayoff creation.

regression_data holds function to create a regression and a Path to calibrate the regression. Details are passed on to AmcPayoff at creation. The elements are supposed to be updated subsequent to BermudanSwaptionLeg creation. This should allow decoupling of leg creation and usage.

source
DiffFusion.bermudan_swaption_legFunction
bermudan_swaption_leg(
+    )

Create a list of BermudanExercises from Vanilla swap legs.

source
DiffFusion.BermudanSwaptionLegType

A Bermudan swaption implemented as a CashFlowLeg.

alias is the leg alias.

bermudan_exercises is a list of BermudanExercises in ascending order.

option_long_short is +1 for a long option position (buy) and -1 for a short option position (sell).

numeraire_curve_key is a discount curve key used for numeraie calculation in AmcPayoffs.

hold_values is a list of Payoffs per BermudanExercise that represent the option prices if not exercised.

exercise_triggers is a list of Payoffs per BermudanExercise that represent the indicator whether option was not exercised at respective exercise time.

make_regression_variables is a function with signature

(obs_time) -> [ regr_payoff_1, ..., regr_payoff_N ].

The function takes observation time as input to allow for re-usable fuctions. It returns a list of regression payoffs used for regression to current observation time.

The result of the function make_regression_variables is passed on to the AmcPayoff creation.

regression_data holds function to create a regression and a Path to calibrate the regression. Details are passed on to AmcPayoff at creation. The elements are supposed to be updated subsequent to BermudanSwaptionLeg creation. This should allow decoupling of leg creation and usage.

source
DiffFusion.bermudan_swaption_legFunction
bermudan_swaption_leg(
     alias::String,
     bermudan_exercises::AbstractVector,
     option_long_short::ModelValue,
@@ -58,7 +58,7 @@
     make_regression_variables::Function,
     path::Union{AbstractPath, Nothing},
     make_regression::Union{Function, Nothing},
-    )

Create a BermudanSwaptionLeg.

Calculate hold value payoffs and exercise trigger payoffs and setup the BermudanSwaptionLeg object.

alias, bermudan_exercises, option_long_short, numeraire_curve_key, and make_regression_variables are passed on to BermudanSwaptionLeg.

path and make_regression are used to create an AmcPayoffRegression object for AmcPayoffs. This data is supposed to be updated subsequent to leg cretion.

regression_on_exercise_trigger = true specifies AMC regression strategy. If regression_on_exercise_trigger = then then regression on regression is used. regression_on_exercise_trigger = true is recommended for accurate sensitivity calculation.

source
bermudan_swaption_leg(
+    )

Create a BermudanSwaptionLeg.

Calculate hold value payoffs and exercise trigger payoffs and setup the BermudanSwaptionLeg object.

alias, bermudan_exercises, option_long_short, numeraire_curve_key, and make_regression_variables are passed on to BermudanSwaptionLeg.

path and make_regression are used to create an AmcPayoffRegression object for AmcPayoffs. This data is supposed to be updated subsequent to leg cretion.

regression_on_exercise_trigger = true specifies AMC regression strategy. If regression_on_exercise_trigger = then then regression on regression is used. regression_on_exercise_trigger = true is recommended for accurate sensitivity calculation.

source
bermudan_swaption_leg(
     alias::String,
     fixed_leg::DeterministicCashFlowLeg,
     float_leg::DeterministicCashFlowLeg,
@@ -66,8 +66,8 @@
     option_long_short::ModelValue,
     numeraire_curve_key::String,
     regression_on_exercise_trigger = true,
-    )

Create a BermudanSwaptionLeg using simplified interface.

regression_on_exercise_trigger = true specifies AMC regression strategy. If regression_on_exercise_trigger = then then regression on regression is used. regression_on_exercise_trigger = true is recommended for accurate sensitivity calculation.

source
DiffFusion.reset_regression!Function
reset_regression!(
+    )

Create a BermudanSwaptionLeg using simplified interface.

regression_on_exercise_trigger = true specifies AMC regression strategy. If regression_on_exercise_trigger = then then regression on regression is used. regression_on_exercise_trigger = true is recommended for accurate sensitivity calculation.

source
DiffFusion.reset_regression!Function
reset_regression!(
     leg::BermudanSwaptionLeg,
     path::Union{AbstractPath, Nothing} = nothing,
     make_regression::Union{Function, Nothing}  = nothing,
-    )

Reset the regression properties for the AMC payoffs of the BermudanSwaptionLeg.

This method is used to allow setting and updating AMC regression after leg creation.

source
DiffFusion.discounted_cashflowsMethod
discounted_cashflows(leg::BermudanSwaptionLeg, obs_time::ModelTime)

Calculate the list of future discounted payoffs in numeraire currency.

Critical aspect is to consider the path-dependent exercise into the option underlying.

Consider an obs_time after a given BermudanExercise (last exercise). For this implementation, we make the assumption that exercise at obs_time will only be into the underlying of the last exercise.

Above assumption is does not pose a limitation if all underlyings are the same, i.e. standard Bermudans.

Above assumption is a limitation if the Bermudan can be exercised into different underlyings per exercise time. This corresponds to a more complex trigger option.

Above assumption can be relaxed at the expense of calculating discounted cash flows for all (earlier) underlyings.

source
+ )

Reset the regression properties for the AMC payoffs of the BermudanSwaptionLeg.

This method is used to allow setting and updating AMC regression after leg creation.

source
DiffFusion.discounted_cashflowsMethod
discounted_cashflows(leg::BermudanSwaptionLeg, obs_time::ModelTime)

Calculate the list of future discounted payoffs in numeraire currency.

Critical aspect is to consider the path-dependent exercise into the option underlying.

Consider an obs_time after a given BermudanExercise (last exercise). For this implementation, we make the assumption that exercise at obs_time will only be into the underlying of the last exercise.

Above assumption is does not pose a limitation if all underlyings are the same, i.e. standard Bermudans.

Above assumption is a limitation if the Bermudan can be exercised into different underlyings per exercise time. This corresponds to a more complex trigger option.

Above assumption can be relaxed at the expense of calculating discounted cash flows for all (earlier) underlyings.

source
diff --git a/dev/scenarios/collateral_simulation/index.html b/dev/scenarios/collateral_simulation/index.html index eecb1ee..1918241 100644 --- a/dev/scenarios/collateral_simulation/index.html +++ b/dev/scenarios/collateral_simulation/index.html @@ -3,21 +3,21 @@ Δt::ModelTime, first_call_time::ModelTime, last_call_time::ModelTime, - )

Calculate margin call times.

Margin frequency is represented as time difference between margin call times, Δt.

first_call_time is the first margin time greater/equal time-0 and last_call_time is the last modelled margin call time.

source
DiffFusion.market_values_for_csaFunction
market_values_for_csa(
+    )

Calculate margin call times.

Margin frequency is represented as time difference between margin call times, Δt.

first_call_time is the first margin time greater/equal time-0 and last_call_time is the last modelled margin call time.

source
DiffFusion.market_values_for_csaFunction
market_values_for_csa(
     portfolio::ScenarioCube,
     obs_times::AbstractVector,
     fx_rates::Union{ScenarioCube, Nothing} = nothing
-    )

Calculate future market values of a given portfolio in CSA currency. Result is represented as ScenarioCube.

Market values of the portfolio are assumed in numeraire currency from a simulation.

fx_rates are simulated FOR-DOM exchange rates where FOR currency represents the CSA currency and DOM currency represents the numeraire currency of the simulation.

obs_times represent the margin call times for which market values are required. We implement linear interpolation of available market values.

source
DiffFusion.collateral_values_for_csaFunction
collateral_values_for_csa(
+    )

Calculate future market values of a given portfolio in CSA currency. Result is represented as ScenarioCube.

Market values of the portfolio are assumed in numeraire currency from a simulation.

fx_rates are simulated FOR-DOM exchange rates where FOR currency represents the CSA currency and DOM currency represents the numeraire currency of the simulation.

obs_times represent the margin call times for which market values are required. We implement linear interpolation of available market values.

source
DiffFusion.collateral_values_for_csaFunction
collateral_values_for_csa(
    portfolio::ScenarioCube,
    initial_collateral_balance::ModelValue,
    minimum_transfer_amount::ModelValue,
    threshold_amount::ModelValue,
    independent_amount::ModelValue,
-   )

Calculate the collateral balance based on CSA parameters.

portfolio is assumed to be aggregated over legs and represents un-discounted market values in CSA currency.

CSA parameters are all denominated in CSA currency (or base currency).

initial_collateral_balance is the (net-)balance of posted/received collateral at time-0.

minimum_transfer_amount (MTA) is the minimum amount of collateral that is exchanged at a collateral call time. Here, MTA is assumed equal for bank and counterparty.

threshold_amount (TA) represents the maximum exposure of the portfolio below which no collateral is posted. Here, TA is assumed equal for bank and counterparty.

independent_amount represents a (net-)amount of collateral that is posted/received independent of the portfolio market value.

source
DiffFusion.effective_collateral_valuesFunction
effective_collateral_values(
+   )

Calculate the collateral balance based on CSA parameters.

portfolio is assumed to be aggregated over legs and represents un-discounted market values in CSA currency.

CSA parameters are all denominated in CSA currency (or base currency).

initial_collateral_balance is the (net-)balance of posted/received collateral at time-0.

minimum_transfer_amount (MTA) is the minimum amount of collateral that is exchanged at a collateral call time. Here, MTA is assumed equal for bank and counterparty.

threshold_amount (TA) represents the maximum exposure of the portfolio below which no collateral is posted. Here, TA is assumed equal for bank and counterparty.

independent_amount represents a (net-)amount of collateral that is posted/received independent of the portfolio market value.

source
DiffFusion.effective_collateral_valuesFunction
effective_collateral_values(
     obs_times::AbstractVector,
     collateral_balance::ScenarioCube,
     margin_period_of_risk::ModelTime,
-    )

Calculate the effective collateral balance per observation times.

The effective effective collateral balance is modelled as an additional ScenarioCube which can be joined with the original portfolio ScenarioCube. The resulting combined ScenarioCube represents the collateralised portfolio.

Portfolio observation times obs_times represent termination times following a potential default.

collateral_balance represent un-discounted market values of the collateral account from bank's perspective in CSA currency. Collateral observation times are margin call times.

margin_period_of_risk (MPR) represents the modelled time between default time τ and observation time t.

We make the following assumptions:

  • No margin flows are paid during MPR.
  • All trade flows are paid during MPR.

The modelled approach refers to the "Classical+" approach in Andersen/Pykhtin/Sokol, 2016.

source
DiffFusion.collateralised_portfolioFunction
collateralised_portfolio(
+    )

Calculate the effective collateral balance per observation times.

The effective effective collateral balance is modelled as an additional ScenarioCube which can be joined with the original portfolio ScenarioCube. The resulting combined ScenarioCube represents the collateralised portfolio.

Portfolio observation times obs_times represent termination times following a potential default.

collateral_balance represent un-discounted market values of the collateral account from bank's perspective in CSA currency. Collateral observation times are margin call times.

margin_period_of_risk (MPR) represents the modelled time between default time τ and observation time t.

We make the following assumptions:

  • No margin flows are paid during MPR.
  • All trade flows are paid during MPR.

The modelled approach refers to the "Classical+" approach in Andersen/Pykhtin/Sokol, 2016.

source
DiffFusion.collateralised_portfolioFunction
collateralised_portfolio(
     portfolio::ScenarioCube,
     fx_rates::Union{ScenarioCube, Nothing},
     margin_call_times::AbstractVector,
@@ -26,4 +26,4 @@
     threshold_amount::ModelValue,
     independent_amount::ModelValue,
     margin_period_of_risk::ModelTime,
-    )

Calculate a collateralised portfolio by joining the effective collateral balance.

source
+ )

Calculate a collateralised portfolio by joining the effective collateral balance.

source diff --git a/dev/scenarios/exposure_calculation/index.html b/dev/scenarios/exposure_calculation/index.html index a895b7e..a666218 100644 --- a/dev/scenarios/exposure_calculation/index.html +++ b/dev/scenarios/exposure_calculation/index.html @@ -4,11 +4,11 @@ gross_leg::Bool = false, average_paths::Bool = true, aggregate_legs::Bool = true, - )

Calculate expected positive exposure (EPE or EE).

scens is the input ScenarioCube.

If gross_leg is true then calculate positive floor on trade level. Otherwise, use netted portfolio to determine positive floor.

If average_paths is true then reduce scenario cube along path axis. Otherwise, keep individual paths.

If aggregate_legs is true then reduce scenario cube along the axis of legs. Otherwise, keep individual legs.

source
DiffFusion.potential_future_exposureFunction
potential_future_exposure(
+    )

Calculate expected positive exposure (EPE or EE).

scens is the input ScenarioCube.

If gross_leg is true then calculate positive floor on trade level. Otherwise, use netted portfolio to determine positive floor.

If average_paths is true then reduce scenario cube along path axis. Otherwise, keep individual paths.

If aggregate_legs is true then reduce scenario cube along the axis of legs. Otherwise, keep individual legs.

source
DiffFusion.potential_future_exposureFunction
potential_future_exposure(
     scens::ScenarioCube,
     quantile_::ModelValue,
     gross_leg::Bool = false,
-    )

Calculate the potential future exposure (PFE).

scens is the input ScenarioCube.

quantile_ is the desired quantile for PFE calculation.

If gross_leg is true then calculate positive floor on trade level. Otherwise, use netted portfolio to determine positive floor.

source
DiffFusion.valuation_adjustmentFunction
valuation_adjustment(
+    )

Calculate the potential future exposure (PFE).

scens is the input ScenarioCube.

quantile_ is the desired quantile for PFE calculation.

If gross_leg is true then calculate positive floor on trade level. Otherwise, use netted portfolio to determine positive floor.

source
DiffFusion.valuation_adjustmentFunction
valuation_adjustment(
     credit_ts::CreditDefaultTermstructure,
     recovery_rate::ModelValue,
     cva_dva::ModelValue,
@@ -17,4 +17,4 @@
     average_paths::Bool = true,
     aggregate_legs::Bool = true,
     rho::ModelValue = 0.5,
-    )

Calculate unilateral CVA and DVA for a given ScenarioCube. Result is a ScenarioCube with non-negative XVA contributions along the time axis.

credit_ts is the credit spread curve to calculate survival probabilities. recovery_rate is the corresponding constant recovery rate value (typicall 0.40).

cva_dva is a binary flag to model CVA (+1.0) and DVA (-1.0).

scens is the input ScenarioCube. Values are assumed to be discounted prices in the corresponding portfolio currency.

Parameters gross_leg, average_paths and aggregate_legs are used as in function expected_exposure.

rho specifies how to integrate discounted prices. rho=0.5 uses trapezoidal rule. This choice is used in BCBS paper Basel III: A global regulatory framework for more resilient banks and banking systems (2011). rho=0.0 uses prices at the start of period and is proposed in Green, XVA (2016).

source
+ )

Calculate unilateral CVA and DVA for a given ScenarioCube. Result is a ScenarioCube with non-negative XVA contributions along the time axis.

credit_ts is the credit spread curve to calculate survival probabilities. recovery_rate is the corresponding constant recovery rate value (typicall 0.40).

cva_dva is a binary flag to model CVA (+1.0) and DVA (-1.0).

scens is the input ScenarioCube. Values are assumed to be discounted prices in the corresponding portfolio currency.

Parameters gross_leg, average_paths and aggregate_legs are used as in function expected_exposure.

rho specifies how to integrate discounted prices. rho=0.5 uses trapezoidal rule. This choice is used in BCBS paper Basel III: A global regulatory framework for more resilient banks and banking systems (2011). rho=0.0 uses prices at the start of period and is proposed in Green, XVA (2016).

source diff --git a/dev/scenarios/scenario_generation/index.html b/dev/scenarios/scenario_generation/index.html index d5bfa06..ddc9c17 100644 --- a/dev/scenarios/scenario_generation/index.html +++ b/dev/scenarios/scenario_generation/index.html @@ -5,17 +5,17 @@ leg_aliases::AbstractVector numeraire_context_key::String discount_curve_key::Union{String,Nothing} -end

A ScenarioCube represents the result of MC pricing results of a list of product legs and is calculated for a list of observation times.

Elements are

source

Pricing Scenarios

DiffFusion.scenariosFunction
scenarios(
+end

A ScenarioCube represents the result of MC pricing results of a list of product legs and is calculated for a list of observation times.

Elements are

  • X - tensor of size (N_1, N_2, N_3) and type ModelValue where
    • N_1 is number of Monte Carlo paths,
    • N_2 is number of time steps,
    • N_3 is number of legs.
  • times - a vector representing observation times.
  • leg_aliases - a list of aliases (identifiers) corresponding to each leg
  • numeraire_context_key - the context_key of the NumeraireEntry; this label should indicate the cash flow currency.
  • discount_curve_key - a flag specifying whether prices in X are discounted prices (for XVA) or undiscounted prices (for CCR).
source

Pricing Scenarios

DiffFusion.scenariosFunction
scenarios(
     legs::AbstractVector,
     times::AbstractVector,
     path::Path,
     discount_curve_key::Union{String,Nothing};
     with_progress_bar::Bool = true,
-    )

Calculate ScenarioCube for a vector of CashFlowLeg objects and a vector of scenario observation times.

source

Scenario Cube Operations

DiffFusion.join_scenariosFunction
join_scenarios(cube1::ScenarioCube, cube2::ScenarioCube)

Join two scenario cubes along leg-axis.

source
join_scenarios(cubes::AbstractVector{ScenarioCube})

Join a list of scenario cubes along leg-axis.

source
DiffFusion.interpolate_scenariosFunction
interpolate_scenarios(
+    )

Calculate ScenarioCube for a vector of CashFlowLeg objects and a vector of scenario observation times.

source

Scenario Cube Operations

DiffFusion.join_scenariosFunction
join_scenarios(cube1::ScenarioCube, cube2::ScenarioCube)

Join two scenario cubes along leg-axis.

source
join_scenarios(cubes::AbstractVector{ScenarioCube})

Join a list of scenario cubes along leg-axis.

source
DiffFusion.interpolate_scenariosFunction
interpolate_scenarios(
     t::ModelTime,
     cube::ScenarioCube,
-    )

Interpolation scenarios along time axis.

We implement linear interpolation with flat extrapolation.

Other interpolations, e.g., piece-wise flat or Brownian Bridge should be incorporated here.

source
DiffFusion.concatenate_scenariosFunction
concatenate_scenarios(cubes::AbstractVector{ScenarioCube})

Concatenate a list of scenarios along time axis.

source
DiffFusion.aggregateFunction
aggregate(
+    )

Interpolation scenarios along time axis.

We implement linear interpolation with flat extrapolation.

Other interpolations, e.g., piece-wise flat or Brownian Bridge should be incorporated here.

source
DiffFusion.concatenate_scenariosFunction
concatenate_scenarios(cubes::AbstractVector{ScenarioCube})

Concatenate a list of scenarios along time axis.

source
DiffFusion.aggregateFunction
aggregate(
     scens::ScenarioCube,
     average_paths::Bool=true,
     aggregate_legs::Bool=true,
-    )

Average paths and aggregate legs in ScenarioCube.

scens is the input ScenarioCube.

If average_paths is true then reduce scenario cube along path axis. Otherwise, keep individual paths.

If aggregate_legs is true then reduce scenario cube along the axis of legs. Otherwise, keep individual legs.

source
+ )

Average paths and aggregate legs in ScenarioCube.

scens is the input ScenarioCube.

If average_paths is true then reduce scenario cube along path axis. Otherwise, keep individual paths.

If aggregate_legs is true then reduce scenario cube along the axis of legs. Otherwise, keep individual legs.

source diff --git a/dev/sensitivities/sensitivities/index.html b/dev/sensitivities/sensitivities/index.html index 85e2523..67f55d5 100644 --- a/dev/sensitivities/sensitivities/index.html +++ b/dev/sensitivities/sensitivities/index.html @@ -4,12 +4,12 @@ path_obj::Path, pay_time::Union{ModelTime, Nothing} = nothing, discount_curve_key::Union{String,Nothing} = nothing - )

Calculate model price for a vector of Payoff objects.

source
DiffFusion.model_price_and_deltasFunction
model_price_and_deltas(
+    )

Calculate model price for a vector of Payoff objects.

source
DiffFusion.model_price_and_deltasFunction
model_price_and_deltas(
     payoffs::AbstractVector,
     path_obj::Path,
     pay_time::Union{ModelTime, Nothing} = nothing,
     discount_curve_key::Union{String,Nothing} = nothing
-    )

Calculate model price and curve sensitivities.

Here, payoffs is a vector of Payoff objects and path_obj is a simulated Path.

pay_time and discount_curve_key control payoff discounting via numeraire calculation.

source
DiffFusion.model_price_and_vegasFunction
model_price_and_vegas(
+    )

Calculate model price and curve sensitivities.

Here, payoffs is a vector of Payoff objects and path_obj is a simulated Path.

pay_time and discount_curve_key control payoff discounting via numeraire calculation.

source
DiffFusion.model_price_and_vegasFunction
model_price_and_vegas(
     payoffs::AbstractVector,
     model::CompositeModel,
     simulation::Function,
@@ -17,13 +17,13 @@
     context::Context,
     pay_time::Union{ModelTime, Nothing} = nothing,
     discount_curve_key::Union{String,Nothing} = nothing
-    )

Calculate model price and model sensitivities.

Here, payoffs is a vector of Payoff objects, model is a full hybrid model.

simulation is a short cut for a Simulation constructor with the signature simulation(model::Model, ch::CorrelationHolder).

ts_list is a list of TermStructure objects for pricing and context is a Context for valuation.

pay_time and discount_curve_key control payoff discounting via numeraire calculation.

source
DiffFusion.model_price_and_deltas_vectorFunction
model_price_and_deltas_vector(
+    )

Calculate model price and model sensitivities.

Here, payoffs is a vector of Payoff objects, model is a full hybrid model.

simulation is a short cut for a Simulation constructor with the signature simulation(model::Model, ch::CorrelationHolder).

ts_list is a list of TermStructure objects for pricing and context is a Context for valuation.

pay_time and discount_curve_key control payoff discounting via numeraire calculation.

source
DiffFusion.model_price_and_deltas_vectorFunction
model_price_and_deltas_vector(
     payoffs::AbstractVector,
     path_obj::Path,
     pay_time::Union{ModelTime, Nothing} = nothing,
     discount_curve_key::Union{String,Nothing} = nothing,
     ad_module::Module = ForwardDiff,
-    )

Calculate model price and curve sensitivities. Sensitivities are calculated as vector together with a vector of labels.

Here, payoffs is a vector of Payoff objects and path_obj is a simulated Path.

pay_time and discount_curve_key control payoff discounting via numeraire calculation.

ad_module can be Zygote or ForwardDiff.

For AMC payoffs we need to update the regression path and trigger a recalibration. For sensitivity calculation, we impose the constraint that regression calibration uses the same paths as valuation.

source
DiffFusion.model_price_and_vegas_vectorFunction
model_price_and_vegas_vector(
+    )

Calculate model price and curve sensitivities. Sensitivities are calculated as vector together with a vector of labels.

Here, payoffs is a vector of Payoff objects and path_obj is a simulated Path.

pay_time and discount_curve_key control payoff discounting via numeraire calculation.

ad_module can be Zygote or ForwardDiff.

For AMC payoffs we need to update the regression path and trigger a recalibration. For sensitivity calculation, we impose the constraint that regression calibration uses the same paths as valuation.

source
DiffFusion.model_price_and_vegas_vectorFunction
model_price_and_vegas_vector(
     payoffs::AbstractVector,
     model::CompositeModel,
     simulation::Function,
@@ -32,4 +32,4 @@
     pay_time::Union{ModelTime, Nothing} = nothing,
     discount_curve_key::Union{String,Nothing} = nothing,
     ad_module::Module = ForwardDiff,
-    )

Calculate model price and model sensitivities. Sensitivities are calculated as vector together with a vector of labels.

Here, payoffs is a vector of Payoff objects, model is a full hybrid model.

simulation is a short cut for a Simulation constructor with the signature simulation(model::Model, ch::CorrelationHolder).

ts_list is a list of TermStructure objects for pricing and context is a Context for valuation.

pay_time and discount_curve_key control payoff discounting via numeraire calculation.

ad_module can be Zygote or ForwardDiff.

For AMC payoffs we need to update the regression path and trigger a recalibration. For sensitivity calculation, we impose the constraint that regression calibration uses the same paths as valuation.

source
+ )

Calculate model price and model sensitivities. Sensitivities are calculated as vector together with a vector of labels.

Here, payoffs is a vector of Payoff objects, model is a full hybrid model.

simulation is a short cut for a Simulation constructor with the signature simulation(model::Model, ch::CorrelationHolder).

ts_list is a list of TermStructure objects for pricing and context is a Context for valuation.

pay_time and discount_curve_key control payoff discounting via numeraire calculation.

ad_module can be Zygote or ForwardDiff.

For AMC payoffs we need to update the regression path and trigger a recalibration. For sensitivity calculation, we impose the constraint that regression calibration uses the same paths as valuation.

source diff --git a/dev/serialisation/serialisation/index.html b/dev/serialisation/serialisation/index.html index d506a36..015542b 100644 --- a/dev/serialisation/serialisation/index.html +++ b/dev/serialisation/serialisation/index.html @@ -3,41 +3,41 @@ constructor : function_name field_name_1 : field_value_1 ... -field_name_n : field_value_n

Dictionary keys are strings, dictionary values are strings, numbers o ordered dictionaries of component structures.

We utilise multiple dispatch to specify serialisation recursively.

Object Serialisation

DiffFusion.serialiseFunction
serialise(o::Any)

Serialise an arbitrary object.

source
serialise(o::Future)

Serialise a Future object from a remotecall(...).

This operation is blocking. We require that the result is calculated such that it actually can be serialised.

source
serialise(o::Nothing)

Serialise Nothing.

source
serialise(o::AbstractString)

Serialise String.

source
serialise(o::Integer)

Serialise Integer.

source
serialise(o::ModelValue)

Serialise Float.

source
serialise(o::AbstractDict)

Serialise dictionaries.

source
serialise(o::AbstractVector)

Serialise vectors.

source
serialise(o::AbstractMatrix)

Serialise matrices.

source
serialise(o::AbstractArray)

Serialise d-dimensional arrays.

source
serialise(o::FlatForward)

Serialise FlatForward.

source
serialise(o::ZeroCurve)

Serialise ZeroCurve.

source
serialise(o::LinearZeroCurve)
+field_name_n : field_value_n

Dictionary keys are strings, dictionary values are strings, numbers o ordered dictionaries of component structures.

We utilise multiple dispatch to specify serialisation recursively.

Object Serialisation

DiffFusion.serialiseFunction
serialise(o::Any)

Serialise an arbitrary object.

source
serialise(o::Future)

Serialise a Future object from a remotecall(...).

This operation is blocking. We require that the result is calculated such that it actually can be serialised.

source
serialise(o::Nothing)

Serialise Nothing.

source
serialise(o::AbstractString)

Serialise String.

source
serialise(o::Integer)

Serialise Integer.

source
serialise(o::ModelValue)

Serialise Float.

source
serialise(o::AbstractDict)

Serialise dictionaries.

source
serialise(o::AbstractVector)

Serialise vectors.

source
serialise(o::AbstractMatrix)

Serialise matrices.

source
serialise(o::AbstractArray)

Serialise d-dimensional arrays.

source
serialise(o::FlatForward)

Serialise FlatForward.

source
serialise(o::ZeroCurve)

Serialise ZeroCurve.

source
serialise(o::LinearZeroCurve)
 
-Serialise LinearZeroCurve.
source
serialise(o::BackwardFlatVolatility)

Serialise BackwardFlatVolatility.

source
serialise(o::PiecewiseFlatParameter)

Serialise PiecewiseFlatParameter.

source
serialise(o::CorrelationHolder)

Serialise CorrelationHolder.

source
serialise(o::Context)

Serialise model Context.

source
serialise(o::BenchmarkTimesScaling)

Serialise a BenchmarkTimesScaling enumeration object.

source
serialise(o::GaussianHjmModel)

Serialise GaussianHjmModel.

source
serialise(o::LognormalAssetModel)

Serialise LognormalAssetModel.

source
serialise(o::CevAssetModel)

Serialise CevAssetModel.

source
serialise(o::SimpleModel)

Serialise SimpleModel.

source
DiffFusion.serialise_keyFunction
serialise_key(alias::String)

Serialise an alias as a key.

This is required to capture object dependencies for de-serialisation.

source

Object De-Serialisation

DiffFusion.deserialiseFunction
deserialise(o::String, d::Union{AbstractDict, Nothing} = nothing)

De-serialise strings.

We incorporate some logic to handle external references.

We allow that the repository disctionary d contains remote call Futures. However, we want to ensure that the method returns actual objects. Thus, we fetch any Future within this method.

source
deserialise(o::Number, d::Union{AbstractDict, Nothing} = nothing)

De-serialise numbers.

source
deserialise(o::AbstractDict, d::Union{AbstractDict, Nothing} = nothing)

De-serialise dictionary.

source
deserialise(o::AbstractVector, d::Union{AbstractDict, Nothing} = nothing)

De-serialise vector or matrix.

source
DiffFusion.deserialise_objectFunction
deserialise_object(o::OrderedDict, d::Union{AbstractDict, Nothing} = nothing)

De-serialise objects.

Caution, this method bares the potential risk of code injection.

source
DiffFusion.arrayFunction
array(data::AbstractVector, dims)

Convert vector data into d-dimensional array. Here, d is length(dims).

Parameter dims is a vector or tuple of number of elements per dimension.

Data vector data must be of appropriate length, i.e. length(data) == prod(dims).

source

Rebuild Models

This subsection contains methods to extract term structures and re-build models.

Methods are intended to be used for sensitivity calculations. For that purpose we need to identify model parameters as inputs to the valuation function.

Model parameters for a model m::Model are stored in a Dict{String, Any} of the form

"type" => typeof(m),
+Serialise LinearZeroCurve.
source
serialise(o::BackwardFlatVolatility)

Serialise BackwardFlatVolatility.

source
serialise(o::PiecewiseFlatParameter)

Serialise PiecewiseFlatParameter.

source
serialise(o::CorrelationHolder)

Serialise CorrelationHolder.

source
serialise(o::Context)

Serialise model Context.

source
serialise(o::BenchmarkTimesScaling)

Serialise a BenchmarkTimesScaling enumeration object.

source
serialise(o::GaussianHjmModel)

Serialise GaussianHjmModel.

source
serialise(o::LognormalAssetModel)

Serialise LognormalAssetModel.

source
serialise(o::CevAssetModel)

Serialise CevAssetModel.

source
serialise(o::SimpleModel)

Serialise SimpleModel.

source
DiffFusion.serialise_structFunction
serialise_struct(o::Any)

Create a dictionary from an arbitrary struct object

source
DiffFusion._serialise_key_referencesConstant

Identifyiers used to specify a reference for serialisation.

source
DiffFusion.serialise_keyFunction
serialise_key(alias::String)

Serialise an alias as a key.

This is required to capture object dependencies for de-serialisation.

source
DiffFusion.serialise_as_listFunction
serialise_as_list(o::SimpleModel)

Serialise SimpleModel as a list and capture references.

source

Object De-Serialisation

DiffFusion.deserialiseFunction
deserialise(o::String, d::Union{AbstractDict, Nothing} = nothing)

De-serialise strings.

We incorporate some logic to handle external references.

We allow that the repository disctionary d contains remote call Futures. However, we want to ensure that the method returns actual objects. Thus, we fetch any Future within this method.

source
deserialise(o::Number, d::Union{AbstractDict, Nothing} = nothing)

De-serialise numbers.

source
deserialise(o::AbstractDict, d::Union{AbstractDict, Nothing} = nothing)

De-serialise dictionary.

source
deserialise(o::AbstractVector, d::Union{AbstractDict, Nothing} = nothing)

De-serialise vector or matrix.

source
DiffFusion.deserialise_objectFunction
deserialise_object(o::OrderedDict, d::Union{AbstractDict, Nothing} = nothing)

De-serialise objects.

Caution, this method bares the potential risk of code injection.

source
DiffFusion.deserialise_from_listFunction
deserialise_from_list(dict_list::AbstractVector)

De-serialise a list of objects and capture references.

source
DiffFusion.arrayFunction
array(data::AbstractVector, dims)

Convert vector data into d-dimensional array. Here, d is length(dims).

Parameter dims is a vector or tuple of number of elements per dimension.

Data vector data must be of appropriate length, i.e. length(data) == prod(dims).

source

Rebuild Models

This subsection contains methods to extract term structures and re-build models.

Methods are intended to be used for sensitivity calculations. For that purpose we need to identify model parameters as inputs to the valuation function.

Model parameters for a model m::Model are stored in a Dict{String, Any} of the form

"type" => typeof(m),
 "alias" => m.alias,
 [parameter identifier] => [parameter value(s)]
-...
DiffFusion.model_parametersFunction
model_parameters(m::GaussianHjmModel)

Extract model parameters from GaussianHjmModel.

source
model_parameters(m::LognormalAssetModel)

Extract model parameters from LognormalAssetModel.

source
model_parameters(m::CevAssetModel)

Extract model parameters from CevAssetModel.

source
model_parameters(m::SimpleModel)

Extract model parameters from SimpleModel.

source
DiffFusion.build_modelFunction
build_model(
+...
DiffFusion.model_parametersFunction
model_parameters(m::GaussianHjmModel)

Extract model parameters from GaussianHjmModel.

source
model_parameters(m::LognormalAssetModel)

Extract model parameters from LognormalAssetModel.

source
model_parameters(m::CevAssetModel)

Extract model parameters from CevAssetModel.

source
model_parameters(m::SimpleModel)

Extract model parameters from SimpleModel.

source
DiffFusion.build_modelFunction
build_model(
      alias::String,
      param_dict::Dict,
      model_dict::Dict,
-     )

Re-build a model from model parameters dictionary.

Alias identifies the model which is to be build. Input parameter term structures are stored in paramdict. The modeldict is used to reference quanto models.

source
DiffFusion.termstructure_dictionary!Function
termstructure_dictionary!(
+     )

Re-build a model from model parameters dictionary.

Alias identifies the model which is to be build. Input parameter term structures are stored in paramdict. The modeldict is used to reference quanto models.

source
DiffFusion.termstructure_dictionary!Function
termstructure_dictionary!(
     ts_dict::AbstractDict,
     ts_labels::AbstractVector,
     ts_values::AbstractVector,
-    )

Re-build term structure dictionary from labels and values.

source
DiffFusion.model_parameters!Function
model_parameters!(
     param_dict::Dict,
     param_labels::AbstractVector,
     param_values::AbstractVector,
-    )

Re-build model parameter dictionary from volatility labels and values.

source

Read Term Structures From CSV Files

Read Term Structures From CSV Files

DiffFusion.read_zero_curvesFunction
read_zero_curves(
     source,
     delim::AbstractChar,
     method_alias::String = "LINEAR"
-    )

Read times and values from CSV file and create ZeroCurve.

Arguments source and delim are passed on to DelimitedFiles.readdlm.

method_alias is the interpolation string used in interpolation_methods.

source
DiffFusion.read_volatilitiesFunction
read_volatilities(
+    )

Read times and values from CSV file and create ZeroCurve.

Arguments source and delim are passed on to DelimitedFiles.readdlm.

method_alias is the interpolation string used in interpolation_methods.

source
DiffFusion.read_volatilitiesFunction
read_volatilities(
     source,
     delim::AbstractChar,
-    )

Read times and values from CSV file and create scalar-valued BackwardFlatVolatility.

Arguments source and delim are passed on to DelimitedFiles.readdlm.

source
DiffFusion.read_volatilityFunction
read_volatility(
+    )

Read times and values from CSV file and create scalar-valued BackwardFlatVolatility.

Arguments source and delim are passed on to DelimitedFiles.readdlm.

source
DiffFusion.read_volatilityFunction
read_volatility(
     source,
     delim::AbstractChar,
-    )

Read times and values from CSV file and create a single vector-valued BackwardFlatVolatility.

Arguments source and delim are passed on to DelimitedFiles.readdlm.

Termstructure alias is read from the first data column header.

source
DiffFusion.read_parametersFunction
read_parameters(
+    )

Read times and values from CSV file and create a single vector-valued BackwardFlatVolatility.

Arguments source and delim are passed on to DelimitedFiles.readdlm.

Termstructure alias is read from the first data column header.

source
DiffFusion.read_parametersFunction
read_parameters(
     source,
     delim::AbstractChar,
     param_func::Function = forward_flat_parameter,
-    )

Read times and values from CSV file and create scalar-valued ParameterTermstructures.

Arguments source and delim are passed on to DelimitedFiles.readdlm.

constructor is the constructor called to create the term structure. It is used to apply method to read ForwardFlatParameter and BackwardFlatParameter.

source
DiffFusion.read_correlationsFunction
read_correlations(
+    )

Read times and values from CSV file and create scalar-valued ParameterTermstructures.

Arguments source and delim are passed on to DelimitedFiles.readdlm.

constructor is the constructor called to create the term structure. It is used to apply method to read ForwardFlatParameter and BackwardFlatParameter.

source
DiffFusion.read_correlationsFunction
read_correlations(
     source,
     delim::AbstractChar,
-    )

Read factor aliases and correlation values and setup a CorrelationHolder.

Arguments source and delim are passed on to DelimitedFiles.readdlm.

source
+ )

Read factor aliases and correlation values and setup a CorrelationHolder.

Arguments source and delim are passed on to DelimitedFiles.readdlm.

source diff --git a/dev/simulations/simulations/index.html b/dev/simulations/simulations/index.html index 68f3ca8..1eb4297 100644 --- a/dev/simulations/simulations/index.html +++ b/dev/simulations/simulations/index.html @@ -4,16 +4,16 @@ times::AbstractVector X::AbstractArray dZ::Union{AbstractArray, Nothing} -end

A Simulation object represents the result of a Monte Carlo simulation.

Elements are:

source
DiffFusion.pseudo_brownian_incrementsFunction
pseudo_brownian_increments(
+end

A Simulation object represents the result of a Monte Carlo simulation.

Elements are:

  • model - the model used for simulation.
  • times - vector of simulation times starting with 0.
  • X - tensor of size (N_1, N_2, N_3) and type ModelValue where
    • N_1 is length(m.state_alias),
    • N_2 is number of Monte Carlo paths,
    • N_3 is length(times).
  • dZ - Brownian motion increments.
source
DiffFusion.pseudo_brownian_incrementsFunction
pseudo_brownian_increments(
     n_states::Int,
     n_paths::Int,
     n_times::Int,  # without zero
     seed::Int = 271828182846,
-    )

A simple method to generate Brownian motion increments.

source
DiffFusion.sobol_brownian_incrementsFunction
sobol_brownian_increments(
+    )

A simple method to generate Brownian motion increments.

source
DiffFusion.sobol_brownian_incrementsFunction
sobol_brownian_increments(
     n_states::Int,
     n_paths::Int,
     n_times::Int,  # without zero
-    )

Generate Brownian motion increments via Sobol sequence.

source
DiffFusion.simple_simulationFunction
simple_simulation(
+    )

Generate Brownian motion increments via Sobol sequence.

source
DiffFusion.simple_simulationFunction
simple_simulation(
     model::Model,
     ch::CorrelationHolder,
     times::AbstractVector,
@@ -21,7 +21,7 @@
     with_progress_bar::Bool = true,
     brownian_increments::Function = pseudo_brownian_increments,
     store_brownian_increments::Bool = false,
-    )

A simple Monte Carlo simulation method assuming all model components are state-independent.

source
DiffFusion.diagonal_simulationFunction
diagonal_simulation(
+    )

A simple Monte Carlo simulation method assuming all model components are state-independent.

source
DiffFusion.diagonal_simulationFunction
diagonal_simulation(
     model::Model,
     ch::CorrelationHolder,
     times::AbstractVector,
@@ -29,4 +29,4 @@
     with_progress_bar::Bool = true,
     brownian_increments::Function = pseudo_brownian_increments,
     store_brownian_increments::Bool = false,
-    )

A Monte Carlo simulation method assuming all model components are diagonal models.

source
+ )

A Monte Carlo simulation method assuming all model components are diagonal models.

source diff --git a/dev/termstructures/correlations/index.html b/dev/termstructures/correlations/index.html index cb911ed..d4d04c3 100644 --- a/dev/termstructures/correlations/index.html +++ b/dev/termstructures/correlations/index.html @@ -1,21 +1,21 @@ -Correlations · [∂F]

Correlations

Correlation Term Structure Type

DiffFusion.CorrelationTermstructureType
abstract type CorrelationTermstructure <: Termstructure end

An abstract correlation term structure that provides methods to calculate instantaneous correlations.

source
DiffFusion.CorrelationHolderType
struct CorrelationHolder <: CorrelationTermstructure
+Correlations · [∂F]

Correlations

Correlation Term Structure Type

DiffFusion.CorrelationTermstructureType
abstract type CorrelationTermstructure <: Termstructure end

An abstract correlation term structure that provides methods to calculate instantaneous correlations.

source
DiffFusion.CorrelationHolderType
struct CorrelationHolder <: CorrelationTermstructure
     alias::String
     correlations::Dict{String, ModelValue}
     sep::String
     value_type::DataType
-end

A container holding correlation values.

A CorrelationHolder allows to calculate correlation matrices based on String alias keys (identifiers).

value_type specifies the type of correlation entries. This ensures that all values are of consistent type. This feature is required for correlation sensitivity calculation.

source
DiffFusion.correlation_holderFunction
correlation_holder(
+end

A container holding correlation values.

A CorrelationHolder allows to calculate correlation matrices based on String alias keys (identifiers).

value_type specifies the type of correlation entries. This ensures that all values are of consistent type. This feature is required for correlation sensitivity calculation.

source
DiffFusion.correlation_holderFunction
correlation_holder(
     alias::String,
     correlations::Dict,
     sep::String = "<>",
     value_type::DataType = ModelValue,
-    )

Create a CorrelationHolder object from dictionary.

source
correlation_holder(
+    )

Create a CorrelationHolder object from dictionary.

source
correlation_holder(
     alias::String,
     sep::String = "<>",
     value_type::DataType = ModelValue,
-    )

Create an empty CorrelationHolder object.

source
correlation_holder(m::AssetModel)

Return the correlation holder term structure.

source

Return the model's CorrelationHolder.

source

Functions

Call operator for CorrelationTermstructure is defined as

(ts::CorrelationTermstructure)(args...) = correlation(ts, args...)
DiffFusion.correlationFunction
correlation(ts::CorrelationTermstructure, alias1::String, alias2::String)

Return a scalar instantaneous correlation.

source
correlation(ts::CorrelationTermstructure, aliases::AbstractVector{String})

Return a symmetric matrix of instantaneous correlations.

source
correlation(ts::CorrelationTermstructure, aliases1::AbstractVector{String}, aliases2::AbstractVector{String})

Return a matrix of instantaneous correlations, each element of aliases1 versus each element of aliases2. The size of the resulting matrix is (length(aliases1), length(aliases2)).

source
correlation(ts::CorrelationTermstructure, alias1::String, aliases2::AbstractVector{String})

Return an (1,N) matrix of instantaneous correlations.

source
correlation(ts::CorrelationTermstructure, aliases1::AbstractVector{String}, alias2::String)

Return an (N, 1) matrix of instantaneous correlations.

source
correlation(ch::CorrelationHolder, alias1::String, alias2::String)

Return a scalar instantaneous correlation.

source
correlation(ch::CorrelationHolder, aliases1::AbstractVector{String}, aliases2::AbstractVector{String})

Return a matrix of instantaneous correlations, each element of aliases1 versus each element of aliases2. The size of the resulting matrix is (length(aliases1), length(aliases2)).

source
correlation(ch::CorrelationHolder, aliases::AbstractVector{String})

Return a symmetric matrix of instantaneous correlations.

source
DiffFusion.correlation_keyFunction
correlation_key(ch::CorrelationHolder, alias1::String, alias2::String)

Derive the key for correlation dictionary from two aliases.

source
DiffFusion.set_correlation!Function
set_correlation!(
+    )

Create an empty CorrelationHolder object.

source
correlation_holder(m::AssetModel)

Return the correlation holder term structure.

source

Return the model's CorrelationHolder.

source

Functions

Call operator for CorrelationTermstructure is defined as

(ts::CorrelationTermstructure)(args...) = correlation(ts, args...)
DiffFusion.correlationFunction
correlation(ts::CorrelationTermstructure, alias1::String, alias2::String)

Return a scalar instantaneous correlation.

source
correlation(ts::CorrelationTermstructure, aliases::AbstractVector{String})

Return a symmetric matrix of instantaneous correlations.

source
correlation(ts::CorrelationTermstructure, aliases1::AbstractVector{String}, aliases2::AbstractVector{String})

Return a matrix of instantaneous correlations, each element of aliases1 versus each element of aliases2. The size of the resulting matrix is (length(aliases1), length(aliases2)).

source
correlation(ts::CorrelationTermstructure, alias1::String, aliases2::AbstractVector{String})

Return an (1,N) matrix of instantaneous correlations.

source
correlation(ts::CorrelationTermstructure, aliases1::AbstractVector{String}, alias2::String)

Return an (N, 1) matrix of instantaneous correlations.

source
correlation(ch::CorrelationHolder, alias1::String, alias2::String)

Return a scalar instantaneous correlation.

source
correlation(ch::CorrelationHolder, aliases1::AbstractVector{String}, aliases2::AbstractVector{String})

Return a matrix of instantaneous correlations, each element of aliases1 versus each element of aliases2. The size of the resulting matrix is (length(aliases1), length(aliases2)).

source
correlation(ch::CorrelationHolder, aliases::AbstractVector{String})

Return a symmetric matrix of instantaneous correlations.

source
DiffFusion.correlation_keyFunction
correlation_key(ch::CorrelationHolder, alias1::String, alias2::String)

Derive the key for correlation dictionary from two aliases.

source
DiffFusion.set_correlation!Function
set_correlation!(
     ch::CorrelationHolder,
     alias1::String,
     alias2::String,
     value::ModelValue
-    )

Insert a new correlation value into CorrelationHolder. If a correlation already exists it is overwritten.

source
DiffFusion.getFunction
get(ch::CorrelationHolder, alias1::String, alias2::String)

Implement methodology to obtain a scalar correlation from a CorrelationHolder.

source
+ )

Insert a new correlation value into CorrelationHolder. If a correlation already exists it is overwritten.

source
DiffFusion.getFunction
get(ch::CorrelationHolder, alias1::String, alias2::String)

Implement methodology to obtain a scalar correlation from a CorrelationHolder.

source
diff --git a/dev/termstructures/others/index.html b/dev/termstructures/others/index.html index 339c34c..ef3b25b 100644 --- a/dev/termstructures/others/index.html +++ b/dev/termstructures/others/index.html @@ -1,19 +1,19 @@ -Others · [∂F]

Futures, Inflation, Credit

Futures Term Structure

DiffFusion.FuturesTermstructureType
abstract type FuturesTermstructure <: Termstructure end

An abstract futures term structure that provides methods to calculate prices of futures. Such prices represent risk-neutral expectations of spot prices.

source

Call operator for FuturesTermstructure is defined as

(ts::FuturesTermstructure)(args...) = future_price(ts, args...)

Inflation Term Structure

DiffFusion.InflationTermstructureType
abstract type InflationTermstructure <: Termstructure end

An abstract inflation term structure that provides methods to calculate forward inflation index. Forward inflation index is a T-forward measure expectation of (spot) inflation index values.

source

Call operator for InflationTermstructure is defined as

(ts::InflationTermstructure)(args...) = inflation_index(ts, args...)

Credit Default Term Structures

DiffFusion.FlatSpreadCurveType
struct FlatSpreadCurve <: CreditDefaultTermstructure
+Others · [∂F]

Futures, Inflation, Credit

Futures Term Structure

DiffFusion.FuturesTermstructureType
abstract type FuturesTermstructure <: Termstructure end

An abstract futures term structure that provides methods to calculate prices of futures. Such prices represent risk-neutral expectations of spot prices.

source

Call operator for FuturesTermstructure is defined as

(ts::FuturesTermstructure)(args...) = future_price(ts, args...)

Inflation Term Structure

DiffFusion.InflationTermstructureType
abstract type InflationTermstructure <: Termstructure end

An abstract inflation term structure that provides methods to calculate forward inflation index. Forward inflation index is a T-forward measure expectation of (spot) inflation index values.

source

Call operator for InflationTermstructure is defined as

(ts::InflationTermstructure)(args...) = inflation_index(ts, args...)

Credit Default Term Structures

DiffFusion.flat_spread_curveFunction
flat_spread_curve(alias::String, spread::ModelValue)

Create a FlatSpreadCurve.

source
flat_spread_curve(spread::ModelValue)

Create a FlatSpreadCurve without alias.

source
DiffFusion.flat_spread_curveFunction
flat_spread_curve(alias::String, spread::ModelValue)

Create a FlatSpreadCurve.

source
flat_spread_curve(spread::ModelValue)

Create a FlatSpreadCurve without alias.

source
DiffFusion.LogSurvivalCurveType
struct LogSurvivalCurve <: CreditDefaultTermstructure
     alias::String
     times::AbstractVector
     values::AbstractVector
-end

Log-interpolated survival probabilities.

source
DiffFusion.survival_curveFunction
survival_curve(
     alias::String,
     times::AbstractVector,
     survival_probs::AbstractVector,
     interp_method = (x,y) -> linear_interpolation(x, y, extrapolation_bc = Line()),
-    )

Create a LogSurvivalCurve.

source
survival_curve(
+    )

Create a LogSurvivalCurve.

source
survival_curve(
     alias::String,
     times::AbstractVector,
     survival_probs::AbstractVector,
     method_alias::String,
-    )

Create a LogSurvivalCurve for pre-defined interpolation methods.

source

Call operator for CreditDefaultTermstructure is defined as

(ts::CreditDefaultTermstructure)(args...) = survival(ts, args...)
DiffFusion.survivalFunction
survival(ts::CreditDefaultTermstructure, t::ModelTime)

Return the survival probability with observation time t.

source
survival(ts::FlatSpreadCurve, t::ModelTime)

Calculate survival probability.

source
survival(ts::LogSurvivalCurve, t::ModelTime)

Calculate survival probability.

source
+ )

Create a LogSurvivalCurve for pre-defined interpolation methods.

source

Call operator for CreditDefaultTermstructure is defined as

(ts::CreditDefaultTermstructure)(args...) = survival(ts, args...)
DiffFusion.survivalFunction
survival(ts::CreditDefaultTermstructure, t::ModelTime)

Return the survival probability with observation time t.

source
survival(ts::FlatSpreadCurve, t::ModelTime)

Calculate survival probability.

source
survival(ts::LogSurvivalCurve, t::ModelTime)

Calculate survival probability.

source
diff --git a/dev/termstructures/parameters/index.html b/dev/termstructures/parameters/index.html index 7102438..fa0b8f7 100644 --- a/dev/termstructures/parameters/index.html +++ b/dev/termstructures/parameters/index.html @@ -1,26 +1,26 @@ -Model Parameters · [∂F]

Model Parameters

Parameter Term Structure Types

DiffFusion.ParameterTermstructureType
abstract type ParameterTermstructure <: Termstructure end

An abstract generic parameter term structure that provides methods to retrieve parameter values for various incarnations of signatures.

source
DiffFusion.PiecewiseFlatParameterType
abstract type PiecewiseFlatParameter <: ParameterTermstructure end

A generic vector-valued model parameter term structure with piece-wise constant interpolation and constant extrapolation.

source
DiffFusion.BackwardFlatParameterType
struct BackwardFlatParameter <: PiecewiseFlatParameter
+Model Parameters · [∂F]

Model Parameters

Parameter Term Structure Types

DiffFusion.ParameterTermstructureType
abstract type ParameterTermstructure <: Termstructure end

An abstract generic parameter term structure that provides methods to retrieve parameter values for various incarnations of signatures.

source
DiffFusion.PiecewiseFlatParameterType
abstract type PiecewiseFlatParameter <: ParameterTermstructure end

A generic vector-valued model parameter term structure with piece-wise constant interpolation and constant extrapolation.

source
DiffFusion.BackwardFlatParameterType
struct BackwardFlatParameter <: PiecewiseFlatParameter
     alias::String
     times::AbstractVector
     values::AbstractMatrix
-end

A generic vector-valued model parameter term structure with piece-wise constant backward-flat interpolation and constant extrapolation.

source
DiffFusion.backward_flat_parameterFunction
backward_flat_parameter(
+end

A generic vector-valued model parameter term structure with piece-wise constant backward-flat interpolation and constant extrapolation.

source
DiffFusion.backward_flat_parameterFunction
backward_flat_parameter(
      alias::String,
      times::AbstractVector,
      values::AbstractMatrix,
-     )

Create a BackwardFlatParameter object for vector-valued parameters.

source
backward_flat_parameter(
+     )

Create a BackwardFlatParameter object for vector-valued parameters.

source
backward_flat_parameter(
     alias::String,
     times::AbstractVector,
     values::AbstractVector,
-    )

Create a BackwardFlatParameter object for scalar parameters.

source
DiffFusion.flat_parameterFunction
flat_parameter(value::ModelValue)

Create a constant BackwardFlatParameter object.

source
flat_parameter(alias::String, value::ModelValue)

Create a constant BackwardFlatParameter object.

source
flat_parameter(value::AbstractVector)

Create a constant BackwardFlatParameter object.

source
flat_parameter(alias::String, value::AbstractVector)

Create a constant BackwardFlatParameter object.

source
DiffFusion.flat_parameterFunction
flat_parameter(value::ModelValue)

Create a constant BackwardFlatParameter object.

source
flat_parameter(alias::String, value::ModelValue)

Create a constant BackwardFlatParameter object.

source
flat_parameter(value::AbstractVector)

Create a constant BackwardFlatParameter object.

source
flat_parameter(alias::String, value::AbstractVector)

Create a constant BackwardFlatParameter object.

source
DiffFusion.ForwardFlatParameterType
struct ForwardFlatParameter <: PiecewiseFlatParameter
     alias::String
     times::AbstractVector
     values::AbstractMatrix
-end

A generic vector-valued model parameter term structure with piece-wise constant forward-flat interpolation and constant extrapolation.

source
DiffFusion.forward_flat_parameterFunction
forward_flat_parameter(
+end

A generic vector-valued model parameter term structure with piece-wise constant forward-flat interpolation and constant extrapolation.

source
DiffFusion.forward_flat_parameterFunction
forward_flat_parameter(
     alias::String,
     times::AbstractVector,
     values::AbstractMatrix,
-    )

Create a ForwardFlatParameter object for vector-valued parameters.

source
forward_flat_parameter(
+    )

Create a ForwardFlatParameter object for vector-valued parameters.

source
forward_flat_parameter(
     alias::String,
     times::AbstractVector,
     values::AbstractVector,
-    )

Create a ForwardFlatParameter object for scalar parameters.

source
DiffFusion.time_idxMethod
time_idx(ts::BackwardFlatParameter, t)

Find the index such that T[idx-1] < t <= T[idx]. If t is larger than the last (or all) times T then return length(T)+1.

source

Functions

Call operator for ParameterTermstructure is defined as

(ts::ParameterTermstructure)(args...) = value(ts, args...)
DiffFusion.valueFunction
value(ts::ParameterTermstructure, result_size::TermstructureResultSize = TermstructureVector)

Return a value for constant/time-homogeneous parameters.

source
value(ts::ParameterTermstructure, t::ModelTime, result_size::TermstructureResultSize = TermstructureVector)

Return a value for a given observation time t.

source
value(ts::PiecewiseFlatParameter, result_size::TermstructureResultSize = TermstructureVector)

Return a value for constant/time-homogeneous parameters.

source
value(ts::PiecewiseFlatParameter, t::ModelTime, result_size::TermstructureResultSize = TermstructureVector)

Return a value for a given observation time t.

source
DiffFusion.time_idxMethod
time_idx(ts::ForwardFlatParameter, t)

Find the index such that T[idx] >= t > T[idx+1]. If t is smaller than the first (or all) times T then return 0.

source
+ )

Create a ForwardFlatParameter object for scalar parameters.

source
DiffFusion.time_idxMethod
time_idx(ts::BackwardFlatParameter, t)

Find the index such that T[idx-1] < t <= T[idx]. If t is larger than the last (or all) times T then return length(T)+1.

source

Functions

Call operator for ParameterTermstructure is defined as

(ts::ParameterTermstructure)(args...) = value(ts, args...)
DiffFusion.valueFunction
value(ts::ParameterTermstructure, result_size::TermstructureResultSize = TermstructureVector)

Return a value for constant/time-homogeneous parameters.

source
value(ts::ParameterTermstructure, t::ModelTime, result_size::TermstructureResultSize = TermstructureVector)

Return a value for a given observation time t.

source
value(ts::PiecewiseFlatParameter, result_size::TermstructureResultSize = TermstructureVector)

Return a value for constant/time-homogeneous parameters.

source
value(ts::PiecewiseFlatParameter, t::ModelTime, result_size::TermstructureResultSize = TermstructureVector)

Return a value for a given observation time t.

source
DiffFusion.time_idxMethod
time_idx(ts::ForwardFlatParameter, t)

Find the index such that T[idx] >= t > T[idx+1]. If t is smaller than the first (or all) times T then return 0.

source
diff --git a/dev/termstructures/termstructures/index.html b/dev/termstructures/termstructures/index.html index d82ac3f..f023f85 100644 --- a/dev/termstructures/termstructures/index.html +++ b/dev/termstructures/termstructures/index.html @@ -1,6 +1,6 @@ -Term Structures Functions · [∂F]

Term Structures Functions

In this section we document term structures.

Term Structure Type and Methods

DiffFusion.TermstructureResultSizeType
@enum(
+Term Structures Functions · [∂F]

Term Structures Functions

In this section we document term structures.

Term Structure Type and Methods

DiffFusion.TermstructureResultSizeType
@enum(
     TermstructureResultSize,
     TermstructureVector,
     TermstructureScalar
-)

Specify the dimensions/shape of the values modelled by a term structure.

For some term structures (e.g. ParameterTermstructure and VolatilityTermstructure) the result may be either a vector or a scalar.

source
+)

Specify the dimensions/shape of the values modelled by a term structure.

For some term structures (e.g. ParameterTermstructure and VolatilityTermstructure) the result may be either a vector or a scalar.

source
diff --git a/dev/termstructures/volatilities/index.html b/dev/termstructures/volatilities/index.html index e041843..1561d9a 100644 --- a/dev/termstructures/volatilities/index.html +++ b/dev/termstructures/volatilities/index.html @@ -1,14 +1,14 @@ -Volatilities · [∂F]

Volatilities

Volatility Term Structure Types

DiffFusion.VolatilityTermstructureType
abstract type VolatilityTermstructure <: Termstructure end

An abstract volatility term structure that provides methods to calculate volatility values for various incarnations of signatures.

source
DiffFusion.BackwardFlatVolatilityType
struct BackwardFlatVolatility <: VolatilityTermstructure
+Volatilities · [∂F]

Volatilities

Volatility Term Structure Types

DiffFusion.VolatilityTermstructureType
abstract type VolatilityTermstructure <: Termstructure end

An abstract volatility term structure that provides methods to calculate volatility values for various incarnations of signatures.

source
DiffFusion.BackwardFlatVolatilityType
struct BackwardFlatVolatility <: VolatilityTermstructure
     alias::String
     times::AbstractVector
     values::AbstractMatrix
-end

A vector-valued volatility term structure with piece-wise constant (backward-flat) interpolation and constant extrapolation.

source
DiffFusion.backward_flat_volatilityFunction
backward_flat_volatility(
+end

A vector-valued volatility term structure with piece-wise constant (backward-flat) interpolation and constant extrapolation.

source
DiffFusion.backward_flat_volatilityFunction
backward_flat_volatility(
     alias::String,
     times::AbstractVector,
     values::AbstractMatrix,
-    )

Create a BackwardFlatVolatility object for vector-valued volatility.

Volatility values are of size (nvols, ntimes).

source
backward_flat_volatility(
+    )

Create a BackwardFlatVolatility object for vector-valued volatility.

Volatility values are of size (nvols, ntimes).

source
backward_flat_volatility(
     alias::String,
     times::AbstractVector,
     values::AbstractVector,
-    )

Create a BackwardFlatVolatility object for scalar volatility.

source
DiffFusion.flat_volatilityFunction
flat_volatility(alias::String, value)

Create a BackwardFlatVolatility object for a flat volatility.

source
flat_volatility(alias::String, value)

Create a BackwardFlatVolatility object for a flat volatility.

source

Functions

Call operator for VolatilityTermstructure is defined as

(ts::VolatilityTermstructure)(args...) = volatility(ts, args...)
DiffFusion.volatilityFunction
volatility(ts::VolatilityTermstructure, t::ModelTime, result_size::TermstructureResultSize = TermstructureVector)

Return a volatility for a given observation time t.

source
DiffFusion.volatilityMethod
volatility(ts::VolatilityTermstructure, t::ModelTime, x::ModelValue)

Return a scalar volatility for a given observation time t and underlying or strike value x.

source
DiffFusion.volatilityFunction
volatility(ts::BackwardFlatVolatility, t::ModelTime, result_size::TermstructureResultSize = TermstructureVector)

Return a vector of volatilities for a given observation time t.

source
DiffFusion.time_idxMethod
time_idx(ts::BackwardFlatVolatility, t)

Find the index such that T[idx-1] < t <= T[idx]. If t is larger than the last (or all) times T then return length(T)+1.

source
+ )

Create a BackwardFlatVolatility object for scalar volatility.

source
DiffFusion.flat_volatilityFunction
flat_volatility(alias::String, value)

Create a BackwardFlatVolatility object for a flat volatility.

source
flat_volatility(alias::String, value)

Create a BackwardFlatVolatility object for a flat volatility.

source

Functions

Call operator for VolatilityTermstructure is defined as

(ts::VolatilityTermstructure)(args...) = volatility(ts, args...)
DiffFusion.volatilityFunction
volatility(ts::VolatilityTermstructure, t::ModelTime, result_size::TermstructureResultSize = TermstructureVector)

Return a volatility for a given observation time t.

source
DiffFusion.volatilityMethod
volatility(ts::VolatilityTermstructure, t::ModelTime, x::ModelValue)

Return a scalar volatility for a given observation time t and underlying or strike value x.

source
DiffFusion.volatilityFunction
volatility(ts::BackwardFlatVolatility, t::ModelTime, result_size::TermstructureResultSize = TermstructureVector)

Return a vector of volatilities for a given observation time t.

source
DiffFusion.time_idxMethod
time_idx(ts::BackwardFlatVolatility, t)

Find the index such that T[idx-1] < t <= T[idx]. If t is larger than the last (or all) times T then return length(T)+1.

source
diff --git a/dev/termstructures/yield_curves/index.html b/dev/termstructures/yield_curves/index.html index d1c86d7..3e088dc 100644 --- a/dev/termstructures/yield_curves/index.html +++ b/dev/termstructures/yield_curves/index.html @@ -1,39 +1,39 @@ -Yield Curves · [∂F]

Yield Curves

Yield Term Structure Types

DiffFusion.YieldTermstructureType
abstract type YieldTermstructure <: Termstructure end

An abstract yield term structure that provides methods to calculate discount factors zero rates and forward rates.

source
DiffFusion.FlatForwardType
struct FlatForward <: YieldTermstructure
+Yield Curves · [∂F]

Yield Curves

Yield Term Structure Types

DiffFusion.YieldTermstructureType
abstract type YieldTermstructure <: Termstructure end

An abstract yield term structure that provides methods to calculate discount factors zero rates and forward rates.

source
DiffFusion.flat_forwardFunction
flat_forward(alias::String, rate)

Create a FlatForward yield curve.

source
flat_forward(rate)

Create a FlatForward yield curve without alias.

source
DiffFusion.flat_forwardFunction
flat_forward(alias::String, rate)

Create a FlatForward yield curve.

source
flat_forward(rate)

Create a FlatForward yield curve without alias.

source
DiffFusion.ZeroCurveType
struct ZeroCurve <: YieldTermstructure
     alias::String
     times::AbstractVector
     values::AbstractVector
     interpolation
-end

A yield term structure based on interpolated continuous compounded zero rates.

source
DiffFusion.zero_curveFunction
zero_curve(
     alias::String,
     times::AbstractVector,
     values::AbstractVector,
     interp_method = (x,y) -> linear_interpolation(x, y, extrapolation_bc = Line()),
-    )

Create a ZeroCurve object.

source
zero_curve(
+    )

Create a ZeroCurve object.

source
zero_curve(
     times::AbstractVector,
     values::AbstractVector,
     interp_method = (x,y) -> linear_interpolation(x, y, extrapolation_bc = Line()),
-    )

Create a ZeroCurve object without alias.

source
zero_curve(
+    )

Create a ZeroCurve object without alias.

source
zero_curve(
     alias::String,
     times::AbstractVector,
     values::AbstractVector,
     method_alias::String,
-    )

Create a ZeroCurve object using interpolation string.

source
zero_curve(
+    )

Create a ZeroCurve object using interpolation string.

source
zero_curve(
     times::AbstractVector,
     values::AbstractVector,
     method_alias::String,
-    )

Create a ZeroCurve object using interpolation string.

source
DiffFusion.LinearZeroCurveType
struct LinearZeroCurve <: YieldTermstructure
     alias::String
     times::AbstractVector
     values::AbstractVector
-end

A yield term structure based on continuous compounded zero rates with linear interpolation and flat extrapolation.

This curve aims at mitigating limitations of Zygote and ZeroCurve.

source
DiffFusion.linear_zero_curveFunction
linear_zero_curve(
+end

A yield term structure based on continuous compounded zero rates with linear interpolation and flat extrapolation.

This curve aims at mitigating limitations of Zygote and ZeroCurve.

source
DiffFusion.linear_zero_curveFunction
linear_zero_curve(
     alias::String,
     times::AbstractVector,
     values::AbstractVector,
-    )

Create a LinearZeroCurve.

source
linear_zero_curve(
+    )

Create a LinearZeroCurve.

source
linear_zero_curve(
     times::AbstractVector,
     values::AbstractVector,
-    )

Create a LinearZeroCurve with empty alias.

source

Functions

Discount Factor Calculation

Call operator for YieldTermstructure is defined as

(ts::YieldTermstructure)(args...) = discount(ts, args...)
DiffFusion.discountMethod
discount(ts::YieldTermstructure, t::ModelTime)

Return the discount factor with observation time t.

source

Zero Rate Calculation

DiffFusion.zero_rateMethod
zero_rate(ts::YieldTermstructure, t::ModelTime)

Return the continuous compounded zero rate as of today with observation time t.

source
DiffFusion.zero_rateMethod
zero_rate(ts::YieldTermstructure, t0::ModelTime, t1::ModelTime)

Return the continuous compounded zero rate over a period t0 to t1.

source

Forward Rate Calculation

DiffFusion.forward_rateFunction
forward_rate(ts::YieldTermstructure, t::ModelTime, dt=1.0e-6)

Return the instantaneous forward rate with observation time t.

source
+ )

Create a LinearZeroCurve with empty alias.

source

Functions

Discount Factor Calculation

Call operator for YieldTermstructure is defined as

(ts::YieldTermstructure)(args...) = discount(ts, args...)
DiffFusion.discountMethod
discount(ts::YieldTermstructure, t::ModelTime)

Return the discount factor with observation time t.

source

Zero Rate Calculation

DiffFusion.zero_rateMethod
zero_rate(ts::YieldTermstructure, t::ModelTime)

Return the continuous compounded zero rate as of today with observation time t.

source
DiffFusion.zero_rateMethod
zero_rate(ts::YieldTermstructure, t0::ModelTime, t1::ModelTime)

Return the continuous compounded zero rate over a period t0 to t1.

source

Forward Rate Calculation

DiffFusion.forward_rateFunction
forward_rate(ts::YieldTermstructure, t::ModelTime, dt=1.0e-6)

Return the instantaneous forward rate with observation time t.

source
diff --git a/dev/utils/utils/index.html b/dev/utils/utils/index.html index 1dd3d21..9ce76b7 100644 --- a/dev/utils/utils/index.html +++ b/dev/utils/utils/index.html @@ -1,18 +1,18 @@ -Utilities · [∂F]

Utilities

In this section we document commonly used utility structures methods.

Interpolation Methods

DiffFusion.interpolation_methodsConstant

const interpolation_methods = Dict{String, Function}(...)

Specify names for available interpolation methods.

Dictionary values are constructors with signature (x,y) -> interpolation

Available interpolation strings (i.e. keys) are

  • LINEAR,
  • CUBIC,
  • AKIMA,
  • FRITSCHCARLSON,
  • STEFFEN.

See package Interpolations for details.

source

Polynomial Regression Methods

DiffFusion.PolynomialRegressionType
struct PolynomialRegression
+Utilities · [∂F]

Utilities

In this section we document commonly used utility structures methods.

Interpolation Methods

DiffFusion.interpolation_methodsConstant

const interpolation_methods = Dict{String, Function}(...)

Specify names for available interpolation methods.

Dictionary values are constructors with signature (x,y) -> interpolation

Available interpolation strings (i.e. keys) are

  • LINEAR,
  • CUBIC,
  • AKIMA,
  • FRITSCHCARLSON,
  • STEFFEN.

See package Interpolations for details.

source

Polynomial Regression Methods

DiffFusion.PolynomialRegressionType
struct PolynomialRegression
     V::Matrix{Int}
     beta::AbstractVector
-end

A PolynomialRegression holds allows to predict values of a multi-variate function. The polynomial degrees are encoded in the multi-index matrix V. The polynomial coefficients are stored in the vector beta.

source
DiffFusion.polynomial_regressionFunction
polynomial_regression(
+end

A PolynomialRegression holds allows to predict values of a multi-variate function. The polynomial degrees are encoded in the multi-index matrix V. The polynomial coefficients are stored in the vector beta.

source
DiffFusion.polynomial_regressionFunction
polynomial_regression(
     C::AbstractMatrix,
     O::AbstractVector,
     max_degree::Int,
-    )

Calibrate a PolynomialRegression object from a matrix of controls C of size (n,p) and a vector of observations O of size (p,). The maximum polynomial degree is given by max_degree.

source
DiffFusion.predictMethod
predict(reg::PolynomialRegression, C::AbstractMatrix)

Use a calibrated polynomial regression to predict function values. Input is a matrix of controls C of size (n,p). Result is a vector of size (p,).

source
DiffFusion.multi_indexMethod
multi_index(n::Int, k::Int)

Calculate an Int matrix as Vector{Vector{Int}} of size (m,n) where each row represents an n-dimensional multi-index α with degree |α| < k.

source
DiffFusion.monomialsMethod
monomials(C::AbstractMatrix, V::AbstractMatrix)

Calculate monomials M of size (m,p) for a matrix of controls C of size (n,p) and a matrix V of multi-indices α. V is of size (m,n).

source

Pice-wise Polynomial Regression Methods

We implement a piece-wise polynomial multivariate regression.

The method represents a combination of a simple decision tree model with polynomial regression on the leaf nodes.

For reference and motivation, see the following blog post.

We consider a data set of controls C of size (n,p). Here, n represents the number of features and p represents the number of observations.

A partitioning is represented by a multi-index π = (π1, ..., πn) with πk > 0. Each πk represents the number of partitions for the k-th feature.

The idea is to sort C by the values of the first feature. Then, we split the data set into π_1 partitions. For each partition the procedure is repeated with the second feature and following features.

As a result, we get a split of the full data set into π1 * ... * πn subsets. For each subset of data we calculate a polynomial regression.

For model prediction have a given data point c. We need to identify the subset and regression which is to be used with c. This step is split into the following sub-steps:

  1. Determine a multi-index α that identifies the subset.

  2. Determine a scalar index r via a total ordering of multi- indices.

The elements of α in step 1 are determined successively by means of a branching matrix Q. A branching matrix is of size (πk - 1, mk). Each column in Q represents quantiles that evenly split the calibration data set for the k-th feature.

In order to determine an element αk from ck in step 1 we determine the relevant column from the k-th branching matrix and compare c_k against the quantile values.

DiffFusion.PiecewiseRegressionType
struct PiecewiseRegression
+    )

Calibrate a PolynomialRegression object from a matrix of controls C of size (n,p) and a vector of observations O of size (p,). The maximum polynomial degree is given by max_degree.

source
DiffFusion.predictMethod
predict(reg::PolynomialRegression, C::AbstractMatrix)

Use a calibrated polynomial regression to predict function values. Input is a matrix of controls C of size (n,p). Result is a vector of size (p,).

source
DiffFusion.multi_indexMethod
multi_index(n::Int, k::Int)

Calculate an Int matrix as Vector{Vector{Int}} of size (m,n) where each row represents an n-dimensional multi-index α with degree |α| < k.

source
DiffFusion.monomialsMethod
monomials(C::AbstractMatrix, V::AbstractMatrix)

Calculate monomials M of size (m,p) for a matrix of controls C of size (n,p) and a matrix V of multi-indices α. V is of size (m,n).

source

Pice-wise Polynomial Regression Methods

We implement a piece-wise polynomial multivariate regression.

The method represents a combination of a simple decision tree model with polynomial regression on the leaf nodes.

For reference and motivation, see the following blog post.

We consider a data set of controls C of size (n,p). Here, n represents the number of features and p represents the number of observations.

A partitioning is represented by a multi-index π = (π1, ..., πn) with πk > 0. Each πk represents the number of partitions for the k-th feature.

The idea is to sort C by the values of the first feature. Then, we split the data set into π_1 partitions. For each partition the procedure is repeated with the second feature and following features.

As a result, we get a split of the full data set into π1 * ... * πn subsets. For each subset of data we calculate a polynomial regression.

For model prediction have a given data point c. We need to identify the subset and regression which is to be used with c. This step is split into the following sub-steps:

  1. Determine a multi-index α that identifies the subset.

  2. Determine a scalar index r via a total ordering of multi- indices.

The elements of α in step 1 are determined successively by means of a branching matrix Q. A branching matrix is of size (πk - 1, mk). Each column in Q represents quantiles that evenly split the calibration data set for the k-th feature.

In order to determine an element αk from ck in step 1 we determine the relevant column from the k-th branching matrix and compare c_k against the quantile values.

DiffFusion.PiecewiseRegressionType
struct PiecewiseRegression
     π::Vector{Int}
     Qs::Vector{AbstractMatrix}
     regs::Vector{PolynomialRegression}
-end

A PiecewiseRegression holds the information on the partitioning of the training data set and a list of regressions. The information on the partitioning is encoded in the partitioning vector π, the list of branching matrices Qs and the list of polynomial regressions.

source
DiffFusion.piecewise_regressionFunction
piecewise_regression(
+end

A PiecewiseRegression holds the information on the partitioning of the training data set and a list of regressions. The information on the partitioning is encoded in the partitioning vector π, the list of branching matrices Qs and the list of polynomial regressions.

source
DiffFusion.piecewise_regressionFunction
piecewise_regression(
     C::AbstractMatrix,
     O::AbstractVector,
     max_degree::Int,
     π::Vector{Int},
-    )

Create a PiecewiseRegression from a matrix of features (or controls) C, a vector of labels (or observations) O, a maximum polynomial degree (max_degree), and a partitioning vector π.

C is of size (n,p), O is of length p, max_degree should be 2 (or 3) and π is of length n. The entries of π should be between 2 and 4; depending on the number of observations p and the number of dimensions n.

source
DiffFusion.predictMethod
predict(reg::PiecewiseRegression, C::AbstractMatrix)

Use a calibrates piecewise polynomial regression to predict function values. Input is a matrix of controls C of size (n,p). Result is a vector of size (p,).

source
DiffFusion.partition_indexMethod
partition_index(π::Vector{Int}, α::Vector{Int})

Calculate a scalar index r from a multi-index α and a partitioning π.

This method implements a total ordering of multi-indices.

source
DiffFusion.sub_indexMethod
sub_index(c_k::ModelValue, π::Vector{Int}, α::Vector{Int}, Q::AbstractMatrix)

Calculate the k-th index αk for a scalar feature ck, earlier indices α = (α1, ..., αk-1), partitioning π = (π1, ..., πk) up to index k and a branching matrix Q.

source
DiffFusion.multi_indexMethod
multi_index(c::AbstractVector, π::Vector{Int}, Qs::AbstractVector)

Calculate a multi-index α = (α1, ..., αn). For the elements we have 1 ≤ αk ≤ πk. An element αk represents the index of the subset to which the k-th feature ck belongs (all conditional on earlier features).

source
DiffFusion.branching_matrixMethod
branching_matrix(π::Vector{Int}, Alpha::Matrix{Int}, C_k::AbstractVector)

Calculate a branching matrix Qk of quantiles for a vector of features (ck,j)j=1,..,p. Calculation also depends on earlier multi-indices α = (α1, ..., αk-1) for each ck,j and partitions π = (π1, ..., πk-1).

source
DiffFusion.partitioningMethod
partitioning(C::AbstractMatrix, π::Vector{Int})

Calculate branching matrices and indices for a matrix of features C and a partitioning vector π. The matrix C is of size (n,p) where n is the number of scalar features (per observation) and p is the number observations/samples.

The method returns a vector (or list) of branching matrices Qs, a matrix of multi-indices Alpha, and the corresponding partition index R. Qs is of length n, Alpha is of size (n,p) and R is of length p.

source

Black Formula Methods

DiffFusion.black_priceFunction
black_price(strike, forward, nu, call_put)

Calculate Vanilla option price V in Black model.

Argument strike ($K$) represents the option strike, forward ($F$) is the forward price of the underlying $S$, i.e. $F = E[S(T)]$ in the respective pricing measure.

Argument nu represents the standard deviation of the forward price. For annualised lognormal volatility σ, we have $ν = σ √T$. Finally, call_put is the call (+1) or put (-1) option flag.

We allow broadcasting for arguments.

source
black_price(strike, forward, σ, T, call_put)

Calculate Vanilla option price $V$ in Black model with volatility parameter.

source
DiffFusion.black_deltaFunction
black_delta(strike, forward, nu, call_put)

Calculate Vanilla option Delta in Black model.

source
black_delta(strike, forward, σ, T, call_put)

Calculate Vanilla option Delta in Black model with volatility parameter.

source
DiffFusion.black_gammaFunction
black_gamma(strike, forward, nu)

Calculate Vanilla option Gamma in Black model.

source
black_gamma(strike, forward, σ, T)

Calculate Vanilla option Gamma in Black model with volatility parameter.

source
DiffFusion.black_vegaFunction
black_vega(strike, forward, nu)

Calculate Vanilla option Vega in Black model.

Here, Vega is calculated as $dV / d ν$.

source
black_vega(strike, forward, σ, T)

Calculate Vanilla option Vega in Black model with volatility parameter..

Here, Vega is calculated as $dV / dσ$.

source
DiffFusion.black_implied_stdevFunction
black_implied_stdev(price, strike, forward, call_put, min_max = (0.01, 3.00))

Calculate the implied log-normal standard deviation ν from a Black model price.

source
DiffFusion.black_implied_volatilityFunction
black_implied_volatility(price, strike, forward, T, call_put, min_max = (0.01, 1.00))

Calculate the implied log-normal volatility σ from a Black model price.

source

Bachelier Formula Methods

DiffFusion.bachelier_priceFunction
bachelier_price(strike, forward, nu, call_put)

Calculate Vanilla option price $V$ in Bachelier model.

Argument strike ($K$) represents the option strike, forward ($F$) is the forward price of the underlying $S$, i.e. $F = E[S(T)]$ in the respective pricing measure.

Argument nu represents the standard deviation of the forward price. For annualised normal volatility σ, we have ν = σ √T. Finally, call_put is the call (+1) or put (-1) option flag.

source
bachelier_price(strike, forward, σ, T, call_put)

Calculate Vanilla option price $V$ in Bachelier model with volatility parameter.

source
DiffFusion.bachelier_vegaFunction
bachelier_vega(strike, forward, nu)

Calculate Vanilla option Vega in Bachelier model.

Here, Vega is calculated as $dV / d ν$.

source
bachelier_vega(strike, forward, σ, T)

Calculate Vanilla option Vega in Bachelier model with volatility parameter.

Here, Vega is calculated as $dV / dσ$.

source
DiffFusion.bachelier_implied_stdevFunction
bachelier_implied_stdev(price, strike, forward, call_put, min_max = (1.0e-4, 6.0e-2))

Calculate the implied normal standard deviation ν from a Bachelier model price.

source
+ )

Create a PiecewiseRegression from a matrix of features (or controls) C, a vector of labels (or observations) O, a maximum polynomial degree (max_degree), and a partitioning vector π.

C is of size (n,p), O is of length p, max_degree should be 2 (or 3) and π is of length n. The entries of π should be between 2 and 4; depending on the number of observations p and the number of dimensions n.

source
DiffFusion.predictMethod
predict(reg::PiecewiseRegression, C::AbstractMatrix)

Use a calibrates piecewise polynomial regression to predict function values. Input is a matrix of controls C of size (n,p). Result is a vector of size (p,).

source
DiffFusion.partition_indexMethod
partition_index(π::Vector{Int}, α::Vector{Int})

Calculate a scalar index r from a multi-index α and a partitioning π.

This method implements a total ordering of multi-indices.

source
DiffFusion.sub_indexMethod
sub_index(c_k::ModelValue, π::Vector{Int}, α::Vector{Int}, Q::AbstractMatrix)

Calculate the k-th index αk for a scalar feature ck, earlier indices α = (α1, ..., αk-1), partitioning π = (π1, ..., πk) up to index k and a branching matrix Q.

source
DiffFusion.multi_indexMethod
multi_index(c::AbstractVector, π::Vector{Int}, Qs::AbstractVector)

Calculate a multi-index α = (α1, ..., αn). For the elements we have 1 ≤ αk ≤ πk. An element αk represents the index of the subset to which the k-th feature ck belongs (all conditional on earlier features).

source
DiffFusion.branching_matrixMethod
branching_matrix(π::Vector{Int}, Alpha::Matrix{Int}, C_k::AbstractVector)

Calculate a branching matrix Qk of quantiles for a vector of features (ck,j)j=1,..,p. Calculation also depends on earlier multi-indices α = (α1, ..., αk-1) for each ck,j and partitions π = (π1, ..., πk-1).

source
DiffFusion.partitioningMethod
partitioning(C::AbstractMatrix, π::Vector{Int})

Calculate branching matrices and indices for a matrix of features C and a partitioning vector π. The matrix C is of size (n,p) where n is the number of scalar features (per observation) and p is the number observations/samples.

The method returns a vector (or list) of branching matrices Qs, a matrix of multi-indices Alpha, and the corresponding partition index R. Qs is of length n, Alpha is of size (n,p) and R is of length p.

source

Black Formula Methods

DiffFusion.black_priceFunction
black_price(strike, forward, nu, call_put)

Calculate Vanilla option price V in Black model.

Argument strike ($K$) represents the option strike, forward ($F$) is the forward price of the underlying $S$, i.e. $F = E[S(T)]$ in the respective pricing measure.

Argument nu represents the standard deviation of the forward price. For annualised lognormal volatility σ, we have $ν = σ √T$. Finally, call_put is the call (+1) or put (-1) option flag.

We allow broadcasting for arguments.

source
black_price(strike, forward, σ, T, call_put)

Calculate Vanilla option price $V$ in Black model with volatility parameter.

source
DiffFusion.black_deltaFunction
black_delta(strike, forward, nu, call_put)

Calculate Vanilla option Delta in Black model.

source
black_delta(strike, forward, σ, T, call_put)

Calculate Vanilla option Delta in Black model with volatility parameter.

source
DiffFusion.black_gammaFunction
black_gamma(strike, forward, nu)

Calculate Vanilla option Gamma in Black model.

source
black_gamma(strike, forward, σ, T)

Calculate Vanilla option Gamma in Black model with volatility parameter.

source
DiffFusion.black_vegaFunction
black_vega(strike, forward, nu)

Calculate Vanilla option Vega in Black model.

Here, Vega is calculated as $dV / d ν$.

source
black_vega(strike, forward, σ, T)

Calculate Vanilla option Vega in Black model with volatility parameter..

Here, Vega is calculated as $dV / dσ$.

source
DiffFusion.black_implied_stdevFunction
black_implied_stdev(price, strike, forward, call_put, min_max = (0.01, 3.00))

Calculate the implied log-normal standard deviation ν from a Black model price.

source
DiffFusion.black_implied_volatilityFunction
black_implied_volatility(price, strike, forward, T, call_put, min_max = (0.01, 1.00))

Calculate the implied log-normal volatility σ from a Black model price.

source

Bachelier Formula Methods

DiffFusion.bachelier_priceFunction
bachelier_price(strike, forward, nu, call_put)

Calculate Vanilla option price $V$ in Bachelier model.

Argument strike ($K$) represents the option strike, forward ($F$) is the forward price of the underlying $S$, i.e. $F = E[S(T)]$ in the respective pricing measure.

Argument nu represents the standard deviation of the forward price. For annualised normal volatility σ, we have ν = σ √T. Finally, call_put is the call (+1) or put (-1) option flag.

source
bachelier_price(strike, forward, σ, T, call_put)

Calculate Vanilla option price $V$ in Bachelier model with volatility parameter.

source
DiffFusion.bachelier_vegaFunction
bachelier_vega(strike, forward, nu)

Calculate Vanilla option Vega in Bachelier model.

Here, Vega is calculated as $dV / d ν$.

source
bachelier_vega(strike, forward, σ, T)

Calculate Vanilla option Vega in Bachelier model with volatility parameter.

Here, Vega is calculated as $dV / dσ$.

source
DiffFusion.bachelier_implied_stdevFunction
bachelier_implied_stdev(price, strike, forward, call_put, min_max = (1.0e-4, 6.0e-2))

Calculate the implied normal standard deviation ν from a Bachelier model price.

source