Crypto Arbitrage Opportunity Illustrator

Crypto Arbitrage Opportunity Illustrator

This tool is for educational purposes to illustrate arbitrage calculation with manually entered data. It does NOT fetch live market prices or guarantee any profits.

Input Data

Exchange 1
$
$
Exchange 2
$
$
Trade & Fee Details
%
$

Net Profit/Loss: ${formatCurrencyCAO(netProfit2to1)}

${netProfit2to1 > 0 ? '

Potential arbitrage opportunity!

' : '

No arbitrage opportunity on this path after fees.

'} `; } const overallConclusionEl = document.getElementById('overallConclusionCAO'); if (overallConclusionEl) { if (netProfit1to2 > 0 && netProfit1to2 > netProfit2to1) { overallConclusionEl.textContent = `Path 1 (Buy ${ex1Name} -> Sell ${ex2Name}) shows the best potential profit.`; overallConclusionEl.className = 'profit'; } else if (netProfit2to1 > 0 && netProfit2to1 > netProfit1to2) { overallConclusionEl.textContent = `Path 2 (Buy ${ex2Name} -> Sell ${ex1Name}) shows the best potential profit.`; overallConclusionEl.className = 'profit'; } else if (netProfit1to2 > 0 || netProfit2to1 > 0) { // One is positive but not necessarily better than other (if equal) overallConclusionEl.textContent = "A potential arbitrage opportunity exists based on inputs."; overallConclusionEl.className = 'profit'; } else { overallConclusionEl.textContent = "No profitable arbitrage opportunity identified with the given inputs and fees."; overallConclusionEl.className = 'loss'; } } if(resultsSection) resultsSection.style.display = 'block'; if(downloadBtn) downloadBtn.style.display = 'block'; // Store data for PDF caoPdfData = { inputs: { cryptoSymbol, ex1Name, ex1BuyPrice, ex1SellPrice, ex2Name, ex2BuyPrice, ex2SellPrice, quantity, tradingFeePercent: tradingFeePercent*100, transferFee }, path1: { grossProfit: grossProfit1to2, totalTradingFees: buyingFee1 + sellingFee2, netProfit: netProfit1to2, profitable: netProfit1to2 > 0 }, path2: { grossProfit: grossProfit2to1, totalTradingFees: buyingFee2 + sellingFee1, netProfit: netProfit2to1, profitable: netProfit2to1 > 0 } }; } function generatePdfCAO() { if (typeof jsPDF === 'undefined' || typeof jsPDF.API === 'undefined' || typeof jsPDF.API.autoTable === 'undefined') { alert("PDF generation library is not loaded. Please ensure internet connection."); return; } if (Object.keys(caoPdfData).length === 0 || !document.getElementById('caoResultsSection').style.display || document.getElementById('caoResultsSection').style.display === 'none') { alert("Please calculate arbitrage potential first."); return; } const doc = new jsPDF(); const today = new Date(); const dateStr = `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, '0')}-${today.getDate().toString().padStart(2, '0')}`; let currentY = 15; const pageMargin = 14; const contentWidth = doc.internal.pageSize.getWidth() - (2 * pageMargin); doc.setFontSize(16); doc.text("Crypto Arbitrage Opportunity Illustration", pageMargin, currentY, {align: 'center', maxWidth: contentWidth}); currentY += 8; doc.setFontSize(10); doc.text(`Report Date: ${dateStr}`, pageMargin, currentY); currentY += 6; doc.text(`Cryptocurrency: ${caoPdfData.inputs.cryptoSymbol}`, pageMargin, currentY); currentY += 10; doc.setFontSize(12); doc.text("Input Parameters:", pageMargin, currentY); currentY += 6; doc.setFontSize(10); const { inputs, path1, path2 } = caoPdfData; doc.text(`${inputs.ex1Name} - Buy Price: ${formatCurrencyCAO(inputs.ex1BuyPrice)}, Sell Price: ${formatCurrencyCAO(inputs.ex1SellPrice)}`, pageMargin + 2, currentY); currentY += 5; doc.text(`${inputs.ex2Name} - Buy Price: ${formatCurrencyCAO(inputs.ex2BuyPrice)}, Sell Price: ${formatCurrencyCAO(inputs.ex2SellPrice)}`, pageMargin + 2, currentY); currentY += 5; doc.text(`Quantity to Trade: ${formatCryptoCAO(inputs.quantity, 4)} ${inputs.cryptoSymbol}`, pageMargin + 2, currentY); currentY += 5; doc.text(`Trading Fee per Exchange: ${inputs.tradingFeePercent.toFixed(2)}%`, pageMargin + 2, currentY); currentY += 5; doc.text(`Fixed Withdrawal/Transfer Fee: ${formatCurrencyCAO(inputs.transferFee)}`, pageMargin + 2, currentY); currentY += 10; // Path 1 Results doc.setFontSize(12); doc.text(`Path 1: Buy on ${inputs.ex1Name}, Sell on ${inputs.ex2Name}`, pageMargin, currentY); currentY += 6; doc.setFontSize(10); doc.text(`Gross Profit (before fees): ${formatCurrencyCAO(path1.grossProfit)}`, pageMargin + 2, currentY); currentY += 5; doc.text(`Estimated Total Trading Fees: ${formatCurrencyCAO(path1.totalTradingFees)}`, pageMargin + 2, currentY); currentY += 5; doc.setFont(undefined, 'bold'); doc.text(`Net Profit/Loss: ${formatCurrencyCAO(path1.netProfit)}`, pageMargin + 2, currentY); currentY += 5; doc.setFont(undefined, 'normal'); doc.text(path1.profitable ? "Potential arbitrage opportunity on this path." : "No arbitrage opportunity on this path after fees.", pageMargin + 2, currentY); currentY += 8; if (currentY > doc.internal.pageSize.getHeight() - 50) { doc.addPage(); currentY = 15; } // Path 2 Results doc.setFontSize(12); doc.text(`Path 2: Buy on ${inputs.ex2Name}, Sell on ${inputs.ex1Name}`, pageMargin, currentY); currentY += 6; doc.setFontSize(10); doc.text(`Gross Profit (before fees): ${formatCurrencyCAO(path2.grossProfit)}`, pageMargin + 2, currentY); currentY += 5; doc.text(`Estimated Total Trading Fees: ${formatCurrencyCAO(path2.totalTradingFees)}`, pageMargin + 2, currentY); currentY += 5; doc.setFont(undefined, 'bold'); doc.text(`Net Profit/Loss: ${formatCurrencyCAO(path2.netProfit)}`, pageMargin + 2, currentY); currentY += 5; doc.setFont(undefined, 'normal'); doc.text(path2.profitable ? "Potential arbitrage opportunity on this path." : "No arbitrage opportunity on this path after fees.", pageMargin + 2, currentY); currentY += 10; if (currentY > doc.internal.pageSize.getHeight() - 20) { doc.addPage(); currentY = 15; } doc.setFontSize(10); doc.setFont(undefined, 'bold'); const overallConclusionEl = document.getElementById('overallConclusionCAO'); if(overallConclusionEl) doc.text(`Overall: ${overallConclusionEl.textContent}`, pageMargin, currentY); doc.save(`Crypto_Arbitrage_Illustration_${inputs.cryptoSymbol}_${dateStr}.pdf`); }
Scroll to Top