Skip to content

Commit a1d1f44

Browse files
committed
Merge branch 'ghpr_20230907' into 'master'
GitHub PRs 20230907 Closes QPR-11732 See merge request qs/ore!55
2 parents f68745c + 800e1b8 commit a1d1f44

22 files changed

Lines changed: 52 additions & 98 deletions

Docs/UserGuide/allowablevalues.tex

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,16 +251,19 @@ \subsection{Allowable Values}
251251
\emph{A364, Actual/364, Act/364, ACT/364}& Actual 364 \\ \hline
252252
\emph{Actual/365 (No Leap), Act/365 (NL), NL/365, Actual/365 (JGB)} & Actual 365 Fixed (No Leap Year)\\ \hline
253253
\emph{Act/365 (Canadian Bond)} & Actual 365 Fixed (Canadian Bond)\\ \hline
254-
\emph{T360, 30/360, 30/360 (Bond Basis), ACT/nACT, 30/360 US, 30U/360, 30US/360} & Thirty 360 (US) \\ \hline
254+
\emph{T360, 30/360, ACT/nACT, 30/360 US, 30/360 (US), 30U/360, 30US/360} & Thirty 360 (US) \\ \hline
255+
\emph{30/360 (Bond Basis)} & Thirty 360 (Bond Basis) \\ \hline
255256
\emph{30E/360 (Eurobond Basis), 30E/360, 30/360 AIBD (Euro), 30E/360.ICMA, 30E/360 ICMA} & Thirty 360 (European) \\ \hline
256257
\emph{30E/360E, 30E/360 ISDA, 30E/360.ISDA, 30/360 German, 30/360 (German)} & Thirty 360 (German) \\ \hline
257258
\emph{30/360 Italian, 30/360 (Italian)} & Thirty 360 (Italian) \\ \hline
258-
\emph{ActActISDA, ACT/ACT.ISDA, Actual/Actual (ISDA), ActualActual (ISDA), ACT/ACT, ACT} & Actual Actual (ISDA) \\ \hline
259+
\emph{ActActISDA, ACT/ACT.ISDA, Actual/Actual (ISDA), ActualActual (ISDA), ACT/ACT, Act/Act, ACT} & Actual Actual (ISDA) \\ \hline
259260
\emph{ActActISMA, Actual/Actual (ISMA), ActualActual (ISMA), ACT/ACT.ISMA} & Actual Actual (ISMA) \\ \hline
260261
\emph{ActActICMA, Actual/Actual (ICMA), ActualActual (ICMA), ACT/ACT.ICMA} & Actual Actual (ICMA) \\ \hline
261-
\emph{ActActAFB, ACT/ACT.AFB, Actual/Actual (AFB)} & Actual Actual (AFB) \\ \hline
262+
\emph{ActActAFB, ACT/ACT.AFB, Actual/Actual (AFB), ACT29} & Actual Actual (AFB) \\ \hline
262263
\emph{BUS/252, Business/252} & Brazilian Bus/252 \\ \hline
263264
\emph{1/1} & 1/1 \\ \hline
265+
\emph{Simple} & Simple Day Counter \\ \hline
266+
\emph{Year} & Year Counter \\ \hline
264267
\end{tabular}
265268
\caption{Allowable Values for DayCount Convention}
266269
\label{tab:daycount}

Docs/UserGuide/curve_configurations/commodity_volatilities.tex

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,12 @@ \subsubsection{Commodity Volatilities}
303303
\item \lstinline!PutDeltas!:
304304
A comma separated list of one or more put deltas to use in the volatility surface. Note that the put deltas should be given without a sign e.g.\ \lstinline!<PutDeltas>0.10,0.20,0.30,0.40</PutDeltas>! would be an example.
305305

306-
\item \lstinline!PutDeltas!:
306+
\item \lstinline!CallDeltas!:
307307
A comma separated list of one or more call deltas to use in the volatility surface.
308308

309+
\item \lstinline!Expiries!:
310+
A comma separated list of one or more expiries (e.g. 1W, 1M) to load. Supports using the single wildcard value \lstinline!*!.
311+
309312
\item \lstinline!TimeInterpolation!:
310313
Only \lstinline!Linear! is currently supported here.
311314

Docs/UserGuide/curve_configurations/yieldcurves.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ \subsubsection{Yield Curves}
1313
<Segments> </Segments>
1414
<InterpolationVariable> </InterpolationVariable>
1515
<InterpolationMethod> </InterpolationMethod>
16-
<ZeroDayCounter> </ZeroDayCounter>
16+
<YieldCurveDayCounter> </YieldCurveDayCounter>
1717
<Tolerance> </Tolerance>
1818
<Extrapolation> </Extrapolation>
1919
<BootstrapConfig>
@@ -40,7 +40,7 @@ \subsubsection{Yield Curves}
4040
\emph{Discount}.
4141
\item InterpolationMethod [Optional]: The interpolation method to use. The allowable values are given in Table
4242
\ref{tab:allow_interp_methods}. If the element is omitted or left blank, then it defaults to \emph{LogLinear}.
43-
\item ZeroDayCounter [Optional]: The day count basis used internally by the yield curve to calculate the time between
43+
\item YieldCurveDayCounter [Optional]: The day count basis used internally by the yield curve to calculate the time between
4444
dates. In particular, if the curve is queried for a zero rate without specifying the day count basis, the zero rate that
4545
is returned has this basis. If the element is omitted or left blank, then it defaults to \emph{A365}.
4646

