# 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:** 1.0.0 **Actualizado:** 2026-01-27 --- ## 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: auth, education, trading, investment, financial, portfolio, market_data, ml, llm, audit ``` --- ## ESTRUCTURA DEL MONOREPO ``` trading-platform/ ├── apps/ │ ├── backend/ → Express.js API │ ├── frontend/ → React SPA │ ├── database/ → DDL/Schemas │ ├── data-service/ → Python data aggregation │ ├── ml-engine/ → Python ML service │ ├── mcp-binance-connector/ │ └── mcp-mt4-connector/ ├── mcp-auth/ → Auth service (port 3095) ├── mcp-wallet/ → Wallet service (port 3090) ├── mcp-products/ → Products service (port 3091) ├── mcp-vip/ → VIP service (port 3092) ├── mcp-investment/ → Investment service (port 3093) ├── mcp-predictions/ → ML signals (port 3094) ├── packages/ → Shared packages └── docker/ → Docker configs ``` --- ## 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 | 3080 | | Frontend | 3000 | | ML Engine | 3083 | | Trading Agents | 3086 | | LLM Agent | 3085 | | MCP Auth | 3095 | | MCP Wallet | 3090 | | MCP Products | 3091 | | MCP VIP | 3092 | | MCP Investment | 3093 | | MCP Predictions | 3094 | --- ## 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*