Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #df = df['2018']
- # volatility
- df['volatility'] = abs(df['open'] - df['close']) * 0.5
- #print(df)
- # volatility breakout
- #df['breakout'] = np.where(df['high'] > (df['open'] + df['volatility'].shift(1)), 'buy', 'none')
- df['ER'] = np.where(df['high'] > (df['open'] + df['volatility'].shift(1)),
- (df['close'] / (df['open'] + df['volatility'].shift(1))), 1)
- result = df['ER'].cumprod().iloc[-1]
- print("누적수익률: %.2f 배" % result)
Add Comment
Please, Sign In to add comment