Example #1
0
def capm_view(ticker: str) -> None:
    """Displays information for the CAPM model.

    Parameters
    ----------
    ticker : str
        Selected ticker
    """
    beta, sy = capm_information(ticker)
    console.print(f"Beta:\t\t\t{beta:.2f}")
    console.print(f"Systematic Risk:\t{sy*100:.2f}%")
    console.print(f"Unsystematic Risk:\t{(1-sy)*100:.2f}%\n")
Example #2
0
def test_capm_information(mocker, recorder):
    # FORCE SINGLE THREADING
    yf_download = factors_model.yf.download

    def mock_yf_download(*args, **kwargs):
        kwargs["threads"] = False
        return yf_download(*args, **kwargs)

    mocker.patch("yfinance.download", side_effect=mock_yf_download)

    result_tuple = factors_model.capm_information(ticker="PM")
    recorder.capture(result_tuple)
def capm_view(ticker):
    """A view that displays information for the CAPM model."""
    beta, sy = capm_information(ticker)
    print(f"Beta:\t\t\t{beta:.2f}")
    print(f"Systematic Risk:\t{sy*100:.2f}%")
    print(f"Unsystematic Risk:\t{(1-sy)*100:.2f}%\n")