workspace-v1/projects/trading-platform/docs/README.md
rckrdmrd 66161b1566 feat: Workspace-v1 complete migration with NEXUS v3.4
Sistema NEXUS v3.4 migrado con:

Estructura principal:
- core/orchestration: Sistema SIMCO + CAPVED (27 directivas, 28 perfiles)
- core/catalog: Catalogo de funcionalidades reutilizables
- shared/knowledge-base: Base de conocimiento compartida
- devtools/scripts: Herramientas de desarrollo
- control-plane/registries: Control de servicios y CI/CD
- orchestration/: Configuracion de orquestacion de agentes

Proyectos incluidos (11):
- gamilit (submodule -> GitHub)
- trading-platform (OrbiquanTIA)
- erp-suite con 5 verticales:
  - erp-core, construccion, vidrio-templado
  - mecanicas-diesel, retail, clinicas
- betting-analytics
- inmobiliaria-analytics
- platform_marketing_content
- pos-micro, erp-basico

Configuracion:
- .gitignore completo para Node.js/Python/Docker
- gamilit como submodule (git@github.com:rckrdmrd/gamilit-workspace.git)
- Sistema de puertos estandarizado (3005-3199)

Generated with NEXUS v3.4 Migration System
EPIC-010: Configuracion Git y Repositorios
2026-01-04 03:37:42 -06:00

279 lines
9.7 KiB
Markdown

