Coder Social home page Coder Social logo

georgefahmy / stonks Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 1.0 162 KB

This stonks project is meant to allow users to scrape wallstreetbets for stock information. Generate a report or stream live, to see what stocks people are talking about.

License: MIT License

Python 100.00%

stonks's Introduction

Robin Stonks

My lame attempt to have a python script manage my stock portfolio

Best to run this in a virtual environment to keep things clean.

git clone https://github.com/georgefahmy/stonks.git

cd stonks

pip install .

Run python src/utils/nltk_download.py and download 'all-corpora'. (need to look into this more for tuning the model)

Before running any scripts, run get_symbols to generate the tickers.txt. This file is used for determining whether a set of capital letters used in a comment is a stock symbol or not.

Main scripts help description below.

If stock tickers are showing up that you suspect are not of importance, or actually being discussed, edit the src/utils/ignore.py. Also you can use the -i <TICKER SYMBOLS...> as an optional flag for temporarily ignoring additional stock symbols.

wsb_report

usage: wsb_report [-h] [--type-flag TYPE_FLAG] [--submissions SUBMISSIONS]
                  [-c COMMENTS] [-p PRINT] [--sub-score SUB_SCORE]
                  [--com-score COM_SCORE] [-i [IGNORE [IGNORE ...]]] [-d]
                  [--debug]
                  type

Generate a report for stock mentions and the number of occurrences in
/r/wallstreetbets. Options allow for different types of filters and
thresholds.

positional arguments:
  type                  Choose which submissions to search: top, hot or new,
                        If top, --type-flag is an optional flag to choose day,
                        week, month, year, all

optional arguments:
  -h, --help            show this help message and exit
  --type-flag TYPE_FLAG
                        enter the type of sorting for 'Top': 'day, week,
                        month'
  --submissions SUBMISSIONS
                        Enter the number of submissions to scrape
  -c COMMENTS, --comments COMMENTS
                        Enter the limit for how many comment pages to scrape.
                        Default=None
  -p PRINT, --print PRINT
                        Limit the number of stocks printed after scraping.
                        Default=5
  --sub-score SUB_SCORE
                        Minimum submission score to include in analysis.
                        Default=5
  --com-score COM_SCORE
                        Minimum comment score to include in analysis.
                        Default=5
  -i [IGNORE [IGNORE ...]], --ignore [IGNORE [IGNORE ...]]
                        List of stock symbols to ignore
  -d, --display_dict    Option to display dictionary of all stocks found.
                        Default=False
  --debug               Displays debug messages in console

streamer

usage: streamer [-h] [-p] [-l] [-s] [-m] [-c] [--debug]

Reddit WallStreetBets stream with stock extraction from comments. Includes
comment sentiment as well as links to the comment URL. Stock symbol extraction
can also be used to automate retrieving stock price information.

optional arguments:
  -h, --help       show this help message and exit
  -p, --no-price   Optional flag to hide pricing info. Default=False
  -l, --link       Optional flag to display comment permalink in the stream.
                   Default=False
  -s, --sentiment  Optional flag to display comment sentiment (experimental).
                   Default=False
  -m, --multi      Optional flag to stream from r/wallstreetbets,
                   r/smallstreetbets, r/wsb, r/investing. Default=False
  -c, --censor     Optional flag to censor bad words in comment body.
                   Default=False
  --debug          Displays debug messages in console

all_stream

usage: all_stream [-h] [-f [FILTER [FILTER ...]]] [-st] [-l] [-s] [--debug]
                  [subreddits [subreddits ...]]

all_stream.py streams one or more subreddits' comments. Add --filter option
for filtering for specific words in the comment body. Additional options
available

positional arguments:
  subreddits            Subreddit(s) to pull comment stream from.

optional arguments:
  -h, --help            show this help message and exit
  -f [FILTER [FILTER ...]], --filter [FILTER [FILTER ...]]
                        Optional flag to filter for specific text in comment
                        body. Default=None
  -S, --stocks         Optional flag to display stock information found in
                        the comment. Default=False
  -l, --link            Optional flag to display comment url in the stream.
                        Default=False
  -s, --sentiment       Optional flag to display comment sentiment
                        (experimental). Default=False
  --debug               Displays debug messages in console

stonks's People

Contributors

georgefahmy avatar

Stargazers

 avatar Austin Jackson avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

Forkers

kevinfeng01

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.