sxiii icon

Metarbitrge - Crypto Exchanges Arbitrage Script

sxiii | PRO | 12/09/17 07:33:25 PM UTC | 0 ⭐ | 2719 👁️ | Never ⏰ | []
Bash |

2.8 KB

|

None

|

0 👍

/

0 👎

#!/bin/bash
 
clear
 
tickerswex=( btc_usd btc_eur btc_rur ltc_btc ltc_usd ltc_eur ltc_rur nmc_btc nmc_usd nvc_btc nvc_usd usd_rur ppc_btc ppc_usd dsh_btc dsh_rur dsh_usd dsh_eth eth_btc eth_usd eth_eur eth_rur bch_usd bch_btc bch_rur bch_eth zec_btc zec_usd zec_eur )
tickersyob=( btc_usd btc_eur btc_rur ltc_btc ltc_usd ltc_eur ltc_rur nmc_btc nmc_usd nvc_btc nvc_usd usd_rur ppc_btc ppc_usd dash_btc dash_rur dash_usd dash_eth eth_btc eth_usd eth_eur eth_rur bcc_usd bcc_btc bcc_rur bcc_eth zec_btc zec_usd zec_eur )
tickersexm=( BTC_USD BTC_EUR BTC_RUB LTC_BTC LTC_USD LTC_EUR LTC_RUB NMC_BTC NMC_USD NVC_BTC NVC_USD USD_RUB PPC_BTC PPC_USD DASH_BTS DASH_RUB DASH_USD DASH_ETH ETH_BTC ETH_USD ETH_EUR ETH_RUB BCH_USD BCH_BTC BCH_RUB BCH_ETH ZEC_BTC ZEC_USD ZEC_EUR)
 
end=$(echo ${tickerswex[@]} | wc -w)
 
echo "\/--------------------------------------------------------------------------------\/"
echo "|| M E T A R B I T R A G E                                      Handle with care! ||"
echo "|| This script helps you to arbitrage cryptocurrencies between exchanges.         ||"
echo "|| Please wait, scanning $end crypocurrency pairs on two exchanges.                 ||"
echo "||                                        Written by Security XIII on 8-9.12.2017 ||"
echo "\/--------------------------------------------------------------------------------\/"
echo ""
text=( "PAIR NAME" "YOBIT.NET" "WEX.NZ" "EXMO.ME" "DIFF. Y/W" "DIFF. Y/E" "DIFF. W/E" )
printf "%-10s | %-10s | %-10s | %-10s | %-10s | %-10s | %-30s\n" " ${text[0]}" "${text[1]}" "${text[2]}" "${text[3]}" "${text[4]}" "${text[5]}" "${text[6]}"
echo "---------------------------------------------------------------------------------------"
 
for i in `seq 0 $(($end-1))`; do
 
    w=""; y=""; e=""; r=""; r2=""; r3="";
 
    w=$(curl -f -s https://wex.nz/api/3/ticker/"${tickerswex[i]}" | jq '.'"${tickerswex[i]}"'.sell' ) 
    y=$(curl -f -s https://yobit.net/api/3/ticker/"${tickersyob[i]}" | jq '.'"${tickersyob[i]}"'.sell' )
    e=$(curl -f -s https://api.exmo.com/v1/ticker | jq '.'"${tickersexm[i]}"'.sell_price' | awk -F'"' '{ print $2 }' )
 
    [[ $w == null ]] && w=""; [[ $y == null ]] && y=""; [[ $e == null ]] && e=""; 
 
    #z = ($w $y $e)
    #for x in `seq 0 2`; do [[ "${z[$x]}" == "null" ]] && h="eval ${z[$x]}=''"; $h; done
 
    [[ $w =~ ^[+-]?[0-9]+\.?[0-9]*$ ]] && [[ $y =~ ^[+-]?[0-9]+\.?[0-9]*$ ]] && r=$(echo "scale=8;(($y/$w)-1)*100" | bc)
    [[ $y =~ ^[+-]?[0-9]+\.?[0-9]*$ ]] && [[ $e =~ ^[+-]?[0-9]+\.?[0-9]*$ ]] && r2=$(echo "scale=8;(($y/$e)-1)*100" | bc)
    [[ $e =~ ^[+-]?[0-9]+\.?[0-9]*$ ]] && [[ $w =~ ^[+-]?[0-9]+\.?[0-9]*$ ]] && r3=$(echo "scale=8;(($w/$e)-1)*100" | bc)
 
 
    printf "%-10s | %-10s | %-10s | %-10s | %-10s | %-10s | %-20s\n" "${tickersyob[$i]}" "${y:0:10}" "${w:0:10}" "${e:0:10}" "${r:0:10}" "${r2:0:10}" "${r3:0:10}"
 
 
done
 
#sleep 60

Comments