{
  "sources": [
    {
      "url": "https://api.imd.fun/artifacts/7236701c55bd1d2e0674854545ae0bbe4d4b54508c7f7a7c914261696b02e158",
      "quote": "Defends against the arbitrageur by knowing where p is before quoting."
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/docs/orderbook_prediction_market_challenge.md",
      "quote": "- participant starts with `$1000`, `0` YES, and `0` NO\n- resting bids reserve `price * quantity` cash\n- uncovered resting asks reserve `(1 - price) * quantity` cash\n- the participant can mint one YES and one NO for `$1`"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/market.py",
      "quote": "                if uncovered > 0.0:\n                    collateral = round((1.0 - price) * uncovered, 10)\n                    self._cash = round(self._cash - collateral, 10)\n                    self._no_inventory = round(self._no_inventory + uncovered, 10)"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/types.py",
      "quote": "Action = Union[PlaceOrder, CancelOrder, CancelAll]"
    },
    {
      "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/runner.py",
      "quote": "        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/config.py",
      "quote": "    default_simulations: int = DEFAULT_SIMULATIONS\n    starting_cash: float = 1_000.0"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/results.py",
      "quote": "    def mean_edge(self) -> float:\n        successes = [result.total_edge for result in self.simulation_results if not result.failed]\n        return sum(successes) / len(successes) if successes else 0.0"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/cli.py",
      "quote": "    if args.json:\n        print(json.dumps(asdict(batch), indent=2))\n        return 0"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/loader.py",
      "quote": "    strategy_cls = getattr(module, \"Strategy\", None)\n    if strategy_cls is None:\n        raise AttributeError(f\"{path} does not define a Strategy class\")"
    },
    {
      "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.\"\"\"\n\n    def on_step(self, state: StepState) -> Sequence[Action]:\n        return []"
    },
    {
      "url": "https://raw.githubusercontent.com/danrobinson/prediction-market-challenge/b244530ee2a6247b5f930830eeca9dd950da0e7e/orderbook_pm_challenge/sandbox.py",
      "quote": "    with tempfile.TemporaryFile() as stdout_file, tempfile.TemporaryFile() as stderr_file:"
    }
  ]
}