trading-platform/orchestration/tareas/_archive/2026-01/TASK-2026-01-26-OQI-006-ML-UTILITY-PANELS/06-DOCUMENTACION.md
Adrian Flores Cortes df43dd90cb [F0-F2] feat: Coherence analysis baseline + entity types + frontend stores
FASE 0 - Preparación y Purga:
- Archived 21 completed tasks to _archive/2026-01/
- Marked 4 docs as DEPRECATED
- Created 3 baseline coherence reports

FASE 1 - DDL-Backend Coherence:
- audit.types.ts: +4 types (SystemEvent, TradingAudit, ApiRequestLog, DataAccessLog)
- investment.types.ts: +4 types (RiskQuestionnaire, WithdrawalRequest, DailyPerformance, DistributionHistory)
- entity.types.ts: +5 types (Symbol, TradingBot, TradingSignal, TradingMetrics, PaperBalance)

FASE 2 - Backend-Frontend Coherence:
- investmentStore.ts: New Zustand store with 20+ actions
- mlStore.ts: New Zustand store with signal caching
- alerts.service.ts: New service with 15 functions

FASE 3 - Documentation:
- OQI-009: Updated to 100% coverage, added ET-MKT-004-productos.md
- OQI-010: Created full structure (STATUS.md, ROADMAP-MT4.md, ET-MT4-001-gateway.md)

Coherence Baseline Established:
- DDL-Backend: 31% (target 95%)
- Backend-Frontend: 72% (target 85%)
- Global: 39.6% (target 90%)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 22:08:04 -06:00

4.1 KiB

06-DOCUMENTACION.md - OQI-006 ML Utility Panels

Documentación Técnica

Componentes Creados

Componente LOC Tipos Descripción
ModelSelector 280 2 Selector de modelos ML
EnsemblePanel 320 3 Config ensemble
ICTAnalysisPanel 350 2 Params ICT
Total 950 7

API de Componentes

ModelSelector

interface MLModel {
  id: string;
  name: string;
  type: 'lstm' | 'xgboost' | 'random_forest' | 'svm' | 'ensemble' | 'transformer';
  accuracy: number;
  lastUpdated: string;
  status: 'active' | 'training' | 'inactive' | 'deprecated';
  description?: string;
  features?: string[];
}

interface ModelSelectorProps {
  models: MLModel[];
  selectedModelId: string;
  onModelChange: (modelId: string) => void;
  variant?: 'dropdown' | 'tabs' | 'cards';
  showMetrics?: boolean;
  disabled?: boolean;
  loading?: boolean;
}

// Uso
<ModelSelector
  models={availableModels}
  selectedModelId="xgboost-v2"
  onModelChange={handleModelChange}
  variant="dropdown"
  showMetrics={true}
/>

EnsemblePanel

interface ModelWeight {
  modelId: string;
  modelName: string;
  weight: number;
  accuracy: number;
  locked?: boolean;
}

interface EnsembleConfig {
  votingMethod: 'weighted' | 'majority' | 'unanimous';
  minimumAgreement: number;
  confidenceThreshold: number;
  weights: ModelWeight[];
}

interface EnsemblePanelProps {
  config: EnsembleConfig;
  onConfigChange: (config: EnsembleConfig) => void;
  onSave?: () => void;
  onReset?: () => void;
  isLoading?: boolean;
  readOnly?: boolean;
}

// Uso
<EnsemblePanel
  config={ensembleConfig}
  onConfigChange={setEnsembleConfig}
  onSave={handleSave}
  onReset={handleReset}
/>

ICTAnalysisPanel

interface ICTParams {
  timeframe: '1m' | '5m' | '15m' | '1h' | '4h' | '1d';
  htfBias: '15m' | '1h' | '4h' | '1d' | '1w';
  orderBlocks: {
    enabled: boolean;
    lookback: number;
    minImbalance: number;
    showMitigated: boolean;
  };
  fvg: {
    enabled: boolean;
    minSize: number;
    showFilled: boolean;
    filterByTrend: boolean;
  };
  marketStructure: {
    enabled: boolean;
    swingLookback: number;
    showBOS: boolean;
    showCHOCH: boolean;
  };
  liquidity: {
    enabled: boolean;
    showBSL: boolean;
    showSSL: boolean;
    equalHighsLows: boolean;
  };
  sessions: {
    showAsian: boolean;
    showLondon: boolean;
    showNewYork: boolean;
    highlightKillzones: boolean;
  };
}

interface ICTAnalysisPanelProps {
  params: ICTParams;
  onParamsChange: (params: ICTParams) => void;
  onSave?: () => void;
  onReset?: () => void;
  isLoading?: boolean;
  readOnly?: boolean;
}

// Uso
<ICTAnalysisPanel
  params={ictParams}
  onParamsChange={setIctParams}
  onSave={handleSave}
/>

Integración con Store

Ejemplo de uso con mlStore

// stores/mlStore.ts
interface MLState {
  selectedModelId: string;
  ensembleConfig: EnsembleConfig;
  ictParams: ICTParams;
  setSelectedModel: (id: string) => void;
  setEnsembleConfig: (config: EnsembleConfig) => void;
  setIctParams: (params: ICTParams) => void;
}

// pages/MLSettings.tsx
import { ModelSelector, EnsemblePanel, ICTAnalysisPanel } from '@/modules/ml/components';
import { useMLStore } from '@/stores/mlStore';

export const MLSettings = () => {
  const {
    selectedModelId,
    ensembleConfig,
    ictParams,
    setSelectedModel,
    setEnsembleConfig,
    setIctParams,
  } = useMLStore();

  return (
    <div className="space-y-6">
      <ModelSelector
        models={models}
        selectedModelId={selectedModelId}
        onModelChange={setSelectedModel}
        variant="cards"
      />

      <EnsemblePanel
        config={ensembleConfig}
        onConfigChange={setEnsembleConfig}
      />

      <ICTAnalysisPanel
        params={ictParams}
        onParamsChange={setIctParams}
      />
    </div>
  );
};

Próximos Pasos

  1. Integración con mlStore - Conectar componentes con estado global
  2. Persistencia - Guardar configuración en backend
  3. WebSocket - Actualizar modelos en tiempo real
  4. Tests - Agregar unit tests con jest/vitest