Skip to content

Commit 93f220f

Browse files
authored
Modify Trade Republic PDF-Importer to support new transaction (#4315)
https://forum.portfolio-performance.info/t/pdf-import-von-trade-republic/5107/681
1 parent 66263c2 commit 93f220f

File tree

3 files changed

+66
-9
lines changed

3 files changed

+66
-9
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
PDFBox Version: 1.8.17
2+
Portfolio Performance Version: 0.71.2
3+
-----------------------------------------
4+
TRADE REPUBLIC BANK GMBH BRUNNENSTRASSE 19-21 10119 BERLIN
5+
Vorname Nachname SEITE 1 von 1
6+
Straße 123 DATUM 02.09.2024
7+
PLZ Ort AUSFÜHRUNG 4e58-c971
8+
SAVEBACK 9eed-7c4d
9+
CRYPTO- BitGo Deutschland
10+
WALLET GmbH
11+
DEPOT 123234345
12+
ABRECHNUNG CRYPTO SAVEBACK
13+
ÜBERSICHT
14+
Saveback Ausführung am 02.09.2024 im außerbörslichen Handel Bankhaus Scheich.
15+
Der Kontrahent der Transaktion ist Bankhaus Scheich Wertpapierspezialist AG.
16+
POSITION ANZAHL DURCHSCHNITTSKURS BETRAG
17+
Bitcoin (BTC) 0,000254 Stk. 53.988,63 EUR 13,71 EUR
18+
GESAMT 13,71 EUR
19+
BUCHUNG
20+
VERRECHNUNGSKONTO WERTSTELLUNG BETRAG
21+
DE123234345456 02.09.2024 -13,71 EUR
22+
Diese Abrechnung wird maschinell erstellt und daher nicht unterschrieben.
23+
Die Cryptowerte werden in einer zentralen Wallet bei dem Cryptoverwahrer BitGo Deutschland GmbH verwahrt.
24+
Trade Republic Bank GmbH www.traderepublic.com Sitz der Gesellschaft: Berlin Geschäftsführer
25+
Brunnenstraße 19-21 [email protected] AG Charlottenburg HRB 244347 B Andreas Torner
26+
10119 Berlin USt-ID DE307510626 Gernot Mittendorfer

name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/traderepublic/TradeRepublicPDFExtractorTest.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,36 @@ public void testCryptoKauf05()
962962
hasTaxes("EUR", 0.00), hasFees("EUR", 1.00))));
963963
}
964964

