Spaces:
Runtime error
Runtime error
add retry to getting tao price
Browse files
app.py
CHANGED
@@ -68,8 +68,15 @@ class ModelData:
|
|
68 |
emission=emission
|
69 |
)
|
70 |
|
71 |
-
def get_tao_price():
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
def print_validator_weights(metagraph: bt.metagraph):
|
75 |
for uid in metagraph.uids.tolist():
|
|
|
68 |
emission=emission
|
69 |
)
|
70 |
|
71 |
+
def get_tao_price() -> float:
|
72 |
+
for i in range(0, METAGRAPH_RETRIES):
|
73 |
+
try:
|
74 |
+
return float(requests.get("https://api.kucoin.com/api/v1/market/stats?symbol=TAO-USDT").json()["data"]["last"])
|
75 |
+
except:
|
76 |
+
if i == METAGRAPH_RETRIES - 1:
|
77 |
+
raise
|
78 |
+
time.sleep(METAGRAPH_DELAY_SECS)
|
79 |
+
raise RuntimeError()
|
80 |
|
81 |
def print_validator_weights(metagraph: bt.metagraph):
|
82 |
for uid in metagraph.uids.tolist():
|