GamestonkTerminal

Gamestonk Terminal provides a modern Python-based integrated environment for investment research, that allows the average joe retail trader to leverage state-of-the-art Data Science and Machine Learning technologies.

As a modern Python-based environment, GamestonkTerminal opens access to numerous Python data libraries in Data Science (Pandas, Numpy, Scipy, Jupyter), Machine Learning (Pytorch, Tensorflow, Sklearn, Flair), and Data Acquisition (Beautiful Soup, and numerous third-party APIs).

Getting Started

Install

This project was originally written and tested with Python 3.6.8. It should now support Python 3.6, 3.7, and 3.8.

Our current recommendation is to use this project with Anaconda's Python distribution - either full Anaconda3 Latest or Miniconda3 Latest. Several features in this project utilize Machine Learning. Machine Learning Python dependencies are optional. If you decided to add Machine Learning features at a later point, you will likely have better user experience with Anaconda's Python distribution.

  1. Install Anaconda

Confirm that you have it with: conda -V. The output should be something along the lines of: conda 4.9.2

  1. Create Environment

You can name the environment whatever you want. Although you could use names such as: welikethestock, thisistheway or diamondhands, we recommend something simple and intuitive like gst. This is because this name will be used from now onwards.

conda create -n gst python=3.6.8
  1. Activate the virtual environment
conda activate gst

Note: At the end, you can deactivate it with: conda deactivate

  1. Fork the Project
  • Via HTTPS: git clone https://github.com/DidierRLopes/GamestonkTerminal.git
  • via SSH: git clone [email protected]:DidierRLopes/GamestonkTerminal.git

Navigate into the folder with: cd GamestonkTerminal/

  1. Install poetry
conda install poetry
  1. Install poetry dependencies
poetry install

This is a library for package management, and ensures a smoother experience than: pip install -r requirements.txt

  1. You're ready to Gamestonk it!
python terminal.py

Advanced User Install - Python 3.8

Note that the conda deactivate -> conda activate in the middle is on purpose, this is sometimes required to avoid issues with poetry

conda create -n gst python=3.8.8
conda activate gst
conda install poetry
conda deactivate
conda activate gst
poetry install
conda install -c conda-forge fbprophet numpy=1.19.5 hdf5=1.10.5
poetry install -E prediction

Advanced User Install - Machine Learning

If you are an advanced user and use other Python distributions, we have several requirements.txt documents that you can pick from to download project dependencies.

Note: The libraries specified in the requirements.txt file have been tested and work for the purpose of this project, however, these may be older versions. Hence, it is recommended for the user to set up a virtual python environment prior to installing these. This allows to keep dependencies required by different projects in separate places.

If you would like to use optional Machine Learning features:

ENABLE_PREDICT = os.getenv("GTFF_ENABLE_PREDICT") or True
  • Install optional ML features dependencies:
poetry install -E prediction

If you run into issues installing or Cannot convert a symbolic Tensor... at runtime, try this:

conda install -c conda-forge fbprophet numpy=1.19.5 hdf5=1.10.5
poetry install
poetry install -E prediction

If you would like to set up a docker image:

  • Build the docker: docker build .
  • Run it: docker run -it gamestonkterminal:dev

Note: The problem with docker is that it won't output matplotlib figures.

*Commands that may help you in case of an error:

  • python -m pip install --upgrade pip
  • pip install pystan --upgrade
  • poetry update --lock

Other issues

If you run into trouble with poetry and the advice above did not help, your best bet is to try

  1. poetry update --lock

  2. conda deactivate -> conda activate gst, then try again

  3. Delete the poetry cache, then try again

    Platform Location
    Linux "~/.cache/pypoetry"
    Mac "~/Library/Caches/pypoetry"
    Windows "%localappdata%/pypoetry/cache"
  4. Track down the offensive package and purge it from your anaconda <environment_name> folder, then try again (removing through conda can sometimes leave locks behind)

    Platform Location
    Linux/Mac "~/anaconda3/envs" or "~/opt/anaconda3/envs"
    Windows "%userprofile%/anaconda3/envs"
  5. Completely nuke your conda environment folder and make a new environment from scratch

  6. Reboot your computer and try again

  7. Submit a ticket on github

API Keys

The project is build around several different API calls, whether it is to access historical data or financials.

These are the ones where a key is necessary:

When these are obtained, don't forget to update config_terminal.py.

Alternatively, you can also set them to the following environment variables: GT_API_KEY_ALPHAVANTAGE, GT_API_KEY_FINANCIALMODELINGPREP, GT_API_KEY_QUANDL, GT_API_REDDIT_CLIENT_ID, GT_API_REDDIT_CLIENT_SECRET, GT_API_REDDIT_USERNAME, GT_API_REDDIT_USER_AGENT, GT_API_REDDIT_PASSWORD, GT_API_TWITTER_KEY, GT_API_TWITTER_SECRET_KEY, GT_API_TWITTER_BEARER_TOKEN, GT_API_POLYGON_KEY, GT_FRED_API_KEY, GT_API_NEWS_TOKEN.

Example:

export GT_API_REDDIT_USERNAME=SexyYear

Note that it is not necessary to have a valid Alpha Vantage key to get daily OHLC values.

Usage

Start by loading a ticker of interest:

load -t GME

The menu will expand to all its menus since a ticker has been loaded.

View the historical data of this stock:

view

Slice the historical data by loading ticker and setting a starting point, e.g.

load -t GME -s 2020-06-04

Enter in technical analysis menu with

ta

and run a SMA with:

sma

However, imagine that you wanted to change the length of the window because you don't want to go long but do a swing, and therefore a smaller window is necessary. Check what settings are available on the SMA command:

sma -h

Once that has been seen, set the parameters that you want after flagging them. In this case, to change length window to 10, we would have to do:

sma -l 10

Example:

usage

GitHub

https://github.com/DidierRLopes/GamestonkTerminal