AI-Powered Volatility Clustering & Prediction Model

AI-Powered Volatility Clustering & Prediction Model

Analyze historical price data to identify volatility regimes and predict future trends.

Historical Market Data

Paste comma or newline-separated daily prices.

No Analysis Performed

Your analysis and predictions will appear here.

Key Observations:

    '; // Insight 1: Dominant Regime const dominantCluster = Object.keys(counts).reduce((a, b) => counts[a] > counts[b] ? a : b); const dominantLabel = labels[sortedCentroids.indexOf(centroids[dominantCluster])]; const dominantPercentage = ((counts[dominantCluster] / totalPeriods) * 100).toFixed(1); insightsHTML += `
  • The market was in a ${dominantLabel} Volatility regime for approximately ${dominantPercentage}% of the observed period.
  • `; // Insight 2: Recent Trend const recentAssignments = assignments.slice(-5); const recentCluster = recentAssignments[recentAssignments.length - 1]; const recentLabel = labels[sortedCentroids.indexOf(centroids[recentCluster])]; if (recentAssignments.every(a => a === recentCluster)) { insightsHTML += `
  • The market has stabilized into a ${recentLabel} Volatility state over the last 5 periods, reinforcing the prediction.
  • `; } else { insightsHTML += `
  • Recent periods show a transition, with the most recent state being ${recentLabel} Volatility. This suggests potential instability.
  • `; } insightsHTML += '
'; aiInsightsEl.innerHTML = insightsHTML; } /** * Generates PDF report. */ function exportToPDF() { if (!analysisResults.prices) { alert("Please run an analysis first."); return; } const { jsPDF } = window.jspdf; const doc = new jsPDF(); // Header doc.setFontSize(18); doc.setTextColor(40); doc.text("Volatility Clustering & Prediction Report", 14, 22); // Chart Image const chartImage = volatilityChart.toBase64Image(); doc.addImage(chartImage, 'PNG', 14, 30, 180, 90); // Prediction doc.setFontSize(14); doc.text("Volatility Forecast", 14, 130); doc.setFontSize(12); doc.text(`Predicted Next Period Volatility: ${analysisResults.predictionLabel}`, 14, 138); // AI Insights const insightsText = aiInsightsEl.innerText; doc.setFontSize(14); doc.text("AI-Powered Insights", 14, 150); doc.setFontSize(10); doc.text(insightsText, 14, 158, { maxWidth: 180 }); doc.save('Volatility-Analysis-Report.pdf'); } // --- Helper Functions --- function getClusterNames(k) { if (k === 2) return ['Low', 'High']; if (k === 3) return ['Low', 'Medium', 'High']; if (k === 4) return ['Low', 'Medium-Low', 'Medium-High', 'High']; return Array.from({length: k}, (_, i) => `Cluster ${i}`); } function formatCurrency(value) { return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(value); } });
Scroll to Top