learning_ai_invt_trdg/web
Saravana Achu Mac 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
..
src feat: live data wiring (Alpaca/FMP) + strategy builder + screener 2026-05-04 06:16:46 -07:00
.dockerignore feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
.gitignore feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
ADMIN_TRADE_CONTROL_UI.md feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
backtesting.md feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
dashboard-metrics-contract.md feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
Dockerfile feat(web): Dockerize web app, wire to deployed backend 2026-04-13 17:48:17 +00:00
eslint.config.js feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
guided-strategy-builder.md feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
index.html feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
LIVE_PULSE_TICKER.md feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
metric-validation-runbook.md feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
NAVIGATION_ACCESS_CONTROL.md feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
nginx.conf chore(infra): vendored @bytelyst/* packages, Docker healthcheck, compose merge 2026-04-29 19:35:35 -04:00
package.json feat: live data wiring (Alpaca/FMP) + strategy builder + screener 2026-05-04 06:16:46 -07:00
pre-deploy.md feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
README.md refactor: remove live web supabase dependency 2026-04-04 18:03:49 -07:00
schema_reference.sql feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
tsconfig.app.json feat: live data wiring (Alpaca/FMP) + strategy builder + screener 2026-05-04 06:16:46 -07:00
tsconfig.json feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
tsconfig.node.json feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
vite.config.ts feat: live data wiring (Alpaca/FMP) + strategy builder + screener 2026-05-04 06:16:46 -07:00
vite.svg feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
vitest.full.config.ts feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00
workspace-system-scan-2026-02-21.md feat: scaffold trading monorepo foundation 2026-04-04 11:18:21 -07:00

Bytelyst Trading Dashboard

Real-time trading dashboard for the Bytelyst Trading Platform. Built with React 19, TypeScript, Tailwind CSS 4, and Supabase.

Features

  • AI Strategy Assistant — Chat-based profile creation using natural language (powered by Perplexity/OpenAI/Gemini). Floating robot icon available on all pages with quick-action suggestions, profile preview, and apply/cancel workflow
  • Live Market Data — Real-time price updates via Socket.IO from the bot service
  • Strategy Profile Management — Create, edit, delete, and activate/deactivate trading profiles with per-profile rule configuration. Elevated 2D card design with embedded metrics table and color-coded rule icons
  • 7-Rule Pipeline Visualization — View the strategy rule pipeline in the Admin tab
  • Position Tracking — Hybrid view of manual entries and bot-managed positions with profile attribution
  • Trade History — Complete trade ledger filtered by profile, with P&L metrics and win rate
  • Signal Monitor — Live rule-by-rule signal analysis per symbol
  • Global Config — Edit bot configuration from the dashboard
  • User Settings — Manage exchange API keys, thresholds, and preferences
  • Auth — Supabase Authentication with email/password and password reset
  • Role-Based Access — Admin tab only visible and accessible to admin users

Tech Stack

Layer Technology
Framework React 19
Language TypeScript 5.9
Build Vite 7
Styling Tailwind CSS 4
Charts Recharts
Icons Lucide React
Real-time Socket.IO Client
Database Supabase (PostgreSQL)
Auth Supabase Auth

Quick Start

Prerequisites

Installation

git clone https://github.com/saravanakumardb/bytelyst-trading-dashboard-web.git
cd bytelyst-trading-dashboard-web
npm install

Configuration

Create a .env file in the project root:

VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=eyJ...your-anon-key
VITE_API_URL=http://localhost:5000

Run

# Development
npm run dev

# Production build
npm run build

# Preview production build
npm run preview

Project Structure

src/
├── components/
│   ├── AuthContext.tsx           # Supabase auth provider + user profile
│   ├── Login.tsx                # Login / signup form
│   ├── ResetPassword.tsx        # Password reset flow
│   ├── TradeProfileManager.tsx  # Strategy profile CRUD + rule config (elevated 2D cards)
│   ├── ChatControl.tsx          # AI Strategy Assistant (floating robot + chat panel)
│   ├── GlobalConfigManager.tsx  # Bot config editor
│   ├── EntryForm.tsx            # Manual trade entry form
│   ├── SymbolCard.tsx           # Symbol price card with indicators
│   ├── PriceChart.tsx           # Recharts price history chart
│   ├── AlertFeed.tsx            # Real-time alert feed
│   ├── MarketTicker.tsx         # Horizontal price ticker
│   └── MarketOpportunities.tsx  # Market opportunity scanner
├── tabs/
│   ├── OverviewTab.tsx          # Dashboard home with symbol cards
│   ├── SignalsTab.tsx           # Live rule-by-rule signal analysis
│   ├── PositionsTab.tsx         # Active positions (manual + bot)
│   ├── HistoryTab.tsx           # Trade history with profile filter
│   ├── EntriesTab.tsx           # Manual watchlist entries
│   ├── AdminTab.tsx             # Admin panel (rules, profiles, config)
│   ├── ConfigTab.tsx            # Global bot config editor
│   └── SettingsTab.tsx          # User settings + API keys
├── hooks/
│   └── useWebSocket.ts         # Socket.IO hook for real-time data
├── lib/
│   ├── authSession.ts          # Platform-service session bootstrap + token refresh
│   └── const.ts                # Table names + constants
├── App.tsx                      # Main app layout + tab navigation
├── main.tsx                     # React entry point
└── index.css                    # Tailwind CSS imports + custom styles

Environment Variables

Variable Required Description
VITE_PLATFORM_URL Yes Platform-service API base URL
VITE_TRADING_API_URL Yes Trading backend API base URL
VITE_PRODUCT_ID No Product identifier override
VITE_SOCKET_PATH No Custom Socket.IO path

Dashboard Tabs

Overview

Main dashboard showing live market data for all tracked symbols. Each symbol card displays price, 24h change, session, signal status, indicators (EMA, RSI), and active position P&L.

Signals

Detailed rule-by-rule breakdown for each symbol showing which strategy rules pass/fail in the current market context.

Positions

Hybrid view merging manual entries and bot-managed positions. Positions are tagged as BOT (with profile name) or MANUAL. Filters by profile.

History

Complete trade ledger with:

  • Profile filter dropdown
  • Metrics bar (total P&L, win rate, trade count, avg P&L)
  • Per-trade detail: symbol, side, entry/exit price, P&L, reason

Strategy Clusters (main tab)

Elevated 2D profile cards with:

  • Aggregate stats header (total profiles, capital, P&L, trades)
  • Per-profile metrics panel (Capital, P&L, Risk) with column dividers
  • Embedded details table (active rules with color-coded icons, max daily loss, max open trades, order type, cooldown)
  • Win rate progress bar with gradient fill
  • Edit drawer with General / Rules / Risk & Execution tabs
  • AI chat-created profiles appear instantly

Admin (admin-only)

Three sub-sections:

  • Strategy Pipeline — Read-only pipeline view of the 7 strategy rules
  • Global Config — Edit bot key-value configuration
  • Debug — Dashboard environment variables and bot configuration display (fetched from /api/config)

Settings

User account settings: name, exchange API keys (paper + live), trading thresholds, and notification preferences.

Database Tables

The dashboard reads/writes these Supabase tables (defined in lib/const.ts):

Constant Table Usage
tableNameStocks entries Manual watchlist entries
tableNameTransactions trade_history Completed trades
tableNameOrders orders Active/pending orders
tableNameProfiles trade_profiles Strategy profiles
tableNameUsers users User accounts
tableNameBotConfig bot_config Global configuration

Connecting to Bot Service

The dashboard connects to the bot service via:

  1. Socket.IO — Real-time updates (prices, signals, positions, alerts)
  2. REST API — Status checks, manual trades, config reads

Set VITE_API_URL to point to your bot service instance. The connection status is shown in the header.

License

Private