mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
Refactoring financial_modeling_prep_view
This commit is contained in:
@@ -25,7 +25,7 @@ register_matplotlib_converters()
|
||||
def price_target_from_analysts(
|
||||
other_args: List[str], stock: DataFrame, ticker: str, start: str, interval: str
|
||||
):
|
||||
"""Print analysts' price targets for a given stock
|
||||
"""Display analysts' price targets for a given stock
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -143,7 +143,7 @@ def price_target_from_analysts(
|
||||
|
||||
|
||||
def estimates(other_args: List[str], ticker: str):
|
||||
"""Print analysts' estimates for a given ticker
|
||||
"""Display analysts' estimates for a given ticker
|
||||
|
||||
Parameters
|
||||
----------
|
||||
@@ -314,7 +314,7 @@ def estimates(other_args: List[str], ticker: str):
|
||||
def insider_activity(
|
||||
other_args: List[str], stock: DataFrame, ticker: str, start: str, interval: str
|
||||
):
|
||||
"""Print insider activity
|
||||
"""Display insider activity
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
||||
@@ -7,7 +7,7 @@ from pandas.core.frame import DataFrame
|
||||
from prompt_toolkit.completion import NestedCompleter
|
||||
|
||||
from gamestonk_terminal.due_diligence import business_insider_view as bi_view
|
||||
from gamestonk_terminal.due_diligence import financial_modeling_prep_api as fmp_api
|
||||
from gamestonk_terminal.due_diligence import financial_modeling_prep_view as fmp_view
|
||||
from gamestonk_terminal.due_diligence import finviz_api as fvz_api
|
||||
from gamestonk_terminal.due_diligence import market_watch_api as mw_api
|
||||
from gamestonk_terminal.due_diligence import quandl_api as q_api
|
||||
@@ -161,7 +161,7 @@ class DueDiligenceController:
|
||||
|
||||
def call_rating(self, other_args: List[str]):
|
||||
""" Process rating command """
|
||||
fmp_api.rating(other_args, self.ticker)
|
||||
fmp_view.rating(other_args, self.ticker)
|
||||
|
||||
def call_warnings(self, other_args: List[str]):
|
||||
""" Process rating command """
|
||||
|
||||
@@ -1,10 +1,24 @@
|
||||
""" Due Diligence Controller """
|
||||
__docformat__ = "numpy"
|
||||
|
||||
import argparse
|
||||
from typing import List
|
||||
import FundamentalAnalysis as fa # Financial Modeling Prep
|
||||
from gamestonk_terminal import config_terminal as cfg
|
||||
from gamestonk_terminal.helper_funcs import parse_known_args_and_warn
|
||||
|
||||
|
||||
def rating(l_args, s_ticker):
|
||||
def rating(other_args: List[str], ticker: str):
|
||||
"""Display ratings for a given ticker
|
||||
|
||||
Parameters
|
||||
----------
|
||||
other_args : List[str]
|
||||
argparse other args
|
||||
ticker : str
|
||||
Stock ticker
|
||||
"""
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
prog="rating",
|
||||
@@ -16,18 +30,18 @@ def rating(l_args, s_ticker):
|
||||
)
|
||||
|
||||
try:
|
||||
ns_parser = parse_known_args_and_warn(parser, l_args)
|
||||
ns_parser = parse_known_args_and_warn(parser, other_args)
|
||||
if not ns_parser:
|
||||
return
|
||||
|
||||
df_fa = fa.rating(s_ticker, cfg.API_KEY_FINANCIALMODELINGPREP)
|
||||
df_fa = fa.rating(ticker, cfg.API_KEY_FINANCIALMODELINGPREP)
|
||||
print(df_fa)
|
||||
|
||||
print("")
|
||||
|
||||
except KeyError:
|
||||
print(
|
||||
f"Financialmodelingprep.com is returning empty response the ticker {s_ticker}."
|
||||
f"Financialmodelingprep.com is returning empty response the ticker {ticker}."
|
||||
)
|
||||
print("")
|
||||
return
|
||||
@@ -1,9 +0,0 @@
|
||||
""" fundamental_analysis/business_insider_api.py tests """
|
||||
import unittest
|
||||
|
||||
from gamestonk_terminal.due_diligence.financial_modeling_prep_api import rating
|
||||
|
||||
|
||||
class TestDdFinancialModelingPrepApi(unittest.TestCase):
|
||||
def test_rating(self):
|
||||
rating([], "PLTR")
|
||||
Reference in New Issue
Block a user