Skip to main content

Stock Price-Opining Tools

Project description

Alt text

Gammath SPOT

Stock Price-Opining Toolset is a DIY stock technical analysis software with a Graphical User Interface (GUI) and a Command Line Interface (CLI). It is used to analyze stocks and compute a stock analysis score --- I'm calling it gScore (pronounced as "ga Score") --- to represent Gammath Works' stock analysis score. It indicates the degree to which a stock is trading at a perceived discount or at a perceived premium. SPOT also provides tools to generate price projection, support and resistance lines, stock news headline sentiment analysis score, gScore-history, backtesting and stock screening. Together, these can help in making your own stock-specific buy, sell, hold decisions.

Please note that gScore is NOT G-Score/GScore/G Score/g-score. It differs in its usage, appearance, spelling, pronunciation, meaning and sits on top of totally different stock analysis and scoring system).

How does it do that? It does this in six parts:

  1. It provides a gammath_stocks_data_scraper.py app that scrapes the web to obtain stock information necessary for algorithmic analysis and scoring.
  2. It provides a gammath_stocks_analyzer_and_scorer.py app that analyzes the stock data saved on the local storage from step 1 and computes analysis scores using its algorithm to indicate a degree to which the stock is trading at a perceived discount or perceived premium. The Gammath Scores (gScores) range between -1 and +1. gScores closer to -1 indicate that the software perceives the stock to be trading at a premium while gScore closer to +1 indicates that the software preceives the stock to be trading at a discount. In addition, it also estimates current moving support and resistance lines for the stock price and computes stock news headlines sentiment score.
  3. It provides a gammath_stocks_pep.py app that estimates and projects price for an approximately five (5) years time frame.
  4. It provides a gammath_stocks_gscores_historian.py app that generates gScore and micro-gScores history for correlation and backtesting.
  5. It provides a gammath_stocks_backtesting.py app that tests an implemented strategy and generates data to see how respective strategy did. It also generates "today's actions" summary for default strategy. This way the entire stock analysis and decision-making process is fully automated.
  6. All the above apps take a watchlist as an input. A sample watch list is provided in sample_watchlist.csv that can be used and updated for your watchlist.
  7. It provides a gammath_stocks_screener.py app that helps screen stocks based on micro-gScores.
  8. In addition to all the above tools, it also provides a gammath_gui_app.py -- an "all-in-one" application -- that provides a graphical user interface to the toolset.

External dependencies

This project uses following free tools that need to be installed (you can use pip install) to be able to use this tool:

  1. numpy
  2. pandas
  3. pandas_datareader
  4. ta-lib (Install ta-lib using miniconda in case you run into problem: conda install -c conda-forge ta-lib)
  5. yfinance
  6. pykalman
  7. statsmodels (Install statsmodels using miniconda in case you run into problems: conda install statsmodels)
  8. scikit-learn
  9. matplotlib (Install matplotlib using miniconda in case you run into problem: conda install matplotlib)
  10. backtesting
  11. textblob

HOWTO install

If you want to use the GUI, it is recommended to install miniconda (latest version for Python 3.10) and then use following commands in your miniconda shell for installing gammath-spot:

  1. conda install -c conda-forge ta-lib
  2. pip install gammath-spot --prefer-binary

If you want to use CLI and use prebuilt docker image then please see the the instruction videos here.

WHERE to get source code without installing

