Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eodhd/apiclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ def get_insider_transactions_data(

def get_fundamentals_data(self, ticker: str, filter: str = None, historical: int = None,
from_date: str = None, to_date: str = None, version: int = None,
no_cache: int = None) -> list:
no_cache: int = None) -> dict:
"""GET /api/fundamentals/{ticker}"""
api_call = FundamentalDataAPI(session=self._session, timeout=self._timeout)
return api_call.get_fundamentals_data(
Expand All @@ -716,7 +716,7 @@ def get_fundamentals_data(self, ticker: str, filter: str = None, historical: int

def get_fundamentals_data_v1_1(self, ticker: str, filter: str = None, historical: int = None,
from_date: str = None, to_date: str = None, version: int = None,
no_cache: int = None) -> list:
no_cache: int = None) -> dict:
"""GET /api/v1.1/fundamentals/{ticker} — uses improved Earnings::Trend data"""
api_call = FundamentalDataAPI(session=self._session, timeout=self._timeout)
return api_call.get_fundamentals_data_v1_1(
Expand Down
12 changes: 12 additions & 0 deletions tests/test_fundamentaldataapi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
"""Unit tests for FundamentalDataAPI"""

import inspect

import pytest

from eodhd.apiclient import APIClient
from eodhd.APIs import FundamentalDataAPI


Expand All @@ -25,3 +29,11 @@ def test_get_fundamentals_data_v1_1_method_exists():
api = FundamentalDataAPI()
assert hasattr(api, "get_fundamentals_data_v1_1")
assert callable(api.get_fundamentals_data_v1_1)


def test_get_fundamentals_data_return_annotation_is_dict():
"""The /fundamentals endpoint returns a JSON object, so the client methods
must be annotated -> dict, not -> list (see issue #71)."""
client = APIClient.__new__(APIClient)
assert inspect.signature(client.get_fundamentals_data).return_annotation is dict
assert inspect.signature(client.get_fundamentals_data_v1_1).return_annotation is dict