Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
staticanalyser.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 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 ored/scripting/staticanalyser.hpp
20 \brief static script analyser
21 \ingroup utilities
22*/
23
24#pragma once
25
28
30
31namespace ore {
32namespace data {
33
34/*! assumption: the context passed to a script engine is const and no declarations of type
35 event or index are allowed in a script. */
37public:
38 StaticAnalyser(const ASTNodePtr root, const QuantLib::ext::shared_ptr<Context> context)
39 : root_(root), context_(context) {}
40 void run(const std::string& script = "");
41
42 // maps an index (EQ-IDX, EUR-CMS-10Y, ...) to the set of observation dates on which it is is evaluated
43 // via ()(obsDate) or ()(obsdate,fwdDate) or [ABOVE|BELOW]PROB(d1, d2)
44 const std::map<std::string, std::set<QuantLib::Date>>& indexEvalDates() const { return indexEvalDates_; }
45
46 // maps an index (EQ-IDX, EUR-CMS-10Y, ...) to the set of forward dates which are requested via ()(obsDate, fwdDate)
47 const std::map<std::string, std::set<QuantLib::Date>>& indexFwdDates() const { return indexFwdDates_; }
48
49 // maps a pay currency to obsdate required from PAY()
50 const std::map<std::string, std::set<QuantLib::Date>>& payObsDates() const { return payObsDates_; }
51
52 // maps a pay currency to paydate required from PAY()
53 const std::map<std::string, std::set<QuantLib::Date>>& payPayDates() const { return payPayDates_; }
54
55 // maps a pay currency to obsdate required from DISCOUNT()
56 const std::map<std::string, std::set<QuantLib::Date>>& discountObsDates() const { return discountObsDates_; }
57
58 // maps a pay currency to paydate required from DISCOUNT()
59 const std::map<std::string, std::set<QuantLib::Date>>& discountPayDates() const { return discountPayDates_; }
60
61 // set of obs dates where a conditional expectation from NPV() is required
62 const std::set<QuantLib::Date>& regressionDates() const { return regressionDates_; }
63
64 // maps an index (EUR-EONIA) to the set of fixing dates from FWD[COMP|AVG](index, obs, start, end, ...)
65 const std::map<std::string, std::set<QuantLib::Date>>& fwdCompAvgFixingDates() const { return fwdCompAvgFixingDates_; }
66
67 // maps an index (EUR-EONIA) to the set of obs dates from FWD[COMP|AVG](index ,obs, start, end, ...)
68 const std::map<std::string, std::set<QuantLib::Date>>& fwdCompAvgEvalDates() const { return fwdCompAvgEvalDates_; }
69
70 // maps an index (EUR-EONIA) to the set of start or end (value) dates from FWD[COMP|AVG](index, obs, start, end, ...)
71 const std::map<std::string, std::set<QuantLib::Date>>& fwdCompAvgStartEndDates() const {
73 }
74
75 // maps an index (EQ-IDX, EUR-CMS-10Y, ...) to the set of fixing dates from [ABOVE|BELOW]PROB(d1, d2)
76 const std::map<std::string, std::set<QuantLib::Date>>& probFixingDates() const { return probFixingDates_; }
77
78private:
80 const QuantLib::ext::shared_ptr<Context> context_;
81 //
82 std::map<std::string, std::set<QuantLib::Date>> indexEvalDates_, indexFwdDates_, payObsDates_, payPayDates_,
85 std::set<QuantLib::Date> regressionDates_;
86};
87
88} // namespace data
89} // namespace ore
abstract syntax tree for payoff scripting
std::string script
const std::map< std::string, std::set< QuantLib::Date > > & probFixingDates() const
const std::map< std::string, std::set< QuantLib::Date > > & payObsDates() const
StaticAnalyser(const ASTNodePtr root, const QuantLib::ext::shared_ptr< Context > context)
std::map< std::string, std::set< QuantLib::Date > > discountPayDates_
const std::map< std::string, std::set< QuantLib::Date > > & fwdCompAvgEvalDates() const
const QuantLib::ext::shared_ptr< Context > context_
const std::map< std::string, std::set< QuantLib::Date > > & fwdCompAvgFixingDates() const
const std::set< QuantLib::Date > & regressionDates() const
std::map< std::string, std::set< QuantLib::Date > > indexEvalDates_
const std::map< std::string, std::set< QuantLib::Date > > & discountObsDates() const
std::map< std::string, std::set< QuantLib::Date > > payObsDates_
std::map< std::string, std::set< QuantLib::Date > > fwdCompAvgStartEndDates_
std::set< QuantLib::Date > regressionDates_
std::map< std::string, std::set< QuantLib::Date > > probFixingDates_
const std::map< std::string, std::set< QuantLib::Date > > & indexFwdDates() const
std::map< std::string, std::set< QuantLib::Date > > payPayDates_
std::map< std::string, std::set< QuantLib::Date > > discountObsDates_
std::map< std::string, std::set< QuantLib::Date > > fwdCompAvgFixingDates_
const std::map< std::string, std::set< QuantLib::Date > > & indexEvalDates() const
const std::map< std::string, std::set< QuantLib::Date > > & fwdCompAvgStartEndDates() const
std::map< std::string, std::set< QuantLib::Date > > indexFwdDates_
const std::map< std::string, std::set< QuantLib::Date > > & payPayDates() const
const std::map< std::string, std::set< QuantLib::Date > > & discountPayDates() const
std::map< std::string, std::set< QuantLib::Date > > fwdCompAvgEvalDates_
void run(const std::string &script="")
script engine context holding variable names and values
Currency and instrument specific conventions/defaults.
@ data
Definition: log.hpp:77
QuantLib::ext::shared_ptr< ASTNode > ASTNodePtr
Definition: ast.hpp:46
Serializable Credit Default Swap.
Definition: namespaces.docs:23