trading-platform/README.md
Adrian Flores Cortes 8f0235c096 [TASK-2026-02-06-ANALISIS-INTEGRAL-DOCUMENTACION] docs: Complete 6-phase documentation analysis
- FASE-0: Diagnostic audit of 500+ files, 33 findings cataloged (7P0/8P1/12P2/6P3)
- FASE-1: Resolved 7 P0 critical conflicts (ports, paths, dedup OQI-010/ADR-002, orphan schemas)
- FASE-2: Resolved 8 P1 issues (traces, README/CLAUDE.md, DEPENDENCY-GRAPH v2.0, DDL drift, stack versions, DoR/DoD)
- FASE-3: Resolved 12 P2 issues (archived tasks indexed, RNFs created, OQI-010 US/RF/ET, AGENTS v2.0)
- FASE-4: Purged 3 obsolete docs to _archive/, fixed MODELO-NEGOCIO.md broken ref
- FASE-5: Cross-layer validation (DDL→OQI 66%, OQI→BE 72%, BE→FE 78%, Inventories 95%)
- FASE-6: INFORME-FINAL, SA-INDEX (18 subagents), METADATA COMPLETED

27/33 findings resolved (82%), 6 P3 deferred to backlog.
18 new files created, 40+ modified, 4 archived.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 10:57:03 -06:00

232 lines
7.8 KiB
Markdown

