-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathExampleIRD.py
More file actions
32 lines (22 loc) · 1.11 KB
/
Copy pathExampleIRD.py
File metadata and controls
32 lines (22 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from IRD import *
from runExampleCalcs import *
#Tested to match R version
def ExampleIRD():
# creating the trade objects and storing them in a list
tr1 = IRDSwap(Notional=10000,MtM=30,Currency="USD",Si=0,Ei=10,BuySell='Buy')
tr2 = IRDSwap(Notional=10000,MtM=-20,Currency="USD",Si=0,Ei=4,BuySell='Sell')
tr3 = IRDSwaption(Notional=5000,MtM=50,Currency="EUR",Si=1,Ei=11,BuySell='Sell',OptionType='Put',UnderlyingPrice=0.06,StrikePrice=0.05)
trades= [tr1,tr2,tr3]
# calculating the Exposure-at-Default
return runExampleCalcs(trades)
print(ExampleIRD())
def ExampleIRD():
"""Testing negative underlying price"""
# creating the trade objects and storing them in a list
tr1 = IRDSwap(Notional=10000,MtM=30,Currency="USD",Si=0,Ei=10,BuySell='Buy')
tr2 = IRDSwap(Notional=10000,MtM=-20,Currency="USD",Si=0,Ei=4,BuySell='Sell')
tr3 = IRDSwaption(Notional=5000,MtM=50,Currency="EUR",Si=1,Ei=11,BuySell='Sell',OptionType='Put',UnderlyingPrice=-0.06,StrikePrice=0.05)
trades= [tr1,tr2,tr3]
# calculating the Exposure-at-Default
return runExampleCalcs(trades)
print(ExampleIRD())