Здравствуйте есть такой код, мне необходимо вывести хешрейт за 30 минут, 3 часа, 24 часа. Буду благодарен за подсказку.
Информация берется от сюда
https://api.frincoin.com/api/pools/sdr/miners/sedr...
вот в этих местах
workerList += '<div class="current_hashrate"><div class="worker">' + _formatter(value.hashrate, 2, 'H/s') + '</div></div>';
workerList += '<div class="hashrate3h"><div class="worker">' + _formatter(value.hashrate, 2, 'H/s') + '</div></div>';
workerList += '<div class="hashrate24h"><div class="worker">' + _formatter(value.hashrate, 2, 'H/s') + '</div>
Вот сам код.
function loadDashboardWorkerList(walletAddress) {
return $.ajax(API + 'pools/' + currentPool + '/miners/' + walletAddress + '/performance')
.done(function (data) {
var totalRigs = 0;
var workerList = '<div>';
if (data.length > 0) {
$.each(data[0].workers, function (index, value) {
totalRigs++;
if (index.length === 0) {
workerList += '<div class="miners_row flex-container diver">';
workerList += '<div class="workername"><div class="worker">Unnamed</div></div>';
} else {
workerList += '<div class="miners_row flex-container diver">';
workerList += '<div class="workername"><div class="worker">' + index + '</div></div>';
}
workerList += '<div class="current_hashrate"><div class="worker">' + _formatter(value.hashrate, 2, 'H/s') + '</div></div>';
workerList += '<div class="hashrate3h"><div class="worker">' + _formatter(value.hashrate, 2, 'H/s') + '</div></div>';
workerList += '<div class="hashrate24h"><div class="worker">' + _formatter(value.hashrate, 2, 'H/s') + '</div></div>';
workerList += '<div class="last_share_time"><div class="worker">' + _formatter(value.sharesPerSecond, 3, 'S/s') + '</div></div>';
workerList += '</div>';
});
} else {
workerList += '<div class="workername"><div class="worker"><td colspan="4">None</td></div></div>';
}
workerList += '</div>';
$('#workerList').html(workerList);
})
.fail(function () {
$.notify({
icon: "ti-cloud-down",
message: "Error: No response from API.<br>(loadDashboardWorkerList)",
}, {
type: 'danger',
timer: 3000,
});
});