Guest User

Untitled

a guest
Jun 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #df = df['2018']
  2.  
  3. # volatility
  4. df['volatility'] = abs(df['open'] - df['close']) * 0.5
  5. #print(df)
  6.  
  7. # volatility breakout
  8. #df['breakout'] = np.where(df['high'] > (df['open'] + df['volatility'].shift(1)), 'buy', 'none')
  9. df['ER'] = np.where(df['high'] > (df['open'] + df['volatility'].shift(1)),
  10. (df['close'] / (df['open'] + df['volatility'].shift(1))), 1)
  11.  
  12. result = df['ER'].cumprod().iloc[-1]
  13. print("누적수익률: %.2f 배" % result)
Add Comment
Please, Sign In to add comment