Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv25490/qlo
Modified Files:
.cvsignore asianoption.cpp asianoption.hpp barrieroption.cpp
barrieroption.hpp cliquetoption.cpp cliquetoption.hpp
dividendvanillaoption.cpp dividendvanillaoption.hpp
enumclassregistry.cpp europeanoption.cpp europeanoption.hpp
forwardvanillaoption.cpp forwardvanillaoption.hpp
quantoforwardvanillaoption.cpp quantoforwardvanillaoption.hpp
quantovanillaoption.cpp quantovanillaoption.hpp
typefactory.hpp vanillaoption.cpp vanillaoption.hpp
Added Files:
payoffs.cpp payoffs.hpp
Log Message:
implement separate class for StrikedTypePayoff
Index: dividendvanillaoption.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/dividendvanillaoption.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** dividendvanillaoption.cpp 29 Jun 2006 15:02:31 -0000 1.5
--- dividendvanillaoption.cpp 29 Jun 2006 16:52:12 -0000 1.6
***************
*** 27,39 ****
DividendVanillaOption::DividendVanillaOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const std::vector < QuantLib::Date > ÷ndDates,
const std::vector < double > ÷nds,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
- boost::shared_ptr<QuantLib::StrikedTypePayoff> payoff =
- Create<boost::shared_ptr<QuantLib::StrikedTypePayoff> >()(optionTypeID, payoffID, strike);
libraryObject_ = boost::shared_ptr<QuantLib::DividendVanillaOption>(
new QuantLib::DividendVanillaOption(
--- 27,35 ----
DividendVanillaOption::DividendVanillaOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const std::vector < QuantLib::Date > ÷ndDates,
const std::vector < double > ÷nds,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
libraryObject_ = boost::shared_ptr<QuantLib::DividendVanillaOption>(
new QuantLib::DividendVanillaOption(
Index: quantoforwardvanillaoption.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/quantoforwardvanillaoption.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** quantoforwardvanillaoption.cpp 29 Jun 2006 15:02:31 -0000 1.5
--- quantoforwardvanillaoption.cpp 29 Jun 2006 16:52:12 -0000 1.6
***************
*** 38,44 ****
const long &resetDate,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
--- 38,42 ----
const long &resetDate,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
***************
*** 50,56 ****
new QuantLib::SimpleQuote(correlation)));
- boost::shared_ptr<QuantLib::StrikedTypePayoff> payoff =
- Create<boost::shared_ptr<QuantLib::StrikedTypePayoff> >()(optionTypeID, payoffID, strike);
-
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::QuantoForwardVanillaOption(
--- 48,51 ----
Index: forwardvanillaoption.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/forwardvanillaoption.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** forwardvanillaoption.cpp 29 Jun 2006 15:02:31 -0000 1.4
--- forwardvanillaoption.cpp 29 Jun 2006 16:52:12 -0000 1.5
***************
*** 29,39 ****
const long &resetDate,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
- boost::shared_ptr<QuantLib::StrikedTypePayoff> payoff =
- Create<boost::shared_ptr<QuantLib::StrikedTypePayoff> >()(optionTypeID, payoffID, strike);
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::ForwardVanillaOption(
--- 29,35 ----
const long &resetDate,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::ForwardVanillaOption(
Index: cliquetoption.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/cliquetoption.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** cliquetoption.hpp 29 Jun 2006 15:02:31 -0000 1.4
--- cliquetoption.hpp 29 Jun 2006 16:52:12 -0000 1.5
***************
*** 29,35 ****
CliquetOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const QuantLib::Option::Type &optionType,
! const double &strike,
! const QuantLib::Date &expiryDate,
const std::vector < QuantLib::Date > &resetDates,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
--- 29,34 ----
CliquetOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::PercentageStrikePayoff> &payoff,
! const boost::shared_ptr < QuantLib::EuropeanExercise > &exercise,
const std::vector < QuantLib::Date > &resetDates,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
Index: barrieroption.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/barrieroption.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** barrieroption.cpp 29 Jun 2006 15:02:31 -0000 1.4
--- barrieroption.cpp 29 Jun 2006 16:52:12 -0000 1.5
***************
*** 29,41 ****
const double &rebate,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
- boost::shared_ptr<QuantLib::StrikedTypePayoff> payoff =
- Create<boost::shared_ptr<QuantLib::StrikedTypePayoff> >()(optionTypeID, payoffID, strike);
-
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::BarrierOption(
--- 29,36 ----
const double &rebate,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::BarrierOption(
Index: vanillaoption.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/vanillaoption.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** vanillaoption.cpp 29 Jun 2006 15:02:31 -0000 1.4
--- vanillaoption.cpp 29 Jun 2006 16:52:12 -0000 1.5
***************
*** 32,43 ****
VanillaOption::VanillaOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
-
- boost::shared_ptr<QuantLib::StrikedTypePayoff> payoff =
- Create<boost::shared_ptr<QuantLib::StrikedTypePayoff> >()(optionTypeID, payoffID, strike);
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::VanillaOption(
--- 32,38 ----
VanillaOption::VanillaOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::VanillaOption(
Index: typefactory.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/typefactory.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** typefactory.hpp 29 Jun 2006 15:02:31 -0000 1.8
--- typefactory.hpp 29 Jun 2006 16:52:12 -0000 1.9
***************
*** 80,91 ****
private RegistryManager<QuantLib::StrikedTypePayoff, EnumClassRegistry> {
public:
! boost::shared_ptr<QuantLib::StrikedTypePayoff> operator()(const std::string& optionTypeID,
! const std::string& payoffID,
! const double& input1,
! const double& input2 = 0.) {
! boost::shared_ptr<QuantLib::StrikedTypePayoff>(*ctor)(const std::string&, const double&, const double&) =
! (boost::shared_ptr<QuantLib::StrikedTypePayoff>(*)(const std::string&, const double&, const double&))
getType(payoffID);
! return ctor(optionTypeID, input1, input2);
}
};
--- 80,101 ----
private RegistryManager<QuantLib::StrikedTypePayoff, EnumClassRegistry> {
public:
! boost::shared_ptr<QuantLib::StrikedTypePayoff> operator()(
! const std::string& payoffID,
! const QuantLib::Option::Type& optionType,
! const double& input1) {
! boost::shared_ptr<QuantLib::StrikedTypePayoff>(*ctor)(const QuantLib::Option::Type&, const double&) =
! (boost::shared_ptr<QuantLib::StrikedTypePayoff>(*)(const QuantLib::Option::Type&, const double&))
getType(payoffID);
! return ctor(optionType, input1);
! }
! boost::shared_ptr<QuantLib::StrikedTypePayoff> operator()(
! const std::string& payoffID,
! const QuantLib::Option::Type& optionType,
! const double& input1,
! const double& input2) {
! boost::shared_ptr<QuantLib::StrikedTypePayoff>(*ctor)(const QuantLib::Option::Type&, const double&, const double&) =
! (boost::shared_ptr<QuantLib::StrikedTypePayoff>(*)(const QuantLib::Option::Type&, const double&, const double&))
! getType(payoffID);
! return ctor(optionType, input1, input2);
}
};
Index: europeanoption.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/europeanoption.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** europeanoption.hpp 29 Jun 2006 15:02:31 -0000 1.4
--- europeanoption.hpp 29 Jun 2006 16:52:12 -0000 1.5
***************
*** 29,35 ****
EuropeanOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
--- 29,33 ----
EuropeanOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
Index: asianoption.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/asianoption.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** asianoption.cpp 29 Jun 2006 15:02:31 -0000 1.5
--- asianoption.cpp 29 Jun 2006 16:52:12 -0000 1.6
***************
*** 29,41 ****
const QuantLib::Average::Type &averageType,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
- boost::shared_ptr<QuantLib::StrikedTypePayoff> payoff =
- Create<boost::shared_ptr<QuantLib::StrikedTypePayoff> >()(optionTypeID, payoffID, strike);
-
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::ContinuousAveragingAsianOption(
--- 29,36 ----
const QuantLib::Average::Type &averageType,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::ContinuousAveragingAsianOption(
***************
*** 53,65 ****
const std::vector < QuantLib::Date > &fixingDates,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
- boost::shared_ptr<QuantLib::StrikedTypePayoff> payoff =
- Create<boost::shared_ptr<QuantLib::StrikedTypePayoff> >()(optionTypeID, payoffID, strike);
-
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::DiscreteAveragingAsianOption(
--- 48,55 ----
const std::vector < QuantLib::Date > &fixingDates,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::DiscreteAveragingAsianOption(
Index: quantoforwardvanillaoption.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/quantoforwardvanillaoption.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** quantoforwardvanillaoption.hpp 29 Jun 2006 15:02:31 -0000 1.5
--- quantoforwardvanillaoption.hpp 29 Jun 2006 16:52:12 -0000 1.6
***************
*** 35,41 ****
const long &resetDate,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
--- 35,39 ----
const long &resetDate,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
Index: .cvsignore
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/.cvsignore,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** .cvsignore 29 Jun 2006 13:06:24 -0000 1.10
--- .cvsignore 29 Jun 2006 16:52:12 -0000 1.11
***************
*** 20,23 ****
--- 20,24 ----
vo_mathf.*pp
vo_options.*pp
+ vo_payoffs.*pp
vo_pricingengines.*pp
vo_processes.*pp
Index: cliquetoption.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/cliquetoption.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** cliquetoption.cpp 29 Jun 2006 15:02:31 -0000 1.5
--- cliquetoption.cpp 29 Jun 2006 16:52:12 -0000 1.6
***************
*** 28,41 ****
CliquetOption::CliquetOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const QuantLib::Option::Type &optionType,
! const double &strike,
! const QuantLib::Date &expiryDate,
const std::vector < QuantLib::Date > &resetDates,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
-
- boost::shared_ptr<QuantLib::PercentageStrikePayoff> payoff(
- new QuantLib::PercentageStrikePayoff(optionType, strike));
- boost::shared_ptr<QuantLib::EuropeanExercise> exercise(
- new QuantLib::EuropeanExercise(expiryDate));
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::CliquetOption(
--- 28,35 ----
CliquetOption::CliquetOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::PercentageStrikePayoff> &payoff,
! const boost::shared_ptr < QuantLib::EuropeanExercise > &exercise,
const std::vector < QuantLib::Date > &resetDates,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::CliquetOption(
--- NEW FILE: payoffs.cpp ---
/*
Copyright (C) 2006 Eric Ehlers
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it under the
terms of the QuantLib license. You should have received a copy of the
license along with this program; if not, please email qua...@li...
The license is also available online at http://quantlib.org/html/license.html
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
#if defined(HAVE_CONFIG_H)
#include <qlo/config.hpp>
#endif
#include <qlo/payoffs.hpp>
#include <qlo/typefactory.hpp>
namespace QuantLibAddin {
StrikedTypePayoff::StrikedTypePayoff(
const std::string& payoffID,
const QuantLib::Option::Type& optionType,
const double &strike) {
libraryObject_ = Create<boost::shared_ptr<QuantLib::StrikedTypePayoff> >()(
payoffID, optionType, strike);
}
StrikedTypePayoff::StrikedTypePayoff(
const std::string& payoffID,
const QuantLib::Option::Type& optionType,
const double &strike,
const double &strikeIncrement) {
libraryObject_ = Create<boost::shared_ptr<QuantLib::StrikedTypePayoff> >()(
payoffID, optionType, strike, strikeIncrement);
}
}
Index: enumclassregistry.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/enumclassregistry.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** enumclassregistry.cpp 29 Jun 2006 15:02:31 -0000 1.2
--- enumclassregistry.cpp 29 Jun 2006 16:52:12 -0000 1.3
***************
*** 38,90 ****
namespace QuantLibAddin {
! /* *** StrikedTypePayoff *** */
! boost::shared_ptr<QuantLib::StrikedTypePayoff> SUPERSHARE_Payoff(const std::string& optionTypeID,
! const double &input1,
! const double &input2) {
! QuantLib::Option::Type type =
! Create<QuantLib::Option::Type>()(optionTypeID);
return boost::shared_ptr<QuantLib::StrikedTypePayoff> (
! new QuantLib::SuperSharePayoff(type, input1, input2));
}
! boost::shared_ptr<QuantLib::StrikedTypePayoff> VANILLA_Payoff(const std::string& optionTypeID,
! const double &input1,
! const double &input2) {
! QuantLib::Option::Type type =
! Create<QuantLib::Option::Type>()(optionTypeID);
return boost::shared_ptr<QuantLib::StrikedTypePayoff> (
! new QuantLib::PlainVanillaPayoff(type, input1));
}
! boost::shared_ptr<QuantLib::StrikedTypePayoff> PERCENTAGESTRIKE_Payoff(const std::string& optionTypeID,
! const double &input1,
! const double &input2) {
! QuantLib::Option::Type type =
! Create<QuantLib::Option::Type>()(optionTypeID);
return boost::shared_ptr<QuantLib::StrikedTypePayoff> (
! new QuantLib::PercentageStrikePayoff(type, input1));
}
! boost::shared_ptr<QuantLib::StrikedTypePayoff> ASSETORNOTHING_Payoff(const std::string& optionTypeID,
! const double &input1,
! const double &input2) {
! QuantLib::Option::Type type =
! Create<QuantLib::Option::Type>()(optionTypeID);
return boost::shared_ptr<QuantLib::StrikedTypePayoff> (
! new QuantLib::AssetOrNothingPayoff(type, input1));
}
! boost::shared_ptr<QuantLib::StrikedTypePayoff> CASHORNOTHING_Payoff(const std::string& optionTypeID,
! const double &input1,
! const double &input2) {
! QuantLib::Option::Type type =
! Create<QuantLib::Option::Type>()(optionTypeID);
return boost::shared_ptr<QuantLib::StrikedTypePayoff> (
! new QuantLib::CashOrNothingPayoff(type, input1, input2));
}
!
! boost::shared_ptr<QuantLib::StrikedTypePayoff> GAP_Payoff(const std::string& optionTypeID,
! const double &input1,
! const double &input2) {
! QuantLib::Option::Type type =
! Create<QuantLib::Option::Type>()(optionTypeID);
return boost::shared_ptr<QuantLib::StrikedTypePayoff> (
! new QuantLib::GapPayoff(type, input1, input2));
}
--- 38,81 ----
namespace QuantLibAddin {
! /* *** StrikedTypePayoff - one input*** */
! boost::shared_ptr<QuantLib::StrikedTypePayoff> VANILLA_Payoff(
! const QuantLib::Option::Type& optionType,
! const double &strike) {
return boost::shared_ptr<QuantLib::StrikedTypePayoff> (
! new QuantLib::PlainVanillaPayoff(optionType, strike));
}
! boost::shared_ptr<QuantLib::StrikedTypePayoff> ASSETORNOTHING_Payoff(
! const QuantLib::Option::Type& optionType,
! const double &strike) {
return boost::shared_ptr<QuantLib::StrikedTypePayoff> (
! new QuantLib::AssetOrNothingPayoff(optionType, strike));
}
! boost::shared_ptr<QuantLib::StrikedTypePayoff> PERCENTAGESTRIKE_Payoff(
! const QuantLib::Option::Type& optionType,
! const double &moneyness) {
return boost::shared_ptr<QuantLib::StrikedTypePayoff> (
! new QuantLib::PercentageStrikePayoff(optionType, moneyness));
}
! /* *** StrikedTypePayoff - two inputs*** */
! boost::shared_ptr<QuantLib::StrikedTypePayoff> SUPERSHARE_Payoff(
! const QuantLib::Option::Type& optionType,
! const double &strike,
! const double &strikeIncrement) {
return boost::shared_ptr<QuantLib::StrikedTypePayoff> (
! new QuantLib::SuperSharePayoff(optionType, strike, strikeIncrement));
}
! boost::shared_ptr<QuantLib::StrikedTypePayoff> CASHORNOTHING_Payoff(
! const QuantLib::Option::Type& optionType,
! const double &strike,
! const double &strikeIncrement) {
return boost::shared_ptr<QuantLib::StrikedTypePayoff> (
! new QuantLib::CashOrNothingPayoff(optionType, strike, strikeIncrement));
}
! boost::shared_ptr<QuantLib::StrikedTypePayoff> GAP_Payoff(
! const QuantLib::Option::Type& optionType,
! const double &strike,
! const double &strikeIncrement) {
return boost::shared_ptr<QuantLib::StrikedTypePayoff> (
! new QuantLib::GapPayoff(optionType, strike, strikeIncrement));
}
Index: forwardvanillaoption.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/forwardvanillaoption.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** forwardvanillaoption.hpp 29 Jun 2006 15:02:31 -0000 1.4
--- forwardvanillaoption.hpp 29 Jun 2006 16:52:12 -0000 1.5
***************
*** 31,37 ****
const long &resetDate,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
--- 31,35 ----
const long &resetDate,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
Index: europeanoption.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/europeanoption.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** europeanoption.cpp 29 Jun 2006 15:02:31 -0000 1.4
--- europeanoption.cpp 29 Jun 2006 16:52:12 -0000 1.5
***************
*** 32,42 ****
EuropeanOption::EuropeanOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
- boost::shared_ptr<QuantLib::StrikedTypePayoff> payoff =
- Create<boost::shared_ptr<QuantLib::StrikedTypePayoff> >()(optionTypeID, payoffID, strike);
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::EuropeanOption(
--- 32,38 ----
EuropeanOption::EuropeanOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::EuropeanOption(
Index: asianoption.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/asianoption.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** asianoption.hpp 29 Jun 2006 15:02:31 -0000 1.4
--- asianoption.hpp 29 Jun 2006 16:52:12 -0000 1.5
***************
*** 30,36 ****
const QuantLib::Average::Type &averageType,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
--- 30,34 ----
const QuantLib::Average::Type &averageType,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
***************
*** 45,51 ****
const std::vector < QuantLib::Date > &fixingDates,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
--- 43,47 ----
const std::vector < QuantLib::Date > &fixingDates,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
--- NEW FILE: payoffs.hpp ---
/*
Copyright (C) 2006 Eric Ehlers
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it under the
terms of the QuantLib license. You should have received a copy of the
license along with this program; if not, please email qua...@li...
The license is also available online at http://quantlib.org/html/license.html
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
#ifndef qla_payoffs_hpp
#define qla_payoffs_hpp
#include <oh/objhandler.hpp>
#include <ql/Instruments/payoffs.hpp>
namespace QuantLibAddin {
class StrikedTypePayoff : public ObjHandler::LibraryObject<QuantLib::StrikedTypePayoff> {
public:
StrikedTypePayoff(
const std::string& payoffID,
const QuantLib::Option::Type& optionType,
const double &strike);
StrikedTypePayoff(
const std::string& payoffID,
const QuantLib::Option::Type& optionType,
const double &strike,
const double &strikeIncrement);
};
}
#endif
Index: quantovanillaoption.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/quantovanillaoption.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** quantovanillaoption.cpp 29 Jun 2006 15:02:31 -0000 1.5
--- quantovanillaoption.cpp 29 Jun 2006 16:52:12 -0000 1.6
***************
*** 37,43 ****
const double &correlation,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
--- 37,41 ----
const double &correlation,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine) {
***************
*** 49,55 ****
new QuantLib::SimpleQuote(correlation)));
- boost::shared_ptr<QuantLib::StrikedTypePayoff> payoff =
- Create<boost::shared_ptr<QuantLib::StrikedTypePayoff> >()(optionTypeID, payoffID, strike);
-
libraryObject_ = boost::shared_ptr<QuantLib::Instrument>(
new QuantLib::QuantoVanillaOption(
--- 47,50 ----
Index: barrieroption.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/barrieroption.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** barrieroption.hpp 29 Jun 2006 15:02:31 -0000 1.4
--- barrieroption.hpp 29 Jun 2006 16:52:12 -0000 1.5
***************
*** 33,39 ****
const double &rebate,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
--- 33,37 ----
const double &rebate,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
Index: dividendvanillaoption.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/dividendvanillaoption.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** dividendvanillaoption.hpp 29 Jun 2006 15:02:31 -0000 1.4
--- dividendvanillaoption.hpp 29 Jun 2006 16:52:12 -0000 1.5
***************
*** 29,35 ****
DividendVanillaOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const std::vector < QuantLib::Date > ÷ndDates,
--- 29,33 ----
DividendVanillaOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const std::vector < QuantLib::Date > ÷ndDates,
Index: quantovanillaoption.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/quantovanillaoption.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** quantovanillaoption.hpp 29 Jun 2006 15:02:31 -0000 1.5
--- quantovanillaoption.hpp 29 Jun 2006 16:52:12 -0000 1.6
***************
*** 32,38 ****
const double &correlation,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
--- 32,36 ----
const double &correlation,
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
Index: vanillaoption.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/vanillaoption.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** vanillaoption.hpp 29 Jun 2006 15:02:31 -0000 1.5
--- vanillaoption.hpp 29 Jun 2006 16:52:12 -0000 1.6
***************
*** 29,35 ****
VanillaOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const std::string &optionTypeID,
! const std::string &payoffID,
! const double &strike,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
--- 29,33 ----
VanillaOption(
const boost::shared_ptr < QuantLib::GeneralizedBlackScholesProcess > &blackScholesProcess,
! const boost::shared_ptr<QuantLib::StrikedTypePayoff> &payoff,
const boost::shared_ptr < QuantLib::Exercise > &exercise,
const boost::shared_ptr<QuantLib::PricingEngine> &pricingEngine);
|