brain-synthesis
Tri-factor apex synthesis engine with Hierarchical Risk Parity (HRP) and dynamic regime adaptation for WorldQuant BRAIN.
brain_synthesis combines orthogonal signals across asset classes and information tiers into high-scoring hybrid meta-alphas on WorldQuant BRAIN. By fusing options implied volatility surfaces, analyst earnings revisions, and systematic risk premia using Hierarchical Risk Parity (HRP) and Dynamic Regime Detection, it generates super-alphas yielding 1,600+ platform points with sub-0.50 platform correlation and 0.85+ uniqueness.
Installation
pip install brain-synthesis
Installing brain-synthesis automatically installs the complete 7-library suite and registers the global brain executable.
Quickstart
1. The 8 Golden Apex Formulations
from brain_synthesis import generate_apex_candidates
# Generate golden apex candidates across TOP3000, TOP2000, TOP1000
candidates = generate_apex_candidates(universes=["TOP3000", "TOP1000"], decays=[15, 20])
for alpha in candidates[:3]:
print(f"[{alpha.archetype_name}] {alpha.expression}\n")
2. Hierarchical Risk Parity (HRP) Synthesis
from brain_core.types import AlphaCandidate
from brain_synthesis import DynamicSynthesizer
syn = DynamicSynthesizer()
leg_options = AlphaCandidate(expression="rank(implied_volatility_call_30)", archetype_name="opt")
leg_sentiment = AlphaCandidate(expression="rank(snt1_d1_netearningsrevision)", archetype_name="snt")
leg_risk = AlphaCandidate(expression="rank(beta_last_60_days_spy)", archetype_name="risk")
# Empirical covariance matrix between legs
cov_matrix = [
[0.04, 0.005, 0.002],
[0.005, 0.02, 0.001],
[0.002, 0.001, 0.01],
]
# Computes tree clustering & recursive bisection without matrix inversion
apex = syn.synthesize_hrp(
candidates=[leg_options, leg_sentiment, leg_risk],
cov_matrix=cov_matrix,
name="My_HRP_Super_Alpha",
universe="TOP3000",
)
print("Synthesized HRP Expression:", apex.expression)
3. Dynamic Market Regime Synthesis
from brain_synthesis import DynamicSynthesizer, MarketRegime
syn = DynamicSynthesizer()
# In high-volatility regimes, automatically boosts options skew and tail protection
apex_vol = syn.synthesize_regime(
candidates=[leg_options, leg_sentiment, leg_risk],
regime=MarketRegime.HIGH_VOLATILITY,
universe="TOP1000",
)
print("High-Vol Adaptive Expression:", apex_vol.expression)
4. Unified CLI
# Generate 3 cross-domain apex meta-alphas
brain generate --domain synthesis --count 3
# Apply 10-axis orthogonal decorrelation
brain decorrelate "rank(close)" --base-sharpe 1.55
# Inspect storage subsystem health
brain store
The 8 Golden Tri-Factor Formulations
| Formulation | Leg 1 (Options) | Leg 2 (Sentiment) | Leg 3 (Risk / Fundamental) | ValueScore |
|---|---|---|---|---|
| Apex 1: Accumulation Triple | Put Support Floor | Analyst Net Revisions | Low SPY Beta (BAB) | 8.5+ |
| Apex 2: SUE Smirk Confluence | Inverted IV Skew Smirk | SUE Earnings Shock | Quality / Solvency Accel | 8.5+ |
| Apex 3: Target Term Slope | 180d vs 30d IV Term Slope | Net Target Upgrades | Beta Demean | 8.5+ |
| Apex 4: Torpedo Quality Drift | Call Breakeven Basis | Disappointment Re-rating | Accounting F-Score Quality | 8.5+ |
| Apex 5: Attention Asymmetry | Put Forward Cushion | Analyst Search Attention | Low SPY Correlation | 8.5+ |
| Apex 6: Toxic Flow Squeeze (New) | VPIN Volume Imbalance | Consensus Dispersion | Borrow Utilization Surge | 9.0+ |
| Apex 7: Gross Profitability Basis (New) | Synthetic Forward Basis | Revenue Revision Drift | Novy-Marx Gross Profitability | 9.0+ |
| Apex 8: Borrow Friction Drift (New) | Put/Call OI Positioning | Institutional Ownership Delta | Loan Fee Momentum | 9.0+ |
Architecture
brain_synthesis/
├── hrp/ # Hierarchical Risk Parity (López de Prado, AFML)
│ ├── clustering.py # Correlation metric distance & tree clustering
│ └── bisection.py # Recursive bisection weight allocation
├── regime_engine/ # Dynamic regime adaptation (AQuA, 2026)
│ ├── detector.py # Macro regime detector (Vol, Earnings, Trending, Neutral)
│ └── dynamic_weights.py # Regime-conditional factor weight tuner
├── apex_generator.py # 8 Golden Tri-Factor Apex Archetypes across 6 universes
├── combiner.py # DynamicSynthesizer supporting manual, HRP, and regime weighting
├── engine.py # Master SynthesisEngine multi-generator orchestrator
├── cli.py # Unified 'brain' command-line interface
└── py.typed # PEP 561 compliance marker
Testing
pytest tests/ -v
License
Released under the MIT License. Maintained by Xtley001.
Metadata
Release files for brain-synthesis 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| brain_synthesis-0.2.0.tar.gz | 18.5 kB | Without provenance | Details for brain_synthesis-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| brain_synthesis-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for brain_synthesis-0.2.0-py3-none-any.whl |
Total release size: 36.5 kB
Release files / brain_synthesis-0.2.0.tar.gz
| Download URL | brain_synthesis-0.2.0.tar.gz |
|---|---|
| Size | 18.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b286941c47f9499eb7f76e6acc258c6197ca11adabb2d26c64ccd766c9eab3c6
|
|
BLAKE2b-256 checksum How to use checksums |
1739840faf8a1fac6c8575f634b54159394c8dfac7bd8c809cf8cf07d544d0f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / brain_synthesis-0.2.0-py3-none-any.whl
| Download URL | brain_synthesis-0.2.0-py3-none-any.whl |
|---|---|
| Size | 18.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3c72d1dc59585f34ea8f383fde05c9a3bea227401c44fa1e4a6dd279a0750e0
|
|
BLAKE2b-256 checksum How to use checksums |
de3d877d44a5eee6a86d60cc27299a3229ebb2bbce3e816027143af640700af4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Security for brain-synthesis 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.