This project contains C++ code for modeling and pricing financial options using QuantLib and exploring different pricing models (European, American, and Asian options).
main.cpp: Main source file for the options pricing logic.
- QuantLib 1.38
- Boost C++ Libraries
- C++17 or newer compiler (tested with MSYS2 g++ and Visual Studio)
A step-by-step process to set up the environment correctly, install dependencies, and build the target.
Install Prerequisites:
- Git for Windows
- Visual Studio 2022 (Community Edition)
- During install, select the "Desktop development with C++" workload.
- Visual Studio Code
- With the "CMake Tools" extension.
Install vcpkg Package Manager: Open a PowerShell terminal and run:
cd C:\
mkdir dev
cd dev
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg integrate installInstall QuantLib (this may take 20-60 minutes as it builds Boost):
.\vcpkg install quantlib\:x64-windows-staticOpen in VS Code: Open the project folder (containing CMakeLists.txt) in VS Code.
Build:
Select the kit for Visual Studio Build Tools 2022 Release - amd64 when prompted. Click the Build button in the status bar, can also, build from the command line:
cmake -B build -DCMAKE_TOOLCHAIN_FILE=C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build buildRun : after building, do:
./build/Release/main.exe- For educational and prototyping purposes only.
- The Asian option Monte Carlo simulation can/will be slow for large sample sizes; change
requiredSamplesinmain.cppfor faster testing.
suggestions welcome! please open an issue or PR for improvements.
FOR educational use. See LICENSE file.