SatWorth/app/assets/script.html

21 lines
872 B
HTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<div class="bitcointodollars">
<h1>Bitcoin Price Tracker</h1>
<div id="bitcoin-price"></div>
</div>
<script>
// Fetch the Bitcoin price from the CoinGecko API
fetch('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd')
.then(response => response.json())
.then(data => {
const bitcoinPrice = data['bitcoin']['usd'];
const bitcoinPriceDivided = bitcoinPrice; // Divide the Bitcoin price by 100 million
// Update the Bitcoin price on the website
const bitcoinPriceElement = document.getElementById('bitcoin-price');
bitcoinPriceElement.textContent = `1 Bitcoin = $${bitcoinPriceDivided.toFixed(2)}`; // Display the Bitcoin price
})
.catch(error => console.error(error));
</script>