diff options
author | Danglewood <85772166+deeleeramone@users.noreply.github.com> | 2024-04-09 06:09:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-09 13:09:08 +0000 |
commit | 0a64bd19d04c78f501c1128d27a2725468f41c24 (patch) | |
tree | 67d9ebc372df62f201a5f127bcea2d4f576aebcc | |
parent | 8fed63e4c82613b5bc4c1da8b9b3c7c36c2bdfc0 (diff) |
[HotFix] Add ETF holdings data param to Intrinio (#6293)
* add etf holdings date param
* static files
---------
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
5 files changed, 35 insertions, 5 deletions
diff --git a/openbb_platform/extensions/etf/integration/test_etf_api.py b/openbb_platform/extensions/etf/integration/test_etf_api.py index 850998dd540..e3dffef2c63 100644 --- a/openbb_platform/extensions/etf/integration/test_etf_api.py +++ b/openbb_platform/extensions/etf/integration/test_etf_api.py @@ -337,6 +337,14 @@ def test_etf_holdings_date(params, headers): { "symbol": "DJIA", "provider": "intrinio", + "date": None, + } + ), + ( + { + "symbol": "DJIA", + "provider": "intrinio", + "date": "2020-04-03", } ), ], diff --git a/openbb_platform/extensions/etf/integration/test_etf_python.py b/openbb_platform/extensions/etf/integration/test_etf_python.py index f3d966b831b..568c0eab2b2 100644 --- a/openbb_platform/extensions/etf/integration/test_etf_python.py +++ b/openbb_platform/extensions/etf/integration/test_etf_python.py @@ -329,6 +329,14 @@ def test_etf_holdings_date(params, obb): { "symbol": "DJIA", "provider": "intrinio", + "date": None, + } + ), + ( + { + "symbol": "DJIA", + "provider": "intrinio", + "date": "2020-04-03", } ), ], diff --git a/openbb_platform/openbb/assets/reference.json b/openbb_platform/openbb/assets/reference.json index 8517caa78cc..ef97af715c1 100644 --- a/openbb_platform/openbb/assets/reference.json +++ b/openbb_platform/openbb/assets/reference.json @@ -22279,7 +22279,15 @@ "optional": true } ], - "intrinio": [], + "intrinio": [ + { + "name": "date", + "type": "Union[date, str]", + "description": "A specific date to get data for.", + "default": null, + "optional": true + } + ], "sec": [ { "name": "date", diff --git a/openbb_platform/openbb/package/etf.py b/openbb_platform/openbb/package/etf.py index a48f89d875c..7e00a168999 100644 --- a/openbb_platform/openbb/package/etf.py +++ b/openbb_platform/openbb/package/etf.py @@ -392,6 +392,7 @@ class ROUTER_etf(Container): no default. date : Optional[Union[str, datetime.date]] A specific date to get data for. Entering a date will attempt to return the NPORT-P filing for the entered date. This needs to be _exactly_ the date of the filing. Use the holdings_date command/endpoint to find available filing dates for the ETF. (provider: fmp); + A specific date to get data for. (provider: intrinio); A specific date to get data for. The date represents the period ending. The date entered will return the closest filing. (provider: sec) cik : Optional[str] The CIK of the filing entity. Overrides symbol. (provider: fmp) diff --git a/openbb_platform/providers/intrinio/openbb_intrinio/models/etf_holdings.py b/openbb_platform/providers/intrinio/openbb_intrinio/models/etf_holdings.py index 52d546bf002..9d38c4b29fd 100644 --- a/openbb_platform/providers/intrinio/openbb_intrinio/models/etf_holdings.py +++ b/openbb_platform/providers/intrinio/openbb_intrinio/models/etf_holdings.py @@ -10,6 +10,7 @@ from openbb_core.provider.standard_models.etf_holdings import ( EtfHoldingsData, EtfHoldingsQueryParams, ) +from openbb_core.provider.utils.descriptions import QUERY_DESCRIPTIONS from openbb_core.provider.utils.helpers import ( ClientResponse, ClientSession, @@ -25,6 +26,12 @@ class IntrinioEtfHoldingsQueryParams(EtfHoldingsQueryParams): Source: https://docs.intrinio.com/documentation/web_api/get_etf_holdings_v2 """ + __alias_dict__ = {"date": "as_of_date"} + + date: Optional[dateType] = Field( + default=None, description=QUERY_DESCRIPTIONS.get("date", "") + ) + class IntrinioEtfHoldingsData(EtfHoldingsData): """Intrinio ETF Holdings Data.""" @@ -145,13 +152,11 @@ class IntrinioEtfHoldingsFetcher( **kwargs: Any, ) -> List[Dict]: """Return the raw data from the Intrinio endpoint.""" - api_key = credentials.get("intrinio_api_key") if credentials else "" - symbol = query.symbol + ":US" if ":" not in query.symbol else query.symbol - URL = f"https://api-v2.intrinio.com/etfs/{symbol}/holdings?page_size=10000&api_key={api_key}" - + if query.date: + URL += f"&as_of_date={query.date}" data = [] async def response_callback(response: ClientResponse, session: ClientSession): |