Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
scriptedinstrumentamccalculator.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2020 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/engines/scriptedinstrumentamccalculator.hpp
20 \brief amc calculator for scripted trades
21*/
22
23#pragma once
24
30
32
34
35namespace ore {
36namespace data {
37
39public:
40 ScriptedInstrumentAmcCalculator(const std::string& npv, const QuantLib::ext::shared_ptr<Model>& model, const ASTNodePtr ast,
41 const QuantLib::ext::shared_ptr<Context>& context, const std::string& script = "",
42 const bool interactive = false,
43 const std::set<std::string>& stickyCloseOutStates = {})
44 : npv_(npv), model_(model), ast_(ast), context_(context), script_(script), interactive_(interactive),
45 stickyCloseOutStates_(stickyCloseOutStates) {}
46
47 QuantLib::Currency npvCurrency() override;
48
49 std::vector<QuantExt::RandomVariable> simulatePath(const std::vector<QuantLib::Real>& pathTimes,
50 std::vector<std::vector<QuantExt::RandomVariable>>& paths,
51 const std::vector<size_t>& relevantPathIndex,
52 const std::vector<size_t>& relevantTimeIndex) override;
53
54private:
55 const std::string npv_;
56 const QuantLib::ext::shared_ptr<Model> model_;
58 const QuantLib::ext::shared_ptr<Context> context_;
59 const std::string script_;
60 const bool interactive_;
61 const std::set<std::string> stickyCloseOutStates_;
62 //
63 std::map<std::string, ValueType> stickyCloseOutRunScalars_;
64 std::map<std::string, std::vector<ValueType>> stickyCloseOutRunArrays_;
65};
66
67} // namespace data
68} // namespace ore
additional interface for amc enabled models
abstract syntax tree for payoff scripting
std::string script
const QuantLib::ext::shared_ptr< Context > context_
std::vector< QuantExt::RandomVariable > simulatePath(const std::vector< QuantLib::Real > &pathTimes, std::vector< std::vector< QuantExt::RandomVariable > > &paths, const std::vector< size_t > &relevantPathIndex, const std::vector< size_t > &relevantTimeIndex) override
std::map< std::string, std::vector< ValueType > > stickyCloseOutRunArrays_
ScriptedInstrumentAmcCalculator(const std::string &npv, const QuantLib::ext::shared_ptr< Model > &model, const ASTNodePtr ast, const QuantLib::ext::shared_ptr< Context > &context, const std::string &script="", const bool interactive=false, const std::set< std::string > &stickyCloseOutStates={})
const QuantLib::ext::shared_ptr< Model > model_
std::map< std::string, ValueType > stickyCloseOutRunScalars_
script engine context holding variable names and values
Currency and instrument specific conventions/defaults.
@ data
Definition: log.hpp:77
interface for model against which a script can be run
QuantLib::ext::shared_ptr< ASTNode > ASTNodePtr
Definition: ast.hpp:46
Serializable Credit Default Swap.
Definition: namespaces.docs:23
scripted instrument