Table of Contents

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

TRng

The random-number traits.

TStats

The statistics accumulator.

Inheritance
MakeMCAmericanPathEngine<TRng, TStats>
Implements
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

process StochasticProcessArray

The assets' correlated processes.

seed long

The seed, in [1, 4294967295].

Exceptions

ArgumentNullException

process is null.

ArgumentOutOfRangeException

seed is outside its range.

Methods

Equals(MakeMCAmericanPathEngine<TRng, TStats>?)

public bool Equals(MakeMCAmericanPathEngine<TRng, TStats>? other)

Parameters

other MakeMCAmericanPathEngine<TRng, TStats>

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

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

string

WithAbsoluteTolerance(double)

Sets the absolute tolerance.

public MakeMCAmericanPathEngine<TRng, TStats> WithAbsoluteTolerance(double tolerance)

Parameters

tolerance double

The 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

b bool

Whether 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

b bool

Whether to.

Returns

MakeMCAmericanPathEngine<TRng, TStats>

A modified copy.

WithCalibrationSamples(int)

Sets the number of calibration samples.

public MakeMCAmericanPathEngine<TRng, TStats> WithCalibrationSamples(int samples)

Parameters

samples int

The number of calibration samples, positive.

Returns

MakeMCAmericanPathEngine<TRng, TStats>

A modified copy.

Exceptions

ArgumentOutOfRangeException

samples isn'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

b bool

Whether to.

Returns

MakeMCAmericanPathEngine<TRng, TStats>

A modified copy.

WithMaxSamples(int)

Sets the largest number of samples.

public MakeMCAmericanPathEngine<TRng, TStats> WithMaxSamples(int samples)

Parameters

samples int

The largest number of samples.

Returns

MakeMCAmericanPathEngine<TRng, TStats>

A modified copy.

Exceptions

ArgumentOutOfRangeException

samples is negative.

WithSamples(int)

Sets the number of samples.

public MakeMCAmericanPathEngine<TRng, TStats> WithSamples(int samples)

Parameters

samples int

The number of samples.

Returns

MakeMCAmericanPathEngine<TRng, TStats>

A modified copy.

Exceptions

NanoQLException

A tolerance is already set.

ArgumentOutOfRangeException

samples is negative.

WithSeed(long)

Sets the seed.

public MakeMCAmericanPathEngine<TRng, TStats> WithSeed(long seed)

Parameters

seed long

The seed, in [1, 4294967295].

Returns

MakeMCAmericanPathEngine<TRng, TStats>

A modified copy.

Exceptions

ArgumentOutOfRangeException

seed is outside its range.

WithSteps(int)

Sets the number of time steps.

public MakeMCAmericanPathEngine<TRng, TStats> WithSteps(int steps)

Parameters

steps int

The 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

steps int

The 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

left MakeMCAmericanPathEngine<TRng, TStats>
right MakeMCAmericanPathEngine<TRng, TStats>

Returns

bool

operator !=(MakeMCAmericanPathEngine<TRng, TStats>?, MakeMCAmericanPathEngine<TRng, TStats>?)

public static bool operator !=(MakeMCAmericanPathEngine<TRng, TStats>? left, MakeMCAmericanPathEngine<TRng, TStats>? right)

Parameters

left MakeMCAmericanPathEngine<TRng, TStats>
right MakeMCAmericanPathEngine<TRng, TStats>

Returns

bool