Add JoinQuant browser backtest automation
This commit is contained in:
@@ -238,6 +238,65 @@ The command downloads a tiny public daily-bar sample, builds a fixed-share
|
||||
JoinQuant target files, writes a configured wrapper strategy, and creates
|
||||
`joinquant_smoke_manifest.json` with all output paths.
|
||||
|
||||
## Browser Backtest Automation
|
||||
|
||||
JoinQuant's public `jqdatasdk` is a data SDK. It supports authenticated data
|
||||
calls such as `auth(username, password)` and `get_price(...)`, but cloud
|
||||
strategy upload, backtest execution, and result export are web-application
|
||||
workflows. The plugin therefore automates those remote steps through Playwright
|
||||
with a saved browser session.
|
||||
|
||||
Install the optional browser runner in the uv environment:
|
||||
|
||||
```bash
|
||||
uv sync --extra joinquant-browser
|
||||
uv run playwright install chromium
|
||||
```
|
||||
|
||||
Save a reusable login state. This opens a browser; log in normally, including
|
||||
any CAPTCHA or 2FA, then press Enter in the terminal to save state:
|
||||
|
||||
```bash
|
||||
uv run python cli.py joinquant browser-login \
|
||||
--storage-state ~/.config/chinese-equity-quant/joinquant_storage_state.json
|
||||
```
|
||||
|
||||
Create a selector/action config:
|
||||
|
||||
```bash
|
||||
uv run python cli.py joinquant write-browser-config \
|
||||
--out-path /tmp/chinese-equity-quant-realdata/joinquant_browser_config.json \
|
||||
--strategy-url "https://www.joinquant.com/<your strategy page>"
|
||||
```
|
||||
|
||||
If selectors need tuning, capture the logged-in page:
|
||||
|
||||
```bash
|
||||
uv run python cli.py joinquant browser-snapshot \
|
||||
--url "https://www.joinquant.com/<your strategy page>" \
|
||||
--out-dir /tmp/chinese-equity-quant-realdata/browser_snapshot
|
||||
```
|
||||
|
||||
Then run the remote backtest automation:
|
||||
|
||||
```bash
|
||||
uv run python cli.py joinquant run-browser-backtest \
|
||||
--manifest-path /tmp/chinese-equity-quant-realdata/joinquant_smoke_manifest.json \
|
||||
--config-path /tmp/chinese-equity-quant-realdata/joinquant_browser_config.json \
|
||||
--storage-state ~/.config/chinese-equity-quant/joinquant_storage_state.json \
|
||||
--headed
|
||||
```
|
||||
|
||||
The config is declarative: actions can navigate, paste the generated wrapper,
|
||||
upload all target CSV files, fill dates, click run, wait for completion,
|
||||
download result CSVs, and take screenshots. When the configured downloads
|
||||
produce fills, positions, and PnL CSVs, the runner automatically calls
|
||||
`joinquant ingest` and `joinquant reconcile`.
|
||||
|
||||
Do not store raw JoinQuant passwords in this repository. The browser state file
|
||||
is created with `0600` permissions and should live under `~/.config`, outside
|
||||
the repo.
|
||||
|
||||
## Recommended First Sanity Checks
|
||||
|
||||
1. One liquid stock with a fixed target share count.
|
||||
|
||||
Reference in New Issue
Block a user