aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/risk/bonds.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/python/risk/bonds.py b/python/risk/bonds.py
index edb4ceb8..6333fc8e 100644
--- a/python/risk/bonds.py
+++ b/python/risk/bonds.py
@@ -134,7 +134,7 @@ def subprime_risk(pos_date, conn, engine, model_date=None):
),
delta_ir=df_calc.delta_ir_io + df_calc.delta_ir_po,
# use original notional for 0 factor bonds to calc yield
- curr_ntl=df_calc.notional * df_calc.factor.apply(lambda x: 1 if x == 0 else x),
+ curr_ntl=df_calc.notional * df_calc.factor.where(df_calc.factor != 0.0, 1.0),
# assume beta and ontr is initialized from analytics
hy_equiv=(
df_calc.delta_yield
@@ -144,9 +144,8 @@ def subprime_risk(pos_date, conn, engine, model_date=None):
* df_calc.local_market_value
/ df_calc.pv3
),
- date=pos_date,
+ date=pd.Timestamp(pos_date),
)
- df_calc.date = pd.to_datetime(df_calc.date)
df_calc.bond_yield += (
np.log(df_calc.pv1 * df_calc.curr_ntl / df_calc.local_market_value)
/ df_calc.modDur