Skip to content

Commit 1643c1a

Browse files
committed
Merge branch 'master' into 'master'
QPR-12319 -- Improve error message when underlying bond basket build fails due... Closes QPR-9859 See merge request qs/ore-github!28
2 parents 41d89ab + d44788f commit 1643c1a

37 files changed

Lines changed: 823 additions & 265 deletions

Docs/ScriptedTrade/docs/models.tex

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ \subsection{Pricing Engine Configuration}\label{pricingengine_config}
2727
<Parameter name="Model_SingleAssetOptionBwd(FX)">BlackScholes</Parameter>
2828
<Parameter name="Model_SingleAssetOptionBwd(COMM)">BlackScholes</Parameter>
2929
<Parameter name="Model_SingleUnderlyingIrOption">GaussianCam</Parameter>
30+
<Parameter name="Model_SingleUnderlyingIrOptionBwd">GaussianCam</Parameter>
3031
<Parameter name="Model_MultiUnderlyingIrOption">GaussianCam</Parameter>
3132
<Parameter name="Model_IrHybrid(EQ)">GaussianCam</Parameter>
3233
<Parameter name="Model_IrHybrid(FX)">GaussianCam</Parameter>
@@ -38,6 +39,7 @@ \subsection{Pricing Engine Configuration}\label{pricingengine_config}
3839
<Parameter name="Engine">MC</Parameter>
3940
<Parameter name="Samples">10000</Parameter>
4041
<Parameter name="StateGridPoints">200</Parameter>
42+
<Parameter name="StateGridPoints_SingleUnderlyingIrOptionBwd">50</Parameter>
4143
<Parameter name="MesherEpsilon">1E-4</Parameter>
4244
<Parameter name="MesherScaling">1.5</Parameter>
4345
<Parameter name="MesherConcentration">0.1</Parameter>
@@ -54,7 +56,7 @@ \subsection{Pricing Engine Configuration}\label{pricingengine_config}
5456
<Parameter name="Engine_SingleAssetOptionBwd(EQ)">FD</Parameter>
5557
<Parameter name="Engine_SingleAssetOptionBwd(FX)">FD</Parameter>
5658
<Parameter name="Engine_SingleAssetOptionBwd(COMM)">FD</Parameter>
57-
<Parameter name="Engine_SingleUnderlyingIrOption">6</Parameter>
59+
<Parameter name="Engine_SingleUnderlyingIrOption">FD</Parameter>
5860
<Parameter name="useAD_MultiAssetOptionAD(EQ)">true</Parameter>
5961
<Parameter name="useAD_MultiAssetOptionAD(FX)">true</Parameter>
6062
<Parameter name="useAD_MultiAssetOptionAD(COMM)">true</Parameter>
@@ -188,11 +190,15 @@ \subsection{BlackScholes model}\label{blackscholes}
188190
189191
See \ref{pricingengine_config} for the impact of the model parameter FullDynamicFx on the model setup.
190192
191-
TimeStepsPerYear are ignored if the correlation structure is trivial, because then the process can be discretised
193+
For MC TimeStepsPerYear are ignored if the correlation structure is trivial, because then the process can be discretised
192194
exactly. Otherwise the given time steps per year are used to build a grid on which covariance matrices are computed
193195
assuming a constant volatility between the grid points. The actual MC paths are evoloved using these covariance matrices
194196
on the original (non-refined) time grid, i.e. taking large, exact steps again.
195197
198+
For FD TimeStepsPerYear, StateGridPoints, MesherEpsilon, MesherScaling, MesherConcentration,
199+
MesehMaxConcentrationPoints, MesherIsStatic are used, see the description of these parameters for their detailled
200+
interpretation.
201+
196202
\smallskip
197203
Available Engine types: MC, FD
198204
@@ -229,8 +235,12 @@ \subsection{GaussianCam models}
229235
230236
See \ref{pricingengine_config} for the impact of the model parameters FullDynamicFx, FullDynamicIr on the model setup.
231237
238+
The FD model variant is supported for a single underlying IR model only. A single calibration strike is supported that
239+
can be specified for any IR model index appearing in the script. TimeStepsPerYear, StateGridPoints, MesherEpsilon are
240+
used, see the description of these parameters for their detailled interpretation.
241+
232242
\smallskip
233-
Available Engine types: MC
243+
Available Engine types: MC, FD
234244
235245
\subsection{Base Currency Determination}\label{baseccy_determination}
236246
@@ -312,12 +322,12 @@ \subsection{Calibration}\label{calibration}
312322
The usage of the calibration strikes is twofold:
313323
314324
\begin{itemize}
315-
\item For the determination of calibration strikes. This is only relevant / supported by the BlackScholes model, which
316-
will use the first strike from the list to read the volatility from the market term structure (if Calibration is set
317-
to Deal in the model parameters).
325+
\item For the determination of calibration strikes. This is only relevant / supported by the BlackScholes and
326+
GaussianCam-FD model, which will use the first strike from the list to read the volatility from the market term
327+
structure (if Calibration is set to Deal in the model parameters).
318328
\item To determine concentration points for an FD mesher if \verb+Engine+ is set to \verb+FD+. The first $n$ strikes are
319329
used as concentration points where $n$ is the minimum of specified strikes and the engine parameter
320-
\verb+MesherMaxConcentrationPoints+.
330+
\verb+MesherMaxConcentrationPoints+. This is supported by the BlackScholes model only.
321331
\end{itemize}
322332
323333
\subsection{FX tags and correlation curves}\label{fxtags_correlationcurves}

