American-transaction costs 1.0.0.0 American option pricer under proportional transaction costs

- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

treeproduct.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_H
    00021 #define TREEPRODUCT_H
    00022
    00023 #include "../config.h"
    00024 //#include "../payoff/bridge.h"
    00025 #include "../trading.h"
    00026
    00028 class TreeProduct
    00029 {
    00030 public:
    00031         TreeProduct ( const coefficient expiry) : _expiry ( expiry )
    00032         {
    00033         #ifdef USE_ASSERT
    00034                 assert ( expiry > 0 );
    00035         #endif
    00036         }
    00037
    00043         virtual PiecewiseLinear final_hedge (const Spot& spot) const = 0;
    00044
    00052         virtual PiecewiseLinear interim_hedge (const coefficient t, const Spot& spot, const PiecewiseLinear& future_hedge) const = 0;
    00053
    00059         virtual coefficient current_price (const PiecewiseLinear& current, const Portfolio& holdings = Portfolio (0,0)) const = 0;
    00060
    00069         Portfolio next_portfolio (const coefficient t, const Spot& spot, const PiecewiseLinear& future_hedge, const Portfolio& current_portfolio) const
    00070         {
    00071 #ifdef USE_ASSERT
    00072                 assert (t < expiry());
    00073 #endif
    00074                 Portfolio portfolio (current_portfolio);
    00075                 untangle_restriction (portfolio, future_hedge, spot);
    00076                 return portfolio;
    00077         }
    00078
    00080         coefficient expiry() const { return _expiry;}
    00081
    00082 private:
    00083         coefficient _expiry;
    00084 };
    00085
    00086 inline coefficient buyers_price(const PiecewiseLinear& current, const Portfolio& holdings)
    00087 {
    00088         return - current ( holdings.shares() ) - holdings.cash();
    00089 };
    00090
    00091 inline coefficient sellers_price(const PiecewiseLinear& current, const Portfolio& holdings)
    00092 {
    00093         return current ( holdings.shares() ) - holdings.cash();
    00094 };
    00095
    00096 #endif // TREEPRODUCT_H

All Classes Namespaces Files Functions Variables Typedefs Defines