Spaces:
Runtime error
Runtime error
jiarongqiu commited on
Commit ·
cab991e
1
Parent(s): cc5c9ae
add capacity
Browse files- service/api.py +8 -0
- service/scheduler.py +2 -0
service/api.py
CHANGED
|
@@ -130,5 +130,13 @@ class API():
|
|
| 130 |
except Exception as e:
|
| 131 |
print(e)
|
| 132 |
return data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
|
| 134 |
api = API()
|
|
|
|
| 130 |
except Exception as e:
|
| 131 |
print(e)
|
| 132 |
return data
|
| 133 |
+
|
| 134 |
+
def get_fvm_storage(self):
|
| 135 |
+
url = "https://dashboard.starboard.ventures/v2/v1/network_core/capacity-services/network_storage_capacity"
|
| 136 |
+
response = requests.get(url)
|
| 137 |
+
data=response.json()['data'][0]
|
| 138 |
+
total_raw_bytes_power = int(data['total_raw_bytes_power'])/1024**6
|
| 139 |
+
total_raw_bytes_power = f"{total_raw_bytes_power:,.1f}"
|
| 140 |
+
return total_raw_bytes_power
|
| 141 |
|
| 142 |
api = API()
|
service/scheduler.py
CHANGED
|
@@ -21,10 +21,12 @@ class Scheduler:
|
|
| 21 |
price = api.get_filecoin_price()
|
| 22 |
deposit = api.get_filecoin_deposit()
|
| 23 |
tvl = api.get_filecoin_tvl()
|
|
|
|
| 24 |
text = """
|
| 25 |
The price of filecoin(FIL) is currently ${} USD.
|
| 26 |
The Total DeFi Net Deposits of filecoin(FIL) is {} FIL.
|
| 27 |
The Total Value Locked(TVL) of filecoin(FIL) is ${} USD.
|
|
|
|
| 28 |
""".format(price,deposit,tvl)
|
| 29 |
vector_store.upsert(text,"dataset_1")
|
| 30 |
|
|
|
|
| 21 |
price = api.get_filecoin_price()
|
| 22 |
deposit = api.get_filecoin_deposit()
|
| 23 |
tvl = api.get_filecoin_tvl()
|
| 24 |
+
total_raw_bytes_power = api.get_fvm_storage()
|
| 25 |
text = """
|
| 26 |
The price of filecoin(FIL) is currently ${} USD.
|
| 27 |
The Total DeFi Net Deposits of filecoin(FIL) is {} FIL.
|
| 28 |
The Total Value Locked(TVL) of filecoin(FIL) is ${} USD.
|
| 29 |
+
The Network Raw Byte Power of the Filecoin Network is {} EiB
|
| 30 |
""".format(price,deposit,tvl)
|
| 31 |
vector_store.upsert(text,"dataset_1")
|
| 32 |
|