Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
jackmoody11 committed May 8, 2019
2 parents 634e617 + 9af0370 commit 5741bd7
Show file tree
Hide file tree
Showing 18 changed files with 273 additions and 216 deletions.
6 changes: 0 additions & 6 deletions .pre-commit-config.yaml

This file was deleted.

53 changes: 41 additions & 12 deletions .travis.yml
@@ -1,16 +1,45 @@
sudo: false

language: python
python:
- "3.6"
# - "3.7" Will not include 3.7 support for now
# earlier versions not supported by black
# command to install dependencies
# Current workaround for running Python 3.7 tests
# sudo: required
# dist: xenial

matrix:
include:
- python: 3.5
dist: trusty
- python: 3.6
dist: trusty
env: DOCBUILD=true
- python: 3.7
dist: xenial
sudo: true

env:
global:
# Doctr deploy key for jackmoody11/stockscore
- secure: "MgSSDvTut3VcakoiK39VneLt0cBVhifnrKaFFu8XiLR9WW2qU/83aYPMV2zw8yM0XyU3IECFnAJWKCRr1bQGlhUS66Xlb/9zp5Yec1kVcU8GBY21r2k9YnkuFPYrgmdHrm5ChajQNJZ/nN8xgBstTIDdBIwtDn5rh3igcnHaAnm4BeEDlVnYqMsCa5VD0DlCPXZvDeqxjokMlb5NEn0La48k/oShYc+sa6gFfgUaLmPnE8b9EC0M4W2qq0jD4XmbGFyasN0LbSGs9vIOXooQybSTDyfEzGSySdRbU6mJO3rfVHL95Ewn0Sc6DRe0JVx11KKa0AXnUKXYD3u4HJ9tXn2KuWDmKPgSfMcjO6yKSR8vecvsdHXxcZszGw9mLFrw0dDKVDUWVOFiSkGMf8ukv3O6+LGo4ZDOV/+a9Bu4HGVdbAulQBmmAuuIVQN2cLf12WcHpd8oiEanuCqpNLr/MnqiokBCab9jGOtxB1Dj6qvhsW/PxQj01kWcbLF6Rr9dxh2zCsrsMVLV+fsQekhsup377gKNztPSGv6/qQJUn4S0rXQYtt3E7eYGzR/uDmhyHQQa4ZYSA6b4JQ6/X0R2WiB6wWdf7cOAeBeQ1/f5LsDRgsp2cI9dXydnv/9aKUVz1ZTgTFKiLxQqSqs5SG1GuOwqd1obU/oQtO2RwJE6oAg="

install:
- pip install -qq flake8
- if [[ $DOCBUILD ]]; then
pip install doctr sphinx sphinx_rtd_theme ipython matplotlib;
fi
- pip install -r requirements.txt

script:
- pytest tests --runslow # or py.test for Python versions 3.5 and below
os:
- linux
# may add osx later if it works - currently having issues
- flake8 --version
- flake8 stockscore
- pytest stockscore/tests --runslow # or py.test for Python versions 3.5 and below

after_success:
- |
if [[ $DOCBUILD ]]; then
cd docs
make html && make html
cd ..
doctr deploy devel --build-tags
if [[ -z ${TRAVIS_TAG} ]]; then
echo "Not a tagged build."
else
doctr deploy stable --build-tags
fi
fi
9 changes: 5 additions & 4 deletions docs/source/conf.py
Expand Up @@ -10,9 +10,10 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath('../..'))


# -- Project information -----------------------------------------------------
Expand All @@ -34,7 +35,7 @@
# ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.githubpages', 'sphinx.ext.todo',
'IPython.sphinxext.ipython_console_highlighting', 'IPython.sphinxext.ipython_directive',
'sphinxcontrib.napoleon', ]
'sphinx.ext.napoleon', ]

# Add any paths that contain templates here, relative to this directory.
templates_path = []
Expand Down
23 changes: 13 additions & 10 deletions docs/source/install.rst
Expand Up @@ -9,7 +9,11 @@ Dependencies

stockscore relies on:

\# Need to update!!!
- grequests
- iexfinance
- matplotlib
- pandas
- requests

Installation
------------
Expand All @@ -30,18 +34,17 @@ or

.. code:: bash
$ git clone https://github.com/jackmoody11/stockscore.git
$ cd stockscore
$ pip install .
$ git clone https://github.com/jackmoody11/stockscore.git
$ cd stockscore
$ pip install .
**Note:**

The use of
`virtualenv <http://docs.python-guide.org/en/latest/dev/virtualenvs/>`__
is recommended as below:
The use of virtual environments is recommended as below.
Using `virtualenv` may cause problems due to a `known conflict<https://matplotlib.org/faq/virtualenv_faq.html>`__
with `matplotlib`.

