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>
247 lines
8.2 KiB
Markdown
247 lines
8.2 KiB
Markdown
# Resumen de Cambios - Fase 6 Ejecución
|
|
## Trading Platform
|
|
|
|
**Fecha**: 2026-01-07
|
|
**Versión**: 1.0.0
|
|
**Estado**: COMPLETADO
|
|
|
|
---
|
|
|
|
## 1. Resumen Ejecutivo
|
|
|
|
La Fase 6 de ejecución homologó la configuración de todos los servicios del trading-platform, asegurando:
|
|
- Credenciales de base de datos consistentes
|
|
- Puertos de servicios estandarizados
|
|
- Docker Compose completo con todos los servicios
|
|
- URLs de integración correctas en frontend
|
|
|
|
---
|
|
|
|
## 2. Archivos Modificados
|
|
|
|
### 2.1 Docker Compose
|
|
**Archivo**: `/docker-compose.yml`
|
|
|
|
**Cambios**:
|
|
- Agregado servicio `llm-agent` (puerto 3085)
|
|
- Agregado servicio `trading-agents` (puerto 3086)
|
|
- Configuradas dependencias entre servicios
|
|
- Variables de entorno homologadas
|
|
|
|
```yaml
|
|
# Servicios agregados:
|
|
llm-agent:
|
|
container_name: trading-llm-agent
|
|
ports: ["3085:3085"]
|
|
depends_on: [postgres, redis, ml-engine, data-service]
|
|
|
|
trading-agents:
|
|
container_name: trading-trading-agents
|
|
ports: ["3086:3086"]
|
|
depends_on: [postgres, redis, ml-engine, llm-agent]
|
|
```
|
|
|
|
### 2.2 Configuraciones .env.example
|
|
|
|
| Archivo | Cambios |
|
|
|---------|---------|
|
|
| `apps/backend/.env.example` | DB_USER: trading, DB_PASSWORD: trading_dev_2025 |
|
|
| `apps/data-service/.env.example` | Credenciales homologadas |
|
|
| `apps/ml-engine/.env.example` | PORT: 3083, DATA_SERVICE_URL actualizado |
|
|
| `apps/llm-agent/.env.example` | DATABASE_URL y credenciales agregadas |
|
|
| `apps/trading-agents/.env.example` | Credenciales actualizadas, vars POSTGRES_* removidas |
|
|
|
|
### 2.3 Configuración ML Engine
|
|
**Archivo**: `apps/ml-engine/config/database.yaml`
|
|
|
|
**Cambios**:
|
|
- Agregada sección PostgreSQL como base de datos primaria
|
|
- MySQL marcado como READ ONLY para datos históricos
|
|
|
|
```yaml
|
|
postgres:
|
|
host: "${DB_HOST:-localhost}"
|
|
port: "${DB_PORT:-5432}"
|
|
database: "${DB_NAME:-trading_platform}"
|
|
user: "${DB_USER:-trading}"
|
|
password: "${DB_PASSWORD:-trading_dev_2025}"
|
|
pool_size: 10
|
|
|
|
mysql:
|
|
host: "72.60.226.4"
|
|
read_only: true # Solo lectura de datos historicos
|
|
```
|
|
|
|
### 2.4 Frontend Services
|
|
**Archivos modificados**:
|
|
- `apps/frontend/src/services/mlService.ts`
|
|
- `apps/frontend/src/services/llmAgentService.ts`
|
|
- `apps/frontend/src/services/backtestService.ts`
|
|
- `apps/frontend/src/services/trading.service.ts`
|
|
|
|
**Cambios**:
|
|
```typescript
|
|
// mlService.ts - ANTES: 8001 → DESPUÉS: 3083
|
|
const ML_API_URL = import.meta.env.VITE_ML_URL || 'http://localhost:3083';
|
|
|
|
// llmAgentService.ts - ANTES: 8003 → DESPUÉS: 3085
|
|
const LLM_AGENT_URL = import.meta.env.VITE_LLM_AGENT_URL || 'http://localhost:3085';
|
|
|
|
// backtestService.ts - ANTES: 8001/8002 → DESPUÉS: 3083/3084
|
|
const ML_API_URL = import.meta.env.VITE_ML_URL || 'http://localhost:3083';
|
|
const DATA_SERVICE_URL = import.meta.env.VITE_DATA_SERVICE_URL || 'http://localhost:3084';
|
|
|
|
// trading.service.ts - ANTES: 8003 → DESPUÉS: 3085
|
|
const LLM_AGENT_URL = import.meta.env.VITE_LLM_AGENT_URL || 'http://localhost:3085';
|
|
```
|
|
|
|
---
|
|
|
|
## 3. Configuración Estandarizada
|
|
|
|
### 3.1 Base de Datos PostgreSQL (Source of Truth)
|
|
```
|
|
Host: localhost (postgres en docker)
|
|
Port: 5432
|
|
Database: trading_platform
|
|
User: trading
|
|
Password: trading_dev_2025
|
|
```
|
|
|
|
### 3.2 Puertos de Servicios
|
|
| Servicio | Puerto | Descripción |
|
|
|----------|--------|-------------|
|
|
| frontend | 3080 | React + Vite |
|
|
| backend | 3081 | Express.js API |
|
|
| ml-engine | 3083 | Python FastAPI - ML Models |
|
|
| data-service | 3084 | Python FastAPI - Market Data |
|
|
| llm-agent | 3085 | Python FastAPI - LLM/RAG |
|
|
| trading-agents | 3086 | Python FastAPI - Auto Trading |
|
|
|
|
### 3.3 Redis
|
|
```
|
|
Host: localhost (redis en docker)
|
|
Port: 6379
|
|
DB: 0
|
|
```
|
|
|
|
---
|
|
|
|
## 4. Verificación de Servicios
|
|
|
|
### 4.1 Data Service (3084)
|
|
- **Estado**: 100% Implementado
|
|
- **Endpoints**: /api/v1/market-data, /api/v1/tickers, /api/v1/polygon
|
|
- **Integraciones**: Polygon.io, PostgreSQL, Redis cache
|
|
|
|
### 4.2 ML Engine (3083)
|
|
- **Estado**: 100% Implementado
|
|
- **Modelos**: RangePredictor, AMDDetector, TPSLClassifier, StrategyEnsemble
|
|
- **Endpoints**: /api/v1/signals, /api/v1/amd, /api/v1/predict, /api/ensemble
|
|
|
|
### 4.3 LLM Agent (3085)
|
|
- **Estado**: 100% Implementado
|
|
- **Funciones**: Predictions, Backtesting, Risk Management
|
|
- **Endpoints**: /api/v1/predictions, /api/v1/backtesting
|
|
|
|
### 4.4 Trading Agents (3086)
|
|
- **Estado**: Base implementada
|
|
- **Funciones**: Auto-trading, Signal execution
|
|
- **Pendiente**: MetaAPI integration tests
|
|
|
|
---
|
|
|
|
## 5. Integraciones Verificadas
|
|
|
|
```
|
|
┌─────────────────────────────────────────────────────────────┐
|
|
│ FRONTEND (3080) │
|
|
│ mlService.ts ──────────► ML Engine (3083) │
|
|
│ llmAgentService.ts ────► LLM Agent (3085) │
|
|
│ dataService.ts ────────► Data Service (3084) │
|
|
└─────────────────────────────────────────────────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────────────────────────────────────────┐
|
|
│ BACKEND (3081) │
|
|
│ ├── ML Engine integration │
|
|
│ ├── Data Service integration │
|
|
│ └── PostgreSQL direct │
|
|
└─────────────────────────────────────────────────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────────────────────────────────────────┐
|
|
│ PYTHON SERVICES │
|
|
│ ml-engine (3083) ◄──► data-service (3084) │
|
|
│ │ │ │
|
|
│ ▼ ▼ │
|
|
│ llm-agent (3085) PostgreSQL │
|
|
│ │ │ │
|
|
│ ▼ │ │
|
|
│ trading-agents (3086) ◄─────┘ │
|
|
└─────────────────────────────────────────────────────────────┘
|
|
```
|
|
|
|
---
|
|
|
|
## 6. Próximos Pasos (Fase 7)
|
|
|
|
1. **Validar Docker Compose**
|
|
```bash
|
|
docker-compose config --quiet && echo "OK"
|
|
```
|
|
|
|
2. **Verificar builds**
|
|
```bash
|
|
docker-compose build --dry-run
|
|
```
|
|
|
|
3. **Test de conexiones (cuando servicios activos)**
|
|
```bash
|
|
curl http://localhost:3083/health # ML Engine
|
|
curl http://localhost:3084/health # Data Service
|
|
curl http://localhost:3085/health # LLM Agent
|
|
curl http://localhost:3086/health # Trading Agents
|
|
```
|
|
|
|
---
|
|
|
|
## 7. Notas Importantes
|
|
|
|
### 7.1 MySQL Remoto (Solo Lectura)
|
|
- Host: 72.60.226.4:3306
|
|
- Base de datos: db_trading_meta
|
|
- Uso: Datos históricos de tickers
|
|
- **IMPORTANTE**: Configurado como READ ONLY
|
|
|
|
### 7.2 Variables de Entorno Críticas
|
|
```bash
|
|
# Requeridas para producción
|
|
POLYGON_API_KEY=xxx
|
|
METAAPI_TOKEN=xxx
|
|
METAAPI_ACCOUNT_ID=xxx
|
|
ANTHROPIC_API_KEY=xxx # Si se usa Claude
|
|
```
|
|
|
|
### 7.3 Archivos NO modificados (ya correctos)
|
|
- `apps/database/` - Schema DDL correcto
|
|
- `apps/mcp-*/` - Configuración independiente
|
|
- `packages/` - Tipos compartidos correctos
|
|
|
|
---
|
|
|
|
## 8. Checklist de Validación
|
|
|
|
- [x] docker-compose.yml con todos los servicios
|
|
- [x] Credenciales DB homologadas en todos los .env.example
|
|
- [x] Puertos consistentes (3080-3086)
|
|
- [x] Frontend services con URLs correctas
|
|
- [x] ML Engine con PostgreSQL config
|
|
- [x] Data Service verificado 100%
|
|
- [x] LLM Agent verificado 100%
|
|
- [ ] Test de integración end-to-end (requiere servicios activos)
|
|
|
|
---
|
|
|
|
**Documento generado automáticamente durante Fase 6 de integración**
|