Commit Graph

36 Commits

Author SHA1 Message Date
938ed86044 feat: live data wiring (Alpaca/FMP) + strategy builder + screener
Wires the new dashboard to real market data and adds the strategy
builder & screener UIs that were stubbed in the previous commit.

Frontend (web/src/):
- lib/marketApi.ts: authenticated fetch helpers for chart bars,
  market indices, news, and FMP research endpoints
- views/HomeView.tsx: StockChart now fetches live OHLCV via
  fetchChartBars on symbol/period change with loading/error states;
  ResearchCards replaces the static placeholder with live FMP
  profile/metrics/earnings (next-earnings + last 3 historical)
- components/layout/Header.tsx: live SPY/DIA/QQQ price + change%
  via fetchMarketIndices, refreshing every 60s; removed unused
  static sparkline placeholder
- components/strategy/VisualRuleBuilder.tsx: drag-and-drop IF/THEN
  rule composer using @dnd-kit (RSI/MACD/EMA/Price/Volume,
  above/below/crosses, BUY/SELL with shares or % of capital);
  saves via POST /api/profiles
- components/strategy/CodeStrategyEditor.tsx: Monaco editor with
  JS strategy template; "Run Backtest" posts to /api/backtest and
  renders return/win-rate/Sharpe/drawdown plus trade log
- views/ResearchView.tsx: adds "Visual Builder" and "Code Editor"
  sub-tabs alongside Strategies / Signals / Backtesting
- views/ScreenerView.tsx: live FMP screener with market-cap and
  sector filters, sortable columns, click-to-load-symbol routing
- index.css: light theme background; @keyframes spin for loaders
- App.dom.test.tsx: rewritten for router-based AppShell (was
  asserting on the removed tab UI; fixes 5 prior failures)

Backend (backend/src/services/apiServer.ts):
- /api/chart/bars: detects crypto symbols (contains "/") and
  routes to Alpaca v1beta3/crypto/us/bars; equities use
  v2/stocks/{symbol}/bars with iex feed
- (existing) /api/news, /api/market/indices, /api/research/{
  profile,metrics,earnings}, /api/screener proxy endpoints

Build/config:
- web/vite.config.ts: dedupe react / react/jsx-runtime /
  react-router-dom so the vendored react-auth dist resolves the
  same React instance (fixes "Cannot resolve react/jsx-runtime"
  Rollup error)
- web/tsconfig.app.json: exclude shared/platform-clients.ts and
  shared/platform-mobile.ts (mobile-only, missing RN SDK)
- web/package.json: add react-router-dom, @monaco-editor/react,
  @dnd-kit/core, @dnd-kit/sortable, @dnd-kit/utilities

Verification: `npm run build` in web/ → clean (✓ built in 3s);
backend tsc --noEmit → clean. Test suite: 151/155 pass; the 4
remaining failures are pre-existing (3 useTabFeatureFlags module
cache leaks, 1 EntryForm), not introduced here.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 06:16:46 -07:00
f62c3b15ee feat: full web dashboard redesign + 6 new API proxy endpoints
Replaces the 12-tab dashboard with a 3-column layout matching the
investing app mockup (sidebar nav, main chart area, right panel).

Web changes:
- New context/AppContext.tsx — shared botState/auth across all views
- New layout: Sidebar, Header (with market index sparklines), RightPanel
- New views: Home, Portfolio, Research, Markets, Screener, Watchlist, Alerts, Settings
- AppShell wires React Router routes to all views
- App.tsx refactored to use AppContext.Provider + BrowserRouter

Backend changes:
- 6 new proxy endpoints: /api/news, /api/market/indices,
  /api/research/profile, /api/research/metrics,
  /api/research/earnings, /api/screener
- config/index.ts: FMP_API_KEY env var added

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 23:50:01 -07:00
4cfb446f57 feat(backend): WebSocket namespaces, audit persistence, tab flags, telemetry
- Add /trading and /admin named Socket.IO namespaces; root namespace kept for
  backward compat; admin namespace rejects non-admins at connect time
- Wire auditRepository.ts: persist TradeAuditEvent to Cosmos audit-events
  container (best-effort); expose GET /api/admin/audit for admin queries
- Add tradingTelemetry singleton (Node.js Map-based storage adapter); init
  and fatal-error tracking wired in index.ts main()
- Add TAB_MARKETPLACE_ENABLED / TAB_MEMBERSHIP_ENABLED config flags; expose
  tabs.* shape in GET /api/feature-flags response
