Commit Graph

206 Commits

Author SHA1 Message Date
github-actions[bot] 33f932f6e0 chore: daily discovery 2026-03-02 2026-03-02 13:43:55 +00:00
github-actions[bot] 8b8b0ab3f5 chore: update performance tracking 2026-03-01 2026-03-01 13:20:37 +00:00
github-actions[bot] b12040f3d6 chore: daily discovery 2026-03-01 2026-03-01 13:19:55 +00:00
github-actions[bot] db332b3033 chore: update performance tracking 2026-02-28 2026-02-28 13:17:50 +00:00
github-actions[bot] 41684c36e0 chore: daily discovery 2026-02-28 2026-02-28 13:17:14 +00:00
github-actions[bot] 151b841fd4 chore: update performance tracking 2026-02-27 2026-02-27 13:40:57 +00:00
github-actions[bot] dabec2130e chore: daily discovery 2026-02-27 2026-02-27 13:40:48 +00:00
github-actions[bot] 6273c2c94c chore: update performance tracking 2026-02-26 2026-02-26 13:53:17 +00:00
github-actions[bot] 4b47f23219 chore: daily discovery 2026-02-26 2026-02-26 13:52:36 +00:00
github-actions[bot] bd3086f044 chore: update performance tracking 2026-02-25 2026-02-25 13:51:31 +00:00
github-actions[bot] bc3c5e729e chore: daily discovery 2026-02-25 2026-02-25 13:51:20 +00:00
github-actions[bot] 3d9c43343b chore: update performance tracking 2026-02-24 2026-02-24 13:51:30 +00:00
github-actions[bot] 9e9550f4aa chore: daily discovery 2026-02-24 2026-02-24 13:51:19 +00:00
github-actions[bot] 25de155d0b chore: update performance tracking 2026-02-23 2026-02-23 13:56:54 +00:00
github-actions[bot] 576f264c85 chore: daily discovery 2026-02-23 2026-02-23 13:55:47 +00:00
github-actions[bot] ac07e23882 chore: update performance tracking 2026-02-22 2026-02-22 13:31:47 +00:00
github-actions[bot] 41f457bd12 chore: daily discovery 2026-02-22 2026-02-22 13:31:02 +00:00
github-actions[bot] 592fe798ec chore: update performance tracking 2026-02-21 2026-02-21 13:25:44 +00:00
github-actions[bot] 01e16e987f chore: daily discovery 2026-02-21 2026-02-21 13:24:48 +00:00
Youssef Aitousarrah c792b17ab6 fix(discovery): fix three scanner hang/validation bugs found in ranker_debug.log
1. executor.shutdown(wait=True) still blocked after global timeout (critical)
   The previous fix added timeout= to as_completed() but used `with
   ThreadPoolExecutor() as executor`, whose __exit__ calls shutdown(wait=True).
   This meant the process still hung waiting for stuck threads (ml_signal) even
   after the TimeoutError was caught.  Fixed by creating the executor explicitly
   and calling shutdown(wait=False) in a finally block.

2. ml_signal hangs on every run — "Batch-downloading 592 tickers (1y)..." never
   completes. Root cause: a single yfinance request for 592 tickers × 1 year of
   daily OHLCV is a very large payload that regularly times out at the network
   layer. Fixed by:
   - Reducing default lookback from "1y" to "6mo" (halves download size)
   - Splitting downloads into 150-ticker chunks so a slow chunk doesn't kill
     the whole scan (partial results are still returned)

3. C (Citigroup) and other single-letter NYSE tickers rejected as invalid.
   validate_ticker_format used ^[A-Z]{2,5}$ requiring at least 2 letters.
   Real tickers like C, A, F, T, X, M are 1 letter. Fixed to ^[A-Z]{1,5}$.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 22:35:42 -08:00
Youssef Aitousarrah ce2a6ef8fa fix(discovery): fix infinite hang when a scanner thread blocks indefinitely
Two issues caused the agent to get stuck after the last log message
from a completed scanner (e.g. "✓ reddit_trending: 11 candidates"):

1. `as_completed()` had no global timeout. If a scanner thread blocked
   in a non-interruptible I/O call, `as_completed()` waited forever
   because it only yields a future once it has finished — the per-future
   `future.result(timeout=N)` call was never even reached.
   Fixed by passing `timeout=global_timeout` to `as_completed()` so
   the outer iterator raises TimeoutError after a capped wall-clock
   budget, then logs which scanners didn't complete and continues.

2. `SectorRotationScanner` called `get_ticker_info()` (one HTTP request
   per ticker) in a serial loop for up to 100 tickers from a 592-ticker
   file, easily exceeding the 30 s per-scanner budget.
   Fixed by batch-downloading close prices for all tickers in a single
   `download_history()` call, computing 5-day returns locally, and only
   calling `get_ticker_info()` for the small subset of laggard tickers
   (<2% 5d move) that actually need a sector label.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 22:14:53 -08:00
Youssef Aitousarrah 6a9a190af5 fix(ui): fix signal cards rendering as raw HTML in Streamlit
Two bugs were causing the signal card HTML to display as literal text:

1. CommonMark HTML block termination: Streamlit's markdown parser
   (CommonMark-compliant) terminates a <div> block at the first blank
   line. Empty optional fields (name_html, desc_html, risk_badge_html)
   left whitespace-only lines in the f-string template, ending the HTML
   block and causing the parser to render subsequent tags as text.
   Fixed by building HTML from a parts list and only appending optional
   elements when non-empty — no blank lines can appear in output.

