aboutsummaryrefslogtreecommitdiffstats
path: root/python/trade_dataclasses.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/trade_dataclasses.py')
-rw-r--r--python/trade_dataclasses.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/python/trade_dataclasses.py b/python/trade_dataclasses.py
index fe06ce1d..fb27386a 100644
--- a/python/trade_dataclasses.py
+++ b/python/trade_dataclasses.py
@@ -9,7 +9,12 @@ import csv
import datetime
from psycopg.types.numeric import Int2BinaryDumper
from psycopg import adapters
-from serenitas.analytics.dates import next_business_day, previous_twentieth
+from serenitas.analytics.dates import (
+ next_business_day,
+ previous_twentieth,
+ adjust_next_business_day,
+ prev_business_day,
+)
from serenitas.utils.db2 import dbconn
from serenitas.utils.env import DAILY_DIR
from serenitas.utils.remote import SftpClient
@@ -388,7 +393,11 @@ class CDSDeal(
bbg_ticket_id: str = None
def __post_init__(self):
- self.effective_date = previous_twentieth(self.trade_date)
+ start_protection = d + datetime.timedelta(days=1)
+ effective_date = previous_twentieth(prev_business_day(start_protection))
+ self.effective_date = adjust_next_business_day(
+ previous_twentieth(self.trade_date)
+ )
def to_markit(self):
obj = self.serialize("mtm")