Get source code from GIT repo. (git clone https://github.com/salylgw/gammath_spot.git).

HOWTO build docker image to use CLI

  1. Get Docker desktop (for MAC or Windows) or Docker Engine (for Linux) from here.
  2. Run it.
  3. Open terminal (MAC/Linux) or Power Shell (Windows)
  4. Use this Dockerfile in the directory where you want to build the image.
  5. Run docker build --no-cache=true --tag=gammathworks/gammath_spot ..

HOWTO get prebuilt Gammath SPOT docker image to use CLI

  1. Repeat first three steps above.
  2. Run docker pull gammathworks/gammath_spot.

HOWTO to run containerized Gammath SPOT with CLI

  1. Run docker desktop/engine that you installed.
  2. Open terminal or command prompt.
  3. Run docker run -i -t -e TZ="America/Los_Angeles" --mount type=volume,source=gammath_spot_vol,target=/gammath_spot/gammath_spot gammathworks/gammath_spot /bin/bash.
  4. Note: You can replace the value for TZ to match your timezone.

HOWTO run these apps

  1. If you installed this software to use it with the GUI then run: gammath_spot_gui > log_gui.txt. If not installed but just obtained the source code then go to the directory gammath_spot/gammath_spot where all the source files are and run: python gammath_gui_app.py > log_gui.txt. log_gui.txt should contain the GUI app's log. The GUI is self-explanatory to run the tools, watchlists operations, screeners, get results etc. When using the GUI, the user need not use the commands in following instructions. However, the information about path information on where data and results are saved can still be used to directly browse and view the data and results using native apps on the machine such as file explorer, spreadsheet viewer, PDF viewer etc.
  2. If you want to use the CLI and installed this software then run: gammath_scraper sample_watchlist.csv > log_scraper.txt. See sample_watchlist.csv. If not installed but just obtained the source code then go to the directory gammath_spot/gammath_spot where all the source files are and run: python gammath_stocks_data_scraper.py sample_watchlist.csv > log_scraper.txt.
  3. Above step will save the scraper log in log_scraper.txt and save the scraped, formatted data in tickers sub-directory. Running the data scraper is essential to be able to use rest of the tools.
  4. If you want to use the CLI and installed this software then run: gammath_scorer sample_watchlist.csv > log_scorer.txt. If not installed but just obtained the source code then go to the directory gammath_spot/gammath_spot/ where all the source files are and run: python gammath_stocks_analyzer_and_scorer.py sample_watchlist.csv > log_scorer.txt.
  5. Above step will save the scorer log in log_scorer.txt and all of the Gammath SPOT's analysis and scoring data in tickers and tickers/<ticker-symbol> sub-directories. Go to tickers/ sub-directory and open <watchlist_name>_overall_gscores.csv (e.g.: sample_watchlist_overall_gscores.csv) in your favorite spreadsheet program or a text editor. In <watchlist_name>_overall_gscores.csv, you should see stocks from your watchlist arranged in ascending order of gScores. In this file, you'll also see sh_gscore (stock history based gscore) and sci_gscore (current info based gacore) that make up the overall/final gscore. If you are not interested in backtesting or sub-component score then you can ignore it. In addition, the stock-specific news headlines sentiment mean score is also computed and included in the <watchlist_name>_overall_gscores.csv. There is a lot of useful information stored in tickers/<ticker-symbol> dir that can be checked for details. <ticker-symbol>_signal.txt shows details of the analysis results and <ticker-symbol>_charts.pdf shows the plotted charts. This tool also generates current moving estimated support and resistance lines for the stock and saves <ticker-symbol>_tc.pdf in tickers/<ticker-symbol> dir.
  6. If you want to use the CLI and want to generate estimated price projection and have installed this software then run: gammath_projector sample_watchlist.csv > log_projector.txt. If not installed but just obtained the source code then go to the directory gammath_spot/gammath_spot/ where all the source files are and run: python gammath_stocks_pep.py sample_watchlist.csv > log_projector.txt.
  7. Price projection chart and projections are saved in tickers/<ticker-symbol> dir. Chart and projection for S&P500 are saved in tickers dir. <ticker-symbol>_pep.pdf shows the chart and <ticker-symbol>_pp.csv shows the projected values. A sorted list of moving estimated projected 5Y returns are saved in tickers/MPEP.csv.
  8. If you want to use the CLI and you want to generate historical gscores (for correlation, past performance, backtesting etc.) then you can do so by using the gScores historian tool. Please note that this tool takes a long time to run so limit the watchlist for this tool to few selected stocks that you want to zoom into. If you installed this software then run: gammath_historian sample_watchlist.csv > log_historian.txt. If not installed but just obtained the source code then go to the directory gammath_spot/gammath_spot/ where all the source files are and run: python gammath_stocks_gscores_historian.py sample_watchlist.csv > log_historian.txt.
  9. You can check the tickers/<ticker-symbol>/<ticker-symbol>_micro_gscores.csv (for stock history based micro-gScores and corresponding total gScore) and tickers/<ticker-symbol>/<ticker-symbol>_gscores_charts.pdf that shows the plotted charts of price, overall stock history based gScore and micro-gScores.
  10. You can do backtesting on provided watchlist. If you want to use the CLI and if you installed this software then run: gammath_backtester sample_watchlist.csv > log_backtester.txt. If not installed but just obtained the source code then go to the directory gammath_spot/gammath_spot/ where all the source files are and run: python gammath_stocks_backtesting.py sample_watchlist.csv > log_backtester.txt. You can update the function locally for implementing your own strategy.
  11. For each stock, backtester processes (based on a strategy you implement/use) the data collected by scraper app and processes the stock history based gScore/micro-gScores for approximately last 5 years (that were saved from the gscore historian) and saves the backtesting stats in tickers/<ticker_symbol>/<ticker_symbol>_gtrades_stats_<term>_<risk>_risk_appetite.csv (term is either short_term or long_term and risk is medium or high). You can check the backtesting stats to understand if the strategy you use worked historically and then decide whether to use that strategy or not. A sorted list of "Today's Actions" summary associated with default backtested strategy is saved in tickers/Todays_Actions.csv.
  12. If you want to use the CLI and want to screen stocks based on micro-gScores and have installed this software then run: gammath_screener screener.csv > log_screener.txt. If not installed but just obtained the source code then go to the directory gammath_spot/gammath_spot/ where all the source files are and run: python gammath_stocks_screener.py screener.csv > log_screener.txt. Note that the filtering criteria (micro-gScores values) is specified in screener.csv and the results can be found in tickers/screened_watchlist.csv.

HOWTO to get Gammath SPOT data from Docker desktop to your PC/MAC

  1. Run docker desktop
  2. Click on "Volumes"
  3. Click on the Volume name
  4. Click on Data
  5. Scroll down to see tickers directory
  6. Move the cursor to tickers. Notice the three dots on the right. Click on it
  7. Click on "Save as"
  8. Click on Save
  9. Unzip the tickers.zip file
  10. You should be able to view files using your favorite programs (e.g. Excel, Acrobat etc)

Investment blog

If you want to see a free example of how gScore is being used in manual decision-making then checkout DIY Investment blog.

Questions

If you have any questions, then please contact me using this form.

Happy SPOTing!

Note: This version of Gammath SPOT is free and open source. If you would like to contribute to this project through your expertise in Python and/or world of finance then please contact me using this form indicating your area of interest and expertise

Gammath, SPOT and logo showing stylized g(m) are registered trade/service marks.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gammath_spot-11.tar.gz (98.6 kB view details)

Uploaded Source

Built Distributions

gammath_spot-11.0.0-py3-none-any.whl (133.9 kB view details)

Uploaded Python 3

gammath_spot-11.0-py3-none-any.whl (133.9 kB view details)

Uploaded Python 3

gammath_spot-11-py3-none-any.whl (133.8 kB view details)

Uploaded Python 3

File details

Details for the file gammath_spot-11.tar.gz.

File metadata

  • Download URL: gammath_spot-11.tar.gz
  • Upload date:
  • Size: 98.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for gammath_spot-11.tar.gz
Algorithm Hash digest
SHA256 839b94688caf9d9d0fbcab96a4885f899600f71ea5d4f78e355100c56f6f4cc1
MD5 d1f493222b7a11fe27dfede0a1b5328d
BLAKE2b-256 ae17336099beb23a211458770216075153cef40ecaad10f39037ecd4c2f67e99

See more details on using hashes here.

File details

Details for the file gammath_spot-11.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gammath_spot-11.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa5016b6c7f4e57cf8fc7c101ddbcf0f7149e3b2d2c46915ce2892124c73a817
MD5 877d15bb229ad50e5a27344524856ece
BLAKE2b-256 961caa2133ec6f79c959289da9d2357e8e4aeea474422c3a7be7360e1cec52b1

See more details on using hashes here.

File details

Details for the file gammath_spot-11.0-py3-none-any.whl.

File metadata

  • Download URL: gammath_spot-11.0-py3-none-any.whl
  • Upload date:
  • Size: 133.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for gammath_spot-11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a29127b950eaf81c200dbbfbc5b6ae1d9fe5cffe5be5f37e2d104d15604e95c
MD5 f5b09243c25e305ea0e798278a5665c5
BLAKE2b-256 be8790e733fdba0991172cc6a4853c8d54b3152a532d420492eba2ba9503bd9d

See more details on using hashes here.

File details

Details for the file gammath_spot-11-py3-none-any.whl.

File metadata

  • Download URL: gammath_spot-11-py3-none-any.whl
  • Upload date:
  • Size: 133.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for gammath_spot-11-py3-none-any.whl
Algorithm Hash digest
SHA256 5aaffb53be1af8559c22435fe084d9e9239d0a4946b0335a54cdafcf89b126e7
MD5 c6165ecdd1a0097b12097ddc96d1b216
BLAKE2b-256 045795d388164699daaa6b893f178f1113b79e9707371ffdce55d317d92bcd1a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page