aboutsummaryrefslogtreecommitdiffstats
path: root/python/external_deriv_marks.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/external_deriv_marks.py')
-rw-r--r--python/external_deriv_marks.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/python/external_deriv_marks.py b/python/external_deriv_marks.py
index acb15109..dc0bc666 100644
--- a/python/external_deriv_marks.py
+++ b/python/external_deriv_marks.py
@@ -6,7 +6,7 @@ from collateral.baml_isda import load_excel
from collateral.citi import load_pdf, get_col
from collateral.jpm import load_positions
from dates import bus_day
-from analytics.utils import next_business_day, prev_business_day
+from analytics.utils import next_business_day, prev_business_day, get_fx
# local_nav is the nav in the trade's own currency
COLUMNS = ["trade_date", "buy/sell", "notional", "local_nav", "base_nav", "ia"]
@@ -260,13 +260,16 @@ def jpm_navs(date: datetime.date = None, fund: str = "BowdSt"):
for fname in g:
pages = load_pdf(fname, pages=True)
df = load_positions(pages[4])
+ date = datetime.datetime.strptime(fname.stem.split("-")[2], "%y%m%d").date()
+ df["fx"] = df["Pay CCY"].apply(lambda s: get_fx(date, s))
+ df["local_navs"] = df["MTM Amount"] / df["fx"]
df = df[
[
"Deal ID",
"Trade Date",
"Long/ Short",
"Pay Notional",
- "MTM Amount",
+ "local_navs",
"MTM Amount",
"IM Amount",
]
@@ -274,7 +277,6 @@ def jpm_navs(date: datetime.date = None, fund: str = "BowdSt"):
df = df.set_index("Deal ID")
df["IM Amount"] *= -1.0
df.columns = COLUMNS
- date = datetime.datetime.strptime(fname.stem.split("-")[2], "%y%m%d").date()
d[date] = df
if d:
df = pd.concat(d)