Clear M1 milestone bugs (T-37, T-39, T-41, T-42, T-44, T-45, T-46, T-48, T-49, T-51, T-52)
This commit is contained in:
parent
199f7beecd
commit
9e259ca43b
18 changed files with 255 additions and 34 deletions
|
|
@ -73,7 +73,7 @@ CREATE TABLE IF NOT EXISTS instrument_identifier_history (
|
|||
id_type VARCHAR(8) NOT NULL
|
||||
CHECK (id_type IN ('ISIN', 'CUSIP')),
|
||||
id_value VARCHAR(16) NOT NULL,
|
||||
valid_from DATE,
|
||||
valid_from DATE NOT NULL,
|
||||
valid_to DATE,
|
||||
source VARCHAR(16) NOT NULL,
|
||||
PRIMARY KEY (id_type, id_value, valid_from)
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ Exact DDL and edge-case rules are specified in **[DATA-CONTRACTS.md](DATA-CONTRA
|
|||
### Six-pass resolution pipeline
|
||||
|
||||
1. **Pass 1 — Exchanges (~320 rows):** Seed ISO 10383 MICs; map EOD (`76`), IB (`214`), QM (`25`), and CEO (`4: TSX→XTSE, CDX→XTSX, CNQ→XCNQ, AQL→NEOE`). Explicitly tag EOD `US` as composite (resolved via per-symbol `eodSymbols.Exchange`), exclude EOD `NMFQS` (`44,970` mutual funds) from equity universes, and mark IB ATS/smart codes (`AEQLIT`, `ARCAEDGE`, `BEX`, `DRCTEDGE`, `EDGEA`, `IEX`, `MEMX`, `OTCLNKECN`, `PSX`, `IBEOS`) as **`ats_routing`** rather than primary listing MICs.
|
||||
2. **Pass 2 — Normalization & Observed Spans:** Parse root + suffix (`AAA-P`/`AAA.P`, `AACT U`/`AACT.U`, `SCU.UN`, strip CEO `.TO`/`.V`), Luhn-validate ISINs (rejecting `CATSETEST001`, `CA00149WBAD4`, checksum-corrupted `CA8131391062` while recovering valid CUSIP `813139106` → `CA8131391064`), fix `provider-symbol.ts` to read IB `exchangeId`/`description`, and precompute `[first_bar_date, last_bar_date]` per `(source, source_id)`.
|
||||
2. **Pass 2 — Normalization & Observed Spans:** Parse root + suffix (`AAA-P`/`AAA.P`, `AACT U`/`AACT.U`, `SCU.UN`, strip CEO `.TO`/`.V`), Luhn-validate ISINs (rejecting placeholder/checksum-bad values like `CATSETEST001`, `CA00149WBAD4`, `CA8131391062` while recovering a checksum-corrupted US/CA ISIN from a valid 9-char CUSIP, e.g. `037833100` → `US0378331005` or `82509L107` → `CA82509L1076`), fix `provider-symbol.ts` to read IB `exchangeId`/`description`, and precompute `[first_bar_date, last_bar_date]` per `(source, source_id)`.
|
||||
3. **Pass 3 — Two-Stage Matching (Instrument first, Listing second):**
|
||||
- **Stage A (`instrument`):** Match globally by Luhn-valid ISIN and US/CA CUSIP-derived ISIN (`IB ↔ EOD`). Interlisted US/CA shares (`SHOP` on `XTSE` CAD and `XNYS` USD) share one `instrument_id` and get two `listing_id`s.
|
||||
- **Stage B (`listing` & non-ISIN sources):** Assign primary `listing.mic` from EOD `Exchange` + QM `exchange`; attach IB `conid` at `(instrument_id, currency)` (resolving the 83% TSX-on-`AEQLIT` and >90% NYSE/Nasdaq-on-ATS `ibSymbols` problem). Match QM and CEO by `(normalized_ticker, mic, currency)` **requiring overlapping `[first_bar_date, last_bar_date]` spans** so reused tickers (`FB` 2012–2022 Meta vs `FB` 2025 ProShares ETF; CSE `CNX`/`CC` duplicates) never collide.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue