Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulate Uncorrelated Paths with Separate Path Generator Instead of Multivariate Path Generator #172

Open
bowd opened this issue Jun 15, 2022 · 0 comments
Labels
tech-debt Technical debt that needs to be addressed

Comments

@bowd
Copy link
Contributor

bowd commented Jun 15, 2022

def generate_uncorrelated_paths(self):
            sequence_generator = UniformRandomSequenceGenerator(
                len(time_grid), UniformRandomGenerator())
            gaussian_sequence_generator = GaussianRandomSequenceGenerator(
                sequence_generator)
            maturity = time_grid[len(time_grid) - 1]
            path_generator = GaussianPathGenerator(
                process, maturity, len(time_grid), gaussian_sequence_generator, False)
            paths = np.zeros(shape=(number_of_paths, len(time_grid)))
            for path_index in range(number_of_paths):
                path = path_generator.next().value()
                paths[path_index, :] = np.array(
                    [path[j] for j in range(len(time_grid))])

        log_returns = np.diff(np.log(paths[0]))
        # the current setup does only support simulation of processes with independent
        # increments or processes without if the value is not changed in other sub-steps
        increments = {}
        for asset, path in list(zip(self.processes, log_returns)):
            increments[asset] = path

        return increments

    def switcher(self, params):
        if (np.array(params['correlation']) -
            np.diag(np.ones(len(params['correlation'])))
                == np.zeros(np.array(params['correlation']).shape)).all():
            process = self.process_container(params=params)
        else:
            process = None
        return process
@bowd bowd added this to Engineering Jun 15, 2022
@bowd bowd moved this to 🧊 Icebox in Engineering Jun 16, 2022
@bowd bowd added the tech-debt Technical debt that needs to be addressed label Jun 16, 2022
@bowd bowd removed this from Engineering Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-debt Technical debt that needs to be addressed
Projects
None yet
Development

No branches or pull requests

1 participant