def generate_paths(self, fixed_seed=False, day_count=365.0):
        if self.time_grid is None:
            self.generate_time_grid()
        M = len(self.time_grid)
        I = self.paths
        paths = np.zeros((M, I))
        paths[0] = self.initial_value
        if self.correlated is False:
            sn1 = sn_random_numbers((1, M, I), fixed_seed=fixed_seed)
        else:
            sn1 = self.random_numbers

        # standard normally distributed pseudorandom numbers for the jump component
        sn2 = sn_random_numbers((1, M, I), fixed_seed=fixed_seed)

        rj = self.lamb * (np.exp(self.mu + 0.5 * self.delt ** 2) - 1)
        short_rate = self.discount_curve.short_rate

        for t in range(1, len(self.time_grid)):
            if self.correlated is False:
                ran = sn1[t]
            else:
                ran = np.dot(self.cholesky_matrix, sn1[:, t, :])
                ran = ran[self.rn_set]
            dt = (self.time_grid[t] - self.time_grid[t - 1]).days / day_count
            poi = np.random.poisson(self.lamb * dt, I)
            paths[t] = paths[t - 1] * (np.exp((short_rate - rj
                                               - 0.5 * self.volatility ** 2) * dt
                                              + self.volatility * np.sqrt(dt) * ran)
                                       + (np.exp(self.mu + self.delt * sn2[t]) - 1) * poi)
        self.instrument_values = paths
 def generate_paths(self, fixed_seed=False, day_count=365.0):
     if self.time_grid is None:
         self.generate_time_grid()
     # number of dates for time grid
     M = len(self.time_grid)
     I = self.paths
     paths = np.zeros((M, I))
     paths[0] = self.initial_value
     if not self.correlated:
         rand = sn_random_numbers((1, M, I), fixed_seed=fixed_seed)
     else:
         rand = self.random_numbers
     short_rate = self.discount_curve.short_rate
     for t in range(1, len(self.time_grid)):
         if not self.correlated:
             ran = rand[t]
         else:
             ran = np.dot(self.cholesky_matrix, rand[:, t, :])
             ran = ran[self.rn_set]
         dt = (self.time_grid[t] - self.time_grid[t - 1]).days / day_count
         paths[t] = paths[t - 1] * np.exp((short_rate - 0.5
                                           * self.volatility ** 2) * dt
                                          + self.volatility * np.sqrt(dt) * ran)
     self.instrument_values = paths