An integrated desktop toolbox that includes:
This app is built with PySide6 for the GUI and supports macOS.
brain_viewer/ app.py # Integrated entry (four tabs) dataset_viewer.py # Dataset browsing and search (with Gemini) backtest_viewer.py # Backtest data viewer (pairs with data/) generator.py # Strategy templates/parameters and export simulation.py # Simulation widget (integrated into Simulation tab in app.py) datasets/ # Datasets containing *_fields_formatted.csv data/ # Backtest or simulation outputs (CSV/LOG) alphas/ # Strategy files generated by the strategy generator templates/ # Strategy templates (.json)
Required packages (install with pip):
pip install PySide6 pandas matplotlib python-dotenv google-generativeai requests
python3 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install PySide6 pandas matplotlib python-dotenv google-generativeai requests
.env file at the project root:cat > .env << 'EOF'
GEMINI_API_KEY=your_api_key
EOF
dataset_viewer.py automatically reads .env and initializes Gemini:
python app.py
Datasets
*_fields_formatted.csv files under the datasets/ directoryBacktests
data/ (per your existing data format/process)Strategy Generator
alphas/Simulation
data/ directory (filenames include timestamps)Obtain an API Key:
Save the key into .env:
echo "GEMINI_API_KEY=your_api_key" >> .env
pip install google-generativeai python-dotenv
Common issues:
.env exists, the content is correct, and the terminal process has permission to read it.Location: datasets/
Filename rule: Must match *_fields_formatted.csv, for example: custom_demo_fields_formatted.csv
Required columns (case-sensitive):
Field (string, field name)Description (text description)Type (recommended categories such as Vector/Matrix/Scalar)Coverage (coverage; recommended as a percentage string like 95%. If numeric, the app will append % automatically)Users (integer)Alphas (integer)Minimal viable example (CSV content):
Field,Description,Type,Coverage,Users,Alphas demo_close,Daily close price,Vector,95%,120,300 demo_volume,Daily volume,Vector,92%,110,280 demo_return_5d,5-day return,Vector,88%,90,250 demo_beta,Market beta estimate,Scalar,80%,60,180 demo_inst_density,Institutional density,Matrix,75%,40,120
Save the above as datasets/custom_demo_fields_formatted.csv, then return to the app and click it in the left list to load. The app will automatically create a corresponding .db (SQLite) in the same directory to accelerate browsing and sorting.
The Simulation tab interacts with the WorldQuant Brain API. Create a credentials.json in the project root:
{
"email": "your_email@example.com",
"password": "your_password"
}
Notes:
python app.py
python dataset_viewer.pypython generator.pypython backtest_viewer.py (requires readable data under data/)
simulation.pyis integrated as a widget withinapp.py; running it standalone is not recommended.
alphas/alpha_custom_YYYYmmdd_HHMMSS.pydata/YYYYmmdd_HHMMSS.csv and the corresponding .log