.. code:: bash
$ pip install virtualenv
$ virtualenv env
$ source env/bin/activate
$ python3 -m venv myenv
$ source myvenv/bin/activate
86 changes: 40 additions & 46 deletions docs/source/screens.rst
@@ -1,107 +1,101 @@
.. _screens:


.. currentmodule:: stockscore

stockscore Screens
==================

The `stockscore` module relies on many different screens. Screens relate to certain
"scores." Each stock is given scores based on relevant statistics. The available score
"scores." The `Scores` object takes one or more ticker symbols.

.. autoclass:: stockscore.scores.Scores

Each stock is given scores based on relevant statistics. The available score
categories are:
* Value
* Growth
* Momentum

* :ref:`Value<screens.value>`
* :ref:`Growth<screens.growth>`
* :ref:`Momentum<screens.momentum>`

.. _screens.value:

Value
~~~~~
* :ref:`Trading Volume<scores.trading_volume_screen>`
* :ref:`Net Income<scores.net_income_screen>`
* :ref:`Current Ratio<scores.current_ratio_screen>`
* :ref:`Price/Book Ratio<scores.p_to_b_screen>`
* :ref:`Price/Earnings Ratio<scores.p_to_e_screen>`
* :ref:`Profit Margin<scores.profit_margin_screen>`
* :ref:`Dividend<scores.dividend_screen>`
- :ref:`Trading Volume <screens.trading_volume_screen>`
- :ref:`Net Income <screens.net_income_screen>`
- :ref:`Current Ratio <screens.current_ratio_screen>`
- :ref:`Price/Book Ratio <screens.pb_ratio_screen>`
- :ref:`Price/Earnings Ratio <screens.pe_ratio_screen>`
- :ref:`Profit Margin <screens.profit_margin_screen>`
- :ref:`Dividend <screens.dividend_screen>`

.. _screens.growth:

Growth
~~~~~~
* :ref:`Splits<scores.splits_screen>`
- :ref:`Splits <screens.splits_screen>`

.. _screens.momentum:

Momentum
~~~~~~~~
* :ref:`Moving Avg<scores.moving_avg_screen>`
* :ref:`Trading Volume<scores.trading_volume_screen>`
* :ref:`Splits<scores.splits_screen>`

Value
~~~~~
- :ref:`Moving Avg <screens.moving_avg_screen>`
- Trading Volume (See :ref:`screens.value`)
- :ref:`Splits <screens.splits_screen>`

.. _scores.trading_volume_screen:
.. _screens.trading_volume_screen:

Trading Volume
--------------
.. automethod:: stockscore.scores.Scores.trading_volume_screen

.. _scores.net_income_screen:
.. _screens.net_income_screen:

Net Income
----------
.. automethod:: stockscore.scores.Scores.net_income_screen

.. _scores.current_ratio_screen:
.. _screens.current_ratio_screen:

Current Ratio
-------------
.. automethod:: stockscore.scores.Scores.current_ratio_screen

.. _scores.p_to_b_screen:
.. _screens.pb_ratio_screen:

Price/Book
----------
.. automethod:: stockscore.scores.Scores.p_to_b_screen
.. automethod:: stockscore.scores.Scores.pb_ratio_screen

.. _scores.p_to_e_screen:
.. _screens.pe_ratio_screen:

Price/Earnings
--------------
.. automethod:: stockscore.scores.Scores.p_to_e_screen
.. automethod:: stockscore.scores.Scores.pe_ratio_screen

.. _scores.profit_margin_screen:
.. _screens.profit_margin_screen:

Profit Margin
-------------
.. automethod:: stockscore.scores.Scores.profit_margin_screen

.. _scores.dividend_screen:
.. _screens.dividend_screen:

Dividend
--------
.. automethod:: stockscore.scores.Scores.dividend_screen


Growth
~~~~~~

.. _scores.splits_screen:
.. _screens.splits_screen:

Splits
------
.. automethod:: stockscore.scores.Scores.splits_screen

Momentum
~~~~~~~~

.. _scores.moving_avg_screen:
.. _screens.moving_avg_screen:

Moving Avg
----------
.. automethod:: stockscore.scores.Scores.moving_avg_screen

.. _scores.trading_volume_screen:

Trading Volume
--------------
.. automethod:: stockscore.scores.Scores.trading_volume_screen

.. _scores.splits_screen
Splits
------
.. automethod:: stockscore.scores.Scores.splits_screen
1 change: 1 addition & 0 deletions github_deploy_key_jackmoody11_stockscore.enc
@@ -0,0 +1 @@
gAAAAABc0akvCm631eWWs1GID_Agzh28InHFpIO95FGzsHytyaTDTWiAll27tN8D9VbnfZafYKatj8F3rNIprBuip2dReKgzomA2btwbDYOpN1xfMKRWW1eRsLw7TBlV_vvJpWtw2czAQk4LIRpb_50pH0xA06jKyB5F5DUSIrDOMOL6w3pXIiuTb4sIpR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3kh9iUbw2KbQhOfQl7euM71plk85em1lFBKG4_5vSoWzCTOP0O2AJKrf9gC09unKySGeSlgIqRLpqGPcusn-7DJzXnGNWzmZqBndeZJnfVtACf4Y3jyKk1vFRVMvc1CsiTL9rlnt3wV5a0LMYvvbOVp1arc5QEu1RWQrfhQZEOGAKbC2PvrdW1cAoIS1mjhKt-EaUM8Tkox5C2C2k893uPcj8nHrJNUYNNFiTos9aLGU7WMCq8Gba8gBgY7SE03eXgxZQvQS4rLdSRF4hXgtH7-Tz7660dbwTqAdEmfI-cjJMafYf25CNDz-euISjaDNH37lPwYw-vt3bPo8mEs7BNUTyaHeQ138FEuot6gFiLJM5HYte8zygEUoBAXZFtVZP967KL8Ozj-90P2StsBBNhWEWmIAawpT-uKxevSjuOBuozmHK-Y102VqnU6VhVEyR-4cqzduBKY-wPzGJPc1AVLvTKSHbQ-rlZsuCkipcXrXw0qo3N4KmT9sn5pb19Y0DBYb99BulWVv4twYss9BAn3C5WRNTjS6H_IjcrldPcGt4YxIR1S-ZMOhFMxEIriWOdoCivN0238GQbQ3sDMn83_hwI0bsQO7buoBDopoJryhhYMm9I5rXbq1KymTSfw7ndIEaAzBCoZclE7hR_3Tf6LXthVv8z0mwYYaq_xWY6Z7y6fbjgQR3M_8VGrIYb2EG6kzmOD_aNr7Hzasxm7qS3yArHEKw2-i9xJ_Sk36ojt6Ix4SWWfP7w63fxkmKynXHbY4lC38i07bqww3cdTWzmrCZOexNVVo5wGBF5SDjhTT8b5fvzbbGtVK4i4tHDsP9R9_RRTXgxncXS3FvNgqoyReP3KeVMMAWQzw570vDZ2qvuSa_F7KRpXb-rCNrkkXlsSrKZQPWFjFIo-RBRE-KuvnAKq3-8wsXIEUVqR2YQPR_G_KX-1ZKBwoW4k0tLCzRob2JWTdrI0nFw52sPPge-Vd_EIXUKmA==
43 changes: 5 additions & 38 deletions requirements.txt
@@ -1,38 +1,5 @@
appdirs==1.4.3
aspy.yaml==1.1.1
atomicwrites==1.2.1
attrs==18.2.0
beautifulsoup4==4.7.1
black==18.6b4
bs4==0.0.1
cached-property==1.5.1
certifi==2018.11.29
cfgv==1.4.0
chardet==3.0.4
Click==7.0
cycler==0.10.0
gevent==1.4.0
greenlet==0.4.15
grequests==0.3.0
identify==1.1.8
idna==2.7
iexfinance==0.3.4
kiwisolver==1.0.1
matplotlib==2.2.3
more-itertools==5.0.0
nodeenv==1.3.3
numpy==1.15.4
pandas==0.23.3
pluggy==0.6.0
pre-commit==1.11.2
py==1.7.0
pyparsing==2.3.1
pytest==3.6.3
python-dateutil==2.7.5
pytz==2018.9
PyYAML==4.2b1
requests==2.20.0
six==1.12.0
soupsieve==1.7.1
toml==0.10.0
urllib3>=1.24.2
grequests
iexfinance
matplotlib
pandas
requests
3 changes: 3 additions & 0 deletions setup.cfg
@@ -0,0 +1,3 @@

[flake8]
max-line-length = 100
4 changes: 2 additions & 2 deletions stockscore.py
Expand Up @@ -43,9 +43,9 @@ def score_stocks(num_stocks):
# Run screens to find top stocks
top = score_stocks(stock_count)
stocks = list(top.index)
print(f"The top {stock_count} stocks are {stocks}")
print("The top {stock_count} stocks are {stocks}".format(stock_count=stock_count, stocks=stocks))
# End timer
end = time.time()
print(f"That took {end - begin:.2f} seconds")
print("That took {time} seconds".format(time=end - begin))
# Plot top stocks in bar chart
plot_top(top)
3 changes: 2 additions & 1 deletion stockscore/__init__.py
@@ -1 +1,2 @@
__version__ == '0.4.0'
__version__ = '0.4.0'
__author__ = 'Jack Moody'

0 comments on commit 5741bd7

Please sign in to comment.