From 518b9e808a4caf408bd04de0c75790cc8e879daf Mon Sep 17 00:00:00 2001 From: virgesmith Date: Fri, 20 Nov 2020 09:18:16 +0000 Subject: [PATCH] correct dt value --- examples/option/black_scholes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/option/black_scholes.py b/examples/option/black_scholes.py index 3d214aa3..d7df4765 100644 --- a/examples/option/black_scholes.py +++ b/examples/option/black_scholes.py @@ -62,17 +62,17 @@ def checkpoint(self): # !checkpoint! def simulate(self): - # get the time from the environment - dt = self.timeline().time() + # get the single timestep from the timeline + dt = self.timeline().dt() normals = nstream(self.mc().ustream(self.nsims)) - # compute underlying prices at dt + # compute underlying prices at t=dt S = self.market["spot"] r = self.market["rate"] q = self.market["divy"] sigma = self.market["vol"] underlyings = S * np.exp((r - q - 0.5 * sigma * sigma) * dt + normals * sigma * sqrt(dt)) - # compute option prices at dt + # compute option prices at t=dt if self.option["callput"] == "CALL": fv = (underlyings - self.option["strike"]).clip(min=0.0).mean() else: