Skip to content
Benny Thadikaran edited this page May 18, 2024 · 3 revisions

Display Help: py init.py -h

Show Version: py init.py -v

Scan stocks using a watchlist file. Pass a file containing stocks (one on each line).

# starts an interactive prompt
py init.py -f nifty_500.csv

See Chart controls how to navigate charts.

Scan stocks from a list of symbols. Pass a list of symbols space separated.

py init.py --sym tcs astral datapattns

NOTE: If SYM_LIST is specified in user.json, -f or --sym is not required unless you wish to override the default watchlist.

Identify chart patterns on a specific date.:

# iso date format YYYY-MM-DD
py init.py -f nifty_500.csv -d 2023-01-01

Save results as images to folder

# default folder is src/images
py init.py -f nifty_500.csv --save
# add a custom folder
py init.py -f nifty_500.csv --save ~/Desktop/pattern/

To skip the interactive prompt, specify a pattern string:

# Bullish VCP
py init.py -f nifty_500.csv -p vcpu

Pattern string can be one of:

Pattern String Description
all All patterns
bull All Bullish patterns
bear All Bearish patterns
vcpu VCP Up (Bullish)
vcpd VCP Down (Bearish)
dbot Double Bottom
dtop Double Top
hnsu Head & Shoulder Up (Bullish)
hnsd Head & Shoulder Down (Bearish)
trng Triangles (Symmetric, Ascending, Descending)

There are other CLI options available for those wanting to tinker.

Chart keyboard navigation

Key Description
n Next Chart
p Previous Chart
NUM_KEY + j Type the number followed by j to jump to index. Press ESC to clear

Chart Plot options

Results of last scan, are saved as json files. Filename is same as pattern string, for E.g. vcpu.json

To plot results of scan, use --plot.

py init.py --plot vcpu.json

To jump to a particular count in the result, use --idx

py init.py --plot vcpu.json --idx 15

SAVE_STATE config option

SAVE_STATE config option can be set in user.json. (See Configuration section below). It default to False.

Below behavior only applies, when set to True.

When scanning using a watchlist file, all patterns are tracked in json files stored in src/state folder.

File format is <watchlist_name>_<pattern_name>.json. For e.g. nifty_500_vcpu.json.

Only newly detected patterns are notified and plotted on charts.

To see all currently active patterns in market, use the --plot passing the json file from state folder

py init.py --plot state/nifty_500_vcpu.json

Scanning other Timeframes

By default, only the daily timeframe is scanned. You can specify the timeframe to scan with --tf option.

Assume you have daily stock data.

py init.py --tf weekly

py init.py --tf monthly

If intraday data is configured, you can also scan intraday timeframes.

py init.py --tf 15

py init.py --tf 2h

Multiple config files

While user.json is the default config file. You can define additional config files. For ex. a config file for intraday data or different markets.

Use the -c or --config passing the path to JSON file.

py init.py -c intra_config.json

Configuration

user.json is used for configuration and is auto-generated on first run.

Both absolute and relative file path are supported. Tilde or ~ for home directory symbol is also supported.

Parameter Description
DATA_PATH Required. Folder path for OHLC csv data.
SYM_LIST Optional. File path containing list of symbols, one per line. Override with -f or --file
SAVE_FOLDER Optional. Folder path to save charts as images. Override with --save
POST_SCAN_PLOT Default False. If True, plots the results on the chart after a scan.
SAVE_STATE Default False. If True, previously detected patterns will not be displayed in subsequent scans.
LOADER Optional. EODFileLoader (for daily) or IEODFileLoader for intraday data or any user-defined class
DEFAULT_TF Optional. Timeframe of OHLC file data stored in DATA_PATH. See below for details
  • LOADER can be either EODFileLoader for daily and higher timeframes or IEODFileLoader for intraday timeframes.
  • EODFileLoader uses daily as default timeframe.
  • IEODFileLoader uses 1min as the default timeframe.
  • If your data is stored in different timeframe, set the DEFAULT_TF accordingly.
  • If --tf is not used, the value of DEFAULT_TF or default timeframe of the Loader is used.

For IEODFileLoader, valid values for DEFAULT_TF are 1, 5, 10, 15, 25, 30, 60, 75, 125, 2h, 4h.

For EODFileLoader, valid values for DEFAULT_TF are daily, weekly and monthly.