Skip to content

Instantly share code, notes, and snippets.

@andreachello
Created May 17, 2022 01:33
Show Gist options
  • Save andreachello/33d70f4091832f6b09e505dcf10c129f to your computer and use it in GitHub Desktop.
Save andreachello/33d70f4091832f6b09e505dcf10c129f to your computer and use it in GitHub Desktop.
np.random.seed(0)
num_simulations = 1000
# the number of steps represent the times we simulate the process, with each step comprising
# 1000*i steps so we get simulations from 1000 to 50000
num_steps = 50
num_of_months = 13
# terminal price is an array of size 13 to account for the 12 months plus initial value
# it is timed by the number of steps
term_val = [[None]*num_of_months]*num_steps
# initialise the monte carlo value, estimates and std as empty array of size number of steps
mbarrier_val = [None]*num_steps
mbarrier_estimates = [None]*num_steps
mbarrier_std = [None]*num_steps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment