diff options
Diffstat (limited to 'python/Dawn/views.py')
| -rw-r--r-- | python/Dawn/views.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/python/Dawn/views.py b/python/Dawn/views.py index e69dee6a..900ca2ea 100644 --- a/python/Dawn/views.py +++ b/python/Dawn/views.py @@ -18,6 +18,7 @@ from wtforms.fields import BooleanField from pandas.tseries.offsets import CustomBusinessDay from pandas.tseries.holiday import (get_calendar, HolidayCalendarFactory, GoodFriday) +from pyisda.date import previous_twentieth from .utils import bump_rev, simple_serialize from PyPDF2 import PdfFileMerger @@ -185,19 +186,23 @@ def get_form(trade, kind): form = Form(obj=trade) else: today = pd.datetime.today() - if kind in ['cds', 'swaption']: - tomorrow = today + pd.DateOffset(1) + tomorrow = today + pd.DateOffset(1) + if kind == 'cds': + form = Form(trade_date=today.date(), + effective_date=previous_twentieth(today.date()), + upfront_settle_date=today.date() + 1 * bus_day) + + form.account_code.choices = fcm_accounts() + form.portfolio.choices = [c for c in form.portfolio.choices + if c[0] not in ('IR', 'IG', 'HY')] + form.folder.choices = [c for c in form.folder.choices + if (not c[0].startswith("SER_") or c[0].endswith("CURVE"))] + + elif kind == "swaption": form = Form(trade_date=today.date(), effective_date=tomorrow.date(), upfront_settle_date=today.date() + 3 * bus_day) - if kind == 'cds': - form.account_code.choices = fcm_accounts() - form.portfolio.choices = [c for c in form.portfolio.choices - if c[0] not in ('IR', 'IG', 'HY')] - form.folder.choices = [c for c in form.folder.choices - if (not c[0].startswith("SER_") or c[0].endswith("CURVE"))] - if kind == 'swaption': - form.portfolio.choices = [('OPTIONS', 'OPTIONS'), ('IR', 'IR')] + form.portfolio.choices = [('OPTIONS', 'OPTIONS'), ('IR', 'IR')] else: form = Form(trade_date=today.date(), settle_date=today.date() + 2 * bus_day) |
