Skip to content

Instantly share code, notes, and snippets.

@krejdster
Last active May 12, 2018 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krejdster/c0813d2d6e515e5eaecf3cb598c84db4 to your computer and use it in GitHub Desktop.
Save krejdster/c0813d2d6e515e5eaecf3cb598c84db4 to your computer and use it in GitHub Desktop.
[Bitbay - transactions PCC]
var sumArray = [];
var transactionsInterval = setInterval(function() {
// Get all buy (bid) transactions
$('.bid').closest('.historyItem-wrapper').find('strong#transaction-value').each(function(idx, record) {
var price = $(record).text().replace(/pln/ig, '').replace(/ /ig, '').trim();
price = parseFloat(price);
sumArray.push(price);
});
var nextPageButton = $('.waves-effect.pagination-next-page-button');
// Check if there is "next page" available or is it an end of all transactions
if(nextPageButton.hasClass('disabled') == true) {
var sumAll = sumArray.reduce((a, b) => a + b, 0);
var onePercentOfThat = sumAll / 100;
console.log(onePercentOfThat);
alert(onePercentOfThat);
clearInterval(transactionsInterval);
} else {
nextPageButton.trigger('click');
}
}, 4000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment