Add earnings-profit → 3–5 day price trend model - #2
Draft
ax3301 wants to merge 1 commit into
Draft
Conversation
Model relating quarterly earnings/profit data to post-earnings price drift over 3 and 5 trading days. - earnings_trend.py: reusable pipeline (yfinance data -> profit features -> forward-trend labels -> direction classifier + magnitude regressor), with a chronological train/test split to avoid look-ahead leakage and an optional requests-session hook for restricted-proxy environments. - earnings_trend_model.ipynb: self-contained, Colab-friendly notebook running data collection, EDA (correlation heatmap, EPS-surprise scatter, surprise buckets), modeling, and upcoming-earnings scoring. - README.md: usage, data-source swap to Robinhood, and an honest write-up of limitations (free yfinance only ships ~5 quarters of income statements, so EPS surprise + pre-earnings momentum carry the usable signal). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QpxV7kVFiBk9JmdcW73iGb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A model relating quarterly earnings / profit data to a stock's post-earnings price drift over the next 3 and 5 trading days.
New folder
earnings_trend_model/:earnings_trend.pyearnings_trend_model.ipynbREADME.mdHow it works
RandomForestClassifierfor direction +Ridgefor magnitude, with a chronological train/test split so the score reflects real forward use (no look-ahead leakage).Verified
Ran the full pipeline end-to-end on 8 large caps → 388 real earnings events. Data collection, both models, feature importances, and upcoming-earnings scoring all work.
Honest limitations (also in the README)
net_income_yoy/revenue_yoyare NaN for older events and show ~0 importance. The signal that actually drives the model is EPS surprise + pre-earnings momentum (earnings-date data covers ~25 quarters).TICKERSfor statistical power, or swap in a longer-history fundamentals source (e.g. the Robinhood connector) to activate the YoY features.Notes
yfinance(no API key). An optionalset_session()hook routes calls through a plainrequestssession for TLS-terminating proxy environments wherecurl_cffigets reset.earnings_trend.py(documented in the README).🤖 Generated with Claude Code
Generated by Claude Code