Skip to content

Commit 7488493

Browse files
author
jenkins
committed
git subrepo pull (merge) ore
subrepo: subdir: "ore" merged: "ebf3c58134" upstream: origin: "git@gitlab.acadiasoft.net:qs/ore.git" branch: "master" commit: "094627784c" git-subrepo: version: "0.4.6" origin: "https://github.com/ingydotnet/git-subrepo" commit: "110b9eb"
2 parents 44e76c6 + 0946277 commit 7488493

60 files changed

Lines changed: 1606 additions & 918 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

OREAnalytics/orea/app/oreapp.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,7 @@ boost::shared_ptr<AggregationScenarioData> OREApp::getMarketCube(std::string cub
156156
}
157157

158158
std::vector<std::string> OREApp::getErrors() {
159-
std::vector<std::string> errors;
160-
while (fbLogger_ && fbLogger_->logger->hasNext())
161-
errors.push_back(fbLogger_->logger->next());
162-
return errors;
159+
return structuredLogger_->messages();
163160
}
164161

165162
Real OREApp::getRunTime() {
@@ -383,6 +380,7 @@ void OREApp::run() {
383380
runTimer_.start();
384381

385382
try {
383+
structuredLogger_->clear();
386384
analytics();
387385
} catch (std::exception& e) {
388386
StructuredAnalyticsWarningMessage("OREApp::run()", "Error", e.what()).log();
@@ -403,6 +401,7 @@ void OREApp::run(const std::vector<std::string>& marketData,
403401

404402
try {
405403
LOG("ORE analytics starting");
404+
structuredLogger_->clear();
406405
MEM_LOG_USING_LEVEL(ORE_WARNING)
407406

408407
QL_REQUIRE(inputs_, "ORE input parameters not set");
@@ -1411,8 +1410,6 @@ void OREApp::setupLog(const std::string& path, const std::string& file, Size mas
14111410
QL_REQUIRE(boost::filesystem::is_directory(p), "output path '" << path << "' is not a directory.");
14121411

14131412
Log::instance().registerLogger(boost::make_shared<FileLogger>(file));
1414-
// Report StructuredErrorMessages with level WARNING, ERROR, CRITICAL, ALERT
1415-
fbLogger_ = boost::make_shared<FilteredBufferedLoggerGuard>();
14161413
boost::filesystem::path oreRootPath =
14171414
logRootPath.empty() ? boost::filesystem::path(__FILE__).parent_path().parent_path().parent_path().parent_path()
14181415
: logRootPath;
@@ -1428,10 +1425,10 @@ void OREApp::setupLog(const std::string& path, const std::string& file, Size mas
14281425
Log::instance().registerIndependentLogger(progressLogger);
14291426

14301427
// Structured message logger
1431-
auto structuredLogger = boost::make_shared<StructuredLogger>();
1428+
structuredLogger_ = boost::make_shared<StructuredLogger>();
14321429
string structuredLogFilePath = structuredLogFile.empty() ? path + "/log_structured.json" : structuredLogFile;
1433-
structuredLogger->setFileLog(structuredLogFilePath, path, structuredLogRotationSize);
1434-
Log::instance().registerIndependentLogger(structuredLogger);
1430+
structuredLogger_->setFileLog(structuredLogFilePath, path, structuredLogRotationSize);
1431+
Log::instance().registerIndependentLogger(structuredLogger_);
14351432

14361433
// Event message logger
14371434
auto eventLogger = boost::make_shared<EventLogger>();

OREAnalytics/orea/app/oreapp.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include <orea/app/parameters.hpp>
2828
#include <orea/app/analyticsmanager.hpp>
2929

30-
#include <ored/utilities/filteredbufferedlogger.hpp>
31-
3230
#include <boost/make_shared.hpp>
3331
#include <boost/timer/timer.hpp>
3432

@@ -102,7 +100,7 @@ class OREApp {
102100
boost::shared_ptr<OutputParameters> outputs_;
103101

104102
boost::shared_ptr<AnalyticsManager> analyticsManager_;
105-
boost::shared_ptr<FilteredBufferedLoggerGuard> fbLogger_;
103+
boost::shared_ptr<StructuredLogger> structuredLogger_;
106104
boost::timer::cpu_timer runTimer_;
107105
};
108106

OREData/ored/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ scripting/models/blackscholescg.cpp
313313
scripting/models/blackscholescgbase.cpp
314314
scripting/models/fdblackscholesbase.cpp
315315
scripting/models/gaussiancam.cpp
316+
scripting/models/gaussiancamcg.cpp
317+
scripting/models/lgmcg.cpp
316318
scripting/models/localvol.cpp
317319
scripting/models/modelcgimpl.cpp
318320
scripting/models/modelimpl.cpp
@@ -335,7 +337,6 @@ utilities/currencyhedgedequityindexdecomposition.cpp
335337
utilities/currencyparser.cpp
336338
utilities/dategrid.cpp
337339
utilities/fileio.cpp
338-
utilities/filteredbufferedlogger.cpp
339340
utilities/flowanalysis.cpp
340341
utilities/indexnametranslator.cpp
341342
utilities/indexparser.cpp
@@ -684,13 +685,16 @@ scripting/engines/scriptedinstrumentpricingengine.hpp
684685
scripting/engines/scriptedinstrumentpricingenginecg.hpp
685686
scripting/grammar.hpp
686687
scripting/models/amcmodel.hpp
688+
scripting/models/amcmodelcg.hpp
687689
scripting/models/blackscholes.hpp
688690
scripting/models/blackscholesbase.hpp
689691
scripting/models/blackscholescg.hpp
690692
scripting/models/blackscholescgbase.hpp
691693
scripting/models/dummymodel.hpp
692694
scripting/models/fdblackscholesbase.hpp
693695
scripting/models/gaussiancam.hpp
696+
scripting/models/gaussiancamcg.hpp
697+
scripting/models/lgmcg.hpp
694698
scripting/models/localvol.hpp
695699
scripting/models/model.hpp
696700
scripting/models/modelcg.hpp
@@ -716,7 +720,6 @@ utilities/currencyhedgedequityindexdecomposition.hpp
716720
utilities/currencyparser.hpp
717721
utilities/dategrid.hpp
718722
utilities/fileio.hpp
719-
utilities/filteredbufferedlogger.hpp
720723
utilities/flowanalysis.hpp
721724
utilities/indexnametranslator.hpp
722725
utilities/indexparser.hpp

OREData/ored/ored.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,13 +334,16 @@
334334
#include <ored/scripting/engines/scriptedinstrumentpricingenginecg.hpp>
335335
#include <ored/scripting/grammar.hpp>
336336
#include <ored/scripting/models/amcmodel.hpp>
337+
#include <ored/scripting/models/amcmodelcg.hpp>
337338
#include <ored/scripting/models/blackscholes.hpp>
338339
#include <ored/scripting/models/blackscholesbase.hpp>
339340
#include <ored/scripting/models/blackscholescg.hpp>
340341
#include <ored/scripting/models/blackscholescgbase.hpp>
341342
#include <ored/scripting/models/dummymodel.hpp>
342343
#include <ored/scripting/models/fdblackscholesbase.hpp>
343344
#include <ored/scripting/models/gaussiancam.hpp>
345+
#include <ored/scripting/models/gaussiancamcg.hpp>
346+
#include <ored/scripting/models/lgmcg.hpp>
344347
#include <ored/scripting/models/localvol.hpp>
345348
#include <ored/scripting/models/model.hpp>
346349
#include <ored/scripting/models/modelcg.hpp>
@@ -366,7 +369,6 @@
366369
#include <ored/utilities/currencyparser.hpp>
367370
#include <ored/utilities/dategrid.hpp>
368371
#include <ored/utilities/fileio.hpp>
369-
#include <ored/utilities/filteredbufferedlogger.hpp>
370372
#include <ored/utilities/flowanalysis.hpp>
371373
#include <ored/utilities/indexnametranslator.hpp>
372374
#include <ored/utilities/indexparser.hpp>

OREData/ored/portfolio/builders/scriptedtrade.cpp

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <ored/scripting/models/blackscholescg.hpp>
2222
#include <ored/scripting/models/fdblackscholesbase.hpp>
2323
#include <ored/scripting/models/gaussiancam.hpp>
24+
#include <ored/scripting/models/gaussiancamcg.hpp>
2425
#include <ored/scripting/models/localvol.hpp>
2526
#include <ored/scripting/engines/scriptedinstrumentpricingengine.hpp>
2627
#include <ored/scripting/engines/scriptedinstrumentpricingenginecg.hpp>
@@ -1278,7 +1279,7 @@ void ScriptedTradeEngineBuilder::buildGaussianCam(const std::string& id, const I
12781279
std::vector<boost::shared_ptr<EqBsData>> eqConfigs;
12791280
std::vector<boost::shared_ptr<CommoditySchwartzData>> comConfigs;
12801281
// TODO: populate comConfigs
1281-
1282+
12821283
// calibration expiries and terms for IR, INF, FX, EQ parametrisations (this will only work for a fixed reference
12831284
// date, due to the way the cam builder and nested builders work, see ticket #940)
12841285
Date referenceDate = modelCurves_.front()->referenceDate();
@@ -1473,19 +1474,30 @@ void ScriptedTradeEngineBuilder::buildGaussianCam(const std::string& id, const I
14731474

14741475
std::string configurationInCcy = configuration(MarketContext::irCalibration);
14751476
std::string configurationXois = configuration(MarketContext::pricing);
1477+
auto discretization = useCg_ ? CrossAssetModel::Discretization::Euler : CrossAssetModel::Discretization::Exact;
14761478
auto camBuilder = boost::make_shared<CrossAssetModelBuilder>(
14771479
market_,
14781480
boost::make_shared<CrossAssetModelData>(irConfigs, fxConfigs, eqConfigs, infConfigs, crLgmConfigs, crCirConfigs,
1479-
comConfigs, 0, camCorrelations, bootstrapTolerance_),
1481+
comConfigs, 0, camCorrelations, bootstrapTolerance_, "LGM",
1482+
discretization),
14801483
configurationInCcy, configurationXois, configurationXois, configurationInCcy, configurationInCcy,
14811484
configurationXois, !calibrate_ || zeroVolatility_, continueOnCalibrationError_, referenceCalibrationGrid_,
14821485
SalvagingAlgorithm::Spectral, id);
14831486

1484-
// TODO hardcode timeStepsPerYear to 0 and exact discretisation (we might want Euler for AD...)
1485-
model_ = boost::make_shared<GaussianCam>(camBuilder->model(), modelSize_, modelCcys_, modelCurves_, modelFxSpots_,
1486-
modelIrIndices_, modelInfIndices_, modelIndices_, modelIndicesCurrencies_,
1487-
simulationDates_, mcParams_, 0, iborFallbackConfig, std::vector<Size>(),
1488-
conditionalExpectationModelStates);
1487+
// effective time steps per year: zero for exact evolution, otherwise the pricing engine parameter
1488+
if (useCg_) {
1489+
modelCG_ = boost::make_shared<GaussianCamCG>(
1490+
camBuilder->model(), modelSize_, modelCcys_, modelCurves_, modelFxSpots_, modelIrIndices_, modelInfIndices_,
1491+
modelIndices_, modelIndicesCurrencies_, simulationDates_,
1492+
camBuilder->model()->discretization() == CrossAssetModel::Discretization::Exact ? 0 : timeStepsPerYear_,
1493+
iborFallbackConfig, std::vector<Size>(), conditionalExpectationModelStates);
1494+
} else {
1495+
model_ = boost::make_shared<GaussianCam>(
1496+
camBuilder->model(), modelSize_, modelCcys_, modelCurves_, modelFxSpots_, modelIrIndices_, modelInfIndices_,
1497+
modelIndices_, modelIndicesCurrencies_, simulationDates_, mcParams_,
1498+
camBuilder->model()->discretization() == CrossAssetModel::Discretization::Exact ? 0 : timeStepsPerYear_,
1499+
iborFallbackConfig, std::vector<Size>(), conditionalExpectationModelStates);
1500+
}
14891501

14901502
modelBuilders_.insert(std::make_pair(id, camBuilder));
14911503
}
@@ -1526,11 +1538,20 @@ void ScriptedTradeEngineBuilder::buildGaussianCamAMC(
15261538
Handle<CrossAssetModel> projectedModel(
15271539
getProjectedCrossAssetModel(amcCam_, selectedComponents, projectedStateProcessIndices));
15281540

1529-
// TODO hardcode timeStepsPerYear to 1 and exact discretisation (we might want Euler for AD...)
1530-
model_ = boost::make_shared<GaussianCam>(projectedModel, modelSize_, modelCcys_, modelCurves_, modelFxSpots_,
1531-
modelIrIndices_, modelInfIndices_, modelIndices_, modelIndicesCurrencies_,
1532-
simulationDates_, mcParams_, 1, iborFallbackConfig,
1533-
projectedStateProcessIndices, conditionalExpectationModelStates);
1541+
// effective time steps per year: zero for exact evolution, otherwise the pricing engine parameter
1542+
if (useCg_) {
1543+
modelCG_ = boost::make_shared<GaussianCamCG>(
1544+
projectedModel, modelSize_, modelCcys_, modelCurves_, modelFxSpots_, modelIrIndices_, modelInfIndices_,
1545+
modelIndices_, modelIndicesCurrencies_, simulationDates_,
1546+
projectedModel->discretization() == CrossAssetModel::Discretization::Exact ? 0 : timeStepsPerYear_,
1547+
iborFallbackConfig, projectedStateProcessIndices, conditionalExpectationModelStates);
1548+
} else {
1549+
model_ = boost::make_shared<GaussianCam>(
1550+
projectedModel, modelSize_, modelCcys_, modelCurves_, modelFxSpots_, modelIrIndices_, modelInfIndices_,
1551+
modelIndices_, modelIndicesCurrencies_, simulationDates_, mcParams_,
1552+
projectedModel->discretization() == CrossAssetModel::Discretization::Exact ? 0 : timeStepsPerYear_,
1553+
iborFallbackConfig, projectedStateProcessIndices, conditionalExpectationModelStates);
1554+
}
15341555

15351556
DLOG("built GuassianCam model as projection of xva evolution model");
15361557
for (auto const& p : projectedStateProcessIndices)

0 commit comments

Comments
 (0)