| | |
| | | |
| | | |
| | | def label_for(price: float, base_range: tuple[float, float], optimistic_range: tuple[float, float]) -> str: |
| | | if price < base_range[0] * 0.90: |
| | | if price < base_range[0]: |
| | | return "偏低" |
| | | if price <= base_range[1]: |
| | | return "基本合理" |
| | |
| | | "institution": f"东方财富公开一致预期汇总(覆盖池{forecast_data['count']}家)", |
| | | "report_date": AS_OF, "include": True, |
| | | "core_assumption": "C1汇总快照缺逐家报告日期;仅作市场预期锚,不替代法定利润。", |
| | | "source_id": "SRC-EM-CONSENSUS-20260813", |
| | | "source_id": f"SRC-EM-CONSENSUS-{STAMP}", |
| | | "estimates": {year: values for year, values in forecast_data["years"].items() if year in {"2026", "2027", "2028"}}, |
| | | }) |
| | | shares_match = abs(float(report_proof["report_shares"]) - shares) <= max(100.0, shares * 0.000001) |
| | |
| | | sources = [ |
| | | {"id": "SRC-ANNUAL-2025", "source_type": disclosure_source_type(annual["url"]), "title": annual["title"], "publish_date": annual["publish_date"], "period_end": "2025-12-31", "url": annual["url"], "supports": ["financials.annual", "business", "profit_sources"], "revision_status": "current"}, |
| | | {"id": "SRC-CURRENT-2026", "source_type": disclosure_source_type(current["url"]), "title": current["title"], "publish_date": current["publish_date"], "period_end": finance["current_cumulative"]["period_end"], "url": current["url"], "supports": ["financials.current_cumulative", "financials.prior_year_same_period", "balance_sheet", "balance_sheet.equity"], "revision_status": "current"}, |
| | | {"id": "SRC-EM-FINANCE-20260813", "source_type": "financial_mirror", "title": "东方财富结构化财务字段与法定报告勾稽", "publish_date": current["publish_date"], "period_end": finance["current_cumulative"]["period_end"], "url": "https://datacenter-web.eastmoney.com/api/data/v1/get", "supports": ["financials", "balance_sheet"], "revision_status": "current"}, |
| | | {"id": f"SRC-EM-FINANCE-{STAMP}", "source_type": "financial_mirror", "title": "东方财富结构化财务字段与法定报告勾稽", "publish_date": current["publish_date"], "period_end": finance["current_cumulative"]["period_end"], "url": "https://datacenter-web.eastmoney.com/api/data/v1/get", "supports": ["financials", "balance_sheet"], "revision_status": "current"}, |
| | | {"id": "SRC-LOCAL-FRONT-KLINE", "source_type": "quote_provider", "title": "trading_xuntou前复权日K完整收盘价", "publish_date": AS_OF, "period_end": AS_OF, "url": "mysql://trading_xuntou/cn_stock_kline_1d_front", "supports": ["market.price", "market.price_timestamp", "market.amount", "analysis.kline"], "revision_status": "current"}, |
| | | shares_source, |
| | | ] |
| | | if forecasts: |
| | | sources.append({"id": "SRC-EM-CONSENSUS-20260813", "source_type": "institution_aggregator", "title": "东方财富盈利预测汇总", "publish_date": AS_OF, "period_end": AS_OF, "url": "https://datacenter-web.eastmoney.com/api/data/v1/get?reportName=RPT_WEB_RESPREDICT", "supports": ["institutions"], "revision_status": "current"}) |
| | | sources.append({"id": f"SRC-EM-CONSENSUS-{STAMP}", "source_type": "institution_aggregator", "title": "东方财富盈利预测汇总", "publish_date": AS_OF, "period_end": AS_OF, "url": "https://datacenter-web.eastmoney.com/api/data/v1/get?reportName=RPT_WEB_RESPREDICT", "supports": ["institutions"], "revision_status": "current"}) |
| | | |
| | | snapshot = { |
| | | "snapshot_id": f"SNAPSHOT-{target.ticker[:6]}-{STAMP}-INDUSTRY-GAP-V1", |