Technical Docs

Reference documentation for the mi-casa codebase.

NoteDescription
Architecture OverviewFull stack table, request flow, directory structure, path aliases, DI pattern
Authentication FlowLogin, invite signup, token refresh, change password — sequence diagrams + security properties
Frontend State ManagementRedux store shape, RTK Query slice pattern, re-auth interceptor, localStorage persistence
Database SchemaAll tables, column types, relationships, migration workflow, repository layer
Environment VariablesEvery env var, type, default, and which service uses it
Environment Variables Reference — DeploymentOverview table showing which vars go to which deployment (mi-casa / ohlc-service / ctrader-service) plus quick copy-paste lists per service
Error Handling PatternsErrorOr<T>, AppError types, HTTP status mapping, response shapes, validation
OHLC Feature EnhancementsNew pattern types (Cypher, Three Drives, ABCD), composite signal score, multi-timeframe confirmation, backtest improvements, indicator overlays, live alerts, BTC/ETH symbols
OHLC Phase 2 — Actionability & ObservabilityDesktop/email notifications, analytics dashboard, chart drawing tools, watchlist, paper portfolio
Broker — IC Markets EU + cTrader Open APIIC Markets EU chosen as single broker; Raw Spread account; live tick streaming via cTrader Open API WebSocket
OHLC Service — Candle Data FlowLive feed sequence, backfill flow, REST endpoints, and service-to-service auth pattern for ohlc-service ↔ mi-casa
Markets — Pattern DetectionAll pattern detection algorithms: harmonic XABCD, structure (ABCD, Three Drives, Double Top/Bottom, H&S), and 19 candlestick patterns — plus signal scoring and SL/TP logic
Markets — Replay FeatureCandle-by-candle replay: Redux state, pattern filter multiselects, simulated trade overlay (auto-entry, live P&L, SL/TP), and trade log
Broker — IC Markets EU Leverage Limits (Retail)ESMA retail leverage caps per CFD category, tracked symbol mapping, and margin calculation formula
Trading System — Dependency MapEnd-to-end dependency map: auto-trade prerequisites, SL/TP calculation, resolution matrix, pattern config fallback chain, pending order activation, and known bugs
Backtest System — Dependency MapBacktest pipeline: entry strategy simulation per mode (swing_confirmation / prz_touch / candle_close), SL/TP anchor logic, walk-forward scanner, output shape, and known bugs
Optimisation System — Dependency MapOptimisation pipeline: 50-config grid, composite scoring, best-run selection, apply flow, what does/doesn’t propagate to live trading, and known bugs
Strategy-gates-Pattern — Auto-Trading RuleArchitectural rule: why a detected harmonic pattern never opens a trade without a matching enabled Strategy — supported strategy types and what bypasses the gate
Auto-Trading — Per-Strategy Account RoutingHow ctraderAccountId on a Strategy routes trades to paper vs. a specific live account — stale-signal gate, immutable pending order snapshots, and disconnect guard