def get_stocks_with_upcoming_earnings(
        self, num_days_from_now: int, only_sp500: bool
    ) -> pd.DataFrame:
        """
        Returns a pandas dataframe containing all stocks which are announcing earnings in upcoming days.

        Arguments:
         num_days_from_now: only returns stocks which announcing earnings from today's date to num_days_from_now.
         only_sp500: only returns sp500 stocks.

        """
        start_date = datetime.now().strftime("%Y-%m-%d")
        end_date = (datetime.now() + timedelta(num_days_from_now)).strftime("%Y-%m-%d")
        return earnings.get_upcoming_earnings(
            self._api_key,
            start_date=start_date,
            end_date=end_date,
            country="USD",
            only_sp500=only_sp500,
        )

        Returns a pandas dataframe containing all stocks which are announcing earnings in upcoming days.

        Arguments:
         num_days_from_now: only returns stocks which announcing earnings from today's date to num_days_from_now.
         only_sp500: only returns sp500 stocks.

        
llama-index-integrations/tools/llama-index-tools-finance/llama_index/tools/finance/base.py