Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
pnlexplainreport.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2024 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
20
21namespace ore {
22namespace analytics {
23
25public:
26
28 QuantLib::Real pnl = 0.0;
29 QuantLib::Real delta = 0.0;
30 QuantLib::Real gamma = 0.0;
31 QuantLib::Real vega = 0.0;
32 QuantLib::Real irDelta = 0.0;
33 QuantLib::Real irGamma = 0.0;
34 QuantLib::Real irVega = 0.0;
35 QuantLib::Real eqDelta = 0.0;
36 QuantLib::Real eqGamma = 0.0;
37 QuantLib::Real eqVega = 0.0;
38 QuantLib::Real fxDelta = 0.0;
39 QuantLib::Real fxGamma = 0.0;
40 QuantLib::Real fxVega = 0.0;
41 QuantLib::Real infDelta = 0.0;
42 QuantLib::Real infGamma = 0.0;
43 QuantLib::Real infVega = 0.0;
44 QuantLib::Real creditDelta = 0.0;
45 QuantLib::Real creditGamma = 0.0;
46 QuantLib::Real creditVega = 0.0;
47 QuantLib::Real comDelta = 0.0;
48 QuantLib::Real comGamma = 0.0;
49 QuantLib::Real comVega = 0.0;
50 };
51
52 PnlExplainReport(const std::string& baseCurrency, const QuantLib::ext::shared_ptr<Portfolio>& portfolio,
53 const std::string& portfolioFilter, boost::optional<ore::data::TimePeriod> period,
54 const QuantLib::ext::shared_ptr<Report>& pnlReport = nullptr,
55 const QuantLib::ext::shared_ptr<HistoricalScenarioGenerator>& hisScenGen = nullptr,
56 std::unique_ptr<SensiRunArgs> sensiArgs = nullptr,
57 std::unique_ptr<FullRevalArgs> fullRevalArgs = nullptr,
58 std::unique_ptr<MultiThreadArgs> multiThreadArgs = nullptr,
59 const bool requireTradePnl = false)
60 : MarketRiskReport(baseCurrency, portfolio, portfolioFilter, period, hisScenGen, std::move(sensiArgs), std::move(fullRevalArgs),
61 std::move(multiThreadArgs), true, requireTradePnl), pnlReport_(pnlReport) {
62 sensiBased_ = true;
63 }
64
65protected:
66 void createReports(const QuantLib::ext::shared_ptr<MarketRiskReport::Reports>& reports) override;
67 void handleSensiResults(const QuantLib::ext::shared_ptr<MarketRiskReport::Reports>& report,
68 const QuantLib::ext::shared_ptr<MarketRiskGroupBase>& riskGroup,
69 const QuantLib::ext::shared_ptr<TradeGroupBase>& tradeGroup) override;
70 void addPnlCalculators(const QuantLib::ext::shared_ptr<MarketRiskReport::Reports>& reports) override;
71 void writeReports(const QuantLib::ext::shared_ptr<MarketRiskReport::Reports>& reports,
72 const QuantLib::ext::shared_ptr<MarketRiskGroupBase>& riskGroup,
73 const QuantLib::ext::shared_ptr<TradeGroupBase>& tradeGroup) override;
74 bool
75 includeDeltaMargin(const QuantLib::ext::shared_ptr<ore::analytics::MarketRiskGroupBase>& riskGroup) const override;
76 bool
77 includeGammaMargin(const QuantLib::ext::shared_ptr<ore::analytics::MarketRiskGroupBase>& riskGroup) const override;
78 void closeReports(const QuantLib::ext::shared_ptr<MarketRiskReport::Reports>& reports) override;
79
80private:
81 std::map<std::string, PnlExplainResults> results_;
82 QuantLib::ext::shared_ptr<Report> pnlReport_;
83 QuantLib::Size pnlReportColumnSize_;
84};
85
86} // namespace analytics
87} // namespace ore
PnlExplainReport(const std::string &baseCurrency, const QuantLib::ext::shared_ptr< Portfolio > &portfolio, const std::string &portfolioFilter, boost::optional< ore::data::TimePeriod > period, const QuantLib::ext::shared_ptr< Report > &pnlReport=nullptr, const QuantLib::ext::shared_ptr< HistoricalScenarioGenerator > &hisScenGen=nullptr, std::unique_ptr< SensiRunArgs > sensiArgs=nullptr, std::unique_ptr< FullRevalArgs > fullRevalArgs=nullptr, std::unique_ptr< MultiThreadArgs > multiThreadArgs=nullptr, const bool requireTradePnl=false)
QuantLib::ext::shared_ptr< Report > pnlReport_
void createReports(const QuantLib::ext::shared_ptr< MarketRiskReport::Reports > &reports) override
void closeReports(const QuantLib::ext::shared_ptr< MarketRiskReport::Reports > &reports) override
void addPnlCalculators(const QuantLib::ext::shared_ptr< MarketRiskReport::Reports > &reports) override
std::map< std::string, PnlExplainResults > results_
bool includeDeltaMargin(const QuantLib::ext::shared_ptr< ore::analytics::MarketRiskGroupBase > &riskGroup) const override
bool includeGammaMargin(const QuantLib::ext::shared_ptr< ore::analytics::MarketRiskGroupBase > &riskGroup) const override
void writeReports(const QuantLib::ext::shared_ptr< MarketRiskReport::Reports > &reports, const QuantLib::ext::shared_ptr< MarketRiskGroupBase > &riskGroup, const QuantLib::ext::shared_ptr< TradeGroupBase > &tradeGroup) override
void handleSensiResults(const QuantLib::ext::shared_ptr< MarketRiskReport::Reports > &report, const QuantLib::ext::shared_ptr< MarketRiskGroupBase > &riskGroup, const QuantLib::ext::shared_ptr< TradeGroupBase > &tradeGroup) override
Base class for a market risk report.