aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/analytics/tranche_basket.py4
-rw-r--r--python/risk/tranches.py3
2 files changed, 4 insertions, 3 deletions
diff --git a/python/analytics/tranche_basket.py b/python/analytics/tranche_basket.py
index 46161e0f..985ade28 100644
--- a/python/analytics/tranche_basket.py
+++ b/python/analytics/tranche_basket.py
@@ -19,7 +19,6 @@ from .utils import (
memoize,
build_table,
bus_day,
- next_twentieth,
get_external_nav,
run_local,
)
@@ -35,6 +34,7 @@ from scipy.optimize import brentq
from scipy.interpolate import CubicSpline, PchipInterpolator
from scipy.special import logit, expit
+from typing import Callable
import datetime
import logging
import matplotlib.pyplot as plt
@@ -717,7 +717,7 @@ class DualCorrTranche:
)
def theta(self, method="ATM", skew=None):
- if self.maturity + relativedelta(years=-1) < self.value_date:
+ if self.maturity + relativedelta(years=-1) <= self.value_date + relativedelta(days=1):
raise ValueError("less than one year left")
def aux(x, K2, shortened):
diff --git a/python/risk/tranches.py b/python/risk/tranches.py
index 3bf72e50..93c433f4 100644
--- a/python/risk/tranches.py
+++ b/python/risk/tranches.py
@@ -79,7 +79,8 @@ def insert_tranche_portfolio(portf, conn):
logger.info(f"marking tranche {trade_id} in {strat}")
try:
theta = trade.theta(method="TLP")
- except (ValueError, RuntimeError):
+ except (ValueError, RuntimeError) as e:
+ logger.info(str(e))
theta = (
trade.clean_pv / trade.notional / trade.duration
+ trade.tranche_running * 1e-4