Created
November 4, 2015 04:50
-
-
Save anonymous/8ce8ae15a805ec611a31 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/python | |
''' | |
1. put this in your $PATH | |
2. create a crontab that runs it every x minutes and writes the output to a file | |
for example: | |
$ crontab -e | |
* * * * * ~/btc.py > ~/btcprice | |
3. set your shell prompt to include the first line of this file | |
''' | |
import requests | |
import json | |
import sys | |
import datetime | |
req = requests.get('https://api.coinbase.com/v2/prices/sell') | |
req = json.loads(req.text) | |
print req['data']['amount'] | |
print datetime.datetime.now() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment