Class MakeMCAmericanPathEngine<TRng, TStats>
- Namespace
- NanoQL.Experimental
- Assembly
- NanoQL.dll
A builder of the Monte Carlo American path engine, with QuantLib's defaults but the seed.
[Experimental("NQL0001")]
public sealed record MakeMCAmericanPathEngine<TRng, TStats> : IEquatable<MakeMCAmericanPathEngine<TRng, TStats>> where TRng : IRngTraits where TStats : IStatistics, new()
Type Parameters
TRngThe random-number traits.
TStatsThe statistics accumulator.
- Inheritance
-
MakeMCAmericanPathEngine<TRng, TStats>
- Implements
-
IEquatable<MakeMCAmericanPathEngine<TRng, TStats>>
- Inherited Members
Remarks
An immutable builder: each method returns a modified copy. ToEngine() returns the engine as a function of the option and the context, its settings bound, in place of QuantLib's conversion to a pricing engine, with QuantLib's checks on the steps. A builder has no value equality.
The seed is a constructor argument: QuantLib's default, 0, a seed from the clock, is refused.
Constructors
MakeMCAmericanPathEngine(StochasticProcessArray, long)
Initializes a new instance of the MakeMCAmericanPathEngine<TRng, TStats> record.
public MakeMCAmericanPathEngine(StochasticProcessArray process, long seed)
Parameters
processStochasticProcessArrayThe assets' correlated processes.
seedlongThe seed, in [1, 4294967295].
Exceptions
- ArgumentNullException
processis null.- ArgumentOutOfRangeException
seedis outside its range.
Methods
Equals(MakeMCAmericanPathEngine<TRng, TStats>?)
public bool Equals(MakeMCAmericanPathEngine<TRng, TStats>? other)
Parameters
otherMakeMCAmericanPathEngine<TRng, TStats>
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToEngine()
The engine, its settings bound: QuantLib's conversion to a pricing engine.
public Func<PathMultiAssetOption, EvaluationContext, InstrumentResults> ToEngine()
Returns
- Func<PathMultiAssetOption, EvaluationContext, InstrumentResults>
The engine as a function of the option and the context.
Exceptions
- NanoQLException
The number of steps is neither or both given.
ToString()
public override string ToString()
Returns
WithAbsoluteTolerance(double)
Sets the absolute tolerance.
public MakeMCAmericanPathEngine<TRng, TStats> WithAbsoluteTolerance(double tolerance)
Parameters
tolerancedoubleThe tolerance.
Returns
- MakeMCAmericanPathEngine<TRng, TStats>
A modified copy.
Exceptions
- NanoQLException
A number of samples is already set, or the traits allow no error estimate.
WithAntitheticVariate(bool)
Sets whether to use antithetic paths.
public MakeMCAmericanPathEngine<TRng, TStats> WithAntitheticVariate(bool b = true)
Parameters
bboolWhether to.
Returns
- MakeMCAmericanPathEngine<TRng, TStats>
A modified copy.
WithBrownianBridge(bool)
Sets whether to build the paths by a Brownian bridge.
public MakeMCAmericanPathEngine<TRng, TStats> WithBrownianBridge(bool b = true)
Parameters
bboolWhether to.
Returns
- MakeMCAmericanPathEngine<TRng, TStats>
A modified copy.
WithCalibrationSamples(int)
Sets the number of calibration samples.
public MakeMCAmericanPathEngine<TRng, TStats> WithCalibrationSamples(int samples)
Parameters
samplesintThe number of calibration samples, positive.
Returns
- MakeMCAmericanPathEngine<TRng, TStats>
A modified copy.
Exceptions
- ArgumentOutOfRangeException
samplesisn't positive.
WithControlVariate(bool)
Sets whether to use a control variate, which the engine doesn't provide (QuantLib's flag).
public MakeMCAmericanPathEngine<TRng, TStats> WithControlVariate(bool b = true)
Parameters
bboolWhether to.
Returns
- MakeMCAmericanPathEngine<TRng, TStats>
A modified copy.
WithMaxSamples(int)
Sets the largest number of samples.
public MakeMCAmericanPathEngine<TRng, TStats> WithMaxSamples(int samples)
Parameters
samplesintThe largest number of samples.
Returns
- MakeMCAmericanPathEngine<TRng, TStats>
A modified copy.
Exceptions
- ArgumentOutOfRangeException
samplesis negative.
WithSamples(int)
Sets the number of samples.
public MakeMCAmericanPathEngine<TRng, TStats> WithSamples(int samples)
Parameters
samplesintThe number of samples.
Returns
- MakeMCAmericanPathEngine<TRng, TStats>
A modified copy.
Exceptions
- NanoQLException
A tolerance is already set.
- ArgumentOutOfRangeException
samplesis negative.
WithSeed(long)
Sets the seed.
public MakeMCAmericanPathEngine<TRng, TStats> WithSeed(long seed)
Parameters
seedlongThe seed, in [1, 4294967295].
Returns
- MakeMCAmericanPathEngine<TRng, TStats>
A modified copy.
Exceptions
- ArgumentOutOfRangeException
seedis outside its range.
WithSteps(int)
Sets the number of time steps.
public MakeMCAmericanPathEngine<TRng, TStats> WithSteps(int steps)
Parameters
stepsintThe number of time steps.
Returns
- MakeMCAmericanPathEngine<TRng, TStats>
A modified copy.
WithStepsPerYear(int)
Sets the number of time steps per year.
public MakeMCAmericanPathEngine<TRng, TStats> WithStepsPerYear(int steps)
Parameters
stepsintThe number of time steps per year.
Returns
- MakeMCAmericanPathEngine<TRng, TStats>
A modified copy.
Operators
operator ==(MakeMCAmericanPathEngine<TRng, TStats>?, MakeMCAmericanPathEngine<TRng, TStats>?)
public static bool operator ==(MakeMCAmericanPathEngine<TRng, TStats>? left, MakeMCAmericanPathEngine<TRng, TStats>? right)
Parameters
leftMakeMCAmericanPathEngine<TRng, TStats>rightMakeMCAmericanPathEngine<TRng, TStats>
Returns
operator !=(MakeMCAmericanPathEngine<TRng, TStats>?, MakeMCAmericanPathEngine<TRng, TStats>?)
public static bool operator !=(MakeMCAmericanPathEngine<TRng, TStats>? left, MakeMCAmericanPathEngine<TRng, TStats>? right)
Parameters
leftMakeMCAmericanPathEngine<TRng, TStats>rightMakeMCAmericanPathEngine<TRng, TStats>