Name Trade Republic uploads by statement period
Trade Republic statements all download as document-N.pdf, which says
nothing about what they hold. traderepublic now implements parser.Namer:
it reads the period from the address block at the top of the first page
("DATE 01 May 2025 - 31 Jul 2026") and names the statement
traderepublic_2025_05_01_2026_07_31, lowercase like the NLB names, so the
folder sorts by start date and two downloads of one statement meet under
one name. The transaction table's own DATE heading never matches, since
no date range follows it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -162,3 +162,19 @@ func TestParseTradeRepublicIgnoresAmountsInDescription(t *testing.T) {
|
||||
t.Errorf("description = %q, want the inline figure kept", txns[0].Description)
|
||||
}
|
||||
}
|
||||
|
||||
// A statement is named after the period in its header; the transaction
|
||||
// table's DATE heading, with no dates after it, is not mistaken for it.
|
||||
func TestTradeRepublicStatementName(t *testing.T) {
|
||||
header := "NIKOLA PETROV DATE 01 May 2025 - 31 Jul 2026\n" +
|
||||
"Ulica 21 IBAN DE00000000000000000000\n\n" +
|
||||
"DATE TYPE DESCRIPTION MONEY IN MONEY OUT BALANCE\n"
|
||||
if got := tradeRepublicStatementName(header); got != "traderepublic_2025_05_01_2026_07_31" {
|
||||
t.Errorf("name = %q, want traderepublic_2025_05_01_2026_07_31", got)
|
||||
}
|
||||
table := "DATE TYPE DESCRIPTION MONEY IN MONEY OUT BALANCE\n" +
|
||||
"01 Jul 2026 Interest Interest payment €1.17 €671.58\n"
|
||||
if got := tradeRepublicStatementName(table); got != "" {
|
||||
t.Errorf("name without a period = %q, want none", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user