From c665fb9907b977c94a92a7c799ab0fcf68b646fd Mon Sep 17 00:00:00 2001 From: Theodore Aptekarev Date: Mon, 11 Dec 2023 15:49:57 +0100 Subject: [PATCH 01/10] Limit mypy v3 linting to only the diff of the PR (#5878) --- .github/workflows/linting.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 32012d5c2e0a..29e2e0cf3fd0 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -37,6 +37,11 @@ jobs: python-version: "3.9" architecture: x64 + - name: Get changed files in openbb_terminal for PR + if: github.event_name == 'pull_request' + run: | + echo "files=$(git diff --name-only origin/${{ github.base_ref }}...${{ github.head_ref }} | grep 'openbb_terminal/.*\.py$' | xargs)" >> $GITHUB_ENV + - uses: actions/cache@v3 with: path: ~/.cache/pip @@ -50,7 +55,12 @@ jobs: - run: black --diff --check . - run: codespell --ignore-words=.codespell.ignore --skip="$(tr '\n' ',' < .codespell.skip | sed 's/,$//')" --quiet-level=2 - run: ruff . - - run: mypy --ignore-missing-imports openbb_terminal + - run: | + if [ -n "${{ env.files }}" ]; then + mypy --ignore-missing-imports ${{ env.files }} + else + echo "No Python files changed in openbb_terminal" + fi - run: pylint terminal.py openbb_terminal tests markdown-link-check: From d9ec0fe80c612ca9ca86fb2fa1e4b5e513318643 Mon Sep 17 00:00:00 2001 From: Theodore Aptekarev Date: Mon, 11 Dec 2023 16:10:10 +0100 Subject: [PATCH 02/10] Use custom parametrize from news menu tests (#5873) * Use custom parametrize from news menu tests * Update Ultima unit test cassettes --- .../news/integration/test_news_api.py | 19 +- .../news/integration/test_news_python.py | 19 +- .../test_ultima_company_news_fetcher.yaml | 161 ++++--- .../test_ultima_sector_news_fetcher.yaml | 395 ++++++++++++++++++ 4 files changed, 508 insertions(+), 86 deletions(-) create mode 100644 openbb_platform/providers/ultima/tests/record/http/test_ultima_fetchers/test_ultima_sector_news_fetcher.yaml diff --git a/openbb_platform/extensions/news/integration/test_news_api.py b/openbb_platform/extensions/news/integration/test_news_api.py index c2b766df1594..78e9e3cb8cb1 100644 --- a/openbb_platform/extensions/news/integration/test_news_api.py +++ b/openbb_platform/extensions/news/integration/test_news_api.py @@ -147,6 +147,12 @@ def test_news_world(params, headers): "source": "bloomberg.com", } ), + ( + { + "provider": "ultima", + "sectors": "Real Estate", + } + ), ], ) @pytest.mark.integration @@ -160,8 +166,17 @@ def test_news_company(params, headers): assert result.status_code == 200 -@pytest.mark.skip(reason="No providers implement this yet.") -@pytest.mark.parametrize("params", []) +@parametrize( + "params", + [ + ( + { + "provider": "ultima", + "sectors": "Real Estate", + } + ), + ], +) @pytest.mark.integration def test_news_sector(params, headers): params = {p: v for p, v in params.items() if v} diff --git a/openbb_platform/extensions/news/integration/test_news_python.py b/openbb_platform/extensions/news/integration/test_news_python.py index baa01f9503bc..6a7ca2bfd971 100644 --- a/openbb_platform/extensions/news/integration/test_news_python.py +++ b/openbb_platform/extensions/news/integration/test_news_python.py @@ -141,6 +141,12 @@ def test_news_world(params, obb): "source": "bloomberg.com", } ), + ( + { + "provider": "ultima", + "symbols": "AAPL,MSFT", + } + ), ], ) @pytest.mark.integration @@ -153,8 +159,17 @@ def test_news_company(params, obb): assert len(result.results) > 0 -@pytest.mark.skip(reason="Not providers implement this yet.") -@pytest.mark.parametrize("params", []) +@parametrize( + "params", + [ + ( + { + "provider": "ultima", + "sectors": "Real Estate", + } + ), + ], +) @pytest.mark.integration def test_news_sector(params, obb): params = {p: v for p, v in params.items() if v} diff --git a/openbb_platform/providers/ultima/tests/record/http/test_ultima_fetchers/test_ultima_company_news_fetcher.yaml b/openbb_platform/providers/ultima/tests/record/http/test_ultima_fetchers/test_ultima_company_news_fetcher.yaml index 777776c8f7ee..709736051e1f 100644 --- a/openbb_platform/providers/ultima/tests/record/http/test_ultima_fetchers/test_ultima_company_news_fetcher.yaml +++ b/openbb_platform/providers/ultima/tests/record/http/test_ultima_fetchers/test_ultima_company_news_fetcher.yaml @@ -14,99 +14,96 @@ interactions: uri: https://api.ultimainsights.ai/v1/getOpenBBProInsights/AAPL,MSFT response: body: - string: "[\n {\n \"8k_filings\": [],\n \"articles\": [\n {\n \"headline\": - \"LG launches 118-inch ... Reportedly, batteries based on the new design will - be offered with the company's products that will launch in 2025 or later.\",\n - \ \"publishedDate\": \"2023-11-07 13:01:41\",\n \"publisher\": - \"SamMobile\",\n \"riskCategory\": \"Competition News\",\n \"summary\": - \"Apple is developing a new battery design expected to offer better performance - and launch in 2025 or later.\",\n \"url\": \"https://www.sammobile.com/new/apple-developing-new-battery-design-2025-products/\"\n - \ },\n {\n \"headline\": \"(Bloomberg) -- Meta Platforms Inc., - Apple Inc., Alphabet Inc. and other companies that offer digital wallets and - payment apps would fall under US ...\",\n \"publishedDate\": \"2023-11-08 - 01:16:45\",\n \"publisher\": \"Yahoo Finance\",\n \"riskCategory\": - \"Financial News\",\n \"summary\": \"Apple, along with other companies - offering digital wallets and payment apps, could fall under US Consumer Financial - Protection Bureau supervision under a newly proposed rule. The rule aims to - treat nonbanks more like traditional financial institutions and would require - companies handling more than 5 million transactions per year to be regulated. - This could impact Apple Pay and Google Pay, as the CFPB would be able to monitor - their compliance with federal money-transfer laws.\",\n \"url\": \"https://finance.yahoo.com/news/meta-apple-risk-increased-regulation-184702439.html\"\n - \ }\n ],\n \"critical_factors\": {},\n \"earnings_summary\": - {},\n \"industry_summary\": [],\n \"metadata\": {\n \"has_industry_summary\": - false,\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + string: "[\n {\n \"8k_filings\": [],\n \"articles\": [],\n \"critical_factors\": + {},\n \"earnings_summary\": {},\n \"industry_summary\": [],\n \"metadata\": + {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": - 2,\n \"n_pr_articles_with_summaries\": 0\n },\n \"pr_articles\": - [],\n \"ticker\": \"AAPL\"\n },\n {\n \"8k_filings\": [],\n \"articles\": - [\n {\n \"headline\": \"In 2021, Microsoft acquired AI company - Nuance Communications, a leading software technology corporation specializing - in speech recognition and ...\",\n \"publishedDate\": \"2023-11-07 - 10:03:30\",\n \"publisher\": \"Gamerant\",\n \"riskCategory\": - \"Competition News\",\n \"summary\": \"Microsoft partners with Inworld - AI to empower game developers with AI-driven features for Xbox.\",\n \"url\": - \"https://gamerant.com/microsoft-inworld-ai-partnership-for-xbox/\"\n },\n - \ {\n \"headline\": \"\\u201cWe are looking forward to partnering - with Microsoft Azure and G7 CR Technologies \\u2013 A Noventiq Company to - bring our fraud protection capabilities.\",\n \"publishedDate\": \"2023-11-07 - 20:06:49\",\n \"publisher\": \"The Financial Express\",\n \"riskCategory\": - \"Legal News\",\n \"summary\": \"Namaste Credit partners with Microsoft - Azure to enhance fraud detection capabilities and offer real-time data analysis - to banking and financial institutions.\",\n \"url\": \"https://www.financialexpress.com/business/digital-transformation-namaste-credit-enters-into-a-collaboration-with-microsoft-azure-over-fraud-detection-solutions-3299994/\"\n + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"AAPL\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [\n {\n \"headline\": \"With global regulators + examining Microsoft Corp. ... The unorthodox structure was concocted because + OpenAI is a capped for-profit company housed inside ...\",\n \"publishedDate\": + \"2023-12-09 03:57:12\",\n \"publisher\": \"Bloomberg\",\n \"riskCategory\": + \"Competition News\",\n \"summary\": \"Microsoft's $13 billion investment + in OpenAI is under scrutiny by global regulators. Microsoft argues that it + doesn't control OpenAI as it doesn't own a traditional stake. Regulators are + examining whether the collaboration threatens competition and violates antitrust + laws. Microsoft faces intense competition and government regulations, which + may reduce its attractiveness and revenue.\",\n \"url\": \"https://www.bloomberg.com/news/articles/2023-12-08/microsoft-s-answer-to-openai-inquiry-it-doesn-t-own-a-stake\"\n + \ },\n {\n \"headline\": \"The US Federal Trade Commission's + antitrust case against Amazon.com Inc ... The US Federal Trade Commission + is examining the nature of Microsoft Corp.\",\n \"publishedDate\": + \"2023-12-09 16:02:34\",\n \"publisher\": \"Bloomberg\",\n \"riskCategory\": + \"Competition News\",\n \"summary\": \"Amazon's antitrust case challenges + the agency's assertion that it causes prices to go up on competing websites, + which may impact Microsoft's revenue.\",\n \"url\": \"https://www.bloomberg.com/news/articles/2023-12-08/amazon-seeks-dismissal-of-ftc-antitrust-lawsuit\"\n + \ },\n {\n \"headline\": \"Former Microsoft Product Leader + to Help Launch VERSES AI Developer Platform ... Amazon and the Amazon logo + are trademarks of Amazon.com, Inc. or its ...\",\n \"publishedDate\": + \"2023-12-09 04:09:29\",\n \"publisher\": \"The Tech Outlook\",\n \"riskCategory\": + \"Competition News\",\n \"summary\": \"VERSES AI Inc. welcomes Peter + Provost, former Microsoft product leader, as VP of Product, Developer Platforms. + Provost will lead the strategic development and enhancement of VERSES' Intelligence-as-a-Service + platform, leveraging his experience in product engineering and deep understanding + of the developer community.\",\n \"url\": \"https://www.thetechoutlook.com/press-release/former-microsoft-product-leader-to-help-launch-verses-ai-developer-platform/\"\n \ }\n ],\n \"critical_factors\": {},\n \"earnings_summary\": - {},\n \"industry_summary\": [\n {\n \"headline\": \"Microsoft - AI Partnership\",\n \"publishedDate\": \"2023-11-07 10:03:30\",\n \"publisher\": - \"Gamerant\",\n \"riskCategory\": \"Competition News\",\n \"summary\": - \"Microsoft partners with Inworld AI to empower game developers with AI-driven - features for Xbox, aiming to make game development easier and push the boundaries - of gaming.\",\n \"url\": \"https://gamerant.com/microsoft-inworld-ai-partnership-for-xbox/\"\n - \ },\n {\n \"headline\": \"Namaste Credit Collaboration\",\n - \ \"publishedDate\": \"2023-11-07 20:06:49\",\n \"publisher\": - \"The Financial Express\",\n \"riskCategory\": \"Legal News\",\n \"summary\": - \"Namaste Credit partners with Microsoft Azure to introduce fraud detection - capabilities for banking, financial institutions, and the fintech industry.\",\n - \ \"url\": \"https://www.financialexpress.com/business/digital-transformation-namaste-credit-enters-into-a-collaboration-with-microsoft-azure-over-fraud-detection-solutions-3299994/\"\n - \ },\n {\n \"headline\": \"Microsoft Ignite Security\",\n - \ \"publishedDate\": \"2023-11-07 21:19:41\",\n \"publisher\": - \"Microsoft\",\n \"riskCategory\": \"Cybersecurity News\",\n \"summary\": - \"Microsoft Ignite will feature sessions on security strategies and practical - applications, with a focus on leveraging AI and Microsoft Security solutions - to strengthen threat defense. The event will also include networking opportunities - and product announcements.\",\n \"url\": \"https://www.microsoft.com/en-us/security/blog/2023/11/07/digital-security-sessions-at-microsoft-ignite-to-prepare-you-for-the-era-of-ai/\"\n - \ },\n {\n \"headline\": \"Palo Alto Talon Acquisition\",\n - \ \"publishedDate\": \"2023-11-07 21:56:49\",\n \"publisher\": - \"CFO Dive\",\n \"riskCategory\": \"Cybersecurity News\",\n \"summary\": - \"Palo Alto Networks is acquiring Israeli startup Talon Cyber Security for - $625 million, following its recent acquisition of cloud security startup Dig - Security. The acquisitions aim to enhance Palo Alto Networks' PrismaSASE service - and strengthen its presence in the Israeli cybersecurity ecosystem.\",\n \"url\": - \"https://www.cfodive.com/news/palo-alto-networks-agrees-buy-talon-cyber-security-merger-acquisition-ramp-up/698951/\"\n - \ },\n {\n \"headline\": \"Microsoft Azure Kubernetes Service\",\n - \ \"publishedDate\": \"2023-11-07 14:14:56\",\n \"publisher\": - \"SiliconANGLE\",\n \"riskCategory\": \"Competition News\",\n \"summary\": - \"Microsoft Corp. announced updates to its Azure Kubernetes Service (AKS) - at the KubeCon + CloudNativeCon NA event. The updates focus on efficiency, - scalability, networking, security, and observability. AKS now offers kube-reserved - resource optimization, artifact streaming support, Istio-based service mesh - add-on, Kubernetes event-driven autoscaling, Azure Container Storage, image - integrity feature, dual-stack support, application routing add-on, Azure Backup, - Azure Monitor for Prometheus, and Azure Monitor OpenTelemetry-based distributions.\",\n - \ \"url\": \"https://siliconangle.com/2023/11/07/microsoft-adds-ton-new-features-azure-kubernetes-service-making-efficient-scalable-secure/\"\n - \ }\n ],\n \"metadata\": {\n \"has_industry_summary\": true,\n - \ \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": - false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": - 3,\n \"n_pr_articles_with_summaries\": 0\n },\n \"pr_articles\": - [],\n \"ticker\": \"MSFT\"\n }\n]\n" + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 3,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"MSFT\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [\n {\n \"headline\": \"Microsoft\\\\'s OpenAI Inquiry\",\n \"publishedDate\": + \"2023-12-09 03:57:12\",\n \"publisher\": \"Bloomberg\",\n \"riskCategory\": + \"Financial News\",\n \"summary\": \"Microsoft's $13 billion investment + in OpenAI is being examined by global regulators for potential antitrust violations. + Microsoft argues that it doesn't control OpenAI due to an unusual investment + arrangement. Regulators in the UK and the US are gathering information to + determine if the collaboration threatens competition. Microsoft faces potential + regulatory headaches in Europe as well. The partnership raises competition + concerns if Microsoft reduces its own AI research or restricts OpenAI from + partnering with rivals.\",\n \"url\": \"https://www.bloomberg.com/news/articles/2023-12-08/microsoft-s-answer-to-openai-inquiry-it-doesn-t-own-a-stake\"\n + \ },\n {\n \"headline\": \"Amazon FTC Antitrust Lawsuit\",\n + \ \"publishedDate\": \"2023-12-09 16:02:34\",\n \"publisher\": + \"Bloomberg\",\n \"riskCategory\": \"Legal News\",\n \"summary\": + \"Amazon seeks dismissal of FTC antitrust lawsuit, arguing that the agency's + case lacks evidence of harm to consumers and fails to prove that Amazon's + practices raise prices on competing websites.\",\n \"url\": \"https://www.bloomberg.com/news/articles/2023-12-08/amazon-seeks-dismissal-of-ftc-antitrust-lawsuit\"\n + \ },\n {\n \"headline\": \"Former Microsoft Product Leader\",\n + \ \"publishedDate\": \"2023-12-09 04:09:29\",\n \"publisher\": + \"The Tech Outlook\",\n \"riskCategory\": \"Competition News\",\n \"summary\": + \"VERSES AI Inc. welcomes Peter Provost as VP of Product, Developer Platforms. + Provost brings 18 years of experience from Microsoft and will lead the strategic + development of VERSES' Intelligence-as-a-Service platform.\",\n \"url\": + \"https://www.thetechoutlook.com/press-release/former-microsoft-product-leader-to-help-launch-verses-ai-developer-platform/\"\n + \ },\n {\n \"headline\": \"Microsoft\\\\'s Partnership Controversy\",\n + \ \"publishedDate\": \"2023-12-09 12:23:13\",\n \"publisher\": + \"Digital Information World\",\n \"riskCategory\": \"Competition News\",\n + \ \"summary\": \"Microsoft's partnership with a major tech company is + causing controversy in the Software\\u2014Infrastructure industry.\",\n \"url\": + \"https://www.digitalinformationworld.com/2023/12/microsofts-much-debated-partnership.html\"\n + \ },\n {\n \"headline\": \"EU AI Act\",\n \"publishedDate\": + \"2023-12-09 18:06:52\",\n \"publisher\": \"WIRED\",\n \"riskCategory\": + \"Regulatory News\",\n \"summary\": \"The European Union has agreed + on the AI Act, a comprehensive set of rules for artificial intelligence. The + act includes bans on biometric systems, transparency requirements for AI models, + and fines for non-compliance.\",\n \"url\": \"https://www.wired.com/story/eu-ai-act/\"\n + \ }\n ],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n + \ \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 5,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Industry\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"Software\\u2014Infrastructure\"\n }\n]\n" headers: Access-Control-Allow-Origin: - '*' Connection: - keep-alive Content-Length: - - '6802' + - '6540' Content-Type: - application/json Date: - - Wed, 08 Nov 2023 13:59:33 GMT + - Mon, 11 Dec 2023 12:13:48 GMT Server: - nginx/1.18.0 (Ubuntu) status: diff --git a/openbb_platform/providers/ultima/tests/record/http/test_ultima_fetchers/test_ultima_sector_news_fetcher.yaml b/openbb_platform/providers/ultima/tests/record/http/test_ultima_fetchers/test_ultima_sector_news_fetcher.yaml new file mode 100644 index 000000000000..afb0ee05cd6c --- /dev/null +++ b/openbb_platform/providers/ultima/tests/record/http/test_ultima_fetchers/test_ultima_sector_news_fetcher.yaml @@ -0,0 +1,395 @@ +interactions: +- request: + body: null + headers: + Accept-Encoding: + - gzip, deflate + Authorization: + - Bearer MOCK_API_KEY + Connection: + - keep-alive + accept: + - application/json + method: GET + uri: https://api.ultimainsights.ai/v1/getCompaniesForSectors/Real%20Estate,%20Financial%20Services + response: + body: + string: !!binary | + H4sIAAAAAAAEAyXOWxLCIAwF0K04fLuJAGkbpTYFpHUc978N597+cMgTvkHWHu630HwmXWguFaHu + JCVjMUqCKVaFS+Po6GySEZGsygVPWxHF04HudtLWgL3GAt+Zk1bZ6yUjmbyTNjscdj1+aCmIVxHg + Kk+oJ1dsuB8fnFPlvDf2yfVVyQm1Vmcg8XrXnFadjOkpsfzYNPz+W2p4hxoBAAA= + headers: + Access-Control-Allow-Origin: + - '*' + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Type: + - text/html; charset=utf-8 + Date: + - Mon, 11 Dec 2023 12:13:48 GMT + Server: + - nginx/1.18.0 (Ubuntu) + Transfer-Encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept-Encoding: + - gzip, deflate + Authorization: + - Bearer MOCK_API_KEY + Connection: + - keep-alive + accept: + - application/json + method: GET + uri: https://api.ultimainsights.ai/v1/getOpenBBProInsights/AMT,SPG,STAG,DLR,EQR,CCI,SBAC,CBRE,HST,VTR,AVB,REG,KIM,BXP,EQIX,ESS,INVH,UDR,IRM,PLD,CPT,CSGP,VICI,WELL,MAA,PEAK,EXR,O,WY,FRT,PSA,ARE,ADC,SRG,ABR,IIPR,REFI,AFCG,JOE + response: + body: + string: "[\n {\n \"8k_filings\": [],\n \"articles\": [],\n \"critical_factors\": + {},\n \"earnings_summary\": {},\n \"industry_summary\": [],\n \"metadata\": + {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"AMT\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 0,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"SPG\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"STAG\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 0,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"DLR\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [\n {\n \"headline\": \"... purchase, Redfall and Starfield are + new intellectual properties \\u2013 a distinction that might decide how Redmond + handles future exclusives. However ...\",\n \"publishedDate\": + \"2023-12-09 15:57:06\",\n \"publisher\": \"TechSpot\",\n \"riskCategory\": + \"Competition News\",\n \"summary\": \"FTC continues fighting Microsoft-Activision + deal post-closure, raising concerns about Microsoft's potential exclusivity + with Call of Duty and other Activision Blizzard properties. This could impact + EQR's competition risk as it faces other real estate companies.\",\n \"url\": + \"https://www.techspot.com/news/101136-ftc-continues-fighting-microsoft-activision-deal-post-closure.html\"\n + \ },\n {\n \"headline\": \"... home rental property acquired + as an investment towards retirement. So, the home is sold to a large management + company that raises the rent and has ...\",\n \"publishedDate\": + \"2023-12-09 08:23:03\",\n \"publisher\": \"The Jolt News\",\n \"riskCategory\": + \"Interest Rate News, Competition News, Regulatory News, Economic News, Political + News, Financial News, Legal News\",\n \"summary\": \"Residents of Western + Plaza Mobile Home Park in Tumwater, WA, are organizing against rent hikes + imposed by Legacy Communities LLC. The company acquired the park and announced + monthly rental increases of 18%, causing concern among tenants on fixed incomes. + This article highlights the impact of rising rents on vulnerable seniors and + the efforts of Resident Action to advocate for rent caps and regulations. + EQR, as a real estate investment trust, faces similar risks related to rental + income, regulatory changes, and competition.\",\n \"url\": \"https://www.thejoltnews.com/stories/tumwater-mobile-home-tenants-lobby-against-rent-hikes,13259\"\n + \ }\n ],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 2,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"EQR\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [\n {\n \"headline\": \"Everest Infrastructure Partners and TowerCo + acquire 546 towers from Charter Communications ... Tower companies Everest + Infrastructure Partners and ...\",\n \"publishedDate\": \"2023-12-09 + 02:12:09\",\n \"publisher\": \"Data Center Dynamics\",\n \"riskCategory\": + \"Competition News\",\n \"summary\": \"Everest Infrastructure Partners + and TowerCo acquire 546 towers from Charter Communications, with Charter receiving + tower-use rights and becoming preferred fiber provider. The deal expands network + coverage and leasing activities for Everest and TowerCo.\",\n \"url\": + \"https://www.datacenterdynamics.com/en/news/everest-infrastructure-partners-and-towerco-acquire-546-towers-from-charter-communications/\"\n + \ }\n ],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 1,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"CCI\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [\n {\n \"headline\": \"Everest Infrastructure Partners and TowerCo + acquire 546 towers from Charter Communications ... Tower companies Everest + Infrastructure Partners and ...\",\n \"publishedDate\": \"2023-12-09 + 02:12:09\",\n \"publisher\": \"Data Center Dynamics\",\n \"riskCategory\": + \"Competition News\",\n \"summary\": \"SBAC's tower assets are not + involved in the acquisition of 546 wireless towers by Everest Infrastructure + Partners and TowerCo from Charter Communications.\",\n \"url\": \"https://www.datacenterdynamics.com/en/news/everest-infrastructure-partners-and-towerco-acquire-546-towers-from-charter-communications/\"\n + \ }\n ],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 1,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"SBAC\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"CBRE\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 0,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"HST\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"VTR\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [\n {\n \"headline\": \"... home rental + property acquired as an investment towards retirement. So, the home is sold + to a large management company that raises the rent and has ...\",\n \"publishedDate\": + \"2023-12-09 08:23:03\",\n \"publisher\": \"The Jolt News\",\n \"riskCategory\": + \"Real Estate\",\n \"summary\": \"Residents of Western Plaza Mobile + Home Park in Tumwater, WA, are organizing against rent hikes imposed by Legacy + Communities LLC. The company acquired the park and announced monthly rental + increases of 18%, causing concern among tenants on fixed incomes. This article + highlights the efforts of the tenant group and their push for legislative + action to address the issue. AVB, as a real estate company, may face similar + challenges related to rent increases and tenant rights.\",\n \"url\": + \"https://www.thejoltnews.com/stories/tumwater-mobile-home-tenants-lobby-against-rent-hikes,13259\"\n + \ }\n ],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 1,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"AVB\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"REG\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 0,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"KIM\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [\n {\n \"headline\": \"Dream Office REIT (. D-UN-T -3.12%decrease. + ) also has gained 26 per cent from its low. Among U.S. REITs, Boston Properties + Inc. (. BXP-N -1.25% ...\",\n \"publishedDate\": \"2023-12-09 + 08:00:29\",\n \"publisher\": \"The Globe and Mail\",\n \"riskCategory\": + \"Economic News and Financial News\",\n \"summary\": \"Office REITs + are rallying despite high vacancies, posing a threat to BXP.\",\n \"url\": + \"https://www.theglobeandmail.com/investing/markets/inside-the-market/article-office-reits-are-rallying-but-high-vacancies-are-still-a-threat/\"\n + \ }\n ],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 1,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"BXP\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"EQIX\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 0,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"ESS\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"INVH\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [\n {\n \"headline\": \"... home rental + property acquired as an investment towards retirement. So, the home is sold + to a large management company that raises the rent and has ...\",\n \"publishedDate\": + \"2023-12-09 08:23:03\",\n \"publisher\": \"The Jolt News\",\n \"riskCategory\": + \"Competition, Economic Conditions, Interest Rate News, Regulatory News, Technology + News, Reputational News, Cybersecurity News, Financial News, Legal News\",\n + \ \"summary\": \"UDR, Inc. may face regulatory risk as tenants in mobile + home communities organize against rent hikes, impacting the demand for services + and potentially affecting UDR's business. The article highlights the challenges + faced by residents of Western Plaza Mobile Home Park and their efforts to + oppose rent increases imposed by a national management company. This situation + underscores the regulatory risks UDR faces in relation to tenant rights and + ownership restrictions.\",\n \"url\": \"https://www.thejoltnews.com/stories/tumwater-mobile-home-tenants-lobby-against-rent-hikes,13259\"\n + \ }\n ],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 1,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"UDR\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"IRM\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 0,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"PLD\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [\n {\n \"headline\": \"... home rental property acquired as an + investment towards retirement. So, the home is sold to a large management + company that raises the rent and has ...\",\n \"publishedDate\": + \"2023-12-09 08:23:03\",\n \"publisher\": \"The Jolt News\",\n \"riskCategory\": + \"Interest Rate News, Economic News, Political News, Regulatory News, Competition + News, Financial News, Legal News\",\n \"summary\": \"Camden Property + Trust faces challenges as large management companies raise rents on rental + properties, potentially decreasing the pool of affordable housing. The article + highlights the impact of rent increases on seniors and the efforts of tenant + associations to advocate for rent caps and regulations. This demonstrates + the economic and regulatory risks faced by CPT.\",\n \"url\": \"https://www.thejoltnews.com/stories/tumwater-mobile-home-tenants-lobby-against-rent-hikes,13259\"\n + \ }\n ],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 1,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"CPT\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"CSGP\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 0,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"VICI\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"WELL\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [\n {\n \"headline\": \"... home rental + property acquired as an investment towards retirement. So, the home is sold + to a large management company that raises the rent and has ...\",\n \"publishedDate\": + \"2023-12-09 08:23:03\",\n \"publisher\": \"The Jolt News\",\n \"riskCategory\": + \"Competition News\",\n \"summary\": \"Residents of Western Plaza Mobile + Home Park in Tumwater, WA, are organizing against rent hikes imposed by Legacy + Communities LLC. The rent increases have alarmed tenants on fixed incomes + and sparked a collective urgency to organize opposition. Mid-America Apartment + Communities (MAA) faces Competition Risk from other apartment communities, + which can lead to higher prices, lower occupancy rates, and reduced revenue.\",\n + \ \"url\": \"https://www.thejoltnews.com/stories/tumwater-mobile-home-tenants-lobby-against-rent-hikes,13259\"\n + \ }\n ],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 1,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"MAA\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"PEAK\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 0,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"EXR\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"O\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 0,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"WY\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"FRT\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 0,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"PSA\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"ARE\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 0,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"ADC\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"SRG\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 0,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"ABR\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"IIPR\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 0,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"REFI\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n \"is_day_before_or_of_earnings\": + false,\n \"n_8k_articles_with_summaries\": 0,\n \"n_articles_with_summaries\": + 0,\n \"n_pr_articles_with_summaries\": 0,\n \"symbol_type\": \"Company\"\n + \ },\n \"pr_articles\": [],\n \"ticker\": \"AFCG\"\n },\n {\n \"8k_filings\": + [],\n \"articles\": [],\n \"critical_factors\": {},\n \"earnings_summary\": + {},\n \"industry_summary\": [],\n \"metadata\": {\n \"is_day_after_earnings\": + false,\n \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 0,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Company\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"JOE\"\n },\n {\n \"8k_filings\": [],\n \"articles\": + [],\n \"critical_factors\": {},\n \"earnings_summary\": {},\n \"industry_summary\": + [\n {\n \"headline\": \"FTC Microsoft-Activision Deal\",\n \"publishedDate\": + \"2023-12-09 15:57:06\",\n \"publisher\": \"TechSpot\",\n \"riskCategory\": + \"Competition News\",\n \"summary\": \"The US Federal Trade Commission + (FTC) continues to challenge Microsoft's acquisition of Activision Blizzard, + arguing that Microsoft could withhold Activision Blizzard content from rival + platforms. The FTC claims that Microsoft's decision to make Zenimax titles + Xbox exclusive after purchasing that company supports this concern. However, + Microsoft has made concessions to regulators and signed a deal with Sony to + keep future Call of Duty entries on PlayStation.\",\n \"url\": \"https://www.techspot.com/news/101136-ftc-continues-fighting-microsoft-activision-deal-post-closure.html\"\n + \ }\n ],\n \"metadata\": {\n \"is_day_after_earnings\": false,\n + \ \"is_day_before_or_of_earnings\": false,\n \"n_8k_articles_with_summaries\": + 0,\n \"n_articles_with_summaries\": 1,\n \"n_pr_articles_with_summaries\": + 0,\n \"symbol_type\": \"Industry\"\n },\n \"pr_articles\": [],\n + \ \"ticker\": \"REIT\\u2014Residential\"\n }\n]\n" + headers: + Access-Control-Allow-Origin: + - '*' + Connection: + - keep-alive + Content-Length: + - '26011' + Content-Type: + - application/json + Date: + - Mon, 11 Dec 2023 12:13:49 GMT + Server: + - nginx/1.18.0 (Ubuntu) + status: + code: 200 + message: OK +version: 1 From c02f54536a6f801e310a619daf1d826f9dd4359d Mon Sep 17 00:00:00 2001 From: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Date: Mon, 11 Dec 2023 16:11:00 +0100 Subject: [PATCH 03/10] Command Schema (#5874) * POC * Filter by provider * pass base_app as parameter * add typing + TODO * fix some typing * Fix unit tests --------- Co-authored-by: Diogo Sousa --- .../api/router/helpers/__init__.py | 1 + .../api/router/helpers/coverage_helpers.py | 119 ++++++++++++++++++ .../core/openbb_core/app/router.py | 6 +- .../openbb_core/app/static/app_factory.py | 2 +- .../core/openbb_core/app/static/coverage.py | 34 +++-- .../core/tests/app/static/test_coverage.py | 12 +- 6 files changed, 158 insertions(+), 16 deletions(-) create mode 100644 openbb_platform/core/openbb_core/api/router/helpers/__init__.py create mode 100644 openbb_platform/core/openbb_core/api/router/helpers/coverage_helpers.py diff --git a/openbb_platform/core/openbb_core/api/router/helpers/__init__.py b/openbb_platform/core/openbb_core/api/router/helpers/__init__.py new file mode 100644 index 000000000000..fd226e138085 --- /dev/null +++ b/openbb_platform/core/openbb_core/api/router/helpers/__init__.py @@ -0,0 +1 @@ +"""The init of the coverage helpers.""" diff --git a/openbb_platform/core/openbb_core/api/router/helpers/coverage_helpers.py b/openbb_platform/core/openbb_core/api/router/helpers/coverage_helpers.py new file mode 100644 index 000000000000..ad699cd5000d --- /dev/null +++ b/openbb_platform/core/openbb_core/api/router/helpers/coverage_helpers.py @@ -0,0 +1,119 @@ +"""Coverage API router helper functions.""" +from inspect import _empty, signature +from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Tuple, Type + +from openbb_core.app.provider_interface import ProviderInterface +from pydantic import BaseModel, Field, create_model + +if TYPE_CHECKING: + from openbb_core.app.static.app_factory import BaseApp + +provider_interface = ProviderInterface() + + +def get_route_callable(app: "BaseApp", route: str) -> Callable: + """Get the callable for a route.""" + # TODO: Add return typing Optional[Callable] to this function. First need to + # figure how to do that starting from "BaseApp" and account for the possibility + # of a route not existing. Then remove the type: ignore from the function. + + split_route = route.replace(".", "/").split("/")[1:] + + return_callable = app + + for route_path in split_route: + return_callable = getattr(return_callable, route_path) + + return return_callable # type: ignore + + +def signature_to_fields(app: "BaseApp", route: str) -> Dict[str, Tuple[Any, Field]]: # type: ignore + """Convert a command signature to pydantic fields.""" + return_callable = get_route_callable(app, route) + sig = signature(return_callable) + + fields = {} + for name, param in sig.parameters.items(): + if name not in ["kwargs", "args"]: + type_annotation = ( + param.annotation if param.annotation is not _empty else Any + ) + description = ( + param.annotation.__metadata__[0].description + if hasattr(param.annotation, "__metadata__") + else None + ) + fields[name] = ( + type_annotation, + Field(..., title="openbb", description=description), + ) + + return fields + + +def dataclass_to_fields(model_name: str) -> Dict[str, Tuple[Any, Field]]: # type: ignore + """Convert a dataclass to pydantic fields.""" + dataclass = provider_interface.params[model_name]["extra"] + fields = {} + for name, field in dataclass.__dataclass_fields__.items(): + type_annotation = field.default.annotation if field.default is not None else Any # type: ignore + description = field.default.description if field.default is not None else None # type: ignore + title = field.default.title if field.default is not None else None # type: ignore + fields[name] = ( + type_annotation, + Field(..., title=title, description=description), + ) + + return fields + + +def create_combined_model( + model_name: str, + *field_sets: Dict[str, Tuple[Any, Field]], # type: ignore + filter_by_provider: Optional[str] = None, +) -> Type[BaseModel]: + """Create a combined pydantic model.""" + combined_fields = {} + for fields in field_sets: + for name, (type_annotation, field) in fields.items(): + if ( + filter_by_provider is None + or "openbb" in field.title # type: ignore + or (filter_by_provider in field.title) # type: ignore + ): + combined_fields[name] = (type_annotation, field) + + model = create_model(model_name, **combined_fields) # type: ignore + + # # Clean up the metadata + for field in model.model_fields.values(): + if hasattr(field, "metadata"): + field.metadata = None # type: ignore + + return model + + +def get_route_schema_map( + app: "BaseApp", + command_model_map: Dict[str, str], + filter_by_provider: Optional[str] = None, +) -> Dict[str, Dict[str, Any]]: + """Get the route schema map.""" + route_schema_map = {} + for route, model in command_model_map.items(): + input_model = create_combined_model( + route, + signature_to_fields(app, route), + dataclass_to_fields(model), + filter_by_provider=filter_by_provider, + ) + output_model = provider_interface.return_schema[model] + return_callable = get_route_callable(app, route) + + route_schema_map[route] = { + "input": input_model, + "output": output_model, + "callable": return_callable, + } + + return route_schema_map diff --git a/openbb_platform/core/openbb_core/app/router.py b/openbb_platform/core/openbb_core/app/router.py index ca385ea434cb..f9a116e99506 100644 --- a/openbb_platform/core/openbb_core/app/router.py +++ b/openbb_platform/core/openbb_core/app/router.py @@ -457,7 +457,7 @@ def command_coverage(self) -> Dict[str, List[str]]: return self._command_coverage @property - def commands_model(self) -> Dict[str, List[str]]: + def commands_model(self) -> Dict[str, str]: return self._commands_model @staticmethod @@ -526,9 +526,7 @@ def get_command_coverage( return coverage_map @staticmethod - def get_commands_model( - router: Router, sep: Optional[str] = None - ) -> Dict[str, List[str]]: + def get_commands_model(router: Router, sep: Optional[str] = None) -> Dict[str, str]: api_router = router.api_router coverage_map: Dict[Any, Any] = {} diff --git a/openbb_platform/core/openbb_core/app/static/app_factory.py b/openbb_platform/core/openbb_core/app/static/app_factory.py index dbf8f7d0da0c..82172177a402 100644 --- a/openbb_platform/core/openbb_core/app/static/app_factory.py +++ b/openbb_platform/core/openbb_core/app/static/app_factory.py @@ -26,7 +26,7 @@ class BaseApp: def __init__(self, command_runner: CommandRunner): self._command_runner = command_runner self._account = Account(self) - self._coverage = Coverage() + self._coverage = Coverage(self) @property def account(self) -> Account: diff --git a/openbb_platform/core/openbb_core/app/static/coverage.py b/openbb_platform/core/openbb_core/app/static/coverage.py index 89d01a73d514..2c219b9823bd 100644 --- a/openbb_platform/core/openbb_core/app/static/coverage.py +++ b/openbb_platform/core/openbb_core/app/static/coverage.py @@ -1,18 +1,28 @@ """Coverage module.""" +from typing import TYPE_CHECKING, Any, Dict, List, Optional + +from openbb_core.api.router.helpers.coverage_helpers import get_route_schema_map from openbb_core.app.provider_interface import ProviderInterface from openbb_core.app.router import CommandMap +if TYPE_CHECKING: + from openbb_core.app.static.app_factory import BaseApp + class Coverage: - """/coverage + """Coverage class. - providers - commands - command_model + /coverage + + providers + commands + command_model + command_schemas """ - def __init__(self): + def __init__(self, app: "BaseApp"): """Initialize coverage.""" + self._app = app self._command_map = CommandMap(coverage_sep=".") self._provider_interface = ProviderInterface() @@ -21,21 +31,27 @@ def __repr__(self) -> str: return self.__doc__ or "" @property - def providers(self): + def providers(self) -> Dict[str, List[str]]: """Return providers coverage.""" return self._command_map.provider_coverage @property - def commands(self): + def commands(self) -> Dict[str, List[str]]: """Return commands coverage.""" return self._command_map.command_coverage @property - def command_model(self): + def command_model(self) -> Dict[str, Dict[str, Dict[str, Dict[str, Any]]]]: """Return command to model mapping.""" return { command: self._provider_interface.map[ self._command_map.commands_model[command] ] - for command in self._command_map.commands_model # pylint: disable=C0206 + for command in self._command_map.commands_model } + + def command_schemas(self, filter_by_provider: Optional[str] = None): + """Return route schema for a command.""" + return get_route_schema_map( + self._app, self._command_map.commands_model, filter_by_provider + ) diff --git a/openbb_platform/core/tests/app/static/test_coverage.py b/openbb_platform/core/tests/app/static/test_coverage.py index 2131d24cefbf..15bc7a0b3eae 100644 --- a/openbb_platform/core/tests/app/static/test_coverage.py +++ b/openbb_platform/core/tests/app/static/test_coverage.py @@ -2,13 +2,21 @@ # pylint: disable=redefined-outer-name import pytest +from openbb_core.app.command_runner import CommandRunner +from openbb_core.app.static.app_factory import BaseApp from openbb_core.app.static.coverage import Coverage @pytest.fixture(scope="module") -def coverage(): +def app(): + """Return a BaseApp instance.""" + return BaseApp(command_runner=CommandRunner()) + + +@pytest.fixture(scope="module") +def coverage(app): """Return coverage.""" - return Coverage() + return Coverage(app) # Pass the BaseApp instance to Coverage def test_coverage_init(coverage): From fce63afa6cfe73b0fc947f795f2d84aae0491e9b Mon Sep 17 00:00:00 2001 From: Henrique Joaquim Date: Mon, 11 Dec 2023 15:27:58 +0000 Subject: [PATCH 04/10] Parameterize `obbject.to_df` with `index` and `sort_by` (#5877) * Parameterize obbject.to_df with index and sort_by * unit tests for obbject * keep using the date as default to use on basemode_to_df() --------- Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> --- .../core/openbb_core/app/model/obbject.py | 41 +++++++++++++++---- .../core/tests/app/model/test_obbject.py | 39 +++++++++++++++++- 2 files changed, 70 insertions(+), 10 deletions(-) diff --git a/openbb_platform/core/openbb_core/app/model/obbject.py b/openbb_platform/core/openbb_core/app/model/obbject.py index e66adb35dbde..edc21defc845 100644 --- a/openbb_platform/core/openbb_core/app/model/obbject.py +++ b/openbb_platform/core/openbb_core/app/model/obbject.py @@ -11,6 +11,7 @@ Optional, Set, TypeVar, + Union, ) import pandas as pd @@ -24,6 +25,7 @@ from openbb_core.app.provider_interface import ProviderInterface from openbb_core.app.query import Query from openbb_core.app.utils import basemodel_to_df +from openbb_core.provider.abstract.data import Data if TYPE_CHECKING: try: @@ -89,11 +91,15 @@ def model_parametrized_name(cls, params: Any) -> str: """Return the model name with the parameters.""" return f"OBBject[{cls.results_type_repr(params)}]" - def to_df(self) -> pd.DataFrame: + def to_df( + self, index: Optional[str] = None, sort_by: Optional[str] = None + ) -> pd.DataFrame: """Alias for `to_dataframe`.""" - return self.to_dataframe() + return self.to_dataframe(index=index, sort_by=sort_by) - def to_dataframe(self) -> pd.DataFrame: + def to_dataframe( + self, index: Optional[str] = None, sort_by: Optional[str] = None + ) -> pd.DataFrame: """Convert results field to pandas dataframe. Supports converting creating pandas DataFrames from the following @@ -109,18 +115,25 @@ def to_dataframe(self) -> pd.DataFrame: - Dict[str, List] - Dict[str, BaseModel] + Parameters + ---------- + index : Optional[str] + Column name to use as index. + sort_by : Optional[str] + Column name to sort by. + Returns ------- pd.DataFrame Pandas dataframe. """ - def is_list_of_basemodel(items: List[Any]) -> bool: + def is_list_of_basemodel(items: Union[List[T], T]) -> bool: return isinstance(items, list) and all( isinstance(item, BaseModel) for item in items ) - if self.results is None or self.results == []: + if self.results is None or not self.results: raise OpenBBError("Results not found.") if isinstance(self.results, pd.DataFrame): @@ -139,7 +152,7 @@ def is_list_of_basemodel(items: List[Any]) -> bool: for k, v in r.items(): # Dict[str, List[BaseModel]] if is_list_of_basemodel(v): - dict_of_df[k] = basemodel_to_df(v, "date") + dict_of_df[k] = basemodel_to_df(v, index or "date") sort_columns = False # Dict[str, Any] else: @@ -149,12 +162,17 @@ def is_list_of_basemodel(items: List[Any]) -> bool: # List[BaseModel] elif is_list_of_basemodel(res): - df = basemodel_to_df(res, "date") + dt: Union[List[Data], Data] = res # type: ignore + df = basemodel_to_df(dt, index or "date") sort_columns = False # List[List | str | int | float] | Dict[str, Dict | List | BaseModel] else: try: df = pd.DataFrame(res) + # Set index, if any + if index and index in df.columns: + df.set_index(index, inplace=True) + except ValueError: if isinstance(res, dict): df = pd.DataFrame([res]) @@ -167,6 +185,10 @@ def is_list_of_basemodel(items: List[Any]) -> bool: df.sort_index(axis=1, inplace=True) df = df.dropna(axis=1, how="all") + # Sort by specified column + if sort_by: + df.sort_values(by=sort_by, inplace=True) + except OpenBBError as e: raise e except ValueError as ve: @@ -223,7 +245,8 @@ def to_dict( if not isinstance(self.results, dict): transpose = False else: # Only enter the loop if self.results is a dictionary - for key, value in self.results.items(): + self.results: Dict[str, Any] = self.results # type: ignore + for _, value in self.results.items(): if not isinstance(value, dict): transpose = False break @@ -237,6 +260,7 @@ def to_dict( def to_chart(self, **kwargs): """ Create or update the `Chart`. + This function assumes that the provided data is a time series, if it's not, it will most likely result in an Exception. @@ -287,5 +311,4 @@ async def from_query(cls, query: Query) -> "OBBject": OBBject[ResultsType] OBBject with results. """ - return cls(results=await query.execute()) diff --git a/openbb_platform/core/tests/app/model/test_obbject.py b/openbb_platform/core/tests/app/model/test_obbject.py index 686ac901c34c..ec7ac75b1aa4 100644 --- a/openbb_platform/core/tests/app/model/test_obbject.py +++ b/openbb_platform/core/tests/app/model/test_obbject.py @@ -16,7 +16,7 @@ def test_OBBject(): def test_fields(): """Smoke test.""" - fields = OBBject.__fields__.keys() + fields = OBBject.model_fields.keys() assert "results" in fields assert "provider" in fields @@ -218,6 +218,43 @@ def test_to_dataframe(results, expected_df): assert str(exc_info.value) == str(expected_df) +@pytest.mark.parametrize( + "results, index, sort_by", + [ + # Test case 1: Normal results with "date" column + ( + [{"date": "2023-07-30", "value": 10}, {"date": "2023-07-31", "value": 20}], + "date", + "value", + ), + # Test case 2: List of Data + ( + [ + MockData(x=0, y=2), + MockData(x=1, y=3), + MockData(x=2, y=0), + MockData(x=3, y=1), + MockData(x=4, y=6), + ], + "x", + "y", + ), + ], +) +def test_to_dataframe_w_args(results, index, sort_by): + """Test helper.""" + # Arrange + co = OBBject(results=results) + + # Act and Assert + result = co.to_dataframe(index=index, sort_by=sort_by) + assert isinstance(result, pd.DataFrame) + assert result.index.name == index + + # check if dataframe is properly sorted + assert result[sort_by].is_monotonic_increasing + + @pytest.mark.parametrize( "results, expected_dict", [ # Case 1: Normal results with "date" column From e7a06085b3657b7eae12538039d149c7aaa08ff7 Mon Sep 17 00:00:00 2001 From: Henrique Joaquim Date: Mon, 11 Dec 2023 18:44:51 +0000 Subject: [PATCH 05/10] Changes to the `obb.fixedincome.corporate.hqm()` output (#5876) * changes to the hqm output * typo --------- Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> --- .github/pull_request_template.md | 2 +- .../providers/fred/openbb_fred/models/hqm.py | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 1c5145873d6a..3df72068a852 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -74,7 +74,7 @@ - [ ] I have performed a self-review of my own code. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have adhered to the GitFlow naming convention and my branch name is in the format of `feature/feature-name` or `hotfix/hotfix-name`. -- [ ] I ensure that I am following th [CONTRIBUTING guidelines](https://github.com/OpenBB-finance/OpenBBTerminal/blob/main/CONTRIBUTING.md). +- [ ] I ensure that I am following the [CONTRIBUTING guidelines](https://github.com/OpenBB-finance/OpenBBTerminal/blob/main/CONTRIBUTING.md). - [ ] (If applicable) I have updated tests following [these guidelines](/openbb_platform/CONTRIBUTING.md#qa-your-extension). diff --git a/openbb_platform/providers/fred/openbb_fred/models/hqm.py b/openbb_platform/providers/fred/openbb_fred/models/hqm.py index b7c98ea836ef..c410b6d00803 100644 --- a/openbb_platform/providers/fred/openbb_fred/models/hqm.py +++ b/openbb_platform/providers/fred/openbb_fred/models/hqm.py @@ -14,7 +14,7 @@ YIELD_CURVE_SERIES_CORPORATE_PAR, YIELD_CURVE_SERIES_CORPORATE_SPOT, ) -from pydantic import field_validator +from pydantic import Field, field_validator class FREDHighQualityMarketCorporateBondQueryParams( @@ -28,6 +28,8 @@ class FREDHighQualityMarketCorporateBondData(HighQualityMarketCorporateBondData) __alias_dict__ = {"rate": "value"} + series_id: str = Field(description="FRED series id.") + @field_validator("rate", mode="before", check_fields=False) @classmethod def value_validate(cls, v): @@ -88,10 +90,15 @@ def extract_data( start_date=start_date, **kwargs, ) - for item in d: - item["maturity"] = maturity - item["yield_curve"] = query.yield_curve - data.extend(d) + for observation in d: + series_data = { + "series_id": id_, + "maturity": maturity, + "yield_curve": query.yield_curve, + "date": observation["date"], + "value": observation["value"], + } + data.append(series_data) return data From 6918ab14d406785952cf625a73e2aee419c09861 Mon Sep 17 00:00:00 2001 From: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Date: Tue, 12 Dec 2023 09:30:50 +0000 Subject: [PATCH 06/10] Refactor method in RegistryMap (#5879) * refactor extract_info * add comment --------- Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> --- .../core/openbb_core/provider/registry_map.py | 68 +++++++++++-------- 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/openbb_platform/core/openbb_core/provider/registry_map.py b/openbb_platform/core/openbb_core/provider/registry_map.py index 2a82f73531a2..ab035b5fe92f 100644 --- a/openbb_platform/core/openbb_core/provider/registry_map.py +++ b/openbb_platform/core/openbb_core/provider/registry_map.py @@ -1,7 +1,7 @@ """Provider registry map.""" -import os from inspect import getfile, isclass +from pathlib import Path from typing import Any, Dict, List, Literal, Optional, Tuple, Union, get_origin from pydantic import BaseModel @@ -13,6 +13,9 @@ MapType = Dict[str, Dict[str, Dict[str, Dict[str, Any]]]] +STANDARD_MODELS_FOLDER = Path(__file__).parent / "standard_models" +SKIP = {"object", "Representation", "BaseModel", "QueryParams", "Data"} + class RegistryMap: """Class to store information about providers in the registry.""" @@ -95,7 +98,7 @@ def _get_map(self, registry: Registry) -> Tuple[MapType, MapType]: if union_return_map.get(model_name, None) is None and get_origin( return_type ) != get_origin(in_return_map): - union_return_map[model_name] = Union[in_return_map, return_type] + union_return_map[model_name] = Union[in_return_map, return_type] # type: ignore return_map[model_name] = return_type @@ -111,40 +114,35 @@ def _get_models(self, map_: MapType) -> List[str]: @staticmethod def extract_info(fetcher: Fetcher, type_: Literal["query_params", "data"]) -> tuple: """Extract info (fields and docstring) from fetcher query params or data.""" - super_model: BaseModel = getattr(fetcher, f"{type_}_type") - RegistryMap.validate_model(super_model, type_) - - skip_classes = {"object", "Representation", "BaseModel", "QueryParams", "Data"} - inheritance_list: List[BaseModel] = [ - model for model in super_model.__mro__ if model.__name__ not in skip_classes - ] - + model: BaseModel = RegistryMap._get_model(fetcher, type_) all_fields = {} alias_dict: Dict[str, List[str]] = {} standard_info: Dict[str, Any] = {"fields": {}, "docstring": None} - found_standard = False - - for model in inheritance_list: - model_file_dir = os.path.dirname(getfile(model)) - model_name = os.path.basename(model_file_dir) - - if (model_name == "standard_models") or found_standard: - if not found_standard: - standard_info["docstring"] = model.__doc__ - found_standard = True - standard_info["fields"].update(model.model_fields) + found_top_level = False + + for c in RegistryMap._class_hierarchy(model): + if c.__name__ in SKIP: + continue + if (Path(getfile(c)).parent == STANDARD_MODELS_FOLDER) or found_top_level: + if not found_top_level: + # We might update the standard_info more than once to account for + # nested standard models, but we only want to update the docstring + # once with the __doc__ of the top-level standard model. + standard_info["docstring"] = c.__doc__ + found_top_level = True + standard_info["fields"].update(c.model_fields) else: - all_fields.update(model.model_fields) - if hasattr(model, "__alias_dict__"): - for name, alias in getattr(model, "__alias_dict__").items(): - alias_dict.setdefault(name, []).append(alias) + all_fields.update(c.model_fields) + for name, alias in getattr(c, "__alias_dict__", {}).items(): + alias_dict.setdefault(name, []).append(alias) - extra_info = { + extra_info: Dict[str, Any] = { "fields": {}, - "docstring": super_model.__doc__, + "docstring": model.__doc__, "alias_dict": alias_dict, } + # We ignore fields that are already in the standard model for name, field in all_fields.items(): if name not in standard_info["fields"]: extra_info["fields"][name] = field @@ -157,7 +155,16 @@ def extract_return_type(fetcher: Fetcher): return getattr(fetcher, "return_type", None) @staticmethod - def validate_model(model: Any, type_: Literal["query_params", "data"]): + def _get_model( + fetcher: Fetcher, type_: Literal["query_params", "data"] + ) -> BaseModel: + """Get model from fetcher.""" + model = getattr(fetcher, f"{type_}_type") + RegistryMap._validate(model, type_) + return model + + @staticmethod + def _validate(model: Any, type_: Literal["query_params", "data"]) -> None: """Validate model.""" parent_model = QueryParams if type_ == "query_params" else Data if not isclass(model) or not issubclass(model, parent_model): @@ -167,3 +174,8 @@ def validate_model(model: Any, type_: Literal["query_params", "data"]): "If you are returning a nested type, try specifying" f" `{type_}_type = <'your_{type_}_type'>` in the fetcher." ) + + @staticmethod + def _class_hierarchy(class_) -> tuple: + """Return the class hierarchy starting with the class itself until `object`.""" + return getattr(class_, "__mro__", ()) From 704c2d82dea6375029c0f47f877165198f4d47f4 Mon Sep 17 00:00:00 2001 From: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Date: Tue, 12 Dec 2023 15:50:32 +0000 Subject: [PATCH 07/10] remove Literal from providers in OBBject (#5882) Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> --- openbb_platform/core/openbb_core/app/model/obbject.py | 4 +--- .../core/openbb_core/app/static/package_builder.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/openbb_platform/core/openbb_core/app/model/obbject.py b/openbb_platform/core/openbb_core/app/model/obbject.py index edc21defc845..36c2ec8cf58b 100644 --- a/openbb_platform/core/openbb_core/app/model/obbject.py +++ b/openbb_platform/core/openbb_core/app/model/obbject.py @@ -22,7 +22,6 @@ from openbb_core.app.model.abstract.tagged import Tagged from openbb_core.app.model.abstract.warning import Warning_ from openbb_core.app.model.charts.chart import Chart -from openbb_core.app.provider_interface import ProviderInterface from openbb_core.app.query import Query from openbb_core.app.utils import basemodel_to_df from openbb_core.provider.abstract.data import Data @@ -34,7 +33,6 @@ PolarsDataFrame = None T = TypeVar("T") -PROVIDERS = Literal[tuple(ProviderInterface().available_providers)] # type: ignore class OBBject(Tagged, Generic[T]): @@ -44,7 +42,7 @@ class OBBject(Tagged, Generic[T]): default=None, description="Serializable results.", ) - provider: Optional[PROVIDERS] = Field( # type: ignore + provider: Optional[str] = Field( # type: ignore default=None, description="Provider name.", ) diff --git a/openbb_platform/core/openbb_core/app/static/package_builder.py b/openbb_platform/core/openbb_core/app/static/package_builder.py index f664378f8147..f58beeca688d 100644 --- a/openbb_platform/core/openbb_core/app/static/package_builder.py +++ b/openbb_platform/core/openbb_core/app/static/package_builder.py @@ -371,7 +371,7 @@ class DocstringGenerator: @staticmethod def get_OBBject_description(results_type: str, providers: Optional[str]) -> str: """Get the command output description.""" - available_providers = providers or "Optional[PROVIDERS]" + available_providers = providers or "Optional[str]" obbject_description = ( "OBBject\n" From 40f3de132a006dd09f3aba5b74aa9a8179b3414f Mon Sep 17 00:00:00 2001 From: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Date: Wed, 13 Dec 2023 10:54:32 +0100 Subject: [PATCH 08/10] Fix version (#5883) * Fix version * Fix linter on terminal --- openbb_platform/core/openbb_core/app/version.py | 12 ++++++++++-- openbb_terminal/stocks/stocks_helper.py | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/openbb_platform/core/openbb_core/app/version.py b/openbb_platform/core/openbb_core/app/version.py index c53858bf55a8..3294ba4a385f 100644 --- a/openbb_platform/core/openbb_core/app/version.py +++ b/openbb_platform/core/openbb_core/app/version.py @@ -16,7 +16,12 @@ def get_package_version(package: str): except pkg_resources.DistributionNotFound: package += "-nightly" is_nightly = True - version = pkg_resources.get_distribution(package).version + try: + version = pkg_resources.get_distribution(package).version + except pkg_resources.DistributionNotFound: + package = "openbb-core" + version = pkg_resources.get_distribution(package).version + version += "core" if is_git_repo(Path(__file__).parent.resolve()) and not is_nightly: version += "dev" @@ -42,4 +47,7 @@ def is_git_repo(path: Path): return False -VERSION = get_package_version(PACKAGE) +try: + VERSION = get_package_version(PACKAGE) +except pkg_resources.DistributionNotFound: + VERSION = "unknown" diff --git a/openbb_terminal/stocks/stocks_helper.py b/openbb_terminal/stocks/stocks_helper.py index dff393794f66..1143235a77ee 100644 --- a/openbb_terminal/stocks/stocks_helper.py +++ b/openbb_terminal/stocks/stocks_helper.py @@ -4,7 +4,7 @@ # pylint: disable=no-member, too-many-branches, too-many-arguments # pylint: disable=inconsistent-return-statements # pylint: disable=consider-using-dict-items - +# pylint: disable=too-many-lines import logging import os from copy import deepcopy From bcb1f50b05dc9ce2f8900cda110b4663e2bd0cfa Mon Sep 17 00:00:00 2001 From: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Date: Wed, 13 Dec 2023 12:13:43 +0000 Subject: [PATCH 09/10] Refactor package builder (#5880) * breakdown builder + remove black * rebuild * rebuild * rebuild * rename method * format built code without black * we still lint if it's available * fix existing tests * add linter tests * add black to dev deps * auto_build as instance method * reorder methods * typing --------- Co-authored-by: Henrique Joaquim --- .../core/openbb_core/app/static/account.py | 8 +- .../openbb_core/app/static/build_utils.py | 98 -- .../core/openbb_core/app/static/container.py | 6 +- .../openbb_core/app/static/package_builder.py | 1034 +++++++++-------- .../openbb_core/app/static/utils/console.py | 15 + .../app/static/{ => utils}/decorators.py | 0 .../app/static/{ => utils}/filters.py | 0 .../openbb_core/app/static/utils/linters.py | 59 + openbb_platform/core/poetry.lock | 306 ++--- openbb_platform/core/pyproject.toml | 2 +- .../core/tests/app/static/test_build_utils.py | 136 --- .../core/tests/app/static/test_filters.py | 2 +- .../tests/app/static/test_package_builder.py | 187 ++- .../tests/app/static/utils/test_linters.py | 43 + openbb_platform/openbb/__init__.py | 12 +- .../openbb/package/__extensions__.py | 31 +- openbb_platform/openbb/package/crypto.py | 32 +- .../openbb/package/crypto_price.py | 31 +- openbb_platform/openbb/package/currency.py | 28 +- .../openbb/package/currency_price.py | 31 +- openbb_platform/openbb/package/derivatives.py | 3 +- .../openbb/package/derivatives_options.py | 49 +- openbb_platform/openbb/package/economy.py | 312 +++-- openbb_platform/openbb/package/economy_gdp.py | 87 +- openbb_platform/openbb/package/equity.py | 132 ++- .../openbb/package/equity_calendar.py | 105 +- .../openbb/package/equity_compare.py | 27 +- .../openbb/package/equity_discovery.py | 35 +- .../openbb/package/equity_estimates.py | 75 +- .../openbb/package/equity_fundamental.py | 597 +++++----- .../openbb/package/equity_ownership.py | 99 +- .../openbb/package/equity_price.py | 99 +- .../openbb/package/equity_shorts.py | 27 +- openbb_platform/openbb/package/etf.py | 458 +++++--- openbb_platform/openbb/package/fixedincome.py | 125 +- .../openbb/package/fixedincome_corporate.py | 607 +++++----- .../openbb/package/fixedincome_government.py | 55 +- .../openbb/package/fixedincome_rate.py | 891 +++++++------- .../openbb/package/fixedincome_spreads.py | 337 +++--- openbb_platform/openbb/package/index.py | 73 +- openbb_platform/openbb/package/news.py | 53 +- openbb_platform/openbb/package/regulators.py | 3 +- .../openbb/package/regulators_sec.py | 135 +-- 43 files changed, 3187 insertions(+), 3258 deletions(-) delete mode 100644 openbb_platform/core/openbb_core/app/static/build_utils.py create mode 100644 openbb_platform/core/openbb_core/app/static/utils/console.py rename openbb_platform/core/openbb_core/app/static/{ => utils}/decorators.py (100%) rename openbb_platform/core/openbb_core/app/static/{ => utils}/filters.py (100%) create mode 100644 openbb_platform/core/openbb_core/app/static/utils/linters.py delete mode 100644 openbb_platform/core/tests/app/static/test_build_utils.py create mode 100644 openbb_platform/core/tests/app/static/utils/test_linters.py diff --git a/openbb_platform/core/openbb_core/app/static/account.py b/openbb_platform/core/openbb_core/app/static/account.py index 7507185a2af0..15bf03c38c7e 100644 --- a/openbb_platform/core/openbb_core/app/static/account.py +++ b/openbb_platform/core/openbb_core/app/static/account.py @@ -114,7 +114,7 @@ def login( Returns ------- - UserSettings + Optional[UserSettings] User settings: profile, credentials, preferences """ hs = self._create_hub_service(email, password, pat) @@ -145,7 +145,7 @@ def save(self, return_settings: bool = False) -> Optional[UserSettings]: Returns ------- - UserSettings + Optional[UserSettings] User settings: profile, credentials, preferences """ hub_session = self._base_app._command_runner.user_settings.profile.hub_session @@ -172,7 +172,7 @@ def refresh(self, return_settings: bool = False) -> Optional[UserSettings]: Returns ------- - UserSettings + Optional[UserSettings] User settings: profile, credentials, preferences """ hub_session = self._base_app._command_runner.user_settings.profile.hub_session @@ -202,7 +202,7 @@ def logout(self, return_settings: bool = False) -> Optional[UserSettings]: Returns ------- - UserSettings + Optional[UserSettings] User settings: profile, credentials, preferences """ hub_session = self._base_app._command_runner.user_settings.profile.hub_session diff --git a/openbb_platform/core/openbb_core/app/static/build_utils.py b/openbb_platform/core/openbb_core/app/static/build_utils.py deleted file mode 100644 index 4206cd1a9c10..000000000000 --- a/openbb_platform/core/openbb_core/app/static/build_utils.py +++ /dev/null @@ -1,98 +0,0 @@ -from json import load -from pathlib import Path -from typing import List, Optional, Set, Tuple, Union - -from importlib_metadata import entry_points - -from openbb_core.app.static.package_builder import PackageBuilder -from openbb_core.env import Env - - -def get_ext_map(package: Path) -> dict: - """Get extension map from package folder""" - ext_map_file = Path(package, "extension_map.json") - try: - with open(ext_map_file) as fp: - ext_map = load(fp) - except Exception: - ext_map = {} - - return ext_map - - -def package_diff(package: Path) -> Tuple[Set[str], Set[str]]: - """Check differences between built and installed extensions. - - Parameters - ---------- - package: Path - The path to the package - - Returns - ------- - Tuple[Set[str], Set[str]] - First element: set of installed extensions that are not in the package. - Second element: set of extensions in the package that are not installed. - """ - - ext_map = get_ext_map(package) - - add: Set[str] = set() - remove: Set[str] = set() - groups = ("openbb_core_extension", "openbb_provider_extension") - for g in groups: - built = set(ext_map.get(g, {})) - installed = set( - f"{e.name}@{getattr(e.dist, 'version', '')}" for e in entry_points(group=g) - ) - add = add.union(installed - built) - remove = remove.union(built - installed) - - return add, remove - - -def build( - directory: Path, - modules: Optional[Union[str, List[str]]] = None, - lint: bool = True, - verbose: bool = False, -) -> None: - """Build extension modules in a separate process. - - Parameters - ---------- - directory: Path - The path of directory where package lives - modules : Optional[List[str]], optional - The modules to rebuild, by default None - For example: "/news" or ["/news", "/crypto"] - If None, all modules are rebuilt. - lint : bool, optional - Whether to lint the code, by default True - verbose : bool, optional - Enable/disable verbose mode - """ - PackageBuilder(directory, lint, verbose).build(modules) - - -def auto_build(directory: Path): - """Trigger build if there are differences between built and installed extensions. - - Parameters - ---------- - directory: Path - The path of directory where package lives - """ - if Env().AUTO_BUILD: - add, remove = package_diff(Path(directory, "package")) - if add: - a = ", ".join(add) - print(f"Extensions to add: {a}") # noqa: T201 - - if remove: - r = ", ".join(remove) - print(f"Extensions to remove: {r}") # noqa: T201 - - if add or remove: - print("\nBuilding...") # noqa: T201 - build(directory) diff --git a/openbb_platform/core/openbb_core/app/static/container.py b/openbb_platform/core/openbb_core/app/static/container.py index f5619183c95f..c74a7702e6d0 100644 --- a/openbb_platform/core/openbb_core/app/static/container.py +++ b/openbb_platform/core/openbb_core/app/static/container.py @@ -1,7 +1,5 @@ """Container class.""" -from typing import Union - -import pandas as pd +from typing import Any from openbb_core.app.command_runner import CommandRunner from openbb_core.app.model.obbject import OBBject @@ -14,7 +12,7 @@ def __init__(self, command_runner: CommandRunner) -> None: self._command_runner = command_runner OBBject._credentials = command_runner.user_settings.credentials - def _run(self, *args, **kwargs) -> Union[OBBject, pd.DataFrame, dict]: + def _run(self, *args, **kwargs) -> Any: """Run a command in the container.""" obbject = self._command_runner.sync_run(*args, **kwargs) output_type = self._command_runner.user_settings.preferences.output_type diff --git a/openbb_platform/core/openbb_core/app/static/package_builder.py b/openbb_platform/core/openbb_core/app/static/package_builder.py index f58beeca688d..0773bc8f8cfa 100644 --- a/openbb_platform/core/openbb_core/app/static/package_builder.py +++ b/openbb_platform/core/openbb_core/app/static/package_builder.py @@ -3,10 +3,9 @@ import builtins import inspect import shutil -import subprocess import sys from inspect import Parameter, _empty, isclass, signature -from json import dumps +from json import dumps, load from pathlib import Path from typing import ( Any, @@ -16,6 +15,8 @@ Literal, Optional, OrderedDict, + Set, + Tuple, Type, TypeVar, Union, @@ -36,6 +37,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.provider_interface import ProviderInterface from openbb_core.app.router import CommandMap, RouterLoader +from openbb_core.app.static.utils.console import Console +from openbb_core.app.static.utils.linters import Linters from openbb_core.env import Env from openbb_core.provider.abstract.data import Data @@ -52,19 +55,6 @@ ) -class Console: - """Console to be used by builder and linters.""" - - def __init__(self, verbose: bool): - """Initialize the console.""" - self.verbose = verbose - - def log(self, message: str, **kwargs): - """Console log method.""" - if self.verbose or Env().DEBUG_MODE: - print(message, **kwargs) # noqa: T201 - - class PackageBuilder: """Build the extension package for the Platform.""" @@ -77,15 +67,21 @@ def __init__( self.verbose = verbose self.console = Console(verbose) - def clean_package(self, modules: Optional[Union[str, List[str]]] = None) -> None: - """Delete the package folder or modules before building.""" - if modules: - for module in modules: - module_path = self.directory / "package" / f"{module}.py" - if module_path.exists(): - module_path.unlink() - else: - shutil.rmtree(self.directory / "package", ignore_errors=True) + def auto_build(self) -> None: + """Trigger build if there are differences between built and installed extensions.""" + if Env().AUTO_BUILD: + add, remove = PackageBuilder._diff(self.directory / "package") + if add: + a = ", ".join(add) + print(f"Extensions to add: {a}") # noqa: T201 + + if remove: + r = ", ".join(remove) + print(f"Extensions to remove: {r}") # noqa: T201 + + if add or remove: + print("\nBuilding...") # noqa: T201 + self.build() def build( self, @@ -93,16 +89,26 @@ def build( ) -> None: """Build the extensions for the Platform.""" self.console.log("\nBuilding extensions package...\n") - self.clean_package(modules) - ext_map = self.get_extension_map() - self.save_extension_map(ext_map) - self.save_module_map() - self.save_modules(modules, ext_map) - self.save_package() + self._clean_package(modules) + ext_map = self._get_extension_map() + self._save_extension_map(ext_map) + self._save_module_map() + self._save_modules(modules, ext_map) + self._save_package() if self.lint: - self.run_linters() + self._run_linters() + + def _clean_package(self, modules: Optional[Union[str, List[str]]] = None) -> None: + """Delete the package folder or modules before building.""" + if modules: + for module in modules: + module_path = self.directory / "package" / f"{module}.py" + if module_path.exists(): + module_path.unlink() + else: + shutil.rmtree(self.directory / "package", ignore_errors=True) - def get_extension_map(self) -> Dict[str, List[str]]: + def _get_extension_map(self) -> Dict[str, List[str]]: """Get map of extensions available at build time.""" groups = ("openbb_core_extension", "openbb_provider_extension") ext_map = { @@ -116,13 +122,13 @@ def get_extension_map(self) -> Dict[str, List[str]]: } return ext_map - def save_extension_map(self, ext_map: Dict[str, List[str]]) -> None: + def _save_extension_map(self, ext_map: Dict[str, List[str]]) -> None: """Save the map of extensions available at build time.""" code = dumps(obj=dict(sorted(ext_map.items())), indent=4) self.console.log("Writing extension map...") - self.write_to_package(code=code, name="extension_map", extension="json") + self._write(code=code, name="extension_map", extension="json") - def save_module_map(self): + def _save_module_map(self): """Save the module map.""" route_map = PathHandler.build_route_map() path_list = PathHandler.build_path_list(route_map=route_map) @@ -131,9 +137,9 @@ def save_module_map(self): } code = dumps(obj=dict(sorted(module_map.items())), indent=4) self.console.log("\nWriting module map...") - self.write_to_package(code=code, name="module_map", extension="json") + self._write(code=code, name="module_map", extension="json") - def save_modules( + def _save_modules( self, modules: Optional[Union[str, List[str]]] = None, ext_map: Optional[Dict[str, List[str]]] = None, @@ -161,22 +167,22 @@ def save_modules( ) module_name = PathHandler.build_module_name(path=path) self.console.log(f"({path})", end=" " * (MAX_LEN - len(path))) - self.write_to_package(code=module_code, name=module_name) + self._write(code=module_code, name=module_name) - def save_package(self): + def _save_package(self): """Save the package.""" self.console.log("\nWriting package __init__...") code = "### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###\n" - self.write_to_package(code=code, name="__init__") + self._write(code=code, name="__init__") - def run_linters(self): + def _run_linters(self): """Run the linters.""" self.console.log("\nRunning linters...") linters = Linters(self.directory / "package", self.verbose) linters.ruff() linters.black() - def write_to_package(self, code: str, name: str, extension="py") -> None: + def _write(self, code: str, name: str, extension="py") -> None: """Write the module to the package.""" package_folder = self.directory / "package" package_path = package_folder / f"{name}.{extension}" @@ -187,6 +193,49 @@ def write_to_package(self, code: str, name: str, extension="py") -> None: with package_path.open("w", encoding="utf-8", newline="\n") as file: file.write(code.replace("typing.", "")) + @staticmethod + def _read_extension_map(package: Path) -> dict: + """Get extension map from package folder.""" + ext_map_file = Path(package, "extension_map.json") + try: + with open(ext_map_file) as fp: + ext_map = load(fp) + except Exception: + ext_map = {} + + return ext_map + + @staticmethod + def _diff(package: Path) -> Tuple[Set[str], Set[str]]: + """Check differences between built and installed extensions. + + Parameters + ---------- + package: Path + The path to the package + + Returns + ------- + Tuple[Set[str], Set[str]] + First element: set of installed extensions that are not in the package. + Second element: set of extensions in the package that are not installed. + """ + ext_map = PackageBuilder._read_extension_map(package) + + add: Set[str] = set() + remove: Set[str] = set() + groups = ("openbb_core_extension", "openbb_provider_extension") + for g in groups: + built = set(ext_map.get(g, {})) + installed = set( + f"{e.name}@{getattr(e.dist, 'version', '')}" + for e in entry_points(group=g) + ) + add = add.union(installed - built) + remove = remove.union(built - installed) + + return add, remove + class ModuleBuilder: """Build the module for the Platform.""" @@ -194,7 +243,7 @@ class ModuleBuilder: @staticmethod def build(path: str, ext_map: Optional[Dict[str, List[str]]] = None) -> str: """Build the module.""" - code = "### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###\n" + code = "### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###\n\n" code += ImportDefinition.build(path=path) code += ClassDefinition.build(path, ext_map) @@ -258,7 +307,7 @@ def get_path_hint_type_list(cls, path: str) -> List[Type]: def build(cls, path: str) -> str: """Build the import definition.""" hint_type_list = cls.get_path_hint_type_list(path=path) - code = "\nfrom openbb_core.app.static.container import Container" + code = "from openbb_core.app.static.container import Container" code += "\nfrom openbb_core.app.model.obbject import OBBject" code += ( "\nfrom openbb_core.app.model.custom_parameter import OpenBBCustomParameter" @@ -282,8 +331,8 @@ def build(cls, path: str) -> str: else: code += "\nfrom typing_extensions import Annotated" code += "\nfrom openbb_core.app.utils import df_to_basemodel" - code += "\nfrom openbb_core.app.static.decorators import validate\n" - code += "\nfrom openbb_core.app.static.filters import filter_inputs\n" + code += "\nfrom openbb_core.app.static.utils.decorators import validate\n" + code += "\nfrom openbb_core.app.static.utils.filters import filter_inputs\n" code += "\nfrom openbb_core.provider.abstract.data import Data" if path.startswith("/quantitative"): code += "\nfrom openbb_quantitative.models import " @@ -307,7 +356,7 @@ class ClassDefinition: def build(path: str, ext_map: Optional[Dict[str, List[str]]] = None) -> str: """Build the class definition.""" class_name = PathHandler.build_module_class(path=path) - code = f"\nclass {class_name}(Container):\n" + code = f"class {class_name}(Container):\n" route_map = PathHandler.build_route_map() path_list = PathHandler.build_path_list(route_map=route_map) @@ -320,10 +369,10 @@ def build(path: str, ext_map: Optional[Dict[str, List[str]]] = None) -> str: doc = f' """{path}\n' if path else ' # fmt: off\n """\nRouters:\n' methods = "" - for child_path in child_path_list: - route = PathHandler.get_route(path=child_path, route_map=route_map) + for c in child_path_list: + route = PathHandler.get_route(path=c, route_map=route_map) if route: - doc += f"{route.name}\n" + doc += f" {route.name}\n" methods += MethodDefinition.build_command_method( path=route.path, func=route.endpoint, @@ -332,9 +381,9 @@ def build(path: str, ext_map: Optional[Dict[str, List[str]]] = None) -> str: else None, ) # type: ignore else: - doc += "/" if path else " /" - doc += child_path.split("/")[-1] + "\n" - methods += MethodDefinition.build_class_loader_method(path=child_path) + doc += " /" if path else " /" + doc += c.split("/")[-1] + "\n" + methods += MethodDefinition.build_class_loader_method(path=c) if not path: if ext_map: @@ -351,11 +400,11 @@ def build(path: str, ext_map: Optional[Dict[str, List[str]]] = None) -> str: ] ) doc += ' """\n' - doc += "# fmt: on\n" + doc += " # fmt: on\n" else: doc += ' """\n' - code += doc + code += doc + "\n" code += " def __repr__(self) -> str:\n" code += ' return self.__doc__ or ""\n' code += methods @@ -363,410 +412,126 @@ def build(path: str, ext_map: Optional[Dict[str, List[str]]] = None) -> str: return code -class DocstringGenerator: - """Dynamically generate docstrings for the commands.""" - - provider_interface = ProviderInterface() +class MethodDefinition: + """Build the method definition for the Platform.""" @staticmethod - def get_OBBject_description(results_type: str, providers: Optional[str]) -> str: - """Get the command output description.""" - available_providers = providers or "Optional[str]" + def build_class_loader_method(path: str) -> str: + """Build the class loader method.""" + module_name = PathHandler.build_module_name(path=path) + class_name = PathHandler.build_module_class(path=path) + function_name = path.rsplit("/", maxsplit=1)[-1].strip("/") - obbject_description = ( - "OBBject\n" - f" results : {results_type}\n" - " Serializable results.\n" - f" provider : {available_providers}\n" - " Provider name.\n" - " warnings : Optional[List[Warning_]]\n" - " List of warnings.\n" - " chart : Optional[Chart]\n" - " Chart object.\n" - " extra: Dict[str, Any]\n" - " Extra info.\n" - ) - obbject_description = obbject_description.replace("NoneType", "None") + code = "\n @property\n" + code += f" def {function_name}(self):\n" + code += " # pylint: disable=import-outside-toplevel\n" + code += f" from . import {module_name}\n\n" + code += f" return {module_name}.{class_name}(command_runner=self._command_runner)\n" - return obbject_description + return code @staticmethod - def get_model_standard_params(param_fields: Dict[str, FieldInfo]) -> Dict[str, Any]: - """Get the test params for the fetcher based on the required standard params.""" - test_params: Dict[str, Any] = {} - for field_name, field in param_fields.items(): - if field.default and field.default is not PydanticUndefined: - test_params[field_name] = field.default - elif field.default and field.default is PydanticUndefined: - example_dict = { - "symbol": "AAPL", - "symbols": "AAPL,MSFT", - "start_date": "2023-01-01", - "end_date": "2023-06-06", - "country": "Portugal", - "date": "2023-01-01", - "countries": ["portugal", "spain"], - } - if field_name in example_dict: - test_params[field_name] = example_dict[field_name] - elif field.annotation == str: - test_params[field_name] = "TEST_STRING" - elif field.annotation == int: - test_params[field_name] = 1 - elif field.annotation == float: - test_params[field_name] = 1.0 - elif field.annotation == bool: - test_params[field_name] = True - elif get_origin(field.annotation) is Literal: # type: ignore - option = field.annotation.__args__[0] # type: ignore - if isinstance(option, str): - test_params[field_name] = f'"{option}"' - else: - test_params[field_name] = option - - return test_params + def get_type(field: FieldInfo) -> type: + """Get the type of the field.""" + field_type = getattr( + field, "annotation", getattr(field, "type", Parameter.empty) + ) + if isclass(field_type): + name = field_type.__name__ + if name.startswith("Constrained") and name.endswith("Value"): + name = name[11:-5].lower() + return getattr(builtins, name, field_type) + return field_type + return field_type @staticmethod - def get_full_command_name(route: str) -> str: - """Get the full command name.""" - cmd_parts = route.split("/") - del cmd_parts[0] + def get_default(field: FieldInfo): + """Get the default value of the field.""" + field_default = getattr(field, "default", None) + if field_default is None or field_default is PydanticUndefined: + return Parameter.empty - menu = cmd_parts[0] - command = cmd_parts[-1] - sub_menus = cmd_parts[1:-1] + default_default = getattr(field_default, "default", None) + if default_default is PydanticUndefined or default_default is Ellipsis: + return Parameter.empty - sub_menu_str_cmd = f".{'.'.join(sub_menus)}" if sub_menus else "" + return default_default - full_command = f"{menu}{sub_menu_str_cmd}.{command}" + @staticmethod + def is_annotated_dc(annotation) -> bool: + """Check if the annotation is an annotated dataclass.""" + return isinstance(annotation, _AnnotatedAlias) and hasattr( + annotation.__args__[0], "__dataclass_fields__" + ) - return full_command + @staticmethod + def is_data_processing_function(path: str) -> bool: + """Check if the function is a data processing function.""" + methods = PathHandler.build_route_map()[path].methods # type: ignore + return "POST" in methods - @classmethod - def generate_example( - cls, - model_name: str, - standard_params: Dict[str, FieldInfo], - ) -> str: - """Generate the example for the command.""" - # find the model router here - cm = CommandMap() - commands_model = cm.commands_model - route = [k for k, v in commands_model.items() if v == model_name] + @staticmethod + def reorder_params(params: Dict[str, Parameter]) -> "OrderedDict[str, Parameter]": + """Reorder the params.""" + formatted_keys = list(params.keys()) + for k in ["provider", "extra_params"]: + if k in formatted_keys: + formatted_keys.remove(k) + formatted_keys.append(k) - if not route: - return "" + od: OrderedDict[str, Parameter] = OrderedDict() + for k in formatted_keys: + od[k] = params[k] - full_command_name = cls.get_full_command_name(route=route[0]) - example_params = cls.get_model_standard_params(param_fields=standard_params) + return od - # Edge cases (might find more) - if "crypto" in route[0] and "symbol" in example_params: - example_params["symbol"] = "BTCUSD" - elif "currency" in route[0] and "symbol" in example_params: - example_params["symbol"] = "EURUSD" - elif ( - "index" in route[0] - and "european" not in route[0] - and "symbol" in example_params - ): - example_params["symbol"] = "SPX" - elif ( - "index" in route[0] - and "european" in route[0] - and "symbol" in example_params - ): - example_params["symbol"] = "BUKBUS" - elif ( - "futures" in route[0] and "curve" in route[0] and "symbol" in example_params - ): - example_params["symbol"] = "VX" - elif "futures" in route[0] and "symbol" in example_params: - example_params["symbol"] = "ES" + @staticmethod + def format_params( + path: str, parameter_map: Dict[str, Parameter] + ) -> OrderedDict[str, Parameter]: + """Format the params.""" + # These are types we want to expand. + # For example, start_date is always a 'date', but we also accept 'str' as input. + # Be careful, if the type is not coercible by pydantic to the original type, you + # will need to add some conversion code in the input filter. + TYPE_EXPANSION = { + "symbol": List[str], + "data": DataProcessingSupportedTypes, + "start_date": str, + "end_date": str, + "provider": None, + } - example = "\nExample\n-------\n" - example += ">>> from openbb import obb\n" - example += f">>> obb.{full_command_name}(" - for param_name, param_value in example_params.items(): - if isinstance(param_value, str): - param_value = f'"{param_value}"' # noqa: PLW2901 - example += f"{param_name}={param_value}, " - if example_params: - example = example[:-2] + ")\n\n" - else: - example += ")\n\n" + DEFAULT_REPLACEMENT = { + "provider": None, + } - return example + parameter_map.pop("cc", None) + # we need to add the chart parameter here bc of the docstring generation + if ( + path.replace("/", "_")[1:] + in ChartingService.get_implemented_charting_functions() + ): + parameter_map["chart"] = Parameter( + name="chart", + kind=Parameter.POSITIONAL_OR_KEYWORD, + annotation=bool, + default=False, + ) - @classmethod - def generate_model_docstring( - cls, - model_name: str, - summary: str, - explicit_params: dict, - params: dict, - returns: Dict[str, FieldInfo], - results_type: str, - ) -> str: - """Create the docstring for model.""" + formatted: Dict[str, Parameter] = {} - def format_type(type_: str, char_limit: Optional[int] = None) -> str: - """Format type in docstrings.""" - type_str = str(type_) - type_str = type_str.replace("NoneType", "None") - if char_limit: - type_str = type_str[:char_limit] + ( - "..." if len(str(type_str)) > char_limit else "" - ) - return type_str + for name, param in parameter_map.items(): + if name == "extra_params": + formatted[name] = Parameter(name="kwargs", kind=Parameter.VAR_KEYWORD) + elif MethodDefinition.is_annotated_dc(param.annotation): + fields = param.annotation.__args__[0].__dataclass_fields__ + for field_name, field in fields.items(): + type_ = MethodDefinition.get_type(field) + default = MethodDefinition.get_default(field) - standard_dict = params["standard"].__dataclass_fields__ - extra_dict = params["extra"].__dataclass_fields__ - - obb_query_fields: Dict[str, FieldInfo] = cls.provider_interface.map[model_name][ - "openbb" - ]["QueryParams"]["fields"] - - example_docstring = cls.generate_example( - model_name=model_name, standard_params=obb_query_fields - ) - - docstring = summary - docstring += "\n" - docstring += "\nParameters\n----------\n" - - # Explicit parameters - for param_name, param in explicit_params.items(): - if param_name in standard_dict: - # pylint: disable=W0212 - p_type = obb_query_fields[param_name].annotation - type_ = p_type.__name__ if inspect.isclass(p_type) else p_type - description = obb_query_fields[param_name].description - elif param_name == "provider": - # pylint: disable=W0212 - type_ = param._annotation - default = param._annotation.__args__[0].__args__[0] - description = f"""The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or '{default}' if there is - no default.""" - elif param_name == "chart": - type_ = "bool" - description = "Whether to create a chart or not, by default False." - else: - type_ = "" - description = "" - - type_str = format_type(type_, char_limit=79) # type: ignore - docstring += f"{param_name} : {type_str}\n" - docstring += f" {description}\n" - - # Kwargs - for param_name, param in extra_dict.items(): - p_type = param.type - type_ = p_type.__name__ if inspect.isclass(p_type) else p_type - - if "NoneType" in str(type_): - type_ = f"Optional[{type_}]".replace(", NoneType", "") - - docstring += f"{param_name} : {type_}\n" - docstring += f" {param.default.description}\n" - - # Returns - docstring += "\nReturns\n-------\n" - provider_param = explicit_params.get("provider", None) - available_providers = getattr(provider_param, "_annotation", None) - - docstring += cls.get_OBBject_description(results_type, available_providers) - - # Schema - underline = "-" * len(model_name) - docstring += f"\n{model_name}\n{underline}\n" - - for name, field in returns.items(): - try: - _type = field.annotation - is_optional = not field.is_required() - if "BeforeValidator" in str(_type): - _type = "Optional[int]" if is_optional else "int" # type: ignore - - field_type = ( - str(_type) - .replace("", "") - .replace("typing.", "") - .replace("pydantic.types.", "") - .replace("datetime.datetime", "datetime") - .replace("datetime.date", "date") - .replace("NoneType", "None") - .replace(", None", "") - ) - field_type = ( - f"Optional[{field_type}]" - if is_optional and "Optional" not in str(_type) - else field_type - ) - except TypeError: - # Fallback to the annotation if the repr fails - field_type = field.annotation # type: ignore - - docstring += f"{field.alias or name} : {field_type}\n" - docstring += f" {field.description}\n" - - docstring += example_docstring - return docstring - - @classmethod - def generate( - cls, - func: Callable, - formatted_params: OrderedDict[str, Parameter], - model_name: Optional[str] = None, - ) -> Optional[str]: - """Generate the docstring for the function.""" - doc = func.__doc__ - if model_name: - params = cls.provider_interface.params.get(model_name, None) - return_schema = cls.provider_interface.return_schema.get(model_name, None) - if params and return_schema: - explicit_dict = dict(formatted_params) - explicit_dict.pop("extra_params", None) - - returns = return_schema.model_fields - results_type = func.__annotations__.get("return", model_name) - if hasattr(results_type, "results_type_repr"): - results_type = results_type.results_type_repr() - - return cls.generate_model_docstring( - model_name=model_name, - summary=func.__doc__ or "", - explicit_params=explicit_dict, - params=params, - returns=returns, - results_type=results_type, - ) - return doc - return doc - - -class MethodDefinition: - """Build the method definition for the Platform.""" - - @staticmethod - def build_class_loader_method(path: str) -> str: - """Build the class loader method.""" - module_name = PathHandler.build_module_name(path=path) - class_name = PathHandler.build_module_class(path=path) - function_name = path.rsplit("/", maxsplit=1)[-1].strip("/") - - code = "\n @property\n" - code += f' def {function_name}(self): # route = "{path}"\n' - code += f" from . import {module_name}\n" - code += f" return {module_name}.{class_name}(command_runner=self._command_runner)\n" - - return code - - @staticmethod - def get_type(field: FieldInfo) -> type: - """Get the type of the field.""" - field_type = getattr( - field, "annotation", getattr(field, "type", Parameter.empty) - ) - if isclass(field_type): - name = field_type.__name__ - if name.startswith("Constrained") and name.endswith("Value"): - name = name[11:-5].lower() - return getattr(builtins, name, field_type) - return field_type - return field_type - - @staticmethod - def get_default(field: FieldInfo): - """Get the default value of the field.""" - field_default = getattr(field, "default", None) - if field_default is None or field_default is PydanticUndefined: - return Parameter.empty - - default_default = getattr(field_default, "default", None) - if default_default is PydanticUndefined or default_default is Ellipsis: - return Parameter.empty - - return default_default - - @staticmethod - def is_annotated_dc(annotation) -> bool: - """Check if the annotation is an annotated dataclass.""" - return isinstance(annotation, _AnnotatedAlias) and hasattr( - annotation.__args__[0], "__dataclass_fields__" - ) - - @staticmethod - def is_data_processing_function(path: str) -> bool: - """Check if the function is a data processing function.""" - methods = PathHandler.build_route_map()[path].methods # type: ignore - return "POST" in methods - - @staticmethod - def reorder_params(params: Dict[str, Parameter]) -> "OrderedDict[str, Parameter]": - """Reorder the params.""" - formatted_keys = list(params.keys()) - for k in ["provider", "extra_params"]: - if k in formatted_keys: - formatted_keys.remove(k) - formatted_keys.append(k) - - od: OrderedDict[str, Parameter] = OrderedDict() - for k in formatted_keys: - od[k] = params[k] - - return od - - @staticmethod - def format_params( - path: str, parameter_map: Dict[str, Parameter] - ) -> OrderedDict[str, Parameter]: - """Format the params.""" - # These are types we want to expand. - # For example, start_date is always a 'date', but we also accept 'str' as input. - # Be careful, if the type is not coercible by pydantic to the original type, you - # will need to add some conversion code in the input filter. - TYPE_EXPANSION = { - "symbol": List[str], - "data": DataProcessingSupportedTypes, - "start_date": str, - "end_date": str, - "provider": None, - } - - DEFAULT_REPLACEMENT = { - "provider": None, - } - - parameter_map.pop("cc", None) - # we need to add the chart parameter here bc of the docstring generation - if ( - path.replace("/", "_")[1:] - in ChartingService.get_implemented_charting_functions() - ): - parameter_map["chart"] = Parameter( - name="chart", - kind=Parameter.POSITIONAL_OR_KEYWORD, - annotation=bool, - default=False, - ) - - formatted: Dict[str, Parameter] = {} - - for name, param in parameter_map.items(): - if name == "extra_params": - formatted[name] = Parameter(name="kwargs", kind=Parameter.VAR_KEYWORD) - elif MethodDefinition.is_annotated_dc(param.annotation): - fields = param.annotation.__args__[0].__dataclass_fields__ - for field_name, field in fields.items(): - type_ = MethodDefinition.get_type(field) - default = MethodDefinition.get_default(field) - - new_type = TYPE_EXPANSION.get(field_name, ...) - updated_type = type_ if new_type is ... else Union[type_, new_type] + new_type = TYPE_EXPANSION.get(field_name, ...) + updated_type = type_ if new_type is ... else Union[type_, new_type] formatted[field_name] = Parameter( name=field_name, @@ -824,7 +589,9 @@ def add_field_descriptions( @staticmethod def build_func_params(formatted_params: OrderedDict[str, Parameter]) -> str: """Stringify function params.""" - func_params = ", ".join(str(param) for param in formatted_params.values()) + func_params = ",\n ".join( + str(param) for param in formatted_params.values() + ) func_params = func_params.replace("NoneType", "None") func_params = func_params.replace( "pandas.core.frame.DataFrame", "pandas.DataFrame" @@ -836,20 +603,14 @@ def build_func_params(formatted_params: OrderedDict[str, Parameter]) -> str: return func_params @staticmethod - def build_func_returns(return_type: type, model_name: Optional[str] = None) -> str: + def build_func_returns(return_type: type) -> str: """Build the function returns.""" if return_type == _empty: func_returns = "None" elif return_type.__module__ == "builtins": func_returns = return_type.__name__ else: - item_type = get_args(get_type_hints(return_type)["results"])[0] - if item_type.__module__ == "builtins": - func_returns = f"OBBject[{item_type.__name__}]" - else: - func_returns = return_type.__qualname__ - if model_name: - func_returns = func_returns.replace(model_name, "Data") + func_returns = "OBBject" return func_returns @@ -865,7 +626,7 @@ def build_command_method_signature( od=formatted_params, model_name=model_name ) # this modified `od` in place func_params = MethodDefinition.build_func_params(formatted_params) - func_returns = MethodDefinition.build_func_returns(return_type, model_name) + func_returns = MethodDefinition.build_func_returns(return_type) args = ( "(config=dict(arbitrary_types_allowed=True))" @@ -873,7 +634,8 @@ def build_command_method_signature( else "" ) code = f"\n @validate{args}" - code += f"\n def {func_name}(self, {func_params}) -> {func_returns}:\n" + code += f"\n def {func_name}(" + code += f"\n self,\n {func_params}\n ) -> {func_returns}:\n" return code @@ -889,12 +651,12 @@ def build_command_method_doc( doc = DocstringGenerator.generate( func=func, formatted_params=formatted_params, model_name=model_name ) - code = f' """{doc}""" # noqa: E501\n\n' if doc else "" + code = f' """{doc} """ # noqa: E501\n\n' if doc else "" return code @staticmethod - def build_command_method_implementation(path: str, func: Callable): + def build_command_method_body(path: str, func: Callable): """Build the command method implementation.""" sig = signature(func) parameter_map = dict(sig.parameters) @@ -911,32 +673,30 @@ def build_command_method_implementation(path: str, func: Callable): default=False, ) - code = " inputs = filter_inputs(\n" + code = " return self._run(\n" + code += f""" "{path}",\n""" + code += " **filter_inputs(\n" for name, param in parameter_map.items(): if name == "extra_params": - code += f" {name}=kwargs,\n" + code += f" {name}=kwargs,\n" elif MethodDefinition.is_annotated_dc(param.annotation): fields = param.annotation.__args__[0].__dataclass_fields__ value = {k: k for k in fields} - code += f" {name}={{" + code += f" {name}={{\n" for k, v in value.items(): if k == "symbol": - code += f'"{k}": ",".join(symbol) if isinstance(symbol, list) else symbol, ' + code += f' "{k}": ",".join(symbol) if isinstance(symbol, list) else symbol, \n' continue - code += f'"{k}": {v}, ' - code += "},\n" + code += f' "{k}": {v},\n' + code += " },\n" else: - code += f" {name}={name},\n" + code += f" {name}={name},\n" if MethodDefinition.is_data_processing_function(path): - code += " data_processing=True,\n" + code += " data_processing=True,\n" - code += " )\n\n" - code += " return self._run(\n" - code += f""" "{path}",\n""" - code += " **inputs,\n" + code += " )\n" code += " )\n" - code += "\n" return code @@ -962,11 +722,308 @@ def build_command_method( func=func, formatted_params=formatted_params, model_name=model_name ) - code += cls.build_command_method_implementation(path=path, func=func) + code += cls.build_command_method_body(path=path, func=func) return code +class DocstringGenerator: + """Dynamically generate docstrings for the commands.""" + + provider_interface = ProviderInterface() + + @staticmethod + def get_OBBject_description(results_type: str, providers: Optional[str]) -> str: + """Get the command output description.""" + available_providers = providers or "Optional[str]" + + obbject_description = ( + " OBBject\n" + f" results : {results_type}\n" + " Serializable results.\n" + f" provider : {available_providers}\n" + " Provider name.\n" + " warnings : Optional[List[Warning_]]\n" + " List of warnings.\n" + " chart : Optional[Chart]\n" + " Chart object.\n" + " extra: Dict[str, Any]\n" + " Extra info.\n" + ) + obbject_description = obbject_description.replace("NoneType", "None") + + return obbject_description + + @staticmethod + def get_model_standard_params(param_fields: Dict[str, FieldInfo]) -> Dict[str, Any]: + """Get the test params for the fetcher based on the required standard params.""" + test_params: Dict[str, Any] = {} + for field_name, field in param_fields.items(): + if field.default and field.default is not PydanticUndefined: + test_params[field_name] = field.default + elif field.default and field.default is PydanticUndefined: + example_dict = { + "symbol": "AAPL", + "symbols": "AAPL,MSFT", + "start_date": "2023-01-01", + "end_date": "2023-06-06", + "country": "Portugal", + "date": "2023-01-01", + "countries": ["portugal", "spain"], + } + if field_name in example_dict: + test_params[field_name] = example_dict[field_name] + elif field.annotation == str: + test_params[field_name] = "TEST_STRING" + elif field.annotation == int: + test_params[field_name] = 1 + elif field.annotation == float: + test_params[field_name] = 1.0 + elif field.annotation == bool: + test_params[field_name] = True + elif get_origin(field.annotation) is Literal: # type: ignore + option = field.annotation.__args__[0] # type: ignore + if isinstance(option, str): + test_params[field_name] = f'"{option}"' + else: + test_params[field_name] = option + + return test_params + + @staticmethod + def get_full_command_name(route: str) -> str: + """Get the full command name.""" + cmd_parts = route.split("/") + del cmd_parts[0] + + menu = cmd_parts[0] + command = cmd_parts[-1] + sub_menus = cmd_parts[1:-1] + + sub_menu_str_cmd = f".{'.'.join(sub_menus)}" if sub_menus else "" + + full_command = f"{menu}{sub_menu_str_cmd}.{command}" + + return full_command + + @classmethod + def generate_example( + cls, + model_name: str, + standard_params: Dict[str, FieldInfo], + ) -> str: + """Generate the example for the command.""" + # find the model router here + cm = CommandMap() + commands_model = cm.commands_model + route = [k for k, v in commands_model.items() if v == model_name] + + if not route: + return "" + + full_command_name = cls.get_full_command_name(route=route[0]) + example_params = cls.get_model_standard_params(param_fields=standard_params) + + # Edge cases (might find more) + if "crypto" in route[0] and "symbol" in example_params: + example_params["symbol"] = "BTCUSD" + elif "currency" in route[0] and "symbol" in example_params: + example_params["symbol"] = "EURUSD" + elif ( + "index" in route[0] + and "european" not in route[0] + and "symbol" in example_params + ): + example_params["symbol"] = "SPX" + elif ( + "index" in route[0] + and "european" in route[0] + and "symbol" in example_params + ): + example_params["symbol"] = "BUKBUS" + elif ( + "futures" in route[0] and "curve" in route[0] and "symbol" in example_params + ): + example_params["symbol"] = "VX" + elif "futures" in route[0] and "symbol" in example_params: + example_params["symbol"] = "ES" + + example = "\n Example\n -------\n" + example += " >>> from openbb import obb\n" + example += f" >>> obb.{full_command_name}(" + for param_name, param_value in example_params.items(): + if isinstance(param_value, str): + param_value = f'"{param_value}"' # noqa: PLW2901 + example += f"{param_name}={param_value}, " + if example_params: + example = example[:-2] + ")\n" + else: + example += ")\n" + + return example + + @classmethod + def generate_model_docstring( + cls, + model_name: str, + summary: str, + explicit_params: dict, + params: dict, + returns: Dict[str, FieldInfo], + results_type: str, + ) -> str: + """Create the docstring for model.""" + + def format_type(type_: str, char_limit: Optional[int] = None) -> str: + """Format type in docstrings.""" + type_str = str(type_) + type_str = type_str.replace("NoneType", "None") + if char_limit: + type_str = type_str[:char_limit] + ( + "..." if len(str(type_str)) > char_limit else "" + ) + return type_str + + def format_description(description: str) -> str: + """Format description in docstrings.""" + description = description.replace("\n", "\n ") + return description + + standard_dict = params["standard"].__dataclass_fields__ + extra_dict = params["extra"].__dataclass_fields__ + + obb_query_fields: Dict[str, FieldInfo] = cls.provider_interface.map[model_name][ + "openbb" + ]["QueryParams"]["fields"] + + example_docstring = cls.generate_example( + model_name=model_name, standard_params=obb_query_fields + ) + + docstring = summary + docstring += "\n\n" + docstring += " Parameters\n" + docstring += " ----------\n" + + # Explicit parameters + for param_name, param in explicit_params.items(): + if param_name in standard_dict: + # pylint: disable=W0212 + p_type = obb_query_fields[param_name].annotation + type_ = p_type.__name__ if inspect.isclass(p_type) else p_type + description = getattr(obb_query_fields[param_name], "description", "") + elif param_name == "provider": + # pylint: disable=W0212 + type_ = param._annotation + default = param._annotation.__args__[0].__args__[0] + description = f"""The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or '{default}' if there is + no default.""" + elif param_name == "chart": + type_ = "bool" + description = "Whether to create a chart or not, by default False." + else: + type_ = "" + description = "" + + type_str = format_type(type_, char_limit=79) # type: ignore + docstring += f" {param_name} : {type_str}\n" + docstring += f" {format_description(description)}\n" + + # Kwargs + for param_name, param in extra_dict.items(): + p_type = param.type + type_ = p_type.__name__ if inspect.isclass(p_type) else p_type + + if "NoneType" in str(type_): + type_ = f"Optional[{type_}]".replace(", NoneType", "") + + description = getattr(param.default, "description", "") + + docstring += f" {param_name} : {type_}\n" + docstring += f" {format_description(description)}\n" + + # Returns + docstring += "\n" + docstring += " Returns\n" + docstring += " -------\n" + provider_param = explicit_params.get("provider", None) + available_providers = getattr(provider_param, "_annotation", None) + + docstring += cls.get_OBBject_description(results_type, available_providers) + + # Schema + underline = "-" * len(model_name) + docstring += f"\n {model_name}\n {underline}\n" + + for name, field in returns.items(): + try: + _type = field.annotation + is_optional = not field.is_required() + if "BeforeValidator" in str(_type): + _type = "Optional[int]" if is_optional else "int" # type: ignore + + field_type = ( + str(_type) + .replace("", "") + .replace("typing.", "") + .replace("pydantic.types.", "") + .replace("datetime.datetime", "datetime") + .replace("datetime.date", "date") + .replace("NoneType", "None") + .replace(", None", "") + ) + field_type = ( + f"Optional[{field_type}]" + if is_optional and "Optional" not in str(_type) + else field_type + ) + except TypeError: + # Fallback to the annotation if the repr fails + field_type = field.annotation # type: ignore + + description = getattr(field, "description", "") + + docstring += f" {field.alias or name} : {field_type}\n" + docstring += f" {format_description(description)}\n" + + docstring += example_docstring + return docstring + + @classmethod + def generate( + cls, + func: Callable, + formatted_params: OrderedDict[str, Parameter], + model_name: Optional[str] = None, + ) -> Optional[str]: + """Generate the docstring for the function.""" + doc = func.__doc__ + if model_name: + params = cls.provider_interface.params.get(model_name, None) + return_schema = cls.provider_interface.return_schema.get(model_name, None) + if params and return_schema: + explicit_dict = dict(formatted_params) + explicit_dict.pop("extra_params", None) + + returns = return_schema.model_fields + results_type = func.__annotations__.get("return", model_name) + if hasattr(results_type, "results_type_repr"): + results_type = results_type.results_type_repr() + + return cls.generate_model_docstring( + model_name=model_name, + summary=func.__doc__ or "", + explicit_params=explicit_dict, + params=params, + returns=returns, + results_type=results_type, + ) + return doc + return doc + + class PathHandler: """Handle the paths for the Platform.""" @@ -1032,50 +1089,3 @@ def build_module_class(cls, path: str) -> str: if not path: return "Extensions" return f"ROUTER_{cls.clean_path(path=path)}" - - -class Linters: - """Run the linters for the Platform.""" - - def __init__(self, directory: Path, verbose: bool = False) -> None: - """Initialize the linters.""" - self.directory = directory - self.verbose = verbose - self.console = Console(verbose) - - def print_separator(self, symbol: str, length: int = 160): - """Print a separator.""" - self.console.log(symbol * length) - - def run( - self, - linter: Literal["black", "ruff"], - flags: Optional[List[str]] = None, - ): - """Run linter with flags.""" - if shutil.which(linter): - self.console.log(f"\n* {linter}") - self.print_separator("^") - - command = [linter] + list(self.directory.glob("*.py")) - if flags: - command.extend(flags) # type: ignore - subprocess.run(command, check=False) # noqa: S603 - - self.print_separator("-") - else: - self.console.log(f"\n* {linter} not found") - - def black(self): - """Run black.""" - flags = [] - if not self.verbose and not Env().DEBUG_MODE: - flags.append("--quiet") - self.run(linter="black", flags=flags) - - def ruff(self): - """Run ruff.""" - flags = ["--fix"] - if not self.verbose and not Env().DEBUG_MODE: - flags.append("--silent") - self.run(linter="ruff", flags=flags) diff --git a/openbb_platform/core/openbb_core/app/static/utils/console.py b/openbb_platform/core/openbb_core/app/static/utils/console.py new file mode 100644 index 000000000000..8c0e36c7b9b0 --- /dev/null +++ b/openbb_platform/core/openbb_core/app/static/utils/console.py @@ -0,0 +1,15 @@ +"""Console module.""" +from openbb_core.env import Env + + +class Console: + """Console to be used by builder and linters.""" + + def __init__(self, verbose: bool): + """Initialize the console.""" + self.verbose = verbose + + def log(self, message: str, **kwargs): + """Console log method.""" + if self.verbose or Env().DEBUG_MODE: + print(message, **kwargs) # noqa: T201 diff --git a/openbb_platform/core/openbb_core/app/static/decorators.py b/openbb_platform/core/openbb_core/app/static/utils/decorators.py similarity index 100% rename from openbb_platform/core/openbb_core/app/static/decorators.py rename to openbb_platform/core/openbb_core/app/static/utils/decorators.py diff --git a/openbb_platform/core/openbb_core/app/static/filters.py b/openbb_platform/core/openbb_core/app/static/utils/filters.py similarity index 100% rename from openbb_platform/core/openbb_core/app/static/filters.py rename to openbb_platform/core/openbb_core/app/static/utils/filters.py diff --git a/openbb_platform/core/openbb_core/app/static/utils/linters.py b/openbb_platform/core/openbb_core/app/static/utils/linters.py new file mode 100644 index 000000000000..27448f5f1bff --- /dev/null +++ b/openbb_platform/core/openbb_core/app/static/utils/linters.py @@ -0,0 +1,59 @@ +"""Linters for the package.""" +import shutil +import subprocess +from pathlib import Path +from typing import ( + List, + Literal, + Optional, +) + +from openbb_core.app.static.utils.console import Console +from openbb_core.env import Env + + +class Linters: + """Run the linters for the Platform.""" + + def __init__(self, directory: Path, verbose: bool = False) -> None: + """Initialize the linters.""" + self.directory = directory + self.verbose = verbose + self.console = Console(verbose) + + def print_separator(self, symbol: str, length: int = 160): + """Print a separator.""" + self.console.log(symbol * length) + + def run( + self, + linter: Literal["black", "ruff"], + flags: Optional[List[str]] = None, + ): + """Run linter with flags.""" + if shutil.which(linter): + self.console.log(f"\n* {linter}") + self.print_separator("^") + + command = [linter] + list(self.directory.glob("*.py")) + if flags: + command.extend(flags) # type: ignore + subprocess.run(command, check=False) # noqa: S603 + + self.print_separator("-") + else: + self.console.log(f"\n* {linter} not found") + + def black(self): + """Run black.""" + flags = [] + if not self.verbose and not Env().DEBUG_MODE: + flags.append("--quiet") + self.run(linter="black", flags=flags) + + def ruff(self): + """Run ruff.""" + flags = ["--fix"] + if not self.verbose and not Env().DEBUG_MODE: + flags.append("--silent") + self.run(linter="ruff", flags=flags) diff --git a/openbb_platform/core/poetry.lock b/openbb_platform/core/poetry.lock index 38b630c59fa5..e0fdbef88085 100644 --- a/openbb_platform/core/poetry.lock +++ b/openbb_platform/core/poetry.lock @@ -187,29 +187,33 @@ files = [ [[package]] name = "black" -version = "23.11.0" +version = "23.12.0" description = "The uncompromising code formatter." optional = false python-versions = ">=3.8" files = [ - {file = "black-23.11.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:dbea0bb8575c6b6303cc65017b46351dc5953eea5c0a59d7b7e3a2d2f433a911"}, - {file = "black-23.11.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:412f56bab20ac85927f3a959230331de5614aecda1ede14b373083f62ec24e6f"}, - {file = "black-23.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d136ef5b418c81660ad847efe0e55c58c8208b77a57a28a503a5f345ccf01394"}, - {file = "black-23.11.0-cp310-cp310-win_amd64.whl", hash = "sha256:6c1cac07e64433f646a9a838cdc00c9768b3c362805afc3fce341af0e6a9ae9f"}, - {file = "black-23.11.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:cf57719e581cfd48c4efe28543fea3d139c6b6f1238b3f0102a9c73992cbb479"}, - {file = "black-23.11.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:698c1e0d5c43354ec5d6f4d914d0d553a9ada56c85415700b81dc90125aac244"}, - {file = "black-23.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:760415ccc20f9e8747084169110ef75d545f3b0932ee21368f63ac0fee86b221"}, - {file = "black-23.11.0-cp311-cp311-win_amd64.whl", hash = "sha256:58e5f4d08a205b11800332920e285bd25e1a75c54953e05502052738fe16b3b5"}, - {file = "black-23.11.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:45aa1d4675964946e53ab81aeec7a37613c1cb71647b5394779e6efb79d6d187"}, - {file = "black-23.11.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:4c44b7211a3a0570cc097e81135faa5f261264f4dfaa22bd5ee2875a4e773bd6"}, - {file = "black-23.11.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2a9acad1451632021ee0d146c8765782a0c3846e0e0ea46659d7c4f89d9b212b"}, - {file = "black-23.11.0-cp38-cp38-win_amd64.whl", hash = "sha256:fc7f6a44d52747e65a02558e1d807c82df1d66ffa80a601862040a43ec2e3142"}, - {file = "black-23.11.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7f622b6822f02bfaf2a5cd31fdb7cd86fcf33dab6ced5185c35f5db98260b055"}, - {file = "black-23.11.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:250d7e60f323fcfc8ea6c800d5eba12f7967400eb6c2d21ae85ad31c204fb1f4"}, - {file = "black-23.11.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5133f5507007ba08d8b7b263c7aa0f931af5ba88a29beacc4b2dc23fcefe9c06"}, - {file = "black-23.11.0-cp39-cp39-win_amd64.whl", hash = "sha256:421f3e44aa67138ab1b9bfbc22ee3780b22fa5b291e4db8ab7eee95200726b07"}, - {file = "black-23.11.0-py3-none-any.whl", hash = "sha256:54caaa703227c6e0c87b76326d0862184729a69b73d3b7305b6288e1d830067e"}, - {file = "black-23.11.0.tar.gz", hash = "sha256:4c68855825ff432d197229846f971bc4d6666ce90492e5b02013bcaca4d9ab05"}, + {file = "black-23.12.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:67f19562d367468ab59bd6c36a72b2c84bc2f16b59788690e02bbcb140a77175"}, + {file = "black-23.12.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:bbd75d9f28a7283b7426160ca21c5bd640ca7cd8ef6630b4754b6df9e2da8462"}, + {file = "black-23.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:593596f699ca2dcbbbdfa59fcda7d8ad6604370c10228223cd6cf6ce1ce7ed7e"}, + {file = "black-23.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:12d5f10cce8dc27202e9a252acd1c9a426c83f95496c959406c96b785a92bb7d"}, + {file = "black-23.12.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:e73c5e3d37e5a3513d16b33305713237a234396ae56769b839d7c40759b8a41c"}, + {file = "black-23.12.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ba09cae1657c4f8a8c9ff6cfd4a6baaf915bb4ef7d03acffe6a2f6585fa1bd01"}, + {file = "black-23.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ace64c1a349c162d6da3cef91e3b0e78c4fc596ffde9413efa0525456148873d"}, + {file = "black-23.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:72db37a2266b16d256b3ea88b9affcdd5c41a74db551ec3dd4609a59c17d25bf"}, + {file = "black-23.12.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:fdf6f23c83078a6c8da2442f4d4eeb19c28ac2a6416da7671b72f0295c4a697b"}, + {file = "black-23.12.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:39dda060b9b395a6b7bf9c5db28ac87b3c3f48d4fdff470fa8a94ab8271da47e"}, + {file = "black-23.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7231670266ca5191a76cb838185d9be59cfa4f5dd401b7c1c70b993c58f6b1b5"}, + {file = "black-23.12.0-cp312-cp312-win_amd64.whl", hash = "sha256:193946e634e80bfb3aec41830f5d7431f8dd5b20d11d89be14b84a97c6b8bc75"}, + {file = "black-23.12.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bcf91b01ddd91a2fed9a8006d7baa94ccefe7e518556470cf40213bd3d44bbbc"}, + {file = "black-23.12.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:996650a89fe5892714ea4ea87bc45e41a59a1e01675c42c433a35b490e5aa3f0"}, + {file = "black-23.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bdbff34c487239a63d86db0c9385b27cdd68b1bfa4e706aa74bb94a435403672"}, + {file = "black-23.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:97af22278043a6a1272daca10a6f4d36c04dfa77e61cbaaf4482e08f3640e9f0"}, + {file = "black-23.12.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ead25c273adfad1095a8ad32afdb8304933efba56e3c1d31b0fee4143a1e424a"}, + {file = "black-23.12.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c71048345bdbced456cddf1622832276d98a710196b842407840ae8055ade6ee"}, + {file = "black-23.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:81a832b6e00eef2c13b3239d514ea3b7d5cc3eaa03d0474eedcbbda59441ba5d"}, + {file = "black-23.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:6a82a711d13e61840fb11a6dfecc7287f2424f1ca34765e70c909a35ffa7fb95"}, + {file = "black-23.12.0-py3-none-any.whl", hash = "sha256:a7c07db8200b5315dc07e331dda4d889a56f6bf4db6a9c2a526fa3166a81614f"}, + {file = "black-23.12.0.tar.gz", hash = "sha256:330a327b422aca0634ecd115985c1c7fd7bdb5b5a2ef8aa9888a82e2ebe9437a"}, ] [package.dependencies] @@ -223,7 +227,7 @@ typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""} [package.extras] colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)"] +d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] @@ -529,20 +533,20 @@ files = [ [[package]] name = "importlib-metadata" -version = "6.8.0" +version = "6.11.0" description = "Read metadata from Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "importlib_metadata-6.8.0-py3-none-any.whl", hash = "sha256:3ebb78df84a805d7698245025b975d9d67053cd94c79245ba4b3eb694abe68bb"}, - {file = "importlib_metadata-6.8.0.tar.gz", hash = "sha256:dbace7892d8c0c4ac1ad096662232f831d4e64f4c4545bd53016a3e9d4654743"}, + {file = "importlib_metadata-6.11.0-py3-none-any.whl", hash = "sha256:f0afba6205ad8f8947c7d338b5342d5db2afbfd82f9cbef7879a9539cc12eb9b"}, + {file = "importlib_metadata-6.11.0.tar.gz", hash = "sha256:1231cf92d825c9e03cfc4da076a16de6422c863558229ea0b22b675657463443"}, ] [package.dependencies] zipp = ">=0.5" [package.extras] -docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-lint"] perf = ["ipython"] testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)", "pytest-ruff"] @@ -824,24 +828,24 @@ xml = ["lxml (>=4.6.3)"] [[package]] name = "pathspec" -version = "0.11.2" +version = "0.12.1" description = "Utility library for gitignore style pattern matching of file paths." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pathspec-0.11.2-py3-none-any.whl", hash = "sha256:1d6ed233af05e679efb96b1851550ea95bbb64b7c490b0f5aa52996c11e92a20"}, - {file = "pathspec-0.11.2.tar.gz", hash = "sha256:e0d8d0ac2f12da61956eb2306b69f9469b42f4deb0f3cb6ed47b9cce9996ced3"}, + {file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"}, + {file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"}, ] [[package]] name = "platformdirs" -version = "4.0.0" +version = "4.1.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "platformdirs-4.0.0-py3-none-any.whl", hash = "sha256:118c954d7e949b35437270383a3f2531e99dd93cf7ce4dc8340d3356d30f173b"}, - {file = "platformdirs-4.0.0.tar.gz", hash = "sha256:cb633b2bcf10c51af60beb0ab06d2f1d69064b43abf4c185ca6b28865f3f9731"}, + {file = "platformdirs-4.1.0-py3-none-any.whl", hash = "sha256:11c8f37bcca40db96d8144522d925583bdb7a31f7b0e37e3ed4318400a8e2380"}, + {file = "platformdirs-4.1.0.tar.gz", hash = "sha256:906d548203468492d432bcb294d4bc2fff751bf84971fbb2c10918cc206ee420"}, ] [package.extras] @@ -865,13 +869,13 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "posthog" -version = "3.0.2" +version = "3.1.0" description = "Integrate PostHog into any python application." optional = false python-versions = "*" files = [ - {file = "posthog-3.0.2-py2.py3-none-any.whl", hash = "sha256:a8c0af6f2401fbe50f90e68c4143d0824b54e872de036b1c2f23b5abb39d88ce"}, - {file = "posthog-3.0.2.tar.gz", hash = "sha256:701fba6e446a4de687c6e861b587e7b7741955ad624bf34fe013c06a0fec6fb3"}, + {file = "posthog-3.1.0-py2.py3-none-any.whl", hash = "sha256:acd033530bdfc275dce5587f205f62378991ecb9b7cd5479e79c7f4ac575d319"}, + {file = "posthog-3.1.0.tar.gz", hash = "sha256:db17a2c511e18757aec12b6632ddcc1fa318743dad88a4666010467a3d9468da"}, ] [package.dependencies] @@ -884,7 +888,7 @@ six = ">=1.5" [package.extras] dev = ["black", "flake8", "flake8-print", "isort", "pre-commit"] sentry = ["django", "sentry-sdk"] -test = ["coverage", "flake8", "freezegun (==0.3.15)", "mock (>=2.0.0)", "pylint", "pytest"] +test = ["coverage", "flake8", "freezegun (==0.3.15)", "mock (>=2.0.0)", "pylint", "pytest", "pytest-timeout"] [[package]] name = "pyasn1" @@ -1189,6 +1193,7 @@ files = [ {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, + {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"}, {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, @@ -1196,8 +1201,15 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, + {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, + {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, + {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, + {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, @@ -1214,6 +1226,7 @@ files = [ {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, + {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"}, {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, @@ -1221,6 +1234,7 @@ files = [ {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, + {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, @@ -1263,28 +1277,28 @@ pyasn1 = ">=0.1.3" [[package]] name = "ruff" -version = "0.1.6" +version = "0.1.7" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.1.6-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:88b8cdf6abf98130991cbc9f6438f35f6e8d41a02622cc5ee130a02a0ed28703"}, - {file = "ruff-0.1.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:5c549ed437680b6105a1299d2cd30e4964211606eeb48a0ff7a93ef70b902248"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1cf5f701062e294f2167e66d11b092bba7af6a057668ed618a9253e1e90cfd76"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:05991ee20d4ac4bb78385360c684e4b417edd971030ab12a4fbd075ff535050e"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:87455a0c1f739b3c069e2f4c43b66479a54dea0276dd5d4d67b091265f6fd1dc"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:683aa5bdda5a48cb8266fcde8eea2a6af4e5700a392c56ea5fb5f0d4bfdc0240"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:137852105586dcbf80c1717facb6781555c4e99f520c9c827bd414fac67ddfb6"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bd98138a98d48a1c36c394fd6b84cd943ac92a08278aa8ac8c0fdefcf7138f35"}, - {file = "ruff-0.1.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3a0cd909d25f227ac5c36d4e7e681577275fb74ba3b11d288aff7ec47e3ae745"}, - {file = "ruff-0.1.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:e8fd1c62a47aa88a02707b5dd20c5ff20d035d634aa74826b42a1da77861b5ff"}, - {file = "ruff-0.1.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:fd89b45d374935829134a082617954120d7a1470a9f0ec0e7f3ead983edc48cc"}, - {file = "ruff-0.1.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:491262006e92f825b145cd1e52948073c56560243b55fb3b4ecb142f6f0e9543"}, - {file = "ruff-0.1.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:ea284789861b8b5ca9d5443591a92a397ac183d4351882ab52f6296b4fdd5462"}, - {file = "ruff-0.1.6-py3-none-win32.whl", hash = "sha256:1610e14750826dfc207ccbcdd7331b6bd285607d4181df9c1c6ae26646d6848a"}, - {file = "ruff-0.1.6-py3-none-win_amd64.whl", hash = "sha256:4558b3e178145491e9bc3b2ee3c4b42f19d19384eaa5c59d10acf6e8f8b57e33"}, - {file = "ruff-0.1.6-py3-none-win_arm64.whl", hash = "sha256:03910e81df0d8db0e30050725a5802441c2022ea3ae4fe0609b76081731accbc"}, - {file = "ruff-0.1.6.tar.gz", hash = "sha256:1b09f29b16c6ead5ea6b097ef2764b42372aebe363722f1605ecbcd2b9207184"}, + {file = "ruff-0.1.7-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:7f80496854fdc65b6659c271d2c26e90d4d401e6a4a31908e7e334fab4645aac"}, + {file = "ruff-0.1.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:1ea109bdb23c2a4413f397ebd8ac32cb498bee234d4191ae1a310af760e5d287"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8b0c2de9dd9daf5e07624c24add25c3a490dbf74b0e9bca4145c632457b3b42a"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:69a4bed13bc1d5dabf3902522b5a2aadfebe28226c6269694283c3b0cecb45fd"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:de02ca331f2143195a712983a57137c5ec0f10acc4aa81f7c1f86519e52b92a1"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:45b38c3f8788a65e6a2cab02e0f7adfa88872696839d9882c13b7e2f35d64c5f"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6c64cb67b2025b1ac6d58e5ffca8f7b3f7fd921f35e78198411237e4f0db8e73"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9dcc6bb2f4df59cb5b4b40ff14be7d57012179d69c6565c1da0d1f013d29951b"}, + {file = "ruff-0.1.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:df2bb4bb6bbe921f6b4f5b6fdd8d8468c940731cb9406f274ae8c5ed7a78c478"}, + {file = "ruff-0.1.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:276a89bcb149b3d8c1b11d91aa81898fe698900ed553a08129b38d9d6570e717"}, + {file = "ruff-0.1.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:90c958fe950735041f1c80d21b42184f1072cc3975d05e736e8d66fc377119ea"}, + {file = "ruff-0.1.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:6b05e3b123f93bb4146a761b7a7d57af8cb7384ccb2502d29d736eaade0db519"}, + {file = "ruff-0.1.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:290ecab680dce94affebefe0bbca2322a6277e83d4f29234627e0f8f6b4fa9ce"}, + {file = "ruff-0.1.7-py3-none-win32.whl", hash = "sha256:416dfd0bd45d1a2baa3b1b07b1b9758e7d993c256d3e51dc6e03a5e7901c7d80"}, + {file = "ruff-0.1.7-py3-none-win_amd64.whl", hash = "sha256:4af95fd1d3b001fc41325064336db36e3d27d2004cdb6d21fd617d45a172dd96"}, + {file = "ruff-0.1.7-py3-none-win_arm64.whl", hash = "sha256:0683b7bfbb95e6df3c7c04fe9d78f631f8e8ba4868dfc932d43d690698057e2e"}, + {file = "ruff-0.1.7.tar.gz", hash = "sha256:dffd699d07abf54833e5f6cc50b85a6ff043715da8788c4a79bcd4ab4734d306"}, ] [[package]] @@ -1664,101 +1678,101 @@ files = [ [[package]] name = "yarl" -version = "1.9.3" +version = "1.9.4" description = "Yet another URL library" optional = false python-versions = ">=3.7" files = [ - {file = "yarl-1.9.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:32435d134414e01d937cd9d6cc56e8413a8d4741dea36af5840c7750f04d16ab"}, - {file = "yarl-1.9.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:9a5211de242754b5e612557bca701f39f8b1a9408dff73c6db623f22d20f470e"}, - {file = "yarl-1.9.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:525cd69eff44833b01f8ef39aa33a9cc53a99ff7f9d76a6ef6a9fb758f54d0ff"}, - {file = "yarl-1.9.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fc94441bcf9cb8c59f51f23193316afefbf3ff858460cb47b5758bf66a14d130"}, - {file = "yarl-1.9.3-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e36021db54b8a0475805acc1d6c4bca5d9f52c3825ad29ae2d398a9d530ddb88"}, - {file = "yarl-1.9.3-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e0f17d1df951336a02afc8270c03c0c6e60d1f9996fcbd43a4ce6be81de0bd9d"}, - {file = "yarl-1.9.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c5f3faeb8100a43adf3e7925d556801d14b5816a0ac9e75e22948e787feec642"}, - {file = "yarl-1.9.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:aed37db837ecb5962469fad448aaae0f0ee94ffce2062cf2eb9aed13328b5196"}, - {file = "yarl-1.9.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:721ee3fc292f0d069a04016ef2c3a25595d48c5b8ddc6029be46f6158d129c92"}, - {file = "yarl-1.9.3-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:b8bc5b87a65a4e64bc83385c05145ea901b613d0d3a434d434b55511b6ab0067"}, - {file = "yarl-1.9.3-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:dd952b9c64f3b21aedd09b8fe958e4931864dba69926d8a90c90d36ac4e28c9a"}, - {file = "yarl-1.9.3-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:c405d482c320a88ab53dcbd98d6d6f32ada074f2d965d6e9bf2d823158fa97de"}, - {file = "yarl-1.9.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:9df9a0d4c5624790a0dea2e02e3b1b3c69aed14bcb8650e19606d9df3719e87d"}, - {file = "yarl-1.9.3-cp310-cp310-win32.whl", hash = "sha256:d34c4f80956227f2686ddea5b3585e109c2733e2d4ef12eb1b8b4e84f09a2ab6"}, - {file = "yarl-1.9.3-cp310-cp310-win_amd64.whl", hash = "sha256:cf7a4e8de7f1092829caef66fd90eaf3710bc5efd322a816d5677b7664893c93"}, - {file = "yarl-1.9.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:d61a0ca95503867d4d627517bcfdc28a8468c3f1b0b06c626f30dd759d3999fd"}, - {file = "yarl-1.9.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:73cc83f918b69110813a7d95024266072d987b903a623ecae673d1e71579d566"}, - {file = "yarl-1.9.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d81657b23e0edb84b37167e98aefb04ae16cbc5352770057893bd222cdc6e45f"}, - {file = "yarl-1.9.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:26a1a8443091c7fbc17b84a0d9f38de34b8423b459fb853e6c8cdfab0eacf613"}, - {file = "yarl-1.9.3-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fe34befb8c765b8ce562f0200afda3578f8abb159c76de3ab354c80b72244c41"}, - {file = "yarl-1.9.3-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2c757f64afe53a422e45e3e399e1e3cf82b7a2f244796ce80d8ca53e16a49b9f"}, - {file = "yarl-1.9.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:72a57b41a0920b9a220125081c1e191b88a4cdec13bf9d0649e382a822705c65"}, - {file = "yarl-1.9.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:632c7aeb99df718765adf58eacb9acb9cbc555e075da849c1378ef4d18bf536a"}, - {file = "yarl-1.9.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:b0b8c06afcf2bac5a50b37f64efbde978b7f9dc88842ce9729c020dc71fae4ce"}, - {file = "yarl-1.9.3-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:1d93461e2cf76c4796355494f15ffcb50a3c198cc2d601ad8d6a96219a10c363"}, - {file = "yarl-1.9.3-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:4003f380dac50328c85e85416aca6985536812c082387255c35292cb4b41707e"}, - {file = "yarl-1.9.3-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:4d6d74a97e898c1c2df80339aa423234ad9ea2052f66366cef1e80448798c13d"}, - {file = "yarl-1.9.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:b61e64b06c3640feab73fa4ff9cb64bd8182de52e5dc13038e01cfe674ebc321"}, - {file = "yarl-1.9.3-cp311-cp311-win32.whl", hash = "sha256:29beac86f33d6c7ab1d79bd0213aa7aed2d2f555386856bb3056d5fdd9dab279"}, - {file = "yarl-1.9.3-cp311-cp311-win_amd64.whl", hash = "sha256:f7271d6bd8838c49ba8ae647fc06469137e1c161a7ef97d778b72904d9b68696"}, - {file = "yarl-1.9.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:dd318e6b75ca80bff0b22b302f83a8ee41c62b8ac662ddb49f67ec97e799885d"}, - {file = "yarl-1.9.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:c4b1efb11a8acd13246ffb0bee888dd0e8eb057f8bf30112e3e21e421eb82d4a"}, - {file = "yarl-1.9.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:c6f034386e5550b5dc8ded90b5e2ff7db21f0f5c7de37b6efc5dac046eb19c10"}, - {file = "yarl-1.9.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cd49a908cb6d387fc26acee8b7d9fcc9bbf8e1aca890c0b2fdfd706057546080"}, - {file = "yarl-1.9.3-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:aa4643635f26052401750bd54db911b6342eb1a9ac3e74f0f8b58a25d61dfe41"}, - {file = "yarl-1.9.3-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e741bd48e6a417bdfbae02e088f60018286d6c141639359fb8df017a3b69415a"}, - {file = "yarl-1.9.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7c86d0d0919952d05df880a1889a4f0aeb6868e98961c090e335671dea5c0361"}, - {file = "yarl-1.9.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3d5434b34100b504aabae75f0622ebb85defffe7b64ad8f52b8b30ec6ef6e4b9"}, - {file = "yarl-1.9.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:79e1df60f7c2b148722fb6cafebffe1acd95fd8b5fd77795f56247edaf326752"}, - {file = "yarl-1.9.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:44e91a669c43f03964f672c5a234ae0d7a4d49c9b85d1baa93dec28afa28ffbd"}, - {file = "yarl-1.9.3-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:3cfa4dbe17b2e6fca1414e9c3bcc216f6930cb18ea7646e7d0d52792ac196808"}, - {file = "yarl-1.9.3-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:88d2c3cc4b2f46d1ba73d81c51ec0e486f59cc51165ea4f789677f91a303a9a7"}, - {file = "yarl-1.9.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:cccdc02e46d2bd7cb5f38f8cc3d9db0d24951abd082b2f242c9e9f59c0ab2af3"}, - {file = "yarl-1.9.3-cp312-cp312-win32.whl", hash = "sha256:96758e56dceb8a70f8a5cff1e452daaeff07d1cc9f11e9b0c951330f0a2396a7"}, - {file = "yarl-1.9.3-cp312-cp312-win_amd64.whl", hash = "sha256:c4472fe53ebf541113e533971bd8c32728debc4c6d8cc177f2bff31d011ec17e"}, - {file = "yarl-1.9.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:126638ab961633f0940a06e1c9d59919003ef212a15869708dcb7305f91a6732"}, - {file = "yarl-1.9.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c99ddaddb2fbe04953b84d1651149a0d85214780e4d0ee824e610ab549d98d92"}, - {file = "yarl-1.9.3-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8dab30b21bd6fb17c3f4684868c7e6a9e8468078db00f599fb1c14e324b10fca"}, - {file = "yarl-1.9.3-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:828235a2a169160ee73a2fcfb8a000709edf09d7511fccf203465c3d5acc59e4"}, - {file = "yarl-1.9.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fc391e3941045fd0987c77484b2799adffd08e4b6735c4ee5f054366a2e1551d"}, - {file = "yarl-1.9.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:51382c72dd5377861b573bd55dcf680df54cea84147c8648b15ac507fbef984d"}, - {file = "yarl-1.9.3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:28a108cb92ce6cf867690a962372996ca332d8cda0210c5ad487fe996e76b8bb"}, - {file = "yarl-1.9.3-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:8f18a7832ff85dfcd77871fe677b169b1bc60c021978c90c3bb14f727596e0ae"}, - {file = "yarl-1.9.3-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:7eaf13af79950142ab2bbb8362f8d8d935be9aaf8df1df89c86c3231e4ff238a"}, - {file = "yarl-1.9.3-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:66a6dbf6ca7d2db03cc61cafe1ee6be838ce0fbc97781881a22a58a7c5efef42"}, - {file = "yarl-1.9.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:1a0a4f3aaa18580038cfa52a7183c8ffbbe7d727fe581300817efc1e96d1b0e9"}, - {file = "yarl-1.9.3-cp37-cp37m-win32.whl", hash = "sha256:946db4511b2d815979d733ac6a961f47e20a29c297be0d55b6d4b77ee4b298f6"}, - {file = "yarl-1.9.3-cp37-cp37m-win_amd64.whl", hash = "sha256:2dad8166d41ebd1f76ce107cf6a31e39801aee3844a54a90af23278b072f1ccf"}, - {file = "yarl-1.9.3-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:bb72d2a94481e7dc7a0c522673db288f31849800d6ce2435317376a345728225"}, - {file = "yarl-1.9.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:9a172c3d5447b7da1680a1a2d6ecdf6f87a319d21d52729f45ec938a7006d5d8"}, - {file = "yarl-1.9.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:2dc72e891672343b99db6d497024bf8b985537ad6c393359dc5227ef653b2f17"}, - {file = "yarl-1.9.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b8d51817cf4b8d545963ec65ff06c1b92e5765aa98831678d0e2240b6e9fd281"}, - {file = "yarl-1.9.3-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:53ec65f7eee8655bebb1f6f1607760d123c3c115a324b443df4f916383482a67"}, - {file = "yarl-1.9.3-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cfd77e8e5cafba3fb584e0f4b935a59216f352b73d4987be3af51f43a862c403"}, - {file = "yarl-1.9.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e73db54c967eb75037c178a54445c5a4e7461b5203b27c45ef656a81787c0c1b"}, - {file = "yarl-1.9.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:09c19e5f4404574fcfb736efecf75844ffe8610606f3fccc35a1515b8b6712c4"}, - {file = "yarl-1.9.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:6280353940f7e5e2efaaabd686193e61351e966cc02f401761c4d87f48c89ea4"}, - {file = "yarl-1.9.3-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:c25ec06e4241e162f5d1f57c370f4078797ade95c9208bd0c60f484834f09c96"}, - {file = "yarl-1.9.3-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:7217234b10c64b52cc39a8d82550342ae2e45be34f5bff02b890b8c452eb48d7"}, - {file = "yarl-1.9.3-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:4ce77d289f8d40905c054b63f29851ecbfd026ef4ba5c371a158cfe6f623663e"}, - {file = "yarl-1.9.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:5f74b015c99a5eac5ae589de27a1201418a5d9d460e89ccb3366015c6153e60a"}, - {file = "yarl-1.9.3-cp38-cp38-win32.whl", hash = "sha256:8a2538806be846ea25e90c28786136932ec385c7ff3bc1148e45125984783dc6"}, - {file = "yarl-1.9.3-cp38-cp38-win_amd64.whl", hash = "sha256:6465d36381af057d0fab4e0f24ef0e80ba61f03fe43e6eeccbe0056e74aadc70"}, - {file = "yarl-1.9.3-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:2f3c8822bc8fb4a347a192dd6a28a25d7f0ea3262e826d7d4ef9cc99cd06d07e"}, - {file = "yarl-1.9.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b7831566595fe88ba17ea80e4b61c0eb599f84c85acaa14bf04dd90319a45b90"}, - {file = "yarl-1.9.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ff34cb09a332832d1cf38acd0f604c068665192c6107a439a92abfd8acf90fe2"}, - {file = "yarl-1.9.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fe8080b4f25dfc44a86bedd14bc4f9d469dfc6456e6f3c5d9077e81a5fedfba7"}, - {file = "yarl-1.9.3-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8535e111a064f3bdd94c0ed443105934d6f005adad68dd13ce50a488a0ad1bf3"}, - {file = "yarl-1.9.3-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0d155a092bf0ebf4a9f6f3b7a650dc5d9a5bbb585ef83a52ed36ba46f55cc39d"}, - {file = "yarl-1.9.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:778df71c8d0c8c9f1b378624b26431ca80041660d7be7c3f724b2c7a6e65d0d6"}, - {file = "yarl-1.9.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b9f9cafaf031c34d95c1528c16b2fa07b710e6056b3c4e2e34e9317072da5d1a"}, - {file = "yarl-1.9.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:ca6b66f69e30f6e180d52f14d91ac854b8119553b524e0e28d5291a724f0f423"}, - {file = "yarl-1.9.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:e0e7e83f31e23c5d00ff618045ddc5e916f9e613d33c5a5823bc0b0a0feb522f"}, - {file = "yarl-1.9.3-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:af52725c7c39b0ee655befbbab5b9a1b209e01bb39128dce0db226a10014aacc"}, - {file = "yarl-1.9.3-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:0ab5baaea8450f4a3e241ef17e3d129b2143e38a685036b075976b9c415ea3eb"}, - {file = "yarl-1.9.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:6d350388ba1129bc867c6af1cd17da2b197dff0d2801036d2d7d83c2d771a682"}, - {file = "yarl-1.9.3-cp39-cp39-win32.whl", hash = "sha256:e2a16ef5fa2382af83bef4a18c1b3bcb4284c4732906aa69422cf09df9c59f1f"}, - {file = "yarl-1.9.3-cp39-cp39-win_amd64.whl", hash = "sha256:d92d897cb4b4bf915fbeb5e604c7911021a8456f0964f3b8ebbe7f9188b9eabb"}, - {file = "yarl-1.9.3-py3-none-any.whl", hash = "sha256:271d63396460b6607b588555ea27a1a02b717ca2e3f2cf53bdde4013d7790929"}, - {file = "yarl-1.9.3.tar.gz", hash = "sha256:4a14907b597ec55740f63e52d7fee0e9ee09d5b9d57a4f399a7423268e457b57"}, + {file = "yarl-1.9.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a8c1df72eb746f4136fe9a2e72b0c9dc1da1cbd23b5372f94b5820ff8ae30e0e"}, + {file = "yarl-1.9.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a3a6ed1d525bfb91b3fc9b690c5a21bb52de28c018530ad85093cc488bee2dd2"}, + {file = "yarl-1.9.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c38c9ddb6103ceae4e4498f9c08fac9b590c5c71b0370f98714768e22ac6fa66"}, + {file = "yarl-1.9.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d9e09c9d74f4566e905a0b8fa668c58109f7624db96a2171f21747abc7524234"}, + {file = "yarl-1.9.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b8477c1ee4bd47c57d49621a062121c3023609f7a13b8a46953eb6c9716ca392"}, + {file = "yarl-1.9.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d5ff2c858f5f6a42c2a8e751100f237c5e869cbde669a724f2062d4c4ef93551"}, + {file = "yarl-1.9.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:357495293086c5b6d34ca9616a43d329317feab7917518bc97a08f9e55648455"}, + {file = "yarl-1.9.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:54525ae423d7b7a8ee81ba189f131054defdb122cde31ff17477951464c1691c"}, + {file = "yarl-1.9.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:801e9264d19643548651b9db361ce3287176671fb0117f96b5ac0ee1c3530d53"}, + {file = "yarl-1.9.4-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e516dc8baf7b380e6c1c26792610230f37147bb754d6426462ab115a02944385"}, + {file = "yarl-1.9.4-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:7d5aaac37d19b2904bb9dfe12cdb08c8443e7ba7d2852894ad448d4b8f442863"}, + {file = "yarl-1.9.4-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:54beabb809ffcacbd9d28ac57b0db46e42a6e341a030293fb3185c409e626b8b"}, + {file = "yarl-1.9.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:bac8d525a8dbc2a1507ec731d2867025d11ceadcb4dd421423a5d42c56818541"}, + {file = "yarl-1.9.4-cp310-cp310-win32.whl", hash = "sha256:7855426dfbddac81896b6e533ebefc0af2f132d4a47340cee6d22cac7190022d"}, + {file = "yarl-1.9.4-cp310-cp310-win_amd64.whl", hash = "sha256:848cd2a1df56ddbffeb375535fb62c9d1645dde33ca4d51341378b3f5954429b"}, + {file = "yarl-1.9.4-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:35a2b9396879ce32754bd457d31a51ff0a9d426fd9e0e3c33394bf4b9036b099"}, + {file = "yarl-1.9.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4c7d56b293cc071e82532f70adcbd8b61909eec973ae9d2d1f9b233f3d943f2c"}, + {file = "yarl-1.9.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d8a1c6c0be645c745a081c192e747c5de06e944a0d21245f4cf7c05e457c36e0"}, + {file = "yarl-1.9.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4b3c1ffe10069f655ea2d731808e76e0f452fc6c749bea04781daf18e6039525"}, + {file = "yarl-1.9.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:549d19c84c55d11687ddbd47eeb348a89df9cb30e1993f1b128f4685cd0ebbf8"}, + {file = "yarl-1.9.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a7409f968456111140c1c95301cadf071bd30a81cbd7ab829169fb9e3d72eae9"}, + {file = "yarl-1.9.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e23a6d84d9d1738dbc6e38167776107e63307dfc8ad108e580548d1f2c587f42"}, + {file = "yarl-1.9.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d8b889777de69897406c9fb0b76cdf2fd0f31267861ae7501d93003d55f54fbe"}, + {file = "yarl-1.9.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:03caa9507d3d3c83bca08650678e25364e1843b484f19986a527630ca376ecce"}, + {file = "yarl-1.9.4-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:4e9035df8d0880b2f1c7f5031f33f69e071dfe72ee9310cfc76f7b605958ceb9"}, + {file = "yarl-1.9.4-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:c0ec0ed476f77db9fb29bca17f0a8fcc7bc97ad4c6c1d8959c507decb22e8572"}, + {file = "yarl-1.9.4-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:ee04010f26d5102399bd17f8df8bc38dc7ccd7701dc77f4a68c5b8d733406958"}, + {file = "yarl-1.9.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:49a180c2e0743d5d6e0b4d1a9e5f633c62eca3f8a86ba5dd3c471060e352ca98"}, + {file = "yarl-1.9.4-cp311-cp311-win32.whl", hash = "sha256:81eb57278deb6098a5b62e88ad8281b2ba09f2f1147c4767522353eaa6260b31"}, + {file = "yarl-1.9.4-cp311-cp311-win_amd64.whl", hash = "sha256:d1d2532b340b692880261c15aee4dc94dd22ca5d61b9db9a8a361953d36410b1"}, + {file = "yarl-1.9.4-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:0d2454f0aef65ea81037759be5ca9947539667eecebca092733b2eb43c965a81"}, + {file = "yarl-1.9.4-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:44d8ffbb9c06e5a7f529f38f53eda23e50d1ed33c6c869e01481d3fafa6b8142"}, + {file = "yarl-1.9.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:aaaea1e536f98754a6e5c56091baa1b6ce2f2700cc4a00b0d49eca8dea471074"}, + {file = "yarl-1.9.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3777ce5536d17989c91696db1d459574e9a9bd37660ea7ee4d3344579bb6f129"}, + {file = "yarl-1.9.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9fc5fc1eeb029757349ad26bbc5880557389a03fa6ada41703db5e068881e5f2"}, + {file = "yarl-1.9.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ea65804b5dc88dacd4a40279af0cdadcfe74b3e5b4c897aa0d81cf86927fee78"}, + {file = "yarl-1.9.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa102d6d280a5455ad6a0f9e6d769989638718e938a6a0a2ff3f4a7ff8c62cc4"}, + {file = "yarl-1.9.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:09efe4615ada057ba2d30df871d2f668af661e971dfeedf0c159927d48bbeff0"}, + {file = "yarl-1.9.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:008d3e808d03ef28542372d01057fd09168419cdc8f848efe2804f894ae03e51"}, + {file = "yarl-1.9.4-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:6f5cb257bc2ec58f437da2b37a8cd48f666db96d47b8a3115c29f316313654ff"}, + {file = "yarl-1.9.4-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:992f18e0ea248ee03b5a6e8b3b4738850ae7dbb172cc41c966462801cbf62cf7"}, + {file = "yarl-1.9.4-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:0e9d124c191d5b881060a9e5060627694c3bdd1fe24c5eecc8d5d7d0eb6faabc"}, + {file = "yarl-1.9.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:3986b6f41ad22988e53d5778f91855dc0399b043fc8946d4f2e68af22ee9ff10"}, + {file = "yarl-1.9.4-cp312-cp312-win32.whl", hash = "sha256:4b21516d181cd77ebd06ce160ef8cc2a5e9ad35fb1c5930882baff5ac865eee7"}, + {file = "yarl-1.9.4-cp312-cp312-win_amd64.whl", hash = "sha256:a9bd00dc3bc395a662900f33f74feb3e757429e545d831eef5bb280252631984"}, + {file = "yarl-1.9.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:63b20738b5aac74e239622d2fe30df4fca4942a86e31bf47a81a0e94c14df94f"}, + {file = "yarl-1.9.4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d7d7f7de27b8944f1fee2c26a88b4dabc2409d2fea7a9ed3df79b67277644e17"}, + {file = "yarl-1.9.4-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c74018551e31269d56fab81a728f683667e7c28c04e807ba08f8c9e3bba32f14"}, + {file = "yarl-1.9.4-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ca06675212f94e7a610e85ca36948bb8fc023e458dd6c63ef71abfd482481aa5"}, + {file = "yarl-1.9.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5aef935237d60a51a62b86249839b51345f47564208c6ee615ed2a40878dccdd"}, + {file = "yarl-1.9.4-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2b134fd795e2322b7684155b7855cc99409d10b2e408056db2b93b51a52accc7"}, + {file = "yarl-1.9.4-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:d25039a474c4c72a5ad4b52495056f843a7ff07b632c1b92ea9043a3d9950f6e"}, + {file = "yarl-1.9.4-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:f7d6b36dd2e029b6bcb8a13cf19664c7b8e19ab3a58e0fefbb5b8461447ed5ec"}, + {file = "yarl-1.9.4-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:957b4774373cf6f709359e5c8c4a0af9f6d7875db657adb0feaf8d6cb3c3964c"}, + {file = "yarl-1.9.4-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:d7eeb6d22331e2fd42fce928a81c697c9ee2d51400bd1a28803965883e13cead"}, + {file = "yarl-1.9.4-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:6a962e04b8f91f8c4e5917e518d17958e3bdee71fd1d8b88cdce74dd0ebbf434"}, + {file = "yarl-1.9.4-cp37-cp37m-win32.whl", hash = "sha256:f3bc6af6e2b8f92eced34ef6a96ffb248e863af20ef4fde9448cc8c9b858b749"}, + {file = "yarl-1.9.4-cp37-cp37m-win_amd64.whl", hash = "sha256:ad4d7a90a92e528aadf4965d685c17dacff3df282db1121136c382dc0b6014d2"}, + {file = "yarl-1.9.4-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:ec61d826d80fc293ed46c9dd26995921e3a82146feacd952ef0757236fc137be"}, + {file = "yarl-1.9.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8be9e837ea9113676e5754b43b940b50cce76d9ed7d2461df1af39a8ee674d9f"}, + {file = "yarl-1.9.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:bef596fdaa8f26e3d66af846bbe77057237cb6e8efff8cd7cc8dff9a62278bbf"}, + {file = "yarl-1.9.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2d47552b6e52c3319fede1b60b3de120fe83bde9b7bddad11a69fb0af7db32f1"}, + {file = "yarl-1.9.4-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:84fc30f71689d7fc9168b92788abc977dc8cefa806909565fc2951d02f6b7d57"}, + {file = "yarl-1.9.4-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4aa9741085f635934f3a2583e16fcf62ba835719a8b2b28fb2917bb0537c1dfa"}, + {file = "yarl-1.9.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:206a55215e6d05dbc6c98ce598a59e6fbd0c493e2de4ea6cc2f4934d5a18d130"}, + {file = "yarl-1.9.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07574b007ee20e5c375a8fe4a0789fad26db905f9813be0f9fef5a68080de559"}, + {file = "yarl-1.9.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:5a2e2433eb9344a163aced6a5f6c9222c0786e5a9e9cac2c89f0b28433f56e23"}, + {file = "yarl-1.9.4-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:6ad6d10ed9b67a382b45f29ea028f92d25bc0bc1daf6c5b801b90b5aa70fb9ec"}, + {file = "yarl-1.9.4-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:6fe79f998a4052d79e1c30eeb7d6c1c1056ad33300f682465e1b4e9b5a188b78"}, + {file = "yarl-1.9.4-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:a825ec844298c791fd28ed14ed1bffc56a98d15b8c58a20e0e08c1f5f2bea1be"}, + {file = "yarl-1.9.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8619d6915b3b0b34420cf9b2bb6d81ef59d984cb0fde7544e9ece32b4b3043c3"}, + {file = "yarl-1.9.4-cp38-cp38-win32.whl", hash = "sha256:686a0c2f85f83463272ddffd4deb5e591c98aac1897d65e92319f729c320eece"}, + {file = "yarl-1.9.4-cp38-cp38-win_amd64.whl", hash = "sha256:a00862fb23195b6b8322f7d781b0dc1d82cb3bcac346d1e38689370cc1cc398b"}, + {file = "yarl-1.9.4-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:604f31d97fa493083ea21bd9b92c419012531c4e17ea6da0f65cacdcf5d0bd27"}, + {file = "yarl-1.9.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8a854227cf581330ffa2c4824d96e52ee621dd571078a252c25e3a3b3d94a1b1"}, + {file = "yarl-1.9.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ba6f52cbc7809cd8d74604cce9c14868306ae4aa0282016b641c661f981a6e91"}, + {file = "yarl-1.9.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a6327976c7c2f4ee6816eff196e25385ccc02cb81427952414a64811037bbc8b"}, + {file = "yarl-1.9.4-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:8397a3817d7dcdd14bb266283cd1d6fc7264a48c186b986f32e86d86d35fbac5"}, + {file = "yarl-1.9.4-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e0381b4ce23ff92f8170080c97678040fc5b08da85e9e292292aba67fdac6c34"}, + {file = "yarl-1.9.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:23d32a2594cb5d565d358a92e151315d1b2268bc10f4610d098f96b147370136"}, + {file = "yarl-1.9.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ddb2a5c08a4eaaba605340fdee8fc08e406c56617566d9643ad8bf6852778fc7"}, + {file = "yarl-1.9.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:26a1dc6285e03f3cc9e839a2da83bcbf31dcb0d004c72d0730e755b33466c30e"}, + {file = "yarl-1.9.4-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:18580f672e44ce1238b82f7fb87d727c4a131f3a9d33a5e0e82b793362bf18b4"}, + {file = "yarl-1.9.4-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:29e0f83f37610f173eb7e7b5562dd71467993495e568e708d99e9d1944f561ec"}, + {file = "yarl-1.9.4-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:1f23e4fe1e8794f74b6027d7cf19dc25f8b63af1483d91d595d4a07eca1fb26c"}, + {file = "yarl-1.9.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:db8e58b9d79200c76956cefd14d5c90af54416ff5353c5bfd7cbe58818e26ef0"}, + {file = "yarl-1.9.4-cp39-cp39-win32.whl", hash = "sha256:c7224cab95645c7ab53791022ae77a4509472613e839dab722a72abe5a684575"}, + {file = "yarl-1.9.4-cp39-cp39-win_amd64.whl", hash = "sha256:824d6c50492add5da9374875ce72db7a0733b29c2394890aef23d533106e2b15"}, + {file = "yarl-1.9.4-py3-none-any.whl", hash = "sha256:928cecb0ef9d5a7946eb6ff58417ad2fe9375762382f1bf5c55e61645f2c43ad"}, + {file = "yarl-1.9.4.tar.gz", hash = "sha256:566db86717cf8080b99b58b083b773a908ae40f06681e87e589a976faf8246bf"}, ] [package.dependencies] @@ -1783,4 +1797,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "172bc32d35fc45fdb6414daeca973e075adbf970387be505268cd1bc17a1149a" +content-hash = "75368138f4afea6249bab8d2c059f380d3df421d5b4b8f0e85676e76f60c5bd8" diff --git a/openbb_platform/core/pyproject.toml b/openbb_platform/core/pyproject.toml index 6b6aec69f97b..5980d77cb163 100644 --- a/openbb_platform/core/pyproject.toml +++ b/openbb_platform/core/pyproject.toml @@ -22,7 +22,6 @@ requests = "^2.31.0" importlib-metadata = "^6.8.0" python-dotenv = "^1.0.0" aiohttp = "^3.9.0" -black = "^23.11.0" ruff = "^0.1.6" [tool.poetry.group.dev.dependencies] @@ -30,6 +29,7 @@ pytest = "^7.0.0" pytest-subtests = "^0.11.0" pytest-recorder = "^0.2.4" pytest-asyncio = "^0.23.2" +black = "^23.11.0" [build-system] requires = ["poetry-core"] diff --git a/openbb_platform/core/tests/app/static/test_build_utils.py b/openbb_platform/core/tests/app/static/test_build_utils.py deleted file mode 100644 index ebedee369229..000000000000 --- a/openbb_platform/core/tests/app/static/test_build_utils.py +++ /dev/null @@ -1,136 +0,0 @@ -"""Test the utils.py file.""" -# pylint: disable=redefined-outer-name - - -from pathlib import Path -from unittest.mock import PropertyMock, mock_open, patch - -import pytest -from importlib_metadata import EntryPoint, EntryPoints -from openbb_core.app.static.build_utils import auto_build, get_ext_map, package_diff -from openbb_core.env import Env - -PATH = "openbb_core.app.static.build_utils." - - -@pytest.fixture(scope="function") -def tmp_dir(tmp_path_factory): - return tmp_path_factory.mktemp("tmp_dir") - - -def test_get_ext_map(tmp_dir): - """Test extensions map.""" - - open_mock = mock_open() - with patch(PATH + "open", open_mock), patch(PATH + "load") as mock_load: - get_ext_map(package=tmp_dir) - open_mock.assert_called_once_with(Path(tmp_dir, "extension_map.json")) - mock_load.assert_called_once() - - -@pytest.mark.parametrize( - "ext_built, ext_installed, ext_inst_version, expected_add, expected_remove", - [ - ( - { - "openbb_core_extension": [ - "ext_1@0.0.0", - "ext_2@0.0.0", - ], - "openbb_provider_extension": [ - "prov_1@0.0.0", - "prov_2@1.1.1", - ], - }, - EntryPoints( - ( - EntryPoint( - name="ext_2", value="...", group="openbb_core_extension" - ), - EntryPoint( - name="prov_2", value="...", group="openbb_provider_extension" - ), - ) - ), - "0.0.0", - {"prov_2@0.0.0"}, - {"ext_1@0.0.0", "prov_1@0.0.0", "prov_2@1.1.1"}, - ), - ( - { - "openbb_core_extension": ["ext_1@9.9.9"], - "openbb_provider_extension": ["prov_2@0.0.0"], - }, - EntryPoints( - ( - EntryPoint( - name="ext_2", value="...", group="openbb_core_extension" - ), - EntryPoint( - name="prov_1", value="...", group="openbb_provider_extension" - ), - ) - ), - "5.5.5", - {"ext_2@5.5.5", "prov_1@5.5.5"}, - {"ext_1@9.9.9", "prov_2@0.0.0"}, - ), - ], -) -def test_package_diff( - tmp_dir, - ext_built, - ext_installed, - ext_inst_version, - expected_add, - expected_remove, -): - """Test package differences.""" - - def mock_entry_points(group): - return ext_installed.select(**{"group": group}) - - with patch(PATH + "get_ext_map") as mock_get_ext_map, patch( - PATH + "entry_points", mock_entry_points - ), patch.object(EntryPoint, "dist", new_callable=PropertyMock) as mock_obj: - - class MockPathDistribution: - version = ext_inst_version - - mock_obj.return_value = MockPathDistribution() - mock_get_ext_map.return_value = ext_built - - add, remove = package_diff(tmp_dir) - - # We add whatever is not built, but is installed - assert add == expected_add - # We remove whatever is built, but is not installed - assert remove == expected_remove - - -@pytest.mark.parametrize( - "add, remove, openbb_auto_build", - [ - (set(), set(), True), - ({"this"}, set(), True), - (set(), {"that"}, True), - ({"this"}, {"that"}, True), - ({"this"}, {"that"}, False), - ], -) -def test_auto_build(tmp_dir, add, remove, openbb_auto_build): - """Test auto build.""" - - with patch(PATH + "package_diff") as mock_package_diff, patch( - PATH + "build" - ) as mock_build, patch.object(Env, "AUTO_BUILD", openbb_auto_build): - mock_package_diff.return_value = add, remove - auto_build(tmp_dir) - - if openbb_auto_build: - mock_package_diff.assert_called_once_with(Path(tmp_dir, "package")) - if add or remove: - mock_build.assert_called_once_with(tmp_dir) - else: - mock_package_diff.assert_not_called() - mock_build.assert_not_called() diff --git a/openbb_platform/core/tests/app/static/test_filters.py b/openbb_platform/core/tests/app/static/test_filters.py index 13e137a6abc0..9e16aadaf119 100644 --- a/openbb_platform/core/tests/app/static/test_filters.py +++ b/openbb_platform/core/tests/app/static/test_filters.py @@ -3,7 +3,7 @@ import numpy as np import pandas as pd import pytest -from openbb_core.app.static.filters import filter_inputs +from openbb_core.app.static.utils.filters import filter_inputs from openbb_core.provider.abstract.data import Data diff --git a/openbb_platform/core/tests/app/static/test_package_builder.py b/openbb_platform/core/tests/app/static/test_package_builder.py index 757ab48ef9d2..9c7c17b56819 100644 --- a/openbb_platform/core/tests/app/static/test_package_builder.py +++ b/openbb_platform/core/tests/app/static/test_package_builder.py @@ -1,23 +1,25 @@ """Test the package_builder.py file.""" -# pylint: disable=redefined-outer-name +# pylint: disable=redefined-outer-name, protected-access from dataclasses import dataclass from inspect import _empty -from unittest.mock import patch +from pathlib import Path +from unittest.mock import PropertyMock, mock_open, patch import pandas import pytest +from importlib_metadata import EntryPoint, EntryPoints from openbb_core.app.static.package_builder import ( ClassDefinition, DocstringGenerator, ImportDefinition, - Linters, MethodDefinition, ModuleBuilder, PackageBuilder, Parameter, PathHandler, ) +from openbb_core.env import Env from pydantic import Field from typing_extensions import Annotated @@ -45,27 +47,27 @@ def test_package_builder_build(package_builder): def test_save_module_map(package_builder): """Test save module map.""" - package_builder.save_module_map() + package_builder._save_module_map() def test_save_modules(package_builder): """Test save module.""" - package_builder.save_modules() + package_builder._save_modules() def test_save_package(package_builder): """Test save package.""" - package_builder.save_package() + package_builder._save_package() def test_run_linters(package_builder): """Test run linters.""" - package_builder.run_linters() + package_builder._run_linters() -def test_write_to_package(package_builder): +def test_write(package_builder): """Test save to package.""" - package_builder.write_to_package(code="", name="test", extension="json") + package_builder._write(code="", name="test", extension="json") @pytest.fixture(scope="module") @@ -237,7 +239,9 @@ def test_build_func_params(method_definition): ), } - expected_output = "param1: None, param2: int, param3: pandas.DataFrame" + expected_output = ( + "param1: None,\n param2: int,\n param3: pandas.DataFrame" + ) output = method_definition.build_func_params(param_map) assert output == expected_output @@ -289,8 +293,8 @@ def some_func(): assert isinstance(output, str) -def test_build_command_method_implementation(method_definition): - """Test build command method implementation.""" +def test_build_command_method_body(method_definition): + """Test build command method body.""" def some_func(): """Do some func doc.""" @@ -300,7 +304,7 @@ def some_func(): "openbb_core.app.static.package_builder.MethodDefinition.is_data_processing_function", **{"return_value": False}, ): - output = method_definition.build_command_method_implementation( + output = method_definition.build_command_method_body( path="openbb_core.app.static.container.Container", func=some_func ) @@ -439,37 +443,6 @@ def test_build_module_class(path_handler): assert module_class == "ROUTER_equity_price_historical" -@pytest.fixture(scope="module") -def linters(tmp_package_dir): - """Return linters.""" - return Linters(tmp_package_dir) - - -def test_linters_init(linters): - """Test linters init.""" - assert linters - - -def test_print_separator(linters): - """Test print separator.""" - linters.print_separator(symbol="AAPL") - - -def test_run(linters): - """Test run.""" - linters.run(linter="ruff") - - -def test_ruff(linters): - """Test ruff.""" - linters.ruff() - - -def test_black(linters): - """Test black.""" - linters.black() - - @pytest.fixture(scope="module") def docstring_generator(): """Return package builder.""" @@ -539,3 +512,129 @@ def some_func(): assert doc assert "Parameters" in doc assert "Returns" in doc + + +def test_read_extension_map(package_builder, tmp_package_dir): + """Test read extension map.""" + + PATH = "openbb_core.app.static.package_builder." + open_mock = mock_open() + with patch(PATH + "open", open_mock), patch(PATH + "load") as mock_load: + package_builder._read_extension_map(tmp_package_dir) + open_mock.assert_called_once_with(Path(tmp_package_dir, "extension_map.json")) + mock_load.assert_called_once() + + +@pytest.mark.parametrize( + "ext_built, ext_installed, ext_inst_version, expected_add, expected_remove", + [ + ( + { + "openbb_core_extension": [ + "ext_1@0.0.0", + "ext_2@0.0.0", + ], + "openbb_provider_extension": [ + "prov_1@0.0.0", + "prov_2@1.1.1", + ], + }, + EntryPoints( + ( + EntryPoint( + name="ext_2", value="...", group="openbb_core_extension" + ), + EntryPoint( + name="prov_2", value="...", group="openbb_provider_extension" + ), + ) + ), + "0.0.0", + {"prov_2@0.0.0"}, + {"ext_1@0.0.0", "prov_1@0.0.0", "prov_2@1.1.1"}, + ), + ( + { + "openbb_core_extension": ["ext_1@9.9.9"], + "openbb_provider_extension": ["prov_2@0.0.0"], + }, + EntryPoints( + ( + EntryPoint( + name="ext_2", value="...", group="openbb_core_extension" + ), + EntryPoint( + name="prov_1", value="...", group="openbb_provider_extension" + ), + ) + ), + "5.5.5", + {"ext_2@5.5.5", "prov_1@5.5.5"}, + {"ext_1@9.9.9", "prov_2@0.0.0"}, + ), + ], +) +def test_package_diff( + package_builder, + tmp_package_dir, + ext_built, + ext_installed, + ext_inst_version, + expected_add, + expected_remove, +): + """Test package differences.""" + + def mock_entry_points(group): + return ext_installed.select(**{"group": group}) + + PATH = "openbb_core.app.static.package_builder." + with patch.object( + PackageBuilder, "_read_extension_map" + ) as mock_read_extension_map, patch( + PATH + "entry_points", mock_entry_points + ), patch.object( + EntryPoint, "dist", new_callable=PropertyMock + ) as mock_obj: + + class MockPathDistribution: + version = ext_inst_version + + mock_obj.return_value = MockPathDistribution() + mock_read_extension_map.return_value = ext_built + + add, remove = package_builder._diff(tmp_package_dir) + + # We add whatever is not built, but is installed + assert add == expected_add + # We remove whatever is built, but is not installed + assert remove == expected_remove + + +@pytest.mark.parametrize( + "add, remove, openbb_auto_build", + [ + (set(), set(), True), + ({"this"}, set(), True), + (set(), {"that"}, True), + ({"this"}, {"that"}, True), + ({"this"}, {"that"}, False), + ], +) +def test_auto_build(package_builder, tmp_package_dir, add, remove, openbb_auto_build): + """Test auto build.""" + + with patch.object(PackageBuilder, "_diff") as mock_package_diff, patch.object( + PackageBuilder, "build" + ) as mock_build, patch.object(Env, "AUTO_BUILD", openbb_auto_build): + mock_package_diff.return_value = add, remove + + package_builder.auto_build() + + if openbb_auto_build: + mock_package_diff.assert_called_once_with(Path(tmp_package_dir, "package")) + if add or remove: + mock_build.assert_called_once() + else: + mock_package_diff.assert_not_called() + mock_build.assert_not_called() diff --git a/openbb_platform/core/tests/app/static/utils/test_linters.py b/openbb_platform/core/tests/app/static/utils/test_linters.py new file mode 100644 index 000000000000..3b55ac304f0c --- /dev/null +++ b/openbb_platform/core/tests/app/static/utils/test_linters.py @@ -0,0 +1,43 @@ +"""Test linters.py file.""" +# pylint: disable=redefined-outer-name + +import pytest +from openbb_core.app.static.package_builder import ( + Linters, +) + + +@pytest.fixture(scope="module") +def tmp_package_dir(tmp_path_factory): + return tmp_path_factory.mktemp("package") + + +@pytest.fixture(scope="module") +def linters(tmp_package_dir): + """Return linters.""" + return Linters(tmp_package_dir) + + +def test_linters_init(linters): + """Test linters init.""" + assert linters + + +def test_print_separator(linters): + """Test print separator.""" + linters.print_separator(symbol="AAPL") + + +def test_run(linters): + """Test run.""" + linters.run(linter="ruff") + + +def test_ruff(linters): + """Test ruff.""" + linters.ruff() + + +def test_black(linters): + """Test black.""" + linters.black() diff --git a/openbb_platform/openbb/__init__.py b/openbb_platform/openbb/__init__.py index c46f0490faa5..d20635b89ad3 100644 --- a/openbb_platform/openbb/__init__.py +++ b/openbb_platform/openbb/__init__.py @@ -1,7 +1,6 @@ """OpenBB Platform.""" # flake8: noqa -import os from pathlib import Path from typing import List, Optional, Union @@ -9,12 +8,9 @@ BaseApp as _BaseApp, create_app as _create_app, ) -from openbb_core.app.static.build_utils import ( - auto_build as _auto_build, - build as _build, -) +from openbb_core.app.static.package_builder import PackageBuilder as _PackageBuilder -_this_dir = Path(os.path.dirname(os.path.realpath(__file__))) +_this_dir = Path(__file__).parent.resolve() def build( @@ -35,10 +31,10 @@ def build( verbose : bool, optional Enable/disable verbose mode """ - _build(directory=_this_dir, modules=modules, lint=lint, verbose=verbose) + _PackageBuilder(_this_dir, lint, verbose).build(modules) -_auto_build(directory=_this_dir) +_PackageBuilder(_this_dir).auto_build() try: # pylint: disable=import-outside-toplevel diff --git a/openbb_platform/openbb/package/__extensions__.py b/openbb_platform/openbb/package/__extensions__.py index 369479a3f2d1..27e79fd0f14b 100644 --- a/openbb_platform/openbb/package/__extensions__.py +++ b/openbb_platform/openbb/package/__extensions__.py @@ -41,65 +41,76 @@ class Extensions(Container): - tiingo@1.0.0 - tradingeconomics@1.0.0 """ # fmt: on + def __repr__(self) -> str: return self.__doc__ or "" @property - def crypto(self): # route = "/crypto" + def crypto(self): + # pylint: disable=import-outside-toplevel from . import crypto return crypto.ROUTER_crypto(command_runner=self._command_runner) @property - def currency(self): # route = "/currency" + def currency(self): + # pylint: disable=import-outside-toplevel from . import currency return currency.ROUTER_currency(command_runner=self._command_runner) @property - def derivatives(self): # route = "/derivatives" + def derivatives(self): + # pylint: disable=import-outside-toplevel from . import derivatives return derivatives.ROUTER_derivatives(command_runner=self._command_runner) @property - def economy(self): # route = "/economy" + def economy(self): + # pylint: disable=import-outside-toplevel from . import economy return economy.ROUTER_economy(command_runner=self._command_runner) @property - def equity(self): # route = "/equity" + def equity(self): + # pylint: disable=import-outside-toplevel from . import equity return equity.ROUTER_equity(command_runner=self._command_runner) @property - def etf(self): # route = "/etf" + def etf(self): + # pylint: disable=import-outside-toplevel from . import etf return etf.ROUTER_etf(command_runner=self._command_runner) @property - def fixedincome(self): # route = "/fixedincome" + def fixedincome(self): + # pylint: disable=import-outside-toplevel from . import fixedincome return fixedincome.ROUTER_fixedincome(command_runner=self._command_runner) @property - def index(self): # route = "/index" + def index(self): + # pylint: disable=import-outside-toplevel from . import index return index.ROUTER_index(command_runner=self._command_runner) @property - def news(self): # route = "/news" + def news(self): + # pylint: disable=import-outside-toplevel from . import news return news.ROUTER_news(command_runner=self._command_runner) @property - def regulators(self): # route = "/regulators" + def regulators(self): + # pylint: disable=import-outside-toplevel from . import regulators return regulators.ROUTER_regulators(command_runner=self._command_runner) diff --git a/openbb_platform/openbb/package/crypto.py b/openbb_platform/openbb/package/crypto.py index 0e1fbc520dc0..3839ceb26086 100644 --- a/openbb_platform/openbb/package/crypto.py +++ b/openbb_platform/openbb/package/crypto.py @@ -1,13 +1,12 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from typing import List, Literal, Optional +from typing import Literal, Optional from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -21,7 +20,8 @@ def __repr__(self) -> str: return self.__doc__ or "" @property - def price(self): # route = "/crypto/price" + def price(self): + # pylint: disable=import-outside-toplevel from . import crypto_price return crypto_price.ROUTER_crypto_price(command_runner=self._command_runner) @@ -34,7 +34,7 @@ def search( ] = "", provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Cryptocurrency Search. Search available cryptocurrency pairs. Parameters @@ -79,17 +79,15 @@ def search( >>> obb.crypto.search() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "query": query, - }, - extra_params=kwargs, - ) - return self._run( "/crypto/search", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "query": query, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/crypto_price.py b/openbb_platform/openbb/package/crypto_price.py index d96c4cef1912..ef6bf0fe6d6b 100644 --- a/openbb_platform/openbb/package/crypto_price.py +++ b/openbb_platform/openbb/package/crypto_price.py @@ -6,9 +6,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -43,7 +42,7 @@ def historical( ] = None, provider: Optional[Literal["fmp", "polygon", "tiingo"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Cryptocurrency Historical Price. Cryptocurrency historical price data. Parameters @@ -129,19 +128,17 @@ def historical( >>> obb.crypto.price.historical(symbol="BTCUSD") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/crypto/price/historical", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/currency.py b/openbb_platform/openbb/package/currency.py index a1c42cc01436..bc9cb9a4bfa4 100644 --- a/openbb_platform/openbb/package/currency.py +++ b/openbb_platform/openbb/package/currency.py @@ -1,12 +1,11 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from typing import List, Literal, Optional +from typing import Literal, Optional from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs class ROUTER_currency(Container): @@ -19,7 +18,8 @@ def __repr__(self) -> str: return self.__doc__ or "" @property - def price(self): # route = "/currency/price" + def price(self): + # pylint: disable=import-outside-toplevel from . import currency_price return currency_price.ROUTER_currency_price(command_runner=self._command_runner) @@ -27,7 +27,7 @@ def price(self): # route = "/currency/price" @validate def search( self, provider: Optional[Literal["fmp", "intrinio", "polygon"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Currency Search. Search available currency pairs. Parameters @@ -106,15 +106,13 @@ def search( >>> obb.currency.search() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={}, - extra_params=kwargs, - ) - return self._run( "/currency/search", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={}, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/currency_price.py b/openbb_platform/openbb/package/currency_price.py index 851289d31a79..744c4acb9253 100644 --- a/openbb_platform/openbb/package/currency_price.py +++ b/openbb_platform/openbb/package/currency_price.py @@ -6,9 +6,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -43,7 +42,7 @@ def historical( ] = None, provider: Optional[Literal["fmp", "polygon", "tiingo"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Currency Historical Price. Currency historical data. Parameters @@ -122,19 +121,17 @@ def historical( >>> obb.currency.price.historical(symbol="EURUSD") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/currency/price/historical", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/derivatives.py b/openbb_platform/openbb/package/derivatives.py index ce67e02ed06c..d14a4fdd8c43 100644 --- a/openbb_platform/openbb/package/derivatives.py +++ b/openbb_platform/openbb/package/derivatives.py @@ -13,7 +13,8 @@ def __repr__(self) -> str: return self.__doc__ or "" @property - def options(self): # route = "/derivatives/options" + def options(self): + # pylint: disable=import-outside-toplevel from . import derivatives_options return derivatives_options.ROUTER_derivatives_options( diff --git a/openbb_platform/openbb/package/derivatives_options.py b/openbb_platform/openbb/package/derivatives_options.py index 57727a0214ed..7e43dfe1afe9 100644 --- a/openbb_platform/openbb/package/derivatives_options.py +++ b/openbb_platform/openbb/package/derivatives_options.py @@ -5,9 +5,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -29,7 +28,7 @@ def chains( ], provider: Optional[Literal["intrinio"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Get the complete options chain for a ticker. Parameters @@ -118,19 +117,17 @@ def chains( >>> obb.derivatives.options.chains(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/derivatives/options/chains", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -144,7 +141,7 @@ def unusual( ] = None, provider: Optional[Literal["intrinio"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Get the complete options chain for a ticker. Parameters @@ -203,17 +200,15 @@ def unusual( >>> obb.derivatives.options.unusual() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/derivatives/options/unusual", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/economy.py b/openbb_platform/openbb/package/economy.py index be9f3a85f006..fa8d5c634e8e 100644 --- a/openbb_platform/openbb/package/economy.py +++ b/openbb_platform/openbb/package/economy.py @@ -6,9 +6,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -42,7 +41,7 @@ def calendar( ] = None, provider: Optional[Literal["fmp", "tradingeconomics"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Economic Calendar. Parameters @@ -121,20 +120,18 @@ def calendar( >>> obb.economy.calendar() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/economy/calendar", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) @validate @@ -199,7 +196,7 @@ def cpi( units: Annotated[ Literal["growth_previous", "growth_same", "index_2015"], OpenBBCustomParameter( - description="The unit of measurement for the data.\n Options:\n - `growth_previous`: growth from the previous period\n - `growth_same`: growth from the same period in the previous year\n - `index_2015`: index with base year 2015." + description="The unit of measurement for the data.\n Options:\n - `growth_previous`: Percent growth from the previous period.\n If monthly data, this is month-over-month, etc\n - `growth_same`: Percent growth from the same period in the previous year.\n If looking at monthly data, this would be year-over-year, etc.\n - `index_2015`: Rescaled index value, such that the value in 2015 is 100." ), ] = "growth_same", frequency: Annotated[ @@ -228,8 +225,8 @@ def cpi( ] = None, provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: - """Consumer Price Index (CPI) Data. + ) -> OBBject: + """Consumer Price Index (CPI). Returns either the rescaled index value, or a rate of change (inflation). Parameters ---------- @@ -238,9 +235,11 @@ def cpi( units : Literal['growth_previous', 'growth_same', 'index_2015'] The unit of measurement for the data. Options: - - `growth_previous`: growth from the previous period - - `growth_same`: growth from the same period in the previous year - - `index_2015`: index with base year 2015. + - `growth_previous`: Percent growth from the previous period. + If monthly data, this is month-over-month, etc + - `growth_same`: Percent growth from the same period in the previous year. + If looking at monthly data, this would be year-over-year, etc. + - `index_2015`: Rescaled index value, such that the value in 2015 is 100. frequency : Literal['monthly', 'quarter', 'annual'] The frequency of the data. Options: `monthly`, `quarter`, and `annual`. @@ -280,24 +279,22 @@ def cpi( >>> obb.economy.cpi(countries=['portugal', 'spain'], units="growth_same", frequency="monthly") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "countries": countries, - "units": units, - "frequency": frequency, - "harmonized": harmonized, - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/economy/cpi", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "countries": countries, + "units": units, + "frequency": frequency, + "harmonized": harmonized, + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) @validate @@ -308,110 +305,108 @@ def fred_search( ] = None, provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """ - Search for FRED series or economic releases by ID or fuzzy query. - This does not return the observation values, only the metadata. - Use this function to find series IDs for `fred_series()`. + Search for FRED series or economic releases by ID or string. + This does not return the observation values, only the metadata. + Use this function to find series IDs for `fred_series()`. - Parameters - ---------- - query : Optional[str] - The search word(s). - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - is_release : Optional[bool] - Is release? If True, other search filter variables are ignored. If no query text or release_id is supplied, this defaults to True. (provider: fred) - release_id : Optional[Union[str, int]] - A specific release ID to target. (provider: fred) - limit : Optional[int] - The number of data entries to return. (1-1000) (provider: fred) - offset : Optional[Annotated[int, Ge(ge=0)]] - Offset the results in conjunction with limit. (provider: fred) - filter_variable : Literal[None, 'frequency', 'units', 'seasonal_adjustment'] - Filter by an attribute. (provider: fred) - filter_value : Optional[str] - String value to filter the variable by. Used in conjunction with filter_variable. (provider: fred) - tag_names : Optional[str] - A semicolon delimited list of tag names that series match all of. Example: 'japan;imports' (provider: fred) - exclude_tag_names : Optional[str] - A semicolon delimited list of tag names that series match none of. Example: 'imports;services'. Requires that variable tag_names also be set to limit the number of matching series. (provider: fred) - - Returns - ------- - OBBject - results : List[FredSearch] - Serializable results. + Parameters + ---------- + query : Optional[str] + The search word(s). provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - FredSearch - ---------- - release_id : Optional[Union[str, int]] - The release ID for queries. - series_id : Optional[str] - The series ID for the item in the release. - name : Optional[str] - The name of the release. - title : Optional[str] - The title of the series. - observation_start : Optional[date] - The date of the first observation in the series. - observation_end : Optional[date] - The date of the last observation in the series. - frequency : Optional[str] - The frequency of the data. - frequency_short : Optional[str] - Short form of the data frequency. - units : Optional[str] - The units of the data. - units_short : Optional[str] - Short form of the data units. - seasonal_adjustment : Optional[str] - The seasonal adjustment of the data. - seasonal_adjustment_short : Optional[str] - Short form of the data seasonal adjustment. - last_updated : Optional[datetime] - The datetime of the last update to the data. - notes : Optional[str] - Description of the release. - press_release : Optional[bool] - If the release is a press release. - url : Optional[str] - URL to the release. - popularity : Optional[int] - Popularity of the series (provider: fred) - group_popularity : Optional[int] - Group popularity of the release (provider: fred) - - Example - ------- - >>> from openbb import obb - >>> obb.economy.fred_search() + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + is_release : Optional[bool] + Is release? If True, other search filter variables are ignored. If no query text or release_id is supplied, this defaults to True. (provider: fred) + release_id : Optional[Union[str, int]] + A specific release ID to target. (provider: fred) + limit : Optional[int] + The number of data entries to return. (1-1000) (provider: fred) + offset : Optional[Annotated[int, Ge(ge=0)]] + Offset the results in conjunction with limit. (provider: fred) + filter_variable : Literal[None, 'frequency', 'units', 'seasonal_adjustment'] + Filter by an attribute. (provider: fred) + filter_value : Optional[str] + String value to filter the variable by. Used in conjunction with filter_variable. (provider: fred) + tag_names : Optional[str] + A semicolon delimited list of tag names that series match all of. Example: 'japan;imports' (provider: fred) + exclude_tag_names : Optional[str] + A semicolon delimited list of tag names that series match none of. Example: 'imports;services'. Requires that variable tag_names also be set to limit the number of matching series. (provider: fred) + + Returns + ------- + OBBject + results : List[FredSearch] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + FredSearch + ---------- + release_id : Optional[Union[str, int]] + The release ID for queries. + series_id : Optional[str] + The series ID for the item in the release. + name : Optional[str] + The name of the release. + title : Optional[str] + The title of the series. + observation_start : Optional[date] + The date of the first observation in the series. + observation_end : Optional[date] + The date of the last observation in the series. + frequency : Optional[str] + The frequency of the data. + frequency_short : Optional[str] + Short form of the data frequency. + units : Optional[str] + The units of the data. + units_short : Optional[str] + Short form of the data units. + seasonal_adjustment : Optional[str] + The seasonal adjustment of the data. + seasonal_adjustment_short : Optional[str] + Short form of the data seasonal adjustment. + last_updated : Optional[datetime] + The datetime of the last update to the data. + notes : Optional[str] + Description of the release. + press_release : Optional[bool] + If the release is a press release. + url : Optional[str] + URL to the release. + popularity : Optional[int] + Popularity of the series (provider: fred) + group_popularity : Optional[int] + Group popularity of the release (provider: fred) + + Example + ------- + >>> from openbb import obb + >>> obb.economy.fred_search() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "query": query, - }, - extra_params=kwargs, - ) - return self._run( "/economy/fred_search", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "query": query, + }, + extra_params=kwargs, + ) ) @validate @@ -439,7 +434,7 @@ def fred_series( ] = 100000, provider: Optional[Literal["fred", "intrinio"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Get data by series ID from FRED. Parameters @@ -528,26 +523,25 @@ def fred_series( >>> obb.economy.fred_series(symbol="AAPL", limit=100000) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "start_date": start_date, - "end_date": end_date, - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/economy/fred_series", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "start_date": start_date, + "end_date": end_date, + "limit": limit, + }, + extra_params=kwargs, + ) ) @property - def gdp(self): # route = "/economy/gdp" + def gdp(self): + # pylint: disable=import-outside-toplevel from . import economy_gdp return economy_gdp.ROUTER_economy_gdp(command_runner=self._command_runner) @@ -555,7 +549,7 @@ def gdp(self): # route = "/economy/gdp" @validate def risk_premium( self, provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Historical Market Risk Premium. Parameters @@ -596,15 +590,13 @@ def risk_premium( >>> obb.economy.risk_premium() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={}, - extra_params=kwargs, - ) - return self._run( "/economy/risk_premium", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={}, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/economy_gdp.py b/openbb_platform/openbb/package/economy_gdp.py index 91b0a68d28bc..5cb9b376d800 100644 --- a/openbb_platform/openbb/package/economy_gdp.py +++ b/openbb_platform/openbb/package/economy_gdp.py @@ -1,14 +1,13 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### import datetime -from typing import List, Literal, Optional, Union +from typing import Literal, Optional, Union from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -51,7 +50,7 @@ def forecast( ] = "real", provider: Optional[Literal["oecd"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Forecasted GDP Data. Parameters @@ -98,22 +97,20 @@ def forecast( >>> obb.economy.gdp.forecast(period="annual", type="real") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "period": period, - "start_date": start_date, - "end_date": end_date, - "type": type, - }, - extra_params=kwargs, - ) - return self._run( "/economy/gdp/forecast", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "period": period, + "start_date": start_date, + "end_date": end_date, + "type": type, + }, + extra_params=kwargs, + ) ) @validate @@ -139,7 +136,7 @@ def nominal( ] = None, provider: Optional[Literal["oecd"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Nominal GDP Data. Parameters @@ -184,21 +181,19 @@ def nominal( >>> obb.economy.gdp.nominal(units="usd") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "units": units, - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/economy/gdp/nominal", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "units": units, + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) @validate @@ -224,7 +219,7 @@ def real( ] = None, provider: Optional[Literal["oecd"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Real GDP Data. Parameters @@ -269,19 +264,17 @@ def real( >>> obb.economy.gdp.real(units="yoy") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "units": units, - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/economy/gdp/real", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "units": units, + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/equity.py b/openbb_platform/openbb/package/equity.py index 5ec8a600fbf3..4f363a8f1217 100644 --- a/openbb_platform/openbb/package/equity.py +++ b/openbb_platform/openbb/package/equity.py @@ -5,9 +5,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -31,7 +30,8 @@ def __repr__(self) -> str: return self.__doc__ or "" @property - def calendar(self): # route = "/equity/calendar" + def calendar(self): + # pylint: disable=import-outside-toplevel from . import equity_calendar return equity_calendar.ROUTER_equity_calendar( @@ -39,13 +39,15 @@ def calendar(self): # route = "/equity/calendar" ) @property - def compare(self): # route = "/equity/compare" + def compare(self): + # pylint: disable=import-outside-toplevel from . import equity_compare return equity_compare.ROUTER_equity_compare(command_runner=self._command_runner) @property - def discovery(self): # route = "/equity/discovery" + def discovery(self): + # pylint: disable=import-outside-toplevel from . import equity_discovery return equity_discovery.ROUTER_equity_discovery( @@ -53,7 +55,8 @@ def discovery(self): # route = "/equity/discovery" ) @property - def estimates(self): # route = "/equity/estimates" + def estimates(self): + # pylint: disable=import-outside-toplevel from . import equity_estimates return equity_estimates.ROUTER_equity_estimates( @@ -61,7 +64,8 @@ def estimates(self): # route = "/equity/estimates" ) @property - def fundamental(self): # route = "/equity/fundamental" + def fundamental(self): + # pylint: disable=import-outside-toplevel from . import equity_fundamental return equity_fundamental.ROUTER_equity_fundamental( @@ -71,7 +75,7 @@ def fundamental(self): # route = "/equity/fundamental" @validate def market_snapshots( self, provider: Optional[Literal["fmp", "polygon"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Get a current, complete, market snapshot. Parameters @@ -186,21 +190,20 @@ def market_snapshots( >>> obb.equity.market_snapshots() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={}, - extra_params=kwargs, - ) - return self._run( "/equity/market_snapshots", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={}, + extra_params=kwargs, + ) ) @property - def ownership(self): # route = "/equity/ownership" + def ownership(self): + # pylint: disable=import-outside-toplevel from . import equity_ownership return equity_ownership.ROUTER_equity_ownership( @@ -208,7 +211,8 @@ def ownership(self): # route = "/equity/ownership" ) @property - def price(self): # route = "/equity/price" + def price(self): + # pylint: disable=import-outside-toplevel from . import equity_price return equity_price.ROUTER_equity_price(command_runner=self._command_runner) @@ -222,7 +226,7 @@ def profile( ], provider: Optional[Literal["intrinio"]] = None, **kwargs - ) -> OBBject[Data]: + ) -> OBBject: """Equity Info. Get general price and performance metrics of a stock. Parameters @@ -333,25 +337,21 @@ def profile( >>> obb.equity.profile(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/profile", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate - def screener( - self, provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + def screener(self, provider: Optional[Literal["fmp"]] = None, **kwargs) -> OBBject: """Equity Screen. Screen for companies meeting various criteria. Parameters @@ -446,17 +446,15 @@ def screener( >>> obb.equity.screener() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={}, - extra_params=kwargs, - ) - return self._run( "/equity/screener", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={}, + extra_params=kwargs, + ) ) @validate @@ -467,9 +465,9 @@ def search( bool, OpenBBCustomParameter(description="Whether to search by ticker symbol."), ] = False, - provider: Optional[Literal["sec"]] = None, + provider: Optional[Literal["intrinio", "sec"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Equity Search. Search for a company or stock ticker. Parameters @@ -478,10 +476,14 @@ def search( Search query. is_symbol : bool Whether to search by ticker symbol. - provider : Optional[Literal['sec']] + provider : Optional[Literal['intrinio', 'sec']] The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'sec' if there is + If None, the provider specified in defaults is selected or 'intrinio' if there is no default. + active : Optional[bool] + When true, return companies that are actively traded (having stock prices within the past 14 days). When false, return companies that are not actively traded or never have been traded. (provider: intrinio) + limit : Optional[int] + The number of data entries to return. (provider: intrinio) is_fund : bool Whether to direct the search to the list of mutual funds and ETFs. (provider: sec) use_cache : bool @@ -492,7 +494,7 @@ def search( OBBject results : List[EquitySearch] Serializable results. - provider : Optional[Literal['sec']] + provider : Optional[Literal['intrinio', 'sec']] Provider name. warnings : Optional[List[Warning_]] List of warnings. @@ -503,12 +505,17 @@ def search( EquitySearch ------------ - symbol : str + symbol : Optional[str] Symbol representing the entity requested in the data. name : str Name of the company. cik : Optional[str] + ; Central Index Key (provider: sec) + lei : Optional[str] + The Legal Entity Identifier (LEI) of the company. (provider: intrinio) + intrinio_id : Optional[str] + The Intrinio ID of the company. (provider: intrinio) Example ------- @@ -516,24 +523,23 @@ def search( >>> obb.equity.search() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "query": query, - "is_symbol": is_symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/search", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "query": query, + "is_symbol": is_symbol, + }, + extra_params=kwargs, + ) ) @property - def shorts(self): # route = "/equity/shorts" + def shorts(self): + # pylint: disable=import-outside-toplevel from . import equity_shorts return equity_shorts.ROUTER_equity_shorts(command_runner=self._command_runner) diff --git a/openbb_platform/openbb/package/equity_calendar.py b/openbb_platform/openbb/package/equity_calendar.py index 457c4dfd8645..1cbb2438ad11 100644 --- a/openbb_platform/openbb/package/equity_calendar.py +++ b/openbb_platform/openbb/package/equity_calendar.py @@ -6,9 +6,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -40,7 +39,7 @@ def dividend( ] = None, provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Upcoming and Historical Dividend Calendar. Parameters @@ -95,20 +94,18 @@ def dividend( >>> obb.equity.calendar.dividend() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/equity/calendar/dividend", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) @validate @@ -128,7 +125,7 @@ def earnings( ] = None, provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Upcoming and Historical earnings calendar. Parameters @@ -187,20 +184,18 @@ def earnings( >>> obb.equity.calendar.earnings() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/equity/calendar/earnings", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) @validate @@ -228,7 +223,7 @@ def ipo( ] = 100, provider: Optional[Literal["intrinio"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Upcoming and Historical IPO Calendar. Parameters @@ -354,22 +349,20 @@ def ipo( >>> obb.equity.calendar.ipo(limit=100) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "start_date": start_date, - "end_date": end_date, - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/equity/calendar/ipo", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "start_date": start_date, + "end_date": end_date, + "limit": limit, + }, + extra_params=kwargs, + ) ) @validate @@ -389,7 +382,7 @@ def splits( ] = None, provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Calendar Splits. Show Stock Split Calendar. Parameters @@ -436,18 +429,16 @@ def splits( >>> obb.equity.calendar.splits() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/equity/calendar/splits", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/equity_compare.py b/openbb_platform/openbb/package/equity_compare.py index de0cfdefe63d..fb4fbf9c25de 100644 --- a/openbb_platform/openbb/package/equity_compare.py +++ b/openbb_platform/openbb/package/equity_compare.py @@ -5,9 +5,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -28,7 +27,7 @@ def peers( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[Data]: + ) -> OBBject: """Equity Peers. Company peers. Parameters @@ -65,17 +64,15 @@ def peers( >>> obb.equity.compare.peers(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/compare/peers", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/equity_discovery.py b/openbb_platform/openbb/package/equity_discovery.py index 5d04e0fd2fab..0df5fc8ed8fc 100644 --- a/openbb_platform/openbb/package/equity_discovery.py +++ b/openbb_platform/openbb/package/equity_discovery.py @@ -1,14 +1,13 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### import datetime -from typing import List, Literal, Optional, Union +from typing import Literal, Optional, Union from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -47,7 +46,7 @@ def filings( ] = 100, provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Get the most-recent filings submitted to the SEC. Parameters @@ -102,20 +101,18 @@ def filings( >>> obb.equity.discovery.filings(limit=100) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - "form_type": form_type, - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/equity/discovery/filings", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + "form_type": form_type, + "limit": limit, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/equity_estimates.py b/openbb_platform/openbb/package/equity_estimates.py index 79c73609b607..917c63e5cfc3 100644 --- a/openbb_platform/openbb/package/equity_estimates.py +++ b/openbb_platform/openbb/package/equity_estimates.py @@ -5,9 +5,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -30,7 +29,7 @@ def consensus( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[Data]: + ) -> OBBject: """Price Target Consensus. Price target consensus data. Parameters @@ -75,19 +74,17 @@ def consensus( >>> obb.equity.estimates.consensus(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/estimates/consensus", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -107,7 +104,7 @@ def historical( ] = 30, provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Historical Analyst Estimates. Analyst stock recommendations. Parameters @@ -190,21 +187,19 @@ def historical( >>> obb.equity.estimates.historical(symbol="AAPL", period="annual", limit=30) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "period": period, - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/equity/estimates/historical", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "period": period, + "limit": limit, + }, + extra_params=kwargs, + ) ) @validate @@ -216,7 +211,7 @@ def price_target( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Price Target. Price target data. Parameters @@ -281,17 +276,15 @@ def price_target( >>> obb.equity.estimates.price_target(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/estimates/price_target", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/equity_fundamental.py b/openbb_platform/openbb/package/equity_fundamental.py index 0c92a718aa51..ebc9cfad0551 100644 --- a/openbb_platform/openbb/package/equity_fundamental.py +++ b/openbb_platform/openbb/package/equity_fundamental.py @@ -7,9 +7,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -61,7 +60,7 @@ def balance( ] = 5, provider: Optional[Literal["fmp", "intrinio", "polygon"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Balance Sheet. Balance sheet statement. Parameters @@ -264,21 +263,19 @@ def balance( >>> obb.equity.fundamental.balance(symbol="AAPL", period="annual", limit=5) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "period": period, - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/balance", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "period": period, + "limit": limit, + }, + extra_params=kwargs, + ) ) @validate @@ -294,7 +291,7 @@ def balance_growth( ] = 10, provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Balance Sheet Statement Growth. Information about the growth of the company balance sheet. Parameters @@ -415,20 +412,18 @@ def balance_growth( >>> obb.equity.fundamental.balance_growth(symbol="AAPL", limit=10) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/balance_growth", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "limit": limit, + }, + extra_params=kwargs, + ) ) @validate @@ -448,7 +443,7 @@ def cash( ] = 5, provider: Optional[Literal["fmp", "intrinio", "polygon"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Cash Flow Statement. Information about the cash flow statement. Parameters @@ -623,21 +618,19 @@ def cash( >>> obb.equity.fundamental.cash(symbol="AAPL", period="annual", limit=5) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "period": period, - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/cash", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "period": period, + "limit": limit, + }, + extra_params=kwargs, + ) ) @validate @@ -653,7 +646,7 @@ def cash_growth( ] = 10, provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Cash Flow Statement Growth. Information about the growth of the company cash flow statement. Parameters @@ -756,20 +749,18 @@ def cash_growth( >>> obb.equity.fundamental.cash_growth(symbol="AAPL", limit=10) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/cash_growth", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "limit": limit, + }, + extra_params=kwargs, + ) ) @validate @@ -781,7 +772,7 @@ def dividends( ], provider: Optional[Literal["fmp", "intrinio"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Historical Dividends. Historical dividends data for a given company. Parameters @@ -838,19 +829,17 @@ def dividends( >>> obb.equity.fundamental.dividends(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/dividends", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -862,7 +851,7 @@ def employee_count( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Historical Employees. Historical number of employees. Parameters @@ -915,19 +904,17 @@ def employee_count( >>> obb.equity.fundamental.employee_count(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/employee_count", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -949,7 +936,7 @@ def filings( ] = 100, provider: Optional[Literal["fmp", "intrinio", "sec"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Company Filings. Company filings data. Parameters @@ -1043,8 +1030,8 @@ def filings( The size of the filing. (provider: sec) complete_submission_url : Optional[str] The URL to the complete filing submission. (provider: sec) - xml : Optional[str] - The URL to the primary XML document. (provider: sec) + filing_detail_url : Optional[str] + The URL to the filing details. (provider: sec) Example ------- @@ -1052,21 +1039,19 @@ def filings( >>> obb.equity.fundamental.filings(limit=100) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "form_type": form_type, - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/filings", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "form_type": form_type, + "limit": limit, + }, + extra_params=kwargs, + ) ) @validate @@ -1109,7 +1094,7 @@ def historical_attributes( ] = "desc", provider: Optional[Literal["intrinio"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Fetch the historical values of a data tag from Intrinio. Parameters @@ -1162,26 +1147,24 @@ def historical_attributes( >>> obb.equity.fundamental.historical_attributes(symbol="AAPL", tag="TEST_STRING", frequency="yearly", limit=1000, sort="desc") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "tag": tag, - "start_date": start_date, - "end_date": end_date, - "frequency": frequency, - "limit": limit, - "type": type, - "sort": sort, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/historical_attributes", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "tag": tag, + "start_date": start_date, + "end_date": end_date, + "frequency": frequency, + "limit": limit, + "type": type, + "sort": sort, + }, + extra_params=kwargs, + ) ) @validate @@ -1193,7 +1176,7 @@ def historical_eps( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Historical earnings-per-share for a given company. Parameters @@ -1252,19 +1235,17 @@ def historical_eps( >>> obb.equity.fundamental.historical_eps(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/historical_eps", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -1276,7 +1257,7 @@ def historical_splits( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Historical Splits. Historical splits data. Parameters @@ -1319,19 +1300,17 @@ def historical_splits( >>> obb.equity.fundamental.historical_splits(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/historical_splits", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -1351,7 +1330,7 @@ def income( ] = 5, provider: Optional[Literal["fmp", "intrinio", "polygon"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Income Statement. Report on a company's financial performance. Parameters @@ -1528,21 +1507,19 @@ def income( >>> obb.equity.fundamental.income(symbol="AAPL", period="annual", limit=5) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "period": period, - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/income", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "period": period, + "limit": limit, + }, + extra_params=kwargs, + ) ) @validate @@ -1562,7 +1539,7 @@ def income_growth( ] = "annual", provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Income Statement Growth. Information about the growth of the company income statement. Parameters @@ -1659,21 +1636,19 @@ def income_growth( >>> obb.equity.fundamental.income_growth(symbol="AAPL", limit=10, period="annual") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "limit": limit, - "period": period, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/income_growth", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "limit": limit, + "period": period, + }, + extra_params=kwargs, + ) ) @validate @@ -1688,7 +1663,7 @@ def latest_attributes( ], provider: Optional[Literal["intrinio"]] = None, **kwargs - ) -> OBBject[Data]: + ) -> OBBject: """Fetch the latest value of a data tag from Intrinio. Parameters @@ -1727,20 +1702,18 @@ def latest_attributes( >>> obb.equity.fundamental.latest_attributes(symbol="AAPL", tag="TEST_STRING") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "tag": tag, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/latest_attributes", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "tag": tag, + }, + extra_params=kwargs, + ) ) @validate @@ -1752,7 +1725,7 @@ def management( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Key Executives. Key executives for a given company. Parameters @@ -1801,19 +1774,17 @@ def management( >>> obb.equity.fundamental.management(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/management", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -1825,7 +1796,7 @@ def management_compensation( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Get Executive Compensation. Information about the executive compensation for a given company. Parameters @@ -1886,19 +1857,17 @@ def management_compensation( >>> obb.equity.fundamental.management_compensation(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/management_compensation", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -1918,7 +1887,7 @@ def metrics( ] = 100, provider: Optional[Literal["fmp", "intrinio"]] = None, **kwargs - ) -> OBBject[Union[List[Data], Data]]: + ) -> OBBject: """Key Metrics. Key metrics for a given company. Parameters @@ -2089,21 +2058,19 @@ def metrics( >>> obb.equity.fundamental.metrics(symbol="AAPL", period="annual", limit=100) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "period": period, - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/metrics", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "period": period, + "limit": limit, + }, + extra_params=kwargs, + ) ) @validate @@ -2115,7 +2082,7 @@ def multiples( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Equity Valuation Multiples. Valuation multiples for a stock ticker. Parameters @@ -2272,19 +2239,17 @@ def multiples( >>> obb.equity.fundamental.multiples(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/multiples", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -2296,7 +2261,7 @@ def overview( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[Data]: + ) -> OBBject: """Company Overview. General information about a company. Parameters @@ -2403,19 +2368,17 @@ def overview( >>> obb.equity.fundamental.overview(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/overview", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -2435,7 +2398,7 @@ def ratios( ] = 12, provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Extensive set of ratios over time. Financial ratios for a given company. Parameters @@ -2594,21 +2557,19 @@ def ratios( >>> obb.equity.fundamental.ratios(symbol="AAPL", period="annual", limit=12) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "period": period, - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/ratios", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "period": period, + "limit": limit, + }, + extra_params=kwargs, + ) ) @validate @@ -2628,7 +2589,7 @@ def revenue_per_geography( ] = "flat", provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Revenue Geographic. Geographic revenue data. Parameters @@ -2681,21 +2642,19 @@ def revenue_per_geography( >>> obb.equity.fundamental.revenue_per_geography(symbol="AAPL", period="annual", structure="flat") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "period": period, - "structure": structure, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/revenue_per_geography", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "period": period, + "structure": structure, + }, + extra_params=kwargs, + ) ) @validate @@ -2715,7 +2674,7 @@ def revenue_per_segment( ] = "flat", provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Revenue Business Line. Business line revenue data. Parameters @@ -2758,21 +2717,19 @@ def revenue_per_segment( >>> obb.equity.fundamental.revenue_per_segment(symbol="AAPL", period="annual", structure="flat") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "period": period, - "structure": structure, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/revenue_per_segment", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "period": period, + "structure": structure, + }, + extra_params=kwargs, + ) ) @validate @@ -2787,7 +2744,7 @@ def search_attributes( ] = 1000, provider: Optional[Literal["intrinio"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Search Intrinio data tags. Parameters @@ -2846,20 +2803,18 @@ def search_attributes( >>> obb.equity.fundamental.search_attributes(query="TEST_STRING", limit=1000) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "query": query, - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/search_attributes", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "query": query, + "limit": limit, + }, + extra_params=kwargs, + ) ) @validate @@ -2871,7 +2826,7 @@ def trailing_dividend_yield( ] = None, provider: Optional[Literal["tiingo"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Trailing 1yr dividend yield. Parameters @@ -2910,19 +2865,17 @@ def trailing_dividend_yield( >>> obb.equity.fundamental.trailing_dividend_yield() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/trailing_dividend_yield", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -2938,7 +2891,7 @@ def transcript( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Earnings Call Transcript. Earnings call transcript for a given company. Parameters @@ -2985,18 +2938,16 @@ def transcript( >>> obb.equity.fundamental.transcript(symbol="AAPL", year=1) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "year": year, - }, - extra_params=kwargs, - ) - return self._run( "/equity/fundamental/transcript", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "year": year, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/equity_ownership.py b/openbb_platform/openbb/package/equity_ownership.py index 522f15e52e3c..93a9d994635b 100644 --- a/openbb_platform/openbb/package/equity_ownership.py +++ b/openbb_platform/openbb/package/equity_ownership.py @@ -6,9 +6,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -36,7 +35,7 @@ def insider_trading( ] = 500, provider: Optional[Literal["fmp", "intrinio"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Insider Trading. Information about insider trading. Parameters @@ -141,20 +140,18 @@ def insider_trading( >>> obb.equity.ownership.insider_trading(symbol="AAPL", limit=500) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/equity/ownership/insider_trading", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "limit": limit, + }, + extra_params=kwargs, + ) ) @validate @@ -166,7 +163,7 @@ def institutional( ], provider: Optional[Literal["fmp", "intrinio"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Institutional Ownership. Institutional ownership data. Parameters @@ -297,19 +294,17 @@ def institutional( >>> obb.equity.ownership.institutional(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/ownership/institutional", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -329,7 +324,7 @@ def major_holders( ] = 0, provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Equity Ownership. Information about the company ownership. Parameters @@ -446,21 +441,19 @@ def major_holders( >>> obb.equity.ownership.major_holders(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "date": date, - "page": page, - }, - extra_params=kwargs, - ) - return self._run( "/equity/ownership/major_holders", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "date": date, + "page": page, + }, + extra_params=kwargs, + ) ) @validate @@ -472,7 +465,7 @@ def share_statistics( ], provider: Optional[Literal["fmp", "intrinio"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Share Statistics. Share statistics for a given company. Parameters @@ -523,17 +516,15 @@ def share_statistics( >>> obb.equity.ownership.share_statistics(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/ownership/share_statistics", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/equity_price.py b/openbb_platform/openbb/package/equity_price.py index dc0e90a8105c..62c141c9b110 100644 --- a/openbb_platform/openbb/package/equity_price.py +++ b/openbb_platform/openbb/package/equity_price.py @@ -6,9 +6,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -48,7 +47,7 @@ def historical( ] = None, provider: Optional[Literal["fmp", "intrinio", "polygon", "tiingo"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Equity Historical price. Load stock data for a specific ticker. Parameters @@ -162,22 +161,20 @@ def historical( >>> obb.equity.price.historical(symbol="AAPL", interval="1d") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "interval": interval, - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/equity/price/historical", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "interval": interval, + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) @validate @@ -189,7 +186,7 @@ def nbbo( ], provider: Optional[Literal["polygon"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Equity NBBO. Load National Best Bid and Offer for a specific equity. Parameters @@ -293,19 +290,17 @@ def nbbo( >>> obb.equity.price.nbbo(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/price/nbbo", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -317,7 +312,7 @@ def performance( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Price performance as a return, over different periods. Parameters @@ -382,19 +377,17 @@ def performance( >>> obb.equity.price.performance(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/price/performance", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -408,7 +401,7 @@ def quote( ], provider: Optional[Literal["fmp", "intrinio"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Equity Quote. Load stock data for a specific ticker. Parameters @@ -533,17 +526,15 @@ def quote( >>> obb.equity.price.quote(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/price/quote", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/equity_shorts.py b/openbb_platform/openbb/package/equity_shorts.py index aba850d04b59..3ec7ffa5dda5 100644 --- a/openbb_platform/openbb/package/equity_shorts.py +++ b/openbb_platform/openbb/package/equity_shorts.py @@ -5,9 +5,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -28,7 +27,7 @@ def fails_to_deliver( ], provider: Optional[Literal["sec"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Get reported Fail-to-deliver (FTD) data. Parameters @@ -84,17 +83,15 @@ def fails_to_deliver( >>> obb.equity.shorts.fails_to_deliver(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/equity/shorts/fails_to_deliver", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/etf.py b/openbb_platform/openbb/package/etf.py index 8be6ef2789ff..3f2b593e7b39 100644 --- a/openbb_platform/openbb/package/etf.py +++ b/openbb_platform/openbb/package/etf.py @@ -5,9 +5,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -35,7 +34,7 @@ def countries( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """ETF Country weighting. Parameters @@ -72,19 +71,17 @@ def countries( >>> obb.etf.countries(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/etf/countries", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -94,30 +91,33 @@ def holdings( Union[str, List[str]], OpenBBCustomParameter(description="Symbol to get data for. (ETF)"), ], - provider: Optional[Literal["fmp"]] = None, + provider: Optional[Literal["fmp", "sec"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Get the holdings for an individual ETF. Parameters ---------- symbol : str Symbol to get data for. (ETF) - provider : Optional[Literal['fmp']] + provider : Optional[Literal['fmp', 'sec']] 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. date : Optional[Union[str, datetime.date]] - A specific date to get data for. 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. 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. 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) + use_cache : bool + Whether or not to use cache for the request. (provider: sec) Returns ------- OBBject results : List[EtfHoldings] Serializable results. - provider : Optional[Literal['fmp']] + provider : Optional[Literal['fmp', 'sec']] Provider name. warnings : Optional[List[Warning_]] List of warnings. @@ -133,45 +133,157 @@ def holdings( name : Optional[str] Name of the ETF holding. lei : Optional[str] - The LEI of the holding. (provider: fmp) + The LEI of the holding. (provider: fmp, sec) title : Optional[str] The title of the holding. (provider: fmp) cusip : Optional[str] - The CUSIP of the holding. (provider: fmp) + The CUSIP of the holding. (provider: fmp, sec) isin : Optional[str] - The ISIN of the holding. (provider: fmp) + The ISIN of the holding. (provider: fmp, sec) balance : Optional[float] - The balance of the holding. (provider: fmp) + The balance of the holding. (provider: fmp, sec) units : Optional[Union[str, float]] - The units of the holding. (provider: fmp) + The units of the holding. (provider: fmp, sec) currency : Optional[str] - The currency of the holding. (provider: fmp) + The currency of the holding. (provider: fmp, sec) value : Optional[float] - The value of the holding in USD. (provider: fmp) + The value of the holding in USD. (provider: fmp, sec) weight : Optional[float] - The weight of the holding in ETF in %. (provider: fmp) + The weight of the holding in ETF in %. (provider: fmp, sec) payoff_profile : Optional[str] - The payoff profile of the holding. (provider: fmp) + The payoff profile of the holding. (provider: fmp, sec) asset_category : Optional[str] - The asset category of the holding. (provider: fmp) + The asset category of the holding. (provider: fmp, sec) issuer_category : Optional[str] - The issuer category of the holding. (provider: fmp) + The issuer category of the holding. (provider: fmp, sec) country : Optional[str] - The country of the holding. (provider: fmp) + The country of the holding. (provider: fmp, sec) is_restricted : Optional[str] - Whether the holding is restricted. (provider: fmp) + Whether the holding is restricted. (provider: fmp, sec) fair_value_level : Optional[int] - The fair value level of the holding. (provider: fmp) + The fair value level of the holding. (provider: fmp, sec) is_cash_collateral : Optional[str] - Whether the holding is cash collateral. (provider: fmp) + Whether the holding is cash collateral. (provider: fmp, sec) is_non_cash_collateral : Optional[str] - Whether the holding is non-cash collateral. (provider: fmp) + Whether the holding is non-cash collateral. (provider: fmp, sec) is_loan_by_fund : Optional[str] - Whether the holding is loan by fund. (provider: fmp) + Whether the holding is loan by fund. (provider: fmp, sec) cik : Optional[str] The CIK of the filing. (provider: fmp) acceptance_datetime : Optional[str] The acceptance datetime of the filing. (provider: fmp) + other_id : Optional[str] + Internal identifier for the holding. (provider: sec) + loan_value : Optional[float] + The loan value of the holding. (provider: sec) + issuer_conditional : Optional[str] + The issuer conditions of the holding. (provider: sec) + asset_conditional : Optional[str] + The asset conditions of the holding. (provider: sec) + maturity_date : Optional[date] + The maturity date of the debt security. (provider: sec) + coupon_kind : Optional[str] + The type of coupon for the debt security. (provider: sec) + rate_type : Optional[str] + The type of rate for the debt security, floating or fixed. (provider: sec) + annualized_return : Optional[float] + The annualized return on the debt security. (provider: sec) + is_default : Optional[str] + If the debt security is defaulted. (provider: sec) + in_arrears : Optional[str] + If the debt security is in arrears. (provider: sec) + is_paid_kind : Optional[str] + If the debt security payments are are paid in kind. (provider: sec) + derivative_category : Optional[str] + The derivative category of the holding. (provider: sec) + counterparty : Optional[str] + The counterparty of the derivative. (provider: sec) + underlying_name : Optional[str] + The name of the underlying asset associated with the derivative. (provider: sec) + option_type : Optional[str] + The type of option. (provider: sec) + derivative_payoff : Optional[str] + The payoff profile of the derivative. (provider: sec) + expiry_date : Optional[date] + The expiry or termination date of the derivative. (provider: sec) + exercise_price : Optional[float] + The exercise price of the option. (provider: sec) + exercise_currency : Optional[str] + The currency of the option exercise price. (provider: sec) + shares_per_contract : Optional[float] + The number of shares per contract. (provider: sec) + delta : Optional[Union[str, float]] + The delta of the option. (provider: sec) + rate_type_rec : Optional[str] + The type of rate for reveivable portion of the swap. (provider: sec) + receive_currency : Optional[str] + The receive currency of the swap. (provider: sec) + upfront_receive : Optional[float] + The upfront amount received of the swap. (provider: sec) + floating_rate_index_rec : Optional[str] + The floating rate index for reveivable portion of the swap. (provider: sec) + floating_rate_spread_rec : Optional[float] + The floating rate spread for reveivable portion of the swap. (provider: sec) + rate_tenor_rec : Optional[str] + The rate tenor for reveivable portion of the swap. (provider: sec) + rate_tenor_unit_rec : Optional[Union[str, int]] + The rate tenor unit for reveivable portion of the swap. (provider: sec) + reset_date_rec : Optional[str] + The reset date for reveivable portion of the swap. (provider: sec) + reset_date_unit_rec : Optional[Union[str, int]] + The reset date unit for reveivable portion of the swap. (provider: sec) + rate_type_pmnt : Optional[str] + The type of rate for payment portion of the swap. (provider: sec) + payment_currency : Optional[str] + The payment currency of the swap. (provider: sec) + upfront_payment : Optional[float] + The upfront amount received of the swap. (provider: sec) + floating_rate_index_pmnt : Optional[str] + The floating rate index for payment portion of the swap. (provider: sec) + floating_rate_spread_pmnt : Optional[float] + The floating rate spread for payment portion of the swap. (provider: sec) + rate_tenor_pmnt : Optional[str] + The rate tenor for payment portion of the swap. (provider: sec) + rate_tenor_unit_pmnt : Optional[Union[str, int]] + The rate tenor unit for payment portion of the swap. (provider: sec) + reset_date_pmnt : Optional[str] + The reset date for payment portion of the swap. (provider: sec) + reset_date_unit_pmnt : Optional[Union[str, int]] + The reset date unit for payment portion of the swap. (provider: sec) + repo_type : Optional[str] + The type of repo. (provider: sec) + is_cleared : Optional[str] + If the repo is cleared. (provider: sec) + is_tri_party : Optional[str] + If the repo is tri party. (provider: sec) + principal_amount : Optional[float] + The principal amount of the repo. (provider: sec) + principal_currency : Optional[str] + The currency of the principal amount. (provider: sec) + collateral_type : Optional[str] + The collateral type of the repo. (provider: sec) + collateral_amount : Optional[float] + The collateral amount of the repo. (provider: sec) + collateral_currency : Optional[str] + The currency of the collateral amount. (provider: sec) + exchange_currency : Optional[str] + The currency of the exchange rate. (provider: sec) + exchange_rate : Optional[float] + The exchange rate. (provider: sec) + currency_sold : Optional[str] + The currency sold in a Forward Derivative. (provider: sec) + currency_amount_sold : Optional[float] + The amount of currency sold in a Forward Derivative. (provider: sec) + currency_bought : Optional[str] + The currency bought in a Forward Derivative. (provider: sec) + currency_amount_bought : Optional[float] + The amount of currency bought in a Forward Derivative. (provider: sec) + notional_amount : Optional[float] + The notional amount of the derivative. (provider: sec) + notional_currency : Optional[str] + The currency of the derivative's notional amount. (provider: sec) + unrealized_gain : Optional[float] + The unrealized gain or loss on the derivative. (provider: sec) Example ------- @@ -179,19 +291,17 @@ def holdings( >>> obb.etf.holdings(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/etf/holdings", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -203,7 +313,7 @@ def holdings_date( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Get the holdings filing date for an individual ETF. Parameters @@ -242,19 +352,17 @@ def holdings_date( >>> obb.etf.holdings_date(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/etf/holdings_date", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -266,7 +374,7 @@ def holdings_performance( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Get the ETF holdings performance. Parameters @@ -331,19 +439,17 @@ def holdings_performance( >>> obb.etf.holdings_performance(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/etf/holdings_performance", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -355,7 +461,7 @@ def info( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """ETF Information Overview. Parameters @@ -422,19 +528,17 @@ def info( >>> obb.etf.info(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/etf/info", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -446,7 +550,7 @@ def price_performance( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Price performance as a return, over different periods. Parameters @@ -511,19 +615,17 @@ def price_performance( >>> obb.equity.price.performance(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/etf/price_performance", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -534,87 +636,85 @@ def search( ] = "", provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Search for ETFs. - An empty query returns the full list of ETFs from the provider. + An empty query returns the full list of ETFs from the provider. - Parameters - ---------- - query : Optional[str] - Search query. - provider : Optional[Literal['fmp']] - 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. - exchange : Optional[Literal['AMEX', 'NYSE', 'NASDAQ', 'ETF', 'TSX', 'EURONEXT']] - The exchange code the ETF trades on. (provider: fmp) - is_active : Optional[Literal[True, False]] - Whether the ETF is actively trading. (provider: fmp) - - Returns - ------- - OBBject - results : List[EtfSearch] - Serializable results. + Parameters + ---------- + query : Optional[str] + Search query. provider : Optional[Literal['fmp']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - EtfSearch - --------- - symbol : str - Symbol representing the entity requested in the data.(ETF) - name : Optional[str] - Name of the ETF. - market_cap : Optional[float] - The market cap of the ETF. (provider: fmp) - sector : Optional[str] - The sector of the ETF. (provider: fmp) - industry : Optional[str] - The industry of the ETF. (provider: fmp) - beta : Optional[float] - The beta of the ETF. (provider: fmp) - price : Optional[float] - The current price of the ETF. (provider: fmp) - last_annual_dividend : Optional[float] - The last annual dividend paid. (provider: fmp) - volume : Optional[float] - The current trading volume of the ETF. (provider: fmp) - exchange : Optional[str] - The exchange code the ETF trades on. (provider: fmp) - exchange_name : Optional[str] - The full name of the exchange the ETF trades on. (provider: fmp) - country : Optional[str] - The country the ETF is registered in. (provider: fmp) - actively_trading : Optional[Literal[True, False]] - Whether the ETF is actively trading. (provider: fmp) - - Example - ------- - >>> from openbb import obb - >>> obb.etf.search() + 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. + exchange : Optional[Literal['AMEX', 'NYSE', 'NASDAQ', 'ETF', 'TSX', 'EURONEXT']] + The exchange code the ETF trades on. (provider: fmp) + is_active : Optional[Literal[True, False]] + Whether the ETF is actively trading. (provider: fmp) + + Returns + ------- + OBBject + results : List[EtfSearch] + Serializable results. + provider : Optional[Literal['fmp']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + EtfSearch + --------- + symbol : str + Symbol representing the entity requested in the data.(ETF) + name : Optional[str] + Name of the ETF. + market_cap : Optional[float] + The market cap of the ETF. (provider: fmp) + sector : Optional[str] + The sector of the ETF. (provider: fmp) + industry : Optional[str] + The industry of the ETF. (provider: fmp) + beta : Optional[float] + The beta of the ETF. (provider: fmp) + price : Optional[float] + The current price of the ETF. (provider: fmp) + last_annual_dividend : Optional[float] + The last annual dividend paid. (provider: fmp) + volume : Optional[float] + The current trading volume of the ETF. (provider: fmp) + exchange : Optional[str] + The exchange code the ETF trades on. (provider: fmp) + exchange_name : Optional[str] + The full name of the exchange the ETF trades on. (provider: fmp) + country : Optional[str] + The country the ETF is registered in. (provider: fmp) + actively_trading : Optional[Literal[True, False]] + Whether the ETF is actively trading. (provider: fmp) + + Example + ------- + >>> from openbb import obb + >>> obb.etf.search() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "query": query, - }, - extra_params=kwargs, - ) - return self._run( "/etf/search", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "query": query, + }, + extra_params=kwargs, + ) ) @validate @@ -626,7 +726,7 @@ def sectors( ], provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """ETF Sector weighting. Parameters @@ -665,17 +765,15 @@ def sectors( >>> obb.etf.sectors(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/etf/sectors", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/fixedincome.py b/openbb_platform/openbb/package/fixedincome.py index 0f8be6b74c63..e0c74b110be4 100644 --- a/openbb_platform/openbb/package/fixedincome.py +++ b/openbb_platform/openbb/package/fixedincome.py @@ -1,14 +1,13 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### import datetime -from typing import List, Literal, Optional, Union +from typing import Literal, Optional, Union from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -25,7 +24,8 @@ def __repr__(self) -> str: return self.__doc__ or "" @property - def corporate(self): # route = "/fixedincome/corporate" + def corporate(self): + # pylint: disable=import-outside-toplevel from . import fixedincome_corporate return fixedincome_corporate.ROUTER_fixedincome_corporate( @@ -33,7 +33,8 @@ def corporate(self): # route = "/fixedincome/corporate" ) @property - def government(self): # route = "/fixedincome/government" + def government(self): + # pylint: disable=import-outside-toplevel from . import fixedincome_government return fixedincome_government.ROUTER_fixedincome_government( @@ -41,7 +42,8 @@ def government(self): # route = "/fixedincome/government" ) @property - def rate(self): # route = "/fixedincome/rate" + def rate(self): + # pylint: disable=import-outside-toplevel from . import fixedincome_rate return fixedincome_rate.ROUTER_fixedincome_rate( @@ -65,71 +67,70 @@ def sofr( ] = None, provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Secured Overnight Financing Rate. - The Secured Overnight Financing Rate (SOFR) is a broad measure of the cost of - borrowing cash overnight collateralizing by Treasury securities. - - - Parameters - ---------- - start_date : Optional[datetime.date] - Start date of the data, in YYYY-MM-DD format. - end_date : Optional[datetime.date] - End date of the data, in YYYY-MM-DD format. - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - period : Literal['overnight', '30_day', '90_day', '180_day', 'index'] - Period of SOFR rate. (provider: fred) - - Returns - ------- - OBBject - results : List[SOFR] - Serializable results. + The Secured Overnight Financing Rate (SOFR) is a broad measure of the cost of + borrowing cash overnight collateralizing by Treasury securities. + + + Parameters + ---------- + start_date : Optional[datetime.date] + Start date of the data, in YYYY-MM-DD format. + end_date : Optional[datetime.date] + End date of the data, in YYYY-MM-DD format. provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - SOFR - ---- - date : date - The date of the data. - rate : Optional[float] - SOFR rate. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.sofr() + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + period : Literal['overnight', '30_day', '90_day', '180_day', 'index'] + Period of SOFR rate. (provider: fred) + + Returns + ------- + OBBject + results : List[SOFR] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + SOFR + ---- + date : date + The date of the data. + rate : Optional[float] + SOFR rate. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.sofr() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/sofr", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) @property - def spreads(self): # route = "/fixedincome/spreads" + def spreads(self): + # pylint: disable=import-outside-toplevel from . import fixedincome_spreads return fixedincome_spreads.ROUTER_fixedincome_spreads( diff --git a/openbb_platform/openbb/package/fixedincome_corporate.py b/openbb_platform/openbb/package/fixedincome_corporate.py index 6024be7b9638..a7598bf36878 100644 --- a/openbb_platform/openbb/package/fixedincome_corporate.py +++ b/openbb_platform/openbb/package/fixedincome_corporate.py @@ -6,9 +6,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -52,76 +51,74 @@ def commercial_paper( ] = "aa", provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Commercial Paper. - Commercial paper (CP) consists of short-term, promissory notes issued primarily by corporations. - Maturities range up to 270 days but average about 30 days. - Many companies use CP to raise cash needed for current transactions, - and many find it to be a lower-cost alternative to bank loans. - - - Parameters - ---------- - start_date : Optional[datetime.date] - Start date of the data, in YYYY-MM-DD format. - end_date : Optional[datetime.date] - End date of the data, in YYYY-MM-DD format. - maturity : Literal['overnight', '7d', '15d', '30d', '60d', '90d'] - The maturity. - category : Literal['asset_backed', 'financial', 'nonfinancial'] - The category. - grade : Literal['aa', 'a2_p2'] - The grade. - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - - Returns - ------- - OBBject - results : List[CommercialPaper] - Serializable results. + Commercial paper (CP) consists of short-term, promissory notes issued primarily by corporations. + Maturities range up to 270 days but average about 30 days. + Many companies use CP to raise cash needed for current transactions, + and many find it to be a lower-cost alternative to bank loans. + + + Parameters + ---------- + start_date : Optional[datetime.date] + Start date of the data, in YYYY-MM-DD format. + end_date : Optional[datetime.date] + End date of the data, in YYYY-MM-DD format. + maturity : Literal['overnight', '7d', '15d', '30d', '60d', '90d'] + The maturity. + category : Literal['asset_backed', 'financial', 'nonfinancial'] + The category. + grade : Literal['aa', 'a2_p2'] + The grade. provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - CommercialPaper - --------------- - date : date - The date of the data. - rate : Optional[float] - Commercial Paper Rate. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.corporate.commercial_paper(maturity="30d", category="financial", grade="aa") + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + + Returns + ------- + OBBject + results : List[CommercialPaper] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + CommercialPaper + --------------- + date : date + The date of the data. + rate : Optional[float] + Commercial Paper Rate. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.corporate.commercial_paper(maturity="30d", category="financial", grade="aa") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - "maturity": maturity, - "category": category, - "grade": grade, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/corporate/commercial_paper", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + "maturity": maturity, + "category": category, + "grade": grade, + }, + extra_params=kwargs, + ) ) @validate @@ -137,71 +134,69 @@ def hqm( ] = "spot", provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """High Quality Market Corporate Bond. - The HQM yield curve represents the high quality corporate bond market, i.e., - corporate bonds rated AAA, AA, or A. The HQM curve contains two regression terms. - These terms are adjustment factors that blend AAA, AA, and A bonds into a single HQM yield curve - that is the market-weighted average (MWA) quality of high quality bonds. - - - Parameters - ---------- - date : Optional[datetime.date] - A specific date to get data for. - yield_curve : Literal['spot', 'par'] - The yield curve type. - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - - Returns - ------- - OBBject - results : List[HighQualityMarketCorporateBond] - Serializable results. + The HQM yield curve represents the high quality corporate bond market, i.e., + corporate bonds rated AAA, AA, or A. The HQM curve contains two regression terms. + These terms are adjustment factors that blend AAA, AA, and A bonds into a single HQM yield curve + that is the market-weighted average (MWA) quality of high quality bonds. + + + Parameters + ---------- + date : Optional[datetime.date] + A specific date to get data for. + yield_curve : Literal['spot', 'par'] + The yield curve type. provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - HighQualityMarketCorporateBond - ------------------------------ - date : date - The date of the data. - rate : Optional[float] - HighQualityMarketCorporateBond Rate. - maturity : str - Maturity. - yield_curve : Literal['spot', 'par'] - The yield curve type. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.corporate.hqm(yield_curve="spot") + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + + Returns + ------- + OBBject + results : List[HighQualityMarketCorporateBond] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + HighQualityMarketCorporateBond + ------------------------------ + date : date + The date of the data. + rate : Optional[float] + HighQualityMarketCorporateBond Rate. + maturity : str + Maturity. + yield_curve : Literal['spot', 'par'] + The yield curve type. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.corporate.hqm(yield_curve="spot") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "date": date, - "yield_curve": yield_curve, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/corporate/hqm", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "date": date, + "yield_curve": yield_curve, + }, + extra_params=kwargs, + ) ) @validate @@ -225,79 +220,77 @@ def ice_bofa( ] = "yield", provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """ICE BofA US Corporate Bond Indices. - The ICE BofA US Corporate Index tracks the performance of US dollar denominated investment grade corporate debt - publicly issued in the US domestic market. Qualifying securities must have an investment grade rating (based on an - average of Moody’s, S&P and Fitch), at least 18 months to final maturity at the time of issuance, at least one year - remaining term to final maturity as of the rebalance date, a fixed coupon schedule and a minimum amount - outstanding of $250 million. The ICE BofA US Corporate Index is a component of the US Corporate Master Index. - - - Parameters - ---------- - start_date : Optional[datetime.date] - Start date of the data, in YYYY-MM-DD format. - end_date : Optional[datetime.date] - End date of the data, in YYYY-MM-DD format. - index_type : Literal['yield', 'yield_to_worst', 'total_return', 'spread'] - The type of series. - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - category : Literal['all', 'duration', 'eur', 'usd'] - The type of category. (provider: fred) - area : Literal['asia', 'emea', 'eu', 'ex_g10', 'latin_america', 'us'] - The type of area. (provider: fred) - grade : Literal['a', 'aa', 'aaa', 'b', 'bb', 'bbb', 'ccc', 'crossover', 'high_grade', 'high_yield', 'non_financial', 'non_sovereign', 'private_sector', 'public_sector'] - The type of grade. (provider: fred) - options : bool - Whether to include options in the results. (provider: fred) - - Returns - ------- - OBBject - results : List[ICEBofA] - Serializable results. + The ICE BofA US Corporate Index tracks the performance of US dollar denominated investment grade corporate debt + publicly issued in the US domestic market. Qualifying securities must have an investment grade rating (based on an + average of Moody’s, S&P and Fitch), at least 18 months to final maturity at the time of issuance, at least one year + remaining term to final maturity as of the rebalance date, a fixed coupon schedule and a minimum amount + outstanding of $250 million. The ICE BofA US Corporate Index is a component of the US Corporate Master Index. + + + Parameters + ---------- + start_date : Optional[datetime.date] + Start date of the data, in YYYY-MM-DD format. + end_date : Optional[datetime.date] + End date of the data, in YYYY-MM-DD format. + index_type : Literal['yield', 'yield_to_worst', 'total_return', 'spread'] + The type of series. provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - ICEBofA - ------- - date : date - The date of the data. - rate : Optional[float] - ICE BofA US Corporate Bond Indices Rate. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.corporate.ice_bofa(index_type="yield") + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + category : Literal['all', 'duration', 'eur', 'usd'] + The type of category. (provider: fred) + area : Literal['asia', 'emea', 'eu', 'ex_g10', 'latin_america', 'us'] + The type of area. (provider: fred) + grade : Literal['a', 'aa', 'aaa', 'b', 'bb', 'bbb', 'ccc', 'crossover', 'high_grade', 'high_yield', 'non_financial', 'non_sovereign', 'private_sector', 'public_sector'] + The type of grade. (provider: fred) + options : bool + Whether to include options in the results. (provider: fred) + + Returns + ------- + OBBject + results : List[ICEBofA] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + ICEBofA + ------- + date : date + The date of the data. + rate : Optional[float] + ICE BofA US Corporate Bond Indices Rate. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.corporate.ice_bofa(index_type="yield") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - "index_type": index_type, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/corporate/ice_bofa", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + "index_type": index_type, + }, + extra_params=kwargs, + ) ) @validate @@ -321,72 +314,70 @@ def moody( ] = "aaa", provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Moody Corporate Bond Index. - Moody's Aaa and Baa are investment bonds that acts as an index of - the performance of all bonds given an Aaa or Baa rating by Moody's Investors Service respectively. - These corporate bonds often are used in macroeconomics as an alternative to the federal ten-year - Treasury Bill as an indicator of the interest rate. - - - Parameters - ---------- - start_date : Optional[datetime.date] - Start date of the data, in YYYY-MM-DD format. - end_date : Optional[datetime.date] - End date of the data, in YYYY-MM-DD format. - index_type : Literal['aaa', 'baa'] - The type of series. - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - spread : Optional[Literal['treasury', 'fed_funds']] - The type of spread. (provider: fred) - - Returns - ------- - OBBject - results : List[MoodyCorporateBondIndex] - Serializable results. + Moody's Aaa and Baa are investment bonds that acts as an index of + the performance of all bonds given an Aaa or Baa rating by Moody's Investors Service respectively. + These corporate bonds often are used in macroeconomics as an alternative to the federal ten-year + Treasury Bill as an indicator of the interest rate. + + + Parameters + ---------- + start_date : Optional[datetime.date] + Start date of the data, in YYYY-MM-DD format. + end_date : Optional[datetime.date] + End date of the data, in YYYY-MM-DD format. + index_type : Literal['aaa', 'baa'] + The type of series. provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - MoodyCorporateBondIndex - ----------------------- - date : date - The date of the data. - rate : Optional[float] - Moody Corporate Bond Index Rate. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.corporate.moody(index_type="aaa") + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + spread : Optional[Literal['treasury', 'fed_funds']] + The type of spread. (provider: fred) + + Returns + ------- + OBBject + results : List[MoodyCorporateBondIndex] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + MoodyCorporateBondIndex + ----------------------- + date : date + The date of the data. + rate : Optional[float] + Moody Corporate Bond Index Rate. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.corporate.moody(index_type="aaa") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - "index_type": index_type, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/corporate/moody", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + "index_type": index_type, + }, + extra_params=kwargs, + ) ) @validate @@ -413,71 +404,69 @@ def spot_rates( ] = ["spot_rate"], provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Spot Rates. - The spot rates for any maturity is the yield on a bond that provides a single payment at that maturity. - This is a zero coupon bond. - Because each spot rate pertains to a single cashflow, it is the relevant interest rate - concept for discounting a pension liability at the same maturity. - - - Parameters - ---------- - start_date : Optional[datetime.date] - Start date of the data, in YYYY-MM-DD format. - end_date : Optional[datetime.date] - End date of the data, in YYYY-MM-DD format. - maturity : List[float] - The maturities in years. - category : List[Literal['par_yield', 'spot_rate']] - The category. - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - - Returns - ------- - OBBject - results : List[SpotRate] - Serializable results. + The spot rates for any maturity is the yield on a bond that provides a single payment at that maturity. + This is a zero coupon bond. + Because each spot rate pertains to a single cashflow, it is the relevant interest rate + concept for discounting a pension liability at the same maturity. + + + Parameters + ---------- + start_date : Optional[datetime.date] + Start date of the data, in YYYY-MM-DD format. + end_date : Optional[datetime.date] + End date of the data, in YYYY-MM-DD format. + maturity : List[float] + The maturities in years. + category : List[Literal['par_yield', 'spot_rate']] + The category. provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - SpotRate - -------- - date : date - The date of the data. - rate : Optional[float] - Spot Rate. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.corporate.spot_rates(maturity=[10.0], category=['spot_rate']) + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + + Returns + ------- + OBBject + results : List[SpotRate] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + SpotRate + -------- + date : date + The date of the data. + rate : Optional[float] + Spot Rate. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.corporate.spot_rates(maturity=[10.0], category=['spot_rate']) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - "maturity": maturity, - "category": category, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/corporate/spot_rates", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + "maturity": maturity, + "category": category, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/fixedincome_government.py b/openbb_platform/openbb/package/fixedincome_government.py index 2c6658163e84..5ed9d085f94e 100644 --- a/openbb_platform/openbb/package/fixedincome_government.py +++ b/openbb_platform/openbb/package/fixedincome_government.py @@ -1,14 +1,13 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### import datetime -from typing import List, Literal, Optional, Union +from typing import Literal, Optional, Union from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -38,7 +37,7 @@ def treasury_rates( ] = None, provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Government Treasury Rates. Parameters @@ -101,20 +100,18 @@ def treasury_rates( >>> obb.fixedincome.government.treasury_rates() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/government/treasury_rates", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) @validate @@ -132,7 +129,7 @@ def us_yield_curve( ] = False, provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """US Yield Curve. Get United States yield curve. Parameters @@ -173,18 +170,16 @@ def us_yield_curve( >>> obb.fixedincome.government.us_yield_curve() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "date": date, - "inflation_adjusted": inflation_adjusted, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/government/us_yield_curve", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "date": date, + "inflation_adjusted": inflation_adjusted, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/fixedincome_rate.py b/openbb_platform/openbb/package/fixedincome_rate.py index 1649130c1592..e3981b228857 100644 --- a/openbb_platform/openbb/package/fixedincome_rate.py +++ b/openbb_platform/openbb/package/fixedincome_rate.py @@ -1,14 +1,13 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### import datetime -from typing import List, Literal, Optional, Union +from typing import Literal, Optional, Union from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -44,68 +43,66 @@ def ameribor( ] = None, provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Ameribor. - Ameribor (short for the American interbank offered rate) is a benchmark interest rate that reflects the true cost of - short-term interbank borrowing. This rate is based on transactions in overnight unsecured loans conducted on the - American Financial Exchange (AFX). - - - Parameters - ---------- - start_date : Optional[datetime.date] - Start date of the data, in YYYY-MM-DD format. - end_date : Optional[datetime.date] - End date of the data, in YYYY-MM-DD format. - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - parameter : Literal['overnight', 'term_30', 'term_90', '1_week_term_structure', '1_month_term_structure', '3_month_term_structure', '6_month_term_structure', '1_year_term_structure', '2_year_term_structure', '30_day_ma', '90_day_ma'] - Period of AMERIBOR rate. (provider: fred) - - Returns - ------- - OBBject - results : List[AMERIBOR] - Serializable results. + Ameribor (short for the American interbank offered rate) is a benchmark interest rate that reflects the true cost of + short-term interbank borrowing. This rate is based on transactions in overnight unsecured loans conducted on the + American Financial Exchange (AFX). + + + Parameters + ---------- + start_date : Optional[datetime.date] + Start date of the data, in YYYY-MM-DD format. + end_date : Optional[datetime.date] + End date of the data, in YYYY-MM-DD format. provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - AMERIBOR - -------- - date : date - The date of the data. - rate : Optional[float] - AMERIBOR rate. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.rate.ameribor() + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + parameter : Literal['overnight', 'term_30', 'term_90', '1_week_term_structure', '1_month_term_structure', '3_month_term_structure', '6_month_term_structure', '1_year_term_structure', '2_year_term_structure', '30_day_ma', '90_day_ma'] + Period of AMERIBOR rate. (provider: fred) + + Returns + ------- + OBBject + results : List[AMERIBOR] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + AMERIBOR + -------- + date : date + The date of the data. + rate : Optional[float] + AMERIBOR rate. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.rate.ameribor() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/rate/ameribor", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) @validate @@ -125,69 +122,67 @@ def dpcredit( ] = None, provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Discount Window Primary Credit Rate. - A bank rate is the interest rate a nation's central bank charges to its domestic banks to borrow money. - The rates central banks charge are set to stabilize the economy. - In the United States, the Federal Reserve System's Board of Governors set the bank rate, - also known as the discount rate. - - - Parameters - ---------- - start_date : Optional[datetime.date] - Start date of the data, in YYYY-MM-DD format. - end_date : Optional[datetime.date] - End date of the data, in YYYY-MM-DD format. - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - parameter : Literal['daily_excl_weekend', 'monthly', 'weekly', 'daily', 'annual'] - FRED series ID of DWPCR data. (provider: fred) - - Returns - ------- - OBBject - results : List[DiscountWindowPrimaryCreditRate] - Serializable results. + A bank rate is the interest rate a nation's central bank charges to its domestic banks to borrow money. + The rates central banks charge are set to stabilize the economy. + In the United States, the Federal Reserve System's Board of Governors set the bank rate, + also known as the discount rate. + + + Parameters + ---------- + start_date : Optional[datetime.date] + Start date of the data, in YYYY-MM-DD format. + end_date : Optional[datetime.date] + End date of the data, in YYYY-MM-DD format. provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - DiscountWindowPrimaryCreditRate - ------------------------------- - date : date - The date of the data. - rate : Optional[float] - Discount Window Primary Credit Rate. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.rate.dpcredit() + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + parameter : Literal['daily_excl_weekend', 'monthly', 'weekly', 'daily', 'annual'] + FRED series ID of DWPCR data. (provider: fred) + + Returns + ------- + OBBject + results : List[DiscountWindowPrimaryCreditRate] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + DiscountWindowPrimaryCreditRate + ------------------------------- + date : date + The date of the data. + rate : Optional[float] + Discount Window Primary Credit Rate. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.rate.dpcredit() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/rate/dpcredit", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) @validate @@ -211,72 +206,70 @@ def ecb( ] = "lending", provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """European Central Bank Interest Rates. - The Governing Council of the ECB sets the key interest rates for the euro area: - - - The interest rate on the main refinancing operations (MRO), which provide - the bulk of liquidity to the banking system. - - The rate on the deposit facility, which banks may use to make overnight deposits with the Eurosystem. - - The rate on the marginal lending facility, which offers overnight credit to banks from the Eurosystem. - - - Parameters - ---------- - start_date : Optional[datetime.date] - Start date of the data, in YYYY-MM-DD format. - end_date : Optional[datetime.date] - End date of the data, in YYYY-MM-DD format. - interest_rate_type : Literal['deposit', 'lending', 'refinancing'] - The type of interest rate. - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - - Returns - ------- - OBBject - results : List[EuropeanCentralBankInterestRates] - Serializable results. + The Governing Council of the ECB sets the key interest rates for the euro area: + + - The interest rate on the main refinancing operations (MRO), which provide + the bulk of liquidity to the banking system. + - The rate on the deposit facility, which banks may use to make overnight deposits with the Eurosystem. + - The rate on the marginal lending facility, which offers overnight credit to banks from the Eurosystem. + + + Parameters + ---------- + start_date : Optional[datetime.date] + Start date of the data, in YYYY-MM-DD format. + end_date : Optional[datetime.date] + End date of the data, in YYYY-MM-DD format. + interest_rate_type : Literal['deposit', 'lending', 'refinancing'] + The type of interest rate. provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - EuropeanCentralBankInterestRates - -------------------------------- - date : date - The date of the data. - rate : Optional[float] - European Central Bank Interest Rate. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.rate.ecb(interest_rate_type="lending") + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + + Returns + ------- + OBBject + results : List[EuropeanCentralBankInterestRates] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + EuropeanCentralBankInterestRates + -------------------------------- + date : date + The date of the data. + rate : Optional[float] + European Central Bank Interest Rate. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.rate.ecb(interest_rate_type="lending") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - "interest_rate_type": interest_rate_type, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/rate/ecb", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + "interest_rate_type": interest_rate_type, + }, + extra_params=kwargs, + ) ) @validate @@ -296,141 +289,137 @@ def effr( ] = None, provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Fed Funds Rate. - Get Effective Federal Funds Rate data. A bank rate is the interest rate a nation's central bank charges to its - domestic banks to borrow money. The rates central banks charge are set to stabilize the economy. In the - United States, the Federal Reserve System's Board of Governors set the bank rate, also known as the discount rate. - - - Parameters - ---------- - start_date : Optional[datetime.date] - Start date of the data, in YYYY-MM-DD format. - end_date : Optional[datetime.date] - End date of the data, in YYYY-MM-DD format. - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - parameter : Literal['monthly', 'daily', 'weekly', 'daily_excl_weekend', 'annual', 'biweekly', 'volume'] - Period of FED rate. (provider: fred) - - Returns - ------- - OBBject - results : List[FEDFUNDS] - Serializable results. + Get Effective Federal Funds Rate data. A bank rate is the interest rate a nation's central bank charges to its + domestic banks to borrow money. The rates central banks charge are set to stabilize the economy. In the + United States, the Federal Reserve System's Board of Governors set the bank rate, also known as the discount rate. + + + Parameters + ---------- + start_date : Optional[datetime.date] + Start date of the data, in YYYY-MM-DD format. + end_date : Optional[datetime.date] + End date of the data, in YYYY-MM-DD format. provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - FEDFUNDS - -------- - date : date - The date of the data. - rate : Optional[float] - FED rate. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.rate.effr() + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + parameter : Literal['monthly', 'daily', 'weekly', 'daily_excl_weekend', 'annual', 'biweekly', 'volume'] + Period of FED rate. (provider: fred) + + Returns + ------- + OBBject + results : List[FEDFUNDS] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + FEDFUNDS + -------- + date : date + The date of the data. + rate : Optional[float] + FED rate. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.rate.effr() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/rate/effr", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) @validate def effr_forecast( self, provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Fed Funds Rate Projections. - The projections for the federal funds rate are the value of the midpoint of the - projected appropriate target range for the federal funds rate or the projected - appropriate target level for the federal funds rate at the end of the specified - calendar year or over the longer run. - - - Parameters - ---------- - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - long_run : bool - Flag to show long run projections (provider: fred) - - Returns - ------- - OBBject - results : List[PROJECTIONS] - Serializable results. + The projections for the federal funds rate are the value of the midpoint of the + projected appropriate target range for the federal funds rate or the projected + appropriate target level for the federal funds rate at the end of the specified + calendar year or over the longer run. + + + Parameters + ---------- provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - PROJECTIONS - ----------- - date : date - The date of the data. - range_high : Optional[float] - High projection of rates. - central_tendency_high : Optional[float] - Central tendency of high projection of rates. - median : Optional[float] - Median projection of rates. - range_midpoint : Optional[float] - Midpoint projection of rates. - central_tendency_midpoint : Optional[float] - Central tendency of midpoint projection of rates. - range_low : Optional[float] - Low projection of rates. - central_tendency_low : Optional[float] - Central tendency of low projection of rates. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.rate.effr_forecast() + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + long_run : bool + Flag to show long run projections (provider: fred) + + Returns + ------- + OBBject + results : List[PROJECTIONS] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + PROJECTIONS + ----------- + date : date + The date of the data. + range_high : Optional[float] + High projection of rates. + central_tendency_high : Optional[float] + Central tendency of high projection of rates. + median : Optional[float] + Median projection of rates. + range_midpoint : Optional[float] + Midpoint projection of rates. + central_tendency_midpoint : Optional[float] + Central tendency of midpoint projection of rates. + range_low : Optional[float] + Low projection of rates. + central_tendency_low : Optional[float] + Central tendency of low projection of rates. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.rate.effr_forecast() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={}, - extra_params=kwargs, - ) - return self._run( "/fixedincome/rate/effr_forecast", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={}, + extra_params=kwargs, + ) ) @validate @@ -450,69 +439,67 @@ def estr( ] = None, provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Euro Short-Term Rate. - The euro short-term rate (€STR) reflects the wholesale euro unsecured overnight borrowing costs of banks located in - the euro area. The €STR is published on each TARGET2 business day based on transactions conducted and settled on - the previous TARGET2 business day (the reporting date “T”) with a maturity date of T+1 which are deemed to have been - executed at arm’s length and thus reflect market rates in an unbiased way. - - - Parameters - ---------- - start_date : Optional[datetime.date] - Start date of the data, in YYYY-MM-DD format. - end_date : Optional[datetime.date] - End date of the data, in YYYY-MM-DD format. - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - parameter : Literal['volume_weighted_trimmed_mean_rate', 'number_of_transactions', 'number_of_active_banks', 'total_volume', 'share_of_volume_of_the_5_largest_active_banks', 'rate_at_75th_percentile_of_volume', 'rate_at_25th_percentile_of_volume'] - Period of ESTR rate. (provider: fred) - - Returns - ------- - OBBject - results : List[ESTR] - Serializable results. + The euro short-term rate (€STR) reflects the wholesale euro unsecured overnight borrowing costs of banks located in + the euro area. The €STR is published on each TARGET2 business day based on transactions conducted and settled on + the previous TARGET2 business day (the reporting date “T”) with a maturity date of T+1 which are deemed to have been + executed at arm’s length and thus reflect market rates in an unbiased way. + + + Parameters + ---------- + start_date : Optional[datetime.date] + Start date of the data, in YYYY-MM-DD format. + end_date : Optional[datetime.date] + End date of the data, in YYYY-MM-DD format. provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - ESTR - ---- - date : date - The date of the data. - rate : Optional[float] - ESTR rate. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.rate.estr() + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + parameter : Literal['volume_weighted_trimmed_mean_rate', 'number_of_transactions', 'number_of_active_banks', 'total_volume', 'share_of_volume_of_the_5_largest_active_banks', 'rate_at_75th_percentile_of_volume', 'rate_at_25th_percentile_of_volume'] + Period of ESTR rate. (provider: fred) + + Returns + ------- + OBBject + results : List[ESTR] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + ESTR + ---- + date : date + The date of the data. + rate : Optional[float] + ESTR rate. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.rate.estr() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/rate/estr", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) @validate @@ -532,66 +519,64 @@ def iorb( ] = None, provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Interest on Reserve Balances. - Get Interest Rate on Reserve Balances data A bank rate is the interest rate a nation's central bank charges to its - domestic banks to borrow money. The rates central banks charge are set to stabilize the economy. In the - United States, the Federal Reserve System's Board of Governors set the bank rate, also known as the discount rate. - - - Parameters - ---------- - start_date : Optional[datetime.date] - Start date of the data, in YYYY-MM-DD format. - end_date : Optional[datetime.date] - End date of the data, in YYYY-MM-DD format. - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - - Returns - ------- - OBBject - results : List[IORB] - Serializable results. + Get Interest Rate on Reserve Balances data A bank rate is the interest rate a nation's central bank charges to its + domestic banks to borrow money. The rates central banks charge are set to stabilize the economy. In the + United States, the Federal Reserve System's Board of Governors set the bank rate, also known as the discount rate. + + + Parameters + ---------- + start_date : Optional[datetime.date] + Start date of the data, in YYYY-MM-DD format. + end_date : Optional[datetime.date] + End date of the data, in YYYY-MM-DD format. provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - IORB - ---- - date : date - The date of the data. - rate : Optional[float] - IORB rate. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.rate.iorb() + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + + Returns + ------- + OBBject + results : List[IORB] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + IORB + ---- + date : date + The date of the data. + rate : Optional[float] + IORB rate. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.rate.iorb() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/rate/iorb", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) @validate @@ -611,66 +596,64 @@ def sonia( ] = None, provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Sterling Overnight Index Average. - SONIA (Sterling Overnight Index Average) is an important interest rate benchmark. SONIA is based on actual - transactions and reflects the average of the interest rates that banks pay to borrow sterling overnight from other - financial institutions and other institutional investors. - - - Parameters - ---------- - start_date : Optional[datetime.date] - Start date of the data, in YYYY-MM-DD format. - end_date : Optional[datetime.date] - End date of the data, in YYYY-MM-DD format. - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - parameter : Literal['rate', 'index', '10th_percentile', '25th_percentile', '75th_percentile', '90th_percentile', 'total_nominal_value'] - Period of SONIA rate. (provider: fred) - - Returns - ------- - OBBject - results : List[SONIA] - Serializable results. + SONIA (Sterling Overnight Index Average) is an important interest rate benchmark. SONIA is based on actual + transactions and reflects the average of the interest rates that banks pay to borrow sterling overnight from other + financial institutions and other institutional investors. + + + Parameters + ---------- + start_date : Optional[datetime.date] + Start date of the data, in YYYY-MM-DD format. + end_date : Optional[datetime.date] + End date of the data, in YYYY-MM-DD format. provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - SONIA - ----- - date : date - The date of the data. - rate : Optional[float] - SONIA rate. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.rate.sonia() + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + parameter : Literal['rate', 'index', '10th_percentile', '25th_percentile', '75th_percentile', '90th_percentile', 'total_nominal_value'] + Period of SONIA rate. (provider: fred) + + Returns + ------- + OBBject + results : List[SONIA] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + SONIA + ----- + date : date + The date of the data. + rate : Optional[float] + SONIA rate. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.rate.sonia() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/rate/sonia", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/fixedincome_spreads.py b/openbb_platform/openbb/package/fixedincome_spreads.py index ecab218f8185..32aac9418779 100644 --- a/openbb_platform/openbb/package/fixedincome_spreads.py +++ b/openbb_platform/openbb/package/fixedincome_spreads.py @@ -1,14 +1,13 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### import datetime -from typing import List, Literal, Optional, Union +from typing import Literal, Optional, Union from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -43,70 +42,68 @@ def tmc( ] = "3m", provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Treasury Constant Maturity. - Get data for 10-Year Treasury Constant Maturity Minus Selected Treasury Constant Maturity. - Constant maturity is the theoretical value of a U.S. Treasury that is based on recent values of auctioned U.S. - Treasuries. The value is obtained by the U.S. Treasury on a daily basis through interpolation of the Treasury - yield curve which, in turn, is based on closing bid-yields of actively-traded Treasury securities. + Get data for 10-Year Treasury Constant Maturity Minus Selected Treasury Constant Maturity. + Constant maturity is the theoretical value of a U.S. Treasury that is based on recent values of auctioned U.S. + Treasuries. The value is obtained by the U.S. Treasury on a daily basis through interpolation of the Treasury + yield curve which, in turn, is based on closing bid-yields of actively-traded Treasury securities. - Parameters - ---------- - start_date : Optional[datetime.date] - Start date of the data, in YYYY-MM-DD format. - end_date : Optional[datetime.date] - End date of the data, in YYYY-MM-DD format. - maturity : Optional[Literal['3m', '2y']] - The maturity - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - - Returns - ------- - OBBject - results : List[TreasuryConstantMaturity] - Serializable results. + Parameters + ---------- + start_date : Optional[datetime.date] + Start date of the data, in YYYY-MM-DD format. + end_date : Optional[datetime.date] + End date of the data, in YYYY-MM-DD format. + maturity : Optional[Literal['3m', '2y']] + The maturity provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - TreasuryConstantMaturity - ------------------------ - date : date - The date of the data. - rate : Optional[float] - TreasuryConstantMaturity Rate. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.spreads.tmc(maturity="3m") + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + + Returns + ------- + OBBject + results : List[TreasuryConstantMaturity] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + TreasuryConstantMaturity + ------------------------ + date : date + The date of the data. + rate : Optional[float] + TreasuryConstantMaturity Rate. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.spreads.tmc(maturity="3m") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - "maturity": maturity, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/spreads/tmc", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + "maturity": maturity, + }, + extra_params=kwargs, + ) ) @validate @@ -130,70 +127,68 @@ def tmc_effr( ] = "10y", provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Select Treasury Constant Maturity. - Get data for Selected Treasury Constant Maturity Minus Federal Funds Rate - Constant maturity is the theoretical value of a U.S. Treasury that is based on recent values of auctioned U.S. - Treasuries. The value is obtained by the U.S. Treasury on a daily basis through interpolation of the Treasury - yield curve which, in turn, is based on closing bid-yields of actively-traded Treasury securities. + Get data for Selected Treasury Constant Maturity Minus Federal Funds Rate + Constant maturity is the theoretical value of a U.S. Treasury that is based on recent values of auctioned U.S. + Treasuries. The value is obtained by the U.S. Treasury on a daily basis through interpolation of the Treasury + yield curve which, in turn, is based on closing bid-yields of actively-traded Treasury securities. - Parameters - ---------- - start_date : Optional[datetime.date] - Start date of the data, in YYYY-MM-DD format. - end_date : Optional[datetime.date] - End date of the data, in YYYY-MM-DD format. - maturity : Optional[Literal['10y', '5y', '1y', '6m', '3m']] - The maturity - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - - Returns - ------- - OBBject - results : List[SelectedTreasuryConstantMaturity] - Serializable results. + Parameters + ---------- + start_date : Optional[datetime.date] + Start date of the data, in YYYY-MM-DD format. + end_date : Optional[datetime.date] + End date of the data, in YYYY-MM-DD format. + maturity : Optional[Literal['10y', '5y', '1y', '6m', '3m']] + The maturity provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - SelectedTreasuryConstantMaturity - -------------------------------- - date : date - The date of the data. - rate : Optional[float] - Selected Treasury Constant Maturity Rate. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.spreads.tmc_effr(maturity="10y") + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + + Returns + ------- + OBBject + results : List[SelectedTreasuryConstantMaturity] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + SelectedTreasuryConstantMaturity + -------------------------------- + date : date + The date of the data. + rate : Optional[float] + Selected Treasury Constant Maturity Rate. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.spreads.tmc_effr(maturity="10y") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - "maturity": maturity, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/spreads/tmc_effr", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + "maturity": maturity, + }, + extra_params=kwargs, + ) ) @validate @@ -217,69 +212,67 @@ def treasury_effr( ] = "3m", provider: Optional[Literal["fred"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Select Treasury Bill. - Get Selected Treasury Bill Minus Federal Funds Rate. - Constant maturity is the theoretical value of a U.S. Treasury that is based on recent values of - auctioned U.S. Treasuries. - The value is obtained by the U.S. Treasury on a daily basis through interpolation of the Treasury - yield curve which, in turn, is based on closing bid-yields of actively-traded Treasury securities. - - - Parameters - ---------- - start_date : Optional[datetime.date] - Start date of the data, in YYYY-MM-DD format. - end_date : Optional[datetime.date] - End date of the data, in YYYY-MM-DD format. - maturity : Optional[Literal['3m', '6m']] - The maturity - provider : Optional[Literal['fred']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'fred' if there is - no default. - - Returns - ------- - OBBject - results : List[SelectedTreasuryBill] - Serializable results. + Get Selected Treasury Bill Minus Federal Funds Rate. + Constant maturity is the theoretical value of a U.S. Treasury that is based on recent values of + auctioned U.S. Treasuries. + The value is obtained by the U.S. Treasury on a daily basis through interpolation of the Treasury + yield curve which, in turn, is based on closing bid-yields of actively-traded Treasury securities. + + + Parameters + ---------- + start_date : Optional[datetime.date] + Start date of the data, in YYYY-MM-DD format. + end_date : Optional[datetime.date] + End date of the data, in YYYY-MM-DD format. + maturity : Optional[Literal['3m', '6m']] + The maturity provider : Optional[Literal['fred']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra: Dict[str, Any] - Extra info. - - SelectedTreasuryBill - -------------------- - date : date - The date of the data. - rate : Optional[float] - SelectedTreasuryBill Rate. - - Example - ------- - >>> from openbb import obb - >>> obb.fixedincome.spreads.treasury_effr(maturity="3m") + The provider to use for the query, by default None. + If None, the provider specified in defaults is selected or 'fred' if there is + no default. + + Returns + ------- + OBBject + results : List[SelectedTreasuryBill] + Serializable results. + provider : Optional[Literal['fred']] + Provider name. + warnings : Optional[List[Warning_]] + List of warnings. + chart : Optional[Chart] + Chart object. + extra: Dict[str, Any] + Extra info. + + SelectedTreasuryBill + -------------------- + date : date + The date of the data. + rate : Optional[float] + SelectedTreasuryBill Rate. + + Example + ------- + >>> from openbb import obb + >>> obb.fixedincome.spreads.treasury_effr(maturity="3m") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "start_date": start_date, - "end_date": end_date, - "maturity": maturity, - }, - extra_params=kwargs, - ) - return self._run( "/fixedincome/spreads/treasury_effr", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "start_date": start_date, + "end_date": end_date, + "maturity": maturity, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/index.py b/openbb_platform/openbb/package/index.py index 6c464b59c33d..b67239ffc658 100644 --- a/openbb_platform/openbb/package/index.py +++ b/openbb_platform/openbb/package/index.py @@ -6,9 +6,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -23,9 +22,7 @@ def __repr__(self) -> str: return self.__doc__ or "" @validate - def available( - self, provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + def available(self, provider: Optional[Literal["fmp"]] = None, **kwargs) -> OBBject: """Available Indices. Available indices for a given provider. Parameters @@ -66,17 +63,15 @@ def available( >>> obb.index.available() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={}, - extra_params=kwargs, - ) - return self._run( "/index/available", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={}, + extra_params=kwargs, + ) ) @validate @@ -90,7 +85,7 @@ def constituents( ] = "dowjones", provider: Optional[Literal["fmp"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Index Constituents. Constituents of an index. Parameters @@ -141,19 +136,17 @@ def constituents( >>> obb.index.constituents(index="dowjones") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "index": index, - }, - extra_params=kwargs, - ) - return self._run( "/index/constituents", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "index": index, + }, + extra_params=kwargs, + ) ) @validate @@ -177,7 +170,7 @@ def market( ] = None, provider: Optional[Literal["fmp", "intrinio", "polygon"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Historical Market Indices. Parameters @@ -261,19 +254,17 @@ def market( >>> obb.index.market(symbol="SPX") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - "start_date": start_date, - "end_date": end_date, - }, - extra_params=kwargs, - ) - return self._run( "/index/market", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "start_date": start_date, + "end_date": end_date, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/news.py b/openbb_platform/openbb/package/news.py index 3879ed57f6e6..a5c508739801 100644 --- a/openbb_platform/openbb/package/news.py +++ b/openbb_platform/openbb/package/news.py @@ -1,14 +1,13 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from typing import List, Literal, Optional +from typing import Literal, Optional from annotated_types import Ge from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -38,7 +37,7 @@ def company( Literal["benzinga", "fmp", "intrinio", "polygon", "tiingo"] ] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Company News. Get news for one or more companies. Parameters @@ -156,20 +155,18 @@ def company( >>> obb.news.company(symbols="AAPL,MSFT", limit=20) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbols": symbols, - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/news/company", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbols": symbols, + "limit": limit, + }, + extra_params=kwargs, + ) ) @validate @@ -183,7 +180,7 @@ def world( ] = 20, provider: Optional[Literal["benzinga", "fmp", "intrinio", "tiingo"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """World News. Global news data. Parameters @@ -284,17 +281,15 @@ def world( >>> obb.news.world(limit=20) """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "limit": limit, - }, - extra_params=kwargs, - ) - return self._run( "/news/world", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "limit": limit, + }, + extra_params=kwargs, + ) ) diff --git a/openbb_platform/openbb/package/regulators.py b/openbb_platform/openbb/package/regulators.py index cb118a113ad7..753e0bfc69aa 100644 --- a/openbb_platform/openbb/package/regulators.py +++ b/openbb_platform/openbb/package/regulators.py @@ -13,7 +13,8 @@ def __repr__(self) -> str: return self.__doc__ or "" @property - def sec(self): # route = "/regulators/sec" + def sec(self): + # pylint: disable=import-outside-toplevel from . import regulators_sec return regulators_sec.ROUTER_regulators_sec(command_runner=self._command_runner) diff --git a/openbb_platform/openbb/package/regulators_sec.py b/openbb_platform/openbb/package/regulators_sec.py index 8b52eb1c9986..5349e323e186 100644 --- a/openbb_platform/openbb/package/regulators_sec.py +++ b/openbb_platform/openbb/package/regulators_sec.py @@ -5,9 +5,8 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container -from openbb_core.app.static.decorators import validate -from openbb_core.app.static.filters import filter_inputs -from openbb_core.provider.abstract.data import Data +from openbb_core.app.static.utils.decorators import validate +from openbb_core.app.static.utils.filters import filter_inputs from typing_extensions import Annotated @@ -33,7 +32,7 @@ def cik_map( ], provider: Optional[Literal["sec"]] = None, **kwargs - ) -> OBBject[Data]: + ) -> OBBject: """Get the CIK number corresponding to a ticker symbol. Parameters @@ -70,19 +69,17 @@ def cik_map( >>> obb.regulators.sec.cik_map(symbol="AAPL") """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, - }, - extra_params=kwargs, - ) - return self._run( "/regulators/sec/cik_map", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + }, + extra_params=kwargs, + ) ) @validate @@ -91,7 +88,7 @@ def institutions_search( query: Annotated[str, OpenBBCustomParameter(description="Search query.")] = "", provider: Optional[Literal["sec"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """Look up institutions regulated by the SEC. Parameters @@ -132,25 +129,23 @@ def institutions_search( >>> obb.regulators.sec.institutions_search() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "query": query, - }, - extra_params=kwargs, - ) - return self._run( "/regulators/sec/institutions_search", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "query": query, + }, + extra_params=kwargs, + ) ) @validate def rss_litigation( self, provider: Optional[Literal["sec"]] = None, **kwargs - ) -> OBBject[List[Data]]: + ) -> OBBject: """The RSS feed provides links to litigation releases concerning civil lawsuits brought by the Commission in federal court. Parameters @@ -193,17 +188,15 @@ def rss_litigation( >>> obb.regulators.sec.rss_litigation() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={}, - extra_params=kwargs, - ) - return self._run( "/regulators/sec/rss_litigation", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={}, + extra_params=kwargs, + ) ) @validate @@ -212,7 +205,7 @@ def schema_files( query: Annotated[str, OpenBBCustomParameter(description="Search query.")] = "", provider: Optional[Literal["sec"]] = None, **kwargs - ) -> OBBject[Data]: + ) -> OBBject: """Get lists of SEC XML schema files by year. Parameters @@ -251,19 +244,17 @@ def schema_files( >>> obb.regulators.sec.schema_files() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "query": query, - }, - extra_params=kwargs, - ) - return self._run( "/regulators/sec/schema_files", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "query": query, + }, + extra_params=kwargs, + ) ) @validate @@ -272,8 +263,8 @@ def sic_search( query: Annotated[str, OpenBBCustomParameter(description="Search query.")] = "", provider: Optional[Literal["sec"]] = None, **kwargs - ) -> OBBject[List[Data]]: - """Fuzzy search for Industry Titles, Reporting Office, and SIC Codes. + ) -> OBBject: + """Search for Industry Titles, Reporting Office, and SIC Codes. Parameters ---------- @@ -315,19 +306,17 @@ def sic_search( >>> obb.regulators.sec.sic_search() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "query": query, - }, - extra_params=kwargs, - ) - return self._run( "/regulators/sec/sic_search", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "query": query, + }, + extra_params=kwargs, + ) ) @validate @@ -336,7 +325,7 @@ def symbol_map( query: Annotated[str, OpenBBCustomParameter(description="Search query.")] = "", provider: Optional[Literal["sec"]] = None, **kwargs - ) -> OBBject[Data]: + ) -> OBBject: """Get the ticker symbol corresponding to a company's CIK. Parameters @@ -373,17 +362,15 @@ def symbol_map( >>> obb.regulators.sec.symbol_map() """ # noqa: E501 - inputs = filter_inputs( - provider_choices={ - "provider": provider, - }, - standard_params={ - "query": query, - }, - extra_params=kwargs, - ) - return self._run( "/regulators/sec/symbol_map", - **inputs, + **filter_inputs( + provider_choices={ + "provider": provider, + }, + standard_params={ + "query": query, + }, + extra_params=kwargs, + ) ) From f9fbb2a83133a54152f90e7929244f6a9a7bb861 Mon Sep 17 00:00:00 2001 From: Henrique Joaquim Date: Wed, 13 Dec 2023 13:08:08 +0000 Subject: [PATCH 10/10] small refactor for simplification (#5886) Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> --- .../fred/openbb_fred/models/search.py | 31 ++++--------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/openbb_platform/providers/fred/openbb_fred/models/search.py b/openbb_platform/providers/fred/openbb_fred/models/search.py index 5da34efca498..2497b4b44ba8 100644 --- a/openbb_platform/providers/fred/openbb_fred/models/search.py +++ b/openbb_platform/providers/fred/openbb_fred/models/search.py @@ -2,7 +2,6 @@ from typing import Any, Dict, List, Literal, Optional, Union -import pandas as pd from openbb_core.provider.abstract.fetcher import Fetcher from openbb_core.provider.standard_models.fred_search import ( SearchData, @@ -97,7 +96,6 @@ async def aextract_data( **kwargs: Any, ) -> List[Dict]: """Extract the raw data.""" - api_key = credentials.get("fred_api_key") if credentials else "" if query.is_release is True: @@ -131,27 +129,10 @@ def transform_data( query: FredSearchQueryParams, data: List[Dict], **kwargs: Any ) -> List[FredSearchData]: """Transform data.""" + for observation in data: + id_column_name = "release_id" if query.is_release is True else "series_id" + observation[id_column_name] = observation.pop("id") + observation.pop("realtime_start", None) + observation.pop("realtime_end", None) - df = pd.DataFrame() - if data is not None: - for d in data: - d.pop("realtime_start", None) - d.pop("realtime_end", None) - df = ( - pd.DataFrame.from_records(data) - .fillna("N/A") - .replace("N/A", None) - .rename( - columns={"id": "release_id"} - if query.is_release is True - else {"id": "series_id"} - ) - ) - target = "name" if query.is_release is True else "title" - if query.query is not None: - df = df[ - df[target].str.contains(query.query, case=False) - | df["notes"].str.contains(query.query, case=False) - ] - - return [FredSearchData.model_validate(d) for d in df.to_dict("records")] + return [FredSearchData.model_validate(d) for d in data]