I would like to have the value return a response based on the output of the value within the specified range.
import requests
import json
import time
url = 'https://api.gdax.com/products/BTC-USD/trades'
res = requests.get(url)
json_res = json.loads(res.text)
print('val ', json_res[0]['price'])
buy = range(32000, 36000)
sell = range(39000, 50000)
if json_res in buy:
print('Low')
elif json_res in sell:
print('Too High')
This is an example of the output I'm looking for
val 38000.00002545
Too High
Aucun commentaire:
Enregistrer un commentaire