trading-platform/orchestration/tareas/_archive/2026-01/TASK-2026-01-25-ML-DATA-MIGRATION/02-ANALISIS.md
Adrian Flores Cortes df43dd90cb [F0-F2] feat: Coherence analysis baseline + entity types + frontend stores
FASE 0 - Preparación y Purga:
- Archived 21 completed tasks to _archive/2026-01/
- Marked 4 docs as DEPRECATED
- Created 3 baseline coherence reports

FASE 1 - DDL-Backend Coherence:
- audit.types.ts: +4 types (SystemEvent, TradingAudit, ApiRequestLog, DataAccessLog)
- investment.types.ts: +4 types (RiskQuestionnaire, WithdrawalRequest, DailyPerformance, DistributionHistory)
- entity.types.ts: +5 types (Symbol, TradingBot, TradingSignal, TradingMetrics, PaperBalance)

FASE 2 - Backend-Frontend Coherence:
- investmentStore.ts: New Zustand store with 20+ actions
- mlStore.ts: New Zustand store with signal caching
- alerts.service.ts: New service with 15 functions

FASE 3 - Documentation:
- OQI-009: Updated to 100% coverage, added ET-MKT-004-productos.md
- OQI-010: Created full structure (STATUS.md, ROADMAP-MT4.md, ET-MT4-001-gateway.md)

Coherence Baseline Established:
- DDL-Backend: 31% (target 95%)
- Backend-Frontend: 72% (target 85%)
- Global: 39.6% (target 90%)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 22:08:04 -06:00

2.0 KiB

02-ANALISIS - ML Data Migration & Model Training

Fecha: 2026-01-25

Fase: ANALISIS (A)

Estado: COMPLETADA


1. Analisis de Brechas

1.1 Capa de Datos

Componente Estado Anterior Estado Requerido Brecha
OHLCV 5m 0 registros >50K por ticker TOTAL
OHLCV 15m 0 registros >15K por ticker TOTAL
MySQL connection Existente Deprecar MIGRACION
PostgreSQL module No existe Requerido CREAR

1.2 ML Engine

Componente Estado Anterior Estado Requerido Brecha
database.py Referencia MySQL Usar PostgreSQL REFACTORIZAR
execute_query MySQL syntax PostgreSQL syntax COMPATIBILIDAD
Modelos L0 No entrenados 12 modelos ENTRENAR

2. Dependencias Identificadas

Polygon API → fetch_polygon_data.py → PostgreSQL market_data
                                            ↓
                                    database.py (ML Engine)
                                            ↓
                                    attention_trainer.py
                                            ↓
                                    12 modelos .joblib

3. Riesgos Evaluados

Riesgo Probabilidad Impacto Mitigacion
Rate limit Polygon ALTA MEDIO Sleep entre requests
Datos insuficientes L1 ALTA ALTO Solo entrenar L0
Query incompatibility MEDIA MEDIO Capa traduccion

4. Decision de Arquitectura

ADR-ML-001: PostgreSQL como unica fuente de datos ML

Contexto: El ML Engine tenia dependencia de MySQL que ya no existe.

Decision: Migrar a PostgreSQL manteniendo compatibilidad con queries legados.

Consecuencias:

  • (+) Una sola base de datos para todo el sistema
  • (+) Compatibilidad con scripts existentes
  • (-) Necesidad de capa de traduccion de queries