Guest User

Untitled

a guest
Feb 11th, 2017
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. import numpy as np
  2.  
  3. starting_value = 100.
  4. iterations = 100
  5. hedge_value = .7
  6.  
  7. current_val = starting_value
  8. hedged_val = starting_value
  9. for x in range(iterations):
  10.     gain_or_loss = np.random.uniform(-.1, .1)
  11.     current_val = current_val + (current_val * gain_or_loss)
  12.     hedged_val = hedged_val + (hedged_val * gain_or_loss * hedge_value)
  13.  
  14. print 'Final values:'
  15. print 'Unhedged: \t%.4f' % current_val
  16. print 'Hedged: \t%.4f' % hedged_val
Advertisement
Add Comment
Please, Sign In to add comment