{
  "sources": [
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/docs/orderbook_prediction_market_challenge.md",
      "quote": "Each step runs in this order:\n\n1. Refresh competitor replenishments from the previous step.\n2. Call the participant strategy with current private state and the previous\n   step's aggregate fill totals.\n3. Apply participant cancels and new passive limit orders.\n4. Advance the latent process and compute the true probability `p_t`.\n5. Let the arbitrageur sweep stale quotes against `p_t`.\n6. Generate retail market orders and match them against the book."
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/docs/orderbook_prediction_market_challenge.md",
      "quote": "The book uses standard price-time priority:\n\n- highest bid matches first\n- lowest ask matches first\n- same-price orders are FIFO\n- resting orders remain until filled or cancelled"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/config.py",
      "quote": "    jump_intensity_min: float = 0.0008\n    jump_intensity_max: float = 0.0030\n    jump_sigma_min: float = 0.20\n    jump_sigma_max: float = 0.60"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/config.py",
      "quote": "    retail_arrival_rate_min: float = 0.154\n    retail_arrival_rate_max: float = 0.352\n    retail_mean_notional_min: float = 2.64\n    retail_mean_notional_max: float = 6.336"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/process.py",
      "quote": "        diffusion_move = self._rng.gauss(0.0, self.config.diffusion_sigma)\n        jump_count = _sample_poisson(self._rng, self.config.jump_intensity)\n        jump_move = 0.0\n        for _ in range(jump_count):\n            jump_move += self._rng.gauss(self.config.jump_mean, self.config.jump_sigma)"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/market.py",
      "quote": "            if order.owner == COMPETITOR:\n                self._schedule_competitor_replenishment(order)\n            self._remove_order(order)"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/types.py",
      "quote": "    own_orders: tuple[OwnOrderView, ...]"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/runner.py",
      "quote": "    for offset in range(count):\n        seed = seed_start + offset\n        config = sample_config(base, var, seed=seed)\n        engine = SimulationEngine(config, strategy_factory, seed=seed)\n        results.append(engine.run())"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/retail.py",
      "quote": "        mu_ln = math.log(mean) - 0.5 * sigma * sigma"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/README.md",
      "quote": "This repository contains a local-first trading challenge built around a single\nFIFO limit order book for a binary `YES` contract."
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/strategy.py",
      "quote": "class BaseStrategy:\n    \"\"\"Convenience base class for local competitor development.\"\"\""
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/engine.py",
      "quote": "                actions = strategy.on_step(state)\n                market.apply_actions(actions, step=step)\n\n                process.step()\n                probability = process.current_true_probability()"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/results.py",
      "quote": "    total_edge: float\n    retail_edge: float\n    arb_edge: float"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/loader.py",
      "quote": "    strategy_cls = getattr(module, \"Strategy\", None)"
    },
    {
      "url": "https://api.imd.fun/artifacts/db22aff7167a4798251ed3d20432509f30e511e4958799aba5b17b41bb39b4b6",
      "quote": "\"code\""
    }
  ]
}
