diff options
Diffstat (limited to 'python/quote_parsing/parse_emails.py')
| -rw-r--r-- | python/quote_parsing/parse_emails.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/python/quote_parsing/parse_emails.py b/python/quote_parsing/parse_emails.py index a1991839..9b9b6387 100644 --- a/python/quote_parsing/parse_emails.py +++ b/python/quote_parsing/parse_emails.py @@ -466,8 +466,7 @@ def parse_gs(fh, index_desc): line = next(fh).strip() while True: if line.startswith("Expiry"): - m = pat.match(line) - if m: + if m := pat.match(line): expiry, fwdprice, fwdspread = m.groups() expiry = pd.to_datetime(expiry, format="%d%b%y") fwd_index.append( @@ -505,8 +504,7 @@ def parse_citi(fh, index_desc): for line in fh: line = line.strip() if line.startswith("Exp"): - m = pat.match(line) - if m: + if m := pat.match(line): expiry, ref = m.groups() expiry = pd.to_datetime(expiry, format="%d-%b-%y") fwd_index.append({"ref": ref, "expiry": expiry, **index_desc}) @@ -528,8 +526,7 @@ def parse_cs(fh, index_desc): for line in fh: line = line.strip() if line.startswith("Ref"): - m = pat.match(line) - if m: + if m := pat.match(line) d = m.groupdict() d["expiry"] = pd.to_datetime(d["expiry"], format="%d-%b-%y") fwd_index.append({**index_desc, **d}) @@ -551,8 +548,7 @@ def parse_bnp(fh, index_desc): c = line.find("Strike") if c != -1: line = line[:c].rstrip() - m = pat.match(line) - if m: + if m := pat.match(line): d = m.groupdict() if index_desc["index"] == "HY": d["fwdprice"] = d.pop("fwdspread") @@ -600,8 +596,7 @@ def parse_email(email, date_received, conn): subject = fh.readline().lstrip() for source in ["BAML", "GS", "MS", "NOM", "SG", "CITI", "CS", "BNP"]: - m = globals()[f"subject_{source.lower()}"].match(subject) - if m: + if m := globals()[f"subject_{source.lower()}"].match(subject) version = None if source in ["BAML", "CITI", "BNP"]: indextype, series = m.groups() |
