How billyany/worldquant works
Project Type & Purpose
• Type: A CLI-driven open-source factor-mining tool (no GUI, no web frontend/backend).
• Purpose:
– Read user credentials, run two “digging” steps to generate candidate factors.
– Validate (“check”) factors.
– Submit approved factors to an external service (platform.worldquantbrain.com).
File Structure
Top-level files:
• digging_1step.py, digging_2step.py: two sequential factor-mining stages.
• check.py: factor-verification logic.
• submit_alpha.py: submission workflow.
• machine_lib.py: core library functions (data loading, processing, API calls).
• config.py: global configuration (paths, constants, API endpoints).
• fields.py: definitions of data fields & schemas.
• requirements.txt: dependencies.
• user_info.txt (runtime): holds username/password for API authentication.
Extract Insights from README
• Workflow:
1. Install deps.
2. Populate user_info.txt.
3. Run digging_1step → digging_2step → check → submit_alpha.
• External dependency: platform.worldquantbrain.com API.
Main Components & Their Interactions
a. Components
– CLI Launcher (user’s shell)
– Config Module (config.py, fields.py)
– Core Library (machine_lib.py)
– Digging Stage 1 (digging_1step.py)
– Digging Stage 2 (digging_2step.py)
– Check Stage (check.py)
– Submission Stage (submit_alpha.py)
– External Service (WorldQuantBrain API)
– Data Store (local files: user_info.txt, intermediate factor files)
b. Relationships / Data Flow
1. User invokes digging_1step → loads config, fields → uses machine_lib to fetch/preprocess data → outputs intermediate factors.
2. digging_2step reads previous output → refines factors → writes results.
3. check.py loads results → runs validation routines → marks pass/fail.
4. submit_alpha.py reads validated factors & user_info.txt → authenticates via machine_lib against external API → submits.
c. Architectural Patterns
– Modular scripting: each stage is a separate script with clearly defined input/output.
– Shared library (machine_lib) and config for reuse.
– File-based chaining between stages.
– Single external integration point (REST API).
d. Key Technologies / Libraries
– Python 3.x
– requests (for HTTP calls)
– pandas / numpy (likely for data processing, per requirements.txt)