Spaces:
Running
Running
Commit History
-
fix: retrospective agent evaluated wrong month and crashed; persist its analysis to Reports tab
Bibhu Mishra +1: Claude Sonnet 5The retrospective always evaluated (current month - 1), so when trading went live mid-June it kept evaluating an empty May instead of June where the real trades were, silently skipping strategy tuning. Now falls back to the current in-progress month when trading started after the naive previous month. Also fixes a MultipleResultsFound crash once a month has more than one portfolio snapshot, and a "^SPY" ticker typo (the caret prefix is for indices, not the SPY ETF) that made get_spy_monthly_return always return None. Also adds a retrospective_reports table + /retrospective-reports API + a "Monthly Retrospective" tab on the Reports page, so the pattern analysis, tuning rationale, and PDF that the agent already produces are persisted and visible in the UI instead of living only inside the PDF and the raw run log. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>a381fc9
-
fix: shift retrospective cron from 5AM to 4AM UTC to stay Sunday in CDT
Bibhu Mishra +1: Claude Sonnet 4.65AM UTC is midnight Monday in CDT (UTC-5), causing is_last_sunday_of_month() to see Monday and skip the run. 4AM UTC is 11PM CDT / 10PM CST — always still Sunday in Chicago regardless of DST. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>dd31aae
-
fix: correct legend colors and SPY% missing in monthly P&L chart
Bibhu Mishra +1: Claude Sonnet 4.6SPY%: switch Yahoo Finance fetch from 1mo to 1d interval so incomplete current months still resolve to the latest available daily close. Legend colors: add explicit series-level color to each series so ECharts uses the right color in the legend icon (bar series was falling through to the default palette instead of green). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1edbe67 -
feat: overlay portfolio % vs SPY % on monthly realized P&L chart
Bibhu Mishra +1: Claude Sonnet 4.6API: monthlyPnl() now also returns portfolio_pct (cumulative % gain from initial $5000 using portfolio snapshots) and spy_pct (cumulative SPY % from portfolio start date, fetched from Yahoo Finance monthly data). UI: adds a right y-axis for %, a legend, and two line series (Portfolio % in blue, SPY % in dashed amber) over the existing P&L bars. Chart height bumped to 260px to accommodate the legend. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>b61efdf
-
feat: distinguish scheduled vs manual agent run triggers in UI
Bibhu Mishra +1: Claude Sonnet 4.6Previously all workflow_dispatch calls (both NestJS cron and UI button) were indistinguishable — the Python agents always received 'manual'. Now a triggered_by input is passed through the GitHub dispatch payload so the DB stores 'scheduled' for cron-fired runs and 'manual' for UI-triggered runs, which the AdminView already displays via run.triggered_by. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>6d86537
-
feat: fix portfolio chart — time axis, P&L lines, live today point
Bibhu Mishra +1: Claude Sonnet 4.6Three issues fixed on 'Portfolio Value Over Time': 1. Category x-axis spaced dates equally regardless of real time gaps; switched to ECharts time axis so spacing reflects actual calendar gaps. 2. No P&L data — backend now enriches each snapshot with cumulative realized P&L (from SELL transactions) and derived unrealized P&L (total_value - 5000 - realized_pnl). Dual right Y-axis shows P&L scale separately from the ~$5000 portfolio value scale. 3. No current-state point — a live 'today' data point is appended using the already-loaded portfolio/summary/price data once prices finish loading, so the chart always reaches the present. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1cc69ca -
fix: replace @nestjs/schedule with node-cron to fix HF startup crash
Bibhu Mishra +1: Claude Sonnet 4.6@nestjs/schedule caused npm to hoist @nestjs/core and @nestjs/common to root node_modules, while @nestjs/platform-express stayed in api/node_modules. Root @nestjs/core could not resolve @nestjs/platform-express, causing 'No driver (HTTP) has been selected' on startup and process.exit(1). Switch to node-cron (no @nestjs peer deps) via OnModuleInit. Restore the package-lock.json @nestjs layout to api/node_modules only. Remove ScheduleModule.forRoot() from AppModule. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>e182237 -
fix: run Market Analyst at 8:30 AM EST (13:30 UTC) with force=true
Bibhu Mishra +1: Claude Sonnet 4.6Pre-market research runs before NYSE open, so market_hours.py's 9:30 AM time-window check would block it in winter with force=false. Using force=true lets it run at 8:30 AM EST year-round; the Mon-Fri cron pattern still excludes weekends and the Python agent handles its own data availability. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>f9dc668 -
feat: move agent scheduling from GitHub Actions cron to NestJS in-process
Bibhu Mishra +1: Claude Sonnet 4.6GitHub Actions cron was unreliable (delays, skipped runs). Scheduling is now owned by the NestJS process running on HuggingFace (kept alive by keepalive.yml). All three agent workflows are now workflow_dispatch- only; the NestJS scheduler dispatches them at the correct UTC times. Changes: - Remove schedule: triggers from market_analyst, paper_trader, retrospective - Add retrospective to AgentRunsScheduler (Mon 05:00 UTC, force=false so run_retrospective.py's last-Sunday-of-month check still gates it) - Shift Market Analyst from 13:30→14:30 UTC so it falls within NYSE hours in both EDT (10:30 AM) and EST (9:30 AM) seasons - All scheduled dispatches use force=false so market_hours.py holiday and time-window checks apply; force=true is preserved for manual UI triggers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>09053ad -
feat: add NestJS in-process scheduler to replace unreliable GitHub cron
Bibhu Mishra +1: Claude Sonnet 4.6GitHub Actions scheduled workflows were firing hours late or not at all. This adds @nestjs/schedule with four @Cron jobs inside the NestJS process (which stays live via the keepalive workflow) to dispatch the same workflow_dispatch calls at the correct UTC times: - Market Analyst: 13:30 UTC Mon-Fri - Paper Trader: 14:30, 17:00, 19:45 UTC Mon-Fri Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>fd6fef0
-
fix: PDF proxy, 0-qty positions, portfolio chart dedup, SQLite UTC dates
Bibhu Mishra +1: Claude Sonnet 4.6- PDF: remove partial select in getPdfPath (TypeORM select:{} quirk returned null even when row exists); fall back to GH_TOKEN env var in addition to GITHUB_TOKEN so HuggingFace secret naming doesn't matter - Positions: filter quantity > 0 in portfolio service so 0-qty open positions are hidden from dashboard and the open-positions table - Portfolio chart: deduplicate snapshots to one per calendar day (last value wins) to avoid repeated X labels and a cluttered line; rotate labels when many days; proper $ formatter on Y axis - SQLite dates: add SqliteDateSubscriber that undoes the local-timezone shift Node applies when parsing bare "YYYY-MM-DD HH:MM:SS" strings, so local dev times match the PostgreSQL pg-type-parser fix in production Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>73e0e3c -
feat: PDF proxy, 0-qty filter, dashboard unrealized P&L, compact mobile cards
Bibhu Mishra +1: Claude Sonnet 4.6- Reports: proxy PDF through API with GITHUB_TOKEN instead of bare redirect (fixes private-repo PDFs that 401'd in the browser) - Transactions: filter quantity > 0 at query level to hide bad 0-qty records - Dashboard: add 6-card KPI row (portfolio value, unrealized P&L, realized P&L, buying power, win rate, open positions), live open-positions table with current price/unrealized P&L/target/stop/age, improved chart options - TransactionsView: tighten mobile card padding (12→8px) and font (0.85→0.78rem) so cards are visibly more compact Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>d932d1d -
fix: correct UTC timestamp parsing — pg treated bare timestamps as local time
Bibhu Mishra +1: Claude Sonnet 4.6Root cause: PostgreSQL's pg driver returns TIMESTAMP WITHOUT TIME ZONE (OID 1114) as a bare string like "2026-06-19 14:45:00" with no timezone indicator. Node's Date constructor then treated it as *local* time, baking the server's TZ offset into the JSON before the browser saw it. A CDT user would see "02:45 PM" instead of "9:45 AM" for a value stored as 14:45 UTC. Fix: register pg type parsers in app.module.ts that append 'Z' before constructing the Date, so timestamps are always interpreted as UTC. Also tighten format.ts to use the same normalisation as a defence-in-depth for the local SQLite dev path and any remaining edge cases. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>b2f5bb7
-
Fix SPA fallback: register before app.listen() to precede NestJS router
Bibhu Mishra +1: Claude Sonnet 4.6Middleware added after app.init() runs after NestJS's 404 handler, so unmatched routes never reach it. Register the SPA fallback before app.listen() (which calls app.init() internally), with an /api guard so API requests fall through to NestJS while all other paths get index.html. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>fe18a0f -
Replace ServeStaticModule with plain Express middleware for SPA routing
Bibhu Mishra +1: Claude Sonnet 4.6@nestjs/serve-static v5 has incompatible wildcard syntax issues with Express 5 / path-to-regexp v8 (/* and /{*path} both cause errors). Instead, serve static files with express.static() before NestJS routes, then add a catch-all Express handler after app.init() that serves index.html for any request not handled by API routes or static files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>eda9962 -
Fix ServeStaticModule renderPath for Express 5 / path-to-regexp v8
Bibhu Mishra +1: Claude Sonnet 4.6path-to-regexp v8 rejects unnamed wildcards (/* is invalid). Use /{*path} which is the Express 5 named-wildcard syntax. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>34d7c8b -
Fix SPA refresh 500 and agent trigger error handling
Bibhu Mishra +1: Claude Sonnet 4.6- ServeStaticModule: fix exclude pattern from glob '/api*' to path-to-regexp '/api/(.*)' and add renderPath '/*' for SPA fallback; v5 uses path-to-regexp so the old glob was silently not matching - Agent trigger: throw InternalServerErrorException instead of returning 200 with error message when GITHUB_TOKEN is missing or dispatch fails - AdminView: surface the server error message in the error toast Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>6bc99c7 -
Add GitHub Actions CI/CD, HF Space deployment, market hours guard, and static serving
Bibhu Mishra +1: Claude Sonnet 4.6- Dockerfile (multi-stage Node build, port 7860 for HuggingFace) - .github/workflows/deploy-hf.yml — force-push to HF Space on every main push - .github/workflows/market_analyst.yml — cron 9:30 AM CST Mon–Fri + workflow_dispatch - .github/workflows/paper_trader.yml — crons 10 AM / 12 PM / 2:45 PM CST Mon–Fri - .github/workflows/retrospective.yml — cron Mon 5 AM UTC (Sun 11 PM CST), no market gate - agents/core/market_hours.py — check_or_exit() exits cleanly when market is closed; FORCE_RUN=true bypasses (set automatically on workflow_dispatch from admin) - Market Analyst and Paper Trader call check_or_exit() at startup - api/src/app.module.ts — ServeStaticModule serves ui/dist when present (production) - api/src/main.ts — add HuggingFace Space origin to CORS - api/src/agent-runs/agent-runs.service.ts — trigger() now dispatches GitHub Actions workflow_dispatch with force=true instead of spawning local shell scripts - ui/src/views/AdminView.vue — live market-hours banner + market tag…abc493d