Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(runs): keep sub-micro prices in reconstructed chart rows

Rudy Celekli0f4bfb978a54
diff --git a/agent/src/ui_services.py b/agent/src/ui_services.py
index 4c1dc90de..7eb956622 100644
--- a/agent/src/ui_services.py
+++ b/agent/src/ui_services.py
@@ -630,10 +630,10 @@ def _flatten_data_map(data_map: Dict[str, Any], start_date: str) -> List[Dict[st
"time": pd.Timestamp(timestamp).strftime("%Y-%m-%d"),
"timestamp": pd.Timestamp(timestamp).strftime("%Y-%m-%d"),
"code": code,
- "open": round(float(row.get("open") or 0.0), 6),
- "high": round(float(row.get("high") or 0.0), 6),
- "low": round(float(row.get("low") or 0.0), 6),
- "close": round(float(row.get("close") or 0.0), 6),
+ "open": float(row.get("open") or 0.0),
+ "high": float(row.get("high") or 0.0),
+ "low": float(row.get("low") or 0.0),
+ "close": float(row.get("close") or 0.0),
"volume": round(float(row.get("volume") or 0.0), 6),
}
)
diff --git a/agent/tests/test_ui_services.py b/agent/tests/test_ui_services.py
index 785184388..b803f47b5 100644
--- a/agent/tests/test_ui_services.py
+++ b/agent/tests/test_ui_services.py
@@ -388,3 +388,24 @@ def test_fetch_stops_when_fallbacks_leave_symbols_missing(
"source": "primary",
}
)
+
+
+def test_reconstructed_price_rows_keep_sub_micro_prices() -> None:
+ from src.ui_services import _flatten_data_map
+
+ frame = pd.DataFrame(
+ {
+ "open": [0.00000912],
+ "high": [0.00000951],
+ "low": [0.00000887],
+ "close": [0.00000934],
+ "volume": [1.0],
+ },
+ index=pd.DatetimeIndex([pd.Timestamp("2026-01-01")]),
+ )
+
+ [row] = _flatten_data_map({"PEPE-USDT": frame}, start_date="2026-01-01")
+
+ assert (row["open"], row["high"], row["low"], row["close"]) == pytest.approx(
+ (0.00000912, 0.00000951, 0.00000887, 0.00000934)
+ )