Merge branch 'main' into fred

This commit is contained in:
jmaslek
2021-03-16 21:24:06 -04:00
committed by GitHub
18 changed files with 282 additions and 20 deletions

61
.github/workflows/Mac.yml vendored Normal file
View File

@@ -0,0 +1,61 @@
name: Mac OS X Full Clean Build with ML
on:
push:
branches:
- "main"
- "full-builds"
workflow_dispatch:
inputs:
comments:
required: true
description: 'Test scenario tags'
jobs:
macos-conda:
name: MacOS-latest, Conda-latest, Python 3.8
runs-on: macos-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: 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
pip list
- name: Run tests (Bash)
shell: bash -l {0}
run: pytest tests/

70
.github/workflows/windows.yml vendored Executable file
View File

@@ -0,0 +1,70 @@
name: Windows 10 Full Clean Build with ML
on:
push:
branches:
- "main"
- "full-builds"
workflow_dispatch:
inputs:
comments:
required: true
description: 'Test scenario tags'
jobs:
windows-conda:
name: Windows-latest, Conda-latest, Python 3.7
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.7'
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 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
pip list
- name: Run tests (Bash)
shell: bash -l {0}
run: pytest tests/

View File

@@ -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

View File

@@ -0,0 +1,13 @@
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

View File

@@ -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

View File

@@ -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:

View File

@@ -11,7 +11,9 @@ 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 screeninfo import get_monitors
from gamestonk_terminal import feature_flags as gtff
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(), dpi=cfgPlot.PLOT_DPI)
plt.bar(df.index, df.iloc[:, -1], color="k", alpha=0.8, width=0.3)
plt.ylabel("Volume")
_ = axVolume.twinx()
@@ -364,3 +366,30 @@ def str_to_bool(value):
return True
else:
raise ValueError(f"{value} is not a valid boolean value")
def get_screeninfo():
screens = get_monitors() # Get all available monitors
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:
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_PERCENTAGE * 10 ** -2) / (
cfgPlot.PLOT_DPI
) # Calculate width
if cfgPlot.PLOT_HEIGHT_PERCENTAGE == 100: # If full height
y = y - 60 # Remove the height of window toolbar
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)
return x, y

View File

@@ -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
@@ -268,6 +269,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
),

View File

@@ -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)

View File

@@ -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:

View File

@@ -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":

View File

@@ -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

View File

@@ -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)

54
poetry.lock generated
View File

@@ -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]]
@@ -1662,6 +1662,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"
@@ -1953,6 +1972,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"
@@ -2487,6 +2519,7 @@ lock-version = "1.1"
python-versions = "^3.6.8"
content-hash = "184502c6b8d4b7db5baa4323e7f70b2585c6140c304583f0678e24681b8f9c9b"
[metadata.files]
absl-py = [
{file = "absl-py-0.12.0.tar.gz", hash = "sha256:b44f68984a5ceb2607d135a615999b93924c771238a63920d17d3387b0d229d5"},
@@ -3544,6 +3577,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"},
@@ -3875,6 +3924,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"},

View File

@@ -39,6 +39,7 @@ mplfinance = "^0.12.7-alpha.7"
seaborn = "^0.11.0"
scipy = "1.5.4"
fredapi = "^0.4.3"
screeninfo = "^0.6.7"
[tool.poetry.dev-dependencies]
pytest = "^6.2.2"

View File

@@ -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"

View File

@@ -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"

View File

@@ -108,6 +108,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"
@@ -129,3 +130,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"