Skip to content

Commit 36223a9

Browse files
committed
Merge branch 'master' into 'master'
update from master Closes QPR-9859, QPR-11618, QPR-12027, QPR-12014, QPR-12297, QPR-12253, and QPR-12281 See merge request qs/ore-github!26
2 parents c95debf + 4df2590 commit 36223a9

213 files changed

Lines changed: 7706 additions & 7240 deletions

File tree

Some content is hidden

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

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[submodule "QuantLib"]
22
path = QuantLib
3-
url = https://github.com/OpenSourceRisk/QuantLib.git
3+
url = git@gitlab.acadiasoft.net:qs/quantlib.git
44
branch = master
55
ignore = dirty

Docs/UserGuide/tradecomponents/cmbleg.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ \subsubsection{Constant Maturity Bond Leg Data}
2222
...
2323
</ScheduleData>
2424
<CMBLegData>
25-
<Index>CMB-US-TBILL-13W</Index>
25+
<Index>CMB-US-TBILL-HD-13W</Index>
2626
<FixingDays>2</FixingDays>
2727
<Spreads>
2828
<Spread>0.0010</Spread>

Docs/UserGuide/tradedata/swaption.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ \subsubsection{Swaption}
66
component sub-node. These trade components are outlined in section \ref{ss:option_data} and section
77
\ref{ss:leg_data}.\\
88
\vspace{5mm}
9-
Supported swaption exercise styles are \emph{European} and \emph{Bermudan}. Swaptions of both exercise styles can have an arbitrary number of legs, with
9+
Supported swaption exercise styles are \emph{European}, \emph{Bermudan}, \emph{American}. Swaptions of all exercise styles can have an arbitrary number of legs, with
1010
each leg represented by a \lstinline!LegData! sub-node. Cross currency swaptions are not supported for either exercise style, i.e. the Currency element must
1111
have the same value for all \lstinline!LegData! sub-nodes of a swaption. There must be at least one full coupon period after the exercise date for European
1212
Swaptions, and after the last exercise date for Bermudan Swaptions. See Table \ref{tab:swaption_requirements} for further details on requirements for

Docs/UserGuide/userguide.tex

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@
125125
\newcommand{\SCVA}{\mathit{SCVA}}
126126
\newcommand{\bs}{\textbackslash}
127127
\newcommand{\REDY}{\color{red}Y}
128+
\newcommand{\IA}{\mathit{IA}}
129+
\newcommand{\Th}{\mathit{TH}}
130+
\newcommand{\CSA}{\mathit{CSA}}
128131

129132
\begin{document}
130133

@@ -5772,15 +5775,18 @@ \subsubsection{Market}\label{sec:sim_market}
57725775
It should be noted that equity volatilities are taken to be a curve by default. To simulate an equity volatility surface with smile the xml node {\tt <Surface> } must be supplied.
57735776
There are two methods in ORE for equity volatility simulation:
57745777
\begin{itemize}
5775-
\item Simulating ATM volatilities only (and shifting other strikes relative to this using the $T_{0}$ smile). In this case set {\tt <SimulateATMOnly>} to true.
5776-
\item Simulating the full volatility surface. The node {\tt <SimulateATMOnly>} should be omitted or set to false, and explicit moneyness levels for simulation should be provided.
5778+
\item Simulating ATM volatilities only (and shifting other strikes relative to this using the $T_{0}$ smile). In this
5779+
case set {\tt <SimulateATMOnly>} to true and no surface node is given.
5780+
\item Simulating the full volatility surface. The node {\tt <SimulateATMOnly>} should be omitted or set to false, and
5781+
explicit moneyness levels for simulation should be provided.
57775782
\end{itemize}
57785783