# OrbiQuantIA - Documentacion del Proyecto
**Ultima actualizacion:** 2025-12-05
**Version:** 1.0.0
**Estado:** En Desarrollo Activo
**Tipo:** SaaS Trading Platform con IA
---
## Proposito
Este directorio contiene la documentacion completa del proyecto **OrbiQuantIA**, una plataforma SaaS de trading e inversion que integra:
- **Predicciones ML** - XGBoost para prediccion de max/min de precios
- **Plataforma Educativa** - Cursos de trading con sistema de niveles
- **Trading Dashboard** - Charts en tiempo real con predicciones
- **Sistema de Pagos** - Integracion completa con Stripe
---
## Estado Actual del Desarrollo
### Componentes Implementados
| Componente | Estado | Descripcion |
|------------|--------|-------------|
| Backend NestJS | ✅ Completo | API REST con TypeORM y PostgreSQL |
| Frontend React | ✅ Completo | Vite + TailwindCSS + React Router |
| ML Services | ✅ Completo | FastAPI + XGBoost predictor |
| Base de Datos | ✅ Completo | PostgreSQL con 5 schemas, 44 tablas |
| Autenticacion | ✅ Completo | JWT + Refresh Tokens |
| Modulo Cursos | ✅ Completo | CRUD completo con categorias |
| Pagos Stripe | ✅ Completo | Suscripciones + Webhooks |
### Endpoints Disponibles
**Backend (NestJS - Puerto 3000):**
- `POST /auth/login` - Autenticacion
- `POST /auth/register` - Registro
- `GET /courses` - Listar cursos
- `POST /payments/create-payment-intent` - Crear pago
- `POST /payments/subscriptions` - Crear suscripcion
**ML Services (FastAPI - Puerto 8000):**
- `GET /api/predict/{symbol}` - Predicciones de precio
- `POST /api/train/{symbol}` - Entrenar modelo
- `GET /api/training/status` - Estado del entrenamiento
- `GET /health` - Health check
---
## Mapa de Navegacion
```
docs/
├── 00-vision-general/ # Vision, alcance, arquitectura
│ ├── VISION-PRODUCTO.md
│ ├── ARQUITECTURA-GENERAL.md
│ └── STACK-TECNOLOGICO.md
├── 01-fase-mvp/ # FASE 1: MVP (6 epicas)
│ ├── OQI-001-fundamentos-auth/
│ ├── OQI-002-education/
│ ├── OQI-003-trading-charts/
│ ├── OQI-004-investment-accounts/
│ ├── OQI-005-payments-stripe/
│ └── OQI-006-ml-signals/
├── 02-fase-growth/ # FASE 2: Crecimiento
├── 03-fase-enterprise/ # FASE 3: Enterprise
├── 90-transversal/ # Cross-cutting concerns
│ ├── sprints/
│ ├── roadmap/
│ └── inventarios/
├── 95-guias-desarrollo/ # Guias tecnicas
│ ├── backend/
│ ├── frontend/
│ ├── ml-engine/
│ └── database/
├── 96-quick-reference/ # Referencias rapidas
├── 97-adr/ # Architecture Decision Records
└── 98-standards/ # Estandares del proyecto
```
---
## Stack Tecnologico Actual
| Capa | Tecnologia | Version | Estado |
|------|------------|---------|--------|
| **Frontend** | React + Vite + TypeScript | 19.x / 6.x / 5.x | ✅ |
| **UI Framework** | TailwindCSS + shadcn/ui | 3.x | ✅ |
| **State Management** | Zustand | 5.x | ✅ |
| **Backend API** | NestJS + TypeScript | 11.x / 5.x | ✅ |
| **ORM** | TypeORM | 0.3.x | ✅ |
| **ML Engine** | Python + FastAPI | 3.11 / 0.115 | ✅ |
| **ML Models** | XGBoost + scikit-learn | 2.x / 1.x | ✅ |
| **Base de Datos** | PostgreSQL | 16.x | ✅ |
| **Pagos** | Stripe | 20.x | ✅ |
| **Auth** | JWT + Passport | - | ✅ |
---
## Arquitectura del Sistema
```
┌─────────────────────────────────────────────────────────────────┐
│ FRONTEND (React 19) │
│ Vite + TailwindCSS + Zustand │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Login │ │Dashboard │ │ Courses │ │Predictions│ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
│ Puerto 5173 │
└─────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────┐
│ BACKEND API (NestJS 11) │
│ TypeORM + PostgreSQL │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Auth │ │ Users │ │ Courses │ │ Payments │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
│ Puerto 3000 │
└─────────────────────────────────────────────────────────────────┘
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────────────────────────┐
│ PostgreSQL │ │ ML SERVICES (FastAPI) │
│ Puerto 5433 │ │ Puerto 8000 │
│ │ │ ┌──────────┐ ┌──────────┐ │
│ - public │ │ │ XGBoost │ │ Feature │ │
│ - auth │ │ │ Predictor│ │Engineering│ │
│ - education │ │ └──────────┘ └──────────┘ │
│ - trading │ │ ┌──────────┐ ┌──────────┐ │
│ - billing │ │ │ Market │ │ Training │ │
│ │ │ │ Data │ │ Pipeline │ │
└─────────────────┘ │ └──────────┘ └──────────┘ │
└─────────────────────────────────────┘
```
---
## Configuracion de Stripe
### Productos Configurados
| Plan | Producto ID | Price ID | Precio |
|------|-------------|----------|--------|
| Basic | `prod_TYA4rxBGz3ZEl1` | `price_1Sb3k64dPtEGmLmpeAdxvmIu` | $19/mes |
| Pro | `prod_TYA4ZpGaV1eMai` | `price_1Sb3k64dPtEGmLmpm5n5bbJH` | $49/mes |
| Premium | `prod_TYA4MrWX4h8CSF` | `price_1Sb3k74dPtEGmLmpHfLpUkvQ` | $99/mes |
### Webhook Endpoint
```
URL: https://[tu-dominio]/payments/webhook
Eventos:
- payment_intent.succeeded
- payment_intent.payment_failed
- customer.subscription.updated
- customer.subscription.deleted
```
---
## Modelo ML - XGBoost Predictor
### Caracteristicas (30+ features)
- **Volatilidad**: volatility_5, volatility_10, volatility_20, ATR
- **Momentum**: momentum_5, momentum_10, momentum_20, ROC
- **Medias Moviles**: SMA, EMA, ratios de precio
- **Indicadores**: RSI, MACD, Bollinger Bands
- **Volumen**: volume_ratio, volume_sma
### Metricas de Entrenamiento
| Metrica | Valor |
|---------|-------|
| MAE High | 0.099% |
| MAE Low | 0.17% |
| Samples | 500 candles |
| Horizonte | 30 min (6 candles) |
---
## Variables de Entorno
### Backend (.env)
```env
# Database
DB_HOST=localhost
DB_PORT=5433
DB_DATABASE=orbiquantia_platform
DB_USERNAME=orbiquantia
DB_PASSWORD=***
# JWT
JWT_SECRET=***
JWT_EXPIRES_IN=1d
# ML Service
ML_SERVICE_URL=http://localhost:8000
# Stripe
STRIPE_SECRET_KEY=sk_test_***
STRIPE_WEBHOOK_SECRET=whsec_***
# App
PORT=3000
FRONTEND_URL=http://localhost:5173
```
---
## Comandos Utiles
### Desarrollo
```bash
# Backend
cd apps/backend && npm run start:dev
# Frontend
cd apps/frontend && npm run dev
# ML Services
cd apps/ml-services && conda activate orbiquantia-ml && uvicorn src.api.server:app --reload --port 8000
# Base de datos
PGPASSWORD=*** psql -h localhost -p 5433 -U orbiquantia -d orbiquantia_platform
```
### Build
```bash
# Backend
cd apps/backend && npm run build
# Frontend
cd apps/frontend && npm run build
```
---
## Proximos Pasos
1. [x] Conectar Backend con PostgreSQL
2. [x] Implementar modulo de cursos
3. [x] Conectar Frontend con Backend
4. [x] Integrar modelos ML reales
5. [x] Implementar pagos Stripe
6. [ ] Crear pagina de Predictions en Frontend
7. [ ] Implementar WebSocket para precios en tiempo real
8. [ ] Agregar mas instrumentos (ETH, XAU, EUR)
9. [ ] Implementar sistema de notificaciones
10. [ ] Deploy a produccion
---
## Referencias
- [NestJS Documentation](https://docs.nestjs.com)
- [FastAPI Documentation](https://fastapi.tiangolo.com)
- [Stripe API Reference](https://stripe.com/docs/api)
- [XGBoost Documentation](https://xgboost.readthedocs.io)
- [React Documentation](https://react.dev)
---
*Documentacion actualizada: 2025-12-05*