Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
cmsspread.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2018 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
23
24#include <boost/make_shared.hpp>
25
26using namespace QuantLib;
27
28namespace ore {
29namespace data {
30
31QuantLib::ext::shared_ptr<FloatingRateCouponPricer>
32CmsSpreadCouponPricerBuilder::engineImpl(const Currency& ccy, const string& index1, const string& index2,
33 const QuantLib::ext::shared_ptr<CmsCouponPricer>& cmsPricer) {
34
35 QuantLib::Handle<QuantExt::CorrelationTermStructure> corrCurve(
36 QuantLib::ext::make_shared<QuantExt::FlatCorrelation>(0, NullCalendar(), 0.0, Actual365Fixed()));
37 try {
38 corrCurve = market_->correlationCurve(index1, index2, configuration(MarketContext::pricing));
39 } catch (...) {
40 WLOG("no correlation curve for " << index1 << ", " << index2 << " found, fall back to zero correlation.");
41 }
42
43 const string& ccyCode = ccy.code();
44 return QuantLib::ext::make_shared<QuantExt::LognormalCmsSpreadPricer>(
45 cmsPricer, corrCurve, market_->discountCurve(ccyCode, configuration(MarketContext::pricing)),
46 parseInteger(engineParameter("IntegrationPoints")));
47}
48
49} // namespace data
50} // namespace ore
QuantLib::ext::shared_ptr< FloatingRateCouponPricer > engineImpl(const Currency &ccy, const string &index1, const string &index2, const QuantLib::ext::shared_ptr< QuantLib::CmsCouponPricer > &cmsPricer) override
Definition: cmsspread.cpp:32
QuantLib::ext::shared_ptr< Market > market_
std::string engineParameter(const std::string &p, const std::vector< std::string > &qualifiers={}, const bool mandatory=true, const std::string &defaultValue="") const
const string & configuration(const MarketContext &key)
Return a configuration (or the default one if key not found)
builder that returns a cms spread coupon pricer
Integer parseInteger(const string &s)
Convert text to QuantLib::Integer.
Definition: parsers.cpp:136
Classes and functions for log message handling.
@ data
Definition: log.hpp:77
#define WLOG(text)
Logging Macro (Level = Warning)
Definition: log.hpp:550
Serializable Credit Default Swap.
Definition: namespaces.docs:23
Map text representations to QuantLib/QuantExt types.