use of name.abuchen.portfolio.model.BuySellEntry in project portfolio by buchen.
the class BankSLMPDFExtractor method addSellTransaction.
@SuppressWarnings("nls")
private void addSellTransaction() {
DocumentType type = new DocumentType("abrechnung - Verkauf");
this.addDocumentTyp(type);
Block block = new Block("B.rsenabrechnung - Verkauf");
type.addBlock(block);
Transaction<BuySellEntry> extractor = new Transaction<BuySellEntry>().subject(() -> {
BuySellEntry entry = new BuySellEntry();
entry.setType(PortfolioTransaction.Type.SELL);
return entry;
}).section("date", "shares", "name", "wkn", "currency").match(//
"Wir haben f.r Sie am (?<date>\\d+.\\d+.\\d{4}+) verkauft.").match(//
"^(?<shares>[\\d.']+) .*$").match(//
"^(?<name>.*)$").match(//
"^Valor: (?<wkn>[^ ]*)$").match(//
"Total Kurswert (?<currency>\\w{3}+) .*").assign((t, v) -> {
t.setDate(asDate(v.get("date")));
t.setShares(asShares(v.get("shares")));
t.setSecurity(getOrCreateSecurity(v));
}).section("amount", //
"currency").match(//
"Netto (?<currency>\\w{3}+) (?<amount>[\\d.']+)").assign((t, v) -> {
t.setAmount(asAmount(v.get("amount")));
t.setCurrencyCode(v.get("currency"));
}).wrap(t -> new BuySellEntryItem(t));
addForexGrossValue(extractor);
addFeesSection(extractor);
block.set(extractor);
}
use of name.abuchen.portfolio.model.BuySellEntry in project portfolio by buchen.
the class ComdirectPDFExtractor method addSellTransaction.
@SuppressWarnings("nls")
private void addSellTransaction() {
DocumentType type = new DocumentType("Wertpapierverkauf");
this.addDocumentTyp(type);
Block block = new Block("^(\\* )?Wertpapierverkauf *.*");
type.addBlock(block);
Transaction<BuySellEntry> pdfTransaction = new Transaction<BuySellEntry>().subject(() -> {
BuySellEntry entry = new BuySellEntry();
entry.setType(PortfolioTransaction.Type.SELL);
return entry;
}).section(//
"date").match(//
"Geschäftstag *: (?<date>\\d+.\\d+.\\d{4}+) .*").assign((t, v) -> t.setDate(asDate(v.get("date")))).section("isin", "name", //
"wkn").find(//
"Wertpapier-Bezeichnung *WPKNR/ISIN *").match(//
"^(?<name>(\\S{1,} )*) *(?<wkn>\\S*) *$").match(//
"(\\S{1,} )* *(?<isin>\\S*) *$").assign((t, v) -> t.setSecurity(getOrCreateSecurity(v))).section("shares").optional().match(//
"^St\\. *(?<shares>[\\d.]+(,\\d+)?) .*").assign((t, v) -> t.setShares(asShares(v.get("shares")))).section("shares").optional().match(//
"^ Summe *St\\. *(?<shares>[\\d.]+(,\\d+)?) .*").assign((t, v) -> t.setShares(asShares(v.get("shares")))).section("amount", //
"currency").find(//
".*Zu Ihren Gunsten vor Steuern *").match(//
".* \\d+.\\d+.\\d{4}+ *(?<currency>\\w{3}+) *(?<amount>[\\d.]+,\\d+).*").assign((t, v) -> {
t.setCurrencyCode(asCurrencyCode(v.get("currency")));
t.setAmount(asAmount(v.get("amount")));
}).section("tax").optional().match(//
"^a *b *g *e *f *ü *h *r *t *e *S *t *e *u *e *r *n *(?<tax>.*)$").assign((t, v) -> {
Unit unit = createTaxUnit(v.get("tax"));
if (unit == null || unit.getAmount().isZero())
return;
t.getPortfolioTransaction().addUnit(unit);
MutableMoney total = MutableMoney.of(t.getPortfolioTransaction().getCurrencyCode());
total.add(t.getPortfolioTransaction().getMonetaryAmount());
total.subtract(unit.getAmount());
t.setMonetaryAmount(total.toMoney());
}).wrap(BuySellEntryItem::new);
addFeesSection(pdfTransaction);
block.set(pdfTransaction);
addTaxRefunds(type, "^(\\* )?Wertpapierverkauf *.*");
}
use of name.abuchen.portfolio.model.BuySellEntry in project portfolio by buchen.
the class CommerzbankPDFExtractor method addBuyTransaction.
private void addBuyTransaction() {
DocumentType type = new DocumentType("W e r t p a p i e r k a u f");
this.addDocumentTyp(type);
Block block = new Block("W e r t p a p i e r k a u f");
type.addBlock(block);
block.set(new Transaction<BuySellEntry>().subject(() -> {
BuySellEntry entry = new BuySellEntry();
entry.setType(PortfolioTransaction.Type.BUY);
return entry;
}).section("amount", //
"currency").match(".*Zu I h r e n L a s t e n.*").match("^.* (\\d \\d . \\d \\d . \\d \\d \\d \\d) (?<currency>\\w{3}+)(?<amount>( \\d)*( \\.)?( \\d)* ,( \\d)*)$").assign((t, v) -> {
t.setCurrencyCode(asCurrencyCode(v.get("currency")));
t.setAmount(asAmount(stripBlanks(v.get("amount"))));
}).section(//
"date").match("G e s c h ä f t s t a g : (?<date>\\d \\d . \\d \\d . \\d \\d \\d \\d) .*").assign((t, v) -> t.setDate(asDate(stripBlanks(v.get("date"))))).section(//
"shares").match("S t . (?<shares>[\\d ,.]*) .*").assign((t, v) -> t.setShares(asShares(stripBlanks(v.get("shares"))))).section("wkn", "name", "isin", "currency").match(".*W e r t p a p i e r - B e z e i c h n u n g.*").match("(?<name>.*) (?<wkn>\\S*)").match(//
"^IBAN.*$").match("^(?<isin>.*) (?<currency>\\w{3}+) (\\d \\d . \\d \\d . \\d \\d \\d \\d) (\\w{3}+)(( \\d)*( \\.)?( \\d)* ,( \\d)*)$").assign((t, v) -> {
v.put("isin", stripBlanks(v.get("isin")));
t.setSecurity(getOrCreateSecurity(v));
}).wrap(BuySellEntryItem::new));
}
use of name.abuchen.portfolio.model.BuySellEntry in project portfolio by buchen.
the class ConsorsbankPDFExtractor method addSellTransaction.
@SuppressWarnings("nls")
private void addSellTransaction() {
DocumentType type = new DocumentType("VERKAUF");
this.addDocumentTyp(type);
Block block = new Block("^VERKAUF AM .*$");
type.addBlock(block);
Transaction<BuySellEntry> pdfTransaction = new Transaction<>();
block.set(pdfTransaction);
pdfTransaction.subject(() -> {
BuySellEntry entry = new BuySellEntry();
entry.setType(PortfolioTransaction.Type.SELL);
return entry;
});
//
pdfTransaction.section("wkn", "isin", "name", "currency").find(//
"(Wertpapier|Bezeichnung) WKN ISIN").match(//
"^(?<name>.*) (?<wkn>[^ ]*) (?<isin>[^ ]*)$").match("(Kurs|Preis pro Anteil) (\\d+,\\d+) (?<currency>\\w{3}+) .*").assign((t, v) -> t.setSecurity(getOrCreateSecurity(v))).section(//
"shares").find(//
"Einheit Umsatz( F\\Dlligkeit)?").match(//
"^ST (?<shares>[\\d.]+(,\\d+)?).*$").assign((t, v) -> t.setShares(asShares(v.get("shares")))).section("date", "time").match("VERKAUF AM (?<date>\\d+\\.\\d+\\.\\d{4}+)\\s+UM (?<time>\\d+:\\d+:\\d+).*.*").assign((t, v) -> t.setDate(asDate(v.get("date"), v.get("time")))).section("amount", "currency").match(//
"Wert \\d+.\\d+.\\d{4}+ (?<currency>\\w{3}+) (?<amount>[\\d.]+,\\d+)").assign((t, v) -> {
t.setAmount(asAmount(v.get("amount")));
t.setCurrencyCode(asCurrencyCode(v.get("currency")));
}).wrap(BuySellEntryItem::new);
addFeesSectionsTransaction(pdfTransaction);
addTaxesSectionsTransaction(pdfTransaction);
}
use of name.abuchen.portfolio.model.BuySellEntry in project portfolio by buchen.
the class ConsorsbankPDFExtractor method addBuyTransaction.
@SuppressWarnings("nls")
private void addBuyTransaction() {
DocumentType type = new DocumentType("KAUF");
this.addDocumentTyp(type);
Block block = new Block("^KAUF AM .*$");
type.addBlock(block);
Transaction<BuySellEntry> pdfTransaction = new Transaction<>();
block.set(pdfTransaction);
pdfTransaction.subject(() -> {
BuySellEntry entry = new BuySellEntry();
entry.setType(PortfolioTransaction.Type.BUY);
return entry;
});
//
pdfTransaction.section("wkn", "isin", "name", "currency").find(//
"(Wertpapier|Bezeichnung) WKN ISIN").match(//
"^(?<name>.*) (?<wkn>[^ ]*) (?<isin>[^ ]*)$").match("(Kurs|Preis pro Anteil) (\\d+,\\d+) (?<currency>\\w{3}+) .*").assign((t, v) -> t.setSecurity(getOrCreateSecurity(v))).section(//
"shares").find(//
"Einheit Umsatz( F\\Dlligkeit)?").match(//
"^ST (?<shares>[\\d.]+(,\\d+)?).*$").assign((t, v) -> t.setShares(asShares(v.get("shares")))).section("date", "time").match("KAUF AM (?<date>\\d+\\.\\d+\\.\\d{4}+)\\s+UM (?<time>\\d+:\\d+:\\d+).*").assign((t, v) -> t.setDate(asDate(v.get("date"), v.get("time")))).section("amount", "currency").match(//
"Wert \\d+.\\d+.\\d{4}+ (?<currency>\\w{3}+) (?<amount>[\\d.]+,\\d+)").assign((t, v) -> {
t.setAmount(asAmount(v.get("amount")));
t.setCurrencyCode(asCurrencyCode(v.get("currency")));
}).wrap(BuySellEntryItem::new);
addFeesSectionsTransaction(pdfTransaction);
}
Aggregations