Skip to content
untuitivistPublic

About

No description, website, or topics provided.

Resources

Stars

55 stars

Watchers

0 watching

Forks

Repository files navigation

wqb-cli

Version 0.6.3 adds native updates: wqb upgrade --check, wqb upgrade and wqb upgrade --version 0.6.3. Releases are checksum-verified and installed into the running Python environment. See Upgrade.

Version 0.6.2 adds native official Help Center article discovery and reading: wqb help-center search Themes and wqb help-center get 38927747787031. It reuses community SSO and preserves article HTML, update timestamps and pagination; no browser interaction or temporary authenticated script is needed. See Help Center commands.

Optional Delay 1 tower balancing allocates compatible batches by Region × Category expression counts, including AMR and ALL, while preserving the default random scheduler for runs that do not opt in.

Community login and cached-session validation now use the Zendesk current-user JSON API. sqlitecom sync does not load an HTML landing page: a help-center page challenge must not reject an otherwise authenticated API session. Write-specific API CSRF comes from the verified current-user response. Image registration accepts an explicit verified --brand-id; HTML brand lookup is needed only without it.

Community sessions now persist across CLI invocations in the private local auth directory. Cookies retain their original domain/path/expiry, are isolated by account/configuration, and are checked against the saved forum user before reuse. Expired sessions renew automatically; stale processes cannot overwrite newer sessions. wqb community auth reports the session cache outcome without secrets.

Community authentication diagnostics: wqb community auth validates or renews the normal BRAIN-to-Zendesk SSO session. Expired read sessions are refreshed once; rate limits honor a bounded Retry-After wait. A browser_verification_required error identifies a Cloudflare challenge, not bad credentials. The CLI does not solve browser challenges or replay forum writes. Browser login alone may not restore CLI access; contact platform support if the API client remains challenged.

wqb-cli logo

English | 简体中文

wqb-cli is an agent-native command line toolkit for working with the WorldQuant BRAIN API and local research data.

It is built for coding agents and long-running research agents first, not as a thin human-only wrapper. Commands produce structured JSON, preserve raw API context, wait for asynchronous platform results, and fit naturally into repeatable research workflows: authentication, API discovery, alpha listing and inspection, simulation execution, Alpha submission checks, local data_all screening, and community-data search.

Main Commands

The direct simulation command is wqb simu. Use the following entry points in examples and scripts for version 0.6.2:

Command Purpose
wqb simu Create, inspect, and wait for Regular, Super, and ALL simulations.
wqb sqlitesimu Queue candidates in SQLite, execute batches, recover runs, and export results.
wqb community Read/search the forum and publish HTML posts with local images.
wqb help-center Discover and read official articles, including Theme/PPA calendars, using community SSO.
wqb sqlitecom Incrementally sync the forum, search local content, and run read-only SQL.

For simulation settings and request previews, start with wqb simu options and wqb simu create --help. See Command Overview for the complete command tree and examples below for request formats.

Agent-Native Design

wqb-cli is designed so an agent can operate it safely and inspectably without relying on browser state or manual clicking:

  • Structured command outputs that can be saved with --output and consumed by later workflow nodes.
  • Explicit wait semantics for simulations, submit checks, alpha checks, recordsets, and other asynchronous API results.
  • Bundled API inventory and command docs so agents can inspect available endpoints locally.
  • Two isolated workflow document sets under workflows/, with clear inputs, allowed commands, required outputs, and success criteria.
  • Local data commands that read stable files under local/ instead of scraping browser/plugin caches directly.
  • Raw request and response context preserved in command output, including status codes, parameters, locations, retry events, and result bodies.
  • simu create and online community requests support explicit --dry-run previews without authentication or HTTP calls.

What This Tool Provides

  • API commands for https://api.worldquantbrain.com.
  • Auth helpers that store cookies locally.
  • Simulation commands for REGULAR FASTEXPR, REGULAR PYTHON, SUPER and REGION_AGNOSTIC/ALL backtests.
  • Alpha commands for listing, checking, recordsets, correlations, and submit workflows.
  • Local data commands for data_all / all_data.pickle screening.
  • Online community access, SQLite incremental sync, local imports, search, and read-only SQL.
  • Bundled endpoint inventory and command documentation.
  • Workflow documents for bounded adaptive simulations and durable template-family batches under workflows/.

Important Notes

  • This project is not affiliated with WorldQuant or WorldQuant BRAIN.
  • Mutating commands send real API requests unless a supported --dry-run option is supplied. Check the command's help before running it.
  • Commands that need asynchronous results wait for completion or fail on timeout. Simulation-style waits default to 900 seconds where applicable.
  • Local data files are intentionally not committed. Keep credentials, cookies, community exports, and data_all files under local/.
  • The license is source-available but not OSI open source because Commons Clause restricts selling the software.

Requirements

  • Python 3.11 or newer.
  • A WorldQuant BRAIN account.
  • Windows PowerShell is the primary tested shell.
  • Recommended local Conda environment: WQBRAIN.

Installation

Clone the repository:

git clone https://github.com/untuitivist/wqb_cli.git
cd wqb_cli

Install a regular runtime copy in the WQBRAIN environment:

conda activate WQBRAIN
python -m pip install .

The checkout is for development and building distributions only. Run production commands from a separate research workspace with WQBRAIN activated, not through the checkout or a development-directory PYTHONPATH. Editable installs belong in a separate development environment, never in the WQBRAIN runtime environment.

Confirm the installed CLI is available from your research workspace:

wqb --help
wqb auth status

If wqb is not on PATH, use the activated environment's installed module from the research workspace:

python -I -m wqb_cli --help

Command Overview

The built-in commands below are arranged by use case while preserving the actual parser names and hierarchy. Additional installed plugins may expose more commands. <...> marks required positional arguments and [...] marks optional ones. Named options are omitted from the tree; inspect them with --help at each level.

wqb  # WorldQuant BRAIN command-line toolkit
├─ simu                                                          # Create, inspect, and wait for platform simulations
├─ sqlitesimu                                                    # Durable batch simulation engine backed by local SQLite
├─ alpha                                                         # Inspect, analyze, modify, and formally submit Alphas
├─ data                                                          # Explore platform datasets, fields, and operators
├─ auth                                                          # Manage login and authentication sessions
├─ user                                                          # Inspect current-user and user-specific profiles and activity
├─ account                                                       # Access email, password, and account-token workflows
├─ consultant                                                    # Explore consultant information, programs, and guidance
├─ competition                                                   # Explore competitions, rules, rankings, and SPC submissions
├─ event                                                         # Explore platform events
├─ platform                                                      # Explore platform-wide information and resources
├─ tutorial                                                      # Explore platform tutorial content
├─ suggest                                                       # Request platform suggestions using GET or POST
├─ search <query>                                                # Search the platform globally; no subcommands
├─ community                 # Online forum topics, posts, comments, search and raw API
├─ help-center               # Official Help Center articles, search, categories, sections and read-only API
├─ sqlitecom                 # Local community database, incremental sync, imports and read-only SQL
├─ scope                                                         # Inspect local historical research data by REGION_DELAY
├─ shortcut (alias: quick)                                       # Run common combined operations
├─ config                                                        # Manage local configuration and inspect platform settings
├─ docs                                                          # Discover bundled CLI documentation
├─ api                                                           # Inspect the local API registry and call registered endpoints
└─ errors                                                        # Access the platform error-reporting endpoint
Expand the complete command tree
wqb  # WorldQuant BRAIN command-line toolkit
├─ simu                                                          # Create, inspect, and wait for platform simulations
│  ├─ options                                                    # Inspect available simulation settings
│  ├─ list                                                       # List simulations
│  ├─ get <simulation_id>                                        # Read simulation status or results with retry waits
│  ├─ create                                                     # Create a simulation from --input and wait for results
│  └─ super-selection                                            # Query or invoke Super Alpha selection simulations
├─ sqlitesimu                                                    # Durable batch simulation engine backed by local SQLite
│  ├─ init                                                       # Initialize the simulation database
│  ├─ enqueue <input>                                            # Validate and enqueue a manifest without executing it
│  ├─ run <input>                                                # Enqueue and execute a manifest with durable concurrent workers
│  ├─ resume <run_id>                                            # Resume unfinished work in an existing run
│  ├─ status [run_id]                                            # Inspect one run or recent runs
│  ├─ cancel <run_id>                                            # Cancel a local run while preserving its history
│  ├─ export <run_id>                                            # Export metrics, checks, dated PnL paths, and experiment records
│  ├─ template-validate <input>                                  # Validate template format, metadata, and candidate lineage
│  └─ template-report <input>                                    # Build template analysis reports from a run export
├─ alpha                                                         # Inspect, analyze, modify, and formally submit Alphas
│  ├─ get <alpha_id>                                             # Get Alpha details
│  ├─ list                                                       # List your Alphas with filters and sorting
│  ├─ distribution                                               # Query Alpha distribution information
│  ├─ lists                                                      # Query platform Alpha list information
│  ├─ super-selection                                            # Query Super Alpha selection information
│  ├─ unsubmitted                                                # Query unsubmitted Alpha information
│  ├─ walkthrough                                                # Read the sample Alpha walkthrough
│  ├─ all                                                        # List visible Alphas through the /alphas endpoint
│  ├─ check <alpha_id>                                           # Fetch platform checks and wait for asynchronous results
│  ├─ recordsets <alpha_id>                                      # List available Alpha recordsets
│  ├─ related <alpha_id>                                         # Query related Alphas
│  ├─ recordset <alpha_id> <name>                                # Read a named recordset such as pnl or turnover
│  ├─ pnl <alpha_id>                                             # Read the PnL series
│  ├─ sharpe <alpha_id>                                          # Read the Sharpe series
│  ├─ yearly-stats <alpha_id>                                    # Read yearly statistics
│  ├─ patch <alpha_id>                                           # Update Alpha properties from --input
│  ├─ submit <alpha_id>                                          # Formally submit an Alpha and handle submission waits
│  ├─ correlation                                                # Query Alpha correlations
│  │  ├─ self <alpha_id>                                         # Query self-correlation results
│  │  ├─ base <alpha_id>                                         # Query the base correlations endpoint
│  │  ├─ prod <alpha_id>                                         # Query production-pool correlations
│  │  └─ power-pool <alpha_id>                                   # Query Power Pool correlations
│  └─ performance-comparison <alpha_id>                          # Query performance comparisons
├─ data                                                          # Explore platform datasets, fields, and operators
│  ├─ categories                                                 # List data categories
│  ├─ datasets                                                   # List datasets
│  ├─ dataset <dataset_id>                                       # Get dataset details
│  ├─ fields                                                     # List data fields with filters
│  ├─ fields-summary                                             # Query field summaries
│  ├─ dataset-search                                             # Search datasets using GET or POST
│  ├─ field <field_id>                                           # Get field details
│  └─ operators                                                  # List platform operators
├─ auth                                                          # Manage login and authentication sessions
│  ├─ status                                                     # Query authentication status
│  ├─ head                                                       # Check the authentication endpoint with HEAD
│  ├─ login                                                      # Log in and save authenticated session cookies
│  ├─ logout                                                     # Log out of the platform session
│  ├─ brainlabs                                                  # Call the BrainLabs authentication endpoint
│  ├─ persona                                                    # Call the Persona authentication endpoint
│  ├─ support                                                    # Call the support authentication endpoint
│  └─ workday                                                    # Call the Workday authentication endpoint
├─ user                                                          # Inspect current-user and user-specific profiles and activity
│  ├─ activity <activity_name>                                   # Named activity history
│  ├─ osmosis-summary                                            # Osmosis allocation summary
│  ├─ osmosis-scale-status                                       # Osmosis scaling progress
│  ├─ streak                                                     # Activity streak history
│  ├─ tags                                                       # Current user tags and lists
│  ├─ submission-activity                                        # Submission activity history
│  ├─ self                                                       # Get your user profile
│  ├─ consultant-summary                                         # Get your consultant summary
│  ├─ messages                                                   # List your messages with filters and pagination
│  ├─ list                                                       # List users
│  ├─ achievements                                               # List your achievements
│  ├─ simulation-activity                                        # Query your simulation activity
│  ├─ pyramid-alphas                                             # Query your pyramid Alpha activity over a date range
│  ├─ pyramid-multipliers                                        # Query your pyramid multipliers over a date range
│  ├─ agreements                                                 # Query your agreements
│  ├─ alphas-summary                                             # Get your Alpha summary
│  ├─ messages-summary                                           # Get your message summary
│  ├─ pyramid-alpha-summary                                      # Get your pyramid Alpha summary
│  ├─ teams                                                      # List your teams
│  ├─ tutorial-steps                                             # Query your tutorial steps
│  ├─ tutorial-summary                                           # Get your tutorial progress summary
│  ├─ consultant-tutorial-summary                                # Get your consultant tutorial progress
│  ├─ consultant-tutorial-patch                                  # Update your consultant tutorial progress
│  ├─ get <user_id>                                              # Get a user profile
│  ├─ user-achievements <user_id>                                # Query a user's achievements
│  ├─ user-activities <user_id>                                  # Query a user's activity
│  ├─ user-diversity <user_id>                                   # Query diversity by region, delay, and data category
│  ├─ user-alphas-options <user_id>                              # Inspect user Alpha endpoint options, not Alpha rows
│  ├─ user-competitions <user_id>                                # Query a user's competitions
│  └─ user-simulation-settings <user_id>                         # Query a user's simulation settings
├─ account                                                       # Access email, password, and account-token workflows
│  ├─ email-change                                               # Email change workflow using GET or POST
│  ├─ email-reverify                                             # Email reverification workflow using GET or POST
│  ├─ email-verify                                               # Email verification workflow using GET or POST
│  ├─ password-change                                            # Password change workflow using GET or POST
│  ├─ password-forgot                                            # Forgot-password workflow using GET or POST
│  ├─ password-reset                                             # Password reset workflow using GET or POST
│  └─ token                                                      # Account token endpoint using GET or POST
├─ consultant                                                    # Explore consultant information, programs, and guidance
│  ├─ get                                                        # Query consultant information
│  ├─ summary                                                    # Query the consultant summary
│  ├─ datasets                                                   # List consultant datasets
│  ├─ dos-and-donts                                              # Read consultant dos and don'ts
│  ├─ faqs                                                       # Read consultant FAQs
│  ├─ osmosis-guide                                              # Read the Osmosis allocation guide
│  ├─ visualization-tool                                         # Read visualization tool information
│  ├─ program                                                    # Read consultant program information
│  ├─ program-language <language>                                # Read consultant program content by language
│  └─ boards                                                     # Explore consultant boards
│     └─ leader                                                  # Query the consultant leaderboard
├─ competition                                                   # Explore competitions, rules, rankings, and SPC submissions
│  ├─ list                                                       # List competitions
│  ├─ get <competition_id>                                       # Get competition details
│  ├─ agreement <competition_id>                                 # Read or submit a competition agreement
│  ├─ leaderboard <identifier>                                   # Query competition or consultant leaderboards and options
│  ├─ guidelines <competition_id>                                # Read competition guidelines through the agreement endpoint
│  ├─ faq <competition_id>                                       # Read the FAQ URL from competition details
│  └─ spc                                                        # Manage SPC prompt submissions
│     ├─ submissions                                             # List SPC submissions
│     ├─ submission-history <submission_id>                      # Read a submission's history
│     ├─ submission-options [submission_id]                      # Inspect submission collection or item options
│     ├─ create-submission                                       # Create an SPC submission
│     └─ update-submission <submission_id>                       # Update an SPC submission
├─ event                                                         # Explore platform events
│  ├─ list                                                       # List events
│  ├─ options                                                    # Inspect event endpoint options
│  └─ get <event_id>                                             # Get event details
├─ platform                                                      # Explore platform-wide information and resources
│  ├─ achievements                                               # List platform achievement definitions
│  ├─ agreements                                                 # Query platform agreements
│  ├─ captcha                                                    # Call the CAPTCHA endpoint
│  ├─ messages                                                   # Query platform messages
│  ├─ tags                                                       # List tags
│  ├─ teams                                                      # List teams
│  ├─ video-courses                                              # List video courses
│  ├─ achievement-icon <achievement_id>                          # Get the achievement icon endpoint response
│  └─ competition-level-icon <competition_level_id>              # Get the competition-level icon endpoint response
├─ tutorial                                                      # Explore platform tutorial content
│  ├─ list                                                       # List tutorials
│  ├─ pages                                                      # List tutorial pages
│  ├─ page <page_id>                                             # Read a tutorial page
│  └─ slug <tutorial_slug>                                       # Read tutorial content by slug
├─ suggest                                                       # Request platform suggestions using GET or POST
│  ├─ examples                                                   # Request example suggestions
│  ├─ expression                                                 # Request expression suggestions
│  ├─ fastexpr                                                   # Request FASTEXPR suggestions
│  └─ fields                                                     # Request field suggestions
├─ search <query>                                                # Search the platform globally; no subcommands
├─ community                 # Online forum topics, posts, comments, search and raw API
│  ├─ list / topics / topic / get / comments / search
│  ├─ user-posts / user-comments
│  ├─ create / update / delete / comment-create / comment-update / comment-delete
│  └─ api stats / list / show / params / call
├─ help-center               # Official Help Center; reuses community SSO, read-only
│  ├─ categories / category / sections / section
│  ├─ articles / get / search
│  └─ api stats / list / show / params / call
├─ sqlitecom                 # Local community database, incremental sync, imports and read-only SQL
│  ├─ sync / search / get / import
│  ├─ stats / status / schema
│  └─ sql (alias: query)
├─ scope                                                         # Inspect local historical research data by REGION_DELAY
│  ├─ files                                                      # Locate local scope data files
│  ├─ list                                                       # List available scopes such as USA_1
│  ├─ show <scope>                                               # Read a scope summary
│  ├─ top <scope>                                                # Rank fields, datasets, or categories by historical metrics
│  ├─ search <scope> <query>                                     # Search a scope's fields, datasets, or categories
│  ├─ neutralization <scope>                                     # Inspect historical neutralization performance
│  ├─ pickle-summary <scope>                                     # Read a scope summary from the local pickle
│  └─ alpha-rows <scope>                                         # Read historical Alpha attributes, settings, and IS/OS rows
├─ shortcut (alias: quick)                                       # Run common combined operations
│  ├─ whoami                                                     # Check the current authentication session
│  ├─ simulate                                                   # Create a simulation and wait for completion
│  ├─ alpha-report <alpha_id>                                    # Collect Alpha details, checks, correlations, and yearly stats
│  └─ data-fields                                                # Find fields using region, delay, universe, and other filters
├─ config                                                        # Manage local configuration and inspect platform settings
│  ├─ init                                                       # Initialize the local CLI configuration
│  ├─ list                                                       # List local configuration
│  ├─ get <key>                                                  # Read a local configuration key
│  ├─ set <key> <value>                                          # Set a local configuration key
│  ├─ set-secret <key> <value>                                   # Store a secret in the system keyring
│  ├─ platform                                                   # Query platform configuration
│  └─ competition-levels                                         # Query competition-level configuration
├─ docs                                                          # Discover bundled CLI documentation
│  ├─ list                                                       # List documented command nodes
│  └─ show <path>                                                # Read a documentation file
├─ api                                                           # Inspect the local API registry and call registered endpoints
│  ├─ stats                                                      # Show API registry statistics
│  ├─ list                                                       # List registered endpoints, optionally by path prefix
│  ├─ show <path>                                                # Inspect an endpoint definition
│  ├─ params <path>                                              # Inspect query parameter and request-body hints
│  └─ call <method> <path>                                       # Call an endpoint with path variables, parameters, and JSON
└─ errors                                                        # Access the platform error-reporting endpoint
   └─ envelope                                                   # Send an envelope to the platform error collector

Choosing an Entry Point

  • simu calls the platform simulation API directly; sqlitesimu adds a local database, batch queues, concurrent workers, recovery, and result exports.
  • Simulating is not submitting: simu create and sqlitesimu run launch simulations; alpha submit performs formal Alpha submission. The command tree does not imply that research or final eligibility checks have been completed.
  • community accesses the live forum. sqlitecom owns local storage and syncs through the same online client. Migrate old local searches to sqlitecom search and plugin imports to sqlitecom import.
  • help-center reads live official support articles, not forum posts. docs reads bundled CLI documentation; tutorial reads the separate platform tutorial API. Help Center requests reuse community authentication and are GET-only.
  • sqlitesimu cancel manages a local run and preserves history; it does not cancel every simulation already sent to the platform, and it does not bypass an active worker lease by default.
  • api call invokes registered endpoints directly. Mutating operations send real requests and do not automatically perform higher-level research checks.

Exploring Help by Level

wqb --help
wqb simu --help
wqb simu create --help
wqb alpha correlation --help
wqb alpha correlation prod --help
wqb sqlitesimu run --help
wqb sqlitesimu template-report --help

Global options include --registry and --cookies; most leaf commands support --output. Consult each command's --help for filters, input files, wait limits, and concurrency settings. When adding, removing, or changing commands, update both READMEs and verify the trees against the actual parser.

