Skip to content

About

Sentiment-augmented price-prediction research harness in Python. Synthetic methodology validation; no historical sentiment alpha is claimed.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

ML_Sentiment_Augmented_Price_Predictor

Canonical research harness. Empty name-hold twins are not alternate codebases. Status / portfolio placement: docs/STATUS.md.

Result

Sentiment features did not add measurable predictive value over market-only features on the pre-specified historical evaluation (2025 previously inspected for 3 of 12 issuers; not an untouched holdout) (12 large-cap issuers, SEC EDGAR 10-K/10-Q/8-K text, 2025 evaluation period, primary next-session excess-return direction target):

  • n = 197 evaluation filing events
  • combined-minus-market log-loss delta: +0.0041 (block-bootstrap 95% interval [-0.0049, +0.0108]; positive means the combined model was worse)
  • combined-minus-market balanced-accuracy delta: -0.027
  • The sample is underpowered: it cannot rule out small effects in either direction. A power study (research/power/REPORT.md) found the design had 80% power only for log-loss improvements of at least 0.0112 nats per event, 1.6% of the baseline log loss.
  • On the primary target the market-only comparison model was itself no better than the majority-class baseline (log loss 0.69108 vs 0.69110).

Qualifications added after publication are in docs/post-publication-notes.md. Research and educational material only; nothing here is investment advice.

Source: results/historical_text_v2/sentiment_hist_text_v2_primary_historical_evaluation.json. Write-ups: case study, technical paper.

Despite the repository name, this is an evaluation of incremental information, not a price predictor.

This repository is a lean validation framework for one question:

Does point-in-time sentiment add incremental predictive information beyond market-only features for short-horizon asset returns?

It contains two parts:

  1. Synthetic methodology harness: deterministic, offline synthetic workflows (run in CI) that exercise the point-in-time schema, leakage controls, walk-forward splits and ablations. These are methodology checks only, not historical evidence.
  2. Historical filing-text evaluation (2015-2025): a pre-specified study of Loughran-McDonald lexicon sentiment from SEC EDGAR 10-K/10-Q/8-K filings for 12 large-cap issuers (2015-2023 formation, 2024 validation, 2025 evaluation). It failed to demonstrate incremental predictive value over market-only features (see Result above).

The current implementation is intentionally modest and reproducible:

  • no paid APIs or credentials
  • no network access, financial downloads, transformer downloads, or GPU requirements in CI
  • no claims of historical sentiment alpha (the historical study found none)
  • deterministic synthetic workflows for methodology validation

The historical study evaluates lexicon (Loughran-McDonald) sentiment from SEC EDGAR filings against market-only features; see the case study for the full write-up.

Dictionary terms. The Loughran-McDonald Master Dictionary belongs to its authors. Their site states it is free for academic research and that commercial use needs a licence from them (terms, checked 2026-11-15). This repository does not include the word list: it is read at runtime from the pysentiment2 package, whose copy has source entries up to 2018 (dataset id lm_master_dictionary_2026_v1 names the year it was resolved, not the dictionary release). Cite: Loughran, T. and McDonald, B. (2011), "When Is a Liability Not a Liability? Textual Analysis, Dictionaries, and 10-Ks", Journal of Finance 66(1), 35–65.

  • Authoritative results (v2): results/historical_text_v2/
  • Superseded exploratory results (v1: 3 issuers, 8-K only; preserved, not a source for the result above): results/historical_text/
  • Data manifests: data/manifests/

Synthetic methodology artifacts remain non-substitutes for historical claims.

Scope

The package under src/quant_sentiment implements:

  • a point-in-time sentiment event schema with publication, ingestion, availability, timezone, model version, confidence, and effective_trading_timestamp
  • deterministic US market-session alignment rules for before-open, intraday, after-close, weekend, and holiday mapping
  • leakage-safe trailing market and sentiment feature generation
  • decision-time-safe labels with a primary next-session direction target and a documented two-session secondary horizon
  • expanding-window walk-forward validation with horizon-driven embargo/gap handling
  • ablations on identical out-of-sample periods:
    • majority baseline
    • market-only logistic regression
    • sentiment-only logistic regression
    • combined logistic regression
  • classification metrics, log loss, Brier score, and calibration-table data
  • deterministic synthetic methodology validation artifacts
  • the historical filing-text study modules (SEC EDGAR filing/text handling, Loughran-McDonald dictionary features, frozen-input hash gate, v2 walk-forward study), driven by scripts/run_historical_text_study_v2.py

Market-session rules

The testable default calendar uses US regular-hours assumptions:

  • session open: 09:30 America/New_York
  • session close: 16:00 America/New_York
  • before open: effective at same-day session open
  • intraday: effective immediately
  • after close: effective at next trading-session open
  • weekend or configured holiday: effective at next trading-session open

Quick start

python -m pip install -e ".[dev,data]"
ruff check .
mypy src tests
pytest
python -m quant_sentiment.synthetic_validation \
  --output artifacts/synthetic_methodology_validation.json

The generated artifact is explicitly labeled Synthetic methodology validation and should not be interpreted as historical evidence.

Reproducible install

requirements-lock.txt pins the full transitive dependency set (resolved on Python 3.12, dev and data extras, no hashes). To reproduce the tested environment:

python3.12 -m venv .venv && . .venv/bin/activate
python -m pip install -r requirements-lock.txt && python -m pip install -e . --no-deps

The pyproject.toml ranges are unchanged; the regenerate command is in the lock header. CI job locked-env installs from the lock and runs the fast tests. The transitive nltk advisory (GHSA-8mgp-746c-j5xp) is fixed by the locked nltk==3.10.4.

Repository outputs

  • artifacts/synthetic_methodology_validation.json: generated synthetic ablation results
  • results/historical_text_v2/: authoritative historical filing-text evaluation artifacts (source of the Result above)
  • research/sentiment-incremental-predictive-value.md: research framing and limitations
  • research/model-risk.md: model-risk and leakage-control notes
  • research/holdout-audit.md: history of the 2025 evaluation window and leakage fixes
  • research/portfolio-rationalization.md: factual repository positioning and hub-update recommendation

Limitations

  • The 2025 evaluation window was not an untouched holdout. An earlier exploratory v1 study had already evaluated 2025 for three of the twelve issuers (AAPL, MSFT, AMZN), under code later found to contain a purge off-by-one. The authoritative v2 study re-used the 2025 window, and its result is therefore labeled PREVIOUSLY INSPECTED / HISTORICAL EVALUATION rather than a confirmatory out-of-sample test (see research/holdout-audit.md).
  • n = 197 evaluation events is too few to detect small effects; a null result here is not evidence that filing text carries no information.
  • Lexicon-based scores only; no transformer or news-feed sentiment.

Non-goals

The repository does not claim or implement:

  • Docker support
  • SHAP explainability
  • XGBoost
  • paid or proprietary sentiment datasets (the historical study uses public SEC EDGAR filings and a public dictionary only)
  • economic-performance headline metrics such as Sharpe

Those would require additional reproducible evidence and are intentionally omitted here.

License

Apache-2.0 — see LICENSE. © 2026 Micap AI LLC.

About

Sentiment-augmented price-prediction research harness in Python. Synthetic methodology validation; no historical sentiment alpha is claimed.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages