@@ -21,12 +21,10 @@ tickers_health = [ 'FIT' ]
2121tickers_solid = [ 'WMT' , 'KO' , 'G' , 'V' , 'BOE' , 'F' , 'GS' ]
2222
2323def merge_lists ():
24- # all_tickers = list(set(tickers_clothes)|set(tickers_air)|set(tickers_social)|set(tickers_factory)|set(tickers_online_retail)|set(tickers_pay)|set(tickers_it)|set(tickers_health))
25- all_tickers = tickers_solid
24+ all_tickers = list (set (tickers_clothes )| set (tickers_air )| set (tickers_social )| set (tickers_factory )| set (tickers_online_retail )| set (tickers_pay )| set (tickers_it )| set (tickers_health ))
25+ # all_tickers = tickers_solid
2626 return all_tickers
2727
28- ratios_dir = 'data/calculated_ratios/'
29-
3028DATE_FIELD = 'Date'
3129DATE_FORMAT = '%Y-%m-%d'
3230
@@ -43,12 +41,12 @@ def stock_prices_median(date, stock_prices_df, months_delta):
4341 # print 'median?', median
4442 return median
4543
46- def pe_calculations (stock_prices_dir , ratios_dir , tickers ):
44+ def pe_calculations (stock_prices_dir , input_ratios_dir , tickers ):
4745 for ticker in tickers :
4846 print 'Processing ticker:' ,ticker
4947 stock_price_filename_pre = conf_info .stock_prices_dir + conf_info .get_stock_prices_pre_2016_02_filename (ticker )
5048 stock_price_filename_post = conf_info .stock_prices_dir + conf_info .get_stock_prices_post_2016_02_filename (ticker )
51- eps_filename = ratios_dir + 'eps_' + ticker . upper () + '.csv'
49+ eps_filename = input_ratios_dir + conf_info . get_eps_filename ( ticker )
5250 try :
5351 # load the EPS data
5452 eps_df = pd .read_csv (eps_filename )
@@ -72,11 +70,11 @@ def pe_calculations(stock_prices_dir, ratios_dir, tickers):
7270
7371 # store the P/E median (last 2 months) dataframe
7472 # print pe_median_df
75- current_filename_with_path = ratios_dir + 'pe_median_' + ticker . upper () + '.csv'
73+ current_filename_with_path = input_ratios_dir + conf_info . get_pe_median_filename ( ticker )
7674 pe_median_df .to_csv (current_filename_with_path , index = False )
7775
7876 except Exception , e :
7977 print 'Failed to load something about ticker: ' + ticker + ' ~~~' , str (e )
8078
8179
82- pe_calculations (conf_info .stock_prices_dir ,ratios_dir ,merge_lists ())
80+ pe_calculations (conf_info .stock_prices_dir ,conf_info . ratios_dir ,merge_lists ())
0 commit comments