Package Metadata

The Python distribution name is wqb-cli.

The import/package name is wqb_cli.

The command line entry point is:

wqb

Current package version:

version = "0.6.3"

Authentication

Resolve the installed runtime's local directory, then create or edit its .env file. Do not put runtime credentials in the development checkout:

$WqbLocal = python -I -c "from wqb_cli.core.paths import LOCAL_ROOT; print(LOCAL_ROOT)"
New-Item -ItemType Directory -Force $WqbLocal

Fill in one of the following credential pairs:

EMAIL=...
PASSWORD=...

or:

WQB_EMAIL=...
WQB_PASSWORD=...

Login:

wqb auth login

Check authentication:

wqb auth status

Cookies are stored relative to the installed package directory, not the current working directory:

local/auth/cookies.json

All WqbClient calls automatically recover the session when BRAIN returns 204, 401, or 429, matching the status predicate used by wqb.WQBSession. The client reloads credentials from config, keyring, or environment, logs in, persists the refreshed cookie, and replays the rejected request with bounded retries. Stale BRAIN cookies are cleared before login so old and refreshed domain variants cannot be sent together. Calls to /authentication are excluded from recursive renewal, and POST /authentication succeeds only on 201.

Do not commit local/, .env, or cookie files.

Repository Layout

.
  cli.py
  commands/                 CLI command groups
  core/                     HTTP, auth, config, registry, IO, local stores
  resources/
    api_inventory/          Bundled API endpoint inventory
    docs/
      commands/             Handwritten command docs and examples
      generated/            Generated command references
  workflows/                Isolated simu and batchsimu workflow documents
  tests/                    Test suite
  local/                    User-local runtime data, ignored by Git
  LICENSE
  pyproject.toml
  README.md

