ht High-Frequency Trading Strategy Simulator

High-Frequency Trading Strategy Simulator

Test automated trading strategies against simulated real-time market data.

Configure Simulation

Trading Strategy

Market Conditions

Live Simulation

Simulation Complete

The simulation has ended. You can now download the full trade report.

Strategy: ${simulation.config.strategy} | Date: ${new Date().toLocaleDateString()}

NET P/L
$${pnl.toFixed(2)}
WIN RATE
${winRate.toFixed(1)}%
TOTAL TRADES
${totalTrades}
AVG P/L PER TRADE
$${(pnl / totalTrades || 0).toFixed(2)}
Trade Log
${tableRows}
TimestampTypeSharesPriceP/L
`; const pdfTemplate = document.getElementById('pdf-template'); pdfTemplate.innerHTML = reportHtml; pdfTemplate.classList.remove('invisible'); try { const { jsPDF } = window.jspdf; const canvas = await html2canvas(pdfTemplate.querySelector('.pdf-page'), { scale: 2 }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(), pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight); pdf.save('HFT_Simulation_Report.pdf'); } catch (e) { console.error('PDF Generation Error:', e); } finally { downloadPdfBtn.disabled = false; downloadPdfBtn.textContent = 'Download Trade Report'; pdfTemplate.classList.add('invisible'); pdfTemplate.innerHTML = ''; } } // --- EVENT LISTENERS --- startBtn.addEventListener('click', startSimulation); stopBtn.addEventListener('click', stopSimulation); downloadPdfBtn.addEventListener('click', generatePdfReport); // --- INITIALIZATION --- switchTab(0); });
Scroll to Top