Course Name: Volatility Trading Strategies for Beginners, Section No: 22, Unit No: 3, Unit type: Exercise
Dear Support,
Regarding this exercise, where can i get this file: high_beta_stocks.csv? Thanks
Course Name: Volatility Trading Strategies for Beginners, Section No: 22, Unit No: 3, Unit type: Exercise
Dear Support,
Regarding this exercise, where can i get this file: high_beta_stocks.csv? Thanks
Hello,
The high_beta_stocks.csv can be created by using the notebook titled “BAB Backtesting - I” (Section 22, Unit 1) and saving the dataframe ‘long_assets’ into a csv file as it contains the list of the top 20 high-beta stocks.
Hope this helps.
import pandas as pd
data = pd.read_csv(‘…/data_modules/S&P500_stock_prices_2015_2016.csv’, index_col = 0)
data.index = pd.to_datetime(data.index)
high_beta_stocks = pd.read_csv(‘…/data_modules/high_beta_stocks.csv’, index_col = 0)[‘0’]
prices = data.loc[‘2016’, high_beta_stocks]
strategy_returns = prices.pct_change()
As seen from above code, we are supposed to get prices from high_beta_stocks.csv file. However upon checking, there are no price data in both high_beta_stocks.csv and long_assets.csv files. Can you please check the code that generates high_beta_stocks? Because it should have ranked the stocks in a descending beta order and contain prices as well?