Advertisement
sxiii

Metarbitrge - Crypto Exchanges Arbitrage Script

Dec 9th, 2017
2,456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.80 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. clear
  4.  
  5. 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 )
  6. 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 )
  7. 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)
  8.  
  9. end=$(echo ${tickerswex[@]} | wc -w)
  10.  
  11. echo "\/--------------------------------------------------------------------------------\/"
  12. echo "|| M E T A R B I T R A G E                                      Handle with care! ||"
  13. echo "|| This script helps you to arbitrage cryptocurrencies between exchanges.         ||"
  14. echo "|| Please wait, scanning $end crypocurrency pairs on two exchanges.                 ||"
  15. echo "||                                        Written by Security XIII on 8-9.12.2017 ||"
  16. echo "\/--------------------------------------------------------------------------------\/"
  17. echo ""
  18. text=( "PAIR NAME" "YOBIT.NET" "WEX.NZ" "EXMO.ME" "DIFF. Y/W" "DIFF. Y/E" "DIFF. W/E" )
  19. printf "%-10s | %-10s | %-10s | %-10s | %-10s | %-10s | %-30s\n" " ${text[0]}" "${text[1]}" "${text[2]}" "${text[3]}" "${text[4]}" "${text[5]}" "${text[6]}"
  20. echo "---------------------------------------------------------------------------------------"
  21.  
  22. for i in `seq 0 $(($end-1))`; do
  23.  
  24.     w=""; y=""; e=""; r=""; r2=""; r3="";
  25.  
  26.     w=$(curl -f -s https://wex.nz/api/3/ticker/"${tickerswex[i]}" | jq '.'"${tickerswex[i]}"'.sell' )
  27.     y=$(curl -f -s https://yobit.net/api/3/ticker/"${tickersyob[i]}" | jq '.'"${tickersyob[i]}"'.sell' )
  28.     e=$(curl -f -s https://api.exmo.com/v1/ticker | jq '.'"${tickersexm[i]}"'.sell_price' | awk -F'"' '{ print $2 }' )
  29.  
  30.     [[ $w == null ]] && w=""; [[ $y == null ]] && y=""; [[ $e == null ]] && e="";
  31.  
  32.     #z = ($w $y $e)
  33.     #for x in `seq 0 2`; do [[ "${z[$x]}" == "null" ]] && h="eval ${z[$x]}=''"; $h; done
  34.  
  35.     [[ $w =~ ^[+-]?[0-9]+\.?[0-9]*$ ]] && [[ $y =~ ^[+-]?[0-9]+\.?[0-9]*$ ]] && r=$(echo "scale=8;(($y/$w)-1)*100" | bc)
  36.     [[ $y =~ ^[+-]?[0-9]+\.?[0-9]*$ ]] && [[ $e =~ ^[+-]?[0-9]+\.?[0-9]*$ ]] && r2=$(echo "scale=8;(($y/$e)-1)*100" | bc)
  37.     [[ $e =~ ^[+-]?[0-9]+\.?[0-9]*$ ]] && [[ $w =~ ^[+-]?[0-9]+\.?[0-9]*$ ]] && r3=$(echo "scale=8;(($w/$e)-1)*100" | bc)
  38.  
  39.  
  40.     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}"
  41.  
  42.  
  43. done
  44.  
  45. #sleep 60
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement