Skip to content

Commit 59d2ac1

Browse files
Merge branch 'portfolio-performance:master' into refactor/trades-view-to-use-tradeelement
2 parents 30ca395 + 352b7a4 commit 59d2ac1

File tree

30 files changed

+1047
-342
lines changed

30 files changed

+1047
-342
lines changed

name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/csv/CSVAccountTransactionExtractorTest.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasTaxes;
1515
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasTicker;
1616
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.interest;
17+
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.outboundCash;
1718
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.purchase;
1819
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.sale;
1920
import static name.abuchen.portfolio.datatransfer.csv.CSVExtractorTestUtil.buildField2Column;
@@ -705,4 +706,40 @@ public void testGrossValueIsCreated()
705706
hasForexGrossValue("USD", 62.53), // 1.1194 * 55.86
706707
hasTaxes("EUR", 0.00), hasFees("EUR", 0.14))));
707708
}
709+
710+
@Test
711+
public void testExchangeRateIsDerivedFromGrossValue()
712+
{
713+
Client client = new Client();
714+
Security security = new Security();
715+
security.setIsin("LU0419741177");
716+
security.setCurrencyCode(CurrencyUnit.USD);
717+
client.addSecurity(security);
718+
719+
CSVExtractor extractor = new CSVAccountTransactionExtractor(client);
720+
721+
List<Exception> errors = new ArrayList<>();
722+
List<Item> results = extractor.extract(0, Arrays.<String[]>asList(new String[] { //
723+
"2015-09-15", "XX:XX", // Date + Time
724+
"LU0419741177", "", "", // ISIN + TickerSymbol + WKN
725+
"1000", "EUR", // Amount + Currency
726+
"TRANSFER_OUT", // Type
727+
"", "", // Security name + Shares
728+
"Notiz", // Note
729+
"", "", // Taxes + Fee
730+
"", "", "", // account + account2nd + portfolio
731+
"1112", "USD", // Gross + Gross currency
732+
"" }), // Exchange rate
733+
buildField2Column(extractor), errors);
734+
735+
assertThat(errors, empty());
736+
assertThat(results.size(), is(1));
737+
new AssertImportActions().check(results, CurrencyUnit.EUR, "USD");
738+
739+
// check that gross value is created with given exchange rate
740+
assertThat(results, hasItem(outboundCash( //
741+
hasDate("2015-09-15"), //
742+
hasAmount("EUR", 1000.00), //
743+
hasForexGrossValue("USD", 1112.00), hasTaxes("EUR", 0.00), hasFees("EUR", 0.00))));
744+
}
708745
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
PDFBox Version: 3.0.5 != 1.8.17
2+
Portfolio Performance Version: 0.80.0
3+
System: win32 | x86_64 | 21.0.5+11-LTS | Azul Systems, Inc.
4+
-----------------------------------------
5+
PostFinance AG
6+
Sie werden betreut von
7+
Ronja Geiser und Team
8+
Telefon +41 448 14 14
9+
www.postfinance.ch P.P. Post CH AG
10+
CH-4808 Zofingen A-PRIORITY
11+
hGpu
12+
uLm wyJeF
13+
RYynK vKx GsWrkLmuhfdg 66
14+
EBZySFKq 2493 eOCPGrRX
15+
Börsentransaktion: Kauf Seite: 1 / 2
16+
E-Vermögensverwaltung Datum: 14.01.2025
17+
Depot 71-342453-0 Auftrag 19888922
18+
Gemäss Ihrem Auftrag haben wir folgende Transaktion vorgenommen:
19+
Position Stückzahl Währung Kurs
20+
UBS ETF - SXI Real Estate Funds 14.000 CHF 10.0834
21+
ISIN CH0105994401
22+
Kurswert in Handelswährung CHF 141.17
23+
Umsatzabgabe CHF 0.11
24+
Total CHF 141.28
25+
Der Totalbetrag von CHF 141.28 wird Ihrem Konto mt56 8216 4413 1474 3691 5 mit Valuta 16.01.2025 belastet .
26+
0000011111555552222222222 DDDDDEEEEE 000000000000000000002222211111.....0000000000
27+
Börsentransaktion: Kauf
28+
Depot 60-403046-5 Datum: 14.01.2025 Seite: 2 / 2
29+
Ausführungsdetails
30+
Abrechnungs-Nr. Ausführungsort Zeit Stückzahl Währung Kurs
31+
14415821 TWEM 11:09:36 14.000 CHF 10.0834
32+
Durchschnittskurs 14.000 CHF 10.0834
33+
Bitte prüfen Sie dieses Dokument und benachrichtigen Sie uns bei Unstimmigkeiten innert Monatsfrist.
34+
Im Rahmen dieser Transaktion hat PostFinance als Kommissionärin gehandelt.
35+
Der Ort der Ausführung wird nur als Anhaltspunkt angegeben. In einigen Fällen, die der Bank zum Zeitpunkt der Erstellung
36+
dieser Benachrichtigung nicht bekannt waren, könnte ein Vermittler (zum Beispiel ein Broker) als Gegenpartei für Ihre Order,
37+
zum gleichen Preis, wie Sie an der Börse erhalten hätten, auftreten. Bitte nehmen Sie Kontakt zu uns auf, falls Sie mehr In-
38+
formationen zu diesem Thema wünschen.
39+
Freundliche Grüsse
40+
PostFinance AG
41+
01522 DE 000021.00