Docs/UserGuide/tradedata/commodityapo.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ \subsubsection{Commodity Average Price Option}
2727

2828
Allowable values: See \lstinline!Name! for commodity trades in Table \ref{tab:commodity_data}.
2929

30-
\item \lstinline!Currency!: The currency of the payoff which must be consistent with either currency of the market data set up for the commodity or the other currency specified in !lstinline!FXIndex! (see below).
30+
\item \lstinline!Currency!: The currency of the payoff which must be consistent with either currency of the market data set up for the commodity or the other currency specified in \lstinline!FXIndex! (see below).
3131

3232
Allowable values: See \lstinline!Currency! in Table \ref{tab:allow_stand_data}.
3333

QuantExt/qle/instruments/brlcdiswap.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#include <qle/instruments/brlcdiswap.hpp>
2020

21-
#include <boost/assign/list_of.hpp>
2221
#include <ql/cashflows/overnightindexedcoupon.hpp>
2322
#include <ql/cashflows/simplecashflow.hpp>
2423
#include <ql/time/daycounters/business252.hpp>
@@ -27,18 +26,15 @@
2726
#include <qle/cashflows/couponpricer.hpp>
2827

2928
using namespace QuantLib;
30-
using boost::assign::list_of;
3129
using std::pow;
3230
using std::vector;
3331

3432
namespace QuantExt {
3533

36-
// Reason for use of convert_to_container:
37-
// https://stackoverflow.com/a/17805923/1771882
3834
BRLCdiSwap::BRLCdiSwap(Type type, Real nominal, const Date& startDate, const Date& endDate, Rate fixedRate,
3935
const boost::shared_ptr<BRLCdi>& overnightIndex, Spread spread, bool telescopicValueDates)
4036
: OvernightIndexedSwap(type, nominal,
41-
Schedule(list_of(startDate)(endDate).convert_to_container<vector<Date> >(), NullCalendar(),
37+
Schedule({startDate, endDate}, NullCalendar(),
4238
QuantLib::Unadjusted, QuantLib::Unadjusted, 100 * Years),
4339
fixedRate, overnightIndex->dayCounter(), overnightIndex, spread, 0, ModifiedFollowing,
4440
overnightIndex->fixingCalendar(), telescopicValueDates),
@@ -68,9 +64,9 @@ Real BRLCdiSwap::fixedLegBPS() const {
6864

6965
calculate();
7066

71-
static Spread basisPoint = 1.0e-4;
67+
const Spread basisPoint = 1.0e-4;
7268
if (!close(endDiscounts_[0], 0.0) && endDiscounts_[0] != Null<DiscountFactor>()) {
73-
DiscountFactor df = endDiscounts_[0];
69+
DiscountFactor df = payer_[0] * endDiscounts_[0];
7470
Time dcf = index_->dayCounter().yearFraction(startDate_, endDate_);
7571
legBPS_[0] = df * nominal() * (pow(1.0 + fixedRate() + basisPoint, dcf) - pow(1.0 + fixedRate(), dcf));
7672
return legBPS_[0];
@@ -84,7 +80,7 @@ Real BRLCdiSwap::fairRate() const {
8480
calculate();
8581

8682
if (!close(endDiscounts_[0], 0.0) && endDiscounts_[0] != Null<DiscountFactor>()) {
87-
DiscountFactor df = endDiscounts_[0];
83+
DiscountFactor df = -payer_[0] * endDiscounts_[0];
8884
Time dcf = index_->dayCounter().yearFraction(startDate_, endDate_);
8985
return pow(overnightLegNPV() / (nominal() * df) + 1.0, 1.0 / dcf) - 1.0;
9086
}

QuantExt/qle/models/linkablecalibratedmodel.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,22 @@
1919
#include <ql/math/optimization/problem.hpp>
2020
#include <ql/math/optimization/projectedconstraint.hpp>
2121
#include <ql/math/optimization/projection.hpp>
22+
#include <ql/utilities/null_deleter.hpp>
2223
#include <qle/models/linkablecalibratedmodel.hpp>
2324

2425
using boost::shared_ptr;
2526
using std::vector;
2627

2728
namespace QuantExt {
2829

29-
namespace {
30-
void no_deletion(void*) {}
31-
} // namespace
32-
3330
LinkableCalibratedModel::LinkableCalibratedModel()
3431
: constraint_(new PrivateConstraint(arguments_)), endCriteria_(EndCriteria::None) {}
3532

3633
class LinkableCalibratedModel::CalibrationFunction : public CostFunction {
3734
public:
3835
CalibrationFunction(LinkableCalibratedModel* model, const vector<shared_ptr<CalibrationHelper> >& h,
3936
const vector<Real>& weights, const Projection& projection)
40-
: model_(model, no_deletion), instruments_(h), weights_(weights), projection_(projection) {}
37+
: model_(model, null_deleter()), instruments_(h), weights_(weights), projection_(projection) {}
4138

4239
virtual ~CalibrationFunction() {}
4340

QuantExt/qle/pricingengines/discountingfxforwardengine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void DiscountingFxForwardEngine::calculate() const {
147147

148148
results_.value = (tmpPayCurrency1 ? -1.0 : 1.0) * discFar / discNear * (tmpNominal1 / fx1 - tmpNominal2 / fx2);
149149

150-
results_.npv = Money(arguments_.payCcy, results_.value);
150+
results_.npv = Money(settleCcy, results_.value);
151151

152152
results_.fairForwardRate = ExchangeRate(ccy2_, ccy1_, fxfwd);
153153
results_.additionalResults["fairForwardRate"] = fxfwd;

QuantExt/qle/termstructures/averageoisratehelper.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@
1616
FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
1717
*/
1818

19+
#include <ql/utilities/null_deleter.hpp>
1920
#include <qle/instruments/makeaverageois.hpp>
2021
#include <qle/termstructures/averageoisratehelper.hpp>
2122

2223
namespace QuantExt {
2324

24-
namespace {
25-
void no_deletion(YieldTermStructure*) {}
26-
} // namespace
27-
2825
AverageOISRateHelper::AverageOISRateHelper(const Handle<Quote>& fixedRate, const Period& spotLagTenor,
2926
const Period& swapTenor,
3027
// Fixed leg
@@ -95,7 +92,7 @@ Real AverageOISRateHelper::impliedQuote() const {
9592
void AverageOISRateHelper::setTermStructure(YieldTermStructure* t) {
9693

9794
bool observer = false;
98-
boost::shared_ptr<YieldTermStructure> temp(t, no_deletion);
95+
boost::shared_ptr<YieldTermStructure> temp(t, null_deleter());
9996
termStructureHandle_.linkTo(temp, observer);
10097

10198
if (discountHandle_.empty())

QuantExt/qle/termstructures/basistwoswaphelper.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,11 @@
1919
#include <ql/cashflows/floatingratecoupon.hpp>
2020
#include <ql/cashflows/iborcoupon.hpp>
2121
#include <ql/instruments/makevanillaswap.hpp>
22+
#include <ql/utilities/null_deleter.hpp>
2223
#include <qle/termstructures/basistwoswaphelper.hpp>
2324

2425
namespace QuantExt {
2526

26-
namespace {
27-
void no_deletion(YieldTermStructure*) {}
28-
} // namespace
29-
3027
BasisTwoSwapHelper::BasisTwoSwapHelper(const Handle<Quote>& spread, const Period& swapTenor, const Calendar& calendar,
3128
// Long tenor swap
3229
Frequency longFixedFrequency, BusinessDayConvention longFixedConvention,
@@ -120,7 +117,7 @@ void BasisTwoSwapHelper::setTermStructure(YieldTermStructure* t) {
120117

121118
bool observer = false;
122119

123-
boost::shared_ptr<YieldTermStructure> temp(t, no_deletion);
120+
boost::shared_ptr<YieldTermStructure> temp(t, null_deleter());
124121
termStructureHandle_.linkTo(temp, observer);
125122

126123
if (discountHandle_.empty())

QuantExt/qle/termstructures/brlcdiratehelper.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,12 @@
1717
*/
1818

1919
#include <ql/pricingengines/swap/discountingswapengine.hpp>
20+
#include <ql/utilities/null_deleter.hpp>
2021
#include <qle/instruments/brlcdiswap.hpp>
2122
#include <qle/termstructures/brlcdiratehelper.hpp>
2223

2324
using namespace QuantLib;
2425

25-
namespace {
26-
void no_deletion(YieldTermStructure*) {}
27-
} // namespace
28-
2926
namespace QuantExt {
3027

3128
BRLCdiRateHelper::BRLCdiRateHelper(const Period& swapTenor, const Handle<Quote>& fixedRate,
@@ -80,7 +77,7 @@ void BRLCdiRateHelper::initializeDates() {
8077
void BRLCdiRateHelper::setTermStructure(YieldTermStructure* t) {
8178

8279
bool observer = false;
83-
boost::shared_ptr<YieldTermStructure> temp(t, no_deletion);
80+
boost::shared_ptr<YieldTermStructure> temp(t, null_deleter());
8481
termStructureHandle_.linkTo(temp, observer);
8582

8683
if (discountHandle_.empty())
@@ -138,7 +135,7 @@ DatedBRLCdiRateHelper::DatedBRLCdiRateHelper(const Date& startDate, const Date&
138135
void DatedBRLCdiRateHelper::setTermStructure(YieldTermStructure* t) {
139136

140137
bool observer = false;
141-
boost::shared_ptr<YieldTermStructure> temp(t, no_deletion);
138+
boost::shared_ptr<YieldTermStructure> temp(t, null_deleter());
142139
termStructureHandle_.linkTo(temp, observer);
143140

144141
if (discountHandle_.empty())

0 commit comments

Comments
 (0)