Thanks for your work on quiffen.
I have a qif file from a Quicken export with a security that is not publicly traded, so it has a name and no symbol.
That produces an error with from Qif.parse using quiffen 2.0.13, shown below.
$ ./example.py
Traceback (most recent call last):
File ".../example.py", line 6, in <module>
qif = Qif.parse('ex.QIF', day_first=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../.venv/lib/python3.12/site-packages/quiffen/core/qif.py", line 249, in parse
raise ParserException(
quiffen.core.qif.ParserException: Line 2: No symbol found for security.
Here is an ex.QIF:
^
!Type:Security
NExample
TStock
In my local copy, I used the name as the symbol with the following patch:
$ diff -p .venv/lib/python3.12/site-packages/quiffen/core/security.py tmp/security.py
*** .venv/lib/python3.12/site-packages/quiffen/core/security.py 2024-12-25 13:39:50.000000000 -0600
--- tmp/security.py 2024-12-11 18:47:15.000000000 -0600
*************** class Security(BaseModel):
*** 128,133 ****
--- 128,136 ----
if line_number is not None:
kwargs["line_number"] = line_number
+ # if symbol is not present, use the name
+ kwargs["symbol"] = kwargs.get("symbol", kwargs.get("name"))
+
return cls(**kwargs)
@classmethod
I'd be happy to submit that as a PR if you wish.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too