wqo 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
wqo-0.1.0/.gitignore ADDED
@@ -0,0 +1,35 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ data/
5
+ .pytest_cache/
6
+
7
+ # never commit credentials or sessions, even if someone moves them in-repo
8
+ *credentials*.json
9
+ *session*.json
10
+ .DS_Store
11
+
12
+ # per-user account snapshot written by `wqo account snapshot` โ€” holds your
13
+ # account id, level, rank and learned concurrency. Every value is per-user and
14
+ # goes stale, so it never belongs in a shared branch.
15
+ ACCOUNT.local.md
16
+ *.local.md
17
+
18
+ # generated alpha candidate batches โ€” inputs to `sim batch`, not source
19
+ ideas/
20
+
21
+ # alpha expressions and their statistics are the author's IP, and this repo has
22
+ # more than one user โ€” provenance stays on the machine that produced it
23
+ provenance/
24
+
25
+ # research plans hold expressions and their statistics, same as ideas/
26
+ .qoder/plans/
27
+
28
+ # third-party reference material. Keep a copy locally if you have one; this
29
+ # repo does not redistribute it.
30
+ *.pdf
31
+
32
+ # Local package build output
33
+ /build/
34
+ /dist/
35
+ *.egg-info/
wqo-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aaditya Vitthal More
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
wqo-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,84 @@
1
+ Metadata-Version: 2.5
2
+ Name: wqo
3
+ Version: 0.1.0
4
+ Summary: WorldQuant BRAIN research client and command-line interface
5
+ Project-URL: Homepage, https://github.com/aaditya-v-more/worldquant-orchestrator
6
+ Project-URL: Documentation, https://github.com/aaditya-v-more/worldquant-orchestrator#readme
7
+ Project-URL: Issues, https://github.com/aaditya-v-more/worldquant-orchestrator/issues
8
+ Project-URL: Source, https://github.com/aaditya-v-more/worldquant-orchestrator
9
+ Author: Aaditya Vitthal More
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: alpha,brain,cli,quant,worldquant
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Office/Business :: Financial :: Investment
22
+ Requires-Python: >=3.12
23
+ Requires-Dist: requests<3,>=2.31
24
+ Provides-Extra: dev
25
+ Requires-Dist: build>=1.2; extra == 'dev'
26
+ Requires-Dist: pytest>=8; extra == 'dev'
27
+ Requires-Dist: twine>=6; extra == 'dev'
28
+ Description-Content-Type: text/markdown
29
+
30
+ # WQO โ€” WorldQuant Orchestrator
31
+
32
+ A Python client and CLI for WorldQuant BRAIN research: discover data, generate
33
+ expressions, run simulations, analyze results, and review alphas for submission.
34
+
35
+ ## Install
36
+
37
+ Python 3.12 or newer; macOS and Linux. With [uv](https://docs.astral.sh/uv/getting-started/installation/):
38
+
39
+ ```bash
40
+ uv tool install --python 3.12 wqo
41
+ wqo --version
42
+ wqo --help
43
+ ```
44
+
45
+ Alternatively, install in a Python virtual environment with `pip install wqo`,
46
+ or use `pipx install --python python3.12 wqo`. No repository clone is required.
47
+
48
+ ## Authentication and use
49
+
50
+ Use your own WorldQuant BRAIN account. Create `~/.brain_credentials.json` in a
51
+ text editor with `email` and `password` fields; keep its permissions private
52
+ (`chmod 600 ~/.brain_credentials.json`). Do not put the password in shell history.
53
+
54
+ ```bash
55
+ wqo auth status
56
+ wqo data operators
57
+ wqo sim run --help
58
+ wqo state
59
+ ```
60
+
61
+ Authentication may require you to complete Persona verification in your browser.
62
+ No tool bypasses that step. Submission requires explicit confirmation for the
63
+ specific alpha, enforces a local quota and refuses duplicate or unresolved writes.
64
+ Most research candidates fail the quality gate; backtests do not guarantee returns.
65
+
66
+ State defaults to `~/.local/share/wqo` (or `$XDG_DATA_HOME/wqo`), outside the
67
+ installed package. `WQO_DATA_DIR` overrides it. Upgrading from a source checkout:
68
+ stop other WQO processes and migrate the existing ledger before any research:
69
+
70
+ ```bash
71
+ wqo state --migrate-from /absolute/path/to/worldquant-orchestrator/data
72
+ ```
73
+
74
+ Migration preserves the source and refuses an existing destination. To keep the
75
+ old location instead, set `WQO_DATA_DIR` to that absolute directory for every run.
76
+ Do not start with an empty ledger to avoid a quota or unresolved submission.
77
+
78
+ [Installation and upgrades](https://github.com/aaditya-v-more/worldquant-orchestrator/blob/main/docs/installation.md)
79
+ ยท [CLI documentation](https://github.com/aaditya-v-more/worldquant-orchestrator#readme)
80
+ ยท [Safety controls](https://github.com/aaditya-v-more/worldquant-orchestrator/blob/main/docs/safety.md)
81
+
82
+ MIT licensed. Not affiliated with or endorsed by WorldQuant. Agent skills are
83
+ maintained separately in the repository; installing this Python package installs
84
+ the CLI and library.
wqo-0.1.0/README.md ADDED
@@ -0,0 +1,400 @@
1
+ <div align="center">
2
+
3
+ <img src="docs/media/logo.svg" width="132" alt="worldquant-orchestrator logo">
4
+
5
+ <h1>worldquant-orchestrator</h1>
6
+
7
+ <p>
8
+ <b>End-to-end control of <a href="https://platform.worldquantbrain.com">WorldQuant BRAIN</a> from any coding agent.</b><br>
9
+ Data discovery โ†’ alpha generation โ†’ backtesting โ†’ analysis โ†’ submission,<br>
10
+ driven through BRAIN's official REST API rather than the web UI.
11
+ </p>
12
+
13
+ <p>
14
+ <a href="https://www.python.org/downloads/"><img alt="Python 3.12+" src="https://img.shields.io/badge/Python-3.12%2B-3776AB?style=for-the-badge&logo=python&logoColor=white"></a>
15
+ <a href="https://github.com/aaditya-v-more/worldquant-orchestrator/actions/workflows/tests.yml"><img alt="Tests" src="https://img.shields.io/github/actions/workflow/status/aaditya-v-more/worldquant-orchestrator/tests.yml?branch=main&style=for-the-badge&logo=githubactions&logoColor=white&label=tests"></a>
16
+ <a href="LICENSE"><img alt="MIT licence" src="https://img.shields.io/badge/Licence-MIT-22D3EE?style=for-the-badge"></a>
17
+ <img alt="One runtime dependency" src="https://img.shields.io/badge/runtime%20deps-1-34D399?style=for-the-badge">
18
+ <a href="https://github.com/aaditya-v-more/worldquant-orchestrator/stargazers"><img alt="Stars" src="https://img.shields.io/github/stars/aaditya-v-more/worldquant-orchestrator?style=for-the-badge&color=A78BFA&logo=github&logoColor=white"></a>
19
+ </p>
20
+
21
+ <p>
22
+ <a href="https://platform.worldquantbrain.com"><img alt="WorldQuant BRAIN" src="https://img.shields.io/badge/WorldQuant-BRAIN-0A2540?style=for-the-badge"></a>
23
+ <img alt="Claude Code skills" src="https://img.shields.io/badge/Claude%20Code-8%20skills-D97757?style=for-the-badge&logo=anthropic&logoColor=white">
24
+ <img alt="GitHub Copilot skills" src="https://img.shields.io/badge/Copilot-8%20skills-24292E?style=for-the-badge&logo=githubcopilot&logoColor=white">
25
+ <img alt="Qoder skills" src="https://img.shields.io/badge/Qoder-8%20skills-5B8DEF?style=for-the-badge">
26
+ </p>
27
+
28
+ <p>
29
+ <a href="#-quick-start"><b>Quick start</b></a> ยท
30
+ <a href="#-the-loop"><b>The loop</b></a> ยท
31
+ <a href="#-commands"><b>Commands</b></a> ยท
32
+ <a href="#-simulation-settings"><b>Settings</b></a> ยท
33
+ <a href="#-safety-model"><b>Safety</b></a> ยท
34
+ <a href="#-rate-limiting"><b>Rate limiting</b></a> ยท
35
+ <a href="#-reference"><b>Docs</b></a>
36
+ </p>
37
+
38
+ <br>
39
+
40
+ <img src="docs/media/demo.gif" width="760" alt="Synthetic demonstration of the research workflow, ending at the submission confirmation checkpoint">
41
+
42
+ <p><sub><b>Synthetic demonstration.</b> All expressions, identifiers and results shown are illustrative;<br>this is not a live account recording or evidence of investment performance.<br>
43
+ <a href="docs/media/demo.mp4">Full-resolution video โ†’</a> ยท <a href="docs/demo.md">Synthetic walkthrough โ†’</a></sub></p>
44
+
45
+ </div>
46
+
47
+ ---
48
+
49
+ ## โœฆ Two layers
50
+
51
+ <table>
52
+ <tr>
53
+ <td width="50%" valign="top">
54
+
55
+ ### ๐Ÿ &nbsp;`wqo/` โ€” the client
56
+
57
+ A Python library and CLI for BRAIN's REST API. Authentication, pacing, a SQLite
58
+ audit ledger, backtesting, gating, mining. **Usable entirely on its own** โ€” no
59
+ agent required.
60
+
61
+ </td>
62
+ <td width="50%" valign="top">
63
+
64
+ ### ๐Ÿค– &nbsp;`.claude/skills/` โ€” the skills
65
+
66
+ Eight thin wrappers that teach an agent *when* and *how* to invoke each part, so
67
+ "find me an alpha on analyst estimates" becomes real API calls. Symlinked for
68
+ Copilot and Qoder.
69
+
70
+ </td>
71
+ </tr>
72
+ </table>
73
+
74
+ ---
75
+
76
+ ## ๐Ÿ”„ The loop
77
+
78
+ ```mermaid
79
+ flowchart LR
80
+ A(["๐Ÿ”‘ auth"]) --> B(["๐Ÿ—‚๏ธ data"])
81
+ B --> C(["โ›๏ธ mine"])
82
+ C --> D(["๐Ÿ“Š analyze"])
83
+ D --> E{"๐Ÿšฆ gate"}
84
+ E -->|blocked| C
85
+ E -->|clean| F(["๐Ÿง‘ your call"])
86
+ F --> G(["๐Ÿš€ submit"])
87
+
88
+ classDef step fill:#0D1425,stroke:#5B8DEF,stroke-width:2px,color:#E6EDF3
89
+ classDef check fill:#0D1425,stroke:#A78BFA,stroke-width:2px,color:#E6EDF3
90
+ classDef human fill:#0D1425,stroke:#34D399,stroke-width:2px,color:#E6EDF3
91
+ class A,B,C,D,G step
92
+ class E check
93
+ class F human
94
+ ```
95
+
96
+ | Stage | Skill | What it does |
97
+ |---|---|---|
98
+ | ๐Ÿ”‘ | [`wq-auth`](.claude/skills/wq-auth) | Session, quotas, level, biometric handoff |
99
+ | ๐Ÿ—‚๏ธ | [`wq-data`](.claude/skills/wq-data) | Datasets, datafields, operators โ€” cached 7 days |
100
+ | โ›๏ธ | [`wq-mine`](.claude/skills/wq-mine) | Generate candidates, backtest in batch, rank survivors |
101
+ | ๐Ÿ”ฌ | [`wq-simulate`](.claude/skills/wq-simulate) | One expression, or a sweep over settings and fields |
102
+ | ๐Ÿ“Š | [`wq-analyze`](.claude/skills/wq-analyze) | IS stats, PnL, yearly breakdown, correlations, checks |
103
+ | ๐Ÿท๏ธ | [`wq-alphas`](.claude/skills/wq-alphas) | Filter and organize the library โ€” names, tags, colours |
104
+ | ๐Ÿš€ | [`wq-submit`](.claude/skills/wq-submit) | Full check report, then waits for your explicit yes |
105
+ | ๐Ÿ† | [`wq-account`](.claude/skills/wq-account) | Rank, competitions, teams, events, standing |
106
+
107
+ ---
108
+
109
+ ## โšก Quick start
110
+
111
+ ```bash
112
+ uv tool install --python 3.12 wqo
113
+ wqo --version
114
+ ```
115
+
116
+ Python 3.12+; macOS and Linux. See [installation, upgrades and existing-ledger
117
+ migration](docs/installation.md). No manual clone is required. The first PyPI
118
+ release is being prepared; the command above becomes available after publication.
119
+
120
+ Create your credentials file in a text editor โ€” nothing in this repo will write it.
121
+ Use this JSON format and keep the password out of shell history:
122
+
123
+ ```json
124
+ {"email": "you@example.com", "password": "..."}
125
+ ```
126
+
127
+ ```bash
128
+ chmod 600 ~/.brain_credentials.json
129
+ ```
130
+
131
+ Then:
132
+
133
+ ```bash
134
+ wqo auth status
135
+ ```
136
+
137
+ > [!IMPORTANT]
138
+ > **First login on a new account.** BRAIN usually requires a Persona biometric
139
+ > check the first time an account authenticates through the API. The command
140
+ > exits with code `2` and prints a URL. Open it in a browser, complete the check,
141
+ > then run `wqo auth persona`.
142
+ > This is a human step by design โ€” nothing here bypasses it.
143
+
144
+ ---
145
+
146
+ ## ๐Ÿ›  Commands
147
+
148
+ Everything prints JSON to stdout. `gate` and `submit` also render a table unless
149
+ `--json` is passed.
150
+
151
+ ```bash
152
+ # โ”€โ”€ account โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
153
+ python -m wqo auth login | status | persona | logout
154
+
155
+ # โ”€โ”€ data discovery (locally cached for 7 days) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
156
+ python -m wqo data datasets --region USA --delay 1 --universe TOP3000
157
+ python -m wqo data fields --dataset fundamental6 --search revenue
158
+ python -m wqo data operators
159
+
160
+ # โ”€โ”€ backtesting โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
161
+ python -m wqo sim run --code "-ts_delta(ts_backfill(close, 60), 5)"
162
+ python -m wqo sim run --code "rank(close)" --neutralization NONE --test-period 1y
163
+ python -m wqo sim batch --file ideas.json
164
+ python -m wqo sim recent
165
+
166
+ # โ”€โ”€ analysis โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
167
+ python -m wqo alpha get|pnl|yearly <alpha_id>
168
+ python -m wqo alpha corr <alpha_id> [--prod]
169
+ python -m wqo alpha list --status UNSUBMITTED --min-sharpe 1.25
170
+ python -m wqo alpha list --grade EXCELLENT
171
+ python -m wqo alpha tag <alpha_id> --name "..." --color GREEN --tags a,b
172
+
173
+ # โ”€โ”€ submission โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
174
+ python -m wqo gate <alpha_id> # read-only report
175
+ python -m wqo submit <alpha_id> # report only, refuses to submit
176
+ python -m wqo submit <alpha_id> --confirm # actually submits
177
+
178
+ # โ”€โ”€ mining โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
179
+ python -m wqo mine --dataset fundamental6 --budget 40 [--dry-run]
180
+
181
+ # โ”€โ”€ competitions, standing, team, learn, notifications โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
182
+ python -m wqo account status # rank, score, level progress
183
+ python -m wqo account competitions [--mine]
184
+ python -m wqo account competition IQC2026S1 [--alphas|--agreement]
185
+ python -m wqo account activity # counters + referrals
186
+ python -m wqo account teams|events|tutorials|messages|agreements
187
+ python -m wqo account probe # what this level can reach
188
+
189
+ # โ”€โ”€ anything not wrapped above โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
190
+ python -m wqo api GET /users/self/activities
191
+ python -m wqo discover
192
+ ```
193
+
194
+ <table>
195
+ <tr>
196
+ <th align="left">Exit code</th><th align="left">Meaning</th>
197
+ </tr>
198
+ <tr><td><code>0</code></td><td>success</td></tr>
199
+ <tr><td><code>1</code></td><td>generic error, or gate blocked</td></tr>
200
+ <tr><td><code>2</code></td><td>auth required / biometric pending</td></tr>
201
+ <tr><td><code>3</code></td><td>daily budget exhausted</td></tr>
202
+ <tr><td><code>4</code></td><td>submission refused</td></tr>
203
+ </table>
204
+
205
+ ---
206
+
207
+ ## โš™๏ธ Simulation settings
208
+
209
+ Every field the web UI's settings panel exposes is a flag on `sim run`,
210
+ `sim batch` and `mine`, defaulting to `DEFAULT_SETTINGS` in
211
+ [`wqo/config.py`](wqo/config.py):
212
+
213
+ | UI field | Flag | Default |
214
+ |---|---|---|
215
+ | Language | *fixed* โ€” `FASTEXPR` | |
216
+ | Instrument Type | `--instrument-type` | `EQUITY` |
217
+ | Region | `--region` | `USA` |
218
+ | Universe | `--universe` | `TOP3000` |
219
+ | Delay | `--delay` | `1` |
220
+ | Neutralization | `--neutralization` | `SUBINDUSTRY` |
221
+ | Decay | `--decay` | `6` |
222
+ | Truncation | `--truncation` | `0.08` |
223
+ | Pasteurization | `--pasteurization` | `ON` |
224
+ | Unit Handling | `--unit-handling` | `VERIFY` |
225
+ | Nan Handling | `--nan-handling` | `OFF` |
226
+ | Test period | `--test-period` | none (`P0Y0M`) |
227
+
228
+ `--test-period` takes `1y`, `6m`, `1y6m` or the ISO form `P1Y6M`; anything else
229
+ is rejected rather than silently backtesting over the wrong window.
230
+
231
+ > [!NOTE]
232
+ > On `mine`, `--decay` and `--truncation` are unset by default so each template
233
+ > runs under the regime it declares (`config.REGIMES`). Pass them to pin one
234
+ > knob, or `--neutralizations` to sweep โ€” a sweep multiplies jobs without adding
235
+ > expressions, and `--budget` caps the total.
236
+
237
+ ---
238
+
239
+ ## ๐Ÿ… Alpha grade
240
+
241
+ Alpha records carry a `grade` BRAIN computes itself:
242
+
243
+ <div align="center">
244
+
245
+ ![INFERIOR](https://img.shields.io/badge/INFERIOR-6B7280?style=flat-square) โ–ธ
246
+ ![AVERAGE](https://img.shields.io/badge/AVERAGE-5B8DEF?style=flat-square) โ–ธ
247
+ ![GOOD](https://img.shields.io/badge/GOOD-22D3EE?style=flat-square) โ–ธ
248
+ ![EXCELLENT](https://img.shields.io/badge/EXCELLENT-34D399?style=flat-square) โ–ธ
249
+ ![SPECTACULAR](https://img.shields.io/badge/SPECTACULAR-A78BFA?style=flat-square)
250
+
251
+ </div>
252
+
253
+ It comes free on the record, so `sim run`, `mine` and `gate` all report it, and
254
+ `alpha list --grade EXCELLENT` filters on it. It is read-only and purely
255
+ informational โ€” `is.checks` plus the local thresholds are what decide whether an
256
+ alpha may be submitted.
257
+
258
+ ---
259
+
260
+ ## ๐Ÿ”’ Safety model
261
+
262
+ > [!WARNING]
263
+ > **Submission is the only irreversible action, and it is deliberately awkward.**
264
+ > It consumes a daily quota of 3 and permanently affects future self-correlation.
265
+
266
+ - `submit` without `--confirm` **cannot** submit. It prints the check report and
267
+ exits `4`.
268
+ - With `--confirm` but a failing gate, it still refuses unless `--force`.
269
+ - Submission quota is reserved atomically before the request; unresolved writes
270
+ retain their reservation and cannot be retried through `submit`.
271
+ - Raw `api` is read-only. Writes are never automatically replayed.
272
+ - Processes sharing one ledger share simulation slots and quota accounting.
273
+
274
+ See [safety controls and limits](docs/safety.md), including the conservative
275
+ submission window and how to handle uncertain outcomes.
276
+
277
+ Credentials are read directly from disk into HTTP Basic auth. They are never
278
+ logged, echoed, or written by this tool.
279
+
280
+ ---
281
+
282
+ ## ๐Ÿ“ก Rate limiting
283
+
284
+ This uses the official API, which is the sanctioned integration path โ€” but it
285
+ behaves like a good client rather than hammering the endpoint:
286
+
287
+ - **`Retry-After` governs read retries and polling**, including simulation progress,
288
+ checks and correlations. A throttled write stops without an automatic replay.
289
+ - Minimum interval plus jitter between all requests.
290
+ - Exponential backoff with full jitter on read requests receiving 429/5xx.
291
+ - **Concurrency is *learned* from the account:** it starts at 1 slot, grows only
292
+ after clean runs, and shrinks immediately on a 429. Persisted between runs.
293
+ - The session cookie is cached on disk and reused. Re-authenticating on every
294
+ invocation is both slow and the most abnormal traffic pattern a client can
295
+ produce.
296
+ - Local daily budgets on simulations and submissions.
297
+
298
+ Tunable via environment variables โ€” `WQO_MIN_INTERVAL`, `WQO_JITTER`,
299
+ `WQO_SIM_BUDGET`, `WQO_SUBMIT_BUDGET`, `WQO_MAX_CONCURRENCY`, and the
300
+ `WQO_MIN_SHARPE` / `WQO_MAX_TURNOVER` style gate thresholds. See
301
+ [`wqo/config.py`](wqo/config.py).
302
+
303
+ ---
304
+
305
+ ## ๐Ÿงฉ Editor support
306
+
307
+ The eight skills live in `.claude/skills/` and are symlinked so other agents pick
308
+ up the same files โ€” **edit once, every tool sees it**:
309
+
310
+ ```
311
+ .github/skills -> ../.claude/skills # GitHub Copilot (VS Code, CLI, cloud agent)
312
+ .qoder/skills -> ../.claude/skills # Qoder
313
+ ```
314
+
315
+ Both use the same `SKILL.md` + YAML frontmatter format, so no conversion is
316
+ needed. Copilot also reads `.claude/skills` directly; the `.github/skills` link
317
+ is there so the intent is explicit and the CLI and cloud agent resolve it too.
318
+
319
+ > [!TIP]
320
+ > These are relative symlinks and survive a clone on macOS and Linux. On Windows,
321
+ > git needs `core.symlinks=true` and Developer Mode, otherwise they land as plain
322
+ > text files โ€” copy the directories instead if that comes up.
323
+
324
+ ---
325
+
326
+ ## ๐Ÿ“š Reference
327
+
328
+ **Agents start here:** [`AGENTS.md`](AGENTS.md) โ€” setup, hard rules, account
329
+ constraints, workflow, exit codes. `CLAUDE.md` is a symlink to it, so Claude
330
+ Code, Copilot, Cursor, Qoder and OpenCode all read one source of truth.
331
+
332
+ | Document | Contents |
333
+ |---|---|
334
+ | [`docs/fastexpr.md`](docs/fastexpr.md) | FASTEXPR syntax constraints, the operator set actually available at this account level, and the `pv1` field list |
335
+ | [`docs/alpha-research.md`](docs/alpha-research.md) | Passing criteria, the fitness formula, proven expression patterns, and a symptom โ†’ fix table |
336
+ | [`docs/api-map.md`](docs/api-map.md) | Every website tab mapped to its endpoint, plus what is *not* available |
337
+
338
+ `docs/alpha-research.md` is distilled from *Quantitative Alpha Research:
339
+ WorldQuant BRAIN*. The gate thresholds and mining templates are derived from it;
340
+ where it conflicts with BRAIN's own `/check`, BRAIN wins.
341
+
342
+ > [!CAUTION]
343
+ > There is **no leaderboard endpoint**. `GET /alphas` is `405` and
344
+ > `/leaderboards` is `404`: you can read your own rank, never other people's
345
+ > alphas. This is deliberate โ€” alphas are contributor IP.
346
+
347
+ <details>
348
+ <summary><b>๐Ÿ“ Repository layout</b></summary>
349
+
350
+ <br>
351
+
352
+ ```
353
+ docs/
354
+ alpha-research.md distilled research reference
355
+ api-map.md tab -> endpoint map, and what is unavailable
356
+ fastexpr.md expression syntax and operator availability
357
+ wqo/
358
+ endpoints.py API URLs
359
+ config.py paths, pacing, budgets, gate thresholds
360
+ session.py authenticated session, cookie persistence, Persona handoff
361
+ pacing.py interval throttle, Retry-After, backoff
362
+ store.py SQLite ledger (audit trail + budget accounting)
363
+ catalog.py datasets / datafields / operators, cached
364
+ simulate.py submit, poll, normalize; adaptive slot manager
365
+ alphas.py records, PnL, yearly stats, correlations, properties
366
+ gate.py local thresholds + BRAIN checks -> PASS/FAIL report
367
+ submit.py confirmation-gated submission
368
+ mining/ templates, candidate generation, ranking
369
+ account.py competitions, standing, team, learn, notifications
370
+ __main__.py CLI
371
+ ```
372
+
373
+ </details>
374
+
375
+ ---
376
+
377
+ ## ๐Ÿงช Tests
378
+
379
+ ```bash
380
+ .venv/bin/python -m pytest tests -q
381
+ ```
382
+
383
+ Offline only โ€” no network, no credentials. Covers backoff and `Retry-After`
384
+ parsing, ledger and budget accounting, gate threshold logic, correlation
385
+ parsing, slot adaptation, template expansion, and ranking.
386
+
387
+ ---
388
+
389
+ <div align="center">
390
+
391
+ **[Contributing](CONTRIBUTING.md)** ยท **[Code of conduct](CODE_OF_CONDUCT.md)** ยท **[Security](SECURITY.md)** ยท **[Licence](LICENSE)**
392
+
393
+ <sub>MIT licensed. Not affiliated with or endorsed by WorldQuant.<br>
394
+ Alpha expressions are sent to BRAIN for simulation; local ledgers and account statistics should stay out of Git โ€” see <a href="CONTRIBUTING.md">CONTRIBUTING.md</a>.</sub>
395
+
396
+ <br>
397
+
398
+ <a href="#top">โ†‘ Back to top</a>
399
+
400
+ </div>
@@ -0,0 +1,90 @@
1
+ # Install and upgrade WQO
2
+
3
+ WQO requires Python 3.12+ and supports macOS and Linux. The package, import and
4
+ command names are all `wqo`. Windows simulation support is not yet available.
5
+
6
+ ## Install the command
7
+
8
+ [Install uv](https://docs.astral.sh/uv/getting-started/installation/) if `uv --version`
9
+ is unavailable, then install WQO in its own isolated tool environment:
10
+
11
+ ```bash
12
+ uv tool install --python 3.12 wqo
13
+ wqo --version
14
+ wqo --help
15
+ ```
16
+
17
+ uv can provision the requested Python version. If the installed command is not
18
+ on PATH, run `uv tool update-shell` and open a new terminal. Commands work from
19
+ any directory; there is no repository checkout or local `.venv` requirement.
20
+
21
+ If you already have Python 3.12+ and pipx:
22
+
23
+ ```bash
24
+ pipx install --python python3.12 wqo
25
+ ```
26
+
27
+ For Python-library use, install `wqo` with pip into your project's virtual
28
+ environment. `python -m wqo` and the `wqo` command expose the same interface.
29
+
30
+ ## Existing users: preserve your ledger first
31
+
32
+ Stop other WQO processes before switching installations. The ledger records
33
+ quotas, previous submissions and unresolved actions; keep it across upgrades.
34
+
35
+ The new default is `$XDG_DATA_HOME/wqo` when XDG_DATA_HOME is absolute, otherwise
36
+ `~/.local/share/wqo`. It is independent of the checkout and installation path.
37
+ `wqo state` shows the selected paths without contacting BRAIN or creating state.
38
+
39
+ ```bash
40
+ wqo state --migrate-from /absolute/path/to/old-checkout/data
41
+ ```
42
+
43
+ This copies the ledger, catalog, pending Persona state and log to the new default
44
+ using SQLite backups and private permissions. It keeps the original files,
45
+ refuses an existing destination and refuses recorded simulation permits. Resolve
46
+ any remaining permits before migrating. Candidate batches and provenance files
47
+ remain wherever you saved them; this migration does not move those directories.
48
+
49
+ To retain an existing location instead, set `WQO_DATA_DIR` to its absolute path
50
+ in your shell and agent environment. Use the same location in every installation;
51
+ do not alternate between divergent ledger copies. Credentials and session-cookie
52
+ paths remain unchanged at `~/.brain_credentials.json` and `~/.brain_session.json`;
53
+ `WQO_CREDENTIALS` and `WQO_SESSION` remain supported.
54
+
55
+ ## Verify and upgrade
56
+
57
+ ```bash
58
+ wqo --version
59
+ wqo state
60
+ wqo auth status
61
+ uv tool upgrade wqo
62
+ ```
63
+
64
+ For pipx, use `pipx upgrade wqo`. To install a specific supported release, use
65
+ `uv tool install --python 3.12 'wqo==0.1.0'`. Package removal does not remove your
66
+ ledger or credentials. Keep state backups before changing versions.
67
+
68
+ A missing CLI can be installed automatically by a future core skill using this
69
+ flow: detect `wqo`, check its version, check `uv`, install the published package
70
+ if absent, verify `wqo --version`, then perform auth onboarding. Skill distribution
71
+ is a separate launch task; it is not bundled into the Python installation.
72
+
73
+ ## Build and publish from source
74
+
75
+ From the repository root:
76
+
77
+ ```bash
78
+ uv venv --python 3.12 .venv
79
+ uv pip install --python .venv/bin/python -r requirements-dev.txt
80
+ .venv/bin/python -m pytest tests -q
81
+ .venv/bin/python -m build
82
+ .venv/bin/python -m twine check --strict dist/*
83
+ .venv/bin/python scripts/check_dist.py dist
84
+ ```
85
+
86
+ After installing and testing both archives in clean environments, publish the
87
+ reviewed files using `uv publish` or `python -m twine upload`. Configure your PyPI
88
+ API token locally or use PyPI trusted publishing; never place credentials in Git
89
+ or paste them into issues/chat. A missing public PyPI project does not reserve
90
+ its name; the first successful upload establishes ownership.