from plot_utils import * from retrieve_data import * dataLoadStartDate = "2014-04-01" dataLoadEndDate = "2018-04-01" issue = "TLT" feature_dict = {} candle_ind = CandleIndicators() plotIt = PlotUtility() dSet = DataRetrieve() dataSet = dSet.read_issue_data(issue) dataSet = dSet.set_date_range(dataSet, dataLoadStartDate, dataLoadEndDate) days_to_plot = 4 for i in range(1, days_to_plot + 1): num_days = i dataSet = candle_ind.higher_close(dataSet, num_days) dataSet = candle_ind.lower_close(dataSet, num_days) startDate = "2015-02-01" endDate = "2015-03-30" plotDF = dataSet[startDate:endDate] plot_dict = {} plot_dict['Issue'] = issue plot_dict['Plot_Vars'] = list(feature_dict.keys()) plot_dict['Volume'] = 'Yes' plotIt.price_Ind_Vol_Plot(plot_dict, plotDF)
dataSet = taLibOS.triple_EMA(dataSet, 30) dataSet = taLibOS.triangMA(dataSet, 30) dataSet = taLibOS.weighted_MA(dataSet, 30) startDate = "2015-02-01" endDate = "2015-06-30" plotDF = dataSet[startDate:endDate] N = len(plotDF) ind = np.arange(N) # the evenly spaced plot indices plt.figure(figsize=(15, 8)) top = plt.subplot2grid((4, 4), (0, 0), rowspan=3, colspan=4) bottom = plt.subplot2grid((4, 4), (3, 0), rowspan=1, colspan=4) # top.plot(ind, plotDF['Pri']) # # bottom.bar(ind, plotDF['Volume']) top.plot(ind, plotDF['Close'], 'k-', markersize=3, label=issue) plot_list = list(feature_dict.keys()) cnt = len(plot_list) for n in range(7, cnt): print(n) top.plot(ind, plotDF[plot_list[n]]) bottom.bar(ind, plotDF['Volume'], label='Volume') plt.subplots_adjust(hspace=0.05) # set the labels top.axes.get_xaxis().set_visible(True) top.set_title('TLT') top.set_ylabel('Closing Price') bottom.set_ylabel('Volume') for ax in top, bottom: ax.label_outer() ax.legend(loc='upper left', frameon=True, fontsize=8)