# Trading Platform - Trading Platform
## Descripción
**Trading Platform** es una plataforma integral de gestión de inversiones asistida por inteligencia artificial que combina:
- **Money Manager con IA**: Agentes que gestionan cuentas de trading e inversión con diferentes perfiles de riesgo (conservador, moderado, agresivo)
- **Plataforma Educativa**: Cursos de trading accesibles generados con IA
- **TradingView Privado**: Visualización de gráficos, predicciones ML y señales en tiempo real
- **Sistema SaaS**: Suscripciones, pagos con Stripe y wallets internos
## Estado del Proyecto
- **Estado:** MVP en desarrollo avanzado (~50%)
- **Codigo:** 58,000+ lineas en produccion
- **Servicios:** 7 aplicaciones funcionando
- **Database:** 11 schemas, 101 tablas DDL, 50 enums, 36 functions, 46 triggers
- **Backend:** 18 modulos, 85 type interfaces, 76 services, 62 controllers
- **Frontend:** 14 modulos, 225 componentes, 58 paginas
- **Ultima actualizacion:** 2026-02-06
## Stack Tecnológico
| Componente | Tecnología | Puerto |
|------------|------------|--------|
| Frontend | React 18 + TypeScript + Tailwind CSS | 3080 |
| Backend API | Express.js 5 + Node.js 20 | 3081 |
| WebSocket | Real-time (charts, notifications) | 3082 |
| ML Engine | Python + FastAPI + PyTorch/XGBoost | 3083 |
| Data Service | Python + FastAPI | 3084 |
| LLM Agent | Python + FastAPI + Ollama | 3085 |
| Trading Agents | Python + FastAPI + CCXT | 3086 |
| Ollama WebUI | Interfaz gestión modelos LLM | 3087 |
| Database | PostgreSQL 16 (trading_platform) | 5432 |
| Cache | Redis 7 | 6379 |
## Estructura del Proyecto
```
trading-platform/
├── apps/ # Aplicaciones
│ ├── backend/ # API principal (Express.js)
│ │ └── src/
│ │ ├── modules/ # Módulos por funcionalidad
│ │ │ ├── auth/ # Autenticación
│ │ │ ├── users/ # Usuarios
│ │ │ ├── trading/ # Trading
│ │ │ ├── portfolio/ # Portafolios
│ │ │ ├── education/ # Educación
│ │ │ ├── payments/ # Pagos (Stripe)
│ │ │ ├── ml/ # Integración ML
│ │ │ ├── llm/ # Integración LLM
│ │ │ └── admin/ # Administración
│ │ └── shared/ # Compartido
│ │
│ ├── frontend/ # UI (React)
│ │ └── src/
│ │ └── modules/ # Módulos UI
│ │
│ ├── ml-engine/ # Servicio ML (Python)
│ │ └── src/
│ │ ├── models/ # Modelos ML
│ │ ├── pipelines/ # Pipelines de entrenamiento
│ │ ├── backtesting/ # Motor de backtesting
│ │ └── api/ # Endpoints FastAPI
│ │
│ ├── llm-agent/ # Copiloto IA (Python)
│ │ └── src/
│ │ ├── core/ # Core LLM
│ │ ├── tools/ # 12 herramientas de trading
│ │ └── prompts/ # System prompts
│ │
│ ├── trading-agents/ # Agentes de trading (Python)
│ │ └── src/
│ │ ├── agents/ # Atlas, Orion, Nova
│ │ ├── strategies/ # Estrategias de trading
│ │ └── exchange/ # Integración exchanges
│ │
│ ├── data-service/ # Datos de mercado (Python) ⚠️ INCOMPLETO
│ │ └── src/
│ │ └── providers/ # Proveedores de datos
│ │
│ └── database/ # PostgreSQL
│ └── ddl/
│ └── schemas/ # 11 schemas, 101 tablas
├── packages/ # Código compartido
│ ├── sdk-typescript/ # SDK para frontend/backend
│ ├── sdk-python/ # SDK para servicios Python
│ ├── config/ # Configuración centralizada
│ └── types/ # Tipos compartidos
├── docker/ # Configuración Docker
│ └── docker-compose.yml
├── docs/ # Documentación
└── orchestration/ # Sistema de agentes NEXUS
```
## Agentes de Trading
| Agente | Perfil | Target Mensual | Max Drawdown | Estrategias |
|--------|--------|----------------|--------------|-------------|
| **Atlas** | Conservador | 3-5% | 5% | Mean Reversion, Grid Trading |
| **Orion** | Moderado | 5-10% | 10% | Trend Following, Breakouts |
| **Nova** | Agresivo | 10%+ | 20% | Momentum, Scalping |
## Modelos ML
| Modelo | Propósito | Algoritmos |
|--------|-----------|------------|
| AMD Detector | Detectar fases Smart Money | CNN + LSTM + XGBoost Ensemble |
| Range Predictor | Predecir rangos de precio | XGBoost, Random Forest |
| Signal Generator | Generar señales de trading | Neural Network + Technical Analysis |
## Base de Datos (11 Schemas, 101 Tablas)
| Schema | Proposito | Tablas |
|--------|-----------|--------|
| `auth` | Autenticacion y usuarios | 12 |
| `trading` | Trading y ordenes | 13 |
| `education` | Cursos y gamificacion | 19 |
| `financial` | Pagos y wallets | 11 |
| `investment` | Productos PAMM | 10 |
| `ml` | Modelos y predicciones | 12 |
| `llm` | Conversaciones IA | 5 |
| `portfolio` | Gestion de carteras | 5 |
| `audit` | Logs y auditoria | 7 |
| `market_data` | Datos de mercado | 4 |
| `feature_flags` | Feature flags | 3 |
## Inicio Rápido
### Requisitos
- Node.js 20+
- Python 3.10+
- PostgreSQL 16+
- Redis 7+
- Docker & Docker Compose
### Instalación
```bash
# Clonar e instalar
cd C:/Empresas/ISEM/workspace-v2/projects/trading-platform
# Backend (puerto 3081)
cd apps/backend
npm install
cp .env.example .env
npm run dev
# Frontend (puerto 3080)
cd ../frontend
npm install
cp .env.example .env
npm run dev
# Servicios Python
cd ../ml-engine
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn src.main:app --port 3083
# Con Docker (recomendado)
docker-compose up -d
```
## Uso del SDK
### TypeScript
```typescript
import { Trading PlatformClient } from '@trading-platform/sdk-typescript';
const client = new Trading PlatformClient({
baseUrl: 'http://localhost:3081',
});
// Login
await client.auth.login({ email, password });
// Obtener señales
const signals = await client.ml.getSignals({ symbol: 'BTCUSDT' });
// Chat con copiloto
const response = await client.ml.chat({
message: '¿Qué opinas del BTC ahora?',
});
```
### Python
```python
from trading_sdk import Trading PlatformClient, Config
config = Config.from_env()
async with Trading PlatformClient(config) as client:
# Obtener predicción
prediction = await client.get_prediction("BTCUSDT", "1h")
# Chat con LLM
response = await client.chat("Analiza el mercado de ETH")
```
## Tareas Pendientes
### Crítico (P0)
- [ ] Completar data-service (actualmente ~20%)
- [ ] Agregar tests unitarios
- [ ] Implementar retry/circuit breaker entre servicios
### Alto (P1)
- [ ] Documentar APIs (OpenAPI)
- [ ] Implementar métricas Prometheus
- [ ] Completar sistema PAMM
### Medio (P2)
- [ ] KYC/AML
- [ ] Notificaciones push
- [ ] Exportación de reportes
## Documentación
- [Análisis de Migración e Integración](./docs/00-overview/ANALISIS-MIGRACION-INTEGRACION.md)
- [Requerimientos MVP](./docs/00-overview/REQUERIMIENTOS-MVP.md)
- [Servicios](./SERVICES.md)
- [Próxima Acción](./orchestration/PROXIMA-ACCION.md)
---
*Proyecto parte del workspace de Fabrica de Software con Agentes IA*
*Directivas: `C:/Empresas/ISEM/workspace-v2/orchestration/directivas/`*