Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
analyticsmanager.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 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
19/*! \file orea/app/analyticsmanager.hpp
20 \brief ORE Analytics Manager
21*/
22
23#pragma once
24
25#include <orea/app/analytic.hpp>
29
30#include <iostream>
31
32namespace ore {
33namespace analytics {
34
36public:
37 AnalyticsManager(//! Container for the inputs required by the standard analytics
38 const QuantLib::ext::shared_ptr<InputParameters>& inputs,
39 //! A market data loader object that can retrieve required data from a large repository
40 const QuantLib::ext::shared_ptr<MarketDataLoader>& marketDataLoader);
41 virtual ~AnalyticsManager() {};
42
43 //! Valid analytics in the analytics manager are the union of analytics types provided by analytics_ map
44 bool hasAnalytic(const std::string& type);
45 const std::set<std::string>& validAnalytics();
46 const std::set<std::string>& requestedAnalytics();
47 const QuantLib::ext::shared_ptr<Analytic>& getAnalytic(const std::string& type) const;
48 Size numberOfAnalytics() { return analytics_.size(); }
49 const QuantLib::ext::shared_ptr<InputParameters>& inputs() { return inputs_; }
50 std::vector<QuantLib::ext::shared_ptr<ore::data::TodaysMarketParameters>> todaysMarketParams();
51 void runAnalytics(const QuantLib::ext::shared_ptr<MarketCalibrationReportBase>& marketCalibrationReport = nullptr);
52 void addAnalytic(const std::string& label, const QuantLib::ext::shared_ptr<Analytic>& analytic);
53
54 // returns a vector of all analytics, including dependent analytics
55 std::map<std::string, QuantLib::ext::shared_ptr<Analytic>> analytics() { return analytics_; }
56 void clear();
57
62
63 // Write all reports to files, reportNames map can be used to replace standard report names
64 // with custom names
65 void toFile(const Analytic::analytic_reports& reports, const std::string& outputPath,
66 const std::map<std::string, std::string>& reportNames = {}, const char sep = ',',
67 const bool commentCharacter = false, char quoteChar = '\0', const string& nullString = "#N/A",
68 const std::set<std::string>& lowerHeaderReportNames = {});
69
70private:
71 std::map<std::string, QuantLib::ext::shared_ptr<Analytic>> analytics_;
72 QuantLib::ext::shared_ptr<InputParameters> inputs_;
73 QuantLib::ext::shared_ptr<MarketDataLoader> marketDataLoader_;
75 std::set<std::string> validAnalytics_;
76};
77
78QuantLib::ext::shared_ptr<AnalyticsManager> parseAnalytics(const std::string& s,
79 const QuantLib::ext::shared_ptr<InputParameters>& inputs,
80 const QuantLib::ext::shared_ptr<MarketDataLoader>& marketDataLoader);
81
82} // analytics
83} // ore
ORE Analytics Manager.
std::map< std::string, std::map< std::string, QuantLib::ext::shared_ptr< AggregationScenarioData > > > analytic_mktcubes
Definition: analytic.hpp:57
std::map< std::string, std::map< std::string, QuantLib::ext::shared_ptr< ore::data::InMemoryReport > > > analytic_reports
Definition: analytic.hpp:51
std::map< std::string, std::map< std::string, QuantLib::ext::shared_ptr< StressTestScenarioData > > > analytic_stresstests
Definition: analytic.hpp:60
std::map< std::string, std::map< std::string, QuantLib::ext::shared_ptr< NPVCube > > > analytic_npvcubes
Definition: analytic.hpp:54
Analytic::analytic_stresstests const stressTests()
const std::set< std::string > & validAnalytics()
std::map< std::string, QuantLib::ext::shared_ptr< Analytic > > analytics()
const QuantLib::ext::shared_ptr< InputParameters > & inputs()
bool hasAnalytic(const std::string &type)
Valid analytics in the analytics manager are the union of analytics types provided by analytics_ map.
const std::set< std::string > & requestedAnalytics()
std::map< std::string, QuantLib::ext::shared_ptr< Analytic > > analytics_
Analytic::analytic_npvcubes const npvCubes()
std::set< std::string > validAnalytics_
QuantLib::ext::shared_ptr< MarketDataLoader > marketDataLoader_
void addAnalytic(const std::string &label, const QuantLib::ext::shared_ptr< Analytic > &analytic)
void toFile(const Analytic::analytic_reports &reports, const std::string &outputPath, const std::map< std::string, std::string > &reportNames={}, const char sep=',', const bool commentCharacter=false, char quoteChar='\0', const string &nullString="#N/A", const std::set< std::string > &lowerHeaderReportNames={})
const QuantLib::ext::shared_ptr< Analytic > & getAnalytic(const std::string &type) const
Analytic::analytic_reports const reports()
void runAnalytics(const QuantLib::ext::shared_ptr< MarketCalibrationReportBase > &marketCalibrationReport=nullptr)
std::vector< QuantLib::ext::shared_ptr< ore::data::TodaysMarketParameters > > todaysMarketParams()
QuantLib::ext::shared_ptr< InputParameters > inputs_
Analytic::analytic_reports reports_
Analytic::analytic_mktcubes const mktCubes()
Input Parameters.
ORE Analytics Manager.
Market Data Loader.
QuantLib::ext::shared_ptr< AnalyticsManager > parseAnalytics(const std::string &s, const QuantLib::ext::shared_ptr< InputParameters > &inputs, const QuantLib::ext::shared_ptr< MarketDataLoader > &marketDataLoader)