def test_tables(): ibm = Stock("GM") assert ibm.chart_table().empty == False assert ibm.dividends_table().empty == False assert ibm.effective_spread_table().empty == False assert ibm.financials_table().empty == False assert ibm.volume_by_venue_table().empty == False
def get_chart(self, ref_symbol, ref_range='1m'): """ Get charts from IEX @params: ref_symbol - Required : symbol (Str) ref_range - Optional : date range (Str) """ stock = Stock(ref_symbol) chart = stock.chart_table(ref_range, chartByDay=True, chartCloseOnly=True, token=IEX_TOKEN) print(chart) #Remove unnecesary data chart.drop([ "volume", "change", "changePercent", "changeOverTime", "high", "label", "low", "open", "uClose", "uHigh", "uLow", "uOpen", "uVolume" ], axis=1, errors='ignore', inplace=True) #Add symbol name column if not chart.empty: chart_len = len(chart.index) chart_arr = [ref_symbol] * chart_len chart.insert(loc=0, column='symbol', value=chart_arr) #Reorder dataframe chart = self.set_column_sequence(chart, ["symbol", "date"]) return chart