feat(finance): import a watchlist file into a new list named after it - #163
Merged
Conversation
Import now creates its own list instead of merging into whatever tab was
active: "my-tech-list.csv" -> "My Tech List", so an exported list
round-trips. A name already in use gets a numeric suffix ("Tech 2")
rather than a second identical tab, and the file's symbols are validated
client-side first so a junk file never leaves an empty list behind.
If list creation fails, the import falls back to the active list.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
| }); | ||
|
|
||
| it('strips directories, extensions and separators', () => { | ||
| expect(watchlistNameFromFilename('/tmp/dir/high_beta-names.csv')).toBe('High Beta Names'); |
ThreatCrush Security Scan225 finding(s) HIGH/CRITICAL: 137 | MEDIUM: 88
…and 175 more. Full results in the Security tab. Snippets are redacted; ThreatCrush never prints matched credential material. |
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.
Follow-up to #162. Import used to merge the file's tickers into whichever tab happened to be active; now it creates its own list.
my-tech-list.csv→ My Tech List, the inverse of the export filename, so a list exported and re-imported comes back under its original name. A file the user capitalized themselves (FAANG picks.txt→FAANG picks) is left alone; directories and extensions are stripped; the name is capped atMAX_WATCHLIST_NAME.Tech 2,Tech 3… rather than a second identical tab (case-insensitive match, and the suffix stays within the length cap).parseSymbolListbefore the list is created, so a junk or ticker-less file reports "No valid tickers found." and creates nothing.New pure helpers
watchlistNameFromFilenameanduniqueWatchlistNameinsrc/lib/finance/watchlist.ts, both unit-tested including the export→import round trip.submitSymbolstakes an optional target list id; paste-to-add is unchanged. No schema or API changes.Checks:
pnpm typecheckclean,pnpm buildcompiles, full suite 2531 passed / 7 skipped. Lint: 0 errors (5 pre-existingreact-hooks/set-state-in-effectwarnings in this file).🤖 Generated with Claude Code