How titan-255/defi-guardian-even-g2 works
DeFi Guardian combines a React wearable companion with a FastAPI service for live crypto intelligence, alerts, read-only wallet monitoring, and simulated trading. The user-facing workflow is: view live prices, inspect anomaly analysis, review portfolio or alerts, and preview then confirm a paper trade; Even G2 gestures navigate the screens. The graph preserves the documented browser-side statistical fallback and optional CoinGecko integration. Some subsystems are supported by README or source-index references rather than sampled implementation excerpts, so their links are limited to those explicit relationships.
Main entry points: App.tsx Screen coordinator · main.py FastAPI application · hyperliquid.py Hyperliquid service · database.py SQLite state
Components 33
Wearable companion
- G2 glasses
- Screen coordinator
frontend/src/App.tsx - Even Hub bridge
frontend/src/services/evenBridge.ts - Market glance
frontend/src/components/MarketGlance.tsx - AI insight
frontend/src/components/AiInsight.tsx - Market attention
frontend/src/components/MarketAttention.tsx - Portfolio screen
frontend/src/components/PortfolioView.tsx - Paper trading screen
frontend/src/components/PaperTradingView.tsx - Alerts screen
frontend/src/components/AlertsView.tsx - Settings screen
frontend/src/components/SettingsView.tsx - Companion dashboard
frontend/src/components/CompanionView.tsx - API and fallback
frontend/src/services/api.ts
Backend API
- FastAPI application
backend/app/main.py - Market routes
backend/app/routers/market.py - Intelligence routes
backend/app/routers/intelligence.py - Portfolio routes
backend/app/routers/portfolio.py - Trading routes
backend/app/routers/trading.py - Alert routes
backend/app/routers/alerts.py - Wallet routes
backend/app/routers/wallet.py - Health routes
backend/app/routers/health.py - Demo reset
backend/app/routers/demo.py - Request and response schemas
backend/app/schemas.py
Market intelligence
- Hyperliquid service
backend/app/services/hyperliquid.py - Hyperliquid API
- CoinGecko service
backend/app/services/coingecko.py - CoinGecko API
- Market aggregation
backend/app/services/market_service.py - Isolation Forest engine
backend/app/services/anomaly_engine.py
Portfolio and safety
- Alert evaluation
backend/app/services/alerts.py - Paper trading engine
backend/app/services/paper_trading.py - SQLite state
backend/app/database.py - Mutation guard
backend/app/security.py
Other components
- Wearable user
Connections 47
- Wearable user → G2 glasses: gestures
- G2 glasses → Even Hub bridge: sends events
- Even Hub bridge → Screen coordinator: notifies navigation
frontend/src/App.tsx - Screen coordinator → Even Hub bridge: initializes and subscribes
frontend/src/App.tsx - Screen coordinator → Market glance: renders screen
frontend/src/App.tsx - Screen coordinator → AI insight: renders screen
frontend/src/App.tsx - Screen coordinator → Market attention: renders screen
frontend/src/App.tsx - Screen coordinator → Portfolio screen: renders screen
frontend/src/App.tsx - Screen coordinator → Paper trading screen: renders screen
frontend/src/App.tsx - Screen coordinator → Alerts screen: renders screen
frontend/src/App.tsx - Screen coordinator → Settings screen: renders screen
frontend/src/App.tsx - Screen coordinator → Companion dashboard: renders dashboard
frontend/src/App.tsx - Screen coordinator → API and fallback: requests data
frontend/src/App.tsx - API and fallback → FastAPI application: REST requests
- API and fallback → Hyperliquid API: browser fallback
- FastAPI application → Market routes: registers routes
backend/app/main.py - FastAPI application → Intelligence routes: registers routes
backend/app/main.py - FastAPI application → Portfolio routes: registers routes
backend/app/main.py - FastAPI application → Trading routes: registers routes
backend/app/main.py - FastAPI application → Alert routes: registers routes
backend/app/main.py - FastAPI application → Wallet routes: registers routes
backend/app/main.py - FastAPI application → Health routes: registers routes
backend/app/main.py - FastAPI application → Demo reset: registers routes
backend/app/main.py - FastAPI application → SQLite state: initializes schema
backend/app/main.py - Market routes → Market aggregation: delegates market data
backend/app/routers/market.py - Market routes → Hyperliquid service: requests prices
backend/app/routers/market.py - Intelligence routes → Isolation Forest engine: requests analysis
backend/app/routers/intelligence.py - Isolation Forest engine → Hyperliquid service: loads candles
backend/app/services/anomaly_engine.py - Hyperliquid service → Hyperliquid API: fetches market state
backend/app/services/hyperliquid.py - Market aggregation → Hyperliquid service: uses price data
backend/app/services/market_service.py - Health routes → CoinGecko service: checks availability
backend/app/routers/health.py - CoinGecko service → CoinGecko API: optional lookup
backend/app/services/coingecko.py - Portfolio routes → Paper trading engine: loads portfolio
backend/app/routers/portfolio.py - Trading routes → Paper trading engine: previews and confirms
backend/app/routers/trading.py - Alert routes → Alert evaluation: delegates alert work
backend/app/routers/alerts.py - Alert evaluation → SQLite state: stores alert state
backend/app/services/alerts.py - Paper trading engine → SQLite state: reads and writes trades
backend/app/services/paper_trading.py - Paper trading engine → Hyperliquid service: gets live prices
backend/app/services/paper_trading.py - Wallet routes → Hyperliquid service: loads public wallet
backend/app/routers/wallet.py - Wallet routes → SQLite state: stores wallet setting
backend/app/routers/wallet.py - Alert routes → Mutation guard: guards mutations
backend/app/routers/alerts.py - Trading routes → Mutation guard: guards mutations
backend/app/routers/trading.py - Wallet routes → Mutation guard: guards configuration
backend/app/routers/wallet.py - Demo reset → SQLite state: resets demo state
backend/app/routers/demo.py - Market routes → Request and response schemas: validates and shapes
backend/app/routers/market.py - Intelligence routes → Request and response schemas: shapes response
backend/app/routers/intelligence.py - Trading routes → Request and response schemas: validates trades
backend/app/routers/trading.py