Skip to content

"Vibe-Trading: Your Personal Trading Agent"

Fixed source code grounding issue

William Liao09618b4157cd
diff --git a/agent/src/agent/grounding.py b/agent/src/agent/grounding.py
index 11ef38651..c2f27e033 100644
--- a/agent/src/agent/grounding.py
+++ b/agent/src/agent/grounding.py
@@ -263,15 +263,15 @@ _INDICATOR_VALUE_RE = re.compile(
_PROSPECTIVE_LEVEL_RE = re.compile(
r"(?:"
# (a) comparison operator immediately before the number
- r"(?:>=|<=|≥|≤|>|<|大于|小于|不低于|不高于|高于|低于)\s*[-+]?\d[\d,]*(?:\.\d+)?"
+ r"(?:>=|<=|≥|≤|>|<|大于|小于|不低于|不高于|高于|低于)\s*\$?\s*[-+]?\d[\d,]*(?:\.\d+)?"
r"|"
# (b) a level marker introducing the number
r"(?:目标位|目标区|目标价|止损位?|止盈位?|触发价|触发位|触发点|上看|下看|"
r"target\s+(?:price|level|zone)|trigger|stop[-\s]?loss|take[-\s]?profit)"
- r"\s*(?:为|是|至|到|on|at|of|=)?\s*[::]?\s*[-+]?\d[\d,]*(?:\.\d+)?"
+ r"\s*(?:为|是|至|到|on|at|of|=)?\s*[::]?\s*\$?\s*[-+]?\d[\d,]*(?:\.\d+)?"
r"|"
# (c) the number followed by a level marker
- r"[-+]?\d[\d,]*(?:\.\d+)?\s*(?:一线|附近)?\s*(?:成为?|作为|是)?\s*"
+ r"\$?[-+]?\d[\d,]*(?:\.\d+)?\s*(?:一线|附近)?\s*(?:成为?|作为|是)?\s*"
r"(?:目标区|目标位|止损位|止盈位)"
r"|"
# (d) a conditional opener before the number, digits fencing the reach
diff --git a/agent/tests/test_agent_grounding.py b/agent/tests/test_agent_grounding.py
index 374ed204b..1eba0c753 100644
--- a/agent/tests/test_agent_grounding.py
+++ b/agent/tests/test_agent_grounding.py
@@ -1295,6 +1295,15 @@ _PLAN_LEVELS_FROM_983 = [
"目标位 6.80,止损 5.20",
"若收盘 5.36 则减仓",
"target price 6.80 with stop-loss 5.20",
+ # A `$` currency prefix must not break the mask (false-positive fix,
+ # observed in the Aug 2026 RXRX/BFLY runs: <$2.86 and 目标价 $3.50 were
+ # rejected as conflicts because the `$` sat between the operator/marker
+ # and the digit).
+ "硬触发: 收盘 <$2.86 且量 >2000 万股",
+ "收盘 < $2.86 且量 > 2000 万股",
+ "目标价 $3.50",
+ "目标价 $3.50 两档挂单",
+ "触发价 $4.00",
]
@@ -1317,6 +1326,10 @@ _ASSERTIONS_THAT_MUST_STAY_CHECKED = [
# A conditional opener must not reach back over a quote already made.
("收盘 6.03,若跌破 5.36 减仓", [6.03]),
("开盘 6.80 最高 7.18 最低 6.68", [6.80, 7.18, 6.68]),
+ # A `$` alone is NOT prospective: an observed quote written with a
+ # currency prefix and no marker/operator must stay checked.
+ ("现价 $5.97", [5.97]),
+ ("开盘 $6.80 最高 $7.18 最低 $6.68", [6.80, 7.18, 6.68]),
]