Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
yieldcurvemarketdata.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 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 test/yieldcurvemarketdata.hpp
20 \brief structs containing yield curve market data that can be used in tests
21*/
22
23#ifndef quantext_test_yieldcurvemarketdata_hpp
24#define quantext_test_yieldcurvemarketdata_hpp
25
26#include <ql/termstructures/yield/discountcurve.hpp>
27#include <ql/time/daycounters/actual365fixed.hpp>
28
29#include <boost/make_shared.hpp>
30
31#include <vector>
32
33using namespace QuantLib;
34using std::vector;
35
36namespace QuantExt {
38 // Constructor
39 YieldCurveEUR() : dayCounter(Actual365Fixed()) {
40 // Vectors to hold dates and disc
41 vector<Date> dates(7);
42 vector<Rate> discEonia(7);
43 vector<Rate> disc3M(7);
44 vector<Rate> disc6M(7);
45
46 // Populate the vectors
47 dates[0] = Date(5, Feb, 2016);
48 discEonia[0] = 1.000000000;
49 disc3M[0] = 1.000000000;
50 disc6M[0] = 1.000000000;
51 dates[1] = Date(5, Aug, 2016);
52 discEonia[1] = 1.001296118;
53 disc3M[1] = 1.000482960;
54 disc6M[1] = 0.999875649;
55 dates[2] = Date(6, Feb, 2017);
56 discEonia[2] = 1.003183503;
57 disc3M[2] = 1.001536429;
58 disc6M[2] = 1.000221239;
59 dates[3] = Date(5, Feb, 2021);
60 discEonia[3] = 1.008950857;
61 disc3M[3] = 0.999534627;
62 disc6M[3] = 0.992455644;
63 dates[4] = Date(6, Feb, 2023);
64 discEonia[4] = 0.996461253;
65 disc3M[4] = 0.984474484;
66 disc6M[4] = 0.974435009;
67 dates[5] = Date(5, Feb, 2026);
68 discEonia[5] = 0.960894135;
69 disc3M[5] = 0.944011343;
70 disc6M[5] = 0.932147253;
71 dates[6] = Date(5, Feb, 2036);
72 discEonia[6] = 0.830169833;
73 disc3M[6] = 0.807585583;
74 disc6M[6] = 0.794115491;
75
76 // Create the discount curves
77 discountEonia = Handle<YieldTermStructure>(QuantLib::ext::make_shared<DiscountCurve>(dates, discEonia, dayCounter));
78 forward3M = Handle<YieldTermStructure>(QuantLib::ext::make_shared<DiscountCurve>(dates, disc3M, dayCounter));
79 forward6M = Handle<YieldTermStructure>(QuantLib::ext::make_shared<DiscountCurve>(dates, disc6M, dayCounter));
80
81 // Enable extrapolation on all curves by default
82 discountEonia->enableExtrapolation();
83 forward3M->enableExtrapolation();
84 forward6M->enableExtrapolation();
85 }
86
87 // Members
88 Handle<YieldTermStructure> discountEonia;
89 Handle<YieldTermStructure> forward3M;
90 Handle<YieldTermStructure> forward6M;
91 DayCounter dayCounter;
92};
93} // namespace QuantExt
94
95#endif
Handle< YieldTermStructure > forward3M
Handle< YieldTermStructure > discountEonia
Handle< YieldTermStructure > forward6M