-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CetesDirecto PDF Extractor #4511
base: master
Are you sure you want to change the base?
Conversation
… amounts and add taxes
…ferent. Buy transactions should be working fine now. Sales need work.
…which is not working yet.
Issue: #4511 Signed-off-by: Jonathan <[email protected]> [squashed commits; use latest matcher for test; removed global variable CurrencyUnit.MXN; rebased to master] Signed-off-by: Andreas Buchen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jonathlan for your contribution.
I have merged the change (with some minor refactoring)
// addFeesSectionsTransaction(pdfTransaction, type); | ||
} | ||
|
||
private <T extends Transaction<?>> void addTaxesSectionsTransaction(T transaction, DocumentType type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is never used locally.
BuySellEntry entry = (BuySellEntry) results.stream().filter(BuySellEntryItem.class::isInstance).findFirst() | ||
.orElseThrow(IllegalArgumentException::new).getSubject(); | ||
|
||
assertThat(entry.getPortfolioTransaction().getType(), is(PortfolioTransaction.Type.BUY)); | ||
assertThat(entry.getAccountTransaction().getType(), is(AccountTransaction.Type.BUY)); | ||
|
||
assertThat(entry.getPortfolioTransaction().getDateTime(), is(LocalDateTime.parse("2022-01-06T00:00:00"))); | ||
assertThat(entry.getPortfolioTransaction().getShares(), is(Values.Share.factorize(6080))); | ||
assertThat(entry.getSource(), is("EdoCta01.txt")); | ||
assertThat(entry.getNote(), is("ID:SVD147529623 Series:220203 Term:2 Rate:5.51")); | ||
|
||
assertThat(entry.getPortfolioTransaction().getMonetaryAmount(), | ||
is(Money.of(CurrencyUnit.MXN, Values.Amount.factorize(60540.38)))); | ||
assertThat(entry.getPortfolioTransaction().getGrossValue(), | ||
is(Money.of(CurrencyUnit.MXN, Values.Amount.factorize(60540.38)))); | ||
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.TAX), | ||
is(Money.of(CurrencyUnit.MXN, Values.Amount.factorize(0.00)))); | ||
assertThat(entry.getPortfolioTransaction().getUnitSum(Unit.Type.FEE), | ||
is(Money.of(CurrencyUnit.MXN, Values.Amount.factorize(0.00)))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We created custom matcher that make these kinds of tests easier to write and easier to read. I have refactored the code accordingly.
Hello @jonathlan Another problem with collective statements is that it is not clear in which currency the security is held. This leads to further difficulties, especially with dividend payments. There is also the problem that the import is made in dollars, although the settlement is made in another currency, which leads to incorrect results. Hence our request: Create the individual statements as an importer. Alternatively, PDF debugs can be posted in the forum in a corresponding thread. Regards Set commit to draft |
Thanks @Nirus2000 ! I just double checked but this is the only type of PDF I can get from CetesDirecto. I was not aware this was a collective statement. I tried to convert it to csv, but the buy and sales operations have different columns, hence requires a lot of manual work. That's what encouraged me to develop the importer. Thank a lot! |
Hello @jonathlan |
Issue: https://forum.portfolio-performance.info/t/pdf-import-from-cetesdirecto/31306
Add initial implementation to import CetesDirecto PDF which was not there before.
This required a new date format "dd/MM/yy" and MXN currency type for Mexico.