CLI submitter and algorithm validator for IMC Prosperity competition
Project description
imc-prospector
CLI submitter and algorithm validator for IMC Prosperity competition.
imc-prospector combines a static analysis checker with a command-line submitter to help you validate and submit your IMC Prosperity trading algorithms with confidence.
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
- 🔒 Secure: Uses system keyring for token storage
- 📦 PyPI Package: Easy installation via pip
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 the Checker Validates
| Category | Checks |
|---|---|
| Structure | Trader class exists, run(self, state) method present |
| Imports | Only official allowed libraries (pandas, numpy, statistics, math, typing, jsonpickle) |
| Return | Must return 3-tuple (result, conversions, traderData) |
| Timeouts | Catches infinite loops, time.sleep(), deep nesting |
| State | Warns about instance variables (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 Checker Errors and Warnings
When submitting, the checker runs automatically and handles issues as follows:
- Errors: Block submission by default. Use
--forceto bypass (not recommended). - Warnings: Prompt for confirmation. Use
--forceto skip the prompt and continue automatically.
Example:
# Checker finds errors - submission blocked
$ 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).
# Force submission despite errors (use with caution)
$ imc-prospector submit my_trader.py --force
Running algorithm checker...
⚠️ Errors found but --force flag used. Continuing with submission...
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
- Based on the checker from
imc-prospectorand submitter structure fromimc-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.1.0.tar.gz.
File metadata
- Download URL: imc_prospector-0.1.0.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfe62944456a5d8c9106408923a126be1b0862d338ffaf916d03c23d8baf2049
|
|
| MD5 |
e81fb82b179963f1cb4eba6af830a1bd
|
|
| BLAKE2b-256 |
712bce5463af016a79d5facdae03fe0b96476fda4281fb76ac569a8d2b8b32d3
|
File details
Details for the file imc_prospector-0.1.0-py3-none-any.whl.
File metadata
- Download URL: imc_prospector-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09092d8f59f026fe243aded2116ff2e7111544e4754be10f98cd361817806ba9
|
|
| MD5 |
beacf3f91e02e022741bda8993c06e77
|
|
| BLAKE2b-256 |
b0e8a08d54309656447de0fbf28f4b1a4012e3201e7458c94c9c4344c7cb812c
|