Skip to content

TradingAgents: Multi-Agents LLM Financial Trading Framework

fix(yahoo): report an unreachable Yahoo on insider transactions as unavailable

Yijia-Xiaobbd4d0413a1d
diff --git a/tests/test_no_data_handling.py b/tests/test_no_data_handling.py
index 11635541e..b70ff3354 100644
--- a/tests/test_no_data_handling.py
+++ b/tests/test_no_data_handling.py
@@ -91,3 +91,15 @@ class TestRouteToVendorSentinel(unittest.TestCase):
if __name__ == "__main__":
unittest.main()
+
+
+def test_an_unreachable_yahoo_is_not_reported_as_a_symbol_without_insider_data():
+ from tradingagents.dataflows.errors import VendorRateLimitError
+ from tradingagents.dataflows.vendors.yahoo import fundamentals
+
+ ticker = type("T", (), {"insider_transactions": pd.DataFrame()})()
+ with mock.patch.object(fundamentals.yf, "Ticker", return_value=ticker), \
+ mock.patch.object(fundamentals, "vendor_reachable", return_value=False), \
+ pytest.raises(VendorRateLimitError):
+ fundamentals.get_insider_transactions("AAPL", curr_date="2026-09-21")
diff --git a/tradingagents/dataflows/vendors/yahoo/fundamentals.py b/tradingagents/dataflows/vendors/yahoo/fundamentals.py
index 7684a794a..72974f633 100644
--- a/tradingagents/dataflows/vendors/yahoo/fundamentals.py
+++ b/tradingagents/dataflows/vendors/yahoo/fundamentals.py
@@ -184,6 +184,8 @@ def get_insider_transactions(
return f"# Insider Transactions data for {canonical}\n" + _TRANSACTION_DATE_VINTAGE + data.to_csv()
+ except VendorError:
+ raise
except Exception as e:
raise NoMarketDataError(ticker, canonical, f"insider transactions unavailable: {e}") from e