2. Unescaped HTML chars in LLM-generated text: reason fields from the
   ranker contained raw > and & characters (e.g. '>5% move',
   '50 & 200 SMA') that corrupted the HTML structure. Fixed by running
   all LLM-generated fields through html.escape() before interpolation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 11:33:15 -08:00
Youssef Aitousarrah 07851feeda Update 2026-02-20 08:53:37 -08:00
Youssef Aitousarrah 0420e84283 Update 2026-02-20 08:44:03 -08:00
Youssef Aitousarrah 8e2392029a Update 2026-02-20 08:39:37 -08:00
Youssef Aitousarrah ec8309a34e Update 2026-02-20 08:38:15 -08:00
Youssef Aitousarrah 1c20dc8c90 feat: improve all 9 scanners and add 3 new scanners
Phase 1 - Fix existing scanners:
- Options flow: apply min_premium filter, scan 3 expirations
- Volume accumulation: distinguish accumulation vs distribution
- Reddit DD: use LLM quality score for priority (skip <60)
- Reddit trending: add mention counts, scale priority by volume
- Semantic news: include headlines, add catalyst classification
- Earnings calendar: add pre-earnings accumulation + EPS estimates
- Market movers: add price ($5) and volume (500K) validation
- ML signal: raise min_win_prob from 35% to 50%

Phase 2 - New scanners:
- Analyst upgrades: monitors rating changes via Alpha Vantage
- Technical breakout: volume-confirmed breakouts above 20d high
- Sector rotation: finds laggards in accelerating sectors

All 12 scanners register with valid Strategy enum values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 08:36:18 -08:00
Youssef Aitousarrah 573b756b4b fix(insider-buying): preserve transaction details, add cluster detection and smart priority
- Call get_finviz_insider_buying with return_structured=True and deduplicate=False
  to get all raw transaction dicts instead of parsing markdown
- Group transactions by ticker for cluster detection (2+ unique insiders = CRITICAL)
- Smart priority: CEO/CFO + >$100K = CRITICAL, director + >$50K = HIGH, etc.
- Preserve insider_name, insider_title, transaction_value, num_insiders_buying in output
- Rich context strings: "CEO John Smith purchased $250K of AAPL shares"
- Update finviz_scraper alias to pass through return_structured and deduplicate params

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 08:36:18 -08:00
Youssef Aitousarrah 2b74d298da Add scanner improvements design document
Documents the approved plan to fix signal quality issues in all 9
existing scanners and add 3 new scanners (analyst upgrades, technical
breakout, sector rotation).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 08:36:18 -08:00
github-actions[bot] 6342090a94 chore: update performance tracking 2026-02-20 2026-02-20 13:46:52 +00:00
github-actions[bot] 4f26536f46 chore: daily discovery 2026-02-20 2026-02-20 13:46:15 +00:00
github-actions[bot] aadb54e776 chore: update performance tracking 2026-02-19 2026-02-19 13:55:01 +00:00
github-actions[bot] 89c23751fa chore: daily discovery 2026-02-19 2026-02-19 13:54:25 +00:00
github-actions[bot] 4355f633b3 chore: update performance tracking 2026-02-18 2026-02-18 13:51:57 +00:00
github-actions[bot] a29cb9ca18 chore: daily discovery 2026-02-18 2026-02-18 13:51:26 +00:00
Youssef Aitousarrah 74e8703d60 Add daily price movement to charts and fix intraday data rendering
- Add daily price movement display with color coding (green/red)
- Add 1D (intraday) and 7D chart options with granular data:
  - 1D: 5-minute interval for detailed intraday view
  - 7D: hourly interval for smooth 7-day chart
- Fix discontinuous chart rendering by plotting against sequential index for intraday data
- Eliminate overnight/weekend gaps in hourly charts
- Add timezone normalization for consistent date handling between daily and intraday data
- Improve fallback logic when data is sparse
- Better handling of yfinance column names (Datetime vs Date)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-17 12:55:12 -08:00
Aitous f4dba2940c
Merge pull request #8 from Aitous/feature/discovery-enhancements
Update
2026-02-17 12:14:19 -08:00
Youssef Aitousarrah 22433d6b7d Update 2026-02-17 12:12:20 -08:00
Aitous f8c6e2afcb
Merge pull request #7 from Aitous/feature/discovery-enhancements
Update
2026-02-17 12:08:22 -08:00
Youssef Aitousarrah fd951be8bc Update 2026-02-17 12:07:07 -08:00
Aitous feccdb77fc
Merge pull request #6 from Aitous/feature/discovery-enhancements
Feature/discovery enhancements
2026-02-17 10:27:57 -08:00
Youssef Aitousarrah 457d650e42 Update 2026-02-17 10:27:13 -08:00
github-actions[bot] 60a4fdd98d chore: update performance tracking 2026-02-17 2026-02-17 13:51:48 +00:00
github-actions[bot] 743ef2c56e chore: daily discovery 2026-02-17 2026-02-17 13:50:40 +00:00
Youssef Aitousarrah aef83cd6e0 Update the price chart 2026-02-16 22:41:54 -08:00
Aitous 3c0a6b427c
Merge pull request #5 from Aitous/feature/discovery-enhancements
Feature/discovery enhancements
2026-02-16 14:18:29 -08:00
Youssef Aitousarrah 6831339b78 Remore unused code and improve the UI 2026-02-16 14:17:43 -08:00
Youssef Aitousarrah 8d3205043e Update 2026-02-16 14:17:41 -08:00
Aitous 080f626a22 Update cron schedule to run one hour earlier 2026-02-16 13:27:01 -08:00
Aitous 7f326b1df8 Update cron schedule to run one hour earlier 2026-02-16 13:25:57 -08:00