Skip to content

Instantly share code, notes, and snippets.

@Felix-Fenix
Forked from chris-gong/coinbase.py
Created March 5, 2021 15:23
Show Gist options
  • Select an option

  • Save Felix-Fenix/534b1a15c493fddd82bbcf094f4c27fc to your computer and use it in GitHub Desktop.

Select an option

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.
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)
@Felix-Fenix
Copy link
Author

курс битка

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment