Class MCHullWhiteCapFloorEngine
- Namespace
- NanoQL.PricingEngines
- Assembly
- NanoQL.dll
The Monte Carlo Hull-White cap/floor engine: the short rate simulated in the forward measure of the last payment, each path priced by NanoQL.PricingEngines.HullWhiteCapFloorPricer.
public static class MCHullWhiteCapFloorEngine
- Inheritance
-
MCHullWhiteCapFloorEngine
- Inherited Members
Remarks
A static class: Calculate runs QuantLib's four steps (playbook §2.1) on the model, an argument where
QuantLib's engine holds it, through McSimulation<TPath, TStats>: a
HullWhiteForwardProcess on the model's curve and parameters at the last payment's time, on a grid of
the fixings after the reference date and the last payment; the NPV is the samples' mean, and the error estimate is
theirs where the random-number traits allow one. The type parameters, the traits and the accumulator, are QuantLib's
template parameters, whose defaults are PseudoRandom and GeneralStatistics.
The seed is explicit: QuantLib's 0, a seed from the clock, is refused.
Methods
Calculate<TRng, TStats>(CapFloor, EvaluationContext, HullWhite, bool, bool, int?, double?, int?, long)
Prices a cap, floor or collar by Monte Carlo on a Hull-White model.
public static InstrumentResults Calculate<TRng, TStats>(CapFloor capFloor, EvaluationContext context, HullWhite model, bool brownianBridge, bool antitheticVariate, int? requiredSamples, double? requiredTolerance, int? maxSamples, long seed) where TRng : IRngTraits where TStats : IStatistics, new()
Parameters
capFloorCapFloorThe cap, floor or collar.
contextEvaluationContextThe evaluation context.
modelHullWhiteThe Hull-White model.
brownianBridgeboolWhether the paths are drawn through a Brownian bridge.
antitheticVariateboolWhether antithetic variates are used.
requiredSamplesint?The number of samples, or null, QuantLib's null.
requiredTolerancedouble?The absolute tolerance, or null; it takes precedence over the number of samples.
maxSamplesint?The most samples for a tolerance, or null for no limit.
seedlongThe seed, in [1, 4294967295].
Returns
- InstrumentResults
The instrument's results, the NPV and, where the traits allow one, the error estimate: the expired results when it has expired.
Type Parameters
TRngThe random-number traits.
TStatsThe statistics accumulator.
Exceptions
- ArgumentNullException
The cap, the context or the model is null.
- ArgumentOutOfRangeException
requiredSamplesormaxSamplesis negative, orseedis outside its range.- NanoQLException
The cap's terms are inconsistent, a cash flow isn't a floating-rate coupon, a forward can't be computed, neither a tolerance nor a number of samples is given, or the samples can't reach the tolerance.