mpeng8 / PyTrade

0 stars 2 forks source link

PyTrade

PyTrade is a website trading application that provides stock data visualization and predictive models of stock market trends based on SPY (S&P 500, or Standard & Poor’s 500), DJI (Dow Jones Industrial Average), and NDX (NASDAQ - 100).

PyTrade serves as a platform for both professional investors and newcomers to manage their stock holdings, educate them about the historical background of markets, and provide suggestions about trading strategies based on PyTrade’s validated models of stock markets.

Additionally, PyTrade aims to become a valid source of information for investors to learn about future market trends by developing a high performance model of stock markets.

Table of Contents

Version 0.9.0 Release Notes

This is the beta release of our website. The notes will introduce main features, bug fixes and known bugs that still need to be fixed.

New software features for this release

  1. Register or login to an account in PyTrade website
  2. User-friendly dashboard
  3. User connections (following and unfollowing users, viewing user profile)
  4. Stock information searching
  5. Add and remove stock from stock list
  6. Interactive stock price visualization
  7. Stock price prediction and suggestions for selling or buying stocks

Bug fixes made since the last release

  1. Javascript and plugin: the crossover website information request using Allow-Control-Allow-Origin from google chrome plugin.
  2. Stock list table paging: now the stock list table can be displayed with 10, 25, 50 ,100 entries per page as they want, and when searching for new stocks
  3. Stock searching: When searching for stock information, the stock name can be auto-completed.
  4. Email, username, password validation for new user registration

    Known bugs and defects

  5. Some stocks can not be fetched from Quandl, because of invalid stock name or insufficient data.
  6. Extensively searching for stocks symbol will report errors and the stock names cannot be auto-completed.
  7. Javascript 500 error: the menu toggle function cannot be used in stock information page.
  8. Hosting website on cloud is under construction
  9. Website security check still needed for implementing connection of the banking account
  10. Machine learning model optimization is still under improvement

Install Guide

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

What things you need to install the software and how to install them

Python

PyTrade uses Python 2.7.12. We recommend installing Python from Anaconda Anaconda is the leading open data science platform powered by Python. To download Anaconda, please go to Anaconda download page. HERE

After you have installed Anaconda, you can run the following command in your terminal to install required packages

$ python package_install.py

Then, you can skip the following sections.

TA-Lib

TA-Lib is a Python package that PyTrade uses to perform technical analysis of financial market data.

To install from Anaconda, type the following command into your terminal:

conda install -c quantopian ta-lib=0.4.9

To install from PyPI, type the following command into your terminal:

$ pip install TA-Lib

Or checkout the sources, and type the following command into your terminal:

$ python setup.py install

NumPy

NumPy is a Python package for scientific computations.

To install from Anaconda, type the following command into your terminal:

conda install -c anaconda numpy=1.12.1

To install from a Linux package manager, type the following command into your terminal:

sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

For other installation methods or other systems, please checkout NumPy Download Page

pandas

To install from Anaconda, type the following command into your terminal:

conda install -c anaconda pandas=0.19.2

To install from PyPI, type the following command into your terminal:

pip install pandas

For other installation methods or other systems, please checkout pandas Download Page

scikit-learn

To install from Anaconda, type the following command into your terminal:

conda install scikit-learn

To install from PyPI, type the following command into your terminal:

pip install -U scikit-learn

For other installation methods or other systems, please checkout scikit-learn Download Page

sqlalchemy

To install from Anaconda, type the following command into your terminal:

conda install -c anaconda sqlalchemy=1.1.9

To install from PyPI, type the following command into your terminal:

pip install SQLAlchemy

For other installation versions, please checkout sqlalchemy Index of Packages

Dependent libraries that must be installed

Since PyTrade's real-time stock data comes from quandl, PyTrade currently relies on a third-party plugin to make API calls.

Download instructions

To download PyTrade, type the following command in your terminal:

git clone https://github.com/mpeng8/PyTrade.git

Installation of actual application

PyTrade does not require any additional installation. After you have downloaded PyTrade repository, you are ready to run PyTrade.

Run instructions

To run PyTrade on your localhost server, run the following command in your terminal.

$ python run.py

Troubleshooting

'python' is not recognized as an internal or external command, operable program or batch file.

This typically means that your Python path is not declared. We suggest following the instructions here.

talib/common.c:8:22: fatal error: pyconfig.h: No such file or directory
#include "pyconfig.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

This typically means that you need the Python headers, and should run something like:

$ sudo apt-get install python3-dev
func.c:256:28: fatal error: ta-lib/ta_libc.h: No such file or directory
compilation terminated.

This typically means that it can't find the underlying TA-Lib library, a dependency which needs to be installed.

Command C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\jon\\appdata\\local\\temp\\pip_build_jon\\numpy\\setup.py';exec(compile(getattr(tokenize, 'open', open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\jon\appdata\local\temp\pip-qnynnf-record\install-record.txt --single-version-externally-managed

--compile failed with error code 1 in c:\users\jon\appdata\local\temp\pip_build_jon\numpyStoring

debug log for failure in C:\Users\jon\pip\pip.log

This typically means that wheel(.whl file) is not supported. You may try run something like:

pip install wheel
pip install numpy‑1.9.1+mkl‑cp27‑none‑win32.whl
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_reihaneh/sklearn/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-89YQB7-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_reihaneh/sklearn
Storing debug log for failure in /home/reihaneh/.pip/pip.log

If there's error indicating that you don't have gcc when using linux to install numpy, you can do:

apt-get install build-essential python-dev

to install the things that missing for python development.

This typically happens because your install command for scikit-learn is incorrect. Please re-check your install command

 Exception:
      Traceback (most recent call last):
        File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/basecommand.py", line 232, in main
          status = self.run(options, args)
        File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/commands/install.py", line 347, in run
          root=options.root_path,
        File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_set.py", line 543, in install
          requirement.uninstall(auto_confirm=True)
        File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_install.py", line 667, in uninstall
          paths_to_remove.remove(auto_confirm)
        File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_uninstall.py", line 126, in remove
          renames(path, new_path)
        File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/utils/__init__.py", line 316, in renames
          shutil.move(old, new)
        File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 300, in move
          rmtree(src)
        File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 252, in rmtree
          onerror(os.remove, fullname, sys.exc_info())
        File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 250, in rmtree
          os.remove(fullname)
      OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/numpy-1.8.0-py2.7.egg-info/dependency_links.txt'

For those who are using linux. This means that you are not the root user. So you can try:

 sudo pip install scikit-learn

to install scikit-learn as root user.

I got a 'Woops, there was an error making the request.' message popped out.

This typically means that the third-party plugin is not running correctly. You can just refresh the page.

error: The requested URL returned error: 401 while accessing
https://github.com/mpeng8/PyTrade.git
fatal: HTTP request failed

Note that you need to ensure the remote is correct. The repository you're trying to fetch must exist on GitHub, and the URL is case-sensitive.

Command python setup.py egg_info failed with error code 1 in c:\users[username]\appdata\local\temp\pip_build_[username]\pandas

This is the error you might see when doing pip install pandas. You can try the following steps:

Download the relevant packages from Christoph Gohlke's Python Extension Packages for Windows repository. You'll find the files for pandas here as well as a list of other required dependencies for pandas here.

Authors