use of name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem in project portfolio by buchen.
the class ComdirectPDFExtractorTest method testWertpapierKauf5.
@Test
public void testWertpapierKauf5() throws IOException {
ComdirectPDFExtractor extractor = new ComdirectPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "comdirectWertpapierabrechnung_Kauf5.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
Optional<Item> item;
// security
item = results.stream().filter(i -> i instanceof SecurityItem).findFirst();
assertThat(item.isPresent(), is(true));
Security security = ((SecurityItem) item.get()).getSecurity();
assertThat(security.getName(), is("Boeing Co."));
assertThat(security.getIsin(), is("US0970231058"));
assertThat(security.getWkn(), is("850471"));
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().getAmount(), is(Values.Amount.factorize(19359.18)));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2016-07-18T00:00")));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of("EUR", Values.Amount.factorize(55.66))));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(160)));
}
use of name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem in project portfolio by buchen.
the class DeutscheBankPDFExtractorTest method testWertpapierVerkauf2.
@Test
public void testWertpapierVerkauf2() throws IOException {
DeutscheBankPDFExtractor extractor = new DeutscheBankPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DeutscheBankVerkauf2.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
new AssertImportActions().check(results, CurrencyUnit.EUR);
assertSecurity(results);
// 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, Values.Amount.factorize(453.66))));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2015-01-30T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(8)));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.TAX), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(0))));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(7.90 + 0.60 + 2))));
}
use of name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem in project portfolio by buchen.
the class DkbPDFExtractorTest method testWertpapierVerkaufAktien.
@Test
public void testWertpapierVerkaufAktien() throws IOException {
DkbPDFExtractor extractor = new DkbPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DkbVerkaufAktien.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
assertSecuritySellAktien(results);
// 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().getCurrencyCode(), is(CurrencyUnit.EUR));
assertThat(entry.getPortfolioTransaction().getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(3000))));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2016-02-10T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(200)));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(10.00))));
}
use of name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem in project portfolio by buchen.
the class DkbPDFExtractorTest method testWertpapierVerkauf.
@Test
public void testWertpapierVerkauf() throws IOException {
DkbPDFExtractor extractor = new DkbPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DkbVerkauf.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(2));
assertSecuritySell(results);
// 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().getCurrencyCode(), is(CurrencyUnit.EUR));
assertThat(entry.getPortfolioTransaction().getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(4937.19))));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2015-10-27T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(60)));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.TAX), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(481.17))));
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(10.00))));
}
use of name.abuchen.portfolio.datatransfer.Extractor.BuySellEntryItem in project portfolio by buchen.
the class DkbPDFExtractorTest method testStornoWertpapierTeilliquidation.
@Test
public void testStornoWertpapierTeilliquidation() throws IOException {
DkbPDFExtractor extractor = new DkbPDFExtractor(new Client());
List<Exception> errors = new ArrayList<Exception>();
List<Item> results = extractor.extract(PDFInputFile.loadTestCase(getClass(), "DkbStornoTeilliquidation.txt"), errors);
assertThat(errors, empty());
assertThat(results.size(), is(3));
assertSecurityRueckzahlungHerabschreibung(results);
// 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.DELIVERY_INBOUND));
assertThat(entry.getAccountTransaction().getType(), is(AccountTransaction.Type.TRANSFER_OUT));
assertThat(entry.getPortfolioTransaction().getCurrencyCode(), is(CurrencyUnit.EUR));
assertThat(entry.getPortfolioTransaction().getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(1908.39))));
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2016-01-13T00:00")));
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(20)));
// Steuergutschrift bei Storno:
Item itemTaxReturn = results.stream().filter(i -> i instanceof TransactionItem).collect(Collectors.toList()).get(0);
AccountTransaction entryTaxReturn = (AccountTransaction) itemTaxReturn.getSubject();
assertThat(entryTaxReturn.getType(), is(AccountTransaction.Type.TAX_REFUND));
assertThat(entryTaxReturn.getMonetaryAmount(), is(Money.of(CurrencyUnit.EUR, Values.Amount.factorize(91.61))));
assertThat(entryTaxReturn.getDateTime(), is(LocalDateTime.parse("2016-01-13T00:00")));
}
Aggregations