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

- the outage raised for an empty insider table reaches the router as a vendor error, not as a symbol with no data
This commit is contained in:
Yijia-Xiao
2026-09-24 05:00:36 +00:00
parent b176c9374b
commit bbd4d0413a
2 changed files with 14 additions and 0 deletions
+12
View File
@@ -91,3 +91,15 @@ class TestRouteToVendorSentinel(unittest.TestCase):
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()
@pytest.mark.unit
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")
+2
View File
@@ -184,6 +184,8 @@ def get_insider_transactions(
return f"# Insider Transactions data for {canonical}\n" + _TRANSACTION_DATE_VINTAGE + data.to_csv() return f"# Insider Transactions data for {canonical}\n" + _TRANSACTION_DATE_VINTAGE + data.to_csv()
except VendorError:
raise
except Exception as e: except Exception as e:
raise NoMarketDataError(ticker, canonical, f"insider transactions unavailable: {e}") from e raise NoMarketDataError(ticker, canonical, f"insider transactions unavailable: {e}") from e