bug fix: Bitcoin price in INR incorrect
This commit is contained in:
parent
335ade586e
commit
67c1c21933
17
index.html
17
index.html
@ -768,6 +768,7 @@
|
||||
bond.querySelector('.amount-invested').textContent = formatAmount(amountInvested[preferredCurrency], preferredCurrency)
|
||||
bond.querySelector('.net-value').textContent = formatAmount(netValue[preferredCurrency], preferredCurrency)
|
||||
})
|
||||
renderRates()
|
||||
})
|
||||
|
||||
|
||||
@ -995,6 +996,19 @@
|
||||
})
|
||||
})
|
||||
|
||||
function renderRates() {
|
||||
preferredCurrency = getRef('currency_selector').value;
|
||||
if (preferredCurrency === 'usd') {
|
||||
getRef("usd-rate").classList.add("hidden")
|
||||
getRef("btc-usd-rate").textContent = `BTC: ${formatAmount(BTC_current, 'usd')}`;
|
||||
|
||||
} else {
|
||||
getRef("usd-rate").classList.remove("hidden")
|
||||
getRef("usd-rate").textContent = `USD: ${formatAmount(USD_current)}`;
|
||||
getRef("btc-usd-rate").textContent = `BTC: ${formatAmount(BTC_current * USD_current)}`;
|
||||
}
|
||||
}
|
||||
|
||||
var USD_current, BTC_current;
|
||||
getRef('refresh_button').addEventListener("click", refreshData);
|
||||
function refreshData() {
|
||||
@ -1003,8 +1017,7 @@
|
||||
USD_current = rates.USD_INR;
|
||||
BTC_current = rates.BTC_USD;
|
||||
console.log(`USD rate: ${USD_current} INR\nBTC rate: ${BTC_current} USD`);
|
||||
getRef("usd-rate").textContent = `USD: ₹${rates.USD_INR.toFixed(2)}`;
|
||||
getRef("btc-usd-rate").textContent = `BTC: ${formatAmount(rates.BTC_USD)}`;
|
||||
renderRates()
|
||||
showPage('home_page')
|
||||
renderElem(getRef('bond_list'), html`<svg class="loader" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"> <polygon points="17.76 23.78 17.76 40.22 32 48.44 46.24 40.22 46.24 23.78 32 15.56 17.76 23.78" /> <polyline points="17.76 23.78 32 32 46.24 23.78" /> <line x1="32" y1="48.44" x2="32" y2="32" /> <polyline points="32 2 6.02 17 6.02 47" /> <polyline points="57.98 47 57.98 17 32 2" /> <polyline points="6.02 47 32 62 57.98 47" /> </svg>`)
|
||||
refreshBlockchainData().then(result => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user