Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(sentiment): remove low from bullish lexicon, fix dual polarity

Lanre Shittueea769d4bdd1
diff --git a/agent/src/tools/sentiment_tool.py b/agent/src/tools/sentiment_tool.py
index c439bc208..e29041d1d 100644
--- a/agent/src/tools/sentiment_tool.py
+++ b/agent/src/tools/sentiment_tool.py
@@ -24,7 +24,7 @@ _POSITIVE: frozenset[str] = frozenset({
"beat", "beats", "bullish", "buy", "cheap", "crush", "crushed",
"crushing", "gain", "gained", "gaining", "gains", "green",
"growth", "high", "higher", "hit", "improve", "improved",
- "jump", "jumped", "lead", "leading", "leads", "long", "low",
+ "jump", "jumped", "lead", "leading", "leads", "long",
"opportunity", "outperform", "outperformed", "profit", "profitable",
"profits", "raise", "raised", "raises", "rally", "rallied",
"rebound", "record", "rise", "rises", "rising", "rose",
diff --git a/agent/tests/test_sentiment_tool.py b/agent/tests/test_sentiment_tool.py
index 542913fc6..f3f5e4e62 100644
--- a/agent/tests/test_sentiment_tool.py
+++ b/agent/tests/test_sentiment_tool.py
@@ -76,6 +76,16 @@ class TestScoreText:
r = _score_text("123 456 !!! ???")
assert r["score"] == 0.0
+ def test_lexicons_are_disjoint(self):
+ from src.tools.sentiment_tool import _NEGATIVE, _POSITIVE
+ assert _POSITIVE & _NEGATIVE == frozenset()
+
+ def test_new_low_is_bearish(self):
+ r = _score_text("shares tumbled to a new low today")
+ assert r["score"] < 0
+ assert r["negative"] == 1
+ assert r["positive"] == 0
+
class TestSentimentTool:
def test_missing_mode(self):