-
-
Save anonymous/b51025c4a01baaf71544 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'json' | |
require 'net/http' | |
require 'uri' | |
require 'pp' | |
def getjson(urlvar) | |
return JSON.parse(Net::HTTP.get_response(URI.parse(urlvar)).body) # Parse urlvar, send a request to it, and parse the response. | |
end | |
while true do | |
puts `clear` | |
File.open('coins', 'r').each_line do |coinname| | |
c = getjson("http://coinmarketcap.northpole.ro/api/#{coinname.gsub(/\s+/, "")}.json") | |
puts "#{c['name']}: $#{c['price']}" | |
puts "Volume (24h): #{c['volume24']} | Price change (24h): #{c['change24']}" | |
end | |
sleep 300 # 5 minutes. | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment