diff options
Diffstat (limited to 'python/pnl_explain.py')
| -rw-r--r-- | python/pnl_explain.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/python/pnl_explain.py b/python/pnl_explain.py index 4a28e6e5..f5013514 100644 --- a/python/pnl_explain.py +++ b/python/pnl_explain.py @@ -1,7 +1,7 @@ import datetime import pandas as pd -import serenitas.analytics +from serenitas.analytics.config import Config from serenitas.analytics.dates import bus_day, prev_business_day, next_business_day from serenitas.analytics.utils import get_fx from serenitas.analytics.api import FxForward @@ -37,7 +37,7 @@ def get_index_pv( accrued = 0.0 for t in portf.trades: _, amount = t._fee_leg.cashflows[0] - if not serenitas.analytics._local: + if not Config.local: amount *= get_fx(prev_day, t.currency) accrued -= amount * t.notional * t.factor * t.fixed_rate * 1e-4 else: @@ -55,7 +55,7 @@ def get_index_pv( conn.reset() raise e for (fee, curr) in c: - if not serenitas.analytics._local: + if not Config.local: fee *= get_fx(prev_day, curr) nav += fee upfronts.append(nav) @@ -441,8 +441,9 @@ if __name__ == "__main__": from serenitas.utils.db import dbconn from itertools import chain - serenitas.analytics._local = False - serenitas.analytics._include_todays_cashflows = True + Config.local = False + Config.include_todays_cashflows = True + dawndb = dbconn("dawndb") parser = argparse.ArgumentParser() parser.add_argument("start_date", type=datetime.datetime.fromisoformat) |
