Fix crex24 market chart

-Chart data was pulling the last 100 trades within 15m intervals but was often returning data well beyond the 24h time period and could lead to some unreadable/unusable charts
This commit is contained in:
Joe Uhren
2022-06-04 16:07:45 -06:00
parent bf1781af29
commit 2841f67b94
+5 -2
View File
@@ -104,8 +104,11 @@ function get_chartdata(coin, exchange, cb) {
else {
var processed = [];
for (var i = 0; i < chartdata.length; i++)
processed.push([new Date(chartdata[i].timestamp).getTime(), parseFloat(chartdata[i].open), parseFloat(chartdata[i].high), parseFloat(chartdata[i].low), parseFloat(chartdata[i].close)]);
for (var i = 0; i < chartdata.length; i++) {
// only keep values from within the last 24 hours
if (new Date(chartdata[i].timestamp).getTime()/1000 > start)
processed.push([new Date(chartdata[i].timestamp).getTime(), parseFloat(chartdata[i].open), parseFloat(chartdata[i].high), parseFloat(chartdata[i].low), parseFloat(chartdata[i].close)]);
}
return cb(null, processed);
}