Table of Contents

Class AverageBasketPayoff

Namespace
NanoQL.Instruments
Assembly
NanoQL.dll

A basket payoff on the weighted sum of the assets' prices.

public sealed class AverageBasketPayoff : BasketPayoff
Inheritance
AverageBasketPayoff
Inherited Members

Remarks

A price count other than the weights' is refused, with the text of QuantLib's Choi, Deng-Li-Zhou and single-factor engines, where QuantLib's inner_product reads past a shorter array or sums a partial basket, so that its Monte Carlo and finite-difference engines price a run-dependent value or a partial basket there (Divergences/AverageBasketPayoffWeightCountTests.cs).

Constructors

AverageBasketPayoff(Payoff, int)

Initializes a new instance of the AverageBasketPayoff class with equal weights, each 1/n.

public AverageBasketPayoff(Payoff basePayoff, int n)

Parameters

basePayoff Payoff

The one-dimensional payoff applied to the average.

n int

The number of assets.

Exceptions

ArgumentNullException

basePayoff is null.

ArgumentOutOfRangeException

n is negative.

AverageBasketPayoff(Payoff, ReadOnlySpan<double>)

Initializes a new instance of the AverageBasketPayoff class with given weights.

public AverageBasketPayoff(Payoff basePayoff, ReadOnlySpan<double> weights)

Parameters

basePayoff Payoff

The one-dimensional payoff applied to the weighted sum.

weights ReadOnlySpan<double>

The weights, one per asset, copied.

Exceptions

ArgumentNullException

basePayoff is null.

Properties

Weights

Gets the weights.

public ImmutableArray<double> Weights { get; }

Property Value

ImmutableArray<double>

Methods

Accumulate(ReadOnlySpan<double>)

The weighted sum of the prices, summed in order from 0, as std::inner_product.

public override double Accumulate(ReadOnlySpan<double> a)

Parameters

a ReadOnlySpan<double>

The assets' prices, one per weight.

Returns

double

The weighted sum.

Exceptions

ArgumentException

a's length isn't the number of weights.