1 /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 3 /* 4 Copyright (C) 2008 Master IMAFA - Polytech'Nice Sophia - Université de Nice Sophia Antipolis 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 #include <ql/experimental/exoticoptions/himalayaoption.hpp> 21 #include <ql/instruments/payoffs.hpp> 22 #include <ql/exercise.hpp> 23 24 namespace QuantLib { 25 HimalayaOption(const std::vector<Date> & fixingDates,Real strike)26 HimalayaOption::HimalayaOption(const std::vector<Date>& fixingDates, 27 Real strike) 28 : MultiAssetOption(ext::shared_ptr<Payoff>( 29 new PlainVanillaPayoff(Option::Call, strike)), 30 ext::shared_ptr<Exercise>( 31 new EuropeanExercise(fixingDates.back()))), 32 fixingDates_(fixingDates) {} 33 setupArguments(PricingEngine::arguments * args) const34 void HimalayaOption::setupArguments(PricingEngine::arguments* args) const { 35 MultiAssetOption::setupArguments(args); 36 37 HimalayaOption::arguments* arguments = 38 dynamic_cast<HimalayaOption::arguments*>(args); 39 QL_REQUIRE(arguments != 0, "wrong argument type"); 40 41 arguments->fixingDates = fixingDates_; 42 } 43 arguments()44 HimalayaOption::arguments::arguments() {} 45 validate() const46 void HimalayaOption::arguments::validate() const { 47 MultiAssetOption::arguments::validate(); 48 QL_REQUIRE(!fixingDates.empty(), "no fixing dates given"); 49 } 50 51 } 52 53