CLI submitter and algorithm validator for IMC Prosperity competition
Project description
imc-prospector
CLI submitter and algorithm validator package for IMC Prosperity competition.
imc-prospector combines a static analysis checker with a command-line submitter to validate and submit your IMC Prosperity trading algorithms.
Note: The CLI submitter is based on jmerle/imc-prosperity-3-submitter. Jmerle is an incredible resource for getting started in IMC algo development.
Features
- Static Analysis Checker: Validates your algorithm against IMC Prosperity requirements before submission
- CLI Submitter: Submit algorithms directly from the command line
- Configurable: Customize allowed imports and severity levels via YAML config
Installation
pip install imc-prospector
Quick Start
Check an Algorithm
# Basic check
imc-prospector check my_trader.py
# Strict mode (warnings as errors)
imc-prospector check my_trader.py --strict
# Use custom config file
imc-prospector check my_trader.py --config my_config.yaml
# JSON output for CI
imc-prospector check my_trader.py --json
# Hide info messages
imc-prospector check my_trader.py --no-info
# Don't prompt, just exit with code
imc-prospector check my_trader.py --no-prompt
Submit an Algorithm
# Submit with automatic checking (default)
imc-prospector submit my_trader.py
# Submit without running checker
imc-prospector submit my_trader.py --no-check
# Submit with custom config file
imc-prospector submit my_trader.py --config my_config.yaml
# Force submission even with errors/warnings (not recommended)
imc-prospector submit my_trader.py --force
# Specify output log file
imc-prospector submit my_trader.py --out logs/my_submission.log
# Don't download logs
imc-prospector submit my_trader.py --no-out
# Combine options: strict checking with custom config
imc-prospector submit my_trader.py --config custom.yaml --strict
What Gets Checked
The checker validates several aspects of your algorithm:
- Structure: Ensures
Traderclass exists with arun(self, state)method - Imports: Verifies only official allowed libraries are used (pandas, numpy, statistics, math, typing, jsonpickle)
- Return: Confirms the method returns a 3-tuple
(result, conversions, traderData) - Timeouts: Detects infinite loops,
time.sleep()calls, and deep nesting that could cause timeouts - State: Warns about instance variables that won't persist (Lambda is stateless)
Configuration
Create .prosperity.yaml in your project root:
# Override severity levels
severity:
E001: error # Forbidden import
W040: warning # Instance vars warning
I030: off # Disable print warnings
# Add custom allowed imports
imports:
scipy: warn # Allow with warning
my_utils: true # Custom module
# Adjust limits
limits:
timeout_ms: 900
max_loop_depth: 3
Config Search Order
The checker searches for config files in this order:
--configargument (if provided viacheckorsubmitcommand).prosperity.yaml(current directory).prosperity.yml(current directory)prosperity.yaml(current directory)prosperity_config.yaml(current directory)~/.prosperity.yaml(home directory)
The first config file found is used, with values merged into the default configuration.
Note: You can use --config with both check and submit commands to override the config file.
See prosperity_config.yaml for all available options.
Submitting to Prosperity
First Time Setup
On first submission, you'll be prompted for your Prosperity ID token. This token is stored securely in your system's keyring.
How to get your token:
- Open the Prosperity website in your browser
- Press F12 to open developer tools
- Go to Application (Chrome) or Storage (Firefox) tab
- Click on Local Storage → select the Prosperity website
- Find the key:
CognitoIdentityServiceProvider.<some id>.<email>.idToken - Copy the token value
The token is stored securely and you'll only need to update it when it expires.
Submission Process
- Check (optional, runs by default): Validates your algorithm
- Errors block submission by default (use
--forceto bypass) - Warnings prompt for confirmation (use
--forceto skip prompt)
- Errors block submission by default (use
- Submit: Uploads to Prosperity API
- Monitor: Watches submission status
- Download: Saves logs to
submissions/<timestamp>.log(unless--no-out)
Submission Options
| Option | Description |
|---|---|
--no-check |
Skip running the checker before submission |
--config, -c |
Use a custom YAML config file for the checker |
--strict |
Treat checker warnings as errors |
--force |
Force submission even if checker finds errors/warnings (not recommended) |
--out, -o |
Specify output log file path |
--no-out |
Don't download submission logs |
Handling Errors and Warnings
When submitting, the checker runs automatically. By default:
- Errors block submission. Use
--forceto bypass (not recommended). - Warnings prompt for confirmation. Use
--forceto skip the prompt.
Example when errors are found:
$ imc-prospector submit my_trader.py
Running algorithm checker...
Checker found 2 error(s) and 1 warning(s):
[E001]:5 Forbidden import: 'os'
[E033]:45 run() returns only a dict, must return 3-tuple
[W040]:10 Instance vars {'position'} may not persist
Submission aborted due to errors. Fix issues and try again.
Use --force to bypass errors (not recommended).
Error Codes
| Code | Severity | Description |
|---|---|---|
| E001 | Error | Forbidden/unsupported import |
| E002 | Error | Missing datamodel import |
| E003 | Error | Missing Trader class |
| E004 | Error | Missing run method |
| E010 | Error | Invalid run() signature |
| E020 | Error | Infinite loop detected |
| E021 | Error | time.sleep() detected |
| E030 | Error | Missing return statement |
| E031 | Error | Returns None |
| E032 | Error | Wrong return tuple size |
| E033 | Error | Returns dict instead of tuple |
| W020 | Warning | Risky while True loop |
| W021 | Warning | Loop variable not modified |
| W022 | Warning | Deep loop nesting |
| W030 | Warning | Can't verify return tuple |
| W040 | Warning | Instance variables won't persist |
Example Output
============================================================
IMC Prosperity Checker: my_trader.py
============================================================
ERRORS (2):
----------------------------------------
[E001]:2 Forbidden import: 'os'
Remove 'import os'. Official allowed: pandas, numpy, statistics, math, typing, jsonpickle
[E033]:45 run() returns only a dict, must return 3-tuple
return result, conversions, traderData
============================================================
Official requirements:
• Imports: pandas, numpy, statistics, math, typing, jsonpickle
• Return: (result, conversions, traderData)
• Timeout: <900ms per run() call
============================================================
Minimal Valid Trader
from datamodel import OrderDepth, TradingState, Order
from typing import List
class Trader:
def run(self, state: TradingState):
result = {}
for product in state.order_depths:
orders: List[Order] = []
# Your trading logic here
result[product] = orders
traderData = "" # Use jsonpickle to persist state
conversions = 0
return result, conversions, traderData
Development
# Clone the repository
git clone https://github.com/arJ-V/imc-prospector.git
cd imc-prospector
# Install in development mode
pip install -e ".[dev]"
# Run linter
ruff check imcprospector/
# Run type checker
mypy imcprospector/
License
MIT
Acknowledgments
Built on top of the submitter structure from imc-prosperity-3-submitter. Uses the same API endpoint as the official Prosperity platform.
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 imc_prospector-0.2.0.tar.gz.
File metadata
- Download URL: imc_prospector-0.2.0.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89f01bb592905684ec53fb6ab0266b8a7b2bb6bd7416573eb98fc6313c74c6af
|
|
| MD5 |
9746d7e717b2e531d75a9f2dc298be40
|
|
| BLAKE2b-256 |
cdf75ad981aad3d0aa510e9ce47c4607c73fa7e0479b670efab62298c238603d
|
File details
Details for the file imc_prospector-0.2.0-py3-none-any.whl.
File metadata
- Download URL: imc_prospector-0.2.0-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b56e86e009d7992f20524317ccdcf2f39557377baec2e44c7f6ecf71fd826f4
|
|
| MD5 |
4192a6b7edbead4c5f3842a8cb241f4b
|
|
| BLAKE2b-256 |
87a75036292ad0041c5c21b2d7b47ddb37395aca4e15593f5e32d44a91b62621
|