- Created full CAPVED folder with METADATA, 01-06 phases, and SUMMARY - Updated _INDEX.yml with new task entry - Documents: Polygon data loading, MySQL→PostgreSQL migration, 12 attention models Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
64 lines
2.0 KiB
Markdown
64 lines
2.0 KiB
Markdown
# 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
|