Skip to content

AP4549/Cpp_Monte_Carlo-main

Repository files navigation

Monte Carlo Futures Simulation - Quick Start

Get Started in 3 Steps

Step 1: Install Dependencies

pip install pandas dash plotly

Step 2: Run the Dashboard

python dashboard.py

Step 3: Open Browser

Navigate to: http://127.0.0.1:8050/


What You Get

image

A single unified dashboard where you can:

  1. Adjust Parameters - Change F0, K, T, r, sigma, steps, simulations
image
  1. Build & Run - Click one button to compile C++ and execute
image
  1. View Results - Three tabs with:
    • Simulation paths visualization
    • Statistics and distribution analysis
    • Raw simulation data
image

Components

File Purpose
dashboard.py Main interactive dashboard (RUN THIS)
build_and_run.py Handles C++ compilation and execution
Monte Carlo/Monte Carlo.cpp Monte Carlo simulation engine
SETUP_INSTRUCTIONS.md Detailed setup guide

Parameters Explained

  • F0: Initial futures price (default: 100)
  • K: Strike price (default: 100)
  • T: Time to maturity in years (default: 1.0)
  • r: Risk-free rate (default: 0.05)
  • sigma: Volatility (default: 0.2)
  • steps: Time steps (default: 100)
  • simulations: Number of paths (default: 1000)

Tip: Start with 1000 simulations for fast results, increase to 5000+ for accuracy.


Output

Results saved to: Monte Carlo/simulation_results.csv

Columns:

  • sim_id: Simulation path ID
  • step: Time step
  • price: Futures price at that step

Windows Users

Make sure you have Visual Studio Build Tools with C++ compiler installed. If using PowerShell, use "Developer Command Prompt for Visual Studio" instead.


Troubleshooting

Issue Solution
"Cannot find cl.exe" Install Visual Studio Build Tools
"No module named 'dash'" Run pip install pandas dash plotly
Dashboard won't open Try http://127.0.0.1:8050 in browser
Compilation fails Check Eigen path in build_and_run.py

Full Details

See SETUP_INSTRUCTIONS.md for complete documentation.


Made with ❤️ for quantitative finance

About

This project integrates a C++ Monte Carlo simulation with a Python dashboard. You can: Adjust simulation parameters from the dashboard Compile and run the C++ code with a single click View results and analysis in real-time

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors