QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
imm.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
5 Copyright (C) 2003, 2004, 2005, 2006, 2007 StatPro Italia srl
6 Copyright (C) 2004, 2005, 2006 Ferdinando Ametrano
7 Copyright (C) 2006 Katiuscia Manzoni
8
9 This file is part of QuantLib, a free-software/open-source library
10 for financial quantitative analysts and developers - http://quantlib.org/
11
12 QuantLib is free software: you can redistribute it and/or modify it
13 under the terms of the QuantLib license. You should have received a
14 copy of the license along with this program; if not, please email
15 <quantlib-dev@lists.sf.net>. The license is also available online at
16 <http://quantlib.org/license.shtml>.
17
18 This program is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 FOR A PARTICULAR PURPOSE. See the license for more details.
21*/
22
27#ifndef quantlib_imm_hpp
28#define quantlib_imm_hpp
29
30#include <ql/time/date.hpp>
31
32namespace QuantLib {
33
35 struct IMM {
36 enum Month { F = 1, G = 2, H = 3,
37 J = 4, K = 5, M = 6,
38 N = 7, Q = 8, U = 9,
39 V = 10, X = 11, Z = 12 };
40
42 static bool isIMMdate(const Date& d,
43 bool mainCycle = true);
44
46 static bool isIMMcode(const std::string& in,
47 bool mainCycle = true);
48
55 static std::string code(const Date& immDate);
56
63 static Date date(const std::string& immCode,
64 const Date& referenceDate = Date());
65
67
71 static Date nextDate(const Date& d = Date(),
72 bool mainCycle = true);
73
75
79 static Date nextDate(const std::string& immCode,
80 bool mainCycle = true,
81 const Date& referenceDate = Date());
82
84
88 static std::string nextCode(const Date& d = Date(),
89 bool mainCycle = true);
90
92
96 static std::string nextCode(const std::string& immCode,
97 bool mainCycle = true,
98 const Date& referenceDate = Date());
99 };
100
101}
102
103#endif
Concrete date class.
Definition: date.hpp:125
Definition: any.hpp:35
Main cycle of the International Money Market (a.k.a. IMM) months.
Definition: imm.hpp:35
static std::string nextCode(const Date &d=Date(), bool mainCycle=true)
next IMM code following the given date
Definition: imm.cpp:196
static bool isIMMcode(const std::string &in, bool mainCycle=true)
returns whether or not the given string is an IMM code
Definition: imm.cpp:55
static Date date(const std::string &immCode, const Date &referenceDate=Date())
Definition: imm.cpp:125
static std::string code(const Date &immDate)
Definition: imm.cpp:70
static bool isIMMdate(const Date &d, bool mainCycle=true)
returns whether or not the given date is an IMM date
Definition: imm.cpp:34
static Date nextDate(const Date &d=Date(), bool mainCycle=true)
next IMM date following the given date
Definition: imm.cpp:164