def test_screener_overview(): from finvizfinance.screener.overview import Overview foverview = Overview() filters_dict = {'Exchange': 'AMEX', 'Sector': 'Basic Materials'} foverview.set_filter(filters_dict=filters_dict) df = foverview.ScreenerView() assert (df is not None) ticker = 'TSLA' foverview.set_filter(signal='', filters_dict={}, ticker=ticker) df = foverview.ScreenerView() assert (df is not None)
def partitionDays(self, mode='financial'): """Partition dataframe to separate dataframes according to the dates. Args: mode(str): choose an option of period(financial, overview, valuation, ownership, performance, technical). """ check_list = [ 'financial', 'overview', 'valuation', 'ownership', 'performance', 'technical' ] if mode not in check_list: print('Available mode: {}'.format(check_list)) raise ValueError() for earning_day in self.earning_days: if mode == 'financial': self.df_days[earning_day] = self.df[ self.df['Earnings'] == earning_day].reset_index(drop=True) else: self.df_days[earning_day] = self.df[ self.df['Earnings'] == earning_day]['Ticker'].to_list() fearnings = None if mode == 'financial': return self.df_days elif mode == 'overview': fearnings = Overview() elif mode == 'valuation': fearnings = Valuation() elif mode == 'ownership': fearnings = Ownership() elif mode == 'performance': fearnings = Performance() elif mode == 'technical': fearnings = Technical() filters_dict = {'Earnings Date': self.period} fearnings.set_filter(filters_dict=filters_dict) df2 = fearnings.ScreenerView(order='Earnings Date', verbose=0) df2_days = {} for earning_day in self.earning_days: tickers = self.df_days[earning_day] df2_days[earning_day] = df2[df2['Ticker'].isin( tickers)].reset_index(drop=True) self.df_days = df2_days return self.df_days
def test_group_overview(): from finvizfinance.group.overview import Overview fgoverview = Overview() df = fgoverview.ScreenerView(group='Industry') assert (df is not None)