mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-09-27 15:02:39 +03:00
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:
@@ -91,3 +91,15 @@ class TestRouteToVendorSentinel(unittest.TestCase):
|
||||
|
||||
if __name__ == "__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")
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user