Backfill recent review stock names
Request: Explain and fix why the recent 30-day listed IPO review showed data_gap in the 股票名 column. Cause: The recent review sample was seeded from HKEX annual new-listing reports, which only carried English issuer names in ipo_master. The archived ipohk external history already had display stock names, but build_analysis_dataset.py did not expose external_ipo_history.stock_name as a stock_short_name fallback. Changes: - Use external_ipo_history.stock_name as a stock_short_name fallback in the analysis dataset after the official/master and market-heat display-name sources. - Backfill blank ipo_master.stock_short_name values when future ipohk history archives carry a stock name. - Document the external-history display-name fallback in the analyst skill. - Refresh the latest report and README so the recent 30-day review shows stock names for 00901, 02723, 03310, 03388, 02553, 01081, 01779, and 02290. Verification: - python3 /root/.codex/skills/.system/skill-creator/scripts/quick_validate.py .agents/skills/hk-ipo-analyst - .venv/bin/python -m py_compile scripts/archive_ipohk_history.py scripts/build_analysis_dataset.py - git diff --check - Rebuilt analysis_model_v0_dataset.csv for 2026-06-23T10:59:36Z - Python check that README matches the dated latest report and recent-review stock-name cells are no longer data_gap
This commit is contained in:
@@ -177,6 +177,17 @@ def upsert_history(
|
||||
notes,
|
||||
),
|
||||
)
|
||||
stock_name = str(row.get("name") or "").strip()
|
||||
if stock_name:
|
||||
conn.execute(
|
||||
"""
|
||||
UPDATE ipo_master
|
||||
SET stock_short_name = ?, data_as_of = ?
|
||||
WHERE ticker = ?
|
||||
AND (stock_short_name IS NULL OR TRIM(stock_short_name) = '')
|
||||
""",
|
||||
(stock_name, as_of, ticker),
|
||||
)
|
||||
written += 1
|
||||
return written
|
||||
|
||||
@@ -198,6 +209,7 @@ def main() -> int:
|
||||
written = upsert_history(conn, rows, local_path, file_sha256, args.url, as_of, notes)
|
||||
write_sync_run(conn, as_of, written)
|
||||
export_snapshot(conn, "external_ipo_history", "listing_date DESC, ticker")
|
||||
export_snapshot(conn, "ipo_master", "ticker")
|
||||
export_snapshot(conn, "sync_runs", "sync_run_id")
|
||||
|
||||
print("ipohk history archived")
|
||||
|
||||
@@ -429,6 +429,7 @@ def fetch_rows(conn: sqlite3.Connection) -> list[sqlite3.Row]:
|
||||
h.margin_subscription_multiple AS t0_5_margin_subscription_multiple,
|
||||
h.source_id AS t0_5_source_id,
|
||||
h.notes AS market_heat_notes,
|
||||
eh.stock_name AS external_stock_name,
|
||||
eh.one_hand_win_rate_pct AS external_one_hand_win_rate_pct,
|
||||
eh.public_oversubscription_times AS external_public_oversubscription_times,
|
||||
eh.grey_market_return_pct AS external_grey_market_return_pct,
|
||||
@@ -470,7 +471,11 @@ def build_records(rows: list[sqlite3.Row], as_of: str) -> list[dict[str, Any]]:
|
||||
total_score = t0_score_value + (t1_score_value if structured_t1 else 0)
|
||||
t0_plus_t0_5_score = t0_score_value + t0_5_score_value if t0_5_score_value is not None else None
|
||||
size = offer_size_hkd_m(row)
|
||||
stock_short_name = row["stock_short_name"] or stock_name_from_market_heat_notes(row["market_heat_notes"])
|
||||
stock_short_name = (
|
||||
row["stock_short_name"]
|
||||
or stock_name_from_market_heat_notes(row["market_heat_notes"])
|
||||
or row["external_stock_name"]
|
||||
)
|
||||
record: dict[str, Any] = {
|
||||
"model_version": MODEL_VERSION,
|
||||
"analysis_as_of": as_of,
|
||||
|
||||
Reference in New Issue
Block a user