trading-platform/orchestration/DEPENDENCY-GRAPH.yml
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

647 lines
24 KiB
YAML

# ===============================================================================
# DEPENDENCY-GRAPH.yml - Trading Platform
# ===============================================================================
#
# Sistema: SIMCO v4.3.0 + NEXUS v4.0
# Estandar: SIMCO-ESTANDAR-ORCHESTRATION v1.0.0
# Proposito: Grafo de dependencias completo del proyecto
# Fecha: 2026-02-06
# Version: 2.0.0
#
# Cubre: 15 servicios, 18 backend modules, 11 DB schemas, 6 external APIs
#
# ===============================================================================
metadata:
proyecto: trading-platform
version: "2.0.0"
ultima_actualizacion: "2026-02-06"
tipo_proyecto: STANDALONE
total_servicios: 15
total_backend_modules: 18
total_db_schemas: 11
total_db_tables: 101
# ─────────────────────────────────────────────────────────────────────────────
# DEPENDENCIAS UPSTREAM (de quien depende este proyecto)
# ─────────────────────────────────────────────────────────────────────────────
upstream:
- proyecto: workspace-v2
tipo: orchestration
que_hereda:
- directivas SIMCO
- principios
- templates
- perfiles de agentes
- proyecto: template-saas
tipo: patterns
que_hereda:
- auth patterns
- multi-tenancy
- api structure
- frontend structure
# ─────────────────────────────────────────────────────────────────────────────
# DEPENDENCIAS DOWNSTREAM (quien depende de este proyecto)
# ─────────────────────────────────────────────────────────────────────────────
downstream: []
# STANDALONE - no tiene proyectos que dependan de el
# ─────────────────────────────────────────────────────────────────────────────
# DEPENDENCIAS EXTERNAS (APIs y servicios de terceros)
# ─────────────────────────────────────────────────────────────────────────────
external:
apis:
- nombre: Polygon.io
tipo: market_data
critico: true
consumido_por: [data-service]
uso: Historical/realtime market data (stocks, forex, crypto)
notas: Also aliased as Massive.com in some config
- nombre: Binance API
tipo: crypto_exchange
critico: false
consumido_por: [data-service, mcp-binance-connector]
uso: Crypto market data, account info, order placement
notas: Read-only in development
- nombre: MetaAPI
tipo: trading_gateway
critico: false
estado: NOT_FUNCTIONAL
consumido_por: [data-service]
uso: MT4 trading bridge (demo accounts only)
notas: OQI-009 mt4-gateway at 15% progress
- nombre: Stripe
tipo: payment_provider
critico: true
consumido_por: [backend, mcp-products, mcp-vip]
uso: Payment processing, subscriptions, refunds, invoices
notas: Test mode only in development
- nombre: Twilio
tipo: communications
critico: false
consumido_por: [backend]
uso: SMS/WhatsApp OTP verification
notas: Via Twilio Verify Service
- nombre: OAuth Providers
tipo: identity
critico: true
consumido_por: [backend]
proveedores:
- Google
- Facebook
- Apple
- GitHub
uso: Social login / OAuth2 authentication
- nombre: Ollama
tipo: llm_provider
critico: false
consumido_por: [ml-engine]
uso: Local LLM inference for strategy analysis
notas: Also supports Claude via Anthropic SDK
- nombre: Anthropic (Claude)
tipo: llm_provider
critico: false
consumido_por: [backend]
uso: LLM module strategy analysis
notas: Via @anthropic-ai/sdk in llm module
- nombre: Firebase (FCM)
tipo: push_notifications
critico: false
consumido_por: [backend]
uso: Push notifications via Firebase Cloud Messaging
infraestructura:
- nombre: PostgreSQL
version: "16+"
uso: primary_database
base_de_datos: trading_platform
schemas: 11
tablas: 101
consumido_por: [backend, mcp-auth, mcp-wallet, mcp-products, mcp-vip, mcp-investment, mcp-predictions, data-service, ml-engine]
- nombre: Redis
version: "7.x"
uso: cache_sessions_rate_limiting
consumido_por: [backend]
funciones:
- session storage
- rate limiting
- feature flag cache
- OAuth state store
# ─────────────────────────────────────────────────────────────────────────────
# DEPENDENCIAS INTERNAS (entre servicios/apps del proyecto)
# ─────────────────────────────────────────────────────────────────────────────
internal:
apps:
# ── TypeScript Stack ─────────────────────────────────────────────────
backend:
nombre: Express.js Backend API
puerto: 3081
websocket_puerto: 3082
stack: Express.js 5 + TypeScript
depende_de:
- database # PostgreSQL via pg Pool (raw SQL)
- redis # Sessions, rate limiting, cache
- ml-engine # HTTP client (mlEngineClient)
- trading-agents # HTTP client (tradingAgentsClient) - NOT DEPLOYED
- llm-agent # HTTP client (llmAgentClient) - NOT DEPLOYED
dependencias_externas:
- Stripe # payments module
- Twilio # auth/phone.service (OTP)
- Firebase # notifications/firebase.client (push)
- Anthropic # llm module (@anthropic-ai/sdk)
- OAuth Providers # auth/oauth.service
modules: 18
notas: Main API gateway; all frontend requests route through here
frontend:
nombre: React SPA
puerto: 3080
stack: React 18 + Vite 6 + Zustand + TanStack Query
depende_de:
- backend # REST API (port 3081)
- backend-ws # WebSocket (port 3082)
notas: All data access goes through backend API; no direct DB/MCP access
database:
nombre: PostgreSQL DDL
stack: PostgreSQL 16+
schemas: [auth, trading, education, financial, investment, ml, llm, audit, portfolio, market_data, feature_flags]
tablas: 101
depende_de: []
notas: Foundation layer; no upstream dependencies
ml-engine:
nombre: ML Engine (Python)
puerto: 3083
stack: FastAPI + Python 3.11 + PyTorch + XGBoost
depende_de:
- database # asyncpg pool (market_data, ml schemas)
- data-service # Market data fetching via HTTP
dependencias_externas:
- Ollama # LLM inference
notas: Signal generation, model training, backtesting, predictions
data-service:
nombre: Data Service (Python)
puerto: 3084
stack: FastAPI + Python 3.12 + asyncpg
depende_de:
- database # asyncpg pool (market_data schema)
dependencias_externas:
- Polygon.io # polygon_client.py
- Binance API # binance_client.py
- MetaAPI # metaapi_client.py (NOT FUNCTIONAL)
notas: Market data aggregation, batch sync, WebSocket streaming
llm-agent:
nombre: LLM Agent (Python)
puerto: 3085
stack: FastAPI (planned)
depende_de:
- ml-engine # Model outputs for strategy analysis
- database # LLM schema tables
estado: NOT_DEPLOYED
notas: Planned Python service; currently llm logic lives in backend module
trading-agents:
nombre: Trading Agents (Python)
puerto: 3086
stack: FastAPI (planned)
depende_de:
- ml-engine # Signal generation
- data-service # Market data
- database # Trading schema tables
estado: NOT_DEPLOYED
notas: Planned autonomous trading agents; referenced by backend shared/clients
# ── MCP Services ─────────────────────────────────────────────────────
mcp-auth:
nombre: MCP Auth Service
puerto: 3095
stack: TypeScript + MCP SDK + pg Pool
depende_de:
- database # pg Pool (auth schema - users, sessions, roles, RBAC)
notas: RBAC, teams, authentication MCP tools
mcp-wallet:
nombre: MCP Wallet Service
puerto: 3090
stack: TypeScript + MCP SDK + pg Pool
depende_de:
- database # pg Pool (financial schema - wallets, transactions)
notas: Wallet operations, balance management, transaction history
mcp-products:
nombre: MCP Products Service
puerto: 3091
stack: TypeScript + MCP SDK + pg Pool
depende_de:
- database # pg Pool (financial schema - products, purchases)
dependencias_externas:
- Stripe # stripeConfig in config.ts
notas: Product catalog, purchases, Stripe integration
mcp-vip:
nombre: MCP VIP Service
puerto: 3092
stack: TypeScript + MCP SDK + pg Pool
depende_de:
- database # pg Pool (financial schema - vip_tiers, subscriptions)
dependencias_externas:
- Stripe # stripe product/price IDs in types
notas: VIP tier management, subscription status
mcp-investment:
nombre: MCP Investment Service
puerto: 3093
stack: TypeScript + MCP SDK + pg Pool
depende_de:
- database # pg Pool (investment schema)
notas: Investment accounts, products, transactions, distributions
mcp-predictions:
nombre: MCP Predictions Service
puerto: 3094
stack: TypeScript + MCP SDK + pg Pool
depende_de:
- database # pg Pool (ml schema - predictions, packages)
- mcp-wallet # HTTP fetch to port 3090 (wallet debit for purchases)
- mcp-vip # HTTP fetch to port 3092 (VIP subscription check)
notas: Prediction packages, purchase flow, signal delivery
mcp-binance-connector:
nombre: MCP Binance Connector
ubicacion: apps/mcp-binance-connector
stack: TypeScript + MCP SDK + CCXT
depende_de: []
dependencias_externas:
- Binance API # CCXT library
notas: Exposes Binance trading tools for AI agents; no database access
mcp-mt4-connector:
nombre: MCP MT4 Connector
ubicacion: apps/mcp-mt4-connector
stack: TypeScript + MCP SDK + Axios
depende_de: []
dependencias_externas: []
notas: HTTP wrapper for mt4-gateway; no direct MetaAPI or DB access
# ─────────────────────────────────────────────────────────────────────────────
# BACKEND MODULES (inter-module dependencies within apps/backend/src/modules/)
# ─────────────────────────────────────────────────────────────────────────────
backend_modules:
# Cada modulo lista sus dependencias internas (otros modulos) y externas
# Todos los modulos dependen implicitamente de: shared/database, shared/utils/logger, core/guards
auth:
ruta: apps/backend/src/modules/auth/
schemas_db: [auth]
dependencias_modulos: []
dependencias_shared: [database, redis, config, utils/logger]
dependencias_core: [middleware/rate-limiter, middleware/auth]
dependencias_externas: [OAuth Providers, Twilio]
servicios: [auth, email, phone, token, twofa, oauth]
notas: Foundation module; no cross-module imports
users:
ruta: apps/backend/src/modules/users/
schemas_db: [auth]
dependencias_modulos: []
dependencias_shared: [database, utils/logger]
dependencias_core: [guards/auth.guard]
notas: User profile management; independent of other modules
trading:
ruta: apps/backend/src/modules/trading/
schemas_db: [trading, market_data]
dependencias_modulos:
- notifications # alerts.service imports notificationService
dependencias_shared: [database, utils/logger]
dependencias_core: [guards/auth.guard]
servicios: [market, order, alerts, bots, watchlist, paper-trading, drawing, export]
notas: Core trading operations; provides market.service consumed by portfolio + llm
portfolio:
ruta: apps/backend/src/modules/portfolio/
schemas_db: [portfolio]
dependencias_modulos:
- trading # portfolio.service imports marketService from trading
dependencias_shared: [database, utils/logger]
dependencias_core: [websocket/websocket.server]
servicios: [portfolio]
repositorios: [portfolio, goal, snapshot]
notas: WebSocket for real-time portfolio updates
education:
ruta: apps/backend/src/modules/education/
schemas_db: [education]
dependencias_modulos: []
dependencias_shared: [database, utils/logger, services/storage, services/video-processing]
dependencias_core: [guards/auth.guard]
servicios: [course, enrollment, quiz, video, reviews, tag, instructor, gamification]
notas: Self-contained; enrollment.service consumed by payments module
payments:
ruta: apps/backend/src/modules/payments/
schemas_db: [financial]
dependencias_modulos:
- education # payments.controller imports enrollmentService
dependencias_shared: [database, utils/logger, config]
dependencias_core: [guards/auth.guard]
dependencias_externas: [Stripe]
servicios: [stripe, wallet, refund, subscription]
notas: Payment processing; depends on education for course enrollment after purchase
ml:
ruta: apps/backend/src/modules/ml/
schemas_db: [ml]
dependencias_modulos: []
dependencias_shared: [database, utils/logger]
dependencias_core: [websocket/websocket.server]
servicios: [ml-data, ml-model-registry, ml-integration, ml-backtest, ml-signal-stream, prediction-overlay]
notas: ML signal streaming via WebSocket; ml-integration.service consumed by llm module
llm:
ruta: apps/backend/src/modules/llm/
schemas_db: [llm]
dependencias_modulos:
- ml # llm.service imports mlIntegrationService
- trading # llm.service imports marketService
dependencias_shared: []
dependencias_externas: [Anthropic (Claude)]
servicios: [llm]
notas: Strategy analysis using LLM + ML signals + market data
admin:
ruta: apps/backend/src/modules/admin/
schemas_db: []
dependencias_modulos: []
dependencias_shared: [database, redis, clients/ml-engine, clients/trading-agents]
notas: Admin dashboard; communicates with Python services via HTTP clients
market-data:
ruta: apps/backend/src/modules/market-data/
schemas_db: [market_data]
dependencias_modulos: []
dependencias_shared: [database, redis, utils/logger]
servicios: [marketData]
notas: Market data queries and caching
audit:
ruta: apps/backend/src/modules/audit/
schemas_db: [audit]
dependencias_modulos: []
dependencias_shared: [database, utils/logger]
dependencias_core: [guards/auth.guard]
servicios: [audit]
notas: Audit logging; standalone module
notifications:
ruta: apps/backend/src/modules/notifications/
schemas_db: [auth]
dependencias_modulos: []
dependencias_shared: [database, utils/logger, config, clients/firebase]
dependencias_core: [websocket/websocket.server]
dependencias_externas: [Firebase]
servicios: [notification]
notas: Push + in-app notifications; consumed by trading.alerts and investment.distribution
investment:
ruta: apps/backend/src/modules/investment/
schemas_db: [investment]
dependencias_modulos:
- notifications # distribution.job imports notificationService
dependencias_shared: [database, utils/logger]
dependencias_core: [guards/auth.guard]
servicios: [account, product, transaction]
repositorios: [account, product, transaction, distribution, withdrawal]
jobs: [distribution]
notas: Investment accounts with scheduled distribution jobs
agents:
ruta: apps/backend/src/modules/agents/
schemas_db: []
dependencias_modulos: []
dependencias_shared: [utils/logger, clients]
servicios: [agents]
notas: Orchestrates Python trading agents via shared HTTP clients
currency:
ruta: apps/backend/src/modules/currency/
schemas_db: [market_data]
dependencias_modulos: []
dependencias_shared: [database, redis, utils/logger]
servicios: [currency]
notas: Currency conversion and exchange rate management
risk:
ruta: apps/backend/src/modules/risk/
schemas_db: [trading]
dependencias_modulos: []
dependencias_shared: [database]
dependencias_core: [guards/auth.guard]
repositorios: [risk]
notas: Risk assessment and portfolio risk analysis
proxy:
ruta: apps/backend/src/modules/proxy/
schemas_db: []
dependencias_modulos: []
dependencias_shared: [config]
dependencias_core: [middleware/auth]
servicios: [proxy]
notas: API proxy for external service forwarding
feature-flags:
ruta: apps/backend/src/modules/feature-flags/
schemas_db: [feature_flags]
dependencias_modulos: []
dependencias_shared: [database, utils/logger]
dependencias_core: [middleware/auth]
servicios: [feature-flags]
notas: Feature flag management; admin-only routes
# ─────────────────────────────────────────────────────────────────────────────
# OQI -> SCHEMA MAPPING (Epics to database schemas)
# ─────────────────────────────────────────────────────────────────────────────
oqi_to_schema:
OQI-001:
nombre: fundamentos-auth
progreso: 85%
schemas:
- schema: auth
tablas: 12
- schema: audit
tablas: 7
- schema: feature_flags
tablas: 3
total_tablas: 22
modulos_backend: [auth, users, audit, feature-flags]
modulos_mcp: [mcp-auth]
OQI-002:
nombre: educativo
progreso: 55%
schemas:
- schema: education
tablas: 19
total_tablas: 19
modulos_backend: [education]
modulos_mcp: []
OQI-003:
nombre: trading-charts
progreso: 60%
schemas:
- schema: trading
tablas: 13
- schema: market_data
tablas: 4
total_tablas: 17
modulos_backend: [trading, market-data, currency, risk]
modulos_mcp: [mcp-binance-connector, mcp-mt4-connector]
servicios_python: [data-service]
OQI-004:
nombre: cuentas-inversion
progreso: 55%
schemas:
- schema: investment
tablas: 10
total_tablas: 10
modulos_backend: [investment]
modulos_mcp: [mcp-investment]
OQI-005:
nombre: pagos-stripe
progreso: 65%
schemas:
- schema: financial
tablas: 11
total_tablas: 11
modulos_backend: [payments]
modulos_mcp: [mcp-wallet, mcp-products, mcp-vip]
OQI-006:
nombre: senales-ml
progreso: 75%
schemas:
- schema: ml
tablas: 12
total_tablas: 12
modulos_backend: [ml, agents]
modulos_mcp: [mcp-predictions]
servicios_python: [ml-engine, trading-agents]
OQI-007:
nombre: llm-strategy-agent
progreso: 45%
schemas:
- schema: llm
tablas: 5
total_tablas: 5
modulos_backend: [llm]
modulos_mcp: []
servicios_python: [llm-agent]
OQI-008:
nombre: portfolio-manager
progreso: 45%
schemas:
- schema: portfolio
tablas: 5
total_tablas: 5
modulos_backend: [portfolio]
modulos_mcp: []
OQI-009:
nombre: mt4-gateway
progreso: 15%
estado: NOT_FUNCTIONAL
schemas: []
total_tablas: 0
modulos_backend: []
modulos_mcp: [mcp-mt4-connector]
notas: MetaAPI integration not functional; demo account only
# ─────────────────────────────────────────────────────────────────────────────
# CROSS-MODULE DEPENDENCY GRAPH (visual summary)
# ─────────────────────────────────────────────────────────────────────────────
#
# llm ──> ml ──> (websocket)
# │
# └──> trading ──> notifications ──> (websocket, firebase)
# │
# portfolio ─┘
#
# payments ──> education
#
# investment ──> notifications
#
# admin ──> (mlEngineClient, tradingAgentsClient)
# agents ──> (shared/clients → ml-engine, trading-agents, llm-agent)
#
# Standalone: auth, users, market-data, audit, currency, risk, proxy, feature-flags
#
# ─────────────────────────────────────────────────────────────────────────────
# SERVICE COMMUNICATION GRAPH
# ─────────────────────────────────────────────────────────────────────────────
#
# frontend ──HTTP──> backend ──HTTP──> ml-engine ──HTTP──> data-service ──HTTP──> Polygon.io
# │ │ └──> Binance API
# │ ├──HTTP──> trading-agents (NOT DEPLOYED)
# │ └──HTTP──> llm-agent (NOT DEPLOYED)
# │
# └──WS──> backend:3082
#
# mcp-predictions ──HTTP──> mcp-wallet (debit)
# └──HTTP──> mcp-vip (subscription check)
#
# mcp-binance-connector ──CCXT──> Binance API
# mcp-mt4-connector ──HTTP──> mt4-gateway (NOT FUNCTIONAL)
#
# [All DB-connected services] ──pg/asyncpg──> PostgreSQL (trading_platform)
#
# ─────────────────────────────────────────────────────────────────────────────
# ─────────────────────────────────────────────────────────────────────────────
# PORT REGISTRY
# ─────────────────────────────────────────────────────────────────────────────
ports:
3080: frontend
3081: backend
3082: backend-websocket
3083: ml-engine
3084: data-service
3085: llm-agent
3086: trading-agents
3090: mcp-wallet
3091: mcp-products
3092: mcp-vip
3093: mcp-investment
3094: mcp-predictions
3095: mcp-auth
5432: postgresql
6379: redis