Skip to content
Python

fix(dataflows): state the vintage rule on yfinance statements

Yijia-Xiaob6dad747e925
diff --git a/tradingagents/dataflows/y_finance.py b/tradingagents/dataflows/y_finance.py
index 7bc9dd18a..7ec45a227 100644
--- a/tradingagents/dataflows/y_finance.py
+++ b/tradingagents/dataflows/y_finance.py
@@ -374,7 +374,8 @@ def get_balance_sheet(
# Add header information
header = f"# Balance Sheet data for {canonical} ({freq})\n"
- header += f"# Data retrieved on: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n"
+ header += f"# Data retrieved on: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n"
+ header += _PERIOD_END_VINTAGE
return header + csv_string
@@ -409,7 +410,8 @@ def get_cashflow(
# Add header information
header = f"# Cash Flow data for {canonical} ({freq})\n"
- header += f"# Data retrieved on: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n"
+ header += f"# Data retrieved on: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n"
+ header += _PERIOD_END_VINTAGE
return header + csv_string
@@ -444,7 +446,8 @@ def get_income_statement(
# Add header information
header = f"# Income Statement data for {canonical} ({freq})\n"
- header += f"# Data retrieved on: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n"
+ header += f"# Data retrieved on: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n"
+ header += _PERIOD_END_VINTAGE
return header + csv_string
@@ -454,6 +457,17 @@ def get_income_statement(
return f"Error retrieving income statement for {ticker}: {str(e)}"
+# This vendor dates a statement by the period it covers, not by the day it was
+# filed, and carries no filing date to do better. A company files weeks after its
+# period ends, so a run dated in that gap can be served figures that were not yet
+# public. Say so rather than implying the stricter guarantee (SEC EDGAR, which
+# does carry filing dates, serves US filers as filed).
+_PERIOD_END_VINTAGE = (
+ "# Periods are cut at the fiscal period end; this vendor does not report "
+ "filing dates, so the most recent period may not have been published yet.\n\n"
+)
+
+
def get_insider_transactions(
ticker: Annotated[str, "ticker symbol of the company"],
curr_date: Annotated[str | None, "only filings on or before this date, yyyy-mm-dd"] = None,