Skip to content

Commit 4858da5

Browse files
committed
Merge remote-tracking branch 'origin/master' into feature/QPR-13640
2 parents a466b77 + ce26bf3 commit 4858da5

92 files changed

Lines changed: 1660 additions & 453 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.

Docs/ScriptedTrade/docs/language.tex

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
\verb+max+ & \\
4242
\verb+min+ & \\
4343
\verb+pow+ & \\
44+
\verb+frac+ & \\
45+
\verb+round+ & \\
4446
\verb+black+ & \\
4547
\verb+dcf+ & \\
4648
\verb+days+ & \\ \hline
@@ -398,21 +400,21 @@
398400
\item {\tt REQUIRE Strike >= 0;}
399401
\end{itemize}
400402

401-
% ====================================================
402-
\stsubsection{Functions {\tt min}, {\tt max}, {\tt pow}}
403-
% ====================================================
403+
% =========================================================================
404+
\stsubsection{Functions {\tt min}, {\tt max}, {\tt pow}}, {\tt round(x,y)}
405+
% =========================================================================
404406

405-
Binary functions {\tt min(x,y)}, {\tt max(x,y)}, {\tt pow(x,y)}, applicable to numbers only.
407+
Binary functions {\tt min(x,y)}, {\tt max(x,y)}, {\tt pow(x,y)}, {\tt round(x,y)}, applicable to numbers only.
406408

407-
% ====================================================
408-
\stsubsection{Functions {\tt -}, abs, exp, ln, sqrt}
409-
% ====================================================
409+
% ========================================================
410+
\stsubsection{Functions {\tt -}, abs, exp, ln, sqrt, frac}
411+
% ========================================================
410412

411-
Unary functions {\tt -x}, {\tt abs(x)}, {\tt exp(x)}, {\tt ln(x)}, {\tt sqrt(x)}, applicable to numbers only.
413+
Unary functions {\tt -x}, {\tt abs(x)}, {\tt exp(x)}, {\tt ln(x)}, {\tt sqrt(x)}, {\tt frac(x)} which take the fractional part of a float, applicable to numbers only.
412414

413-
% ====================================================
415+
% =======================================================
414416
\stsubsection{Functions {\tt normalPdf}, {\tt normalCdf}}
415-
% ====================================================
417+
% =======================================================
416418

417419
Returns the standard normal pdf $\phi(x)$ resp. cdf $\Phi(x)$, applicable to numbers only.
418420

Docs/UserGuide/examples/examples.tex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,9 @@ \subsubsection{Historical Simulation VaR}
615615
The analytic is specified as usual in {\tt ore.xml} with the following parameters:
616616
\begin{itemize}
617617
\item outputFile: csv file name of the resulting VaR report
618-
%\item breakdown: boolean, if true the VaR report will contain a breakdown by risk class and risk type, otherwise the report shows the portfolio-lvel VaR only.
619-
\item tradePnl: boolean, if true the VaR report will contain a breakdown by tradeID, risk class and risk type, otherwise the report shows the portfolio-lvel VaR only.
618+
%\item breakdown: boolean, if true the VaR report will contain a breakdown by risk class and risk type, otherwise the report shows the portfolio-level VaR only.
619+
\item tradePnl: boolean, if true the VaR report will contain a breakdown by tradeID, risk class and risk type, otherwise the report shows the portfolio-level VaR only.
620+
\item riskFactorBreakdown: boolean, if true the VaR report will contain a breakdown by risk factor.
620621
\item quantiles: comma separated list of quantiles to be reported
621622
\item portfolioFilter (optional): Only trades with {\tt portfolioId} equal to the provided filter name are processed, see {\tt portfolio.xml}; the entire portfolio is processed, if omitted
622623
\item historicalPeriod: comma-separated date list, an even number of ordered dates is required (d1, d2, d3, d4, ...), where each pair (d1-d2, d3-d4, ...) defines the start and end of historical observation periods used

Docs/UserGuide/parameterisation/conventions.tex

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,12 @@ \subsubsection{Future Conventions}\label{ss:conventions_future}
140140
\item Index: The underlying index of the futures, this is either a MM (i.e. Ibor) index like e.g. EUR-EURIBOR-3M or an
141141
overnight index like e.g. USD-SOFR.
142142
\item DateGenerationRule [Optional]: This should be set to `IMM' when the start and end dates of the future are
143-
following the IMM date logic or `FirstDayOfMonth' when the start and end date are the first day of a month. If not
144-
given this field defaults to `IMM'.
143+
following the IMM date logic, `FirstDayOfMonth' when the start and end date are the first day of a month, or
144+
`SecondThursday' when the expiry date is the second Thursday of the month. If not given this field defaults to `IMM'.
145145
\begin{itemize}
146-
\item For MM futures only `IMM' is allowed and the expiry date is determined as the next 3rd Wednesday of the expiry
147-
month of a future.
146+
\item For MM futures `IMM' or `SecondThursday' are allowed. The expiry date for `IMM' is determined as the next 3rd
147+
Wednesday of the expiry month of a future. The expiry date for `SecondThursday' is determined as the 2nd Thursday
148+
of the expiry month (e.g. used for AUD-BBSW-3M futures).
148149
\item For an overnight index future `IMM' means that the end date of the future is set to the 3rd Wednesday of the
149150
expiry month and the start date is set to the 3rd Wednesday of the expiry month minus the future tenor. The setting
150151
`IMM' applies to SOFR-3M futures for example. `FirstDayOfMonth' on the other hand means that the end date of the
@@ -163,8 +164,9 @@ \subsubsection{Future Conventions}\label{ss:conventions_future}
163164
are averaging the daily overnight fixings over the calculation period of the future.
164165
\end{itemize}
165166

166-
Listings \ref{lst:future_conventions_euribor_3m}, \ref{lst:future_conventions_sofr_3m},
167-
\ref{lst:future_conventions_sofr_1m} show examples for Euribor-3M, SOFR-3M and SOFR-1M future conventions.
167+
Listings \ref{lst:future_conventions_euribor_3m}, \ref{lst:future_conventions_aud_bbsw_3m},
168+
\ref{lst:future_conventions_sofr_3m}, \ref{lst:future_conventions_sofr_1m} show examples for Euribor-3M, AUD-BBSW-3M,
169+
SOFR-3M and SOFR-1M future conventions.
168170

169171
\begin{listing}[H]
170172
%\hrule\medskip
@@ -192,6 +194,19 @@ \subsubsection{Future Conventions}\label{ss:conventions_future}
192194
\label{lst:future_conventions_euribor_3m}
193195
\end{listing}
194196

197+
\begin{listing}[H]
198+
%\hrule\medskip
199+
\begin{minted}[fontsize=\footnotesize]{xml}
200+
<Future>
201+
<Id>AUD-BBSW-3M-FUTURES-CONVENTIONS</Id>
202+
<Index>AUD-BBSW-3M</Index>
203+
<DateGenerationRule>SecondThursday</DateGenerationRule>
204+
</Future>
205+
\end{minted}
206+
\caption{AUD BBSW 3M MM Future conventions (Second Thursday expiry)}
207+
\label{lst:future_conventions_aud_bbsw_3m}
208+
\end{listing}
209+
195210
\begin{listing}[H]
196211
%\hrule\medskip
197212
\begin{minted}[fontsize=\footnotesize]{xml}

