Skip to content

Commit 3950bae

Browse files
authored
Update jp.htm
1 parent 95184f4 commit 3950bae

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

jp.htm

+18-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,10 @@
158158
}
159159

160160
// table body => sell
161-
JPYtoHKD = 0.05
161+
// JPYtoHKD = 0.05
162+
JPYtoHKD = getJPYtoHKDrate();
163+
164+
162165
for (var i = 0; i <= maxRow; i++) {
163166
consideration = curSellPrice * qty;
164167
otherFee = getOtherFee(curSellPrice, qty, "sell");
@@ -371,6 +374,20 @@
371374
}
372375

373376

377+
378+
function getJPYtoHKDrate() {
379+
const apiUrl = `https://open.er-api.com/v6/latest/JPY`; // Example API endpoint
380+
381+
const response = await fetch(apiUrl);
382+
const data = await response.json();
383+
384+
// Extract the JPY to HKD rate
385+
const rate = data.rates.HKD;
386+
return rate.toFixed(4);
387+
}
388+
389+
390+
374391
</script>
375392

376393

0 commit comments

Comments
 (0)