Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/ofxstatement_fidelity/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class FidelityCSVParser(AbstractStatementParser):
(re.compile(r"^PARTIC CONTR "), "INVBANKTRAN", "CREDIT"),
(re.compile(r"^PARTIAL DISTRIBUTION "), "INVBANKTRAN", "DEBIT"),
(re.compile(r"^FED TAX W/H "), "INVBANKTRAN", "DEBIT"),
(re.compile(r"^DISTRIBUTION "), "TRANSFER", "IN"),
(re.compile(r"^IN LIEU OF FRX SHARE SPINOFF "), "INCOME", "MISC"),
]

def __init__(self, filename: str) -> None:
Expand Down Expand Up @@ -132,9 +134,14 @@ def parse_record(self, line):
invest_stmt_line.unit_price = self.parse_decimal(line[5])
invest_stmt_line.units = self.parse_decimal(line[6])

elif invest_stmt_line.trntype == "TRANSFER":
invest_stmt_line.security_id = line[2]
invest_stmt_line.units = self.parse_decimal(line[6])
invest_stmt_line.unit_price = invest_stmt_line.amount / invest_stmt_line.units

elif (
invest_stmt_line.trntype == "INCOME"
and invest_stmt_line.trntype_detailed == "DIV"
and invest_stmt_line.trntype_detailed in ("DIV", "MISC")
):
invest_stmt_line.security_id = line[2]

Expand Down
3 changes: 3 additions & 0 deletions tests/History_for_Account_TEST2139.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@


Run Date,Action,Symbol,Description,Type,Price ($),Quantity,Commission ($),Fees ($),Accrued Interest ($),Amount ($),Cash Balance ($),Settlement Date
01/29/2025,"IN LIEU OF FRX SHARE SPINOFF FROM:(CONS) ACME CORP (ACME) (Cash)",ACME,"ACME CORP",Cash,,0.000,,,,3.78,74003.45,
01/29/2025,"DISTRIBUTION SPINOFF FROM:(CONS) ACME CORP (ACME) (Cash)",ACME,"ACME CORP",Shares,,3,,,,61.98,73999.67,
01/28/2025,"DISTRIBUTION ACME CORP (ACME) (Cash)",ACME,"OBFUSCATED DESCRIPTION",Shares,,3.000,,,,101.00,73999.67,
01/28/2026,YOU BOUGHT PROSPECTUS UNDER SEPARATE COVER FIDELITY 500 INDEX FUND (FXAIX) (Cash),FXAIX,OBFUSCATED DESCRIPTION,Cash,55.274,169.59,,,,-9373.92,73696.67,01/29/2026
01/26/2026,YOU BOUGHT PROSPECTUS UNDER SEPARATE COVER FIDELITY 500 INDEX FUND (FXAIX) (Cash),FXAIX,OBFUSCATED DESCRIPTION,Cash,58.558,172.72,,,,-10114.14,63582.53,01/27/2026
01/26/2026,CONTRIBUTION VS XXX-XXXXXX-X EMPLOYER CONTR (Cash),,OBFUSCATED DESCRIPTION,Cash,,0.00,,,,551.24,64133.77,
Expand Down