def setup_db_for_hist_prices_storage(self, stock_sym_list): """ Get the price and dividend history and store them to the database for the specified stock sym list. The length of time depends on the date_interval specified. Connection to database is assuemd to be set. For one time large dataset (where the hist data is very large) Args: stock_sym_list (list): list of stock symbol. """ ## set the class for extraction histdata_extract = YFHistDataExtr() histdata_extract.set_interval_to_retrieve(360*5)# assume for 5 years information histdata_extract.enable_save_raw_file = 0 for sub_list in self.break_list_to_sub_list(stock_sym_list): print ('processing sub list', sub_list) histdata_extract.set_multiple_stock_list(sub_list) histdata_extract.get_hist_data_of_all_target_stocks() histdata_extract.removed_zero_vol_fr_dataset() ## save to one particular funciton #save to sql -- hist table histdata_extract.processed_data_df.to_sql(self.hist_data_tablename, self.con, flavor='sqlite', schema=None, if_exists='append', index=True, index_label=None, chunksize=None, dtype=None) #save to sql -- div table histdata_extract.all_stock_div_hist_df.to_sql(self.divdnt_data_tablename, self.con, flavor='sqlite', schema=None, if_exists='append', index=True, index_label=None, chunksize=None, dtype=None) self.close_db()
def retrieve_hist_data_fr_web(self): """ Retrieve the hist data from web using yahoo_finance_historical_data_extract module. Set to self.raw_all_stock_df """ self.histdata_ext = YFHistDataExtr() self.histdata_ext.set_interval_to_retrieve(200) self.set_stocklist(self.stocklist) self.histdata_ext.get_hist_data_of_all_target_stocks() self.raw_all_stock_df = self.histdata_ext.all_stock_df
def setup_db_for_hist_prices_storage(self,stock_sym_list,interval): #get price history histdata_extract = YFHistDataExtr() histdata_extract.set_interval_to_retrieve(360*interval) histdata_extract.enable_save_raw_file=0 for sub_list in self.break_list_to_sub_list(stock_sym_list): print ('processing sub list', sub_list) histdata_extract.set_multiple_stock_list(sub_list) histdata_extract.get_hist_data_of_all_target_stocks() histdata_extract.removed_zero_vol_fr_dataset() # save to SQL table histdata_extract.processed_data_df.to_sql(self.hist_data_tablename, self.con, flavor='sqlite', schema=None, if_exists='append', index=True, index_label=None, chunksize=None, dtype=None) self.close_db()
def calculate_bands(ticker_symbol): # Delete the old bands image for this picture os.system("rm ./static/pictures/%s.png" % ticker_symbol) data_ext = YFHistDataExtr() data_ext.set_interval_to_retrieve(400) #in days data_ext.set_multiple_stock_list([str(ticker_symbol)]) data_ext.get_hist_data_of_all_target_stocks() # convert the date column to date object data_ext.all_stock_df['Date'] = pandas.to_datetime( data_ext.all_stock_df['Date']) temp_data_set = data_ext.all_stock_df.sort( 'Date', ascending=True) #sort to calculate the rolling mean temp_data_set['20d_ma'] = pandas.rolling_mean(temp_data_set['Adj Close'], window=5) temp_data_set['50d_ma'] = pandas.rolling_mean(temp_data_set['Adj Close'], window=50) temp_data_set['Bol_upper'] = pandas.rolling_mean( temp_data_set['Adj Close'], window=80) + 2 * pandas.rolling_std( temp_data_set['Adj Close'], 80, min_periods=80) temp_data_set['Bol_lower'] = pandas.rolling_mean( temp_data_set['Adj Close'], window=80) - 2 * pandas.rolling_std( temp_data_set['Adj Close'], 80, min_periods=80) temp_data_set['Bol_BW'] = ( (temp_data_set['Bol_upper'] - temp_data_set['Bol_lower']) / temp_data_set['20d_ma']) * 100 temp_data_set['Bol_BW_200MA'] = pandas.rolling_mean( temp_data_set['Bol_BW'], window=50) #cant get the 200 daa temp_data_set['Bol_BW_200MA'] = temp_data_set['Bol_BW_200MA'].fillna( method='backfill') ##?? ,may not be good temp_data_set['20d_exma'] = pandas.ewma(temp_data_set['Adj Close'], span=20) temp_data_set['50d_exma'] = pandas.ewma(temp_data_set['Adj Close'], span=50) data_ext.all_stock_df = temp_data_set.sort( 'Date', ascending=False) #revese back to original data_ext.all_stock_df.plot( x='Date', y=['Adj Close', '20d_ma', '50d_ma', 'Bol_upper', 'Bol_lower']) #data_ext.all_stock_df.plot(x='Date', y=['Bol_BW','Bol_BW_200MA' ]) plt.savefig('./static/pictures/%s.png' % ticker_symbol) return temp_data_set['Adj Close'], temp_data_set[ 'Bol_lower'], temp_data_set['20d_ma']
print "Basic Filtering of stock data." ss = InfoBasicFilter(r'c:\data\temp\temp_stockdata.csv') ss.set_criteria_type('basic') ss.get_all_criteria_fr_file() ss.process_criteria() print "stocks left after basic filtering: ", len(ss.modified_df) ss.modified_df.to_csv(final_store_filename, index = False) print "Basic Filtering of stock data -- Done. \n" if 'c_backup' in partial_run: ## testing, to remove after this #ss.modified_df = ss.modified_df.head() ## 3 days trends data print "Getting Trends data" trend_ext = YFHistDataExtr() trend_ext.set_interval_to_retrieve(365*5) trend_ext.enable_save_raw_file = 0 trend_ext.set_multiple_stock_list(list(ss.modified_df['SYMBOL'])) trend_ext.run_all_hist_data() full_stock_data_df = pandas.merge(ss.modified_df, trend_ext.all_stock_combined_post_data_df, on = 'SYMBOL', how ='left') print "Getting Trends data -- Done. \n" #full_stock_data_df.to_csv(r'c:\data\full_oct21.csv', index = False) if 'c_pre' in partial_run: """ Update the database """ print 'Updating the database with latest hist price.' datastore = FinanceDataStore(db_full_path) stock_list = list(ss.modified_df['SYMBOL']) datastore.scan_and_input_recent_prices(stock_list,5)
def setup_db_for_hist_prices_storage(self, stock_sym_list): """ Get the price and dividend history and store them to the database for the specified stock sym list. The length of time depends on the date_interval specified. Connection to database is assuemd to be set. For one time large dataset (where the hist data is very large) Args: stock_sym_list (list): list of stock symbol. """ ## set the class for extraction histdata_extr = YFHistDataExtr() histdata_extr.set_interval_to_retrieve(360*5)# assume for 5 years information histdata_extr.enable_save_raw_file = 0 for sub_list in self.break_list_to_sub_list(stock_sym_list): ## re -initalize the df histdata_extr.all_stock_df = pandas.DataFrame() histdata_extr.processed_data_df = pandas.DataFrame() histdata_extr.all_stock_div_hist_df = pandas.DataFrame() print 'processing sub list', sub_list histdata_extr.set_multiple_stock_list(sub_list) histdata_extr.get_hist_data_of_all_target_stocks() histdata_extr.removed_zero_vol_fr_dataset() ## save to one particular funciton #save to sql -- hist table histdata_extr.processed_data_df.to_sql(self.hist_data_tablename, self.con, flavor='sqlite', schema=None, if_exists='append', index=True, index_label=None, chunksize=None, dtype=None) #save to sql -- div table histdata_extr.all_stock_div_hist_df.to_sql(self.divdnt_data_tablename, self.con, flavor='sqlite', schema=None, if_exists='append', index=True, index_label=None, chunksize=None, dtype=None) self.close_db()
def setup_db_for_hist_prices_storage(self, stock_sym_list, interval): #get price history histdata_extract = YFHistDataExtr() histdata_extract.set_interval_to_retrieve(360 * interval) histdata_extract.enable_save_raw_file = 0 for sub_list in self.break_list_to_sub_list(stock_sym_list): print('processing sub list', sub_list) histdata_extract.set_multiple_stock_list(sub_list) histdata_extract.get_hist_data_of_all_target_stocks() histdata_extract.removed_zero_vol_fr_dataset() # save to SQL table histdata_extract.processed_data_df.to_sql(self.hist_data_tablename, self.con, flavor='sqlite', schema=None, if_exists='append', index=True, index_label=None, chunksize=None, dtype=None) self.close_db()
class TechAnalysisAdd(object): def __init__(self, stocklist): """ Intialize hist data extr. Set the stocklist and get all hist data. Args: stocklist (list): list of stock symbol. For Singapore stocks, best to include the .SI """ ## stocklist self.stocklist = stocklist ## user parameters self.get_fr_database = 0 # 1 will pull data from database, 0 will get directly get from web. self.database_path = r'C:\data\stock_sql_db\stock_hist.db' ## Save parameters. self.raw_all_stock_df = pandas.DataFrame() self.histdata_indiv_stock = object() # for single stock handling. self.histdata_combined = pandas.DataFrame() self.processed_histdata_combined = object() def set_stocklist(self, stocklist): """ Method to set the stocklist for raw data pulling. Set to self.histdata_ext. Args: stocklist (list): list of stock symbol. For Singapore stocks, best to include the .SI """ self.histdata_ext.set_multiple_stock_list(stocklist) def enable_pull_fr_database(self): """ Set the self.get_fr_database parameter so it will pull from database. set to self.get_fr_database. """ self.get_fr_database = 1 def retrieve_hist_data(self): """ Retrieve all the hist data. """ if not self.get_fr_database: self.retrieve_hist_data_fr_web() else: self.retrieve_hist_data_fr_database() self.raw_all_stock_df['Date'] = pandas.to_datetime( self.raw_all_stock_df['Date']) def retrieve_hist_data_fr_database(self): """ Retrieve the hist data from web using yahoo_finance_historical_data_extract module. Set to self.raw_all_stock_df """ c = FinanceDataStore(self.database_path) c.retrieve_hist_data_fr_db(self.stocklist, 0) c.extr_hist_price_by_date(200) self.raw_all_stock_df = c.hist_price_df def retrieve_hist_data_fr_web(self): """ Retrieve the hist data from web using yahoo_finance_historical_data_extract module. Set to self.raw_all_stock_df """ self.histdata_ext = YFHistDataExtr() self.histdata_ext.set_interval_to_retrieve(200) self.set_stocklist(self.stocklist) self.histdata_ext.get_hist_data_of_all_target_stocks() self.raw_all_stock_df = self.histdata_ext.all_stock_df def add_Bollinger_parm(self): """ Add the list of Bolinger Parm. Set to self.histdata_indiv_stock. """ temp_data_set = self.histdata_indiv_stock.sort( 'Date', ascending=True) #sort to calculate the rolling mean temp_data_set['20d_ma'] = pandas.rolling_mean( temp_data_set['Adj Close'], window=20) temp_data_set['50d_ma'] = pandas.rolling_mean( temp_data_set['Adj Close'], window=50) temp_data_set['Bol_upper'] = pandas.rolling_mean( temp_data_set['Adj Close'], window=20) + 2 * pandas.rolling_std( temp_data_set['Adj Close'], 20, min_periods=20) temp_data_set['Bol_lower'] = pandas.rolling_mean( temp_data_set['Adj Close'], window=20) - 2 * pandas.rolling_std( temp_data_set['Adj Close'], 20, min_periods=20) temp_data_set['Bol_BW'] = ( (temp_data_set['Bol_upper'] - temp_data_set['Bol_lower']) / temp_data_set['20d_ma']) * 100 temp_data_set['Bol_BW_200MA'] = pandas.rolling_mean( temp_data_set['Bol_BW'], window=50) #cant get the 200 daa temp_data_set['Bol_BW_200MA'] = temp_data_set['Bol_BW_200MA'].fillna( method='backfill') ##?? ,may not be good temp_data_set['20d_exma'] = pandas.ewma(temp_data_set['Adj Close'], span=20) temp_data_set['50d_exma'] = pandas.ewma(temp_data_set['Adj Close'], span=50) self.histdata_indiv_stock = temp_data_set.sort( 'Date', ascending=False) #revese back to original def add_MACD_parm(self): """ Include the MACD parm. """ temp_data_set = self.histdata_indiv_stock.sort('Date', ascending=True) temp_data_set['12d_exma'] = pandas.ewma(temp_data_set['Adj Close'], span=12) temp_data_set['26d_exma'] = pandas.ewma(temp_data_set['Adj Close'], span=26) temp_data_set['MACD'] = temp_data_set['12d_exma'] - temp_data_set[ '26d_exma'] #12-26 temp_data_set['MACD_signalline'] = pandas.rolling_mean( temp_data_set['MACD'], window=9) temp_data_set['MACD_hist'] = temp_data_set['MACD'] - temp_data_set[ 'MACD_signalline'] self.histdata_indiv_stock = temp_data_set.sort( 'Date', ascending=False) #revese back to original def add_pivot_point(self): """ Getting the pivot pt based on the last entry. Same operation as other add function. Cater for one stock at a time. Assume the first entry is the latest date. The returning will be the self.histdata_indiv_stock with the addional parameter """ temp = self.histdata_indiv_stock.head(2)[1:2] try: pivot_value = list( (temp['High'] + temp['Low'] + temp['Adj Close']) / 3)[0] R1_value = (pivot_value * 2) - list(temp['Low'])[0] S1_value = (pivot_value * 2) - list(temp['High'])[0] except: pivot_value = 0 R1_value = 0 S1_value = 0 self.histdata_indiv_stock['Pivot'] = pivot_value self.histdata_indiv_stock['S1'] = S1_value self.histdata_indiv_stock['R1'] = R1_value def add_average_vol(self): """ Getting the average volume over 200 days. """ temp_group = self.histdata_indiv_stock.groupby('SYMBOL') try: avg_volume = temp_group['Volume'].agg('mean').values[0] except: avg_volume = 0 self.histdata_indiv_stock['Avg_volume_200d'] = avg_volume self.histdata_indiv_stock['Avg_volume_above30per'] = ( self.histdata_indiv_stock['Volume'] > 1.3 * avg_volume) self.histdata_indiv_stock['Avg_volume_above70per'] = ( self.histdata_indiv_stock['Volume'] > 1.7 * avg_volume) def add_analysis_parm(self): """ Add all the different analysis data to the data set. """ self.histdata_combined = pandas.DataFrame() for symbol in self.stocklist: self.histdata_indiv_stock = self.raw_all_stock_df[ self.raw_all_stock_df['SYMBOL'] == symbol] self.add_Bollinger_parm() self.add_MACD_parm() self.add_pivot_point() self.add_average_vol() if len(self.histdata_combined) == 0: self.histdata_combined = self.histdata_indiv_stock else: self.histdata_combined = self.histdata_combined.append( self.histdata_indiv_stock) def bollinger_plots(self): """ Plot the bollinger plots for each stocks. Used self.histdata_indiv_stock for data passing. Pivot is added to here """ self.histdata_indiv_stock.plot(x='Date', y=[ 'Adj Close', '20d_ma', '50d_ma', 'Bol_upper', 'Bol_lower', 'Pivot', 'S1', 'R1' ]) self.histdata_indiv_stock.plot(x='Date', y=['Bol_BW', 'Bol_BW_200MA']) plt.show() def MACD_plots(self): """ Plot the MACD plots for each stocks. Used self.histdata_indiv_stock for data passing. """ self.histdata_indiv_stock.plot(x='Date', y=['MACD', 'MACD_signalline'], ylim=[-0.3, 0.3]) #self.histdata_indiv_stock.plot(x='Date', y=['MACD_hist' ],kind='bar')#problem with this plot plt.show() def analysis_plot_for_tgt_sym(self, symbol): """ Get all analysis plot for target symbol. For each symbol, set to self.histdata_indiv_stock Args: symbol (str): stock symbol. Type of plots to include """ self.histdata_indiv_stock = self.histdata_combined[ self.histdata_combined['SYMBOL'] == symbol] self.bollinger_plots() self.MACD_plots() def get_most_current_dataset(self): """ Get the first (or most current) data for every stock. Additional parm --> cross the bollinger band cross the 50 days ex moving avg Bol width - Bol 200 (percentage) MACD hist (percentage) """ self.processed_histdata_combined = self.histdata_combined.groupby( "SYMBOL").first().reset_index() def add_response_trigger(self): """ Add series of basic trigger point for basic technical analysis. """ tar_data = self.processed_histdata_combined tar_data[ 'Above_Boll_upper'] = tar_data['Adj Close'] > tar_data['Bol_upper'] tar_data[ 'Below_Boll_lower'] = tar_data['Bol_lower'] > tar_data['Adj Close'] tar_data['price_above_50dexm'] = tar_data['Adj Close'] > tar_data[ '50d_exma'] tar_data['20dexm_above_50dexm'] = tar_data['20d_exma'] > tar_data[ '50d_exma'] self.processed_histdata_combined = tar_data def display_avaliable_info_GUI(self): """ For plot display in GUI. """ stock_choice = self.histdata_combined['SYMBOL'].drop_duplicates( ).tolist() while True: choice = easygui.choicebox(choices=stock_choice) if choice == None: return else: self.analysis_plot_for_tgt_sym(choice)
class TechAnalysisAdd(object): def __init__(self,stocklist): """ Intialize hist data extr. Set the stocklist and get all hist data. Args: stocklist (list): list of stock symbol. For Singapore stocks, best to include the .SI """ ## stocklist self.stocklist = stocklist ## user parameters self.get_fr_database = 0 # 1 will pull data from database, 0 will get directly get from web. self.database_path = r'C:\data\stock_sql_db\stock_hist.db' ## Save parameters. self.raw_all_stock_df = pandas.DataFrame() self.histdata_indiv_stock = object() # for single stock handling. self.histdata_combined = pandas.DataFrame() self.processed_histdata_combined = object() def set_stocklist(self, stocklist): """ Method to set the stocklist for raw data pulling. Set to self.histdata_ext. Args: stocklist (list): list of stock symbol. For Singapore stocks, best to include the .SI """ self.histdata_ext.set_multiple_stock_list(stocklist) def enable_pull_fr_database(self): """ Set the self.get_fr_database parameter so it will pull from database. set to self.get_fr_database. """ self.get_fr_database = 1 def retrieve_hist_data(self): """ Retrieve all the hist data. """ if not self.get_fr_database: self.retrieve_hist_data_fr_web() else: self.retrieve_hist_data_fr_database() self.raw_all_stock_df['Date'] = pandas.to_datetime( self.raw_all_stock_df['Date']) def retrieve_hist_data_fr_database(self): """ Retrieve the hist data from web using yahoo_finance_historical_data_extract module. Set to self.raw_all_stock_df """ c = FinanceDataStore(self.database_path) c.retrieve_hist_data_fr_db(self.stocklist,0) c.extr_hist_price_by_date(200) self.raw_all_stock_df = c.hist_price_df def retrieve_hist_data_fr_web(self): """ Retrieve the hist data from web using yahoo_finance_historical_data_extract module. Set to self.raw_all_stock_df """ self.histdata_ext = YFHistDataExtr() self.histdata_ext.set_interval_to_retrieve(200) self.set_stocklist(self.stocklist) self.histdata_ext.get_hist_data_of_all_target_stocks() self.raw_all_stock_df = self.histdata_ext.all_stock_df def add_Bollinger_parm(self): """ Add the list of Bolinger Parm. Set to self.histdata_indiv_stock. """ temp_data_set = self.histdata_indiv_stock.sort('Date',ascending = True ) #sort to calculate the rolling mean temp_data_set['20d_ma'] = pandas.rolling_mean(temp_data_set['Adj Close'], window=20) temp_data_set['50d_ma'] = pandas.rolling_mean(temp_data_set['Adj Close'], window=50) temp_data_set['Bol_upper'] = pandas.rolling_mean(temp_data_set['Adj Close'], window=20) + 2* pandas.rolling_std(temp_data_set['Adj Close'], 20, min_periods=20) temp_data_set['Bol_lower'] = pandas.rolling_mean(temp_data_set['Adj Close'], window=20) - 2* pandas.rolling_std(temp_data_set['Adj Close'], 20, min_periods=20) temp_data_set['Bol_BW'] = ((temp_data_set['Bol_upper'] - temp_data_set['Bol_lower'])/temp_data_set['20d_ma'])*100 temp_data_set['Bol_BW_200MA'] = pandas.rolling_mean(temp_data_set['Bol_BW'], window=50)#cant get the 200 daa temp_data_set['Bol_BW_200MA'] = temp_data_set['Bol_BW_200MA'].fillna(method='backfill')##?? ,may not be good temp_data_set['20d_exma'] = pandas.ewma(temp_data_set['Adj Close'], span=20) temp_data_set['50d_exma'] = pandas.ewma(temp_data_set['Adj Close'], span=50) self.histdata_indiv_stock = temp_data_set.sort('Date',ascending = False ) #revese back to original def add_MACD_parm(self): """ Include the MACD parm. """ temp_data_set = self.histdata_indiv_stock.sort('Date',ascending = True ) temp_data_set['12d_exma'] = pandas.ewma(temp_data_set['Adj Close'], span=12) temp_data_set['26d_exma'] = pandas.ewma(temp_data_set['Adj Close'], span=26) temp_data_set['MACD'] = temp_data_set['12d_exma'] - temp_data_set['26d_exma'] #12-26 temp_data_set['MACD_signalline'] = pandas.rolling_mean(temp_data_set['MACD'], window=9) temp_data_set['MACD_hist'] = temp_data_set['MACD'] - temp_data_set['MACD_signalline'] self.histdata_indiv_stock = temp_data_set.sort('Date',ascending = False ) #revese back to original def add_pivot_point(self): """ Getting the pivot pt based on the last entry. Same operation as other add function. Cater for one stock at a time. Assume the first entry is the latest date. The returning will be the self.histdata_indiv_stock with the addional parameter """ temp = self.histdata_indiv_stock.head(2)[1:2] try: pivot_value = list((temp['High'] + temp['Low'] + temp['Adj Close'])/3)[0] R1_value = (pivot_value*2) - list(temp['Low'])[0] S1_value = (pivot_value*2) - list(temp['High'])[0] except: pivot_value = 0 R1_value = 0 S1_value = 0 self.histdata_indiv_stock['Pivot'] = pivot_value self.histdata_indiv_stock['S1'] = S1_value self.histdata_indiv_stock['R1'] = R1_value def add_average_vol(self): """ Getting the average volume over 200 days. """ temp_group = self.histdata_indiv_stock.groupby('SYMBOL') try: avg_volume = temp_group['Volume'].agg('mean').values[0] except: avg_volume = 0 self.histdata_indiv_stock['Avg_volume_200d'] = avg_volume self.histdata_indiv_stock['Avg_volume_above30per'] = (self.histdata_indiv_stock['Volume']> 1.3*avg_volume) self.histdata_indiv_stock['Avg_volume_above70per'] = (self.histdata_indiv_stock['Volume']> 1.7*avg_volume) def add_analysis_parm(self): """ Add all the different analysis data to the data set. """ self.histdata_combined = pandas.DataFrame() for symbol in self.stocklist: self.histdata_indiv_stock = self.raw_all_stock_df[self.raw_all_stock_df['SYMBOL']== symbol] self.add_Bollinger_parm() self.add_MACD_parm() self.add_pivot_point() self.add_average_vol() if len(self.histdata_combined) == 0: self.histdata_combined = self.histdata_indiv_stock else: self.histdata_combined = self.histdata_combined.append(self.histdata_indiv_stock) def bollinger_plots(self): """ Plot the bollinger plots for each stocks. Used self.histdata_indiv_stock for data passing. Pivot is added to here """ self.histdata_indiv_stock.plot(x='Date', y=['Adj Close','20d_ma','50d_ma','Bol_upper','Bol_lower','Pivot','S1','R1' ]) self.histdata_indiv_stock.plot(x='Date', y=['Bol_BW','Bol_BW_200MA' ]) plt.show() def MACD_plots(self): """ Plot the MACD plots for each stocks. Used self.histdata_indiv_stock for data passing. """ self.histdata_indiv_stock.plot(x='Date', y=['MACD','MACD_signalline' ],ylim=[-0.3,0.3]) #self.histdata_indiv_stock.plot(x='Date', y=['MACD_hist' ],kind='bar')#problem with this plot plt.show() def analysis_plot_for_tgt_sym(self, symbol): """ Get all analysis plot for target symbol. For each symbol, set to self.histdata_indiv_stock Args: symbol (str): stock symbol. Type of plots to include """ self.histdata_indiv_stock = self.histdata_combined[self.histdata_combined['SYMBOL'] == symbol] self.bollinger_plots() self.MACD_plots() def get_most_current_dataset(self): """ Get the first (or most current) data for every stock. Additional parm --> cross the bollinger band cross the 50 days ex moving avg Bol width - Bol 200 (percentage) MACD hist (percentage) """ self.processed_histdata_combined = self.histdata_combined.groupby("SYMBOL").first().reset_index() def add_response_trigger(self): """ Add series of basic trigger point for basic technical analysis. """ tar_data = self.processed_histdata_combined tar_data['Above_Boll_upper'] = tar_data['Adj Close'] > tar_data['Bol_upper'] tar_data['Below_Boll_lower'] = tar_data['Bol_lower'] > tar_data['Adj Close'] tar_data['price_above_50dexm'] = tar_data['Adj Close'] > tar_data['50d_exma'] tar_data['20dexm_above_50dexm'] = tar_data['20d_exma'] > tar_data['50d_exma'] self.processed_histdata_combined = tar_data def display_avaliable_info_GUI(self): """ For plot display in GUI. """ stock_choice = self.histdata_combined['SYMBOL'].drop_duplicates().tolist() while True: choice = easygui.choicebox(choices = stock_choice) if choice == None: return else: self.analysis_plot_for_tgt_sym(choice)