You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A complete client-side vanilla HTML/JS crypto trading research platform with charting, signal generation, backtesting simulation, paper trading, and a Python research engine — backed by Supabase for persistence. No build step, no npm, no framework churn.
Quick Start.
cd crypto-etl
python -m http.server 8080# Open http://localhost:8080
That's it. Just serve the static files — no npm install, no build step, no backend server.
Pages & Features
Page
File
Description
Landing
index.html
Entry point with navigation to Charts, Research, and Simulation
Charts
charts.html
Candlestick chart (Lightweight Charts v5), 12+ indicators, signal builder with BUY/SELL markers, paper trading panel (long/short, positions, live P&L, order history)
Research
research.html
Cross-pair sentiment consensus, best strategies per symbol, research history, sortable/expandable results table
CRITICAL: calculatePnL() guards against quantity===0 || entryPrice===0 (no NaN/Infinity)
CRITICAL: getVolatilityAdjustedReturn() uses Math.abs(maxDrawdownPct) + explicit zero check (fixes wrong-sign for negative drawdown convention)
HIGH: ExecutableSignal constructor — dead if-block removed; _executed=true when both exec params provided; params reordered to mirror Signal (signalId after metadata)
HIGH: getChartColor/Shape() throw on unrecognized directions (no silent SELL default)
MEDIUM: Type guards in formatForChart(), toChartMarker(), formatForDisplay()
LOW: Math.floor→Math.round in toChartMarker(); expanded validateCalculation() (fee consistency); createdAt on ExecutableSignal; exports refactored (single source api object); calculatePositionSize() throws on zero riskAmount
All exports preserved: Signal, SignalMetadata, ConfidenceFactors, MarketSnapshot, BacktestTrade, PnLBreakdown, ResearchResult, PerformanceMetrics, ExecutableSignal (accessible as Contracts.X or global X).
All frontend operations use the anon key with RLS. Service role key is scripts-only (ETL, research engine).
Strategy Research Engine (strategy_research.py)
Strategy
Logic
rsi_reversion
Oversold/overbought mean reversion
macd_crossover
Signal line cross + histogram confirmation
bollinger_reversion
Touch of lower/upper band
ema_crossover
Fast/slow EMA cross
stoch_rsi
K/D cross with overbought/oversold zones
keltner_breakout
Close above/below KC + volume confirmation
rsi_adx_combo
Trend strength filter + RSI entries
rsi_volume_combo
Volume-weighted RSI extremes
buy_and_hold
Baseline (included in batch, filtered from optimization)
Running Research
cd crypto-etl
$env:SUPABASE_URL="https://ymnlqggxeeyqvrojsrzh.supabase.co"$env:SUPABASE_SERVICE_ROLE_KEY="<key>"# Quick run (smaller param grid, 1-2 min)
python strategy_research.py --quick
# Full sweep (30 symbols × 3 timeframes, wide grids, hours)
python strategy_research.py
# Results → strategy_results.csv + Supabase strategy_results (scoped to run_id)
ETL Scripts
cd crypto-etl
$env:SUPABASE_URL="https://ymnlqggxeeyqvrojsrzh.supabase.co"$env:SUPABASE_SERVICE_ROLE_KEY="<key>"# Current price snapshot (fast, runs every 30 min via GitHub Actions)
python etl.py
# Historical data (slow — years of OHLCV per symbol, paginated CCXT fetch)
python historical_etl.py
GitHub Actions CI/CD
Workflow
Schedule
Purpose
schedule.yml
*/30 * * * *
Current price snapshots (etl.py)
historical_etl.yml
5 0 * * *
Daily historical OHLCV fetch
research.yml
0 6 * * 1
Weekly strategy research (Monday 06:00 UTC)
All workflows run on ubuntu-latest with explicit dependency installs and artifact uploads.
Rule:vibe-trading/ is READ-ONLY. Never modify, copy from, or depend on it. All development in crypto-etl/.
Key Design Decisions (ADR Summary)
Decision
Rationale
Vanilla HTML/JS (no build)
Instant iteration, zero config, deploy anywhere
Lightweight Charts (canvas)
Handles 10k+ bars smoothly, no WebGL dependency
All indicators client-side
12+ types in vanilla JS; instant response, no server
Supabase anon key + RLS
Safe frontend writes; service role never in browser
One-tick execution lag
Signals on candle N close → fill on N+1 open (realistic)
Bounded non-compounding sizing
5–15% of initialCash, 15% equity cap (no snowball)
Volume-aware slippage
Scales with order size / available volume
Walk-forward validation
IS/OOS split prevents lookahead bias
Domain randomization (GARCH)
Per-seed regime variation; same seed = identical regime
Deterministic PRNG (mulberry32)
Seeded reproducibility for backtests
Supabase Key Rules
Key
Type
Where Used
SUPABASE_URL
Public URL
Everywhere
Anon key
Publishable
Frontend HTML (RLS-protected SELECT/INSERT)
Service role key
Secret
Python scripts only (ETL, research engine)
Never hard-code service role key in frontend. Never log/print it.
Known Issues & Open Items
Issue
Status
Notes
GARCH price clamp artifact
Open
Realism mode pins price at 10× floor/ceiling ~1.5–3% ticks; strategies "arbitrage" clamps → inflated alpha. 5-step refactor removed compounding sizing; alpha collapsed from +8912%/+2369% → +444%/+411%. Remaining edge may be genuine or clamp-related.
Paper trading cash reset
Unresolved
No persistence to equity curve on reload
Strategy→chart traceability
Unresolved
No signal_id linking research to chart markers
Duplicated strategy/indicator logic
Documented
Python (research) vs JS (chart) — intentional independence
No paginated data loading
Unresolved
All bars loaded at once
No walk-forward UI
Unresolved
IS/OOS labels exist in data, not wired in UI
Development Workflow
# Serve UI
cd crypto-etl
python -m http.server 8080# Run ETL (requires Supabase env vars)$env:SUPABASE_URL="..."$env:SUPABASE_SERVICE_ROLE_KEY="..."
python etl.py # Quick price snapshot
python historical_etl.py # Full historical (hours)
python strategy_research.py # Full research sweep (hours)# Syntax check JS
node --check js/simulation.js
node --check js/contracts.js
node --check js/backtest.js
# Run batch backtest (headless, Node)
node -e "require('./js/backtest.js').runBatchBacktest({seeds:5,ticks:1000})"
License
Internal research tooling — not for production trading. All strategies are backtested on synthetic or historical data; past performance ≠ future results.
Last updated: 2026-07-31 See PROJECT_STATUS.md for detailed change history and ROADMAP.md for phased plan.