|
2 | 2 |
|
3 | 3 | [](https://github.com/WW-shan/poly_strategy/actions/workflows/ci.yml) |
4 | 4 | [](LICENSE) |
| 5 | +[](https://github.com/WW-shan/poly_strategy/releases) |
| 6 | +[](pyproject.toml) |
| 7 | +[](tests) |
| 8 | +[](docs/security.md) |
| 9 | +[](docs/security.md) |
5 | 10 |
|
6 | | -Prediction-market research toolkit for collecting market data, replaying snapshots, and validating dry-run opportunities. |
| 11 | +<p align="center"> |
| 12 | + <a href="docs/command-reference.md"><img src="https://img.shields.io/badge/Command%20Reference-111827?style=for-the-badge&logo=readthedocs&logoColor=white" alt="Command Reference"></a> |
| 13 | + <a href="docs/pipeline.md"><img src="https://img.shields.io/badge/Pipeline-0f766e?style=for-the-badge&logo=mermaid&logoColor=white" alt="Pipeline"></a> |
| 14 | + <a href="docs/operations.md"><img src="https://img.shields.io/badge/Ops%20Runbook-7c2d12?style=for-the-badge&logo=gnubash&logoColor=white" alt="Operations"></a> |
| 15 | + <a href="https://github.com/WW-shan/poly_strategy/releases/tag/v0.1.0"><img src="https://img.shields.io/badge/Release-v0.1.0-1d4ed8?style=for-the-badge&logo=github&logoColor=white" alt="Release"></a> |
| 16 | +</p> |
7 | 17 |
|
8 | | -The repository is organized for research, paper trading, and guarded execution planning. Live execution stays behind explicit keys and risk checks. |
| 18 | +<p align="center"> |
| 19 | + <img src="https://img.shields.io/badge/Polymarket-CLOB%20%2B%20Gamma-111827?style=flat-square" alt="Polymarket"> |
| 20 | + <img src="https://img.shields.io/badge/Kalshi-cross--venue%20research-111827?style=flat-square" alt="Kalshi"> |
| 21 | + <img src="https://img.shields.io/badge/LLM-rule%20verification-111827?style=flat-square" alt="LLM verification"> |
| 22 | + <img src="https://img.shields.io/badge/Risk-pretrade%20checks-111827?style=flat-square" alt="Risk checks"> |
| 23 | +</p> |
9 | 24 |
|
10 | | -## Layout |
| 25 | +Prediction-market research and execution-planning toolkit for collecting books, discovering conservative relations, replaying snapshots, and validating dry-run opportunities before anything touches a live account. |
11 | 26 |
|
12 | | -- `poly_strategy/`: core package |
13 | | -- `scripts/`: recurring jobs and operational helpers |
14 | | -- `tests/`: unit tests |
15 | | -- `docs/`: architecture, operations, and command reference |
16 | | -- `rules/`: cached semantic rules |
17 | | -- `ops/launchd/`: macOS LaunchAgent templates |
18 | | -- `data/` and `var/`: local runtime state, ignored by git |
| 27 | +Live execution is opt-in and stays behind explicit environment variables, pretrade checks, and risk limits. |
| 28 | + |
| 29 | +## What it covers |
| 30 | + |
| 31 | +| Area | Capability | |
| 32 | +| --- | --- | |
| 33 | +| Collection | Polymarket Gamma/CLOB, Kalshi, and external signal ingestion | |
| 34 | +| Discovery | deterministic relation mining, LLM verification, rule caching | |
| 35 | +| Realtime | watchlist building, live book streaming, stable-opportunity monitoring | |
| 36 | +| Paper and risk | backtest, paper selection, execution plan checks, risk ledger updates | |
| 37 | +| Operations | background manager, LaunchAgents, rotation and pruning helpers | |
| 38 | + |
| 39 | +## Architecture |
| 40 | + |
| 41 | +```mermaid |
| 42 | +flowchart LR |
| 43 | + A[Market discovery] --> B[Rule cache] |
| 44 | + B --> C[Watchlist] |
| 45 | + C --> D[Realtime monitor] |
| 46 | + D --> E[Paper trades] |
| 47 | + E --> F[Pretrade checks] |
| 48 | + F --> G[Alerts and status] |
| 49 | +``` |
| 50 | + |
| 51 | +The detailed pipeline is documented in [docs/pipeline.md](docs/pipeline.md). |
19 | 52 |
|
20 | 53 | ## Quick start |
21 | 54 |
|
22 | 55 | ```bash |
23 | 56 | python3.11 -m venv .venv |
24 | 57 | .venv/bin/python -m pip install -e ".[dev,live]" |
25 | 58 | cp .env.example .env.local |
26 | | -pytest |
| 59 | +.venv/bin/python -m pytest |
27 | 60 | ``` |
28 | 61 |
|
29 | | -## Common entry points |
| 62 | +Then inspect the CLI: |
| 63 | + |
| 64 | +```bash |
| 65 | +.venv/bin/poly-strategy --help |
| 66 | +``` |
| 67 | + |
| 68 | +## Common workflows |
30 | 69 |
|
31 | 70 | ```bash |
32 | 71 | python -m poly_strategy.cli sample --out data/sample.ndjson |
33 | 72 | python -m poly_strategy.cli backtest data/sample.ndjson |
34 | 73 | python -m poly_strategy.cli collect-polymarket --out data/polymarket-gamma.ndjson --limit 20 --timeout 10 |
| 74 | +python -m poly_strategy.cli discover-rules --raw data/polymarket-gamma.ndjson --out rules/candidate-implications.json |
| 75 | +python -m poly_strategy.cli build-watchlist --gamma data/polymarket-gamma.ndjson --rules rules/candidate-implications.json --out data/watchlist.json |
| 76 | +python -m poly_strategy.cli realtime-monitor-watchlist --watchlist data/watchlist.json --rules rules/candidate-implications.json --gamma data/polymarket-gamma.ndjson --report-out data/realtime-monitor.jsonl |
35 | 77 | ``` |
36 | 78 |
|
37 | 79 | ## Docs |
38 | 80 |
|
| 81 | +- [Command reference](docs/command-reference.md) |
39 | 82 | - [Pipeline](docs/pipeline.md) |
40 | 83 | - [Operations](docs/operations.md) |
41 | 84 | - [Repository layout](docs/repository-layout.md) |
42 | 85 | - [Security](docs/security.md) |
43 | | -- [Command reference](docs/command-reference.md) |
44 | 86 | - [Changelog](CHANGELOG.md) |
| 87 | +- [Contributing](CONTRIBUTING.md) |
| 88 | + |
| 89 | +## Configuration |
| 90 | + |
| 91 | +| Variable group | Purpose | |
| 92 | +| --- | --- | |
| 93 | +| `OPENAI_*` | LLM discovery and verifier providers | |
| 94 | +| `PROXY` / `OPENAI_PROXY` | local proxy for unstable network paths | |
| 95 | +| `ODDPOOL_*` | external signal ingestion and quota control | |
| 96 | +| `POLYMARKET_*` | live execution / CLOB integration, guarded by `POLY_STRATEGY_ALLOW_LIVE=1` | |
| 97 | +| `ALERT_*`, `TELEGRAM_*`, `DISCORD_*` | notification delivery | |
| 98 | + |
| 99 | +Start from [.env.example](.env.example) and keep `.env.local` untracked. |
| 100 | + |
| 101 | +## Repository layout |
| 102 | + |
| 103 | +- `poly_strategy/`: core package |
| 104 | +- `scripts/`: recurring jobs and operational helpers |
| 105 | +- `tests/`: unit tests |
| 106 | +- `docs/`: architecture, operations, and command reference |
| 107 | +- `rules/`: cached semantic rules |
| 108 | +- `ops/launchd/`: macOS LaunchAgent templates |
| 109 | +- `data/` and `var/`: local runtime state, ignored by git |
45 | 110 |
|
46 | | -## Notes |
| 111 | +## Release and license |
47 | 112 |
|
48 | | -- Keep `.env.local`, generated snapshots, logs, and other runtime artifacts out of git. |
49 | | -- The repo ships with dry-run workflows and optional live integrations, but no secrets. |
50 | | -- Licensed under MIT. See [LICENSE](LICENSE). |
51 | | -- Current release: `v0.1.0`. |
| 113 | +- Current release: `v0.1.0` |
| 114 | +- Licensed under MIT, see [LICENSE](LICENSE) |
0 commit comments