feat: F&G column, the stock's fear-and-greed reading on every report row - #114
Merged
Merged
Conversation
The composite (RSI 14, MACD-histogram percentile within the trailing year, Bollinger %B, equal weights, 0-100) moves from the backtest into scan.py as fear_greed() so the report and the replay share one implementation. scan_symbol computes one reading per symbol at the last close and puts it on each of the symbol's signals; signals.json gains fear_greed, the report gains the F&G column and a footer sentence explaining the zones. Information only; the stretch gate it suggests is #113. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Description
Puts the per-ticker fear-and-greed reading of #112 on the report as information, the way the market context was added in #105. No rule uses it.
scan.fear_greed(with Wilder's RSI inscan._rsi): the composite moves fromtools/backtest.pyinto the scanner so the report and the replay share one implementation; the backtest imports it. ConstantsFG_RSI_LEN,FG_BB_LEN,FG_MACD,FG_LOOKBACKjoin the constants block with the replay evidence in the comment.Signal.fear_greed: one reading per symbol at the last close, set byscan_symbolon every row of that symbol;fear_greedinsignals.json.F&GafterVol×, and a footer sentence: above 80 the stock is stretched and such breakouts replayed worst, below 20 it is washed out, information only.F&Gregardless of when this merges.Real-data run on 10 tickers: HAL's confirmed breakout reads 73.9, the PH and HAS cup bases read 20.3 and 17.2.
Verified:
ruffclean, 137 tests pass (the composite tests moved toscan,scan_symbolsets one reading per symbol and a bare detector does not, the report's 14 columns with the F&G cell equal to the symbol's composite, the footer sentence, and the replay row'sfear_greedequal to itsfg_scorefeature).Related Issues
Related: #113 (the stretch gate), #112 (the features), #101 and #99 (context)
Checklist
scan.py(four new constants, commented; no threshold changed)python -m pytest -q)docs/wiki/CHANGELOG.mdupdated🤖 Generated with Claude Code