Fix: Sanitizing API response to resolve JSON float out-of-range error (NaN)
Browse files- app/api/v1/signals.py +2 -2
app/api/v1/signals.py
CHANGED
|
@@ -13,7 +13,7 @@ async def get_jewels(limit: int = Query(20, gt=0)):
|
|
| 13 |
if not os.path.exists(path):
|
| 14 |
return []
|
| 15 |
|
| 16 |
-
df = pd.read_csv(path)
|
| 17 |
# Return last 'limit' items (newest first)
|
| 18 |
data = df.tail(limit).to_dict(orient="records")
|
| 19 |
return data[::-1]
|
|
@@ -25,6 +25,6 @@ async def get_raw_signals(limit: int = Query(50, gt=0)):
|
|
| 25 |
if not os.path.exists(path):
|
| 26 |
return []
|
| 27 |
|
| 28 |
-
df = pd.read_csv(path)
|
| 29 |
data = df.tail(limit).to_dict(orient="records")
|
| 30 |
return data[::-1]
|
|
|
|
| 13 |
if not os.path.exists(path):
|
| 14 |
return []
|
| 15 |
|
| 16 |
+
df = pd.read_csv(path).fillna("")
|
| 17 |
# Return last 'limit' items (newest first)
|
| 18 |
data = df.tail(limit).to_dict(orient="records")
|
| 19 |
return data[::-1]
|
|
|
|
| 25 |
if not os.path.exists(path):
|
| 26 |
return []
|
| 27 |
|
| 28 |
+
df = pd.read_csv(path).fillna("")
|
| 29 |
data = df.tail(limit).to_dict(orient="records")
|
| 30 |
return data[::-1]
|