Skip to content
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

added Fidelity PDF import of trade confirmations #3678

Closed
wants to merge 0 commits into from

Conversation

ggrossbe
Copy link
Contributor

added Fidelity PDF import of trade confirmations (not monthly/quarterly statements)

@ggrossbe
Copy link
Contributor Author

P.S. tests are running fine. I cannot run PP as program from Eclipse on my Mac. Buttons are not showing, ...

@buchen
Copy link
Member

buchen commented Dec 19, 2023

P.S. tests are running fine. I cannot run PP as program from Eclipse on my Mac. Buttons are not showing, ...

Do you use the https://marketplace.eclipse.org/content/launch-configuration-dsl to generate the launch configuration? (I am developing on macOS so it does work there from within Eclipse)

@buchen
Copy link
Member

buchen commented Dec 19, 2023

@Nirus2000

@Nirus2000
Copy link
Member

Hello @ggrossbe
Thank you for your pull request.
That looks very promising.

First of all, however, the importer must be called in PP.
Please add the respective importers to the PDFImportAssistant.java 👍🏻

To keep the source code clean, we would welcome the removal of unused source code (commented out).
The Contributing rules will help you how to structure this correctly, but it already looks very good. Good work. 👍🏻
Have a look there and read them... maybe this will help you to structure the source better.

One question remains.
Why two different importers? (FidelityPDFExtractor and FidelityStockPlanPDFExtractor)

Please merge the two.

Regards
Alex

Comment on lines 54 to 57
.section("month", "day", "year") //
.match("^\\d+-\\w+.* (?<month>\\d+)-(?<day>\\d+)-(?<year>\\d+) \\d+-\\d+-\\d+.*$")
.assign((t, v) -> //
t.setDate(asDate(v.get("day") + "." + v.get("month") + ".20" + v.get("year"))))
Copy link
Member

@Nirus2000 Nirus2000 Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example with contributing rules

Suggested change
.section("month", "day", "year") //
.match("^\\d+-\\w+.* (?<month>\\d+)-(?<day>\\d+)-(?<year>\\d+) \\d+-\\d+-\\d+.*$")
.assign((t, v) -> //
t.setDate(asDate(v.get("day") + "." + v.get("month") + ".20" + v.get("year"))))
// @formatter:off
// 20123-1XXXXX 1* WK# 01-04-21 01-06-21 46428Q109 20123-XXXXX
// @formatter:on
.section("date") //
.match("^.* WK# (?<date>[\\d]{2}\\-[\\d]{2}\\-[\\d]{2}) .*$") //
.assign((t, v) -> t.setDate(asDate(v.get("date"))))

@Nirus2000 Nirus2000 added the pdf label Dec 20, 2023
@ggrossbe
Copy link
Contributor Author

One question remains.
Why two different importers? (FidelityPDFExtractor and FidelityStockPlanPDFExtractor)

Merged now. There are two different document formats from different brokerage accounts. One is a regular account and one is a company stock plan account.

@Nirus2000
Copy link
Member

Nirus2000 commented Dec 21, 2023

Hello @ggrossbe
Please do not check in the current Master in your branch.
This is a lot of extra work for Andreas to disassemble it again.
Do uncheck. ad27d62, 48e609c, 508e42f

And after cleaning up your branch, please merge/rebase the commits in your branch.

.match("^(?!REFERENCE)(?!DESCRIPTION)(?<tickerSymbol>[A-Z]{2,5}).*$") //
.assign((t, v) -> {
t.setCurrencyCode(asCurrencyCode("USD"));
v.put("currency", "USD");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the "$" to identify the currency. You can find the appropriate regex -> here <-.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no $ sign in the text :(

Comment on lines 130 to 135
String date = v.get("date");
// convert month to camel case
if (Character.isLetter(date.charAt(0)))
{
date = date.charAt(0) + date.substring(1, 3).toLowerCase() + date.substring(3);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if you use the ExtractorUtils correctly, we could save this part.
What did you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, as the DateFormatter expects "Dec" and the text from the bank statement is "DEC"

Comment on lines 191 to 205
@Override
protected long asShares(String value)
{
String language = "de";
String country = "DE";

int lastDot = value.lastIndexOf(".");
int lastComma = value.lastIndexOf(",");

// returns the greater of two int values
if (Math.max(lastDot, lastComma) == lastDot)
{
language = "en";
country = "US";
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if all "asShares" are in en_US you can remove this and use
.assign((t, v) -> t.setShares(asShares(v.get("shares"), "en", "US"))),

The same for "asAmount"... 👍🏻 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants