How nicolassinott/imc_prosperity works
1. This repository is a quantitative trading bot project for the IMC Prosperity competition. The runtime architecture is centered on a single exchange-facing trader entrypoint that receives market state from IMC and returns orders each tick.
2. The core execution boundary is the IMC challenge framework. datamodel.py defines the shared data structures used at that boundary, such as the market state, listings, order books, trades, and observations. All strategy code depends on these types.
3. trader.py is the main bot entrypoint used by the competition harness. It is the place where the active strategy is wired together and where per-tick decisions are made from the incoming state to outgoing orders.
4. The round-specific files (round1_trader.py through round5_trader.py) separate strategy logic by competition phase and product set. Each file encodes a different trading model tailored to the instruments introduced in that round.
5. The trading logic is mostly signal-driven and stateless across rounds, but each strategy maintains short-term history internally where needed. Examples from the README include:
- mean-reversion around a fixed anchor for PEARLS,
- EMA-based trading for BANANAS,
- spread/z-score arbitrage for COCONUTS vs PINA_COLADAS,
- seasonal/time-based logic for BERRIES,
- signal trading from DOLPHIN_SIGHTINGS for DIVING_GEAR,
- basket/component spread trading for PICNIC_BASKET.
6. The data flow during execution is: IMC simulator sends market snapshot and observations → datamodel.py structures it → strategy code computes indicators such as EMA, spread, z-score, or derivative thresholds → orders are emitted back to the simulator. This is a closed loop with no external database or service dependency shown in the repo.
7. The notebooks under notebooks/ are the research and analysis layer, not the live trading layer. They appear to be used for exploratory data analysis, parameter selection, and post-run result analysis for individual rounds and strategies.
8. manual_trade_r1.py is a separate utility for hands-on or ad hoc trading/testing for round 1. It likely exists as a lightweight experiment harness distinct from the automated competition bot.
9. The img/ directory contains charts and screenshots that support the strategy write-up in the README. These assets document observed patterns such as spreads, seasonality, and signal thresholds, but they do not affect runtime behavior.
10. Architecturally, the repo is split into two main concerns: strategy research/validation and live execution. The notebooks and plots feed insight into the round trader scripts; the trader scripts and datamodel form the deployable bot that interfaces with the IMC platform.
11. For diagramming, the key nodes are: IMC challenge environment, datamodel.py, trader.py as the active entrypoint, round-specific strategy modules as internal decision engines, and notebooks as offline analytics inputs. The main boundary is between offline analysis and online order generation.
Main entry points: datamodel.py Data model · trader.py Main trader · round3_trader.py Round 3 · round2_trader.py Round 2
Components 21
Live trading
Deployable bot that runs inside the IMC Prosperity competition loop.
- Data model · Defines the market state, listings, order books, trades, and observations passed across the IMC boundary.
datamodel.py - Main trader · Competition entrypoint that wires the active strategy and produces orders per tick.
trader.py - Round 1 · Round-specific logic for early products such as PEARLS and BANANAS.
round1_trader.py - Round 2 · Round-specific logic for the coconuts and pina coladas spread setup.
round2_trader.py - Round 3 · Round-specific logic for berries and dolphin-driven products.
round3_trader.py - Round 4 · Round-specific logic for basket and component trading.
round4_trader.py - Round 5 · Late-round strategy logic and final competition refinements.
round5_trader.py - Manual trade · Lightweight utility for hands-on or experimental round 1 trading.
manual_trade_r1.py
Research
Offline analysis and strategy development artifacts.
- Round 1 notebook · Offline exploration for bananas and pears strategy development.
notebooks/01-round1-bananas_pears.ipynb - Round 2 notebook · Offline exploration for the coconuts and pina coladas spread.
notebooks/02-round2-coconuts_pinacolada.ipynb - Results analysis · General post-run result analysis and evaluation.
notebooks/03-results_analyser.ipynb - Round 3 notebook · Offline exploration for mayberries and seasonality-driven trading.
notebooks/04-round3-mayberries.ipynb - Berries notebook · Offline exploration for berries seasonal behavior and timing.
notebooks/05-round3-berries.ipynb - Diving gear · Offline exploration for dolphin-signal trading in diving gear.
notebooks/05-round3-diving_gear.ipynb - Dolphins notebook · Offline exploration for dolphin sightings as a trading signal.
notebooks/06-round3-dolphins.ipynb - Round 4 notebook · Offline exploration for picnic basket relative-value trading.
notebooks/07-round4-picniq.ipynb - Round 5 EDA · Late-stage exploratory data analysis and feature inspection.
notebooks/08-round5-eda.ipynb - Round 5 results · Post-run evaluation and tuning for the final round.
notebooks/09-round5-analysing_results.ipynb - Optimized coconuts · Parameter tuning and optimization for the coconuts and pina coladas strategy.
notebooks/10-coconuts_pina_coladas_optimized.ipynb - Final report · Summary notebook consolidating findings and final strategy narrative.
notebooks/11-final_report.ipynb
Other components
- IMC harness · Competition runtime that sends market state and receives orders each tick.
Connections 26
- IMC harness → Data model: state snapshot · IMC provides the market state through shared data structures.
- Data model → Main trader: input types · The entrypoint consumes the shared market and observation types.
- Main trader → Round 1: round 1 logic · Main entrypoint can wire in the round-specific strategy.
- Main trader → Round 2: round 2 logic · Main entrypoint can wire in the round-specific strategy.
- Main trader → Round 3: round 3 logic · Main entrypoint can wire in the round-specific strategy.
- Main trader → Round 4: round 4 logic · Main entrypoint can wire in the round-specific strategy.
- Main trader → Round 5: round 5 logic · Main entrypoint can wire in the round-specific strategy.
- Round 1 → Data model: orders · Strategies compute orders from the current market state.
- Round 2 → Data model: orders · Strategies compute orders from the current market state.
- Round 3 → Data model: orders · Strategies compute orders from the current market state.
- Round 4 → Data model: orders · Strategies compute orders from the current market state.
- Round 5 → Data model: orders · Strategies compute orders from the current market state.
- Manual trade → Data model: test harness · Ad hoc round 1 trading uses the same core market types.
- Round 1 notebook → Round 1: research input · Offline analysis informs the round 1 strategy.
- Round 2 notebook → Round 2: research input · Offline analysis informs the round 2 strategy.
- Results analysis → Round 1: evaluation · Shared results analysis supports strategy tuning.
- Results analysis → Round 2: evaluation · Shared results analysis supports strategy tuning.
- Round 3 notebook → Round 3: research input · Offline analysis informs the round 3 strategy.
- Berries notebook → Round 3: research input · Offline analysis informs the round 3 strategy.
- Diving gear → Round 3: research input · Offline analysis informs the round 3 strategy.
- Dolphins notebook → Round 3: research input · Offline analysis informs the round 3 strategy.
- Round 4 notebook → Round 4: research input · Offline analysis informs the round 4 strategy.
- Round 5 EDA → Round 5: research input · Offline analysis informs the round 5 strategy.
- Round 5 results → Round 5: evaluation · Post-run analysis informs late-round tuning.
- Optimized coconuts → Round 2: optimization · Parameter optimization supports the round 2 spread strategy.
- Final report → Main trader: summary · Final write-up consolidates the live architecture and findings.