Examples (Module) Functions

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.

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.

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.

Product Setup

DiffFusion.Examples.fixed_rate_legFunction
fixed_rate_leg(
    alias::String,
    effective_time::ModelTime,
    maturity_time::ModelTime,
    coupons_per_year::Int,
    fixed_rate::ModelValue,
    notional::ModelValue,
    discount_curve_key::String,
    fx_key::Union{String, Nothing} = nothing,
    payer_receiver = 1.0,
    )

Create a fixed rate cash flow leg.

DiffFusion.Examples.simple_rate_legFunction
simple_rate_leg(
    alias::String,
    effective_time::ModelTime,
    maturity_time::ModelTime,
    coupons_per_year::Int,
    forward_curve_key::String,
    fixing_key::Union{String, Nothing},
    spread_rate::Union{ModelValue, Nothing},
    notional::ModelValue,
    discount_curve_key::String,
    fx_key::Union{String, Nothing} = nothing,
    payer_receiver = 1.0,
    )

Create a Libor cash flow leg.

DiffFusion.Examples.compounded_rate_legFunction
compounded_rate_leg(
    alias::String,
    effective_time::ModelTime,
    maturity_time::ModelTime,
    coupons_per_year::Int,
    forward_curve_key::String,
    fixing_key::Union{String, Nothing},
    spread_rate::Union{ModelValue, Nothing},
    notional::ModelValue,
    discount_curve_key::String,
    fx_key::Union{String, Nothing} = nothing,
    payer_receiver = 1.0,
    )

Create a RFR compounded leg.

DiffFusion.Examples.random_swaptionFunction
random_swaption(
    example::OrderedDict{String,Any},
    type_key::Union{String,Nothing} = nothing,
    )

Sample a random European swaption.

DiffFusion.Examples.random_bermudanFunction
random_bermudan(
    example::OrderedDict{String,Any},
    type_key::Union{String,Nothing} = nothing,
    )

Sample a random Bermudan swaption.

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.