Gammath SPOT
Stock Price-Opining Toolset (SPOT) is a do-it-yourself stock technical analysis toolkit with both a Graphical User Interface (GUI) and a Command Line Interface (CLI). It analyzes stocks and computes a proprietary analysis score called the gScore (pronounced "ga Score"), short for Gammath Works' stock analysis score. The gScore indicates the degree to which a stock is trading at a perceived discount or a perceived premium.
SPOT also provides tools for price projection, gScore history generation, backtesting, stock screening and trade simulation. Together, these tools can help you make your own stock-specific buy, hold and sell decisions.
Note: gScore is not G-Score, GScore, G Score or g-score. It differs in usage, appearance, spelling, pronunciation and meaning, and is built on its own distinct stock analysis and scoring system.
Table of Contents
- Features
- Requirements
- Installation
- Using Docker
- Usage
- Troubleshooting
- Resources
- Contact and Contributing
Features
| Tool | Description |
|---|---|
| Data Scraper | Collects the stock data required for algorithmic analysis and scoring. |
| Analyzer and Scorer | Analyzes the locally saved stock data and computes gScores. gScores range from -1 to +1: values closer to -1 indicate that the stock is perceived to be trading at a premium, while values closer to +1 indicate that it is perceived to be trading at a discount. |
| Price Projector | Estimates and projects prices over an approximately five-year time frame. |
| Screener | Screens stocks based on current-information micro-gScores (fundamental analysis and options analysis). |
| gScores Historian | Generates gScore and micro-gScore history for correlation analysis and backtesting. |
| Backtester | Tests a trading strategy against historical data and reports how it performed. It also generates a "Today's Actions" summary for the default strategy, so the entire analysis and decision-making process can be automated. |
| GUI | An all-in-one graphical interface to the entire toolset. |
| Trading Simulator | A reinforcement learning (RL) trading agent that trains on gScore history and recommends actions (work in progress). |
All tools take a watchlist as input. A sample is provided in sample_watchlist.csv, which you can modify to create your own watchlist.
Requirements
- Python 3.12
- The following packages (installed automatically with
pip install gammath-spot):- numpy
- pandas
- yfinance
- scikit-learn
- matplotlib
- tensorflow
- tensorboard
- keras-tuner
- gymnasium
Installation
Install from PyPI
After installing Python 3.12, run:
pip install gammath-spot --prefer-binary
Get the source code (without installing)
git clone https://github.com/salylgw/gammath_spot.git
Tip: If you are a new user, or would like to try Gammath SPOT without setting up a local environment, we recommend starting with the prebuilt Docker image and the CLI. This lets you get familiar with the tools quickly without worrying about local environment issues. See the instructional videos and the Using Docker section below.
Using Docker
Get the prebuilt image
-
Install Docker Desktop (macOS or Windows) or Docker Engine (Linux).
-
Start Docker.
-
Open a terminal (macOS/Linux) or PowerShell (Windows).
-
Pull the image:
docker pull gammathworks/gammath_spot
Run the container (CLI)
-
Start Docker Desktop or Docker Engine.
-
Open a terminal or command prompt.
-
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
Replace the
TZvalue to match your time zone. -
At the container prompt, run
pwd. It should print/gammath_spot/gammath_spot. Runninglsshould list all the.pyfiles. You are now ready to run the Gammath SPOT commands described in Usage.
Build your own image
-
Install and start Docker, then open a terminal as described above.
-
Place this Dockerfile in the directory where you want to build the image.
-
Build the image (note the trailing
.):docker build --no-cache=true --tag=gammathworks/gammath_spot .
-
Run the container as described in Run the container (CLI).
Copy data from Docker Desktop to your computer
The exact steps may vary slightly depending on your Docker Desktop version and environment.
- Open Docker Desktop and click Volumes.
- Click the volume name, then click Data.
- Scroll down to the
tickersdirectory. - Hover over
tickers, click the three-dot menu on the right, and select Save as. - Click Save, then unzip the downloaded
tickers.zipfile. - Open the files with your preferred applications (e.g., Excel, Acrobat).
Usage
All commands below write their log to a text file via > redirection. If you installed the package, use the console command (e.g., gammath_scraper). If you are running from source, change to the gammath_spot/gammath_spot/ directory and use the corresponding python command. Both forms work inside the prebuilt Docker container.
Graphical User Interface
Note: The GUI is not supported in the Docker container.
| Installed | From source |
|---|---|
gammath_spot_gui > log_gui.txt |
python gammath_gui_app.py > log_gui.txt |
The GUI is self-explanatory: it lets you run the tools, manage watchlists, run screeners, view results and more, without using any of the CLI commands below. The output locations described in the CLI section still apply, so you can also browse the data and results directly with native applications such as a file explorer, spreadsheet program or PDF viewer.
Command Line Interface
1. Scrape stock data
| Installed | From source |
|---|---|
gammath_scraper sample_watchlist.csv > log_scraper.txt |
python gammath_stocks_data_scraper.py sample_watchlist.csv > log_scraper.txt |
The scraped and formatted data, along with a reference SP500_watchlist.csv based on the S&P 500, is saved in the tickers subdirectory. Running the scraper is required before using any of the other tools.
2. Analyze and score
| Installed | From source |
|---|---|
gammath_scorer sample_watchlist.csv > log_scorer.txt |
python gammath_stocks_analyzer_and_scorer.py sample_watchlist.csv > log_scorer.txt |
Analysis and scoring results are saved in the tickers and tickers/<ticker-symbol> subdirectories.
-
tickers/<watchlist_name>_overall_gscores.csv(e.g.,sample_watchlist_overall_gscores.csv): Stocks from your watchlist sorted in ascending order of gScore. This file also includes:sh_gscore: the stock-history-based gScoresci_gscore: the current-information-based gScore
Together,
sh_gscoreandsci_gscoremake up the overall gScore. If you are not interested in backtesting or sub-component scores, you can ignore them. -
tickers/<ticker-symbol>/<ticker-symbol>_signal.txt: Detailed analysis results. -
tickers/<ticker-symbol>/<ticker-symbol>_charts.pdf: Plotted charts. -
tickers/<ticker-symbol>/<ticker-symbol>_tc.pdf: Current moving estimated support and resistance lines.
3. Project prices
| Installed | From source |
|---|---|
gammath_projector sample_watchlist.csv > log_projector.txt |
python gammath_stocks_pep.py sample_watchlist.csv > log_projector.txt |
tickers/<ticker-symbol>/<ticker-symbol>_pp.csv: Projected price values. S&P 500 projections are saved in thetickersdirectory.tickers/MPEP.csv: A sorted list of moving estimated projected five-year returns.
4. Screen stocks
| Installed | From source |
|---|---|
gammath_screener screener.csv > log_screener.txt |
python gammath_stocks_screener.py screener.csv > log_screener.txt |
Screens stocks based on the current-information micro-gScores computed by the scorer: the fundamental analysis (FAST) and options analysis (Options) micro-gScores. The minimum value for each micro-gScore is specified in screener.csv, and every stock in the tickers directory that meets both minimums is included in the results. Run the scraper and scorer first.
tickers/screened_watchlist.csv: The screened list of stocks, which can also be used as a watchlist for the other tools.
5. Generate gScore history
| Installed | From source |
|---|---|
gammath_historian sample_watchlist.csv > log_historian.txt |
python gammath_stocks_gscores_historian.py sample_watchlist.csv > log_historian.txt |
Use this tool to generate historical gScores for correlation analysis, past-performance review and backtesting. The first run takes a long time, so limit the watchlist to a few stocks you want to study closely.
tickers/<ticker-symbol>/<ticker-symbol>_micro_gscores.csv: Stock-history-based micro-gScores and the corresponding total gScore.tickers/<ticker-symbol>/<ticker-symbol>_gscores_charts.pdf: Charts of price, overall stock-history-based gScore and micro-gScores.
6. Backtest a strategy
| Installed | From source |
|---|---|
gammath_backtester sample_watchlist.csv > log_backtester.txt |
python gammath_stocks_backtesting.py sample_watchlist.csv > log_backtester.txt |
For each stock, the backtester applies a strategy to the scraped data and the stock-history-based gScores/micro-gScores (generated by the historian) for approximately the last five years. You can modify the strategy function locally to implement your own.
tickers/<ticker-symbol>/<ticker-symbol>_gtrades_stats_<term>_<risk>_risk_appetite.csv: Backtesting statistics, where<term>isshort_termorlong_termand<risk>ismediumorhigh. Use these statistics to judge whether a strategy has worked historically before deciding to use it.tickers/Todays_Actions.csv: A sorted "Today's Actions" summary based on the default backtested strategy.
7. Run the trading simulator (work in progress)
Note: The SPOT RL trading simulator is experimental and has had limited testing.
| Installed | From source |
|---|---|
gammath_trading_simulator sample_watchlist.csv > log_trader.txt |
python gammath_spot_rl_gym_env.py sample_watchlist.csv > log_trader.txt |
Optional arguments: --retrain (force retraining even if a saved model exists), --episodes <n> and --test_days <n>. Run with --help for details.
tickers/<ticker-symbol>/<ticker-symbol>_rl_signals.csv: Per-stock RL signals.tickers/<watchlist_name>_rl_signals.csv: Watchlist-level summary for daily review.
Troubleshooting
"Command not found" after installation
The installer normally adds the console scripts (gammath_scraper, gammath_scorer, gammath_projector, gammath_historian, gammath_backtester, gammath_screener, gammath_trading_simulator and gammath_spot_gui) to your PATH. In some setups this does not happen, and you will need to add the scripts' install location to your PATH manually.
Scraper fails on macOS due to a certificate error
- Open Applications → Python 3.12.
- Run Install Certificates.command as an administrator.
- Exit the administrator session.
Docker environment issues
- Out of disk space when pulling the image: Run
docker image prune -fto remove unused images. - Signature mismatch error for a component image when building your own image: Run
docker builder prune -fto clear the build cache. - In general, use the latest versions of Docker Desktop and gammath-spot.
Resources
- DIY Investment Blog: Free examples of how gScores are used in manual investment decision-making.
- Instructional videos: Getting started with the prebuilt Docker image.
Contact and Contributing
If you have questions, please reach out using this contact form.
This version of Gammath SPOT is free and open source. If you would like to contribute your expertise in Python and/or finance and investing, please get in touch through the contact form and describe your areas of interest and expertise. See also CONTRIBUTING.md and CODE_OF_CONDUCT.md.
Happy SPOTing!
Gammath, SPOT and the stylized logo are registered trademarks/service marks.
Metadata
Release files for gammath-spot 17.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gammath_spot-17.0.tar.gz | 126.9 kB | Without provenance | Details for gammath_spot-17.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gammath_spot-17.0-py3-none-any.whl | Python 3 | none | any | Details for gammath_spot-17.0-py3-none-any.whl |
Total release size: 294.9 kB
Release files / gammath_spot-17.0.tar.gz
| Download URL | gammath_spot-17.0.tar.gz |
|---|---|
| Size | 126.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c3cb395f4c35ba4079968d27629803d05376be5dec59724bc0b766e5bef558a2
|
|
BLAKE2b-256 checksum How to use checksums |
a4a244256942a4c16e684056a9e1fd91b507bfa1e56b4e79c0d62b10ba023cbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.4
|
Release files / gammath_spot-17.0-py3-none-any.whl
| Download URL | gammath_spot-17.0-py3-none-any.whl |
|---|---|
| Size | 168.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e5ca8f09f726850f86bf61d40041ffeb2d5dd5daa35f16e729ef7b877c8dfd32
|
|
BLAKE2b-256 checksum How to use checksums |
cdc5d210e6918ef066f646bd598559e7606b5c4631f94d901372540566896ef0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.4
|
Security for gammath-spot 17.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.