Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify Trade Republic PDF-Importer to support new transaction #4315

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
PDFBox Version: 1.8.17
Portfolio Performance Version: 0.71.2
-----------------------------------------
TRADE REPUBLIC BANK GMBH BRUNNENSTRASSE 19-21 10119 BERLIN
Vorname Nachname SEITE 1 von 1
Straße 123 DATUM 02.09.2024
PLZ Ort AUSFÜHRUNG 4e58-c971
SAVEBACK 9eed-7c4d
CRYPTO- BitGo Deutschland
WALLET GmbH
DEPOT 123234345
ABRECHNUNG CRYPTO SAVEBACK
ÜBERSICHT
Saveback Ausführung am 02.09.2024 im außerbörslichen Handel Bankhaus Scheich.
Der Kontrahent der Transaktion ist Bankhaus Scheich Wertpapierspezialist AG.
POSITION ANZAHL DURCHSCHNITTSKURS BETRAG
Bitcoin (BTC) 0,000254 Stk. 53.988,63 EUR 13,71 EUR
GESAMT 13,71 EUR
BUCHUNG
VERRECHNUNGSKONTO WERTSTELLUNG BETRAG
DE123234345456 02.09.2024 -13,71 EUR
Diese Abrechnung wird maschinell erstellt und daher nicht unterschrieben.
Die Cryptowerte werden in einer zentralen Wallet bei dem Cryptoverwahrer BitGo Deutschland GmbH verwahrt.
Trade Republic Bank GmbH www.traderepublic.com Sitz der Gesellschaft: Berlin Geschäftsführer
Brunnenstraße 19-21 [email protected] AG Charlottenburg HRB 244347 B Andreas Torner
10119 Berlin USt-ID DE307510626 Gernot Mittendorfer
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,36 @@ public void testCryptoKauf05()
hasTaxes("EUR", 0.00), hasFees("EUR", 1.00))));
}

@Test
public void testCryptoKauf06()
{
List<Exception> errors = new ArrayList<>();

List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "CryptoKauf06.txt"), errors);

assertThat(countSecurities(results), is(1L));
assertThat(countBuySell(results), is(1L));
assertThat(countAccountTransactions(results), is(0L));
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);

// check security
assertThat(results, hasItem(security( //
hasIsin(null), hasWkn(null), hasTicker("BTC"), //
hasName("Bitcoin"), //
hasCurrencyCode("EUR"), //
hasFeed(CoinGeckoQuoteFeed.ID), //
hasFeedProperty(CoinGeckoQuoteFeed.COINGECKO_COIN_ID, "bitcoin"))));

// check buy sell transaction
assertThat(results, hasItem(purchase( //
hasDate("2024-09-02T00:00"), hasShares(0.000254), //
hasSource("CryptoKauf06.txt"), //
hasNote("Ausführung: 4e58-c971 | Saveback: 9eed-7c4d"), //
hasAmount("EUR", 13.71), hasGrossValue("EUR", 13.71), //
hasTaxes("EUR", 0.00), hasFees("EUR", 0.00))));
}

@Test
public void testCryptoVerkauf01()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private void addBuySellTransaction()

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

Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH .*$");
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH.*$");
type.addBlock(firstRelevantLine);
firstRelevantLine.set(pdfTransaction);

Expand Down Expand Up @@ -843,12 +843,12 @@ private void addSellWithNegativeAmountTransaction()

private void addBuySellCryptoTransaction()
{
DocumentType type = new DocumentType("(ABRECHNUNG CRYPTOGESCH.FT|CRYPTO SPARPLAN)");
DocumentType type = new DocumentType("(ABRECHNUNG CRYPTOGESCH.FT|CRYPTO SPARPLAN|ABRECHNUNG CRYPTO SAVEBACK)");
this.addDocumentTyp(type);

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

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

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

.oneOf( //
Expand Down Expand Up @@ -1052,7 +1053,7 @@ private void addDividendeTransaction()

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

Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH .*$"); //
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH.*$"); //
type.addBlock(firstRelevantLine);
firstRelevantLine.set(pdfTransaction);

Expand Down Expand Up @@ -2812,7 +2813,7 @@ private void addDepositStatementTransaction()

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

Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH .*$");
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH.*$");
type.addBlock(firstRelevantLine);
firstRelevantLine.set(pdfTransaction);

Expand Down Expand Up @@ -3101,7 +3102,7 @@ private void addFeeStatementTransaction()

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

Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH .*$");
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH.*$");
type.addBlock(firstRelevantLine);
firstRelevantLine.set(pdfTransaction);

Expand Down Expand Up @@ -3268,7 +3269,7 @@ private void addBuySellTaxReturnBlock(DocumentType type)
{
Transaction<AccountTransaction> pdfTransaction = new Transaction<>();

Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH .*$");
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH.*$");
type.addBlock(firstRelevantLine);
firstRelevantLine.set(pdfTransaction);

Expand Down Expand Up @@ -3565,7 +3566,7 @@ private void addDividendeTaxReturnBlock(DocumentType type)
{
Transaction<AccountTransaction> pdfTransaction = new Transaction<>();

Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH .*$");
Block firstRelevantLine = new Block("^TRADE REPUBLIC BANK GMBH.*$");
type.addBlock(firstRelevantLine);
firstRelevantLine.set(pdfTransaction);

Expand Down