|
8 | 8 | from ..exceptions import HeaderParseError, CASParseError |
9 | 9 | from .regex import DETAILED_DATE_RE, FOLIO_RE, SCHEME_RE, REGISTRAR_RE |
10 | 10 | from .regex import CLOSE_UNITS_RE, NAV_RE, OPEN_UNITS_RE, VALUATION_RE |
11 | | -from .regex import DIVIDEND_RE, TRANSACTION_RE1, TRANSACTION_RE2 |
| 11 | +from .regex import DIVIDEND_RE, TRANSACTION_RE1, TRANSACTION_RE2, DESCRIPTION_TAIL_RE |
12 | 12 | from ..types import FolioType, SchemeType |
13 | 13 | from .utils import isin_search |
14 | 14 |
|
@@ -165,9 +165,15 @@ def process_detailed_text(text): |
165 | 165 | nav=Decimal(m.group(2).replace(",", "_")), |
166 | 166 | ) |
167 | 167 | continue |
| 168 | + description_tail = "" |
| 169 | + if m := re.search(DESCRIPTION_TAIL_RE, line): |
| 170 | + description_tail = m.group(1).strip() |
| 171 | + line = line.replace(m.group(1), "") |
168 | 172 | if m := parse_transaction(line): |
169 | 173 | date = date_parser.parse(m.group(1)).date() |
170 | 174 | desc = m.group(2).strip() |
| 175 | + if description_tail != "": |
| 176 | + desc = " ".join([desc, description_tail]) |
171 | 177 | amt = Decimal(m.group(3).replace(",", "_").replace("(", "-")) |
172 | 178 | if m.group(4) is None: |
173 | 179 | units = None |
|
0 commit comments