Table of Contents

Class MakeMCBarrierEngine<TRng, TStats>

Namespace
NanoQL.PricingEngines
Assembly
NanoQL.dll

A builder of the Monte Carlo barrier engine, with QuantLib's defaults but the seed.

public sealed record MakeMCBarrierEngine<TRng, TStats> : IEquatable<MakeMCBarrierEngine<TRng, TStats>> where TRng : IRngTraits where TStats : IStatistics, new()

Type Parameters

TRng

The random-number traits.

TStats

The statistics accumulator.

Inheritance
MakeMCBarrierEngine<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 (as in MakeMCHullWhiteCapFloorEngine<TRng, TStats>): QuantLib's default, 0, a seed from the clock, is refused.

Constructors

MakeMCBarrierEngine(GeneralizedBlackScholesProcess, long)

Initializes a new instance of the MakeMCBarrierEngine<TRng, TStats> record.

public MakeMCBarrierEngine(GeneralizedBlackScholesProcess process, long seed)

Parameters

process GeneralizedBlackScholesProcess

The Black-Scholes process.

seed long

The seed, in [1, 4294967295].

Exceptions

ArgumentNullException

process is null.

ArgumentOutOfRangeException

seed is outside its range.

Methods

Equals(MakeMCBarrierEngine<TRng, TStats>?)

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

Parameters

other MakeMCBarrierEngine<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 with the builder's settings: QuantLib's conversion to a pricing engine.

public Func<BarrierOption, EvaluationContext, OneAssetOptionResults> ToEngine()

Returns

Func<BarrierOption, EvaluationContext, OneAssetOptionResults>

The engine, a function of the option and the context.

Exceptions

NanoQLException

The number of steps is given neither or both ways.

ToString()

public override string ToString()

Returns

string

WithAbsoluteTolerance(double)

Sets the absolute tolerance.

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

Parameters

tolerance double

The tolerance.

Returns

MakeMCBarrierEngine<TRng, TStats>

The modified builder.

Exceptions

NanoQLException

A number of samples is already set, or the random-number traits allow no error estimate.

WithAntitheticVariate(bool)

Sets whether antithetic variates are used.

public MakeMCBarrierEngine<TRng, TStats> WithAntitheticVariate(bool b = true)

Parameters

b bool

Whether to use antithetic variates.

Returns

MakeMCBarrierEngine<TRng, TStats>

The modified builder.

WithBias(bool)

Sets whether the barrier is checked at the path's points only, the biased pricer.

public MakeMCBarrierEngine<TRng, TStats> WithBias(bool b = true)

Parameters

b bool

Whether to use the biased pricer.

Returns

MakeMCBarrierEngine<TRng, TStats>

The modified builder.

WithBrownianBridge(bool)

Sets whether the draws are ordered by a Brownian bridge.

public MakeMCBarrierEngine<TRng, TStats> WithBrownianBridge(bool b = true)

Parameters

b bool

Whether to use a Brownian bridge.

Returns

MakeMCBarrierEngine<TRng, TStats>

The modified builder.

WithMaxSamples(int)

Sets the most samples for a tolerance.

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

Parameters

samples int

The most samples.

Returns

MakeMCBarrierEngine<TRng, TStats>

The modified builder.

Exceptions

ArgumentOutOfRangeException

samples is negative.

WithSamples(int)

Sets the number of samples.

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

Parameters

samples int

The number of samples.

Returns

MakeMCBarrierEngine<TRng, TStats>

The modified builder.

Exceptions

ArgumentOutOfRangeException

samples is negative.

NanoQLException

A tolerance is already set.

WithSeed(long)

Sets the seed.

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

Parameters

seed long

The seed, in [1, 4294967295].

Returns

MakeMCBarrierEngine<TRng, TStats>

The modified builder.

Exceptions

ArgumentOutOfRangeException

seed is outside its range.

WithSteps(int)

Sets the number of time steps.

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

Parameters

steps int

The number of steps.

Returns

MakeMCBarrierEngine<TRng, TStats>

The modified builder.

WithStepsPerYear(int)

Sets the number of time steps per year.

public MakeMCBarrierEngine<TRng, TStats> WithStepsPerYear(int steps)

Parameters

steps int

The number of steps per year.

Returns

MakeMCBarrierEngine<TRng, TStats>

The modified builder.

Operators

operator ==(MakeMCBarrierEngine<TRng, TStats>?, MakeMCBarrierEngine<TRng, TStats>?)

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

Parameters

left MakeMCBarrierEngine<TRng, TStats>
right MakeMCBarrierEngine<TRng, TStats>

Returns

bool

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

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

Parameters

left MakeMCBarrierEngine<TRng, TStats>
right MakeMCBarrierEngine<TRng, TStats>

Returns

bool