Module: Alpha¶
-
class
pyalpha.alpha.alpha.Alpha(stock_list, start_date, end_date)[source]¶ Abstract class to compute alphas
Methods:
- construct_historical_data(self) - verify_historical_data(self) - save_data(self, file_name) - load_data(self, file_name) - alpha(self, stock) - simulate(self)
-
alpha(stock)[source]¶ Abstract Method: Needs to be defined by the user - Sets the weight for each stock
- All parameters available in HistoricalStock can be used in here
- Returns a single decimal giving the weight of a stock
-
construct_historical_data()[source]¶ - Creates a data structure of historical stock data
- The data structure is a dictionary which maps the dates to a list of HistoricalStock instances, which contain the stock’s data on the given date for each stock in the stock list.
Stock lists are user defined. Stock lists for SNP100 and SNP500 available in stock_lists.py.
-
load_data(file_name='stock_data.pickle', file_directory='.')[source]¶ - Loads the stock_data from a pickle file
-