Replies (2)

I use cryptocompare.com api. No reason other than when I was starting to build it I could get that one to work but not the others. Also, your question just made me realize mine is not open source (I thought I had it open, but see it's set to private). I'll make it public when I get a chance. The price code looks like this though: // Fetch price data $.ajax({ url: `https://min-api.cryptocompare.com/data/price?fsym=${altcoinSelected}&tsyms=${fiatSelected},BTC`, method: "GET", dataType: "json", success: function(data) { if (data.Response === "Error") { $("#coinPrice").text("Error: Invalid symbol or API unavailable"); console.error("API Error:", data.Message); return; } currentPrice = parseFloat(data[fiatSelected]) || 0; altcoinToBtcPrice = parseFloat(data["BTC"]) || (altcoinSelected === "BTC" ? 1 : 0); $("#coinPrice").text(currentPrice.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })); coinConvert(); // Recalculate on update }, error: function(xhr, status, error) { $("#coinPrice").text("Error: Unable to fetch prices - check connection or API"); console.error("AJAX Error:", status, error, xhr.responseText); } }); }
โ†‘