1 /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 3 /* 4 Copyright (C) 2014 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 /*! \file partialtimebarrieroption.hpp 21 \brief Partial-time barrier option 22 */ 23 24 #ifndef quantlib_partial_time_barrier_option_hpp 25 #define quantlib_partial_time_barrier_option_hpp 26 27 #include <ql/instruments/oneassetoption.hpp> 28 #include <ql/instruments/barriertype.hpp> 29 #include <ql/instruments/payoffs.hpp> 30 31 namespace QuantLib { 32 33 class GeneralizedBlackScholesProcess; 34 35 struct PartialBarrier : public Barrier { 36 enum Range { Start, End, EndB1, EndB2 }; 37 }; 38 39 class PartialTimeBarrierOption : public OneAssetOption { 40 public: 41 class arguments; 42 class engine; 43 PartialTimeBarrierOption(PartialBarrier::Type barrierType, 44 PartialBarrier::Range barrierRange, 45 Real barrier, 46 Real rebate, 47 Date coverEventDate, 48 const ext::shared_ptr<StrikedTypePayoff>& payoff, 49 const ext::shared_ptr<Exercise>& exercise); 50 void setupArguments(PricingEngine::arguments*) const; 51 protected: 52 PartialBarrier::Type barrierType_; 53 PartialBarrier::Range barrierRange_; 54 Real barrier_; 55 Real rebate_; 56 Date coverEventDate_; 57 }; 58 59 //! %Arguments for barrier option calculation 60 class PartialTimeBarrierOption::arguments 61 : public OneAssetOption::arguments { 62 public: 63 arguments(); 64 PartialBarrier::Type barrierType; 65 PartialBarrier::Range barrierRange; 66 Real barrier; 67 Real rebate; 68 Date coverEventDate; 69 void validate() const; 70 }; 71 72 //! %Partial-Time-Barrier-Option %engine base class 73 class PartialTimeBarrierOption::engine 74 : public GenericEngine<PartialTimeBarrierOption::arguments, 75 PartialTimeBarrierOption::results> { 76 }; 77 78 } 79 80 81 #endif 82