ML Engine Updates: - Updated BTCUSD with Polygon API data (2024-2025): 215,699 new records - Re-trained all ML models: Attention (R²: 0.223), Base, Metamodel (87.3% confidence) - Backtest results: +176.71R profit with aggressive_filter strategy Documentation Consolidation: - Created docs/99-analisis/_MAP.md index with 13 new analysis documents - Consolidated inventories: removed duplicates from orchestration/inventarios/ - Updated ML_INVENTORY.yml with BTCUSD metrics and training results - Added execution reports: FASE11-BTCUSD, correction issues, alignment validation Architecture & Integration: - Updated all module documentation with NEXUS v3.4 frontmatter - Fixed _MAP.md indexes across all folders - Updated orchestration plans and traces Files: 229 changed, 5064 insertions(+), 1872 deletions(-) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
493 lines
15 KiB
Markdown
493 lines
15 KiB
Markdown
---
|
|
id: "MAP-02-definicion-modulos"
|
|
title: "Mapa de 02-definicion-modulos"
|
|
type: "Index"
|
|
project: "trading-platform"
|
|
updated_date: "2026-01-07"
|
|
---
|
|
|
|
# _MAP: Definicion de Modulos - Trading Platform
|
|
|
|
**Ultima actualizacion:** 2026-01-07
|
|
**Estado:** En Desarrollo
|
|
**Version:** 2.0.0
|
|
**Total Epicas:** 8
|
|
**Total Story Points:** 407 SP
|
|
|
|
---
|
|
|
|
## Proposito
|
|
|
|
Este directorio contiene la documentacion completa de todas las epicas del proyecto Trading Platform, organizadas en dos fases:
|
|
|
|
### Fase 1 - MVP (6 Epicas, 287 SP)
|
|
- Sistema de autenticacion multi-proveedor
|
|
- Modulo educativo basico
|
|
- Plataforma de trading con charts y ML overlay
|
|
- Sistema de cuentas de inversion con agentes IA
|
|
- Integracion de pagos con Stripe
|
|
- Senales ML del TradingAgent existente
|
|
|
|
### Fase 2 - Avanzado (2 Epicas, 120 SP)
|
|
- LLM Strategy Agent (Copiloto de trading con IA)
|
|
- Portfolio Manager (Gestion de carteras a largo plazo)
|
|
|
|
---
|
|
|
|
## Configuracion SaaS Multi-tenant
|
|
|
|
| Feature | Free | Basic | Pro | Premium |
|
|
|---------|------|-------|-----|---------|
|
|
| Autenticacion | ✅ | ✅ | ✅ | ✅ |
|
|
| Cursos basicos | ✅ | ✅ | ✅ | ✅ |
|
|
| Cursos avanzados | ❌ | ✅ | ✅ | ✅ |
|
|
| Paper trading | ✅ | ✅ | ✅ | ✅ |
|
|
| Trading real | ❌ | ✅ | ✅ | ✅ |
|
|
| Senales ML | 3/dia | 10/dia | Ilimitado | Ilimitado |
|
|
| Agentes IA | ❌ | 1 (Atlas) | 3 | 3 |
|
|
| **LLM Copiloto** | ❌ | ❌ | ✅ | ✅ |
|
|
| **Portfolio Manager** | ❌ | ❌ | ❌ | ✅ |
|
|
| **API Access** | ❌ | ❌ | ❌ | ✅ |
|
|
| Soporte | Community | Email | Prioritario | Dedicado |
|
|
| **Precio** | $0/mes | $19/mes | $49/mes | $99/mes |
|
|
|
|
---
|
|
|
|
## Contenido
|
|
|
|
### Fase 1 - MVP (6 Epicas)
|
|
|
|
| Codigo | Nombre | SP | Presupuesto | Estado | Prioridad |
|
|
|--------|--------|-----|-------------|--------|-----------|
|
|
| [OQI-001](./OQI-001-fundamentos-auth/) | Fundamentos y Auth | 50 | $25,000 | ✅ Completado | P0 |
|
|
| [OQI-002](./OQI-002-education/) | Modulo Educativo | 45 | $22,500 | Pendiente | P1 |
|
|
| [OQI-003](./OQI-003-trading-charts/) | Trading y Charts | 55 | $27,500 | Pendiente | P1 |
|
|
| [OQI-004](./OQI-004-investment-accounts/) | Cuentas de Inversion | 57 | $28,500 | Pendiente | P1 |
|
|
| [OQI-005](./OQI-005-payments-stripe/) | Pagos y Stripe | 40 | $25,000 | Pendiente | P0 |
|
|
| [OQI-006](./OQI-006-ml-signals/) | Senales ML | 40 | $25,000 | Pendiente | P2 |
|
|
|
|
**Subtotal Fase 1:** 287 SP | $153,500 MXN
|
|
|
|
### Fase 2 - Avanzado (2 Epicas)
|
|
|
|
| Codigo | Nombre | SP | Presupuesto | Estado | Prioridad |
|
|
|--------|--------|-----|-------------|--------|-----------|
|
|
| [OQI-007](./OQI-007-llm-agent/) | LLM Strategy Agent | 55 | $27,500 | Planificado | P1 |
|
|
| [OQI-008](./OQI-008-portfolio-manager/) | Portfolio Manager | 65 | $32,500 | Planificado | P1 |
|
|
|
|
**Subtotal Fase 2:** 120 SP | $60,000 MXN
|
|
|
|
---
|
|
|
|
**TOTAL PROYECTO:** 407 SP | $213,500 MXN
|
|
|
|
---
|
|
|
|
## Desglose por Epica
|
|
|
|
### OQI-001: Fundamentos y Autenticacion
|
|
|
|
**Objetivo:** Infraestructura base con autenticacion multi-proveedor completa.
|
|
|
|
**Entregables:**
|
|
- Autenticacion OAuth (Google, Facebook, X, Apple, GitHub)
|
|
- Autenticacion email/password con verificacion
|
|
- Autenticacion por telefono (SMS/WhatsApp)
|
|
- JWT con refresh tokens
|
|
- 2FA (TOTP + backup codes)
|
|
- RBAC (roles y permisos)
|
|
- Gestion de sesiones
|
|
|
|
**Documentos clave:**
|
|
- Requerimientos: RF-AUTH-001 a RF-AUTH-005
|
|
- Especificaciones: ET-AUTH-001 a ET-AUTH-005
|
|
- User Stories: US-AUTH-001 a US-AUTH-012
|
|
|
|
**Modulos afectados:**
|
|
- BD: `public` schema (users, profiles, oauth_accounts, sessions)
|
|
- Backend: `auth` module
|
|
- Frontend: `auth` feature
|
|
|
|
**Estado:** ✅ Completado (50 SP)
|
|
|
|
---
|
|
|
|
### OQI-002: Modulo Educativo
|
|
|
|
**Objetivo:** Plataforma de cursos con contenido estructurado y progreso.
|
|
|
|
**Entregables:**
|
|
- Catalogo de cursos con categorias
|
|
- Sistema de lecciones (video, texto, quiz)
|
|
- Progreso y completitud
|
|
- Certificaciones basicas
|
|
- Gamificacion (XP, badges)
|
|
|
|
**Documentos clave:**
|
|
- Requerimientos: RF-EDU-001 a RF-EDU-006
|
|
- Especificaciones: ET-EDU-001 a ET-EDU-006
|
|
- User Stories: US-EDU-001 a US-EDU-015
|
|
|
|
**Modulos afectados:**
|
|
- BD: `education` schema
|
|
- Backend: `education` module
|
|
- Frontend: `education` feature
|
|
|
|
**Reutilizacion Gamilit:** 70% (estructura de cursos, progreso, gamificacion)
|
|
|
|
**Estado:** Pendiente (45 SP)
|
|
|
|
---
|
|
|
|
### OQI-003: Trading y Charts
|
|
|
|
**Objetivo:** Plataforma de trading con charts profesionales y watchlists.
|
|
|
|
**Entregables:**
|
|
- Charts con Lightweight Charts
|
|
- Timeframes multiples (1m, 5m, 15m, 1h, 4h, 1D)
|
|
- Indicadores tecnicos basicos
|
|
- Watchlists personalizables
|
|
- Paper trading (simulacion)
|
|
- Historial de operaciones
|
|
|
|
**Documentos clave:**
|
|
- Requerimientos: RF-TRD-001 a RF-TRD-008
|
|
- Especificaciones: ET-TRD-001 a ET-TRD-008
|
|
- User Stories: US-TRD-001 a US-TRD-018
|
|
|
|
**Modulos afectados:**
|
|
- BD: `trading` schema
|
|
- Backend: `trading` module
|
|
- Frontend: `trading` feature
|
|
- ML Engine: data feeds
|
|
|
|
**Reutilizacion TradingAgent:** 40% (conectores de datos)
|
|
|
|
**Estado:** Pendiente (55 SP)
|
|
|
|
---
|
|
|
|
### OQI-004: Cuentas de Inversion
|
|
|
|
**Objetivo:** Sistema de cuentas gestionadas por agentes IA.
|
|
|
|
**Entregables:**
|
|
- 3 productos de inversion (Atlas, Orion, Nova)
|
|
- Apertura de cuentas con KYC basico
|
|
- Dashboard de portfolio
|
|
- Historial de transacciones
|
|
- Reportes de rendimiento
|
|
- Distribucion de utilidades
|
|
|
|
**Documentos clave:**
|
|
- Requerimientos: RF-INV-001 a RF-INV-007
|
|
- Especificaciones: ET-INV-001 a ET-INV-007
|
|
- User Stories: US-INV-001 a US-INV-014
|
|
|
|
**Modulos afectados:**
|
|
- BD: `investment` schema
|
|
- Backend: `investment` module
|
|
- Frontend: `investment` feature
|
|
- ML Engine: agentes de trading
|
|
|
|
**Estado:** Pendiente (50 SP)
|
|
|
|
---
|
|
|
|
### OQI-005: Pagos y Stripe
|
|
|
|
**Objetivo:** Sistema de pagos completo con Stripe.
|
|
|
|
**Entregables:**
|
|
- Suscripciones (Free, Basic, Pro)
|
|
- Checkout con Stripe Elements
|
|
- Wallet interno
|
|
- Depositos y retiros
|
|
- Facturacion automatica
|
|
- Webhooks de eventos
|
|
|
|
**Documentos clave:**
|
|
- Requerimientos: RF-PAY-001 a RF-PAY-006
|
|
- Especificaciones: ET-PAY-001 a ET-PAY-006
|
|
- User Stories: US-PAY-001 a US-PAY-012
|
|
|
|
**Modulos afectados:**
|
|
- BD: `financial` schema
|
|
- Backend: `payments` module
|
|
- Frontend: billing components
|
|
|
|
**Estado:** Pendiente (40 SP)
|
|
|
|
---
|
|
|
|
### OQI-006: Senales ML
|
|
|
|
**Objetivo:** Sistema de predicciones y senales de trading.
|
|
|
|
**Entregables:**
|
|
- RangePredictor (prediccion ΔHigh/ΔLow)
|
|
- TPSLClassifier (clasificacion TP vs SL)
|
|
- SignalGenerator (senales de entrada)
|
|
- Feature store
|
|
- API de predicciones
|
|
- Notificaciones de senales
|
|
|
|
**Documentos clave:**
|
|
- Requerimientos: RF-ML-001 a RF-ML-005
|
|
- Especificaciones: ET-ML-001 a ET-ML-005
|
|
- User Stories: US-ML-001 a US-ML-010
|
|
|
|
**Modulos afectados:**
|
|
- BD: `ml` schema
|
|
- Backend: `signals` module
|
|
- ML Engine: modelos completos
|
|
- Frontend: signal alerts
|
|
|
|
**Reutilizacion TradingAgent:** 80% (modelos, features, training)
|
|
|
|
**Estado:** Pendiente (40 SP)
|
|
|
|
---
|
|
|
|
### OQI-007: LLM Strategy Agent (Fase 2)
|
|
|
|
**Objetivo:** Copiloto de trading conversacional potenciado por LLM.
|
|
|
|
**Entregables:**
|
|
- Chat conversacional con contexto persistente
|
|
- Interpretacion de senales ML en lenguaje natural
|
|
- Sugerencias de estrategias personalizadas
|
|
- Modo proactivo con alertas inteligentes
|
|
- Ejecucion de ordenes via comandos naturales
|
|
- Historial de conversaciones
|
|
|
|
**Documentos clave:**
|
|
- Requerimientos: RF-LLM-001 a RF-LLM-006
|
|
- Especificaciones: ET-LLM-001 a ET-LLM-006
|
|
- User Stories: US-LLM-001 a US-LLM-010
|
|
|
|
**Modulos afectados:**
|
|
- BD: `llm` schema (conversations, messages, executions)
|
|
- Backend: `llm-agent` module
|
|
- Frontend: `copilot` feature (chat widget)
|
|
- Integracion: Claude API / OpenAI API
|
|
|
|
**Herramientas del Agente:**
|
|
- `get_signal`: Obtener senal ML actual
|
|
- `analyze_chart`: Analizar grafico con indicadores
|
|
- `get_portfolio`: Estado actual del portfolio
|
|
- `execute_trade`: Ejecutar orden de trading
|
|
- `set_alert`: Configurar alerta personalizada
|
|
- `explain_decision`: Explicar decision de agente
|
|
|
|
**Estado:** Planificado (55 SP)
|
|
|
|
---
|
|
|
|
### OQI-008: Portfolio Manager (Fase 2)
|
|
|
|
**Objetivo:** Sistema profesional de gestion de carteras a largo plazo.
|
|
|
|
**Entregables:**
|
|
- Cuestionario de perfil de riesgo
|
|
- 5 perfiles predefinidos (Ultra Conservador a Ultra Agresivo)
|
|
- Asignacion automatica entre agentes (Atlas/Orion/Nova)
|
|
- Rebalanceo automatico por drift, calendario o eventos
|
|
- Distribucion de rendimientos (80% reinversion / 20% usuario)
|
|
- Proyecciones Monte Carlo
|
|
- Metas de inversion con tracking
|
|
- Reportes fiscales y exportacion
|
|
|
|
**Documentos clave:**
|
|
- Requerimientos: RF-PFM-001 a RF-PFM-007
|
|
- Especificaciones: ET-PFM-001 a ET-PFM-007
|
|
- User Stories: US-PFM-001 a US-PFM-012
|
|
|
|
**Modulos afectados:**
|
|
- BD: `portfolio` schema
|
|
- Backend: `portfolio` module
|
|
- Frontend: `portfolio` feature
|
|
- Calculos: Python (NumPy, SciPy) para Monte Carlo
|
|
- Jobs: Bull Queue para rebalanceo y distribuciones
|
|
|
|
**Metricas del Portfolio:**
|
|
- TWR (Time-Weighted Return)
|
|
- MWR (Money-Weighted Return)
|
|
- Sharpe Ratio, Sortino Ratio
|
|
- Maximum Drawdown, VaR
|
|
|
|
**Estado:** Planificado (65 SP)
|
|
|
|
---
|
|
|
|
## Resumen Tecnico
|
|
|
|
### Base de Datos
|
|
|
|
| Schema | Tablas | ENUMs | Functions | Triggers |
|
|
|--------|--------|-------|-----------|----------|
|
|
| public | 10 | 5 | 2 | 6 |
|
|
| education | 11 | 4 | 1 | 5 |
|
|
| trading | 10 | 6 | 2 | 5 |
|
|
| investment | 8 | 4 | 3 | 4 |
|
|
| financial | 10 | 5 | 4 | 5 |
|
|
| ml | 8 | 3 | 2 | 3 |
|
|
| **llm** | 5 | 2 | 1 | 2 |
|
|
| **portfolio** | 8 | 4 | 3 | 4 |
|
|
| audit | 7 | 3 | 1 | 2 |
|
|
|
|
### Backend (Express.js + TypeScript)
|
|
|
|
| Modulo | Controllers | Services | Endpoints |
|
|
|--------|-------------|----------|-----------|
|
|
| auth | 1 | 5 | 25 |
|
|
| education | 3 | 4 | 18 |
|
|
| trading | 2 | 3 | 15 |
|
|
| investment | 2 | 3 | 12 |
|
|
| payments | 2 | 2 | 10 |
|
|
| **llm-agent** | 1 | 3 | 8 |
|
|
| **portfolio** | 2 | 4 | 15 |
|
|
| admin | 3 | 3 | 20 |
|
|
|
|
### Frontend (React + TypeScript)
|
|
|
|
| Feature | Pages | Components | Stores |
|
|
|---------|-------|------------|--------|
|
|
| auth | 6 | 8 | 1 |
|
|
| education | 4 | 12 | 2 |
|
|
| trading | 3 | 15 | 2 |
|
|
| investment | 3 | 10 | 1 |
|
|
| **copilot** | 1 | 8 | 1 |
|
|
| **portfolio** | 3 | 12 | 2 |
|
|
| settings | 1 | 8 | 1 |
|
|
| dashboard | 1 | 6 | 1 |
|
|
|
|
### ML Engine (Python + FastAPI)
|
|
|
|
| Modelo | Algoritmo | Features | Accuracy |
|
|
|--------|-----------|----------|----------|
|
|
| RangePredictor | XGBoost GPU | 21 | 85.9% |
|
|
| TPSLClassifier | XGBoost GPU | 15 | 94% AUC |
|
|
| AMDDetector | GRU Attention | 30 | 78% |
|
|
| SignalGenerator | Ensemble 3-Level | 21 | 75% |
|
|
|
|
### LLM Integration
|
|
|
|
| Componente | Tecnologia | Proposito |
|
|
|------------|------------|-----------|
|
|
| Provider | Claude API / OpenAI | LLM base |
|
|
| Tools | Function Calling | Acciones del agente |
|
|
| Context | Vector DB (futuro) | Memoria persistente |
|
|
| Safety | Guardrails | Validacion de ordenes |
|
|
|
|
---
|
|
|
|
## Metricas del Proyecto
|
|
|
|
| Metrica | Target | Actual |
|
|
|---------|--------|--------|
|
|
| Story Points Total | 407 | 50 (12%) |
|
|
| Presupuesto Total | $213,500 | $25,000 (12%) |
|
|
| Epicas completadas | 8 | 1 (12.5%) |
|
|
| Cobertura de tests | 80% | TBD |
|
|
| Documentacion | 100% | 95% |
|
|
|
|
---
|
|
|
|
## Hitos Planeados
|
|
|
|
### Fase 1 - MVP
|
|
|
|
| Sprint | Hito | Epicas |
|
|
|--------|------|--------|
|
|
| 1-2 | Auth completado | OQI-001 ✅ |
|
|
| 3-4 | Education + Trading | OQI-002, OQI-003 |
|
|
| 5-6 | Investment + Payments | OQI-004, OQI-005 |
|
|
| 7-8 | ML + Integration | OQI-006, Testing |
|
|
|
|
### Fase 2 - Avanzado
|
|
|
|
| Sprint | Hito | Epicas |
|
|
|--------|------|--------|
|
|
| 9-10 | LLM Agent Beta | OQI-007 |
|
|
| 11-12 | Portfolio Manager | OQI-008 |
|
|
| 13 | Integration + Testing | Full System |
|
|
|
|
---
|
|
|
|
## Dependencias
|
|
|
|
```
|
|
FASE 1 - MVP
|
|
┌─────────────────────────────────────────────────────────────────┐
|
|
│ │
|
|
│ OQI-001 (Auth) ─────────────────────────────────┐ │
|
|
│ │ │
|
|
│ OQI-005 (Payments) ─────────────────────────────┼──▶ MVP │
|
|
│ │ │
|
|
│ OQI-002 (Education) ────▶ OQI-003 (Trading) ────┤ │
|
|
│ │ │
|
|
│ OQI-004 (Investment) ◀── OQI-006 (ML Signals) ──┘ │
|
|
│ │
|
|
└────────────────────────────┬────────────────────────────────────┘
|
|
│
|
|
▼
|
|
FASE 2 - AVANZADO
|
|
┌─────────────────────────────────────────────────────────────────┐
|
|
│ │
|
|
│ OQI-006 (ML) ──────────▶ OQI-007 (LLM Agent) ───┐ │
|
|
│ │ │
|
|
│ OQI-004 (Investment) ──▶ OQI-008 (Portfolio) ───┼──▶ FULL │
|
|
│ │ │
|
|
│ OQI-005 (Payments) ─────────────────────────────┘ │
|
|
│ │
|
|
└─────────────────────────────────────────────────────────────────┘
|
|
```
|
|
|
|
---
|
|
|
|
## Criterios de Aceptacion
|
|
|
|
### Fase 1 - MVP
|
|
|
|
- [ ] Todos los usuarios pueden registrarse con al menos 3 metodos
|
|
- [ ] Al menos 5 cursos publicados con quizzes
|
|
- [ ] Charts funcionales con 3 timeframes y ML overlay
|
|
- [ ] 3 productos de inversion disponibles (Atlas, Orion, Nova)
|
|
- [ ] Pagos con tarjeta funcionando
|
|
- [ ] Senales ML generandose cada hora
|
|
- [ ] Tests con >70% cobertura
|
|
|
|
### Fase 2 - Avanzado
|
|
|
|
- [ ] LLM Copiloto respondiendo con contexto
|
|
- [ ] Ejecucion de ordenes via chat
|
|
- [ ] Cuestionario de perfil de riesgo
|
|
- [ ] Rebalanceo automatico funcionando
|
|
- [ ] Distribuciones de rendimientos procesadas
|
|
- [ ] Proyecciones Monte Carlo precisas
|
|
- [ ] Tests con >80% cobertura
|
|
|
|
---
|
|
|
|
## Arquitectura y Documentacion Clave
|
|
|
|
| Documento | Ubicacion |
|
|
|-----------|-----------|
|
|
| Arquitectura Unificada | `docs/01-arquitectura/ARQUITECTURA-UNIFICADA.md` |
|
|
| Integracion TradingAgent | `docs/01-arquitectura/INTEGRACION-TRADINGAGENT.md` |
|
|
| Contexto del Proyecto | `orchestration/00-guidelines/CONTEXTO-PROYECTO.md` |
|
|
| TradingAgent Original | `[LEGACY: apps/ml-engine - migrado desde TradingAgent]/` |
|
|
|
|
---
|
|
|
|
## Referencias
|
|
|
|
- [README Principal](../README.md)
|
|
- [Vision General](../00-vision-general/_MAP.md)
|
|
- [ADRs](../97-adr/)
|
|
- [Guias de Desarrollo](../95-guias-desarrollo/)
|
|
- [Arquitectura Unificada](../01-arquitectura/ARQUITECTURA-UNIFICADA.md)
|
|
- [Integracion TradingAgent](../01-arquitectura/INTEGRACION-TRADINGAGENT.md)
|