Git Product home page Git Product logo

predict_stock_py's Introduction

predict_stock_py

This is a submission for the "Predicting Stock Prices challenge" by @Sirajology on Youtube.

Overview

The python script "predict_stock.py" does the following:

  1. Asks the user for a stock quote from NASDAQ (e.j: AAPL, FB, GOOGL)
  2. Uses Tweepy to retrieve tweets about that stock.
  3. Uses TextBlob to determine if the majority of the tweets are positive using sentiment analisys.
  4. If the last is True, downloads the last year of prices for that stock, and trains a neural net with that data to predict the price for tomorrow.

The folder "demo" contains a test training 'Table 3' to the same network that is used to predict the price.

Dependencies

Usage

Install all the necesary dependencies. Then just run:

python predict_stock.py

It will ask you for a NASDAQ quote, e.j: AAPL, then if the sentiment is positive and the stock you entered exists it will start training the network and give you a result.

Credits

Credits to Siraj and to this blog post.

Disclaimer

Do not use this code to invest in the stock market, if you are interested in stocks start by reading "The Intelligent Investor" by Benjamin Graham.

predict_stock_py's People

Contributors

ciurana2016 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

predict_stock_py's Issues

Details required

@ciurana2016 I am new to python and also for machine learning. Please bear with me.
I have few questions, if you can answer.

  1. Did you test this with real world scenario? what was the success rate?
  2. Why are you predicting the next sequence value with only "Open" value, is there any possibility that I can use multiple input and then predict the next sequence?

How do I setup and run

I tried running this, but I am getting error.
Can you guide me in the right way to install this?
Or a requirement.txt file will help too.

Error for some quotes??

So, I tried it with several quotes and it runs fine, but for some quotes, it doesn't work properly. For instance, in the case of $EARS stock, it gives values that the stock was never priced it ever. Also, when I plugin quotes like $NAKD, I get the following error:

Using TensorFlow backend.
Enter a stock quote from NASDAQ (e.j: AAPL, FB, GOOGL): NAKD
Epoch 1/200
Traceback (most recent call last):
  File "predict_stock.py", line 105, in <module>
    print stock_prediction()
  File "predict_stock.py", line 81, in stock_prediction
    model.fit(trainX, trainY, nb_epoch=200, batch_size=2, verbose=2)
  File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 672, in fit
    initial_epoch=initial_epoch)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 1196, in fit
    initial_epoch=initial_epoch)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/training.py", line 911, in _fit_loop
    callbacks.on_epoch_end(epoch, epoch_logs)
  File "/usr/local/lib/python2.7/dist-packages/keras/callbacks.py", line 76, in on_epoch_end
    callback.on_epoch_end(epoch, logs)
  File "/usr/local/lib/python2.7/dist-packages/keras/callbacks.py", line 265, in on_epoch_end
    self.progbar.update(self.seen, self.log_values, force=True)
AttributeError: 'ProgbarLogger' object has no attribute 'log_values

Please note: I don't put $ before the quotes.

ModuleNotFoundError: No module named 'tensorflow'

I tried running the script and i get this error. please help

Using TensorFlow backend.
Traceback (most recent call last):
File "E:\SM8\Projects\Stock Predictor\stock_predict.py", line 7, in
from keras.models import Sequential
File "C:\Users\shreyash\AppData\Local\Programs\Python\Python36\lib\site-packages\keras_init_.py", line 2, in
from . import backend
File "C:\Users\shreyash\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\backend_init_.py", line 67, in
from .tensorflow_backend import *
File "C:\Users\shreyash\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\backend\tensorflow_backend.py", line 1, in
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.