- Fix SupabaseService URL validation (regex check before createClient)
- Wire check:api-contract and check:audit-repository into npm run test
- Switch @bytelyst/* deps to file:../vendor/* references

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-29 19:35:00 -04:00
aaa516122e feat(backend): wire Azure Key Vault secret resolution at startup
- Add bootstrap.ts as new entry point — resolves Key Vault secrets via
  DefaultAzureCredential before config/index.ts is evaluated, so all
  process.env reads pick up KV values (Azure CLI in dev, Managed Identity
  in prod). Falls back to .env if AZURE_KEYVAULT_URL is not set.
- Define INVTTRDG_SECRETS mappings for Cosmos, Azure OpenAI, product-id
- Add AZURE_OPENAI_ENDPOINT / KEY / DEPLOYMENT to config
- aiClient: prefer AzureOpenAIProvider (AI Foundry) when Azure OpenAI
  config is present; falls back to direct OpenAI if not configured
- Add @azure/identity, @azure/keyvault-secrets, @bytelyst/config deps
- Update dev/start scripts to use bootstrap.ts entry point
- Document AZURE_KEYVAULT_URL and Azure OpenAI vars in .env.example

Key Vault: https://kv-mywisprai.vault.azure.net/
Secrets prefix: invttrdg-*

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 18:28:47 -07:00
c3651f5696 feat(backend): replace custom aiClient with @bytelyst/llm platform package
- Import PerplexityProvider, OpenAIProvider, GeminiProvider from @bytelyst/llm
- Use createFallbackChain() instead of manual axios fallback loop
- Remove axios and @types/axios — no longer needed
- Preserve AIClient class interface (generateAnalysis, getProviderHealth) —
  no changes required in apiServer.ts or AIAnalysisRule.ts
- Fallback order still driven by config.AI.FALLBACK_LIST

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-05 12:50:34 -07:00
7884639876 refactor(backend): route legacy Postgres access through legacySupabaseClient
Made-with: Cursor
2026-04-04 19:30:15 -07:00
72ec663125 refactor(backend): extract UserConfig to tradingUserTypes
Made-with: Cursor
2026-04-04 19:02:45 -07:00
12cedd12da fix(backend): route alerts admin scoping through isTradingAdmin
Made-with: Cursor
2026-04-04 18:58:06 -07:00
b306f3264e refactor(backend): extract shared trading persistence types from SupabaseService
Made-with: Cursor
2026-04-04 18:56:20 -07:00
774541289a refactor(backend): resolve legacy Supabase client inside capital ledger repository
Made-with: Cursor
2026-04-04 18:53:29 -07:00
f0dd2055bf refactor(backend): resolve legacy Supabase client inside user, profile, and snapshot repositories
Made-with: Cursor
2026-04-04 18:47:23 -07:00
b632a0d946 refactor(backend): resolve strategy preset legacy client inside repository
Made-with: Cursor
2026-04-04 18:28:35 -07:00
9898289974 chore(backend): clarify legacy Supabase disabled diagnostic
Made-with: Cursor
2026-04-04 18:28:19 -07:00
1b8740a7f5 fix(backend): align startup logs and validateConfig with Cosmos-first user store
Made-with: Cursor
2026-04-04 18:23:34 -07:00
b4d312ce74 refactor: remove dynamic config legacy fallback 2026-04-04 18:13:41 -07:00
5bba149a7b refactor: share feature flag contract across backend and web 2026-04-04 18:10:34 -07:00
5d3be081ee refactor: move runtime trading records to cosmos 2026-04-04 17:48:49 -07:00
e043f3c79d refactor: move user metadata and presets onto cosmos paths 2026-04-04 17:24:55 -07:00
0baf32bfcf feat: add explicit feature flag contract 2026-04-04 17:18:20 -07:00
77c7b32ac0 refactor: seed cosmos stores and standardize request ids 2026-04-04 17:16:18 -07:00
b433686776 refactor: move web trading data behind backend apis 2026-04-04 16:49:18 -07:00
560c95a599 refactor: move capital ledger to cosmos-first repository 2026-04-04 16:37:54 -07:00
5c4c001f35 refactor: move distributed locks to cosmos-first repository 2026-04-04 16:33:27 -07:00
733874bb6d refactor: move backend snapshots to cosmos-first repository 2026-04-04 16:30:53 -07:00
1f2b7bdf89 refactor: align reconciliation runtime flows with repository 2026-04-04 16:28:59 -07:00
d1da7ec70c refactor: route backend order history access through repository 2026-04-04 16:25:46 -07:00
2b36fca143 refactor: move backend boot user discovery into repositories 2026-04-04 16:18:27 -07:00
50defe1890 refactor: centralize backend profile metadata lookups 2026-04-04 16:12:41 -07:00
ebaabaed47 feat: move manual entries behind backend api 2026-04-04 16:09:21 -07:00
44f3171783 refactor: route settings and config through backend apis 2026-04-04 15:50:44 -07:00
5b59257a4b refactor: move profile manager onto control plane 2026-04-04 15:41:15 -07:00
535e0a88a9 refactor: move profile reads onto backend api 2026-04-04 15:36:54 -07:00
42420687f9 feat: move core web profile flows behind backend api 2026-04-04 15:02:15 -07:00
b551ab2a4f feat: move dynamic config behind backend control plane 2026-04-04 14:26:12 -07:00
d78aeeffc2 feat: adopt platform auth and cosmos trading control 2026-04-04 13:13:08 -07:00
3cbbd6ccaa feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00