项目作者: Llewellynvdm

项目描述 :
Get Coin Rates
高级语言: Shell
项目地址: git://github.com/Llewellynvdm/CoinRate.git
创建时间: 2017-12-27T03:52:47Z
项目社区:https://github.com/Llewellynvdm/CoinRate

开源协议:GNU General Public License v3.0

下载


Coin Rate Watcher

The Bash script gets current values for cryptocurrencies from a variety of Exchange APIs, and then calculates if various notifications should be send based on above or below price margins. All dynamically set by command options or file, you can now stay informed of any changes in the market with this coin rate watching script.

The Get Method (getPrice.sh)

….. more info soon

Features

  • hmmm many

Getting started

First, clone the repository using git:

  1. $git clone https://github.com/vdm-io/CoinRate.git

Then give the execution permission to this file:

  1. $chmod +x getPrice.sh

Set your sms details (if required):

Read sms.txt for more details.

Set your Telegram details (if required):

Read notify.txt for more details.

Set your Factory details (if you want to do bulk checks):

Read factory.txt for more details.

Set your Dynamic details (if you want to do bulk checks based on percentages):

Read dynamic.txt for more details.

Usage GET

The syntax is quite simple:

  1. $./getPrice.sh <PARAMETERS>

Parameters:

  1. API options
  2. ======================================================
  3. -I Select the api to query
  4. Options:
  5. 1 = [cex] cex.io - (default)
  6. 2 = [shapeshift] shapeshift.io
  7. 3 = [bitfinex] bitfinex.com
  8. 4 = [gate] gate.io
  9. 5 = [luno] luno.com
  10. -x Hide API name from message
  11. Basic options
  12. ======================================================
  13. -c Currency to watch (c:_)
  14. example: BTC
  15. -C Target Currecy to Display (_:t)
  16. example: USD
  17. -o How often should the message be send/shown
  18. 0 = once per/day
  19. 1 = once per/hour
  20. 2 = everyTime (default)
  21. 3 = only once
  22. -p The percentage up or down at which to send/show notice
  23. -v Value (above or below) at which to send/show notice
  24. example: 17000 or 14000,15000
  25. -A Value Above at which to send notice
  26. example: 17000 or 19000,18000
  27. -B Value Below at which to send notice
  28. example: 14000 or 14000,15000
  29. -b Send Notice below target value once a day
  30. -a Send Notice above target value once a day (default)
  31. -k show the above value and below value in the result string
  32. Advance options (factory option)
  33. ======================================================
  34. -f Path to file with multiple currency pair options (Fixed values)
  35. (see example factory.txt file for details)
  36. -P Path to file with multiple currency pair options (Percentages)
  37. (see example dynamic.txt file for details)
  38. Message options
  39. ======================================================
  40. -q Quiet - Turn off terminal output
  41. -t Send A Telegram Notice
  42. -T Set notify Line number to use (first line is default)
  43. -s Send A SMS Notice
  44. -M Set sms Line number to use (first line is default)
  45. -S Set smsto Line number to use (first line is default)
  46. -l Show A Linux Notice via zenity
  47. -h display this help menu

Examples (CEX API):

  1. # Get Linux & SMS & Telegram notice when BTC is above 10000 USD (every time command is run)
  2. ./getPrice.sh -c BTC -C USD -av 10000 -lst
  3. # Get Telegram notice when BTC is [above 15000,16000,17000 USD] & [below 14000,13000,12000 USD] (every hour - if run in crontab)
  4. ./getPrice.sh -c BTC -C USD -aA 15000,16000,17000 -bB 14000,13000,12000 -to 1
  5. # Get SMS notice when XRP is [above 2.50,2.60,3 USD] & [below 2.50,2.40,2.30 USD] (only once - if run in crontab)
  6. ./getPrice.sh -c XRP -C USD -aA 2.50,2.60,3 -bB 2.50,2.40,2.30 -so 3
  7. # Get Telegram notice when any currency pair in file meets criteria [fixed amount] (once a day - if run in crontab)
  8. ./getPrice.sh -f /home/coin/factory -to 0
  9. # Get Telegram notice when any currency pair goes below or above 2 percent (every time - if run in crontab)
  10. ./getPrice.sh -c BTC -C USD -tp 2
  11. # Get Telegram notice when any currency pair in file meets criteria [percentage] (every time - if run in crontab)
  12. ./getPrice.sh -P /home/coin/dynamic -t

To use shapeshift API add the -I 2 command:

  1. # Get Linux notice when BTC is above 16 ETH (every time command is run)
  2. ./getPrice.sh -c BTC -C ETH -av 16 -l -I 2

Tested Environments

  • GNU Linux

If you have successfully tested this script on others systems or platforms please let me know!

Running as cron job (ubuntu)

First, open crontab:

  1. $crontab -e

Add the following line at bottom of the file (adapting to your script location!!!):

  1. * * * * * /home/bitnami/coin/getPrice.sh -f /home/bitnami/coin/factory -to 1 -I 2 >> /home/bitnami/coin/coin.log

or

  1. * * * * * /home/bitnami/coin/getPrice.sh -c BTC -C USD -aA 15000,16000,17000 -bB 14000,13000,12000 -to 1 -q
  2. * * * * * /home/bitnami/coin/getPrice.sh -c XRP -C USD -aA 2.50,2.60,3 -bB 2.50,2.40,2.30 -so 3 -q -I 2

Installation Requirements

BASH, JQ, curl, bc, sed, md5sum, awk

Debian & Ubuntu Linux:

These are probably already installed on your system

  1. $sudo apt-get install bash
  2. $sudo apt-get install bc
  3. $sudo apt-get install sed
  4. $sudo apt-get install md5sum
  5. $sudo apt-get install awk

These you may need to install

  1. $sudo apt-get install curl
  2. $sudo apt-get install jq

Donations

Come on buy me a coffee :)

  • PayPal: paypal.me/payvdm
  • Bitcoin: 18vURxYpPFjvNk8BnUy1ovCAyQmY3MzkSf
  • Ethereum: 0x9548144662b47327c954f3e214edb96662d51218