Skip to content

Instantly share code, notes, and snippets.

@ivanelianto
Last active July 9, 2021 04:14
Show Gist options
  • Save ivanelianto/70354b53a63fa148dd1c5a37b6b6fb15 to your computer and use it in GitHub Desktop.
Save ivanelianto/70354b53a63fa148dd1c5a37b6b6fb15 to your computer and use it in GitHub Desktop.
This script is used to get summary of total deposit and withdraw in Indodax.com
/**
* How To Use :
* 1. Open Indodax.com
* 2. Login
* 3. Go To Wallet
* 4. Go To Deposit/Withdraw Rupiah
* 5. Go To History Tab
* 6. Select Month: All
* 7. Select Year: All
* 8. Open Console (F12 or Ctrl + Shift + I)
* 9. Paste This Script
*/
function getTotal(type) {
return $("tbody tr").toArray()
.map(tr => {
const actionType = $(tr.children[1]).text();
const amount = +($(tr.children[2]).text().replaceAll(".", ""));
if (actionType === type) {
return amount;
}
return 0;
})
.reduce((total, amount) => {
return total + amount;
})
}
function getPercentageAssetValueIncrease(currentAsset, deposit) {
return (((currentAsset - deposit)/currentAsset)*100).toFixed(2);
}
totalDeposit = getTotal('Deposit');
totalWithdraw = getTotal('Withdraw');
summary = totalWithdraw - totalDeposit;
currentEstimatedAssetValue = +$(".total_assets_val_main_menu").text().replaceAll('.', '')
console.log(`Total Deposit: %c${totalDeposit.toLocaleString('id-ID')}`,
'color:red;font-weight:bold');
console.log(`Total Withdraw: %c${totalWithdraw.toLocaleString('id-ID')}`,
'color:green;font-weight:bold');
console.log(`Withdraw - Deposit: %c${summary.toLocaleString('id-ID')}`,
'color:blue;font-weight:bold');
console.log(`Asset Value Percentage Increase: %c${
getPercentageAssetValueIncrease(currentEstimatedAssetValue + totalWithdraw, totalDeposit)}%`,
'color:brown;font-weight:bold'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment