diff options
Diffstat (limited to 'python/quote_parsing')
| -rw-r--r-- | python/quote_parsing/parse_emails.py | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/python/quote_parsing/parse_emails.py b/python/quote_parsing/parse_emails.py index 09fbecf6..7a6f908f 100644 --- a/python/quote_parsing/parse_emails.py +++ b/python/quote_parsing/parse_emails.py @@ -683,17 +683,25 @@ def parse_jpm(fh, index_desc): # subject_baml = re.compile(r"(?:Fwd:){0,2}(?:BAML )?(\D{2})(\d{1,2})\s") regex_dict = { - re.compile( - r"(?:Fwd:){0,2}(?:BofA )?(\D{2})(\d{1,2}).*Ref[^\d]*([\d.]+)" - ): ("BAML", parse_baml), + re.compile(r"(?:Fwd:){0,2}(?:BofA )?(\D{2})(\d{1,2}).*Ref[^\d]*([\d.]+)"): ( + "BAML", + parse_baml, + ), re.compile( r"[^$]*\${1,2} MS CDX OPTIONS: (IG|HY)(\d{2})[^-]*- REF[^\d]*([\d.]+)" ): ("MS", parse_ms), - re.compile(r"(?:Fwd:)?CDX (IG|HY)(\d{2}).*- REF:[^\d]*([\d.]+)"): ("NOM", parse_nom), - re.compile( - r"(?:FW: |Fwd: )?GS (IG|HY)(\d{2}) 5y.*- Ref [^\d]*([\d.]+)" - ): ("GS", parse_gs), - re.compile(r"SG OPTIONS - CDX (IG|HY) S(\d{2}).* REF[^\d]*([\d.]+)"): ("SG", parse_sg), + re.compile(r"(?:Fwd:)?CDX (IG|HY)(\d{2}).*- REF:[^\d]*([\d.]+)"): ( + "NOM", + parse_nom, + ), + re.compile(r"(?:FW: |Fwd: )?GS (IG|HY)(\d{2}) 5y.*- Ref [^\d]*([\d.]+)"): ( + "GS", + parse_gs, + ), + re.compile(r"SG OPTIONS - CDX (IG|HY) S(\d{2}).* REF[^\d]*([\d.]+)"): ( + "SG", + parse_sg, + ), re.compile(r"(?:Fwd:)?Citi Options: (IG|HY)(\d{2}) 5Y"): ("CITI", parse_citi), re.compile( r"CS CDX (?P<index>IG|HY)(?P<series>\d{2})_?v?(?P<version>\d)? Options -\s+(?:\d{2}/\d{2}/\d{2}\s+)?Ref = (?P<ref>[\d.]+)[^\d]*" @@ -782,8 +790,10 @@ def write_todb(swaption_stack, index_data, conn): sql_str = sql.SQL( "INSERT INTO swaption_ref_quotes({}) VALUES({}) " "ON CONFLICT DO NOTHING RETURNING ref_id" - ).format(sql.SQL(", ").join(sql.Identifier(c) for c in index_data.columns), - sql.SQL(", ").join(sql.Placeholder() * len(index_data.columns))) + ).format( + sql.SQL(", ").join(sql.Identifier(c) for c in index_data.columns), + sql.SQL(", ").join(sql.Placeholder() * len(index_data.columns)), + ) sql_quotes = sql.SQL( "INSERT INTO swaption_quotes({}) VALUES %s ON CONFLICT DO NOTHING" |
