Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- starting_value = 100.
- iterations = 100
- hedge_value = .7
- current_val = starting_value
- hedged_val = starting_value
- for x in range(iterations):
- gain_or_loss = np.random.uniform(-.1, .1)
- current_val = current_val + (current_val * gain_or_loss)
- hedged_val = hedged_val + (hedged_val * gain_or_loss * hedge_value)
- print 'Final values:'
- print 'Unhedged: \t%.4f' % current_val
- print 'Hedged: \t%.4f' % hedged_val
Advertisement
Add Comment
Please, Sign In to add comment