Created
March 25, 2023 03:05
-
-
Save nikolaybotev/083d0c38f5588b7ae7793ffed6633e34 to your computer and use it in GitHub Desktop.
Convert XE currency rates JSON to CSV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let c1 = require('./currency-rates-2.json') | |
console.log('Date,', c1.from, 'to', c1.to) | |
let c1b = c1.batchList[0] | |
let ts = c1b.startTime | |
for (let i = 1; i < c1b.rates.length; i += 1) { | |
let actualrate = c1b.rates[i] - c1b.rates[0] | |
console.log(new Date(ts).toLocaleDateString() + ', ' + actualrate) | |
ts += c1b.interval | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment