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, 2007 StatPro Italia srl 6 7 This file is part of QuantLib, a free-software/open-source library 8 for financial quantitative analysts and developers - http://quantlib.org/ 9 10 QuantLib is free software: you can redistribute it and/or modify it 11 under the terms of the QuantLib license. You should have received a 12 copy of the license along with this program; if not, please email 13 <quantlib-dev@lists.sf.net>. The license is also available online at 14 <http://quantlib.org/license.shtml>. 15 16 This program is distributed in the hope that it will be useful, but WITHOUT 17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 FOR A PARTICULAR PURPOSE. See the license for more details. 19 */ 20 21 #include <ql/termstructures/yield/flatforward.hpp> 22 #include <ql/quotes/simplequote.hpp> 23 24 namespace QuantLib { 25 FlatForward(const Date & referenceDate,const Handle<Quote> & forward,const DayCounter & dayCounter,Compounding compounding,Frequency frequency)26 FlatForward::FlatForward(const Date& referenceDate, 27 const Handle<Quote>& forward, 28 const DayCounter& dayCounter, 29 Compounding compounding, 30 Frequency frequency) 31 : YieldTermStructure(referenceDate, Calendar(), dayCounter), 32 forward_(forward), compounding_(compounding), frequency_(frequency) { 33 registerWith(forward_); 34 } 35 FlatForward(const Date & referenceDate,Rate forward,const DayCounter & dayCounter,Compounding compounding,Frequency frequency)36 FlatForward::FlatForward(const Date& referenceDate, 37 Rate forward, 38 const DayCounter& dayCounter, 39 Compounding compounding, 40 Frequency frequency) 41 : YieldTermStructure(referenceDate, Calendar(), dayCounter), 42 forward_(ext::shared_ptr<Quote>(new SimpleQuote(forward))), 43 compounding_(compounding), frequency_(frequency) {} 44 FlatForward(Natural settlementDays,const Calendar & calendar,const Handle<Quote> & forward,const DayCounter & dayCounter,Compounding compounding,Frequency frequency)45 FlatForward::FlatForward(Natural settlementDays, 46 const Calendar& calendar, 47 const Handle<Quote>& forward, 48 const DayCounter& dayCounter, 49 Compounding compounding, 50 Frequency frequency) 51 : YieldTermStructure(settlementDays, calendar, dayCounter), 52 forward_(forward), compounding_(compounding), frequency_(frequency) { 53 registerWith(forward_); 54 } 55 FlatForward(Natural settlementDays,const Calendar & calendar,Rate forward,const DayCounter & dayCounter,Compounding compounding,Frequency frequency)56 FlatForward::FlatForward(Natural settlementDays, 57 const Calendar& calendar, 58 Rate forward, 59 const DayCounter& dayCounter, 60 Compounding compounding, 61 Frequency frequency) 62 : YieldTermStructure(settlementDays, calendar, dayCounter), 63 forward_(ext::shared_ptr<Quote>(new SimpleQuote(forward))), 64 compounding_(compounding), frequency_(frequency) {} 65 66 } 67