From 80dfd9a7ee353a6b28619ed221ef42b07922ced6 Mon Sep 17 00:00:00 2001 From: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Date: Fri, 6 Jan 2023 21:34:39 +0000 Subject: [PATCH 1/5] Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates --- openbb_terminal/economy/economy_controller.py | 34 ++-- openbb_terminal/economy/plot_view.py | 2 + .../scripts/economy/test_economy.openbb | 168 +++++++++--------- 3 files changed, 110 insertions(+), 94 deletions(-) diff --git a/openbb_terminal/economy/economy_controller.py b/openbb_terminal/economy/economy_controller.py index b8f774afb18d..5b4c141abdfc 100644 --- a/openbb_terminal/economy/economy_controller.py +++ b/openbb_terminal/economy/economy_controller.py @@ -587,12 +587,19 @@ def call_macro(self, other_args: List[str]): ) if not df.empty: + df.columns = ["_".join(column) for column in df.columns] if ns_parser.transform: df.columns = [df.columns[0] + f"_{ns_parser.transform}"] - self.DATASETS["macro"] = pd.concat([self.DATASETS["macro"], df]) + for column in df.columns: + if column in self.DATASETS["macro"].columns: + self.DATASETS["macro"].drop(column, axis=1, inplace=True) + + self.DATASETS["macro"] = pd.concat( + [self.DATASETS["macro"], df], axis=1 + ) # update units dict for country, data in units.items(): @@ -851,6 +858,7 @@ def call_index(self, other_args: List[str]): ) if not df.empty: + self.DATASETS["index"][index] = df self.stored_datasets = ( @@ -961,20 +969,26 @@ def call_treasury(self, other_args: List[str]): ) if not df.empty: - self.DATASETS["treasury"] = pd.concat( - [ - self.DATASETS["treasury"], - df, - ] - ) cols = [] - for column in self.DATASETS["treasury"].columns: + for column in df.columns: if isinstance(column, tuple): cols.append("_".join(column)) else: cols.append(column) - self.DATASETS["treasury"].columns = cols + df.columns = cols + + for column in df.columns: + if column in self.DATASETS["treasury"].columns: + self.DATASETS["treasury"].drop(column, axis=1, inplace=True) + + self.DATASETS["treasury"] = pd.concat( + [ + self.DATASETS["treasury"], + df, + ], + axis=1, + ) self.stored_datasets = ( economy_helpers.update_stored_datasets_string(self.DATASETS) @@ -1562,7 +1576,7 @@ def call_eval(self, other_args): self.stored_datasets = economy_helpers.update_stored_datasets_string( self.DATASETS ) - console.print() + self.update_runtime_choices() @log_start_end(log=logger) def call_qa(self, _): diff --git a/openbb_terminal/economy/plot_view.py b/openbb_terminal/economy/plot_view.py index bae05e93ef3d..010a23ad0055 100644 --- a/openbb_terminal/economy/plot_view.py +++ b/openbb_terminal/economy/plot_view.py @@ -48,6 +48,7 @@ def show_plot( ax_2_coloring = -1 dataset_yaxis_1 = dataset_yaxis_1.dropna() + dataset_yaxis_1.index = pd.to_datetime(dataset_yaxis_1.index) for column in dataset_yaxis_1: ax1.plot( @@ -72,6 +73,7 @@ def show_plot( ax2 = ax1.twinx() dataset_yaxis_2 = dataset_yaxis_2.dropna() + dataset_yaxis_2.index = pd.to_datetime(dataset_yaxis_2.index) for column in dataset_yaxis_2: ax2.plot( diff --git a/openbb_terminal/miscellaneous/scripts/economy/test_economy.openbb b/openbb_terminal/miscellaneous/scripts/economy/test_economy.openbb index 5d81de44e3b3..77a7c33d896a 100644 --- a/openbb_terminal/miscellaneous/scripts/economy/test_economy.openbb +++ b/openbb_terminal/miscellaneous/scripts/economy/test_economy.openbb @@ -1,86 +1,86 @@ economy -# overview -# overview -t indices -# overview -t usbonds -# overview -t glbonds -# overview -t currencies -# futures -# futures -c energy --source Finviz -# futures -c metals --source Finviz -# futures -c meats --source Finviz -# futures -c grains --source Finviz -# futures -c softs --source Finviz -# futures -c energy -# futures -c metals -# futures -c meats -# futures -c grains -# futures -c softs -# futures -c energy -s ticker --reverse --source Finviz -# map -# map -p 1w -t world -# bigmac -# bigmac -c USA,ESP,LVA,DEU,FRA,FIN -# ycrv -# ycrv --source FRED --date 2022-10-03 --raw -# ycrv -c united_states --source Investing -# events -# events --country united_states -i high --cat employment -s 2022-07-07 -e 2022-07-08 -# events -c spain --source Investing -# edebt --limit 10 -# spread -# spread --group PIIGS --color binary -# spread --countries portugal,spain,italy,united states --maturity 5Y --change=True --color openbb -# rtps -# valuation -# valuation --group sector --sortby MarketCap --reverse -# performance -# performance -g basic_materials -s Month -a -# spectrum -# spectrum --group consumer_defensive -# macro -# macro -p RGDP,CPI -# macro -p URATE -c Netherlands,Germany -# macro -p URATE -c United_States --start 2008-01-01 -# macro -p GDP --countries Portugal,France,United_Kingdom,Spain,Italy,Poland --start 2000-01-10 -# treasury -# treasury --maturity 20y --type nominal -# treasury --raw -# treasury --type inflation --start 2020-01-01 --limit 10 -# fred T10Y2Y,DFII10 -s 2019-01-01 -e 2022-01-01 -# fred -q treasury -# fred -p T10Y2Y,FII10 -s 2005-01-01 -# fred T5YIEM,T10YIEM,T20YIEM,T30YIEM -# index -i nasdaq,dowjones,sp500 -s 2005-01-01 -# macro -p URATE -c Netherlands,Germany -s 2005-01-01 -# index -i sp500 -s 2005-01-01 -# plot --y1 T10Y2Y --y2 T5YIEM -# plot --y1 T10Y2Y,T20YIEM -# rtps -# valuation -# performance -# spectrum -# fred DGS2,DGS5 -# eval spread = DGS2 - DGS5 -# qa -# summary -# normality -# unitroot --fuller_reg c --kps_reg ct -# line -# line --log -# hist -# hist -b 10 -# cdf -# bw -# bw --yearly -# acf --lags 5 -# qqplot -# rolling -# rolling -w 5 -# spread -w 10 -# quantile --window 5 --quantile 0.01 -# skew --window 5 -# kurtosis --window 9 -# raw --limit 2 --reverse -# cusum --threshold 10 --drift 10 -# decompose +overview +overview -t indices +overview -t usbonds +overview -t glbonds +overview -t currencies +futures +futures -c energy --source Finviz +futures -c metals --source Finviz +futures -c meats --source Finviz +futures -c grains --source Finviz +futures -c softs --source Finviz +futures -c energy +futures -c metals +futures -c meats +futures -c grains +futures -c softs +futures -c energy -s ticker --reverse --source Finviz +map +map -p 1w -t world +bigmac +bigmac -c USA,ESP,LVA,DEU,FRA,FIN +ycrv +ycrv --source FRED --date 2022-10-03 --raw +ycrv -c united_states --source Investing +events +events --country united_states -i high --cat employment -s 2022-07-07 -e 2022-07-08 +events -c spain --source Investing +edebt --limit 10 +spread +spread --group PIIGS --color binary +spread --countries portugal,spain,italy,united states --maturity 5Y --change=True --color openbb +rtps +valuation +valuation --group sector --sortby MarketCap --reverse +performance +performance -g basic_materials -s Month -a +spectrum +spectrum --group consumer_defensive +macro +macro -p RGDP,CPI +macro -p URATE -c Netherlands,Germany +macro -p URATE -c United_States --start 2008-01-01 +macro -p GDP --countries Portugal,France,United_Kingdom,Spain,Italy,Poland --start 2000-01-10 +treasury +treasury --maturity 20y --type nominal +treasury --raw +treasury --type inflation --start 2020-01-01 --limit 10 +fred T10Y2Y,DFII10 -s 2019-01-01 -e 2022-01-01 +fred -q treasury +fred -p T10Y2Y,FII10 -s 2005-01-01 +fred T5YIEM,T10YIEM,T20YIEM,T30YIEM +index -i nasdaq,dowjones,sp500 -s 2005-01-01 +macro -p URATE -c Netherlands,Germany -s 2005-01-01 +index -i sp500 -s 2005-01-01 +plot --y1 T10Y2Y --y2 T5YIEM +plot --y1 T10Y2Y,T20YIEM +rtps +valuation +performance +spectrum +fred DGS2,DGS5 +eval spread = DGS2 - DGS5 +qa +summary +normality +unitroot --fuller_reg c --kps_reg ct +line +line --log +hist +hist -b 10 +cdf +bw +bw --yearly +acf --lags 5 +qqplot +rolling +rolling -w 5 +spread -w 10 +quantile --window 5 --quantile 0.01 +skew --window 5 +kurtosis --window 9 +raw --limit 2 --reverse +cusum --threshold 10 --drift 10 +decompose exit From b2312757d1f26485cdba6e6a282db0717d46ab69 Mon Sep 17 00:00:00 2001 From: Jeroen Bouma Date: Mon, 9 Jan 2023 14:15:12 +0100 Subject: [PATCH 2/5] Update installation guides with videos --- .../content/sdk/quickstart/installation.md | 4 +++ .../terminal/quickstart/installation.md | 33 +++++++++++++------ website/package-lock.json | 4 +-- website/yarn.lock | 5 +++ 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/website/content/sdk/quickstart/installation.md b/website/content/sdk/quickstart/installation.md index 7e5edb88cc4e..7ac35af4498b 100644 --- a/website/content/sdk/quickstart/installation.md +++ b/website/content/sdk/quickstart/installation.md @@ -13,6 +13,10 @@ We provide a simple installation method in order to utilize the OpenBB SDK. You Make sure you meet all [requirements](requirements.md) before proceeding. ::: +

Follow along with the instructions of the video or use the steps below to use the OpenBB SDK:

+ + + ### 1. **Install [Miniconda](https://docs.conda.io/en/latest/miniconda.html)** Download the `x86_64` Miniconda for your respective system and follow along diff --git a/website/content/terminal/quickstart/installation.md b/website/content/terminal/quickstart/installation.md index b37901cb90c7..33da8db6bec2 100644 --- a/website/content/terminal/quickstart/installation.md +++ b/website/content/terminal/quickstart/installation.md @@ -7,21 +7,25 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import InstallerButton from "@site/src/components/General/InstallerButton"; -The OpenBB Terminal can be directly installed on your computer via our installation program. Within this section, you are guided through the installation process and how to launch the program. If you struggle with the installation process, please don’t hesitate to reach us on [Discord](https://openbb.co/discord) or visit our [contact page](https://openbb.co/contact). +The OpenBB Terminal can be directly installed on your computer via our installation programs. Within this section, you are guided through the installation process and how to launch the program. If you struggle with the installation process, please don’t hesitate to reach us on [Discord](https://openbb.co/discord) or visit our [contact page](https://openbb.co/contact). -OpenBB Terminal is available in all major platforms. With MacOS/Windows you can easily install with the installer (instructions below). It is also available to install on Linux with Docker or from source. +OpenBB Terminal is available on all major platforms. With Windows and macOS you can make use of an installation file as found below. Furthermore, it is also possible to install the OpenBB Terminal with Docker or directly through Python which also offers support for Linux. :::info Installation Instructions - Install on Windows +
+

