diff options
| -rw-r--r-- | python/pnl_explain.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/python/pnl_explain.py b/python/pnl_explain.py index 0e54b718..fb23b574 100644 --- a/python/pnl_explain.py +++ b/python/pnl_explain.py @@ -1,5 +1,7 @@ import datetime import pandas as pd +import serenitas.analytics + from serenitas.analytics.utils import get_fx, prev_business_day, next_business_day from dates import bus_day from psycopg2.errors import SyntaxError @@ -34,7 +36,8 @@ def get_index_pv( accrued = 0.0 for t in portf.trades: _, amount = t._fee_leg.cashflows[0] - amount *= get_fx(prev_day, t.currency) + if not serenitas.analytics._local: + amount *= get_fx(prev_day, t.currency) accrued -= amount * t.notional * t.factor * t.fixed_rate * 1e-4 else: accrued = 0.0 @@ -51,7 +54,9 @@ def get_index_pv( conn.reset() raise e for (fee, curr) in c: - nav += fee * get_fx(prev_day, curr) + if not serenitas.analytics._local: + fee *= get_fx(prev_day, curr) + nav += fee upfronts.append(nav) accrueds.append(accrued) pvs.append(portf.pv) |
