daxm / fmpsdk

SDK for Financial Modeling Prep's (FMP) API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Historical Rating Function Pointing to Incorrect Endpoint

iguy0 opened this issue · comments

commented

Hello,

Thank you for this great tool, very useful! I believe the historical_rating function in /fmpsdk/company_valuation.py may be pointing to the wrong API endpoint.

Please see below.

def historical_rating(
    apikey: str,
    symbol: str,
    limit: int = DEFAULT_LIMIT,
) -> typing.Optional[typing.List[typing.Dict]]:
    """
    Query FMP /financial-growth/ API.
    :param apikey: Your API key.
    :param symbol: Company ticker.
    :param limit: Number of rows to return.
    :return: A list of dictionaries.
    """
    path = f"financial-growth/{symbol}"
    query_vars = {"apikey": apikey, "limit": limit}
    return __return_json_v3(path=path, query_vars=query_vars)
commented

I would agree with you. It appears I copy/pasted to make the "historical_rating" method but didn't change anything. This said, I've looked through the FMP API Docs and I don't see what I should have put here.

I've been remiss on keeping up to date with changes/additions. The FMP API team seems to be regularly adding and changing things. During these changes it appears they must have restructured the API methods layout and categorization. At some point in the past they must of had some sort of "historical rating" endpoint but now I don't see it.

So, do you see what endpoint historical_rating should point to?

As an aside, I'll try to prioritize updating the fmpsdk python package to bring it more in sync with FMP's current API endpoints.

commented

I took a look and found the correct string. This is working for me:

def historical_rating(
    apikey: str,
    symbol: str,
    limit: int = DEFAULT_LIMIT,
) -> typing.Optional[typing.List[typing.Dict]]:
    """
    Query FMP /historical-rating/ API.

    :param apikey: Your API key.
    :param symbol: Company ticker.
    :param limit: Number of rows to return.
    :return: A list of dictionaries.
    """
    path = f"historical-rating/{symbol}"
    query_vars = {"apikey": apikey, "limit": limit}
    return __return_json_v3(path=path, query_vars=query_vars)
commented

I appreciate your prompt response earlier =] Like i mentioned, great job with the Lib!

commented

Updated and new version released.