American-transaction costs 1.0.0.0
American option pricer under proportional transaction costs
|
00001 /* 00002 American option pricer under proportional transaction costs 00003 Copyright (C) 2011 Alet Roux alet.roux@york.ac.uk 00004 00005 This program is free software: you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation, either version 3 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program. If not, see <http://www.gnu.org/licenses/>. 00017 00018 */ 00019 00020 #ifndef TREEPRODUCT_AMERICAN_BUYERNOOPTIONAL_H 00021 #define TREEPRODUCT_AMERICAN_BUYERNOOPTIONAL_H 00022 00023 #include "exercisable.h" 00024 #include "american.h" 00025 00027 00032 class TreeProductAmericanBuyer : public TreeProductAmerican, public TreeProductExercisable 00033 { 00034 00035 public: 00036 TreeProductAmericanBuyer (const coefficient expiry, const PayoffBridge& payoff) : TreeProductAmerican(expiry,-payoff) {}; 00037 00038 PiecewiseLinear final_hedge (const Spot& spot) const 00039 { 00040 return payoff_hedge (expiry(),spot); 00041 } 00042 00043 PiecewiseLinear interim_hedge (const coefficient time, const Spot& spot, const PiecewiseLinear& future_hedge) const 00044 { 00045 #ifdef USE_ASSERT 00046 assert (time < expiry()); 00047 #endif 00048 00049 PiecewiseLinear current = future_hedge; 00050 current.restrict_slope (-spot.ask(), -spot.bid()); 00051 00052 PiecewiseLinear reference = payoff_hedge (time, spot); 00053 00054 return minimum (current, reference); 00055 } 00056 00057 coefficient current_price(const PiecewiseLinear& current, const Portfolio& holdings = Portfolio (0,0)) const 00058 { 00059 return buyers_price (current, holdings); 00060 } 00061 00062 int exercise (const coefficient t, const Spot& spot, const Portfolio& current_portfolio) const 00063 { 00064 if (t < expiry()) 00065 { 00066 if (lessthan (current_portfolio.cash(), payoff_hedge (t, spot) (current_portfolio.shares()))) 00067 return 0; 00068 00069 return 1; 00070 } 00071 00072 return 1; 00073 } 00074 00075 }; 00076 00077 00078 #endif // TREEPRODUCT_AMERICAN_BUYERNOOPTIONAL_H