Docs/ScriptedTrade/scriptedtrade.tex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ \section*{Document History}
135135
01-07-2021 & Peter Caspers & add case $d1>d2$ for ABOVEPROB, BELOWPROB \\
136136
13-09-2021 & Nathaniel Volfango & update Index section and add note on payment currency \\
137137
11-02-2022 & Peter Caspers & extend FWDCOMP, add FWDAVG function (breaking change) \\
138-
22-06-2023 & Peter Caspers & add config flags for external devices
138+
22-06-2023 & Peter Caspers & add config flags for external devices \\
139+
12-02-2024 & Peter Caspers & additions for FD GaussianCam model
139140
\\ \hline
140141
\end{supertabular}
141142
\end{center}

Docs/UserGuide/userguide.tex

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7210,9 +7210,6 @@ \subsubsection*{Trade Features}
72107210
Some trade features are not yet supported by the multileg option engine:
72117211

72127212
\begin{enumerate}
7213-
\item legs with fx resetting feature
7214-
\item legs with naked option = true
7215-
\item coupon types are restricted to Ibor and CMS
72167213
\item exercise flows (like a notional exchange common to cross currency swaptions) are not supported
72177214
\end{enumerate}
72187215

@@ -7228,12 +7225,6 @@ \subsubsection*{State interpolation for exercise decisions}
72287225
simulated path. Currently this is done using a simple linear interpolation while from a pure methodology point of view a
72297226
Brownian Bridge would be preferable. In our tests we do not see a big impact of this approximation though.
72307227

7231-
\subsubsection*{Missing recalibration of the MCMultiLegOptionEngine}
7232-
7233-
The MC Multi Leg Option Engine builder uses the \verb+CrossAssetModelBuilder+ to set up the pricing model. This class
7234-
does not implement the \verb+ModelBuidler+ interface meaning that the model is not recalibrated in a sensitivity
7235-
analysis run. Therefore the sensitivities calculated by this engine are not valid.
7236-
72377228
\subsubsection*{Basis Function Selection}
72387229

72397230
Currently the basis function system is generated by specifying the type of the functions and the order, see

