What's New
Earnings Patch Module
When API data (e.g. yfinance) lags behind actual earnings releases, the new data.patch module allows patching Stock objects with manually collected quarterly earnings data.
apply_earnings_patch(stock, patch)— computes TTM metrics using partial TTM formula:sum(NQ) + API_annual × (4-N)/4load_patch_from_json(path)— load patch data from JSON fileis_patched/data_provenanceproperties on Stock — track which fields use patched data--earnings-patchCLI flag onfetch_stock_data.py— inject patch via JSON file
Example
from valueinvest.data.patch import EarningsPatch, QuarterlyEarnings, apply_earnings_patch
patch = EarningsPatch(
ticker="ADBE",
source_description="SEC 10-Q filed June 11, 2026",
quarters=[
QuarterlyEarnings(
quarter_label="Q2 FY2026", end_date="2026-05-31",
revenue=5_871_000_000, net_income=1_833_000_000, eps=4.06,
operating_cash_flow=2_280_000_000, capex=85_000_000,
sbc=380_000_000, depreciation=150_000_000,
ebit=2_560_000_000, ebitda=2_710_000_000,
),
],
)
result = apply_earnings_patch(stock, patch)python scripts/fetch_stock_data.py ADBE --earnings-patch /tmp/adbe_patch.jsonTesting
47 unit tests (20 core + 27 edge cases) — all passing.
Full changelog: https://github.com/wangzhe3224/valueinvest/blob/main/CHANGELOG.md