def test_screener_overview(): foverview = Overview() filters_dict = {'Exchange': 'AMEX', 'Sector': 'Basic Materials'} foverview.set_filter(filters_dict=filters_dict) df = foverview.screener_view() assert (df is not None) ticker = 'TSLA' foverview.set_filter(signal='', filters_dict={}, ticker=ticker) df = foverview.screener_view() assert (df is not None)
def partition_days(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: raise ValueError("Invalid mode '{}'. Available mode: {}".format( mode, check_list)) 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.screener_view(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