- Move 7 non-standard folders to _archive/ - Create 5 missing obligatory files - Update _MAP.md with standardized structure Standard: SIMCO-ESTANDAR-ORCHESTRATION v1.0.0 Level: CONSUMER (L2) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
387 lines
11 KiB
Markdown
387 lines
11 KiB
Markdown
# Plan de Desarrollo - Trading Platform
|
|
## Fase 2: Integracion y Testing (Enero 2026)
|
|
|
|
**Fecha:** 2026-01-07
|
|
**Version:** 1.0.0
|
|
**Basado en:** ANALISIS-CONSOLIDADO-FASE1-2026-01-07.md
|
|
**Estado:** EN REVISION
|
|
|
|
---
|
|
|
|
## 1. OBJETIVO DEL PLAN
|
|
|
|
Completar el 100% de la Fase 2 (Integracion y Testing) del proyecto Trading Platform, resolviendo todos los gaps criticos identificados en el analisis consolidado.
|
|
|
|
### 1.1 Criterios de Exito
|
|
|
|
- [ ] Todos los gaps CRITICOS resueltos (4 items)
|
|
- [ ] Todos los gaps ALTA prioridad resueltos (6 items)
|
|
- [ ] Cobertura de tests > 60%
|
|
- [ ] ML Engine funcional con R^2 positivo
|
|
- [ ] Sistema listo para produccion
|
|
|
|
---
|
|
|
|
## 2. PLAN POR SPRINTS
|
|
|
|
### SPRINT 1: ESTABILIZACION ML ENGINE
|
|
|
|
**Duracion:** 5-7 dias
|
|
**Objetivo:** Resolver problemas criticos de predicciones ML
|
|
|
|
#### Tareas Sprint 1
|
|
|
|
| ID | Tarea | Prioridad | Componente | Archivos |
|
|
|----|-------|-----------|------------|----------|
|
|
| S1-T1 | Analizar feature engineering RangePredictor | CRITICA | ML Engine | `src/models/range_predictor.py` |
|
|
| S1-T2 | Revisar normalizacion de datos | CRITICA | ML Engine | `src/data/features.py` |
|
|
| S1-T3 | Verificar data leakage en targets | CRITICA | ML Engine | `src/data/targets.py` |
|
|
| S1-T4 | Implementar auto-load en FastAPI startup | CRITICA | ML Engine | `src/api/main.py` |
|
|
| S1-T5 | Reentrenar modelos con fixes | ALTA | ML Engine | `src/training/*.py` |
|
|
| S1-T6 | Validacion OOS completa | ALTA | ML Engine | Scripts nuevos |
|
|
| S1-T7 | Tests unitarios para modelos | MEDIA | ML Engine | `tests/` |
|
|
|
|
#### Entregables Sprint 1
|
|
|
|
1. **REPORTE-ANALISIS-RANGEPREDICTOR.md**
|
|
- Root cause del R^2 negativo
|
|
- Acciones correctivas aplicadas
|
|
- Metricas antes/despues
|
|
|
|
2. **ML Engine API funcional**
|
|
- Modelos cargados automaticamente
|
|
- Endpoint `/health` con status de modelos
|
|
- Endpoint `/predictions` operativo
|
|
|
|
3. **REPORTE-VALIDACION-OOS.md**
|
|
- Metricas en datos out-of-sample
|
|
- Comparacion con in-sample
|
|
- Recomendaciones
|
|
|
|
#### Criterios de Aceptacion Sprint 1
|
|
|
|
- [ ] RangePredictor R^2 > 0.10 en datos OOS
|
|
- [ ] API ML responde en < 500ms
|
|
- [ ] Tests unitarios > 70% coverage en models/
|
|
- [ ] Documentacion actualizada
|
|
|
|
---
|
|
|
|
### SPRINT 2: INTEGRACION BACKEND
|
|
|
|
**Duracion:** 5 dias
|
|
**Objetivo:** Completar servicios de integracion backend
|
|
|
|
#### Tareas Sprint 2
|
|
|
|
| ID | Tarea | Prioridad | Componente | Archivos |
|
|
|----|-------|-----------|------------|----------|
|
|
| S2-T1 | Implementar ml-integration.service.ts | CRITICA | Backend | `src/modules/ml/services/` |
|
|
| S2-T2 | Auth middleware paper trading | ALTA | Backend | `src/modules/trading/` |
|
|
| S2-T3 | Auth middleware investment | ALTA | Backend | `src/modules/investment/` |
|
|
| S2-T4 | Completar agents.service.ts | ALTA | Backend | `src/modules/agents/` |
|
|
| S2-T5 | Implementar users module | MEDIA | Backend | `src/modules/users/` |
|
|
| S2-T6 | Tests integracion Backend-ML | MEDIA | Backend | `src/__tests__/` |
|
|
|
|
#### Archivos a Modificar/Crear
|
|
|
|
```
|
|
apps/backend/src/
|
|
├── modules/
|
|
│ ├── ml/
|
|
│ │ └── services/
|
|
│ │ └── ml-integration.service.ts # COMPLETAR (actualmente 100 LOC)
|
|
│ ├── trading/
|
|
│ │ └── trading.routes.ts # AGREGAR auth middleware
|
|
│ ├── investment/
|
|
│ │ └── investment.routes.ts # AGREGAR auth middleware
|
|
│ ├── agents/
|
|
│ │ └── services/
|
|
│ │ └── agents.service.ts # COMPLETAR orquestacion
|
|
│ └── users/
|
|
│ ├── users.routes.ts # IMPLEMENTAR
|
|
│ ├── controllers/
|
|
│ │ └── users.controller.ts # CREAR
|
|
│ └── services/
|
|
│ └── users.service.ts # CREAR
|
|
└── __tests__/
|
|
└── integration/
|
|
└── ml-backend.spec.ts # CREAR
|
|
```
|
|
|
|
#### Criterios de Aceptacion Sprint 2
|
|
|
|
- [ ] ml-integration.service.ts completamente implementado
|
|
- [ ] Todos los endpoints paper trading requieren auth
|
|
- [ ] Users module con CRUD basico
|
|
- [ ] Tests de integracion pasando
|
|
|
|
---
|
|
|
|
### SPRINT 3: LLM Y TRADING AGENTS
|
|
|
|
**Duracion:** 5-7 dias
|
|
**Objetivo:** Completar funcionalidades de agentes inteligentes
|
|
|
|
#### Tareas Sprint 3
|
|
|
|
| ID | Tarea | Prioridad | Componente | Archivos |
|
|
|----|-------|-----------|------------|----------|
|
|
| S3-T1 | Completar MCPOrchestrator | CRITICA | LLM Agent | `src/services/mcp_orchestrator.py` |
|
|
| S3-T2 | Live trading execution | ALTA | LLM Agent | `src/tools/trading.py` |
|
|
| S3-T3 | Persistencia decisiones | ALTA | LLM Agent | `src/services/auto_trade_service.py` |
|
|
| S3-T4 | Rate limiting API | ALTA | LLM Agent | `src/api/routes.py` |
|
|
| S3-T5 | Implementar Scalping strategy | ALTA | Trading Agents | `src/strategies/scalping.py` |
|
|
| S3-T6 | Persistencia BD trades | ALTA | Trading Agents | `src/` |
|
|
| S3-T7 | WebSocket signals consumer | MEDIA | Trading Agents | `src/signals/` |
|
|
|
|
#### Archivos a Modificar/Crear
|
|
|
|
```
|
|
apps/llm-agent/src/
|
|
├── services/
|
|
│ └── mcp_orchestrator.py # COMPLETAR (actualmente 100 LOC)
|
|
├── tools/
|
|
│ └── trading.py # AGREGAR _execute_order real
|
|
└── api/
|
|
└── routes.py # AGREGAR rate limiting
|
|
|
|
apps/trading-agents/src/
|
|
├── strategies/
|
|
│ └── scalping.py # CREAR
|
|
├── persistence/
|
|
│ └── db_manager.py # CREAR
|
|
└── signals/
|
|
└── ws_consumer.py # CREAR
|
|
```
|
|
|
|
#### Criterios de Aceptacion Sprint 3
|
|
|
|
- [ ] MCPOrchestrator con portfolio consolidado MT4+Binance
|
|
- [ ] Live trading ejecutando ordenes reales
|
|
- [ ] Rate limiting < 100 req/min por usuario
|
|
- [ ] Scalping strategy funcional para Nova
|
|
- [ ] Trades persistidos en PostgreSQL
|
|
|
|
---
|
|
|
|
### SPRINT 4: FRONTEND Y UX
|
|
|
|
**Duracion:** 5 dias
|
|
**Objetivo:** Mejorar experiencia de usuario
|
|
|
|
#### Tareas Sprint 4
|
|
|
|
| ID | Tarea | Prioridad | Componente | Archivos |
|
|
|----|-------|-----------|------------|----------|
|
|
| S4-T1 | WebSocket real-time trading | ALTA | Frontend | `src/services/websocket.service.ts` |
|
|
| S4-T2 | Streaming LLM responses | ALTA | Frontend | `src/modules/assistant/` |
|
|
| S4-T3 | Certificados PDF | MEDIA | Frontend | `src/modules/education/` |
|
|
| S4-T4 | Investment module conectado | MEDIA | Frontend | `src/modules/investment/` |
|
|
| S4-T5 | Dark mode toggle | BAJA | Frontend | `src/` |
|
|
|
|
#### Archivos a Modificar/Crear
|
|
|
|
```
|
|
apps/frontend/src/
|
|
├── services/
|
|
│ └── websocket.service.ts # COMPLETAR
|
|
├── modules/
|
|
│ ├── assistant/
|
|
│ │ └── pages/
|
|
│ │ └── Assistant.tsx # AGREGAR streaming
|
|
│ ├── education/
|
|
│ │ └── services/
|
|
│ │ └── certificate.service.ts # CREAR
|
|
│ └── investment/
|
|
│ └── services/
|
|
│ └── investment.service.ts # CONECTAR backend
|
|
└── contexts/
|
|
└── ThemeContext.tsx # CREAR (dark mode)
|
|
```
|
|
|
|
#### Criterios de Aceptacion Sprint 4
|
|
|
|
- [ ] Precios actualizandose via WebSocket
|
|
- [ ] Chat con streaming de respuestas
|
|
- [ ] Certificados descargables en PDF
|
|
- [ ] Investment mostrando datos reales
|
|
|
|
---
|
|
|
|
### SPRINT 5: SEGURIDAD Y TESTING
|
|
|
|
**Duracion:** 5-7 dias
|
|
**Objetivo:** Hardening para produccion
|
|
|
|
#### Tareas Sprint 5
|
|
|
|
| ID | Tarea | Prioridad | Componente | Archivos |
|
|
|----|-------|-----------|------------|----------|
|
|
| S5-T1 | Habilitar RLS PostgreSQL | ALTA | Database | DDL scripts |
|
|
| S5-T2 | Rate limiting Backend | ALTA | Backend | Middleware |
|
|
| S5-T3 | Auth Bearer MCP servers | ALTA | MCP | Todos |
|
|
| S5-T4 | E2E Testing suite | ALTA | Testing | Cypress/Playwright |
|
|
| S5-T5 | Integration tests | MEDIA | Testing | Jest |
|
|
| S5-T6 | Security audit | MEDIA | Todos | - |
|
|
|
|
#### Archivos a Modificar/Crear
|
|
|
|
```
|
|
apps/database/ddl/
|
|
├── rls/
|
|
│ ├── auth-rls.sql # CREAR
|
|
│ ├── trading-rls.sql # CREAR
|
|
│ └── financial-rls.sql # CREAR
|
|
|
|
apps/backend/src/
|
|
├── middleware/
|
|
│ └── rate-limiter.ts # ACTUALIZAR
|
|
|
|
apps/mcp-mt4-connector/src/
|
|
└── middleware/
|
|
└── auth.ts # CREAR
|
|
|
|
e2e/
|
|
├── cypress/
|
|
│ └── integration/
|
|
│ ├── auth.spec.ts # CREAR
|
|
│ ├── trading.spec.ts # CREAR
|
|
│ └── education.spec.ts # CREAR
|
|
```
|
|
|
|
#### Criterios de Aceptacion Sprint 5
|
|
|
|
- [ ] RLS habilitado en auth, trading, financial
|
|
- [ ] Rate limiting en todos los endpoints
|
|
- [ ] MCP servers con autenticacion
|
|
- [ ] E2E tests > 50 casos
|
|
- [ ] Security audit sin vulnerabilidades criticas
|
|
|
|
---
|
|
|
|
## 3. DEPENDENCIAS ENTRE TAREAS
|
|
|
|
```
|
|
Sprint 1 (ML Engine)
|
|
|
|
|
v
|
|
Sprint 2 (Backend) ---> Requiere ML funcional
|
|
|
|
|
v
|
|
Sprint 3 (LLM/Agents) ---> Requiere Backend integrado
|
|
|
|
|
v
|
|
Sprint 4 (Frontend) ---> Requiere Backend/LLM funcional
|
|
|
|
|
v
|
|
Sprint 5 (Testing) ---> Requiere todo funcional
|
|
```
|
|
|
|
### Dependencias Criticas
|
|
|
|
| Tarea | Depende de |
|
|
|-------|-----------|
|
|
| S2-T1 (ml-integration) | S1-T4 (ML API funcional) |
|
|
| S3-T2 (live trading) | S3-T1 (MCPOrchestrator) |
|
|
| S4-T4 (investment frontend) | S2-T5 (users module) |
|
|
| S5-T4 (E2E tests) | Sprints 1-4 completados |
|
|
|
|
---
|
|
|
|
## 4. ASIGNACION DE RECURSOS
|
|
|
|
### Perfiles Requeridos
|
|
|
|
| Perfil | Sprints | Dedicacion |
|
|
|--------|---------|------------|
|
|
| ML-SPECIALIST | 1, 3 | 100% |
|
|
| BACKEND-EXPRESS | 2, 5 | 100% |
|
|
| LLM-AGENT | 3 | 100% |
|
|
| FRONTEND-REACT | 4 | 100% |
|
|
| QA-TESTING | 5 | 100% |
|
|
| DBA | 5 | 50% |
|
|
|
|
### Capacidad Estimada
|
|
|
|
- **Total dias de trabajo:** 25-30 dias
|
|
- **Paralelizacion posible:** Sprints 3-4 parcialmente
|
|
- **Buffer para imprevistos:** 20%
|
|
|
|
---
|
|
|
|
## 5. RIESGOS Y MITIGACION
|
|
|
|
| Riesgo | Probabilidad | Mitigacion |
|
|
|--------|--------------|------------|
|
|
| ML no mejora con fixes | Media | Plan B: Simplificar modelo a baseline |
|
|
| Dependencia EA Bridge | Alta | Crear mock service para testing |
|
|
| Retrasos en Sprint 1 | Media | Extender a 7 dias, priorizar criticos |
|
|
| Integracion compleja | Media | Agregar dias buffer a Sprint 3 |
|
|
|
|
---
|
|
|
|
## 6. METRICAS DE SEGUIMIENTO
|
|
|
|
### Por Sprint
|
|
|
|
| Sprint | Velocidad Target | Criterio Exito |
|
|
|--------|-----------------|----------------|
|
|
| 1 | 7 tareas | ML R^2 > 0.10 |
|
|
| 2 | 6 tareas | Backend 100% |
|
|
| 3 | 7 tareas | Live trading OK |
|
|
| 4 | 5 tareas | UX mejorado |
|
|
| 5 | 6 tareas | Ready for prod |
|
|
|
|
### Globales
|
|
|
|
- **Burndown chart** actualizado diariamente
|
|
- **Tests pasando** verificado en cada PR
|
|
- **Metricas ML** monitoreadas continuamente
|
|
|
|
---
|
|
|
|
## 7. CHECKPOINTS DE VALIDACION
|
|
|
|
### Checkpoint 1 (Post-Sprint 1)
|
|
- [ ] ML Engine API respondiendo
|
|
- [ ] Modelos con metricas positivas
|
|
- [ ] Documentacion actualizada
|
|
|
|
### Checkpoint 2 (Post-Sprint 2)
|
|
- [ ] Backend completamente integrado
|
|
- [ ] Tests de integracion pasando
|
|
- [ ] Endpoints protegidos
|
|
|
|
### Checkpoint 3 (Post-Sprint 3)
|
|
- [ ] Agentes operativos
|
|
- [ ] Trading ejecutandose
|
|
- [ ] Persistencia funcionando
|
|
|
|
### Checkpoint 4 (Post-Sprint 4)
|
|
- [ ] Frontend completo
|
|
- [ ] UX validado
|
|
- [ ] Usuarios pueden operar
|
|
|
|
### Checkpoint 5 (Post-Sprint 5)
|
|
- [ ] Seguridad auditada
|
|
- [ ] Tests > 60% coverage
|
|
- [ ] LISTO PARA PRODUCCION
|
|
|
|
---
|
|
|
|
## 8. APROBACION DEL PLAN
|
|
|
|
Este plan requiere aprobacion antes de iniciar ejecucion.
|
|
|
|
**Pendiente aprobacion de:**
|
|
- [ ] Technical Lead
|
|
- [ ] Product Owner
|
|
- [ ] Stakeholders
|
|
|
|
---
|
|
|
|
**Plan creado:** 2026-01-07
|
|
**Version:** 1.0.0
|
|
**Estado:** PENDIENTE APROBACION
|