Skip to content

Checks a list of stocks to see if the price has declined a certain percentage from its maximum price over a specified number of days.

License

Notifications You must be signed in to change notification settings

nicholaskuechler/stock-price-decline-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stock Price Decline Checker

Checks a list of stocks to see if the price has declined a certain percentage from its maximum price over a specified number of days.

The goal is to identify primarily index ETFs that have declined substantially in price from their maximum values over the past few weeks or months, which could potentially signal a buying opportunity.

Author

Nicholas Kuechler

Requirements

  • argparse
  • matplotlib - used to pull the stock quote data from Yahoo! Finance

You can install them with pip:

pip install argparse
pip install matplotlib

Or you can install them using pip and the requirements.txt file:

pip install -r requirements.txt

Example

Show help menu:

python stock-price-decline-checker.py -h
usage: stock-price-decline-checker.py [-h] [-s SYMBOLS] [-p PERCENT] [-d DAYS]
                                      [-v]

optional arguments:
  -h, --help            show this help message and exit
  -s SYMBOLS, --symbols SYMBOLS
                        Comma separate list of symbols. Example: SPY,QQQ
  -p PERCENT, --percent PERCENT
                        Percent change. Example: 5
  -d DAYS, --days DAYS  Number of days. Example: 50
  -v, --verbose         Increase output verbosity

Run the decline checker against some index ETFs:

python stock-price-decline-checker.py -s QQQ,SPY,DIA -d 50 -p 5 -v

Example output:

Symbols: ['QQQ', 'SPY', 'DIA']
Percent: 5.0
Days: 50
Verbose: True

Checking for a 5.0% decline over the past 50 days

Index stock: QQQ
- max value over 50 days: 83.06
- most recent close: 82.81
- percent change: -0.3%

Index stock: SPY
- max value over 50 days: 177.17
- most recent close: 176.21
- percent change: -0.54%

Index stock: DIA
- max value over 50 days: 156.5
- most recent close: 155.86
- percent change: -0.41%

The stock price decline checker will display an alert if the stock has dropped in price greater than the percentage specified:

python stock-price-decline-checker.py -s GOOG,FB -d 50 -p 7.5

Note how FB has now triggered an alert since it has fallen over 7.5%:

Checking for a 7.5% decline over the past 50 days

Index stock: GOOG
- max value over 50 days: 1036.24
- most recent close: 1027.04
- percent change: -0.89%

Index stock: FB
- max value over 50 days: 54.22
- most recent close: 49.75
- percent change: -8.24%

ALERT! FB has dropped -8.24% over the last 50 days

About

Checks a list of stocks to see if the price has declined a certain percentage from its maximum price over a specified number of days.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages