Browse Source

Refresh grid market values on render

Lukas Goldschmidt 1 month ago
parent
commit
954304d95a
1 changed files with 8 additions and 0 deletions
  1. 8 0
      strategies/grid_trader.py

+ 8 - 0
strategies/grid_trader.py

@@ -606,6 +606,14 @@ class Strategy(Strategy):
         return {"action": "hold" if mode == "active" else "plan", "price": price, "deviation": deviation}
 
     def render(self):
+        # Refresh the market-derived display values on render so the dashboard
+        # reflects the same inputs the strategy would use on the next tick.
+        try:
+            self._refresh_balance_snapshot()
+            self._grid_step_pct()
+        except Exception as exc:
+            self._log(f"render refresh failed: {exc}")
+
         return {
             "widgets": [
                 {"type": "metric", "label": "market", "value": self._market_symbol()},