Options are financial instruments that give you the right (not obligation) to buy or sell a stock at a certain price in the future. But how much should this right cost today? That’s exactly what an option pricer tells you.
An Option Pricer is a mathematical or computational tool that helps you calculate the fair value (price) of an option contract. This project is a full-stack application that demonstrates how to calculate European call and put option prices using the Monte-Carlo Simulations.
Monte Carlo simulation is a method of estimating the probability of different outcomes by running lots of random simulations.
Instead of solving complex equations directly, you let the computer simulate many possible futures and see what the average outcome looks like.
-
Calculate Call & Put option prices via Monte-Carlo simulations.
-
Lightweight C++ REST API running on port 18080.
-
Responsive web UI for user input and result display.
-
Cross-origin enabled so frontend can talk to backend.
-
C++17 or later
-
Boost
-
ASIO (
brew install asioon macOS) -
g++(orclang++)
- Clone this repository and
cdinto it. - Compile the backend server:
g++ main.cpp option_pricer.cpp -o option_pricer_app -I . -I /opt/homebrew/include -std=c++17 -pthread
- Run the backend server:
./option_pricer_app
By default, the server starts on http://localhost:18080.
- Endpoint:
POST /price - Input JSON:
{
"S": 100,
"K": 105,
"T": 1,
"r": 0.05,
"v": 0.2,
"type": "call"
}
-
Add Google Login authentication (OAuth).
-
More advanced pricing models (Binomial, Monte Carlo).
-
Better styled frontend (Bootstrap/React).