mirror of
https://github.com/aljazceru/satshkd-vercel.git
synced 2025-12-17 05:04:24 +01:00
Merge pull request #1 from aljazceru/claude/convert-currency-hkd-euro-011CUx3QzK9AAL7hCdWv8qfz
Claude/convert currency hkd euro 011 c ux3 qz k9 aal7h cd wv8qfz
This commit is contained in:
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@@ -1,14 +1,14 @@
|
||||
# This is a basic workflow to help you get started with Actions
|
||||
# Daily job at 04:05 GMT
|
||||
|
||||
name: Simple update btc rates
|
||||
name: Update EUR BTC rates
|
||||
on:
|
||||
schedule:
|
||||
- cron: '5 4 * * *'
|
||||
|
||||
jobs:
|
||||
run:
|
||||
name: update hkdhistorical
|
||||
name: update eurhistorical
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: setup actions
|
||||
|
||||
16
btcpoll.js
16
btcpoll.js
@@ -4,11 +4,11 @@ const moment = require('moment');
|
||||
|
||||
const path = require('path');
|
||||
const dirPath = path.join(__dirname, ".");
|
||||
const fileToWrite = dirPath + "/public/hkd_historical"
|
||||
const fileToRead = dirPath + "/public/hkd_historical"
|
||||
const fileToWrite = dirPath + "/public/historical"
|
||||
const fileToRead = dirPath + "/public/historical"
|
||||
|
||||
|
||||
// get btc/usd and btc/hkd daily rate
|
||||
// get btc/usd and btc/eur daily rate
|
||||
async function BTCDaily() {
|
||||
let url = "https://api.coingecko.com/api/v3/coins/bitcoin/history?localization=false&date="
|
||||
|
||||
@@ -27,17 +27,17 @@ async function BTCDaily() {
|
||||
// console.log("full url: ", full_url)
|
||||
const data = await response.data;
|
||||
const btcusd = data['market_data']['current_price']['usd']
|
||||
const btchkd = data['market_data']['current_price']['hkd']
|
||||
const btceur = data['market_data']['current_price']['eur']
|
||||
const satsrate = 100000000
|
||||
const sathkd = parseInt(satsrate / btchkd)
|
||||
const sateur = parseInt(satsrate / btceur)
|
||||
const usdsat = parseInt(satsrate / btcusd)
|
||||
|
||||
row = {
|
||||
btcusd_rate: parseInt(btcusd),
|
||||
date: dbdate,
|
||||
usdsat_rate: usdsat,
|
||||
sathkd_rate: sathkd,
|
||||
btchkd_rate: parseFloat(btchkd).toFixed(2),
|
||||
sateur_rate: sateur,
|
||||
btceur_rate: parseFloat(btceur).toFixed(2),
|
||||
}
|
||||
console.log("row data: ", row)
|
||||
})
|
||||
@@ -66,7 +66,7 @@ module.exports = {
|
||||
|
||||
// start here
|
||||
main: async function () {
|
||||
console.log("starting btcpoll script for satshkd....")
|
||||
console.log("starting btcpoll script for sateur....")
|
||||
let result = updateFile();
|
||||
console.log(result)
|
||||
return true
|
||||
|
||||
14
calculate.js
14
calculate.js
@@ -3,7 +3,7 @@ const fs = require('fs');
|
||||
|
||||
module.exports = {
|
||||
bfx: async function() {
|
||||
const hkdrate = 0.1287 // approximate rate
|
||||
const eurrate = 0.92 // approximate EUR/USD rate
|
||||
const btcDataURL = "https://api-pub.bitfinex.com/v2/ticker/tBTCUSD"
|
||||
const response = await axios.get(btcDataURL)
|
||||
const data = response.data
|
||||
@@ -13,16 +13,16 @@ module.exports = {
|
||||
// see docs : https://docs.bitfinex.com/reference#rest-public-ticker
|
||||
btcLastPrice = data[6]
|
||||
|
||||
const sathkd = Math.round((1 / btcLastPrice) * satDenominator * hkdrate)
|
||||
//console.log("bitfinex last price: ", btcLastPrice, "current satHKD: ", sathkd)
|
||||
return sathkd
|
||||
const sateur = Math.round((1 / btcLastPrice) * satDenominator * eurrate)
|
||||
//console.log("bitfinex last price: ", btcLastPrice, "current satEUR: ", sateur)
|
||||
return sateur
|
||||
},
|
||||
|
||||
get10yr: async function() {
|
||||
// console.log("get10yr")
|
||||
try {
|
||||
// const content = await fs.readFile('./public/hkd_historical')
|
||||
const content = fs.readFileSync('./public/hkd_historical', { encoding: 'utf8' })
|
||||
// const content = await fs.readFile('./public/historical')
|
||||
const content = fs.readFileSync('./public/historical', { encoding: 'utf8' })
|
||||
|
||||
const historical = JSON.parse(content)
|
||||
hist_entries = []
|
||||
@@ -45,7 +45,7 @@ module.exports = {
|
||||
for (var v = 0; v < hist_entries.length; v++) {
|
||||
const date = new Date(hist_entries[v]['date'])
|
||||
year = date.getFullYear();
|
||||
rawsat = hist_entries[v]['sathkd_rate']
|
||||
rawsat = hist_entries[v]['sateur_rate']
|
||||
percentage = (-100 * ((rawsat - today_sats) / rawsat)).toFixed(3)
|
||||
final_list.push({ "year": date.toLocaleDateString(), "sats": rawsat.toLocaleString("en-US"), "percent": percentage });
|
||||
}
|
||||
|
||||
69
index.js
69
index.js
@@ -11,9 +11,14 @@ const handlebars = require('express-handlebars');
|
||||
const port = 3000;
|
||||
|
||||
const calculate = require('./calculate')
|
||||
const zhcnjson = require('./locales/zh-cn.json');
|
||||
const zhhkjson = require('./locales/zh-hk.json');
|
||||
const enjson = require('./locales/en.json');
|
||||
const enjson = require('./locales/en-eur.json');
|
||||
const dejson = require('./locales/de.json');
|
||||
const frjson = require('./locales/fr.json');
|
||||
const esjson = require('./locales/es.json');
|
||||
const itjson = require('./locales/it.json');
|
||||
const nljson = require('./locales/nl.json');
|
||||
const ptjson = require('./locales/pt.json');
|
||||
const pljson = require('./locales/pl.json');
|
||||
|
||||
app.set('view engine', 'hbs');
|
||||
app.set('views', __dirname + '/views')
|
||||
@@ -34,31 +39,71 @@ app.use(express.static(path.join(__dirname, 'public', 'css')));
|
||||
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
res.redirect('/en');
|
||||
res.redirect('/en-eur');
|
||||
});
|
||||
|
||||
app.get('/en', function(req, res) {
|
||||
// EUR routes
|
||||
app.get('/en-eur', function(req, res) {
|
||||
calculate.get10yr().then(pydata => {
|
||||
// console.log("get10yr: ", pydata)
|
||||
const yeardata = { 'yeardata': pydata }
|
||||
let endata = Object.assign(enjson, yeardata)
|
||||
res.render('sats', endata)
|
||||
})
|
||||
});
|
||||
|
||||
app.get('/zh-cn', function(req, res) {
|
||||
app.get('/de', function(req, res) {
|
||||
calculate.get10yr().then(pydata => {
|
||||
const yeardata = { 'yeardata': pydata }
|
||||
let zhcndata = Object.assign(zhcnjson, yeardata)
|
||||
res.render('sats', zhcndata)
|
||||
let dedata = Object.assign(dejson, yeardata)
|
||||
res.render('sats', dedata)
|
||||
})
|
||||
});
|
||||
|
||||
app.get('/zh-hk', function(req, res) {
|
||||
app.get('/fr', function(req, res) {
|
||||
calculate.get10yr().then(pydata => {
|
||||
const yeardata = { 'yeardata': pydata }
|
||||
let zhhkdata = Object.assign(zhhkjson, yeardata)
|
||||
res.render('sats', zhhkdata)
|
||||
let frdata = Object.assign(frjson, yeardata)
|
||||
res.render('sats', frdata)
|
||||
})
|
||||
});
|
||||
|
||||
app.get('/es', function(req, res) {
|
||||
calculate.get10yr().then(pydata => {
|
||||
const yeardata = { 'yeardata': pydata }
|
||||
let esdata = Object.assign(esjson, yeardata)
|
||||
res.render('sats', esdata)
|
||||
})
|
||||
});
|
||||
|
||||
app.get('/it', function(req, res) {
|
||||
calculate.get10yr().then(pydata => {
|
||||
const yeardata = { 'yeardata': pydata }
|
||||
let itdata = Object.assign(itjson, yeardata)
|
||||
res.render('sats', itdata)
|
||||
})
|
||||
});
|
||||
|
||||
app.get('/nl', function(req, res) {
|
||||
calculate.get10yr().then(pydata => {
|
||||
const yeardata = { 'yeardata': pydata }
|
||||
let nldata = Object.assign(nljson, yeardata)
|
||||
res.render('sats', nldata)
|
||||
})
|
||||
});
|
||||
|
||||
app.get('/pt', function(req, res) {
|
||||
calculate.get10yr().then(pydata => {
|
||||
const yeardata = { 'yeardata': pydata }
|
||||
let ptdata = Object.assign(ptjson, yeardata)
|
||||
res.render('sats', ptdata)
|
||||
})
|
||||
});
|
||||
|
||||
app.get('/pl', function(req, res) {
|
||||
calculate.get10yr().then(pydata => {
|
||||
const yeardata = { 'yeardata': pydata }
|
||||
let pldata = Object.assign(pljson, yeardata)
|
||||
res.render('sats', pldata)
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
35
locales/de.json
Normal file
35
locales/de.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"post": {
|
||||
"author": "Janith Kasun",
|
||||
"image": "https://picsum.photos/500/500",
|
||||
"comments": [
|
||||
"This is the first comment",
|
||||
"This is the second comment",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nec fermentum ligula. Sed vitae erat lectus."
|
||||
]
|
||||
},
|
||||
"layout": "main",
|
||||
"Title": "1 Euro ist derzeit wert ",
|
||||
"subtitle": "EURSAT Historische Performance",
|
||||
"date": "Datum",
|
||||
"price": "Preis",
|
||||
"percentchange": "Prozentuale Änderung",
|
||||
"footnote": "Datenquelle von usdsat.com, angepasst für EUR",
|
||||
"data_file": "historical",
|
||||
"rate_field": "sateur_rate",
|
||||
"exchange_rate": "0.92",
|
||||
"lang1_link": "/en-eur/",
|
||||
"lang1": "English",
|
||||
"lang2_link": "/fr/",
|
||||
"lang2": "Français",
|
||||
"lang3_link": "/es/",
|
||||
"lang3": "Español",
|
||||
"lang4_link": "/it/",
|
||||
"lang4": "Italiano",
|
||||
"lang5_link": "/nl/",
|
||||
"lang5": "Nederlands",
|
||||
"lang6_link": "/pt/",
|
||||
"lang6": "Português",
|
||||
"lang7_link": "/pl/",
|
||||
"lang7": "Polski"
|
||||
}
|
||||
35
locales/en-eur.json
Normal file
35
locales/en-eur.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"post": {
|
||||
"author": "Janith Kasun",
|
||||
"image": "https://picsum.photos/500/500",
|
||||
"comments": [
|
||||
"This is the first comment",
|
||||
"This is the second comment",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nec fermentum ligula. Sed vitae erat lectus."
|
||||
]
|
||||
},
|
||||
"layout": "main",
|
||||
"Title": "1 Euro is currently worth ",
|
||||
"subtitle": "EURSAT Historical Performance",
|
||||
"date": "Date",
|
||||
"price": "Price",
|
||||
"percentchange": "Percent Change",
|
||||
"footnote": "data source from usdsat.com, adapted for EUR",
|
||||
"data_file": "historical",
|
||||
"rate_field": "sateur_rate",
|
||||
"exchange_rate": "0.92",
|
||||
"lang1_link": "/de/",
|
||||
"lang1": "Deutsch",
|
||||
"lang2_link": "/fr/",
|
||||
"lang2": "Français",
|
||||
"lang3_link": "/es/",
|
||||
"lang3": "Español",
|
||||
"lang4_link": "/it/",
|
||||
"lang4": "Italiano",
|
||||
"lang5_link": "/nl/",
|
||||
"lang5": "Nederlands",
|
||||
"lang6_link": "/pt/",
|
||||
"lang6": "Português",
|
||||
"lang7_link": "/pl/",
|
||||
"lang7": "Polski"
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"post": {
|
||||
"author": "Janith Kasun",
|
||||
"image": "https://picsum.photos/500/500",
|
||||
"comments": [
|
||||
"This is the first comment",
|
||||
"This is the second comment",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nec fermentum ligula. Sed vitae erat lectus."
|
||||
]
|
||||
},
|
||||
"layout": "main",
|
||||
"Title": "1 HK dollar is currently worth ",
|
||||
"subtitle": "HKDSAT Historical Performance",
|
||||
"date": "Date",
|
||||
"price": "Price",
|
||||
"percentchange": "Percent Change",
|
||||
"footnote": "data source from usdsat.com, adapted for HKD",
|
||||
"lang1_link": "/zh-cn/",
|
||||
"lang1": "中文(中国)",
|
||||
"lang2_link": "/zh-hk/",
|
||||
"lang2": "中文(香港)"
|
||||
}
|
||||
35
locales/es.json
Normal file
35
locales/es.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"post": {
|
||||
"author": "Janith Kasun",
|
||||
"image": "https://picsum.photos/500/500",
|
||||
"comments": [
|
||||
"This is the first comment",
|
||||
"This is the second comment",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nec fermentum ligula. Sed vitae erat lectus."
|
||||
]
|
||||
},
|
||||
"layout": "main",
|
||||
"Title": "1 Euro vale actualmente ",
|
||||
"subtitle": "Rendimiento Histórico EURSAT",
|
||||
"date": "Fecha",
|
||||
"price": "Precio",
|
||||
"percentchange": "Cambio Porcentual",
|
||||
"footnote": "fuente de datos de usdsat.com, adaptado para EUR",
|
||||
"data_file": "historical",
|
||||
"rate_field": "sateur_rate",
|
||||
"exchange_rate": "0.92",
|
||||
"lang1_link": "/en-eur/",
|
||||
"lang1": "English",
|
||||
"lang2_link": "/de/",
|
||||
"lang2": "Deutsch",
|
||||
"lang3_link": "/fr/",
|
||||
"lang3": "Français",
|
||||
"lang4_link": "/it/",
|
||||
"lang4": "Italiano",
|
||||
"lang5_link": "/nl/",
|
||||
"lang5": "Nederlands",
|
||||
"lang6_link": "/pt/",
|
||||
"lang6": "Português",
|
||||
"lang7_link": "/pl/",
|
||||
"lang7": "Polski"
|
||||
}
|
||||
35
locales/fr.json
Normal file
35
locales/fr.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"post": {
|
||||
"author": "Janith Kasun",
|
||||
"image": "https://picsum.photos/500/500",
|
||||
"comments": [
|
||||
"This is the first comment",
|
||||
"This is the second comment",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nec fermentum ligula. Sed vitae erat lectus."
|
||||
]
|
||||
},
|
||||
"layout": "main",
|
||||
"Title": "1 Euro vaut actuellement ",
|
||||
"subtitle": "Performance Historique EURSAT",
|
||||
"date": "Date",
|
||||
"price": "Prix",
|
||||
"percentchange": "Variation en Pourcentage",
|
||||
"footnote": "source de données de usdsat.com, adaptée pour EUR",
|
||||
"data_file": "historical",
|
||||
"rate_field": "sateur_rate",
|
||||
"exchange_rate": "0.92",
|
||||
"lang1_link": "/en-eur/",
|
||||
"lang1": "English",
|
||||
"lang2_link": "/de/",
|
||||
"lang2": "Deutsch",
|
||||
"lang3_link": "/es/",
|
||||
"lang3": "Español",
|
||||
"lang4_link": "/it/",
|
||||
"lang4": "Italiano",
|
||||
"lang5_link": "/nl/",
|
||||
"lang5": "Nederlands",
|
||||
"lang6_link": "/pt/",
|
||||
"lang6": "Português",
|
||||
"lang7_link": "/pl/",
|
||||
"lang7": "Polski"
|
||||
}
|
||||
35
locales/it.json
Normal file
35
locales/it.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"post": {
|
||||
"author": "Janith Kasun",
|
||||
"image": "https://picsum.photos/500/500",
|
||||
"comments": [
|
||||
"This is the first comment",
|
||||
"This is the second comment",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nec fermentum ligula. Sed vitae erat lectus."
|
||||
]
|
||||
},
|
||||
"layout": "main",
|
||||
"Title": "1 Euro vale attualmente ",
|
||||
"subtitle": "Performance Storica EURSAT",
|
||||
"date": "Data",
|
||||
"price": "Prezzo",
|
||||
"percentchange": "Variazione Percentuale",
|
||||
"footnote": "fonte dati da usdsat.com, adattato per EUR",
|
||||
"data_file": "historical",
|
||||
"rate_field": "sateur_rate",
|
||||
"exchange_rate": "0.92",
|
||||
"lang1_link": "/en-eur/",
|
||||
"lang1": "English",
|
||||
"lang2_link": "/de/",
|
||||
"lang2": "Deutsch",
|
||||
"lang3_link": "/fr/",
|
||||
"lang3": "Français",
|
||||
"lang4_link": "/es/",
|
||||
"lang4": "Español",
|
||||
"lang5_link": "/nl/",
|
||||
"lang5": "Nederlands",
|
||||
"lang6_link": "/pt/",
|
||||
"lang6": "Português",
|
||||
"lang7_link": "/pl/",
|
||||
"lang7": "Polski"
|
||||
}
|
||||
35
locales/nl.json
Normal file
35
locales/nl.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"post": {
|
||||
"author": "Janith Kasun",
|
||||
"image": "https://picsum.photos/500/500",
|
||||
"comments": [
|
||||
"This is the first comment",
|
||||
"This is the second comment",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nec fermentum ligula. Sed vitae erat lectus."
|
||||
]
|
||||
},
|
||||
"layout": "main",
|
||||
"Title": "1 Euro is momenteel waard ",
|
||||
"subtitle": "EURSAT Historische Prestaties",
|
||||
"date": "Datum",
|
||||
"price": "Prijs",
|
||||
"percentchange": "Procentuele Verandering",
|
||||
"footnote": "gegevensbron van usdsat.com, aangepast voor EUR",
|
||||
"data_file": "historical",
|
||||
"rate_field": "sateur_rate",
|
||||
"exchange_rate": "0.92",
|
||||
"lang1_link": "/en-eur/",
|
||||
"lang1": "English",
|
||||
"lang2_link": "/de/",
|
||||
"lang2": "Deutsch",
|
||||
"lang3_link": "/fr/",
|
||||
"lang3": "Français",
|
||||
"lang4_link": "/es/",
|
||||
"lang4": "Español",
|
||||
"lang5_link": "/it/",
|
||||
"lang5": "Italiano",
|
||||
"lang6_link": "/pt/",
|
||||
"lang6": "Português",
|
||||
"lang7_link": "/pl/",
|
||||
"lang7": "Polski"
|
||||
}
|
||||
35
locales/pl.json
Normal file
35
locales/pl.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"post": {
|
||||
"author": "Janith Kasun",
|
||||
"image": "https://picsum.photos/500/500",
|
||||
"comments": [
|
||||
"This is the first comment",
|
||||
"This is the second comment",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nec fermentum ligula. Sed vitae erat lectus."
|
||||
]
|
||||
},
|
||||
"layout": "main",
|
||||
"Title": "1 Euro jest obecnie warte ",
|
||||
"subtitle": "Historyczna Wydajność EURSAT",
|
||||
"date": "Data",
|
||||
"price": "Cena",
|
||||
"percentchange": "Zmiana Procentowa",
|
||||
"footnote": "źródło danych z usdsat.com, dostosowane dla EUR",
|
||||
"data_file": "historical",
|
||||
"rate_field": "sateur_rate",
|
||||
"exchange_rate": "0.92",
|
||||
"lang1_link": "/en-eur/",
|
||||
"lang1": "English",
|
||||
"lang2_link": "/de/",
|
||||
"lang2": "Deutsch",
|
||||
"lang3_link": "/fr/",
|
||||
"lang3": "Français",
|
||||
"lang4_link": "/es/",
|
||||
"lang4": "Español",
|
||||
"lang5_link": "/it/",
|
||||
"lang5": "Italiano",
|
||||
"lang6_link": "/nl/",
|
||||
"lang6": "Nederlands",
|
||||
"lang7_link": "/pt/",
|
||||
"lang7": "Português"
|
||||
}
|
||||
35
locales/pt.json
Normal file
35
locales/pt.json
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"post": {
|
||||
"author": "Janith Kasun",
|
||||
"image": "https://picsum.photos/500/500",
|
||||
"comments": [
|
||||
"This is the first comment",
|
||||
"This is the second comment",
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nec fermentum ligula. Sed vitae erat lectus."
|
||||
]
|
||||
},
|
||||
"layout": "main",
|
||||
"Title": "1 Euro vale atualmente ",
|
||||
"subtitle": "Desempenho Histórico EURSAT",
|
||||
"date": "Data",
|
||||
"price": "Preço",
|
||||
"percentchange": "Variação Percentual",
|
||||
"footnote": "fonte de dados de usdsat.com, adaptado para EUR",
|
||||
"data_file": "historical",
|
||||
"rate_field": "sateur_rate",
|
||||
"exchange_rate": "0.92",
|
||||
"lang1_link": "/en-eur/",
|
||||
"lang1": "English",
|
||||
"lang2_link": "/de/",
|
||||
"lang2": "Deutsch",
|
||||
"lang3_link": "/fr/",
|
||||
"lang3": "Français",
|
||||
"lang4_link": "/es/",
|
||||
"lang4": "Español",
|
||||
"lang5_link": "/it/",
|
||||
"lang5": "Italiano",
|
||||
"lang6_link": "/nl/",
|
||||
"lang6": "Nederlands",
|
||||
"lang7_link": "/pl/",
|
||||
"lang7": "Polski"
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"Title": "1 港币现值 ",
|
||||
"subtitle": "HKDSAT 过往表现",
|
||||
"date": "日期",
|
||||
"price": "价格",
|
||||
"percentchange": "百分比变化",
|
||||
"footnote": "来自usdsat.com的数据源",
|
||||
"lang1_link": "/",
|
||||
"lang1": "EN",
|
||||
"lang2_link": "/zh-hk/",
|
||||
"lang2": "中文(香港)"
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"Title": "1 港幣現值 ",
|
||||
"subtitle" : "HKDSAT 過往表現",
|
||||
"date" : "日期",
|
||||
"price" : "價格",
|
||||
"percentchange" : "百分比變化",
|
||||
"footnote" : "來自usdsat.com的數據源",
|
||||
"lang1_link": "/zh-cn/",
|
||||
"lang1": "中文(中国)",
|
||||
"lang2_link": "/",
|
||||
"lang2": "EN"
|
||||
}
|
||||
1
public/historical
Normal file
1
public/historical
Normal file
@@ -0,0 +1 @@
|
||||
[]
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -58,8 +58,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
<span class="navbar-item" style="color: #fff">
|
||||
<a class="px-2" href="{{ lang1_link }}" style="color: rgb(6, 168, 231)"> {{ lang1 }} </a> |
|
||||
<a class="px-2" href="{{ lang2_link }}" style="color: rgb(6, 168, 231)"> {{ lang2 }}</a>
|
||||
<a class="px-2" href="{{ lang1_link }}" style="color: rgb(6, 168, 231)"> {{ lang1 }} </a>{{#if lang2}} | <a class="px-2" href="{{ lang2_link }}" style="color: rgb(6, 168, 231)"> {{ lang2 }}</a>{{/if}}{{#if lang3}} | <a class="px-2" href="{{ lang3_link }}" style="color: rgb(6, 168, 231)"> {{ lang3 }}</a>{{/if}}{{#if lang4}} | <a class="px-2" href="{{ lang4_link }}" style="color: rgb(6, 168, 231)"> {{ lang4 }}</a>{{/if}}{{#if lang5}} | <a class="px-2" href="{{ lang5_link }}" style="color: rgb(6, 168, 231)"> {{ lang5 }}</a>{{/if}}{{#if lang6}} | <a class="px-2" href="{{ lang6_link }}" style="color: rgb(6, 168, 231)"> {{ lang6 }}</a>{{/if}}{{#if lang7}} | <a class="px-2" href="{{ lang7_link }}" style="color: rgb(6, 168, 231)"> {{ lang7 }}</a>{{/if}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -125,7 +124,7 @@
|
||||
i.forEach(function(item) {
|
||||
if (Array.isArray(item)) {
|
||||
var btc_price = item[0];
|
||||
currentPrice = Math.round((1 / btc_price) * 100000000 / 7.75); // satoshis per HKD dollar
|
||||
currentPrice = Math.round((1 / btc_price) * 100000000 / {{ exchange_rate }}); // satoshis per currency unit
|
||||
document.title = currentPrice.toLocaleString() + " sats";
|
||||
document.querySelector('#current').textContent = currentPrice.toLocaleString();
|
||||
|
||||
@@ -165,7 +164,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<script>
|
||||
d3.json('/hkd_historical', function(data) {
|
||||
d3.json('/{{ data_file }}', function(data) {
|
||||
data = MG.convert.date(data, 'date');
|
||||
|
||||
var windowWidth = $(window).width();
|
||||
@@ -230,7 +229,7 @@
|
||||
xax_count: 16,
|
||||
yax_count: 12,
|
||||
x_accessor: 'date',
|
||||
y_accessor: 'sathkd_rate',
|
||||
y_accessor: '{{ rate_field }}',
|
||||
y_scale_type: 'log',
|
||||
y_extended_ticks: true,
|
||||
yax_units: ' sats',
|
||||
|
||||
Reference in New Issue
Block a user