Fast Mode
This choice may be used only if calculation speed is paramount, which if often the case in trading applications.
If calculation speed is not important, it should be better avoid because it may result to wrong output if not used with care, as explained further below.
It causes the Price function to perform a full calculation only during its first invocation.
At subsequent invocations, all intermediate objects created during the first invocation are reused, thus saving substantial time.
By default, the returned data consist of a 2D-array, of which the top row contains labels and the second row contains the corresponding output values.
If the caller tradable is a Portfolio, there will be seberal rows corresponding to the portfolio's constituent tradables.
Flat DV01 relative to yield curves is returned only if Add Risk = TRUE and the relevant curves have been built with Store Deltas = true
It should be noted that in this case the keys Risk Ref and Risk Models are not supported and should not be part of the input to the Price function.
The labels corresponding to flat DV01 output values are of the form Delta-id, where id stands for the ID, if the latter is defined, or a default generated integer otherwise.
It is also possible to generate and return only a custom defined subset of the default full output array by using the additional optional key Shown Data
The risk of using Fast Mode has to do with the way the corresponding added calculational efficiency is implemented.
More specifically, a special QuantLib object of type Instrument that incorporates all tradable, model and market data needed to carry out the pricing computations is stored inside the respective Tradable object.
Similarly, several special QuantLib objects of type YieldTermStructure that represent modified versions of that curve caused by a 1 bp upward flat shift of other relevant curves are stored inside all relevant Yield Curve objects.
The latter storage takes place only if the Yield Curve has Store Deltas = true
While the setting Store Deltas = true has only a slow down effect on the curve creation, the special QuantLib object stored inside the Tradable object references not only the host Tradable object, but also additional applicable model and market data that have been passed as input to the Price function.
This is ok provided the tradable is priced always with the same market and model inputs.
But if the spreadsheet contains formulas that attempt to price the same tradable with different market and model inputs, only one of these inputs will be reflected in the stored QuantLib object and the pricing output will fail to consider the other inputs.
For example, such a failure would be caused by two spreadsheet formulas, the first of which prices a given swap with a yield curve A, while the second prices the same swap with a different yield curve B.
In such a case, using the Fast Mode would cause the second formula to return a wrong result, because it would attempt to use the stored QuantLib object created during the execution of the first formula.
The wrong result would be the consequence of the fact that the stored QuantLib object was constructed to reference the yield curve A instead of the yield curve B that was intended by the second formula.
