summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanglewood <85772166+deeleeramone@users.noreply.github.com>2024-06-14 13:12:57 -0700
committerGitHub <noreply@github.com>2024-06-14 13:12:57 -0700
commitb990c2aee6668396fe5ef650355594e61bf38f16 (patch)
tree42371633a10543d53bcee43fde4ef4dd2ed1aac0
parentdca19db1d866051124ff299b3845f9b74ef540cc (diff)
parent3db89dae5e6fc9a56d1499d9e4176fbe9f06af46 (diff)
Merge branch 'develop' into feature/effrfeature/effr
-rw-r--r--openbb_platform/core/openbb_core/provider/standard_models/earnings_call_transcript.py2
-rw-r--r--openbb_platform/openbb/assets/reference.json10
-rw-r--r--openbb_platform/openbb/package/equity_fundamental.py26
-rw-r--r--openbb_platform/providers/fmp/openbb_fmp/models/earnings_call_transcript.py45
4 files changed, 51 insertions, 32 deletions
diff --git a/openbb_platform/core/openbb_core/provider/standard_models/earnings_call_transcript.py b/openbb_platform/core/openbb_core/provider/standard_models/earnings_call_transcript.py
index 65ddec15f8f..d1dae96a034 100644
--- a/openbb_platform/core/openbb_core/provider/standard_models/earnings_call_transcript.py
+++ b/openbb_platform/core/openbb_core/provider/standard_models/earnings_call_transcript.py
@@ -17,7 +17,7 @@ class EarningsCallTranscriptQueryParams(QueryParams):
"""Earnings Call Transcript rating Query."""
symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", ""))
- year: int = Field(description="Year of the earnings call transcript.")
+ year: Union[int, str] = Field(description="Year of the earnings call transcript.")
@field_validator("symbol", mode="before", check_fields=False)
@classmethod
diff --git a/openbb_platform/openbb/assets/reference.json b/openbb_platform/openbb/assets/reference.json
index 5e09aba3d07..796454a5384 100644
--- a/openbb_platform/openbb/assets/reference.json
+++ b/openbb_platform/openbb/assets/reference.json
@@ -21196,21 +21196,21 @@
"message": null
},
"description": "Get earnings call transcripts for a given company.",
- "examples": "\nExamples\n--------\n\n```python\nfrom openbb import obb\nobb.equity.fundamental.transcript(symbol='AAPL', year=2020, provider='fmp')\n```\n\n",
+ "examples": "\nExamples\n--------\n\n```python\nfrom openbb import obb\nobb.equity.fundamental.transcript(symbol='AAPL', year='2020', provider='fmp')\n```\n\n",
"parameters": {
"standard": [
{
"name": "symbol",
- "type": "str",
- "description": "Symbol to get data for.",
+ "type": "Union[str, List[str]]",
+ "description": "Symbol to get data for. Multiple items allowed for provider(s): fmp.",
"default": "",
"optional": false,
"choices": null
},
{
"name": "year",
- "type": "int",
- "description": "Year of the earnings call transcript.",
+ "type": "Union[Union[int, str], List[Union[int, str]]]",
+ "description": "Year of the earnings call transcript. Multiple items allowed for provider(s): fmp.",
"default": "",
"optional": false,
"choices": null
diff --git a/openbb_platform/openbb/package/equity_fundamental.py b/openbb_platform/openbb/package/equity_fundamental.py
index 4ac6cd64daa..ff337f1c256 100644
--- a/openbb_platform/openbb/package/equity_fundamental.py
+++ b/openbb_platform/openbb/package/equity_fundamental.py
@@ -3636,9 +3636,17 @@ class ROUTER_equity_fundamental(Container):
@validate
def transcript(
self,
- symbol: Annotated[str, OpenBBField(description="Symbol to get data for.")],
+ symbol: Annotated[
+ Union[str, List[str]],
+ OpenBBField(
+ description="Symbol to get data for. Multiple comma separated items allowed for provider(s): fmp."
+ ),
+ ],
year: Annotated[
- int, OpenBBField(description="Year of the earnings call transcript.")
+ Union[int, str, List[Union[int, str]]],
+ OpenBBField(
+ description="Year of the earnings call transcript. Multiple comma separated items allowed for provider(s): fmp."
+ ),
],
provider: Annotated[
Optional[Literal["fmp"]],
@@ -3652,10 +3660,10 @@ class ROUTER_equity_fundamental(Container):
Parameters
----------
- symbol : str
- Symbol to get data for.
- year : int
- Year of the earnings call transcript.
+ symbol : Union[str, List[str]]
+ Symbol to get data for. Multiple comma separated items allowed for provider(s): fmp.
+ year : Union[int, str, List[Union[int, str]]]
+ Year of the earnings call transcript. Multiple comma separated items allowed for provider(s): fmp.
provider : Optional[Literal['fmp']]
The provider to use, by default None. If None, the priority list configured in the settings is used. Default priority: fmp.
@@ -3689,7 +3697,7 @@ class ROUTER_equity_fundamental(Container):
Examples
--------
>>> from openbb import obb
- >>> obb.equity.fundamental.transcript(symbol='AAPL', year=2020, provider='fmp')
+ >>> obb.equity.fundamental.transcript(symbol='AAPL', year='2020', provider='fmp')
""" # noqa: E501
return self._run(
@@ -3707,5 +3715,9 @@ class ROUTER_equity_fundamental(Container):
"year": year,
},
extra_params=kwargs,
+ info={
+ "symbol": {"fmp": {"multiple_items_allowed": True}},
+ "year": {"fmp": {"multiple_items_allowed": True}},
+ },
)
)
diff --git a/openbb_platform/providers/fmp/openbb_fmp/models/earnings_call_transcript.py b/openbb_platform/providers/fmp/openbb_fmp/models/earnings_call_transcript.py
index 47073b67fe2..e0c47582969 100644
--- a/openbb_platform/providers/fmp/openbb_fmp/models/earnings_call_transcript.py
+++ b/openbb_platform/providers/fmp/openbb_fmp/models/earnings_call_transcript.py
@@ -1,5 +1,7 @@
"""FMP Earnings Call Transcript Model."""
+# pylint: disable=unused-argument
+
from datetime import datetime
from typing import Any, Dict, List, Optional
@@ -8,7 +10,7 @@ from openbb_core.provider.standard_models.earnings_call_transcript import (
EarningsCallTranscriptData,
EarningsCallTranscriptQueryParams,
)
-from openbb_fmp.utils.helpers import create_url, get_data_many
+from openbb_core.provider.utils.helpers import amake_requests
from pydantic import field_validator
@@ -18,12 +20,10 @@ class FMPEarningsCallTranscriptQueryParams(EarningsCallTranscriptQueryParams):
Source: https://site.financialmodelingprep.com/developer/docs/earning-call-transcript-api/
"""
- @field_validator("year", mode="before", check_fields=False)
- @classmethod
- def time_validate(cls, v: int): # pylint: disable=E0213
- """Return the year as an integer."""
- current_year = datetime.now().year
- return current_year if v > current_year or v < 1950 else v
+ __json_schema_extra__ = {
+ "symbol": {"multiple_items_allowed": True},
+ "year": {"multiple_items_allowed": True},
+ }
class FMPEarningsCallTranscriptData(EarningsCallTranscriptData):
@@ -31,7 +31,7 @@ class FMPEarningsCallTranscriptData(EarningsCallTranscriptData):
@field_validator("date", mode="before", check_fields=False)
@classmethod
- def date_validate(cls, v: str): # pylint: disable=E0213
+ def date_validate(cls, v):
"""Return the date as a datetime object."""
return datetime.strptime(v, "%Y-%m-%d %H:%M:%S")
@@ -42,7 +42,7 @@ class FMPEarningsCallTranscriptFetcher(
List[FMPEarningsCallTranscriptData],
]
):
- """Transform the query, extract and transform the data from the FMP endpoints."""
+ """FMP Earnings Call Transcript Fetcher."""
@staticmethod
def transform_query(params: Dict[str, Any]) -> FMPEarningsCallTranscriptQueryParams:
@@ -57,16 +57,23 @@ class FMPEarningsCallTranscriptFetcher(
) -> List[Dict]:
"""Return the raw data from the FMP endpoint."""
api_key = credentials.get("fmp_api_key") if credentials else ""
-
- url = create_url(
- 4,
- f"batch_earning_call_transcript/{query.symbol}",
- api_key,
- query,
- ["symbol"],
- )
-
- return await get_data_many(url, **kwargs)
+ symbols = query.symbol.split(",")
+ years = query.year.split(",") if isinstance(query.year, str) else [query.year]
+
+ def generate_url(symbol, year):
+ """Generate the URL."""
+ url = (
+ f"https://financialmodelingprep.com/api/v4/batch_earning_call_transcript/{symbol}?"
+ + f"year={year}&apikey={api_key}"
+ )
+ return url
+
+ urls: List = []
+ for symbol in symbols:
+ for year in years:
+ urls.append(generate_url(symbol, year))
+
+ return await amake_requests(urls, **kwargs) # type: ignore
@staticmethod
def transform_data(