QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
actual365fixed.hpp
Go to the documentation of this file.
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) 2004 Ferdinando Ametrano
6 Copyright (C) 2013 BGC Partners L.P.
7
8 This file is part of QuantLib, a free-software/open-source library
9 for financial quantitative analysts and developers - http://quantlib.org/
10
11 QuantLib is free software: you can redistribute it and/or modify it
12 under the terms of the QuantLib license. You should have received a
13 copy of the license along with this program; if not, please email
14 <quantlib-dev@lists.sf.net>. The license is also available online at
15 <http://quantlib.org/license.shtml>.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the license for more details.
20*/
21
22/*! \file actual365fixed.hpp
23 \brief Actual/365 (Fixed) day counter
24*/
25
26#ifndef quantlib_actual365fixed_day_counter_h
27#define quantlib_actual365fixed_day_counter_h
28
30
31namespace QuantLib {
32
33 //! Actual/365 (Fixed) day count convention
34 /*! "Actual/365 (Fixed)" day count convention, also know as
35 "Act/365 (Fixed)", "A/365 (Fixed)", or "A/365F".
36
37 \warning According to ISDA, "Actual/365" (without "Fixed") is
38 an alias for "Actual/Actual (ISDA)" (see
39 ActualActual.) If Actual/365 is not explicitly
40 specified as fixed in an instrument specification,
41 you might want to double-check its meaning.
42
43 \ingroup daycounters
44 */
45 class Actual365Fixed : public DayCounter {
46 public:
50
51 private:
52 class Impl final : public DayCounter::Impl {
53 public:
54 std::string name() const override { return std::string("Actual/365 (Fixed)"); }
55 Time
56 yearFraction(const Date& d1, const Date& d2, const Date&, const Date&) const override {
57 return daysBetween(d1,d2)/365.0;
58 }
59 };
60 class CA_Impl final : public DayCounter::Impl {
61 public:
62 std::string name() const override {
63 return std::string("Actual/365 (Fixed) Canadian Bond");
64 }
65 Time yearFraction(const Date& d1,
66 const Date& d2,
67 const Date& refPeriodStart,
68 const Date& refPeriodEnd) const override;
69 };
70 class NL_Impl final : public DayCounter::Impl {
71 public:
72 std::string name() const override { return std::string("Actual/365 (No Leap)"); }
73 Date::serial_type dayCount(const Date& d1, const Date& d2) const override;
74 Time yearFraction(const Date& d1,
75 const Date& d2,
76 const Date& refPeriodStart,
77 const Date& refPeriodEnd) const override;
78 };
79 static ext::shared_ptr<DayCounter::Impl> implementation(Convention);
80 };
81
82}
83
84#endif
Time yearFraction(const Date &d1, const Date &d2, const Date &refPeriodStart, const Date &refPeriodEnd) const override
std::string name() const override
Time yearFraction(const Date &d1, const Date &d2, const Date &, const Date &) const override
std::string name() const override
Date::serial_type dayCount(const Date &d1, const Date &d2) const override
to be overloaded by more complex day counters
Time yearFraction(const Date &d1, const Date &d2, const Date &refPeriodStart, const Date &refPeriodEnd) const override
std::string name() const override
Actual/365 (Fixed) day count convention.
Actual365Fixed(Convention c=Actual365Fixed::Standard)
static ext::shared_ptr< DayCounter::Impl > implementation(Convention)
Concrete date class.
Definition: date.hpp:125
std::int_fast32_t serial_type
serial number type
Definition: date.hpp:128
abstract base class for day counter implementations
Definition: daycounter.hpp:47
day counter class
Definition: daycounter.hpp:44
day counter class
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
Definition: any.hpp:35
Time daysBetween(const Date &d1, const Date &d2)
Definition: date.hpp:442