Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
index.cpp
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#include "toplevelfixture.hpp"
20#include <boost/test/unit_test.hpp>
21#include <ql/currency.hpp>
22#include <ql/index.hpp>
23#include <ql/time/calendars/target.hpp>
24#include <ql/time/calendars/unitedstates.hpp>
62
63using namespace QuantLib;
64using namespace QuantExt;
65using namespace boost::unit_test_framework;
66using namespace std;
67
68namespace {
69
70struct IndTestData {
71 IborIndex ind;
72 string name;
73 string calName;
74 string ccyName;
75};
76} // namespace
77
78BOOST_FIXTURE_TEST_SUITE(QuantExtTestSuite, qle::test::TopLevelFixture)
79
80BOOST_AUTO_TEST_SUITE(IndexTest)
81
82BOOST_AUTO_TEST_CASE(testIborIndex) {
83
84 BOOST_TEST_MESSAGE("Testing QuantExt indexes");
85
86 Period pd(3, Months);
87
88 IndTestData data[] = {
89 { CHFTois(), "CHF-TOIS", Switzerland().name(), CHFCurrency().name() },
90 { CHFSaron(), "CHF-SARON", Switzerland().name(), CHFCurrency().name() },
91 { CORRA(), "CORRA", Canada().name(), CADCurrency().name() },
92 { CZKPribor(pd), "CZK-PRIBOR", CzechRepublic().name(), CZKCurrency().name() },
93 { DKKCibor(pd), "DKK-CIBOR", Denmark().name(), DKKCurrency().name() },
94 { DKKCita(), "DKK-CITA", Denmark().name(), DKKCurrency().name() },
95 { DKKOis(), "DKK-DKKOIS", Denmark().name(), DKKCurrency().name() },
96 { HKDHibor(pd), "HKD-HIBOR", HongKong().name(), HKDCurrency().name() },
97 { HUFBubor(pd), "HUF-BUBOR", Hungary().name(), HUFCurrency().name() },
98 { IDRIdrfix(pd), "IDR-IDRFIX", Indonesia().name(), IDRCurrency().name() },
99 { IDRJibor(pd), "IDR-JIBOR", Indonesia().name(), IDRCurrency().name() },
100 { ILSTelbor(pd), "ILS-TELBOR", QuantExt::Israel(QuantExt::Israel::Telbor).name(), ILSCurrency().name() },
101 { INRMiborOis(), "INR-MIBOROIS", India().name(), INRCurrency().name() },
102 { INRMifor(pd), "INR-MIFOR", India().name(), INRCurrency().name() },
103 { JPYEYTIBOR(pd), "JPY-EYTIBOR", Japan().name(), JPYCurrency().name() },
104 { MXNTiie(pd), "MXN-TIIE", Mexico().name(), MXNCurrency().name() },
105 { NOKNibor(pd), "NOK-NIBOR", Norway().name(), NOKCurrency().name() },
106 { NZDBKBM(pd), "NZD-BKBM", NewZealand().name(), NZDCurrency().name() },
107 { SEKStibor(pd), "SEK-STIBOR", Sweden().name(), SEKCurrency().name() },
108 { SEKStina(), "SEK-STINA", Sweden().name(), SEKCurrency().name() },
109 { SEKSior(), "SEK-SIOR", Sweden().name(), SEKCurrency().name() },
110 { SGDSibor(pd), "SGD-SIBOR", Singapore().name(), SGDCurrency().name() },
111 { SGDSor(pd), "SGD-SOR", Singapore().name(), SGDCurrency().name() },
112 { SKKBribor(pd), "SKK-BRIBOR", Slovakia().name(), SKKCurrency().name() },
113 { Tonar(), "TONAR", Japan().name(), JPYCurrency().name() },
114 { Sora(), "SGD-SORA", Singapore().name(), SGDCurrency().name() },
115 { KRWCd(pd), "KRW-CD", SouthKorea(SouthKorea::Settlement).name(), KRWCurrency().name() },
116 { KRWKoribor(pd), "KRW-KORIBOR", SouthKorea(SouthKorea::Settlement).name(), KRWCurrency().name() },
117 { MYRKlibor(pd), "MYR-KLIBOR", Malaysia().name(), MYRCurrency().name() },
118 { TWDTaibor(pd), "TWD-TAIBOR", Taiwan().name(), TWDCurrency().name() },
119 { CNYRepoFix(pd), "CNY-REPOFIX", China(China::IB).name(), CNYCurrency().name() }
120 };
121
122 Size size = sizeof(data) / sizeof(data[0]);
123
124 for (Size i = 0; i < size; i++) {
125 BOOST_CHECK_EQUAL(data[i].ind.familyName(), data[i].name);
126 BOOST_CHECK_EQUAL(data[i].ind.fixingCalendar().name(), data[i].calName);
127 BOOST_CHECK_EQUAL(data[i].ind.currency().name(), data[i].ccyName);
128 }
129}
130
131BOOST_AUTO_TEST_SUITE_END()
132
133BOOST_AUTO_TEST_SUITE_END()
BRL-CDI index.
Swiss Average Rate Overnight (SARON)
Swiss Franc T/N rate on Reuters page CHFTOIS.
CHF SARON rate
Definition: chfsaron.hpp:42
CHF TOIS rate
Definition: chftois.hpp:43
CNY-CNREPOFIX=CFXS-Reuters index.
Definition: cnyrepofix.hpp:43
CORRA rate
Definition: corra.hpp:39
CZK-PRIBOR index.
Definition: czkpribor.hpp:46
DKK-CIBOR index.
Definition: dkkcibor.hpp:47
HKD-HIBOR index.
Definition: hkdhibor.hpp:44
HUF-BUBOR index.
Definition: hufbubor.hpp:47
IDR-IDRFIX index.
Definition: idridrfix.hpp:46
IDR-JIBOR index.
Definition: idrjibor.hpp:42
ILS-TELBOR index.
Definition: ilstelbor.hpp:43
INR-MIBOROIS index.
Definition: inrmiborois.hpp:46
INR-MIFOR index.
Definition: inrmifor.hpp:46
Israel calendar.
Definition: israel.hpp:40
JPY Euroyen TIBOR index
Definition: jpyeytibor.hpp:45
KRW-CD index.
Definition: krwcd.hpp:42
KRW-KORIBOR index.
Definition: krwkoribor.hpp:42
MXN-TIIE index.
Definition: mxntiie.hpp:46
MYR-KLIBOR index.
Definition: myrklibor.hpp:44
NOK-NIBOR index.
Definition: noknibor.hpp:46
NZD-BKBM index.
Definition: nzdbkbm.hpp:44
SEK-STIBOR index.
Definition: sekstibor.hpp:46
SGD-SIBOR index.
Definition: sgdsibor.hpp:44
SGD-SOR index.
Definition: sgdsor.hpp:44
SKK-BRIBOR index.
Definition: skkbribor.hpp:46
SGD SORA rate
Definition: sora.hpp:45
Swiss calendar.
Definition: switzerland.hpp:50
TWD-TAIBOR index.
Definition: twdtaibor.hpp:42
JPY TONAR rate
Definition: tonar.hpp:45
CLP-CAMARA index.
CNY-CNREPOFIX=CFXS-Reuters index.
COP-IBR index.
Canadian Overnight Repo Rate Average (CORRA) index class.
CZK-PRIBOR index.
DEM-LIBOR index.
DKK-CIBOR index.
DKK T/N rate.
DKK T/N rate.
HKD-HIBOR index.
HUF-BUBOR index.
IDR-IDRFIX index.
IDR-JIBOR index.
ILS-TELBOR index.
BOOST_AUTO_TEST_CASE(testIborIndex)
Definition: index.cpp:82
INR-MIBOROIS index.
INR-MIFOR index.
JPY Euroyen TIBOR index
KRW-CD index.
KRW-KORIBOR index.
MXN-TIIE index.
MYR-KLIBOR index.
NOK-NIBOR index.
NZD-BKBM index.
PHP-PHIREF index.
SEK T/N rate.
SEK-STIBOR index.
SEK T/N rate.
SGD-SIBOR index.
SGD-SOR index.
SKK-BRIBOR index.
Singapore Overnight Average Rate (sora)
THB-BIBOR index.
Tokyo Overnight Average Rate (TONAR)
Fixture that can be used at top level.