diff --git a/pfhedge/instruments/primary/brownian.py b/pfhedge/instruments/primary/brownian.py index ffde5e8f..dd500da2 100644 --- a/pfhedge/instruments/primary/brownian.py +++ b/pfhedge/instruments/primary/brownian.py @@ -137,7 +137,7 @@ def simulate( spot = generate_geometric_brownian( n_paths=n_paths, - n_steps=ceil(time_horizon / self.dt + 1), + n_steps=ceil(round(time_horizon / self.dt, 8) + 1), init_state=init_state, sigma=self.sigma, mu=self.mu, diff --git a/pfhedge/instruments/primary/cir.py b/pfhedge/instruments/primary/cir.py index 51560c78..2b2be8f6 100644 --- a/pfhedge/instruments/primary/cir.py +++ b/pfhedge/instruments/primary/cir.py @@ -106,7 +106,7 @@ def simulate( spot = generate_cir( n_paths=n_paths, - n_steps=ceil(time_horizon / self.dt + 1), + n_steps=ceil(round(time_horizon / self.dt, 8) + 1), init_state=init_state, kappa=self.kappa, theta=self.theta, diff --git a/pfhedge/instruments/primary/heston.py b/pfhedge/instruments/primary/heston.py index 56c77a92..f74b7258 100644 --- a/pfhedge/instruments/primary/heston.py +++ b/pfhedge/instruments/primary/heston.py @@ -129,7 +129,7 @@ def simulate( output = generate_heston( n_paths=n_paths, - n_steps=ceil(time_horizon / self.dt + 1), + n_steps=ceil(round(time_horizon / self.dt, 8) + 1), init_state=init_state, kappa=self.kappa, theta=self.theta, diff --git a/pfhedge/instruments/primary/kou_jump.py b/pfhedge/instruments/primary/kou_jump.py index 786bf605..f811e3c8 100644 --- a/pfhedge/instruments/primary/kou_jump.py +++ b/pfhedge/instruments/primary/kou_jump.py @@ -159,7 +159,7 @@ def simulate( spot = generate_kou_jump( n_paths=n_paths, - n_steps=ceil(time_horizon / self.dt + 1), + n_steps=ceil(round(time_horizon / self.dt, 8) + 1), init_state=init_state, sigma=self.sigma, mu=self.mu, diff --git a/pfhedge/instruments/primary/local_volatility.py b/pfhedge/instruments/primary/local_volatility.py index 4dfeebc7..25ed77de 100644 --- a/pfhedge/instruments/primary/local_volatility.py +++ b/pfhedge/instruments/primary/local_volatility.py @@ -123,7 +123,7 @@ def simulate( output = generate_local_volatility_process( n_paths=n_paths, - n_steps=ceil(time_horizon / self.dt + 1), + n_steps=ceil(round(time_horizon / self.dt, 8) + 1), sigma_fn=self.sigma_fn, init_state=init_state, dt=self.dt, diff --git a/pfhedge/instruments/primary/merton_jump.py b/pfhedge/instruments/primary/merton_jump.py index 3384c2ce..0dcdc685 100644 --- a/pfhedge/instruments/primary/merton_jump.py +++ b/pfhedge/instruments/primary/merton_jump.py @@ -150,7 +150,7 @@ def simulate( output = generate_merton_jump( n_paths=n_paths, - n_steps=ceil(time_horizon / self.dt + 1), + n_steps=ceil(round(time_horizon / self.dt, 8) + 1), init_state=init_state, sigma=self.sigma, mu=self.mu, diff --git a/pfhedge/instruments/primary/rough_bergomi.py b/pfhedge/instruments/primary/rough_bergomi.py index 631f76c7..ed54be88 100644 --- a/pfhedge/instruments/primary/rough_bergomi.py +++ b/pfhedge/instruments/primary/rough_bergomi.py @@ -129,7 +129,7 @@ def simulate( output = generate_rough_bergomi( n_paths=n_paths, - n_steps=ceil(time_horizon / self.dt + 1), + n_steps=ceil(round(time_horizon / self.dt, 8) + 1), init_state=init_state, alpha=self.alpha, rho=self.rho, diff --git a/pfhedge/instruments/primary/vasicek.py b/pfhedge/instruments/primary/vasicek.py index 4416f457..9bb2a15b 100644 --- a/pfhedge/instruments/primary/vasicek.py +++ b/pfhedge/instruments/primary/vasicek.py @@ -88,7 +88,7 @@ def simulate( spot = generate_vasicek( n_paths=n_paths, - n_steps=ceil(time_horizon / self.dt + 1), + n_steps=ceil(round(time_horizon / self.dt, 8) + 1), init_state=init_state, kappa=self.kappa, theta=self.theta,