-
-
Save Felix-Fenix/534b1a15c493fddd82bbcf094f4c27fc 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 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
| 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) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
курс битка