QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
exchangecontract.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) 2008 J. Erik Radmall
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20/*! \file exchangecontract.hpp
21 \brief Exchange contract
22*/
23
24#ifndef quantlib_exchange_contract_hpp
25#define quantlib_exchange_contract_hpp
26
27#include <ql/time/date.hpp>
28#include <map>
29#include <utility>
30
31namespace QuantLib {
32
34 public:
35 ExchangeContract() = default;
36 ExchangeContract(std::string code,
40
41 const std::string& code() const;
42 const Date& expirationDate() const;
43 const Date& underlyingStartDate() const;
44 const Date& underlyingEndDate() const;
45 protected:
46 std::string code_;
50 };
51
52 inline ExchangeContract::ExchangeContract(std::string code,
53 Date expirationDate,
54 Date underlyingStartDate,
55 Date underlyingEndDate)
56 : code_(std::move(code)), expirationDate_(expirationDate),
57 underlyingStartDate_(underlyingStartDate), underlyingEndDate_(underlyingEndDate) {}
58
59 inline const std::string& ExchangeContract::code() const {
60 return code_;
61 }
62
63 inline const Date& ExchangeContract::expirationDate() const {
64 return expirationDate_;
65 }
66
69 }
70
72 return underlyingEndDate_;
73 }
74
75 typedef std::map<Date, ExchangeContract> ExchangeContracts;
76
77}
78
79#endif
Concrete date class.
Definition: date.hpp:125
const Date & underlyingStartDate() const
const std::string & code() const
const Date & expirationDate() const
const Date & underlyingEndDate() const
date- and time-related classes, typedefs and enumerations
Definition: any.hpp:35
std::map< Date, ExchangeContract > ExchangeContracts
STL namespace.