use of name.abuchen.portfolio.datatransfer.pdf.SBrokerPDFExtractor in project portfolio by buchen.
the class SBrokerPDFExtractorTest method testWertpapierVerkauf1.
@Test
public void testWertpapierVerkauf1() throws IOException {
SBrokerPDFExtractor extractor = new SBrokerPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "sBroker_Verkauf1.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
// check security
Security security = results.stream().filter(i -> i instanceof SecurityItem).findFirst().get().getSecurity();
assertThat(security.getIsin(), is("DE000A0H0785"));
assertThat(security.getName(), is("iS.EO G.B.C.1.5-10.5y.U.ETF DE"));
// check buy sell transaction
Optional<Item> item = results.stream().filter(i -> i instanceof BuySellEntryItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(BuySellEntry.class));
BuySellEntry entry = (BuySellEntry) item.get().getSubject();
assertThat(entry.getPortfolioTransaction().getType(), is(PortfolioTransaction.Type.SELL));
assertThat(entry.getAccountTransaction().getType(), is(AccountTransaction.Type.SELL));
assertThat(entry.getPortfolioTransaction().getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, 5648_24)));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2015-06-04T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(47)));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of(CurrencyUnit.EUR, 821L)));
}
use of name.abuchen.portfolio.datatransfer.pdf.SBrokerPDFExtractor in project portfolio by buchen.
the class SBrokerPDFExtractorTest method testErtragsgutschrift1.
@Test
public void testErtragsgutschrift1() throws IOException {
SBrokerPDFExtractor extractor = new SBrokerPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "sBroker_Ertragsgutschrift1.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
// check security
Security security = results.stream().filter(i -> i instanceof SecurityItem).findFirst().get().getSecurity();
assertThat(security.getIsin(), is("DE000A0H0785"));
assertThat(security.getName(), is("iS.EO G.B.C.1.5-10.5y.U.ETF DE"));
// check buy sell transaction
AccountTransaction t = (AccountTransaction) results.stream().filter(i -> i instanceof TransactionItem).findFirst().get().getSubject();
assertThat(t.getType(), is(AccountTransaction.Type.DIVIDENDS));
assertThat(t.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, 12_70)));
assertThat(t.getDateTime(), is(LocalDateTime.parse("2014-11-17T00:00")));
assertThat(t.getShares(), is(Values.Share.factorize(16)));
}
use of name.abuchen.portfolio.datatransfer.pdf.SBrokerPDFExtractor in project portfolio by buchen.
the class SBrokerPDFExtractorTest method testWertpapierKauf1.
@Test
public void testWertpapierKauf1() throws IOException {
SBrokerPDFExtractor extractor = new SBrokerPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "sBroker_Kauf1.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
// check security
Security security = results.stream().filter(i -> i instanceof SecurityItem).findFirst().get().getSecurity();
assertThat(security.getIsin(), is("DE000A0H0785"));
assertThat(security.getName(), is("iS.EO G.B.C.1.5-10.5y.U.ETF DE"));
// check buy sell transaction
Optional<Item> item = results.stream().filter(i -> i instanceof BuySellEntryItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(BuySellEntry.class));
BuySellEntry entry = (BuySellEntry) item.get().getSubject();
assertThat(entry.getPortfolioTransaction().getType(), is(PortfolioTransaction.Type.BUY));
assertThat(entry.getAccountTransaction().getType(), is(AccountTransaction.Type.BUY));
assertThat(entry.getPortfolioTransaction().getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, 1930_17)));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2014-10-01T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(16)));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of(CurrencyUnit.EUR, 377L)));
}
use of name.abuchen.portfolio.datatransfer.pdf.SBrokerPDFExtractor in project portfolio by buchen.
the class ImportExtractedItemsWizard method addDefaultExtractors.
private void addDefaultExtractors() throws IOException {
extractors.add(new BaaderBankPDFExtractor(client));
extractors.add(new BankSLMPDFExtractor(client));
extractors.add(new ComdirectPDFExtractor(client));
extractors.add(new CommerzbankPDFExtractor(client));
extractors.add(new ConsorsbankPDFExtractor(client));
extractors.add(new DABPDFExtractor(client));
extractors.add(new DegiroPDFExtractor(client));
extractors.add(new DeutscheBankPDFExtractor(client));
extractors.add(new DkbPDFExtractor(client));
extractors.add(new FinTechGroupBankPDFExtractor(client));
extractors.add(new INGDiBaExtractor(client));
extractors.add(new OnvistaPDFExtractor(client));
extractors.add(new SBrokerPDFExtractor(client));
extractors.add(new UnicreditPDFExtractor(client));
extractors.add(new HelloBankPDFExtractor(client));
Collections.sort(extractors, (r, l) -> r.getLabel().compareToIgnoreCase(l.getLabel()));
}
Aggregations