Author

Topic: Querying Exchange Wallet Stati (Read 131 times)

newbie
Activity: 1
Merit: 0
December 31, 2017, 10:01:08 AM
#1
Inspired by the current Dimcoin situation on HitBTC and BigUp being 1 sat on Yobit vs. 4 sat on coinexchange and this thread, I decided to monitor some wallets on exchanges.

Here are some current stats and short script:

Code:
#!/bin/bash

folder='wallet-stati'
mkdir -p "$folder"

echo "============ Yobit ============"
wget -q -O "$folder/yobit-wallets.html" --load-cookies='yobit-2017-12-31.cookie' 'https://yobit.net/en/wallets/'
file="$folder/yobit-wallet-stati-$( date -u '+%Y-%m-%dT%H-%M-%S' ).js"
sed -z 's|[\n\r]||g' "$folder/yobit-wallets.html" | sed -nr 's|.*arrsts = (\{[^}]*\};).*|\1|p' | sed "s|],'|],\n'|g" > "$file"
nTotal=$( 'grep' -o "'[123]'" "$file" | wc -l )
for (( i=1; i<=3; i++ )); do
    s=$( sed -nr 's|.*arrstsi = \{.*'"'$i':'([^']*)'"'.*\}.*|\1|p' yobit-wallets.html )
    n=$( grep -o "'$i'" "$file" | wc -l )
    printf '% -20s% 6i (% 3i%%)\n' "$s" "$n" $(( n * 100 / nTotal ))
done
printf '% -20s% 6i\n' "Total" "$nTotal"

echo "============ HitBTC ============"
file="$folder/hitbtc-wallet-stati-$( date -u '+%Y-%m-%dT%H-%M-%S' ).js"
wget -q -O "$file" 'https://api.hitbtc.com/api/2/public/currency/'
nTotal=$( grep -o 'payinEnabled' "$file" | wc -l )
for s in 'payinEnabled' 'payoutEnabled' 'transferEnabled'; do
  for b in 'true' 'false'; do
    s2=$s; if [ "$b" == 'false' ]; then s2=$( echo "$s" | 'sed' 's|Enabled|Disabled|' ) ;fi
    n=$( 'grep' -o "\"$s\":$b" "$file" | wc -l )
    printf '% -20s% 6i (% 3i%%)\n' "$s2" "$n" $(( n * 100 / nTotal ))
  done
done
printf '% -20s% 6i\n' "Total" "$nTotal"

And the output:

============ Yobit ============
Online                 363 ( 32%)
Delayed                 21 (  1%)
Maintenance            719 ( 65%)
Total                 1103
============ HitBTC ============
payinEnabled           207 ( 82%)
payinDisabled           44 ( 17%)
payoutEnabled          207 ( 82%)
payoutDisabled          44 ( 17%)
transferEnabled        231 ( 92%)
transferDisabled        20 (  7%)
Total                  251


I'd be happy to see anyone adding other exchanges to this script.
Jump to: