Spaces:
Running
Running
Update restful/onnx_utilities.py
Browse files
restful/onnx_utilities.py
CHANGED
@@ -17,7 +17,7 @@ class Utilities:
|
|
17 |
# return float(Decimal(str(val)).quantize(Decimal('0.01'), rounding=ROUND_DOWN))
|
18 |
def truncate_2_decimal(self, val: float):
|
19 |
try:
|
20 |
-
return float(Decimal(str(float(val))).quantize(Decimal('0.
|
21 |
except Exception as e:
|
22 |
print("Decimal error:", e)
|
23 |
return float(val)
|
@@ -68,7 +68,7 @@ class Utilities:
|
|
68 |
# last_date += pd.Timedelta(days=1)
|
69 |
last_date = pd.to_datetime(last_date) + pd.Timedelta(days=1)
|
70 |
# predicted_prices[last_date.strftime('%Y-%m-%d')] = float(denorm_price)
|
71 |
-
predicted_prices[last_date] =
|
72 |
|
73 |
lst_seq = np.roll(lst_seq, shift=-1, axis=1)
|
74 |
lst_seq[:, -1, -1] = value
|
@@ -87,7 +87,7 @@ class Utilities:
|
|
87 |
close_denorm = self.denormalization(close_values, min_close, max_close)
|
88 |
|
89 |
actuals = [
|
90 |
-
{'date': to_datetime(date).strftime('%Y-%m-%d'), 'price':
|
91 |
for date, price in zip(df_date, close_denorm)
|
92 |
]
|
93 |
|
|
|
17 |
# return float(Decimal(str(val)).quantize(Decimal('0.01'), rounding=ROUND_DOWN))
|
18 |
def truncate_2_decimal(self, val: float):
|
19 |
try:
|
20 |
+
return float(Decimal(str(float(val))).quantize(Decimal('0.0001'), rounding=ROUND_DOWN))
|
21 |
except Exception as e:
|
22 |
print("Decimal error:", e)
|
23 |
return float(val)
|
|
|
68 |
# last_date += pd.Timedelta(days=1)
|
69 |
last_date = pd.to_datetime(last_date) + pd.Timedelta(days=1)
|
70 |
# predicted_prices[last_date.strftime('%Y-%m-%d')] = float(denorm_price)
|
71 |
+
predicted_prices[last_date] = float(denorm_price)
|
72 |
|
73 |
lst_seq = np.roll(lst_seq, shift=-1, axis=1)
|
74 |
lst_seq[:, -1, -1] = value
|
|
|
87 |
close_denorm = self.denormalization(close_values, min_close, max_close)
|
88 |
|
89 |
actuals = [
|
90 |
+
{'date': to_datetime(date).strftime('%Y-%m-%d'), 'price': float(price)}
|
91 |
for date, price in zip(df_date, close_denorm)
|
92 |
]
|
93 |
|