Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(market-screener): request decimal prices and percents from push2

Rudy Mizrahi Celekli861ac35441e8
diff --git a/agent/src/tools/market_screener_tool.py b/agent/src/tools/market_screener_tool.py
index 66a1b9a8e..498e5291d 100644
--- a/agent/src/tools/market_screener_tool.py
+++ b/agent/src/tools/market_screener_tool.py
@@ -143,6 +143,9 @@ def _screen_market(market: str, *, sort_by: str, top_n: int) -> list[dict[str, A
"fid": _SORT_FID[sort_by],
"fs": _MARKET_FS[market],
"fields": _FIELDS,
+ # Without fltt=2 push2 sends prices and percents as scaled
+ # integers (3.03 -> 303, 10.18% -> 1018).
+ "fltt": "2",
},
)
data = payload.get("data") if isinstance(payload, dict) else None
diff --git a/agent/tests/test_market_screener_tool.py b/agent/tests/test_market_screener_tool.py
index 21974e40b..201c66bf5 100644
--- a/agent/tests/test_market_screener_tool.py
+++ b/agent/tests/test_market_screener_tool.py
@@ -89,6 +89,16 @@ class TestSuccessEnvelope:
assert params["pz"] == "5"
assert params["fs"] == "m:105,m:106,m:107" # US universe
+ def test_requests_decimal_prices_and_percents(self):
+ # The row parser reads f2/f3/f4/f8 as decimals (1688.0, 9.98). push2
+ # only sends them that way with fltt=2; otherwise 3.03 arrives as 303.
+ with patch(
+ "src.tools.market_screener_tool.get_json", return_value=_CLIST_PAYLOAD
+ ) as mock_get:
+ MarketScreenerTool().execute(market="a", sort_by="change_pct", top_n=5)
+
+ assert mock_get.call_args.kwargs["params"]["fltt"] == "2"
+
def test_diff_as_dict_is_normalized(self):
dict_diff = {"data": {"diff": {"0": _CLIST_PAYLOAD["data"]["diff"][0]}}}
with patch(