brain-sentiment
Analyst revisions, PEAD, and sentiment alpha generation engine for WorldQuant BRAIN.
brain_sentiment generates quantitative equity alphas on WorldQuant BRAIN sentiment and revision datasets (sentiment1, sentiment2, ValueScore: 8.0). It codifies Post-Earnings Announcement Drift (PEAD), Standardized Unexpected Earnings (SUE), and analyst revision diffusion into turnover-controlled (< 12%) Fast Expressions with sub-industry neutralization. For institutional literature citations and mathematical derivations, see the whitepaper.
Installation
pip install brain-sentiment
Quickstart
from brain_sentiment import SentimentAlphaEngine
engine = SentimentAlphaEngine()
# Generate 5 turnover-controlled sentiment candidates
candidates = engine.generate_candidates(count=5)
for cand in candidates:
print(f"[{cand.tags}] {cand.expression}\n")
Core Sentiment Archetypes
| Archetype | Institutional Literature | Economic Hypothesis | ValueScore |
|---|---|---|---|
| SUE Drift | Bernard & Thomas (1989) | Standardized quarterly earnings surprises drift predictably for 60-90 days | 8.0 |
| Revision Breadth | Chan et al. (1996) | Net fraction of upward vs downward analyst revisions leads momentum | 8.0 |
| Dispersion Arbitrage | Diether et al. (2002) | Equities with high sell-side forecast disagreement suffer optimistic overpricing | 8.0 |
| Revision Divergence | Livnat & Mendenhall (2006) | Accelerating upward revisions lagging equity price provide reliable forward drift | 8.0 |
Architecture
brain_sentiment/
├── brain_sentiment/
│ ├── __init__.py # Public re-exports (SentimentAlphaEngine, SentimentCandidate)
│ ├── data/
│ │ └── catalog.json # Live BRAIN sentiment field catalog
│ ├── catalog.py # SentimentCatalog field groupings & loader
│ ├── archetypes.py # Quantitative sentiment strategy descriptors
│ ├── dedup.py # AST expression deduplicator (delegates to brain_core)
│ ├── generator.py # Candidate generation engine
│ ├── py.typed # PEP 561 typing marker
│ └── strategies/ # Modular strategy implementations (pead, revision_breadth)
├── tests/ # Unit tests covering catalog, engine, strategies, templates
└── docs/
├── API.md # Complete API specification
└── whitepaper.md # Quantitative sentiment theory & PEAD dynamics
Testing
pytest tests/ -v
Security
Report vulnerabilities per SECURITY.md.
Contributing
See CONTRIBUTING.md for contribution guidelines.
License
Released under the MIT License. Maintained by Xtley001.
Metadata
Release files for brain-sentiment 0.1.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_sentiment-0.1.0.tar.gz | 23.5 kB | Without provenance | Details for brain_sentiment-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| brain_sentiment-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for brain_sentiment-0.1.0-py3-none-any.whl |
Total release size: 54.2 kB
Release files / brain_sentiment-0.1.0.tar.gz
| Download URL | brain_sentiment-0.1.0.tar.gz |
|---|---|
| Size | 23.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
639185b02cd7c0417555b7f24007ea1e7d36bb3eb46ce98eb9f12dab8f24a4c2
|
|
BLAKE2b-256 checksum How to use checksums |
8388780a8182752c6fec934d5559a035b80d5a586741bb068164ca23419c82ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / brain_sentiment-0.1.0-py3-none-any.whl
| Download URL | brain_sentiment-0.1.0-py3-none-any.whl |
|---|---|
| Size | 30.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
683dbf931e652436a45bb08de185a6cbec5a261f0102756496948679a4ffd3f7
|
|
BLAKE2b-256 checksum How to use checksums |
893a5c7c13b65522ebeedf17d09e5285314b39b8ed1fac65403b2bb95ef3f26b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for brain-sentiment 0.1.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.