use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class INGDiBaPDFExtractorTest method testDividendengutschrift2.
@Test
public void testDividendengutschrift2() throws IOException {
INGDiBaExtractor extractor = new INGDiBaExtractor(new Client());
List<Exception> errors = new ArrayList<>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "INGDiBa_Dividendengutschrift2.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
Security security = results.stream().filter(i -> i instanceof SecurityItem).findFirst().get().getSecurity();
assertThat(security.getIsin(), is("DE000A0H0744"));
assertThat(security.getWkn(), is("A0H074"));
assertThat(security.getName(), is("iSh.DJ Asia Pa.S.D.30 U.ETF DE"));
AccountTransaction t = (AccountTransaction) results.stream().filter(i -> i instanceof TransactionItem).findFirst().get().getSubject();
assertThat(t.getType(), is(AccountTransaction.Type.DIVIDENDS));
assertThat(t.getAmount(), is(Values.Amount.factorize(234.92)));
assertThat(t.getDateTime(), is(LocalDateTime.parse("2016-12-15T00:00")));
assertThat(t.getShares(), is(Values.Share.factorize(694)));
assertThat(t.getUnitSum(Unit.Type.TAX), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(65.1 + 3.58))));
assertThat(t.getGrossValue(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(303.60))));
}
use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class INGDiBaPDFExtractorTest method testErtragsgutschrift1.
@Test
public void testErtragsgutschrift1() throws IOException {
INGDiBaExtractor extractor = new INGDiBaExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "INGDiBa_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("DE0002635307"));
assertThat(security.getWkn(), is("263530"));
assertThat(security.getName(), is("iSh.STOXX Europe 600 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.getAmount(), is(Values.Amount.factorize(6.70)));
assertThat(t.getDateTime(), is(LocalDateTime.parse("2015-09-15T00:00")));
assertThat(t.getShares(), is(Values.Share.factorize(18)));
}
use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class INGDiBaPDFExtractorTest method testGemeinschaftskontoDividendengutschrift1.
@Test
public void testGemeinschaftskontoDividendengutschrift1() throws IOException {
INGDiBaExtractor extractor = new INGDiBaExtractor(new Client());
List<Exception> errors = new ArrayList<>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "INGDiBa_Gemeinschaftskonto_Dividendengutschrift1.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
Security security = results.stream().filter(i -> i instanceof SecurityItem).findFirst().get().getSecurity();
assertThat(security.getIsin(), is("DE000TLX1005"));
assertThat(security.getWkn(), is("TLX100"));
assertThat(security.getName(), is("Talanx AG Namens-Aktien o.N."));
AccountTransaction t = (AccountTransaction) results.stream().filter(i -> i instanceof TransactionItem).findFirst().get().getSubject();
assertThat(t.getType(), is(AccountTransaction.Type.DIVIDENDS));
assertThat(t.getAmount(), is(Values.Amount.factorize(468.04)));
assertThat(t.getDateTime(), is(LocalDateTime.parse("2016-05-12T00:00")));
assertThat(t.getShares(), is(Values.Share.factorize(500)));
assertThat(t.getGrossValue(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(650.00))));
assertThat(t.getUnitSum(Unit.Type.TAX), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(79.46 + 7.15 + 4.37 + 79.46 + 7.15 + 4.37))));
}
use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class OnvistaPDFExtractorTest method testDepotauszug.
@Test
public void testDepotauszug() throws IOException {
OnvistaPDFExtractor extractor = new OnvistaPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "OnvistaDepotauszug.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(26));
// check first security
Security security = assertFirstSecurityDepotauszug(results);
// check transaction (first security, in)
Optional<Item> item = results.stream().filter(i -> i instanceof TransactionItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(PortfolioTransaction.class));
PortfolioTransaction transaction = (PortfolioTransaction) item.get().getSubject();
assertThat(transaction.getType(), is(PortfolioTransaction.Type.DELIVERY_INBOUND));
assertThat(transaction.getSecurity(), is(security));
assertThat(transaction.getCurrencyCode(), is(CurrencyUnit.EUR));
assertThat(transaction.getDateTime(), is(LocalDateTime.parse("2010-12-31T00:00")));
assertThat(transaction.getShares(), is(Values.Share.factorize(4)));
// check second security
assertSecurityErtragsgutschriftKupon(results.stream().filter(i -> i instanceof SecurityItem).collect(Collectors.toList()).get(3));
Item secondItem = results.stream().filter(i -> i instanceof TransactionItem).collect(Collectors.toList()).get(3);
// check second transaction (second security, in)
assertThat(secondItem.getSubject(), instanceOf(PortfolioTransaction.class));
PortfolioTransaction entry2 = (PortfolioTransaction) secondItem.getSubject();
assertThat(entry2.getType(), is(PortfolioTransaction.Type.DELIVERY_INBOUND));
assertThat(entry2.getCurrencyCode(), is(CurrencyUnit.EUR));
assertThat(entry2.getDateTime(), is(LocalDateTime.parse("2010-12-31T00:00")));
assertThat(entry2.getShares(), is(Values.Share.factorize(1)));
}
use of name.abuchen.portfolio.datatransfer.Extractor.TransactionItem in project portfolio by buchen.
the class OnvistaPDFExtractorTest method testUmtausch.
@Test
public void testUmtausch() throws IOException {
OnvistaPDFExtractor extractor = new OnvistaPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "OnvistaUmtausch.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
assertSecurityBuyBezugsrechte(results);
// check delivery transaction
Optional<Item> item = results.stream().filter(i -> i instanceof TransactionItem).findFirst();
assertThat(item.isPresent(), is(true));
assertThat(item.get().getSubject(), instanceOf(PortfolioTransaction.class));
PortfolioTransaction entry = (PortfolioTransaction) item.get().getSubject();
assertThat(entry.getType(), is(PortfolioTransaction.Type.DELIVERY_OUTBOUND));
assertThat(entry.getDateTime(), is(is(LocalDateTime.parse("2011-06-06T00:00"))));
assertThat(entry.getShares(), is(Values.Share.factorize(33)));
}
Aggregations