American-transaction costs 1.0.0.0
American option pricer under proportional transaction costs
americanbuyeroptional.h
Go to the documentation of this file.
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_BUYER_H
00021 #define TREEPRODUCT_AMERICAN_BUYER_H
00022 
00023 //#include "americanbuyer.h"
00024 
00025 #include "../config.h"
00026 
00028 
00033 class TreeProductAmericanBuyerOptional : public TreeProductAmericanBuyer
00034 {
00035 
00036 public:
00037         TreeProductAmericanBuyerOptional (const coefficient expiry, const PayoffBridge& payoff) : TreeProductAmericanBuyer(expiry,payoff) {};
00038 
00039         PiecewiseLinear final_hedge (const Spot& spot) const
00040         {
00041           PiecewiseLinear hedge = payoff_hedge (expiry(), spot);
00042           include_solvent_portfolios (hedge, spot);
00043           return hedge;
00044         }
00045 
00046         int exercise (const coefficient t, const Spot& spot, const Portfolio& current_portfolio) const
00047         {
00048         coefficient payoff_value = payoff_hedge (t, spot) (current_portfolio.shares());
00049 
00050 #ifdef VERBOSE_TREEPRODUCT_AMERICANBUYER_EXERCISE
00051         std::cout << "Minimum cash value to allow exercise: " << payoff_value << std::endl;
00052 #endif
00053 
00054         if (greaterequal (current_portfolio.cash(), payoff_value))
00055                 return 1;
00056 
00057         return 0;
00058         }
00059 };
00060 
00061 
00062 #endif // TREEPRODUCT_AMERICAN_BUYER_H
 All Classes Namespaces Files Functions Variables Typedefs Defines