Skip to content

Commit be347e5

Browse files
authored
Fix Bison PDF-Importer Staking Reward (#4747)
Closes #4717
1 parent 5f0e678 commit be347e5

2 files changed

Lines changed: 7 additions & 26 deletions

File tree

name.abuchen.portfolio.tests/src/name/abuchen/portfolio/datatransfer/pdf/bison/BisonPDFExtractorTest.java

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,9 @@ public void testInfoReport04()
313313

314314
assertThat(errors, empty());
315315
assertThat(countSecurities(results), is(2L));
316-
assertThat(countBuySell(results), is(4L));
316+
assertThat(countBuySell(results), is(2L));
317317
assertThat(countAccountTransactions(results), is(3L));
318-
assertThat(results.size(), is(9));
318+
assertThat(results.size(), is(7));
319319
new AssertImportActions().check(results, "EUR");
320320

321321
// check security
@@ -337,14 +337,6 @@ public void testInfoReport04()
337337
assertThat(results, hasItem(deposit(hasDate("2025-02-03T20:17"), hasAmount("EUR", 53.00), //
338338
hasSource("InfoReport04.txt"), hasNote(null))));
339339

340-
// check buy sell transaction
341-
assertThat(results, hasItem(purchase( //
342-
hasDate("2025-02-03T08:48"), hasShares(0.00000541), //
343-
hasSource("InfoReport04.txt"), //
344-
hasNote(null), //
345-
hasAmount("EUR", 0.02), hasGrossValue("EUR", 0.02), //
346-
hasTaxes("EUR", 0.00), hasFees("EUR", 0.00))));
347-
348340
// check inbound delivery transactions
349341
assertThat(results, hasItem(inboundDelivery( //
350342
hasDate("2025-02-03T08:48"), hasShares(0.00000541), //
@@ -369,14 +361,6 @@ public void testInfoReport04()
369361
hasAmount("EUR", 8.40), hasGrossValue("EUR", 8.40), //
370362
hasTaxes("EUR", 0.00), hasFees("EUR", 0.00))));
371363

372-
// check buy sell transaction
373-
assertThat(results, hasItem(purchase( //
374-
hasDate("2025-01-27T07:50"), hasShares(0.00000150), //
375-
hasSource("InfoReport04.txt"), //
376-
hasNote(null), //
377-
hasAmount("EUR", 0.00), hasGrossValue("EUR", 0.00), //
378-
hasTaxes("EUR", 0.00), hasFees("EUR", 0.00))));
379-
380364
// check inbound delivery transactions
381365
assertThat(results, hasItem(inboundDelivery( //
382366
hasDate("2025-01-27T07:50"), hasShares(0.00000150), //

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* @formatter:off
1515
* @implNote Importer for "Info Reports" produced by the Bison App.
1616
*
17-
* @implSpec Bison only supports EUR as currency. Therefore the extractor is always
18-
* defaulting to EUR.
17+
* @implSpec Bison only supports EUR as currency.
18+
* Therefore the extractor is always defaulting to EUR.
1919
* @formatter:on
2020
*/
2121
@SuppressWarnings("nls")
@@ -46,7 +46,7 @@ private void addBuyCryptoTransaction()
4646

4747
var pdfTransaction = new Transaction<BuySellEntry>();
4848

49-
var firstRelevantLine = new Block("^(Kauf|Verkauf|Staking Reward)[\\*]* [A-Z0-9]{1,5}(?:[\\-\\/][A-Z0-9]{1,5})? [\\.,\\d]+$");
49+
var firstRelevantLine = new Block("^(Kauf|Verkauf)[\\*]* [A-Z0-9]{1,5}(?:[\\-\\/][A-Z0-9]{1,5})? [\\.,\\d]+$");
5050
type.addBlock(firstRelevantLine);
5151
firstRelevantLine.set(pdfTransaction);
5252

@@ -60,7 +60,7 @@ private void addBuyCryptoTransaction()
6060

6161
// Is type --> "Verkauf" change from BUY to SELL
6262
.section("type").optional() //
63-
.match("^(?<type>(Kauf|Verkauf|Staking Reward))[\\*]* [A-Z0-9]{1,5}(?:[\\-\\/][A-Z0-9]{1,5})? [\\.,\\d]+$") //
63+
.match("^(?<type>(Kauf|Verkauf))[\\*]* [A-Z0-9]{1,5}(?:[\\-\\/][A-Z0-9]{1,5})? [\\.,\\d]+$") //
6464
.assign((t, v) -> {
6565
if ("Verkauf".equals(v.get("type"))) //
6666
t.setType(PortfolioTransaction.Type.SELL);
@@ -75,12 +75,9 @@ private void addBuyCryptoTransaction()
7575
//
7676
// Verkauf* ETH 0,03396843
7777
// 12.06.2022 21:19 1.401,94 €/ETH + 47,62 €
78-
//
79-
// Staking Reward ETH 0,00000541
80-
// 03.02.2025 08:48 3.011,63 €/ETH + 0,02 €
8178
// @formatter:on
8279
.section("tickerSymbol", "shares", "date", "time", "amount", "currency") //
83-
.match("^(Kauf|Verkauf|Staking Reward)[\\*]* (?<tickerSymbol>[A-Z0-9]{1,5}(?:[\\-\\/][A-Z0-9]{1,5})?) (?<shares>[\\.,\\d]+)$") //
80+
.match("^(Kauf|Verkauf)[\\*]* (?<tickerSymbol>[A-Z0-9]{1,5}(?:[\\-\\/][A-Z0-9]{1,5})?) (?<shares>[\\.,\\d]+)$") //
8481
.match("^(?<date>[\\d]{2}\\.[\\d]{2}\\.[\\d]{4}) (?<time>[\\d]{2}:[\\d]{2}) .* (?<amount>[\\.,\\d]+) (?<currency>\\p{Sc})$") //
8582
.assign((t, v) -> {
8683
t.setSecurity(getOrCreateCryptoCurrency(v));

0 commit comments

Comments
 (0)