2323 DESCRIPTION_TAIL_RE ,
2424 DETAILED_DATE_RE ,
2525 DIVIDEND_RE ,
26- FOLIO_RE ,
2726 FOLIO_KV_RE ,
27+ FOLIO_RE ,
2828 NAV_RE ,
2929 NOMINEE_RE ,
3030 OPEN_UNITS_RE ,
3131 REGISTRAR_RE ,
32- SCHEME_RE ,
3332 SCHEME_KV_RE ,
33+ SCHEME_RE ,
3434 TRANSACTION_RE1 ,
3535 TRANSACTION_RE2 ,
3636 TRANSACTION_RE3 ,
37+ TRANSACTION_RE4 ,
3738 VALUATION_RE ,
3839)
3940from .utils import isin_search
@@ -99,7 +100,7 @@ def get_transaction_type(
99100 txn_type = TransactionType .PURCHASE
100101 elif units < 0 :
101102 if re .search (
102- "reversal|rejection|dishonoured|mismatch|insufficient\s+balance" , description , re .I
103+ r "reversal|rejection|dishonoured|mismatch|insufficient\s+balance" , description , re .I
103104 ):
104105 txn_type = TransactionType .REVERSAL
105106 elif "switch" in description :
@@ -128,7 +129,7 @@ def get_parsed_scheme_name(scheme) -> str:
128129
129130
130131def parse_transaction (line ) -> Optional [ParsedTransaction ]:
131- for regex in (TRANSACTION_RE1 , TRANSACTION_RE2 , TRANSACTION_RE3 ):
132+ for regex in (TRANSACTION_RE1 , TRANSACTION_RE2 , TRANSACTION_RE3 , TRANSACTION_RE4 ):
132133 if m := re .search (regex , line , re .DOTALL | re .MULTILINE | re .I ):
133134 groups = m .groups ()
134135 date = description = amount = units = nav = balance = None
@@ -138,6 +139,10 @@ def parse_transaction(line) -> Optional[ParsedTransaction]:
138139 elif groups .count (None ) == 2 :
139140 # Segregated Portfolio Entries
140141 date , description , units , balance , * _ = groups
142+ elif groups .count (None ) == 1 :
143+ # Zero unit entries
144+ date , description , amount , units , nav , balance = groups
145+ units = "0.000"
141146 elif groups .count (None ) == 0 :
142147 # Normal entries
143148 date , description , amount , units , nav , balance = groups
0 commit comments