From 20d12eafa65594d7b19f20ced1794af4d7c96bb0 Mon Sep 17 00:00:00 2001 From: Danglewood <85772166+deeleeramone@users.noreply.github.com> Date: Mon, 10 Feb 2025 12:30:28 -0800 Subject: [PATCH] [BugFix] `openbb-yfinance`: Remove Duplicated Line In Screener Causing Double Results For First Pass (#7022) * remove duplicated line * remove that other code which wasn't supposed to be there --- .../providers/yfinance/openbb_yfinance/utils/helpers.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openbb_platform/providers/yfinance/openbb_yfinance/utils/helpers.py b/openbb_platform/providers/yfinance/openbb_yfinance/utils/helpers.py index ee56c82f55d..f16760afb99 100644 --- a/openbb_platform/providers/yfinance/openbb_yfinance/utils/helpers.py +++ b/openbb_platform/providers/yfinance/openbb_yfinance/utils/helpers.py @@ -114,14 +114,13 @@ async def get_custom_screener( results.extend(res["quotes"]) total_results = res["total"] - results.extend(res["quotes"]) while len(results) < total_results: if limit is not None and len(results) >= limit: break offset = len(results) body["offset"] = offset - res = _data.post( + response = _data.post( "https://query2.finance.yahoo.com/v1/finance/screener", body=body, user_agent_headers=_data.user_agent_headers, @@ -130,6 +129,7 @@ async def get_custom_screener( ) if not res: break + res = response.json()["finance"]["result"][0] results.extend(res.get("quotes", [])) output: list = [] @@ -186,7 +186,6 @@ async def get_defined_screener( if not response.get("quotes"): raise EmptyDataError("No data found for the predefined screener.") - results.extend(response["quotes"]) total_results = response["total"] results.extend(response["quotes"])