Created
August 14, 2017 04:04
-
-
Save qrkourier/cbe2d36f861a2d301c9754a1751db610 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/env python | |
# | |
# @qrkourier (2017) | |
# | |
# print the estimated USD yield for a given Ethermine API URL | |
# | |
# $ ethermine-yield.py https://ethermine.org/api/miner_new/9a0C4548c8b827e01aF1dc3AF9373830 | |
# $1.28/day | |
# $8.97/week | |
# $38.99/month | |
import sys, json, requests | |
url = sys.argv[1] | |
try: | |
response = requests.get(url=url) | |
except requests.ConnectionError as e: | |
raise(e) | |
data = json.loads(response.text) | |
print('$'+str(round(data['usdPerMin'] * 60 * 24,2))+'/day') | |
print('$'+str(round(data['usdPerMin'] * 60 * 24 * 7,2))+'/week') | |
print('$'+str(round(data['usdPerMin'] * 60 * 24 * 30.4375,2))+'/month') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment