Skip to content

feat: add OMX Copenhagen 25 (OMXC25) to the Indices tab, off by default - #6

Open
knightmare2600 wants to merge 3 commits into
PowerShellYoungTeam:mainfrom
knightmare2600:pr/feat-omxc25
Open

knightmare2600 wants to merge 3 commits into
PowerShellYoungTeam:mainfrom
knightmare2600:pr/feat-omxc25

Conversation

@knightmare2600

@knightmare2600 knightmare2600 commented Oct 9, 2026 •

Copy link
Copy Markdown

Summary

Adds the OMX Copenhagen 25 index (OMXC25) to the Indices tab as a true index rather than an ETF proxy, linked to Nasdaq Copenhagen (XCSE), Denmark, DKK. It is turned off by default because it needs a paid Twelve Data plan.

Depends on #5 (Nasdaq Copenhagen), which depends on #4. Please merge those first; the commit new in this PR is "feat: add OMX Copenhagen 25 (OMXC25) to the Indices tab, off by default".

Why it is off by default

  • Twelve Data's own index catalogue lists OMXC25 ("OMX Copenhagen 25 Index", DKK) with access level Pro: /indices?symbol=OMXC25&show_plan=true.
  • The free Basic key that the README describes would get HTTP 403, which Twelve Data's docs define as "API key lacks permissions for the requested resource (upgrade required)".
  • The Copenhagen-listed tracker ETF (XACTC25) is also Pro-only.
  • So the row is shown greyed out with a note explaining why, and no request is made. Users with a Pro key enable it with "EnabledIndices": ["OMXC25"] in user-preferences.json. This is a new optional preference, carried through Save-UserPreferences; there is no Settings UI yet.

About the index

  • Per Nasdaq Global Indexes, it is "a market value weighted, free float adjusted and capped index" of the 25 largest and most-traded shares on Nasdaq Copenhagen.
  • Index currency DKK; base 1000 on 19 Dec 2016 (methodology).

When enabled

  • Separate request. Fetched in its own /quote request with its own 15-minute cache, so a plan restriction or failure never affects the existing ETF batch.
  • Back-off. HTTP 403/404 stop further requests for that key for the rest of the session, so no credits are wasted. 429s and network errors retry after the TTL and keep showing the last good quote.
  • Status line:
    • Intraday (may be delayed): Copenhagen is in session and the quote is ≤ 30 min old. Twelve Data does not say whether quotes are real-time, so nothing is labelled "live".
    • Last close: Copenhagen is closed and the quote is ≤ 7 days old.
    • Stale: older than those limits; shown greyed out.
    • Unavailable: no quote received this session.
  • Copenhagen's own hours decide the status. It comes from the dashboard's Nasdaq Copenhagen hours and holidays, not Twelve Data's is_market_open, because Twelve Data files OMXC25 under the Stockholm MIC (XSTO), whose hours and holidays differ (e.g. Stockholm trades on 15 May 2026, a Copenhagen closure). The quote time is shown in Copenhagen time.

Code

  • New non-exported Private/IndexQuotes.ps1:
    • index definitions (the eight ETF proxies moved here unchanged);
    • Test-IndexEnabled;
    • Twelve Data quote parsing;
    • per-index cache with back-off;
    • quote-status classification.
  • README OMXC25 section with enabling and troubleshooting steps.

Interaction with other PRs

#10 relabels three ETF proxies in the dashboard's inline list; this PR moves that list to Private/IndexQuotes.ps1. If both are merged, keep #10's labels in the moved list.

Checks

  • Pester: 80 passed, 0 failed (29 new). The new tests cover:
    • registration and association with XCSE / Denmark;
    • opt-in behaviour;
    • parsing valid, missing-price, empty, 403 and 429 responses;
    • mocked retrieval, including the URL sent;
    • network failure;
    • cache TTL, last-good fallback and 403 back-off (retried with a different key);
    • quote status across session, closing auction, after close, Easter, a Copenhagen-only holiday, weekends and stale data.
  • Not verified against a live Pro key; the request and response shape follow the Twelve Data documentation.
  • Lint: the Lint workflow already fails on main before this change — PSScriptAnalyzer reports 120 Warning-level findings there (e.g. run 36486962685). This PR adds no new findings (compared by rule, file and message against main), so a red Lint check here is the pre-existing state.
  • Not run: the WPF dashboard itself (Windows-only); checks were run on Linux with PowerShell 7.6.3.
  • CHANGELOG: this PR adds its own entry under [Unreleased]. The PRs in this series are independent where possible, so whichever merges second will have a trivial conflict in that section — keep both entries.

This is one of a series of small PRs (fixes and features kept separate so you can pick and choose): #2 countdown hours · #3 Refresh button · #4 map preferences · #5 Nasdaq Copenhagen · #6 OMXC25 · #7 FX DKK/SEK · #8 København clock · #9 FTSE 100 · #10 ETF labels.

🤖 Generated with Claude Code

