Spaces:
Sleeping
Sleeping
Commit History
-
Fix: syntax errors in ai_portfolio.py — broken string literals causing 500s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>a09244a -
Fix: portfolio builder in correct file (backend/app) — OpenRouter+Groq fallback
Dockerfile copies backend/app/ not root app/ — all previous fixes went to wrong directory. Now fixed in the right place: - OpenRouter primary (no daily token cap, uses OPENROUTER_API_KEY secret) - Groq llama-3.1-8b-instant fallback (separate quota from 70B) - Compact snapshot: top 20 BUY + 5 HOLD (~400 tokens) - Supabase price fallback when analytics cache is cold - 10-min response cache per amount bucket + risk profile Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>24992ed -
Fix: portfolio builder works on cold cache — Supabase price fallback
When analytics cache is empty (Space restart), falls back to live prices from Supabase for up to 40 stocks so the LLM can still build a portfolio. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>a408455 -
Fix: portfolio builder falls back to Groq when OpenRouter key not set
- Removes hard 503 when OPENROUTER_API_KEY is missing - Provider order: OpenRouter (if key set) → Groq llama-3.1-8b-instant - 8b-instant has separate quota from 70B so won't hit same rate limit Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>ec9821a -
Fix: switch portfolio builder from Groq to OpenRouter (no daily token cap)
- app/core/config.py: add openrouter_api_key + openrouter_url fields - app/services/ai_portfolio.py: use OpenRouter (llama-3.3-70b-instruct) with llama-3.1-8b-instruct fallback — no rate limits hitting demo - Snapshot capped at top 20 BUY + 5 HOLD (~400 tokens vs 2000+) - LLM response cached 10min per amount_bucket+risk_profile Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>ccfdc3e -
Fix: portfolio 500 error + advisor speed (Groq primary, OpenRouter fallback)
- Add groq_api_key/groq_url to Settings (was removed, breaking ai_portfolio.py) - Advisor now streams via Groq llama-3.1-8b-instant first (~300ms TTFT) with llama-3.3-70b-versatile as secondary and OpenRouter as final fallback - 8b-instant has separate higher quota — avoids the 100k TPD cap hit by 70B - Non-streaming path updated with same Groq-first ordering Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>f52660d
-
Fix: add grep command to search for "advisor" in CSS files
c366ad3 -
Fix: true OpenRouter streaming + Netlify SPA routing
- backend/app: replace word-by-word asyncio.sleep simulation with real OpenRouter SSE streaming (~500ms TTFT vs 3-5s wait + artificial delays) Cache hits stream instantly as one token (no delay at all) - frontend: add public/_redirects so Netlify serves index.html for all client-side routes instead of returning 404 on deep links Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>b0b67fb -
Perf: switch advisor to true Groq streaming (500ms TTFT vs 3-5s)
Replace the non-streaming + word-by-word simulation approach with genuine Groq SSE streaming. Tokens are forwarded to the frontend as they are generated instead of waiting for the full response first. - Removes asyncio.sleep() delays between words - Works around old httpx aiter_lines() bug via aiter_text() + manual split - Tool-call rounds still handled correctly (buffer deltas, execute, loop) - tool_use_failed retried cleanly with force_final flag Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>f4308b8 -
Fix AI advisor markdown rendering: heading hierarchy + system prompt
- Redesign CSS heading sizes so h2/h3 are visually distinct from body text (h3 was rendering at 13.3px, smaller than 14px body — unreadable hierarchy) - Make ### sub-headings render as uppercase micro-labels (violet, tracked) - Strengthen system prompt: add explicit ### guidance and mandatory blank-line rule around tables/headings (missing blank lines broke GFM table parsing) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>b812d80 -
Fix: downgrade react-markdown from v10 to v9 for proper markdown rendering
1f81d73 -
Enforce beautiful formatting: tables, math, proper numbers
934cf5d -
Fix OpenRouter model IDs + add full smoke test
fc8ab76 -
Simplify to OpenRouter only — Llama + Gemini models
78047bc -
Add OpenRouter as third LLM fallback
a3829d1 -
Fix formatting + add Gemini fallback LLM
e0f7129 -
Simplify AI Advisor: one Groq call per message, no tool calling
25c3cdb -
Fix import paths for HF Spaces deployment: services-level modules use ..
1a6d406 -
Add graceful degradation: chatbot always returns presentable response
3967f59 -
Fix TypeError: unhashable UserFinancialProfile in cache key generation
81c0902 -
Fix import paths in advisor/ module + fix circuit breaker reset + add smoke tests
f189d47 -
Overhaul AI Advisor: modular architecture, 10 tools, caching, rate limiting, prompt protection
cb6b86f -
Fix AttributeError: remove invalid yf.utils.Cache reference in backend utils
49019e5 -
Fix yfinance reliability with retries and Supabase-first data fetching
ea13f4d
-
Add initial presentation for PaisaPro.ai capstone project
- Created a new LaTeX presentation file `presentation.tex` with a complete slide deck covering the project overview, problem statement, solution, system architecture, analytics engine, machine learning models, and results. - Added a table of contents file `presentation.toc` to support the presentation structure.14fd658
-
Rewrite READMEs with latest architecture and futuristic design
fe216c7 -
Refactor remove_bad_symbols to use Supabase price data instead of yfinance
Avoids Yahoo Finance rate-limiting by querying each symbol's latest date directly from stock_prices. Flags symbols with no rows or data older than 180 days. Used to identify and remove MM (delisted) from the universe.f403f37 -
Implement script to remove stocks with no data from Supabase using yfinance
87dca3a -
Upgrade AI advisor with agentic tool-use and portfolio context injection
- Add Groq function-calling tools: get_stock_analysis, get_macro_dashboard, get_news_sentiment, run_screener with multi-turn tool loop (MAX_TOOL_ROUNDS=3) - Inject user portfolio holdings and watchlist into system prompt for personalised advice - Inject live market intelligence, macro regime, and news sentiment as context - Add PortfolioHoldingContext and WatchlistItemContext Pydantic schemas - Frontend fetches portfolio + watchlist on mount and passes to every chat request - 30-message conversation history window with typed ChatHistoryMessage schema3018093
-
Fix DataFrame truth value error in analytics pre-warm and screener
`get_nifty_df() or pd.DataFrame()` triggers pandas "truth value of a DataFrame is ambiguous" when nifty_df is a valid (non-None) DataFrame. Replace both occurrences with explicit `is not None` guard. Fixes: - Cache pre-warm crash on startup (non-fatal but caused cold starts) - Screener 500 error on first load before report cache is built5184f27 -
Add METHODOLOGY.md
e4be699 -
Rebuild ML regression with robust OHLC-aware financial models
Feature engineering: - 10 new OHLC microstructure features: intraday range (hl_pct), candle body, upper/lower wicks, overnight gap, 52-week hi/lo distance, Williams %R, Donchian channel position — captures structure that close-only indicators miss - log_vol_20d replaces vol_20d (log-vol is more normally distributed) - Tree models use 20 OHLC+base features with max_features='sqrt' for decorrelated ensemble; ElasticNet uses all 32 features with regularisation Target construction: - Vol-adjusted log return target: log(fwd/close) / realised_vol removes heteroscedasticity across different volatility regimes - Rolling trend deducted in vol-normalised space — more stationary than simple excess return approach Walk-forward CV: - Rolling 2-year training window replaces expanding window (recent regime is more predictive than 5-year-old data) - Proper embargo period (horizon//2 days) between train end and test start eliminates label leakage from forward-looking targets Model impr…5264cef -
Fix TypeScript tooltip formatter types in ModelHealth.tsx
e5cc00d -
Refactor backend architecture, add MLOps dashboard, and optimise performance
Backend restructuring: - Split 1560-line analytics.py into focused modules: universe, market_data, technical, risk, ml/classifier, ml/clustering, portfolio_optimizer, portfolio_backtester - Centralised CacheManager singleton (core/cache.py) replacing 6+ scattered local cache dicts across services - Added data repository layer (data/stock_repository.py, macro_repository.py) to consolidate all Supabase I/O - Added custom exception hierarchy (core/errors.py) Performance optimisations: - RF classifier PKL persistence: 500 models train once per day, load from disk on subsequent calls (ml/model_store.py) - ML regression bundle PKL: RF+Ridge+GBM trained once per day per symbol/horizon, inference-only on cache hits - Single-flight lock on analytics report build prevents N concurrent rebuilds - GZip middleware added (85% compression on large responses) - portfolio.py async functions now use asyncio.to_thread() — no longer blocks FastAPI event loop on Supabase calls - portfolio.py…500bec8
-
Add MCP server configuration for Supabase
fef6bbf -
Make PaisaPro logo clickable to navigate to homepage
7aa7113 -
Add macro data pipeline: yfinance → Supabase → API
Macro dashboard now reads from Supabase instead of calling yfinance directly, fixing IP blocking on HF Spaces. Includes backfill script, migration SQL, and daily scheduler refresh.aeced01 -
Add empty state to macro dashboard when data is unavailable
Shows a friendly message with retry button instead of a blank page when the market data provider doesn't respond.e3f687e -
Fix macro: use yf.download batch API to avoid Yahoo Finance IP blocks
yf.Ticker().history() returns empty on HF Spaces cloud IPs. Switch to yf.download() which uses a different, more reliable endpoint and batches all 6 tickers in one request.e57cd4d -
Fix macro dashboard: parallelize yfinance fetches with asyncio.to_thread
6 sequential blocking yfinance calls were freezing the event loop. Now all 6 run in parallel threads via asyncio.gather + to_thread.b881e10 -
Fix HF Spaces config: add YAML frontmatter + fix Dockerfile paths
1e42b4e -
Overhaul ML regression accuracy & optimise analytics backend
ML regression (ml_regression.py): - Add 12 engineered features (smoothed RSI, multi-scale momentum, realised vol, Bollinger position, SMA spread, RSI rate-of-change, volume regime) - Per-model preprocessing: RF/GBM use base features + StandardScaler; Ridge uses all 22 features + RobustScaler + winsorisation - Target demeaning with 20-day rolling trend removes regime-change bias - Walk-forward expanding-window evaluation with purging gap replaces single 80/20 split for honest, stable metrics - Regularisation tuning: RF depth 6→2, Ridge alpha 1→100, GBM depth 4→1 - R²-weighted ensemble instead of equal-weight - Fix stale prediction bug: use latest features, not truncated dataframe - RELIANCE.NS 30d: RF R² -1.38→+0.20, Ridge -0.19→+0.16, GBM -1.23→+0.17 DirAcc: RF 38%→74%, Ridge 48%→63%, GBM 38%→74% Analytics backend (analytics.py): - RF classifier: 100 trees→30, max_depth 5→3 (faster per-stock training) - KMeans: n_init 10→3 (3× faster clustering) - Report ThreadPool: 20→10 work…4e1957f -
Update Draft.MD: add ML regression module, objective #4, section 6.4.4, 17 pages
09d3028 -
Fix NotFittedError: call model.fit() before predict in _eval_model
3fb0e37 -
Remove binary team photos from git tracking (not needed on HF backend)
ae6ba43 -
Merge HF remote — keep project files
db89292 -
Add ML regression predictor with full model evaluations (RF, Ridge, GBM)
- New service: ml_regression.py — trains RF Regressor, Ridge, and Gradient Boosting on technical indicators, computes MAE/RMSE/R²/directional accuracy/5-fold CV MAE per model, ensemble prediction with 80% CI - New schema: schemas/ml_regression.py - New route: GET /advanced/ml-prediction/{symbol}?horizon=30 - New page: MLPrediction.tsx — per-model eval cards, feature importance bar chart, radar comparison chart - Wired into App.tsx, Layout.tsx, client.ts, types/index.tsc34cf1f -
Fix sector filter: align dropdown values with actual DB sector names
4b63077 -
Delete .mcp.json
Stephen BaraikDue to personel Secretsdcd8a47 -
Add MCP file type to .gitignore
cf75ef2