|
30 | 30 | #include <orea/aggregation/dimregressioncalculator.hpp> |
31 | 31 |
|
32 | 32 | #include <ored/marketdata/todaysmarket.hpp> |
| 33 | +#include <ored/marketdata/bondspreadimply.hpp> |
33 | 34 | #include <ored/portfolio/builders/currencyswap.hpp> |
34 | 35 | #include <ored/portfolio/builders/fxoption.hpp> |
35 | 36 | #include <ored/portfolio/builders/multilegoption.hpp> |
@@ -242,5 +243,28 @@ void MarketDataAnalyticImpl::runAnalytic( |
242 | 243 | CONSOLE("OK"); |
243 | 244 | } |
244 | 245 |
|
| 246 | +boost::shared_ptr<Loader> implyBondSpreads(const Date& asof, |
| 247 | + const boost::shared_ptr<ore::analytics::InputParameters>& params, |
| 248 | + const boost::shared_ptr<TodaysMarketParameters>& todaysMarketParams, |
| 249 | + const boost::shared_ptr<Loader>& loader, |
| 250 | + const boost::shared_ptr<CurveConfigurations>& curveConfigs, |
| 251 | + const std::string& excludeRegex) { |
| 252 | + |
| 253 | + auto securities = BondSpreadImply::requiredSecurities(asof, todaysMarketParams, curveConfigs, *loader, |
| 254 | + true, excludeRegex); |
| 255 | + |
| 256 | + if (!securities.empty()) { |
| 257 | + // always continue on error and always use lazy market building |
| 258 | + boost::shared_ptr<Market> market = |
| 259 | + boost::make_shared<TodaysMarket>(asof, todaysMarketParams, loader, curveConfigs, true, true, true, |
| 260 | + params->refDataManager(), false, *params->iborFallbackConfig()); |
| 261 | + return BondSpreadImply::implyBondSpreads(securities, params->refDataManager(), market, params->pricingEngine(), |
| 262 | + Market::defaultConfiguration, *params->iborFallbackConfig()); |
| 263 | + } else { |
| 264 | + // no bonds that require a spread imply => return null ptr |
| 265 | + return boost::shared_ptr<Loader>(); |
| 266 | + } |
| 267 | +} |
| 268 | + |
245 | 269 | } // namespace analytics |
246 | 270 | } // namespace ore |
0 commit comments