diff options
| -rw-r--r-- | python/quote_parsing/parse_emails.py | 4 | ||||
| -rw-r--r-- | python/quote_parsing/tests/__init__.py | 0 | ||||
| -rw-r--r-- | python/quote_parsing/tests/test_cs.py | 8 |
3 files changed, 11 insertions, 1 deletions
diff --git a/python/quote_parsing/parse_emails.py b/python/quote_parsing/parse_emails.py index 8fdc3625..04117504 100644 --- a/python/quote_parsing/parse_emails.py +++ b/python/quote_parsing/parse_emails.py @@ -575,7 +575,9 @@ subject_nom = re.compile(r"(?:Fwd:)?CDX (IG|HY)(\d{2}).*- REF:[^\d]*([\d.]+)") subject_gs = re.compile(r"(?:FW: |Fwd: )?GS (IG|HY)(\d{2}) 5y.*- Ref [^\d]*([\d.]+)") subject_sg = re.compile(r"SG OPTIONS - CDX (IG|HY) S(\d{2}).* REF[^\d]*([\d.]+)") subject_citi = re.compile(r"(?:Fwd:)?Citi Options: (IG|HY)(\d{2}) 5Y") -subject_cs = re.compile(r"CS CDX (IG|HY)(\d{2}) Options -\s+Ref = ([\d.]+)[^\d]*") +subject_cs = re.compile( + r"CS CDX (IG|HY)(\d{2}) Options -\s+(?:\d{2}/\d{2}/\d{2}\s+)?Ref = ([\d.]+)[^\d]*" +) subject_bnp = re.compile(r"CDX OPTIONS RUN: (IG|HY)(\d{2}).*") diff --git a/python/quote_parsing/tests/__init__.py b/python/quote_parsing/tests/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/python/quote_parsing/tests/__init__.py diff --git a/python/quote_parsing/tests/test_cs.py b/python/quote_parsing/tests/test_cs.py new file mode 100644 index 00000000..b6988c70 --- /dev/null +++ b/python/quote_parsing/tests/test_cs.py @@ -0,0 +1,8 @@ +from ..parse_emails import subject_cs + + +def test_subject(): + subject1 = "CS CDX HY32 Options - Ref = 107.5" + subject2 = "CS CDX HY31 Options - 01/16/19 Ref = 104.875 trading" + assert subject_cs.match(subject1).groups() == ("HY", "32", "107.5") + assert subject_cs.match(subject2).groups() == ("HY", "31", "104.875") |
