Class OperatorSplittingSpreadEngine
- Namespace
- NanoQL.PricingEngines
- Assembly
- NanoQL.dll
The operator-splitting engine for a European spread option on two futures, to first or second order: Kirk's price with its corrections, from C. F. Lo, "Pricing Spread Options by the Operator Splitting Method", https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2429696.
public sealed class OperatorSplittingSpreadEngine : SpreadBlackScholesVanillaEngine
- Inheritance
-
OperatorSplittingSpreadEngine
- Inherited Members
Remarks
Immutable. A put is priced from the call by parity.
A second forward and strike summing to zero or less is refused, where QuantLib takes the log of a negative number
and returns NaN (Divergences/SpreadApproximationStrikeTests.cs); at a zero volatility of the second asset
the corrections are their limit, 0, so the price is Kirk's, exact there, where QuantLib's are 0·∞ and the price NaN
(Divergences/OperatorSplittingZeroVolatilityTests.cs).
Constructors
OperatorSplittingSpreadEngine(GeneralizedBlackScholesProcess, GeneralizedBlackScholesProcess, double, OperatorSplittingSpreadEngineOrder)
Initializes a new instance of the OperatorSplittingSpreadEngine class.
public OperatorSplittingSpreadEngine(GeneralizedBlackScholesProcess process1, GeneralizedBlackScholesProcess process2, double correlation, OperatorSplittingSpreadEngineOrder order = OperatorSplittingSpreadEngineOrder.Second)
Parameters
process1GeneralizedBlackScholesProcessThe first asset's process.
process2GeneralizedBlackScholesProcessThe second asset's process.
correlationdoubleThe correlation of the two assets.
orderOperatorSplittingSpreadEngineOrderThe approximation's order.
Exceptions
- ArgumentNullException
A process is null.
- ArgumentOutOfRangeException
orderisn't one of its values.
Methods
Calculate(BasketOption, EvaluationContext, GeneralizedBlackScholesProcess, GeneralizedBlackScholesProcess, double, OperatorSplittingSpreadEngineOrder)
Prices a European spread option by operator splitting.
public static MultiAssetOptionResults Calculate(BasketOption option, EvaluationContext context, GeneralizedBlackScholesProcess process1, GeneralizedBlackScholesProcess process2, double correlation, OperatorSplittingSpreadEngineOrder order = OperatorSplittingSpreadEngineOrder.Second)
Parameters
optionBasketOptionThe option, on a SpreadBasketPayoff over a plain vanilla payoff.
contextEvaluationContextThe evaluation context.
process1GeneralizedBlackScholesProcessThe first asset's process.
process2GeneralizedBlackScholesProcessThe second asset's process.
correlationdoubleThe correlation of the two assets.
orderOperatorSplittingSpreadEngineOrderThe approximation's order.
Returns
- MultiAssetOptionResults
The option's results: the value; the expired results when it has expired.
Exceptions
- ArgumentNullException
An argument is null.
- ArgumentOutOfRangeException
orderisn't one of its values.- NanoQLException
The exercise isn't European, the payoff isn't a spread payoff over a plain vanilla payoff, or the second forward and the strike sum to zero or less.
Calculate(double, double, double, OptionType, double, double, double)
The value of a spread option on two forwards.
protected override double Calculate(double f1, double f2, double k, OptionType optionType, double variance1, double variance2, double df)
Parameters
f1doubleThe first forward.
f2doubleThe second forward.
kdoubleoptionTypeOptionTypeThe option's type.
variance1doubleThe first forward's Black variance to expiry.
variance2doubleThe second forward's Black variance to expiry.
dfdoubleThe discount factor to expiry.
Returns
- double
The value.