This section provides you with the installation file as well as the guide to install the OpenBB Terminal via Windows.

Download the installer from the button below:

-

When the file is downloaded, use the following steps to run the OpenBB Terminal:

+

Follow along with the instructions of the video or use the steps below to run the OpenBB Terminal:

+ + +
@@ -48,7 +52,7 @@ OpenBB Terminal is available in all major platforms. With MacOS/Windows you can
-Install on macOS + For Mac there are two installers available, one for Intel and one for Apple Silicon (M1). Please download the correct one for your machine. @@ -61,7 +65,10 @@ For Mac there are two installers available, one for Intel and one for Apple Sili -

When the DMG file is downloaded, use the following steps to run the OpenBB Terminal:

+

Follow along with the instructions of the video or use the steps below to run the OpenBB Terminal:

+ + +
@@ -83,11 +90,13 @@ Right-Click the app and select Open. You will see a message saying
-

Install with Docker

+

Installing the OpenBB Terminal via Docker supports both Windows and Unix systems (Linux + MacOS). Installation differs a bit between operating system (Windows, macOS and Linux). Please select the section matching to your OS. +

-Here we will detail how to run OpenBB Terminal Docker image. +

Follow along with the instructions of the video or use the steps below to run the OpenBB Terminal:

+ + -Please check the section matching to your OS. ## 1. Windows @@ -228,7 +237,11 @@ docker run --rm -it \
-This installation type supports both Windows and Unix systems (Linux + MacOS). +

This section guides you a long to install the OpenBB Terminal via Python. This installation type supports both Windows and Unix systems (Linux + MacOS).

+ +

Follow along with the instructions of the video or use the steps below to run the OpenBB Terminal:

+ + **NOTE for Windows users:** For Windows users who prefer to use an environment similar to what Linux and macOS users use, we recommend Windows Subsystem for Linux (WSL). WSL emulates a Linux machine inside your Windows system. If this is the case - jump to the Installing WSL (Only for Windows users) section before proceeding. diff --git a/website/package-lock.json b/website/package-lock.json index 075a37a07d8e..3af309d434ac 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -1,12 +1,12 @@ { "name": "docs", - "version": "0.0.0", + "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "docs", - "version": "0.0.0", + "version": "1.0.0", "dependencies": { "@cmfcmf/docusaurus-search-local": "^0.11.0", "@docusaurus/core": "2.2.0", diff --git a/website/yarn.lock b/website/yarn.lock index 302e6e7ba3ca..91e018547d05 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -4299,6 +4299,11 @@ "resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" "version" "1.0.0" +"fsevents@~2.3.2": + "integrity" "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==" + "resolved" "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" + "version" "2.3.2" + "function-bind@^1.1.1": "integrity" "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" "resolved" "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" From dfeeeda0764da404648a78bbe8a7d345079d61a7 Mon Sep 17 00:00:00 2001 From: Jeroen Bouma Date: Mon, 9 Jan 2023 14:39:47 +0100 Subject: [PATCH 3/5] Add fix for Ruff crashing --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 64a37d280268..dd496f6c5bdf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -159,7 +159,7 @@ target-version = "py38" # D: pydocstyle, PD: pandas-vet, I: isort # All options here: https://github.com/charliermarsh/ruff#supported-rules select = ["E", "W", "F", "Q", "W", "S", "UP"] -ignore = ["S105", "S106", "S107"] +ignore = ["S105", "S106", "S107", "S113", "S501"] [tool.ruff.per-file-ignores] "tests/*" = ["S101"] From e4df05faa7f58ade032720fbdd6d8db636eafeab Mon Sep 17 00:00:00 2001 From: Jeroen Bouma Date: Mon, 9 Jan 2023 14:45:01 +0100 Subject: [PATCH 4/5] Me no longer do what James said --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index dd496f6c5bdf..64a37d280268 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -159,7 +159,7 @@ target-version = "py38" # D: pydocstyle, PD: pandas-vet, I: isort # All options here: https://github.com/charliermarsh/ruff#supported-rules select = ["E", "W", "F", "Q", "W", "S", "UP"] -ignore = ["S105", "S106", "S107", "S113", "S501"] +ignore = ["S105", "S106", "S107"] [tool.ruff.per-file-ignores] "tests/*" = ["S101"] From fc58757190ac7c52d6501feef674893e31bcd64e Mon Sep 17 00:00:00 2001 From: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Date: Mon, 9 Jan 2023 09:04:07 -0500 Subject: [PATCH 5/5] Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version --- .github/workflows/test.yml | 2 +- .pre-commit-config.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b8b1625aa7cc..db0a92510ea4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,7 +28,7 @@ jobs: key: ${{ runner.os }}-linting-${{ hashFiles('**/poetry.lock') }} restore-keys: ${{ runner.os }}-linting-${{ hashFiles('**/poetry.lock') }} - - run: pip install bandit black codespell mypy==0.982 pyupgrade safety pylint==2.15.2 packaging==22 ruff + - run: pip install bandit black codespell mypy==0.982 pyupgrade safety pylint==2.15.2 packaging==22 ruff==0.0.212 - run: pip install types-pytz types-requests types-termcolor types-tabulate types-PyYAML types-python-dateutil types-setuptools types-six - run: bandit -x ./tests -r . || true - run: black --diff --check . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 55741044f9ad..3aa2f0b9acda 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: 'v0.0.209' + rev: 'v0.0.212' hooks: - id: ruff - repo: https://github.com/codespell-project/codespell