aboutsummaryrefslogtreecommitdiffstats
path: root/python/quote_parsing
diff options
context:
space:
mode:
Diffstat (limited to 'python/quote_parsing')
-rw-r--r--python/quote_parsing/parse_emails.py35
1 files changed, 31 insertions, 4 deletions
diff --git a/python/quote_parsing/parse_emails.py b/python/quote_parsing/parse_emails.py
index a16b6754..09d3681a 100644
--- a/python/quote_parsing/parse_emails.py
+++ b/python/quote_parsing/parse_emails.py
@@ -469,7 +469,7 @@ def parse_jpm_block(fh, indextype):
)
# No price vol
- if indextype == "HY":
+ if indextype == "HY" or "EU":
df["price_vol"] = None
return makedf(df, indextype, "JPM"), line
@@ -643,6 +643,7 @@ def parse_jpm(fh, index_desc):
regex = {
"HY": r"JPM CDX Options: HY [(]([\w\d]*)[)] (?P<expiry>[\d]+-[\w]+-[\d]+) [*]{2} Fwd @(?P<fwdprice>[\d.]+), Delta @([\d]+)",
"IG": r"JPM CDX Options: IG [(]([\w\d]*)[)] (?P<expiry>[\d]+-[\w]+-[\d]+) [*]{2} Fwd @(?P<fwdspread>[\d.]+), Delta @([\d]+)",
+ "EU": r"JPM iTrx Options: MAIN \(S34V1\) (?P<expiry>[\d]+-[\w]+-[\d]+) [*]{2} Fwd @(?P<fwdprice>[\d.]+), Delta @([\d]+)",
}
pat = re.compile(regex[index_desc["index"]])
line = next(fh).strip()
@@ -689,6 +690,17 @@ subject_bnp = re.compile(r"CDX OPTIONS RUN: (IG|HY)(\d{2}).*")
subject_jpm = re.compile(
r"JPM CDX Options: CDX.([\w]+) S(\d+) \d\w \S+-\S+ \[ref ([\d.]*).*"
)
+eu_subject_baml = re.compile("")
+eu_subject_gs = re.compile("")
+eu_subject_ms = re.compile("")
+eu_subject_nom = re.compile("")
+eu_subject_sg = re.compile("")
+eu_subject_citi = re.compile("")
+eu_subject_cs = re.compile("")
+eu_subject_bnp = re.compile("")
+eu_subject_jpm = re.compile(
+ r"JPM iTrx Options: ITRAXX.(\w+) S(\d+) 5Y \S+-\S+ \[ref ([\d.]*)\].*"
+)
def get_current_version(index, series, d, conn):
@@ -707,8 +719,21 @@ def parse_email(email: Path, date_received: datetime.date, conn):
with email.open("rt") as fh:
subject = fh.readline().lstrip()
- for source in ["BAML", "GS", "MS", "NOM", "SG", "CITI", "CS", "BNP", "JPM"]:
- if m := globals()[f"subject_{source.lower()}"].match(subject):
+ for source in [
+ "JPM",
+ "BAML",
+ "GS",
+ "MS",
+ "NOM",
+ "SG",
+ "CITI",
+ "CS",
+ "BNP",
+ "JPM",
+ ]:
+ if (m := globals()[f"subject_{source.lower()}"].match(subject)) or (
+ m := globals()[f"eu_subject_{source.lower()}"].match(subject)
+ ):
version = None
if source in ["CITI", "BNP"]:
indextype, series = m.groups()
@@ -720,6 +745,7 @@ def parse_email(email: Path, date_received: datetime.date, conn):
ref = float(d["ref"])
else:
indextype, series, ref = m.groups()
+ indextype = "EU" if indextype == "MAIN" else indextype
ref = float(ref)
series = int(series)
cur_pos = fh.tell()
@@ -734,6 +760,7 @@ def parse_email(email: Path, date_received: datetime.date, conn):
"America/New_York"
)
fh.seek(cur_pos)
+ version = 1
if version is None:
version = get_version(indextype, series, quotedate)
parse_fun = globals()[f"parse_{source.lower()}"]
@@ -744,7 +771,7 @@ def parse_email(email: Path, date_received: datetime.date, conn):
"series": series,
"version": version,
}
- if source in ["GS", "MS", "NOM", "SG", "JPM"]:
+ if source in ["GS", "MS", "NOM", "SG", "JPM", "JPM_EUR"]:
index_desc["ref"] = ref
if source in ["BNP", "SG"]:
index_desc["expiration_dates"] = list_imm_dates(quotedate)