From 5f2105cf3fc92a4b39b226b22c5c306b41a90936 Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Mon, 15 Mar 2021 20:01:17 -0700 Subject: [PATCH 01/19] Adding ad-hoc Windows build --- .github/workflows/windows.yml | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 .github/workflows/windows.yml diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100755 index 00000000000..569de01ece6 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,51 @@ +name: Ad-hoc Windows Build +on: workflow_dispatch +jobs: + windows-conda: + name: Windows-latest, Conda-latest, Python 3.8 + needs: test + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + # Need to fetch more than the last commit so that setuptools-scm can + # create the correct version string. If the number of commits since + # the last release is greater than this, the version still be wrong. + # Increase if necessary. + fetch-depth: 100 + # The GitHub token is preserved by default but this job doesn't need + # to be able to push to GitHub. + persist-credentials: false + + - name: Setup Miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + python-version: '3.8' + miniconda-version: 'latest' + auto-update-conda: true + channels: conda-forge + show-channel-urls: true + environment-file: conda-environment.yaml + activate-environment: testing + # Needed for caching + use-only-tar-bz2: true + + - name: Update Temp permissions on windows + if: runner.os == 'Windows' + shell: cmd /C CALL {0} + run: >- + c:\windows\system32\icacls C:\Users\runneradmin\AppData\Local\Temp /grant "everyone":F /t + - name: Install dependencies (Bash) + shell: bash -l {0} + run: | + conda info + pip install --user --requirement requirements-full.txt + - name: List installed packages (Bash) + shell: bash -l {0} + run: conda list + + - name: Run tests (Bash) + shell: bash -l {0} + run: pytest tests/ + From 251e0a1b3df2804d2124467c1bcb4a814f4bf4ee Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Mon, 15 Mar 2021 20:13:27 -0700 Subject: [PATCH 02/19] Create Mac.yml --- .github/workflows/Mac.yml | 55 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/Mac.yml diff --git a/.github/workflows/Mac.yml b/.github/workflows/Mac.yml new file mode 100644 index 00000000000..da5622448da --- /dev/null +++ b/.github/workflows/Mac.yml @@ -0,0 +1,55 @@ +# This is a basic workflow to help you get started with Actions + +name: Ad-hoc Mac OS X Build + +# Controls when the action will run. +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: macos-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + # Need to fetch more than the last commit so that setuptools-scm can + # create the correct version string. If the number of commits since + # the last release is greater than this, the version still be wrong. + # Increase if necessary. + fetch-depth: 100 + # The GitHub token is preserved by default but this job doesn't need + # to be able to push to GitHub. + persist-credentials: false + + - name: Setup Miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + python-version: '3.8' + miniconda-version: 'latest' + auto-update-conda: true + channels: conda-forge + show-channel-urls: true + environment-file: conda-environment.yaml + activate-environment: testing + # Needed for caching + use-only-tar-bz2: true + + - name: Install dependencies (Bash) + shell: bash -l {0} + run: | + conda info + pip install --user --requirement requirements-full.txt + - name: List installed packages (Bash) + shell: bash -l {0} + run: conda list + + - name: Run tests (Bash) + shell: bash -l {0} + run: pytest tests/ From 53f98b5178b32b824ce7e66cb5eea1de8bac9572 Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Mon, 15 Mar 2021 20:21:57 -0700 Subject: [PATCH 03/19] Documenting ad-hoc builds feature --- ROADMAP.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ROADMAP.md b/ROADMAP.md index 74e5d1e9828..a18f1c02854 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -189,6 +189,7 @@ - [ ] Write a developer guide - [ ] Add a docker CI - [x] Add Feature Flags (@aia) - [PR #158](https://github.com/DidierRLopes/GamestonkTerminal/pull/158) +- [ ] Add ad-hoc builds ### Long term From a04ac1b14cf7fbf7c7c34fbfbc301139d1f31467 Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Mon, 15 Mar 2021 20:31:07 -0700 Subject: [PATCH 04/19] Updating trigger --- .github/workflows/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 569de01ece6..cd9f370c426 100755 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,5 +1,5 @@ name: Ad-hoc Windows Build -on: workflow_dispatch +on: [push, workflow_dispatch] jobs: windows-conda: name: Windows-latest, Conda-latest, Python 3.8 From 32cf87201d54c8c4576b09c4b222f19abba57085 Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Mon, 15 Mar 2021 20:32:38 -0700 Subject: [PATCH 05/19] Removing dependencies --- .github/workflows/windows.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index cd9f370c426..de5a1863ff9 100755 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -3,7 +3,6 @@ on: [push, workflow_dispatch] jobs: windows-conda: name: Windows-latest, Conda-latest, Python 3.8 - needs: test runs-on: windows-latest steps: - name: Checkout From 53aca61bed1429bb8b29380dae673f3df77d458b Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Mon, 15 Mar 2021 21:04:53 -0700 Subject: [PATCH 06/19] Updating Mac workflow and adding conda steps to Windows --- .github/workflows/Mac.yml | 19 +++++++------------ .github/workflows/windows.yml | 14 +++++++++++++- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.github/workflows/Mac.yml b/.github/workflows/Mac.yml index da5622448da..801a6eae6b7 100644 --- a/.github/workflows/Mac.yml +++ b/.github/workflows/Mac.yml @@ -1,20 +1,15 @@ -# This is a basic workflow to help you get started with Actions - name: Ad-hoc Mac OS X Build - -# Controls when the action will run. on: - # Allows you to run this workflow manually from the Actions tab + push: workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel + inputs: + comments: + required: true + description: 'Test scenario tags' jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on + macos-conda: + name: MacOS-latest, Conda-latest, Python 3.8 runs-on: macos-latest - - # Steps represent a sequence of tasks that will be executed as part of the job steps: - name: Checkout uses: actions/checkout@v2 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index de5a1863ff9..5002dc5e928 100755 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,5 +1,11 @@ name: Ad-hoc Windows Build -on: [push, workflow_dispatch] +on: + push: + workflow_dispatch: + inputs: + comments: + required: true + description: 'Test scenario tags' jobs: windows-conda: name: Windows-latest, Conda-latest, Python 3.8 @@ -35,6 +41,12 @@ jobs: shell: cmd /C CALL {0} run: >- c:\windows\system32\icacls C:\Users\runneradmin\AppData\Local\Temp /grant "everyone":F /t + - name: Install fbprophet with conda + shell: bash -l {0} + run: | + conda install -c conda-forge fbprophet=0.6 + conda install spyder + conda install gensim=3.8.3 - name: Install dependencies (Bash) shell: bash -l {0} run: | From 8a700990b7114214108af9af34f03fc4c1146835 Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Mon, 15 Mar 2021 21:21:56 -0700 Subject: [PATCH 07/19] Dropping the python version for Windows --- .github/workflows/windows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 5002dc5e928..5e68e5b177b 100755 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -8,7 +8,7 @@ on: description: 'Test scenario tags' jobs: windows-conda: - name: Windows-latest, Conda-latest, Python 3.8 + name: Windows-latest, Conda-latest, Python 3.7 runs-on: windows-latest steps: - name: Checkout @@ -26,7 +26,7 @@ jobs: - name: Setup Miniconda uses: conda-incubator/setup-miniconda@v2 with: - python-version: '3.8' + python-version: '3.7' miniconda-version: 'latest' auto-update-conda: true channels: conda-forge From 6511e6814b83aee7aa79d3bff5ae9267e8e34c01 Mon Sep 17 00:00:00 2001 From: Artem Veremey Date: Mon, 15 Mar 2021 21:52:51 -0700 Subject: [PATCH 08/19] Finalizing full clean builds --- .github/workflows/Mac.yml | 15 +++++++++++++-- .github/workflows/windows.yml | 12 ++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Mac.yml b/.github/workflows/Mac.yml index 801a6eae6b7..0636f0aea05 100644 --- a/.github/workflows/Mac.yml +++ b/.github/workflows/Mac.yml @@ -1,6 +1,9 @@ -name: Ad-hoc Mac OS X Build +name: Mac OS X Full Clean Build with ML on: push: + branches: + - "main" + - "full-builds" workflow_dispatch: inputs: comments: @@ -36,14 +39,22 @@ jobs: # Needed for caching use-only-tar-bz2: true + - name: Install gensim with conda + shell: bash -l {0} + run: | + conda install gensim=3.8.3 + - name: Install dependencies (Bash) shell: bash -l {0} run: | conda info pip install --user --requirement requirements-full.txt + - name: List installed packages (Bash) shell: bash -l {0} - run: conda list + run: | + conda list + pip list - name: Run tests (Bash) shell: bash -l {0} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 5e68e5b177b..940138e40df 100755 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,6 +1,9 @@ -name: Ad-hoc Windows Build +name: Windows 10 Full Clean Build with ML on: push: + branches: + - "main" + - "full-builds" workflow_dispatch: inputs: comments: @@ -41,20 +44,25 @@ jobs: shell: cmd /C CALL {0} run: >- c:\windows\system32\icacls C:\Users\runneradmin\AppData\Local\Temp /grant "everyone":F /t + - name: Install fbprophet with conda shell: bash -l {0} run: | conda install -c conda-forge fbprophet=0.6 conda install spyder conda install gensim=3.8.3 + - name: Install dependencies (Bash) shell: bash -l {0} run: | conda info pip install --user --requirement requirements-full.txt + - name: List installed packages (Bash) shell: bash -l {0} - run: conda list + run: | + conda list + pip list - name: Run tests (Bash) shell: bash -l {0} From 3e1c491ad6f5436993e20f9b071b2e89e3fae529 Mon Sep 17 00:00:00 2001 From: didier Date: Tue, 16 Mar 2021 09:04:04 +0000 Subject: [PATCH 09/19] Fix print --- .../fundamental_analysis/financial_modeling_prep_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamestonk_terminal/fundamental_analysis/financial_modeling_prep_api.py b/gamestonk_terminal/fundamental_analysis/financial_modeling_prep_api.py index c8644efe96c..04c144a9989 100644 --- a/gamestonk_terminal/fundamental_analysis/financial_modeling_prep_api.py +++ b/gamestonk_terminal/fundamental_analysis/financial_modeling_prep_api.py @@ -71,7 +71,7 @@ def menu(s_ticker, s_start, s_interval): # Get input command from user if session: as_input = session.prompt( - f"{get_flair()} (fa)>(av)> ", + f"{get_flair()} (fa)>(fmp)> ", completer=completer, ) else: From a95d1553d46c6c079f2df6021352f30c304a7d14 Mon Sep 17 00:00:00 2001 From: buzzCraft <67235613+buzzCraft@users.noreply.github.com> Date: Tue, 16 Mar 2021 13:10:46 +0100 Subject: [PATCH 10/19] Added scaling for view and candle as suggested in #180 --- gamestonk_terminal/config_plot.py | 11 +++++++++++ gamestonk_terminal/feature_flags.py | 3 +++ gamestonk_terminal/helper_funcs.py | 26 +++++++++++++++++++++++++- gamestonk_terminal/main_helper.py | 2 ++ requirements-win.txt | 2 ++ requirements.txt | 2 ++ 6 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 gamestonk_terminal/config_plot.py diff --git a/gamestonk_terminal/config_plot.py b/gamestonk_terminal/config_plot.py new file mode 100644 index 00000000000..448aa76fc91 --- /dev/null +++ b/gamestonk_terminal/config_plot.py @@ -0,0 +1,11 @@ +import screeninfo + +SCREEN_HEIGHT = 0 +SCREEN_WIDTH = 0 + +PLOT_HEIGHT_PRECENTAGE = 100 # Set = 0 to disable +PLOT_WIDTH_PRECENTAGE = 50 # Set = 0 to disable + +PLOT_HEIGHT = 800 +PLOT_WIDTH = 800 +PLOT_DPI = 100 diff --git a/gamestonk_terminal/feature_flags.py b/gamestonk_terminal/feature_flags.py index b7fc8f051f3..cb7481d9127 100755 --- a/gamestonk_terminal/feature_flags.py +++ b/gamestonk_terminal/feature_flags.py @@ -7,3 +7,6 @@ USE_PROMPT_TOOLKIT = os.getenv("GTFF_USE_PROMPT_TOOLKIT") or False # Enable Prediction features ENABLE_PREDICT = os.getenv("GTFF_ENABLE_PREDICT") or False + +# Enable plot autoscaling +USE_PLOT_AUTOSCALING = os.getenv("GTFF_USE_PLOT_AUTOSCALING") or False diff --git a/gamestonk_terminal/helper_funcs.py b/gamestonk_terminal/helper_funcs.py index cd1c92d2a25..2fb15bd4615 100644 --- a/gamestonk_terminal/helper_funcs.py +++ b/gamestonk_terminal/helper_funcs.py @@ -12,6 +12,8 @@ import pandas.io.formats.format from pandas._config.config import get_option from pandas.plotting import register_matplotlib_converters from gamestonk_terminal import feature_flags as gtff +from screeninfo import get_monitors +from gamestonk_terminal import config_plot as cfgPlot register_matplotlib_converters() @@ -39,7 +41,7 @@ def valid_date(s: str) -> datetime: def plot_view_stock(df, symbol): df.sort_index(ascending=True, inplace=True) - _, axVolume = plt.subplots() + _, axVolume = plt.subplots(figsize=plot_autoscale()) plt.bar(df.index, df.iloc[:, -1], color="k", alpha=0.8, width=0.3) plt.ylabel("Volume") _ = axVolume.twinx() @@ -353,3 +355,25 @@ def get_flair() -> str: return flair[gtff.USE_FLAIR] return "" + + +def get_screeninfo(): + screens = get_monitors() # Get all aviable monitors + main_screen = screens[0] # Choose the first screen as main screen + + return (main_screen.width, main_screen.height) + + +def plot_autoscale(): + if gtff.USE_PLOT_AUTOSCALING: + x, y = get_screeninfo() # Get screen size + x = ((x) * cfgPlot.PLOT_WIDTH_PRECENTAGE * 10 ** -2) / ( + cfgPlot.PLOT_DPI + ) # Calculate width + if cfgPlot.PLOT_HEIGHT_PRECENTAGE == 100: # If full height + y = y - 60 # Remove the height of window toolbar + y = ((y) * cfgPlot.PLOT_HEIGHT_PRECENTAGE * 10 ** -2) / (cfgPlot.PLOT_DPI) + else: # If not autoscale, use size defined in config_plot.py + x = cfgPlot.PLOT_WIDTH / (cfgPlot.PLOT_DPI) + y = cfgPlot.PLOT_HEIGHT / (cfgPlot.PLOT_DPI) + return x, y diff --git a/gamestonk_terminal/main_helper.py b/gamestonk_terminal/main_helper.py index 4e650481d3e..28aa4ca6323 100644 --- a/gamestonk_terminal/main_helper.py +++ b/gamestonk_terminal/main_helper.py @@ -13,6 +13,7 @@ from gamestonk_terminal.helper_funcs import ( check_ohlc, lett_to_num, check_sources, + plot_autoscale, ) from gamestonk_terminal import config_terminal as cfg @@ -264,6 +265,7 @@ def candle(s_ticker: str, s_start: str): style=s, figratio=(10, 7), figscale=1.10, + figsize=(plot_autoscale()), update_width_config=dict( candle_linewidth=1.0, candle_width=0.8, volume_linewidth=1.0 ), diff --git a/requirements-win.txt b/requirements-win.txt index 6049dad70ca..5083766ee84 100644 --- a/requirements-win.txt +++ b/requirements-win.txt @@ -110,6 +110,7 @@ smart-open==4.2.0; python_version >= "3.6" soupsieve==2.2; python_version >= "3.6" sqlitedict==1.7.0; python_version >= "3.6" statsmodels==0.12.2; python_version >= "3.6" +screeninfo == 0.6.7; tabulate==0.8.9; python_version >= "3.6" tensorboard-plugin-wit==1.8.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.2.0" tensorboard==2.4.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.2.0" @@ -134,3 +135,4 @@ yarl==1.6.3; python_version >= "3.6" yfinance==0.1.55 zipp==3.4.0; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" or python_full_version >= "3.2.0" and python_version >= "3.6" and python_version < "3.8" prompt-toolkit==3.0.16; python_version >= "3.6" + diff --git a/requirements.txt b/requirements.txt index a6b36ab22f8..e311408bd59 100644 --- a/requirements.txt +++ b/requirements.txt @@ -107,6 +107,7 @@ seaborn==0.11.1; python_version >= "3.6" send2trash==1.5.0; python_version >= "3.5" six==1.15.0; python_full_version >= "3.6.1" and python_version >= "3.6" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0") and (python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "4.0" or python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.4.0") and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6") and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6") and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.5") soupsieve==2.2; python_version >= "3.6" +screeninfo == 0.6.7; tenacity==7.0.0; python_version >= "3.6" terminado==0.9.2; python_version >= "3.6" testpath==0.4.4; python_version >= "3.6" @@ -128,3 +129,4 @@ widgetsnbextension==3.5.1 yarl==1.6.3; python_version >= "3.6" yfinance==0.1.55 zipp==3.4.1; python_version < "3.8" and python_version >= "3.6" + From c2e4b5c422c4e40b8b52a87c068a5f771c1cd202 Mon Sep 17 00:00:00 2001 From: buzzCraft <67235613+buzzCraft@users.noreply.github.com> Date: Tue, 16 Mar 2021 13:12:48 +0100 Subject: [PATCH 11/19] Removing some old comments --- gamestonk_terminal/config_plot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gamestonk_terminal/config_plot.py b/gamestonk_terminal/config_plot.py index 448aa76fc91..9d26ccba0d5 100644 --- a/gamestonk_terminal/config_plot.py +++ b/gamestonk_terminal/config_plot.py @@ -3,8 +3,8 @@ import screeninfo SCREEN_HEIGHT = 0 SCREEN_WIDTH = 0 -PLOT_HEIGHT_PRECENTAGE = 100 # Set = 0 to disable -PLOT_WIDTH_PRECENTAGE = 50 # Set = 0 to disable +PLOT_HEIGHT_PRECENTAGE = 100 +PLOT_WIDTH_PRECENTAGE = 50 PLOT_HEIGHT = 800 PLOT_WIDTH = 800 From 05003d6b9e233ce00926d284d9b38c72fd20005b Mon Sep 17 00:00:00 2001 From: buzzCraft <67235613+buzzCraft@users.noreply.github.com> Date: Tue, 16 Mar 2021 13:21:41 +0100 Subject: [PATCH 12/19] Fixed a typo --- gamestonk_terminal/helper_funcs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamestonk_terminal/helper_funcs.py b/gamestonk_terminal/helper_funcs.py index 2fb15bd4615..d3ada371cdf 100644 --- a/gamestonk_terminal/helper_funcs.py +++ b/gamestonk_terminal/helper_funcs.py @@ -358,7 +358,7 @@ def get_flair() -> str: def get_screeninfo(): - screens = get_monitors() # Get all aviable monitors + screens = get_monitors() # Get all available monitors main_screen = screens[0] # Choose the first screen as main screen return (main_screen.width, main_screen.height) From dd39d0928ae1c0392f306e873292c05c117a6d7b Mon Sep 17 00:00:00 2001 From: buzzCraft <67235613+buzzCraft@users.noreply.github.com> Date: Tue, 16 Mar 2021 13:23:14 +0100 Subject: [PATCH 13/19] Removed un used import --- gamestonk_terminal/config_plot.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/gamestonk_terminal/config_plot.py b/gamestonk_terminal/config_plot.py index 9d26ccba0d5..27f178021c0 100644 --- a/gamestonk_terminal/config_plot.py +++ b/gamestonk_terminal/config_plot.py @@ -1,5 +1,3 @@ -import screeninfo - SCREEN_HEIGHT = 0 SCREEN_WIDTH = 0 From 8eb507f1882173313bc7603f2bcdce7c8946c8de Mon Sep 17 00:00:00 2001 From: buzzCraft <67235613+buzzCraft@users.noreply.github.com> Date: Tue, 16 Mar 2021 13:25:26 +0100 Subject: [PATCH 14/19] Making linting happy --- gamestonk_terminal/helper_funcs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamestonk_terminal/helper_funcs.py b/gamestonk_terminal/helper_funcs.py index d3ada371cdf..f69688032fe 100644 --- a/gamestonk_terminal/helper_funcs.py +++ b/gamestonk_terminal/helper_funcs.py @@ -11,8 +11,8 @@ from colorama import Fore, Style import pandas.io.formats.format from pandas._config.config import get_option from pandas.plotting import register_matplotlib_converters -from gamestonk_terminal import feature_flags as gtff from screeninfo import get_monitors +from gamestonk_terminal import feature_flags as gtff from gamestonk_terminal import config_plot as cfgPlot register_matplotlib_converters() From a72077e4e173963cb7fc38f963337b45c816feba Mon Sep 17 00:00:00 2001 From: buzzCraft <67235613+buzzCraft@users.noreply.github.com> Date: Tue, 16 Mar 2021 13:28:22 +0100 Subject: [PATCH 15/19] added screeninfo to req-full --- requirements-full.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements-full.txt b/requirements-full.txt index aae65b85025..e487fa78e08 100644 --- a/requirements-full.txt +++ b/requirements-full.txt @@ -159,6 +159,7 @@ smart-open==4.2.0; python_version >= "3.6" soupsieve==2.2; python_version >= "3.6" sqlitedict==1.7.0; python_version >= "3.6" statsmodels==0.12.2; python_version >= "3.6" +screeninfo == 0.6.7; tabulate==0.8.9; python_version >= "3.6" tenacity==7.0.0; python_version >= "3.6" tensorboard-plugin-wit==1.8.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.2.0" From 242f9b876107e4ae77fa483554f6f494b4678a0d Mon Sep 17 00:00:00 2001 From: buzzCraft <67235613+buzzCraft@users.noreply.github.com> Date: Tue, 16 Mar 2021 13:59:31 +0100 Subject: [PATCH 16/19] Removed extra spacec in req files --- requirements-full.txt | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements-full.txt b/requirements-full.txt index e487fa78e08..6da8fbfca0d 100644 --- a/requirements-full.txt +++ b/requirements-full.txt @@ -159,7 +159,7 @@ smart-open==4.2.0; python_version >= "3.6" soupsieve==2.2; python_version >= "3.6" sqlitedict==1.7.0; python_version >= "3.6" statsmodels==0.12.2; python_version >= "3.6" -screeninfo == 0.6.7; +screeninfo==0.6.7; tabulate==0.8.9; python_version >= "3.6" tenacity==7.0.0; python_version >= "3.6" tensorboard-plugin-wit==1.8.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.2.0" diff --git a/requirements.txt b/requirements.txt index e311408bd59..8c767a55b06 100644 --- a/requirements.txt +++ b/requirements.txt @@ -107,7 +107,7 @@ seaborn==0.11.1; python_version >= "3.6" send2trash==1.5.0; python_version >= "3.5" six==1.15.0; python_full_version >= "3.6.1" and python_version >= "3.6" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0") and (python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "4.0" or python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.4.0") and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6") and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6") and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.5") soupsieve==2.2; python_version >= "3.6" -screeninfo == 0.6.7; +screeninfo==0.6.7; tenacity==7.0.0; python_version >= "3.6" terminado==0.9.2; python_version >= "3.6" testpath==0.4.4; python_version >= "3.6" From f876bff079ad40da4ba946fcae51d3e0edb8b7ac Mon Sep 17 00:00:00 2001 From: buzzCraft <67235613+buzzCraft@users.noreply.github.com> Date: Tue, 16 Mar 2021 14:51:33 +0100 Subject: [PATCH 17/19] poetry add screeninfo --- poetry.lock | 63 ++++++++++++++++++++++++++++++++++++++++++++++++-- pyproject.toml | 1 + 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/poetry.lock b/poetry.lock index 44353264ba9..5b554d913be 100644 --- a/poetry.lock +++ b/poetry.lock @@ -334,7 +334,7 @@ name = "cython" version = "0.29.14" description = "The Cython compiler for writing C extensions for the Python language." category = "main" -optional = true +optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" [[package]] @@ -1651,6 +1651,25 @@ category = "main" optional = false python-versions = "*" +[[package]] +name = "pyobjc-core" +version = "7.1" +description = "Python<->ObjC Interoperability Module" +category = "main" +optional = false +python-versions = ">=3.6" + +[[package]] +name = "pyobjc-framework-cocoa" +version = "7.1" +description = "Wrappers for the Cocoa frameworks on macOS" +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +pyobjc-core = ">=7.1" + [[package]] name = "pyparsing" version = "2.4.7" @@ -1942,6 +1961,19 @@ python-versions = ">=3.6" [package.dependencies] numpy = ">=1.14.5" +[[package]] +name = "screeninfo" +version = "0.6.7" +description = "Fetch location and size of physical screens." +category = "main" +optional = false +python-versions = "*" + +[package.dependencies] +Cython = {version = "*", markers = "sys_platform == \"darwin\""} +dataclasses = {version = "*", markers = "python_version < \"3.7\""} +pyobjc-framework-Cocoa = {version = "*", markers = "sys_platform == \"darwin\""} + [[package]] name = "seaborn" version = "0.11.1" @@ -2474,7 +2506,7 @@ prediction = ["fbprophet", "tensorflow", "pmdarima", "transformers", "flair", "t [metadata] lock-version = "1.1" python-versions = "^3.6.8" -content-hash = "cfb418b140b12dd94550b1f21431ceb8bf23df30ae4ec9735a98bc76edbfbb85" +content-hash = "c4a363cd8824c8ccab409ccfc74956db82f9cf9800cd46539b14c7ea927f36de" [metadata.files] absl-py = [ @@ -3529,6 +3561,22 @@ pygments = [ pymeeus = [ {file = "PyMeeus-0.5.9.tar.gz", hash = "sha256:f6c23f47b71fe9b3225f2a6d36dc99743a7fcb7587e17653525883a48803eb1c"}, ] +pyobjc-core = [ + {file = "pyobjc-core-7.1.tar.gz", hash = "sha256:a0616d5d816b4471f8f782c3a9a8923d2cc85014d88ad4f7fec694be9e6ea349"}, + {file = "pyobjc_core-7.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f9fb45c9916f2a03ecd6b9ecde4c35d1d0f1a590ae2ea2372f9d9a360226ac1d"}, + {file = "pyobjc_core-7.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:fff8e87358c6195a2937004f279050cce3d4c02cd77acd73c5ad367307def855"}, + {file = "pyobjc_core-7.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:afb38efd3f2960eb49eb78552d465cfd025a9d6efa06cd4cd8694dafbe7c6e06"}, + {file = "pyobjc_core-7.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:7cb329c4119044fe83bcb3c5d4794d636c706ff0cb7c1c77d36ef5c373100082"}, + {file = "pyobjc_core-7.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7913d7b20217c294900537faf58e5cc15942ed7af277bf05db25667d18255114"}, +] +pyobjc-framework-cocoa = [ + {file = "pyobjc-framework-Cocoa-7.1.tar.gz", hash = "sha256:67966152b3d38a0225176fceca2e9f56d849c8e7445548da09a00cb13155ec3e"}, + {file = "pyobjc_framework_Cocoa-7.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:bef77eafaac5eaf1d91d479d5483fd02216caa3edc27e8f5adc9af0b3fecdac3"}, + {file = "pyobjc_framework_Cocoa-7.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b2ea3582c456827dc20e648c905fdbcf8d3dfae89434f981e9b761cd07262049"}, + {file = "pyobjc_framework_Cocoa-7.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1a4050f2d776f40c2409a151c6f7896420e936934b3bdbfabedf91509637ed9b"}, + {file = "pyobjc_framework_Cocoa-7.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:3f68f022f1f6d5985c418e10c6608c562fcf4bfe3714ec64fd10ce3dc6221bd4"}, + {file = "pyobjc_framework_Cocoa-7.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ecfefd4c48dae42275c18679c69f6f2fff970e711097515a0a8732fc10194018"}, +] pyparsing = [ {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, @@ -3610,18 +3658,26 @@ pyyaml = [ {file = "PyYAML-5.4.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:bb4191dfc9306777bc594117aee052446b3fa88737cd13b7188d0e7aa8162185"}, {file = "PyYAML-5.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:6c78645d400265a062508ae399b60b8c167bf003db364ecb26dcab2bda048253"}, {file = "PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:4e0583d24c881e14342eaf4ec5fbc97f934b999a6828693a99157fde912540cc"}, + {file = "PyYAML-5.4.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:72a01f726a9c7851ca9bfad6fd09ca4e090a023c00945ea05ba1638c09dc3347"}, + {file = "PyYAML-5.4.1-cp36-cp36m-manylinux2014_s390x.whl", hash = "sha256:895f61ef02e8fed38159bb70f7e100e00f471eae2bc838cd0f4ebb21e28f8541"}, {file = "PyYAML-5.4.1-cp36-cp36m-win32.whl", hash = "sha256:3bd0e463264cf257d1ffd2e40223b197271046d09dadf73a0fe82b9c1fc385a5"}, {file = "PyYAML-5.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:e4fac90784481d221a8e4b1162afa7c47ed953be40d31ab4629ae917510051df"}, {file = "PyYAML-5.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:5accb17103e43963b80e6f837831f38d314a0495500067cb25afab2e8d7a4018"}, {file = "PyYAML-5.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:e1d4970ea66be07ae37a3c2e48b5ec63f7ba6804bdddfdbd3cfd954d25a82e63"}, + {file = "PyYAML-5.4.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:cb333c16912324fd5f769fff6bc5de372e9e7a202247b48870bc251ed40239aa"}, + {file = "PyYAML-5.4.1-cp37-cp37m-manylinux2014_s390x.whl", hash = "sha256:fe69978f3f768926cfa37b867e3843918e012cf83f680806599ddce33c2c68b0"}, {file = "PyYAML-5.4.1-cp37-cp37m-win32.whl", hash = "sha256:dd5de0646207f053eb0d6c74ae45ba98c3395a571a2891858e87df7c9b9bd51b"}, {file = "PyYAML-5.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:08682f6b72c722394747bddaf0aa62277e02557c0fd1c42cb853016a38f8dedf"}, {file = "PyYAML-5.4.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d2d9808ea7b4af864f35ea216be506ecec180628aced0704e34aca0b040ffe46"}, {file = "PyYAML-5.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:8c1be557ee92a20f184922c7b6424e8ab6691788e6d86137c5d93c1a6ec1b8fb"}, + {file = "PyYAML-5.4.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:fd7f6999a8070df521b6384004ef42833b9bd62cfee11a09bda1079b4b704247"}, + {file = "PyYAML-5.4.1-cp38-cp38-manylinux2014_s390x.whl", hash = "sha256:bfb51918d4ff3d77c1c856a9699f8492c612cde32fd3bcd344af9be34999bfdc"}, {file = "PyYAML-5.4.1-cp38-cp38-win32.whl", hash = "sha256:fa5ae20527d8e831e8230cbffd9f8fe952815b2b7dae6ffec25318803a7528fc"}, {file = "PyYAML-5.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:0f5f5786c0e09baddcd8b4b45f20a7b5d61a7e7e99846e3c799b05c7c53fa696"}, {file = "PyYAML-5.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:294db365efa064d00b8d1ef65d8ea2c3426ac366c0c4368d930bf1c5fb497f77"}, {file = "PyYAML-5.4.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:74c1485f7707cf707a7aef42ef6322b8f97921bd89be2ab6317fd782c2d53183"}, + {file = "PyYAML-5.4.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:d483ad4e639292c90170eb6f7783ad19490e7a8defb3e46f97dfe4bacae89122"}, + {file = "PyYAML-5.4.1-cp39-cp39-manylinux2014_s390x.whl", hash = "sha256:fdc842473cd33f45ff6bce46aea678a54e3d21f1b61a7750ce3c498eedfe25d6"}, {file = "PyYAML-5.4.1-cp39-cp39-win32.whl", hash = "sha256:49d4cdd9065b9b6e206d0595fee27a96b5dd22618e7520c33204a4a3239d5b10"}, {file = "PyYAML-5.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db"}, {file = "PyYAML-5.4.1.tar.gz", hash = "sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e"}, @@ -3852,6 +3908,9 @@ scipy = [ {file = "scipy-1.5.4-cp39-cp39-win_amd64.whl", hash = "sha256:cc1f78ebc982cd0602c9a7615d878396bec94908db67d4ecddca864d049112f2"}, {file = "scipy-1.5.4.tar.gz", hash = "sha256:4a453d5e5689de62e5d38edf40af3f17560bfd63c9c5bd228c18c1f99afa155b"}, ] +screeninfo = [ + {file = "screeninfo-0.6.7.tar.gz", hash = "sha256:1c4bac1ca329da3f68cbc4d2fbc92256aa9bb8ff8583ee3e14f91f0a7baa69cb"}, +] seaborn = [ {file = "seaborn-0.11.1-py3-none-any.whl", hash = "sha256:4e1cce9489449a1c6ff3c567f2113cdb41122f727e27a984950d004a88ef3c5c"}, {file = "seaborn-0.11.1.tar.gz", hash = "sha256:44e78eaed937c5a87fc7a892c329a7cc091060b67ebd1d0d306b446a74ba01ad"}, diff --git a/pyproject.toml b/pyproject.toml index 0eb5c36af5f..e775e13f428 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ jupyter = "^1.0.0" mplfinance = "^0.12.7-alpha.7" seaborn = "^0.11.0" scipy = "1.5.4" +screeninfo = "^0.6.7" [tool.poetry.dev-dependencies] pytest = "^6.2.2" From b79984350852e50732afc552737c57346a336b1e Mon Sep 17 00:00:00 2001 From: buzzCraft <67235613+buzzCraft@users.noreply.github.com> Date: Tue, 16 Mar 2021 21:58:49 +0100 Subject: [PATCH 18/19] Fixed typoes, added plotscaling to momentum, overlap, trend_indicators, volatility and volume --- gamestonk_terminal/config_plot.py | 20 +++++++++++-------- gamestonk_terminal/helper_funcs.py | 18 ++++++++++++----- .../technical_analysis/momentum.py | 15 +++++++++----- .../technical_analysis/overlap.py | 13 ++++++++---- .../technical_analysis/trend_indicators.py | 11 +++++++--- .../technical_analysis/volatility.py | 9 +++++++-- .../technical_analysis/volume.py | 11 +++++++--- 7 files changed, 67 insertions(+), 30 deletions(-) diff --git a/gamestonk_terminal/config_plot.py b/gamestonk_terminal/config_plot.py index 27f178021c0..d6b34c03719 100644 --- a/gamestonk_terminal/config_plot.py +++ b/gamestonk_terminal/config_plot.py @@ -1,9 +1,13 @@ -SCREEN_HEIGHT = 0 -SCREEN_WIDTH = 0 - -PLOT_HEIGHT_PRECENTAGE = 100 -PLOT_WIDTH_PRECENTAGE = 50 - -PLOT_HEIGHT = 800 -PLOT_WIDTH = 800 PLOT_DPI = 100 + +# Used when USE_PLOT_AUTOSCALING is set to False +PLOT_HEIGHT = 500 +PLOT_WIDTH = 800 + +# Used when USE_PLOT_AUTOSCALING is set to True +PLOT_HEIGHT_PERCENTAGE = 50 +PLOT_WIDTH_PERCENTAGE = 70 + +# When autoscaling is True, choose which monitor to scale to +# Primary monitor = 0, secondary monitor use 1 +MONITOR = 0 diff --git a/gamestonk_terminal/helper_funcs.py b/gamestonk_terminal/helper_funcs.py index f69688032fe..4f4318ea511 100644 --- a/gamestonk_terminal/helper_funcs.py +++ b/gamestonk_terminal/helper_funcs.py @@ -41,7 +41,7 @@ def valid_date(s: str) -> datetime: def plot_view_stock(df, symbol): df.sort_index(ascending=True, inplace=True) - _, axVolume = plt.subplots(figsize=plot_autoscale()) + _, axVolume = plt.subplots(figsize=plot_autoscale(), dpi=cfgPlot.PLOT_DPI) plt.bar(df.index, df.iloc[:, -1], color="k", alpha=0.8, width=0.3) plt.ylabel("Volume") _ = axVolume.twinx() @@ -359,20 +359,28 @@ def get_flair() -> str: def get_screeninfo(): screens = get_monitors() # Get all available monitors - main_screen = screens[0] # Choose the first screen as main screen + if ( + len(screens) - 1 < cfgPlot.MONITOR + ): # Check to see if choosen monitor is detected + monitor = 0 + print(f"Could not locate monitor {cfgPlot.MONITOR}, using primary monitor.") + else: + monitor = cfgPlot.MONITOR + main_screen = screens[monitor] # Choose what monitor to get return (main_screen.width, main_screen.height) def plot_autoscale(): + if gtff.USE_PLOT_AUTOSCALING: x, y = get_screeninfo() # Get screen size - x = ((x) * cfgPlot.PLOT_WIDTH_PRECENTAGE * 10 ** -2) / ( + x = ((x) * cfgPlot.PLOT_WIDTH_PERCENTAGE * 10 ** -2) / ( cfgPlot.PLOT_DPI ) # Calculate width - if cfgPlot.PLOT_HEIGHT_PRECENTAGE == 100: # If full height + if cfgPlot.PLOT_HEIGHT_PERCENTAGE == 100: # If full height y = y - 60 # Remove the height of window toolbar - y = ((y) * cfgPlot.PLOT_HEIGHT_PRECENTAGE * 10 ** -2) / (cfgPlot.PLOT_DPI) + y = ((y) * cfgPlot.PLOT_HEIGHT_PERCENTAGE * 10 ** -2) / (cfgPlot.PLOT_DPI) else: # If not autoscale, use size defined in config_plot.py x = cfgPlot.PLOT_WIDTH / (cfgPlot.PLOT_DPI) y = cfgPlot.PLOT_HEIGHT / (cfgPlot.PLOT_DPI) diff --git a/gamestonk_terminal/technical_analysis/momentum.py b/gamestonk_terminal/technical_analysis/momentum.py index b68ef0fa898..b3d49ba0807 100644 --- a/gamestonk_terminal/technical_analysis/momentum.py +++ b/gamestonk_terminal/technical_analysis/momentum.py @@ -2,7 +2,12 @@ import argparse import matplotlib.pyplot as plt import pandas_ta as ta from pandas.plotting import register_matplotlib_converters -from gamestonk_terminal.helper_funcs import check_positive, parse_known_args_and_warn +from gamestonk_terminal.helper_funcs import ( + check_positive, + parse_known_args_and_warn, + plot_autoscale, +) +from gamestonk_terminal.config_plot import PLOT_DPI from gamestonk_terminal import feature_flags as gtff register_matplotlib_converters() @@ -76,7 +81,7 @@ def cci(l_args, s_ticker, s_interval, df_stock): offset=ns_parser.n_offset, ).dropna() - plt.figure() + plt.figure(figsize=plot_autoscale(), dpi=PLOT_DPI) plt.subplot(211) plt.title(f"Commodity Channel Index (CCI) on {s_ticker}") if s_interval == "1440min": @@ -193,7 +198,7 @@ def macd(l_args, s_ticker, s_interval, df_stock): offset=ns_parser.n_offset, ).dropna() - plt.figure() + plt.figure(figsize=plot_autoscale(), dpi=PLOT_DPI) plt.subplot(211) plt.title(f"Moving Average Convergence Divergence (MACD) on {s_ticker}") if s_interval == "1440min": @@ -308,7 +313,7 @@ def rsi(l_args, s_ticker, s_interval, df_stock): offset=ns_parser.n_offset, ).dropna() - plt.figure() + plt.figure(figsize=plot_autoscale(), dpi=PLOT_DPI) plt.subplot(211) if s_interval == "1440min": plt.plot(df_stock.index, df_stock["5. adjusted close"].values, "k", lw=2) @@ -427,7 +432,7 @@ def stoch(l_args, s_ticker, s_interval, df_stock): offset=ns_parser.n_offset, ).dropna() - plt.figure() + plt.figure(figsize=plot_autoscale(), dpi=PLOT_DPI) plt.subplot(211) if s_interval == "1440min": plt.plot(df_stock.index, df_stock["5. adjusted close"].values, "k", lw=2) diff --git a/gamestonk_terminal/technical_analysis/overlap.py b/gamestonk_terminal/technical_analysis/overlap.py index 6ca6a5e33d3..5b7a5d8c084 100644 --- a/gamestonk_terminal/technical_analysis/overlap.py +++ b/gamestonk_terminal/technical_analysis/overlap.py @@ -2,7 +2,12 @@ import argparse import matplotlib.pyplot as plt import pandas_ta as ta from pandas.plotting import register_matplotlib_converters -from gamestonk_terminal.helper_funcs import check_positive, parse_known_args_and_warn +from gamestonk_terminal.helper_funcs import ( + check_positive, + parse_known_args_and_warn, + plot_autoscale, +) +from gamestonk_terminal.config_plot import PLOT_DPI from gamestonk_terminal import feature_flags as gtff register_matplotlib_converters() @@ -64,7 +69,7 @@ def ema(l_args, s_ticker, s_interval, df_stock): offset=ns_parser.n_offset, ).dropna() - _, axPrice = plt.subplots() + _, axPrice = plt.subplots(figsize=plot_autoscale(), dpi=PLOT_DPI) plt.title(f"{ns_parser.n_length} EMA on {s_ticker}") if s_interval == "1440min": plt.plot( @@ -147,7 +152,7 @@ def sma(l_args, s_ticker, s_interval, df_stock): if not ns_parser: return - plt.figure() + plt.figure(figsize=plot_autoscale(), dpi=PLOT_DPI) if s_interval == "1440min": plt.plot(df_stock.index, df_stock["5. adjusted close"].values, color="k") else: @@ -232,7 +237,7 @@ def vwap(l_args, s_ticker, s_interval, df_stock): offset=ns_parser.n_offset, ) - _, axPrice = plt.subplots() + _, axPrice = plt.subplots(figsize=plot_autoscale(), dpi=PLOT_DPI) if s_interval == "1440min": plt.plot(df_stock.index, df_stock["5. adjusted close"].values, color="k") else: diff --git a/gamestonk_terminal/technical_analysis/trend_indicators.py b/gamestonk_terminal/technical_analysis/trend_indicators.py index 28689f7941c..40cde77bb37 100644 --- a/gamestonk_terminal/technical_analysis/trend_indicators.py +++ b/gamestonk_terminal/technical_analysis/trend_indicators.py @@ -2,7 +2,12 @@ import argparse import matplotlib.pyplot as plt import pandas_ta as ta from pandas.plotting import register_matplotlib_converters -from gamestonk_terminal.helper_funcs import check_positive, parse_known_args_and_warn +from gamestonk_terminal.helper_funcs import ( + check_positive, + parse_known_args_and_warn, + plot_autoscale, +) +from gamestonk_terminal.config_plot import PLOT_DPI from gamestonk_terminal import feature_flags as gtff register_matplotlib_converters() @@ -95,7 +100,7 @@ def adx(l_args, s_ticker, s_interval, df_stock): def plot_adx(df_stock, s_ticker, df_ta): - plt.figure() + plt.figure(figsize=plot_autoscale(), dpi=PLOT_DPI) plt.subplot(211) plt.plot(df_stock.index, df_stock["4. close"].values, "k", lw=2) plt.title(f"Average Directional Movement Index (ADX) on {s_ticker}") @@ -188,7 +193,7 @@ def aroon(l_args, s_ticker, s_interval, df_stock): offset=ns_parser.n_offset, ).dropna() - plt.figure() + plt.figure(figsize=plot_autoscale(), dpi=PLOT_DPI) plt.subplot(311) # Daily if s_interval == "1440min": diff --git a/gamestonk_terminal/technical_analysis/volatility.py b/gamestonk_terminal/technical_analysis/volatility.py index b394ba4c2c2..036b31c5b4a 100644 --- a/gamestonk_terminal/technical_analysis/volatility.py +++ b/gamestonk_terminal/technical_analysis/volatility.py @@ -2,7 +2,12 @@ import argparse import matplotlib.pyplot as plt import pandas_ta as ta from pandas.plotting import register_matplotlib_converters -from gamestonk_terminal.helper_funcs import check_positive, parse_known_args_and_warn +from gamestonk_terminal.helper_funcs import ( + check_positive, + parse_known_args_and_warn, + plot_autoscale, +) +from gamestonk_terminal.config_plot import PLOT_DPI from gamestonk_terminal import feature_flags as gtff register_matplotlib_converters() @@ -82,7 +87,7 @@ def bbands(l_args, s_ticker, s_interval, df_stock): offset=ns_parser.n_offset, ).dropna() - plt.figure() + plt.figure(figsize=plot_autoscale(), dpi=PLOT_DPI) if s_ticker == "1440min": plt.plot( df_stock.index, df_stock["5. adjusted close"].values, color="k", lw=3 diff --git a/gamestonk_terminal/technical_analysis/volume.py b/gamestonk_terminal/technical_analysis/volume.py index 871715e463d..cd48d62ddc0 100644 --- a/gamestonk_terminal/technical_analysis/volume.py +++ b/gamestonk_terminal/technical_analysis/volume.py @@ -2,7 +2,12 @@ import argparse import matplotlib.pyplot as plt import pandas_ta as ta from pandas.plotting import register_matplotlib_converters -from gamestonk_terminal.helper_funcs import check_positive, parse_known_args_and_warn +from gamestonk_terminal.helper_funcs import ( + check_positive, + parse_known_args_and_warn, + plot_autoscale, +) +from gamestonk_terminal.config_plot import PLOT_DPI from gamestonk_terminal import feature_flags as gtff register_matplotlib_converters() @@ -92,7 +97,7 @@ def ad(l_args, s_ticker, s_interval, df_stock): offset=ns_parser.n_offset, ).dropna() - plt.figure() + plt.figure(figsize=plot_autoscale(), dpi=PLOT_DPI) axPrice = plt.subplot(211) if s_interval == "1440min": plt.plot(df_stock.index, df_stock["5. adjusted close"].values, "k", lw=2) @@ -189,7 +194,7 @@ def obv(l_args, s_ticker, s_interval, df_stock): offset=ns_parser.n_offset, ).dropna() - plt.figure() + plt.figure(figsize=plot_autoscale(), dpi=PLOT_DPI) axPrice = plt.subplot(211) if s_interval == "1440min": plt.plot(df_stock.index, df_stock["5. adjusted close"].values, "k", lw=2) From ce872197be4ffe992eafbb441f1912fcce3ed5b2 Mon Sep 17 00:00:00 2001 From: buzzCraft <67235613+buzzCraft@users.noreply.github.com> Date: Tue, 16 Mar 2021 22:01:38 +0100 Subject: [PATCH 19/19] Update helper_funcs.py --- gamestonk_terminal/helper_funcs.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gamestonk_terminal/helper_funcs.py b/gamestonk_terminal/helper_funcs.py index 4f4318ea511..17e255bba25 100644 --- a/gamestonk_terminal/helper_funcs.py +++ b/gamestonk_terminal/helper_funcs.py @@ -359,9 +359,7 @@ def get_flair() -> str: def get_screeninfo(): screens = get_monitors() # Get all available monitors - if ( - len(screens) - 1 < cfgPlot.MONITOR - ): # Check to see if choosen monitor is detected + if len(screens) - 1 < cfgPlot.MONITOR: # Check to see if chosen monitor is detected monitor = 0 print(f"Could not locate monitor {cfgPlot.MONITOR}, using primary monitor.") else: