Beispiel #1
0
 def __init__(self, ticker: str, audit: bool):
     self.audit: bool = audit
     self.wb: Workbook = Workbook()
     self.ws1: worksheet = self.wb.active
     self.ws2: worksheet = self.wb.create_sheet("Free Cash Flows")
     self.ws3: worksheet = self.wb.create_sheet("Explanations")
     self.ws4: worksheet = self.wb.create_sheet("Ratios")
     self.ws1.title = "Financials"
     self.ticker: str = ticker
     self.now: str = datetime.now().strftime("%Y-%m-%d")
     self.letter: int = 0
     self.is_start: int = 4
     self.bs_start: int = 18
     self.cf_start: int = 47
     self.len_data: int = 0
     self.len_pred: int = 10
     self.years: List[str] = []
     self.rounding: int = 0
     self.df_bs: pd.DataFrame = self.get_data("BS", self.bs_start, False)
     self.df_is: pd.DataFrame = self.get_data("IS", self.is_start, True)
     self.df_cf: pd.DataFrame = self.get_data("CF", self.cf_start, False)
     self.info: pd.DataFrame = yf.Ticker(ticker).info
     self.t_bill: float = get_rf()
     self.r_ff: float = dcf_model.get_fama_coe(self.ticker)
     self.sisters: List[str] = dcf_model.others_in_sector(
         self.ticker, self.info["sector"], self.info["industry"]
     )
     self.sister_data: List[List[pd.DataFrame]] = [[pd.DataFrame()]]
Beispiel #2
0
    def __init__(
        self,
        ticker: str,
        audit: bool = False,
        ratios: bool = True,
        len_pred: int = 10,
        max_similars: int = 3,
        no_filter: bool = False,
    ):
        """
        Creates a detialed DCF for a given company

        Parameters
        ----------
        ticker : str
            The ticker to create a DCF for
        audit : bool
            Whether or not to show that the balance sheet and income statement tie-out
        ratios : bool
            Whether to show ratios for the company and for similar companies
        len_pred : int
            The number of years to make predictions for before assuming a terminal value
        max_similars : int
            The maximum number of similar companies to show, will be less if there are not enough similar companies
        no_filter : bool
            Disable filtering of similar companies to being in the same market cap category
        """
        self.info: Dict[str, Any] = {
            "len_data": 0,
            "len_pred": len_pred,
            "max_similars": max_similars,
            "rounding": 0,
            "ticker": ticker,
            "audit": audit,
            "ratios": ratios,
            "no_filter": no_filter,
        }
        self.letter: int = 0
        self.starts: Dict[str, int] = {"IS": 4, "BS": 18, "CF": 47}
        self.wb: Workbook = Workbook()
        self.ws: Dict[int, Any] = {
            1: self.wb.active,
            2: self.wb.create_sheet("Free Cash Flows"),
            3: self.wb.create_sheet("Explanations"),
        }
        self.df: Dict[str, pd.DataFrame] = {
            "BS": self.get_data("BS", self.starts["BS"], False),
            "IS": self.get_data("IS", self.starts["IS"], True),
            "CF": self.get_data("CF", self.starts["CF"], False),
        }
        self.data: Dict[str, Any] = {
            "now": datetime.now().strftime("%Y-%m-%d"),
            "info": yf.Ticker(ticker).info,
            "t_bill": get_rf(),
            "r_ff": dcf_model.get_fama_coe(self.info["ticker"]),
        }
def test_get_fama_coe():
    coef = dcf_model.get_fama_coe(ticker="TSLA")

    assert isinstance(coef, np.float64)