Skip to content

feat: add Nasdaq Copenhagen (XCSE) as a supported exchange - #5

Open
knightmare2600 wants to merge 2 commits into
PowerShellYoungTeam:mainfrom
knightmare2600:pr/feat-nasdaq-copenhagen
Open

knightmare2600 wants to merge 2 commits into
PowerShellYoungTeam:mainfrom
knightmare2600:pr/feat-nasdaq-copenhagen

Conversation

@knightmare2600

@knightmare2600 knightmare2600 commented Oct 9, 2026 •

Copy link
Copy Markdown

Summary

Adds Nasdaq Copenhagen (Nasdaq København, XCSE) as the 21st exchange, using the existing exchange, holiday, map, flyout, world-clock and preference mechanisms. It is not active by default, and existing saved selections are not changed.

Depends on #4 (it uses that PR's Private/ loader and Tests/ folder). Please merge #4 first; the commit new in this PR is "feat: add Nasdaq Copenhagen (XCSE) as a supported exchange".

What's added

  • Exchange record:
    • code XCSE, symbol OMXC;
    • Copenhagen, Denmark, DKK;
    • map marker at 55.6761 / 12.5683;
    • TimeZoneId = 'Romance Standard Time', the Windows ID that .NET maps from IANA Europe/Copenhagen. CET/CEST comes from the OS timezone rules, not a hard-coded offset.
  • Trading hours. Main-market equities run 09:00–17:00 Copenhagen time. Two new optional exchange fields mark the auction phases, so the call phases aren't presented as pre-market or continuous trading:
    • OpeningAuctionStart = '08:45': from 08:45 the status reads "Opening auction – opens in …";
    • ClosingAuctionStart = '16:55': from 16:55 it reads "Closing auction – ends in …".
    • Status values, colours and notifications are unchanged. The flyout lists both auction windows.
    • Sources: Nasdaq European Markets Trading Hours and Holiday Schedule (equities 09:00–17:00; footnote: "Last five minutes: no order matching; final uncross takes place randomly during the last 30 seconds") and the Nasdaq INET Nordic Auctions factsheet (doc. 1015-26: Copenhagen opening 08:45–09:00, random uncross 09:00:00–09:00:05; closing 16:55–17:00, random uncross 16:59:30–17:00).
  • Holidays. holidays.json gains the official Nasdaq Copenhagen equity closures for 2025–2027, from the same Nasdaq holiday schedule, checked 2026-10-09.
    • Nasdaq lists no Copenhagen half-days.
    • Exchange closures differ from Danish public holidays: 24 and 31 December are exchange closures.
  • Exchange details for the flyout. Regulator: Finanstilsynet (Danish FSA), per Nasdaq's Copenhagen rules page. Market cap and listing count are shown as n/a rather than unsourced figures.
  • Docs. README Nasdaq Copenhagen section and exchange table; about help, docs and manifest description updated (20 → 21 exchanges); the README's ActiveExchanges default corrected to the seeded example list.

Supporting changes

  • Status logic extracted. It moved from the dashboard into the non-exported Private/Get-ExchangeSessionStatus.ps1 so it can be tested without WPF. Existing behaviour is preserved. There's an explicit test that an exchange without the auction fields (XETR) is unchanged.
  • Countdowns measured in UTC, so they stay correct on a weekday DST transition.
  • New Format-CountdownSpan helper for countdown text. It truncates hours; see fix: truncate hours in countdowns instead of rounding them #2.
  • Saved-selection logic moved into Test-ExchangeActive, with unchanged behaviour.
  • Cache fix in Get-StockExchangeData. It now appends built-in exchanges that are missing from a cache younger than 30 days, without overwriting cached entries. Without this, existing installs would not see a new exchange for up to 30 days.

Interaction with other PRs

#2 edits five countdown lines that this PR replaces with Format-CountdownSpan (which also truncates). If both are merged, the second conflicts on those lines — keep this PR's version.

Known limitations

  • Holidays after 2027 are not yet published by Nasdaq; until holidays.json is updated, later weekdays count as trading days.
  • holidays.json marks whole-day closures only, so early closes cannot be expressed.
  • Opening uncross is random within 09:00:00–09:00:05; the status switches to Open at exactly 09:00.

Checks

  • Pester: 51 passed, 0 failed (43 new). The new tests cover:
    • before the open, in session, both auctions and after the close;
    • weekends and official holidays, including Christmas Eve;
    • Copenhagen not inheriting another market's holidays;
    • the CET→CEST and CEST→CET weeks;
    • a weekday DST change;
    • machine-timezone independence (subprocesses under America/New_York, Asia/Tokyo, Pacific/Auckland);
    • missing holiday data;
    • selection persistence;
    • cache merge and offline fallback.
  • Mutation check: breaking hour truncation, or ignoring holidays, makes the relevant tests fail.
  • Parses cleanly; manifest validates; exported commands unchanged.
  • 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 2 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>

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