Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
multistatenpvcalculator.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2017 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 engine/multistatenpvcalculator.hpp
20 \brief a calculator that computes npvs for a vector of credit states
21 \ingroup simulation
22*/
23
24#pragma once
25
27
28namespace ore {
29namespace analytics {
30
31//! MultiStateNPVCalculator
32/*! Calculate multiple state NPVs (use addtional result field stateNpv)
33 See NPVCalculator for more conventions of the stored NPVs. */
35public:
36 //! base ccy and index to write to
37 MultiStateNPVCalculator(const std::string& baseCcyCode, Size index, Size states)
38 : NPVCalculator(baseCcyCode, index), states_(states) {}
39
40 void calculate(const QuantLib::ext::shared_ptr<Trade>& trade, Size tradeIndex,
41 const QuantLib::ext::shared_ptr<SimMarket>& simMarket, QuantLib::ext::shared_ptr<NPVCube>& outputCube,
42 QuantLib::ext::shared_ptr<NPVCube>& outputCubeNettingSet, const Date& date, Size dateIndex, Size sample,
43 bool isCloseOut = false) override;
44
45 void calculateT0(const QuantLib::ext::shared_ptr<Trade>& trade, Size tradeIndex,
46 const QuantLib::ext::shared_ptr<SimMarket>& simMarket, QuantLib::ext::shared_ptr<NPVCube>& outputCube,
47 QuantLib::ext::shared_ptr<NPVCube>& outputCubeNettingSet) override;
48
49 std::vector<Real> multiStateNpv(Size tradeIndex, const QuantLib::ext::shared_ptr<Trade>& trade,
50 const QuantLib::ext::shared_ptr<SimMarket>& simMarket);
51
52protected:
53 Size states_;
54};
55
56} // namespace analytics
57} // namespace ore
std::vector< Real > multiStateNpv(Size tradeIndex, const QuantLib::ext::shared_ptr< Trade > &trade, const QuantLib::ext::shared_ptr< SimMarket > &simMarket)
void calculateT0(const QuantLib::ext::shared_ptr< Trade > &trade, Size tradeIndex, const QuantLib::ext::shared_ptr< SimMarket > &simMarket, QuantLib::ext::shared_ptr< NPVCube > &outputCube, QuantLib::ext::shared_ptr< NPVCube > &outputCubeNettingSet) override
void calculate(const QuantLib::ext::shared_ptr< Trade > &trade, Size tradeIndex, const QuantLib::ext::shared_ptr< SimMarket > &simMarket, QuantLib::ext::shared_ptr< NPVCube > &outputCube, QuantLib::ext::shared_ptr< NPVCube > &outputCubeNettingSet, const Date &date, Size dateIndex, Size sample, bool isCloseOut=false) override
MultiStateNPVCalculator(const std::string &baseCcyCode, Size index, Size states)
base ccy and index to write to
The counterparty cube calculator interface.