Skip to content

Commit

Permalink
Merge pull request #255 from jaik03/Move-STOCKINFO
Browse files Browse the repository at this point in the history
Fix STOCKINFO tag generation for investment files
  • Loading branch information
kedder committed Jan 2, 2024
2 parents 4c4a517 + 6fa37fe commit 6916e58
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ NEWFILEUID:NONE
<SECNAME>AAPL</SECNAME> <!-- Full name of security (for simplicty just reuse ticker) -->
<TICKER>AAPL</TICKER> <!-- Ticker -->
</SECINFO>
<SECINFO>
</STOCKINFO>
<STOCKINFO>
<SECINFO>
<SECID>
<UNIQUEID>MSFT</UNIQUEID>
<UNIQUEIDTYPE>TICKER</UNIQUEIDTYPE>
Expand Down
4 changes: 2 additions & 2 deletions src/ofxstatement/ofx.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ def buildInvestTransactionList(self) -> None:
tb = self.tb
tb.start("SECLISTMSGSRSV1", {})
tb.start("SECLIST", {})
tb.start("STOCKINFO", {})

# get unqiue tickers
for security_id in dict.fromkeys(
map(lambda x: x.security_id, self.statement.invest_lines)
):
tb.start("STOCKINFO", {})
tb.start("SECINFO", {})
tb.start("SECID", {})
self.buildText("UNIQUEID", security_id)
Expand All @@ -164,8 +164,8 @@ def buildInvestTransactionList(self) -> None:
self.buildText("SECNAME", security_id)
self.buildText("TICKER", security_id)
tb.end("SECINFO")
tb.end("STOCKINFO")

tb.end("STOCKINFO")
tb.end("SECLIST")
tb.end("SECLISTMSGSRSV1")

Expand Down
2 changes: 2 additions & 0 deletions src/ofxstatement/tests/test_ofx_invest.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
<SECNAME>AAPL</SECNAME>
<TICKER>AAPL</TICKER>
</SECINFO>
</STOCKINFO>
<STOCKINFO>
<SECINFO>
<SECID>
<UNIQUEID>MSFT</UNIQUEID>
Expand Down

0 comments on commit 6916e58

Please sign in to comment.