name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/postfinance/PostfinancePDFExtractorTest.java

Lines changed: 134 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.hasWkn;
2121
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.purchase;
2222
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.removal;
23+
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.sale;
2324
import static name.abuchen.portfolio.datatransfer.ExtractorMatchers.security;
2425
import static name.abuchen.portfolio.datatransfer.ExtractorTestUtilities.countAccountTransactions;
2526
import static name.abuchen.portfolio.datatransfer.ExtractorTestUtilities.countAccountTransfers;
26-
import static name.abuchen.portfolio.datatransfer.ExtractorTestUtilities.countItemsWithFailureMessage;
2727
import static name.abuchen.portfolio.datatransfer.ExtractorTestUtilities.countBuySell;
28+
import static name.abuchen.portfolio.datatransfer.ExtractorTestUtilities.countItemsWithFailureMessage;
2829
import static name.abuchen.portfolio.datatransfer.ExtractorTestUtilities.countSecurities;
2930
import static org.hamcrest.CoreMatchers.hasItem;
3031
import static org.hamcrest.CoreMatchers.is;
@@ -420,6 +421,39 @@ public void testWertpapierKauf05()
420421
hasTaxes("CHF", 0.00), hasFees("CHF", 1.98))));
421422
}
422423

424+
@Test
425+
public void testWertpapierKauf06()
426+
{
427+
var extractor = new PostfinancePDFExtractor(new Client());
428+
429+
List<Exception> errors = new ArrayList<>();
430+
431+
var results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Kauf06.txt"), errors);
432+
433+
assertThat(errors, empty());
434+
assertThat(countSecurities(results), is(1L));
435+
assertThat(countBuySell(results), is(1L));
436+
assertThat(countAccountTransactions(results), is(0L));
437+
assertThat(countAccountTransfers(results), is(0L));
438+
assertThat(countItemsWithFailureMessage(results), is(0L));
439+
assertThat(results.size(), is(2));
440+
new AssertImportActions().check(results, "CHF");
441+
442+
// check security
443+
assertThat(results, hasItem(security( //
444+
hasIsin("CH0105994401"), hasWkn(null), hasTicker(null), //
445+
hasName("UBS ETF - SXI Real Estate Funds"), //
446+
hasCurrencyCode("CHF"))));
447+
448+
// check buy sell transaction
449+
assertThat(results, hasItem(purchase( //
450+
hasDate("2025-01-14T00:00"), hasShares(14.000), //
451+
hasSource("Kauf06.txt"), //
452+
hasNote("Auftrag 19888922"), //
453+
hasAmount("CHF", 141.28), hasGrossValue("CHF", 141.17), //
454+
hasTaxes("CHF", 0.11), hasFees("CHF", 0.00))));
455+
}
456+
423457
@Test
424458
public void testWertpapierVerkauf01()
425459
{
@@ -471,6 +505,105 @@ public void testWertpapierVerkauf01()
471505
is(Money.of("CHF", Values.Amount.factorize(2.60))));
472506
}
473507

508+
@Test
509+
public void testWertpapierVerkauf02()
510+
{
511+
var extractor = new PostfinancePDFExtractor(new Client());
512+
513+
List<Exception> errors = new ArrayList<>();
514+
515+
var results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Verkauf02.txt"), errors);
516+
517+
assertThat(errors, empty());
518+
assertThat(countSecurities(results), is(1L));
519+
assertThat(countBuySell(results), is(1L));
520+
assertThat(countAccountTransactions(results), is(0L));
521+
assertThat(countAccountTransfers(results), is(0L));
522+
assertThat(countItemsWithFailureMessage(results), is(0L));
523+
assertThat(results.size(), is(2));
524+
new AssertImportActions().check(results, "CHF");
525+
526+
// check security
527+
assertThat(results, hasItem(security( //
528+
hasIsin("CH0482006191"), hasWkn(null), hasTicker(null), //
529+
hasName("UBS Index Fund - Bonds"), //
530+
hasCurrencyCode("CHF"))));
531+
532+
// check dividends transaction
533+
assertThat(results, hasItem(sale( //
534+
hasDate("2025-04-16T00:00"), hasShares(0.074), //
535+
hasSource("Verkauf02.txt"), //
536+
hasNote("Auftrag 21187458"), //
537+
hasAmount("CHF", 71.14), hasGrossValue("CHF", 71.14), //
538+
hasTaxes("CHF", 0.00), hasFees("CHF", 0.00))));
539+
}
540+
541+
@Test
542+
public void testWertpapierVerkauf03()
543+
{
544+
var extractor = new PostfinancePDFExtractor(new Client());
545+
546+
List<Exception> errors = new ArrayList<>();
547+
548+
var results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Verkauf03.txt"), errors);
549+
550+
assertThat(errors, empty());
551+
assertThat(countSecurities(results), is(1L));
552+
assertThat(countBuySell(results), is(1L));
553+
assertThat(countAccountTransactions(results), is(0L));
554+
assertThat(countAccountTransfers(results), is(0L));
555+
assertThat(countItemsWithFailureMessage(results), is(0L));
556+
assertThat(results.size(), is(2));
557+
new AssertImportActions().check(results, "CHF");
558+
559+
// check security
560+
assertThat(results, hasItem(security( //
561+
hasIsin("LU0309035367"), hasWkn(null), hasTicker(null), //
562+
hasName("Pictet - Short-Term Money Market"), //
563+
hasCurrencyCode("JPY"))));
564+
565+
// check dividends transaction
566+
assertThat(results, hasItem(sale( //
567+
hasDate("2025-06-18T00:00"), hasShares(0.553), //
568+
hasSource("Verkauf03.txt"), //
569+
hasNote("Auftrag 21796086"), //
570+
hasAmount("CHF", 310.79), hasGrossValue("CHF", 310.79), //
571+
hasForexGrossValue("JPY", 55384.00), //
572+
hasTaxes("CHF", 0.00), hasFees("CHF", 0.00))));
573+
}
574+
575+
@Test
576+
public void testtestWertpapierVerkauf03WithSecurityInCHF()
577+
{
578+
var security = new Security("Pictet - Short-Term Money Market", "CHF");
579+
security.setIsin("LU0309035367");
580+
581+
var client = new Client();
582+
client.addSecurity(security);
583+
584+
var extractor = new PostfinancePDFExtractor(client);
585+
586+
List<Exception> errors = new ArrayList<>();
587+
588+
var results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "Verkauf03.txt"), errors);
589+
590+
assertThat(errors, empty());
591+
assertThat(countSecurities(results), is(0L));
592+
assertThat(countBuySell(results), is(1L));
593+
assertThat(countAccountTransactions(results), is(0L));
594+
assertThat(countAccountTransfers(results), is(0L));
595+
assertThat(results.size(), is(1));
596+
new AssertImportActions().check(results, "CHF");
597+
598+
// check buy sell transaction
599+
assertThat(results, hasItem(sale( //
600+
hasDate("2025-06-18T00:00"), hasShares(0.553), //
601+
hasSource("Verkauf03.txt"), //
602+
hasNote("Auftrag 21796086"), //
603+
hasAmount("CHF", 310.79), hasGrossValue("CHF", 310.79), //
604+
hasTaxes("CHF", 0.00), hasFees("CHF", 0.00))));
605+
}
606+
474607
@Test
475608
public void testCryptoKauf01()
476609
{
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
PDFBox Version: 3.0.5 != 1.8.17
2+
Portfolio Performance Version: 0.80.0
3+
System: win32 | x86_64 | 21.0.5+11-LTS | Azul Systems, Inc.
4+
-----------------------------------------
5+
PostFinance AG
6+
Sie werden betreut von
7+
Ronja Geiser und Team
8+
Telefon +41 58 448 14 14
9+
www.postfinance.ch P.P. Post CH AG
10+
CH-4808 Zofingen A-PRIORITY
11+
Herr
12+
gHSVO Tsq aMF ioYth
13+
cGsBQDLM YQexADdtEcwe 18
14+
4789 wZIMxWTy
15+
Transaktionsabrechnung: Rücknahme Seite: 1 / 1
16+
E-Vermögensverwaltung Datum: 16.04.2025
17+
Depot 47-652916-0 Ort der Ausführung Over-the-Counter
18+
Auftrag 21187458
19+
Gemäss Ihrem Auftrag haben wir folgende Transaktion vorgenommen:
20+
Position Anteile Währung Kurs
21+
UBS Index Fund - Bonds CHF 0.074 CHF 961.41
22+
ISIN CH0482006191
23+
Kurswert in Handelswährung CHF 71.14
24+
Total CHF 71.14
25+
Der Totalbetrag von CHF 71.14 wurde Ihrem Konto Hs67 9280 2693 9259 8731 6 mit Valuta 17.04.2025 gutgeschrie-
26+
ben.
27+
Bitte prüfen Sie dieses Dokument und benachrichtigen Sie uns bei Unstimmigkeiten innert Monatsfrist.
28+
Im Rahmen dieser Transaktion hat PostFinance als Kommissionärin gehandelt.
29+
Freundliche Grüsse
30+
PostFinance AG
31+
01521 DE 000041.00
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
PDFBox Version: 3.0.5 != 1.8.17
2+
Portfolio Performance Version: 0.80.0
3+
System: win32 | x86_64 | 21.0.5+11-LTS | Azul Systems, Inc.
4+
-----------------------------------------
5+
PostFinance AG
6+
Sie werden betreut von
7+
Ronja Geiser und Team ost CH AG
8+
Telefon +41 58 448 14 14
9+
www.postfinance.ch P.P. P
10+
CH-4808 Zofingen A-PRIORITY
11+
DRRI
12+
NxITK ZNM EbM XauSC
13+
AeTVRbxX ifQEjnfDaKqt 95
14+
2167 WQAjSAvG
15+
Transaktionsabrechnung: Rücknahme ganzer Seite: 1 / 1
16+
Bestand Datum: 18.06.2025
17+
E-Vermögensverwaltung
18+
Depot 93-584811-7 Ort der Ausführung Over-the-Counter
19+
Auftrag 21796086
20+
Gemäss Ihrem Auftrag haben wir folgende Transaktion vorgenommen:
21+
Position Anteile Währung Kurs
22+
Pictet - Short-Term Money Market JPY 0.553 JPY 100 152.13
23+
ISIN LU0309035367
24+
Kurswert in Handelswährung JPY 55 384.00
25+
Total JPY 55 384.00
26+
Total in Kontowährung zum Kurs von JPY/CHF 0.0056115 CHF 310.79
27+
Der Totalbetrag von CHF 310.79 wurde Ihrem Konto lX31 7569 1574 2803 1992 6 mit Valuta 20.06.2025 gutgeschrie-
28+
ben.
29+
Bitte prüfen Sie dieses Dokument und benachrichtigen Sie uns bei Unstimmigkeiten innert Monatsfrist.
30+
Im Rahmen dieser Transaktion hat PostFinance als Kommissionärin gehandelt.
31+
Freundliche Grüsse
32+
PostFinance AG
33+
01521 DE 000041.00
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
PDFBox Version: 3.0.5
2+
Portfolio Performance Version: 0.80.4
3+
System: win32 | x86_64 | 21.0.5+11-LTS | Azul Systems, Inc.
4+
-----------------------------------------
5+
TRANSAKTIONSBELEG
6+
Kunde: 6984888 - TRADING
7+
IBAN: CH9208781000172628700
8+
RCFsqkn und-QbSY GwcyGsYEi egwURbjeSA
9+
YgBElJeoNu 7
10+
CH-4710 AeBrJdQy CQ wFZyLD
11+
Gland, 16.05.2022
12+
Dividende Unsere Referenz: 249975908
13+
Im Hinblick auf folgenden Titel:
14+
Titel
15+
Bezeichnung Anzahl
16+
HSBC MSCI EMERGING MARKETS UCI ISIN: IE00B5SSQT16 1'000
17+
NKN: 13305825
18+
haben wir Ihrem Konto den folgenden Betrag gutgeschrieben:
19+
Kontonummer 238498733
20+
Ausführungsdatum 21.04.2022
21+
Valutadatum 13.05.2022
22+
Anzahl 1'000
23+
Dividende 0.0397 USD
24+
Betrag USD 39.70
25+
Total USD 39.70
26+
Wechselkurs USD / CHF : 1.00266
27+
Dieser Transaktionsbeleg sowie die aufgeführte Transaktion unterliegen unseren Allgemeinen Geschäftsbedingungen und Depotreglement.
28+
Formular ohne Unterschrift SE&O.
29+
Swissquote Bank AG, 33 chemin de la Crétaux, CH-1196 Gland
30+
Customer Care : 0848 25 88 88 (Aus dem Ausland +41 44 825 88 88)
31+
CHE-116.310.079 MwSt
32+
33+
Vielen Dank für die Hilfe.
34+
Ich stelle meine Hilfe gerne auch als Tester zur Verfügung, programmieren kann ich leider nicht.
35+
36+
Viele Grüße
37+
Andreas
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
PDFBox Version: 3.0.5
2+
Portfolio Performance Version: 0.80.4
3+
System: win32 | x86_64 | 21.0.5+11-LTS | Azul Systems, Inc.
4+
-----------------------------------------
5+
TRANSACTION NOTIFICATION
6+
Client: 2624857
7+
IBAN: CH2008783000272485630
8+
Mr. NtZrzt UCNAuGw
9+
RPudrHPVkSr 54
10+
7171 BEeH
11+
Gland, 21.10.2025
12+
Sell Our reference: 533430837
13+
In accordance with your sell order of 21.10.2025, we have carried out the following transactions:
14+
Security Exchange
15+
Swisscanto Silver ETF-A CHF ISIN: CH0183135976 SIX Swiss Exchange
16+
NKN: 18313597
17+
Quantity Price Amount
18+
5.0721 108.7 CHF 551.35
19+
Total CHF 551.35
20+
Commission CHF 2.75
21+
Tax (Federal stamp duty) CHF 0.40
22+
To your credit CHF 548.20
23+
Amount credited to your account number 162537800, on value date of 22.10.2025
24+
This notification as well as the transaction are governed by the General Terms and Conditions for Yuh Accounts, the Fractional Trading Agreement
25+
for Yuh Accounts and the Best Execution Policy for Yuh Accounts.
26+
Please note that when you enter into transactions on financial instruments, Swissquote Bank Ltd holds these financial instruments in a fiduciary
27+
capacity and grants you a fiduciary interest. Any booking of financial instruments on your account is a booking of a fiduciary interest according to the
28+
Fractional Trading Agreement for Yuh Accounts.
29+
Any mention to an exchange or other execution venue is provided for information purpose only. At the time of execution of your order, we may not
30+
have acquired or disposed of the relevant financial instrument. The booking of this transaction may remain provisional for a number of days in
31+
accordance with the Fractional Trading Agreement for Yuh Accounts. Please contact us if you need more information about this.
32+
Our sincere thanks for your order.
33+
Yuh banking services are provided by Swissquote Bank Ltd, Advice without signature | E&OE.
34+
a bank regulated by the Swiss Financial Market Supervisory Authority (FINMA).
35+
Swissquote Bank Ltd, Chemin de la Crétaux 33, CH-1196 | Gland Customer Care: +41 44 825 87 89

0 commit comments

Comments
 (0)