Basic Products
Financial instruments are decomposed into legs.
A product is a collection of one or more legs.
Basic Cash Flow Legs
DiffFusion.CashFlowLeg
— Typeabstract 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.
DiffFusion.DeterministicCashFlowLeg
— Typestruct 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.
DiffFusion.cashflow_leg
— Functioncashflow_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.
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.
Cross Currency Swap Legs
DiffFusion.MtMCashFlowLeg
— Typestruct MtMCashFlowLeg <: CashFlowLeg
alias::String
cashflows::AbstractVector
intitial_notional::ModelValue
curve_key_dom::String
curve_key_for::String
fx_key_dom::Union{String, Nothing}
fx_key_for::Union{String, Nothing}
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.
DiffFusion.mtm_cashflow_leg
— Functionmtm_cashflow_leg(
alias::String,
cashflows::AbstractVector,
intitial_notional::ModelValue,
curve_key_dom::String,
curve_key_for::String,
fx_key_dom::Union{String, Nothing},
fx_key_for::Union{String, Nothing},
fx_reset_times::AbstractVector,
fx_pay_times::AbstractVector,
payer_receiver::ModelValue,
)
Create a MTM cash flow leg.
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.
Cash and Assets
DiffFusion.CashBalanceLeg
— Typestruct 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.
DiffFusion.cash_balance_leg
— Functioncash_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.
DiffFusion.AssetLeg
— TypeAn 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.
Cash Flow Leg Functions
Future Cash Flows (Undiscounted)
DiffFusion.future_cashflows
— Methodfuture_cashflows(leg::CashFlowLeg, obs_time::ModelTime)
Calculate the list of future undiscounted payoffs in numeraire currency.
DiffFusion.future_cashflows
— Methodfuture_cashflows(leg::DeterministicCashFlowLeg, obs_time::ModelTime)
Calculate the list of future undiscounted payoffs in numeraire currency.
DiffFusion.future_cashflows
— Methodfuture_cashflows(leg::MtMCashFlowLeg, obs_time::ModelTime)
Calculate the list of future undiscounted payoffs in numeraire currency.
DiffFusion.future_cashflows
— Methodfuture_cashflows(leg::AssetLeg, obs_time::ModelTime)
Calculate the list of future undiscounted payoffs in numeraire currency.
DiffFusion.future_cashflows
— Methodfuture_cashflows(leg::CashBalanceLeg, obs_time::ModelTime)
Calculate the list of future undiscounted payoffs in numeraire currency.
Discounted Cash Flows
DiffFusion.discounted_cashflows
— Methoddiscounted_cashflows(leg::CashFlowLeg, obs_time::ModelTime)
Calculate the list of future discounted payoffs in numeraire currency.
DiffFusion.discounted_cashflows
— Methoddiscounted_cashflows(leg::DeterministicCashFlowLeg, obs_time::ModelTime)
Calculate the list of future discounted payoffs in numeraire currency.
DiffFusion.discounted_cashflows
— Methoddiscounted_cashflows(leg::MtMCashFlowLeg, obs_time::ModelTime)
Calculate the list of future discounted payoffs in numeraire currency.
DiffFusion.discounted_cashflows
— Methoddiscounted_cashflows(leg::AssetLeg, obs_time::ModelTime)
Calculate the list of future discounted payoffs in numeraire currency.
DiffFusion.discounted_cashflows
— Methoddiscounted_cashflows(leg::CashBalanceLeg, obs_time::ModelTime)
Calculate the list of future discounted payoffs in numeraire currency.