Script alert coin price on Bittrex

Share this post to your friends !

Script alert coin price on Bittrex
5 (100%) 1 vote[s]

WriteBash - Today I will share with you a simple script to help alert the current coin price on Bittrex that you want through the bash script. Script will alert the price of a coin on Bittrex that you want. Input is quite simple, you choose coin on the floor, for example usdt-btg. That is, you choose BTG to trade with USDT.

Next, you set the lowest price and the highest price you need to alert. This means that if the current coin price is lower than the lowest price you set, a warning popup will appear on the screen. Or if the current price is higher than the highest price you set, the warning popup will also appear.

Script alert coin price

The contents of the script are as follows or you can download the script file from this link.

#!/bin/bash
#
# Author: Danie Pham
# Website: https://www.writebash.com
# Date: 24-07-2018
# Use: simple script use to alert coin price on Bittrex

echo -n "COIN (usdt-btg): "; read coin;
echo -n "LOW PRICE: "; read lprice;
echo -n "HIGH PRICE: "; read hprice;

while true
do
   COIN=`curl -s https://bittrex.com/api/v1.1/public/getmarketsummary?market=$coin | python -mjson.tool | grep Last | awk '{print $2}' | sed 's/,//g'`
   sleep 0.5

   compare_low=`echo "$COIN <=$lprice" | bc`
   if [[ $compare_low -gt 0 ]]; then
      zenity --warning --text="$coin lower than $lprice"
   else
      echo "$COIN"
   fi

   compare_high=`echo "$COIN >=$hprice" | bc`
   if [[ $compare_high -gt 0 ]]; then
      zenity --warning --text="$coin higher then $hprice"
   else
      echo "$COIN"
      echo "----- $(date) -----"
   fi
done

I will explain the script above:

  • The first 3 echo commands will ask you to enter the coin name, the lowest price and the highest price that you need to track.
  • The next while true statement produces an infinite loop until you stop the script by pressing Ctrl + C.
  • The curl command will get the last price of the coin you entered through the Bittrex API. Ex: 29.5
  • 2 block compare price. Block above will compare the last price with the lowest price you want to track. If the current price is lower, the script uses zenity to display a warning window. Same for the bottom block with the highest price you need to track.

Script is really simple. I tested this script in Linux Mint 18 and it’s ok.

How to use script

OK, so how to use this script? You download this script to your computer, example save it in Desktop. Then open the terminal and type:

chmod +x Script_alert_coin_price

You can save this script with any name that you want, my example it”s name is “Script_alert_coin_price”.

And then, you type this command to run script:

./Script_alert_coin_price

At start, the script will ask you to enter three things as image below:

script-alert-coin-price-on-bittrex-01 Script alert coin price on Bittrex
Script alert coin price on Bittrex.
  1. COIN: you tye the coin’s name, ex: usdt-btg, btc-btg, btc-neo…
  2. LOW PRICE: you type a number, ex: 28, 30.5, 50.8…
  3. HIGH PRICE: you type number just like LOW PRICE.

Price alert window

When the current price is lower than the lowest price you set, the following window will appear in the middle of your screen.

script-alert-coin-price-on-bittrex-02 Script alert coin price on Bittrex
Alert window will appear when price lower than you set.

Or when the current price is higher than highest price you set.

script-alert-coin-price-on-bittrex-03 Script alert coin price on Bittrex
Alert window will appear when price higher than you set.

That’s it. A simple script to help you track the coin price on your computer. Just have fun !!!

If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.


Share this post to your friends !
If you appreciate what we share in this blog, you can support us by:
  1. Stay connected to: Facebook | Twitter | Google Plus | YouTube
  2. Subscribe email to recieve new posts from us: Sign up now.
  3. Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
  4. Become a Supporter - Make a contribution via PayPal.
  5. Support us by purchasing Ribbon Lite Child theme being using on this website.

We are thankful for your support.

single post bottom banner
«« »»

Got something to say? Join the discussion

Please keep in mind that all comments are subject to our Comment Policy. Your email address will not be published.
This site uses Akismet to reduce spam. Learn how your comment data is processed.