summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrique Joaquim <h.joaquim@campus.fct.unl.pt>2024-02-06 13:54:51 +0000
committerGitHub <noreply@github.com>2024-02-06 13:54:51 +0000
commit6eb097c31c7406cca9d890f3edb5dd3215bb2680 (patch)
tree4da6f1a76c35c440e7704a778bca215d07c9e65e
parent1cff417f1062fb9f9722d2d69f8f7651c924afeb (diff)
[BugFix] - Improve Standardization - `EquitySearch` (#6033)
* format w new black * Revert "format w new black" This reverts commit 74b9619cc6b565f85aef1e89fc01900b86c8b991. * small adjustment on the test * index historical * adjust tests accordingly * keep the test skipped * match tests w python * use cache as std field * fix tests * fix tests * use_cache as std * adjust tests * keep the skip * re-record test * black
-rw-r--r--openbb_platform/core/openbb_core/provider/standard_models/equity_search.py4
-rw-r--r--openbb_platform/extensions/equity/integration/test_equity_api.py10
-rw-r--r--openbb_platform/extensions/equity/integration/test_equity_python.py10
-rw-r--r--openbb_platform/providers/cboe/openbb_cboe/models/equity_search.py6
-rw-r--r--openbb_platform/providers/intrinio/tests/record/http/test_intrinio_fetchers/test_intrinio_equity_search_fetcher.yaml49
-rw-r--r--openbb_platform/providers/nasdaq/openbb_nasdaq/models/equity_search.py11
-rw-r--r--openbb_platform/providers/sec/openbb_sec/models/equity_search.py4
7 files changed, 51 insertions, 43 deletions
diff --git a/openbb_platform/core/openbb_core/provider/standard_models/equity_search.py b/openbb_platform/core/openbb_core/provider/standard_models/equity_search.py
index 8ec02ceeb80..195e99dbeef 100644
--- a/openbb_platform/core/openbb_core/provider/standard_models/equity_search.py
+++ b/openbb_platform/core/openbb_core/provider/standard_models/equity_search.py
@@ -16,6 +16,10 @@ class EquitySearchQueryParams(QueryParams):
is_symbol: bool = Field(
description="Whether to search by ticker symbol.", default=False
)
+ use_cache: Optional[bool] = Field(
+ default=True,
+ description="Whether to use the cache or not.",
+ )
class EquitySearchData(Data):
diff --git a/openbb_platform/extensions/equity/integration/test_equity_api.py b/openbb_platform/extensions/equity/integration/test_equity_api.py
index 9ec9e781119..c34badc62a5 100644
--- a/openbb_platform/extensions/equity/integration/test_equity_api.py
+++ b/openbb_platform/extensions/equity/integration/test_equity_api.py
@@ -1212,7 +1212,15 @@ def test_equity_fundamental_latest_attributes(params, headers):
({"query": "AAPl", "is_symbol": True, "provider": "cboe", "use_cache": False}),
({"query": "Apple", "provider": "sec", "use_cache": False, "is_fund": False}),
({"query": "", "provider": "nasdaq", "use_cache": False, "is_etf": True}),
- ({"query": "gold", "provider": "intrinio", "active": True, "limit": 100}),
+ (
+ {
+ "query": "gold",
+ "provider": "intrinio",
+ "active": True,
+ "limit": 100,
+ "use_cache": None,
+ }
+ ),
],
)
@pytest.mark.integration
diff --git a/openbb_platform/extensions/equity/integration/test_equity_python.py b/openbb_platform/extensions/equity/integration/test_equity_python.py
index 2e866217ef2..7c97baaea18 100644
--- a/openbb_platform/extensions/equity/integration/test_equity_python.py
+++ b/openbb_platform/extensions/equity/integration/test_equity_python.py
@@ -1150,7 +1150,15 @@ def test_equity_fundamental_latest_attributes(params, obb):
({"query": "AAPL", "is_symbol": True, "provider": "cboe", "use_cache": False}),
({"query": "Apple", "provider": "sec", "use_cache": False, "is_fund": False}),
({"query": "", "provider": "nasdaq", "use_cache": False, "is_etf": True}),
- ({"query": "gold", "provider": "intrinio", "active": True, "limit": 100}),
+ (
+ {
+ "query": "gold",
+ "provider": "intrinio",
+ "active": True,
+ "limit": 100,
+ "use_cache": None,
+ }
+ ),
],
)
@pytest.mark.integration
diff --git a/openbb_platform/providers/cboe/openbb_cboe/models/equity_search.py b/openbb_platform/providers/cboe/openbb_cboe/models/equity_search.py
index 428a7d92023..a67f1453bd2 100644
--- a/openbb_platform/providers/cboe/openbb_cboe/models/equity_search.py
+++ b/openbb_platform/providers/cboe/openbb_cboe/models/equity_search.py
@@ -17,12 +17,6 @@ class CboeEquitySearchQueryParams(EquitySearchQueryParams):
Source: https://www.cboe.com/
"""
- use_cache: bool = Field(
- default=True,
- description="When True, the company directory of optionable tickers will be cached for 24 hours."
- + " Set as False to bypass.",
- )
-
class CboeEquitySearchData(EquitySearchData):
"""CBOE Equity Search Data."""
diff --git a/openbb_platform/providers/intrinio/tests/record/http/test_intrinio_fetchers/test_intrinio_equity_search_fetcher.yaml b/openbb_platform/providers/intrinio/tests/record/http/test_intrinio_fetchers/test_intrinio_equity_search_fetcher.yaml
index 292cee77eb4..5dcb8c6f8d5 100644
--- a/openbb_platform/providers/intrinio/tests/record/http/test_intrinio_fetchers/test_intrinio_equity_search_fetcher.yaml
+++ b/openbb_platform/providers/intrinio/tests/record/http/test_intrinio_fetchers/test_intrinio_equity_search_fetcher.yaml
@@ -3,36 +3,37 @@ interactions:
body: null
headers:
Accept:
- - '*/*'
+ - application/json
Accept-Encoding:
- - gzip, deflate, br
+ - gzip, deflate
Connection:
- keep-alive
method: GET
- uri: https://api-v2.intrinio.com/companies/search?active=True&api_key=MOCK_API_KEY&page_size=100&query=gold
+ uri: https://api-v2.intrinio.com/companies/search?active=True&api_key=MOCK_API_KEY&page_size=100&query=gold&use_cache=True
response:
body:
string: !!binary |
- H4sIAHb8b2UAA4yWW3PiOBCF/wrF8+yWkGxZnjdfQAFsY2wuhq2tKQMujyfEJlwSYGr++4rNZlCL
- YnHewOFT6/ic7v7ZXFYvm7Qssl3z618/m8Wq+fXy1bfF+bW/yJtfmvti+Zxtxbd84Lnic5m+ZOKT
- bUVR1+k3Lt82nEEUikfrrBBP0EDr20OnN08YHve5Y08MIh4ui+fLQ/Fn6JSZWvPXF+m4c3vS3pzk
- 47rWOLkeV/zBUINX61XDqbabPz8PKw/rtYRuMZ2YFCvoV1tfAHQw4V7nyg4mV/I9MEUGQ4YC9rNX
- dgZgLikUZO8f3G65/C2OrpkEIZ0jHjhPIXqinkmBOOxyGIUH5RkbTMENxrE1vp40jh9eACFsIJMo
- 3NkPGiQytz/irqRMHz9WRme3kifT43oGlBlFUSKBR0F06xyVrBG9ZZpKyS7N3gA59i0ukePqJa1h
- FEPAEYLs08LdWk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FMwCniX0uw1q3MRndUN1uR+G/Rd/iKXL334KH3bVe8F
+ GewXd8EQ6lCWf3zY6kKtB92I92hQMY9uH0etGlCXJTmF49AT5HdsMuUnUDrb1pIEmNiQVpYTjuxK
+ zK3Fb7Jn6IrZNE7n33eN3vfjrph/nOUNnu6WEWBjQx7RG9rrCzXqUpcz7fnp/2Xuqn1TYy4FYAp6
+ iFAaQRQSpDbFrsZ2UnntD8cLU7jTkLhtTrBhWeQPTGyqbLuTm06vvxQnyIif1qNit09v+/C7D+DY
+ eRoE/shuY1fF4q8ijBCUh2ynp9tiXmLS5e5g7dJyX6tdsLVMl2/SX2/EdmRFvkCPiN+lNYa4AQFQ
+ ZTqcZJ5AD0JhiAcvq6Kss1LqJoJIyu7R7wWpuCKE3SdhFS6rbVVHGYQVLPefbLE0RWVaEeWEGbS8
+ yHo8ydkqrALG/pd9Mzvsv63TPLv816/fAAAA//8DANBYgPZ5DwAA
headers:
Connection:
- keep-alive
@@ -41,7 +42,7 @@ interactions:
Content-Type:
- application/json
Date:
- - Wed, 06 Dec 2023 04:45:42 GMT
+ - Mon, 05 Feb 2024 16:07:58 GMT
Transfer-Encoding:
- chunked
Vary:
diff --git a/openbb_platform/providers/nasdaq/openbb_nasdaq/models/equity_search.py b/openbb_platform/providers/nasdaq/openbb_nasdaq/models/equity_search.py
index ce5d6d74c66..77ada033b51 100644
--- a/openbb_platform/providers/nasdaq/openbb_nasdaq/models/equity_search.py
+++ b/openbb_platform/providers/nasdaq/openbb_nasdaq/models/equity_search.py
@@ -33,10 +33,6 @@ class NasdaqEquitySearchQueryParams(EquitySearchQueryParams):
default=None,
description="If True, returns ETFs.",
)
- use_cache: Optional[bool] = Field(
- default=True,
- description="If True, caches the symbol directory for one day.",
- )
class NasdaqEquitySearchData(EquitySearchData):
@@ -108,16 +104,17 @@ class NasdaqEquitySearchFetcher(
@staticmethod
def transform_query(params: Dict[str, Any]) -> NasdaqEquitySearchQueryParams:
+ """Transform the query parameters."""
return NasdaqEquitySearchQueryParams(**params)
+ # pylint: disable=unused-argument
@staticmethod
- async def extract_data(
+ async def aextract_data(
query: NasdaqEquitySearchQueryParams,
credentials: Optional[Dict[str, str]],
**kwargs: Any,
) -> str:
"""Extract data from Nasdaq."""
-
url = "https://www.nasdaqtrader.com/dynamic/SymDir/nasdaqtraded.txt"
def fetch_data():
@@ -133,6 +130,7 @@ class NasdaqEquitySearchFetcher(
loop = asyncio.get_running_loop()
return await loop.run_in_executor(None, fetch_data)
+ # pylint: disable=unused-argument
@staticmethod
def transform_data(
query: NasdaqEquitySearchQueryParams,
@@ -140,7 +138,6 @@ class NasdaqEquitySearchFetcher(
**kwargs: Any,
) -> List[NasdaqEquitySearchData]:
"""Transform the data and filter the results."""
-
directory = read_csv(StringIO(data), sep="|").iloc[:-1]
if query.is_etf is True:
diff --git a/openbb_platform/providers/sec/openbb_sec/models/equity_search.py b/openbb_platform/providers/sec/openbb_sec/models/equity_search.py
index 0438bc694f1..9a3b49409af 100644
--- a/openbb_platform/providers/sec/openbb_sec/models/equity_search.py
+++ b/openbb_platform/providers/sec/openbb_sec/models/equity_search.py
@@ -25,10 +25,6 @@ class SecEquitySearchQueryParams(EquitySearchQueryParams):
default=False,
description="Whether to direct the search to the list of mutual funds and ETFs.",
)
- use_cache: bool = Field(
- default=True,
- description="Whether to use the cache or not. Company names, tickers, and CIKs are cached for seven days.",
- )
class SecEquitySearchData(EquitySearchData):