Skip to content

Instantly share code, notes, and snippets.

Created November 4, 2015 04:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/8ce8ae15a805ec611a31 to your computer and use it in GitHub Desktop.
Save anonymous/8ce8ae15a805ec611a31 to your computer and use it in GitHub Desktop.
#!/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