From a3757146b0a307f7e9500a9cc4e89181eca6ed86 Mon Sep 17 00:00:00 2001 From: Danglewood <85772166+deeleeramone@users.noreply.github.com> Date: Fri, 17 May 2024 16:58:19 -0700 Subject: [PATCH 1/8] sectors as lower_snake_case --- .../fmp/openbb_fmp/models/equity_screener.py | 2 ++ .../fmp/openbb_fmp/utils/definitions.py | 30 +++++++++---------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/openbb_platform/providers/fmp/openbb_fmp/models/equity_screener.py b/openbb_platform/providers/fmp/openbb_fmp/models/equity_screener.py index 58579cacaf9c..1f4fd343519e 100644 --- a/openbb_platform/providers/fmp/openbb_fmp/models/equity_screener.py +++ b/openbb_platform/providers/fmp/openbb_fmp/models/equity_screener.py @@ -162,6 +162,8 @@ async def aextract_data( ) -> List[Dict]: """Return the raw data from the FMP endpoint.""" api_key = credentials.get("fmp_api_key") if credentials else "" + if query.sector is not None: + query.sector = query.sector.replace("_", " ").title() url = create_url( version=3, endpoint="stock-screener", diff --git a/openbb_platform/providers/fmp/openbb_fmp/utils/definitions.py b/openbb_platform/providers/fmp/openbb_fmp/utils/definitions.py index 970b26db7d5b..8711e4e4bad8 100644 --- a/openbb_platform/providers/fmp/openbb_fmp/utils/definitions.py +++ b/openbb_platform/providers/fmp/openbb_fmp/utils/definitions.py @@ -3,21 +3,21 @@ from typing import Literal SECTORS = Literal[ - "Consumer Cyclical", - "Energy", - "Technology", - "Industrials", - "Financial Services", - "Basic Materials", - "Communication Services", - "Consumer Defensive", - "Healthcare", - "Real Estate", - "Utilities", - "Industrial Goods", - "Financial", - "Services", - "Conglomerates", + "consumer_cyclical", + "energy", + "technology", + "industrials", + "financial_services", + "basic_materials", + "communication_services", + "consumer_defensive", + "healthcare", + "real_estate", + "utilities", + "industrial_goods", + "financial", + "services", + "conglomerates", ] EXCHANGES = Literal[ From ea20273e14f9a704018c7bbb9404517759b1783a Mon Sep 17 00:00:00 2001 From: Danglewood <85772166+deeleeramone@users.noreply.github.com> Date: Fri, 17 May 2024 17:18:23 -0700 Subject: [PATCH 2/8] pylint disable unused-argument --- .../providers/fmp/openbb_fmp/models/equity_screener.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/openbb_platform/providers/fmp/openbb_fmp/models/equity_screener.py b/openbb_platform/providers/fmp/openbb_fmp/models/equity_screener.py index 1f4fd343519e..9f5f9b33277b 100644 --- a/openbb_platform/providers/fmp/openbb_fmp/models/equity_screener.py +++ b/openbb_platform/providers/fmp/openbb_fmp/models/equity_screener.py @@ -1,5 +1,7 @@ """FMP Equity Screener Model.""" +# pylint: disable=unused-argument + from typing import Any, Dict, List, Literal, Optional import pandas as pd @@ -8,6 +10,7 @@ EquityScreenerData, EquityScreenerQueryParams, ) +from openbb_core.provider.utils.errors import EmptyDataError from openbb_fmp.utils.definitions import EXCHANGES, SECTORS from openbb_fmp.utils.helpers import create_url, get_data from pydantic import Field @@ -171,16 +174,16 @@ async def aextract_data( query=query, exclude=["query", "is_symbol", "industry"], ).replace(" ", "%20") - return await get_data(url, **kwargs) + return await get_data(url, **kwargs) # type: ignore @staticmethod def transform_data( query: FMPEquityScreenerQueryParams, data: List[Dict], **kwargs: Any ) -> List[FMPEquityScreenerData]: """Return the transformed data.""" + if not data: + raise EmptyDataError("The request was returned empty.") results = pd.DataFrame(data) - if len(results) == 0: - return [] if query.industry: results = results[ results["sector"].str.contains(query.industry, case=False) From 787da802a0afaaa04de8beab8059bdd10ac3315d Mon Sep 17 00:00:00 2001 From: Danglewood <85772166+deeleeramone@users.noreply.github.com> Date: Fri, 17 May 2024 17:30:11 -0700 Subject: [PATCH 3/8] fix tests --- .../extensions/equity/integration/test_equity_api.py | 2 +- .../extensions/equity/integration/test_equity_python.py | 2 +- openbb_platform/providers/fmp/tests/test_fmp_fetchers.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openbb_platform/extensions/equity/integration/test_equity_api.py b/openbb_platform/extensions/equity/integration/test_equity_api.py index ad38630c0693..7ab3bb95c403 100644 --- a/openbb_platform/extensions/equity/integration/test_equity_api.py +++ b/openbb_platform/extensions/equity/integration/test_equity_api.py @@ -1421,7 +1421,7 @@ def test_equity_search(params, headers): ( { "industry": "REIT", - "sector": "Real Estate", + "sector": "real_estate", "mktcap_min": None, "mktcap_max": None, "price_min": None, diff --git a/openbb_platform/extensions/equity/integration/test_equity_python.py b/openbb_platform/extensions/equity/integration/test_equity_python.py index f13df3df5585..344ea98e5d82 100644 --- a/openbb_platform/extensions/equity/integration/test_equity_python.py +++ b/openbb_platform/extensions/equity/integration/test_equity_python.py @@ -1325,7 +1325,7 @@ def test_equity_search(params, obb): ( { "industry": "REIT", - "sector": "Real Estate", + "sector": "real_estate", "mktcap_min": None, "mktcap_max": None, "price_min": None, diff --git a/openbb_platform/providers/fmp/tests/test_fmp_fetchers.py b/openbb_platform/providers/fmp/tests/test_fmp_fetchers.py index b740b6e8050f..f5d25f8149da 100644 --- a/openbb_platform/providers/fmp/tests/test_fmp_fetchers.py +++ b/openbb_platform/providers/fmp/tests/test_fmp_fetchers.py @@ -542,7 +542,7 @@ def test_fmp_equity_quote_fetcher(credentials=test_credentials): @pytest.mark.record_http def test_fmp_equity_screener_fetcher(credentials=test_credentials): """Test FMP equity screener fetcher.""" - params = {"query": "midstream", "sector": "Energy", "beta_max": 0.5} + params = {"query": "midstream", "sector": "energy", "beta_max": 0.5} fetcher = FMPEquityScreenerFetcher() result = fetcher.test(params, credentials) From 177a262fd6354faddf581a28154b33fa5b083d3d Mon Sep 17 00:00:00 2001 From: Danglewood <85772166+deeleeramone@users.noreply.github.com> Date: Fri, 17 May 2024 17:56:02 -0700 Subject: [PATCH 4/8] workaround for pytest --- .../fmp/openbb_fmp/models/equity_screener.py | 9 +- .../test_fmp_equity_screener_fetcher.yaml | 109 +++++++++--------- .../providers/fmp/tests/test_fmp_fetchers.py | 2 +- 3 files changed, 62 insertions(+), 58 deletions(-) diff --git a/openbb_platform/providers/fmp/openbb_fmp/models/equity_screener.py b/openbb_platform/providers/fmp/openbb_fmp/models/equity_screener.py index 9f5f9b33277b..beb23b807853 100644 --- a/openbb_platform/providers/fmp/openbb_fmp/models/equity_screener.py +++ b/openbb_platform/providers/fmp/openbb_fmp/models/equity_screener.py @@ -1,7 +1,7 @@ """FMP Equity Screener Model.""" # pylint: disable=unused-argument - +from copy import deepcopy from typing import Any, Dict, List, Literal, Optional import pandas as pd @@ -165,13 +165,14 @@ async def aextract_data( ) -> List[Dict]: """Return the raw data from the FMP endpoint.""" api_key = credentials.get("fmp_api_key") if credentials else "" - if query.sector is not None: - query.sector = query.sector.replace("_", " ").title() + _query = deepcopy(query) + if _query.sector is not None: + _query.sector = _query.sector.replace("_", " ").title() url = create_url( version=3, endpoint="stock-screener", api_key=api_key, - query=query, + query=_query, exclude=["query", "is_symbol", "industry"], ).replace(" ", "%20") return await get_data(url, **kwargs) # type: ignore diff --git a/openbb_platform/providers/fmp/tests/record/http/test_fmp_fetchers/test_fmp_equity_screener_fetcher.yaml b/openbb_platform/providers/fmp/tests/record/http/test_fmp_fetchers/test_fmp_equity_screener_fetcher.yaml index d0ecd34d58f2..86d183d7cc65 100644 --- a/openbb_platform/providers/fmp/tests/record/http/test_fmp_fetchers/test_fmp_equity_screener_fetcher.yaml +++ b/openbb_platform/providers/fmp/tests/record/http/test_fmp_fetchers/test_fmp_equity_screener_fetcher.yaml @@ -3,9 +3,9 @@ interactions: body: null headers: Accept: - - '*/*' + - application/json Accept-Encoding: - - gzip, deflate, br + - gzip, deflate Connection: - keep-alive method: GET @@ -13,59 +13,62 @@ interactions: response: body: string: !!binary | - H4sIAAAAAAAAA9Wc226j3BXH77+nQHMxvZnZ2kc29M52nIMmdlxDMvlU9YKxmQQFgws4M1bV92mf - 43uxLpyAp7A3PnS7SiJFSsAQ2D/W4b/WIn/9zbL+Ad+W9SFfL76l8Yc/Wx8G/rT34dPL1lm6WAbJ - ehwsws2utAizLLCGSZg9rK2rZIaqTy6C7CksBsESPkextJm0Bef4dW8ezoo0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q61hK9A5SfxkPb8K3eM7waXDS0jxnj + ZD3/0I7O1j6vGqR04Gqn+jig+DvInwbema1QmMvvUGXKWcm0wLdX2Zl2LZDKNm7OPOAEanOccMPs + TJ0LJRAYKxSvKg71x7Ypzv5Y39fL+V2snL7/5EziJz/Mnp6fKzXBoUjrqXYxqGVtCciqNSGXNGe3 + VWr5uMhfo4CbU9kV2tG4d25/jvFMC4YjfRWpM9e/jf/4X5bEof5t/vfew8c//ps67ywPNELRVkS0 + BIhqrUdadjvN5aXadIYJ3l/+McbT0ZEt5T2N5nGk0sD/MvEtIkuDtsCCEoR27DduHb0gqs5j4Jat + YigF5qZRjD3Gr9Oj7hF6R2NbjuwtF/pS4qQcKStWtOlZEoEkkrDLBBngam+ydYyT+hYzGdwe2W3p + Lb+J3dXple2Bkqvg0b+PkwZQ+VeACNmm/reDnRFWL7wj0U7SM1LOCnQk6A/BajC0mdnAf/ioippt + AzBAAcQ7RrEtgb3TdCQn3FBt57idIKEMMg6+hw7J4MO1jdyHa+fMj+ZNDwMJRBmXHRegAKp/nYIr + G+c16mYmOo5mh2DVtz7t3feT6JMKQ01qtdSBaqKmmUFZlvA6ogZZ1c6QSzeUDev9f4iRNPnHV0bu + vDcZ24aytW/PZzfGaiX4i+8AMoF7fu5uNx/Z9JUKVcVBNuVnLql3H5E0gjp4Xv0tGdqvw4ufbY8d + b9PlQhBI1MYbbt3iAm3bjpxL47TnwXlsazc//Ov/64YFR2VQAAA= headers: Access-Control-Allow-Credentials: - 'true' Access-Control-Allow-Headers: - X-Requested-With, content-type, auth-token, Authorization, stripe-signature, - APPS + APPS, publicauthkey, privateauthkey Access-Control-Allow-Methods: - GET, POST, OPTIONS Access-Control-Allow-Origin: @@ -79,9 +82,9 @@ interactions: Content-Type: - application/json; charset=utf-8 Date: - - Wed, 01 Nov 2023 03:52:34 GMT - ETag: - - W/"4982-+8Qdcwj1qb7/EmFCGB+B5c50150" + - Sat, 18 May 2024 00:53:55 GMT + Etag: + - W/"5065-ZEn6rIEbJjPKIDVPjFO8zIEy3jg" Server: - nginx/1.18.0 (Ubuntu) Transfer-Encoding: diff --git a/openbb_platform/providers/fmp/tests/test_fmp_fetchers.py b/openbb_platform/providers/fmp/tests/test_fmp_fetchers.py index f5d25f8149da..7bd48e003ee7 100644 --- a/openbb_platform/providers/fmp/tests/test_fmp_fetchers.py +++ b/openbb_platform/providers/fmp/tests/test_fmp_fetchers.py @@ -542,7 +542,7 @@ def test_fmp_equity_quote_fetcher(credentials=test_credentials): @pytest.mark.record_http def test_fmp_equity_screener_fetcher(credentials=test_credentials): """Test FMP equity screener fetcher.""" - params = {"query": "midstream", "sector": "energy", "beta_max": 0.5} + params = {"industry": "midstream", "sector": "energy", "beta_max": 0.5} fetcher = FMPEquityScreenerFetcher() result = fetcher.test(params, credentials) From d7c73f3d827657f5d737008498254124b7e65458 Mon Sep 17 00:00:00 2001 From: Danglewood <85772166+deeleeramone@users.noreply.github.com> Date: Fri, 17 May 2024 18:09:41 -0700 Subject: [PATCH 5/8] benzinga alias --- openbb_platform/openbb/assets/reference.json | 14 +++++------ openbb_platform/openbb/package/equity.py | 2 +- .../openbb/package/equity_estimates.py | 13 +++++++---- .../openbb_benzinga/models/price_target.py | 23 +++++++++++-------- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/openbb_platform/openbb/assets/reference.json b/openbb_platform/openbb/assets/reference.json index 0c7ed54c2287..b5b7e6b45294 100644 --- a/openbb_platform/openbb/assets/reference.json +++ b/openbb_platform/openbb/assets/reference.json @@ -5794,24 +5794,24 @@ }, { "name": "analyst_ids", - "type": "Union[List[str], str]", - "description": "Comma-separated list of analyst (person) IDs. Omitting will bring back all available analysts.", + "type": "Union[Union[List[str], str], List[Union[List[str], str]]]", + "description": "Comma-separated list of analyst (person) IDs. Omitting will bring back all available analysts. Multiple items allowed for provider(s): benzinga.", "default": null, "optional": true, "choices": null }, { "name": "firm_ids", - "type": "Union[List[str], str]", - "description": "Comma-separated list of firm IDs.", + "type": "Union[Union[List[str], str], List[Union[List[str], str]]]", + "description": "Comma-separated list of firm IDs. Multiple items allowed for provider(s): benzinga.", "default": null, "optional": true, "choices": null }, { "name": "fields", - "type": "Union[List[str], str]", - "description": "Comma-separated list of fields to include in the response. See https://docs.benzinga.io/benzinga-apis/calendar/get-ratings to learn about the available fields.", + "type": "Union[Union[List[str], str], List[Union[List[str], str]]]", + "description": "Comma-separated list of fields to include in the response. See https://docs.benzinga.io/benzinga-apis/calendar/get-ratings to learn about the available fields. Multiple items allowed for provider(s): benzinga.", "default": null, "optional": true, "choices": null @@ -22325,7 +22325,7 @@ }, { "name": "sector", - "type": "Literal['Consumer Cyclical', 'Energy', 'Technology', 'Industrials', 'Financial Services', 'Basic Materials', 'Communication Services', 'Consumer Defensive', 'Healthcare', 'Real Estate', 'Utilities', 'Industrial Goods', 'Financial', 'Services', 'Conglomerates']", + "type": "Literal['consumer_cyclical', 'energy', 'technology', 'industrials', 'financial_services', 'basic_materials', 'communication_services', 'consumer_defensive', 'healthcare', 'real_estate', 'utilities', 'industrial_goods', 'financial', 'services', 'conglomerates']", "description": "Filter by sector.", "default": null, "optional": true, diff --git a/openbb_platform/openbb/package/equity.py b/openbb_platform/openbb/package/equity.py index c67112ac8a1c..922618dae0ab 100644 --- a/openbb_platform/openbb/package/equity.py +++ b/openbb_platform/openbb/package/equity.py @@ -491,7 +491,7 @@ def screener( If true, returns only ETFs. (provider: fmp) is_active : Optional[bool] If false, returns only inactive tickers. (provider: fmp) - sector : Optional[Literal['Consumer Cyclical', 'Energy', 'Technology', 'Industrials', 'Financial Services', 'Basic Materials', 'Communication Services', 'Consumer Defensive', 'Healthcare', 'Real Estate', 'Utilities', 'Industrial Goods', 'Financial', 'Services', 'Conglomerates']] + sector : Optional[Literal['consumer_cyclical', 'energy', 'technology', 'industrials', 'financial_services', 'basic_materials', 'communication_services', 'consumer_defensive', 'healthcare', 'real_estate', 'utilities', 'industrial_goods', 'financial', 'services', 'conglomerates']] Filter by sector. (provider: fmp) industry : Optional[str] Filter by industry. (provider: fmp) diff --git a/openbb_platform/openbb/package/equity_estimates.py b/openbb_platform/openbb/package/equity_estimates.py index efa40206a14c..b93d171b6a17 100644 --- a/openbb_platform/openbb/package/equity_estimates.py +++ b/openbb_platform/openbb/package/equity_estimates.py @@ -849,11 +849,11 @@ def price_target( action : Optional[Literal['downgrades', 'maintains', 'reinstates', 'reiterates', 'upgrades', 'assumes', 'initiates', 'terminates', 'removes', 'suspends', 'firm_dissolved']] Filter by a specific action_company. (provider: benzinga) analyst_ids : Optional[Union[List[str], str]] - Comma-separated list of analyst (person) IDs. Omitting will bring back all available analysts. (provider: benzinga) + Comma-separated list of analyst (person) IDs. Omitting will bring back all available analysts. Multiple comma separated items allowed. (provider: benzinga) firm_ids : Optional[Union[List[str], str]] - Comma-separated list of firm IDs. (provider: benzinga) + Comma-separated list of firm IDs. Multiple comma separated items allowed. (provider: benzinga) fields : Optional[Union[List[str], str]] - Comma-separated list of fields to include in the response. See https://docs.benzinga.io/benzinga-apis/calendar/get-ratings to learn about the available fields. (provider: benzinga) + Comma-separated list of fields to include in the response. See https://docs.benzinga.io/benzinga-apis/calendar/get-ratings to learn about the available fields. Multiple comma separated items allowed. (provider: benzinga) with_grade : bool Include upgrades and downgrades in the response. (provider: fmp) @@ -955,9 +955,12 @@ def price_target( extra_params=kwargs, info={ "symbol": { - "benzinga": {"multiple_items_allowed": True}, + "benzinga": ["multiple_items_allowed"], "fmp": {"multiple_items_allowed": True}, - } + }, + "analyst_ids": {"benzinga": ["multiple_items_allowed"]}, + "firm_ids": {"benzinga": ["multiple_items_allowed"]}, + "fields": {"benzinga": ["multiple_items_allowed"]}, }, ) ) diff --git a/openbb_platform/providers/benzinga/openbb_benzinga/models/price_target.py b/openbb_platform/providers/benzinga/openbb_benzinga/models/price_target.py index 49666ac18c50..6dea39fb96f7 100644 --- a/openbb_platform/providers/benzinga/openbb_benzinga/models/price_target.py +++ b/openbb_platform/providers/benzinga/openbb_benzinga/models/price_target.py @@ -48,8 +48,21 @@ class BenzingaPriceTargetQueryParams(PriceTargetQueryParams): __alias_dict__ = { "limit": "pagesize", "symbol": "parameters[tickers]", + "date": "parameters[date]", + "start_date": "parameters[date_from]", + "end_date": "parameters[date_to]", + "updated": "parameters[updated]", + "importance": "parameters[importance]", + "action": "parameters[action]", + "analyst_ids": "parameters[analyst_id]", + "firm_ids": "parameters[firm_id]", + } + __json_schema_extra__ = { + "symbol": ["multiple_items_allowed"], + "analyst_ids": ["multiple_items_allowed"], + "firm_ids": ["multiple_items_allowed"], + "fields": ["multiple_items_allowed"], } - __json_schema_extra__ = {"symbol": {"multiple_items_allowed": True}} page: Optional[int] = Field( default=0, @@ -60,17 +73,14 @@ class BenzingaPriceTargetQueryParams(PriceTargetQueryParams): date: Optional[dateType] = Field( default=None, description="Date for calendar data, shorthand for date_from and date_to.", - alias="parameters[date]", ) start_date: Optional[dateType] = Field( default=None, description=QUERY_DESCRIPTIONS.get("start_date", ""), - alias="parameters[date_from]", ) end_date: Optional[dateType] = Field( default=None, description=QUERY_DESCRIPTIONS.get("end_date", ""), - alias="parameters[date_to]", ) updated: Optional[Union[dateType, int]] = Field( default=None, @@ -78,13 +88,11 @@ class BenzingaPriceTargetQueryParams(PriceTargetQueryParams): + " This will force the sort order to be Greater Than or Equal to the timestamp indicated." + " The date can be a date string or a Unix timestamp." + " The date string must be in the format of YYYY-MM-DD.", - alias="parameters[updated]", ) importance: Optional[int] = Field( default=None, description="Importance level to filter by." + " Uses Greater Than or Equal To the importance indicated", - alias="parameters[importance]", ) action: Optional[ Literal[ @@ -103,18 +111,15 @@ class BenzingaPriceTargetQueryParams(PriceTargetQueryParams): ] = Field( default=None, description="Filter by a specific action_company.", - alias="parameters[action]", ) analyst_ids: Optional[Union[List[str], str]] = Field( default=None, description="Comma-separated list of analyst (person) IDs." + " Omitting will bring back all available analysts.", - alias="parameters[analyst_id]", ) firm_ids: Optional[Union[List[str], str]] = Field( default=None, description="Comma-separated list of firm IDs.", - alias="parameters[firm_id]", ) fields: Optional[Union[List[str], str]] = Field( default=None, From 68d43cceaf3fde7f8cb2a026919a8406db41322b Mon Sep 17 00:00:00 2001 From: Danglewood <85772166+deeleeramone@users.noreply.github.com> Date: Fri, 17 May 2024 18:24:08 -0700 Subject: [PATCH 6/8] sec form types with spaces --- openbb_platform/openbb/assets/reference.json | 2 +- .../sec/openbb_sec/models/company_filings.py | 4 +- .../sec/openbb_sec/utils/definitions.py | 130 +++++++++--------- 3 files changed, 68 insertions(+), 68 deletions(-) diff --git a/openbb_platform/openbb/assets/reference.json b/openbb_platform/openbb/assets/reference.json index b5b7e6b45294..80ae29f6fd9f 100644 --- a/openbb_platform/openbb/assets/reference.json +++ b/openbb_platform/openbb/assets/reference.json @@ -18380,7 +18380,7 @@ }, { "name": "form_type", - "type": "Literal['1', '1-A', '1-A POS', '1-A-W', '1-E', '1-E AD', '1-K', '1-SA', '1-U', '1-Z', '1-Z-W', '10-12B', '10-12G', '10-D', '10-K', '10-KT', '10-Q', '10-QT', '11-K', '11-KT', '13F-HR', '13F-NT', '13FCONP', '144', '15-12B', '15-12G', '15-15D', '15F-12B', '15F-12G', '15F-15D', '18-12B', '18-K', '19B-4E', '2-A', '2-AF', '2-E', '20-F', '20FR12B', '20FR12G', '24F-2NT', '25', '25-NSE', '253G1', '253G2', '253G3', '253G4', '3', '305B2', '34-12H', '4', '40-17F1', '40-17F2', '40-17G', '40-17GCS', '40-202A', '40-203A', '40-206A', '40-24B2', '40-33', '40-6B', '40-8B25', '40-8F-2', '40-APP', '40-F', '40-OIP', '40FR12B', '40FR12G', '424A', '424B1', '424B2', '424B3', '424B4', '424B5', '424B7', '424B8', '424H', '425', '485APOS', '485BPOS', '485BXT', '486APOS', '486BPOS', '486BXT', '487', '497', '497AD', '497H2', '497J', '497K', '497VPI', '497VPU', '5', '6-K', '6B NTC', '6B ORDR', '8-A12B', '8-A12G', '8-K', '8-K12B', '8-K12G3', '8-K15D5', '8-M', '8F-2 NTC', '8F-2 ORDR', '9-M', 'ABS-15G', 'ABS-EE', 'ADN-MTL', 'ADV-E', 'ADV-H-C', 'ADV-H-T', 'ADV-NR', 'ANNLRPT', 'APP NTC', 'APP ORDR', 'APP WD', 'APP WDG', 'ARS', 'ATS-N', 'ATS-N-C', 'ATS-N/UA', 'AW', 'AW WD', 'C', 'C-AR', 'C-AR-W', 'C-TR', 'C-TR-W', 'C-U', 'C-U-W', 'C-W', 'CB', 'CERT', 'CERTARCA', 'CERTBATS', 'CERTCBO', 'CERTNAS', 'CERTNYS', 'CERTPAC', 'CFPORTAL', 'CFPORTAL-W', 'CORRESP', 'CT ORDER', 'D', 'DEF 14A', 'DEF 14C', 'DEFA14A', 'DEFA14C', 'DEFC14A', 'DEFC14C', 'DEFM14A', 'DEFM14C', 'DEFN14A', 'DEFR14A', 'DEFR14C', 'DEL AM', 'DFAN14A', 'DFRN14A', 'DOS', 'DOSLTR', 'DRS', 'DRSLTR', 'DSTRBRPT', 'EFFECT', 'F-1', 'F-10', 'F-10EF', 'F-10POS', 'F-1MEF', 'F-3', 'F-3ASR', 'F-3D', 'F-3DPOS', 'F-3MEF', 'F-4', 'F-4 POS', 'F-4MEF', 'F-6', 'F-6 POS', 'F-6EF', 'F-7', 'F-7 POS', 'F-8', 'F-8 POS', 'F-80', 'F-80POS', 'F-9', 'F-9 POS', 'F-N', 'F-X', 'FOCUSN', 'FWP', 'G-405', 'G-405N', 'G-FIN', 'G-FINW', 'IRANNOTICE', 'MA', 'MA-A', 'MA-I', 'MA-W', 'MSD', 'MSDCO', 'MSDW', 'N-1', 'N-14', 'N-14 8C', 'N-14MEF', 'N-18F1', 'N-1A', 'N-2', 'N-2 POSASR', 'N-23C-2', 'N-23C3A', 'N-23C3B', 'N-23C3C', 'N-2ASR', 'N-2MEF', 'N-30B-2', 'N-30D', 'N-4', 'N-5', 'N-54A', 'N-54C', 'N-6', 'N-6F', 'N-8A', 'N-8B-2', 'N-8F', 'N-8F NTC', 'N-8F ORDR', 'N-CEN', 'N-CR', 'N-CSR', 'N-CSRS', 'N-MFP', 'N-MFP1', 'N-MFP2', 'N-PX', 'N-Q', 'N-VP', 'N-VPFS', 'NO ACT', 'NPORT-EX', 'NPORT-NP', 'NPORT-P', 'NRSRO-CE', 'NRSRO-UPD', 'NSAR-A', 'NSAR-AT', 'NSAR-B', 'NSAR-BT', 'NSAR-U', 'NT 10-D', 'NT 10-K', 'NT 10-Q', 'NT 11-K', 'NT 20-F', 'NT N-CEN', 'NT N-MFP', 'NT N-MFP1', 'NT N-MFP2', 'NT NPORT-EX', 'NT NPORT-P', 'NT-NCEN', 'NT-NCSR', 'NT-NSAR', 'NTFNCEN', 'NTFNCSR', 'NTFNSAR', 'NTN 10D', 'NTN 10K', 'NTN 10Q', 'NTN 20F', 'OIP NTC', 'OIP ORDR', 'POS 8C', 'POS AM', 'POS AMI', 'POS EX', 'POS462B', 'POS462C', 'POSASR', 'PRE 14A', 'PRE 14C', 'PREC14A', 'PREC14C', 'PREM14A', 'PREM14C', 'PREN14A', 'PRER14A', 'PRER14C', 'PRRN14A', 'PX14A6G', 'PX14A6N', 'QRTLYRPT', 'QUALIF', 'REG-NR', 'REVOKED', 'RW', 'RW WD', 'S-1', 'S-11', 'S-11MEF', 'S-1MEF', 'S-20', 'S-3', 'S-3ASR', 'S-3D', 'S-3DPOS', 'S-3MEF', 'S-4', 'S-4 POS', 'S-4EF', 'S-4MEF', 'S-6', 'S-8', 'S-8 POS', 'S-B', 'S-BMEF', 'SBSE', 'SBSE-A', 'SBSE-BD', 'SBSE-C', 'SBSE-W', 'SC 13D', 'SC 13E1', 'SC 13E3', 'SC 13G', 'SC 14D9', 'SC 14F1', 'SC 14N', 'SC TO-C', 'SC TO-I', 'SC TO-T', 'SC13E4F', 'SC14D1F', 'SC14D9C', 'SC14D9F', 'SD', 'SDR', 'SE', 'SEC ACTION', 'SEC STAFF ACTION', 'SEC STAFF LETTER', 'SF-1', 'SF-3', 'SL', 'SP 15D2', 'STOP ORDER', 'SUPPL', 'T-3', 'TA-1', 'TA-2', 'TA-W', 'TACO', 'TH', 'TTW', 'UNDER', 'UPLOAD', 'WDL-REQ', 'X-17A-5']", + "type": "Literal['1', '1-A', '1-A_POS', '1-A-W', '1-E', '1-E_AD', '1-K', '1-SA', '1-U', '1-Z', '1-Z-W', '10-12B', '10-12G', '10-D', '10-K', '10-KT', '10-Q', '10-QT', '11-K', '11-KT', '13F-HR', '13F-NT', '13FCONP', '144', '15-12B', '15-12G', '15-15D', '15F-12B', '15F-12G', '15F-15D', '18-12B', '18-K', '19B-4E', '2-A', '2-AF', '2-E', '20-F', '20FR12B', '20FR12G', '24F-2NT', '25', '25-NSE', '253G1', '253G2', '253G3', '253G4', '3', '305B2', '34-12H', '4', '40-17F1', '40-17F2', '40-17G', '40-17GCS', '40-202A', '40-203A', '40-206A', '40-24B2', '40-33', '40-6B', '40-8B25', '40-8F-2', '40-APP', '40-F', '40-OIP', '40FR12B', '40FR12G', '424A', '424B1', '424B2', '424B3', '424B4', '424B5', '424B7', '424B8', '424H', '425', '485APOS', '485BPOS', '485BXT', '486APOS', '486BPOS', '486BXT', '487', '497', '497AD', '497H2', '497J', '497K', '497VPI', '497VPU', '5', '6-K', '6B_NTC', '6B_ORDR', '8-A12B', '8-A12G', '8-K', '8-K12B', '8-K12G3', '8-K15D5', '8-M', '8F-2_NTC', '8F-2_ORDR', '9-M', 'ABS-15G', 'ABS-EE', 'ADN-MTL', 'ADV-E', 'ADV-H-C', 'ADV-H-T', 'ADV-NR', 'ANNLRPT', 'APP_NTC', 'APP_ORDR', 'APP_WD', 'APP_WDG', 'ARS', 'ATS-N', 'ATS-N-C', 'ATS-N/UA', 'AW', 'AW_WD', 'C', 'C-AR', 'C-AR-W', 'C-TR', 'C-TR-W', 'C-U', 'C-U-W', 'C-W', 'CB', 'CERT', 'CERTARCA', 'CERTBATS', 'CERTCBO', 'CERTNAS', 'CERTNYS', 'CERTPAC', 'CFPORTAL', 'CFPORTAL-W', 'CORRESP', 'CT ORDER', 'D', 'DEF_14A', 'DEF_14C', 'DEFA14A', 'DEFA14C', 'DEFC14A', 'DEFC14C', 'DEFM14A', 'DEFM14C', 'DEFN14A', 'DEFR14A', 'DEFR14C', 'DEL_AM', 'DFAN14A', 'DFRN14A', 'DOS', 'DOSLTR', 'DRS', 'DRSLTR', 'DSTRBRPT', 'EFFECT', 'F-1', 'F-10', 'F-10EF', 'F-10POS', 'F-1MEF', 'F-3', 'F-3ASR', 'F-3D', 'F-3DPOS', 'F-3MEF', 'F-4', 'F-4_POS', 'F-4MEF', 'F-6', 'F-6_POS', 'F-6EF', 'F-7', 'F-7_POS', 'F-8', 'F-8_POS', 'F-80', 'F-80POS', 'F-9', 'F-9_POS', 'F-N', 'F-X', 'FOCUSN', 'FWP', 'G-405', 'G-405N', 'G-FIN', 'G-FINW', 'IRANNOTICE', 'MA', 'MA-A', 'MA-I', 'MA-W', 'MSD', 'MSDCO', 'MSDW', 'N-1', 'N-14', 'N-14_8C', 'N-14MEF', 'N-18F1', 'N-1A', 'N-2', 'N-2_POSASR', 'N-23C-2', 'N-23C3A', 'N-23C3B', 'N-23C3C', 'N-2ASR', 'N-2MEF', 'N-30B-2', 'N-30D', 'N-4', 'N-5', 'N-54A', 'N-54C', 'N-6', 'N-6F', 'N-8A', 'N-8B-2', 'N-8F', 'N-8F_NTC', 'N-8F_ORDR', 'N-CEN', 'N-CR', 'N-CSR', 'N-CSRS', 'N-MFP', 'N-MFP1', 'N-MFP2', 'N-PX', 'N-Q', 'N-VP', 'N-VPFS', 'NO_ACT', 'NPORT-EX', 'NPORT-NP', 'NPORT-P', 'NRSRO-CE', 'NRSRO-UPD', 'NSAR-A', 'NSAR-AT', 'NSAR-B', 'NSAR-BT', 'NSAR-U', 'NT_10-D', 'NT_10-K', 'NT_10-Q', 'NT_11-K', 'NT_20-F', 'NT_N-CEN', 'NT_N-MFP', 'NT_N-MFP1', 'NT_N-MFP2', 'NT_NPORT-EX', 'NT_NPORT-P', 'NT-NCEN', 'NT-NCSR', 'NT-NSAR', 'NTFNCEN', 'NTFNCSR', 'NTFNSAR', 'NTN_10D', 'NTN_10K', 'NTN_10Q', 'NTN_20F', 'OIP_NTC', 'OIP_ORDR', 'POS_8C', 'POS_AM', 'POS_AMI', 'POS_EX', 'POS462B', 'POS462C', 'POSASR', 'PRE_14A', 'PRE_14C', 'PREC14A', 'PREC14C', 'PREM14A', 'PREM14C', 'PREN14A', 'PRER14A', 'PRER14C', 'PRRN14A', 'PX14A6G', 'PX14A6N', 'QRTLYRPT', 'QUALIF', 'REG-NR', 'REVOKED', 'RW', 'RW_WD', 'S-1', 'S-11', 'S-11MEF', 'S-1MEF', 'S-20', 'S-3', 'S-3ASR', 'S-3D', 'S-3DPOS', 'S-3MEF', 'S-4', 'S-4_POS', 'S-4EF', 'S-4MEF', 'S-6', 'S-8', 'S-8_POS', 'S-B', 'S-BMEF', 'SBSE', 'SBSE-A', 'SBSE-BD', 'SBSE-C', 'SBSE-W', 'SC_13D', 'SC_13E1', 'SC_13E3', 'SC_13G', 'SC_14D9', 'SC_14F1', 'SC_14N', 'SC_TO-C', 'SC_TO-I', 'SC_TO-T', 'SC13E4F', 'SC14D1F', 'SC14D9C', 'SC14D9F', 'SD', 'SDR', 'SE', 'SEC_ACTION', 'SEC_STAFF_ACTION', 'SEC_STAFF_LETTER', 'SF-1', 'SF-3', 'SL', 'SP_15D2', 'STOP_ORDER', 'SUPPL', 'T-3', 'TA-1', 'TA-2', 'TA-W', 'TACO', 'TH', 'TTW', 'UNDER', 'UPLOAD', 'WDL-REQ', 'X-17A-5']", "description": "Type of the SEC filing form.", "default": null, "optional": true, diff --git a/openbb_platform/providers/sec/openbb_sec/models/company_filings.py b/openbb_platform/providers/sec/openbb_sec/models/company_filings.py index e210a5a0c726..9a8b4b8f090c 100644 --- a/openbb_platform/providers/sec/openbb_sec/models/company_filings.py +++ b/openbb_platform/providers/sec/openbb_sec/models/company_filings.py @@ -39,7 +39,7 @@ class SecCompanyFilingsQueryParams(CompanyFilingsQueryParams): description="Lookup filings by Central Index Key (CIK) instead of by symbol.", default=None, ) - form_type: Union[None, FORM_TYPES] = Field( + form_type: Optional[FORM_TYPES] = Field( description="Type of the SEC filing form.", default=None, ) @@ -276,7 +276,7 @@ def transform_data( base_url + filings["accessionNumber"] + "-index.htm" ) if query.form_type: - filings = filings[filings["form"] == query.form_type] + filings = filings[filings["form"] == query.form_type.replace("_", " ")] if query.limit: filings = filings.head(query.limit) if query.limit != 0 else filings diff --git a/openbb_platform/providers/sec/openbb_sec/utils/definitions.py b/openbb_platform/providers/sec/openbb_sec/utils/definitions.py index 8a36a5a4c772..b790b7b57709 100644 --- a/openbb_platform/providers/sec/openbb_sec/utils/definitions.py +++ b/openbb_platform/providers/sec/openbb_sec/utils/definitions.py @@ -21,10 +21,10 @@ FORM_TYPES = Literal[ "1", "1-A", - "1-A POS", + "1-A_POS", "1-A-W", "1-E", - "1-E AD", + "1-E_AD", "1-K", "1-SA", "1-U", @@ -112,8 +112,8 @@ "497VPU", "5", "6-K", - "6B NTC", - "6B ORDR", + "6B_NTC", + "6B_ORDR", "8-A12B", "8-A12G", "8-K", @@ -121,8 +121,8 @@ "8-K12G3", "8-K15D5", "8-M", - "8F-2 NTC", - "8F-2 ORDR", + "8F-2_NTC", + "8F-2_ORDR", "9-M", "ABS-15G", "ABS-EE", @@ -132,16 +132,16 @@ "ADV-H-T", "ADV-NR", "ANNLRPT", - "APP NTC", - "APP ORDR", - "APP WD", - "APP WDG", + "APP_NTC", + "APP_ORDR", + "APP_WD", + "APP_WDG", "ARS", "ATS-N", "ATS-N-C", "ATS-N/UA", "AW", - "AW WD", + "AW_WD", "C", "C-AR", "C-AR-W", @@ -163,8 +163,8 @@ "CORRESP", "CT ORDER", "D", - "DEF 14A", - "DEF 14C", + "DEF_14A", + "DEF_14C", "DEFA14A", "DEFA14C", "DEFC14A", @@ -174,7 +174,7 @@ "DEFN14A", "DEFR14A", "DEFR14C", - "DEL AM", + "DEL_AM", "DFAN14A", "DFRN14A", "DOS", @@ -194,19 +194,19 @@ "F-3DPOS", "F-3MEF", "F-4", - "F-4 POS", + "F-4_POS", "F-4MEF", "F-6", - "F-6 POS", + "F-6_POS", "F-6EF", "F-7", - "F-7 POS", + "F-7_POS", "F-8", - "F-8 POS", + "F-8_POS", "F-80", "F-80POS", "F-9", - "F-9 POS", + "F-9_POS", "F-N", "F-X", "FOCUSN", @@ -225,12 +225,12 @@ "MSDW", "N-1", "N-14", - "N-14 8C", + "N-14_8C", "N-14MEF", "N-18F1", "N-1A", "N-2", - "N-2 POSASR", + "N-2_POSASR", "N-23C-2", "N-23C3A", "N-23C3B", @@ -248,8 +248,8 @@ "N-8A", "N-8B-2", "N-8F", - "N-8F NTC", - "N-8F ORDR", + "N-8F_NTC", + "N-8F_ORDR", "N-CEN", "N-CR", "N-CSR", @@ -261,7 +261,7 @@ "N-Q", "N-VP", "N-VPFS", - "NO ACT", + "NO_ACT", "NPORT-EX", "NPORT-NP", "NPORT-P", @@ -272,38 +272,38 @@ "NSAR-B", "NSAR-BT", "NSAR-U", - "NT 10-D", - "NT 10-K", - "NT 10-Q", - "NT 11-K", - "NT 20-F", - "NT N-CEN", - "NT N-MFP", - "NT N-MFP1", - "NT N-MFP2", - "NT NPORT-EX", - "NT NPORT-P", + "NT_10-D", + "NT_10-K", + "NT_10-Q", + "NT_11-K", + "NT_20-F", + "NT_N-CEN", + "NT_N-MFP", + "NT_N-MFP1", + "NT_N-MFP2", + "NT_NPORT-EX", + "NT_NPORT-P", "NT-NCEN", "NT-NCSR", "NT-NSAR", "NTFNCEN", "NTFNCSR", "NTFNSAR", - "NTN 10D", - "NTN 10K", - "NTN 10Q", - "NTN 20F", - "OIP NTC", - "OIP ORDR", - "POS 8C", - "POS AM", - "POS AMI", - "POS EX", + "NTN_10D", + "NTN_10K", + "NTN_10Q", + "NTN_20F", + "OIP_NTC", + "OIP_ORDR", + "POS_8C", + "POS_AM", + "POS_AMI", + "POS_EX", "POS462B", "POS462C", "POSASR", - "PRE 14A", - "PRE 14C", + "PRE_14A", + "PRE_14C", "PREC14A", "PREC14C", "PREM14A", @@ -319,7 +319,7 @@ "REG-NR", "REVOKED", "RW", - "RW WD", + "RW_WD", "S-1", "S-11", "S-11MEF", @@ -331,12 +331,12 @@ "S-3DPOS", "S-3MEF", "S-4", - "S-4 POS", + "S-4_POS", "S-4EF", "S-4MEF", "S-6", "S-8", - "S-8 POS", + "S-8_POS", "S-B", "S-BMEF", "SBSE", @@ -344,16 +344,16 @@ "SBSE-BD", "SBSE-C", "SBSE-W", - "SC 13D", - "SC 13E1", - "SC 13E3", - "SC 13G", - "SC 14D9", - "SC 14F1", - "SC 14N", - "SC TO-C", - "SC TO-I", - "SC TO-T", + "SC_13D", + "SC_13E1", + "SC_13E3", + "SC_13G", + "SC_14D9", + "SC_14F1", + "SC_14N", + "SC_TO-C", + "SC_TO-I", + "SC_TO-T", "SC13E4F", "SC14D1F", "SC14D9C", @@ -361,14 +361,14 @@ "SD", "SDR", "SE", - "SEC ACTION", - "SEC STAFF ACTION", - "SEC STAFF LETTER", + "SEC_ACTION", + "SEC_STAFF_ACTION", + "SEC_STAFF_LETTER", "SF-1", "SF-3", "SL", - "SP 15D2", - "STOP ORDER", + "SP_15D2", + "STOP_ORDER", "SUPPL", "T-3", "TA-1", From 7cb81db5cf4ff38d7bb393771aae7de3684d9647 Mon Sep 17 00:00:00 2001 From: Danglewood <85772166+deeleeramone@users.noreply.github.com> Date: Fri, 17 May 2024 18:36:46 -0700 Subject: [PATCH 7/8] fmp insider trading --- openbb_platform/openbb/assets/reference.json | 2 +- openbb_platform/openbb/package/equity_ownership.py | 2 +- .../providers/fmp/openbb_fmp/models/insider_trading.py | 2 +- openbb_platform/providers/fmp/openbb_fmp/utils/definitions.py | 1 - 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/openbb_platform/openbb/assets/reference.json b/openbb_platform/openbb/assets/reference.json index 80ae29f6fd9f..d668796f81c3 100644 --- a/openbb_platform/openbb/assets/reference.json +++ b/openbb_platform/openbb/assets/reference.json @@ -19741,7 +19741,7 @@ "fmp": [ { "name": "transaction_type", - "type": "Literal[None, 'award', 'conversion', 'return', 'expire_short', 'in_kind', 'gift', 'expire_long', 'discretionary', 'other', 'small', 'exempt', 'otm', 'purchase', 'sale', 'tender', 'will', 'itm', 'trust']", + "type": "Literal['award', 'conversion', 'return', 'expire_short', 'in_kind', 'gift', 'expire_long', 'discretionary', 'other', 'small', 'exempt', 'otm', 'purchase', 'sale', 'tender', 'will', 'itm', 'trust']", "description": "Type of the transaction.", "default": null, "optional": true, diff --git a/openbb_platform/openbb/package/equity_ownership.py b/openbb_platform/openbb/package/equity_ownership.py index c9806627f8e5..e52db83d08b6 100644 --- a/openbb_platform/openbb/package/equity_ownership.py +++ b/openbb_platform/openbb/package/equity_ownership.py @@ -176,7 +176,7 @@ def insider_trading( The provider to use for the query, by default None. If None, the provider specified in defaults is selected or 'fmp' if there is no default. - transaction_type : Literal[None, 'award', 'conversion', 'return', 'expire_short', 'in_kind', 'gift', 'expire_long', 'discretionary', 'other', 'small', 'exempt', 'otm', 'purchase', 'sale', 'tender', 'will', 'itm', 'trust'] + transaction_type : Optional[Literal['award', 'conversion', 'return', 'expire_short', 'in_kind', 'gift', 'expire_long', 'discretionary', 'other', 'small', 'exempt', 'otm', 'purchase', 'sale', 'tender', 'will', 'itm', 'trust']] Type of the transaction. (provider: fmp) start_date : Optional[datetime.date] Start date of the data, in YYYY-MM-DD format. (provider: intrinio) diff --git a/openbb_platform/providers/fmp/openbb_fmp/models/insider_trading.py b/openbb_platform/providers/fmp/openbb_fmp/models/insider_trading.py index f907b821c84c..3a2ba81f38b3 100644 --- a/openbb_platform/providers/fmp/openbb_fmp/models/insider_trading.py +++ b/openbb_platform/providers/fmp/openbb_fmp/models/insider_trading.py @@ -19,7 +19,7 @@ class FMPInsiderTradingQueryParams(InsiderTradingQueryParams): Source: https://site.financialmodelingprep.com/developer/docs/#Stock-Insider-Trading """ - transaction_type: TRANSACTION_TYPES = Field( + transaction_type: Optional[TRANSACTION_TYPES] = Field( default=None, description="Type of the transaction.", alias="transactionType", diff --git a/openbb_platform/providers/fmp/openbb_fmp/utils/definitions.py b/openbb_platform/providers/fmp/openbb_fmp/utils/definitions.py index 8711e4e4bad8..a558197a5ee2 100644 --- a/openbb_platform/providers/fmp/openbb_fmp/utils/definitions.py +++ b/openbb_platform/providers/fmp/openbb_fmp/utils/definitions.py @@ -142,7 +142,6 @@ ] TRANSACTION_TYPES = Literal[ - None, "award", "conversion", "return", From 61f84568559b467f48a233e53808bcccf06a4f4d Mon Sep 17 00:00:00 2001 From: Danglewood <85772166+deeleeramone@users.noreply.github.com> Date: Fri, 17 May 2024 19:05:02 -0700 Subject: [PATCH 8/8] pylint disable unused argument --- .../providers/fmp/openbb_fmp/models/insider_trading.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openbb_platform/providers/fmp/openbb_fmp/models/insider_trading.py b/openbb_platform/providers/fmp/openbb_fmp/models/insider_trading.py index 3a2ba81f38b3..b0309ad79d38 100644 --- a/openbb_platform/providers/fmp/openbb_fmp/models/insider_trading.py +++ b/openbb_platform/providers/fmp/openbb_fmp/models/insider_trading.py @@ -1,5 +1,7 @@ """FMP Insider Trading Model.""" +# pylint: disable=unused-argument + import math from typing import Any, Dict, List, Optional