Skip to content

Commit 8e45ab1

Browse files
committed
Swissquote importer: add Option Premium as dividend transaction
Issue: https://forum.portfolio-performance.info/t/pdf-import-von-swissquote-bank/15835/70
1 parent 452a8ea commit 8e45ab1

3 files changed

Lines changed: 113 additions & 2 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
PDFBox Version: 3.0.6
2+
Portfolio Performance Version: 0.83.2
3+
System: win32 | x86_64 | 21.0.5+11-LTS | Azul Systems, Inc.
4+
-----------------------------------------
5+
TRANSAKTIONSBELEG
6+
Kunde: 1805027 - TRADING
7+
IBAN: OD1697441568843804599
8+
NXUxt qZwZb und-oder iHnABh dmQYGPOlN fByex
9+
YdPTGUXdthnd 6a
10+
DE-30908 nDfgzu
11+
Gland, 13.05.2026
12+
Option Premium Unsere Referenz: 1097680988
13+
Im Hinblick auf folgenden Titel:
14+
Titel
15+
Bezeichnung Anzahl
16+
INCOMESHARES GOLD YIELD ETP ISIN: XS2852999775 581
17+
NKN: 136957026
18+
haben wir Ihrem Konto den folgenden Betrag gutgeschrieben:
19+
Kontonummer 734035875
20+
Ausführungsdatum 05.05.2026
21+
Valutadatum 12.05.2026
22+
Anzahl 581
23+
Prämienanteil 0.14405405 USD
24+
Betrag USD 83.70
25+
Total USD 83.70
26+
Wechselkurs USD / CHF : 0.7819
27+
Dieser Transaktionsbeleg sowie die aufgeführte Transaktion unterliegen unseren Allgemeinen Geschäftsbedingungen und Depotreglement.
28+
Swissquote Bank AG, 33 chemin de la Crétaux, CH-1196 Gland Formular ohne Unterschrift | SE&O.
29+
Customer Care : 0848 25 88 88 (Aus dem Ausland +41 44 825 88 88)
30+
CHE-116.310.079 MwSt

name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/swissquote/SwissquotePDFExtractorTest.java

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,76 @@ public void testDividende14WithSecurityInCHF()
19741974
hasTaxes("USD", 23.30), hasFees("USD", 0.00))));
19751975
}
19761976

1977+
@Test
1978+
public void testDividende15()
1979+
{
1980+
var extractor = new SwissquotePDFExtractor(new Client());
1981+
1982+
List<Exception> errors = new ArrayList<>();
1983+
1984+
var results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Dividende15.txt"), errors);
1985+
1986+
assertThat(errors, empty());
1987+
assertThat(countSecurities(results), is(1L));
1988+
assertThat(countBuySell(results), is(0L));
1989+
assertThat(countAccountTransactions(results), is(1L));
1990+
assertThat(countAccountTransfers(results), is(0L));
1991+
assertThat(countItemsWithFailureMessage(results), is(0L));
1992+
assertThat(countSkippedItems(results), is(0L));
1993+
assertThat(results.size(), is(2));
1994+
new AssertImportActions().check(results, "USD");
1995+
1996+
// check security
1997+
assertThat(results, hasItem(security( //
1998+
hasIsin("XS2852999775"), hasWkn("136957026"), hasTicker(null), //
1999+
hasName("INCOMESHARES GOLD YIELD ETP"), //
2000+
hasCurrencyCode("USD"))));
2001+
2002+
// check dividend transaction
2003+
assertThat(results, hasItem(dividend( //
2004+
hasDate("2026-05-12T00:00"), hasShares(581.00), //
2005+
hasSource("Dividende15.txt"), //
2006+
hasNote("Referenz: 1097680988"), //
2007+
hasAmount("USD", 83.70), hasGrossValue("USD", 83.70), //
2008+
hasTaxes("USD", 0.00), hasFees("USD", 0.00))));
2009+
}
2010+
2011+
@Test
2012+
public void testDividende15WithSecurityInCHF()
2013+
{
2014+
var security = new Security("INCOMESHARES GOLD YIELD ETP", "CHF");
2015+
security.setIsin("XS2852999775");
2016+
security.setWkn("136957026");
2017+
2018+
var client = new Client();
2019+
client.addSecurity(security);
2020+
2021+
var extractor = new SwissquotePDFExtractor(client);
2022+
2023+
List<Exception> errors = new ArrayList<>();
2024+
2025+
var results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Dividende15.txt"), errors);
2026+
2027+
assertThat(errors, empty());
2028+
assertThat(countSecurities(results), is(0L));
2029+
assertThat(countBuySell(results), is(0L));
2030+
assertThat(countAccountTransactions(results), is(1L));
2031+
assertThat(countAccountTransfers(results), is(0L));
2032+
assertThat(countItemsWithFailureMessage(results), is(0L));
2033+
assertThat(countSkippedItems(results), is(0L));
2034+
assertThat(results.size(), is(1));
2035+
new AssertImportActions().check(results, "USD");
2036+
2037+
// check dividend transaction
2038+
assertThat(results, hasItem(dividend( //
2039+
hasDate("2026-05-12T00:00"), hasShares(581.00), //
2040+
hasSource("Dividende15.txt"), //
2041+
hasNote("Referenz: 1097680988"), //
2042+
hasAmount("USD", 83.70), hasGrossValue("USD", 83.70), //
2043+
hasForexGrossValue("CHF", 65.45), //
2044+
hasTaxes("USD", 0.00), hasFees("USD", 0.00))));
2045+
}
2046+
19772047
@Test
19782048
public void testZahlungsverkehr01()
19792049
{

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,12 @@ private void addBuySellCryptoTransaction()
315315

316316
private void addDividendsTransaction()
317317
{
318-
final var type = new DocumentType("(Dividende|Kapitalgewinn)");
318+
final var type = new DocumentType("(Dividende|Kapitalgewinn|Option Premium)");
319319
this.addDocumentTyp(type);
320320

321321
var pdfTransaction = new Transaction<AccountTransaction>();
322322

323-
var firstRelevantLine = new Block("^(Dividende|Kapitalgewinn) Unsere Referenz:.*$");
323+
var firstRelevantLine = new Block("^(Dividende|Kapitalgewinn|Option Premium) Unsere Referenz:.*$");
324324
type.addBlock(firstRelevantLine);
325325
firstRelevantLine.set(pdfTransaction);
326326

@@ -361,6 +361,17 @@ private void addDividendsTransaction()
361361
.attributes("name", "isin", "currency") //
362362
.match("^(?<name>.*) ISIN: (?<isin>[A-Z]{2}[A-Z0-9]{9}[0-9]).*$") //
363363
.match("^Dividende pro Aktie (?<currency>[A-Z]{3}) [\\.'\\d]+.*$") //
364+
.assign((t, v) -> t.setSecurity(getOrCreateSecurity(v))),
365+
// @formatter:off
366+
// INCOMESHARES GOLD YIELD ETP ISIN: XS2852999775 581
367+
// NKN: 136957026
368+
// Prämienanteil 0.14405405 USD
369+
// @formatter:on
370+
section -> section //
371+
.attributes("name", "isin", "wkn", "currency") //
372+
.match("^(?<name>.*) ISIN: (?<isin>[A-Z]{2}[A-Z0-9]{9}[0-9]).*$") //
373+
.match("^NKN: (?<wkn>[A-Z0-9]{5,9}).*$") //
374+
.match("^Pr.mienanteil [\\.'\\d]+ (?<currency>[A-Z]{3})$") //
364375
.assign((t, v) -> t.setSecurity(getOrCreateSecurity(v))))
365376

366377
// @formatter:off

0 commit comments

Comments
 (0)