If you would like to send yourself push notifications when one of the crypto currencies you are watching hits a certain threshold and you want to play around with a little coding, this is for you!
We will be using Ruby and the free application Prowl.
The first thing we need to do is setup a Prowl account and download the Prowl app from the App Store.
Creating an account.
Visit Prowl App and create an account.
Once your account has been created, click on the API Keys
tab
to access your api key. You will need this to send push notifications to your iPhone.
Download Prowl from the App Store
On Your Computer
Now to the fun part! Ruby has came pre-installed on the Mac for awhile now so unless you have a very old computer, you should have it. We will proceed in the assumption that ruby is installed.
Open up the Terminal application. You can find it here:
/Applications/Utilities/Terminal.app
There is a Prowl gem that we will be using from Ruby.
Install it with the following command.
sudo gem install prowl
The following is a Ruby script that will run every five minutes and send a push notification to the Prowl app on your phone if the price of Steem drops below .14 cents.
Save this text to a file and name it like get_price.rb
.
Add your apikey
.
Change the application
name to your liking.
Run the program like so:
ruby name_of_file.rb
To stop the program:
control + c
Enjoy!
require 'json'
require 'net/http'
require 'uri'
require 'prowl'
def number_for(float)
"$#{float.round(2)}"
end
alert_price = 0.13999
crypto = 'steem' # could be any that cryptonator supports
url = "https://api.cryptonator.com/api/ticker/#{crypto}-usd"
uri = URI.parse(url)
while true do
res = Net::HTTP.get_response(uri)
price = JSON.parse(res.body)["ticker"]["price"].to_f
# Log information while the program is running.
puts "#{number_for(price)} at #{(Time.now.utc).strftime("%Y-%m-%d %H:%M")}"
if price <= alert_price
Prowl.add(
apikey: "your-api-key",
application: "Whatever Name You Want",
event: "changed",
description: "#{crypto.capitalize} price down: #{price}"
)
end
sleep 5*60
end
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit