pax_global_header00006660000000000000000000000064151702222250014510gustar00rootroot0000000000000052 comment=099987f0ca2c11c505dc4348cdb9ce01a598e1e5 QuantLib-1.42.1/000077500000000000000000000000001517022222500133145ustar00rootroot00000000000000QuantLib-1.42.1/.appveyor.yml000066400000000000000000000003221517022222500157570ustar00rootroot00000000000000image: Visual Studio 2017 platform: x64 configuration: Release version: ci.{build} before_build: - COPY .ci\VS2017.props .\Build.props build: parallel: false project: QuantLib.sln verbosity: normal QuantLib-1.42.1/.ci/000077500000000000000000000000001517022222500137655ustar00rootroot00000000000000QuantLib-1.42.1/.ci/Unity.props000066400000000000000000000002551517022222500161640ustar00rootroot00000000000000 true QuantLib-1.42.1/.ci/VS2017.props000066400000000000000000000014711517022222500157170ustar00rootroot00000000000000 false C:\Libraries\boost_1_69_0;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) Disabled C:\Libraries\boost_1_69_0\lib64-msvc-14.1;%(AdditionalLibraryDirectories) QuantLib-1.42.1/.ci/VS2019.alt.props000066400000000000000000000013561517022222500165020ustar00rootroot00000000000000 C:\local\boost;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) true stdcpp17 _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) QuantLib-1.42.1/.ci/VS2019.props000066400000000000000000000010741517022222500157200ustar00rootroot00000000000000 C:\local\boost;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) true QuantLib-1.42.1/.ci/VS2022.alt.props000066400000000000000000000013561517022222500164740ustar00rootroot00000000000000 C:\local\boost;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) true stdcpp17 _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) QuantLib-1.42.1/.ci/VS2022.props000066400000000000000000000010741517022222500157120ustar00rootroot00000000000000 C:\local\boost;%(AdditionalIncludeDirectories) /bigobj %(AdditionalOptions) true QuantLib-1.42.1/.ci/userconfig2019.alt.hpp000066400000000000000000000102701517022222500177350ustar00rootroot00000000000000/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* Copyright (C) 2004, 2011 Ferdinando Ametrano Copyright (C) 2004, 2005 StatPro Italia srl 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. */ #ifndef quantlib_config_hpp #define quantlib_config_hpp /*************************************************************** User configuration section: modify the following definitions to suit your preferences. Do not modify this file if you are using a Linux/Unix system: it will not be read by the compiler. The definitions below will be provided by running ./configure instead. ****************************************************************/ /* Define this if error messages should include current function information. */ #ifndef QL_ERROR_FUNCTIONS # define QL_ERROR_FUNCTIONS #endif /* Define this if error messages should include file and line information. */ #ifndef QL_ERROR_LINES # define QL_ERROR_LINES #endif /* Define this if tracing messages should be allowed (whether they are actually emitted will depend on run-time settings.) */ #ifndef QL_ENABLE_TRACING # define QL_ENABLE_TRACING #endif /* Define this if extra safety checks should be performed. This can degrade performance. */ #ifndef QL_EXTRA_SAFETY_CHECKS # define QL_EXTRA_SAFETY_CHECKS #endif /* Define this to use indexed coupons instead of par coupons in floating legs as the default in 'bool IborCoupon::Settings::usingAtParCoupons();'. */ #ifndef QL_USE_INDEXED_COUPON # define QL_USE_INDEXED_COUPON #endif /* Define this to have singletons return different instances for different threads; in particular, this means that the evaluation date, the stored index fixings and any other settings will be per-thread. */ #ifndef QL_ENABLE_SESSIONS # define QL_ENABLE_SESSIONS #endif /* Define this to enable the thread-safe observer pattern. You should enable it if you want to use QuantLib via the SWIG layer within the JVM or .NET eco system or any environment with an async garbage collector */ #ifndef QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN # define QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN #endif /* Define this to enable a date resolution down to microseconds and allow for accurate intraday pricing. */ #ifndef QL_HIGH_RESOLUTION_DATE # define QL_HIGH_RESOLUTION_DATE #endif /* Define this if you want to throw an exception when a notification loop is detected. Enabling this option is recommended but might cause existing code to throw. */ #ifndef QL_THROW_IN_CYCLES # define QL_THROW_IN_CYCLES #endif /* Undefine this if you want lazy objects to forward all notifications instead of just the first. Disabling this option is safer in some cases but can be a lot slower. */ #ifndef QL_FASTER_LAZY_OBJECTS //# define QL_FASTER_LAZY_OBJECTS #endif /* Define this to use std::any instead of boost::any. */ #ifndef QL_USE_STD_ANY //# define QL_USE_STD_ANY #endif /* Define this to use std::optional instead of boost::optional. */ #ifndef QL_USE_STD_OPTIONAL //# define QL_USE_STD_OPTIONAL #endif /* Define this to use standard smart pointers instead of Boost ones. Note that std::shared_ptr does not check access and can cause segmentation faults. */ #ifndef QL_USE_STD_SHARED_PTR # define QL_USE_STD_SHARED_PTR #endif /* Define this to enable the implementation of Null as template functions. */ #ifndef QL_NULL_AS_FUNCTIONS # define QL_NULL_AS_FUNCTIONS #endif /* Define this to enable the parallel unit test runner */ #ifndef QL_ENABLE_PARALLEL_UNIT_TEST_RUNNER //# define QL_ENABLE_PARALLEL_UNIT_TEST_RUNNER #endif #endif QuantLib-1.42.1/.ci/userconfig2022.alt.hpp000066400000000000000000000102701517022222500177270ustar00rootroot00000000000000/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* Copyright (C) 2004, 2011 Ferdinando Ametrano Copyright (C) 2004, 2005 StatPro Italia srl 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. */ #ifndef quantlib_config_hpp #define quantlib_config_hpp /*************************************************************** User configuration section: modify the following definitions to suit your preferences. Do not modify this file if you are using a Linux/Unix system: it will not be read by the compiler. The definitions below will be provided by running ./configure instead. ****************************************************************/ /* Define this if error messages should include current function information. */ #ifndef QL_ERROR_FUNCTIONS # define QL_ERROR_FUNCTIONS #endif /* Define this if error messages should include file and line information. */ #ifndef QL_ERROR_LINES # define QL_ERROR_LINES #endif /* Define this if tracing messages should be allowed (whether they are actually emitted will depend on run-time settings.) */ #ifndef QL_ENABLE_TRACING # define QL_ENABLE_TRACING #endif /* Define this if extra safety checks should be performed. This can degrade performance. */ #ifndef QL_EXTRA_SAFETY_CHECKS # define QL_EXTRA_SAFETY_CHECKS #endif /* Define this to use indexed coupons instead of par coupons in floating legs as the default in 'bool IborCoupon::Settings::usingAtParCoupons();'. */ #ifndef QL_USE_INDEXED_COUPON # define QL_USE_INDEXED_COUPON #endif /* Define this to have singletons return different instances for different threads; in particular, this means that the evaluation date, the stored index fixings and any other settings will be per-thread. */ #ifndef QL_ENABLE_SESSIONS # define QL_ENABLE_SESSIONS #endif /* Define this to enable the thread-safe observer pattern. You should enable it if you want to use QuantLib via the SWIG layer within the JVM or .NET eco system or any environment with an async garbage collector */ #ifndef QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN # define QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN #endif /* Define this to enable a date resolution down to microseconds and allow for accurate intraday pricing. */ #ifndef QL_HIGH_RESOLUTION_DATE # define QL_HIGH_RESOLUTION_DATE #endif /* Define this if you want to throw an exception when a notification loop is detected. Enabling this option is recommended but might cause existing code to throw. */ #ifndef QL_THROW_IN_CYCLES # define QL_THROW_IN_CYCLES #endif /* Undefine this if you want lazy objects to forward all notifications instead of just the first. Disabling this option is safer in some cases but can be a lot slower. */ #ifndef QL_FASTER_LAZY_OBJECTS //# define QL_FASTER_LAZY_OBJECTS #endif /* Define this to use std::any instead of boost::any. */ #ifndef QL_USE_STD_ANY //# define QL_USE_STD_ANY #endif /* Define this to use std::optional instead of boost::optional. */ #ifndef QL_USE_STD_OPTIONAL //# define QL_USE_STD_OPTIONAL #endif /* Define this to use standard smart pointers instead of Boost ones. Note that std::shared_ptr does not check access and can cause segmentation faults. */ #ifndef QL_USE_STD_SHARED_PTR # define QL_USE_STD_SHARED_PTR #endif /* Define this to enable the implementation of Null as template functions. */ #ifndef QL_NULL_AS_FUNCTIONS # define QL_NULL_AS_FUNCTIONS #endif /* Define this to enable the parallel unit test runner */ #ifndef QL_ENABLE_PARALLEL_UNIT_TEST_RUNNER //# define QL_ENABLE_PARALLEL_UNIT_TEST_RUNNER #endif #endif QuantLib-1.42.1/.clang-format000066400000000000000000000021431517022222500156670ustar00rootroot00000000000000--- Language: Cpp Standard: c++17 # The following is close to the style we've been using all these years # without formalizing it. Formatting won't be enforced, but this file # can help if you want to use the general feel of the library. # General appearance: BasedOnStyle: LLVM IndentWidth: 4 ColumnLimit: 100 NamespaceIndentation: All MaxEmptyLinesToKeep: 2 FixNamespaceComments: false # Function declarations: BinPackParameters: false AllowShortFunctionsOnASingleLine: Inline AlwaysBreakTemplateDeclarations: true # T& x, not T &x: DerivePointerAlignment: false PointerAlignment: Left # QuantLib headers first, then Boost, then std SortIncludes: true IncludeBlocks: Merge IncludeCategories: - Regex: '^"' Priority: 1 - Regex: '^ -*, bugprone-*, -bugprone-assignment-in-if-condition, -bugprone-branch-clone, -bugprone-crtp-constructor-accessibility, -bugprone-easily-swappable-parameters, -bugprone-empty-catch, -bugprone-implicit-widening-of-multiplication-result, -bugprone-macro-parentheses, -bugprone-narrowing-conversions, -bugprone-non-zero-enum-to-bool-conversion, -bugprone-suspicious-include, clang-analyzer-*, -clang-analyzer-core.UndefinedBinaryOperatorResult, -clang-analyzer-core.uninitialized.Assign, -clang-analyzer-optin.cplusplus.UninitializedObject, -clang-analyzer-optin.performance.Padding, -clang-analyzer-security.FloatLoopCounter, cppcoreguidelines-*, -cppcoreguidelines-avoid-c-arrays, -cppcoreguidelines-avoid-const-or-ref-data-members, -cppcoreguidelines-avoid-do-while, -cppcoreguidelines-avoid-goto, -cppcoreguidelines-avoid-magic-numbers, -cppcoreguidelines-avoid-non-const-global-variables, -cppcoreguidelines-init-variables, -cppcoreguidelines-macro-to-enum, -cppcoreguidelines-macro-usage, -cppcoreguidelines-narrowing-conversions, -cppcoreguidelines-non-private-member-variables-in-classes, -cppcoreguidelines-owning-memory, -cppcoreguidelines-prefer-member-initializer, -cppcoreguidelines-pro-bounds-array-to-pointer-decay, -cppcoreguidelines-pro-bounds-constant-array-index, -cppcoreguidelines-pro-bounds-pointer-arithmetic, -cppcoreguidelines-pro-type-const-cast, -cppcoreguidelines-pro-type-member-init, -cppcoreguidelines-pro-type-vararg, -cppcoreguidelines-use-default-member-init, misc-*, -misc-confusable-identifiers, -misc-const-correctness, -misc-include-cleaner, -misc-no-recursion, -misc-non-private-member-variables-in-classes, -misc-use-anonymous-namespace, -misc-use-internal-linkage, -misc-unused-parameters, modernize-*, -modernize-avoid-c-arrays, -modernize-macro-to-enum, -modernize-return-braced-init-list, -modernize-use-trailing-return-type, -modernize-use-using, -modernize-use-nodiscard, performance-*, -performance-avoid-endl, -performance-enum-size, readability-*, -readability-avoid-nested-conditional-operator, -readability-braces-around-statements, -readability-const-return-type, -readability-convert-member-functions-to-static, -readability-else-after-return, -readability-enum-initial-value, -readability-function-cognitive-complexity, -readability-identifier-length, -readability-inconsistent-declaration-parameter-name, -readability-isolate-declaration, -readability-magic-numbers, -readability-make-member-function-const, -readability-math-missing-parentheses, -readability-named-parameter, -readability-redundant-casting, -readability-redundant-declaration, -readability-simplify-boolean-expr, -readability-suspicious-call-argument, -readability-use-anyofallof, -readability-use-std-min-max, HeaderFilterRegex: '.*' FormatStyle: none CheckOptions: - key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor value: 1 - key: modernize-make-shared.MakeSmartPtrFunction value: ext::make_shared - key: modernize-make-shared.MakeSmartPtrFunctionHeader value: - key: modernize-use-default-member-init.UseAssignment value: 1 ... QuantLib-1.42.1/.codecov.yml000066400000000000000000000015411517022222500155400ustar00rootroot00000000000000coverage: precision: 1 # We put red at 50 to have a chance at some non-red build. # I would be happy with 80 right now, so that's where the target is. range: 50...80 ignore: - "test-suite" - "Examples" # The process to get a correct report is a bit fiddly. # This worked in the past, and is added here for reference: # # - clone the repo and mount it in a recent quantlib-devenv image; # - run the following: # # apt update && apt install -y lcov curl git # mkdir build # cd build # CXXFLAGS='-O1 -fprofile-arcs -ftest-coverage' LDFLAGS='-lgcov' cmake .. # CXXFLAGS='-O1 -fprofile-arcs -ftest-coverage' LDFLAGS='-lgcov' make -j 4 # ./test-suite/quantlib-test-suite --log_level=message # bash <(curl -s https://codecov.io/bash) -t @cc_token # # where the file `cc_token` contains the Codecov upload token. QuantLib-1.42.1/.github/000077500000000000000000000000001517022222500146545ustar00rootroot00000000000000QuantLib-1.42.1/.github/boring-cyborg.yml000066400000000000000000000011451517022222500201430ustar00rootroot00000000000000 # Comment to be posted to welcome users when they open their first PR firstPRWelcomeComment: > Thanks for opening this pull request! It might take a while before we look at it, so don't worry if there seems to be no feedback. We'll get to it. # Comment to be posted to congratulate user on their first merged PR firstPRMergeComment: > Congratulations on your first merged pull request! # Comment to be posted to on first time issues firstIssueWelcomeComment: > Thanks for posting! It might take a while before we look at your issue, so don't worry if there seems to be no feedback. We'll get to it. QuantLib-1.42.1/.github/dependabot.yml000066400000000000000000000002611517022222500175030ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: # Check for updates to GitHub Actions every weekday interval: "weekly" QuantLib-1.42.1/.github/workflows/000077500000000000000000000000001517022222500167115ustar00rootroot00000000000000QuantLib-1.42.1/.github/workflows/cmake-latest-runners.yml000066400000000000000000000104461517022222500235050ustar00rootroot00000000000000name: CMake build for the latest runners and C++ standards on: schedule: # At 02:35 on Monday - cron: '35 2 * * 1' workflow_dispatch: jobs: cmake-build-and-test: strategy: fail-fast: false matrix: settings: [ { os: macos-latest, cc: clang, cxx: clang++ }, { os: ubuntu-latest, cc: clang, cxx: clang++ }, { os: ubuntu-latest, cc: gcc, cxx: g++ }, { os: windows-latest, cc: cl, cxx: cl } ##### This is the full set of currently available runners and compilers. ##### # { os: macos-14, cc: clang, cxx: clang++ }, # { os: macos-15, cc: clang, cxx: clang++ }, # # { os: ubuntu-22.04, cc: clang-13, cxx: clang++-13 }, # { os: ubuntu-22.04, cc: clang-14, cxx: clang++-14 }, # { os: ubuntu-22.04, cc: clang-15, cxx: clang++-15 }, # # { os: ubuntu-22.04, cc: gcc-10, cxx: g++-10 }, # { os: ubuntu-22.04, cc: gcc-11, cxx: g++-11 }, # { os: ubuntu-22.04, cc: gcc-12, cxx: g++-12 }, # # { os: ubuntu-24.04, cc: clang-16, cxx: clang++-16 }, # { os: ubuntu-24.04, cc: clang-17, cxx: clang++-17 }, # { os: ubuntu-24.04, cc: clang-18, cxx: clang++-18 }, # # { os: ubuntu-24.04, cc: gcc-12, cxx: g++-12 }, # { os: ubuntu-24.04, cc: gcc-13, cxx: g++-13 }, # { os: ubuntu-24.04, cc: gcc-14, cxx: g++-14 }, # # { os: windows-2022, cc: cl, cxx: cl }, # { os: windows-2025, cc: cl, cxx: cl } ] cxx-standard: [ 17, 20, 23 ] cmake-build-type: [ release ] runs-on: ${{ matrix.settings.os }} steps: - uses: actions/checkout@v6 - name: Determine ccache variant shell: bash run: | echo "CMAKE_CXX_COMPILER_LAUNCHER=${{ ( (runner.os == 'Windows') && 'sccache' ) || 'ccache' }}" >> $GITHUB_ENV - name: Setup CCache uses: hendrikmuhs/ccache-action@v1.2 with: key: cmake-latest-${{ inputs.os }}-${{ inputs.cxx }}-${{ inputs.cxx-standard }} restore-keys: | cmake-latest-${{ inputs.os }}-${{ inputs.cxx }}-${{ inputs.cxx-standard }} cmake-latest-${{ inputs.os }}-${{ inputs.cxx }} cmake-latest-${{ inputs.os }} variant: ${{ env.CMAKE_CXX_COMPILER_LAUNCHER }} - name: Setup Linux if: runner.os == 'Linux' shell: bash run: | sudo apt-get update sudo apt-get install -y ccache ninja-build eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" brew update brew install boost echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH - name: Setup macOS if: runner.os == 'macOS' shell: bash run: | HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install ninja boost echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV - name: Setup Windows if: runner.os == 'Windows' shell: pwsh run: | $BoostUri = "https://archives.boost.io/release/1.90.0/binaries/boost_1_90_0-msvc-14.3-64.exe" Start-BitsTransfer -Source $BoostUri -Destination $env:RUNNER_TEMP\boost.exe Start-Process -Wait -FilePath "$env:RUNNER_TEMP\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=$env:RUNNER_TEMP\boost" choco install -y ninja Write "Boost_DIR=$env:RUNNER_TEMP\boost\lib64-msvc-14.3\cmake\Boost-1.90.0" >> $env:GITHUB_ENV - name: Set up Visual Studio shell on Windows if: runner.os == 'Windows' uses: ilammy/msvc-dev-cmd@v1 with: arch: x64 - name: Configure CMake and build env: CC: ${{ matrix.settings.cc }} CXX: ${{ matrix.settings.cxx }} run: | cmake --version cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.cmake-build-type }} -DCMAKE_CXX_STANDARD=${{ matrix.cxx-standard }} -DQL_COMPILE_WARNING_AS_ERROR=ON -L cmake --build build --verbose - name: Run the test-suite run: | ./build/test-suite/quantlib-test-suite -l message QuantLib-1.42.1/.github/workflows/cmake.yml000066400000000000000000000173011517022222500205160ustar00rootroot00000000000000name: CMake build on: push: branches: - '**' pull_request: jobs: cmake-linux: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Setup run: | sudo rm /etc/apt/sources.list.d/microsoft-prod.list sudo apt update sudo apt install -y libboost-dev ccache ninja-build - name: Cache uses: hendrikmuhs/ccache-action@v1.2 with: key: cmake-linux-ci-build-${{ github.ref }} restore-keys: | cmake-linux-ci-build-${{ github.ref }} cmake-linux-ci-build-refs/heads/master cmake-linux-ci-build- - name: Compile run: | mkdir build cd build cmake .. -GNinja -DBOOST_ROOT=/usr -DCMAKE_BUILD_TYPE=Release -DQL_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -L cat ql/config.hpp cmake --build . --verbose sudo cmake --install . sudo ldconfig - name: Test run: | quantlib-test-suite --log_level=message - name: Run benchmark run: | quantlib-benchmark --size=1 cmake-linux-with-options: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Setup run: | sudo rm /etc/apt/sources.list.d/microsoft-prod.list sudo apt update sudo apt install -y libboost-all-dev ccache ninja-build - name: Cache uses: hendrikmuhs/ccache-action@v1.2 with: key: cmake-linux-ci-opts-${{ github.ref }} restore-keys: | cmake-linux-ci-opts-${{ github.ref }} cmake-linux-ci-opts-refs/heads/master cmake-linux-ci-opts- - name: Compile run: | cmake --preset linux-ci-build-with-nonstandard-options -L cd build/linux-ci-build-with-nonstandard-options cat ql/config.hpp cmake --build . --verbose sudo cmake --build . --target install - name: Test run: | quantlib-test-suite --log_level=message cmake-win: runs-on: windows-2022 steps: - uses: actions/checkout@v6 - name: Cache uses: hendrikmuhs/ccache-action@v1.2 with: key: cmake-windows-ci-build-${{ github.ref }} restore-keys: | cmake-windows-ci-build-${{ github.ref }} cmake-windows-ci-build-refs/heads/master cmake-windows-ci-build- variant: sccache - name: Setup run: | $Url = "https://archives.boost.io/release/1.90.0/source/boost_1_90_0.zip" (New-Object System.Net.WebClient).DownloadFile($Url, "$RUNNER_TEMP\boost.zip") Expand-Archive -Path "$RUNNER_TEMP\boost.zip" -DestinationPath C:\local Rename-Item -Path "C:\local\boost_1_90_0" -NewName "boost" $Url = "https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip" (New-Object System.Net.WebClient).DownloadFile($Url, "$RUNNER_TEMP\ninja-win.zip") Expand-Archive -Path "$RUNNER_TEMP\ninja-win.zip" -DestinationPath C:\local\ninja Add-Content $env:GITHUB_PATH "C:\local\ninja" - name: Setup MSVC++ environment uses: ilammy/msvc-dev-cmd@v1 with: arch: x64 - name: Compile env: BOOST_ROOT: C:\local\boost shell: cmd run: | mkdir build cd build cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DQL_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -L type ql\config.hpp cmake --build . --verbose cmake --install . dir ql\*.lib - name: Test run: | & "C:\Program Files (x86)\QuantLib\bin\quantlib-test-suite" --log_level=message cmake-win-dynamic-runtime: runs-on: windows-2022 steps: - uses: actions/checkout@v6 - name: Cache uses: hendrikmuhs/ccache-action@v1.2 with: key: cmake-windows-ci-dyn-build-${{ github.ref }} restore-keys: | cmake-windows-ci-dyn-build-${{ github.ref }} cmake-windows-ci-dyn-build-refs/heads/master cmake-windows-ci-dyn-build- variant: sccache - name: Setup run: | $Url = "https://archives.boost.io/release/1.90.0/source/boost_1_90_0.zip" (New-Object System.Net.WebClient).DownloadFile($Url, "$RUNNER_TEMP\boost.zip") Expand-Archive -Path "$RUNNER_TEMP\boost.zip" -DestinationPath C:\local Rename-Item -Path "C:\local\boost_1_90_0" -NewName "boost" $Url = "https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip" (New-Object System.Net.WebClient).DownloadFile($Url, "$RUNNER_TEMP\ninja-win.zip") Expand-Archive -Path "$RUNNER_TEMP\ninja-win.zip" -DestinationPath C:\local\ninja Add-Content $env:GITHUB_PATH "C:\local\ninja" - name: Setup MSVC++ environment uses: ilammy/msvc-dev-cmd@v1 with: arch: x64 - name: Compile env: BOOST_ROOT: C:\local\boost shell: cmd run: | mkdir build cd build cmake .. -GNinja -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL -DCMAKE_BUILD_TYPE=Release -DQL_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -L type ql\config.hpp cmake --build . --verbose cmake --install . dir ql\*.lib - name: Test run: | & "C:\Program Files (x86)\QuantLib\bin\quantlib-test-suite" --log_level=message cmake-win-with-options: runs-on: windows-2022 steps: - uses: actions/checkout@v6 - name: Cache uses: hendrikmuhs/ccache-action@v1.2 with: key: cmake-windows-ci-opts-${{ github.ref }} restore-keys: | cmake-windows-ci-opts-${{ github.ref }} cmake-windows-ci-opts-refs/heads/master cmake-windows-ci-opts- variant: sccache - name: Setup run: | $Url = "https://archives.boost.io/release/1.90.0/source/boost_1_90_0.zip" (New-Object System.Net.WebClient).DownloadFile($Url, "$RUNNER_TEMP\boost.zip") Expand-Archive -Path "$RUNNER_TEMP\boost.zip" -DestinationPath C:\local Rename-Item -Path "C:\local\boost_1_90_0" -NewName "boost" $Url = "https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip" (New-Object System.Net.WebClient).DownloadFile($Url, "$RUNNER_TEMP\ninja-win.zip") Expand-Archive -Path "$RUNNER_TEMP\ninja-win.zip" -DestinationPath C:\local\ninja Add-Content $env:GITHUB_PATH "C:\local\ninja" - name: Setup MSVC++ environment uses: ilammy/msvc-dev-cmd@v1 with: arch: x64 - name: Compile env: BOOST_ROOT: C:\local\boost shell: cmd run: | cmake --preset windows-ci-build-with-nonstandard-options -L cd build/windows-ci-build-with-nonstandard-options type ql\config.hpp cmake --build . --verbose cmake --build . --target install - name: Test run: | & "C:\Program Files (x86)\QuantLib\bin\quantlib-test-suite" --log_level=message cmake-macos: runs-on: macos-latest steps: - uses: actions/checkout@v6 - name: Setup env: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 run: | brew install boost ccache ninja - name: Cache uses: hendrikmuhs/ccache-action@v1.2 with: key: cmake-macos-ci-${{ github.ref }} restore-keys: | cmake-macos-ci-${{ github.ref }} cmake-macos-ci-refs/heads/master cmake-macos-ci- - name: Compile run: | mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release -DQL_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -GNinja -L cat ql/config.hpp cmake --build . --verbose sudo cmake --install . - name: Test run: | DYLD_LIBRARY_PATH=/usr/local/lib quantlib-test-suite --log_level=message QuantLib-1.42.1/.github/workflows/codeql-analysis.yml000066400000000000000000000027161517022222500225320ustar00rootroot00000000000000# For most projects, this workflow file will not need changing; you simply need # to commit it to your repository. # # You may wish to alter this file to override the set of languages analyzed, # or to provide custom queries or build logic. name: "CodeQL" on: schedule: - cron: '0 0 * * 0' workflow_dispatch: jobs: analyze: name: CodeQL analysis runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v6 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v4 with: languages: cpp # Set up build environment - name: Setup run: | sudo rm /etc/apt/sources.list.d/microsoft-prod.list sudo apt update sudo apt install -y libboost-dev # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild uses: github/codeql-action/autobuild@v4 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines # and modify them (or add more) to build your code if your project # uses a compiled language #- run: | # make bootstrap # make release - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4 QuantLib-1.42.1/.github/workflows/copyrights.yml000066400000000000000000000011661517022222500216330ustar00rootroot00000000000000name: Update copyright list on: push: branches-ignore: - 'dependabot/**' jobs: check-copyrights: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Check run: | ./tools/check_copyrights.sh - uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.GITHUB_TOKEN }} branch: update-copyright-list-${{ github.ref_name }} delete-branch: true commit-message: 'Update copyright list in license' title: 'Update copyright list in license' author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com> QuantLib-1.42.1/.github/workflows/coveralls.yml000066400000000000000000000026001517022222500214240ustar00rootroot00000000000000name: Coverage report on: push: branches: - master pull_request: workflow_dispatch: jobs: coverage: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v6 - name: Setup run: | sudo rm /etc/apt/sources.list.d/microsoft-prod.list sudo apt update sudo apt install -y lcov libboost-dev - name: Compile run: | ./autogen.sh ./configure --disable-shared CXXFLAGS='-O1 -fprofile-arcs -ftest-coverage' LDFLAGS='-lgcov' make -j 4 - name: Capture baseline run: | mkdir -p coverage tmp lcov --no-external --capture --initial --directory . --output-file ./tmp/lcov_base.info - name: Run tests run: | ./test-suite/quantlib-test-suite --log_level=message - name: Run examples run: | make -C Examples check-examples - name: Capture coverage run: | lcov --no-external --capture --directory . --output-file ./tmp/lcov_run.info lcov --add-tracefile ./tmp/lcov_base.info --add-tracefile ./tmp/lcov_run.info --output-file ./tmp/lcov_total.info lcov --remove ./tmp/lcov_total.info "$PWD/Examples/*" "$PWD/test-suite/*" --output-file ./coverage/lcov.info - name: Upload coverage to Coveralls uses: coverallsapp/github-action@v2 with: github-token: ${{ secrets.GITHUB_TOKEN }} file: ./coverage/lcov.info QuantLib-1.42.1/.github/workflows/devenv-images.yml000066400000000000000000000032761517022222500221760ustar00rootroot00000000000000name: Build quantlib-devenv Docker images on: workflow_dispatch: inputs: boostVersion: description: 'Boost version' required: true env: ROLLING: questing jobs: docker-images: runs-on: ubuntu-latest strategy: matrix: tag: [plucky, questing, resolute] steps: - uses: actions/checkout@v6 - name: Build CI images working-directory: dockerfiles run: | docker build -f ci.Dockerfile \ --build-arg tag=${{ matrix.tag }} \ --build-arg boost_version=${{ github.event.inputs.boostVersion }} \ --build-arg boost_dir=boost_$(echo "${{ github.event.inputs.boostVersion }}" | sed "s/\./_/g") \ -t ghcr.io/lballabio/quantlib-devenv:${{ matrix.tag }} . docker tag ghcr.io/lballabio/quantlib-devenv:${{ matrix.tag }} ghcr.io/lballabio/quantlib-devenv:${{ matrix.tag }}-${{ github.event.inputs.boostVersion }} if test "${{ matrix.tag }}" = "$ROLLING" ; then docker tag ghcr.io/lballabio/quantlib-devenv:${{ matrix.tag }} ghcr.io/lballabio/quantlib-devenv:rolling fi - name: Login to GitHub Container Registry uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GHCR_PAT }} - name: Push Docker images run: | docker push ghcr.io/lballabio/quantlib-devenv:${{ matrix.tag }}-${{ github.event.inputs.boostVersion }} docker push ghcr.io/lballabio/quantlib-devenv:${{ matrix.tag }} if test "${{ matrix.tag }}" = "$ROLLING" ; then docker push ghcr.io/lballabio/quantlib-devenv:rolling fi QuantLib-1.42.1/.github/workflows/doxygen.yml000066400000000000000000000012601517022222500211100ustar00rootroot00000000000000name: Check doc generation on: push: branches: - '**' pull_request: jobs: docs: runs-on: macos-latest steps: - uses: actions/checkout@v6 - name: Setup env: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 run: | brew install automake autoconf libtool boost doxygen graphviz ./autogen.sh ./configure --with-boost-include=$(brew --prefix)/include - name: Doxygen version run: | doxygen --version - name: Check run: | make docs header-docs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Check run: | ./tools/check_all_header_docs.sh QuantLib-1.42.1/.github/workflows/filelists.yml000066400000000000000000000007501517022222500214340ustar00rootroot00000000000000name: Check CMake file list and VC++ projects on: push: branches: - '**' pull_request: jobs: filelists: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Setup run: | sudo rm /etc/apt/sources.list.d/microsoft-prod.list sudo apt update sudo apt install -y libboost-dev - name: Configure run: | ./autogen.sh ./configure - name: Check run: | ./tools/check_filelists.sh QuantLib-1.42.1/.github/workflows/generated-headers.yml000066400000000000000000000017231517022222500230060ustar00rootroot00000000000000name: Update generated headers on: push: branches-ignore: - 'dependabot/**' jobs: generate-headers: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Setup run: | sudo rm /etc/apt/sources.list.d/microsoft-prod.list sudo apt update sudo apt install -y libboost-dev - name: Configure run: | ./autogen.sh ./configure - name: Update headers run: | find ql -name *.am | xargs touch make dist rm QuantLib-*.tar.gz - uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.MACHINE_ACCOUNT_PAT }} push-to-fork: ${{ vars.MACHINE_ACCOUNT }}/QuantLib branch: update-generated-headers-${{ github.ref_name }} delete-branch: true commit-message: 'Update generated headers' title: 'Update generated headers' author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com> QuantLib-1.42.1/.github/workflows/headers.yml000066400000000000000000000012641517022222500210520ustar00rootroot00000000000000name: Compile single headers on: push: branches: - '**' pull_request: jobs: headers: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Setup run: | sudo rm /etc/apt/sources.list.d/microsoft-prod.list sudo apt update sudo apt install -y libboost-dev ccache - name: Cache uses: hendrikmuhs/ccache-action@v1.2 with: key: single-headers-${{ github.ref }} restore-keys: | single-headers-${{ github.ref }} single-headers-refs/heads/master single-headers- - name: Check env: CXX: ccache g++ run: | ./tools/check_all_headers.sh QuantLib-1.42.1/.github/workflows/includes.yml000066400000000000000000000014541517022222500212460ustar00rootroot00000000000000name: Fix inclusions of ql headers in double quotes on: push: branches-ignore: - 'dependabot/**' jobs: check-includes: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Check run: | shopt -s globstar sed -i -E -e 's|#include *"(ql/.*\.hpp)"|#include <\1>|g' **/*.[hc]pp - uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.MACHINE_ACCOUNT_PAT }} push-to-fork: ${{ vars.MACHINE_ACCOUNT }}/QuantLib branch: fix-include-in-quotes-${{ github.ref_name }} delete-branch: true commit-message: 'Fix inclusions of ql headers in double quotes' title: 'Fix inclusions of ql headers in double quotes' author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com> QuantLib-1.42.1/.github/workflows/increase-version-number.yml000066400000000000000000000036201517022222500241770ustar00rootroot00000000000000name: Increase version number on: workflow_dispatch: jobs: increase-version: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: fetch-depth: 0 fetch-tags: true - name: Setup git run: | git config user.name 'lballabio[bot]' git config user.email '224797326+lballabio-bot@users.noreply.github.com' - name: Calculate versions env: GH_TOKEN: ${{ github.token }} run: | export LATEST_RELEASE=`gh release list --json name,isLatest --jq '.[] | select(.isLatest)|.name'` echo ${LATEST_RELEASE} | awk -F '.' '{ print "LATEST_MINOR=" $2 }' | tee -a $GITHUB_ENV echo ${LATEST_RELEASE} | awk -F '.' '{ print "NEXT_MINOR=" $2 + 1 }' | tee -a $GITHUB_ENV - name: Update version numbers run: | sed -i -e "s/^AC_INIT(\[QuantLib\].*$/AC_INIT([QuantLib], [1.${NEXT_MINOR}-dev],/g" configure.ac sed -i -e "s/^#define QL_VERSION.*$/#define QL_VERSION \"1.${NEXT_MINOR}-dev\"/g" ql/version.hpp sed -i -e "s/^#define QL_HEX_VERSION.*$/#define QL_HEX_VERSION 0x01${NEXT_MINOR}0000/g" ql/version.hpp sed -i -e "s/^set(QUANTLIB_VERSION_MINOR .*$/set(QUANTLIB_VERSION_MINOR ${NEXT_MINOR})/g" CMakeLists.txt sed -i -e "s/^set(PACKAGE_VERSION .*$/set(PACKAGE_VERSION \"1.${NEXT_MINOR}-dev\"\)/g" CMakeLists.txt sed -i -e "s/^set(PACKAGE_VERSION_HEX.*$/set(PACKAGE_VERSION_HEX \"0x01${NEXT_MINOR}0000\"\)/g" CMakeLists.txt git commit -a -m "Set version to 1.${NEXT_MINOR}-dev" - uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.MACHINE_ACCOUNT_PAT }} push-to-fork: ${{ vars.MACHINE_ACCOUNT }}/QuantLib branch: set-to-rc-${{ github.ref_name }} delete-branch: true title: 'Set version to 1.${{ env.NEXT_MINOR }}-dev' author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com> QuantLib-1.42.1/.github/workflows/license-url.yml000066400000000000000000000013641517022222500216620ustar00rootroot00000000000000name: Update old license links on: push: branches-ignore: - 'dependabot/**' jobs: license-urls: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Check run: | shopt -s globstar sed -i -e 's|http://quantlib\.org/license\.shtml|https://www.quantlib.org/license.shtml|g' **/*.[hc]pp **/*.ac **/*.docs **/*.cfg **/*.sh **/*.el - uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.GITHUB_TOKEN }} branch: update-license-links-${{ github.ref_name }} delete-branch: true commit-message: 'Update old license links' title: 'Update old license links' author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com> QuantLib-1.42.1/.github/workflows/linux-full-tests.yml000066400000000000000000000156141517022222500227020ustar00rootroot00000000000000name: Linux build with full test matrix on: schedule: - cron: '0 0 * * 0' workflow_dispatch: jobs: build: runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - name: "gcc 8.3 (Boost 1.72)" shortname: gcc8 tag: cosmic cc: gcc cxx: g++ - name: "gcc 9.3 (Boost 1.78)" shortname: gcc9 tag: focal cc: gcc cxx: g++ - name: "gcc 10.3 (Boost 1.79)" shortname: gcc10 tag: hirsute cc: gcc cxx: g++ - name: "gcc 11.4 (Boost 1.82)" shortname: gcc11 tag: jammy cc: gcc cxx: g++ - name: "gcc 12.3 (Boost 1.86)" shortname: gcc12 tag: lunar cc: gcc cxx: g++ - name: "gcc 13.3 (Boost 1.89)" shortname: gcc13 tag: noble cc: gcc cxx: g++ - name: "gcc 14.x" shortname: gcc14 tag: plucky cc: gcc cxx: g++ - name: "gcc 15.x" shortname: gcc15 tag: questing cc: gcc cxx: g++ - name: "Clang 7 (Boost 1.72)" shortname: clang7 tag: cosmic cc: clang cxx: clang++ - name: "Clang 8 (Boost 1.72)" shortname: clang8 tag: disco cc: clang cxx: clang++ - name: "Clang 9 (Boost 1.74)" shortname: clang9 tag: eoan cc: clang cxx: clang++ - name: "Clang 10 (Boost 1.78)" shortname: clang10 tag: focal cc: clang cxx: clang++ - name: "Clang 11 (Boost 1.78)" shortname: clang11 tag: groovy cc: clang cxx: clang++ - name: "Clang 12 (Boost 1.79)" shortname: clang12 tag: hirsute cc: clang cxx: clang++ - name: "Clang 13 (Boost 1.79)" shortname: clang13 tag: impish cc: clang cxx: clang++ - name: "Clang 14 (Boost 1.82)" shortname: clang14 tag: jammy cc: clang cxx: clang++ - name: "Clang 15 (Boost 1.86)" shortname: clang15 tag: lunar cc: clang cxx: clang++ - name: "Clang 16 (Boost 1.86)" shortname: clang16 tag: mantic cc: clang cxx: clang++ - name: "Clang 17 (Boost 1.84)" shortname: clang17 tag: clang-17 cc: clang cxx: clang++ - name: "Clang 18 (Boost 1.89)" shortname: clang18 tag: noble cc: clang cxx: clang++ - name: "Clang 19 (Boost 1.89)" shortname: clang19 tag: oracular cc: clang cxx: clang++ - name: "Clang 20" shortname: clang20 tag: questing cc: clang cxx: clang++ - name: "Clang 21" shortname: clang21 tag: resolute cc: clang cxx: clang++ - name: "C++17 mode" shortname: c++17 tag: rolling cc: gcc cxx: g++ cxxflags: "-std=c++17" - name: "C++20 mode" shortname: c++20 tag: rolling cc: gcc cxx: g++ cxxflags: "-std=c++20" - name: "C++23 mode" shortname: c++23 tag: rolling cc: gcc cxx: g++ cxxflags: "-std=c++23" - name: "C++26 mode" shortname: c++26 tag: rolling cc: gcc cxx: g++ cxxflags: "-std=c++26" - name: "Unity build enabled" shortname: unity tag: rolling cc: gcc cxx: g++ configureflags: --enable-unity-build - name: "Intraday calculations enabled" shortname: intraday tag: rolling cc: gcc cxx: g++ configureflags: --enable-intraday - name: "Throwing in cycles enabled" shortname: cycles tag: rolling cc: gcc cxx: g++ configureflags: --enable-throwing-in-cycles --disable-faster-lazy-objects - name: "Indexed coupons enabled" shortname: indexed tag: rolling cc: gcc cxx: g++ configureflags: --enable-indexed-coupons - name: "Standard Library classes enabled" shortname: stdclasses tag: rolling cc: gcc cxx: g++ configureflags: --enable-std-classes - name: "Thread-safe observer enabled" shortname: threadsafe tag: rolling cc: gcc cxx: g++ configureflags: --enable-thread-safe-observer-pattern - name: "Sessions enabled" shortname: sessions tag: rolling cc: gcc cxx: g++ configureflags: --enable-sessions - name: "OpenMP enabled" shortname: openmp tag: rolling cc: gcc cxx: g++ configureflags: --enable-openmp - name: "Parallel unit-test runner" shortname: paralleltests tag: rolling cc: gcc cxx: g++ configureflags: --enable-parallel-unit-test-runner - name: "Null as function template" shortname: nullfunctions tag: rolling cc: gcc cxx: g++ configureflags: --enable-null-as-functions container: ghcr.io/lballabio/quantlib-devenv:${{ matrix.tag }} steps: - uses: actions/checkout@v6 - name: Compiler version run: | ${{ matrix.cc }} --version - name: Build run: | ./autogen.sh ./configure --disable-static ${{ matrix.configureflags }} CC="${{ matrix.cc }}" CXX="${{ matrix.cxx }}" CXXFLAGS="-O2 -g0 -Wall -Wno-unknown-pragmas -Werror ${{ matrix.cxxflags }}" cat ql/config.hpp make -j 4 - name: Run tests run: | ./test-suite/quantlib-test-suite --log_level=message - name: Run examples run: | make check-examples - name: Check global header run: | echo "#include " > test1.cpp && echo "int main() { return 0; }" >> test1.cpp echo "#include " > test2.cpp make install ${{ matrix.cxx }} -O2 -g0 -Wall -Wno-unknown-pragmas -Werror ${{ matrix.cxxflags }} `quantlib-config --cflags` test1.cpp test2.cpp `quantlib-config --libs` QuantLib-1.42.1/.github/workflows/linux-nondefault.yml000066400000000000000000000133111517022222500227270ustar00rootroot00000000000000name: Linux build with non-default configuration on: schedule: - cron: '0 0 * * 0' workflow_dispatch: jobs: build: runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - name: "gcc 8.3 (Boost 1.72)" shortname: gcc8 tag: cosmic cc: gcc cxx: g++ - name: "gcc 9.3 (Boost 1.78)" shortname: gcc9 tag: focal cc: gcc cxx: g++ - name: "gcc 10.3 (Boost 1.79)" shortname: gcc10 tag: hirsute cc: gcc cxx: g++ - name: "gcc 11.4 (Boost 1.82)" shortname: gcc11 tag: jammy cc: gcc cxx: g++ - name: "gcc 12.3 (Boost 1.86)" shortname: gcc12 tag: lunar cc: gcc cxx: g++ - name: "gcc 13.3 (Boost 1.89)" shortname: gcc13 tag: noble cc: gcc cxx: g++ - name: "gcc 14.x" shortname: gcc14 tag: plucky cc: gcc cxx: g++ - name: "gcc 15.x" shortname: gcc15 tag: questing cc: gcc cxx: g++ - name: "Clang 7 (Boost 1.72)" shortname: clang7 tag: cosmic cc: clang cxx: clang++ - name: "Clang 8 (Boost 1.72)" shortname: clang8 tag: disco cc: clang cxx: clang++ - name: "Clang 9 (Boost 1.74)" shortname: clang9 tag: eoan cc: clang cxx: clang++ - name: "Clang 10 (Boost 1.78)" shortname: clang10 tag: focal cc: clang cxx: clang++ - name: "Clang 11 (Boost 1.78)" shortname: clang11 tag: groovy cc: clang cxx: clang++ - name: "Clang 12 (Boost 1.79)" shortname: clang12 tag: hirsute cc: clang cxx: clang++ - name: "Clang 13 (Boost 1.79)" shortname: clang13 tag: impish cc: clang cxx: clang++ - name: "Clang 14 (Boost 1.82)" shortname: clang14 tag: jammy cc: clang cxx: clang++ - name: "Clang 15 (Boost 1.86)" shortname: clang15 tag: lunar cc: clang cxx: clang++ - name: "Clang 16 (Boost 1.86)" shortname: clang16 tag: mantic cc: clang cxx: clang++ - name: "Clang 18 (Boost 1.89)" shortname: clang18 tag: noble cc: clang cxx: clang++ - name: "Clang 19 (Boost 1.89)" shortname: clang19 tag: oracular cc: clang cxx: clang++ - name: "Clang 20" shortname: clang20 tag: questing cc: clang cxx: clang++ - name: "Clang 21" shortname: clang21 tag: resolute cc: clang cxx: clang++ - name: "C++17 mode" shortname: c++17 tag: rolling cc: gcc cxx: g++ cxxflags: "-std=c++17" - name: "C++20 mode" shortname: c++20 tag: rolling cc: gcc cxx: g++ cxxflags: "-std=c++20" - name: "C++23 mode" shortname: c++23 tag: rolling cc: gcc cxx: g++ cxxflags: "-std=c++23" - name: "C++26 mode" shortname: c++26 tag: rolling cc: gcc cxx: g++ cxxflags: "-std=c++26" - name: "Unity build enabled" shortname: unity tag: rolling cc: gcc cxx: g++ configureflags: --enable-unity-build - name: "Standard Library classes enabled" shortname: stdclasses tag: rolling cc: gcc cxx: g++ configureflags: --enable-std-pointers --disable-std-any --disable-std-optional - name: "OpenMP enabled" shortname: openmp tag: rolling cc: gcc cxx: g++ configureflags: --enable-openmp container: ghcr.io/lballabio/quantlib-devenv:${{ matrix.tag }} steps: - uses: actions/checkout@v6 - name: Compiler version run: | ${{ matrix.cc }} --version - name: Build run: | ./autogen.sh ./configure --disable-static --enable-error-lines --enable-error-functions --enable-tracing --enable-indexed-coupons --enable-extra-safety-checks --enable-sessions --enable-thread-safe-observer-pattern --enable-intraday --disable-faster-lazy-objects --enable-throwing-in-cycles --enable-null-as-functions ${{ matrix.configureflags }} CC="${{ matrix.cc }}" CXX="${{ matrix.cxx }}" CPPFLAGS="-Wall -Wno-unknown-pragmas -Wno-array-bounds -Werror" CXXFLAGS="-O2 -g0 ${{ matrix.cxxflags }}" cat ql/config.hpp make -j 4 - name: Run tests run: | ./test-suite/quantlib-test-suite --log_level=message - name: Run examples run: | make check-examples - name: Check global header run: | echo "#include " > test1.cpp && echo "int main() { return 0; }" >> test1.cpp echo "#include " > test2.cpp make install ${{ matrix.cxx }} -O2 -g0 -Wall -Wno-unknown-pragmas -Werror ${{ matrix.cxxflags }} `quantlib-config --cflags` test1.cpp test2.cpp `quantlib-config --libs` QuantLib-1.42.1/.github/workflows/linux.yml000066400000000000000000000130761517022222500206020ustar00rootroot00000000000000name: Linux build on: push: branches: - '**' pull_request: jobs: build: runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - name: "gcc 9.3 (Boost 1.78)" shortname: gcc9 tag: focal cc: gcc cxx: g++ - name: "gcc 11.4 (Boost 1.82)" shortname: gcc11 tag: jammy cc: gcc cxx: g++ - name: "gcc 13.3 (Boost 1.89)" shortname: gcc13 tag: noble cc: gcc cxx: g++ tests: true - name: "gcc 15.x" shortname: gcc15 tag: questing cc: gcc cxx: g++ tests: true - name: "Clang 10 (Boost 1.78)" shortname: clang10 tag: focal cc: clang cxx: clang++ - name: "Clang 14 (Boost 1.82)" shortname: clang14 tag: jammy cc: clang cxx: clang++ - name: "Clang 18 (Boost 1.89)" shortname: clang18 tag: noble cc: clang cxx: clang++ tests: true - name: "Clang 21" shortname: clang21 tag: resolute cc: clang cxx: clang++ tests: true - name: "C++17 mode" shortname: c++17 tag: rolling cc: gcc cxx: g++ cxxflags: "-std=c++17" - name: "C++20 mode" shortname: c++20 tag: rolling cc: gcc cxx: g++ cxxflags: "-std=c++20" - name: "C++23 mode" shortname: c++23 tag: rolling cc: gcc cxx: g++ cxxflags: "-std=c++23" - name: "C++26 mode" shortname: c++26 tag: rolling cc: gcc cxx: g++ cxxflags: "-std=c++26" - name: "Unity build enabled" shortname: unity tag: rolling cc: gcc cxx: g++ configureflags: --enable-unity-build - name: "Intraday calculations enabled" shortname: intraday tag: rolling cc: gcc cxx: g++ configureflags: --enable-intraday tests: true - name: "Throwing in cycles enabled" shortname: cycles tag: rolling cc: gcc cxx: g++ configureflags: --enable-throwing-in-cycles --disable-faster-lazy-objects tests: true - name: "Indexed coupons enabled" shortname: indexed tag: rolling cc: gcc cxx: g++ configureflags: --enable-indexed-coupons tests: true - name: "Standard Library classes enabled" shortname: stdclasses tag: rolling cc: gcc cxx: g++ configureflags: --enable-std-classes tests: true - name: "Thread-safe observer enabled" shortname: threadsafe tag: rolling cc: gcc cxx: g++ configureflags: --enable-thread-safe-observer-pattern tests: true - name: "Sessions enabled" shortname: sessions tag: rolling cc: gcc cxx: g++ configureflags: --enable-sessions tests: true - name: "OpenMP enabled" shortname: openmp tag: rolling cc: gcc cxx: g++ configureflags: --enable-openmp tests: true - name: "Parallel unit-test runner" shortname: paralleltests tag: rolling cc: gcc cxx: g++ configureflags: --enable-parallel-unit-test-runner tests: true - name: "Null as function template" shortname: nullfunctions tag: rolling cc: gcc cxx: g++ configureflags: --enable-null-as-functions tests: true container: ghcr.io/lballabio/quantlib-devenv:${{ matrix.tag }} steps: - uses: actions/checkout@v6 - name: Cache uses: hendrikmuhs/ccache-action@v1.2 with: key: linux-ci-build-${{ matrix.shortname }}-${{ github.ref }} restore-keys: | linux-ci-build-${{ matrix.shortname }}-${{ github.ref }} linux-ci-build-${{ matrix.shortname }}-refs/heads/master linux-ci-build-${{ matrix.shortname }}- - name: Compiler version run: | ${{ matrix.cc }} --version - name: Build run: | ./autogen.sh ./configure --disable-static ${{ matrix.configureflags }} CC="ccache ${{ matrix.cc }}" CXX="ccache ${{ matrix.cxx }}" CXXFLAGS="-O2 -g0 -Wall -Wno-unknown-pragmas -Werror ${{ matrix.cxxflags }}" cat ql/config.hpp make -j 4 - name: Run tests if: ${{ matrix.tests }} run: | ./test-suite/quantlib-test-suite --log_level=message - name: Run examples if: ${{ matrix.tests }} run: | make check-examples - name: Check global header if: ${{ matrix.tests }} run: | echo "#include " > test1.cpp && echo "int main() { return 0; }" >> test1.cpp echo "#include " > test2.cpp make install ${{ matrix.cxx }} -O2 -g0 -Wall -Wno-unknown-pragmas -Werror ${{ matrix.cxxflags }} `quantlib-config --cflags` test1.cpp test2.cpp `quantlib-config --libs` QuantLib-1.42.1/.github/workflows/macos-nondefault.yml000066400000000000000000000025341517022222500226770ustar00rootroot00000000000000name: Mac OS build with non-default configuration on: schedule: - cron: '0 0 * * 0' workflow_dispatch: jobs: build: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [macos-14, macos-15] classes: [boost, std] include: - classes: std configureflags: --enable-std-pointers --disable-std-any --disable-std-optional steps: - uses: actions/checkout@v6 - name: Setup env: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 run: | brew install automake autoconf libtool boost - name: Compiler version run: | clang --version - name: Build run: | ./autogen.sh ./configure --disable-shared --with-boost-include=`brew --prefix`/include --enable-error-lines --enable-error-functions --enable-tracing --enable-indexed-coupons --enable-extra-safety-checks --enable-sessions --enable-thread-safe-observer-pattern --enable-intraday --disable-faster-lazy-objects --enable-throwing-in-cycles --enable-null-as-functions ${{ matrix.configureflags }} CC="clang" CXX="clang++" CXXFLAGS="-O2 -g0 -Wall -Werror" cat ql/config.hpp make -j 3 - name: Run tests run: | ./test-suite/quantlib-test-suite --log_level=message - name: Run examples run: | make -C Examples check-examples QuantLib-1.42.1/.github/workflows/macos.yml000066400000000000000000000023251517022222500205400ustar00rootroot00000000000000name: Mac OS build on: push: branches: - '**' pull_request: jobs: build: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [macos-14, macos-15] steps: - uses: actions/checkout@v6 - name: Setup env: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 run: | brew install automake autoconf libtool boost ccache - name: Cache uses: hendrikmuhs/ccache-action@v1.2 with: key: macos-ci-build-${{ matrix.os }}-${{ github.ref }} restore-keys: | macos-ci-build-${{ matrix.os }}-${{ github.ref }} macos-ci-build-${{ matrix.os }}-refs/heads/master macos-ci-build-${{ matrix.os }}- - name: Compiler version run: | clang --version - name: Build run: | ./autogen.sh ./configure --disable-shared --with-boost-include=`brew --prefix`/include ${{ matrix.configureflags }} CC="ccache clang" CXX="ccache clang++" CXXFLAGS="-O2 -g0 -Wall -Werror ${{ matrix.cxxflags }}" make -j 3 - name: Run tests run: | ./test-suite/quantlib-test-suite --log_level=message - name: Run examples run: | make -C Examples check-examples QuantLib-1.42.1/.github/workflows/misspell.yml000066400000000000000000000012021517022222500212570ustar00rootroot00000000000000name: Misspell fixer on: push: branches-ignore: - 'dependabot/**' jobs: check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - uses: sobolevn/misspell-fixer-action@master - uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.MACHINE_ACCOUNT_PAT }} push-to-fork: ${{ vars.MACHINE_ACCOUNT }}/QuantLib branch: misspell-fixes-${{ github.ref_name }} delete-branch: true commit-message: 'Fixes by misspell-fixer' title: 'Typos fixed by misspell-fixer' author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com> QuantLib-1.42.1/.github/workflows/msvc-all-configs.yml000066400000000000000000000040301517022222500225750ustar00rootroot00000000000000name: Windows build with all configurations on: schedule: - cron: '0 0 * * 0' workflow_dispatch: jobs: msbuild: runs-on: windows-2022 strategy: fail-fast: false matrix: toolset: [v142, v143] platform: [x64, Win32] configuration: ['Release', 'Debug', 'Release (static runtime)', 'Debug (static runtime)'] unity: [unity, singles] include: - toolset: v142 boost_version: 77 vsversion: 2019 - toolset: v143 boost_version: 90 vsversion: 2022 steps: - uses: actions/checkout@v6 - name: Setup MSVC++ environment uses: ilammy/msvc-dev-cmd@v1 with: arch: x64 - name: Setup Boost run: | $Url = "https://archives.boost.io/release/1.${{ matrix.boost_version }}.0/source/boost_1_${{ matrix.boost_version }}_0.zip" (New-Object System.Net.WebClient).DownloadFile($Url, "$RUNNER_TEMP\boost.zip") Expand-Archive -Path "$RUNNER_TEMP\boost.zip" -DestinationPath C:\local Rename-Item -Path "C:\local\boost_1_${{ matrix.boost_version }}_0" -NewName "boost" - name: Setup local properties shell: cmd run: | COPY .ci\VS${{ matrix.vsversion }}.props .\Build.props - name: Setup unity build if: ${{ matrix.unity == 'unity' }} shell: cmd run: | COPY .ci\Unity.props .\Directory.Build.props - name: Build run: | msbuild ./QuantLib.sln /verbosity:normal /property:Configuration="${{ matrix.configuration }}" /property:Platform=${{ matrix.platform }} /property:PlatformToolset=${{ matrix.toolset }} - name: Test if: ${{ contains(matrix.configuration, 'Release') }} run: | .\test-suite\bin\QuantLib-test-suite*.exe --log_level=message - name: Run examples if: ${{ contains(matrix.configuration, 'Release') }} run: | foreach ($file in Get-ChildItem -Path .\Examples\*.exe -Recurse) { & $file.FullName if (!$?) { Exit $LASTEXITCODE } } QuantLib-1.42.1/.github/workflows/msvc-analysis.yml000066400000000000000000000030521517022222500222250ustar00rootroot00000000000000name: Microsoft C++ Code Analysis on: schedule: - cron: '0 0 * * 0' workflow_dispatch: env: # Path to the CMake build directory. build: '${{ github.workspace }}/build' jobs: analyze: name: Analyze runs-on: windows-2022 steps: - name: Checkout repository uses: actions/checkout@v6 - name: Setup run: | $Url = "https://archives.boost.io/release/1.90.0/source/boost_1_90_0.zip" (New-Object System.Net.WebClient).DownloadFile($Url, "$RUNNER_TEMP\boost.zip") Expand-Archive -Path "$RUNNER_TEMP\boost.zip" -DestinationPath C:\local Rename-Item -Path "C:\local\boost_1_90_0" -NewName "boost" - name: Configure CMake env: BOOST_ROOT: C:\local\boost run: cmake -B ${{ env.build }} -DQL_USE_STD_CLASSES=ON - name: Run MSVC Code Analysis uses: microsoft/msvc-code-analysis-action@v0.1.1 # Provide a unique ID to access the sarif output path id: run-analysis env: CAExcludePath: C:\local\boost with: cmakeBuildDirectory: ${{ env.build }} buildConfiguration: Release ruleset: '${{ github.workspace }}/.msvc-analysis.ruleset' - name: Upload SARIF to GitHub uses: github/codeql-action/upload-sarif@v4 with: sarif_file: ${{ steps.run-analysis.outputs.sarif }} - name: Upload SARIF as an Artifact uses: actions/upload-artifact@v7 with: name: sarif-file path: ${{ steps.run-analysis.outputs.sarif }} QuantLib-1.42.1/.github/workflows/msvc-nondefault.yml000066400000000000000000000036041517022222500225440ustar00rootroot00000000000000name: Windows build with non-default configuration on: schedule: - cron: '0 0 * * 0' workflow_dispatch: jobs: msbuild: runs-on: windows-2022 strategy: fail-fast: false matrix: toolset: [v142, v143] platform: [x64, Win32] unity: [unity, singles] include: - toolset: v142 boost_version: 77 vsversion: 2019 - toolset: v143 boost_version: 90 vsversion: 2022 steps: - uses: actions/checkout@v6 - name: Setup MSVC++ environment uses: ilammy/msvc-dev-cmd@v1 with: arch: x64 - name: Setup Boost run: | $Url = "https://archives.boost.io/release/1.${{ matrix.boost_version }}.0/source/boost_1_${{ matrix.boost_version }}_0.zip" (New-Object System.Net.WebClient).DownloadFile($Url, "$RUNNER_TEMP\boost.zip") Expand-Archive -Path "$RUNNER_TEMP\boost.zip" -DestinationPath C:\local Rename-Item -Path "C:\local\boost_1_${{ matrix.boost_version }}_0" -NewName "boost" - name: Setup local properties shell: cmd run: | COPY .ci\VS${{ matrix.vsversion }}.alt.props .\Build.props COPY .ci\userconfig${{ matrix.vsversion }}.alt.hpp .\ql\userconfig.hpp - name: Setup unity build if: ${{ matrix.unity == 'unity' }} shell: cmd run: | COPY .ci\Unity.props .\Directory.Build.props - name: Build run: | msbuild ./QuantLib.sln /verbosity:normal /property:Configuration=Release /property:Platform=${{ matrix.platform }} /property:PlatformToolset=${{ matrix.toolset }} - name: Test run: | .\test-suite\bin\QuantLib-test-suite*.exe --log_level=message - name: Run examples run: | foreach ($file in Get-ChildItem -Path .\Examples\*.exe -Recurse) { & $file.FullName if (!$?) { Exit $LASTEXITCODE } } QuantLib-1.42.1/.github/workflows/msvc.yml000066400000000000000000000033321517022222500204050ustar00rootroot00000000000000name: Windows build on: push: branches: - '**' pull_request: jobs: msbuild: runs-on: windows-2022 strategy: fail-fast: false matrix: toolset: [v142, v143] unity: [unity, singles] include: - toolset: v142 boost_version: 77 vsversion: 2019 - toolset: v143 boost_version: 90 vsversion: 2022 steps: - uses: actions/checkout@v6 - name: Setup MSVC++ environment uses: ilammy/msvc-dev-cmd@v1 with: arch: x64 - name: Setup Boost run: | $Url = "https://archives.boost.io/release/1.${{ matrix.boost_version }}.0/source/boost_1_${{ matrix.boost_version }}_0.zip" (New-Object System.Net.WebClient).DownloadFile($Url, "$RUNNER_TEMP\boost.zip") Expand-Archive -Path "$RUNNER_TEMP\boost.zip" -DestinationPath C:\local Rename-Item -Path "C:\local\boost_1_${{ matrix.boost_version }}_0" -NewName "boost" - name: Setup local properties shell: cmd run: | COPY .ci\VS${{ matrix.vsversion }}.props .\Build.props - name: Setup unity build if: ${{ matrix.unity == 'unity' }} shell: cmd run: | COPY .ci\Unity.props .\Directory.Build.props - name: Build run: | msbuild ./QuantLib.sln /verbosity:normal /property:Configuration=Release /property:Platform=x64 /property:PlatformToolset=${{ matrix.toolset }} - name: Test run: | .\test-suite\bin\QuantLib-test-suite*.exe --log_level=message - name: Run examples run: | foreach ($file in Get-ChildItem -Path .\Examples\*.exe -Recurse) { & $file.FullName if (!$?) { Exit $LASTEXITCODE } } QuantLib-1.42.1/.github/workflows/namespaces.yml000066400000000000000000000023531517022222500215560ustar00rootroot00000000000000name: Fix deprecated uses of ext namespace on: push: branches-ignore: - 'dependabot/**' jobs: check-namespaces: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Check run: | shopt -s globstar sed -i -e 's/ext::function\b/std::function/g' **/*.[hc]pp sed -i -e 's/ext::bind\b/std::bind/g' **/*.[hc]pp sed -i -e 's/ext::ref\b/std::ref/g' **/*.[hc]pp sed -i -e 's/ext::cref\b/std::cref/g' **/*.[hc]pp sed -i -e 's/ext::placeholders\b/std::placeholders/g' **/*.[hc]pp sed -i -e 's/ext::tuple\b/std::tuple/g' **/*.[hc]pp sed -i -e 's/ext::make_tuple\b/std::make_tuple/g' **/*.[hc]pp sed -i -e 's/ext::get\b/std::get/g' **/*.[hc]pp sed -i -e 's/ext::tie\b/std::tie/g' **/*.[hc]pp - uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.MACHINE_ACCOUNT_PAT }} push-to-fork: ${{ vars.MACHINE_ACCOUNT }}/QuantLib branch: fix-ext-namespace-${{ github.ref_name }} delete-branch: true commit-message: 'Fix deprecated uses of ext namespace' title: 'Fix deprecated uses of ext namespace' author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com> QuantLib-1.42.1/.github/workflows/prepare-patch-release.yml000066400000000000000000000042711517022222500236110ustar00rootroot00000000000000name: Prepare patch release on: workflow_dispatch: jobs: update-for-release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: fetch-depth: 0 fetch-tags: true - name: Setup git run: | git config user.name 'lballabio[bot]' git config user.email '224797326+lballabio-bot@users.noreply.github.com' - name: Calculate versions env: GH_TOKEN: ${{ github.token }} run: | export LATEST_RELEASE=`gh release list --json name,isLatest --jq '.[] | select(.isLatest)|.name'` echo LATEST_TAG=v${LATEST_RELEASE} | tee -a $GITHUB_ENV echo ${LATEST_RELEASE} | awk -F '.' '{ print "LAST_MINOR=" $2 }' | tee -a $GITHUB_ENV echo ${LATEST_RELEASE} | awk -F '.' '{ print "NEXT_PATCH=" $3 + 1 }' | tee -a $GITHUB_ENV - name: Update version numbers run: | sed -i -e "s/^AC_INIT(\[QuantLib\].*$/AC_INIT([QuantLib], [1.${LAST_MINOR}.${NEXT_PATCH}],/g" configure.ac sed -i -e "s/^#define QL_VERSION.*$/#define QL_VERSION \"1.${LAST_MINOR}.${NEXT_PATCH}\"/g" ql/version.hpp sed -i -e "s/^#define QL_HEX_VERSION.*$/#define QL_HEX_VERSION 0x01${LAST_MINOR}0${NEXT_PATCH}f0/g" ql/version.hpp sed -i -e "s/^set(PACKAGE_VERSION .*$/set(PACKAGE_VERSION \"1.${LAST_MINOR}.${NEXT_PATCH}\"\)/g" CMakeLists.txt sed -i -e "s/^set(PACKAGE_VERSION_HEX.*$/set(PACKAGE_VERSION_HEX \"0x01${LAST_MINOR}0${NEXT_PATCH}f0\"\)/g" CMakeLists.txt git commit -a -m "Set version to 1.${LAST_MINOR}.${NEXT_PATCH}" - name: Update ChangeLog run: | git log --pretty=medium --date=rfc --stat --grep='Merge [^p]' --grep='[Mm]erged' --grep='[Pp]ull from' --invert-grep ${LATEST_TAG}.. > ChangeLog.txt git commit -a -m "Update changelog" - uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.MACHINE_ACCOUNT_PAT }} push-to-fork: ${{ vars.MACHINE_ACCOUNT }}/QuantLib branch: update-version-for-release-${{ github.ref_name }} delete-branch: true title: 'Set version to 1.${{ env.LAST_MINOR }}.${{ env.NEXT_PATCH }} final' author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com> QuantLib-1.42.1/.github/workflows/prepare-release-candidate.yml000066400000000000000000000037541517022222500244330ustar00rootroot00000000000000name: Prepare release candidate on: workflow_dispatch: jobs: update-for-rc: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: fetch-depth: 0 fetch-tags: true - name: Setup git run: | git config user.name 'lballabio[bot]' git config user.email '224797326+lballabio-bot@users.noreply.github.com' - name: Calculate versions env: GH_TOKEN: ${{ github.token }} run: | export LATEST_RELEASE=`gh release list --json name,isLatest --jq '.[] | select(.isLatest)|.name'` echo LATEST_TAG=v${LATEST_RELEASE} | tee -a $GITHUB_ENV echo ${LATEST_RELEASE} | awk -F '.' '{ print "NEXT_MINOR=" $2 + 1 }' | tee -a $GITHUB_ENV - name: Update version numbers run: | sed -i -e "s/^AC_INIT(\[QuantLib\].*$/AC_INIT([QuantLib], [1.${NEXT_MINOR}-rc],/g" configure.ac sed -i -e "s/^#define QL_VERSION.*$/#define QL_VERSION \"1.${NEXT_MINOR}-rc\"/g" ql/version.hpp sed -i -e "s/^#define QL_HEX_VERSION.*$/#define QL_HEX_VERSION 0x01${NEXT_MINOR}00c0/g" ql/version.hpp sed -i -e "s/^set(PACKAGE_VERSION .*$/set(PACKAGE_VERSION \"1.${NEXT_MINOR}-rc\"\)/g" CMakeLists.txt sed -i -e "s/^set(PACKAGE_VERSION_HEX.*$/set(PACKAGE_VERSION_HEX \"0x01${NEXT_MINOR}00c0\"\)/g" CMakeLists.txt git commit -a -m "Set version to 1.${NEXT_MINOR}-rc" - name: Update ChangeLog run: | git log --pretty=medium --date=rfc --stat --grep='Merge [^p]' --grep='[Mm]erged' --grep='[Pp]ull from' --invert-grep ${LATEST_TAG}.. > ChangeLog.txt git commit -a -m "Update changelog" - uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.MACHINE_ACCOUNT_PAT }} push-to-fork: ${{ vars.MACHINE_ACCOUNT }}/QuantLib branch: set-to-rc-${{ github.ref_name }} delete-branch: true title: 'Set version to 1.${{ env.NEXT_MINOR }}-rc' author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com> QuantLib-1.42.1/.github/workflows/prepare-release.yml000066400000000000000000000037571517022222500225240ustar00rootroot00000000000000name: Prepare release on: workflow_dispatch: jobs: update-for-release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: fetch-depth: 0 fetch-tags: true - name: Setup git run: | git config user.name 'lballabio[bot]' git config user.email '224797326+lballabio-bot@users.noreply.github.com' - name: Calculate versions env: GH_TOKEN: ${{ github.token }} run: | export LATEST_RELEASE=`gh release list --json name,isLatest --jq '.[] | select(.isLatest)|.name'` echo LATEST_TAG=v${LATEST_RELEASE} | tee -a $GITHUB_ENV echo ${LATEST_RELEASE} | awk -F '.' '{ print "NEXT_MINOR=" $2 + 1 }' | tee -a $GITHUB_ENV - name: Update version numbers run: | sed -i -e "s/^AC_INIT(\[QuantLib\].*$/AC_INIT([QuantLib], [1.${NEXT_MINOR}],/g" configure.ac sed -i -e "s/^#define QL_VERSION.*$/#define QL_VERSION \"1.${NEXT_MINOR}\"/g" ql/version.hpp sed -i -e "s/^#define QL_HEX_VERSION.*$/#define QL_HEX_VERSION 0x01${NEXT_MINOR}00f0/g" ql/version.hpp sed -i -e "s/^set(PACKAGE_VERSION .*$/set(PACKAGE_VERSION \"1.${NEXT_MINOR}\"\)/g" CMakeLists.txt sed -i -e "s/^set(PACKAGE_VERSION_HEX.*$/set(PACKAGE_VERSION_HEX \"0x01${NEXT_MINOR}00f0\"\)/g" CMakeLists.txt git commit -a -m "Set version to 1.${NEXT_MINOR}" - name: Update ChangeLog run: | git log --pretty=medium --date=rfc --stat --grep='Merge [^p]' --grep='[Mm]erged' --grep='[Pp]ull from' --invert-grep ${LATEST_TAG}.. > ChangeLog.txt git commit -a -m "Update changelog" - uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.MACHINE_ACCOUNT_PAT }} push-to-fork: ${{ vars.MACHINE_ACCOUNT }}/QuantLib branch: update-version-for-release-${{ github.ref_name }} delete-branch: true title: 'Set version to 1.${{ env.NEXT_MINOR }} final' author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com> QuantLib-1.42.1/.github/workflows/publish-release-candidate.yml000066400000000000000000000021711517022222500244330ustar00rootroot00000000000000name: Publish release candidate on: push: tags: - 'v1.*-rc' permissions: contents: write packages: write jobs: publish-rc: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: fetch-depth: 0 fetch-tags: true - name: Setup run: | sudo apt update sudo apt install -y libboost-dev tofrodos ./autogen.sh ./configure - name: Make tarballs run: | mkdir tarballs make dist mv QuantLib-*.tar.gz tarballs cd tarballs && ../tools/tgz2zip *.tar.gz && ls -lh - name: Extract version run: | echo ${{ github.ref_name }} | awk -F '[v-]' '{ print "VERSION_NUMBER=" $2 }' | tee -a $GITHUB_ENV - name: Create prerelease env: GH_TOKEN: ${{ github.token }} run: | gh release create ${{ github.ref_name }} \ --title "${VERSION_NUMBER} release candidate" \ --prerelease \ --notes "This is a release candidate. Please try it out and report any issues here on GitHub." --generate-notes \ tarballs/*.tar.gz tarballs/*.zip QuantLib-1.42.1/.github/workflows/publish-release.yml000066400000000000000000000065101517022222500225220ustar00rootroot00000000000000name: Draft new release on: push: tags: - 'v1.[0-9]+' - 'v1.[0-9]+.[0-9]+' permissions: contents: write packages: write jobs: draft-release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: fetch-depth: 0 fetch-tags: true - name: Setup run: | sudo apt update sudo apt install -y libboost-dev tofrodos ./autogen.sh ./configure - name: Make tarballs run: | mkdir tarballs make dist mv QuantLib-*.tar.gz tarballs cd tarballs && ../tools/tgz2zip *.tar.gz && ls -lh - name: Extract version run: | echo ${{ github.ref_name }} | awk -F '[v-]' '{ print "VERSION_NUMBER=" $2 }' | tee -a $GITHUB_ENV - name: Prepare release notes run: | echo "Downloads:" >> tarballs/notes.txt echo "==========" >> tarballs/notes.txt echo "" >> tarballs/notes.txt echo "- [QuantLib-${VERSION_NUMBER}.tar.gz](https://github.com/lballabio/QuantLib/releases/download/v${VERSION_NUMBER}/QuantLib-${VERSION_NUMBER}.tar.gz)" >> tarballs/notes.txt echo "- [QuantLib-${VERSION_NUMBER}.zip](https://github.com/lballabio/QuantLib/releases/download/v${VERSION_NUMBER}/QuantLib-${VERSION_NUMBER}.zip)" >> tarballs/notes.txt echo "" >> tarballs/notes.txt awk '/Full list of pull requests/{ exit } { print }' News.md >> tarballs/notes.txt - name: Remove prerelease continue-on-error: true env: GH_TOKEN: ${{ github.token }} run: | gh release delete ${{ github.ref_name }}-rc --cleanup-tag --yes - name: Create draft release env: GH_TOKEN: ${{ github.token }} run: | gh release create ${{ github.ref_name }} \ --title "${VERSION_NUMBER}" \ --draft \ --notes-file tarballs/notes.txt \ --generate-notes \ tarballs/*.tar.gz tarballs/*.zip reference-manual: runs-on: macos-latest steps: - uses: actions/checkout@v6 - name: Setup env: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 run: | brew install automake autoconf libtool boost doxygen graphviz - name: Doxygen version run: | doxygen --version - name: Generate docs run: | ./autogen.sh ./configure --with-boost-include=$(brew --prefix)/include make docs - uses: actions/checkout@v6 with: repository: quantlib/quantlib.github.io path: site - name: Update docs working-directory: site run: | rm -rf reference mv ../Docs/html reference git add reference cp ../LICENSE.TXT _includes/LICENSE.TXT - uses: peter-evans/create-pull-request@v8 with: path: site token: ${{ secrets.MACHINE_ACCOUNT_PAT }} push-to-fork: ${{ vars.MACHINE_ACCOUNT }}/quantlib.github.io branch: reference-docs-${{ github.ref_name }} delete-branch: true commit-message: 'Update reference docs for ${{ github.ref_name }}' title: 'Update reference docs for ${{ github.ref_name }}' author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com> body: | This is an automated PR generated by the [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action. QuantLib-1.42.1/.github/workflows/sanitizer.yml000066400000000000000000000026461517022222500214540ustar00rootroot00000000000000name: Linux build with address sanitizer enabled on: schedule: - cron: '0 0 * * 0' workflow_dispatch: jobs: sanitize-address-undefined: runs-on: ubuntu-latest container: ghcr.io/lballabio/quantlib-devenv:rolling steps: - uses: actions/checkout@v6 - name: Compiler version run: | gcc --version - name: Build run: | ./autogen.sh ./configure --disable-static CC="gcc" CXX="g++" CXXFLAGS="-O2 -g0 -fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer -Wall -Wno-unknown-pragmas -Werror" make -j 4 - name: Run tests run: | LSAN_OPTIONS=suppressions=.lsan.txt ./test-suite/quantlib-test-suite --log_level=message - name: Run examples run: | make check-examples sanitize-thread: runs-on: ubuntu-latest container: ghcr.io/lballabio/quantlib-devenv:rolling steps: - uses: actions/checkout@v6 - name: Compiler version run: | gcc --version - name: Build run: | ./autogen.sh ./configure --disable-static --enable-sessions --enable-thread-safe-observer-pattern CC="gcc" CXX="g++" CXXFLAGS="-O2 -g0 -fsanitize=thread -fno-sanitize-recover=all -Wall -Wno-unknown-pragmas -Werror" make -j 4 - name: Run tests run: | ./test-suite/quantlib-test-suite --log_level=message - name: Run examples run: | make check-examples QuantLib-1.42.1/.github/workflows/stale.yml000066400000000000000000000022241517022222500205440ustar00rootroot00000000000000name: Close stale issues and PR on: schedule: - cron: '30 1 * * *' jobs: staleness-check: runs-on: ubuntu-latest steps: - uses: actions/stale@v10 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'This issue was automatically marked as stale because it has been open 60 days with no activity. Remove stale label or comment, or this will be closed in two weeks.' close-issue-message: 'This issue was automatically closed because it has been stalled for two weeks with no further activity.' stale-pr-message: 'This PR was automatically marked as stale because it has been open 60 days with no activity. Remove stale label or comment, or this will be closed in two weeks.' close-pr-message: 'This PR was automatically closed because it has been stalled for two weeks with no further activity.' days-before-stale: 60 days-before-close: 14 stale-issue-label: 'stale' stale-pr-label: 'stale' exempt-issue-labels: 'help wanted,in progress' exempt-pr-labels: 'help wanted,in progress' exempt-all-milestones: true QuantLib-1.42.1/.github/workflows/sync-org-repo.yml000066400000000000000000000014511517022222500221410ustar00rootroot00000000000000name: Sync quantlib organization repository on: release: types: [published] permissions: contents: write jobs: sync-org-repo: runs-on: ubuntu-latest if: ${{ github.event.release.prerelease == false }} steps: - uses: actions/checkout@v6 with: repository: quantlib/QuantLib token: ${{ secrets.ORG_PUSH_PAT }} ref: master path: quantlib - name: Setup second remote run: | cd quantlib git remote add src https://github.com/lballabio/QuantLib.git git fetch src - name: Push new commits env: GITHUB_TOKEN: ${{ secrets.ORG_PUSH_PAT }} run: | cd quantlib git push origin ${{ github.ref_name }} git merge --ff-only ${{ github.ref_name }} git push origin master QuantLib-1.42.1/.github/workflows/sync-qldefines.yml000066400000000000000000000017351517022222500223660ustar00rootroot00000000000000name: Keep qldefines.hpp.cfg in sync with original header on: push: branches-ignore: - 'dependabot/**' jobs: sync-files: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Check run: | cp ql/qldefines.hpp ql/qldefines.hpp.cfg sed -i -e 's|^#if defined(HAVE_CONFIG_H).*$|#if defined(QL_HAVE_CONFIG_H) // Dynamically created by cmake|g' ql/qldefines.hpp.cfg sed -i -e 's|^/\* install-hook \*/.*$|#cmakedefine QL_HAVE_CONFIG_H|g' ql/qldefines.hpp.cfg - uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.MACHINE_ACCOUNT_PAT }} push-to-fork: ${{ vars.MACHINE_ACCOUNT }}/QuantLib branch: sync-qldefine-${{ github.ref_name }} delete-branch: true commit-message: 'Sync qldefines.hpp.cfg with original header' title: 'Sync qldefines.hpp.cfg with original header' author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com> QuantLib-1.42.1/.github/workflows/test-macros.yml000066400000000000000000000017321517022222500217000ustar00rootroot00000000000000name: Replace Boost macros that might not work with AAD types on: push: branches-ignore: - 'dependabot/**' jobs: check-namespaces: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Check run: | sed -i -e 's/BOOST_CHECK_SMALL\b/QL_CHECK_SMALL/g' test-suite/*.cpp sed -i -e 's/BOOST_CHECK_CLOSE\b/QL_CHECK_CLOSE/g' test-suite/*.cpp sed -i -e 's/BOOST_CHECK_CLOSE_FRACTION\b/QL_CHECK_CLOSE_FRACTION/g' test-suite/*.cpp - uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.MACHINE_ACCOUNT_PAT }} push-to-fork: ${{ vars.MACHINE_ACCOUNT }}/QuantLib branch: fix-boost-test-macros-${{ github.ref_name }} delete-branch: true commit-message: 'Replace Boost macros that might not work with AAD types' title: 'Replace Boost macros that might not work with AAD types' author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com> QuantLib-1.42.1/.github/workflows/test-times.yml000066400000000000000000000026011517022222500215310ustar00rootroot00000000000000name: Check test times on: push: branches: - '**' pull_request: jobs: check-test-times: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Cache uses: hendrikmuhs/ccache-action@v1.2 with: key: linux-ci-test-times-${{ github.ref }} restore-keys: | linux-ci-test-times-${{ github.ref }} linux-ci-test-times-refs/heads/master linux-ci-test-times- - name: Setup run: | sudo rm /etc/apt/sources.list.d/microsoft-prod.list sudo apt update sudo apt install -y libboost-dev autoconf automake libtool ccache - name: Build run: | ./autogen.sh ./configure --disable-static CC="ccache gcc" CXX="ccache g++" CXXFLAGS="-O2 -g0" make -j 4 - name: Run faster tests run: | ./test-suite/quantlib-test-suite --logger=JUNIT,warning,faster.xml:HRF,message -- --faster - name: Run fast tests run: | ./test-suite/quantlib-test-suite --logger=JUNIT,warning,fast.xml:HRF,message -- --fast - name: Run all tests run: | ./test-suite/quantlib-test-suite --logger=JUNIT,warning,all.xml:HRF,message - name: Save test times uses: actions/upload-artifact@v7 with: name: test-reports path: ./*.xml - name: Check test times run: | python ./tools/check_test_times.py QuantLib-1.42.1/.github/workflows/tidy.yml000066400000000000000000000021461517022222500204100ustar00rootroot00000000000000name: Apply clang-tidy fixes on: schedule: - cron: '0 0 * * 0' workflow_dispatch: jobs: check: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6 - name: Setup run: | sudo apt-get update sudo apt-get install -y clang-tidy-19 libboost-dev - name: Check run: | cmake --preset linux-ci-build-with-clang-tidy cd build/linux-ci-build-with-clang-tidy cmake --build . -j1 - uses: peter-evans/create-pull-request@v8 if: ${{ always() }} with: token: ${{ secrets.MACHINE_ACCOUNT_PAT }} push-to-fork: ${{ vars.MACHINE_ACCOUNT }}/QuantLib branch: clang-tidy-fixes-${{ github.ref_name }} delete-branch: true commit-message: 'Automated fixes by clang-tidy' title: 'Automated fixes by clang-tidy' author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com> body: | This is an automated PR generated by the [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action. Please review the changes before merging. QuantLib-1.42.1/.gitignore000066400000000000000000000036611517022222500153120ustar00rootroot00000000000000# Compilation artifacts configure quantlib-config libtool aclocal.m4 autom4te.cache config.log config.status config/* !config/Makefile.am m4/*.m4 ql/config.hpp ql/config.hpp.in ql/stamp-h1 elc-stamp quantlib.elc quantlib.pc QuantLib.spec CMakeCache.txt CMakeUserPresets.json Docs/.time-stamp Docs/.time-stamp-html Docs/.time-stamp-online Docs/.time-stamp-man Docs/LICENSE.TXT Docs/reference-*/ Docs/html/ Docs/man/ Examples/*/bin/ Examples/*/build/ Examples/*/*.trs build/ install/ lib/ test-suite/bin/QuantLib-test-suite-*.manifest test-suite/build/ test-suite/*.trs # Build outputs **/x64/Debug **/x64/Release **/Debug **/Release **/bin/*.xml **/bin/*.manifest # Artifacts created in multiple directories Makefile Makefile.in unity.cpp unity_*.cpp testCaseCollection.xml .deps .libs *.la *.lo *.o *.so .build-stamp *.exe *.dll *.exp *.lib *.pdb *.ilk *~ *.ncb *.suo *.vcproj.*.user *.vcxproj.user *.VC.db *.VC.opendb *.log *.sdf *.opensdf *.pch *.idb *.ipch CMakeFiles *.cmake !cmake/*.cmake TAGS .dirstamp # Outputs Examples/BasketLosses/BasketLosses Examples/BermudanSwaption/BermudanSwaption Examples/Bonds/Bonds Examples/CallableBonds/CallableBonds Examples/CDS/CDS Examples/ConvertibleBonds/ConvertibleBonds Examples/CVAIRS/CVAIRS Examples/DiscreteHedging/DiscreteHedging Examples/EquityOption/EquityOption Examples/FittedBondCurve/FittedBondCurve Examples/FRA/FRA Examples/Gaussian1dModels/Gaussian1dModels Examples/GlobalOptimizer/GlobalOptimizer Examples/LatentModel/LatentModel Examples/MarketModels/MarketModels Examples/MultidimIntegral/MultidimIntegral Examples/MulticurveBootstrapping/MulticurveBootstrapping Examples/Replication/Replication Examples/Repo/Repo test-suite/quantlib-test-suite test-suite/quantlib-benchmark test-suite/bin/*.exp test-suite/bin/*.lib test-suite/bin/*.pdb test-suite/.unit_test_profile.txt # IDEs .vs .vscode .idea cmake-build-* nbproject .cproject # User customizations .dir-locals.el Build.props Directory.Build.props QuantLib-1.42.1/.lgtm.yml000066400000000000000000000002461517022222500150620ustar00rootroot00000000000000 path_classifiers: docs: - Docs - Examples test: - test-suite library: - tools queries: - exclude: cpp/fixme-comment QuantLib-1.42.1/.lsan.txt000066400000000000000000000000011517022222500150570ustar00rootroot00000000000000 QuantLib-1.42.1/.misspell-fixer.ignore000066400000000000000000000000221517022222500175340ustar00rootroot00000000000000^./ChangeLog.txt QuantLib-1.42.1/.msvc-analysis.ruleset000066400000000000000000000010041517022222500175630ustar00rootroot00000000000000 QuantLib-1.42.1/CITATION.cff000066400000000000000000000005551517022222500152130ustar00rootroot00000000000000cff-version: 1.2.0 message: If you use this software, please cite it using these metadata. title: "QuantLib: a free/open-source library for quantitative finance" authors: - name: "The QuantLib contributors" url: "https://www.quantlib.org/" type: software doi: 10.5281/zenodo.1440997 license: BSD-3-Clause repository-code: "https://github.com/lballabio/QuantLib" QuantLib-1.42.1/CMakeLists.txt000066400000000000000000000252641517022222500160650ustar00rootroot00000000000000cmake_minimum_required(VERSION 3.15.0) # For MSVC RUNTIME LIBRARY, need CMP0091=NEW and cmake 3.15+ cmake_policy(SET CMP0091 NEW) # Version info set(QUANTLIB_VERSION_MAJOR 1) set(QUANTLIB_VERSION_MINOR 42) set(QUANTLIB_VERSION_PATCH 0) set(QUANTLIB_VERSION ${QUANTLIB_VERSION_MAJOR}.${QUANTLIB_VERSION_MINOR}.${QUANTLIB_VERSION_PATCH}) # Project Info set(PACKAGE_NAME "QuantLib") set(PACKAGE_VERSION "1.42.1") set(PACKAGE_VERSION_HEX "0x014201f0") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/lballabio/QuantLib/issues/") # Default build type for single-config generators (set this before project() command) # For multi-config generators, such as Visual Studio, use: cmake --build . --config= if (NOT CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "") set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type for single-config generators" FORCE) endif() project(${PACKAGE_NAME} LANGUAGES CXX DESCRIPTION "The QuantLib C++ Library") # Path for package-local cmake modules set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) # Installation directories set(QL_INSTALL_BINDIR "bin" CACHE STRING "Installation directory for executables") set(QL_INSTALL_LIBDIR "lib" CACHE STRING "Installation directory for libraries") set(QL_INSTALL_INCLUDEDIR "include" CACHE STRING "Installation directory for headers") set(QL_INSTALL_EXAMPLESDIR "lib/QuantLib/examples" CACHE STRING "Installation directory for examples") set(QL_INSTALL_CMAKEDIR "lib/cmake/${PACKAGE_NAME}" CACHE STRING "Installation directory for CMake scripts") # Options option(QL_BUILD_EXAMPLES "Build examples" ON) option(QL_BUILD_TEST_SUITE "Build test suite" ON) option(QL_BUILD_FUZZ_TEST_SUITE "Build fuzz test suite" OFF) option(QL_ENABLE_OPENMP "Detect and use OpenMP" OFF) option(QL_ENABLE_PARALLEL_UNIT_TEST_RUNNER "Enable the parallel unit test runner" OFF) option(QL_ENABLE_SESSIONS "Singletons return different instances for different sessions" OFF) option(QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN "Enable the thread-safe observer pattern" OFF) option(QL_ENABLE_TRACING "Tracing messages should be allowed" OFF) option(QL_ENABLE_DEFAULT_WARNING_LEVEL "Enable the default warning level to pass the ci pipeline" ON) option(QL_COMPILE_WARNING_AS_ERROR "Specify whether to treat warnings on compile as errors." OFF) option(QL_ERROR_FUNCTIONS "Error messages should include current function information" OFF) option(QL_ERROR_LINES "Error messages should include file and line information" OFF) option(QL_EXTRA_SAFETY_CHECKS "Extra safety checks should be performed" OFF) option(QL_HIGH_RESOLUTION_DATE "Enable date resolution down to microseconds" OFF) option(QL_THROW_IN_CYCLES "Throw an exception when a notification loop is detected" OFF) option(QL_FASTER_LAZY_OBJECTS "Cause lazy objects to forward just the first notification instead of every one" ON) option(QL_NULL_AS_FUNCTIONS "Enable the implementation of Null as template functions" OFF) option(QL_INSTALL_BENCHMARK "Install benchmark" ON) option(QL_INSTALL_EXAMPLES "Install examples" ON) option(QL_INSTALL_TEST_SUITE "Install test suite" ON) option(QL_TAGGED_LAYOUT "Library names use layout tags" ${MSVC}) option(QL_USE_CLANG_TIDY "Use clang-tidy when building" OFF) option(QL_USE_INDEXED_COUPON "Use indexed coupons instead of par coupons" OFF) option(QL_USE_STD_ANY "Use std::any instead of boost::any" ON) option(QL_USE_STD_CLASSES "Enable all QL_USE_STD_ options" OFF) option(QL_USE_STD_OPTIONAL "Use std::optional instead of boost::optional" ON) option(QL_USE_STD_SHARED_PTR "Use standard smart pointers instead of Boost ones" OFF) set(QL_EXTERNAL_SUBDIRECTORIES "" CACHE STRING "Optional list of external source directories to be added to the build (semicolon-separated)") # set -lpapi here set(QL_EXTRA_LINK_LIBRARIES "" CACHE STRING "Optional extra link libraries to add to QuantLib") # Require C++17 or higher if (NOT DEFINED CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 17) elseif(CMAKE_CXX_STANDARD LESS 17) message(FATAL_ERROR "Please specify CMAKE_CXX_STANDARD of 17 or higher") endif() if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED) set(CMAKE_CXX_STANDARD_REQUIRED ON) endif() # Avoid use of compiler language extensions, i.e. -std=c++17 not -std=gnu++17 if (NOT DEFINED CMAKE_CXX_EXTENSIONS) set(CMAKE_CXX_EXTENSIONS FALSE) endif() # Convenience option to activate all STD options if (QL_USE_STD_CLASSES) set(QL_USE_STD_ANY ON) set(QL_USE_STD_OPTIONAL ON) set(QL_USE_STD_SHARED_PTR ON) endif() # Set the default warning level we use to pass the GitHub workflows if (QL_ENABLE_DEFAULT_WARNING_LEVEL) if (MSVC) # warning level 3 # There are also specific warnings disabled for MSCV in cmake/Platform.cmake. add_compile_options(-W3) elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") # lots of warnings add_compile_options(-Wall -Wno-unknown-pragmas -Wno-array-bounds) endif() endif() # Treat warnings on compile as errors if (QL_COMPILE_WARNING_AS_ERROR) # all compiler warnings as errors if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") # since v3.24 cmake can set all compiler warnings as errors itself set(CMAKE_COMPILE_WARNING_AS_ERROR ON) else() # or set them manually if (MSVC) add_compile_options(-WX) elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") add_compile_options(-Werror) endif() endif() endif() if (QL_USE_CLANG_TIDY) if (NOT DEFINED QL_CLANG_TIDY) set(QL_CLANG_TIDY clang-tidy) endif() if (NOT DEFINED QL_CLANG_TIDY_OPTIONS) set(QL_CLANG_TIDY_OPTIONS) endif() if (QL_CLANG_TIDY_OPTIONS) set(CMAKE_CXX_CLANG_TIDY "${QL_CLANG_TIDY};${QL_CLANG_TIDY_OPTIONS}") else() set(CMAKE_CXX_CLANG_TIDY "${QL_CLANG_TIDY}") endif() endif() # Project shared libs ON for UNIX if (NOT DEFINED BUILD_SHARED_LIBS) set(BUILD_SHARED_LIBS ${UNIX}) endif() # Boost static libs ON for MSVC if (NOT DEFINED Boost_USE_STATIC_LIBS) set(Boost_USE_STATIC_LIBS ${MSVC}) endif() # Boost static runtime ON for MSVC if (NOT DEFINED Boost_USE_STATIC_RUNTIME) set(Boost_USE_STATIC_RUNTIME ${MSVC}) endif() if (NOT DEFINED QL_BOOST_VERSION) # Boost 1.75.0 or greater required for compiling with C++20 if (CMAKE_CXX_STANDARD GREATER_EQUAL 20) set(QL_BOOST_VERSION 1.75.0) else() set(QL_BOOST_VERSION 1.58.0) endif() endif() if (CMAKE_CXX_COMPILER STREQUAL "icpx") find_package(IntelDPCPP REQUIRED) endif() find_package(Boost ${QL_BOOST_VERSION} REQUIRED) # Do not warn about Boost versions higher than 1.58.0 set(Boost_NO_WARN_NEW_VERSIONS ON) # Avoid using Boost auto-linking add_compile_definitions(BOOST_ALL_NO_LIB) if (QL_ENABLE_OPENMP) find_package(OpenMP REQUIRED) endif() # Prefer pthread flag as per https://cmake.org/cmake/help/latest/module/FindThreads.html if (NOT DEFINED THREADS_PREFER_PTHREAD_FLAG) set(THREADS_PREFER_PTHREAD_FLAG ON) endif() # Add Threads dependency when any of the threading features are enabled if (QL_ENABLE_PARALLEL_UNIT_TEST_RUNNER OR QL_ENABLE_SESSIONS OR QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN) find_package(Threads REQUIRED) # Parallel test runner needs library rt on *nix for shm_open, etc. if (QL_ENABLE_PARALLEL_UNIT_TEST_RUNNER AND UNIX AND NOT APPLE) find_library(RT_LIBRARY rt REQUIRED) set(QL_THREAD_LIBRARIES Threads::Threads ${RT_LIBRARY}) else() set(QL_THREAD_LIBRARIES Threads::Threads) endif() endif() # If available, use PIC for shared libs and PIE for executables if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() if (CMAKE_POSITION_INDEPENDENT_CODE) # cmake policy CMP0083: add PIE support if possible (need cmake 3.14) include(CheckPIESupported) check_pie_supported() endif() # Configure files set(QL_HAVE_CONFIG_H ON) set(QL_VERSION ${PACKAGE_VERSION}) set(QL_HEX_VERSION ${PACKAGE_VERSION_HEX}) configure_file(ql/config.hpp.cfg ql/config.hpp @ONLY) configure_file(ql/qldefines.hpp.cfg ql/qldefines.hpp @ONLY) # Generate quantlib-config # Define the variables to be substituted in the input file set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix "\${prefix}") set(includedir "\${prefix}/include") set(libdir "\${exec_prefix}/lib") if (QL_ENABLE_OPENMP) set(OPENMP_CXXFLAGS ${OpenMP_CXX_FLAGS}) endif() configure_file(quantlib-config.in quantlib-config @ONLY) configure_file(quantlib.pc.in quantlib.pc @ONLY) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/quantlib-config TYPE BIN) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/quantlib.pc DESTINATION lib/pkgconfig) include(Platform) # Check for library name layout tagging if (QL_TAGGED_LAYOUT) if (${CMAKE_SIZEOF_VOID_P} EQUAL 8) set(DEBUG_POSTFIX "-x64") set(RELEASE_POSTFIX "-x64") endif() set(DEBUG_POSTFIX ${DEBUG_POSTFIX}-mt) set(RELEASE_POSTFIX ${RELEASE_POSTFIX}-mt) if (CMAKE_MSVC_RUNTIME_LIBRARY MATCHES ".*DLL$") set(DEBUG_POSTFIX ${DEBUG_POSTFIX}-gd) else() set(DEBUG_POSTFIX ${DEBUG_POSTFIX}-sgd) set(RELEASE_POSTFIX ${RELEASE_POSTFIX}-s) endif() set(CMAKE_DEBUG_POSTFIX ${DEBUG_POSTFIX}) set(CMAKE_RELEASE_POSTFIX ${RELEASE_POSTFIX}) set(CMAKE_RELWITHDEBINFO_POSTFIX ${RELEASE_POSTFIX}) set(CMAKE_MINSIZEREL_POSTFIX ${RELEASE_POSTFIX}) endif() include(CTest) # extension subdirectories if they exist (hook for external projects) foreach(extdir ${QL_EXTERNAL_SUBDIRECTORIES}) get_filename_component(name_without_dir "${extdir}" NAME) add_subdirectory(${extdir} ${name_without_dir}) endforeach() # Add subdirectories add_subdirectory(ql) if (QL_BUILD_EXAMPLES) add_subdirectory(Examples) endif() if (QL_BUILD_TEST_SUITE) add_subdirectory(test-suite) endif() if ('${CMAKE_CXX_COMPILER_ID}' MATCHES 'Clang' AND QL_BUILD_FUZZ_TEST_SUITE) add_subdirectory(fuzz-test-suite) endif() # CPack support (make package, make package_source) set(CPACK_PACKAGE_VERSION_MAJOR ${QUANTLIB_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${QUANTLIB_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_PATCH ${QUANTLIB_VERSION_PATCH}) set(CPACK_PACKAGE_FILE_NAME ${PACKAGE_NAME}-${PACKAGE_VERSION}) set(CPACK_GENERATOR "TGZ" "ZIP" "7Z") set(CPACK_SOURCE_PACKAGE_FILE_NAME ${PACKAGE_NAME}-${PACKAGE_VERSION}) set(CPACK_SOURCE_GENERATOR "TGZ" "ZIP" "7Z") set(CPACK_SOURCE_IGNORE_FILES "~$" "\\\\.swp$" "/[Bb]uild" "/\\\\.app" "/\\\\.cla" "/\\\\.cod" "/\\\\.git" "/\\\\.lgt" "/\\\\.mis") include(CPack) QuantLib-1.42.1/CMakePresets.json000066400000000000000000000176001517022222500165410ustar00rootroot00000000000000{ "version": 3, "configurePresets": [ { "name": "windows-base", "hidden": true, "binaryDir": "${sourceDir}/build/${presetName}", "architecture": { "value": "x64", "strategy": "external" }, "condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows" } }, { "name": "windows-msvc-base", "hidden": true, "inherits": "windows-base", "cacheVariables": { "CMAKE_CXX_COMPILER": "cl.exe" }, "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "intelliSenseMode": "windows-msvc-x64" } } }, { "name": "windows-clang-base", "hidden": true, "inherits": "windows-base", "cacheVariables": { "CMAKE_CXX_COMPILER": "clang-cl.exe" }, "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "intelliSenseMode": "windows-clang-x64" } } }, { "name": "linux-base", "hidden": true, "binaryDir": "${sourceDir}/build/${presetName}", "condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Linux" }, "vendor": { "microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { "sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" }, "microsoft.com/VisualStudioSettings/CMake/1.0": { "intelliSenseMode": "linux-gcc-x64", "hostOS": [ "Linux" ] } } }, { "name": "linux-gcc-base", "hidden": true, "inherits": "linux-base", "cacheVariables": { "CMAKE_CXX_COMPILER": "g++" } }, { "name": "linux-clang-base", "hidden": true, "inherits": "linux-base", "cacheVariables": { "CMAKE_CXX_COMPILER": "clang++" } }, { "name": "apple-arm64-base", "hidden": true, "binaryDir": "${sourceDir}/build/${presetName}", "architecture": { "value": "arm64", "strategy": "external" }, "condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Darwin" } }, { "name": "ninja", "hidden": true, "generator": "Ninja" }, { "name": "make", "hidden": true, "generator": "Unix Makefiles" }, { "name": "_release", "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } }, { "name": "_debug", "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" } }, { "name": "_relwithdebinfo", "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" } }, { "name": "linux-clang-debug", "inherits": [ "linux-clang-base", "make", "_debug" ] }, { "name": "linux-clang-release", "inherits": [ "linux-clang-base", "make", "_release" ] }, { "name": "linux-clang-relwithdebinfo", "inherits": [ "linux-clang-base", "make", "_relwithdebinfo" ] }, { "name": "linux-gcc-debug", "inherits": [ "linux-gcc-base", "make", "_debug" ] }, { "name": "linux-gcc-release", "inherits": [ "linux-gcc-base", "make", "_release" ] }, { "name": "linux-gcc-relwithdebinfo", "inherits": [ "linux-gcc-base", "make", "_relwithdebinfo" ] }, { "name": "linux-clang-ninja-debug", "inherits": [ "ninja", "linux-clang-debug" ] }, { "name": "linux-clang-ninja-release", "inherits": [ "ninja", "linux-clang-release" ] }, { "name": "linux-clang-ninja-relwithdebinfo", "inherits": [ "ninja", "linux-clang-relwithdebinfo" ] }, { "name": "linux-gcc-ninja-debug", "inherits": [ "ninja", "linux-gcc-debug" ] }, { "name": "linux-gcc-ninja-release", "inherits": [ "ninja", "linux-gcc-release" ] }, { "name": "linux-gcc-ninja-relwithdebinfo", "inherits": [ "ninja", "linux-gcc-relwithdebinfo" ] }, { "name": "linux-gcc-debug-with-clang-tidy", "inherits": [ "linux-gcc-debug" ], "cacheVariables": { "QL_CLANG_TIDY_OPTIONS": "-warnings-as-errors=*", "QL_USE_CLANG_TIDY": "ON" } }, { "name": "windows-clang-release", "inherits": [ "windows-clang-base", "ninja", "_release" ] }, { "name": "windows-clang-debug", "inherits": [ "windows-clang-base", "ninja", "_debug" ] }, { "name": "windows-clang-relwithdebinfo", "inherits": [ "windows-clang-base", "ninja", "_relwithdebinfo" ] }, { "name": "windows-msvc-release", "inherits": [ "windows-msvc-base", "ninja", "_release" ] }, { "name": "windows-msvc-debug", "inherits": [ "windows-msvc-base", "ninja", "_debug" ] }, { "name": "windows-msvc-relwithdebinfo", "inherits": [ "windows-msvc-base", "ninja", "_relwithdebinfo" ] }, { "name": "linux-ci-build-with-clang-tidy", "inherits": [ "linux-gcc-debug" ], "cacheVariables": { "BOOST_ROOT": "/usr", "CMAKE_UNITY_BUILD": "ON", "QL_CLANG_TIDY": "clang-tidy-19", "QL_CLANG_TIDY_OPTIONS": "-quiet;-fix", "QL_USE_CLANG_TIDY": "ON", "QL_USE_STD_CLASSES": "ON" } }, { "name": "linux-ci-build-with-nonstandard-options", "inherits": [ "linux-gcc-ninja-release" ], "cacheVariables": { "BOOST_ROOT": "/usr", "BUILD_SHARED_LIBS": false, "CMAKE_CXX_COMPILER_LAUNCHER": "ccache", "QL_ENABLE_SESSIONS": "ON", "QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN": "ON", "QL_HIGH_RESOLUTION_DATE": "ON", "QL_FASTER_LAZY_OBJECTS": "OFF", "QL_THROW_IN_CYCLES": "ON", "QL_NULL_AS_FUNCTIONS": "ON", "QL_USE_INDEXED_COUPON": "ON", "QL_USE_STD_SHARED_PTR": "ON", "QL_USE_STD_ANY": "OFF", "QL_USE_STD_OPTIONAL": "OFF", "QL_COMPILE_WARNING_AS_ERROR": "ON" } }, { "name": "windows-ci-build-with-nonstandard-options", "inherits": [ "windows-msvc-release" ], "cacheVariables": { "CMAKE_UNITY_BUILD": "ON", "QL_ENABLE_SESSIONS": "ON", "QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN": "ON", "QL_HIGH_RESOLUTION_DATE": "ON", "QL_FASTER_LAZY_OBJECTS": "OFF", "QL_THROW_IN_CYCLES": "ON", "QL_NULL_AS_FUNCTIONS": "ON", "QL_USE_INDEXED_COUPON": "ON", "QL_USE_STD_SHARED_PTR": "ON", "QL_USE_STD_ANY": "OFF", "QL_USE_STD_OPTIONAL": "OFF", "QL_COMPILE_WARNING_AS_ERROR": "ON", "CMAKE_CXX_COMPILER_LAUNCHER": "sccache" } }, { "name": "apple-arm64-ninja-debug", "description": "Apple M series preset Debug", "inherits": [ "apple-arm64-base", "ninja", "_debug" ] }, { "name": "apple-arm64-ninja-release", "description": "Apple M series preset Release", "inherits": [ "apple-arm64-base", "ninja", "_release" ] }, { "name": "apple-arm64-ninja-relwithdebinfo", "description": "Apple M series preset RelWithDebInfo", "inherits": [ "apple-arm64-base", "ninja", "_relwithdebinfo" ] } ] } QuantLib-1.42.1/CONTRIBUTING.md000066400000000000000000000036311517022222500155500ustar00rootroot00000000000000 # Contributing to QuantLib Thanks for considering a contribution! We're looking forward to it. The preferred way to contribute is through a pull request on GitHub. This gives us some convenient tooling to look at your changes and provide feedback; also, opening a pull request triggers automated building and testing of your code and often gives you feedback before a human has a chance to look at it (the time we can give to the project is, unfortunately, limited). So, in short: get a GitHub account if you don't have it already and clone the repository at with the "Fork" button in the top right corner of the page. Check out your clone to your machine, code away, push your changes to your clone and submit a pull request: links to more detailed instructions are at the end of this file. A note: a pull request will show any new changes committed and pushed to the corresponding branch. For this reason, we strongly advise you to use a feature branch for your changes, instead of your `master` branch. This gives you the freedom to add unrelated changes to your master, and also gives the maintainers the freedom to push further changes to the branch. It's likely that we won't merge your code right away, and we'll ask for some changes instead. Don't be discouraged! That's normal; the library is complex, and thus it might take some time to become familiar with it and to use it in an idiomatic way. Again, thanks — and welcome! We're looking forward to your contributions. #### Useful links Instructions for forking a cloning a repository are at . More detailed instructions for creating pull requests are at . Finally, a basic guide to GitHub is at . GitHub also provides interactive learning at . QuantLib-1.42.1/ChangeLog.txt000066400000000000000000000040131517022222500157020ustar00rootroot00000000000000commit 974bb6143d544461f1713ac7062f26de763d8bac Author: lballabio[bot] <224797326+lballabio-bot@users.noreply.github.com> Date: Thu, 16 Apr 2026 14:31:36 +0000 Set version to 1.42.1 CMakeLists.txt | 4 ++-- configure.ac | 2 +- ql/version.hpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) commit 12204e07675917a4075235970440ab202813e78d Author: Luigi Ballabio Date: Thu, 16 Apr 2026 15:57:07 +0200 Update news News.md | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) commit aa7b3a1959f01e606f2737e28dc8686bddbaae49 Author: Luigi Ballabio Date: Thu, 16 Apr 2026 15:32:55 +0200 Fix action title .github/workflows/prepare-patch-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) commit fb7b4f3e144f8a0f3d1056bb34d1792a74fbae32 Author: Luigi Ballabio Date: Thu, 16 Apr 2026 14:59:01 +0200 Add action to prepare patch release .github/workflows/prepare-patch-release.yml | 44 +++++++++++++++++++++++++ .github/workflows/prepare-release-candidate.yml | 4 +-- .github/workflows/prepare-release.yml | 4 +-- 3 files changed, 48 insertions(+), 4 deletions(-) commit 10e5d215d9a24ddf36d01fc42f15e95cff0ef931 Merge: 41b0e1460 cf2dc1daf Author: Luigi Ballabio Date: Thu, 16 Apr 2026 12:56:17 +0200 Avoid notification loop in GSR model (#2543) commit cf2dc1daf12a6c23dd6f50f339b9cd7e9f85a1ab Author: Luigi Ballabio Date: Thu, 16 Apr 2026 10:13:34 +0200 Avoid notification loop in GSR model ql/models/shortrate/onefactormodels/gsr.cpp | 6 ++-- test-suite/gsr.cpp | 47 +++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) commit 05169469217ff94f06ab0b31aedc66c5577daa33 Author: Luigi Ballabio Date: Thu, 16 Apr 2026 09:16:54 +0200 Restore disabled test test-suite/gsr.cpp | 3 --- 1 file changed, 3 deletions(-) QuantLib-1.42.1/Contributors.txt000066400000000000000000000130661517022222500165600ustar00rootroot00000000000000We gratefully acknowledge contributions from (in alphabetical order): Nathan Abbott, Samad Abdessadki, Kakhkhor Abdijalilov, Xavier Abulker, Toyin Akin, Marius Akre, Mario Aleppo, Rich Amaya, Ferdinando Ametrano, Imrane Amri, Jongbong An, Tom Anderson, Grzegorz Andruszkiewicz, Ignacio Anguita, Fanis Antoniou, Driss Aouad, Jose Aparicio, Sergio Araujo, Leonardo Arcari, Sercan Atalik, F. Eugene Aumson, Ahmed Ayadi, Arnaud Baguet, Lluis Pujol Bajador, Gerardo Ballabio, Luigi Ballabio, Jonathan Barber, Nabila Barkati, Riccardo Barone, Clément Barret, Christopher Baus, Thomas Becker, Michaël Benguigui, Adolfo Benin, Hachemi Benyahia, Luca Berardi, Nicholas Bertocchi, Sylvain Bertrand, Manas Bhatt, Marco Bianchetti, David Binderman, Theo Boafo, Marcin Bogusz, Francois Botha, Delphine Bouthier, Fakher Braham, Nathaniel Brough, Ole Bueker, Joe Byers, Xavier Caron, Marine Casanova, Peter Caspers, Antoine Cellerier, Yee Man Chan, Aurelien Chanudet, Yiping Chen, Yanice Cherrak, Gualtiero Chiaia, Meryem Chibo, Warren Chou, Scott Condit, Marco Craveiro, Paolo D'Elia, Stephen Dacek, Jon Davidson, William Day, Daniele De Francesco, Frédéric Degraeve, Piero Del Boca, Mike DelMedico, Chirag Desai, Barry Devlin, Nicolas Di Césaré, Lucas Dias, Piter Dias, Binrui Dong, Jacques du Toit, François du Vignaud, Francis Duffy, Cristina Duminuco, Jan Ladislav Dussek, Ralf Konrad Eckel, Dirk Eddelbuettel, Faycal El Karaa, Joshua Engelman, Bernd Engelmann, Giorgio Facchinetti, Matt Fair, Kareem Fareed, Paul Farrington, Lorella Fatone, Isuru Fernando, Luca Ferraro, Marco Bruno Ferreira Vasconcellos, Davide Ferretti, Neil Firth, Stefano Fondi, Chiara Fornarola, Silvia Frasson, Rémy Frèrebeau, Andreas Gaida, Matteo Gallivanoni, Jose Garcia, Lakshay Garg, Shubham Gaur, Fredrik Gerdin Börjesson, Riccardo Ghetta, Hoang Giap Vu, Ryan Gibson, Jack Gillett, Paul Giltinan, Roman Gitlin, Nick Glass, Marek Glowacki, Dmitri Goloubentsev, Richard Gomes, Johannes Göttker-Schnetmann, Henri Gough, Richard Gould, Brett Graves, Eleanor Green, Florent Grenier, Matthias Groncki, Sebastien Gurrieri, Tawanda Gwena, Cavit Hafizoglu, Lew Wei Hao, Joshua Hayes, Michael Heckl, Jake Heke, Andres Hernandez, Chris Higgs, Laurent Hoffmann, Xiangyu Hong, Guillaume Horel, Benoît Houzelle, Frank Hövermann, Daniel Hrabovcak, Shen Hui, Charles Chongseok Hyun, Simon Ibbotson, Yassine Idyiahia, Alexey Indiryakov, Norbert Irmer, Mike Jake, Nicola Jean, Joseph Jeisman, Yi Jiang, Tomas Kalibera, Rahul Kanchi, Roland Kapl, Andrey Karpov, Michal Kaut, Tomoya Kawanishi, Gary Kennedy, Chris Kenyon, Babar Khan, Oleksandr Khomenko, Joel King, Kevin Kirchhoff, Matt Knox, Matthew Kolbe, Andrew Kolesnikov, David Korczynski, Nijaz Kovacevic, Philip Kovacs, Zak Kraehling, Silakhdar Krikeb, Pradeep Krishnamurthy, Nathan Kruck, Yan Kuang, Werner Kuerzinger, Oleg Kulkov, Allen Kuo, Christian Köhnenkamp, Mickael Anas Laaouini, Paul Laderoute, Yasmine Lahlou, Alix Lassauzet, Fabien Le Floc'h, Fabrice Lecuyer, James Lee, Jonghee Lee, Ka Wai Lee, Jacob Lee-Howes, Samuel Lerouge, Bernd Lewerenz, Patrick Lewis, Cheng Li, Gang Liang, Roland Lichters, Kai Lin, Hank Liu, Robert Lopez, André Louw, Benson Luk, Matthias Lungwitz, Jasen Mackie, Trent Maetzold, Andrea Maffezzoli, Joao Paulo Magalhaes, Jose Magana, Andrea Maggiulli, John Maiden, Katiuscia Manzoni, Marco Marchioro, Francesca Mariani, Daniel Martinez Davies, Slava Mazur, Paolo Mazzocchi, Siddharth Mehrotra, Magnus Mencke, Enrico Michelotti, Andre Miemiec, Raso Mirko, Radu Mondescu, Bryte Morio, Bart Mosley, Zain Mughal, Tiziano Müller, Joan Carlos Naftanaila, Prince Nanda, Dmitri Nesteruk, Billy Ng, Bojan Nikolic, Jean Nkeng, Robin Northcott, Konstantin Novitsky, Nikolai Nowaczyk, Adrian O'Neill, Andrea Odetti, Cay Oest, Hiroto Ogawa, Anubhav Pandey, Aaditya Panikath, Sotirios Papathanasopoulos, Krishn Parasar, Mike Parker, Guillermo F. Parra, Giorgio Pazmandi, Guillaume Pealat, Gilbert Peffer, Andrea Pellegatta, Ignacio Peña, Walter Penschke, Francesco Perissin, Robert Philipp, Marcello Pietrobon, Adrien Pinatton, Gianni Piolanti, Vladimir Polin, Sebastian Poloczek, Berat Postalcioglu, Nolan Potier, Mario Pucci, Ian Qsong, Paul Rädle, Alexandre Radicchi, J. Erik Radmall, Ilyas Rahbaoui, Fabio Ramponi, Hristo Raykov, Maria Cristina Recchioni, Simon Rees, Dimitri Reiswich, Sadruddin Rejeb, Martin Ross, Alessandro Roveda, Ryan Russell, Marcin Rybacki, Mohamed Amine Sadaoui, Amine Samani, David Sansom, Alpha Sanou Toure, Tamas Sashalmi, Sebastian Schlenkrich, Peter Schmitteckert, Ralph Schreyer, Leander Schulten, David Schwartz, Benjamin Schwendinger, Henning Segger, Carlos Fidel Selva Ochoa, Giacomo Sergio, Simon Shakeshaft, Michael Sharpe, Kirill Shemyakin, Eugene Shevkoplyas, Mohammad Shojatalab, Anastasiia Shumyk, Piotr Siejda, Matthias Siemering, Adityakumar Sinha, Gyan Sinha, Enrico Sirola, Leon Sit, Wojciech Slusarski, Andrew Smith, Dale Smith, Tim Smith, Maxim Sokolov, Prasad Somwanshi, Niels Elken Sønderby, Klaus Spanderen, Andreas Spengler, Roland Stamm, Weston Steimel, Philip Stephens, Kai Striega, Jonathan Sweemer, Edouard Tallent, Eisuke Tani, Marco Tarenghi, Ryan Taylor, Yue Tian, Eugene Toder, Steven Van Haren, Jayanth R. Varma, Michael von den Driesch, Joseph Wang, Qingxiao Wang, Tony Wang, Charles Whitmore, Tomass Wilson, Stephen Wong, Krzysztof Wos, Bernd Johannes Wuebben, Sun Xiuxin, Frank Xue, Jeff Yu, Maddalena Zanzi, Li Zhong, Viktor Zhou, Francesco Zirilli, and Roy Zywina. QuantLib includes code taken from Peter Jäckel's book "Monte Carlo Methods in Finance". QuantLib includes software developed by the University of Chicago, as Operator of Argonne National Laboratory. QuantLib-1.42.1/Docs/000077500000000000000000000000001517022222500142045ustar00rootroot00000000000000QuantLib-1.42.1/Docs/Makefile.am000066400000000000000000000020631517022222500162410ustar00rootroot00000000000000 EXTRA_DIST = \ quantlib.doxy \ quantlibextra.css \ quantlibfooter.html \ quantlibheader.html DOXYGEN_CONFIG := quantlib.doxy DOXYGEN_CUSTOM := quantlibextra.css quantlibheader.html quantlibfooter.html DOXYGEN_INPUT := $(shell find ${top_srcdir} -name *.hpp) \ $(wildcard pages/*.docs) BASEPATH = $(shell cd @abs_top_srcdir@ && pwd) .PHONY: docs docs-clean dist-hook: mkdir -p $(distdir)/pages $(distdir)/images cp -p $(srcdir)/pages/*.docs $(distdir)/pages cp -p $(srcdir)/images/*.jpg \ $(srcdir)/images/*.ico \ $(distdir)/images docs: .time-stamp clean-local: rm -Rf html rm -f .time-stamp .time-stamp: $(DOXYGEN_CONFIG) $(DOXYGEN_CUSTOM) $(DOXYGEN_INPUT) ../LICENSE.TXT cp -p ${top_srcdir}/LICENSE.TXT ${top_srcdir}/Contributors.txt . $(SED) -e "s|ql_basepath|${BASEPATH}/|" \ -e "s|ql_version|$(VERSION)|" \ ${srcdir}/quantlib.doxy > .quantlib.doxy $(DOXYGEN) .quantlib.doxy rm -f .quantlib.doxy rm -f html/*.md5 rm -f html/*.map touch .time-stamp QuantLib-1.42.1/Docs/images/000077500000000000000000000000001517022222500154515ustar00rootroot00000000000000QuantLib-1.42.1/Docs/images/QL-title.jpg000066400000000000000000000277711517022222500176240ustar00rootroot00000000000000JFIFHH XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmCC2" =  !#89x"Qv12ATWw3!"#21$36ABt%QSq ?3ϔ²Ec='[LM斀%꭯J4r{[F~WkioT]cr{U+)w`ܰ3Yi\gebBYKɟ3%l܂wqckNt*s4;M{˦CմhFJ'8YYj=dN?1핀/R媓`ĉ*gMDwIg ō{驮ںYRbxm1 VR*f5͈/-3`Q^K#‹[v VIk*՚j\,ԕA4K|ș B=''`^q2 w_0Sna I}A&(rs4Ŷ1"p.ƣDG,=Ƕvݹu:ݵ8\AH^jMPfMervHKLqEWG∶l¬``"w=ź -8V?BT*Ov,*I`$Z?HYaG}v nd9ƧC[ludl$Y{eϾ ߊ͟xyaQ-,`vs7GDF&%'2VO4Oܫf%jhFT$҅Muv*f@^__GTYQý\7%|/*h k`֍ѵIR )09wYqVh]J:jГ߸~oxG8NME^IP2r\j ;!%^~Bl[0YmfVl:|1kBZik@ґ1 >O:EЁ{Β&vvaOY[ށ8GjȓT_5gpʆj ؂.ĖOZrؾbLxdsSmcBn kVrNJ#tRN5WxfP[ZdUd~GK}s/ 05؜#l-,zeouf]iTg5 = S>UX8Qd7þ5('ygNÑWmKE}tl3韮1n6_w|tp3r8=6 1wok??kÕf|(ǣPLa >>=vQv"Q՘FFRZP*eMܷm.+leQYO5yojJ$8`^@CDX-+{Z1GRme/9ig)/rC@ä6# P10#t"̹CVvZ0,^>n@VffiD"6rRvtg$J=#.TwQ|n^Ek1Dqi91gNkGug0[ȼFLK[jZrWξ Y34IxrЦ D#߾(x"@=* c D_wk!a,6Ms75Msb渵omƘ?]/t{b(fz'6 N.1^""WK5٦8pq?'9lmgY]2aG:y4 P'o2D9N[*)jʂo*{=87.ɸKؼDĿRF3}e1xK+3PC `  혼Bd4j'dt :$՗8e iکD5 T~i:&bѬZ7`͈H@8[2k 6t5u'ky8{]d{l嗤9]IZ+y_g+*xˤIe#T9ZOD]mM@[h氩t;!:4W]>hd[vOI Ux?s;k {Rɑ&p)'׫s=m_`C]Hg GәBUV#e@r'qԲ! {pk1HN Yt\&`8"/J|c%İ3Lu]&1Ylq lQ} 6~~p5QR}r&9Ů9oɢ3v||!Q\> k_ A7 2)$_r ҵI"{u!Ca4᳽Ƌ !E j|N/6Hoa <^iN3fuhA'-K,SHd|UJ?Khgd)XXZ>2Y+Tf Z2BNFlvRWQΝx1x1GeQHcjK< .Ǘ PZ 0w 0YVQ'*$|}H3nЫKuOV6*|z'>\ַɜsqYg9AAı.Fi4}3|'7ITM7Z_"^Pp(!HDOF;XPFEכ>ER+LY 4o xl,؅reh4SN|c¬M9$ŜZ wa17_I`!u\=ۃd2b<20.#%VEbT҅,Q_ݗP.!݁wHC(v5ù[أ2vyc"|rijgnVeU+8sÐJGriJ ֫M5 }Cr}]rs)J3 tm-ْ]f,9,ctUC O3OyW0[:eTQS^;~ԨPoQCEp [*(i_}ր?RaFBe'â%Pq|=k0EfV:ȂJhħAH]2)㢲aIt>l600(_9ny=`m$q ޳,N3 Nt4I3h/s[7_xoE8_ۗlV(TUW[(axO߮خw'թv[H0x(38V ]|mzR$ѦOIM:A=}W5HrqJj]WQFˍ++MM n"e)p=UM:ׂIrJ7(ci_??cEzQZgޏ8DRFLPŰ WNHҢjG ,䦇XF#.E=KOvr-G:Gq?_"ev$}r24^yrZpQF>K:-p< `:Nm̭K,?Qm2j("=|)У^ءq;5s.7y(XnZgKZN3f (be˜5!}chɢIgTvµlul~$c0[z'/IHI#Z8<ڢ`QP4xDhypG o N )qð0L&R#5Xl-?ePE"صt;G6u)sr/&)w?TZӱ9鬥şEk;ӗ> t 6ED>tgsUV!0bO d@)I6l%Srсjΰ?fL.(qWj'7kOns8&Ćf,Z,ݒMXapO *Y4Dlj _LM=4dT-;qW2@Kf-?l31V1W EDž7S]sC z LjWDr? % 0>03AO^ç%p _z<^*jd6諈$ r#|їZ#~@fPUfDWOn֭/0ijf߫^VBШ9ZOzcv$eV|ei<):03‚ xtKxDwbY>;46.4n2BO $;cY"m"xF)2mPG4g3=N|/ե+-{x^ra+"?ƽ4m4&'ofnFSw&(U(+RIkNi\enc gyUVsY'u]C3M4C6 >M LJxx#_c=/g~ZV޽.4[ʼ%F,V`fĐQf;'vҢ^hX?W*(~ESGYQE&vyp%nJK&+L1n Q*#t3yVy9GyŞ[w#8b+S;v]'4i(•4T$B7MýzP/fr{?+SzpLXNMBϠ+UkqXQpmkN`E@E#Cۺ3Nتӎ8 r_Ii:mjХK ' f؝vO%_O]jv?LqժԄ~?B.*XN@(%Q믰+gZymV#Wa& B0IaD=գwhAnuI 'UwNq괤]rSUC )/T[PxxȨ x'[:Z$i1btQFHO>ט}?)/jT @>(Xv-7+&Je} eRIo U 0 "&QR9WFb}f**V6i]l1;/FтqfTQ4w`o-]TnܾõxxAqyb%,CG*BD`{wz>_?%jv$%NmmOKݹ,K~_f#[B)F(suⳔDCT_Tgteheq*D:ԭAmU߈hqӘS#4Og$~H3r\p4Uy[_ImZTi]!ZQG >ʌW.nrܖFMQxNW2h33ͷ QuE$omt{sM}'Ti؛jMuPu;~%,ѕ"Se-!J!3tu嵳̽{Ur8^u9 tٸ,6둓Vhɴbm*HKSkȅ2b'ф<<΂Q͞C><:2xeURZ:Љ4D\;ڵ?)sfZ,CQff$+~mc:mVq1gggƸƺ11c?ٌcc>Gz<<<<=Gz<<<<=GQuantLib-1.42.1/Docs/images/favicon.ico000066400000000000000000000020661517022222500175760ustar00rootroot00000000000000BM66(   FFFTTTLLL qqq)))fff!!!;;;~~~111444(((mmmBBB AAAwwwQuantLib-1.42.1/Docs/pages/000077500000000000000000000000001517022222500153035ustar00rootroot00000000000000QuantLib-1.42.1/Docs/pages/authors.docs000066400000000000000000000015131517022222500176420ustar00rootroot00000000000000 /* Copyright (C) 2003 Ferdinando Ametrano Copyright (C) 2000-2003 StatPro Italia srl 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. */ /*! \page group Contributors \htmlinclude Contributors.txt */ QuantLib-1.42.1/Docs/pages/config.docs000066400000000000000000000133051517022222500174240ustar00rootroot00000000000000 /* Copyright (C) 2004, 2005 StatPro Italia srl 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. */ /*! \page config User configuration A number of macros is provided for user configuration. Defining or undefining such macros triggers variations in some library functionality. When using CMake, they can be set to `ON` or `OFF` as properties. Under a Linux/Unix system, they are (un)set by `configure`; run \code ./configure --help \endcode for a list of corresponding command-line options. Under a Windows system, they must be (un)defined by editing the file `` and commenting or uncommenting the relevant lines. Such macros include: \code #define QL_ERROR_FUNCTIONS \endcode If defined, function information is added to the error messages thrown by the library. Undefined by default. \code #define QL_ERROR_LINES \endcode If defined, file and line information is added to the error messages thrown by the library. Undefined by default. \code #define QL_ENABLE_TRACING \endcode If defined, tracing messages might be emitted by the library depending on run-time settings. Enabling this option can degrade performance. Undefined by default. \code #define QL_EXTRA_SAFETY_CHECKS \endcode If defined, extra run-time checks are added to a few functions. This can prevent their inlining and degrade performance. Undefined by default. \code #define QL_USE_INDEXED_COUPON \endcode If defined, indexed coupons (see the documentation) are used in floating legs. If undefined (the default), par coupons are used. \code #define QL_ENABLE_SESSIONS \endcode If defined, singletons will return different instances for different threads; in particular, this means that the evaluation date, the stored index fixings and any other settings will be per-thread. Undefined by default. \code #define QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN \endcode If defined, a thread-safe (but less performant) version of the observer pattern is used. You should define it if you want to use %QuantLib via the SWIG layer within the JVM or .NET ecosystem or any other environment with an async garbage collector. Undefined by default. \code #define QL_HIGH_RESOLUTION_DATE \endcode If defined, date objects willsupport an intraday datetime resolution down to microseconds. Strictly monotone daycounters (`Actual360`, `Actual365Fixed` and `ActualActual`) will take the additional information into account and allow for accurate intraday pricing. If undefined (the default) the smallest resolution of date objects is a single day. Intraday datetime resolution is experimental. \code #define QL_THROW_IN_CYCLES \endcode If defined, lazy objects will raise an exception when they detect a notification cycle which would result in an infinite recursion loop. If undefined (the default), they will break the recursion without throwing. Enabling this option is recommended but might cause existing code to throw. \code #define QL_FASTER_LAZY_OBJECTS \endcode If defined (the default), lazy objects will forward the first notification received, and discard the others until recalculated; the rationale is that observers were already notified, and don't need further notifications until they recalculate, at which point this object would be recalculated too. After recalculation, this object would again forward the first notification received. Although not always correct, this behavior is a lot faster and thus is the current default. \code #define QL_USE_STD_ANY \endcode If defined (the default), `std::any` and related classes and functions will be used instead of `boost::any`. If undefined, the Boost facilities will be used. \code #define QL_USE_STD_OPTIONAL \endcode If defined (the default), `std::optional` and related classes and functions will be used instead of `boost::optional`. If undefined, the Boost facilities will be used. \code #define QL_USE_STD_SHARED_PTR \endcode If defined, `std::shared_ptr` and related classes and functions will used instead of `boost::shared_ptr`. If undefined (the default) the Boost facilities will be used. Note that `std::shared_ptr` does not check access and can cause segmentation faults. \code #define QL_NULL_AS_FUNCTIONS \endcode If defined, `Null` will be implemented as a template function. This allows the code to work with user-defined `Real` types but was reported to cause internal compiler errors with Visual C++ 2022 in some cases. If undefined (the default) `Null` will be implemented as a class template, as in previous releases. \code #define QL_ENABLE_PARALLEL_UNIT_TEST_RUNNER \endcode If defined, a parallel unit test runner will be used to execute the C++ test suite. This will reduce the runtime on multi core CPUs. Undefined by default. */ QuantLib-1.42.1/Docs/pages/coreclasses.docs000066400000000000000000000015621517022222500204670ustar00rootroot00000000000000 /* Copyright (C) 2000-2004 StatPro Italia srl 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. */ /*! \defgroup types Numeric types A number of numeric types are defined in order to add clarity to function and method declarations. */ QuantLib-1.42.1/Docs/pages/currencies.docs000066400000000000000000000014241517022222500203200ustar00rootroot00000000000000 /* Copyright (C) 2000-2003 StatPro Italia srl 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. */ /*! \defgroup currencies Currencies and FX rates */ QuantLib-1.42.1/Docs/pages/datetime.docs000066400000000000000000000040641517022222500177550ustar00rootroot00000000000000 /* Copyright (C) 2004 Ferdinando Ametrano Copyright (C) 2000-2004 StatPro Italia srl 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. */ /*! \defgroup datetime Date and time calculations The concrete class QuantLib::Date implements the concept of date. Its functionalities include: - providing basic information such as weekday, day of the month, day of the year, month, and year; - comparing two dates to determine whether they are equal, or which one is the earlier or later, or the difference between them expressed in days; - incrementing or decrementing a date of a given number of days, or of a given period expressed in weeks, months, or years. @{ */ /*! \defgroup calendars Calendars The class QuantLib::Calendar provides the interface for determining whether a date is a business day or a holiday for a given exchange or a given country, and for incrementing/decrementing a date of a given number of business days. A number of calendars is contained in the ql/time/calendars directory. */ /*! \defgroup daycounters Day counters The class QuantLib::DayCounter provides more advanced means of measuring the distance between two dates according to a given market convention, both as number of days of fraction of year. A number of such conventions is contained in the ql/time/daycounters directory. */ /*! @} */ QuantLib-1.42.1/Docs/pages/engines.docs000066400000000000000000000026631517022222500176140ustar00rootroot00000000000000 /* Copyright (C) 2004 StatPro Italia srl 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. */ /*! \defgroup engines Pricing engines @{ */ /*! \defgroup asianengines Asian option engines */ /*! \defgroup barrierengines Barrier option engines */ /*! \defgroup basketengines Basket option engines */ /*! \defgroup bondengines Basket option engines */ /*! \defgroup capfloorengines Cap/floor engines */ /*! \defgroup cliquetengines Cliquet option engines */ /*! \defgroup forwardengines Forward option engines */ /*! \defgroup inflationcapfloorengines Inflation cap/floor engines */ /*! \defgroup lookbackengines Lookback option engines */ /*! \defgroup quantoengines Quanto option engines */ /*! \defgroup swaptionengines Swaption engines */ /*! \defgroup vanillaengines Vanilla option engines */ /*! @} */ QuantLib-1.42.1/Docs/pages/examples.docs000066400000000000000000000123101517022222500177700ustar00rootroot00000000000000 /* Copyright (C) 2000-2003 StatPro Italia srl 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. */ /*! \example BasketLosses.cpp This example shows how to model losses across correlated assets. \example BermudanSwaption.cpp This example prices a bermudan swaption using different models calibrated to market swaptions. The calibration examples include Hull and White's using both an analytic formula as well as numerically, and Black and Karasinski's model. Using these three calibrations, Bermudan swaptions are priced for at-the-money, out-of-the-money and in-the-money volatilities. \example Bonds.cpp This example shows how to set up a term structure and then price some simple bonds. The last part is dedicated to peripherical computations such as yield-to-price or price-to-yield. \example CallableBonds.cpp This example prices a number of callable bonds and compares the results to known good data. \example CDS.cpp This example bootstraps a default-probability curve over a number of CDS and reprices them. \example ConvertibleBonds.cpp For a given set of option parameters, this example computes the value of a convertible bond with an embedded put option for two different equity options types (with european and american exercise features) using the Tsiveriotis-Fernandes method with different implied tree algorithms. The tree types are Jarrow-Rudd, Cox-Ross-Rubinstein, Additive equiprobabilities, Trigeorgis, Tian and Leisen-Reimer. \example CVAIRS.cpp This example shows how to calculate credit value adjustment for an interest rate swap. \example DiscreteHedging.cpp This example computes profit and loss of a discrete interval hedging strategy and compares with the outcome with the results of Derman and Kamal's Goldman Sachs Equity Derivatives Research Note "When You Cannot Hedge Continuously: The Corrections to Black-Scholes". It shows the use of the Monte Carlo framework. \example EquityOption.cpp For a given set of option parameters, this example computes the value of three different equity options types (with european, bermudan and american exercise features) using different valuation algorithms. The calculation methods are Black-Scholes (for european options only), Barone-Adesi/Whaley (american-only), Bjerksund/Stensland (american), Integral (european), finite differences, binomial trees, crude Monte Carlo (european-only) and Sobol-sequence Monte Carlo (european-only). \example FittedBondCurve.cpp For a given set of coupons and terms to maturity, this example computes the value of a bond by fitting the yields to a curve using different methods. The fitting methods are exponential splines, simple polynomials, Nelson-Siegel, and cubic B-splines. It then shifts the evaluation date into the future to compute implied forward par rates. It also computes yields after small price shifts. \example FRA.cpp This example values a forward-rate agreement (FRA) at different forward dates under two yield curve assumptions. It thereby illustrates how set up a term structure, and to use it to price a simple forward-rate agreement. \example Gaussian1dModels.cpp This example shows the use of Gaussian short rate model for interest rate derivatives. \example GlobalOptimizer.cpp This example shows the use of several different optimizers: firefly algorithm, hybrid simulated annealing, particle swarm optimization, simulated annealing, and differential evolution. \example LatentModel.cpp This example shows the calculation of correlated defaults. \example MarketModels.cpp This example shows the use of interest-rate market models. \example MulticurveBootstrapping.cpp This example prices an interest rate swap over a term structure and calculates its fair fixed rate and floating spread. \example MultidimIntegral.cpp This example shows multi-dimensional numerical integration. \example Replication.cpp This example uses the CompositeInstrument class to statically replicate a down-and-out barrier options. \example Repo.cpp This example values a fixed-coupon bond repurchase (repo). The repurchase agreement example is set up to use the repo rate to do all discounting (including the underlying bond income). Forward delivery price is also obtained using this repo rate. All this is done by supplying the FixedCouponBondForward constructor with a flat repo YieldTermStructure. */ QuantLib-1.42.1/Docs/pages/findiff.docs000066400000000000000000000017631517022222500175710ustar00rootroot00000000000000 /* Copyright (C) 2000-2003 StatPro Italia srl 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. */ /*! \defgroup findiff Finite-differences framework This framework (corresponding to the ql/methods/finitedifferences directory) contains basic building blocks for the numerical solution of partial differential equations by means of finite-difference methods. */ QuantLib-1.42.1/Docs/pages/fixedincome.docs000066400000000000000000000077221517022222500204570ustar00rootroot00000000000000 /* Copyright (C) 2000-2003 Sadruddin Rejeb 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. */ /*! \defgroup shortrate Short-rate modelling framework This framework (corresponding to the ql/models/shortrate directory) implements some single-factor and two-factor short rate models. The models implemented in this library are widely used by practitioners. For the moment, the ShortRateModel class defines the short-rate dynamics with stochastic equations of the type \f[ dx_i = \mu(t,x_i) dt + \sigma(t,x_i) dW_t \f] where \f$ r = f(t,x) \f$. If the model is affine (i.e. derived from the QuantLib::AffineModel class), analytical formulas for discount bonds and discount bond options are given (useful for calibration). \section singlefactormodels Single-factor models \par The Hull & White model \f[ dr_t = (\theta(t) - \alpha(t) r_t)dt + \sigma(t) dW_t \f] When \f$ \alpha \f$ and \f$ \sigma \f$ are constants, this model has analytical formulas for discount bonds and discount bond options. \par The Black-Karasinski model \f[ d\ln{r_t} = (\theta(t) - \alpha \ln{r_t})dt + \sigma dW_t \f] No analytical tractability here. \par The extended Cox-Ingersoll-Ross model \f[ dr_t = (\theta(t) - k r_t)dt + \sigma \sqrt{r_t} dW_t \f] There are analytical formulas for discount bonds (and soon for discount bond options). \section calibration Calibration The class CalibrationHelper is a base class that facilitates the instantiation of market instruments used for calibration. It has a method marketValue() that gives the market price using a Black formula, and a modelValue() method that gives the price according to a model Derived classed are QuantLib::CapHelper and QuantLib::SwaptionHelper. For the calibration itself, you must choose an optimization method that will find constant parameters such that the value: \f[ V = \sqrt{\sum_{i=1}^{n} \frac{(T_i - M_i)^2}{M_i}}, \f] where \f$ T_i \f$ is the price given by the model and \f$ M_i \f$ is the market price, is minimized. A few optimization methods are available in the ql/Optimization directory. \section twofactormodels Two-factor models \section pricers Pricers \par Analytical pricers If the model is affine, i.e. discount bond options formulas exist, caps are easily priced since they are a portfolio of discount bond options. Such a pricer is implemented in QuantLib::AnalyticalCapFloor. In the case of single-factor affine models, swaptions can be priced using the Jamshidian decomposition, implemented in QuantLib::JamshidianSwaption. \par Using Trees Each model derived from the single-factor model class has the ability to return a trinomial tree. For yield-curve consistent models, the fitting parameter can be determined either analytically (when possible) or numerically. When a tree is built, it is then pretty straightforward to implement a pricer for any path-independent derivative. Just implement a class derived from NumericalDerivative (see QuantLib::NumericalSwaption for example) and roll it back until the present time... Just look at QuantLib::TreeCapFloor and QuantLib::TreeSwaption for working pricers. */ QuantLib-1.42.1/Docs/pages/history.docs000066400000000000000000000015601517022222500176600ustar00rootroot00000000000000/* Copyright (C) 2000-2018 StatPro Italia srl 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. */ /*! \page history Version history The list of releases is available from GitHub at . */ QuantLib-1.42.1/Docs/pages/index.docs000066400000000000000000000032531517022222500172670ustar00rootroot00000000000000 /* Copyright (C) 2000-2003 StatPro Italia srl 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. */ /*! \mainpage Introduction %QuantLib (https://www.quantlib.org/) is a C++ library for financial quantitative analysts and developers. %QuantLib is Non-Copylefted Free Software released under the modified BSD License. It is also OSI Certified Open Source Software. OSI Certified is a certification mark of the Open Source Initiative. %QuantLib is free software and you are allowed to use, copy, modify, merge, publish, distribute, and/or sell copies of it under the conditions stated in the \ref license. %QuantLib and its documentation are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \ref license for more details. \section disclaimer Disclaimer At this time, this documentation is widely incomplete and must be regarded as a work in progress. Contributions are welcome. */ QuantLib-1.42.1/Docs/pages/instruments.docs000066400000000000000000000014231517022222500205500ustar00rootroot00000000000000 /* Copyright (C) 2000-2004 StatPro Italia srl 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. */ /*! \defgroup instruments Financial instruments */ QuantLib-1.42.1/Docs/pages/lattices.docs000066400000000000000000000106521517022222500177710ustar00rootroot00000000000000 /* Copyright (C) 2002, 2003 Sadruddin Rejeb 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. */ /*! \defgroup lattices Lattice methods The framework (corresponding to the ql/methods/lattices directory) contains basic building blocks for pricing instruments using lattice methods (trees). A lattice, i.e. an instance of the abstract class QuantLib::Lattice, relies on one or several trees (each one approximating a diffusion process) to price an instance of the DiscretizedAsset class. Trees are instances of classes derived from QuantLib::Tree, classes which define the branching between nodes and transition probabilities. \section binomial Binomial trees The binomial method is the simplest numerical method that can be used to price path-independent derivatives. It is usually the preferred lattice method under the Black-Scholes-Merton model. As an example, let's see the framework implemented in the bsmlattice.hpp file. It is a method based on a binomial tree, with constant short-rate (discounting). There are several approaches to build the underlying binomial tree, like Jarrow-Rudd or Cox-Ross-Rubinstein. \section trinomial Trinomial trees When the underlying stochastic process has a mean-reverting pattern, it is usually better to use a trinomial tree instead of a binomial tree. An example is implemented in the QuantLib::TrinomialTree class, which is constructed using a diffusion process and a time-grid. The goal is to build a recombining trinomial tree that will discretize, at a finite set of times, the possible evolutions of a random variable \f$ y \f$ satisfying \f[ dy_t = \mu(t, y_t) dt + \sigma(t, y_t) dW_t. \f] At each node, there is a probability \f$ p_u, p_m \f$ and \f$ p_d \f$ to go through respectively the upper, the middle and the lower branch. These probabilities must satisfy \f[ p_{u}y_{i+1,k+1}+p_{m}y_{i+1,k}+p_{d}y_{i+1,k-1}=E_{i,j} \f] and \f[ p_u y_{i+1,k+1}^2 + p_m y_{i+1,k}^2 + p_d y_{i+1,k-1}^2 = V^2_{i,j}+E_{i,j}^2, \f] where k (the index of the node at the end of the middle branch) is the index of the node which is the nearest to the expected future value, \f$ E_{i,j}=\mathbf{E}\left( y(t_{i+1})|y(t_{i})=y_{i,j}\right) \f$ and \f$ V_{i,j}^{2}=\mathbf{Var}\{y(t_{i+1})|y(t_{i})=y_{i,j}\} \f$. If we suppose that the variance is only dependent on time \f$ V_{i,j}=V_{i} \f$ and set \f$ y_{i+1} \f$ to \f$ V_{i}\sqrt{3} \f$, we find that \f[ p_{u} = \frac{1}{6}+\frac{(E_{i,j}-y_{i+1,k})^{2}}{6V_{i}^{2}} + \frac{E_{i,j}-y_{i+1,k}}{2\sqrt{3}V_{i}}, \f] \f[ p_{m} = \frac{2}{3}-\frac{(E_{i,j}-y_{i+1,k})^{2}}{3V_{i}^{2}}, \f] \f[ p_{d} = \frac{1}{6}+\frac{(E_{i,j}-y_{i+1,k})^{2}}{6V_{i}^{2}} - \frac{E_{i,j}-y_{i+1,k}}{2\sqrt{3}V_{i}}. \f] \section bidimensional Bidimensional lattices To come... \section discretizedasset The QuantLib::DiscretizedAsset class This class is a representation of the price of a derivative at a specific time. It is roughly an array of values, each value being associated to a state of the underlying stochastic variables. For the moment, it is only used when working with trees, but it should be quite easy to make a use of it in finite-differences methods. The two main points, when deriving classes from QuantLib::DiscretizedAsset, are: -# Define the initialisation procedure (e.g. terminal payoff for european stock options). -# Define the method adjusting values, when necessary, at each time steps (e.g. apply the step condition for american or bermudan options). Some examples are found in QuantLib::DiscretizedSwap and QuantLib::DiscretizedSwaption. */ QuantLib-1.42.1/Docs/pages/license.docs000066400000000000000000000020471517022222500176020ustar00rootroot00000000000000 /*! \page license QuantLib License \verbinclude LICENSE.TXT
\section licensecomments Comments on Copyright and License %QuantLib is Non-Copylefted Free Software [1] released under the modified BSD License [2] (also know as XFree86-style license). %QuantLib is Open Source [3] because of its license: it is OSI Certified Open Source Software [4]. OSI Certified is a certification mark of the Open Source Initiative [5]. The modified BSD License is GPL compatible as confirmed by the Free Software Foundation [6]. This license has been adopted to allow free use of %QuantLib and its source, to make %QuantLib flourish as a free-software/open-source project. It allows proprietary extensions to be commercialized. [1] http://www.gnu.org/philosophy/categories.html#Non-CopyleftedFreeSoftware
[2] http://www.opensource.org/licenses/bsd-license.html
[3] http://www.opensource.org/docs/definition.html
[4] http://www.opensource.org/docs/certification_mark.html
[5] http://www.opensource.org
[6] http://www.gnu.org/philosophy/bsd.html */ QuantLib-1.42.1/Docs/pages/math.docs000066400000000000000000000034471517022222500171160ustar00rootroot00000000000000 /* Copyright (C) 2000-2003 StatPro Italia srl 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. */ /*! \defgroup math Math tools @{ */ /*! \defgroup interpolations 1-D Interpolations and corresponding traits */ /*! \defgroup solvers One-dimensional solvers The abstract class QuantLib::Solver1D provides the interface for one-dimensional solvers which can find the zeroes of a given function. A number of such solvers is contained in the ql/Solvers1D directory. The implementation of the algorithms was inspired by "Numerical Recipes in C", 2nd edition, Press, Teukolsky, Vetterling, Flannery - Chapter 9 Some work is needed to resolve the ambiguity of the root finding accuracy definition: for some algorithms it is the x-accuracy, for others it is f(x)-accuracy. */ /*! \defgroup optimizers Optimizers The optimization framework (corresponding to the ql/Optimization directory) implements some multi-dimensional minimizing methods. The function to be minimized is to be derived from the QuantLib::CostFunction base class (if the gradient is not analytically implemented, it will be computed numerically). */ /*! @} */ QuantLib-1.42.1/Docs/pages/mcarlo.docs000066400000000000000000000016321517022222500174340ustar00rootroot00000000000000 /* Copyright (C) 2000-2003 StatPro Italia srl 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. */ /*! \defgroup mcarlo Monte Carlo framework This framework (corresponding to the ql/methods/montecarlo directory) contains basic building blocks for Monte Carlo simulations. */ QuantLib-1.42.1/Docs/pages/patterns.docs000066400000000000000000000014121517022222500200130ustar00rootroot00000000000000 /* Copyright (C) 2000-2004 StatPro Italia srl 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. */ /*! \defgroup patterns Design patterns */ QuantLib-1.42.1/Docs/pages/processes.docs000066400000000000000000000020041517022222500201570ustar00rootroot00000000000000 /* Copyright (C) 2006 StatPro Italia srl 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. */ /*! \defgroup processes Stochastic processes The classes QuantLib::StochasticProcess and QuantLib::StochasticProcess1D provide the interface for a generic stochastic process. A number of specific processes is contained in the ql/processes directory. */ QuantLib-1.42.1/Docs/pages/resources.docs000066400000000000000000000027301517022222500201710ustar00rootroot00000000000000 /* Copyright (C) 2000-2003 StatPro Italia srl 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. */ /*! \page resources Additional resources The main %QuantLib resource is the %QuantLib web site (https://www.quantlib.org). Additional resources available from the above site include: - available documentation (https://www.quantlib.org/docs.shtml); - the %QuantLib mailing lists and forums (https://www.quantlib.org/mailinglists.shtml); - the %QuantLib programming style guidelines (https://www.quantlib.org/style.shtml); - links to pages for reporting issues (https://github.com/lballabio/QuantLib/issues) and submitting changes (https://github.com/lballabio/QuantLib/pulls); - a page (https://www.quantlib.org/extensions.shtml) about how to use %QuantLib in other languages/platforms. */ QuantLib-1.42.1/Docs/pages/termstructures.docs000066400000000000000000000026611517022222500212750ustar00rootroot00000000000000 /* Copyright (C) 2000-2003 StatPro Italia srl 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. */ /*! \defgroup termstructuressss Term structures @{ */ /*! \defgroup yieldtermstructures Interest-rate term structures The abstract class QuantLib::YieldTermStructure provides the common interface to concrete yield-rate term structure models. Among others, methods are declared which return instantaneous forward rate, discount factor, and zero rate at a given date. Adapter classes are provided which already implement part of the required methods, thus allowing the programmer to define only the non-redundant part. */ /*! \defgroup defaultprobabilitytermstructures Default-probability term structures */ /*! \defgroup inflationtermstructures Inflation term structures */ /*! @} */ QuantLib-1.42.1/Docs/quantlib.doxy000066400000000000000000000317311517022222500167350ustar00rootroot00000000000000# Doxyfile 1.14.0 #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = QuantLib PROJECT_NUMBER = ql_version PROJECT_BRIEF = "A free/open-source library for quantitative finance" PROJECT_LOGO = PROJECT_ICON = OUTPUT_DIRECTORY = CREATE_SUBDIRS = NO CREATE_SUBDIRS_LEVEL = 8 ALLOW_UNICODE_NAMES = NO OUTPUT_LANGUAGE = English BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ABBREVIATE_BRIEF = ALWAYS_DETAILED_SEC = NO INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = YES STRIP_FROM_PATH = ql_basepath STRIP_FROM_INC_PATH = ql_basepath SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO JAVADOC_BANNER = NO QT_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO PYTHON_DOCSTRING = YES INHERIT_DOCS = YES SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 4 ALIASES = "warning=\xrefitem caveats \"Warning\" \"Caveats\"" \ "test=\xrefitem test \"Tests\" \"Test Suite\"" \ "bug=\xrefitem bug \"Bug\" \"Known Bugs\"" \ "deprecated=\xrefitem deprecated \"Deprecated\" \"Deprecated Features\"" OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_JAVA = NO OPTIMIZE_FOR_FORTRAN = NO OPTIMIZE_OUTPUT_VHDL = NO OPTIMIZE_OUTPUT_SLICE = NO EXTENSION_MAPPING = MARKDOWN_SUPPORT = YES TOC_INCLUDE_HEADINGS = 0 MARKDOWN_ID_STYLE = DOXYGEN AUTOLINK_SUPPORT = YES AUTOLINK_IGNORE_WORDS = BUILTIN_STL_SUPPORT = YES CPP_CLI_SUPPORT = NO SIP_SUPPORT = NO IDL_PROPERTY_SUPPORT = YES DISTRIBUTE_GROUP_DOC = NO GROUP_NESTED_COMPOUNDS = NO SUBGROUPING = YES INLINE_GROUPED_CLASSES = NO INLINE_SIMPLE_STRUCTS = NO TYPEDEF_HIDES_STRUCT = NO LOOKUP_CACHE_SIZE = 0 NUM_PROC_THREADS = 1 TIMESTAMP = NO #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- EXTRACT_ALL = NO EXTRACT_PRIVATE = NO EXTRACT_PRIV_VIRTUAL = NO EXTRACT_PACKAGE = NO EXTRACT_STATIC = NO EXTRACT_LOCAL_CLASSES = NO EXTRACT_LOCAL_METHODS = NO EXTRACT_ANON_NSPACES = NO RESOLVE_UNNAMED_PARAMS = YES HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = YES HIDE_UNDOC_NAMESPACES = YES HIDE_FRIEND_COMPOUNDS = NO HIDE_IN_BODY_DOCS = YES INTERNAL_DOCS = NO CASE_SENSE_NAMES = NO HIDE_SCOPE_NAMES = YES HIDE_COMPOUND_REFERENCE= NO SHOW_HEADERFILE = YES SHOW_INCLUDE_FILES = YES SHOW_GROUPED_MEMB_INC = NO FORCE_LOCAL_INCLUDES = NO INLINE_INFO = NO SORT_MEMBER_DOCS = NO SORT_BRIEF_DOCS = NO SORT_MEMBERS_CTORS_1ST = YES SORT_GROUP_NAMES = YES SORT_BY_SCOPE_NAME = YES STRICT_PROTO_MATCHING = NO GENERATE_TODOLIST = NO GENERATE_TESTLIST = YES GENERATE_BUGLIST = YES GENERATE_DEPRECATEDLIST= YES ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 SHOW_USED_FILES = NO SHOW_FILES = NO SHOW_NAMESPACES = NO FILE_VERSION_FILTER = LAYOUT_FILE = CITE_BIB_FILES = EXTERNAL_TOOL_PATH = #--------------------------------------------------------------------------- # Configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = YES WARNINGS = YES WARN_IF_UNDOCUMENTED = NO WARN_IF_DOC_ERROR = YES WARN_IF_INCOMPLETE_DOC = NO WARN_NO_PARAMDOC = NO WARN_IF_UNDOC_ENUM_VAL = NO WARN_LAYOUT_FILE = YES WARN_AS_ERROR = YES WARN_FORMAT = "$file:$line: $text" WARN_LINE_FORMAT = "at line $line of file $file" WARN_LOGFILE = #--------------------------------------------------------------------------- # Configuration options related to the input files #--------------------------------------------------------------------------- INPUT = ql_basepath/Docs//pages \ ql_basepath/ql INPUT_ENCODING = UTF-8 INPUT_FILE_ENCODING = FILE_PATTERNS = *.docs \ *.hpp \ *.h RECURSIVE = YES EXCLUDE = ql_basepath//ql/config.hpp \ ql_basepath//ql/config.msvc.hpp EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = */all.hpp EXCLUDE_SYMBOLS = EXAMPLE_PATH = ql_basepath/Examples \ . EXAMPLE_PATTERNS = *.cpp EXAMPLE_RECURSIVE = YES IMAGE_PATH = INPUT_FILTER = FILTER_PATTERNS = FILTER_SOURCE_FILES = NO FILTER_SOURCE_PATTERNS = USE_MDFILE_AS_MAINPAGE = IMPLICIT_DIR_DOCS = YES FORTRAN_COMMENT_AFTER = 72 #--------------------------------------------------------------------------- # Configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = NO INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = NO REFERENCES_RELATION = NO REFERENCES_LINK_SOURCE = NO SOURCE_TOOLTIPS = NO USE_HTAGS = NO VERBATIM_HEADERS = NO #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = YES IGNORE_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = html HTML_FILE_EXTENSION = .html HTML_HEADER = ql_basepath/Docs/quantlibheader.html HTML_FOOTER = ql_basepath/Docs/quantlibfooter.html HTML_STYLESHEET = HTML_EXTRA_STYLESHEET = ql_basepath/Docs/quantlibextra.css HTML_EXTRA_FILES = ql_basepath/Docs/images/favicon.ico HTML_COLORSTYLE = AUTO_LIGHT HTML_COLORSTYLE_HUE = 220 HTML_COLORSTYLE_SAT = 100 HTML_COLORSTYLE_GAMMA = 80 HTML_DYNAMIC_MENUS = YES HTML_DYNAMIC_SECTIONS = YES HTML_CODE_FOLDING = YES HTML_COPY_CLIPBOARD = YES HTML_PROJECT_COOKIE = HTML_INDEX_NUM_ENTRIES = 100 GENERATE_DOCSET = NO DOCSET_FEEDNAME = "Doxygen generated docs" DOCSET_FEEDURL = DOCSET_BUNDLE_ID = org.doxygen.Project DOCSET_PUBLISHER_ID = org.doxygen.Publisher DOCSET_PUBLISHER_NAME = Publisher GENERATE_HTMLHELP = NO CHM_FILE = HHC_LOCATION = hhc.exe GENERATE_CHI = NO CHM_INDEX_ENCODING = BINARY_TOC = NO TOC_EXPAND = NO SITEMAP_URL = GENERATE_QHP = NO QCH_FILE = QHP_NAMESPACE = org.doxygen.Project QHP_VIRTUAL_FOLDER = doc QHP_CUST_FILTER_NAME = QHP_CUST_FILTER_ATTRS = QHP_SECT_FILTER_ATTRS = QHG_LOCATION = GENERATE_ECLIPSEHELP = NO ECLIPSE_DOC_ID = org.doxygen.Project DISABLE_INDEX = NO GENERATE_TREEVIEW = NO PAGE_OUTLINE_PANEL = YES FULL_SIDEBAR = NO ENUM_VALUES_PER_LINE = 4 SHOW_ENUM_VALUES = NO TREEVIEW_WIDTH = 250 EXT_LINKS_IN_WINDOW = NO OBFUSCATE_EMAILS = YES HTML_FORMULA_FORMAT = png FORMULA_FONTSIZE = 12 FORMULA_MACROFILE = USE_MATHJAX = YES MATHJAX_VERSION = MathJax_2 MATHJAX_FORMAT = HTML-CSS MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/ MATHJAX_EXTENSIONS = MATHJAX_CODEFILE = SEARCHENGINE = YES SERVER_BASED_SEARCH = NO EXTERNAL_SEARCH = NO SEARCHENGINE_URL = SEARCHDATA_FILE = searchdata.xml EXTERNAL_SEARCH_ID = EXTRA_SEARCH_MAPPINGS = #--------------------------------------------------------------------------- # Configuration options related to the LaTeX output #--------------------------------------------------------------------------- GENERATE_LATEX = NO LATEX_OUTPUT = latex LATEX_CMD_NAME = latex MAKEINDEX_CMD_NAME = makeindex LATEX_MAKEINDEX_CMD = makeindex COMPACT_LATEX = NO PAPER_TYPE = a4 EXTRA_PACKAGES = LATEX_HEADER = LATEX_FOOTER = LATEX_EXTRA_STYLESHEET = LATEX_EXTRA_FILES = PDF_HYPERLINKS = YES USE_PDFLATEX = YES LATEX_BATCHMODE = NO LATEX_HIDE_INDICES = NO LATEX_BIB_STYLE = plain LATEX_EMOJI_DIRECTORY = #--------------------------------------------------------------------------- # Configuration options related to the RTF output #--------------------------------------------------------------------------- GENERATE_RTF = NO RTF_OUTPUT = rtf COMPACT_RTF = NO RTF_HYPERLINKS = NO RTF_STYLESHEET_FILE = RTF_EXTENSIONS_FILE = RTF_EXTRA_FILES = #--------------------------------------------------------------------------- # Configuration options related to the man page output #--------------------------------------------------------------------------- GENERATE_MAN = NO MAN_OUTPUT = man MAN_EXTENSION = .3 MAN_SUBDIR = MAN_LINKS = YES #--------------------------------------------------------------------------- # Configuration options related to the XML output #--------------------------------------------------------------------------- GENERATE_XML = NO XML_OUTPUT = xml XML_PROGRAMLISTING = NO XML_NS_MEMB_FILE_SCOPE = NO #--------------------------------------------------------------------------- # Configuration options related to the DOCBOOK output #--------------------------------------------------------------------------- GENERATE_DOCBOOK = NO DOCBOOK_OUTPUT = docbook #--------------------------------------------------------------------------- # Configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # Configuration options related to Sqlite3 output #--------------------------------------------------------------------------- GENERATE_SQLITE3 = NO SQLITE3_OUTPUT = sqlite3 SQLITE3_RECREATE_DB = YES #--------------------------------------------------------------------------- # Configuration options related to the Perl module output #--------------------------------------------------------------------------- GENERATE_PERLMOD = NO PERLMOD_LATEX = NO PERLMOD_PRETTY = YES PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = PREDEFINED = __DOXYGEN__ EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration options related to external references #--------------------------------------------------------------------------- TAGFILES = GENERATE_TAGFILE = ALLEXTERNALS = NO EXTERNAL_GROUPS = YES EXTERNAL_PAGES = YES #--------------------------------------------------------------------------- # Configuration options related to diagram generator tools #--------------------------------------------------------------------------- HIDE_UNDOC_RELATIONS = NO HAVE_DOT = YES DOT_NUM_THREADS = 0 DOT_COMMON_ATTR = "fontname=Helvetica,fontsize=10" DOT_EDGE_ATTR = "labelfontname=Helvetica,labelfontsize=10" DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4" DOT_FONTPATH = CLASS_GRAPH = YES COLLABORATION_GRAPH = NO GROUP_GRAPHS = NO UML_LOOK = NO UML_LIMIT_NUM_FIELDS = 10 UML_MAX_EDGE_LABELS = 10 DOT_UML_DETAILS = NO DOT_WRAP_THRESHOLD = 17 TEMPLATE_RELATIONS = NO INCLUDE_GRAPH = NO INCLUDED_BY_GRAPH = NO CALL_GRAPH = NO CALLER_GRAPH = NO GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = NO DIR_GRAPH_MAX_DEPTH = 1 DOT_IMAGE_FORMAT = png INTERACTIVE_SVG = NO DOT_PATH = DOTFILE_DIRS = DIA_PATH = DIAFILE_DIRS = PLANTUML_JAR_PATH = PLANTUML_CFG_FILE = PLANTUML_INCLUDE_PATH = PLANTUMLFILE_DIRS = DOT_GRAPH_MAX_NODES = 150 MAX_DOT_GRAPH_DEPTH = 2 DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES DOT_CLEANUP = YES MSCGEN_TOOL = MSCFILE_DIRS = QuantLib-1.42.1/Docs/quantlibextra.css000066400000000000000000000014711517022222500176040ustar00rootroot00000000000000#projectname, #projectname a, #projectname a:visited { font-family: "Lato", sans-serif; font-weight: 700; font-style: italic; color: black; } #projectname { padding: 1em; } #projectnumber { font-family: "Lato", sans-serif; font-weight: 400; font-style: italic; font-size: 60%; margin-top: 1em; margin-bottom: 0; } body, table, div, p, dl { font: 300 16px/22px Lato,sans-serif; } p.reference, p.definition { font: 300 16px/22px Lato,sans-serif; } .title { font-family: "Lato", sans-serif; font-style: italic; } table.directory { font: 400 16px "Lato",sans-serif; } h1 { font-style: italic; } .sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active { font-family: "Lato", sans-serif; font-weight: 400; font-style: italic; } QuantLib-1.42.1/Docs/quantlibfooter.html000066400000000000000000000011261517022222500201300ustar00rootroot00000000000000 QuantLib-1.42.1/Docs/quantlibheader.html000066400000000000000000000040641517022222500200660ustar00rootroot00000000000000 $projectname: $title $title $treeview $search $mathjax $extrastylesheet
QuantLib: a free/open-source library for quantitative finance
Reference manual - version $projectnumber
$projectbrief
$searchbox
QuantLib-1.42.1/Examples/000077500000000000000000000000001517022222500150725ustar00rootroot00000000000000QuantLib-1.42.1/Examples/AsianOption/000077500000000000000000000000001517022222500173165ustar00rootroot00000000000000QuantLib-1.42.1/Examples/AsianOption/AsianOption.cpp000066400000000000000000000330631517022222500222530ustar00rootroot00000000000000/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! Copyright (C) 2025 Kareem Fareed 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 demonstrates Asian option pricing using various methods available in QuantLib, including: - Discrete vs. Continuous averaging - Arithmetic vs. Geometric averaging - Multiple pricing engines (Analytic, Monte Carlo, PDE, Approximations) */ #include #if !defined(BOOST_ALL_NO_LIB) && defined(BOOST_MSVC) # include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace QuantLib; int main(int, char* []) { try { std::cout << std::endl; // set up dates Calendar calendar = TARGET(); Date todaysDate(15, November, 2025); Date settlementDate(17, November, 2025); Settings::instance().evaluationDate() = todaysDate; // our options Option::Type type(Option::Put); Real underlying = 100; Real strike = 100; Spread dividendYield = 0.03; Rate riskFreeRate = 0.06; Volatility volatility = 0.20; Date maturity(17, November, 2026); DayCounter dayCounter = Actual365Fixed(); std::cout << "Asian Option Pricing Example" << std::endl; std::cout << "=============================" << std::endl << std::endl; std::cout << "Option type = " << type << std::endl; std::cout << "Maturity = "<< maturity << std::endl; std::cout << "Underlying price = " << underlying << std::endl; std::cout << "Strike = " << strike << std::endl; std::cout << "Risk-free interest rate = " << io::rate(riskFreeRate) << std::endl; std::cout << "Dividend yield = " << io::rate(dividendYield) << std::endl; std::cout << "Volatility = " << io::volatility(volatility) << std::endl; std::cout << std::endl; // Set up fixing dates for discrete averaging (monthly fixings) std::vector fixingDates; Date d = settlementDate; while (d <= maturity) { fixingDates.push_back(d); d = calendar.advance(d, 1, Months); } std::cout << "Number of fixings: " << fixingDates.size() << std::endl; std::cout << std::endl; // Set up flat yield/dividend/vol curves auto underlyingH = makeQuoteHandle(underlying); Handle flatTermStructure( ext::make_shared(settlementDate, riskFreeRate, dayCounter)); Handle flatDividendTS( ext::make_shared(settlementDate, dividendYield, dayCounter)); Handle flatVolTS( ext::make_shared(settlementDate, calendar, volatility, dayCounter)); auto payoff = ext::make_shared(type, strike); auto bsmProcess = ext::make_shared( underlyingH, flatDividendTS, flatTermStructure, flatVolTS); auto europeanExercise = ext::make_shared(maturity); // Create Asian options DiscreteAveragingAsianOption discreteArithmeticOption( Average::Arithmetic, 0.0, // running sum 0, // past fixings fixingDates, payoff, europeanExercise); DiscreteAveragingAsianOption discreteGeometricOption( Average::Geometric, 0.0, // running product (should be 1.0 for geometric, but 0 means no past fixings) 0, // past fixings fixingDates, payoff, europeanExercise); ContinuousAveragingAsianOption continuousArithmeticOption( Average::Arithmetic, settlementDate, payoff, europeanExercise); ContinuousAveragingAsianOption continuousGeometricOption( Average::Geometric, payoff, europeanExercise); // ********************************************** // DISCRETE AVERAGING - GEOMETRIC AVERAGE // ********************************************** std::cout << std::endl; std::cout << "DISCRETE AVERAGING - GEOMETRIC AVERAGE" << std::endl; std::cout << "======================================" << std::endl; Size widths[] = { 40, 16 }; // Analytic geometric discrete std::cout << std::setw(widths[0]) << std::left << "Analytic (Discrete Geometric)" << std::fixed << std::setprecision(6) << std::setw(widths[1]) << std::left; discreteGeometricOption.setPricingEngine( ext::make_shared(bsmProcess)); std::cout << discreteGeometricOption.NPV() << std::endl; // Monte Carlo geometric discrete Size mcSeed = 42; std::cout << std::setw(widths[0]) << std::left << "Monte Carlo (Discrete Geometric)" << std::fixed << std::setprecision(6) << std::setw(widths[1]) << std::left; discreteGeometricOption.setPricingEngine( MakeMCDiscreteGeometricAPEngine(bsmProcess) .withSamples(10000) .withSeed(mcSeed)); std::cout << discreteGeometricOption.NPV() << std::endl; // ********************************************** // DISCRETE AVERAGING - ARITHMETIC AVERAGE // ********************************************** std::cout << std::endl; std::cout << "DISCRETE AVERAGING - ARITHMETIC AVERAGE" << std::endl; std::cout << "=======================================" << std::endl; // Monte Carlo arithmetic discrete std::cout << std::setw(widths[0]) << std::left << "Monte Carlo (Discrete Arithmetic)" << std::fixed << std::setprecision(6) << std::setw(widths[1]) << std::left; discreteArithmeticOption.setPricingEngine( MakeMCDiscreteArithmeticAPEngine(bsmProcess) .withSamples(10000) .withSeed(mcSeed)); std::cout << discreteArithmeticOption.NPV() << std::endl; // Monte Carlo arithmetic discrete with control variate std::cout << std::setw(widths[0]) << std::left << "MC with Control Variate" << std::fixed << std::setprecision(6) << std::setw(widths[1]) << std::left; discreteArithmeticOption.setPricingEngine( MakeMCDiscreteArithmeticAPEngine(bsmProcess) .withSamples(10000) .withControlVariate() .withSeed(mcSeed)); std::cout << discreteArithmeticOption.NPV() << std::endl; // Turnbull-Wakeman approximation std::cout << std::setw(widths[0]) << std::left << "Turnbull-Wakeman Approximation" << std::fixed << std::setprecision(6) << std::setw(widths[1]) << std::left; discreteArithmeticOption.setPricingEngine( ext::make_shared(bsmProcess)); std::cout << discreteArithmeticOption.NPV() << std::endl; // Finite Differences (PDE method) std::cout << std::setw(widths[0]) << std::left << "Finite Differences (PDE)" << std::fixed << std::setprecision(6) << std::setw(widths[1]) << std::left; discreteArithmeticOption.setPricingEngine( ext::make_shared(bsmProcess, 100, 100, 50)); std::cout << discreteArithmeticOption.NPV() << std::endl; // ********************************************** // CONTINUOUS AVERAGING - GEOMETRIC AVERAGE // ********************************************** std::cout << std::endl; std::cout << "CONTINUOUS AVERAGING - GEOMETRIC AVERAGE" << std::endl; std::cout << "========================================" << std::endl; // Analytic geometric continuous std::cout << std::setw(widths[0]) << std::left << "Analytic (Continuous Geometric)" << std::fixed << std::setprecision(6) << std::setw(widths[1]) << std::left; continuousGeometricOption.setPricingEngine( ext::make_shared(bsmProcess)); std::cout << continuousGeometricOption.NPV() << std::endl; // ********************************************** // CONTINUOUS AVERAGING - ARITHMETIC AVERAGE // ********************************************** std::cout << std::endl; std::cout << "CONTINUOUS AVERAGING - ARITHMETIC AVERAGE" << std::endl; std::cout << "=========================================" << std::endl; // Continuous Arithmetic Levy Engine std::cout << std::setw(widths[0]) << std::left << "Continuous Arithmetic Levy Engine" << std::fixed << std::setprecision(6) << std::setw(widths[1]) << std::left; auto currentAverage = makeQuoteHandle(0.0); // No averaging yet for fresh option continuousArithmeticOption.setPricingEngine( ext::make_shared(bsmProcess, currentAverage)); std::cout << continuousArithmeticOption.NPV() << std::endl; // ********************************************** // COMPARISON SUMMARY // ********************************************** std::cout << std::endl; std::cout << "SUMMARY COMPARISON" << std::endl; std::cout << "==================" << std::endl; std::cout << std::endl; std::cout << "Averaging Type Method NPV" << std::endl; std::cout << "--------------------------------------------------------------------------------" << std::endl; // Re-price all for summary discreteGeometricOption.setPricingEngine( ext::make_shared(bsmProcess)); std::cout << std::setw(24) << std::left << "Discrete Geometric" << std::setw(36) << std::left << "Analytic" << std::fixed << std::setprecision(6) << discreteGeometricOption.NPV() << std::endl; discreteArithmeticOption.setPricingEngine( MakeMCDiscreteArithmeticAPEngine(bsmProcess) .withSamples(10000) .withControlVariate() .withSeed(mcSeed)); std::cout << std::setw(24) << std::left << "Discrete Arithmetic" << std::setw(36) << std::left << "Monte Carlo (Control Variate)" << std::fixed << std::setprecision(6) << discreteArithmeticOption.NPV() << std::endl; discreteArithmeticOption.setPricingEngine( ext::make_shared(bsmProcess)); std::cout << std::setw(24) << std::left << "Discrete Arithmetic" << std::setw(36) << std::left << "Turnbull-Wakeman" << std::fixed << std::setprecision(6) << discreteArithmeticOption.NPV() << std::endl; continuousGeometricOption.setPricingEngine( ext::make_shared(bsmProcess)); std::cout << std::setw(24) << std::left << "Continuous Geometric" << std::setw(36) << std::left << "Analytic" << std::fixed << std::setprecision(6) << continuousGeometricOption.NPV() << std::endl; continuousArithmeticOption.setPricingEngine( ext::make_shared(bsmProcess, currentAverage)); std::cout << std::setw(24) << std::left << "Continuous Arithmetic" << std::setw(36) << std::left << "Levy Engine" << std::fixed << std::setprecision(6) << continuousArithmeticOption.NPV() << std::endl; std::cout << 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; } } QuantLib-1.42.1/Examples/AsianOption/AsianOption.vcxproj000066400000000000000000001055641517022222500231720ustar00rootroot00000000000000 Debug (static runtime) Win32 Debug (static runtime) x64 Debug Win32 Debug x64 Release (static runtime) Win32 Release (static runtime) x64 Release Win32 Release x64 AsianOption {A17D4799-97BF-410A-97C2-683F489A9DA8} $(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\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ false false false false .\bin\ .\bin\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ false false false false .\bin\ .\bin\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true true false false .\bin\ .\bin\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true true false false AsianOption-mt-sgd AsianOption-x64-mt-sgd AsianOption-mt-gd AsianOption-x64-mt-gd AsianOption-mt-s AsianOption-x64-mt-s AsianOption-mt AsianOption-x64-mt .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.tlb MaxSpeed stdcpp17 AnySuitable false Speed ..\..;%(AdditionalIncludeDirectories) NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) true MultiThreadedDLL true false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true Default false NDEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pdb Console false MachineX86 .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.tlb MaxSpeed stdcpp17 AnySuitable false Speed ..\..;%(AdditionalIncludeDirectories) NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) true MultiThreadedDLL true false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true Default false NDEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pdb Console false .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.tlb MaxSpeed stdcpp17 AnySuitable false Speed ..\..;%(AdditionalIncludeDirectories) NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) true MultiThreaded true false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true Default false NDEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pdb Console false MachineX86 .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.tlb MaxSpeed stdcpp17 AnySuitable false Speed ..\..;%(AdditionalIncludeDirectories) NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) true MultiThreaded true false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true Default false NDEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pdb Console false .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.tlb Disabled stdcpp17 false ..\..;%(AdditionalIncludeDirectories) _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true EditAndContinue Default false _DEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pdb Console false MachineX86 false .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.tlb Disabled stdcpp17 false ..\..;%(AdditionalIncludeDirectories) _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true ProgramDatabase Default false _DEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pdb Console false .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.tlb Disabled stdcpp17 false ..\..;%(AdditionalIncludeDirectories) _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true EditAndContinue Default false _DEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pdb Console false MachineX86 false .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.tlb Disabled stdcpp17 false ..\..;%(AdditionalIncludeDirectories) _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true ProgramDatabase Default false _DEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\AsianOption.pdb Console false {ad0a27da-91da-46a2-acbd-296c419ed3aa} false QuantLib-1.42.1/Examples/AsianOption/AsianOption.vcxproj.filters000066400000000000000000000016131517022222500246270ustar00rootroot00000000000000 {e1cf0425-cf98-4329-a9cc-02cc9512d9e4} cpp;c;cxx;rc;def;r;odl;idl;hpj;bat {3fba9b70-6bea-43e7-b0e8-5a037bc32d53} h;hpp;hxx;hm;inl {6a339176-8fa2-4b45-ac4a-0af262ec79fe} ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe Source Files QuantLib-1.42.1/Examples/AsianOption/CMakeLists.txt000066400000000000000000000003411517022222500220540ustar00rootroot00000000000000add_executable(AsianOption AsianOption.cpp) target_link_libraries(AsianOption ql_library ${QL_THREAD_LIBRARIES}) if (QL_INSTALL_EXAMPLES) install(TARGETS AsianOption RUNTIME DESTINATION ${QL_INSTALL_EXAMPLESDIR}) endif() QuantLib-1.42.1/Examples/BasketLosses/000077500000000000000000000000001517022222500174745ustar00rootroot00000000000000QuantLib-1.42.1/Examples/BasketLosses/BasketLosses.cpp000066400000000000000000000266021517022222500226100ustar00rootroot00000000000000/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* Copyright (C) 2014 Jose Aparicio 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. */ #include #if !defined(BOOST_ALL_NO_LIB) && defined(BOOST_MSVC) # include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using namespace QuantLib; int main(int, char* []) { try { std::cout << std::endl; Calendar calendar = TARGET(); Date todaysDate(19, March, 2014); // must be a business day todaysDate = calendar.adjust(todaysDate); Settings::instance().evaluationDate() = todaysDate; /* -------------------------------------------------------------- SET UP BASKET PORTFOLIO -------------------------------------------------------------- */ // build curves and issuers into a basket of ten names std::vector hazardRates = { 0.001, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09 }; std::vector names; names.reserve(hazardRates.size()); for(Size i=0; i> defTS; for (Real& hazardRate : hazardRates) { defTS.emplace_back( ext::make_shared(0, TARGET(), hazardRate, Actual365Fixed())); defTS.back()->enableExtrapolation(); } std::vector issuers; for(Size i=0; i curves(1, std::make_pair(NorthAmericaCorpDefaultKey( EURCurrency(), QuantLib::SeniorSec, Period(), 1. // amount threshold ), defTS[i])); issuers.emplace_back(curves); } auto thePool = ext::make_shared(); for(Size i=0; iadd(names[i], issuers[i], NorthAmericaCorpDefaultKey( EURCurrency(), QuantLib::SeniorSec, Period(), 1.)); std::vector defaultKeys(hazardRates.size(), NorthAmericaCorpDefaultKey(EURCurrency(), SeniorSec, Period(), 1.)); auto theBskt = ext::make_shared( todaysDate, names, std::vector(hazardRates.size(), 100.), thePool, // 0.0, 0.78); 0.03, .06); /* -------------------------------------------------------------- SET UP DEFAULT LOSS MODELS -------------------------------------------------------------- */ std::vector recoveries(hazardRates.size(), 0.4); Date calcDate(TARGET().advance(Settings::instance().evaluationDate(), Period(60, Months))); Real factorValue = 0.05; std::vector> fctrsWeights(hazardRates.size(), std::vector(1, std::sqrt(factorValue))); // --- LHP model -------------------------- #ifndef QL_PATCH_SOLARIS auto lmGLHP = ext::make_shared( fctrsWeights[0][0] * fctrsWeights[0][0], recoveries); theBskt->setLossModel(lmGLHP); std::cout << "GLHP Expected 10-Yr Losses: " << std::endl; std::cout << theBskt->expectedTrancheLoss(calcDate) << std::endl; // --- G Binomial model -------------------- auto ktLossLM = ext::make_shared(fctrsWeights, recoveries, LatentModelIntegrationType::GaussianQuadrature, GaussianCopulaPolicy::initTraits()); auto lmBinomial = ext::make_shared(ktLossLM); theBskt->setLossModel(lmBinomial); std::cout << "Gaussian Binomial Expected 10-Yr Losses: " << std::endl; std::cout << theBskt->expectedTrancheLoss(calcDate) << std::endl; #endif // --- T Binomial model -------------------- TCopulaPolicy::initTraits initT; initT.tOrders = std::vector(2, 3); auto ktTLossLM = ext::make_shared(fctrsWeights, recoveries, //LatentModelIntegrationType::GaussianQuadrature, LatentModelIntegrationType::Trapezoid, initT); auto lmTBinomial = ext::make_shared(ktTLossLM); theBskt->setLossModel(lmTBinomial); std::cout << "T Binomial Expected 10-Yr Losses: " << std::endl; std::cout << theBskt->expectedTrancheLoss(calcDate) << std::endl; // --- G Inhomogeneous model --------------- Size numSimulations = 100000; #ifndef QL_PATCH_SOLARIS auto gLM = ext::make_shared(fctrsWeights, recoveries, LatentModelIntegrationType::GaussianQuadrature, // g++ requires this when using make_shared GaussianCopulaPolicy::initTraits()); Size numBuckets = 100; auto inhomogeneousLM = ext::make_shared(gLM, numBuckets); theBskt->setLossModel(inhomogeneousLM); std::cout << "G Inhomogeneous Expected 10-Yr Losses: " << std::endl; std::cout << theBskt->expectedTrancheLoss(calcDate) << std::endl; // --- G Random model --------------------- // Gaussian random joint default model: // Size numCoresUsed = 4; // Sobol, many cores auto rdlmG = ext::make_shared>>>(gLM, recoveries, numSimulations, 1.e-6, 2863311530UL); //auto rdlmG = ext::make_shared>(gLM, // recoveries, numSimulations, 1.e-6, 2863311530); theBskt->setLossModel(rdlmG); std::cout << "Random G Expected 10-Yr Losses: " << std::endl; std::cout << theBskt->expectedTrancheLoss(calcDate) << std::endl; #endif // --- StudentT Random model --------------------- // Sobol, many cores auto rdlmT = ext::make_shared>>>(ktTLossLM, recoveries, numSimulations, 1.e-6, 2863311530UL); //auto rdlmT = ext::make_shared>(ktTLossLM, // recoveries, numSimulations, 1.e-6, 2863311530); theBskt->setLossModel(rdlmT); std::cout << "Random T Expected 10-Yr Losses: " << std::endl; std::cout << theBskt->expectedTrancheLoss(calcDate) << std::endl; // Spot Loss latent model: #ifndef QL_PATCH_SOLARIS std::vector> fctrsWeightsRR(2 * hazardRates.size(), std::vector(1, std::sqrt(factorValue))); Real modelA = 2.2; auto sptLG = ext::make_shared( fctrsWeightsRR, recoveries, modelA, LatentModelIntegrationType::GaussianQuadrature, GaussianCopulaPolicy::initTraits()); auto sptLT = ext::make_shared(fctrsWeightsRR, recoveries, modelA, LatentModelIntegrationType::GaussianQuadrature, initT); // --- G Random Loss model --------------------- // Gaussian random joint default model: // Sobol, many cores auto rdLlmG = ext::make_shared>(sptLG, numSimulations, 1.e-6, 2863311530UL); theBskt->setLossModel(rdLlmG); std::cout << "Random Loss G Expected 10-Yr Losses: " << std::endl; std::cout << theBskt->expectedTrancheLoss(calcDate) << std::endl; // --- T Random Loss model --------------------- // Gaussian random joint default model: // Sobol, many cores auto rdLlmT = ext::make_shared>(sptLT, numSimulations, 1.e-6, 2863311530UL); theBskt->setLossModel(rdLlmT); std::cout << "Random Loss T Expected 10-Yr Losses: " << std::endl; std::cout << theBskt->expectedTrancheLoss(calcDate) << std::endl; // Base Correlation model set up to test coherence with base LHP model std::vector bcTenors = {{1, Years}, {5, Years}}; std::vector bcLossPercentages = {0.03, 0.12}; std::vector>> correls; // std::vector> corr1Y; // 3% corr1Y.emplace_back( ext::make_shared(fctrsWeights[0][0] * fctrsWeights[0][0])); // 12% corr1Y.emplace_back( ext::make_shared(fctrsWeights[0][0] * fctrsWeights[0][0])); correls.push_back(corr1Y); std::vector> corr2Y; // 3% corr2Y.emplace_back( ext::make_shared(fctrsWeights[0][0] * fctrsWeights[0][0])); // 12% corr2Y.emplace_back( ext::make_shared(fctrsWeights[0][0] * fctrsWeights[0][0])); correls.push_back(corr2Y); auto correlSurface = ext::make_shared>( // first one would do, all should be the same. defTS[0]->settlementDays(), defTS[0]->calendar(), Unadjusted, bcTenors, bcLossPercentages, correls, Actual365Fixed()); Handle> correlHandle(correlSurface); auto bcLMG_LHP_Bilin = ext::make_shared(correlHandle, recoveries, GaussianCopulaPolicy::initTraits()); theBskt->setLossModel(bcLMG_LHP_Bilin); std::cout << "Base Correlation GLHP Expected 10-Yr Losses: " << std::endl; std::cout << theBskt->expectedTrancheLoss(calcDate) << std::endl; #endif return 0; } catch (exception& e) { cerr << e.what() << endl; return 1; } catch (...) { cerr << "unknown error" << endl; return 1; } } QuantLib-1.42.1/Examples/BasketLosses/BasketLosses.vcxproj000066400000000000000000001053701517022222500235210ustar00rootroot00000000000000 Debug (static runtime) Win32 Debug (static runtime) x64 Debug Win32 Debug x64 Release (static runtime) Win32 Release (static runtime) x64 Release Win32 Release x64 BasketLosses {43A17E5B-EC94-4EB5-9D68-788BF234AE1F} 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>11.0.1 .\bin\ .\bin\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ false false false false .\bin\ .\bin\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ false false false false .\bin\ .\bin\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true true false false .\bin\ .\bin\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true true false false BasketLosses-mt-sgd BasketLosses-x64-mt-sgd BasketLosses-mt-gd BasketLosses-x64-mt-gd BasketLosses-mt-s BasketLosses-x64-mt-s BasketLosses-mt BasketLosses-x64-mt .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.tlb MaxSpeed stdcpp17 AnySuitable false Speed ..\..;%(AdditionalIncludeDirectories) NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) true MultiThreadedDLL true false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true Default false NDEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pdb Console false MachineX86 .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.tlb MaxSpeed stdcpp17 AnySuitable false Speed ..\..;%(AdditionalIncludeDirectories) NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) true MultiThreadedDLL true false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true Default false NDEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pdb Console false .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.tlb MaxSpeed stdcpp17 AnySuitable false Speed ..\..;%(AdditionalIncludeDirectories) NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) true MultiThreaded true false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true Default false NDEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pdb Console false MachineX86 .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.tlb MaxSpeed stdcpp17 AnySuitable false Speed ..\..;%(AdditionalIncludeDirectories) NDEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) true MultiThreaded true false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true Default false NDEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pdb Console false .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.tlb Disabled stdcpp17 false ..\..;%(AdditionalIncludeDirectories) _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true EditAndContinue Default false _DEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pdb Console false MachineX86 false .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.tlb Disabled stdcpp17 false ..\..;%(AdditionalIncludeDirectories) _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true ProgramDatabase Default false _DEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pdb Console false .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.tlb Disabled stdcpp17 false ..\..;%(AdditionalIncludeDirectories) _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true EditAndContinue Default false _DEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pdb Console false MachineX86 false .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.tlb Disabled stdcpp17 false ..\..;%(AdditionalIncludeDirectories) _DEBUG;WIN32;_CONSOLE;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug false true true quantlib.hpp .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pch .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\ Level3 true ProgramDatabase Default false _DEBUG;%(PreprocessorDefinitions) 0x0409 $(OutDir)$(TargetName)$(TargetExt) true ..\..\lib;%(AdditionalLibraryDirectories) true .\build\$(PlatformToolset)\$(Platform)\$(Configuration)\BasketLosses.pdb Console false {ad0a27da-91da-46a2-acbd-296c419ed3aa} false QuantLib-1.42.1/Examples/BasketLosses/BasketLosses.vcxproj.filters000066400000000000000000000016131517022222500251630ustar00rootroot00000000000000 {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cxx;rc;def;r;odl;idl;hpj;bat {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hpp;hxx;hm;inl {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe Source Files QuantLib-1.42.1/Examples/BasketLosses/CMakeLists.txt000066400000000000000000000003451517022222500222360ustar00rootroot00000000000000add_executable(BasketLosses BasketLosses.cpp) target_link_libraries(BasketLosses ql_library ${QL_THREAD_LIBRARIES}) if (QL_INSTALL_EXAMPLES) install(TARGETS BasketLosses RUNTIME DESTINATION ${QL_INSTALL_EXAMPLESDIR}) endif() QuantLib-1.42.1/Examples/BermudanSwaption/000077500000000000000000000000001517022222500203545ustar00rootroot00000000000000QuantLib-1.42.1/Examples/BermudanSwaption/BermudanSwaption.cpp000066400000000000000000000373041517022222500243510ustar00rootroot00000000000000/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! Copyright (C) 2002, 2003 Sadruddin Rejeb Copyright (C) 2004 Ferdinando Ametrano Copyright (C) 2005, 2006, 2007 StatPro Italia srl 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. */ #include #if !defined(BOOST_ALL_NO_LIB) && defined(BOOST_MSVC) # include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace QuantLib; //Number of swaptions to be calibrated to... Size numRows = 5; Size numCols = 5; Integer swapLengths[] = { 1, 2, 3, 4, 5}; Volatility swaptionVols[] = { 0.1490, 0.1340, 0.1228, 0.1189, 0.1148, 0.1290, 0.1201, 0.1146, 0.1108, 0.1040, 0.1149, 0.1112, 0.1070, 0.1010, 0.0957, 0.1047, 0.1021, 0.0980, 0.0951, 0.1270, 0.1000, 0.0950, 0.0900, 0.1230, 0.1160}; void calibrateModel( const ext::shared_ptr& model, const std::vector>& swaptions) { std::vector> helpers(swaptions.begin(), swaptions.end()); LevenbergMarquardt om; model->calibrate(helpers, om, EndCriteria(400, 100, 1.0e-8, 1.0e-8, 1.0e-8)); // Output the implied Black volatilities for (Size i=0; imodelValue(); Volatility implied = swaptions[i]->impliedVolatility(npv, 1e-4, 1000, 0.05, 0.50); Volatility diff = implied - swaptionVols[k]; std::cout << i+1 << "x" << swapLengths[j] << std::setprecision(5) << std::noshowpos << ": model " << std::setw(7) << io::volatility(implied) << ", market " << std::setw(7) << io::volatility(swaptionVols[k]) << " (" << std::setw(7) << std::showpos << io::volatility(diff) << std::noshowpos << ")\n"; } } int main(int, char* []) { try { std::cout << std::endl; Date todaysDate(15, February, 2002); Calendar calendar = TARGET(); Date settlementDate(19, February, 2002); Settings::instance().evaluationDate() = todaysDate; // flat yield term structure impling 1x5 swap at 5% auto flatRate = ext::make_shared(0.04875825); Handle rhTermStructure( ext::make_shared( settlementDate, Handle(flatRate), Actual365Fixed())); // Define the ATM/OTM/ITM swaps Frequency fixedLegFrequency = Annual; BusinessDayConvention fixedLegConvention = Unadjusted; BusinessDayConvention floatingLegConvention = ModifiedFollowing; DayCounter fixedLegDayCounter = Thirty360(Thirty360::European); Frequency floatingLegFrequency = Semiannual; Swap::Type type = Swap::Payer; Rate dummyFixedRate = 0.03; auto indexSixMonths = ext::make_shared(rhTermStructure); Date startDate = calendar.advance(settlementDate,1,Years, floatingLegConvention); Date maturity = calendar.advance(startDate,5,Years, floatingLegConvention); Schedule fixedSchedule(startDate,maturity,Period(fixedLegFrequency), calendar,fixedLegConvention,fixedLegConvention, DateGeneration::Forward,false); Schedule floatSchedule(startDate,maturity,Period(floatingLegFrequency), calendar,floatingLegConvention,floatingLegConvention, DateGeneration::Forward,false); auto swap = ext::make_shared( type, 1000.0, fixedSchedule, dummyFixedRate, fixedLegDayCounter, floatSchedule, indexSixMonths, 0.0, indexSixMonths->dayCounter()); swap->setPricingEngine(ext::make_shared(rhTermStructure)); Rate fixedATMRate = swap->fairRate(); Rate fixedOTMRate = fixedATMRate * 1.2; Rate fixedITMRate = fixedATMRate * 0.8; auto atmSwap = ext::make_shared( type, 1000.0, fixedSchedule, fixedATMRate, fixedLegDayCounter, floatSchedule, indexSixMonths, 0.0, indexSixMonths->dayCounter()); auto otmSwap = ext::make_shared( type, 1000.0, fixedSchedule, fixedOTMRate, fixedLegDayCounter, floatSchedule, indexSixMonths, 0.0, indexSixMonths->dayCounter()); auto itmSwap = ext::make_shared( type, 1000.0, fixedSchedule, fixedITMRate, fixedLegDayCounter, floatSchedule, indexSixMonths, 0.0, indexSixMonths->dayCounter()); // defining the swaptions to be used in model calibration std::vector swaptionMaturities; swaptionMaturities.emplace_back(1, Years); swaptionMaturities.emplace_back(2, Years); swaptionMaturities.emplace_back(3, Years); swaptionMaturities.emplace_back(4, Years); swaptionMaturities.emplace_back(5, Years); std::vector> swaptions; // List of times that have to be included in the timegrid std::list