OREAnalytics/orea/app/analytics/pricinganalytic.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ void PricingAnalyticImpl::runAnalytic(
158158
else if (type == "SENSITIVITY") {
159159
CONSOLEW("Risk: Sensitivity Report");
160160
LOG("Sensi Analysis - Initialise");
161-
bool recalibrateModels = true;
162161
bool ccyConv = false;
163162
std::string configuration = inputs_->marketConfig("pricing");
164163
boost::shared_ptr<SensitivityAnalysis> sensiAnalysis;
@@ -169,7 +168,7 @@ void PricingAnalyticImpl::runAnalytic(
169168
sensiAnalysis = boost::make_shared<SensitivityAnalysis>(
170169
analytic()->portfolio(), analytic()->market(), configuration, inputs_->pricingEngine(),
171170
analytic()->configurations().simMarketParams, analytic()->configurations().sensiScenarioData,
172-
recalibrateModels, analytic()->configurations().curveConfig,
171+
inputs_->sensiRecalibrateModels(), analytic()->configurations().curveConfig,
173172
analytic()->configurations().todaysMarketParams, ccyConv, inputs_->refDataManager(),
174173
*inputs_->iborFallbackConfig(), true, inputs_->dryRun());
175174
LOG("Single-threaded sensi analysis created");
@@ -182,9 +181,9 @@ void PricingAnalyticImpl::runAnalytic(
182181
std::function<std::vector<boost::shared_ptr<ore::data::EngineBuilder>>()> extraEngineBuilders = {};
183182
std::function<std::vector<boost::shared_ptr<ore::data::LegBuilder>>()> extraLegBuilders = {};
184183
sensiAnalysis = boost::make_shared<SensitivityAnalysis>(
185-
inputs_->nThreads(), inputs_->asof(), loader, analytic()->portfolio(), Market::defaultConfiguration,
184+
inputs_->nThreads(), inputs_->asof(), loader, analytic()->portfolio(), configuration,
186185
inputs_->pricingEngine(), analytic()->configurations().simMarketParams,
187-
analytic()->configurations().sensiScenarioData, recalibrateModels,
186+
analytic()->configurations().sensiScenarioData, inputs_->sensiRecalibrateModels(),
188187
analytic()->configurations().curveConfig, analytic()->configurations().todaysMarketParams, ccyConv,
189188
inputs_->refDataManager(), *inputs_->iborFallbackConfig(), true, inputs_->dryRun());
190189
LOG("Multi-threaded sensi analysis created");

OREAnalytics/orea/app/inputparameters.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ class InputParameters {
128128
void setOutputJacobi(bool b) { outputJacobi_ = b; }
129129
void setUseSensiSpreadedTermStructures(bool b) { useSensiSpreadedTermStructures_ = b; }
130130
void setSensiThreshold(Real r) { sensiThreshold_ = r; }
131+
void setSensiRecalibrateModels(bool b) { sensiRecalibrateModels_ = b; }
131132
void setSensiSimMarketParams(const std::string& xml);
132133
void setSensiSimMarketParamsFromFile(const std::string& fileName);
133134
void setSensiScenarioData(const std::string& xml);
@@ -420,6 +421,7 @@ class InputParameters {
420421
bool outputJacobi() const { return outputJacobi_; };
421422
bool useSensiSpreadedTermStructures() { return useSensiSpreadedTermStructures_; }
422423
QuantLib::Real sensiThreshold() const { return sensiThreshold_; }
424+
bool sensiRecalibrateModels() const { return sensiRecalibrateModels_; }
423425
const boost::shared_ptr<ore::analytics::ScenarioSimMarketParameters>& sensiSimMarketParams() { return sensiSimMarketParams_; }
424426
const boost::shared_ptr<ore::analytics::SensitivityScenarioData>& sensiScenarioData() { return sensiScenarioData_; }
425427
const boost::shared_ptr<ore::data::EngineData>& sensiPricingEngine() { return sensiPricingEngine_; }
@@ -688,6 +690,7 @@ class InputParameters {
688690
bool alignPillars_ = false;
689691
bool useSensiSpreadedTermStructures_ = true;
690692
QuantLib::Real sensiThreshold_ = 1e-6;
693+
bool sensiRecalibrateModels_ = true;
691694
boost::shared_ptr<ore::analytics::ScenarioSimMarketParameters> sensiSimMarketParams_;
692695
boost::shared_ptr<ore::analytics::SensitivityScenarioData> sensiScenarioData_;
693696
boost::shared_ptr<ore::data::EngineData> sensiPricingEngine_;

OREAnalytics/orea/app/oreapp.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,10 @@ void OREApp::buildInputParameters(boost::shared_ptr<InputParameters> inputs,
766766
tmp = params_->get("sensitivity", "outputSensitivityThreshold", false);
767767
if (tmp != "")
768768
inputs->setSensiThreshold(parseReal(tmp));
769+
770+
tmp = params_->get("sensitivity", "recalibrateModels", false);
771+
if (tmp != "")
772+
inputs->setSensiRecalibrateModels(parseBool(tmp));
769773
}
770774

771775

0 commit comments

Comments
 (0)