aboutsummaryrefslogtreecommitdiffstats
path: root/python/mark_swaptions.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/mark_swaptions.py')
-rw-r--r--python/mark_swaptions.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/python/mark_swaptions.py b/python/mark_swaptions.py
index 1623a181..0566e55d 100644
--- a/python/mark_swaptions.py
+++ b/python/mark_swaptions.py
@@ -65,19 +65,15 @@ def mark_trades(date, engine):
underlying.ref = quote.ref
swaption = Swaption(underlying, trade.expiration_date.date(),
trade.strike, trade.swaption_type.lower())
- if swaption.option_type == "payer":
- if quote.payer is None:
- swaption.sigma = quote.receiver
- else:
- swaption.sigma = quote.payer
- else:
- if quote.receiver is None:
- swaption.sigma = quote.payer
- else:
- swaption.sigma = quote.receiver
+ swaption.sigma = getattr(quote, swaption.option_type)
+ if swaption.sigma is None:
+ swaption.sigma = quote.receiver if option_type == "payer" else quote.payer
direction = 1. if trade.buysell else -1.
market_value = swaption.pv * trade.notional * direction
- market_value += swaption.DV01 * (closespread - quote.ref) * trade.notional * direction
+ if trade.index in ["HY", "XO"]:
+ market_value += (quote.ref - closeprice) / 100 * swaption.delta * trade.notional * direction
+ else:
+ market_value += swaption.DV01 * (closespread - quote.ref) * trade.notional * direction
#compute the greeks at index mark
swaption.index.spread = closespread
swaption._update()