knightmare2600 and others added 3 commits October 9, 2026 23:12
user-preferences.example.json has shipped MapStyle, MapProjection and
MapOverlays since the map overhaul, but nothing read them: the map
always started on Earth at Night / Flat / Day-Night, and
Save-UserPreferences rewrote the file with a fixed key set, deleting
the three keys on the first save. There is no save on window close
(it minimises to the tray), so map changes were never persisted.

- Save-UserPreferences now writes MapStyle, MapProjection and
  MapOverlays from the current toolbar state.
- The style and projection pickers and the ten overlay toggles save
  when changed, as the exchange toggles already do.
- Saved settings are applied straight after the pickers are populated,
  before change handlers are attached, so start-up does not redraw the
  map once per toggle.
- New Private/Get-MapPreferenceState resolves the saved values. Unknown
  styles/projections fall back to the defaults; overlay names with no
  toggle (e.g. 'TimeLine' from the original example file) are ignored;
  an empty MapOverlays list means all overlays off; a missing key keeps
  the XAML defaults.
- PSExchangeClock.psm1 now dot-sources Private/*.ps1 (not exported).
- Pester tests in Tests/MapPreferences.Tests.ps1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds Nasdaq Copenhagen (Nasdaq København) as the 21st exchange, using
the existing exchange, holiday, map, flyout, world-clock and
preference mechanisms. It is not active by default; existing saved
selections are left unchanged.

Exchange
- Code XCSE, symbol OMXC, Copenhagen, Denmark, DKK, 55.6761 / 12.5683.
- TimeZoneId 'Romance Standard Time' (Windows ID that .NET maps from
  IANA Europe/Copenhagen); CET/CEST comes from the OS timezone rules.
- Main-market equities 09:00-17:00 local. New optional exchange fields
  OpeningAuctionStart (08:45) and ClosingAuctionStart (16:55) make the
  status read "Opening auction - opens in ..." and "Closing auction -
  ends in ..." instead of presenting the call phases as pre-market or
  continuous trading. Status values, colours and notifications are
  unchanged. The flyout lists both auction windows.
- Sources: Nasdaq European Markets Trading Hours and Holiday Schedule
  (https://www.nasdaq.com/european-market-activity/trading-hours) and
  the Nasdaq INET Nordic Auctions factsheet 1015-26.

Holidays
- holidays.json gains the official Nasdaq Copenhagen equity closures
  for 2025-2027 (checked 2026-10-09). Nasdaq lists no Copenhagen half
  days. These differ from Danish public holidays (24 and 31 December
  are exchange closures). Later years are not yet published.

Supporting changes
- Exchange status logic moved from the dashboard into
  Private/Get-ExchangeSessionStatus.ps1 (behaviour preserved) so it can
  be tested without WPF. Countdowns are now measured in UTC, so they
  stay correct on DST transition days. Format-CountdownSpan replaces
  the inline countdown formatting.
- Private/Test-ExchangeActive holds the existing saved-selection logic.
- Get-StockExchangeData appends built-in exchanges missing from a cache
  younger than 30 days, without overwriting cached entries, so
  existing installs see the new exchange without -ForceRefresh.
- README, about help, docs and manifest description updated (20 -> 21
  exchanges); README's ActiveExchanges default corrected to the seeded
  example list.
- Pester tests: sessions, auctions, weekends, holidays, CET/CEST
  transitions, machine-timezone independence, missing holiday data,
  selection persistence and cache handling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds OMXC25 as a true index (not an ETF proxy) on the existing
Indices tab, associated with Nasdaq Copenhagen (XCSE), Denmark, DKK.

Provider and plan
- Twelve Data /quote, symbol OMXC25. Twelve Data's /indices catalogue
  lists it as "OMX Copenhagen 25 Index" (DKK) with access level "Pro",
  so free/Basic keys get HTTP 403. The index is therefore turned off by
  default: the row is shown greyed out with a note explaining why, and
  no request is made. Enable it by adding "EnabledIndices": ["OMXC25"]
  to user-preferences.json (new optional preference, carried through
  Save-UserPreferences; no Settings UI yet).

When enabled
- Fetched in its own request with its own 15-minute cache, so a plan
  restriction or failure never affects the existing ETF batch.
- HTTP 403/404 stop further requests for that key for the session
  (no wasted credits); 429/network errors retry after the TTL and keep
  showing the last good quote.
- Status line: Intraday (may be delayed) / Last close / Stale /
  Unavailable, judged against the dashboard's own Nasdaq Copenhagen
  hours and holidays rather than Twelve Data's is_market_open (which
  files OMXC25 under Stockholm, XSTO). Stale values are greyed out.
  Twelve Data does not state whether quotes are real-time, so nothing
  is labelled "live". Quote time is shown in Copenhagen time.

Code
- Private/IndexQuotes.ps1: index definitions (the eight ETF proxies
  moved here unchanged), Test-IndexEnabled, Twelve Data quote parsing,
  per-index cache with back-off, and quote-status classification.
- README: OMXC25 section with enabling and troubleshooting steps.
- Pester tests: registration, opt-in, parsing, mocked retrieval,
  network failure, cache/TTL/back-off and quote status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant