mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-09-27 06:56:39 +03:00
refactor(graph): settle past decisions in graph/settlement.py
- resolve_benchmark, fetch_returns and settle_pending are module functions; the graph's settle_pending runs them under its config - create_run_state settles through settle_pending, so the CLI path also settles under the graph's config
This commit is contained in:
@@ -140,15 +140,18 @@ def test_concurrent_runs_each_read_their_own_config():
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_settling_reads_the_graphs_own_config():
|
||||
def test_settling_reads_the_graphs_own_config(monkeypatch):
|
||||
from tradingagents.dataflows.router import get_vendor
|
||||
|
||||
config = copy.deepcopy(default_config.DEFAULT_CONFIG)
|
||||
config["tool_vendors"] = {"get_stock_data": "alpha_vantage"}
|
||||
graph = _graph(config)
|
||||
graph.memory_log = graph.reflector = None # the settlement below is a stand-in
|
||||
seen = []
|
||||
graph._resolve_pending_entries = lambda ticker: seen.append(
|
||||
get_vendor("core_stock_apis", "get_stock_data"))
|
||||
from tradingagents.graph import settlement
|
||||
|
||||
monkeypatch.setattr(settlement, "settle_pending",
|
||||
lambda *a: seen.append(get_vendor("core_stock_apis", "get_stock_data")))
|
||||
|
||||
graph.settle_pending("AAPL")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user