Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
fixingmanager.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 orea/simulation/fixingmanager.hpp
20 \brief Controls the updating/reset of the QuantLib::IndexManager
21 \ingroup simulation
22 */
23#pragma once
24
27
28namespace ore {
29namespace analytics {
30using namespace QuantLib;
33
34namespace detail {
36 bool operator()(const QuantLib::ext::shared_ptr<Index>& a, const QuantLib::ext::shared_ptr<Index>& b) const {
37 return a->name() < b->name();
38 }
39};
40} // namespace detail
41
42//! Pseudo Fixings Manager
43/*!
44 A Pseudo Fixing is a future historical fixing. When pricing on T0 but asof T and we require a fixing on t with
45 T0 < t < T then the QuantLib pricing engines will look to the IndexManager for a fixing at t.
46
47 When moving between dates and simulation paths then the Fixings can change and should be populated in a path
48 consistent manner
49
50 The FixingManager controls this updating and reset of the QuantLib::IndexManager for the required set of fixings
51
52 When stepping between simulation dated t_(n-1) and t_(n) and update a fixing t with t_(n-1) < t < t(n) than the fixing
53 from t(n) will be backfilled. There is currently no interpolation of fixings.
54
55 \ingroup simulation
56 */
58public:
59 explicit FixingManager(Date today);
60 virtual ~FixingManager() {}
61
62 //! Initialise the manager with these flows and indices from the given portfolio
63 void initialise(const QuantLib::ext::shared_ptr<Portfolio>& portfolio, const QuantLib::ext::shared_ptr<Market>& market,
64 const std::string& configuration = Market::defaultConfiguration);
65
66 //! Update fixings to date d
67 void update(Date d);
68
69 //! Reset fixings to t0 (today)
70 void reset();
71
72 //! Cashflow handler type definitions
73
74 using FixingMap = std::map<QuantLib::ext::shared_ptr<Index>, std::set<Date>, detail::IndexComparator>;
75
76private:
77 void applyFixings(Date start, Date end);
78
81
82 using FixingCache = std::map<QuantLib::ext::shared_ptr<Index>, TimeSeries<Real>, detail::IndexComparator>;
83
86};
87
88} // namespace analytics
89} // namespace ore
Pseudo Fixings Manager.
std::map< QuantLib::ext::shared_ptr< Index >, std::set< Date >, detail::IndexComparator > FixingMap
Cashflow handler type definitions.
std::map< QuantLib::ext::shared_ptr< Index >, TimeSeries< Real >, detail::IndexComparator > FixingCache
void applyFixings(Date start, Date end)
void update(Date d)
Update fixings to date d.
void initialise(const QuantLib::ext::shared_ptr< Portfolio > &portfolio, const QuantLib::ext::shared_ptr< Market > &market, const std::string &configuration=Market::defaultConfiguration)
Initialise the manager with these flows and indices from the given portfolio.
void reset()
Reset fixings to t0 (today)
static const string defaultConfiguration
bool operator()(const QuantLib::ext::shared_ptr< Index > &a, const QuantLib::ext::shared_ptr< Index > &b) const