Smart Money Flow Tracker

Smart Money Flow Tracker

Analyze institutional order flow for bullish or bearish signals.

Notable Bullish Flow

Notable Bearish Flow

Export Smart Money Insights Report

Generate a professional PDF of the institutional flow analysis for your records.

Bearish Flow

$${(bearishFlow/1_000_000).toFixed(1)}M

Net Flow Sentiment

${sentimentScore.toFixed(1)}% Bullish

`; const ctx = document.getElementById('sentiment-chart').getContext('2d'); if (sentimentChart) sentimentChart.destroy(); sentimentChart = new Chart(ctx, { type: 'bar', data: { labels: ['Bullish Flow', 'Bearish Flow'], datasets: [{ label: 'Value ($)', data: [bullishFlow, bearishFlow], backgroundColor: ['#22c55e', '#ef4444'] }] }, options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { display: false } }, scales: { y: { ticks: { callback: v => `$${(v/1_000_000)}M` } } } } }); } function renderDetails() { document.getElementById('details-title').textContent = `Detailed Flow for ${currentTicker}`; ['bullish', 'bearish'].forEach(sentiment => { const container = document.getElementById(`${sentiment}-flow-container`); const trades = analysisResults[`${sentiment}Trades`]; if(trades.length === 0) { container.innerHTML = `

No ${sentiment} flow detected.

`; return; } container.innerHTML = trades.map(t => `
${t.type} $${(t.value/1_000_000).toFixed(2)}M

${t.desc}

`).join(''); }); } // --- PDF GENERATION --- async function generatePdfReport() { downloadPdfBtn.disabled = true; downloadPdfBtn.textContent = 'Generating...'; const renderTableRows = (trades) => trades.map(t => `${t.type}${t.desc}$${t.value.toLocaleString()}`).join('') || `No activity recorded.`; const reportHtml = `

Smart Money Insights Report

TICKER: ${currentTicker} | DATE: ${new Date().toLocaleDateString()}

BULLISH FLOW
$${(analysisResults.bullishFlow/1_000_000).toFixed(1)}M
BEARISH FLOW
$${(analysisResults.bearishFlow/1_000_000).toFixed(1)}M
SENTIMENT
${analysisResults.sentimentScore.toFixed(1)}%
Institutional Flow Breakdown
Notable Bullish Transactions
${renderTableRows(analysisResults.bullishTrades)}
TypeDescriptionValue
Notable Bearish Transactions
${renderTableRows(analysisResults.bearishTrades)}
TypeDescriptionValue
`; const pdfTemplate = document.getElementById('pdf-template'); pdfTemplate.innerHTML = reportHtml; pdfTemplate.classList.remove('invisible'); new Chart(document.getElementById('pdf-sentiment-chart'), { type: 'bar', data: sentimentChart.data, options: { ...sentimentChart.options, animation: { duration: 0 }, maintainAspectRatio: false } }); setTimeout(async () => { 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(`Smart_Money_Report_${currentTicker}.pdf`); } catch (e) { console.error('PDF Generation Error:', e); } finally { downloadPdfBtn.disabled = false; downloadPdfBtn.textContent = 'Download PDF Report'; pdfTemplate.classList.add('invisible'); pdfTemplate.innerHTML = ''; } }, 500); } // --- EVENT LISTENERS --- analyzeBtn.addEventListener('click', () => { const ticker = tickerInput.value.trim().toUpperCase(); if (ticker) { currentTicker = ticker; analyzeData(); switchTab(0); } }); downloadPdfBtn.addEventListener('click', generatePdfReport); // --- INITIALIZATION --- analyzeData(); switchTab(0); });
Scroll to Top