small commit

This commit is contained in:
Boki 2026-11-26 10:22:21 -05:00
parent f8ca9b529b
commit 8f00871661
4 changed files with 874 additions and 0 deletions

View file

@ -0,0 +1,310 @@
# Phase 1 data-pipeline investigation
Full inventory run at **2026-11-26T08:29:35.173Z** against checkout `f8ca9b529bea0e1b6ab1f5ef73b79c2b1a29eb3b`. The inventory script was an uncommitted addition at that SHA. The run took **24.85 seconds** and peaked at **1,413 MiB RSS**.
Command `bun apps/stock/data-pipeline/scripts/phase1-inventory.ts > /tmp/p1.json` from the repository root. The private JSON contains the sampled key sets, index names, source excerpts, exact tallies and per-pair results. The report uses only the first full run for measured figures.
## a. Source inventory
The `stock` database contained **31 collections**. Source names start with lowercase provider prefixes followed by a camelCase entity name (`qm*`, `eod*`, `ib*`, `ceo*`, `te*`, `tt*`). No `XX_`-prefixed, TradingView, or Webshare collection was present. This describes persisted data. The ingestion code and [source notes](../../docs/data-sources.md) also cover providers with no collection in this snapshot.
The exact count column comes from `countDocuments({})` for collections whose estimate was below one million. A dash means the estimate was used. The inventory sampled top-level keys from up to 200 documents per collection. Large time-series and event collections had metadata and key samples only.
| Provider | Collection | Entity | Estimated documents | Exact documents | Indexes |
| --- | --- | --- | --- | --- | --- |
| ceo | `ceoExchanges` | exchange | 4 | 4 | 1 |
| ceo | `ceoPosts` | other | 14,779,267 | — | 2 |
| ceo | `ceoShorts` | other | 692,904 | 692,904 | 2 |
| ceo | `ceoSymbols` | stock | 12,589 | 12,589 | 2 |
| eod | `eodExchanges` | exchange | 76 | 76 | 1 |
| eod | `eodFinancialsOLD` | other | 2,975,061 | — | 3 |
| eod | `eodFundamentalsOLD` | other | 106,589 | 106,589 | 2 |
| eod | `eodIntraday1H` | other | 110,450,096 | — | 4 |
| eod | `eodIntraday1M` | other | 3,402,612,960 | — | 4 |
| eod | `eodIntraday5M` | other | 1,075,367,880 | — | 4 |
| eod | `eodPrices` | other | 845,701,704 | — | 4 |
| eod | `eodSymbolChange` | other | 230 | 230 | 1 |
| eod | `eodSymbols` | stock | 317,807 | 317,807 | 41 |
| ib | `ibExchanges` | exchange | 214 | 214 | 1 |
| ib | `ibSymbols` | stock | 18,402 | 18,402 | 1 |
| qm | `qmDividends` | other | 495,942 | 495,942 | 2 |
| qm | `qmEarnings` | other | 444,865 | 444,865 | 2 |
| qm | `qmExchanges` | exchange | 25 | 25 | 1 |
| qm | `qmFilings` | other | 30,521,360 | — | 2 |
| qm | `qmFinancials` | other | 1,864,342 | — | 2 |
| qm | `qmFinancials-old` | other | 907,764 | 907,764 | 4 |
| qm | `qmIntraday` | other | 173,281,224 | — | 2 |
| qm | `qmPrices` | other | 51,524,772 | — | 2 |
| qm | `qmSplits` | other | 18,751 | 18,751 | 2 |
| qm | `qmSymbols` | stock | 47,243 | 47,243 | 60 |
| te | `teCountries` | country | 197 | 197 | 1 |
| te | `teData` | country | 14,794 | 14,794 | 3 |
| te | `teIndicators` | country | 163 | 163 | 1 |
| te | `teMarketData` | country | 435 | 435 | 3 |
| te | `teUrls` | other | 2,424,784 | — | 8 |
| tt | `ttFutures` | other | 1,460,406 | — | 4 |
### Identifier coverage
Cells show filled records and percentages within the full collection. Coverage measures nonempty values, including values later rejected by identifier validation. The JSON records the tested field aliases, including EOD `eodExchange` before `Exchange`, IB `localSymbol` before `symbol`, and QM profile and symbol-info paths. Country and other collections are inventoried as their own entity types. The stock/exchange identifier pass is confined to the eight collections below.
| Collection | Records | Ticker | Exchange code | ISIN | FIGI | CUSIP | Name | Country | Currency |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| `ceoExchanges` | 4 | 0 (0.00%) | 4 (100.00%) | 0 (0.00%) | 0 (0.00%) | 0 (0.00%) | 0 (0.00%) | 4 (100.00%) | 0 (0.00%) |
| `ceoSymbols` | 12,589 | 12,589 (100.00%) | 12,589 (100.00%) | 0 (0.00%) | 0 (0.00%) | 0 (0.00%) | 12,560 (99.77%) | 0 (0.00%) | 0 (0.00%) |
| `eodExchanges` | 76 | 0 (0.00%) | 76 (100.00%) | 0 (0.00%) | 0 (0.00%) | 0 (0.00%) | 76 (100.00%) | 76 (100.00%) | 76 (100.00%) |
| `eodSymbols` | 317,807 | 317,807 (100.00%) | 317,807 (100.00%) | 196,833 (61.93%) | 0 (0.00%) | 0 (0.00%) | 317,807 (100.00%) | 317,807 (100.00%) | 317,807 (100.00%) |
| `ibExchanges` | 214 | 0 (0.00%) | 214 (100.00%) | 0 (0.00%) | 0 (0.00%) | 0 (0.00%) | 214 (100.00%) | 214 (100.00%) | 0 (0.00%) |
| `ibSymbols` | 18,402 | 18,402 (100.00%) | 18,402 (100.00%) | 18,402 (100.00%) | 0 (0.00%) | 18,399 (99.98%) | 18,402 (100.00%) | 18,402 (100.00%) | 18,376 (99.86%) |
| `qmExchanges` | 25 | 0 (0.00%) | 25 (100.00%) | 0 (0.00%) | 0 (0.00%) | 0 (0.00%) | 25 (100.00%) | 25 (100.00%) | 0 (0.00%) |
| `qmSymbols` | 47,243 | 47,243 (100.00%) | 47,243 (100.00%) | 0 (0.00%) | 0 (0.00%) | 0 (0.00%) | 47,243 (100.00%) | 47,243 (100.00%) | 0 (0.00%) |
Supplemental identifiers and ranking fields
| Collection | Field | Filled |
| --- | --- | --- |
| `ceoExchanges` | `mic` | 0 (0.00%) |
| `eodExchanges` | `mic` | 73 (96.05%) |
| `ibExchanges` | `mic` | 0 (0.00%) |
| `ibSymbols` | `conid` | 18,402 (100.00%) |
| `qmExchanges` | `mic` | 0 (0.00%) |
| `qmExchanges` | `priority` | 25 (100.00%) |
### Example documents
The excerpts below preserve real document IDs and selected fields. The full JSON trims nested objects and arrays and retains more of each record.
**Exchange**
`ceoExchanges`
`{"_id": "685824287a995922a6f9b0e3", "exchange": "TSX", "countryCode": "CA"}`
`ceoExchanges`
`{"_id": "685824287a995922a6f9b0e4", "exchange": "CDX", "countryCode": "CA"}`
**Other**
`ceoPosts`
`{"_id": "68584d967a995922a6fa97d3", "spielId": "2875b3d77a40", "ceoId": "BGF", "timestamp": 1744193045999, "score": 1, "votes": 1}`
`ceoPosts`
`{"_id": "68584d967a995922a6fa97d4", "spielId": "ef70832d6c62", "ceoId": "BGF", "timestamp": 1744290036418, "score": 7, "votes": 7}`
**Stock**
`ceoSymbols`
`{"_id": "685824287a995922a6f9b0b3", "symbol": "1689.TO", "exchange": "TSX", "name": "WisdomTree Natural Gas", "type": "company", "stockType": null, "marketCap": null}`
`ceoSymbols`
`{"_id": "685824287a995922a6f9b0b4", "symbol": "A.V", "exchange": "CDX", "name": "Armor Minerals Inc.", "type": "company", "stockType": null, "marketCap": 34481079.45}`
**Country**
`teCountries`
`{"_id": "69cdcbe61d0a0362a5e5d120", "slug": "united-states", "name": "United States", "url": "/united-states"}`
`teCountries`
`{"_id": "69cdcbe61d0a0362a5e5d121", "slug": "united-kingdom", "name": "United Kingdom", "url": "/united-kingdom"}`
### MongoDB access and repeatability
The planning run reported only `trading_admin` with `root@admin`. Fresh `usersInfo` queries on `admin` and `stock` returned both accounts below.
| User | Authentication database | Roles |
| --- | --- | --- |
| `trading_admin` | admin | `root@admin` |
| `studio_stock_bot_read` | stock | `read@stock` |
The live result was **`readOnlyUserExists = true`**. The configured account was used for the two `usersInfo` calls. The pre-existing read-only account was used for collection reads. This investigation created no database users and made no database writes.
Collection names, complete index definitions and user roles were identical before and after the read-only checks. The estimates were also identical. No collection-level count drift was observed during the verification window.
The second full run returned identical match tallies and tricky-case excerpts. Random field-key samples may differ on repeat runs. Independent mongosh checks matched five collection estimates and all fixture references. A separate psql read-only transaction matched all five inventory table counts.
## b. Existing mapping UI, data, and merge rules
The exchange screen lists existing exchange mappings, displays their status and lets a user add or edit a provider exchange mapping. The pipeline screen starts sync operations and presents counts. The symbol screens browse and filter records. Repository search found no symbol-level mapping editor. Within the application code, the symbol sync paths own writes to `provider_mappings`; the separately exposed pipeline reset can clear the table.
**Exchange mapping UI**
- [`apps/stock/web-app/src/features/exchanges/ExchangesPage.tsx`](../../apps/stock/web-app/src/features/exchanges/ExchangesPage.tsx)
- [`apps/stock/web-app/src/features/exchanges/components/AddProviderMappingDialog.tsx`](../../apps/stock/web-app/src/features/exchanges/components/AddProviderMappingDialog.tsx)
- [`apps/stock/web-app/src/features/exchanges/components/ExchangesTable.tsx`](../../apps/stock/web-app/src/features/exchanges/components/ExchangesTable.tsx)
- [`apps/stock/web-app/src/features/exchanges/services/exchangeApi.ts`](../../apps/stock/web-app/src/features/exchanges/services/exchangeApi.ts)
**Pipeline and symbol screens**
- [`apps/stock/web-app/src/features/pipeline/PipelinePage.tsx`](../../apps/stock/web-app/src/features/pipeline/PipelinePage.tsx)
- [`apps/stock/web-app/src/features/pipeline/services/pipelineApi.ts`](../../apps/stock/web-app/src/features/pipeline/services/pipelineApi.ts)
- [`apps/stock/web-app/src/features/symbols/SymbolsPage.tsx`](../../apps/stock/web-app/src/features/symbols/SymbolsPage.tsx)
- [`apps/stock/web-app/src/features/symbols/SymbolDetailPage.tsx`](../../apps/stock/web-app/src/features/symbols/SymbolDetailPage.tsx)
**Web API**
- [`apps/stock/web-api/src/routes/exchange.routes.ts`](../../apps/stock/web-api/src/routes/exchange.routes.ts)
- [`apps/stock/web-api/src/routes/pipeline.routes.ts`](../../apps/stock/web-api/src/routes/pipeline.routes.ts)
- [`apps/stock/web-api/src/services/exchange.service.ts`](../../apps/stock/web-api/src/services/exchange.service.ts)
- [`apps/stock/web-api/src/services/pipeline.service.ts`](../../apps/stock/web-api/src/services/pipeline.service.ts)
Exchange routes include `GET /provider-mappings/all`, `GET /provider-mappings/:provider`, `PATCH /provider-mappings/:id`, `POST /provider-mappings`, `GET /provider-exchanges/unmapped/:provider`, and `GET /stats/summary` under the exchanges prefix. Pipeline routes include `POST /symbols/:provider`, `POST /provider-mappings/qm`, `POST /provider-mappings/ib`, and `GET /stats/provider-mappings` under the pipeline prefix. The inventory invoked no API endpoints.
**Postgres storage and visibility**
- [`database/postgres/init/02-master-schema.sql`](../../database/postgres/init/02-master-schema.sql)
- [`database/postgres/init/04-provider-exchange-mapping-schema.sql`](../../database/postgres/init/04-provider-exchange-mapping-schema.sql)
- [`database/postgres/init/05-add-visible-column.sql`](../../database/postgres/init/05-add-visible-column.sql)
`exchanges` and `symbols` hold canonical records, keyed by exchange code and by ticker plus exchange ID respectively. `provider_exchange_mappings` links provider codes to exchange UUIDs and allows unresolved mappings. `provider_mappings` links provider symbols to canonical symbol UUIDs. `sync_status` records provider and operation status. The visibility flag affects which exchanges the UI and summary show. The live check used `to_regclass` before selecting each table.
| Table | Rows |
| --- | --- |
| `exchanges` | 301 |
| `symbols` | 0 |
| `provider_mappings` | 0 |
| `provider_exchange_mappings` | 313 |
| `sync_status` | 3 |
| `master_exchanges` | missing |
| `master_symbols` | missing |
| `provider_symbol_mappings` | missing |
The plan’s names `master_exchanges`, `master_symbols` and `provider_symbol_mappings` are absent from the live Postgres schema. As separately inventoried in section a, the Mongo sources are the provider collections, and the legacy IB handler’s `masterExchanges` collection was also absent from this snapshot.
| Provider | Has exchange UUID | Verified | Active | Auto mapped | Rows |
| --- | --- | --- | --- | --- | --- |
| eod | yes | no | no | no | 2 |
| eod | yes | no | no | yes | 72 |
| eod | yes | no | yes | no | 2 |
| ib | yes | no | no | no | 1 |
| ib | yes | no | no | yes | 186 |
| qm | yes | no | no | yes | 26 |
| qm | yes | no | yes | no | 1 |
| unified | yes | no | no | yes | 22 |
| unified | yes | no | yes | no | 1 |
The symbol-mapping counts by provider and verification and the confidence histogram are both empty because `provider_mappings` contains zero rows.
### Existing field and source precedence
- **Provider normalization**. Uses the first populated ticker of `symbol`, `code`, and `Code`, and the first populated exchange of `exchangeCode`, `exchange`, `exchange_id`, and `Exchange`. It chooses a provider search code, name, country and currency by field precedence. This code does not read `exchangeId`, the live IB symbol spelling. It defines field precedence rather than a source ranking. [`apps/stock/data-pipeline/src/normalization/provider-symbol.ts`](../../apps/stock/data-pipeline/src/normalization/provider-symbol.ts)
- **Generic provider symbol sync**. Supports QM, EOD and IB; normalizes the relevant Mongo source and sends each record to the shared repository. [`apps/stock/data-pipeline/src/handlers/symbols/operations/sync-symbols-from-provider.operations.ts`](../../apps/stock/data-pipeline/src/handlers/symbols/operations/sync-symbols-from-provider.operations.ts)
- **Shared SQL sync**. Requires an exact active mapped exchange and matches symbols on ticker plus exchange UUID. Non-null incoming name, country and currency can replace existing values. Verified provider-symbol links retain their symbol and exchange assignments in this path; last-seen timestamps advance. Exchange mapping uses exact code and preserves existing conflicts rather than scoring candidates across sources. [`apps/stock/data-pipeline/src/repositories/PipelineSyncRepository.ts`](../../apps/stock/data-pipeline/src/repositories/PipelineSyncRepository.ts)
- **Dedicated QM symbol sync**. Has a fixed exchange-code translation map, a ticker and exchange lookup, and non-null field precedence for name, country and currency. It has its own provider mapping SQL and does not share the verified-link protection in the common repository. [`apps/stock/data-pipeline/src/handlers/symbols/operations/qm-symbols.operations.ts`](../../apps/stock/data-pipeline/src/handlers/symbols/operations/qm-symbols.operations.ts)
- **QM exchange mapping sync**. Groups provider exchange codes, supplies name and country, infers CAD for Canada and USD otherwise, and calls the SQL repository with 0.80 confidence. [`apps/stock/data-pipeline/src/handlers/exchanges/operations/sync-qm-provider-mappings.operations.ts`](../../apps/stock/data-pipeline/src/handlers/exchanges/operations/sync-qm-provider-mappings.operations.ts)
- **Dedicated QM exchange sync**. Processes QM exchange records through its own SQL path, with exchange lookup and metadata handling. [`apps/stock/data-pipeline/src/handlers/exchanges/operations/qm-exchanges.operations.ts`](../../apps/stock/data-pipeline/src/handlers/exchanges/operations/qm-exchanges.operations.ts)
- **Legacy IB exchange sync**. Builds an IB-derived canonical exchange identifier and aliases and targets the Mongo collection `masterExchanges`. Its new records mark the direct IB mapping verified at 1.00 confidence, independent of the live SQL mapping flags. That code path was inspected only. [`apps/stock/data-pipeline/src/handlers/exchanges/operations/sync-ib-exchanges.operations.ts`](../../apps/stock/data-pipeline/src/handlers/exchanges/operations/sync-ib-exchanges.operations.ts)
- **QM ingestion deduplication**. Sets `qmExchanges.priority` from a hard-coded venue list. Within a ticker and country, it prefers a bare QM search code in the US and `symbol:COUNTRY` elsewhere. If neither is present it chooses exchange priority, then market cap, and uses the result to set active flags. This ranks listings inside QM, rather than sources against one another. [`apps/stock/data-ingestion/src/handlers/qm/actions/symbol-dedup.action.ts`](../../apps/stock/data-ingestion/src/handlers/qm/actions/symbol-dedup.action.ts)
The canonical symbol storage lacks ISIN and FIGI columns, per-field provenance, a match-review queue and a separate country entity. The current symbol and exchange sync paths provide no CEO, TE or TT mappings. The existing code and data support listing and manual exchange mapping by provider, not a general cross-provider merge policy.
## c. Cross-source matching
Each source record is counted once across the other providers. Strong means a shared checksum-valid ISIN, a nine-character CUSIP (including the embedded value of valid US and Canadian ISINs), or a 12-character FIGI when supplied. The effective FIGI input was empty. Weak-only means no strong match and either the same ticker and mapped exchange UUID or the same ticker and currency with name token Jaccard ≥ 0.8. Both records require an existing non-null exchange mapping for either weak heuristic. These are candidate links and measured overlaps, not confirmed entity identity.
| Provider | Projected records | Strong | Weak only | Unmatched | Exact weak | Normalized weak |
| --- | --- | --- | --- | --- | --- | --- |
| qm | 47,243 | 0 | 976 | 46,267 | 913 | 976 |
| eod | 317,807 | 21,200 | 2,710 | 293,897 | 2,452 | 2,710 |
| ib | 18,402 | 14,216 | 1,555 | 2,631 | 1,351 | 1,555 |
| ceo | 12,589 | 0 | 0 | 12,589 | 0 | 0 |
Exact weak uses the trimmed raw ticker. Normalized weak also folds case, strips known venue affixes such as `.US` and `:NASDAQ`, and canonicalizes one-letter share classes across dot, dash, slash and whitespace forms. The two weak columns overlap. Their union is the weak-only classification. Each rule occurrence is recorded in the JSON.
| Provider | Missing exchange code | No mapping row | Mapping has null master | Has master |
| --- | --- | --- | --- | --- |
| qm | 0 | 0 | 0 | 47,243 |
| eod | 0 | 9,845 | 0 | 307,962 |
| ib | 0 | 0 | 0 | 18,402 |
| ceo | 0 | 12,589 | 0 | 0 |
| Provider | Observed normalization rules |
| --- | --- |
| qm | `share_class_dot` 1,298, `share_class_separator` 2 |
| eod | `case` 1,727, `share_class_dot` 2,561, `share_class_separator` 2,561 |
| ib | `share_class_dot` 579, `share_class_separator` 45 |
| ceo | `share_class_dot` 3,105 |
The pair counts are directed and count records in the source on the left. A record can appear in more than one pair.
| Pair | Projected records | Strong | Weak only | Unmatched | Exact weak | Normalized weak |
| --- | --- | --- | --- | --- | --- | --- |
| qm→eod | 47,243 | 0 | 712 | 46,531 | 650 | 712 |
| qm→ib | 47,243 | 0 | 264 | 46,979 | 263 | 264 |
| qm→ceo | 47,243 | 0 | 0 | 47,243 | 0 | 0 |
| eod→qm | 317,807 | 0 | 712 | 317,095 | 650 | 712 |
| eod→ib | 317,807 | 21,200 | 2,620 | 293,987 | 2,398 | 2,620 |
| eod→ceo | 317,807 | 0 | 0 | 317,807 | 0 | 0 |
| ib→qm | 18,402 | 0 | 264 | 18,138 | 263 | 264 |
| ib→eod | 18,402 | 14,216 | 1,546 | 2,640 | 1,342 | 1,546 |
| ib→ceo | 18,402 | 0 | 0 | 18,402 | 0 | 0 |
| ceo→qm | 12,589 | 0 | 0 | 12,589 | 0 | 0 |
| ceo→eod | 12,589 | 0 | 0 | 12,589 | 0 | 0 |
| ceo→ib | 12,589 | 0 | 0 | 12,589 | 0 | 0 |
### Exchange codes
The denominator is distinct nonempty exchange codes per source after case and whitespace normalization. A non-null explicit SQL mapping counts as strong, split into verified, otherwise auto-mapped, and other. The instrument heuristic for unresolved exchanges uses an exact non-placeholder OperatingMIC or country and name token agreement. A SQL mapping may point to an exchange with no equivalent code in the other Mongo sources.
| Provider | Distinct codes | Mapped / strong | Verified | Auto | Other mapped | Cross-source only | Unmatched |
| --- | --- | --- | --- | --- | --- | --- | --- |
| qm | 25 | 25 | 0 | 24 | 1 | 0 | 0 |
| eod | 76 | 73 | 0 | 69 | 4 | 0 | 3 |
| ib | 188 | 187 | 0 | 186 | 1 | 0 | 1 |
| ceo | 4 | 0 | 0 | 0 | 0 | 0 | 4 |
### Tricky cases
The deterministic selection produced **25 candidates** across 5 buckets. The same record pair can qualify for more than one bucket. The script sorts by identifier or ticker, then source and document ID, and keeps up to five per bucket. No cross-source candidate shared both ticker and mapped exchange while carrying two distinct valid ISINs.
| Bucket | Candidate key | Source document excerpts |
| --- | --- | --- |
| `isin_currency_or_country_conflict` | `AGP8696W1045` | `eodSymbols/6870729a89b14ad0b4a7fc48` · Code=SVQ, eodSearchCode=SVQ.F, eodExchange=F, Exchange=F, Isin=AGP8696W1045, Country=Germany, Currency=EUR · master `d9df353b-dae0-43c1-b722-1a0a043d38d2` <br> `ibSymbols/684cd228ba15394e9c03cafd` · symbol=SVA, localSymbol=SVA, exchangeId=NASDAQ, isin=AGP8696W1045, cusip=P8696W104, country=US, currency=USD · master `17eaa972-fac5-4701-8c51-61fe61287820` |
| `isin_currency_or_country_conflict` | `AN8068571086` | `eodSymbols/6870729a89b14ad0b4a7f07b` · Code=SLB, eodSearchCode=SLB.PA, eodExchange=PA, Exchange=PA, Isin=AN8068571086, Country=France, Currency=EUR · master `4b186932-19e2-4151-8728-6c9f3469260c` <br> `ibSymbols/684cd226ba15394e9c03c7f9` · symbol=SLB, localSymbol=SLB, exchangeId=EDGX, isin=AN8068571086, cusip=806857108, country=US, currency=USD · master `34c0796c-8d15-434c-9c87-806b062327f3` |
| `isin_currency_or_country_conflict` | `AU000000AGD4` | `eodSymbols/6870729f89b14ad0b4a9e61d` · Code=AGD, eodSearchCode=AGD.AU, eodExchange=AU, Exchange=AU, Isin=AU000000AGD4, Country=Australia, Currency=AUD · master `84fe59d5-8228-4e13-b70e-1f507b6597eb` <br> `ibSymbols/684cd08bba15394e9c038dda` · symbol=AGLD, localSymbol=AGLD, exchangeId=AEQLIT, isin=AU000000AGD4, cusip=Q0819E102, country=CA, currency=CAD · master `e09270dd-a099-4e96-9dce-7b52820352b9` |
| `isin_currency_or_country_conflict` | `AU000000CIA2` | `eodSymbols/6870729b89b14ad0b4a83e5f` · Code=MMPI, eodSearchCode=MMPI.F, eodExchange=F, Exchange=F, Isin=AU000000CIA2, Country=Germany, Currency=EUR · master `d9df353b-dae0-43c1-b722-1a0a043d38d2` <br> `ibSymbols/684cd213ba15394e9c039ad2` · symbol=CIA, localSymbol=CIA, exchangeId=AEQLIT, isin=AU000000CIA2, cusip=Q22964102, country=CA, currency=CAD · master `e09270dd-a099-4e96-9dce-7b52820352b9` |
| `isin_currency_or_country_conflict` | `AU000000CY57` | `eodSymbols/6870729f89b14ad0b4a9eeef` · Code=CY5, eodSearchCode=CY5.AU, eodExchange=AU, Exchange=AU, Isin=AU000000CY57, Country=Australia, Currency=AUD · master `84fe59d5-8228-4e13-b70e-1f507b6597eb` <br> `ibSymbols/684cd214ba15394e9c039eaa` · symbol=CYG, localSymbol=CYG, exchangeId=VENTURE, isin=AU000000CY57, cusip=Q3080P103, country=CA, currency=CAD · master `bb86f438-d8c1-40b5-ad03-897274de6377` |
| `isin_ticker_variation` | `AGP8696W1045` | `eodSymbols/6870729a89b14ad0b4a7fc48` · Code=SVQ, eodSearchCode=SVQ.F, eodExchange=F, Exchange=F, Isin=AGP8696W1045, Country=Germany, Currency=EUR · master `d9df353b-dae0-43c1-b722-1a0a043d38d2` <br> `ibSymbols/684cd228ba15394e9c03cafd` · symbol=SVA, localSymbol=SVA, exchangeId=NASDAQ, isin=AGP8696W1045, cusip=P8696W104, country=US, currency=USD · master `17eaa972-fac5-4701-8c51-61fe61287820` |
| `isin_ticker_variation` | `AN8068571086` | `eodSymbols/6870729a89b14ad0b4a804dc` · Code=SCL, eodSearchCode=SCL.STU, eodExchange=STU, Exchange=STU, Isin=AN8068571086, Country=Germany, Currency=EUR · master `6b1ed995-47c4-4e8a-98a8-eefdb1513189` <br> `ibSymbols/684cd226ba15394e9c03c7f9` · symbol=SLB, localSymbol=SLB, exchangeId=EDGX, isin=AN8068571086, cusip=806857108, country=US, currency=USD · master `34c0796c-8d15-434c-9c87-806b062327f3` |
| `isin_ticker_variation` | `AU000000AGD4` | `eodSymbols/6870729f89b14ad0b4a9e61d` · Code=AGD, eodSearchCode=AGD.AU, eodExchange=AU, Exchange=AU, Isin=AU000000AGD4, Country=Australia, Currency=AUD · master `84fe59d5-8228-4e13-b70e-1f507b6597eb` <br> `ibSymbols/684cd08bba15394e9c038dda` · symbol=AGLD, localSymbol=AGLD, exchangeId=AEQLIT, isin=AU000000AGD4, cusip=Q0819E102, country=CA, currency=CAD · master `e09270dd-a099-4e96-9dce-7b52820352b9` |
| `isin_ticker_variation` | `AU000000CIA2` | `eodSymbols/6870729b89b14ad0b4a83e5f` · Code=MMPI, eodSearchCode=MMPI.F, eodExchange=F, Exchange=F, Isin=AU000000CIA2, Country=Germany, Currency=EUR · master `d9df353b-dae0-43c1-b722-1a0a043d38d2` <br> `ibSymbols/684cd213ba15394e9c039ad2` · symbol=CIA, localSymbol=CIA, exchangeId=AEQLIT, isin=AU000000CIA2, cusip=Q22964102, country=CA, currency=CAD · master `e09270dd-a099-4e96-9dce-7b52820352b9` |
| `isin_ticker_variation` | `AU000000CY57` | `eodSymbols/6870729f89b14ad0b4a9eeef` · Code=CY5, eodSearchCode=CY5.AU, eodExchange=AU, Exchange=AU, Isin=AU000000CY57, Country=Australia, Currency=AUD · master `84fe59d5-8228-4e13-b70e-1f507b6597eb` <br> `ibSymbols/684cd214ba15394e9c039eaa` · symbol=CYG, localSymbol=CYG, exchangeId=VENTURE, isin=AU000000CY57, cusip=Q3080P103, country=CA, currency=CAD · master `bb86f438-d8c1-40b5-ad03-897274de6377` |
| `share_class_format` | `AAA.P` | `eodSymbols/6870729789b14ad0b4a719de` · Code=AAA-P, eodSearchCode=AAA-P.V, eodExchange=V, Exchange=V, Country=Canada, Currency=CAD · master `c4d21513-3671-4187-9f87-1a8138b39a33` <br> `ibSymbols/684cd08bba15394e9c038c1a` · symbol=AAA.P, localSymbol=AAA.P, exchangeId=VENTURE, isin=CA33719F1099, cusip=33719F109, country=CA, currency=CAD · master `bb86f438-d8c1-40b5-ad03-897274de6377` |
| `share_class_format` | `AAAJ.P` | `eodSymbols/6870729789b14ad0b4a72085` · Code=AAAJ-P, eodSearchCode=AAAJ-P.V, eodExchange=V, Exchange=V, Country=Canada, Currency=CAD · master `c4d21513-3671-4187-9f87-1a8138b39a33` <br> `ibSymbols/684cd08bba15394e9c038c1b` · symbol=AAAJ.P, localSymbol=AAAJ.P, exchangeId=AEQLIT, isin=CA00036L1013, cusip=00036L101, country=CA, currency=CAD · master `e09270dd-a099-4e96-9dce-7b52820352b9` |
| `share_class_format` | `AACT.U` | `ibSymbols/684cd08bba15394e9c038c28` · symbol=AACT U, localSymbol=AACT U, exchangeId=PSX, isin=KYG330331128, cusip=G33033112, country=US, currency=USD · master `48898e5f-0749-47c6-9832-2af991768477` <br> `qmSymbols/685f48529aba109fcce7be10` · symbol=AACT.U, qmSearchCode=AACT.U:EGX, exchange=EDGX, countryCode=US · master `34c0796c-8d15-434c-9c87-806b062327f3` |
| `share_class_format` | `AAM.U` | `ibSymbols/684cd08bba15394e9c038c38` · symbol=AAM U, localSymbol=AAM U, exchangeId=IBEOS, isin=KYG1000R1193, cusip=G1000R119, country=US, currency=USD · master `d0209689-cbe9-4258-919a-7f6cd73db322` <br> `qmSymbols/685f484f9aba109fcce7b6ba` · symbol=AAM.U, qmSearchCode=AAM.U, exchange=NYE, countryCode=US · master `662967e1-3293-4a40-bbd3-297f200c156a` |
| `share_class_format` | `ACAP.P` | `eodSymbols/6870729789b14ad0b4a719e6` · Code=ACAP-P, eodSearchCode=ACAP-P.V, eodExchange=V, Exchange=V, Country=Canada, Currency=CAD · master `c4d21513-3671-4187-9f87-1a8138b39a33` <br> `ibSymbols/684cd08bba15394e9c038ca6` · symbol=ACAP.P, localSymbol=ACAP.P, exchangeId=VENTURE, isin=CA04941B1094, cusip=04941B109, country=CA, currency=CAD · master `bb86f438-d8c1-40b5-ad03-897274de6377` |
| `dual_master_exchanges` | `AGP8696W1045` | `eodSymbols/6870729a89b14ad0b4a7fc48` · Code=SVQ, eodSearchCode=SVQ.F, eodExchange=F, Exchange=F, Isin=AGP8696W1045, Country=Germany, Currency=EUR · master `d9df353b-dae0-43c1-b722-1a0a043d38d2` <br> `ibSymbols/684cd228ba15394e9c03cafd` · symbol=SVA, localSymbol=SVA, exchangeId=NASDAQ, isin=AGP8696W1045, cusip=P8696W104, country=US, currency=USD · master `17eaa972-fac5-4701-8c51-61fe61287820` |
| `dual_master_exchanges` | `AN8068571086` | `eodSymbols/6870729a89b14ad0b4a7f07b` · Code=SLB, eodSearchCode=SLB.PA, eodExchange=PA, Exchange=PA, Isin=AN8068571086, Country=France, Currency=EUR · master `4b186932-19e2-4151-8728-6c9f3469260c` <br> `ibSymbols/684cd226ba15394e9c03c7f9` · symbol=SLB, localSymbol=SLB, exchangeId=EDGX, isin=AN8068571086, cusip=806857108, country=US, currency=USD · master `34c0796c-8d15-434c-9c87-806b062327f3` |
| `dual_master_exchanges` | `AU000000AGD4` | `eodSymbols/6870729789b14ad0b4a719fc` · Code=AGLD, eodSearchCode=AGLD.V, eodExchange=V, Exchange=V, Isin=AU000000AGD4, Country=Canada, Currency=CAD · master `c4d21513-3671-4187-9f87-1a8138b39a33` <br> `ibSymbols/684cd08bba15394e9c038dda` · symbol=AGLD, localSymbol=AGLD, exchangeId=AEQLIT, isin=AU000000AGD4, cusip=Q0819E102, country=CA, currency=CAD · master `e09270dd-a099-4e96-9dce-7b52820352b9` |
| `dual_master_exchanges` | `AU000000CIA2` | `eodSymbols/6870729889b14ad0b4a723d9` · Code=CIA, eodSearchCode=CIA.TO, eodExchange=TO, Exchange=TO, Isin=AU000000CIA2, Country=Canada, Currency=CAD · master `54a5f743-5dde-4de2-a0f9-0a11bc517a73` <br> `ibSymbols/684cd213ba15394e9c039ad2` · symbol=CIA, localSymbol=CIA, exchangeId=AEQLIT, isin=AU000000CIA2, cusip=Q22964102, country=CA, currency=CAD · master `e09270dd-a099-4e96-9dce-7b52820352b9` |
| `dual_master_exchanges` | `AU000000CY57` | `eodSymbols/6870729f89b14ad0b4a9eeef` · Code=CY5, eodSearchCode=CY5.AU, eodExchange=AU, Exchange=AU, Isin=AU000000CY57, Country=Australia, Currency=AUD · master `84fe59d5-8228-4e13-b70e-1f507b6597eb` <br> `ibSymbols/684cd214ba15394e9c039eaa` · symbol=CYG, localSymbol=CYG, exchangeId=VENTURE, isin=AU000000CY57, cusip=Q3080P103, country=CA, currency=CAD · master `bb86f438-d8c1-40b5-ad03-897274de6377` |
| `invalid_isin` | `CA00149WBAD4` | `ibSymbols/684cd212ba15394e9c038fd5` · symbol=AIP.U.BAD, localSymbol=AIP.U.BAD, exchangeId=AEQLIT, isin=CA00149WBAD4, cusip=00149WBAD, country=CA, currency=CAD · master `e09270dd-a099-4e96-9dce-7b52820352b9` |
| `invalid_isin` | `CA45175CBAD7` | `ibSymbols/684cd218ba15394e9c03ae3f` · symbol=IKNK.BADN, localSymbol=IKNK.BAD.NEW, exchangeId=AEQLIT, isin=CA45175CBAD7, cusip=45175CBAD, country=CA · master `e09270dd-a099-4e96-9dce-7b52820352b9` |
| `invalid_isin` | `CA52886N1024` | `eodSymbols/6870729d89b14ad0b4a91247` · Code=LEXXW, eodSearchCode=LEXXW.US, eodExchange=US, Exchange=NASDAQ, Isin=CA52886N1024, Country=USA, Currency=USD · master `c6aebb89-82fb-403e-9e82-2cae8068bf55` |
| `invalid_isin` | `CA8131391062` | `ibSymbols/684cd225ba15394e9c03c664` · symbol=SCU.UN, localSymbol=SCU.UN.NEW, exchangeId=TSE, isin=CA8131391062, cusip=813139106, country=CA · master `d8272e91-5cd3-4a74-ba38-f77d527b5b8d` |
| `invalid_isin` | `CATSETEST001` | `ibSymbols/684cd230ba15394e9c03d587` · symbol=ZYZ.A, localSymbol=ZYZ.A, exchangeId=AEQLIT, isin=CATSETEST001, cusip=TSETEST00, country=CA, currency=CAD · master `e09270dd-a099-4e96-9dce-7b52820352b9` |
## d. Stack and conventions
- **Runtime and workspace**. Bun workspaces and Turbo tasks drive package orchestration.
[`package.json`](../../package.json) · [`turbo.json`](../../turbo.json) · [`bunfig.toml`](../../bunfig.toml)
- **Query layer**. The Postgres library uses `pg` and raw SQL. The pipeline repository follows that pattern and uses transaction helpers. There is no ORM in this layer.
[`libs/data/postgres/package.json`](../../libs/data/postgres/package.json) · [`libs/data/postgres/src/client.ts`](../../libs/data/postgres/src/client.ts) · [`libs/data/postgres/src/transactions.ts`](../../libs/data/postgres/src/transactions.ts) · [`apps/stock/data-pipeline/src/repositories/PipelineSyncRepository.ts`](../../apps/stock/data-pipeline/src/repositories/PipelineSyncRepository.ts)
- **Schema changes**. Numbered SQL files are mounted into the Postgres container’s init directory. This is container initialization, so changes to an already initialized volume need a separate application decision. The Studio migration skill refers to Studio’s own Drizzle schema and does not describe this repository.
[`docker-compose.yml`](../../docker-compose.yml) · [`database/postgres/init/02-master-schema.sql`](../../database/postgres/init/02-master-schema.sql) · [`database/postgres/init/04-provider-exchange-mapping-schema.sql`](../../database/postgres/init/04-provider-exchange-mapping-schema.sql) · [`database/postgres/init/05-add-visible-column.sql`](../../database/postgres/init/05-add-visible-column.sql)
- **Queue and handlers**. The workspace queue and handler libraries provide registration, job dispatch, scheduled operations and metrics. The pipeline registers exchange and symbol handlers.
[`libs/core/queue/src/queue-manager.ts`](../../libs/core/queue/src/queue-manager.ts) · [`libs/core/handlers/src/index.ts`](../../libs/core/handlers/src/index.ts) · [`apps/stock/data-pipeline/src/handlers/index.ts`](../../apps/stock/data-pipeline/src/handlers/index.ts) · [`apps/stock/data-pipeline/src/handlers/exchanges/exchanges.handler.ts`](../../apps/stock/data-pipeline/src/handlers/exchanges/exchanges.handler.ts) · [`apps/stock/data-pipeline/src/handlers/symbols/symbols.handler.ts`](../../apps/stock/data-pipeline/src/handlers/symbols/symbols.handler.ts)
- **HTTP API**. Hono routers delegate to services.
[`apps/stock/web-api/package.json`](../../apps/stock/web-api/package.json) · [`apps/stock/web-api/src/routes/exchange.routes.ts`](../../apps/stock/web-api/src/routes/exchange.routes.ts) · [`apps/stock/web-api/src/routes/pipeline.routes.ts`](../../apps/stock/web-api/src/routes/pipeline.routes.ts)
- **Tests**. The pipeline package runs Bun tests. The Mongo workspace has an example Bun test suite.
[`apps/stock/data-pipeline/package.json`](../../apps/stock/data-pipeline/package.json) · [`libs/data/mongodb/test/mongodb.test.ts`](../../libs/data/mongodb/test/mongodb.test.ts)
- **Web app**. React and Vite, with the application split into feature folders.
[`apps/stock/web-app/package.json`](../../apps/stock/web-app/package.json) · [`apps/stock/web-app/vite.config.ts`](../../apps/stock/web-app/vite.config.ts) · [`apps/stock/web-app/src/features/exchanges/ExchangesPage.tsx`](../../apps/stock/web-app/src/features/exchanges/ExchangesPage.tsx)
## e. Open questions for the director
- Should the project adopt the existing scoped read-only MongoDB login for routine audits, and how should environments that only have `trading_admin` supply an equivalent login?
- Should the design use the observed camelCase collection names as the contract, and where should any legacy `XX_` assumptions be corrected?
- Which of `exchanges`, `symbols`, `provider_mappings` and `provider_exchange_mappings` should be extended or replaced? How does the legacy IB Mongo path fit?
- Which sources should win conflicts for individual fields? The QM venue priority covers a narrower case within a single source.
- Are CEO, TE and TT in scope for the next phase, and which entities or feeds should each contribute?
- What applies schema changes to existing Postgres volumes? The repository uses numbered SQL init files and the Studio skill refers to Drizzle.

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB