
P1: JYS
c09 JWBK378-Fletcher May 12, 2009 19:0 Printer: Yet to come
142 Financial Modelling in Python
exercised before the end of the trade.
def call (self, symbol value pairs to add = None):
.
.
.
# calculate pv
underlying = ctr.retrieve
symbol("underlying")
underlying *= 0
cnt=0
for l in self.
trade.legs():
underlying += ctr.retrieve
symbol("leg"+str(cnt))
cnt += 1
self.
symbol listener (to , "underlying", underlying)
ctr.update
symbol("underlying", underlying, to )
if self.
regression model:
berm = ctr.retrieve
symbol("berm")
berm = self.
exercise helper.max(to , \
self.
trade.exercise type()*underlying, berm)
ctr.update
symbol("berm", berm, to )
pv = 0
if self.
trade.has exercise schedule():
if self.
trade.exercise type() == exercise type.callable:
pv = ctr.retrieve
symbol("berm").mean()
else:
pv = ctr.retrieve
symbol("underlying").mean() \
+ctr.retrieve
symbol("berm").mean()
else:
pv = ctr.retrieve
symbol("underlying").mean()
return pv
The above pricing framework is generic and makes few assumptions on either the model or
the underlying numerical container. One obvious caveat to this is that the pricing framework
doesn’t handle stubs, the treatment of which is beyond the scope of this book. As a final
comment, the inclusion of fees into the framework is left as an exercise for the reader.
9.3 CONCLUDING REMARKS
In this chapter we have developed two pricing frameworks: a lattice pricing framework for
pricing non-path-dependent ...