From 649dd1d64bc75adb6858b65d9ebf51b3c829e8c4 Mon Sep 17 00:00:00 2001 From: James Maslek Date: Tue, 22 Nov 2022 20:40:44 -0500 Subject: Fix linter issue (#3538) * Fix linter issue * Didnt import optimization menu * Fix some things for deployment * openbbterminal -> openbb * openbb --- .github/workflows/gh-pages.yml | 2 +- openbb_terminal/SDK_README.md | 2 +- .../cryptocurrency/cryptocurrency_helpers.py | 61 +++++++++++----------- .../stocks/options/chartexchange_model.py | 9 ++-- .../stocks/options/options_sdk_helper.py | 16 +++--- openbb_terminal/terminal_helper.py | 3 +- pyproject.toml | 2 +- website/content/sdk/quickstart/installation.md | 2 +- 8 files changed, 48 insertions(+), 49 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index a0478e8694e..efea1e798f8 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -38,7 +38,7 @@ jobs: run: poetry install --no-interaction --no-root - name: Install packages - run: poetry install --no-interaction -E prediction -E doc + run: poetry install --no-interaction -E prediction -E doc -E optimization - run: | source $VENV diff --git a/openbb_terminal/SDK_README.md b/openbb_terminal/SDK_README.md index 72befab3361..5e29a42784a 100644 --- a/openbb_terminal/SDK_README.md +++ b/openbb_terminal/SDK_README.md @@ -80,7 +80,7 @@ conda activate obb #### 4. **Install OpenBB SDK Core package** ```bash -pip install openbbterminal +pip install openbb ``` #### 5. **(Optional) Install the Toolkits** diff --git a/openbb_terminal/cryptocurrency/cryptocurrency_helpers.py b/openbb_terminal/cryptocurrency/cryptocurrency_helpers.py index 3b00fc6e796..8c86ab45ed9 100644 --- a/openbb_terminal/cryptocurrency/cryptocurrency_helpers.py +++ b/openbb_terminal/cryptocurrency/cryptocurrency_helpers.py @@ -1,40 +1,39 @@ """Cryptocurrency helpers""" # pylint: disable=too-many-lines,too-many-return-statements -from __future__ import annotations - -import os -import json -from datetime import datetime, timedelta import difflib +import json import logging +import os +from datetime import datetime, timedelta +from typing import Union -import pandas as pd -import numpy as np import ccxt import matplotlib.pyplot as plt -from matplotlib.ticker import LogLocator, ScalarFormatter -import yfinance as yf import mplfinance as mpf +import numpy as np +import pandas as pd +import yfinance as yf +from matplotlib.ticker import LogLocator, ScalarFormatter from pycoingecko import CoinGeckoAPI -from openbb_terminal.helper_funcs import ( - lambda_long_number_format, - plot_autoscale, - export_data, - print_rich_table, - lambda_long_number_format_y_axis, - is_valid_axes_count, -) from openbb_terminal.config_plot import PLOT_DPI from openbb_terminal.config_terminal import theme -from openbb_terminal.rich_config import console -from openbb_terminal.cryptocurrency.due_diligence import coinpaprika_model from openbb_terminal.cryptocurrency.discovery import pycoingecko_model +from openbb_terminal.cryptocurrency.due_diligence import coinpaprika_model from openbb_terminal.cryptocurrency.due_diligence.pycoingecko_model import ( - get_ohlc, get_coin_tokenomics, + get_ohlc, ) +from openbb_terminal.helper_funcs import ( + export_data, + is_valid_axes_count, + lambda_long_number_format, + lambda_long_number_format_y_axis, + plot_autoscale, + print_rich_table, +) +from openbb_terminal.rich_config import console logger = logging.getLogger(__name__) @@ -115,13 +114,13 @@ YF_CURRENCY = [ def check_datetime( - ck_date: datetime | str | None = None, start: bool = True + ck_date: Union[datetime, Union[str, None]] = None, start: bool = True ) -> datetime: """Checks if given argument is string and attempts to convert to datetime. Parameters ---------- - ck_date : Optional[Union[datetime, str]], optional + ck_date : Union[datetime, Union[str, None]], optional Date to check, by default None start : bool, optional If True and string is invalid, will return 1100 days ago @@ -488,11 +487,11 @@ def load_from_yahoofinance( def load( symbol: str, - start_date: datetime | str | None = None, - interval: str | int = "1440", + start_date: Union[datetime, Union[str, None]] = None, + interval: Union[str, int] = "1440", exchange: str = "binance", vs_currency: str = "usdt", - end_date: datetime | str | None = None, + end_date: Union[datetime, Union[str, None]] = None, source: str = "CCXT", ) -> pd.DataFrame: """Load crypto currency to get data for @@ -501,16 +500,16 @@ def load( ---------- symbol: str Coin to get - start_date: str or datetime, optional + start_date: Union[datetime, Union[str, None]], optional Start date to get data from with. - datetime or string format (YYYY-MM-DD) - interval: str|int + interval: Union[str, int] The interval between data points in minutes. Choose from: 1, 15, 30, 60, 240, 1440, 10080, 43200 exchange: str: The exchange to get data from. vs_currency: str Quote Currency (Defaults to usdt) - end_date: str or datetime, optional + end_date: Union[datetime, Union[str, None]], optional End date to get data from with. - datetime or string format (YYYY-MM-DD) source: str The source of the data @@ -752,7 +751,7 @@ def plot_chart( source: str = "", exchange: str = "", interval: str = "", - external_axes: list[plt.Axes] | None = None, + external_axes: Union[list[plt.Axes], None] = None, yscale: str = "linear", ) -> None: """Load data for Technical Analysis @@ -802,7 +801,7 @@ def plot_candles( volume: bool = True, ylabel: str = "", title: str = "", - external_axes: list[plt.Axes] | None = None, + external_axes: Union[list[plt.Axes], None] = None, yscale: str = "linear", ) -> None: """Plot candle chart from dataframe. [Source: Binance] @@ -882,7 +881,7 @@ def plot_order_book( bids: np.ndarray, asks: np.ndarray, coin: str, - external_axes: list[plt.Axes] | None = None, + external_axes: Union[list[plt.Axes], None] = None, ) -> None: """ Plots Bid/Ask. Can be used for Coinbase and Binance diff --git a/openbb_terminal/stocks/options/chartexchange_model.py b/openbb_terminal/stocks/options/chartexchange_model.py index b2ca002a770..962c13e632a 100644 --- a/openbb_terminal/stocks/options/chartexchange_model.py +++ b/openbb_terminal/stocks/options/chartexchange_model.py @@ -1,8 +1,7 @@ """Chartexchange model""" -from __future__ import annotations - import logging +from typing import Union import pandas as pd import requests @@ -21,7 +20,7 @@ def get_option_history( symbol: str = "GME", date: str = "2021-02-05", call: bool = True, - price: str | int | float = "90", + price: Union[str, Union[int, float]] = "90", ) -> pd.DataFrame: """Historic prices for a specific option [chartexchange] @@ -29,11 +28,11 @@ def get_option_history( ---------- symbol : str Ticker symbol to get historical data from - date : str|int|float + date : str Date as a string YYYYMMDD call : bool Whether to show a call or a put - price : str + price : Union[str, Union[int, float]] Strike price for a specific option Returns diff --git a/openbb_terminal/stocks/options/options_sdk_helper.py b/openbb_terminal/stocks/options/options_sdk_helper.py index aafd87cc3d1..74ec1adf5c4 100644 --- a/openbb_terminal/stocks/options/options_sdk_helper.py +++ b/openbb_terminal/stocks/options/options_sdk_helper.py @@ -1,24 +1,24 @@ """Options Functions For OpenBB SDK""" -from __future__ import annotations - import logging +from typing import Union + import pandas as pd +from openbb_terminal.decorators import log_start_end from openbb_terminal.stocks.options import ( + chartexchange_model, nasdaq_model, tradier_model, yfinance_model, - chartexchange_model, ) -from openbb_terminal.decorators import log_start_end logger = logging.getLogger(__name__) @log_start_end(log=logger) def get_full_option_chain( - symbol: str, source: str = "Nasdaq", expiration: str | None = None + symbol: str, source: str = "Nasdaq", expiration: Union[str, None] = None ) -> pd.DataFrame: """Get Option Chain For A Stock. No greek data is returned @@ -28,7 +28,7 @@ def get_full_option_chain( Symbol to get chain for source : str, optional Source to get data from, by default "Nasdaq" - expiration : str, optional + expiration : Union[str, None], optional Date to get chain for. By default returns all dates Returns @@ -101,7 +101,7 @@ def get_option_expirations(symbol: str, source: str = "Nasdaq") -> list: def hist( symbol: str, exp: str, - strike: int | float | str, + strike: Union[int, Union[float, str]], call: bool = True, source="ChartExchange", ) -> pd.DataFrame: @@ -113,7 +113,7 @@ def hist( Symbol to get data for exp : str Expiration date - strike : int | float | str + strike : Union[int ,Union[float,str]] Strike price call : bool, optional Flag to indicate a call, by default True diff --git a/openbb_terminal/terminal_helper.py b/openbb_terminal/terminal_helper.py index 701779f0d67..63a0ab3801b 100644 --- a/openbb_terminal/terminal_helper.py +++ b/openbb_terminal/terminal_helper.py @@ -228,7 +228,6 @@ def check_for_updates() -> None: if current_version_number == latest_version_number: console.print("[green]You are using the latest stable version[/green]") - return else: console.print( "[yellow]You are not using the latest stable version[/yellow]" @@ -237,10 +236,12 @@ def check_for_updates() -> None: console.print( "[yellow]Check for updates at https://openbb.co/products/terminal#get-started[/yellow]" ) + else: console.print( "[yellow]You are using an unreleased version[/yellow]" ) + else: console.print("[red]You are using an unrecognized version.[/red]") else: diff --git a/pyproject.toml b/pyproject.toml index ca02d2d151f..9aa43b065e0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.poetry] -name = "OpenBBTerminal" +name = "openbb" version = "2.0.0rc1" description = "Investment Research for Everyone, Anywhere." license = "MIT" diff --git a/website/content/sdk/quickstart/installation.md b/website/content/sdk/quickstart/installation.md index 543c952bb83..71aa6ebc6de 100644 --- a/website/content/sdk/quickstart/installation.md +++ b/website/content/sdk/quickstart/installation.md @@ -33,7 +33,7 @@ conda activate obb ### 4. **Install OpenBB SDK Core package** ```bash -pip install openbbterminal +pip install openbb ``` ### 5. **(Optional) Install the Toolkits** -- cgit v1.2.3