# CLAUDE.md - Trading Platform **Hereda de:** workspace-v2/CLAUDE.md **Sistema:** SIMCO v4.0.0 + NEXUS v4.0 **Proyecto:** trading-platform **Tipo:** STANDALONE **Versión:** 2.0.0 **Actualizado:** 2026-02-06 --- ## EXTENSIONES LOCALES Este archivo EXTIENDE (no reemplaza) las reglas del workspace. Para reglas base, ver: `../../CLAUDE.md` --- ## ARQUITECTURA HIBRIDA Este proyecto usa una arquitectura híbrida TypeScript + Python: ``` ┌─────────────────────────────────────────────────────────┐ │ TRADING PLATFORM │ ├──────────────────────┬──────────────────────────────────┤ │ TypeScript Stack │ Python Stack │ ├──────────────────────┼──────────────────────────────────┤ │ • Express.js Backend │ • FastAPI (ml-engine) │ │ • React Frontend │ • Data Service │ │ • MCP Connectors │ • Trading Agents │ │ • Portfolio Manager │ • Prediction Models │ └──────────────────────┴──────────────────────────────────┘ ``` --- ## STACK TECNOLOGICO | Capa | Tecnología | Versión | |------|------------|---------| | Backend API | Express.js | 5.0.1 | | Frontend | React | 18.2.0 | | Build Tool | Vite | 6.2.0 | | ML Engine | FastAPI (Python) | 3.11 | | Database | PostgreSQL | 16+ | | Cache | Redis | 7.x | | Charts | lightweight-charts | 4.1.1 | | State | Zustand | 4.4.7 | | Data Fetching | TanStack Query | 5.14.0 | --- ## CREDENCIALES BD ``` Database: trading_platform User: trading_user Password: trading_dev_2026 Port: 5432 Host: localhost Schemas (11): auth, trading, education, financial, investment, ml, llm, audit, portfolio, market_data, feature_flags Tables: 101 DDL | Enums: 50 | Functions: 36 | Triggers: 46 ``` ### Metricas de Coherencia (SSOT: orchestration/inventarios/) | Capa | Metrica | Valor | |------|---------|-------| | Database | Schemas | 11 | | Database | Tablas DDL | 101 | | Backend | Modulos | 18 | | Backend | Type Interfaces | 85/101 (84%) | | Backend | Services | 76/101 (75%) | | Backend | Controllers | 62/101 (61%) | | Frontend | Modulos | 14 | | Frontend | Componentes | 225 (185 funcionales) | | Frontend | Paginas | 58 | --- ## ESTRUCTURA DEL MONOREPO ``` trading-platform/ ├── apps/ ← Todos los componentes (submodulos) │ ├── backend/ → Express.js API (main) │ ├── frontend/ → React SPA (main) │ ├── database/ → DDL/Schemas (main) │ ├── data-service/ → Python data aggregation (main) │ ├── ml-engine/ → Python ML service (main) │ ├── mcp-auth/ → Auth service, port 3095 (master) │ ├── mcp-binance-connector/ → Binance connector (master) │ ├── mcp-investment/ → Investment service, port 3093 (master) │ ├── mcp-mt4-connector/ → MT4 connector (master) │ ├── mcp-predictions/ → ML signals, port 3094 (master) │ ├── mcp-products/ → Products service, port 3091 (master) │ ├── mcp-vip/ → VIP service, port 3092 (master) │ └── mcp-wallet/ → Wallet service, port 3090 (master) ├── packages/ → Shared packages ├── docker/ → Docker configs ├── orchestration/ → Gobernanza SIMCO └── docs/ → Documentacion ``` > **NOTA:** Los 8 MCP submodulos usan branch `master` (no `main`). Los 5 apps principales > usan branch `main`. Migracion de branch pendiente cuando se actualicen los repos remotos. --- ## MODULOS/EPICS (9) | ID | Módulo | Progreso | Descripción | |----|--------|----------|-------------| | OQI-001 | fundamentos-auth | 85% | Autenticacion base (token rotation, 2FA, OAuth) | | OQI-002 | educativo | 55% | Modulo educativo (courses, quizzes, gamification, video) | | OQI-003 | trading-charts | 60% | Charts de trading (panels, indicators, screener) | | OQI-004 | cuentas-inversion | 55% | Cuentas de inversion (detail, wizard, risk analysis) | | OQI-005 | pagos-stripe | 65% | Integracion Stripe (elements, refunds, invoices) | | OQI-006 | senales-ml | 75% | Senales ML (models, signals, ensemble, ICT) | | OQI-007 | llm-strategy-agent | 45% | Agente LLM (panels, prompts, connection, tokens) | | OQI-008 | portfolio-manager | 45% | Gestion portafolio (dashboard, allocations, goals) | | OQI-009 | mt4-gateway | 15% | Gateway MetaTrader (NO FUNCIONAL) | --- ## PUERTOS DE SERVICIOS | Servicio | Puerto | |----------|--------| | Backend API | 3081 | | Frontend | 3080 | | Backend WebSocket | 3082 | | ML Engine | 3083 | | Data Service | 3084 | | LLM Agent | 3085 | | Trading Agents | 3086 | | MCP Wallet | 3090 | | MCP Products | 3091 | | MCP VIP | 3092 | | MCP Investment | 3093 | | MCP Predictions | 3094 | | MCP Auth | 3095 | --- ## REGLAS ESPECIFICAS ### 1. Código TypeScript vs Python - **TypeScript:** APIs, Frontend, MCPs - **Python:** ML, Data processing, Trading agents - NO mezclar: cada servicio es independiente ### 2. ML Models - Los modelos ML están en `apps/ml-engine/` - Usar PyTorch + XGBoost para predicciones (NO TensorFlow) - Validar con backtesting antes de deploy ### 3. Trading Safety - NUNCA ejecutar trades reales sin confirmación - Usar modo sandbox en desarrollo - Validar límites de riesgo ### 4. API Keys - Binance API: Solo read en desarrollo - MT4: Cuenta demo únicamente - Stripe: Test mode --- ## VALIDACIONES ADICIONALES Además de las validaciones del workspace: 1. **TypeScript Backend:** ```bash cd apps/backend && npm run build && npm run lint ``` 2. **Frontend:** ```bash cd apps/frontend && npm run build && npm run lint ``` 3. **Python Services:** ```bash cd apps/ml-engine && python -m pytest ``` --- ## ALIASES LOCALES - `@BACKEND` → apps/backend/src/ - `@FRONTEND` → apps/frontend/src/ - `@ML` → apps/ml-engine/ - `@DDL` → apps/database/ - `@DOCS` → docs/ - `@MCP` → mcp-*/ --- ## ANTES DE IMPLEMENTAR 1. Identificar si es TypeScript o Python 2. Verificar módulo/epic correspondiente 3. Consultar directivas en `orchestration/directivas/` 4. Verificar impacto en otros servicios --- ## DESPUES DE IMPLEMENTAR 1. Actualizar inventarios locales 2. Ejecutar tests del servicio afectado 3. Commit y push siguiendo SIMCO-GIT 4. NO hay propagación (STANDALONE) --- *Trading Platform v1.0.0 - Sistema SIMCO v4.0.0*