Spaces:
Running
Running
Commit History
-
Real direction-accuracy/P&L measurement + BULLISH trigger fixes
Khanna, Videh Rakesh Rakesh +1: Claude Sonnet 5The backtest only ever graded whether price touched a predicted band (target_hit_for_tf), which a deliberately low near-bound wins regardless of whether a direction call has any real edge. Added a standing real DirAcc + net P&L report (TABLE 6, research/backtest.py) and used it to find and fix three BULLISH triggers that were worse than a coin flip (T4, T5, T7 in ai_forecast.py), plus a relative-strength-vs-Nifty guard that blocks BULLISH on stocks structurally underperforming the market (mirrors ml_predictor's already-validated excess-of-Nifty labels). Net result on a 200-row diverse backtest: 1D BULLISH direction accuracy improved 54.2% -> 56.4% on 12 of 15 tickers; 3 known-hard stocks (HDFCBANK, TITAN, SUNPHARMA) remain a resistant drag after extensive targeted iteration - accepted as a genuine ceiling, not a fixable bug. Also includes the earlier, separately-validated INTRADAY/1D NEUTRAL-band widening (1D target_hit_for_tf 83.3% -> 88.9%) and a real bug fix: the Ollama fallback's…5342112
-
refactor: remove GitHub Models + Anthropic; unify LLM provider chain
Khanna, Videh Rakesh Rakesh +1: Claude Sonnet 4.6Drop GitHub Models (GITHUB_TOKEN) and Anthropic (ANTHROPIC_API_KEY) entirely — neither is in active use. All LLM calls now use a single OpenRouter → Groq → HuggingFace waterfall, consistent across ai_forecast.py and news_sentiment.py (previously news_sentiment only had GitHub + OpenRouter). - Delete model_picker.py (GitHub Models-only utility, not imported anywhere) - ai_forecast.py: remove _try_github(), _GITHUB_DISABLED_UNTIL, update provider order to [openrouter, groq, huggingface] - news_sentiment.py: remove GitHub block; add Groq + HF providers to match ai_forecast.py's 3-provider chain - app.py: remove github_token from provider status dict - research/loop_backtest.py: replace GitHub readiness check with Groq + HF - research/compare_predictors.py: update CLI defaults to openrouter/groq - .env.example: remove GITHUB_TOKEN and ANTHROPIC_API_KEY entries Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>6f2bcff
-
feat: bearish neutralization guard, T7 trigger, WhatsApp alerts, equity curve + portfolio review
Khanna, Videh Rakesh Rakesh +1: Claude Sonnet 4.6ai_forecast: add T7 (slow positive drift) trigger to 1D/3D/5D; loosen T4/guard RSI+BB thresholds to 50/45% (from 46/40%); add bearish neutralization guard (BEARISH → NEUTRAL when momentum > -3% and BB < 65% and RSI < 60 and no bull trigger fired); Nifty-EMA200 context in bearish guard. app.py: WhatsApp HIGH-confidence alerts on watchlist refresh (no-op if env not set); /api/equity-curve endpoint; /api/portfolio-review batch AI trade coach endpoint. risk_engine: include_curve=True support for equity curve data. top5_picker: refactored for reliability. research: backtest + loop_backtest + validate_on_trades updates; confidence calibration tuned. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>edd5dd2
-
fix: HF provider circuit-breaker, add Groq/HF fallback chain, trigger rules
Khanna, Videh Rakesh Rakesh +1: Claude Sonnet 4.6- Fix HF _DISABLED_UNTIL being set on first 429 instead of after all models exhausted - Remove time.sleep(2) from Groq and HF 429 handling (slows 4-call debate) - Add Groq + HuggingFace as providers 3 & 4 in _make_chat_call chain - Add trigger-based direction rules to synthesis prompt (T1-T6, B1-B2) - Add 10D/20D momentum, BB position, consecutive days to context block - Add direction/confidence guards for malformed LLM output - Shorten HF disabled cooldown to 30s (last-resort provider) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>6ef59ab
-
fix: load dotenv in ai_forecast, improve top5 5D scoring, harden HF repo IDs
Khanna, Videh Rakesh Rakesh- ai_forecast.py: add load_dotenv() so API keys load outside Flask context (fixes 'AI unavailable' when running top5_picker/backtest directly) - ai_forecast.py: add 401/403 error logging for GitHub Models + OpenRouter so key/scope failures are visible in logs instead of silent debug drops - top5_picker.py: replace confidence-tier sort with composite 5D profit score (ret_hi × conf_mult × ml_factor × rr_factor × sector_factor) - top5_picker.py: add min thresholds (ret_hi>1%, R:R>=1.2) to filter weak setups - top5_picker.py: widen candidate pool to 2×top_n, re-rank after full debate run - database.py: read HF_DATA_REPO_ID from env (default: V1deh/papertrade-data) - app.py: use db._HF_REPO_ID instead of hardcoded string04219e7
-
Add bear-direction fixes, research scripts, market_calendar, and gitignore cleanup
Khanna, Videh Rakesh Rakesh +1: Claude Sonnet 4.6- ai_forecast.py: bear midpoint clamped to -0.10%, bearish direction override, stricter thresholds - app.py / static/app.js: UI and API improvements - CLAUDE.md: updated backtest accuracy docs (85-94% on N=67 small sample) - market_calendar.py: new module for NSE trading calendar - research/: add all backtest and analysis scripts - .gitignore: exclude cache files, memory/, .github/, .vscode/, DB WAL files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>74d4035