Python
refactor: name the decision log module tradingagents/memory.py
Yijia-Xiao51066935b83c
diff --git a/tests/test_backtest.py b/tests/test_backtest.pyindex e86d40973..e9aab6c20 100644--- a/tests/test_backtest.py+++ b/tests/test_backtest.py@@ -11,7 +11,7 @@ from __future__ import annotationsimport pytestfrom tradingagents.backtest import iter_grid, run_backtest, summarize-from tradingagents.decision_log import TradingMemoryLog+from tradingagents.memory import TradingMemoryLogDECISION = "Rating: Buy\n\nbuy it"diff --git a/tests/test_cli_decision_log.py b/tests/test_cli_decision_log.pyindex be695b095..d8cf89da3 100644--- a/tests/test_cli_decision_log.py+++ b/tests/test_cli_decision_log.py@@ -12,8 +12,8 @@ from __future__ import annotationsimport pytestimport cli.run as cli_run-from tradingagents.decision_log import TradingMemoryLogfrom tradingagents.graph.trading_graph import TradingAgentsGraph+from tradingagents.memory import TradingMemoryLogdef _bare_graph(tmp_path):diff --git a/tests/test_memory_log.py b/tests/test_memory_log.pyindex 42dc34b11..807335b4a 100644--- a/tests/test_memory_log.py+++ b/tests/test_memory_log.py@@ -7,11 +7,11 @@ import pytestfrom tradingagents.agents.managers.portfolio_manager import create_portfolio_managerfrom tradingagents.agents.schemas import PortfolioDecision, PortfolioRating-from tradingagents.decision_log import TradingMemoryLogfrom tradingagents.graph import settlementfrom tradingagents.graph.propagation import Propagatorfrom tradingagents.graph.reflection import Reflectorfrom tradingagents.graph.trading_graph import TradingAgentsGraph+from tradingagents.memory import TradingMemoryLog_SEP = TradingMemoryLog._SEPARATOR@@ -863,12 +863,12 @@ class TestLegacyRemoval:def test_financial_situation_memory_removed(self):"""FinancialSituationMemory must not be importable from the memory module."""- import tradingagents.decision_log as m+ import tradingagents.memory as massert not hasattr(m, "FinancialSituationMemory")def test_bm25_not_imported(self):"""rank_bm25 must not be present in the memory module namespace."""- import tradingagents.decision_log as m+ import tradingagents.memory as massert not hasattr(m, "BM25Okapi")def test_reflect_and_remember_removed(self):@@ -934,8 +934,8 @@ class TestLegacyRemoval:def test_a_failed_reflection_leaves_the_entry_pending_and_lets_the_run_start(tmp_path, monkeypatch):"""Settling past decisions happens on the way into a new run, and reflectioncalls an LLM. A transient failure there must not stop the new analysis."""- from tradingagents.decision_log import TradingMemoryLogfrom tradingagents.graph.trading_graph import TradingAgentsGraph+ from tradingagents.memory import TradingMemoryLoggraph = object.__new__(TradingAgentsGraph)graph.config = {"memory_log_path": str(tmp_path / "m.md")}@@ -967,8 +967,8 @@ def test_a_failed_reflection_leaves_the_entry_pending_and_lets_the_run_start(tmpdef test_the_holding_window_is_configurable(tmp_path, monkeypatch):"""A decision written for months should not be graded at a week without theoperator choosing that window."""- from tradingagents.decision_log import TradingMemoryLogfrom tradingagents.graph.trading_graph import TradingAgentsGraph+ from tradingagents.memory import TradingMemoryLoggraph = object.__new__(TradingAgentsGraph)graph.config = {"memory_log_path": str(tmp_path / "m.md"), "holding_period_days": 21}diff --git a/tests/test_memory_pointintime.py b/tests/test_memory_pointintime.pyindex 6adaf082d..c61a1d707 100644--- a/tests/test_memory_pointintime.py+++ b/tests/test_memory_pointintime.py@@ -10,7 +10,7 @@ from __future__ import annotationsimport pytest-from tradingagents.decision_log import TradingMemoryLog+from tradingagents.memory import TradingMemoryLogdef _log(tmp_path):diff --git a/tests/test_portfolio_context.py b/tests/test_portfolio_context.pyindex b48481e39..3da81b5fe 100644--- a/tests/test_portfolio_context.py+++ b/tests/test_portfolio_context.py@@ -76,9 +76,9 @@ def test_load_reads_a_valid_file(tmp_path):# --- threading through the graph --------------------------------------------def _bare_graph(tmp_path):- from tradingagents.decision_log import TradingMemoryLogfrom tradingagents.graph.propagation import Propagatorfrom tradingagents.graph.trading_graph import TradingAgentsGraph+ from tradingagents.memory import TradingMemoryLoggraph = object.__new__(TradingAgentsGraph)graph.config = {"memory_log_path": str(tmp_path / "m.md"), "max_debate_rounds": 1,diff --git a/tests/test_rating_integrity.py b/tests/test_rating_integrity.pyindex 1ee0a4c87..692ad918a 100644--- a/tests/test_rating_integrity.py+++ b/tests/test_rating_integrity.py@@ -64,7 +64,7 @@ def test_the_scale_quoted_in_a_prompt_does_not_become_the_rating():@pytest.mark.unitdef test_the_memory_log_records_review_rather_than_a_tradeable_hold(tmp_path):- from tradingagents.decision_log import TradingMemoryLog+ from tradingagents.memory import TradingMemoryLoglog = TradingMemoryLog({"memory_log_path": str(tmp_path / "m.md")})log.store_decision("NVDA", "2026-01-05", REFUSAL)@@ -76,7 +76,7 @@ def test_the_memory_log_records_review_rather_than_a_tradeable_hold(tmp_path):@pytest.mark.unitdef test_the_signal_and_the_log_agree_on_the_same_decision(tmp_path):from tradingagents.agents.rating import parse_rating- from tradingagents.decision_log import TradingMemoryLog+ from tradingagents.memory import TradingMemoryLoglog = TradingMemoryLog({"memory_log_path": str(tmp_path / "m.md")})for text in (INVERTED, REFUSAL, "**Rating**: Buy\n\nAccumulate."):@@ -91,7 +91,7 @@ def test_the_signal_and_the_log_agree_on_the_same_decision(tmp_path):def test_an_unscored_decision_is_left_out_of_the_backtest_figures(tmp_path):"""REVIEW has no direction, so it cannot count for or against the system."""from tradingagents.backtest import summarize- from tradingagents.decision_log import TradingMemoryLog+ from tradingagents.memory import TradingMemoryLoglog = TradingMemoryLog({"memory_log_path": str(tmp_path / "m.md")})log.store_decision("NVDA", "2026-01-05", "**Rating**: Buy\n\nx")diff --git a/tradingagents/backtest.py b/tradingagents/backtest.pyindex 65c4d9a6a..b249b4e96 100644--- a/tradingagents/backtest.py+++ b/tradingagents/backtest.py@@ -24,8 +24,8 @@ from pathlib import Pathfrom tradingagents.agents.rating import RATING_REVIEWfrom tradingagents.dataflows.date_window import get_current_datefrom tradingagents.dataflows.symbols import safe_ticker_component-from tradingagents.decision_log import TradingMemoryLogfrom tradingagents.graph.trading_graph import TradingAgentsGraph+from tradingagents.memory import TradingMemoryLoglogger = logging.getLogger(__name__)diff --git a/tradingagents/graph/trading_graph.py b/tradingagents/graph/trading_graph.pyindex 8169decc4..6717ef397 100644--- a/tradingagents/graph/trading_graph.py+++ b/tradingagents/graph/trading_graph.py@@ -11,9 +11,9 @@ from tradingagents.agents.rating import parse_ratingfrom tradingagents.dataflows.config import run_config, set_configfrom tradingagents.dataflows.date_window import get_current_datefrom tradingagents.dataflows.symbols import safe_ticker_component-from tradingagents.decision_log import TradingMemoryLogfrom tradingagents.default_config import DEFAULT_CONFIGfrom tradingagents.llm_clients import build_llm_kwargs, create_llm_client+from tradingagents.memory import TradingMemoryLogfrom tradingagents.reporting import write_report_treefrom . import settlementdiff --git a/tradingagents/decision_log.py b/tradingagents/memory.pysimilarity index 100%rename from tradingagents/decision_log.pyrename to tradingagents/memory.py