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

- Main Page
- Namespaces
- Classes
- Files
- Directories

- File List
- File Members

americanseller.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_SELLERNOOPTIONAL_H
    00021 #define TREEPRODUCT_AMERICAN_SELLERNOOPTIONAL_H
    00022
    00023 #include "american.h"
    00024 #include "randomexercisable.h"
    00025
    00027
    00031 class TreeProductAmericanSeller : public TreeProductAmerican, public TreeProductRandomExercisable
    00032 {
    00033
    00034 public:
    00035         TreeProductAmericanSeller (const coefficient expiry, const PayoffBridge& payoff) : TreeProductAmerican (expiry, payoff) {};
    00036
    00037         PiecewiseLinear final_hedge (const Spot& spot) const
    00038         {
    00039           return payoff_hedge (expiry(), spot);
    00040         }
    00041
    00042         PiecewiseLinear interim_hedge (const coefficient time, const Spot& spot, const PiecewiseLinear& future_hedge) const
    00043         {
    00044 #ifdef USE_ASSERT
    00045         assert (time < expiry());
    00046 #endif
    00047
    00048         PiecewiseLinear current = future_hedge;
    00049         current.restrict_slope (-spot.ask(), -spot.bid());
    00050
    00051         PiecewiseLinear reference = payoff_hedge (time, spot);
    00052         return maximum (current, reference);
    00053         }
    00054
    00055         coefficient current_price(const PiecewiseLinear& current, const Portfolio& holdings = Portfolio (0,0)) const
    00056         {
    00057           return sellers_price(current, holdings);
    00058         }
    00059
    00063     coefficient random_exercise (const coefficient t, const Spot& spot, const PiecewiseLinear& current_hedge, const PiecewiseLinear& future_hedge, const coefficient x, coefficient& y, coefficient& S, const Portfolio& portfolio) const
    00064     {
    00065         if (equal (t, expiry()))
    00066         {
    00067                 y = x;
    00068                 S = x;
    00069                 return 1.0;
    00070         }
    00071
    00072         std::vector<PiecewiseLinear> g;
    00073         g.push_back (payoff_hedge (t, spot));
    00074         g.push_back (future_hedge);
    00075         g[1].restrict_slope (-spot.ask(), -spot.bid());
    00076
    00077         std::vector<coefficient> p, X;
    00078
    00079         coefficient shares = portfolio.shares();
    00080         untangle_maximum (current_hedge, g, x, shares, p, X);
    00081
    00082         S = X[0];
    00083         y = X[1];
    00084
    00085         return p[0];
    00086    }
    00087
    00088 };
    00089
    00090 #endif // TREEPRODUCT_AMERICAN_SELLERNOOPTIONAL_H

All Classes Namespaces Files Functions Variables Typedefs Defines