diff options
Diffstat (limited to 'python/parse_gs_exchange.py')
| -rw-r--r-- | python/parse_gs_exchange.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/python/parse_gs_exchange.py b/python/parse_gs_exchange.py index 0d6de7c0..2fec4a4a 100644 --- a/python/parse_gs_exchange.py +++ b/python/parse_gs_exchange.py @@ -12,7 +12,7 @@ class ParseError(Exception): def parse_email(email, fwd_index): - m = re.search("(IG|HY)(\d{2}) 5y (?:.*)SWAPTION (?:UPDATE|CLOSES|CLOSE) - Ref\D+(.+)$", + m = re.search("(IG|HY)(\d{2}) 5y (?:.*)SWAPTION (?:UPDATE|CLOSES|CLOSE) - Ref\D+([\d.]+)\D*$", email.subject) if m: indextype, series, ref = m.groups() @@ -22,7 +22,10 @@ def parse_email(email, fwd_index): re.match(r"([\S]+)\s+\(([^)]+)\)", ref). groups()) else: - refspread = float(ref) + try: + refspread = float(ref) + except ValueError as e: + raise ParseError(str(e)) else: raise ParseError(f"can't parse subject line: {email.subject}") @@ -112,6 +115,7 @@ if __name__ == "__main__": quotedate, indextype, series, df = parse_email(email, fwd_index) except ParseError as e: logging.exception(e) + continue swaption_quotes[(quotedate, indextype, series)] = df index_df = pd.DataFrame(fwd_index) |
