Repository navigation
Conversation
Turns a series of downloaded Nordnet fund lists into a basis for
choosing funds. Pure stdlib Python, self-contained under fond/ and
outside the petrolib package and test path.
The core problem the tooling addresses: ranking a single export by
trailing return measures which market did well, not which fund is
good. Morningstar's category column is too coarse to fix this on its
own -- it files Norwegian, Swedish, Danish, Nordic and broad European
index funds together under "Europe Equity Large Cap", a 25-percentage-
point spread that is pure geography.
So funds are grouped by an exposure key derived from the fund name
(market, sector, size segment, currency hedging, factor/ESG tilt) and
ranked only within a group. Name matching deliberately omits word
boundaries for most tokens: Norwegian fund names are compounds
("KLP AksjeNorge Indeks", "AksjeUSA", "AksjeVerden") where a \b anchor
never matches, and Amundi contracts to "EurSRIClmtPrsAlgd". The name
takes priority over the category, which is only a fallback.
Scoring within a group weights cost highest (0.45) -- it is the one
field known in advance -- then return relative to the group median,
then consistency across periods. Morningstar stars, the risk number
(4 for 74 of 84 funds) and owner counts are carried in the panel but
kept out of the score.
Stacking exports also yields a NAV series per ISIN, which gives
volatility, max drawdown and pairwise correlation -- the last of these
identifies funds that are duplicates of each other. These switch on at
four snapshots; below that the report says so and falls back to the
export's own return columns.
Classification by name is a heuristic, so funds deviating more than 3pp
from their group are flagged and sorted last rather than topping the
list, and overrides.csv pins exposure per ISIN. It ships with one real
case: Alfred Berg Indeks R tracks Oslo Børs, but its name says nothing
and Morningstar files it under Europe.
Parsing handles Nordnet's actual format: UTF-16LE, tab-separated,
decimal comma, and U+2212 MINUS SIGN rather than ASCII hyphen.
27 tests under fond/test_fond.py (stdlib unittest, also runnable under
pytest); pyproject's testpaths keeps them out of the petrolib suite.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L8cF2pbLZuncatMezhAV63
fond/test_fond.py is stdlib-only and lives outside pyproject's testpaths, so neither the lint job (which checks petrolib, tests and tools) nor the petrolib pytest lane ever executed it. Own job, own runner, pinned to 3.10 -- the oldest version fond/ claims to support. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L8cF2pbLZuncatMezhAV63
Owner
Author
|
Closing — this moved to its own repository at ingehap/fond_analyse, which is where the note at the bottom of this description suggested it might belong. The same files now sit at the repo root rather than under
All four jobs are green on the initial commit. The branch Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Turns a series of downloaded Nordnet fund lists into a basis for choosing funds. Pure stdlib Python 3.10+, self-contained under
fond/, outside thepetrolibpackage and outside pyproject'stestpaths— no existing library code, test or CI job is modified. The only change outsidefond/is one added CI job (see Testing).The problem
Ranking a single export by trailing return measures which market did well, not which fund is good. In the attached 18.8.2026 export, currency-hedged Asia and Norway funds top the 1-year list — that is the krone and one good year on Oslo Børs, not fund quality.
Morningstar's category column can't fix this on its own. It files these five together under
Europe Equity Large Cap:A 25-percentage-point spread that is pure geography.
Approach
Funds are grouped by an exposure key derived from the fund name — market, sector, size segment, currency hedging, factor/ESG tilt — and ranked only within a group.
Name matching deliberately omits
\banchors for most tokens: Norwegian fund names are compounds (KLP AksjeNorge Indeks,AksjeUSA,AksjeVerden) where a word boundary never matches, and Amundi contracts toEurSRIClmtPrsAlgd. The name takes priority over the category, which is only a fallback. Sector comes from the category rather than the name, since name matching turnsHandelsbankenandSpareBank 1into financials funds.Hedged and unhedged variants are separate groups. Same index, same manager:
Those 8.6 points are the exchange rate.
Scoring
Z-scores within the group: cost 0.45, return vs. the group median 0.35, consistency across 3m/1y/3y/5y 0.20. Cost weighs heaviest because it is the one field known in advance and it applies every year regardless of what the market does.
Morningstar stars (missing for 22 of 84 funds), the risk number (4 for 74 of 84) and owner counts stay in the panel and the
--csvoutput but out of the score.What the monthly cadence adds
Sisteis the unit price, and NAV for Norwegian and Nordic funds is total return. Stacking exports gives a NAV series per ISIN, and with it volatility, max drawdown, and pairwise correlation — the last identifying funds that are duplicates of each other. These switch on at four snapshots; below that the report says so and falls back to the export's own return columns.--endringeralso surfaces price changes and funds that drop off the list, neither of which anyone notifies you about.Handling classification error
Name-based classification is a heuristic, so funds deviating more than 3pp from their group are flagged and sorted last rather than allowed to top the list. On the sample data this catches
Nordnet Europa Indeks(IE00BMTD2N07) at −3.0pp — an Irish-domiciled fund tracking a different Europe index than its peers.overrides.csvpins exposure per ISIN and ships with one real case: Alfred Berg Indeks R tracks Oslo Børs, but its name says nothing and Morningstar files it under Europe. Without the override it appeared to beat the Europe group by six percentage points.Parsing
Nordnet's actual format: UTF-16LE with BOM, tab-separated, decimal comma, thousands separated by NBSP, and U+2212 MINUS SIGN rather than ASCII hyphen. The snapshot date comes from the most common NAV date in the file rather than the filename, so the few funds priced a day later don't move it, and
ingest.pyis idempotent on re-run.Testing
27 tests in
fond/test_fond.py(stdlibunittest, also runnable under pytest), covering number/date parsing, the compound-name and contracted-name cases, sector-from-category, hedged/unhedged separation, overrides, and — against a synthetic six-month panel — NAV metrics, max drawdown, duplicate detection and the ranking itself.They live under
fond/rather thantests/so pyproject'stestpaths = ["tests"]keeps them out of the petrolib suite. That also meant nothing in CI ran them — the lint job checkspetrolib tests toolsand the pytest lane honourstestpaths— so the second commit adds a separatefond-testsjob on 3.10, the oldest versionfond/claims to support. It shares no setup with the existing jobs and does not alter them.Note
fond/is unrelated to petrophysics. It is isolated in its own directory with no imports either way, but say the word if it belongs in a separate repo instead.