57795784
Swaption volatilities are taken to be a surface by default. To simulate a swaption volatility cube with smile the xml node {\tt <Cube> } must be supplied.
57805785
There are two methods in ORE for swaption volatility cube simulation:
57815786
\begin{itemize}
57825787
\item Simulating ATM volatilities only (and shifting other strikes relative to this using the $T_{0}$ smile). In this case set {\tt <SimulateATMOnly>} to true.
5783-
\item Simulating the full volatility cube. The node {\tt <SimulateATMOnly>} should be omitted or set to false, and explicit strike spreads for simulation should be provided.
5788+
\item Simulating the full volatility cube. The node {\tt <SimulateATMOnly>} should be omitted or set to false, and
5789+
explicit strike spreads for simulation should be provided.
57845790
\end{itemize}
57855791

57865792
FX volatilities are taken to be a curve by default. To simulate an FX volatility cube with smile the xml node {\tt <Surface> } must be supplied. The surface node contains the moneyness levels to be simulated.
@@ -5862,8 +5868,8 @@ \subsubsection{Market}\label{sec:sim_market}
58625868
</Currencies>
58635869
<Expiries>6M,1Y,2Y,3Y,5Y,10Y,12Y,15Y,20Y</Expiries>
58645870
<Terms>1Y,2Y,3Y,4Y,5Y,7Y,10Y,15Y,20Y,30Y</Terms>
5871+
<SimulateATMOnly>false</SimulateATMOnly>
58655872
<Cube>
5866-
<SimulateATMOnly>false</SimulateATMOnly>
58675873
<StrikeSpreads>-0.02,-0.01,0.0,0.01,0.02</StrikeSpreads>
58685874
</Cube>
58695875
<!-- Sets a new daycounter for just the EUR swaptionVolatility surface -->
@@ -5896,9 +5902,9 @@ \subsubsection{Market}\label{sec:sim_market}
58965902
<Name>Lufthansa</Name>
58975903
</Names>
58985904
<Expiries>6M,1Y,2Y,3Y,4Y,5Y,7Y,10Y</Expiries>
5905+
<SimulateATMOnly>false</SimulateATMOnly>
58995906
<Surface>
5900-
<SimulateATMOnly>false</SimulateATMOnly><!-- false -->
5901-
<Moneyness>0.1,0.5,1.0,1.5,2.0,3.0</Moneyness><!-- omitted if SimulateATMOnly true -->
5907+
<Moneyness>0.1,0.5,1.0,1.5,2.0,3.0</Moneyness>
59025908
</Surface>
59035909
<TimeExtrapolation>Flat</TimeExtrapolation>
59045910
<StrikeExtrapolation>Flat</StrikeExtrapolation>
@@ -7546,28 +7552,31 @@ \subsection{Collateral Model}\label{sec:app_collateral}
75467552
\begin{align}\label{eq:CSA}
75477553
CSA(t_m) &=
75487554
\begin{cases}
7549-
\max(0, V_{set}(t_m) - I_A - T_{hold}),& V_{set}(t_m) - I_A \ge 0 \\
7550-
\min(0, V_{set}(t_m) - I_A + T_{hold}),& V_{set}(t_m) - I_A < 0
7555+
\max(0, \NPV(t_m) + \IA - \Th_{rec}),& \NPV(t_m) + \IA \ge 0 \\
7556+
\min(0, \NPV(t_m) + \IA + \Th_{pay}),& \NPV(t_m) + \IA < 0
75517557
\end{cases}
75527558
\end{align}
75537559
where
75547560
\begin{itemize}
7555-
\item $V_{set}(t_m)$ is the value of the netting set as of
7556-
time $t_m$,
7557-
\item $T_{hold}$ is the threshold exposure below which no collateral is
7558-
required (possibly asymmetric),
7561+
\item $\NPV(t_m)$ is the value of the netting set as of
7562+
time $t_m$ from our persepctive,
7563+
\item $\Th_{rec}$ is the threshold exposure below which we do not
7564+
require collateral, likewise $\TH_{pay}$ is the threshold that applies to collateral posted to the counterparty,
75597565
%\item $MTA$ is the minimum transfer amount for collateral margin
75607566
% flow requests (possibly asymmetric)
7561-
\item $I_A$ is the sum of all collateral independent amounts attached to
7562-
the underlying portfolio of trades (positive amounts imply that the bank
7563-
has received a net inflow of independent amounts from the
7567+
\item $\IA$ is the sum of all collateral independent amounts attached to
7568+
the underlying portfolio of trades (positive amounts imply that we
7569+
have received a net inflow of independent amounts from the
75647570
counterparty), assumed here to be cash.
75657571
\end{itemize}
75667572

75677573
As the collateral account already has a value of $C(t_m)$ at time $t_m$, the collateral shortfall is simply the
7568-
difference between $C(t_m)$ and $CSA(t_m)$. However, we also need to account for the possibility that margin calls
7574+
difference between $C(t_m)$ and $\CSA(t_m)$. However, we also need to account for the possibility that margin calls
75697575
issued in the past have not yet been settled (for instance, because of disputes). If $M(t_m)$ denotes the net value of
7570-
all outstanding margin calls at $t_m$, and $\Delta(t)$ is the difference $\Delta(t) = CSA(t_m) - C(t_m) - M(t_m)$
7576+
all outstanding margin calls at $t_m$, and $\Delta(t)$ is the difference
7577+
$$
7578+
\Delta(t) = \CSA(t_m) - C(t_m) - M(t_m)
7579+
$$
75717580
between the {\em Credit Support Amount} and the current and outstanding collateral, then the actual margin
75727581
\emph{Delivery Amount} $D(t_m)$ is calculated as follows:
75737582
\begin{align}\label{eq:DA}
@@ -7577,7 +7586,18 @@ \subsection{Collateral Model}\label{sec:app_collateral}
75777586
0,& \left| \Delta(t) \right| < MTA
75787587
\end{cases}
75797588
\end{align}
7580-
where $MTA$ is the minimum transfer amount.
7589+
where $MTA$ is the minimum transfer amount.
7590+
7591+
Consider the upper case of \eqref{eq:CSA}: If the initial value of the netting set is zero ($\NPV(t_0)=0$) and
7592+
if $\Th_{rec}=0$, but the combined $\IA>0$, then the Credit Support Amount equals the Independent Amount, $\CSA(t_0)=\IA$.
7593+
If moreover the initial collateral balance is zero (because the Independent Amount has not been received yet),
7594+
then $\Delta(t_0)=\CSA(t_0)=\IA$, and the delivery amount $D(t_0)$ also matches the $\IA$ (assuming this exceeds the MTA),
7595+
so that the next call leads to the transfer of the Independent Amount to us. For a positive $\Th_{rec}>0$, the transfer to us is reduced accordingly.
7596+
In that case we can view the Independent Amount as an offset to the threshold.
7597+
7598+
Consider the lower case of \eqref{eq:CSA}: If the netting set value is negative from our perspective and in absolute terms larger than the $\IA$,
7599+
then the Credit Support Amount is just the negative difference $\CSA=-|\NPV| + \IA + \Th_{pay}$ so that we need to post collateral, but only the amount
7600+
beyond the combined threshold $\IA + \Th_{pay}$.
75817601

75827602
\subsubsection{Margin Period of Risk} \label{sec:mpor}
75837603
After a counterparty defaults, it takes time to close out the portfolio. During this time period the portfolio value will change upon market conditions, therefore the portfolio's close-out value is subject to market risk, which is referred also as the close-out risk and the corresponding close-out period is called as the {\em Margin Period of Risk} (MPoR).

Examples/Example_1/ExpectedOutput/exposure_nettingset_CPTY_A.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#NettingSet,Date,Time,EPE,ENE,PFE,ExpectedCollateral,BaselEE,BaselEEE
2-
CPTY_A,2016-02-05,0.000000,597.96,0.00,597.96,-597.96,597.96,597.96
2+
CPTY_A,2016-02-05,0.000000,597.96,0.00,597.96,597.96,597.96,597.96
33
CPTY_A,2016-05-06,0.248634,127002.98,148662.15,560569.13,0.00,127643.44,127643.44
44
CPTY_A,2016-08-05,0.497268,205715.45,254771.75,791661.75,0.00,207795.46,207795.46
55
CPTY_A,2016-11-07,0.754098,287607.07,232717.91,1302106.25,0.00,291989.83,291989.83

0 commit comments

Comments
 (0)