Created
May 15, 2019 00:20
-
-
Save chris-gong/b24130f5ea0c6c93e3c24bfb4aca27fd to your computer and use it in GitHub Desktop.
Code for sending requests to the coinbase api and receiving price data as a json response.
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
import requests | |
import json | |
import time | |
while True : | |
response = requests.get("https://api.coinbase.com/v2/prices/BTC-USD/spot") | |
data = response.json() | |
currency = data["data"]["base"] | |
price = data["data"]["amount"] | |
print(f"Currency : {currency} Price: {price}") | |
time.sleep(5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome