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

- periods are cut at the fiscal period end and the vendor reports no filing date, so the newest period may not have been published yet
This commit is contained in:
Yijia-Xiao
2026-09-17 02:37:15 +00:00
parent f881c4a111
commit b6dad747e9

View File

@@ -374,7 +374,8 @@ def get_balance_sheet(
# Add header information # Add header information
header = f"# Balance Sheet data for {canonical} ({freq})\n" 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 return header + csv_string
@@ -409,7 +410,8 @@ def get_cashflow(
# Add header information # Add header information
header = f"# Cash Flow data for {canonical} ({freq})\n" 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 return header + csv_string
@@ -444,7 +446,8 @@ def get_income_statement(
# Add header information # Add header information
header = f"# Income Statement data for {canonical} ({freq})\n" 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 return header + csv_string
@@ -454,6 +457,17 @@ def get_income_statement(
return f"Error retrieving income statement for {ticker}: {str(e)}" 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( def get_insider_transactions(
ticker: Annotated[str, "ticker symbol of the company"], ticker: Annotated[str, "ticker symbol of the company"],
curr_date: Annotated[str | None, "only filings on or before this date, yyyy-mm-dd"] = None, curr_date: Annotated[str | None, "only filings on or before this date, yyyy-mm-dd"] = None,