FinanceModels.ShortRate API Reference
FinanceModels.ShortRate.CoxIngersollRossFinanceModels.ShortRate.HullWhiteFinanceModels.ShortRate.Vasicek
Exported API
Simulation and Monte Carlo
FinanceModels.simulate — Function
simulate(model::AbstractStochasticModel;
n_scenarios=1000, timestep=1/12, horizon=30.0,
rng=Random.default_rng())Generate n_scenarios interest-rate paths via Euler-Maruyama discretisation. Each path is returned as a RatePath (an AbstractYieldModel) so it plugs directly into present_value, discount, etc.
FinanceModels.pv_mc — Function
pv_mc(model, contract;
n_scenarios=1000, timestep=1/12, horizon=nothing,
rng=Random.default_rng())Estimate the expected present value of contract under the stochastic model by averaging present_value across simulated scenarios.
pv_mc is designed for fixed-cashflow instruments where each RatePath scenario provides the discount factors. For floating-rate instruments whose cashflows depend on the rate path, project cashflows per scenario using Projection instead.
The horizon should cover the contract's maturity. The default (maturity + 1) ensures this.
FinanceModels.short_rate — Function
short_rate(path::RatePath, t)The instantaneous short rate r(t) for a simulated scenario.
RatePath stores the cumulative integral ∫₀ᵗ r(s) ds as a LinearInterpolation. The short rate is the derivative of this cumulative integral.
Because the cumulative integral is built from Euler-Maruyama trapezoidal steps, the returned rate is piecewise-constant within each timestep — an approximation to the continuous short-rate process, not the exact value.
Unexported API
FinanceModels.ShortRate.CoxIngersollRoss — Type
CoxIngersollRoss(a, b, σ, initial)Cox-Ingersoll-Ross (1985) mean-reverting short-rate model:
dr = a(b - r) dt + σ √r dWArguments
a: speed of mean reversionb: long-term mean rate (continuous compounding). Can be passed as aRealorContinuous(b).σ: volatilityinitial: initial short rater₀(aRateobject orReal)
FinanceModels.ShortRate.HullWhite — Type
HullWhite(a, σ, curve)Hull-White (1990) one-factor model:
dr = (θ(t) - a r) dt + σ dWwhere θ(t) is calibrated to fit the initial term structure curve.
Arguments
a: speed of mean reversionσ: volatilitycurve: an existing yield model providing the initial term structure
FinanceModels.ShortRate.Vasicek — Type
Vasicek(a, b, σ, initial)Vasicek (1977) mean-reverting short-rate model:
dr = a(b - r) dt + σ dWArguments
a: speed of mean reversionb: long-term mean rate (continuous compounding). Can be passed as aRealorContinuous(b).σ: volatilityinitial: initial short rater₀(aRateobject orReal)
Please open an issue if you encounter any issues or confusion with the package.