Docs/UserGuide/tradedata/rainbow_option.tex

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,3 +1648,169 @@ \subsubsection*{Worst Performance Rainbow Option 05}
16481648
COMM underlyings), this will result in a quanto payoff. Notice section ``Payment Currency'' in ore/Docs/ScriptedTrade. \\
16491649
Allowable values: See Table \ref{tab:currency} for allowable currency codes.
16501650
\end{itemize}
1651+
1652+
\subsubsection*{Worst Performance Rainbow Option 06}
1653+
1654+
A worst performance rainbow option 06 is represented as a {\em scripted trade},
1655+
refer to the scripted trade documentation in ore/Docs/ScriptedTrade
1656+
for an introduction.
1657+
1658+
Trade input and the payoff script are described below.
1659+
1660+
\begin{minted}[fontsize=\scriptsize]{xml}
1661+
<Trade id="EQ_WorstPerformanceRainbowOption06">
1662+
<TradeType>ScriptedTrade</TradeType>
1663+
<Envelope>
1664+
<CounterParty>CPTY_A</CounterParty>
1665+
<NettingSetId>CPTY_A</NettingSetId>
1666+
<AdditionalFields/>
1667+
</Envelope>
1668+
<WorstPerformanceRainbowOption06Data>
1669+
<LongShort type="longShort">Long</LongShort>
1670+
<Quantity type="number">200000</Quantity>
1671+
<Underlyings type="index">
1672+
<Value>EQ-RIC:.STOXX50E</Value>
1673+
<Value>EQ-RIC:.SPX</Value>
1674+
</Underlyings>
1675+
<InitialPrices type="number">
1676+
<Value>5455.60</Value>
1677+
<Value>500</Value>
1678+
</InitialPrices>
1679+
<StrikePrices type="number">
1680+
<Value>5600</Value>
1681+
<Value>550</Value>
1682+
</StrikePrices>
1683+
<BarrierLevels type="number">
1684+
<Value>5600</Value>
1685+
<Value>550</Value>
1686+
</BarrierLevels>
1687+
<KnockInPrices type="number">
1688+
<Value>5600</Value>
1689+
<Value>550</Value>
1690+
</KnockInPrices>
1691+
<BonusCoupon type="number">0.1430</BonusCoupon>
1692+
<ObservationSchedule type="event">
1693+
<ScheduleData>
1694+
<Rules>
1695+
<StartDate>2020-03-11</StartDate>
1696+
<EndDate>2020-09-04</EndDate>
1697+
<Tenor>1D</Tenor>
1698+
<Calendar>USD</Calendar>
1699+
<Convention>ModifiedFollowing</Convention>
1700+
<TermConvention>ModifiedFollowing</TermConvention>
1701+
<Rule>Forward</Rule>
1702+
</Rules>
1703+
</ScheduleData>
1704+
</ObservationSchedule>
1705+
<ObservationDate type="event">2020-09-04</ObservationDate>
1706+
<SettlementDate type="event">2020-09-11</SettlementDate>
1707+
<PayCcy type="currency">EUR</PayCcy>
1708+
</WorstPerformanceRainbowOption06Data>
1709+
</Trade>
1710+
\end{minted}
1711+
1712+
The WorstPerformanceRainbowOption06 script referenced in the trade above is shown in listing
1713+
\ref{lst:worst_performance_rainbow_option_06}.
1714+
1715+
\begin{listing}[hbt]
1716+
\begin{minted}[fontsize=\scriptsize]{Basic}
1717+
REQUIRE SIZE(Underlyings) == SIZE(InitialPrices) AND SIZE(Underlyings) == SIZE(StrikePrices);
1718+
REQUIRE SIZE(Underlyings) == SIZE(BarrierLevels) AND SIZE(Underlyings) == SIZE(KnockInPrices);
1719+
REQUIRE ObservationDate <= SettlementDate;
1720+
1721+
NUMBER indexInitial, indexFinal, performance, d, spot;
1722+
NUMBER worstPerformance, payoff, premium, knockedIn, u, worstUnderlying, worstUnderlyingFinalPrice;
1723+
NUMBER deliverableAsset,fractionalAmount, fractionalCashAmount;
1724+
1725+
worstUnderlying = 1;
1726+
1727+
FOR u IN (1, SIZE(Underlyings), 1) DO
1728+
indexInitial = InitialPrices[u];
1729+
indexFinal = Underlyings[u](ObservationDate);
1730+
performance = indexFinal / indexInitial;
1731+
1732+
IF {u == 1} OR {performance < worstPerformance} THEN
1733+
worstPerformance = performance;
1734+
worstUnderlyingFinalPrice = indexFinal;
1735+
worstUnderlying = u;
1736+
END;
1737+
END;
1738+
1739+
FOR d IN (1, SIZE(ObservationSchedule), 1) DO
1740+
IF knockedIn == 0 THEN
1741+
FOR u IN (1, SIZE(Underlyings), 1) DO
1742+
spot = Underlyings[u](ObservationSchedule[d]);
1743+
IF spot < KnockInPrices[u] THEN
1744+
knockedIn = 1;
1745+
END;
1746+
END;
1747+
END;
1748+
END;
1749+
1750+
IF knockedIn == 1 AND worstUnderlyingFinalPrice < StrikePrices[worstUnderlying] THEN
1751+
deliverableAsset = Quantity/StrikePrices[worstUnderlying];
1752+
fractionalAmount = frac(deliverableAsset);
1753+
fractionalAmount = round(fractionalAmount,4);
1754+
fractionalCashAmount = worstUnderlyingFinalPrice*fractionalAmount;
1755+
payoff = round(fractionalCashAmount,2)+round(deliverableAsset,0);
1756+
ELSE
1757+
IF worstUnderlyingFinalPrice >= BarrierLevels[worstUnderlying] THEN
1758+
payoff = Quantity*(1+max(BonusCoupon, worstPerformance-1));
1759+
ELSE
1760+
payoff = Quantity;
1761+
END;
1762+
END;
1763+
1764+
payoff = LOGPAY(payoff, ObservationDate, SettlementDate, PayCcy, 1, Payoff);
1765+
1766+
Option = LongShort * payoff;
1767+
\end{minted}
1768+
\caption{Payoff script for a WorstPerformanceRainbowOption06.}
1769+
\label{lst:worst_performance_rainbow_option_06}
1770+
\end{listing}
1771+
1772+
The payout formula, determined on the \lstinline!ObservationDate!, is as follows, where
1773+
$worstPerformance$ is the performance, i.e.\ $S_T/S_0$, of the worst-performing asset as
1774+
of the final determination date $T$. The payout for a long put option is as follows:
1775+
1776+
If a knock-in event was triggered and the Final Reference Price of the Worst Performing Underlying
1777+
is below its Strike Price,
1778+
\begin{equation*}
1779+
Payout = \text{\lstinline!Quantity!} * S * \text{FractionalAmount} + \text{round}(\text{fractionalCashAmount})
1780+
\end{equation*}
1781+
with Fractional Amount being the fractional share resulting from the calculation of the Deliverable Assets. $K$ being the strike level of the
1782+
worst underlying performing asset, $S$ that underlying final price.
1783+
\begin{equation*}
1784+
FractionalAmount = \text{\lstinline!Quantity!} / \text{K}
1785+
\end{equation*}
1786+
1787+
The meanings and allowable values for the \lstinline!WorstPerformanceRainbowOption06Data! node below.
1788+
1789+
\begin{itemize}
1790+
\item{}[longShort] \lstinline!LongShort!: Own party position in the option. \\
1791+
Allowable values: \emph{Long, Short}.
1792+
\item{}[index] \lstinline!Underlyings!: The basket of underlyings. \\
1793+
Allowable values: See ore/Docs/ScriptedTrade's Index Section for allowable values.
1794+
\item{}[number] \lstinline!InitialPrices!: The agreed initial price for each basket underlying. \\
1795+
Allowable values: Any positive number.
1796+
\item{}[number] \lstinline!StrikePrices!: The strike prices used within the calculation agent. \\
1797+
Allowable values: Any number.
1798+
\item{}[number] \lstinline!KnockInPrices!: The agreed European knock-in barrier level. \\
1799+
Allowable values: Any number.
1800+
\item{}[number] \lstinline!Quantity!: A quantity multiplier applied to the payoff. \\
1801+
Allowable values: Any number.
1802+
\item{}[number] \lstinline!BarrierLevels!: The agreed barrier level. \\
1803+
Allowable values: Any number.
1804+
\item{}[number] \lstinline!BonusCoupon!: A percentage. \\
1805+
Allowable values: Any number.
1806+
\item{}[event] \lstinline!ObservationDate!: The date on which the final levels of the assets are determined. \\
1807+
Allowable values: See \lstinline!Date! in Table \ref{tab:allow_stand_data}.
1808+
\item{}[event] \lstinline!SettlementDate!: The settlement date for the payoff. \\
1809+
Allowable values: See \lstinline!Date! in Table \ref{tab:allow_stand_data}.
1810+
\item{}[currency] \lstinline!PayCcy!: The payment currency. For FX, where the underlying is provided
1811+
in the form \lstinline!FX-SOURCE-CCY1-CCY2! (see Table \ref{tab:fxindex_data}) this should
1812+
be \lstinline!CCY2!. If \lstinline!CCY1! or the currency of the underlying (for EQ and
1813+
COMM underlyings), this will result in a quanto payoff. The \lstinline!StrikePrices! and \lstinline!BarrierLevels! should be expressed in
1814+
as amount of CCY1 in CCY2.Notice section ``Payment Currency'' in ore/Docs/ScriptedTrade. \\
1815+
Allowable values: See Table \ref{tab:currency} for allowable currency codes.
1816+
\end{itemize}

0 commit comments

Comments
 (0)