diff options
Diffstat (limited to 'python/quote_parsing/parse_emails.py')
| -rw-r--r-- | python/quote_parsing/parse_emails.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/python/quote_parsing/parse_emails.py b/python/quote_parsing/parse_emails.py index e07d295b..5b106b26 100644 --- a/python/quote_parsing/parse_emails.py +++ b/python/quote_parsing/parse_emails.py @@ -617,12 +617,17 @@ def parse_bnp(fh, index_desc): def parse_jpm(fh, index_desc): option_stack = {} fwd_index = [] - pat = re.compile(r"JPM CDX Options: IG [(](?P<ticker>[\w\d]*)[)] (?P<expiry>[\d]+-[\w]+-[\d]+) [*]{2} Fwd @(?P<fwd>[\d.]+), Delta @(?P<delta>[\d]+)") + subject_jpm = re.compile(r"JPM CDX Options: CDX.([\w]+) S(\d+) \d\w \S+-\S+ \[ref (?P<ref>[\d.]*).*") + pat = re.compile(r"JPM CDX Options: IG [(]([\w\d]*)[)] (?P<expiry>[\d]+-[\w]+-[\d]+) [*]{2} Fwd @(?P<fwdspread>[\d.]+), Delta @([\d]+)") line = next(fh).strip() + if m := subject_jpm.match(line): + d = m.groupdict() + ref = d['ref'] while True: if "**" in line: if m := pat.match(line): d = m.groupdict() + d['ref'] = ref expiry_month = datetime.datetime.strptime(d["expiry"], "%d-%b-%y").month d["expiry"] = pd.to_datetime(d["expiry"], format="%d-%b-%y") fwd_index.append({**index_desc, **d}) @@ -642,7 +647,6 @@ def parse_jpm(fh, index_desc): line = next(fh).strip() except StopIteration: break - breakpoint() return option_stack, fwd_index # subject_baml = re.compile(r"(?:Fwd:){0,2}(?:BAML )?(\D{2})(\d{1,2})\s") |
