Skip to content

Commit

Permalink
Move chooser options from experimental to core
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Aug 25, 2023
1 parent 5dfcdca commit e0edbf1
Show file tree
Hide file tree
Showing 22 changed files with 350 additions and 239 deletions.
12 changes: 8 additions & 4 deletions QuantLib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,7 @@
<ClInclude Include="ql\instruments\capfloor.hpp" />
<ClInclude Include="ql\instruments\claim.hpp" />
<ClInclude Include="ql\instruments\cliquetoption.hpp" />
<ClInclude Include="ql\instruments\complexchooseroption.hpp" />
<ClInclude Include="ql\instruments\compositeinstrument.hpp" />
<ClInclude Include="ql\instruments\compoundoption.hpp" />
<ClInclude Include="ql\instruments\cpicapfloor.hpp" />
Expand Down Expand Up @@ -949,6 +950,7 @@
<ClInclude Include="ql\instruments\quantobarrieroption.hpp" />
<ClInclude Include="ql\instruments\quantoforwardvanillaoption.hpp" />
<ClInclude Include="ql\instruments\quantovanillaoption.hpp" />
<ClInclude Include="ql\instruments\simplechooseroption.hpp" />
<ClInclude Include="ql\instruments\simplifynotificationgraph.hpp" />
<ClInclude Include="ql\instruments\stickyratchet.hpp" />
<ClInclude Include="ql\instruments\stock.hpp" />
Expand Down Expand Up @@ -1530,8 +1532,10 @@
<ClInclude Include="ql\pricingengines\credit\midpointcdsengine.hpp" />
<ClInclude Include="ql\pricingengines\exotic\all.hpp" />
<ClInclude Include="ql\pricingengines\exotic\analyticamericanmargrabeengine.hpp" />
<ClInclude Include="ql\pricingengines\exotic\analyticcomplexchooserengine.hpp" />
<ClInclude Include="ql\pricingengines\exotic\analyticcompoundoptionengine.hpp" />
<ClInclude Include="ql\pricingengines\exotic\analyticeuropeanmargrabeengine.hpp" />
<ClInclude Include="ql\pricingengines\exotic\analyticsimplechooserengine.hpp" />
<ClInclude Include="ql\pricingengines\forward\all.hpp" />
<ClInclude Include="ql\pricingengines\forward\forwardengine.hpp" />
<ClInclude Include="ql\pricingengines\forward\forwardperformanceengine.hpp" />
Expand Down Expand Up @@ -2019,15 +2023,12 @@
<ClCompile Include="ql\experimental\credit\riskyassetswap.cpp" />
<ClCompile Include="ql\experimental\credit\riskyassetswapoption.cpp" />
<ClCompile Include="ql\experimental\credit\syntheticcdo.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\analyticcomplexchooserengine.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\analyticholderextensibleoptionengine.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\analyticpartialtimebarrieroptionengine.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\analyticpdfhestonengine.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\analyticsimplechooserengine.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\analytictwoassetbarrierengine.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\analytictwoassetcorrelationengine.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\analyticwriterextensibleoptionengine.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\complexchooseroption.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\continuousarithmeticasianlevyengine.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\continuousarithmeticasianvecerengine.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\everestoption.cpp" />
Expand All @@ -2039,7 +2040,6 @@
<ClCompile Include="ql\experimental\exoticoptions\mcpagodaengine.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\pagodaoption.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\partialtimebarrieroption.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\simplechooseroption.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\twoassetbarrieroption.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\twoassetcorrelationoption.cpp" />
<ClCompile Include="ql\experimental\exoticoptions\writerextensibleoption.cpp" />
Expand Down Expand Up @@ -2171,6 +2171,7 @@
<ClCompile Include="ql\instruments\capfloor.cpp" />
<ClCompile Include="ql\instruments\claim.cpp" />
<ClCompile Include="ql\instruments\cliquetoption.cpp" />
<ClCompile Include="ql\instruments\complexchooseroption.cpp" />
<ClCompile Include="ql\instruments\compositeinstrument.cpp" />
<ClCompile Include="ql\instruments\compoundoption.cpp" />
<ClCompile Include="ql\instruments\cpicapfloor.cpp" />
Expand Down Expand Up @@ -2209,6 +2210,7 @@
<ClCompile Include="ql\instruments\quantobarrieroption.cpp" />
<ClCompile Include="ql\instruments\quantoforwardvanillaoption.cpp" />
<ClCompile Include="ql\instruments\quantovanillaoption.cpp" />
<ClCompile Include="ql\instruments\simplechooseroption.cpp" />
<ClCompile Include="ql\instruments\simplifynotificationgraph.cpp" />
<ClCompile Include="ql\instruments\stickyratchet.cpp" />
<ClCompile Include="ql\instruments\stock.cpp" />
Expand Down Expand Up @@ -2587,8 +2589,10 @@
<ClCompile Include="ql\pricingengines\credit\isdacdsengine.cpp" />
<ClCompile Include="ql\pricingengines\credit\midpointcdsengine.cpp" />
<ClCompile Include="ql\pricingengines\exotic\analyticamericanmargrabeengine.cpp" />
<ClCompile Include="ql\pricingengines\exotic\analyticcomplexchooserengine.cpp" />
<ClCompile Include="ql\pricingengines\exotic\analyticcompoundoptionengine.cpp" />
<ClCompile Include="ql\pricingengines\exotic\analyticeuropeanmargrabeengine.cpp" />
<ClCompile Include="ql\pricingengines\exotic\analyticsimplechooserengine.cpp" />
<ClCompile Include="ql\pricingengines\forward\mcforwardeuropeanbsengine.cpp" />
<ClCompile Include="ql\pricingengines\forward\mcforwardeuropeanhestonengine.cpp" />
<ClCompile Include="ql\pricingengines\greeks.cpp" />
Expand Down
36 changes: 24 additions & 12 deletions QuantLib.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,9 @@
<ClInclude Include="ql\instruments\cliquetoption.hpp">
<Filter>instruments</Filter>
</ClInclude>
<ClInclude Include="ql\instruments\complexchooseroption.hpp">
<Filter>instruments</Filter>
</ClInclude>
<ClInclude Include="ql\instruments\compositeinstrument.hpp">
<Filter>instruments</Filter>
</ClInclude>
Expand Down Expand Up @@ -891,6 +894,9 @@
<ClInclude Include="ql\instruments\quantovanillaoption.hpp">
<Filter>instruments</Filter>
</ClInclude>
<ClInclude Include="ql\instruments\simplechooseroption.hpp">
<Filter>instruments</Filter>
</ClInclude>
<ClInclude Include="ql\instruments\simplifynotificationgraph.hpp">
<Filter>instruments</Filter>
</ClInclude>
Expand Down Expand Up @@ -2433,12 +2439,18 @@
<ClInclude Include="ql\pricingengines\exotic\analyticamericanmargrabeengine.hpp">
<Filter>pricingengines\exotic</Filter>
</ClInclude>
<ClInclude Include="ql\pricingengines\exotic\analyticcomplexchooserengine.hpp">
<Filter>pricingengines\exotic</Filter>
</ClInclude>
<ClInclude Include="ql\pricingengines\exotic\analyticcompoundoptionengine.hpp">
<Filter>pricingengines\exotic</Filter>
</ClInclude>
<ClInclude Include="ql\pricingengines\exotic\analyticeuropeanmargrabeengine.hpp">
<Filter>pricingengines\exotic</Filter>
</ClInclude>
<ClInclude Include="ql\pricingengines\exotic\analyticsimplechooserengine.hpp">
<Filter>pricingengines\exotic</Filter>
</ClInclude>
<ClInclude Include="ql\pricingengines\forward\all.hpp">
<Filter>pricingengines\forward</Filter>
</ClInclude>
Expand Down Expand Up @@ -4682,6 +4694,9 @@
<ClCompile Include="ql\instruments\cliquetoption.cpp">
<Filter>instruments</Filter>
</ClCompile>
<ClCompile Include="ql\instruments\complexchooseroption.cpp">
<Filter>instruments</Filter>
</ClCompile>
<ClCompile Include="ql\instruments\compositeinstrument.cpp">
<Filter>instruments</Filter>
</ClCompile>
Expand Down Expand Up @@ -4763,6 +4778,9 @@
<ClCompile Include="ql\instruments\quantovanillaoption.cpp">
<Filter>instruments</Filter>
</ClCompile>
<ClCompile Include="ql\instruments\simplechooseroption.cpp">
<Filter>instruments</Filter>
</ClCompile>
<ClCompile Include="ql\instruments\simplifynotificationgraph.cpp">
<Filter>instruments</Filter>
</ClCompile>
Expand Down Expand Up @@ -5843,12 +5861,18 @@
<ClCompile Include="ql\pricingengines\exotic\analyticamericanmargrabeengine.cpp">
<Filter>pricingengines\exotic</Filter>
</ClCompile>
<ClCompile Include="ql\pricingengines\exotic\analyticcomplexchooserengine.cpp">
<Filter>pricingengines\exotic</Filter>
</ClCompile>
<ClCompile Include="ql\pricingengines\exotic\analyticcompoundoptionengine.cpp">
<Filter>pricingengines\exotic</Filter>
</ClCompile>
<ClCompile Include="ql\pricingengines\exotic\analyticeuropeanmargrabeengine.cpp">
<Filter>pricingengines\exotic</Filter>
</ClCompile>
<ClCompile Include="ql\pricingengines\exotic\analyticsimplechooserengine.cpp">
<Filter>pricingengines\exotic</Filter>
</ClCompile>
<ClCompile Include="ql\pricingengines\lookback\analyticcontinuousfixedlookback.cpp">
<Filter>pricingengines\lookback</Filter>
</ClCompile>
Expand Down Expand Up @@ -6248,9 +6272,6 @@
<ClCompile Include="ql\experimental\fx\deltavolquote.cpp">
<Filter>experimental\fx</Filter>
</ClCompile>
<ClCompile Include="ql\experimental\exoticoptions\analyticcomplexchooserengine.cpp">
<Filter>experimental\exoticoptions</Filter>
</ClCompile>
<ClCompile Include="ql\experimental\exoticoptions\analyticholderextensibleoptionengine.cpp">
<Filter>experimental\exoticoptions</Filter>
</ClCompile>
Expand All @@ -6260,9 +6281,6 @@
<ClCompile Include="ql\experimental\exoticoptions\analyticpdfhestonengine.cpp">
<Filter>experimental\exoticoptions</Filter>
</ClCompile>
<ClCompile Include="ql\experimental\exoticoptions\analyticsimplechooserengine.cpp">
<Filter>experimental\exoticoptions</Filter>
</ClCompile>
<ClCompile Include="ql\experimental\exoticoptions\analytictwoassetbarrierengine.cpp">
<Filter>experimental\exoticoptions</Filter>
</ClCompile>
Expand All @@ -6272,9 +6290,6 @@
<ClCompile Include="ql\experimental\exoticoptions\analyticwriterextensibleoptionengine.cpp">
<Filter>experimental\exoticoptions</Filter>
</ClCompile>
<ClCompile Include="ql\experimental\exoticoptions\complexchooseroption.cpp">
<Filter>experimental\exoticoptions</Filter>
</ClCompile>
<ClCompile Include="ql\experimental\exoticoptions\continuousarithmeticasianlevyengine.cpp">
<Filter>experimental\exoticoptions</Filter>
</ClCompile>
Expand Down Expand Up @@ -6308,9 +6323,6 @@
<ClCompile Include="ql\experimental\exoticoptions\partialtimebarrieroption.cpp">
<Filter>experimental\exoticoptions</Filter>
</ClCompile>
<ClCompile Include="ql\experimental\exoticoptions\simplechooseroption.cpp">
<Filter>experimental\exoticoptions</Filter>
</ClCompile>
<ClCompile Include="ql\experimental\exoticoptions\twoassetbarrieroption.cpp">
<Filter>experimental\exoticoptions</Filter>
</ClCompile>
Expand Down
12 changes: 8 additions & 4 deletions ql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,12 @@ set(QL_SOURCES
experimental/credit/riskyassetswap.cpp
experimental/credit/riskyassetswapoption.cpp
experimental/credit/syntheticcdo.cpp
experimental/exoticoptions/analyticcomplexchooserengine.cpp
experimental/exoticoptions/analyticholderextensibleoptionengine.cpp
experimental/exoticoptions/analyticpartialtimebarrieroptionengine.cpp
experimental/exoticoptions/analyticpdfhestonengine.cpp
experimental/exoticoptions/analyticsimplechooserengine.cpp
experimental/exoticoptions/analytictwoassetbarrierengine.cpp
experimental/exoticoptions/analytictwoassetcorrelationengine.cpp
experimental/exoticoptions/analyticwriterextensibleoptionengine.cpp
experimental/exoticoptions/complexchooseroption.cpp
experimental/exoticoptions/continuousarithmeticasianlevyengine.cpp
experimental/exoticoptions/continuousarithmeticasianvecerengine.cpp
experimental/exoticoptions/everestoption.cpp
Expand All @@ -143,7 +140,6 @@ set(QL_SOURCES
experimental/exoticoptions/mcpagodaengine.cpp
experimental/exoticoptions/pagodaoption.cpp
experimental/exoticoptions/partialtimebarrieroption.cpp
experimental/exoticoptions/simplechooseroption.cpp
experimental/exoticoptions/twoassetbarrieroption.cpp
experimental/exoticoptions/twoassetcorrelationoption.cpp
experimental/exoticoptions/writerextensibleoption.cpp
Expand Down Expand Up @@ -277,6 +273,7 @@ set(QL_SOURCES
instruments/capfloor.cpp
instruments/claim.cpp
instruments/cliquetoption.cpp
instruments/complexchooseroption.cpp
instruments/compositeinstrument.cpp
instruments/compoundoption.cpp
instruments/cpicapfloor.cpp
Expand Down Expand Up @@ -315,6 +312,7 @@ set(QL_SOURCES
instruments/quantobarrieroption.cpp
instruments/quantoforwardvanillaoption.cpp
instruments/quantovanillaoption.cpp
instruments/simplechooseroption.cpp
instruments/simplifynotificationgraph.cpp
instruments/stickyratchet.cpp
instruments/stock.cpp
Expand Down Expand Up @@ -698,8 +696,10 @@ set(QL_SOURCES
pricingengines/credit/isdacdsengine.cpp
pricingengines/credit/midpointcdsengine.cpp
pricingengines/exotic/analyticamericanmargrabeengine.cpp
pricingengines/exotic/analyticcomplexchooserengine.cpp
pricingengines/exotic/analyticcompoundoptionengine.cpp
pricingengines/exotic/analyticeuropeanmargrabeengine.cpp
pricingengines/exotic/analyticsimplechooserengine.cpp
pricingengines/forward/mcforwardeuropeanbsengine.cpp
pricingengines/forward/mcforwardeuropeanhestonengine.cpp
pricingengines/greeks.cpp
Expand Down Expand Up @@ -1324,6 +1324,7 @@ set(QL_HEADERS
instruments/capfloor.hpp
instruments/claim.hpp
instruments/cliquetoption.hpp
instruments/complexchooseroption.hpp
instruments/compositeinstrument.hpp
instruments/compoundoption.hpp
instruments/cpicapfloor.hpp
Expand Down Expand Up @@ -1364,6 +1365,7 @@ set(QL_HEADERS
instruments/quantobarrieroption.hpp
instruments/quantoforwardvanillaoption.hpp
instruments/quantovanillaoption.hpp
instruments/simplechooseroption.hpp
instruments/simplifynotificationgraph.hpp
instruments/stickyratchet.hpp
instruments/stock.hpp
Expand Down Expand Up @@ -1901,8 +1903,10 @@ set(QL_HEADERS
pricingengines/credit/isdacdsengine.hpp
pricingengines/credit/midpointcdsengine.hpp
pricingengines/exotic/analyticamericanmargrabeengine.hpp
pricingengines/exotic/analyticcomplexchooserengine.hpp
pricingengines/exotic/analyticcompoundoptionengine.hpp
pricingengines/exotic/analyticeuropeanmargrabeengine.hpp
pricingengines/exotic/analyticsimplechooserengine.hpp
pricingengines/forward/forwardengine.hpp
pricingengines/forward/forwardperformanceengine.hpp
pricingengines/forward/mcforwardeuropeanbsengine.hpp
Expand Down
10 changes: 5 additions & 5 deletions ql/experimental/exoticoptions/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,12 @@ this_include_HEADERS = \
writerextensibleoption.hpp

cpp_files = \
analyticcomplexchooserengine.cpp \
analyticholderextensibleoptionengine.cpp \
analyticpartialtimebarrieroptionengine.cpp \
analyticpdfhestonengine.cpp \
analyticsimplechooserengine.cpp \
analytictwoassetbarrierengine.cpp \
analytictwoassetcorrelationengine.cpp \
analyticwriterextensibleoptionengine.cpp \
complexchooseroption.cpp \
continuousarithmeticasianlevyengine.cpp \
continuousarithmeticasianvecerengine.cpp \
everestoption.cpp \
Expand All @@ -56,7 +53,6 @@ cpp_files = \
mcpagodaengine.cpp \
pagodaoption.cpp \
partialtimebarrieroption.cpp \
simplechooseroption.cpp \
twoassetbarrieroption.cpp \
twoassetcorrelationoption.cpp \
writerextensibleoption.cpp
Expand Down Expand Up @@ -92,7 +88,11 @@ all.hpp: Makefile.am
analyticamericanmargrabeengine.hpp \
analyticeuropeanmargrabeengine.hpp \
compoundoption.hpp \
analyticcompoundoptionengine.hpp, $(this_include_HEADERS)); do \
analyticcompoundoptionengine.hpp \
simplechooseroption.hpp \
analyticsimplechooserengine.hpp \
complexchooseroption.hpp \
analyticcomplexchooserengine.hpp, $(this_include_HEADERS)); do \
echo "#include <${subdir}/$$i>" >> ${srcdir}/$@; \
done
echo >> ${srcdir}/$@
Expand Down
4 changes: 0 additions & 4 deletions ql/experimental/exoticoptions/all.hpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
/* This file is automatically generated; do not edit. */
/* Add the files to be included into Makefile.am instead. */

#include <ql/experimental/exoticoptions/analyticcomplexchooserengine.hpp>
#include <ql/experimental/exoticoptions/analyticholderextensibleoptionengine.hpp>
#include <ql/experimental/exoticoptions/analyticpartialtimebarrieroptionengine.hpp>
#include <ql/experimental/exoticoptions/analyticpdfhestonengine.hpp>
#include <ql/experimental/exoticoptions/analyticsimplechooserengine.hpp>
#include <ql/experimental/exoticoptions/analytictwoassetbarrierengine.hpp>
#include <ql/experimental/exoticoptions/analytictwoassetcorrelationengine.hpp>
#include <ql/experimental/exoticoptions/analyticwriterextensibleoptionengine.hpp>
#include <ql/experimental/exoticoptions/complexchooseroption.hpp>
#include <ql/experimental/exoticoptions/continuousarithmeticasianlevyengine.hpp>
#include <ql/experimental/exoticoptions/continuousarithmeticasianvecerengine.hpp>
#include <ql/experimental/exoticoptions/everestoption.hpp>
Expand All @@ -21,7 +18,6 @@
#include <ql/experimental/exoticoptions/mcpagodaengine.hpp>
#include <ql/experimental/exoticoptions/pagodaoption.hpp>
#include <ql/experimental/exoticoptions/partialtimebarrieroption.hpp>
#include <ql/experimental/exoticoptions/simplechooseroption.hpp>
#include <ql/experimental/exoticoptions/spreadoption.hpp>
#include <ql/experimental/exoticoptions/twoassetbarrieroption.hpp>
#include <ql/experimental/exoticoptions/twoassetcorrelationoption.hpp>
Expand Down
45 changes: 3 additions & 42 deletions ql/experimental/exoticoptions/analyticcomplexchooserengine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,7 @@
FOR A PARTICULAR PURPOSE. See the license for more details.
*/

/*! \file analyticcomplexchooserengine.hpp
\brief Analytic engine for complex chooser option
*/

#ifndef quantlib_analytic_complex_chooser_engine_hpp
#define quantlib_analytic_complex_chooser_engine_hpp

#include <ql/experimental/exoticoptions/complexchooseroption.hpp>
#include <ql/processes/blackscholesprocess.hpp>
#include <ql/pricingengines/blackscholescalculator.hpp>

namespace QuantLib {

class AnalyticComplexChooserEngine : public ComplexChooserOption::engine {
public:
explicit AnalyticComplexChooserEngine(
ext::shared_ptr<GeneralizedBlackScholesProcess> process);
void calculate() const override;

private:
ext::shared_ptr<GeneralizedBlackScholesProcess> process_;
Real strike(Option::Type optionType) const;
Time choosingTime() const;
Time putMaturity() const;
Time callMaturity() const;
Volatility volatility(Time t) const;

Rate dividendYield(Time t) const;
DiscountFactor dividendDiscount(Time t) const;

Rate riskFreeRate(Time t) const;
DiscountFactor riskFreeDiscount(Time t) const;

BlackScholesCalculator bsCalculator(Real spot,
Option::Type optionType) const;
Real CriticalValueChooser() const;
Real ComplexChooser() const;
};

}

// Deprecated in version 1.32
#pragma message("Warning: this file will disappear in a future release; include <ql/pricingengines/exotic/analyticcomplexchooserengine.hpp> instead.")

#endif
#include <ql/pricingengines/exotic/analyticcomplexchooserengine.hpp>
Loading

0 comments on commit e0edbf1

Please sign in to comment.