Clear T-18, T-34, T-54, T-55 on master (release note, test/ lint gate, Stage A fixes)

This commit is contained in:
Boki 2026-11-27 16:24:57 -05:00
parent d9d49ebc22
commit ade0a3ef1d
10 changed files with 74 additions and 23 deletions

View file

@ -179,8 +179,8 @@ export function matchInstrumentsStageA(
for (let i = 0; i < records.length; i++) {
const record = records[i];
if (record === undefined) {
continue;
if (record === undefined || record === null || typeof record !== 'object') {
throw new TypeError(`Invalid Stage A record at index ${i}: expected a record object`);
}
if (!isStageASource(record.source)) {
throw new Error(
@ -243,13 +243,15 @@ export function matchInstrumentsStageA(
const normalizedCusip = normalizeCode(record.cusip);
if (normalizedCusip !== null) {
const normalizedCountry = normalizeCode(record.country);
let derivedCountry: NorthAmericaCountry | null = null;
if (normalizedCountry !== null) {
derivedCountry = isNorthAmericaCountry(normalizedCountry) ? normalizedCountry : null;
} else {
const isinPrefix = resolved.isin.slice(0, 2);
derivedCountry = isNorthAmericaCountry(isinPrefix) ? isinPrefix : null;
}
const isinPrefix = resolved.isin.slice(0, 2);
// For US/CA ISINs, the ISIN prefix is the authoritative issuer country so interlisted
// shares carrying a listing country (e.g. CA-issued SHOP on NYSE with country 'US')
// are not quarantined as false isin_cusip_mismatch conflicts.
const derivedCountry: NorthAmericaCountry | null = isNorthAmericaCountry(isinPrefix)
? isinPrefix
: normalizedCountry !== null && isNorthAmericaCountry(normalizedCountry)
? normalizedCountry
: null;
if (derivedCountry !== null) {
const derivedIsin = cusipToIsin(normalizedCusip, derivedCountry);