diff options
62 files changed, 51 insertions, 6513 deletions
diff --git a/.github/workflows/macos-build.yml b/.github/workflows/macos-build.yml index 3d8652ab050..6c7a2971b17 100644 --- a/.github/workflows/macos-build.yml +++ b/.github/workflows/macos-build.yml @@ -140,26 +140,6 @@ jobs: pkgutil --expand-full OpenBBTerminal.pkg extract/ rm -rf OpenBBTerminal.pkg - - name: Run Integration Tests - run: | - extract/OpenBBTerminal.pkg/Payload/Applications/OpenBB\ Terminal/.OpenBB/OpenBBTerminal -t -s forecast cryptocurrency reports alternative economy futures econometrics dashboards portfolio stocks/test_stocks_options_screen.openbb stocks/test_stocks_options.openbb forex etf stocks/test_stocks_fa.openbb | tee result.txt - grep "================================ Integration Test Summary ================================" result.txt -A100 | tail --bytes=2000 > summary.txt - - - name: Run Integration Tests Coverage Report - run: | - extract/OpenBBTerminal.pkg/Payload/Applications/OpenBB\ Terminal/.OpenBB/OpenBBTerminal -t --coverage | tee result.txt - echo >> summary.txt - sed -n '/Integration Coverage Summary/,$p' result.txt >> summary.txt - - - name: Upload summary to Slack - uses: adrey/slack-file-upload-action@master - with: - token: ${{ secrets.SLACK_API_TOKEN }} - initial_comment: "MacOs Build Integration test summary" - title: "MacOs Build Integration test summary" - path: summary.txt - channel: ${{ secrets.SLACK_CHANNEL_ID }} - - name: Remove OpenBB Folder run: | rm -rf /Users/openbb/Desktop/OpenBB\ Terminal @@ -293,26 +273,6 @@ jobs: pkgutil --expand-full OpenBBTerminal.pkg extract/ rm -rf OpenBBTerminal.pkg - - name: Run Integration Tests - run: | - extract/OpenBBTerminal.pkg/Payload/Applications/OpenBB\ Terminal/.OpenBB/OpenBBTerminal -t -s forecast cryptocurrency reports alternative economy futures econometrics dashboards portfolio stocks/test_stocks_options_screen.openbb stocks/test_stocks_options.openbb forex etf stocks/test_stocks_fa.openbb | tee result.txt - grep "================================ Integration Test Summary ================================" result.txt -A100 | tail --bytes=2000 > summary.txt - echo >> summary.txt - - - name: Run Integration Tests Coverage Report - run: | - extract/OpenBBTerminal.pkg/Payload/Applications/OpenBB\ Terminal/.OpenBB/OpenBBTerminal -t --coverage | tee result.txt - sed -n '/Integration Coverage Summary/,$p' result.txt >> summary.txt - - - name: Upload summary to Slack - uses: adrey/slack-file-upload-action@master - with: - token: ${{ secrets.SLACK_API_TOKEN }} - initial_comment: "MacOs Build Integration test summary" - title: "Intel MacOs Build Integration test summary" - path: summary.txt - channel: ${{ secrets.SLACK_CHANNEL_ID }} - - name: Remove OpenBB Folder run: | rm -rf /Users/openbb/Desktop/OpenBB\ Terminal diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eff20db9821..dd290578b6e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1370,7 +1370,6 @@ The convention is as follows: "news": [ "Feedparser", "NewsApi", - "Ultima" ], ... ``` @@ -1497,7 +1496,6 @@ class ForexController(BaseController): CHOICES_MENUS = [ "forecast", "qa", - "oanda", "ta", ] RESOLUTION = ["i", "d", "w", "m"] diff --git a/build/pyinstaller/macOS/darwin/Resources/LICENSE.txt b/build/pyinstaller/macOS/darwin/Resources/LICENSE.txt index 793f55bb607..b86fa3e85d2 100644 --- a/build/pyinstaller/macOS/darwin/Resources/LICENSE.txt +++ b/build/pyinstaller/macOS/darwin/Resources/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021-2023 OpenBB Inc. +Copyright (c) 2021-2024 OpenBB Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/build/pyinstaller/terminal.spec b/build/pyinstaller/terminal.spec index 2728339ece7..35d0b300995 100644 --- a/build/pyinstaller/terminal.spec +++ b/build/pyinstaller/terminal.spec @@ -72,10 +72,6 @@ added_files = [ (str(pathex / "streamlit"), "streamlit"), (str(pathex / "altair"), "altair"), (str(pathex / "pyarrow"), "pyarrow"), - (str(pathex / "langchain"), "langchain"), - (str(pathex / "llama_index/VERSION"), "llama_index"), - (str(pathex / "tiktoken"), "tiktoken"), - (str(pathex / "tiktoken_ext"), "tiktoken_ext"), (which("pywry"), "."), ] @@ -123,7 +119,6 @@ hidden_imports = [ "pytrends", "pytrends.request", "pyarrow", - "langchain", ] diff --git a/openbb_platform/core/openbb_core/app/model/hub/features_keys.py b/openbb_platform/core/openbb_core/app/model/hub/features_keys.py index 31f828017d9..c0653ff443c 100644 --- a/openbb_platform/core/openbb_core/app/model/hub/features_keys.py +++ b/openbb_platform/core/openbb_core/app/model/hub/features_keys.py @@ -34,8 +34,4 @@ class FeaturesKeys(BaseModel): API_SMARTSTAKE_KEY: Optional[str] = Field(default=None) API_SMARTSTAKE_TOKEN: Optional[str] = Field(default=None) API_TOKEN_TERMINAL_KEY: Optional[str] = Field(default=None) - API_TWITTER_BEARER_TOKEN: Optional[str] = Field(default=None) - API_TWITTER_KEY: Optional[str] = Field(default=None) - API_TWITTER_SECRET_KEY: Optional[str] = Field(default=None) - API_ULTIMA_KEY: Optional[str] = Field(default=None) API_WHALE_ALERT_KEY: Optional[str] = Field(default=None) diff --git a/openbb_terminal/common/ultima_newsmonitor_model.py b/openbb_terminal/common/ultima_newsmonitor_model.py deleted file mode 100644 index 0fb041dda16..00000000000 --- a/openbb_terminal/common/ultima_newsmonitor_model.py +++ /dev/null @@ -1,240 +0,0 @@ -""" Ultima News Monitor Model """ - -__docformat__ = "numpy" - -import logging -import os -from urllib.parse import quote - -import certifi -import pandas as pd - -from openbb_terminal.core.session.current_user import get_current_user -from openbb_terminal.decorators import log_start_end - -# from openbb_terminal.decorators import check_api_key -from openbb_terminal.helper_funcs import request -from openbb_terminal.rich_config import console - -logger = logging.getLogger(__name__) - - -ULTIMA_BASE_URL = "https://api.ultimainsights.ai/v1" -NO_API_KEY = "REPLACE_ME" - - -@log_start_end(log=logger) -# @check_api_key(["API_ULTIMA_KEY"]) -def get_news(term: str = "", sort: str = "articlePublishedDate") -> pd.DataFrame: - """Get news for a given term and source. [Source: Ultima Insights News Monitor] - - Parameters - ---------- - term : str - term to search on the news articles - sort: str - the column to sort by - - Returns - ------- - articles: pd.DataFrame - term to search on the news articles - - Examples - -------- - >>> from openbb_terminal.sdk import openbb - >>> openbb.news() - """ - # Necessary for installer so that it can locate the correct certificates for - # API calls and https - # https://stackoverflow.com/questions/27835619/urllib-and-ssl-certificate-verify-failed-error/73270162#73270162 - os.environ["REQUESTS_CA_BUNDLE"] = certifi.where() - os.environ["SSL_CERT_FILE"] = certifi.where() - - current_user = get_current_user() - if current_user.credentials.API_ULTIMA_KEY == NO_API_KEY: - auth_header = None - else: - auth_header = { - "Authorization": f"Bearer {current_user.credentials.API_ULTIMA_KEY}" - } - - have_data = False - limit = 0 - - while not have_data: - if term: - term = quote(term) - term = term.upper() - term = term.strip() - if term in supported_terms(): - if auth_header: - data = request( - f"{ULTIMA_BASE_URL}/getNewsArticles/{term}", headers=auth_header - ) - else: - data = request(f"{ULTIMA_BASE_URL}/getNewsArticles/{term}") - else: - console.print( - "[red]Ticker not supported. Unable to retrieve data\n[/red]" - ) - return pd.DataFrame() - else: - console.print("[red]No term specified. Unable to retrieve data\n[/red]") - return pd.DataFrame() - - if ( - hasattr(data, "status") and data.status_code == 200 - ): # Checking if data has status attribute and if data request succeeded - if data.content: - have_data = True - elif limit == 60: # Breaking if 60 successful requests return no data - console.print("[red]Timeout occurred. Please try again\n[/red]") - break - limit = limit + 1 - - elif ( - hasattr(data, "status") and data.status_code == 429 - ): # If data request failed - console.print( - "[red]Too many requests. Please get an API Key from https://www.ultimainsights.ai/[/red]" - ) - break - elif ( - hasattr(data, "status") and data.status_code != 200 - ): # If data request failed - console.print("[red]Status code not 200. Unable to retrieve data\n[/red]") - break - else: - # console.print("[red]Could not retrieve data\n[/red]") - break - if not data.json(): - return pd.DataFrame() - df = pd.DataFrame( - data.json(), - columns=[ - "articleHeadline", - "articleURL", - "articlePublishedDate", - "riskCategory", - "riskElaboratedDescription", - "relevancyScore", - ], - ) - df = df[df["relevancyScore"] < 5] - df = df[df["relevancyScore"] > 3.5] - df["riskElaboratedDescription"] = df["riskElaboratedDescription"].str.replace( - "\n", "" - ) - df["riskElaboratedDescription"] = df["riskElaboratedDescription"].str.replace( - "\n", "" - ) - df["articlePublishedDate"] = pd.to_datetime(df["articlePublishedDate"]) - df = df.sort_values(by=[sort], ascending=False) - return df - - -@log_start_end(log=logger) -# @check_api_key(["API_ULTIMA_KEY"]) -def supported_terms() -> list: - """Get supported terms for news. [Source: Ultima] - - Returns - ------- - terms: list - list of supported terms (tickers) - - """ - - # Necessary for installer so that it can locate the correct certificates for - # API calls and https - # https://stackoverflow.com/questions/27835619/urllib-and-ssl-certificate-verify-failed-error/73270162#73270162 - os.environ["REQUESTS_CA_BUNDLE"] = certifi.where() - os.environ["SSL_CERT_FILE"] = certifi.where() - data = request(f"{ULTIMA_BASE_URL}/supportedTickers") - return list(data.json()) - - -@log_start_end(log=logger) -def get_company_info(ticker: str) -> dict: - """Get company info for a given ticker. [Source: Ultima Insights] - - Parameters - ---------- - ticker : str - ticker to search for company info - - Returns - ------- - company_info: dict - dictionary of company info - """ - - # Necessary for installer so that it can locate the correct certificates for - # API calls and https - # https://stackoverflow.com/questions/27835619/urllib-and-ssl-certificate-verify-failed-error/73270162#73270162 - os.environ["REQUESTS_CA_BUNDLE"] = certifi.where() - os.environ["SSL_CERT_FILE"] = certifi.where() - - if ticker in supported_terms(): - data = request(f"{ULTIMA_BASE_URL}/getCompanyInfo/{ticker}") - return data.json() - console.print("[red]Ticker not supported. Unable to retrieve data\n[/red]") - return {} - - -@log_start_end(log=logger) -def get_top_headlines(ticker: str) -> dict: - """Get top headlines for a given ticker. [Source: Ultima Insights] - - Parameters - ---------- - ticker : str - ticker to get top headlines for - - Returns - ------- - top_headlines: dict - dictionary of top headlines - """ - - # Necessary for installer so that it can locate the correct certificates for - # API calls and https - |