mirror of
https://github.com/aljazceru/satshkd-vercel.git
synced 2025-12-18 13:44:22 +01:00
Remove all HKD/satshkd support, keep only EUR version
- Removed all HKD routes (/en, /zh-cn, /zh-hk) from index.js - Removed HKD locale files (en.json, zh-cn.json, zh-hk.json) - Removed HKD calculation files (calculate.js, btcpoll.js, updaterate.js from old version) - Removed HKD historical data files (hkd_historical, hkd_historical_dedup) - Renamed EUR-specific files to standard names: - calculate-eur.js -> calculate.js - btcpoll-eur.js -> btcpoll.js - updaterate-eur.js -> updaterate.js - eur_historical -> historical - Updated all locale files to reference 'historical' instead of 'eur_historical' - Updated default route to redirect to /en-eur instead of /en - Updated GitHub Actions workflow to only run EUR data updates - Updated all references in code to use renamed files This creates a clean EUR-only implementation ready for deployment at eursat.eu
This commit is contained in:
16
calculate.js
16
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 });
|
||||
}
|
||||
@@ -55,4 +55,4 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user