Skip to main content

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:

  1. PnL: Maximize total profit
  2. Sharpe Ratio: Maximize risk-adjusted returns
  3. 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:

  1. Scans your algorithm file for # opt: annotations
  2. Runs backtests using the prosperity3bt module with different parameter combinations
  3. Optimizes parameters using Optuna (NSGA-II for multi-objective, TPE for single-objective)
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prosperity3opt-0.1.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prosperity3opt-0.1.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file prosperity3opt-0.1.0.tar.gz.

File metadata

  • Download URL: prosperity3opt-0.1.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for prosperity3opt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6485188bccbb87ba0bf876bd95bd06e473a82ba851e7531a3a202565696eaeb5
MD5 69f4ffc03b904ec023d5fa2c50b50af6
BLAKE2b-256 0fcef914b6d7f06cc9293feb95629464e590b4fb771dcd5a321cfb4f3c65575b

See more details on using hashes here.

File details

Details for the file prosperity3opt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: prosperity3opt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for prosperity3opt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0bec9e03a759ab05d30d07b0be277f200aca6630680ec854262143c6abf2b9cf
MD5 edd9d632b72dc5c0eb60aa7edfa94e20
BLAKE2b-256 af8f182d6f78313e9d56aeb913328faabf08cdee280019a1c98202f862499c80

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page