Stock Price-Opining Tools
Project description
Gammath™ SPOT
Stock Price-Opining Tool is a DIY stock technical analysis toolset used to analyze stocks and compute gScore that indicates the degree at which a stock is trading at a perceived discount or a perceived premium. The gScore is then used like an indicator in making buy, sell or hold decision on the stock. It also provides a tool to generate price projection, a tool to generate gScore-history for correlation and a tool for backtesting strategy.
How does it do that? It does this in five parts:
- It provides a
gammath_stocks_data_scraper.py
app that scrapes the web to obtain stock information necessary to run its gScore computing algorithm. - 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 scores using its algorithm to indicate perceived discount or perceived premium. - The gScores range between -1 and +1. gScores towards -1 indicates that the tool perceives the stock price to be at a premium while gScore towards +1 indicates that the tool preceives the stock price to be at a discount.
- It also estimates current moving support and resistance lines for the stock price.
- It provides a
gammath_stocks_pep.py
app that projects estimated price for an approximately five (5) years time frame. - It provides a
gammath_stocks_gscores_historian.py
app that generates gScore and micro-gScores history for correlation. These can be used in backtesting a strategy - 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. - 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.
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:
- numpy
- pandas
- pandas_datareader
- ta-lib (Install ta-lib using miniconda in case you run into problem:
conda install -c conda-forge ta-lib
) - yfinance
- pykalman
- statsmodels (Install statsmodels using miniconda in case you run into problems:
conda install statsmodels
) - scikit-learn
- matplotlib (Install matplotlib using miniconda in case you run into problem:
conda install matplotlib
) - backtesting
HOWTO install
If you are not familiar with python then you can use prebuilt docker image described in section "HOWTO get prebuilt docker image" below.
pip install gammath-spot
In case you run into installation problem(s) then use the alternative installation method(s) mentioned above and then run pip install gammath-spot
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
- Get Docker desktop (for MAC or Windows) or Docker Engine (for Linux) from here.
- Run it
- Open terminal (MAC/Linux) or Power Shell (Windows)
- Use this Dockerfile in the directory where you want to build the image
- Run
docker build --no-cache=true --tag=gammathworks/gammath_spot .
HOWTO get prebuilt Gammath™ SPOT docker image
- Repeat first three steps above
- Run
docker pull gammathworks/gammath_spot
HOWTO to run containerized Gammath™ SPOT
- Run docker desktop/engine that you installed
- Open 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
- Note: You can replace the value for TZ to match your timezone
HOWTO use these apps
- If you installed this software then run:
gammath_scraper sample_watchlist.csv > log_scraper.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_data_scraper.py sample_watchlist.csv > log_scraper.txt
- Above step will save the scraper log in
log_scraper.txt
, creates atickers/
sub-directory where it saves scraped data for stocks in the watch list. Running the data scraper is essential before using the scorer and historian - If you 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
- Above step will save the scorer log in
log_scorer.txt
, analyze the stock data and computes the gScore using Gammath's algorithm. - Go to
tickers/
sub-directory and openoverall_gscores.csv
in your favorite spreadsheet program or a text editor. - In
overall_gscores.csv
, you should see stocks from your watchlist arrange in ascending order of gScores. Lower values (towards -1) indicate that the tool perceives the respective stock to be trading at a premium while higher values (towards +1) indicate that the tool perceives the respective stock to be trading at a doscount. 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 gscore. If you are not interested in backtesting or sub-component score then you can ignore it There is a lot of useful information stored intickers/*symbol*
dir that can be checked for details.*symbol*_signal.txt
shows details of the analysis results and*symbol*_charts.pdf
shows the plotted charts - This tool also generates current moving estimated support and resistance lines for the stock and saves
*symbol*_tc.pdf
intickers/*symbol*
dir. - If you 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
- Price projection chart and projections are saved in
tickers/*symbol*
dir. - Chart and projection for S&P500 are saved in
tickers
dir.*symbol*_pep.pdf
shows the chart and*symbol*_pp.csv
shows the projected values. A sorted list of moving estimated projected 5Y returns are saved intickers/MPEP.csv
. - In case you want to collect historical gscores (for correlation, past performance etc.) then you can do so by using the gScores historian tool. Please note that this tool is slow at the moment so limit the watchlist for this tool to few selected stocks that you have 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
- You can check the
tickers/"ticker_symbol"/"ticker_symbol"_micro_gscores.csv
(for stock history based micro-gScores and corresponding total gScore) andtickers/"ticker_symbol"/
"ticker_symbol"_gscores_charts.pdf` that shows the plotted charts of price, overall stock history based gScore and micro-gScores - You can do backtesting on provided watchlist. 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 - For each stock, it 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.csv
- 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
HOWTO to get Gammath™ SPOT data from Docker desktop to your PC/MAC
- Run docker desktop
- Click on "Volumes"
- Click on the Volume name
- Click on Data
- Scroll down to see tickers directory
- Move the cursor to tickers. Notice the three dots on the right. Click on it
- Click on "Save as"
- Click on Save
- Unzip the tickers.zip file
- You should be able to view files using your favorite programs (e.g. Excel, Acrobat etc)
Investment blog
If you want to see a real example of how output of this tool is being used then checkout DIY Investment blog.
Report Issues
If you run into any problem then please contact us using the https://www.gammathworks.com contact page. You can also purchase technical support at https://www.gammathworks.com/plans-pricing.
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 us using the https://www.gammathworks.com contact page indicating your area of interest and expertise
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for gammath_spot-8.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60354ab5a96f23348c77328702b43318eb7506c59352a62981b4b1732bd68eff |
|
MD5 | b24ffe66b6311206cd65e141e2c448d8 |
|
BLAKE2b-256 | 8797b5648f3d59fdd5672c7b2acaa61d45d6931724bb41bb87bee3132ff3a3b9 |