I have a file, called ETHBTC.json:
[{
"open": "0.06252000",
"high": "0.06264700",
"low": "0.06239800",
"close": "0.06254100",
"volume": "681.69300000",
"timestamp": 1521575400000
},
{
"open": "0.06253500",
"high": "0.06270000",
"low": "0.06242800",
"close": "0.06261900",
"volume": "371.99900000",
"timestamp": 1521575700000
},
{
"open": "0.06261500",
"high": "0.06280000",
"low": "0.06257500",
"close": "0.06266200",
"volume": "519.11000000",
"timestamp": 1521576000000
},
...
]
I am trying to save the low value to a variable in Node.js so I can add all the low values together, etc:
for(item in words) {
var lowTotal = 0;
lowTotal += words.low;
}
But I have no luck.
I'm also having trouble with the console.log just to log the low variable.
[...]around it and first useJSON.parse(). Also you need to accesswords[item].lowand put thevar lowTotal = 0;in front of the for loop.lowTotalis always reset to 0 at each iteration. Put it outside the loop