trading-platform/orchestration/_archive/planes/PLAN-REFINADO-2026-01-FASE2.md
Adrian Flores Cortes 8293938cbe [ESTANDAR-ORCHESTRATION] refactor: Consolidate to standard structure
- 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>
2026-01-24 14:38:26 -06:00

12 KiB

Plan de Desarrollo Refinado

Trading Platform - Version Final

Fecha: 2026-01-07 Version: 2.0.0 (Refinado) Estado: LISTO PARA EJECUCION Basado en:

  • ANALISIS-CONSOLIDADO-FASE1-2026-01-07.md
  • VALIDACION-PLAN-VS-ANALISIS-2026-01-07.md
  • ANALISIS-DEPENDENCIAS-2026-01-07.md

1. CAMBIOS RESPECTO AL PLAN ORIGINAL

1.1 Tareas Agregadas

Sprint Tarea Nueva Razon
3 S3-T0: Documentar EA Bridge Dependencia critica no documentada
2 S2-T7: Admin controllers Gap identificado en validacion
5 S5-T7: Contract tests Dependencias entre servicios

1.2 Orden de Ejecucion Ajustado

Basado en analisis de dependencias, se ajusto el orden interno de cada sprint.

1.3 Criterios de Aceptacion Refinados

Criterio Original Criterio Refinado Razon
R^2 > 0.10 R^2 > 0.05 (minimo aceptable) Realismo
Live trading OK Live trading + Mock fallback Dependencia EA Bridge

2. PLAN REFINADO POR SPRINTS

SPRINT 1: ESTABILIZACION ML ENGINE (5-7 dias)

Objetivo

Resolver problemas criticos de ML y establecer baseline funcional.

Tareas en Orden de Ejecucion

# ID Tarea Archivo(s) Deps Entregable
1 S1-T1 Analizar features RangePredictor src/data/features.py - Reporte de features
2 S1-T2 Revisar normalizacion src/data/features.py S1-T1 Fix normalizacion
3 S1-T3 Verificar data leakage src/data/targets.py S1-T1 Reporte leakage
4 S1-T4a Corregir RangePredictor src/models/range_predictor.py S1-T2,T3 Modelo corregido
5 S1-T4b Reentrenar modelos src/training/*.py S1-T4a Modelos nuevos
6 S1-T5 Auto-load en API src/api/main.py S1-T4b API funcional
7 S1-T6 Validacion OOS Scripts nuevos S1-T5 Reporte OOS
8 S1-T7 Tests unitarios tests/ S1-T5 Coverage > 70%

Metricas de Exito Sprint 1

Metrica Minimo Aceptable Objetivo
RangePredictor R^2 > 0.05 > 0.15
API Response Time < 1000ms < 500ms
Test Coverage > 50% > 70%
Modelos cargados 100% 100%

Plan de Contingencia Sprint 1

Si R^2 < 0.05 despues de 5 dias:

  1. Cambiar a modelo baseline (media movil)
  2. Documentar limitaciones
  3. Continuar con Sprint 2 usando baseline
  4. Crear ticket para iteracion futura de ML

SPRINT 2: INTEGRACION BACKEND (5 dias)

Objetivo

Completar servicios de integracion y seguridad basica.

Tareas en Orden de Ejecucion

# ID Tarea Archivo(s) Deps Entregable
1 S2-T1 ml-integration.service.ts src/modules/ml/services/ Sprint 1 Servicio completo
2 S2-T2 Auth paper trading src/modules/trading/trading.routes.ts - Endpoints protegidos
3 S2-T3 Auth investment src/modules/investment/investment.routes.ts - Endpoints protegidos
4 S2-T4 agents.service.ts src/modules/agents/services/ S2-T1 Orquestacion basica
5 S2-T5 Users module src/modules/users/ - CRUD usuarios
6 S2-T6 Tests integracion src/__tests__/integration/ S2-T1 Tests pasando
7 S2-T7 Admin controllers src/modules/admin/ S2-T5 Admin basico

Metricas de Exito Sprint 2

Metrica Minimo Aceptable Objetivo
Endpoints con auth 100% (paper/investment) 100%
ml-integration completo 100% metodos 100%
Tests integracion > 10 tests > 20 tests

SPRINT 3: LLM Y TRADING AGENTS (5-7 dias)

Objetivo

Completar agentes inteligentes y trading automatizado.

Tareas en Orden de Ejecucion

# ID Tarea Archivo(s) Deps Entregable
0 S3-T0 Documentar EA Bridge docs/EA-BRIDGE.md - Documentacion
1 S3-T1 MCPOrchestrator completo src/services/mcp_orchestrator.py - Portfolio consolidado
2 S3-T2 Live trading execution src/tools/trading.py S3-T1 Trading funcional
3 S3-T3 Persistencia decisiones src/services/auto_trade_service.py S3-T2 Decisiones en BD
4 S3-T4 Rate limiting src/api/routes.py - Limites aplicados
5 S3-T5 Scalping strategy src/strategies/scalping.py (nuevo) - Estrategia funcional
6 S3-T6 Persistencia trades src/persistence/db_manager.py (nuevo) - Trades en BD
7 S3-T7 WebSocket signals src/signals/ws_consumer.py (nuevo) S3-T6 Real-time signals

Configuracion Scalping Strategy

scalping:
  enabled: true
  description: "Fast in-and-out trades for Nova"
  suitable_for:
    - nova
  parameters:
    tick_interval: "1m"
    spread_threshold: 0.05
    min_profit_ticks: 2
    max_position_time_seconds: 300
    rsi_period: 7
    rsi_oversold: 25
    rsi_overbought: 75
  indicators:
    - type: rsi
      period: 7
    - type: ema
      period: 5
    - type: volume
      period: 10

Metricas de Exito Sprint 3

Metrica Minimo Aceptable Objetivo
Portfolio consolidado MT4 + Binance Completo
Live trading Mock funcional Real si EA Bridge disponible
Rate limiting 60 req/min 100 req/min
Scalping tests > 5 tests > 10 tests
Trades persistidos 100% 100%

SPRINT 4: FRONTEND Y UX (5 dias)

Objetivo

Mejorar experiencia de usuario y completar modulos faltantes.

Tareas en Orden de Ejecucion

# ID Tarea Archivo(s) Deps Entregable
1 S4-T1 WebSocket trading src/services/websocket.service.ts Sprint 2 Real-time prices
2 S4-T2 Streaming LLM src/modules/assistant/pages/Assistant.tsx Sprint 3 Chat streaming
3 S4-T3 Certificados PDF src/modules/education/services/certificate.service.ts - PDFs descargables
4 S4-T4 Investment conectado src/modules/investment/ Sprint 2 Datos reales
5 S4-T5 Dashboard basico src/modules/dashboard/ - Overview funcional

Metricas de Exito Sprint 4

Metrica Minimo Aceptable Objetivo
WebSocket latencia < 500ms < 200ms
Streaming funcionando Si Si
Certificados Descargables Con verificacion
Investment data Backend conectado Completo

SPRINT 5: SEGURIDAD Y TESTING (5-7 dias)

Objetivo

Hardening para produccion y cobertura de tests.

Tareas en Orden de Ejecucion

# ID Tarea Archivo(s) Deps Entregable
1 S5-T1 RLS PostgreSQL ddl/rls/*.sql - RLS habilitado
2 S5-T2 Rate limiting Backend src/middleware/rate-limiter.ts - Limites globales
3 S5-T3 Auth MCP servers apps/mcp-*/src/middleware/auth.ts - Bearer tokens
4 S5-T4 E2E tests core e2e/cypress/integration/ Sprints 1-4 > 30 tests
5 S5-T5 Integration tests src/__tests__/integration/ - > 20 tests
6 S5-T6 Security audit - S5-T1,T2,T3 Reporte
7 S5-T7 Contract tests tests/contracts/ - Interfaces validadas

RLS Policies a Implementar

-- Auth schema
CREATE POLICY user_own_sessions ON auth.sessions
  FOR ALL USING (user_id = current_setting('app.user_id')::UUID);

-- Trading schema
CREATE POLICY user_own_orders ON trading.orders
  FOR ALL USING (user_id = current_setting('app.user_id')::UUID);

CREATE POLICY user_own_positions ON trading.positions
  FOR ALL USING (user_id = current_setting('app.user_id')::UUID);

-- Financial schema
CREATE POLICY user_own_wallets ON financial.wallets
  FOR ALL USING (user_id = current_setting('app.user_id')::UUID);

Metricas de Exito Sprint 5

Metrica Minimo Aceptable Objetivo
RLS tablas 10 tablas criticas 20+ tablas
E2E tests 30 tests 50 tests
Integration tests 20 tests 40 tests
Vulnerabilidades criticas 0 0
Coverage global 50% 60%

3. TIMELINE CONSOLIDADO

Semana 1: Sprint 1 (ML Engine)
    L  M  X  J  V
    |  |  |  |  |
    S1-T1-T2-T3-T4a
              |
Semana 2: Sprint 1 (cont) + Sprint 2 (inicio)
    L  M  X  J  V
    |  |  |  |  |
    S1-T4b-T5-T6-T7 | S2-T1
                    |
Semana 3: Sprint 2 (Backend)
    L  M  X  J  V
    |  |  |  |  |
    S2-T2-T3-T4-T5-T6-T7

Semana 4: Sprint 3 (LLM + Agents)
    L  M  X  J  V  S  D
    |  |  |  |  |  |  |
    S3-T0-T1-T2-T3-T4-T5

Semana 5: Sprint 3 (cont) + Sprint 4
    L  M  X  J  V
    |  |  |  |  |
    S3-T6-T7 | S4-T1-T2-T3
             |
Semana 6: Sprint 4 (cont) + Sprint 5
    L  M  X  J  V
    |  |  |  |  |
    S4-T4-T5 | S5-T1-T2-T3
             |
Semana 7: Sprint 5 (Testing)
    L  M  X  J  V
    |  |  |  |  |
    S5-T4-T5-T6-T7

4. CHECKPOINTS DE VALIDACION

Checkpoint 1 (Fin Semana 2)

Criterios:

  • ML API respondiendo correctamente
  • Al menos 1 modelo con R^2 > 0 (positivo)
  • Backend puede conectar a ML

Decision Gate: Si no se cumple, activar Plan B ML

Checkpoint 2 (Fin Semana 3)

Criterios:

  • Backend 100% integrado
  • Todos los endpoints protegidos
  • Tests de integracion pasando

Decision Gate: Si no se cumple, extender Sprint 2

Checkpoint 3 (Fin Semana 5)

Criterios:

  • MCPOrchestrator funcional
  • Trading (mock o real) operativo
  • Scalping strategy implementada

Decision Gate: Si no se cumple, priorizar funcionalidad core

Checkpoint 4 (Fin Semana 6)

Criterios:

  • Frontend completo
  • WebSocket funcionando
  • UX validado

Decision Gate: Si no se cumple, diferir features no criticos

Checkpoint Final (Fin Semana 7)

Criterios:

  • RLS habilitado
  • Tests > 50% coverage
  • 0 vulnerabilidades criticas
  • LISTO PARA PRODUCCION

5. ESCALATION PATH

Nivel 1: Bloqueo Tecnico

Trigger: Tarea bloqueada > 1 dia Accion: Pair programming, buscar alternativa Responsable: Tech Lead

Nivel 2: Retraso de Sprint

Trigger: Sprint > 2 dias de retraso Accion: Reducir scope, mover tareas a siguiente sprint Responsable: Tech Lead + Product Owner

Nivel 3: Riesgo de Proyecto

Trigger: 2+ sprints retrasados O bloqueador critico Accion: Reunion de crisis, replantear timeline Responsable: Stakeholders


6. DEFINICION DE DONE

Por Tarea

  • Codigo implementado
  • Tests escritos (si aplica)
  • Code review aprobado
  • Documentacion actualizada
  • Sin errores de lint

Por Sprint

  • Todas las tareas Done
  • Tests del sprint pasando
  • Demo realizada
  • Retrospectiva completada
  • Siguiente sprint planificado

Por Proyecto (Fase 2)

  • 100% gaps criticos resueltos
  • 100% gaps alta prioridad resueltos
  • > 50% coverage tests
  • 0 vulnerabilidades criticas
  • Documentacion completa
  • Ready for production deploy

7. APROBACION FINAL

Estado del Plan

Fase Estado Fecha
Analisis COMPLETADO 2026-01-07
Planeacion COMPLETADO 2026-01-07
Validacion COMPLETADO 2026-01-07
Dependencias COMPLETADO 2026-01-07
Refinamiento COMPLETADO 2026-01-07
PLAN FINAL LISTO PARA EJECUCION 2026-01-07

Firmas de Aprobacion

  • Technical Lead: _____________ Fecha: _______
  • Product Owner: _____________ Fecha: _______
  • QA Lead: _____________ Fecha: _______

Plan refinado: 2026-01-07 Version: 2.0.0 Autor: Technical Lead (Claude Opus 4.5) Siguiente paso: Fase 6 - Ejecucion (Sprint 1)