Skip to content

Commit 4401a7e

Browse files
author
jenkins
committed
git subrepo pull (merge) ore
subrepo: subdir: "ore" merged: "7a88d02248" upstream: origin: "git@gitlab.acadiasoft.net:qs/ore.git" branch: "master" commit: "a45903c51c" git-subrepo: version: "0.4.6" origin: "https://github.com/ingydotnet/git-subrepo" commit: "73a0129"
2 parents e8fd531 + a45903c commit 4401a7e

345 files changed

Lines changed: 1864 additions & 1408 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/ComputeEnvironment/computeenvironment.tex

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ \subsection{Implementation of the ComputeContext interface}\label{implComputeCon
277277
operations is described in \ref{randomVariableOpCodes}
278278
\item \verb+freeVariable()+: indicate that the variable with the given id will no longer be referenced in subsequent
279279
calculations. The variable id can be reused as a new variable.
280-
\item \verb+declareOutputVariable()+: declare a variable with given id as part of the output vector
280+
\item \verb+declareOutputVariable()+: declare a variable with given id as part of the output vector.
281281
\item \verb+finalizeCalculation()+: execute the calculation and populate the given vector of vector of floats with the
282282
result. The inner vector is given as a raw pointer and must have the size of the calculation. The outer vector matches
283283
the output variables in the order they were declared before.
@@ -289,12 +289,17 @@ \subsection{Implementation of the ComputeContext interface}\label{implComputeCon
289289

290290
\begin{enumerate}
291291
\item \verb+initiateCalculation()+: once
292-
\item \verb+createInputVariable()+: never, once, or several times
293-
\item \verb+createInputVariates()+: never, once, or several times
294-
\item \verb+applyOperation()+: only called if the current calculation is not replayed from a previous calculation, then can be called never, once, or several times
295-
\item \verb+freeVariable()+: only called if the current calculation is not replayed, then can be called never, once, or several times
296-
\item \verb+declareOutputVariable()+: only called if the current calculation is not replayed, then can be called never, once, or several times
297-
\item \verb+finalizeCalculation()+: never or once
292+
\item \verb+createInputVariable()+: never, once, or several times, if a calc is replayed, the same number and type of
293+
input variables must be created (just with possibly different values)
294+
\item \verb+createInputVariates()+: called if the current calculation is not replayed from a previous calculation, then
295+
can be called never, once or several times
296+
\item \verb+applyOperation()+: only called if the current calculation is not replayed from a previous calculation, then
297+
can be called never, once, or several times
298+
\item \verb+freeVariable()+: only called if the current calculation is not replayed, then can be called never, once, or
299+
several times
300+
\item \verb+declareOutputVariable()+: only called if the current calculation is not replayed, then can be called never,
301+
once, or several times
302+
\item \verb+finalizeCalculation()+: once
298303
\end{enumerate}
299304

300305
\subsection{Random Variable Op Codes}\label{randomVariableOpCodes}
@@ -417,16 +422,17 @@ \subsection{Populating the input variables}
417422

418423
\subsection{Populating the input variates}
419424

420-
The next step is the creating of random variates
425+
The next step is the creating of random variates (if this is a new calculation and not replayed):
421426

422427
\begin{minted}[fontsize=\footnotesize]{xml}
423-
auto gen = ComputeEnvironment::instance().context()
424-
.createInputVariates(rv.size(),
425-
rv.front().size(),
426-
42);
427-
for (Size k = 0; k < rv.size(); ++k) {
428-
for (Size j = 0; j < rv.front().size(); ++j)
429-
valuesExternal[rv[k][j]] = ExternalRandomVariable(gen[k][j]);
428+
if (useExternalComputeFramework_ && newExternalCalc) {
429+
auto gen =
430+
ComputeEnvironment::instance().context().
431+
createInputVariates(rv.size(), rv.front().size(), 42);
432+
for (Size k = 0; k < rv.size(); ++k) {
433+
for (Size j = 0; j < rv.front().size(); ++j)
434+
valuesExternal[rv[k][j]] = ExternalRandomVariable(gen[k][j]);
435+
}
430436
}
431437
\end{minted}
432438

Docs/UserGuide/curve_configurations/yieldcurves.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ \subsubsection*{Fitted Bond Segment}
456456
</Quotes>
457457
<!-- mapping of Ibor curves used in the bonds from which the curve is built -->
458458
<IborIndexCurves>
459-
<IborIndexCurve iborIndex="EUR-EURIBOR-6M">EUR-EURIBOR-6M</IborIndexCurve>
459+
<IborIndexCurve iborIndex="EUR-EURIBOR-6M">EUR6M</IborIndexCurve>
460460
</IborIndexCurves>
461461
<!-- flat extrapolation before first and after last bond maturity -->
462462
<ExtrapolateFlat>true</ExtrapolateFlat>

Docs/UserGuide/marketdata.tex

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,31 @@ \subsection{Bond Yield Spreads}
14431443
\item BOND/YIELD\_SPREAD/SECURITY\_1
14441444
\end{itemize}
14451445

1446+
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1447+
\subsection{Bond Prices}
1448+
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1449+
1450+
\begin{table}[H]
1451+
\centering
1452+
\begin{tabular}{|p{3cm}|p{3.5cm}|p{7cm}|}
1453+
\hline
1454+
{\bf Property} & {\bf Allowable values} & {\bf Description} \\ \hline
1455+
Instrument Type & \emph{BOND} & \\ \hline
1456+
Quote Type & \emph{PRICE} & \\ \hline
1457+
Name & String & Identifying name of the bond \\ \hline
1458+
\end{tabular}
1459+
\caption{Bond Prices}
1460+
\label{tab:bondprice_quote}
1461+
\end{table}
1462+
1463+
This quote provides the clean price for a specified bond in units.
1464+
1465+
\medskip
1466+
Examples:
1467+
\begin{itemize}
1468+
\item BOND/PRICE/SECURITY\_1
1469+
\end{itemize}
1470+
14461471
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14471472
\subsection{Base Correlations}
14481473
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Docs/UserGuide/tradedata/bond.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ \subsubsection{Bond}
6060
An alphanumeric string of the form [CCY]-[INDEX]-[TERM]. CCY, INDEX and TERM must be separated by dashes (-). CCY and INDEX must be among the supported currency and index combinations. TERM must be an integer followed by D, W, M or Y. See Table \ref{tab:indices}.
6161

6262
For currencies without available ibor indices: \\
63-
An alphanumeric string of the form [CCY]BENCHMARK-[CCY]-TERM, matching a benchmark curve set up in the market data configuration.
63+
An alphanumeric string, matching a benchmark curve set up in the market data configuration in {\tt todaysmarket.xml} Yield curves section.
6464

6565
Examples: IDRBENCHMARK-IDR-3M, EGPBENCHMARK-EGP-3M, UAHBENCHMARK-UAH-3M, NGNBENCHMARK-NGN-3M
6666

Docs/UserGuide/userguide.tex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2132,7 +2132,7 @@ \subsection{Bonds and Amortisation Structures}% Example 18
21322132
%--------------------------------------------------------
21332133

21342134
The example in folder {\tt Examples/Example\_18} computes NPVs and cash flow projections for a vanilla bond portfolio
2135-
consisting of a range of bond products, in particular demonstrating amortisation features:
2135+
consisting of a range of bond products, in particular demonstrating amortisation features. Also, pricing using a benchmark bond price curve (bond definitions in referencedata.xml) is demonstrated:
21362136
\begin{itemize}
21372137
\item fixed rate bond
21382138
\item floating rate bond linked to Euribor 6M
@@ -2143,6 +2143,7 @@ \subsection{Bonds and Amortisation Structures}% Example 18
21432143
\item bond with fixed annuity amortisation
21442144
\item bond with floating annuity amortisation (this example needs QuantLib 1.10 or higher to work, in particular the amount() method in the Coupon class needs to be virtual)
21452145
\item bond with fixed amount amortisation followed by percentage amortisation relative to previous notional
2146+
\item fixed rate bond using a benchmark bond price curve instead of the benchmark yield curve
21462147
\end{itemize}
21472148

21482149
After running the example, the results of the computation can be found in the output files {\tt npv.csv} and {\tt

Examples/Example_18/ExpectedOutput/flows.csv

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ Bond_Fixed_Then_Floating,Bond,13,0,2025-02-03,InterestProjected,147307.5573,EUR,
100100
Bond_Fixed_Then_Floating,Bond,14,0,2025-08-04,InterestProjected,147637.7985,EUR,0.0296086794,0.4986301370,2025-02-03,2025-08-04,0.0000,2025-01-30,0.0196086794,10000000.0000,0.8286266420,122336.6132292770,1.0000000000,122336.6132292770,EUR,#N/A,#N/A,#N/A,#N/A
101101
Bond_Fixed_Then_Floating,Bond,15,0,2026-02-03,InterestProjected,148451.6639,EUR,0.0296092117,0.5013698630,2025-08-04,2026-02-03,0.0000,2025-07-31,0.0196097440,10000000.0000,0.8204483993,121796.9300410371,1.0000000000,121796.9300410371,EUR,#N/A,#N/A,#N/A,#N/A
102102
Bond_Fixed_Then_Floating,Bond,16,0,2026-02-03,Notional,10000000.0000,EUR,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,0.8204483993,8204483.9926123777,1.0000000000,8204483.9926123777,EUR,#N/A,#N/A,#N/A,#N/A
103+
Bond_Fixed_using_BMBond_curve_Pricing,Bond,1,0,2017-02-03,Interest,500123.5122,EUR,0.0500000000,1.0002470245,2016-02-03,2017-02-03,2732.2404,#N/A,#N/A,10000000.0000,1.0036811234,501964.5286144280,1.0000000000,501964.5286144280,EUR,#N/A,#N/A,#N/A,#N/A
104+
Bond_Fixed_using_BMBond_curve_Pricing,Bond,2,0,2018-02-05,Interest,502739.7260,EUR,0.0500000000,1.0054794521,2017-02-03,2018-02-05,0.0000,#N/A,#N/A,10000000.0000,1.0074063046,506463.1695560819,1.0000000000,506463.1695560819,EUR,#N/A,#N/A,#N/A,#N/A
105+
Bond_Fixed_using_BMBond_curve_Pricing,Bond,3,0,2019-02-04,Interest,498630.1370,EUR,0.0500000000,0.9972602740,2018-02-05,2019-02-04,0.0000,#N/A,#N/A,10000000.0000,1.0111146915,504172.2571370929,1.0000000000,504172.2571370929,EUR,#N/A,#N/A,#N/A,#N/A
106+
Bond_Fixed_using_BMBond_curve_Pricing,Bond,4,0,2020-02-03,Interest,498506.6247,EUR,0.0500000000,0.9970132495,2019-02-04,2020-02-03,0.0000,#N/A,#N/A,10000000.0000,1.0388538629,517875.5327880877,1.0000000000,517875.5327880877,EUR,#N/A,#N/A,#N/A,#N/A
107+
Bond_Fixed_using_BMBond_curve_Pricing,Bond,5,0,2021-02-03,Interest,500123.5122,EUR,0.0500000000,1.0002470245,2020-02-03,2021-02-03,0.0000,#N/A,#N/A,10000000.0000,1.0482657535,524262.3503842037,1.0000000000,524262.3503842037,EUR,#N/A,#N/A,#N/A,#N/A
108+
Bond_Fixed_using_BMBond_curve_Pricing,Bond,6,0,2021-02-03,Notional,10000000.0000,EUR,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,#N/A,1.0482657535,10482657.5346797928,1.0000000000,10482657.5346797928,EUR,#N/A,#N/A,#N/A,#N/A
103109
Bond_Floating,Bond,1,0,2016-08-03,Interest,50224.0437,EUR,0.0101000000,0.4972677596,2016-02-03,2016-08-03,551.9126,2016-02-01,0.0001000000,10000000.0000,0.9900995527,49726.8032160310,1.0000000000,49726.8032160310,EUR,#N/A,#N/A,#N/A,#N/A
104110
Bond_Floating,Bond,2,0,2017-02-03,InterestProjected,148293.6367,EUR,0.0294830517,0.5029792649,2016-08-03,2017-02-03,0.0000,2016-08-01,0.0194830517,10000000.0000,0.9803373492,145377.7907112182,1.0000000000,145377.7907112182,EUR,#N/A,#N/A,#N/A,#N/A
105111
Bond_Floating,Bond,3,0,2017-08-03,InterestProjected,146109.2400,EUR,0.0294640180,0.4958904110,2017-02-03,2017-08-03,0.0000,2017-02-01,0.0194640180,10000000.0000,0.9708366681,141848.2077635486,1.0000000000,141848.2077635486,EUR,#N/A,#N/A,#N/A,#N/A

Examples/Example_18/ExpectedOutput/npv.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ Bond_Amortizing_Floating_Annuity,Bond,2021-02-03,4.994783,10233214.908861,EUR,10
1717
FwdBond_Amortizing_Floating_Annuity,ForwardBond,2021-02-03,4.994783,21532.889785,EUR,21532.889785,EUR,10000000.00,EUR,10000000.00,,CPTY_C
1818
Bond_Amortizing_FixedAmount_PercentagePrevious,Bond,2026-02-03,9.994783,11884303.320039,EUR,11884303.320039,EUR,10000000.00,EUR,10000000.00,,CPTY_C
1919
FwdBond_Amortizing_FixedAmount_PercentagePrevious,ForwardBond,2026-02-03,9.994783,1986043.880658,EUR,1986043.880658,EUR,10000000.00,EUR,10000000.00,,CPTY_C
20+
Bond_Fixed_using_BMBond_curve_Pricing,Bond,2021-02-03,4.994783,13037395.373160,EUR,13037395.373160,EUR,10000000.00,EUR,10000000.00,,CPTY_C

Examples/Example_18/Input/ore.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<Parameter name="pricingEnginesFile">../../Input/pricingengine.xml</Parameter>
1616
<Parameter name="portfolioFile">portfolio.xml</Parameter>
1717
<Parameter name="observationModel">Disable</Parameter>
18+
<Parameter name="referenceDataFile">referencedata.xml</Parameter>
1819
</Setup>
1920
<Markets>
2021
<Parameter name="lgmcalibration">libor</Parameter>

Examples/Example_18/Input/portfolio.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,4 +1125,49 @@
11251125
<LongInForward>true</LongInForward>
11261126
</ForwardBondData>
11271127
</Trade>
1128+
<Trade id="Bond_Fixed_using_BMBond_curve_Pricing">
1129+
<TradeType>Bond</TradeType>
1130+
<Envelope>
1131+
<CounterParty>CPTY_C</CounterParty>
1132+
<NettingSetId/>
1133+
<AdditionalFields/>
1134+
</Envelope>
1135+
<BondData>
1136+
<IssuerId>CPTY_C</IssuerId>
1137+
<SecurityId>SECURITY_1</SecurityId>
1138+
<ReferenceCurveId>BENCHMARK-EUR-6M</ReferenceCurveId>
1139+
<SettlementDays>2</SettlementDays>
1140+
<Calendar>TARGET</Calendar>
1141+
<IssueDate>20160203</IssueDate>
1142+
<LegData>
1143+
<LegType>Fixed</LegType>
1144+
<Payer>false</Payer>
1145+
<Currency>EUR</Currency>
1146+
<Notionals>
1147+
<Notional>10000000.000000</Notional>
1148+
</Notionals>
1149+
<DayCounter>ACT/ACT</DayCounter>
1150+
<PaymentConvention>F</PaymentConvention>
1151+
<FixedLegData>
1152+
<Rates>
1153+
<Rate>0.05</Rate>
1154+
</Rates>
1155+
</FixedLegData>
1156+
<ScheduleData>
1157+
<Rules>
1158+
<StartDate>20160203</StartDate>
1159+
<EndDate>20210203</EndDate>
1160+
<Tenor>1Y</Tenor>
1161+
<Calendar>TARGET</Calendar>
1162+
<Convention>F</Convention>
1163+
<TermConvention>F</TermConvention>
1164+
<Rule>Forward</Rule>
1165+
<EndOfMonth/>
1166+
<FirstDate/>
1167+
<LastDate/>
1168+
</Rules>
1169+
</ScheduleData>
1170+
</LegData>
1171+
</BondData>
1172+
</Trade>
11281173
</Portfolio>
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<ReferenceData>
3+
<ReferenceDatum id="SECURITY_2">
4+
<Type>Bond</Type>
5+
<BondReferenceData>
6+
<IssuerId></IssuerId>
7+
<CreditCurveId></CreditCurveId>
8+
<ReferenceCurveId>EUR-EURIBOR-6M</ReferenceCurveId>
9+
<SettlementDays>2</SettlementDays>
10+
<Calendar>TARGET</Calendar>
11+
<IssueDate>07.10.2014</IssueDate>
12+
<LegData>
13+
<LegType>Fixed</LegType>
14+
<Payer>false</Payer>
15+
<Currency>EUR</Currency>
16+
<Notionals>
17+
<Notional>1.0</Notional>
18+
</Notionals>
19+
<DayCounter>30/360</DayCounter>
20+
<PaymentConvention>F</PaymentConvention>
21+
<FixedLegData>
22+
<Rates>
23+
<Rate>0.0025</Rate>
24+
</Rates>
25+
</FixedLegData>
26+
<ScheduleData>
27+
<Rules>
28+
<StartDate>07.10.2014</StartDate>
29+
<EndDate>18.10.2019</EndDate>
30+
<Rule>Backward</Rule>
31+
<Tenor>1Y</Tenor>
32+
<Calendar>TARGET</Calendar>
33+
<Convention>F</Convention>
34+
<TermConvention>F</TermConvention>
35+
</Rules>
36+
</ScheduleData>
37+
</LegData>
38+
</BondReferenceData>
39+
</ReferenceDatum>
40+
<ReferenceDatum id="SECURITY_3">
41+
<Type>Bond</Type>
42+
<BondReferenceData>
43+
<IssuerId></IssuerId>
44+
<CreditCurveId></CreditCurveId>
45+
<ReferenceCurveId>EUR-EURIBOR-6M</ReferenceCurveId>
46+
<IncomeCurveId/>
47+
<SettlementDays>2</SettlementDays>
48+
<Calendar>TARGET</Calendar>
49+
<IssueDate>23.06.2015</IssueDate>
50+
<LegData>
51+
<LegType>Fixed</LegType>
52+
<Payer>false</Payer>
53+
<Currency>EUR</Currency>
54+
<Notionals>
55+
<Notional>1.0</Notional>
56+
</Notionals>
57+
<DayCounter>30/360</DayCounter>
58+
<PaymentConvention>F</PaymentConvention>
59+
<FixedLegData>
60+
<Rates>
61+
<Rate>0.012</Rate>
62+
</Rates>
63+
</FixedLegData>
64+
<ScheduleData>
65+
<Rules>
66+
<StartDate>23.06.2015</StartDate>
67+
<EndDate>20.10.2025</EndDate>
68+
<Rule>Backward</Rule>
69+
<Tenor>1Y</Tenor>
70+
<Calendar>TARGET</Calendar>
71+
<Convention>F</Convention>
72+
<TermConvention>F</TermConvention>
73+
</Rules>
74+
</ScheduleData>
75+
</LegData>
76+
</BondReferenceData>
77+
</ReferenceDatum>
78+
<ReferenceDatum id="SECURITY_4">
79+
<Type>Bond</Type>
80+
<BondReferenceData>
81+
<IssuerId></IssuerId>
82+
<CreditCurveId></CreditCurveId>
83+
<ReferenceCurveId>EUR-EURIBOR-6M</ReferenceCurveId>
84+
<SettlementDays>2</SettlementDays>
85+
<Calendar>TARGET</Calendar>
86+
<IssueDate>23.02.2016</IssueDate>
87+
<LegData>
88+
<LegType>Fixed</LegType>
89+
<Payer>false</Payer>
90+
<Currency>EUR</Currency>
91+
<Notionals>
92+
<Notional>1.0</Notional>
93+
</Notionals>
94+
<DayCounter>30/360</DayCounter>
95+
<PaymentConvention>F</PaymentConvention>
96+
<FixedLegData>
97+
<Rates>
98+
<Rate>0.0075</Rate>
99+
</Rates>
100+
</FixedLegData>
101+
<ScheduleData>
102+
<Rules>
103+
<StartDate>23.02.2016</StartDate>
104+
<EndDate>20.10.2026</EndDate>
105+
<Rule>Backward</Rule>
106+
<Tenor>1Y</Tenor>
107+
<Calendar>TARGET</Calendar>
108+
<Convention>F</Convention>
109+
<TermConvention>F</TermConvention>
110+
</Rules>
111+
</ScheduleData>
112+
</LegData>
113+
</BondReferenceData>
114+
</ReferenceDatum>
115+
<ReferenceDatum id="SECURITY_5">
116+
<Type>Bond</Type>
117+
<BondReferenceData>
118+
<IssuerId></IssuerId>
119+
<CreditCurveId></CreditCurveId>
120+
<ReferenceCurveId>EUR-EURIBOR-6M</ReferenceCurveId>
121+
<IncomeCurveId/>
122+
<SettlementDays>2</SettlementDays>
123+
<Calendar>TARGET</Calendar>
124+
<IssueDate>23.02.2016</IssueDate>
125+
<LegData>
126+
<LegType>Fixed</LegType>
127+
<Payer>false</Payer>
128+
<Currency>EUR</Currency>
129+
<Notionals>
130+
<Notional>1.0</Notional>
131+
</Notionals>
132+
<DayCounter>30/360</DayCounter>
133+
<PaymentConvention>F</PaymentConvention>
134+
<FixedLegData>
135+
<Rates>
136+
<Rate>0.015</Rate>
137+
</Rates>
138+
</FixedLegData>
139+
<ScheduleData>
140+
<Rules>
141+
<StartDate>23.02.2016</StartDate>
142+
<EndDate>20.02.2047</EndDate>
143+
<Rule>Backward</Rule>
144+
<Tenor>1Y</Tenor>
145+
<Calendar>TARGET</Calendar>
146+
<Convention>F</Convention>
147+
<TermConvention>F</TermConvention>
148+
</Rules>
149+
</ScheduleData>
150+
</LegData>
151+
</BondReferenceData>
152+
</ReferenceDatum>
153+
</ReferenceData>

0 commit comments

Comments
 (0)