diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/pnl_explain.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/python/pnl_explain.py b/python/pnl_explain.py index 387cadaf..f398ae6d 100644 --- a/python/pnl_explain.py +++ b/python/pnl_explain.py @@ -8,7 +8,7 @@ from risk.swaptions import get_swaption_portfolio from risk.indices import get_index_portfolio from risk.tranches import get_tranche_portfolio from pyisda.date import previous_twentieth, cds_accrued -from typing import Tuple, Union +from typing import Literal, Tuple, Union def get_index_pv( @@ -98,16 +98,13 @@ def get_swaption_pv( ) for (fee,) in c: nav += fee + daily.append(nav) dates.append(prev_day) if portf: pv.append(portf.pv) else: pv.append(0.0) - daily.append(nav) - df = pd.DataFrame( - {"pv": pv, "upfront": upfronts, "accrued": accrueds}, - index=pd.to_datetime(dates), - ) + df = pd.DataFrame({"pv": pv, "daily": daily}, index=pd.to_datetime(dates)) return df @@ -386,6 +383,7 @@ if __name__ == "__main__": action="store", default="tranche", dest="pnl_type", + choices=("tranche", "swaption", "bond", "hedge"), help="instrument for which we want the pnl ('tranche', 'swaption', 'bond', 'hedge')", ) parser.add_argument( |
