Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Sample data - in production this would come from an API
+ const strategies = [
+ {
+ name: "Momentum Factor Strategy",
+ source: "Quantpedia",
+ sharpe: 1.8,
+ sortino: 2.1,
+ maxdd: -15.2,
+ cagr: 12.5,
+ description: "Momentum-based strategy focusing on trend following"
+ },
+ {
+ name: "Mean Reversion ETF",
+ source: "MQL5",
+ sharpe: 1.6,
+ sortino: 1.9,
+ maxdd: -12.8,
+ cagr: 10.2,
+ description: "Statistical arbitrage approach using ETFs"
+ }
+ ];
+
+ const strategiesGrid = document.querySelector('.strategies-grid');
+ const metricSelect = document.getElementById('metricSelect');
+ const timeframeSelect = document.getElementById('timeframeSelect');
+
+ function renderStrategies(sortMetric = 'sharpe') {
+ strategiesGrid.innerHTML = '';
+
+ const sortedStrategies = [...strategies].sort((a, b) => b[sortMetric] - a[sortMetric]);
+
+ sortedStrategies.forEach((strategy, index) => {
+ const card = document.createElement('div');
+ card.className = 'strategy-card';
+ card.innerHTML = `
+
${index + 1}. ${strategy.name}
+
Source: ${strategy.source}
+
Sharpe Ratio: ${strategy.sharpe.toFixed(2)}
+
Sortino Ratio: ${strategy.sortino.toFixed(2)}
+
Max Drawdown: ${strategy.maxdd.toFixed(1)}%
+
CAGR: ${strategy.cagr.toFixed(1)}%
+
${strategy.description}
+ `;
+ strategiesGrid.appendChild(card);
+ });
+ }
+
+ metricSelect.addEventListener('change', (e) => {
+ renderStrategies(e.target.value);
+ });
+
+ timeframeSelect.addEventListener('change', () => {
+ renderStrategies(metricSelect.value);
+ });
+
+ // Initial render
+ renderStrategies();
+ });