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 #3801

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,28 @@
PDFBox Version: 1.8.17
Portfolio Performance Version: 0.67.3
-----------------------------------------
TRADE REPUBLIC BANK GMBH BRUNNENSTRASSE 19-21 10119 BERLIN
vdKvP VUBCnscro SEITE 1 von 1
pCVMWiOWE-WSyybgJqJ-CJHPRJ 44 DATUM 09.02.2024
79325 NmxfEe AUSFÜHRUNG 8f44-fdf5
ROUND UP 42c2-50a7
DEPOT 4814460061
WERTPAPIERABRECHNUNG ROUND UP
ÜBERSICHT
Ausführung von Round up am 09.02.2024 an der Lang & Schwarz Exchange.
Der Kontrahent der Transaktion ist Lang & Schwarz TradeCenter AG & Co. KG.
POSITION ANZAHL DURCHSCHNITTSKURS BETRAG
iSh.ST.Gl.Sel.Div.100 U.ETF DE 0,09351 Stk. 26,735 EUR 2,50 EUR
Inhaber-Anteile
ISIN: DE000A0F5UH1
GESAMT 2,50 EUR
BUCHUNG
VERRECHNUNGSKONTO WERTSTELLUNG BETRAG
DE85XXXXXXXXXXXXXXXXXX 13.02.2024 -2,50 EUR
iSh.ST.Gl.Sel.Div.100 U.ETF DE Inhaber-Anteile in Girosammelverwahrung in Deutschland.
Diese Abrechnung wird maschinell erstellt und daher nicht unterschrieben.
Sofern keine Umsatzsteuer ausgewiesen ist, handelt es sich gem. § 4 Nr. 8 UStG um eine umsatzsteuerfreie Leistung.
Trade Republic Bank GmbH www.traderepublic.com Sitz der Gesellschaft: Berlin Geschäftsführer
Brunnenstraße 19-21 service@traderepublic.com AG Charlottenburg HRB 244347 B Andreas Torner
10119 Berlin USt-ID DE307510626 Gernot Mittendorfer
ABRE / 09.02.2024 / 56127006 / f122-a87c
Expand Up @@ -535,6 +535,37 @@ public void testWertpapierKauf11()
hasTaxes("EUR", 0.00), hasFees("EUR", 1.00))));
}

@Test
public void testWertpapierKauf12()
{
TradeRepublicPDFExtractor extractor = new TradeRepublicPDFExtractor(new Client());

List<Exception> errors = new ArrayList<>();

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

assertThat(errors, empty());
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("DE000A0F5UH1"), hasWkn(null), hasTicker(null), //
hasName("iSh.ST.Gl.Sel.Div.100 U.ETF DE Inhaber-Anteile"), //
hasCurrencyCode("EUR"))));

// check buy sell transaction
assertThat(results, hasItem(purchase( //
hasDate("2024-02-09T00:00"), hasShares(0.09351), //
hasSource("Kauf12.txt"), //
hasNote(null), //
hasAmount("EUR", 2.50), hasGrossValue("EUR", 2.50), //
hasTaxes("EUR", 0.00), hasFees("EUR", 0.00))));
}

@Test
public void testBuy01()
{
Expand Down
Expand Up @@ -54,6 +54,7 @@ private void addBuySellTransaction()
{
DocumentType type = new DocumentType("(WERTPAPIERABRECHNUNG" //
+ "|WERTPAPIERABRECHNUNG SPARPLAN" //
+ "|WERTPAPIERABRECHNUNG ROUND UP" //
+ "|SECURITIES SETTLEMENT SAVINGS PLAN" //
+ "|SECURITIES SETTLEMENT" //
+ "|REINVESTIERUNG" //
Expand Down Expand Up @@ -182,6 +183,13 @@ private void addBuySellTransaction()
.match("^(Sparplanausf.hrung|Savings plan) .* (?<date>([\\d]{2}\\.[\\d]{2}\\.[\\d]{4}|[\\d]{4}\\-[\\d]{2}\\-[\\d]{2})) .*$") //
.assign((t, v) -> t.setDate(asDate(v.get("date")))),

// @formatter:off
// Ausführung von Round up am 09.02.2024 an der Lang & Schwarz Exchange.
// @formatter:on
section -> section.attributes("date") //
.match("^Ausf.hrung von Round up .* (?<date>([\\d]{2}\\.[\\d]{2}\\.[\\d]{4}|[\\d]{4}\\-[\\d]{2}\\-[\\d]{2})) .*$") //
.assign((t, v) -> t.setDate(asDate(v.get("date")))),

// @formatter:off
// This is for the reinvestment of dividends
//
Expand All @@ -190,7 +198,6 @@ private void addBuySellTransaction()
section -> section.attributes("date") //
.match("^[\\w]+ (?<date>([\\d]{2}\\.[\\d]{2}\\.[\\d]{4}|[\\d]{4}\\-[\\d]{2}\\-[\\d]{2})) [\\.,\\d]+ [\\w]{3}$") //
.assign((t, v) -> t.setDate(asDate(v.get("date")))))

// @formatter:off
// If the type of transaction is "SELL" and the amount
// is negative, then the gross amount set.
Expand Down