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
Exceptions
- ArgumentNullException
basePayoffis null.- ArgumentOutOfRangeException
nis negative.
AverageBasketPayoff(Payoff, ReadOnlySpan<double>)
Initializes a new instance of the AverageBasketPayoff class with given weights.
public AverageBasketPayoff(Payoff basePayoff, ReadOnlySpan<double> weights)
Parameters
basePayoffPayoffThe one-dimensional payoff applied to the weighted sum.
weightsReadOnlySpan<double>The weights, one per asset, copied.
Exceptions
- ArgumentNullException
basePayoffis null.
Properties
Weights
Gets the weights.
public ImmutableArray<double> Weights { get; }
Property Value
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
aReadOnlySpan<double>The assets' prices, one per weight.
Returns
- double
The weighted sum.
Exceptions
- ArgumentException
a's length isn't the number of weights.