965+
@Test
966+
public void testCryptoKauf06()
967+
{
968+
List<Exception> errors = new ArrayList<>();
969+
970+
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "CryptoKauf06.txt"), errors);
971+
972+
assertThat(countSecurities(results), is(1L));
973+
assertThat(countBuySell(results), is(1L));
974+
assertThat(countAccountTransactions(results), is(0L));
975+
assertThat(results.size(), is(2));
976+
new AssertImportActions().check(results, CurrencyUnit.EUR);
977+
978+
// check security
979+
assertThat(results, hasItem(security( //
980+
hasIsin(null), hasWkn(null), hasTicker("BTC"), //
981+
hasName("Bitcoin"), //
982+
hasCurrencyCode("EUR"), //
983+
hasFeed(CoinGeckoQuoteFeed.ID), //
984+
hasFeedProperty(CoinGeckoQuoteFeed.COINGECKO_COIN_ID, "bitcoin"))));
985+
986+
// check buy sell transaction
987+
assertThat(results, hasItem(purchase( //
988+
hasDate("2024-09-02T00:00"), hasShares(0.000254), //
989+
hasSource("CryptoKauf06.txt"), //
990+
hasNote("Ausführung: 4e58-c971 | Saveback: 9eed-7c4d"), //
991+
hasAmount("EUR", 13.71), hasGrossValue("EUR", 13.71), //
992+
hasTaxes("EUR", 0.00), hasFees("EUR", 0.00))));
993+
}
994+
965995
@Test
966996
public void testCryptoVerkauf01()
967997
{

name.abuchen.portfolio/src/name/abuchen/portfolio/datatransfer/pdf/TradeRepublicPDFExtractor.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ private void addBuySellTransaction()
7979

8080
Transaction<BuySellEntry> pdfTransaction = new Transaction<>();
8181

82-
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH .*$");
82+
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH.*$");
8383
type.addBlock(firstRelevantLine);
8484
firstRelevantLine.set(pdfTransaction);
8585

@@ -843,12 +843,12 @@ private void addSellWithNegativeAmountTransaction()
843843

844844
private void addBuySellCryptoTransaction()
845845
{
846-
DocumentType type = new DocumentType("(ABRECHNUNG CRYPTOGESCH.FT|CRYPTO SPARPLAN)");
846+
DocumentType type = new DocumentType("(ABRECHNUNG CRYPTOGESCH.FT|CRYPTO SPARPLAN|ABRECHNUNG CRYPTO SAVEBACK)");
847847
this.addDocumentTyp(type);
848848

849849
Transaction<BuySellEntry> pdfTransaction = new Transaction<>();
850850

851-
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH .*$");
851+
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH.*$", "^Diese Abrechnung wird maschinell erstellt.*$");
852852
type.addBlock(firstRelevantLine);
853853
firstRelevantLine.set(pdfTransaction);
854854

@@ -900,10 +900,11 @@ private void addBuySellCryptoTransaction()
900900
.assign((t, v) -> t.setDate(asDate(v.get("date"), v.get("time")))),
901901
// @formatter:off
902902
// Sparplanausführung am 16.05.2023 im außerbörslichen Handel Bankhaus Scheich.
903+
// Saveback Ausführung am 02.09.2024 im außerbörslichen Handel Bankhaus Scheich.
903904
// @formatter:on
904905
section -> section //
905906
.attributes("date") //
906-
.match("^Sparplanausf.hrung .* (?<date>[\\d]{2}\\.[\\d]{2}\\.[\\d]{4}) .*$") //
907+
.match("^(Sparplanausf.hrung|Saveback) .* (?<date>[\\d]{2}\\.[\\d]{2}\\.[\\d]{4}) .*$") //
907908
.assign((t, v) -> t.setDate(asDate(v.get("date")))))
908909

909910
.oneOf( //
@@ -1052,7 +1053,7 @@ private void addDividendeTransaction()
10521053

10531054
Transaction<AccountTransaction> pdfTransaction = new Transaction<>();
10541055

1055-
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH .*$"); //
1056+
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH.*$"); //
10561057
type.addBlock(firstRelevantLine);
10571058
firstRelevantLine.set(pdfTransaction);
10581059

@@ -2812,7 +2813,7 @@ private void addDepositStatementTransaction()
28122813

28132814
Transaction<AccountTransaction> pdfTransaction = new Transaction<>();
28142815

2815-
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH .*$");
2816+
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH.*$");
28162817
type.addBlock(firstRelevantLine);
28172818
firstRelevantLine.set(pdfTransaction);
28182819

@@ -3101,7 +3102,7 @@ private void addFeeStatementTransaction()
31013102

31023103
Transaction<AccountTransaction> pdfTransaction = new Transaction<>();
31033104

3104-
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH .*$");
3105+
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH.*$");
31053106
type.addBlock(firstRelevantLine);
31063107
firstRelevantLine.set(pdfTransaction);
31073108

@@ -3268,7 +3269,7 @@ private void addBuySellTaxReturnBlock(DocumentType type)
32683269
{
32693270
Transaction<AccountTransaction> pdfTransaction = new Transaction<>();
32703271

3271-
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH .*$");
3272+
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH.*$");
32723273
type.addBlock(firstRelevantLine);
32733274
firstRelevantLine.set(pdfTransaction);
32743275

@@ -3565,7 +3566,7 @@ private void addDividendeTaxReturnBlock(DocumentType type)
35653566
{
35663567
Transaction<AccountTransaction> pdfTransaction = new Transaction<>();
35673568

3568-
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH .*$");
3569+
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH.*$");
35693570
type.addBlock(firstRelevantLine);
35703571
firstRelevantLine.set(pdfTransaction);
35713572

0 commit comments

Comments
 (0)