Files
hk-ipo/schema/hk_ipo.schema.sql
T
geometrybase 7a8c648d87 Bootstrap HK IPO historical archive
Request:
- Use the project archivist workflow to update historical IPO data.

Changes:
- Add an embedded SQLite archive at data/hk_ipo.sqlite.
- Add schema/hk_ipo.schema.sql and scripts/bootstrap_historical_data.py for reproducible archive generation.
- Archive HKEXnews source PDFs for 06658, 06675, and 06106 under repo-relative data/raw paths.
- Export Git-friendly snapshots for ipo_master, offering_terms, ipo_demand, source_refs, and data_gaps.
- Add .gitignore rules for Python cache and SQLite transient files.

Verification:
- Re-ran the bootstrap script successfully.
- Ran PRAGMA integrity_check on the SQLite database.
- Verified source_refs paths are repo-relative, files exist, and SHA-256 hashes match.
- Verified snapshot row counts match SQLite table counts.
- Ran git diff --check and searched generated durable files for machine-specific absolute paths.
2026-06-15 06:13:27 +00:00

84 lines
2.3 KiB
SQL

PRAGMA foreign_keys = ON;
CREATE TABLE IF NOT EXISTS ipo_master (
ticker TEXT PRIMARY KEY,
company_name_en TEXT NOT NULL,
company_name_zh TEXT,
stock_short_name TEXT,
exchange TEXT NOT NULL DEFAULT 'HKEX',
board TEXT NOT NULL DEFAULT 'Main Board',
status TEXT NOT NULL,
listing_date TEXT,
application_start_date TEXT,
application_end_date TEXT,
allotment_results_expected_date TEXT,
industry_label TEXT,
data_as_of TEXT NOT NULL,
notes TEXT
);
CREATE TABLE IF NOT EXISTS offering_terms (
ticker TEXT PRIMARY KEY REFERENCES ipo_master(ticker),
source_id TEXT NOT NULL,
prospectus_date TEXT,
offer_price_hkd REAL,
board_lot INTEGER,
min_subscription_amount_hkd REAL,
global_offer_shares INTEGER,
hk_offer_shares_initial INTEGER,
international_offer_shares_initial INTEGER,
public_offer_pct_initial REAL,
over_allotment_offer_shares INTEGER,
offer_size_adjustment_offer_shares INTEGER,
market_cap_hkd_m REAL,
gross_proceeds_hkd_m REAL,
net_proceeds_hkd_m REAL,
issued_shares_upon_listing INTEGER,
data_as_of TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS ipo_demand (
demand_id TEXT PRIMARY KEY,
ticker TEXT NOT NULL REFERENCES ipo_master(ticker),
source_id TEXT NOT NULL,
stage_date TEXT NOT NULL,
valid_applications INTEGER,
successful_applications INTEGER,
public_oversubscription_times REAL,
international_placees INTEGER,
international_oversubscription_times REAL,
final_hk_offer_shares INTEGER,
final_international_offer_shares INTEGER,
data_as_of TEXT NOT NULL,
notes TEXT
);
CREATE TABLE IF NOT EXISTS source_refs (
source_id TEXT PRIMARY KEY,
ticker TEXT NOT NULL REFERENCES ipo_master(ticker),
source_type TEXT NOT NULL,
title TEXT NOT NULL,
path_base TEXT NOT NULL DEFAULT 'repo_root',
local_path TEXT NOT NULL,
url TEXT NOT NULL,
file_sha256 TEXT,
source_date TEXT,
archived_at TEXT NOT NULL,
notes TEXT,
CHECK (path_base = 'repo_root'),
CHECK (local_path NOT LIKE '/%'),
CHECK (local_path NOT LIKE './%'),
CHECK (local_path NOT LIKE '%\%')
);
CREATE TABLE IF NOT EXISTS data_gaps (
gap_id TEXT PRIMARY KEY,
ticker TEXT NOT NULL REFERENCES ipo_master(ticker),
stage TEXT NOT NULL,
field_name TEXT NOT NULL,
reason TEXT NOT NULL,
expected_resolution_date TEXT,
created_at TEXT NOT NULL,
notes TEXT
);