diff --git a/.gitignore b/.gitignore index a81835c4ed9..11e26081751 100644 --- a/.gitignore +++ b/.gitignore @@ -101,9 +101,9 @@ Examples/GlobalOptimizer/GlobalOptimizer Examples/LatentModel/LatentModel Examples/MarketModels/MarketModels Examples/MultidimIntegral/MultidimIntegral +Examples/MulticurveBootstrapping/MulticurveBootstrapping Examples/Replication/Replication Examples/Repo/Repo -Examples/Swap/SwapValuation test-suite/quantlib-test-suite test-suite/quantlib-benchmark test-suite/bin/*.exp diff --git a/Docs/pages/examples.docs b/Docs/pages/examples.docs index c722e3fbe1c..883cad7f813 100644 --- a/Docs/pages/examples.docs +++ b/Docs/pages/examples.docs @@ -117,7 +117,7 @@ done by supplying the FixedCouponBondForward constructor with a flat repo YieldTermStructure. - \example swapvaluation.cpp + \example MulticurveBootstrapping.cpp This example prices an interest rate swap over a term structure and calculates its fair fixed rate and floating spread. diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index c578c9b4c22..b829ae72c9b 100644 --- a/Examples/CMakeLists.txt +++ b/Examples/CMakeLists.txt @@ -14,6 +14,6 @@ add_subdirectory(GlobalOptimizer) add_subdirectory(LatentModel) add_subdirectory(MarketModels) add_subdirectory(MultidimIntegral) +add_subdirectory(MulticurveBootstrapping) add_subdirectory(Replication) add_subdirectory(Repo) -add_subdirectory(Swap) diff --git a/Examples/Makefile.am b/Examples/Makefile.am index 70d877fa758..9bc47f94a5f 100644 --- a/Examples/Makefile.am +++ b/Examples/Makefile.am @@ -18,9 +18,9 @@ SUBDIRS = \ LatentModel \ MarketModels \ MultidimIntegral \ + MulticurveBootstrapping \ Replication \ - Repo \ - Swap + Repo SUBDIR_CHECKS = $(SUBDIRS:%=%.check) diff --git a/Examples/MulticurveBootstrapping/CMakeLists.txt b/Examples/MulticurveBootstrapping/CMakeLists.txt new file mode 100644 index 00000000000..6a6421dfdca --- /dev/null +++ b/Examples/MulticurveBootstrapping/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(MulticurveBootstrapping MulticurveBootstrapping.cpp) +target_link_libraries(MulticurveBootstrapping ${QL_LINK_LIBRARY}) diff --git a/Examples/MulticurveBootstrapping/Makefile.am b/Examples/MulticurveBootstrapping/Makefile.am new file mode 100644 index 00000000000..b88b1c816ef --- /dev/null +++ b/Examples/MulticurveBootstrapping/Makefile.am @@ -0,0 +1,29 @@ + +AM_CPPFLAGS = -I${top_builddir} -I${top_srcdir} + +if AUTO_EXAMPLES +bin_PROGRAMS = MulticurveBootstrapping +TESTS = MulticurveBootstrapping$(EXEEXT) +else +noinst_PROGRAMS = MulticurveBootstrapping +endif +MulticurveBootstrapping_SOURCES = MulticurveBootstrapping.cpp +MulticurveBootstrapping_LDADD = ../../ql/libQuantLib.la ${BOOST_THREAD_LIB} + +EXTRA_DIST = \ + CMakeLists.txt \ + MulticurveBootstrapping.vcxproj \ + MulticurveBootstrapping.vcxproj.filters \ + README.txt + +.PHONY: examples check-examples + +examples: MulticurveBootstrapping$(EXEEXT) + +check-examples: examples + ./MulticurveBootstrapping$(EXEEXT) + +dist-hook: + mkdir -p $(distdir)/bin + mkdir -p $(distdir)/build + diff --git a/Examples/MulticurveBootstrapping/MulticurveBootstrapping.cpp b/Examples/MulticurveBootstrapping/MulticurveBootstrapping.cpp index 982756a9721..80eb6f4e236 100644 --- a/Examples/MulticurveBootstrapping/MulticurveBootstrapping.cpp +++ b/Examples/MulticurveBootstrapping/MulticurveBootstrapping.cpp @@ -22,10 +22,8 @@ /* This example shows how to set up a Term Structure with ois Discounting and then price a simple 5 year swap. - - Boilerplate code was taken from swapvaluation.cpp - Example based on market data in paper by F. M. Ametrano and M. Blanchetti, + Example based on market data in paper by F. M. Ametrano and M. Bianchetti, Everything You Always WAnted to Know About Multiple Interest RAte Curve Boostrapping but Were Afraid to Ask (April 2, 2013). http://ssrn.com/abstract=2219548 @@ -319,7 +317,7 @@ int main(int, char* []) { double tolerance = 1.0e-15; // Eonia curve - std::vector> eoniaInstruments; + std::vector > eoniaInstruments; eoniaInstruments.push_back(dON); eoniaInstruments.push_back(dTN); eoniaInstruments.push_back(dSN); diff --git a/Examples/MulticurveBootstrapping/MulticurveBootstrapping.vcxproj b/Examples/MulticurveBootstrapping/MulticurveBootstrapping.vcxproj index d738e97e804..989d05d8e61 100644 --- a/Examples/MulticurveBootstrapping/MulticurveBootstrapping.vcxproj +++ b/Examples/MulticurveBootstrapping/MulticurveBootstrapping.vcxproj @@ -1,569 +1,537 @@ - - - - - Debug (static runtime) - Win32 - - - Debug (static runtime) - x64 - - - Debug - Win32 - - - Debug - x64 - - - Release (static runtime) - Win32 - - - Release (static runtime) - x64 - - - Release - Win32 - - - Release - x64 - - - - MulticurveBootstrapping - {EDB14DD0-2191-401B-97D1-4C86AF984783} - $(VCTargetsPath11) - - - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - .\bin\ - .\bin\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - true - false - false - .\bin\ - .\bin\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - true - false - false - .\bin\ - .\bin\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - false - false - false - false - .\bin\ - .\bin\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - false - false - false - false - SwapValuation-$(qlCompilerTag)-mt-sgd - SwapValuation-$(qlCompilerTag)-x64-mt-sgd - SwapValuation-$(qlCompilerTag)-mt-gd - SwapValuation-$(qlCompilerTag)-x64-mt-gd - SwapValuation-$(qlCompilerTag)-mt-s - SwapValuation-$(qlCompilerTag)-x64-mt-s - SwapValuation-$(qlCompilerTag)-mt - SwapValuation-$(qlCompilerTag)-x64-mt - - - D:\Jose_Files\GitHub\_j053_\QuantLib\ql;D:\Jose_Files\GitHub\_j053_\boost_1_68_0;$(IncludePath) - D:\Jose_Files\GitHub\_j053_\QuantLib\lib;D:\Jose_Files\GitHub\_j053_\boost_1_68_0\lib32-msvc-14.1;$(LibraryPath) - - - D:\Jose_Files\GitHub\_j053_\QuantLib\ql;D:\Jose_Files\GitHub\_j053_\boost_1_68_0;$(IncludePath) - D:\Jose_Files\GitHub\_j053_\QuantLib\lib;D:\Jose_Files\GitHub\_j053_\boost_1_68_0\lib32-msvc-14.1;$(LibraryPath) - - - D:\Jose_Files\GitHub\_j053_\QuantLib\ql;D:\Jose_Files\GitHub\_j053_\boost_1_68_0;$(IncludePath) - D:\Jose_Files\GitHub\_j053_\QuantLib\lib;D:\Jose_Files\GitHub\_j053_\boost_1_68_0\lib32-msvc-14.1;$(LibraryPath) - - - D:\Jose_Files\GitHub\_j053_\QuantLib\ql;D:\Jose_Files\GitHub\_j053_\boost_1_68_0;$(IncludePath) - D:\Jose_Files\GitHub\_j053_\QuantLib\lib;D:\Jose_Files\GitHub\_j053_\boost_1_68_0\lib32-msvc-14.1;$(LibraryPath) - - - D:\Jose_Files\GitHub\_j053_\QuantLib\ql;D:\Jose_Files\GitHub\_j053_\boost_1_68_0;$(IncludePath) - D:\Jose_Files\GitHub\_j053_\QuantLib\lib;D:\Jose_Files\GitHub\_j053_\boost_1_68_0\lib32-msvc-14.1;$(LibraryPath) - - - D:\Jose_Files\GitHub\_j053_\QuantLib\ql;D:\Jose_Files\GitHub\_j053_\boost_1_68_0;$(IncludePath) - D:\Jose_Files\GitHub\_j053_\QuantLib\lib;D:\Jose_Files\GitHub\_j053_\boost_1_68_0\lib32-msvc-14.1;$(LibraryPath) - - - D:\Jose_Files\GitHub\_j053_\QuantLib\ql;D:\Jose_Files\GitHub\_j053_\boost_1_68_0;$(IncludePath) - D:\Jose_Files\GitHub\_j053_\QuantLib\lib;D:\Jose_Files\GitHub\_j053_\boost_1_68_0\lib32-msvc-14.1;$(LibraryPath) - - - D:\Jose_Files\GitHub\_j053_\QuantLib\ql;D:\Jose_Files\GitHub\_j053_\boost_1_68_0;$(IncludePath) - D:\Jose_Files\GitHub\_j053_\QuantLib\lib;D:\Jose_Files\GitHub\_j053_\boost_1_68_0\lib32-msvc-14.1;$(LibraryPath) - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - Disabled - false - ..\..;%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - EditAndContinue - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - MachineX86 - false - - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - Disabled - false - ..\..;%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - ProgramDatabase - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - Disabled - false - ..\..;%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - EditAndContinue - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - MachineX86 - false - - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - Disabled - false - ..\..;%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - ProgramDatabase - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - MaxSpeed - AnySuitable - false - Speed - ..\..;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - MachineX86 - - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - MaxSpeed - AnySuitable - false - Speed - ..\..;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - MaxSpeed - AnySuitable - false - Speed - ..\..;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - MultiThreaded - true - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - MachineX86 - - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - MaxSpeed - AnySuitable - false - Speed - ..\..;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - MultiThreaded - true - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - - - - - - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} - false - - - - - - \ No newline at end of file + + + + + Debug (static runtime) + Win32 + + + Debug (static runtime) + x64 + + + Debug + Win32 + + + Debug + x64 + + + Release (static runtime) + Win32 + + + Release (static runtime) + x64 + + + Release + Win32 + + + Release + x64 + + + + MulticurveBootstrapping + {4EAC6A0E-20F2-4B5A-8250-7E930CCE3AD0} + $(VCTargetsPath11) + + + + + Application + false + MultiByte + + + Application + false + MultiByte + + + Application + false + MultiByte + + + Application + false + MultiByte + + + Application + false + MultiByte + + + Application + false + MultiByte + + + Application + false + MultiByte + + + Application + false + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + .\bin\ + .\bin\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + true + true + false + false + .\bin\ + .\bin\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + true + true + false + false + .\bin\ + .\bin\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + false + false + false + false + .\bin\ + .\bin\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + false + false + false + false + MulticurveBootstrapping-$(qlCompilerTag)-mt-sgd + MulticurveBootstrapping-$(qlCompilerTag)-x64-mt-sgd + MulticurveBootstrapping-$(qlCompilerTag)-mt-gd + MulticurveBootstrapping-$(qlCompilerTag)-x64-mt-gd + MulticurveBootstrapping-$(qlCompilerTag)-mt-s + MulticurveBootstrapping-$(qlCompilerTag)-x64-mt-s + MulticurveBootstrapping-$(qlCompilerTag)-mt + MulticurveBootstrapping-$(qlCompilerTag)-x64-mt + + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.tlb + + + + + Disabled + false + ..\..;%(AdditionalIncludeDirectories) + _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + false + true + true + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pch + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + true + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + Level3 + true + EditAndContinue + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)$(TargetName)$(TargetExt) + true + ..\..\lib;%(AdditionalLibraryDirectories) + true + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pdb + Console + false + + + MachineX86 + false + + + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.tlb + + + + + Disabled + false + ..\..;%(AdditionalIncludeDirectories) + _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + false + true + true + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pch + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + true + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + Level3 + true + ProgramDatabase + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)$(TargetName)$(TargetExt) + true + ..\..\lib;%(AdditionalLibraryDirectories) + true + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pdb + Console + false + + + + + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.tlb + + + + + Disabled + false + ..\..;%(AdditionalIncludeDirectories) + _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + false + true + true + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pch + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + true + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + Level3 + true + EditAndContinue + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)$(TargetName)$(TargetExt) + true + ..\..\lib;%(AdditionalLibraryDirectories) + true + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pdb + Console + false + + + MachineX86 + false + + + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.tlb + + + + + Disabled + false + ..\..;%(AdditionalIncludeDirectories) + _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + false + true + true + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pch + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + true + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + Level3 + true + ProgramDatabase + Default + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)$(TargetName)$(TargetExt) + true + ..\..\lib;%(AdditionalLibraryDirectories) + true + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pdb + Console + false + + + + + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.tlb + + + + + MaxSpeed + AnySuitable + false + Speed + ..\..;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + false + true + true + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pch + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + true + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + Level3 + true + Default + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)$(TargetName)$(TargetExt) + true + ..\..\lib;%(AdditionalLibraryDirectories) + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pdb + Console + false + + + MachineX86 + + + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.tlb + + + + + MaxSpeed + AnySuitable + false + Speed + ..\..;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + false + true + true + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pch + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + true + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + Level3 + true + Default + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)$(TargetName)$(TargetExt) + true + ..\..\lib;%(AdditionalLibraryDirectories) + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pdb + Console + false + + + + + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.tlb + + + + + MaxSpeed + AnySuitable + false + Speed + ..\..;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + true + MultiThreaded + true + false + true + true + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pch + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + true + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + Level3 + true + Default + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)$(TargetName)$(TargetExt) + true + ..\..\lib;%(AdditionalLibraryDirectories) + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pdb + Console + false + + + MachineX86 + + + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.tlb + + + + + MaxSpeed + AnySuitable + false + Speed + ..\..;%(AdditionalIncludeDirectories) + NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + true + MultiThreaded + true + false + true + true + + + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pch + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + true + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ + Level3 + true + Default + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + $(OutDir)$(TargetName)$(TargetExt) + true + ..\..\lib;%(AdditionalLibraryDirectories) + .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\MulticurveBootstrapping.pdb + Console + false + + + + + + + + + + {ad0a27da-91da-46a2-acbd-296c419ed3aa} + false + + + + + + diff --git a/Examples/Swap/Swap.vcxproj.filters b/Examples/MulticurveBootstrapping/MulticurveBootstrapping.vcxproj.filters similarity index 90% rename from Examples/Swap/Swap.vcxproj.filters rename to Examples/MulticurveBootstrapping/MulticurveBootstrapping.vcxproj.filters index 3262023f74d..d4782bc4966 100644 --- a/Examples/Swap/Swap.vcxproj.filters +++ b/Examples/MulticurveBootstrapping/MulticurveBootstrapping.vcxproj.filters @@ -15,8 +15,8 @@ - + Source Files - \ No newline at end of file + diff --git a/Examples/Swap/README.txt b/Examples/MulticurveBootstrapping/README.txt similarity index 100% rename from Examples/Swap/README.txt rename to Examples/MulticurveBootstrapping/README.txt diff --git a/Examples/Swap/CMakeLists.txt b/Examples/Swap/CMakeLists.txt deleted file mode 100644 index 722f3ccf8fd..00000000000 --- a/Examples/Swap/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_executable(SwapValuation swapvaluation.cpp) -target_link_libraries(SwapValuation ${QL_LINK_LIBRARY}) \ No newline at end of file diff --git a/Examples/Swap/Makefile.am b/Examples/Swap/Makefile.am deleted file mode 100644 index 8bd49f2435d..00000000000 --- a/Examples/Swap/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ - -AM_CPPFLAGS = -I${top_builddir} -I${top_srcdir} - -if AUTO_EXAMPLES -bin_PROGRAMS = SwapValuation -TESTS = SwapValuation$(EXEEXT) -else -noinst_PROGRAMS = SwapValuation -endif -SwapValuation_SOURCES = swapvaluation.cpp -SwapValuation_LDADD = ../../ql/libQuantLib.la ${BOOST_THREAD_LIB} - -EXTRA_DIST = \ - CMakeLists.txt \ - Swap.vcxproj \ - Swap.vcxproj.filters \ - README.txt - -.PHONY: examples check-examples - -examples: SwapValuation$(EXEEXT) - -check-examples: examples - ./SwapValuation$(EXEEXT) - -dist-hook: - mkdir -p $(distdir)/bin - mkdir -p $(distdir)/build - diff --git a/Examples/Swap/Swap.vcxproj b/Examples/Swap/Swap.vcxproj deleted file mode 100644 index 0d299e5e6a3..00000000000 --- a/Examples/Swap/Swap.vcxproj +++ /dev/null @@ -1,537 +0,0 @@ - - - - - Debug (static runtime) - Win32 - - - Debug (static runtime) - x64 - - - Debug - Win32 - - - Debug - x64 - - - Release (static runtime) - Win32 - - - Release (static runtime) - x64 - - - Release - Win32 - - - Release - x64 - - - - Swap - {4EAC6A0E-20F2-4B5A-8250-7E930CCE3AD0} - $(VCTargetsPath11) - - - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - .\bin\ - .\bin\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - true - false - false - .\bin\ - .\bin\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - true - false - false - .\bin\ - .\bin\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - false - false - false - false - .\bin\ - .\bin\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - false - false - false - false - SwapValuation-$(qlCompilerTag)-mt-sgd - SwapValuation-$(qlCompilerTag)-x64-mt-sgd - SwapValuation-$(qlCompilerTag)-mt-gd - SwapValuation-$(qlCompilerTag)-x64-mt-gd - SwapValuation-$(qlCompilerTag)-mt-s - SwapValuation-$(qlCompilerTag)-x64-mt-s - SwapValuation-$(qlCompilerTag)-mt - SwapValuation-$(qlCompilerTag)-x64-mt - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - Disabled - false - ..\..;%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - EditAndContinue - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - MachineX86 - false - - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - Disabled - false - ..\..;%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - ProgramDatabase - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - Disabled - false - ..\..;%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - EditAndContinue - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - MachineX86 - false - - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - Disabled - false - ..\..;%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - ProgramDatabase - Default - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - MaxSpeed - AnySuitable - false - Speed - ..\..;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - MachineX86 - - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - MaxSpeed - AnySuitable - false - Speed - ..\..;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - MultiThreadedDLL - true - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - MaxSpeed - AnySuitable - false - Speed - ..\..;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - MultiThreaded - true - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - MachineX86 - - - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.tlb - - - - - MaxSpeed - AnySuitable - false - Speed - ..\..;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - MultiThreaded - true - false - true - true - - - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\Swap.pch - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - true - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\ - Level3 - true - Default - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - - - $(OutDir)$(TargetName)$(TargetExt) - true - ..\..\lib;%(AdditionalLibraryDirectories) - .\build\$(qlCompilerTag)\$(Platform)\$(Configuration)\SwapValuation.pdb - Console - false - - - - - - - - - - {ad0a27da-91da-46a2-acbd-296c419ed3aa} - false - - - - - - \ No newline at end of file diff --git a/Examples/Swap/swapvaluation.cpp b/Examples/Swap/swapvaluation.cpp deleted file mode 100644 index 216bed4d57e..00000000000 --- a/Examples/Swap/swapvaluation.cpp +++ /dev/null @@ -1,787 +0,0 @@ -/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/*! - Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl - Copyright (C) 2003, 2004, 2005, 2006, 2007 StatPro Italia srl - Copyright (C) 2004 Ferdinando Ametrano - - 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 - . The license is also available online at - . - - 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. -*/ - -/* This example shows how to set up a Term Structure and then price a simple - swap. -*/ - -#include -#ifdef BOOST_MSVC -# include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -using namespace QuantLib; - -#if defined(QL_ENABLE_SESSIONS) -namespace QuantLib { - - Integer sessionId() { return 0; } - -} -#endif - - -int main(int, char* []) { - - try { - - boost::timer timer; - std::cout << std::endl; - - /********************* - *** MARKET DATA *** - *********************/ - - Calendar calendar = TARGET(); - Date settlementDate(22, September, 2004); - // must be a business day - settlementDate = calendar.adjust(settlementDate); - - Integer fixingDays = 2; - Date todaysDate = calendar.advance(settlementDate, -fixingDays, Days); - // nothing to do with Date::todaysDate - Settings::instance().evaluationDate() = todaysDate; - - - todaysDate = Settings::instance().evaluationDate(); - std::cout << "Today: " << todaysDate.weekday() - << ", " << todaysDate << std::endl; - - std::cout << "Settlement date: " << settlementDate.weekday() - << ", " << settlementDate << std::endl; - - // deposits - Rate d1wQuote=0.0382; - Rate d1mQuote=0.0372; - Rate d3mQuote=0.0363; - Rate d6mQuote=0.0353; - Rate d9mQuote=0.0348; - Rate d1yQuote=0.0345; - // FRAs - Rate fra3x6Quote=0.037125; - Rate fra6x9Quote=0.037125; - Rate fra6x12Quote=0.037125; - // futures - Real fut1Quote=96.2875; - Real fut2Quote=96.7875; - Real fut3Quote=96.9875; - Real fut4Quote=96.6875; - Real fut5Quote=96.4875; - Real fut6Quote=96.3875; - Real fut7Quote=96.2875; - Real fut8Quote=96.0875; - // swaps - Rate s2yQuote=0.037125; - Rate s3yQuote=0.0398; - Rate s5yQuote=0.0443; - Rate s10yQuote=0.05165; - Rate s15yQuote=0.055175; - - - /******************** - *** QUOTES *** - ********************/ - - // SimpleQuote stores a value which can be manually changed; - // other Quote subclasses could read the value from a database - // or some kind of data feed. - - // deposits - ext::shared_ptr d1wRate(new SimpleQuote(d1wQuote)); - ext::shared_ptr d1mRate(new SimpleQuote(d1mQuote)); - ext::shared_ptr d3mRate(new SimpleQuote(d3mQuote)); - ext::shared_ptr d6mRate(new SimpleQuote(d6mQuote)); - ext::shared_ptr d9mRate(new SimpleQuote(d9mQuote)); - ext::shared_ptr d1yRate(new SimpleQuote(d1yQuote)); - // FRAs - ext::shared_ptr fra3x6Rate(new SimpleQuote(fra3x6Quote)); - ext::shared_ptr fra6x9Rate(new SimpleQuote(fra6x9Quote)); - ext::shared_ptr fra6x12Rate(new SimpleQuote(fra6x12Quote)); - // futures - ext::shared_ptr fut1Price(new SimpleQuote(fut1Quote)); - ext::shared_ptr fut2Price(new SimpleQuote(fut2Quote)); - ext::shared_ptr fut3Price(new SimpleQuote(fut3Quote)); - ext::shared_ptr fut4Price(new SimpleQuote(fut4Quote)); - ext::shared_ptr fut5Price(new SimpleQuote(fut5Quote)); - ext::shared_ptr fut6Price(new SimpleQuote(fut6Quote)); - ext::shared_ptr fut7Price(new SimpleQuote(fut7Quote)); - ext::shared_ptr fut8Price(new SimpleQuote(fut8Quote)); - // swaps - ext::shared_ptr s2yRate(new SimpleQuote(s2yQuote)); - ext::shared_ptr s3yRate(new SimpleQuote(s3yQuote)); - ext::shared_ptr s5yRate(new SimpleQuote(s5yQuote)); - ext::shared_ptr s10yRate(new SimpleQuote(s10yQuote)); - ext::shared_ptr s15yRate(new SimpleQuote(s15yQuote)); - - - /********************* - *** RATE HELPERS *** - *********************/ - - // RateHelpers are built from the above quotes together with - // other instrument dependant infos. Quotes are passed in - // relinkable handles which could be relinked to some other - // data source later. - - // deposits - DayCounter depositDayCounter = Actual360(); - - ext::shared_ptr d1w(new DepositRateHelper( - Handle(d1wRate), - 1*Weeks, fixingDays, - calendar, ModifiedFollowing, - true, depositDayCounter)); - ext::shared_ptr d1m(new DepositRateHelper( - Handle(d1mRate), - 1*Months, fixingDays, - calendar, ModifiedFollowing, - true, depositDayCounter)); - ext::shared_ptr d3m(new DepositRateHelper( - Handle(d3mRate), - 3*Months, fixingDays, - calendar, ModifiedFollowing, - true, depositDayCounter)); - ext::shared_ptr d6m(new DepositRateHelper( - Handle(d6mRate), - 6*Months, fixingDays, - calendar, ModifiedFollowing, - true, depositDayCounter)); - ext::shared_ptr d9m(new DepositRateHelper( - Handle(d9mRate), - 9*Months, fixingDays, - calendar, ModifiedFollowing, - true, depositDayCounter)); - ext::shared_ptr d1y(new DepositRateHelper( - Handle(d1yRate), - 1*Years, fixingDays, - calendar, ModifiedFollowing, - true, depositDayCounter)); - - - // setup FRAs - ext::shared_ptr fra3x6(new FraRateHelper( - Handle(fra3x6Rate), - 3, 6, fixingDays, calendar, ModifiedFollowing, - true, depositDayCounter)); - ext::shared_ptr fra6x9(new FraRateHelper( - Handle(fra6x9Rate), - 6, 9, fixingDays, calendar, ModifiedFollowing, - true, depositDayCounter)); - ext::shared_ptr fra6x12(new FraRateHelper( - Handle(fra6x12Rate), - 6, 12, fixingDays, calendar, ModifiedFollowing, - true, depositDayCounter)); - - - // setup futures - // Rate convexityAdjustment = 0.0; - Integer futMonths = 3; - Date imm = IMM::nextDate(settlementDate); - ext::shared_ptr fut1(new FuturesRateHelper( - Handle(fut1Price), - imm, - futMonths, calendar, ModifiedFollowing, - true, depositDayCounter)); - imm = IMM::nextDate(imm+1); - ext::shared_ptr fut2(new FuturesRateHelper( - Handle(fut2Price), - imm, - futMonths, calendar, ModifiedFollowing, - true, depositDayCounter)); - imm = IMM::nextDate(imm+1); - ext::shared_ptr fut3(new FuturesRateHelper( - Handle(fut3Price), - imm, - futMonths, calendar, ModifiedFollowing, - true, depositDayCounter)); - imm = IMM::nextDate(imm+1); - ext::shared_ptr fut4(new FuturesRateHelper( - Handle(fut4Price), - imm, - futMonths, calendar, ModifiedFollowing, - true, depositDayCounter)); - imm = IMM::nextDate(imm+1); - ext::shared_ptr fut5(new FuturesRateHelper( - Handle(fut5Price), - imm, - futMonths, calendar, ModifiedFollowing, - true, depositDayCounter)); - imm = IMM::nextDate(imm+1); - ext::shared_ptr fut6(new FuturesRateHelper( - Handle(fut6Price), - imm, - futMonths, calendar, ModifiedFollowing, - true, depositDayCounter)); - imm = IMM::nextDate(imm+1); - ext::shared_ptr fut7(new FuturesRateHelper( - Handle(fut7Price), - imm, - futMonths, calendar, ModifiedFollowing, - true, depositDayCounter)); - imm = IMM::nextDate(imm+1); - ext::shared_ptr fut8(new FuturesRateHelper( - Handle(fut8Price), - imm, - futMonths, calendar, ModifiedFollowing, - true, depositDayCounter)); - - - // setup swaps - Frequency swFixedLegFrequency = Annual; - BusinessDayConvention swFixedLegConvention = Unadjusted; - DayCounter swFixedLegDayCounter = Thirty360(Thirty360::European); - ext::shared_ptr swFloatingLegIndex(new Euribor6M); - - ext::shared_ptr s2y(new SwapRateHelper( - Handle(s2yRate), 2*Years, - calendar, swFixedLegFrequency, - swFixedLegConvention, swFixedLegDayCounter, - swFloatingLegIndex)); - ext::shared_ptr s3y(new SwapRateHelper( - Handle(s3yRate), 3*Years, - calendar, swFixedLegFrequency, - swFixedLegConvention, swFixedLegDayCounter, - swFloatingLegIndex)); - ext::shared_ptr s5y(new SwapRateHelper( - Handle(s5yRate), 5*Years, - calendar, swFixedLegFrequency, - swFixedLegConvention, swFixedLegDayCounter, - swFloatingLegIndex)); - ext::shared_ptr s10y(new SwapRateHelper( - Handle(s10yRate), 10*Years, - calendar, swFixedLegFrequency, - swFixedLegConvention, swFixedLegDayCounter, - swFloatingLegIndex)); - ext::shared_ptr s15y(new SwapRateHelper( - Handle(s15yRate), 15*Years, - calendar, swFixedLegFrequency, - swFixedLegConvention, swFixedLegDayCounter, - swFloatingLegIndex)); - - - /********************* - ** CURVE BUILDING ** - *********************/ - - // Any DayCounter would be fine. - // ActualActual::ISDA ensures that 30 years is 30.0 - DayCounter termStructureDayCounter = - ActualActual(ActualActual::ISDA); - - - double tolerance = 1.0e-15; - - // A depo-swap curve - std::vector > depoSwapInstruments; - depoSwapInstruments.push_back(d1w); - depoSwapInstruments.push_back(d1m); - depoSwapInstruments.push_back(d3m); - depoSwapInstruments.push_back(d6m); - depoSwapInstruments.push_back(d9m); - depoSwapInstruments.push_back(d1y); - depoSwapInstruments.push_back(s2y); - depoSwapInstruments.push_back(s3y); - depoSwapInstruments.push_back(s5y); - depoSwapInstruments.push_back(s10y); - depoSwapInstruments.push_back(s15y); - ext::shared_ptr depoSwapTermStructure( - new PiecewiseYieldCurve( - settlementDate, depoSwapInstruments, - termStructureDayCounter, - tolerance)); - - - // A depo-futures-swap curve - std::vector > depoFutSwapInstruments; - depoFutSwapInstruments.push_back(d1w); - depoFutSwapInstruments.push_back(d1m); - depoFutSwapInstruments.push_back(fut1); - depoFutSwapInstruments.push_back(fut2); - depoFutSwapInstruments.push_back(fut3); - depoFutSwapInstruments.push_back(fut4); - depoFutSwapInstruments.push_back(fut5); - depoFutSwapInstruments.push_back(fut6); - depoFutSwapInstruments.push_back(fut7); - depoFutSwapInstruments.push_back(fut8); - depoFutSwapInstruments.push_back(s3y); - depoFutSwapInstruments.push_back(s5y); - depoFutSwapInstruments.push_back(s10y); - depoFutSwapInstruments.push_back(s15y); - ext::shared_ptr depoFutSwapTermStructure( - new PiecewiseYieldCurve( - settlementDate, depoFutSwapInstruments, - termStructureDayCounter, - tolerance)); - - - // A depo-FRA-swap curve - std::vector > depoFRASwapInstruments; - depoFRASwapInstruments.push_back(d1w); - depoFRASwapInstruments.push_back(d1m); - depoFRASwapInstruments.push_back(d3m); - depoFRASwapInstruments.push_back(fra3x6); - depoFRASwapInstruments.push_back(fra6x9); - depoFRASwapInstruments.push_back(fra6x12); - depoFRASwapInstruments.push_back(s2y); - depoFRASwapInstruments.push_back(s3y); - depoFRASwapInstruments.push_back(s5y); - depoFRASwapInstruments.push_back(s10y); - depoFRASwapInstruments.push_back(s15y); - ext::shared_ptr depoFRASwapTermStructure( - new PiecewiseYieldCurve( - settlementDate, depoFRASwapInstruments, - termStructureDayCounter, - tolerance)); - - - // Term structures that will be used for pricing: - // the one used for discounting cash flows - RelinkableHandle discountingTermStructure; - // the one used for forward rate forecasting - RelinkableHandle forecastingTermStructure; - - - /********************* - * SWAPS TO BE PRICED * - **********************/ - - // constant nominal 1,000,000 Euro - Real nominal = 1000000.0; - // fixed leg - Frequency fixedLegFrequency = Annual; - BusinessDayConvention fixedLegConvention = Unadjusted; - BusinessDayConvention floatingLegConvention = ModifiedFollowing; - DayCounter fixedLegDayCounter = Thirty360(Thirty360::European); - Rate fixedRate = 0.04; - DayCounter floatingLegDayCounter = Actual360(); - - // floating leg - Frequency floatingLegFrequency = Semiannual; - ext::shared_ptr euriborIndex( - new Euribor6M(forecastingTermStructure)); - Spread spread = 0.0; - - Integer lenghtInYears = 5; - VanillaSwap::Type swapType = VanillaSwap::Payer; - - Date maturity = settlementDate + lenghtInYears*Years; - Schedule fixedSchedule(settlementDate, maturity, - Period(fixedLegFrequency), - calendar, fixedLegConvention, - fixedLegConvention, - DateGeneration::Forward, false); - Schedule floatSchedule(settlementDate, maturity, - Period(floatingLegFrequency), - calendar, floatingLegConvention, - floatingLegConvention, - DateGeneration::Forward, false); - VanillaSwap spot5YearSwap(swapType, nominal, - fixedSchedule, fixedRate, fixedLegDayCounter, - floatSchedule, euriborIndex, spread, - floatingLegDayCounter); - - Date fwdStart = calendar.advance(settlementDate, 1, Years); - Date fwdMaturity = fwdStart + lenghtInYears*Years; - Schedule fwdFixedSchedule(fwdStart, fwdMaturity, - Period(fixedLegFrequency), - calendar, fixedLegConvention, - fixedLegConvention, - DateGeneration::Forward, false); - Schedule fwdFloatSchedule(fwdStart, fwdMaturity, - Period(floatingLegFrequency), - calendar, floatingLegConvention, - floatingLegConvention, - DateGeneration::Forward, false); - VanillaSwap oneYearForward5YearSwap(swapType, nominal, - fwdFixedSchedule, fixedRate, fixedLegDayCounter, - fwdFloatSchedule, euriborIndex, spread, - floatingLegDayCounter); - - - /*************** - * SWAP PRICING * - ****************/ - - // utilities for reporting - std::vector headers(4); - headers[0] = "term structure"; - headers[1] = "net present value"; - headers[2] = "fair spread"; - headers[3] = "fair fixed rate"; - std::string separator = " | "; - Size width = headers[0].size() + separator.size() - + headers[1].size() + separator.size() - + headers[2].size() + separator.size() - + headers[3].size() + separator.size() - 1; - std::string rule(width, '-'), dblrule(width, '='); - std::string tab(8, ' '); - - // calculations - std::cout << dblrule << std::endl; - std::cout << "5-year market swap-rate = " - << std::setprecision(2) << io::rate(s5yRate->value()) - << std::endl; - std::cout << dblrule << std::endl; - - std::cout << tab << "5-years swap paying " - << io::rate(fixedRate) << std::endl; - std::cout << headers[0] << separator - << headers[1] << separator - << headers[2] << separator - << headers[3] << separator << std::endl; - std::cout << rule << std::endl; - - Real NPV; - Rate fairRate; - Spread fairSpread; - - ext::shared_ptr swapEngine( - new DiscountingSwapEngine(discountingTermStructure)); - - spot5YearSwap.setPricingEngine(swapEngine); - oneYearForward5YearSwap.setPricingEngine(swapEngine); - - // Of course, you're not forced to really use different curves - forecastingTermStructure.linkTo(depoSwapTermStructure); - discountingTermStructure.linkTo(depoSwapTermStructure); - - NPV = spot5YearSwap.NPV(); - fairSpread = spot5YearSwap.fairSpread(); - fairRate = spot5YearSwap.fairRate(); - - std::cout << std::setw(headers[0].size()) - << "depo-swap" << separator; - std::cout << std::setw(headers[1].size()) - << std::fixed << std::setprecision(2) << NPV << separator; - std::cout << std::setw(headers[2].size()) - << io::rate(fairSpread) << separator; - std::cout << std::setw(headers[3].size()) - << io::rate(fairRate) << separator; - std::cout << std::endl; - - - // let's check that the 5 years swap has been correctly re-priced - QL_REQUIRE(std::fabs(fairRate-s5yQuote)<1e-8, - "5-years swap mispriced by " - << io::rate(std::fabs(fairRate-s5yQuote))); - - - forecastingTermStructure.linkTo(depoFutSwapTermStructure); - discountingTermStructure.linkTo(depoFutSwapTermStructure); - - NPV = spot5YearSwap.NPV(); - fairSpread = spot5YearSwap.fairSpread(); - fairRate = spot5YearSwap.fairRate(); - - std::cout << std::setw(headers[0].size()) - << "depo-fut-swap" << separator; - std::cout << std::setw(headers[1].size()) - << std::fixed << std::setprecision(2) << NPV << separator; - std::cout << std::setw(headers[2].size()) - << io::rate(fairSpread) << separator; - std::cout << std::setw(headers[3].size()) - << io::rate(fairRate) << separator; - std::cout << std::endl; - - QL_REQUIRE(std::fabs(fairRate-s5yQuote)<1e-8, - "5-years swap mispriced!"); - - - forecastingTermStructure.linkTo(depoFRASwapTermStructure); - discountingTermStructure.linkTo(depoFRASwapTermStructure); - - NPV = spot5YearSwap.NPV(); - fairSpread = spot5YearSwap.fairSpread(); - fairRate = spot5YearSwap.fairRate(); - - std::cout << std::setw(headers[0].size()) - << "depo-FRA-swap" << separator; - std::cout << std::setw(headers[1].size()) - << std::fixed << std::setprecision(2) << NPV << separator; - std::cout << std::setw(headers[2].size()) - << io::rate(fairSpread) << separator; - std::cout << std::setw(headers[3].size()) - << io::rate(fairRate) << separator; - std::cout << std::endl; - - QL_REQUIRE(std::fabs(fairRate-s5yQuote)<1e-8, - "5-years swap mispriced!"); - - - std::cout << rule << std::endl; - - // now let's price the 1Y forward 5Y swap - - std::cout << tab << "5-years, 1-year forward swap paying " - << io::rate(fixedRate) << std::endl; - std::cout << headers[0] << separator - << headers[1] << separator - << headers[2] << separator - << headers[3] << separator << std::endl; - std::cout << rule << std::endl; - - - forecastingTermStructure.linkTo(depoSwapTermStructure); - discountingTermStructure.linkTo(depoSwapTermStructure); - - NPV = oneYearForward5YearSwap.NPV(); - fairSpread = oneYearForward5YearSwap.fairSpread(); - fairRate = oneYearForward5YearSwap.fairRate(); - - std::cout << std::setw(headers[0].size()) - << "depo-swap" << separator; - std::cout << std::setw(headers[1].size()) - << std::fixed << std::setprecision(2) << NPV << separator; - std::cout << std::setw(headers[2].size()) - << io::rate(fairSpread) << separator; - std::cout << std::setw(headers[3].size()) - << io::rate(fairRate) << separator; - std::cout << std::endl; - - - forecastingTermStructure.linkTo(depoFutSwapTermStructure); - discountingTermStructure.linkTo(depoFutSwapTermStructure); - - NPV = oneYearForward5YearSwap.NPV(); - fairSpread = oneYearForward5YearSwap.fairSpread(); - fairRate = oneYearForward5YearSwap.fairRate(); - - std::cout << std::setw(headers[0].size()) - << "depo-fut-swap" << separator; - std::cout << std::setw(headers[1].size()) - << std::fixed << std::setprecision(2) << NPV << separator; - std::cout << std::setw(headers[2].size()) - << io::rate(fairSpread) << separator; - std::cout << std::setw(headers[3].size()) - << io::rate(fairRate) << separator; - std::cout << std::endl; - - - forecastingTermStructure.linkTo(depoFRASwapTermStructure); - discountingTermStructure.linkTo(depoFRASwapTermStructure); - - NPV = oneYearForward5YearSwap.NPV(); - fairSpread = oneYearForward5YearSwap.fairSpread(); - fairRate = oneYearForward5YearSwap.fairRate(); - - std::cout << std::setw(headers[0].size()) - << "depo-FRA-swap" << separator; - std::cout << std::setw(headers[1].size()) - << std::fixed << std::setprecision(2) << NPV << separator; - std::cout << std::setw(headers[2].size()) - << io::rate(fairSpread) << separator; - std::cout << std::setw(headers[3].size()) - << io::rate(fairRate) << separator; - std::cout << std::endl; - - - // now let's say that the 5-years swap rate goes up to 4.60%. - // A smarter market element--say, connected to a data source-- would - // notice the change itself. Since we're using SimpleQuotes, - // we'll have to change the value manually--which forces us to - // downcast the handle and use the SimpleQuote - // interface. In any case, the point here is that a change in the - // value contained in the Quote triggers a new bootstrapping - // of the curve and a repricing of the swap. - - ext::shared_ptr fiveYearsRate = - ext::dynamic_pointer_cast(s5yRate); - fiveYearsRate->setValue(0.0460); - - std::cout << dblrule << std::endl; - std::cout << "5-year market swap-rate = " - << io::rate(s5yRate->value()) << std::endl; - std::cout << dblrule << std::endl; - - std::cout << tab << "5-years swap paying " - << io::rate(fixedRate) << std::endl; - std::cout << headers[0] << separator - << headers[1] << separator - << headers[2] << separator - << headers[3] << separator << std::endl; - std::cout << rule << std::endl; - - // now get the updated results - forecastingTermStructure.linkTo(depoSwapTermStructure); - discountingTermStructure.linkTo(depoSwapTermStructure); - - NPV = spot5YearSwap.NPV(); - fairSpread = spot5YearSwap.fairSpread(); - fairRate = spot5YearSwap.fairRate(); - - std::cout << std::setw(headers[0].size()) - << "depo-swap" << separator; - std::cout << std::setw(headers[1].size()) - << std::fixed << std::setprecision(2) << NPV << separator; - std::cout << std::setw(headers[2].size()) - << io::rate(fairSpread) << separator; - std::cout << std::setw(headers[3].size()) - << io::rate(fairRate) << separator; - std::cout << std::endl; - - QL_REQUIRE(std::fabs(fairRate-s5yRate->value())<1e-8, - "5-years swap mispriced!"); - - - forecastingTermStructure.linkTo(depoFutSwapTermStructure); - discountingTermStructure.linkTo(depoFutSwapTermStructure); - - NPV = spot5YearSwap.NPV(); - fairSpread = spot5YearSwap.fairSpread(); - fairRate = spot5YearSwap.fairRate(); - - std::cout << std::setw(headers[0].size()) - << "depo-fut-swap" << separator; - std::cout << std::setw(headers[1].size()) - << std::fixed << std::setprecision(2) << NPV << separator; - std::cout << std::setw(headers[2].size()) - << io::rate(fairSpread) << separator; - std::cout << std::setw(headers[3].size()) - << io::rate(fairRate) << separator; - std::cout << std::endl; - - QL_REQUIRE(std::fabs(fairRate-s5yRate->value())<1e-8, - "5-years swap mispriced!"); - - - forecastingTermStructure.linkTo(depoFRASwapTermStructure); - discountingTermStructure.linkTo(depoFRASwapTermStructure); - - NPV = spot5YearSwap.NPV(); - fairSpread = spot5YearSwap.fairSpread(); - fairRate = spot5YearSwap.fairRate(); - - std::cout << std::setw(headers[0].size()) - << "depo-FRA-swap" << separator; - std::cout << std::setw(headers[1].size()) - << std::fixed << std::setprecision(2) << NPV << separator; - std::cout << std::setw(headers[2].size()) - << io::rate(fairSpread) << separator; - std::cout << std::setw(headers[3].size()) - << io::rate(fairRate) << separator; - std::cout << std::endl; - - QL_REQUIRE(std::fabs(fairRate-s5yRate->value())<1e-8, - "5-years swap mispriced!"); - - std::cout << rule << std::endl; - - // the 1Y forward 5Y swap changes as well - - std::cout << tab << "5-years, 1-year forward swap paying " - << io::rate(fixedRate) << std::endl; - std::cout << headers[0] << separator - << headers[1] << separator - << headers[2] << separator - << headers[3] << separator << std::endl; - std::cout << rule << std::endl; - - - forecastingTermStructure.linkTo(depoSwapTermStructure); - discountingTermStructure.linkTo(depoSwapTermStructure); - - NPV = oneYearForward5YearSwap.NPV(); - fairSpread = oneYearForward5YearSwap.fairSpread(); - fairRate = oneYearForward5YearSwap.fairRate(); - - std::cout << std::setw(headers[0].size()) - << "depo-swap" << separator; - std::cout << std::setw(headers[1].size()) - << std::fixed << std::setprecision(2) << NPV << separator; - std::cout << std::setw(headers[2].size()) - << io::rate(fairSpread) << separator; - std::cout << std::setw(headers[3].size()) - << io::rate(fairRate) << separator; - std::cout << std::endl; - - - forecastingTermStructure.linkTo(depoFutSwapTermStructure); - discountingTermStructure.linkTo(depoFutSwapTermStructure); - - NPV = oneYearForward5YearSwap.NPV(); - fairSpread = oneYearForward5YearSwap.fairSpread(); - fairRate = oneYearForward5YearSwap.fairRate(); - - std::cout << std::setw(headers[0].size()) - << "depo-fut-swap" << separator; - std::cout << std::setw(headers[1].size()) - << std::fixed << std::setprecision(2) << NPV << separator; - std::cout << std::setw(headers[2].size()) - << io::rate(fairSpread) << separator; - std::cout << std::setw(headers[3].size()) - << io::rate(fairRate) << separator; - std::cout << std::endl; - - - forecastingTermStructure.linkTo(depoFRASwapTermStructure); - discountingTermStructure.linkTo(depoFRASwapTermStructure); - - NPV = oneYearForward5YearSwap.NPV(); - fairSpread = oneYearForward5YearSwap.fairSpread(); - fairRate = oneYearForward5YearSwap.fairRate(); - - std::cout << std::setw(headers[0].size()) - << "depo-FRA-swap" << separator; - std::cout << std::setw(headers[1].size()) - << std::fixed << std::setprecision(2) << NPV << separator; - std::cout << std::setw(headers[2].size()) - << io::rate(fairSpread) << separator; - std::cout << std::setw(headers[3].size()) - << io::rate(fairRate) << separator; - std::cout << std::endl; - - double seconds = timer.elapsed(); - Integer hours = int(seconds/3600); - seconds -= hours * 3600; - Integer minutes = int(seconds/60); - seconds -= minutes * 60; - std::cout << " \nRun completed in "; - if (hours > 0) - std::cout << hours << " h "; - if (hours > 0 || minutes > 0) - std::cout << minutes << " m "; - std::cout << std::fixed << std::setprecision(0) - << seconds << " s\n" << std::endl; - - return 0; - - } catch (std::exception& e) { - std::cerr << e.what() << std::endl; - return 1; - } catch (...) { - std::cerr << "unknown error" << std::endl; - return 1; - } -} - diff --git a/QuantLib.sln b/QuantLib.sln index f33466cdf3b..4d0e14b72a0 100644 --- a/QuantLib.sln +++ b/QuantLib.sln @@ -6,7 +6,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantLib", "QuantLib.vcxpro EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsuite", "test-suite\testsuite.vcxproj", "{A613045C-34AF-4706-AA3C-730C92524F74}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Swap", "Examples\Swap\Swap.vcxproj", "{4EAC6A0E-20F2-4B5A-8250-7E930CCE3AD0}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MulticurveBootstrapping", "Examples\MulticurveBootstrapping\MulticurveBootstrapping.vcxproj", "{4EAC6A0E-20F2-4B5A-8250-7E930CCE3AD0}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EquityOption", "Examples\EquityOption\EquityOption.vcxproj", "{EF6D982C-CF99-4442-B297-776DBECFAFC9}" EndProject diff --git a/configure.ac b/configure.ac index 27a9d9ac08d..7cf1d588b32 100644 --- a/configure.ac +++ b/configure.ac @@ -611,9 +611,9 @@ AC_CONFIG_FILES([ Examples/GlobalOptimizer/Makefile Examples/MarketModels/Makefile Examples/MultidimIntegral/Makefile + Examples/MulticurveBootstrapping/Makefile Examples/Replication/Makefile Examples/Repo/Makefile - Examples/Swap/Makefile test-suite/Makefile]) AC_CONFIG_FILES([quantlib-config],[chmod +x quantlib-config]) AC_CONFIG_FILES([QuantLib.spec]) diff --git a/man/BasketLosses.1 b/man/BasketLosses.1 index c7744227912..1d3717b058c 100644 --- a/man/BasketLosses.1 +++ b/man/BasketLosses.1 @@ -22,9 +22,9 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/BermudanSwaption.1 b/man/BermudanSwaption.1 index 69d2418a5c8..b84e0168634 100644 --- a/man/BermudanSwaption.1 +++ b/man/BermudanSwaption.1 @@ -28,9 +28,9 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/Bonds.1 b/man/Bonds.1 index 94db85859d1..66e122dae6f 100644 --- a/man/Bonds.1 +++ b/man/Bonds.1 @@ -26,9 +26,9 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/CDS.1 b/man/CDS.1 index f240ed8b496..4d48b2c8420 100644 --- a/man/CDS.1 +++ b/man/CDS.1 @@ -25,9 +25,9 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/CVAIRS.1 b/man/CVAIRS.1 index b01ec430454..abcf47a9ecd 100644 --- a/man/CVAIRS.1 +++ b/man/CVAIRS.1 @@ -22,9 +22,9 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/CallableBonds.1 b/man/CallableBonds.1 index a19be889dce..4a6b5454169 100644 --- a/man/CallableBonds.1 +++ b/man/CallableBonds.1 @@ -25,9 +25,9 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/ConvertibleBonds.1 b/man/ConvertibleBonds.1 index 608de2e5287..45ba20f4aeb 100644 --- a/man/ConvertibleBonds.1 +++ b/man/ConvertibleBonds.1 @@ -30,9 +30,9 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/DiscreteHedging.1 b/man/DiscreteHedging.1 index fdce1af188f..a7f630fc1d3 100644 --- a/man/DiscreteHedging.1 +++ b/man/DiscreteHedging.1 @@ -28,9 +28,9 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org , .I http://www.gs.com/qs/doc/when_you_cannot_hedge.pdf diff --git a/man/EquityOption.1 b/man/EquityOption.1 index 305e8a7f29d..3de2aa41b7f 100644 --- a/man/EquityOption.1 +++ b/man/EquityOption.1 @@ -33,9 +33,9 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/FRA.1 b/man/FRA.1 index dd668136c50..e6ddbc6dad8 100644 --- a/man/FRA.1 +++ b/man/FRA.1 @@ -27,9 +27,9 @@ The source code .BR EquityOption (1), .BR FittedBondCurve (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/FittedBondCurve.1 b/man/FittedBondCurve.1 index 0ae7bd5fd54..cd6d080d0a6 100644 --- a/man/FittedBondCurve.1 +++ b/man/FittedBondCurve.1 @@ -30,9 +30,9 @@ The source code .BR EquityOption (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/Gaussian1dModels.1 b/man/Gaussian1dModels.1 index 876de559e2d..f7b0bf0618e 100644 --- a/man/Gaussian1dModels.1 +++ b/man/Gaussian1dModels.1 @@ -22,9 +22,9 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/GlobalOptimizer.1 b/man/GlobalOptimizer.1 index a2d64dd1410..c9ae0606dde 100644 --- a/man/GlobalOptimizer.1 +++ b/man/GlobalOptimizer.1 @@ -25,9 +25,9 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/LatentModel.1 b/man/LatentModel.1 index d56b9e8df07..55c227066cc 100644 --- a/man/LatentModel.1 +++ b/man/LatentModel.1 @@ -22,9 +22,9 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/Makefile.am b/man/Makefile.am index 10636a8fe43..1a6560bd774 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -18,13 +18,13 @@ dist_man_MANS += BasketLosses.1 \ FittedBondCurve.1 \ FRA.1 \ Gaussian1dModels.1 \ - GlobalOptimizer.1 \ + GlobalOptimizer.1 \ LatentModel.1 \ MarketModels.1 \ MultidimIntegral.1 \ + MulticurveBootstrapping.1 \ Replication.1 \ - Repo.1 \ - SwapValuation.1 + Repo.1 else @@ -40,13 +40,13 @@ EXTRA_DIST += BasketLosses.1 \ FittedBondCurve.1 \ FRA.1 \ Gaussian1dModels.1 \ - GlobalOptimizer.1 \ + GlobalOptimizer.1 \ LatentModel.1 \ MarketModels.1 \ MultidimIntegral.1 \ + MulticurveBootstrapping.1 \ Replication.1 \ - Repo.1 \ - SwapValuation.1 + Repo.1 endif diff --git a/man/MarketModels.1 b/man/MarketModels.1 index 24b1174ec02..0670d2fb4c8 100644 --- a/man/MarketModels.1 +++ b/man/MarketModels.1 @@ -22,9 +22,9 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/SwapValuation.1 b/man/MulticurveBootstrapping.1 similarity index 64% rename from man/SwapValuation.1 rename to man/MulticurveBootstrapping.1 index 71323b17793..d24ee3a931c 100644 --- a/man/SwapValuation.1 +++ b/man/MulticurveBootstrapping.1 @@ -1,20 +1,20 @@ .\" Man page contributed by Luigi Ballabio .\" and released under the Quantlib license -.TH SWAPVALUATION 1 "20 September 2001" QuantLib +.TH MulticurveBootstrapping 1 "27 October 2018" QuantLib .SH NAME -SwapValuation - Example of using QuantLib +MulticurveBootstrapping - Example of using QuantLib .SH SYNOPSIS -.B SwapValuation +.B MulticurveBootstrapping .SH DESCRIPTION .PP -.B SwapValuation +.B MulticurveBootstrapping is an example of using \fIQuantLib\fP. -It prices an Interest Rate Swap over a term structure and calculates -its fair fixed rate and floating spread. +It prices an interest-rate swap over a bootstrapped term structure and +calculates its fair fixed rate and floating spread. .SH SEE ALSO The source code -.IR swapvaluation.cpp , +.IR MulticurveBootstrapping.cpp , .BR BermudanSwaption (1), .BR Bonds (1), .BR CallableBonds (1), @@ -35,4 +35,4 @@ The QuantLib Group (see .IR Contributors.txt ). This manual page was added by Luigi Ballabio - . + . diff --git a/man/MultidimIntegral.1 b/man/MultidimIntegral.1 index 0b10584a5e1..3a1edc674ec 100644 --- a/man/MultidimIntegral.1 +++ b/man/MultidimIntegral.1 @@ -22,9 +22,9 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/Replication.1 b/man/Replication.1 index 89e986e20fd..5df9ea1cfd3 100644 --- a/man/Replication.1 +++ b/man/Replication.1 @@ -26,8 +26,8 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Repo (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org . diff --git a/man/Repo.1 b/man/Repo.1 index d5cca2d5a77..46b7f289195 100644 --- a/man/Repo.1 +++ b/man/Repo.1 @@ -31,8 +31,8 @@ The source code .BR FittedBondCurve (1), .BR FRA (1), .BR MarketModels (1), +.BR MulticurveBootstrapping (1), .BR Replication (1), -.BR SwapValuation (1), the QuantLib documentation and website at .IR http://quantlib.org .