Common API Commands

Inspect the bundled API inventory:

wqb api stats
wqb api list
wqb api show /authentication
wqb api params /users/self/alphas

Call a safe endpoint:

wqb api call GET /authentication

Inspect simulation options:

wqb simu options

Most high-level query commands expose common filters directly and still allow raw query parameters through --param KEY=VALUE.

Examples:

wqb alpha list --settings-neutralization SUBINDUSTRY --is-sharpe ">=1.25"
wqb data fields --dataset analyst14 --coverage ">0.8" --order=-userCount
wqb data datasets --category pv --region USA --delay 1 --limit 20

When in doubt, check command help:

wqb alpha list --help
wqb data datasets --help
wqb data fields --help
wqb data operators --help
wqb simu create --help

API Refresh and User Resources

The 2026-09-22 API refresh covers 131 existing/discovered paths and expands the catalog from 109 to 127. api list/show/params/call exposes the new paths and schema shapes. Probe evidence distinguishes successful read metadata from advertised methods; writes were not exercised and private option choices are excluded. See the refresh report.

New user commands include activity <activity_name>, osmosis-summary, osmosis-scale-status, streak, tags and submission-activity. Normal scaling-status HTTP 204 responses do not trigger authentication replay. See user resource examples.

Alpha Listing Examples

Recent ACTIVE REGULAR alphas for a region/delay:

wqb alpha list `
  --type REGULAR `
  --settings-region CHN `
  --settings-delay 1 `
  --settings-instrument-type EQUITY `
  --limit 100 `
  --order=-dateSubmitted `
  --status ACTIVE

Tower-tag lookup, when tags are maintained:

wqb alpha list `
  --type REGULAR `
  --settings-region CHN `
  --settings-delay 1 `
  --settings-instrument-type EQUITY `
  --limit 100 `
  --order=-dateSubmitted `
  --status ACTIVE `
  --tag CHN/D1/PV

If the tag result is empty or inconsistent, fall back to the region/delay query and inspect pyramids[].name locally.

Do not rely on --param pyramid=pv for alpha listing. It is accepted by the server but does not filter results in observed tests.

Simulation Workflows

Create a simulation from a JSON body:

wqb simu create --input body.json --output simulation_result.json

By default, simu create waits for the simulation result or fails on timeout. For multi-simulation requests, child simulations are also waited and reported.

Get an existing simulation:

wqb simu get <simulation_id> --max-wait-seconds 900 --output simulation.json

Simulation examples are documented here:

resources/docs/commands/simulations/create/examples/input_json.md
resources/docs/commands/simulations/create/examples/backtest_modes.md

Supported documented example bodies include:

  • REGULAR FASTEXPR multi-simulation.
  • REGULAR FASTEXPR single simulation.
  • REGULAR PYTHON single simulation.
  • SUPER simulation.

For REGULAR FASTEXPR multi-simulation, the shared settings requirement is limited to:

  • delay
  • region
  • instrumentType
  • language

Durable SQLite Batch Simulations

Both simu and sqlitesimu support REGION_AGNOSTIC/ALL. ALL uses a single parent object, ALL/D1 and LARGE/MEDIUM/SMALL, then collects every regional child Alpha and PnL. The server does not support ALL in HTTP batch arrays. A SQLite run can interleave individual ALL requests with Regular batches using the same sender and backpressure.

Use simu create --dry-run for a request preview. Use sqlitesimu run ... --no-resend or resume ... --no-resend to keep collecting accepted work without repeatedly posting it. Export includes region_agnostic_children; RA parents have no PnL and remain one experiment each. See the durable simulation guide.

To let a workflow generate candidates while the CLI independently runs simulations, polls, retries, and persists results:

wqb sqlitesimu run candidates.json --output run-result.json

For explicit process control, initialize a database, enqueue once, and resume the returned run:

wqb sqlitesimu init --db simulations.sqlite3
wqb sqlitesimu enqueue candidates.json --db simulations.sqlite3 --output enqueue-result.json
wqb sqlitesimu resume <run_id> --db simulations.sqlite3 --output worker-result.json
wqb sqlitesimu status <run_id> --db simulations.sqlite3 --output status.json
wqb sqlitesimu export <run_id> --db simulations.sqlite3 --output run-export.json

The default database is local/sqlitesimu/simulations.sqlite3. Each run retains candidates, batches, simulation locations, errors, Alpha details, and PnL history, and exposes a simued_alpha_is_pnl compatibility view for legacy analysis code. Run exports also include structured pnl_paths with deduplicated date grids and per-Alpha daily increments so downstream correlation analysis can align observations by date without filling missing values.

The sender randomly selects an eligible (region, delay, type) group, then randomly fills a compatible batch: up to 10 Regular FASTEXPR candidates, or one Super, ALL, or Python candidate. Full batches are sent whenever enough candidates are due; smaller final batches are also sent. Due confirmed-failure retries take precedence, and new work is selected before explicitly enabled resends. Queue priority and insertion order do not control default sampling. A run can opt in to descending Super priority within the selected group with manifest metadata "super_queue_priority": {"enabled": true, "mode": "within_group"}. This does not change group sampling, Regular/ALL ordering, dispatch exclusions, or confirmed-failure retry precedence; equal priorities remain random. BATCH_CREATED records the applied mode and selected priorities. Each accepted request is followed immediately by the next send, with no local simulation-slot cap; server backpressure and daily-limit deadlines govern waiting. Accepted work is excluded by default; --resend-seconds SECONDS opts in to reposting pending work, and --no-resend overrides that option.

Template-family manifests can be validated before enqueue and rendered into a fixed terminal report:

wqb sqlitesimu template-validate template-manifest.json --output template-validation.json
wqb sqlitesimu template-report run-export.json --analysis-contract analysis-contract.json --output template-report.json --markdown-output template-report.md

The analysis contract can pre-register a direction-invariant discovery screen separately from positive-direction validation. Reverse discoveries are reported as requiring a new simulation and never become final-check candidates from transformed historical metrics.

See resources/docs/sqlitesimu.md for the manifest contract, recovery states, exit codes, and explicit differences from the three legacy workers.

The agent-independent template-family lifecycle is defined in workflows/workflow_batchsimu/. Its J node enqueues and launches the worker; K/L/M remain blocked until that exact run reaches a terminal state.

Submit Workflow

Submit an alpha:

wqb alpha submit <alpha_id> --output submit_result.json

The CLI distinguishes API acceptance from final submit success.

  • 201 Created means the submit request was accepted by the API.
  • Final success requires polling the submit/check result until the submit check succeeds.
  • If an intermediate response is printed, it should be read as 201 Created, waiting for results....

Commands that wait for platform-side results return only after a final result, a request failure, or timeout.

Local Data Setup

Local data is not bundled and must not be committed.

The local/ input paths below refer to the installed package's runtime data, not the development checkout. Resolve the directory in the active environment:

$WqbLocal = python -I -c "from wqb_cli.core.paths import LOCAL_ROOT; print(LOCAL_ROOT)"

Copy data and credentials into that directory when migrating from an editable install. Back up runtime data before package upgrades; keep research outputs and run databases in a separate workspace. Community refreshes must inspect export coverage and preserve existing documentation when a new export omits it.

Recommended layout:

local/
  .env
  config.json
  auth/
    cookies.json
  community/
    WQPCommunityState_*.json
    WQPCommunityState_*.wqcs
    community.sqlite3
  data_all/
    info_data.bin
    all_data.pickle
    main.ipynb

data_all

data_all comes from the WebDataScope plugin's network-disk data package:

leetesla/WebDataScope-WorldQuant

all_data.pickle is not released with this repository. Download it from the Baidu Netdisk link provided by the WebDataScope plugin README, then place it under:

local/data_all/

Expected files:

local/data_all/
  info_data.bin
  all_data.pickle
  main.ipynb

Check local data:

wqb scope files
wqb scope list
wqb scope show USA_1 --output local/scope_usa_1.json
wqb scope top USA_1 --group datafield --min-count 5 --limit 10
wqb scope pickle-summary USA_1 --sample 1
wqb scope alpha-rows USA_1 --table os --datafield volume --limit 3 --columns id,sharpe,fitness,turnover,margin

Community Data

community is the online interface; sqlitecom owns local storage. Start from an empty database or an existing plugin import. Sync merges changes without replacing the database or erasing documentation.

Legacy imports may contain the same post ID under several forum sections. Sync reconciles these copies using the section returned by the API, unions comments by ID, and saves every pre-merge row in community_row_history. Conflicting comment copies prefer their source update timestamp, then the API section; fresh API comments take precedence. Reconciliation and FTS updates are transactional. Failed comment retrieval leaves the imported copies intact and the sync resumable.

wqb community topics
wqb community list --sort updated_at --limit 10
wqb community search wqb_cli --limit 5
wqb community get 41706827651991
wqb community api list
wqb community create --html post.html --title "Research notes" --topic 18910956638743 --dry-run
wqb community create --html post.html --title "Research notes" --topic 18910956638743 --output published.json
wqb sqlitecom sync --sqlite community.sqlite3 --since 2026-09-17 --log sync.log
wqb sqlitecom search --sqlite community.sqlite3 --author JL40454 --scope topics
wqb sqlitecom get 41706827651991 --sqlite community.sqlite3
wqb sqlitecom schema --sqlite community.sqlite3
wqb sqlitecom sql --sqlite community.sqlite3 --file report.sql --param author=JL40454
wqb sqlitecom import --sqlite community.sqlite3 --source export.json

community create --html uploads local images from the HTML directory, replaces image paths, publishes the body and reads the saved post back. Keep the generated .assets.json receipt to reuse uploads on retry. Use --prepared-output to save the actual request body. Dry runs make no HTTP requests; uncertain writes are never automatically replayed. See community commands for JSON input, image limits and update commands.

Sync uses cursor pagination, an update-time boundary and a default 48-hour overlap. Saved work resumes automatically; --max-pages pauses after a bounded number of index pages. A new database builds a full baseline unless --since limits it. Old comment edits may not update the parent timestamp: periodically use --reconcile to revisit the full index. Unchanged posts with comments checked in the last seven days skip comment downloads.

sql accepts one read-only statement, CTEs and bound parameters, with a default 200-row output limit and 10-second execution deadline. Use --file for UTF-8 SQL without shell-escaping issues. Read-only connections reject writes, ATTACH, extension loading and multiple statements. Only sync uses the network; other sqlitecom commands are local.

Research Workflow Documents

Two complete, isolated workflows live under workflows/:

workflows/
  workflow_simu/          bounded, adaptive A-M research with synchronous wqb simu create
  workflow_batchsimu/     template-family A-M research with agent-independent sqlitesimu execution

Each workflow has its own A node, run directory, input/output contracts, graph, and terminal behavior. They do not share A-F artifacts, SQLite databases, node inputs, or control-flow handoffs.

Entry points:

workflows/workflow_simu/workflow_graph.md
workflows/workflow_batchsimu/workflow_graph.md

The batch workflow freezes one settings cell, samples each template family without replacement, records full family lineage, and only analyzes density, quality distributions, errors, and actual IS-PnL correlation after the authoritative run is terminal. K selects candidates from the batch's own results, L performs slow final checks, and M is the only node allowed to call wqb alpha submit; no candidate or result crosses into the adaptive workflow.

Command Documentation

Command documentation lives in:

resources/docs/commands/

Useful entry points:

  • resources/docs/commands/README.md
  • resources/docs/commands/local-data/README.md
  • resources/docs/commands/community/README.md
  • resources/docs/commands/scope/README.md
  • resources/docs/commands/simulations/create/examples/backtest_modes.md
  • resources/docs/commands/simulations/create/examples/input_json.md

Bundled API inventory:

resources/api_inventory/

Development

Install editable package:

python -m pip install -e ".[dev]"

Run tests from the repository root:

python -m pytest tests

Build package artifacts:

python scripts/build_release.py --outdir dist --expected-version 0.6.3

Do not commit:

  • .env
  • local/
  • dist/
  • build/
  • *.egg-info/
  • credentials or cookies

Troubleshooting

ModuleNotFoundError: No module named 'wqb_cli'

Activate the runtime environment and check its regular installation:

conda activate WQBRAIN
python -m pip show wqb-cli
python -I -m wqb_cli --help

If the package is missing, install a built wheel using its actual path:

python -m pip install path/to/wqb_cli-version-py3-none-any.whl

Do not repair runtime imports by adding the development checkout to PYTHONPATH or installing editable mode in WQBRAIN. Source-based tests belong in a separate development environment.

WARNING: Ignoring invalid distribution ~qb-cli

This is usually a stale pip uninstall/install artifact under site-packages. If the install succeeds, it does not block normal use. To clean it, inspect the active environment's Lib/site-packages directory and remove stale ~qb* distribution folders.

wqb.exe is installed ... which is not on PATH

Use the full Python module form or add the printed scripts directory to PATH:

python -m wqb_cli --help

Release

Package release:

GitHub Releases

Release checklist:

  1. Update package/runtime versions, the changelog and bilingual documentation.
  2. Install .[dev] in a development environment and run tests.
  3. Commit the changes, open a PR and merge after verification.
  4. Tag the merged master commit, for example v0.6.3, and push the tag.
  5. Build from that exact clean commit with scripts/build_release.py, verify the installed wheel, and publish wheel/sdist, SHA256SUMS.txt and BUILD_INFO.json using gh release create --verify-tag and a notes file.
  6. Verify the downloaded release and wqb upgrade --check. Existing versions without upgrade can bootstrap by installing the verified release wheel.

The build helper requires an empty output directory and excludes ignored local data and old build outputs. See the 0.6.3 plan. Optional GitHub Actions examples automate these checks and publication once a credential with workflow scope can enable them.

Version History

The history below follows versions recorded by package metadata and GitHub releases. The old runtime-only __version__ = "0.1.0" value was stale and was never a published package version.

0.6.1 - 2026-09-22

  • Fixed live community-write CSRF; added HTML-file posting, local-image uploads, reusable asset receipts and separate API/page verification. The existing v0.6.1 assets are replaced with this correction; reinstall the wheel with --force-reinstall --no-cache-dir if 0.6.1 is already installed.

  • Standardized the simulation entry point as wqb simu, including the source module, parser and documentation. Use this name when updating existing scripts.

  • Compatible Regular batches now contain up to 10 candidates, including GLB, and dispatch continuously with server backpressure. Confirmed simulation failures retry once, then are recorded and skipped. Schema 8 preserves failed-attempt history and retry budgets across restarts; ALL and Super retain single-object requests.

  • Daily quota rejections pause new simulations until the next America/New_York midnight, including daylight-saving changes, while accepted results continue collecting. The pause survives restarts.

0.6.0 - 2026-09-22

  • Added: online community resources and API inventory; sqlitecom incremental sync, local search and parameterized read-only SQL.
  • Changed: local community search/stats/export moved to sqlitecom search/stats/import. community search now searches the live forum.
  • Authentication: existing BRAIN renewal plus forum SSO, HTML redirects and CSRF; writes are not automatically replayed.

0.5.0 - 2026-09-22

  • Added: native ALL support in simu and sqlitesimu, schema 7 with regional child results, no-resend and dry-run controls, 18 newly registered API paths and user activity/Osmosis commands.
  • Fixed: pending enrichment responses and normal endpoint-specific HTTP 204 responses. Existing Regular and Super request forms remain supported.
  • This source/wheel version is separate from the historical GitHub release link above.

0.4.0 - 2026-08-18

  • Added: command-plugin SDK; durable SQLite batch simulations with enqueue/resume/status/cancel/export; template-family manifest validation and terminal reports; two isolated A-M research workflows.
  • Changed: global 204/401/429 session renewal, five additional batch-worker login attempts, server-driven 429 / Retry-After backpressure, polling-first queue scheduling, and explicit simulate-versus-submit terminology.
  • Preserved: ambiguous simulation POST outcomes, operational history, Alpha details, and PnL remain auditable instead of being blindly replayed or deleted.

0.3.2 - 2026-07-16

  • Added: generic competition and consultant leaderboard scopes; competition Guidelines and FAQ helpers; complete SPC prompt-submission list/create/history/update commands; canonical endpoint inventory, examples, and tests.
  • Changed: API inventory grew from 104 endpoints and 126 method cases to 109 endpoints and 134 method cases without dropping existing registrations; alpha requests can retry with Basic Auth after a cookie-session 401; workflow constraints and README release documentation were expanded; runtime and package versions are now synchronized.
  • Removed: obsolete analyst/PV vector sample JSON files and one redundant workflow document. No published CLI command or registered endpoint was removed.

0.3.1 - 2026-05-22

  • Added: the agent-first wqb console command, package-local auth/config/community/scope/shortcut tools, bundled API inventory, generated command docs, alpha submit polling, smoke tests, bilingual README files, and project branding.
  • Changed: package layout and metadata were rebuilt around wqb_cli; workflow and local-data documentation were expanded; licensing changed from MIT to GPL-3.0-only plus Commons Clause.
  • Removed: the legacy wqb_core package-discovery/test layout and unused legacy resources.

0.2.5 - 2026-05-13

  • Added: the initial packaged WorldQuant BRAIN API wrapper and agent-oriented workflow baseline with requests, pandas, and msgpack dependencies.
  • Changed: none; this was the initial package-metadata baseline.
  • Removed: none.

See CHANGELOG.md for the maintained release log.

License

This project is licensed under GPL-3.0-only with the Commons Clause License Condition v1.0.

Required attribution:

Original author: wiz
Original repository: https://github.com/untuitivist/wqb_cli
Author GitHub: https://github.com/untuitivist

The Commons Clause removes the right to sell the software as defined in LICENSE. This means the source is available, but the project is not OSI open source.

About

No description, website, or topics provided.

Resources

Stars

55 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages