Skip to content

Commit 8f5563e

Browse files
Farah Khashmanjenkins
authored andcommitted
Merge remote-tracking branch 'origin/master' into QPR-12101
2 parents 2aeb2f4 + 6b0a55d commit 8f5563e

42 files changed

Lines changed: 852 additions & 465 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Docs/UserGuide/tradecomponents/optiondata.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ \subsubsection{Option Data}
111111
112112
Allowable values: \emph{European} or \emph{American} or \emph{Bermudan}.
113113
114-
Note that trade types IR Swaption and CallableSwap can have style
115-
\emph{European} or \emph{Bermudan}, but not \emph{American}.
114+
Note that trade types IR Swaption and CallableSwap can have all three styles:
115+
\emph{European}, \emph{Bermudan}, or \emph{American}.
116116
117117
FX, Equity and Commodity vanilla options can have styles \emph{European}
118118
or \emph{American}, but not \emph{Bermudan}.

Docs/UserGuide/tradedata/indexcdsoption.tex

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ \subsubsection{Index Credit Default Swap Option}
33
An index CDS option, trade type \lstinline!IndexCreditDefaultSwapOption!, is an option to enter into an index CDS at a specified strike spread or strike price. The Index CDS Option is set up using an \lstinline!IndexCreditDefaultSwapOptionData! node as shown in Listing \ref{lst:indexcdsoptiondata}. Its child nodes have the following meanings:
44

55
\begin{itemize}
6-
\item
7-
\lstinline!KnockOut!: A boolean node that determines whether front end protection is included or not. When this node evaluates to \lstinline!false!, front end protection is included. When this node evaluates to \lstinline!true!, front end protection is not included.
8-
9-
Allowable values: Boolean node, allowing \emph{Y, N, 1, 0, true, false} etc. The full set of allowable values is given in Table \ref{tab:boolean_allowable}.
106

117
\item
128
\lstinline!IndexTerm! [Optional]: An optional node giving the term of the underlying index CDS e.g.\ 3Y, 5Y, 7Y, 10Y etc. The main function of this node is to allow for different index CDS option volatility structures for different terms of the same index series e.g.\ a CDX HY Series 34 5Y volatility structure and a CDX HY Series 34 10Y volatility structure. If this node is omitted, the market is searched for a CDS volatility surface with ID equal to the value of the \lstinline!CreditCurveId! node under \lstinline!IndexCreditDefaultSwapData!. There will generally be one \lstinline!CreditCurveId! for each index CDS series e.g.\ \lstinline!CDXHYS34V1! for CDX HY Series 34 Version 1. Consequently, there can only be one CDS volatility surface for this index CDS series. When \lstinline!IndexTerm! is populated with the underlying index term, the market is searched for a CDS volatility surface with ID equal to the value of the \lstinline!CreditCurveId! node with suffix \lstinline!-[IndexTerm]!. For example, if the \lstinline!CreditCurveId! node on an index CDS option trade is \lstinline!CDXHYS34V1! and the \lstinline!IndexTerm! node is populated with \lstinline!5Y!, the market will be searched for a CDS volatility surface with ID \lstinline!CDXHYS34V1-5Y! and this will be used in the trade valuation. In this way, different volatility surfaces can be used to value different terms of the same CDS index series.
@@ -83,7 +79,6 @@ \subsubsection{Index Credit Default Swap Option}
8379
\begin{listing}[H]
8480
\begin{minted}[fontsize=\footnotesize]{xml}
8581
<IndexCreditDefaultSwapOptionData>
86-
<KnockOut>N</KnockOut>
8782
<IndexTerm>5Y</IndexTerm>
8883
<OptionData>
8984
<LongShort>Long</LongShort>

Docs/UserGuide/tradedata/swaption.tex

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ \subsubsection{Swaption}
142142
\item \lstinline!ExerciseFeeSettlementConvention![Optional]: The roll convention used to compute the exercise fee settlement date from
143143
the exercise date. Defaults to \emph{Unadjusted} if not given. Allowable values: See Table \ref{tab:convention} Roll Convention.
144144

145-
\item An \lstinline!ExerciseDates! node where for \emph{European} style swaptions exactly one \lstinline!ExerciseDate! date element must be given, and for \emph{American} style swaptions exactly two \lstinline!ExerciseDate! date element must be given, defining the start and the end of the American exercise period. \emph{Bermudan} style swaptions can have \lstinline!ExerciseDate! elements given directly (at least two \lstinline!ExerciseDate! elements must be given), or Rules or Dates based exercise dates. See Listings \ref{lst:bermudan_swaption_exercisedates}, \ref{lst:bermudan_swaption_rules} and \ref{lst:bermudan_swaption_dates}.
145+
\item An \lstinline!ExerciseDates! node where for \emph{European} style swaptions exactly one \lstinline!ExerciseDate! date element must be given, and for \emph{American} style swaptions exactly two \lstinline!ExerciseDate! date element must be given, defining the start and the end of the American exercise period. \emph{Bermudan} style swaptions can have \lstinline!ExerciseDate! elements given directly (at least two \lstinline!ExerciseDate! elements must be given). See Listing \ref{lst:bermudan_swaption_exercisedates}
146+
147+
\item \emph{Bermudan} style swaptions can also have Rules or Dates based exercise dates using an \lstinline!ExerciseSchedule! node instead of \lstinline!ExerciseDates!. See Listings \ref{lst:bermudan_swaption_rules} and \ref{lst:bermudan_swaption_dates}.
146148

147149

148150
\begin{listing}[H]
@@ -172,15 +174,15 @@ \subsubsection{Swaption}
172174
<LongShort>Long</LongShort>
173175
<Style>Bermudan</Style>
174176
<Settlement>Physical</Settlement>
175-
<ExerciseDates>
177+
<ExerciseSchedule>
176178
<Rules>
177179
<StartDate>2027-03-02</StartDate>
178180
<EndDate>2029-03-02</EndDate>
179181
<Tenor>1Y</Tenor>
180182
<Calendar>US</Calendar>
181183
<Convention>MF</Convention>
182-
<Rules>
183-
</ExerciseDates>
184+
</Rules>
185+
</ExerciseSchedule>
184186
...
185187
</OptionData>
186188
...
@@ -196,17 +198,17 @@ \subsubsection{Swaption}
196198
<LongShort>Long</LongShort>
197199
<Style>Bermudan</Style>
198200
<Settlement>Physical</Settlement>
199-
<ExerciseDates>
201+
<ExerciseSchedule>
200202
<Dates>
201203
<Calendar>NullCalendar</Calendar>
202204
<Convention>Unadjusted</Convention>
203205
<Dates>
204206
<Date>2027-03-02</Date>
205207
<Date>2028-03-02</Date>
206208
<Date>2029-03-02</Date>
207-
<Dates>
208-
<Dates>
209-
</ExerciseDates>
209+
</Dates>
210+
</Dates>
211+
</ExerciseSchedule>
210212
...
211213
</OptionData>
212214
...

Examples/Example_40/Input/portfolio.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@
267267
</Envelope>
268268
<IndexCreditDefaultSwapOptionData>
269269
<Strike>0.0060</Strike>
270-
<KnockOut>N</KnockOut>
271270
<OptionData>
272271
<LongShort>Long</LongShort>
273272
<OptionType>Call</OptionType>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#TradeId,TradeType,Maturity,MaturityTime,NPV,NpvCurrency,NPV(Base),BaseCurrency,Notional,NotionalCurrency,Notional(Base),NettingSet,CounterParty
22
BermSwp,ScriptedTrade,2036-03-03,20.073770,51640.311738,EUR,51640.311738,EUR,#N/A,#N/A,#N/A,CPTY_A,CPTY_A
3-
LPISwp,ScriptedTrade,2035-02-01,18.989303,62979.404029,GBP,78301.934721,EUR,#N/A,#N/A,#N/A,CPTY_B,CPTY_B
3+
LPISwp,ScriptedTrade,2035-02-01,18.989303,53833.516084,GBP,66930.904274,EUR,#N/A,#N/A,#N/A,CPTY_B,CPTY_B

Examples/Example_54/Input/pricingengine.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@
88
<Parameter name="EnforceBaseCcy">false</Parameter>
99
<Parameter name="GridCoarsening">3M(1W),1Y(1M),5Y(3M),10Y(1Y),50Y(5Y)</Parameter>
1010
<Parameter name="IrReversion_EUR">0.01</Parameter>
11-
<Parameter name="IrReversion_GBP">0.01</Parameter>
11+
<Parameter name="IrReversion_GBP">0.015</Parameter>
1212
<Parameter name="FullDynamicFx">true</Parameter>
1313
<Parameter name="FullDynamicIr">true</Parameter>
1414
<!-- DK or JY -->
1515
<Parameter name="InfModelType">JY</Parameter>
16+
<!-- explicit overwrite of cam correlations -->
17+
<Parameter name="Correlation_IR:GBP_INF:UKRPI:0">0.8</Parameter>
18+
<Parameter name="Correlation_IR:GBP_INF:UKRPI:1">0.6</Parameter>
19+
<Parameter name="Correlation_INF:UKRPI:0_INF:UKRPI:1">0.3</Parameter>
20+
<!-- real to nominal rate vol ratio in jy model -->
21+
<Parameter name="InfJyRealToNominalVolRatio">0.6</Parameter>
1622
</ModelParameters>
1723
<Engine>Generic</Engine>
1824
<EngineParameters>

Examples/Example_54/run.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
sys.path.append('../')
66
from ore_examples_helper import OreExample
77

8-
samples1=os.environ["OVERWRITE_SCENARIOGENERATOR_SAMPLES"]
9-
print("samples1 =", samples1)
10-
os.environ["OVERWRITE_SCENARIOGENERATOR_SAMPLES"]=""
11-
samples2=os.environ["OVERWRITE_SCENARIOGENERATOR_SAMPLES"]
12-
print("samples2 =", samples2)
8+
if "OVERWRITE_SCENARIOGENERATOR_SAMPLES" in os.environ:
9+
backupSamples = os.environ["OVERWRITE_SCENARIOGENERATOR_SAMPLES"]
10+
os.environ["OVERWRITE_SCENARIOGENERATOR_SAMPLES"] = ""
1311

1412
oreex = OreExample(sys.argv[1] if len(sys.argv)>1 else False)
1513

@@ -41,4 +39,5 @@
4139
oreex.decorate_plot(title="Example Scripting / AMC - DIM Evolution for LPI Swap (sticky date mpor mode)")
4240
oreex.save_plot_to_file()
4341

44-
os.environ["OVERWRITE_SCENARIOGENERATOR_SAMPLES"]=samples1
42+
if "OVERWRITE_SCENARIOGENERATOR_SAMPLES" in os.environ:
43+
os.environ["OVERWRITE_SCENARIOGENERATOR_SAMPLES"] = backupSamples

OREAnalytics/orea/orea.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <orea/aggregation/staticcreditxvacalculator.hpp>
2323
#include <orea/aggregation/xvacalculator.hpp>
2424
#include <orea/app/analytic.hpp>
25+
#include <orea/app/analytics/imscheduleanalytic.hpp>
2526
#include <orea/app/analytics/parconversionanalytic.hpp>
2627
#include <orea/app/analytics/pricinganalytic.hpp>
2728
#include <orea/app/analytics/scenarioanalytic.hpp>
@@ -64,6 +65,7 @@
6465
#include <orea/engine/historicalpnlgenerator.hpp>
6566
#include <orea/engine/historicalsensipnlcalculator.hpp>
6667
#include <orea/engine/historicalsimulationvar.hpp>
68+
#include <orea/engine/marketriskbacktest.hpp>
6769
#include <orea/engine/marketriskreport.hpp>
6870
#include <orea/engine/mporcalculator.hpp>
6971
#include <orea/engine/multistatenpvcalculator.hpp>
@@ -85,6 +87,7 @@
8587
#include <orea/engine/stresstest.hpp>
8688
#include <orea/engine/valuationcalculator.hpp>
8789
#include <orea/engine/valuationengine.hpp>
90+
#include <orea/engine/varbacktest.hpp>
8891
#include <orea/engine/varcalculator.hpp>
8992
#include <orea/engine/xvaenginecg.hpp>
9093
#include <orea/engine/zerotoparcube.hpp>
@@ -121,6 +124,8 @@
121124
#include <orea/simm/crif.hpp>
122125
#include <orea/simm/crifloader.hpp>
123126
#include <orea/simm/crifrecord.hpp>
127+
#include <orea/simm/imschedulecalculator.hpp>
128+
#include <orea/simm/imscheduleresults.hpp>
124129
#include <orea/simm/simmbasicnamemapper.hpp>
125130
#include <orea/simm/simmbucketmapper.hpp>
126131
#include <orea/simm/simmbucketmapperbase.hpp>

OREData/ored/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,8 @@ portfolio/equityfuturesoption.hpp
623623
portfolio/equityfxlegbuilder.hpp
624624
portfolio/equityfxlegdata.hpp
625625
portfolio/equityoption.hpp
626-
portfolio/equityoutperformanceoption.hpp
627626
portfolio/equityoptionposition.hpp
627+
portfolio/equityoutperformanceoption.hpp
628628
portfolio/equityposition.hpp
629629
portfolio/equityswap.hpp
630630
portfolio/equitytouchoption.hpp

OREData/ored/model/crossassetmodelbuilder.cpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,35 @@ void CrossAssetModelBuilder::resetModelParams(const CrossAssetModel::AssetType t
162162
}
163163
}
164164

165+
void CrossAssetModelBuilder::copyModelParams(const CrossAssetModel::AssetType t0, const Size param0, const Size index0,
166+
const Size i0, const CrossAssetModel::AssetType t1, const Size param1,
167+
const Size index1, const Size i1, const Real mult) const {
168+
auto mp0 = model_->MoveParameter(t0, param0, index0, i0);
169+
auto mp1 = model_->MoveParameter(t1, param1, index1, i1);
170+
auto s0 = 0, s1 = 0;
171+
for (Size i = 0; i < mp0.size(); ++i)
172+
if (mp0[i])
173+
s0++;
174+
for (Size i = 0; i < mp1.size(); ++i)
175+
if (mp1[i])
176+
s1++;
177+
QL_REQUIRE(s0 == s1, "CrossAssetModelBuilder::copyModelParams(): source range size ("
178+
<< s0 << ") does not match target range size (" << s1 << ") when copying (" << t0 << ", "
179+
<< param0 << "," << index0 << "," << i0 << ") -> (" << t0 << ", " << param0 << ","
180+
<< index0 << "," << i0 << ")");
181+
std::vector<Real> sourceValues(s0);
182+
for (Size idx0 = 0, count = 0; idx0 < mp0.size(); ++idx0) {
183+
if (!mp0[idx0]) {
184+
sourceValues[count++] = params_[idx0];
185+
}
186+
}
187+
for (Size idx1 = 0, count = 0; idx1 < mp1.size(); ++idx1) {
188+
if (!mp1[idx1]) {
189+
model_->setParam(idx1, sourceValues[count++] * mult);
190+
}
191+
}
192+
}
193+
165194
void CrossAssetModelBuilder::buildModel() const {
166195

167196
LOG("Start building CrossAssetModel");
@@ -842,6 +871,15 @@ void CrossAssetModelBuilder::calibrateInflation(const InfJyData& data, Size mode
842871
// Calibration configuration.
843872
const auto& cc = data.calibrationConfiguration();
844873

874+
// if we link the real rate params to the nominal rate params, we copy them over now (ir calibration is done at this point)
875+
if(data.linkRealRateParamsToNominalRateParams()) {
876+
Size irIdx = model_->ccyIndex(model_->infjy(modelIdx)->currency());
877+
copyModelParams(CrossAssetModel::AssetType::IR, 0, irIdx, Null<Size>(), CrossAssetModel::AssetType::INF, 0,
878+
modelIdx, Null<Size>(), data.linkedRealRateVolatilityScaling());
879+
copyModelParams(CrossAssetModel::AssetType::IR, 1, irIdx, Null<Size>(), CrossAssetModel::AssetType::INF, 1,
880+
modelIdx, Null<Size>(), 1.0);
881+
}
882+
845883
if (data.calibrationType() == CalibrationType::BestFit) {
846884

847885
// If calibration type is BestFit, do a global optimisation on the parameters that need to be calibrated.
@@ -937,6 +975,13 @@ void CrossAssetModelBuilder::calibrateInflation(const InfJyData& data, Size mode
937975
}
938976

939977
// Log the calibration details.
978+
TLOG("INF (JY) " << data.index() << " model parameters after calibration:");
979+
TLOG("Real rate vol times : " << inflationParam->parameterTimes(0));
980+
TLOG("Real rate vol values : " << inflationParam->parameterValues(0));
981+
TLOG("Real rate rev times : " << inflationParam->parameterTimes(1));
982+
TLOG("Real rate rev values : " << inflationParam->parameterValues(1));
983+
TLOG("R/N conversion times : " << inflationParam->parameterTimes(2));
984+
TLOG("R/N conversion values : " << inflationParam->parameterValues(2));
940985
DLOG("INF (JY) " << data.index() << " calibration errors:");
941986
inflationCalibrationErrors_[modelIdx] = getCalibrationError(allHelpers);
942987
if (data.calibrationType() == CalibrationType::Bootstrap) {

0 commit comments

Comments
 (0)