Skip to content

Instantly share code, notes, and snippets.

@Willamin
Created December 8, 2017 21:53
Show Gist options
  • Save Willamin/490a9a2a6be4eb6fcf2a06301ae3f5f3 to your computer and use it in GitHub Desktop.
Save Willamin/490a9a2a6be4eb6fcf2a06301ae3f5f3 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "json"
address = "some key I found when watching support xmr's dashboard call their api. haven't looked into it further"
output = `curl -s 'https://supportxmr.com/api/miner/#{address}/stats'`
paid = JSON.parse(output)['amtPaid']
due = JSON.parse(output)['amtDue']
total = paid + due
total /= 1_000_000_000_000.0
puts "XMR: #{total}"
monero_to_usd = `curl -s "https://api.coinmarketcap.com/v1/ticker/?convert=usd" | jq '.[] | select(.id == "monero") | .price_usd' | stripcolor | cut -d '"' -f2`.to_f
puts "@ #{monero_to_usd}"
puts "USD: #{total*monero_to_usd}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment