Hyperparameter optimizer for IMC Prosperity 3 algorithms with multi-objective optimization. Based on the original optimizer by jmerle.
Project description
IMC Prosperity 3 Optimizer
Hyperparameter optimizer for IMC Prosperity 3 algorithms with multi-objective optimization support.
Note: This project is based on the original imc-prosperity-3-optimizer by Jasper van Merle (jmerle). The original project provided the foundation for this version.
Features
- Multi-objective optimization (default): Uses NSGA-II to optimize PnL, Sharpe ratio, and drawdown simultaneously
- Single-objective mode: Optional PnL-only optimization using TPE
- Post-optimization analysis: Sensitivity analysis, knife-edge detection, and visualizations
- Overfitting protection: Default trial limits (50-80 for multi-objective, 30-50 for single-objective)
Installation
pip install prosperity3opt
Usage
Basic Usage
Hyperparameters that need to be optimized must be annotated in your code like this:
RAINFOREST_RESIN_VALUE = 10_000 # opt: int(10_000 - 3, 10_000 + 3)
You can use any of Optuna's trial.suggest_* methods after the "# opt: " comment:
# opt: categorical(choices)- suggest a value for a categorical parameter# opt: float(low, high, *[, step, log])- suggest a value for a floating point parameter# opt: int(low, high, *[, step, log])- suggest a value for an integer parameter
Running the Optimizer
Multi-objective mode (default) - Optimizes PnL, Sharpe ratio, and drawdown:
# Optimize on all days from round 1
prosperity3opt algorithm.py 1
# Optimize on specific days
prosperity3opt algorithm.py 1-0 1--1
Single-objective mode (PnL-only) - Optimizes only PnL:
prosperity3opt algorithm.py 1 --pnl-only
Options
--pnl-only: Use single-objective optimization (TPE) instead of multi-objective (NSGA-II)--trials N: Maximum number of trials (default: 65 for multi-objective, 40 for single-objective)--out PATH: Path to save optimization results (default:prosperity3opt.log)--grid: Use grid search instead of TPE/NSGA-II--jobs N: Number of parallel backtests (default: -1, uses all CPU cores)
Run prosperity3opt --help for all available options.
Design Philosophy
Multi-Objective Optimization (Default)
The default mode uses NSGA-II to optimize three objectives simultaneously:
- PnL: Maximize total profit
- Sharpe Ratio: Maximize risk-adjusted returns
- Drawdown: Minimize maximum drawdown
This returns a Pareto front of solutions, allowing you to choose the highest PnL candidate with acceptable Sharpe ratio and drawdown.
Trial Limits
To prevent overfitting on limited backtest data:
- Multi-objective: 50-80 trials (default: 65)
- Single-objective: 30-50 trials (default: 40)
Post-Optimization Analysis
After optimization, the tool provides:
- Pareto front visualization: Shows tradeoffs between objectives
- Parameter importance: Identifies which parameters matter most
- Sensitivity analysis: Flags parameters on "knife edges" (unstable performance)
- Optimization history: Tracks PnL progression over trials
How It Works
The optimizer:
- Scans your algorithm file for
# opt:annotations - Runs backtests using the
prosperity3btmodule with different parameter combinations - Optimizes parameters using Optuna (NSGA-II for multi-objective, TPE for single-objective)
- Returns a Pareto front (multi-objective) or best solution (single-objective)
Note: The optimizer uses the prosperity3bt module to access historical data and run backtests. You don't need to upload day-specific code - the backtester handles data access automatically.
Visualization
After optimization, you can use the Optuna Dashboard to visualize results:
optuna-dashboard prosperity3opt.log
Credits
This project is based on the original imc-prosperity-3-optimizer by Jasper van Merle (jmerle). The original project provided the core optimizer functionality.
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prosperity3opt-0.2.0.tar.gz.
File metadata
- Download URL: prosperity3opt-0.2.0.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa1df06f5ae66509436d5166909ef7c8b2232415ece8a5c72824498ec406c5cd
|
|
| MD5 |
faff243fff04b920afb3fe122dd2f417
|
|
| BLAKE2b-256 |
b98ab17d41c0172fcfad9dad9feab4e1f1d649b1a573bab0b96febc6b5d9e63e
|
File details
Details for the file prosperity3opt-0.2.0-py3-none-any.whl.
File metadata
- Download URL: prosperity3opt-0.2.0-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7438314c743daffd417ca79434501538237b1471bf6e3e61f0605fbecc00d6cb
|
|
| MD5 |
8b78f81b601def30df3c0134a37dc0c3
|
|
| BLAKE2b-256 |
57eb22153620131ba5cda45fae68c69ccc946df86ddb264095fced716e69006f
|