Merge pull request #76 from DidierRLopes/nodesocket

Overall install improvements
This commit is contained in:
DidierRLopes
2021-03-02 22:27:53 +00:00
committed by GitHub
12 changed files with 3203 additions and 122 deletions

7
.dockerignore Normal file
View File

@@ -0,0 +1,7 @@
.git
.*
.dockerignore
.env*
.gitignore
docker-compose.yaml
Dockerfile*

42
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Tests
on: push
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.6.13', '3.7', '3.8']
name: Python ${{ matrix.python-version }}
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install Poetry
uses: snok/install-poetry@v1.1.1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Run tests
env:
MPLBACKEND: Agg
run: |
source .venv/bin/activate
pytest tests/

33
Dockerfile Normal file
View File

@@ -0,0 +1,33 @@
FROM python:3.6.13-slim-buster
RUN apt-get update && apt-get -y install --no-install-recommends \
gcc \
g++ \
make \
wget \
curl \
telnet \
net-tools \
iputils-ping \
dnsutils \
git \
gnupg \
unzip \
bzip2 && \
apt-get -y autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN useradd --create-home --shell /bin/bash python
USER python
WORKDIR /home/python
ENV PATH="/home/python/.local/bin:${PATH}"
COPY --chown=python:python . .
#RUN INSTALL_ON_LINUX=1 pip install -r requirements.txt
RUN pip install "poetry==1.1.4"
RUN poetry export --without-hashes -f requirements.txt | pip install -r /dev/stdin
CMD ["python", "gamestonk_terminal.py"]

6
docker-compose.yaml Normal file
View File

@@ -0,0 +1,6 @@
version: '3.8'
services:
gamestonkterminal:
build:
context: .
image: gamestonkterminal:dev

View File

@@ -11,10 +11,10 @@ from rapidfuzz import fuzz
# ---------------------------------------------------- MANAGEMENT ----------------------------------------------------
def management(l_args, s_ticker):
parser = argparse.ArgumentParser(prog='mgmt',
description="""Print management team. Namely: Name, Title, Information from google and
parser = argparse.ArgumentParser(prog='mgmt',
description="""Print management team. Namely: Name, Title, Information from google and
(potentially) Insider Activity page. [Source: Business Insider]""")
try:
(ns_parser, l_unknown_args) = parser.parse_known_args(l_args)
@@ -33,7 +33,7 @@ def management(l_args, s_ticker):
l_names = list()
for s_name in text_soup_market_business_insider.findAll('td', {'class': 'table__td table--allow-wrap'}):
l_names.append(s_name.text.strip())
df_management = pd.DataFrame({'Name': l_names[-len(l_titles):], 'Title':l_titles}, columns=['Name','Title'])
df_management['Info'] = '-'
@@ -57,7 +57,7 @@ def management(l_args, s_ticker):
if df_management['Insider Activity'][ind] not in '-':
print(f"{df_management['Insider Activity'][ind]}")
print("")
except:
print("")
return

2910
poetry.lock generated Normal file

File diff suppressed because it is too large Load Diff

37
pyproject.toml Normal file
View File

@@ -0,0 +1,37 @@
[tool.poetry]
name = "GamestonkTerminal"
version = "0.1.0"
description = ""
authors = ["Didier Rodrigues Lopes"]
[tool.poetry.dependencies]
python = "^3.6.8"
fbprophet = "^0.6"
pandas = "^1.1.5"
iso8601 = "^0.1.14"
FundamentalAnalysis = "^0.2.6"
requests = "^2.25.1"
alpha-vantage = "^2.3.1"
finviz = "^1.3.4"
bs4 = "^0.0.1"
rapidfuzz = "^1.1.1"
yfinance = "^0.1.55"
pandas-ta = "^0.2.23b0"
prettytable = "^2.0.0"
psaw = "^0.0.12"
praw = "^7.1.4"
Quandl = "^3.6.0"
flair = "^0.7"
pytrends = "^4.7.3"
TimeSeriesCrossValidation = { git = "https://github.com/DidierRLopes/TimeSeriesCrossValidation.git", branch = "master" }
pmdarima = "^1.8.0"
tensorflow = "^2.4.1"
matplotlib = "^3.3.3"
plotly = "^4.14.3"
[tool.poetry.dev-dependencies]
pytest = "^6.2.2"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

View File

@@ -1,131 +1,129 @@
absl-py==0.11.0
aiohttp==3.7.3
absl-py==0.11.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.2.0"
aiohttp==3.7.4; python_version >= "3.6"
alpha-vantage==2.3.1
appscript==1.1.2
astunparse==1.6.3
async-timeout==3.0.1
attrs==20.3.0
async-timeout==3.0.1; python_full_version >= "3.5.3" and python_version >= "3.6"
attrs==20.3.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
beautifulsoup4==4.9.3
bpemb==0.3.2
cachetools==4.2.1
certifi==2020.12.5
chardet==3.0.4
click==7.1.2
cloudpickle==1.6.0
config==0.5.0.post0
convertdate==2.3.1
cssselect==1.1.0
cycler==0.10.0
Cython==0.29.17
decorator==4.4.2
Deprecated==1.2.11
filelock==3.0.12
bpemb==0.3.2; python_version >= "3.6"
bs4==0.0.1
cachetools==4.2.1; python_version >= "3.5" and python_version < "4.0" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0")
certifi==2020.12.5; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
chardet==3.0.4; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
click==7.1.2; python_full_version >= "3.6.0" and python_version >= "3.6"
cloudpickle==1.6.0; python_version >= "3.6"
cmdstanpy==0.4.0
convertdate==2.3.1; python_version >= "3.5"
cssselect==1.1.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0"
cycler==0.10.0; python_version >= "3.6"
cython==0.29.17; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6"
dataclasses==0.8; python_version >= "3.6" and python_version < "3.7" and python_full_version >= "3.6.2"
decorator==4.4.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.2.0" and python_version >= "3.6"
deprecated==1.2.11; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
ephem==3.7.7.1; python_version >= "2.7" and python_version < "4"
fbprophet==0.6
filelock==3.0.12; python_full_version >= "3.6.0" and python_version >= "3.6"
finviz==1.3.4
flair==0.7
flair==0.7; python_version >= "3.6"
flatbuffers==1.12
ftfy==5.9
FundamentalAnalysis==0.2.6
future==0.18.2
gast==0.3.3
gdown==3.12.2
gensim==3.8.3
google-auth==1.27.0
google-auth-oauthlib==0.4.2
ftfy==5.9; python_version >= "3.6"
fundamentalanalysis==0.2.6
future==0.18.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6"
gast==0.3.3; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.4.0"
gdown==3.12.2; python_version >= "3.6"
gensim==3.8.2; python_version >= "3.6"
google-auth-oauthlib==0.4.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.2.0" and python_version >= "3.6"
google-auth==1.27.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
google-pasta==0.2.0
grpcio==1.32.0
grpcio==1.32.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.2.0"
h5py==2.10.0
hijri-converter==2.1.1
hijri-converter==2.1.1; python_version >= "3.6"
holidays==0.10.5.2
hyperopt==0.2.5
idna==2.10
importlib-metadata==3.7.0
inflection==0.5.1
hyperopt==0.2.5; python_version >= "3.6"
idna-ssl==1.1.0; python_version < "3.7" and python_version >= "3.6"
idna==2.10; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.7" or python_version < "3.7" and python_version >= "3.6" and python_full_version >= "3.5.0"
importlib-metadata==3.7.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"
inflection==0.5.1; python_version >= "3.5"
iso8601==0.1.14
Janome==0.4.1
joblib==1.0.1
Keras-Preprocessing==1.1.2
kiwisolver==1.3.1
konoha==4.6.2
janome==0.4.1; python_version >= "3.6"
joblib==1.0.1; python_full_version >= "3.6.0" and python_version >= "3.6"
keras-preprocessing==1.1.2
kiwisolver==1.3.1; python_version >= "3.6"
konoha==4.6.2; python_full_version >= "3.6.1" and python_full_version < "4.0.0" and python_version >= "3.6"
korean-lunar-calendar==0.2.1
langdetect==1.0.8
lxml==4.6.2
Markdown==3.3.4
matplotlib==3.1.1
more-itertools==8.7.0
mpld3==0.3
multidict==5.1.0
langdetect==1.0.8; python_version >= "3.6"
lunarcalendar==0.0.9; python_version >= "2.7" and python_version < "4"
lxml==4.6.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
markdown==3.3.4; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.2.0" and python_version >= "3.6"
matplotlib==3.3.4; python_version >= "3.6"
more-itertools==8.7.0; python_version >= "3.5"
mpld3==0.3; python_version >= "3.6"
multidict==5.1.0; python_version >= "3.6"
multitasking==0.0.9
networkx==2.5
numpy==1.19.2
oauthlib==3.1.0
opt-einsum==3.3.0
overrides==3.0.0
packaging==20.9
pandas==1.1.5
pandas-ta==0.2.23b0
patsy==0.5.1
pmdarima==1.8.0
praw==7.1.4
prawcore==1.5.0
prettytable==2.0.0
protobuf==3.15.2
psaw==0.0.12
psutil==5.8.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
PyMeeus==0.4.2
pyparsing==2.4.7
PySocks==1.7.1
python-dateutil==2.8.1
networkx==2.5; python_version >= "3.6"
numpy==1.19.5; python_version >= "3.6" and python_full_version >= "3.6.2" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.2.0" and python_version >= "3.6")
oauthlib==3.1.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
opt-einsum==3.3.0; python_version >= "3.5"
overrides==3.0.0; python_full_version >= "3.6.1" and python_full_version < "4.0.0" and python_version >= "3.6"
packaging==20.9; python_full_version >= "3.6.0" and python_version >= "3.6"
pandas-ta==0.2.45b
pandas==1.1.5; python_full_version >= "3.6.1"
patsy==0.5.1; python_version >= "3.6"
pillow==8.1.0; python_version >= "3.6"
plotly==4.14.3
pmdarima==1.8.0; python_version >= "3.6"
praw==7.2.0; python_version >= "3.6" and python_version < "4.0"
prawcore==2.0.0; python_version >= "3.6" and python_version < "4.0"
prettytable==2.0.0; python_version >= "3.6"
protobuf==3.15.3; python_full_version >= "3.6.0" and python_version >= "3.6" and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.2.0")
psaw==0.0.12; python_version >= "3"
pyasn1-modules==0.2.8; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0"
pyasn1==0.4.8; python_version >= "3.5" and python_full_version < "3.0.0" and python_version < "4" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6") or python_version >= "3.5" and python_version < "4" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6") and python_full_version >= "3.6.0"
pymeeus==0.4.3; python_version >= "3.5"
pyparsing==2.4.7; python_full_version >= "3.6.0" and python_version >= "3.6"
pysocks==1.7.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
pystan==2.18
python-dateutil==2.8.1; python_full_version >= "3.6.1" and python_version >= "3.5" 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 >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0") and (python_version >= "2.7" and python_full_version < "3.0.0" and python_version < "4" or python_version >= "2.7" and python_version < "4" and python_full_version >= "3.3.0")
pytrends==4.7.3
pytz==2019.3
Quandl==3.6.0
rapidfuzz==1.1.1
regex==2020.11.13
requests==2.25.1
requests-oauthlib==1.3.0
rsa==4.7.2
sacremoses==0.0.43
scikit-learn==0.24.1
scipy==1.6.1
segtok==1.5.10
sentencepiece==0.1.91
six==1.15.0
smart-open==4.2.0
soupsieve==2.2
sqlitedict==1.7.0
statsmodels==0.12.2
tabulate==0.8.9
tensorboard==2.4.1
tensorboard-plugin-wit==1.8.0
tensorflow==2.4.1
pytz==2021.1; python_full_version >= "3.6.1" and python_version >= "3.5" and python_version < "4"
quandl==3.6.0; python_version >= "3.5"
rapidfuzz==1.1.1; python_version >= "2.7"
regex==2020.11.13; python_full_version >= "3.6.0" and python_version >= "3.6"
requests-oauthlib==1.3.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
requests==2.25.1; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.5.0")
retrying==1.3.3
rsa==4.7.2; python_version >= "3.5" and python_version < "4" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6")
sacremoses==0.0.43; python_full_version >= "3.6.0" and python_version >= "3.6"
scikit-learn==0.24.1; python_version >= "3.6"
scipy==1.5.4; python_version >= "3.6"
segtok==1.5.10; python_version >= "3.6"
sentencepiece==0.1.91; python_full_version >= "3.6.0" and python_version >= "3.6"
setuptools-git==1.2
six==1.15.0; python_full_version >= "3.6.0" and python_version >= "3.6" and python_version < "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 >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0")
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"
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"
tensorflow-estimator==2.4.0
termcolor==1.1.0
threadpoolctl==2.1.0
TimeSeriesCrossValidation @ git+https://github.com/DidierRLopes/TimeSeriesCrossValidation@1e29d393204abb3bde23ff3f15258ed85d3b263e
tokenizers==0.9.3
torch==1.7.1
tqdm==4.57.0
transformers==3.5.1
typing-extensions==3.7.4.3
update-checker==0.18.0
urllib3==1.26.3
user-agent==0.1.9
wcwidth==0.2.5
websocket-client==0.57.0
Werkzeug==1.0.1
wrapt==1.12.1
XlsxWriter==1.2.7
xlwings==0.16.4
yahoo-fin==0.8.4
yarl==1.6.3
yfinance==0.1.55
beautifulsoup4==4.9.3
FundamentalAnalysis==0.2.6
python_dateutil==2.8.1
scikit_learn==0.24.1
tensorflow==2.4.1
zipp==3.4.0
lunarcalendar
fbprophet
levenshtein
termcolor==1.1.0
threadpoolctl==2.1.0; python_version >= "3.6"
timeseriescrossvalidation @ git+https://github.com/DidierRLopes/TimeSeriesCrossValidation.git@master
tokenizers==0.9.3; python_full_version >= "3.6.0" and python_version >= "3.6"
torch==1.7.1; python_full_version >= "3.6.2" and python_version >= "3.6"
tqdm==4.58.0; python_full_version >= "3.6.0" and python_version >= "3.6"
transformers==3.5.1; python_full_version >= "3.6.0" and python_version >= "3.6"
typing-extensions==3.7.4.3; python_full_version >= "3.6.2" and python_version >= "3.6" and python_version < "3.8" and (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")
update-checker==0.18.0; python_version >= "3.6" and python_version < "4.0"
urllib3==1.26.3; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version < "4" and python_version >= "3.6"
user-agent==0.1.9
wcwidth==0.2.5; python_version >= "3.6"
websocket-client==0.57.0; 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"
werkzeug==1.0.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
wrapt==1.12.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
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"

0
tests/__init__.py Normal file
View File

2
tests/conftest.py Normal file
View File

@@ -0,0 +1,2 @@
def pytest_configure(config):
config.addinivalue_line("markers", "e2e: mark as end-to-end test.")

View File

@@ -0,0 +1,21 @@
from unittest.mock import patch
import pandas as pd
import pytest
from gamestonk_terminal import load
@pytest.mark.e2e
def test_load_command():
test_stock = 'TSLA'
test_start = '2020-06-04'
with patch('sys.stdout.write') as mock_out:
result = load(['-t', test_stock, '-s', test_start], '', '', '', '')
args = mock_out.call_args_list[0][0]
assert result[0] == test_stock
assert test_stock in args[0]
assert test_start in args[0]

View File

@@ -0,0 +1,25 @@
from unittest.mock import patch
import pytest
from prediction_techniques.neural_networks import mlp
from gamestonk_terminal import load
@pytest.fixture
def stock():
def load_stock(name, start='2020-06-04'):
return load(['-t', name, '-s', start], '', '', '', '')
return load_stock
@pytest.mark.e2e
def test_mlp(stock):
with patch('sys.stdout.write') as mock_out:
tesla = stock('TSLA')
mlp([], tesla[0], tesla[2], tesla[3])
mock_out.assert_any_call('Predicted share price:')