Skip to content

Plot.py ‐ Watchlists and Presets

Benny Thadikaran edited this page Sep 8, 2023 · 12 revisions

2nd part of the 5 part series on Plot.py. If you haven't read the previous part, please use the links below:

So far we used --sym option with a single symbol. But we can pass multiple symbols as well.

py plot.py --sym tcs infy hcltech

The first chart will be displayed.

To switch to the next chart, press 'n' on the keyboard.

To switch to the previous chart, press 'p' on the keyboard.

Press 'q' to quit the chart at any time. To display the keyboard and mouse controls, press 'h'.

The old prompt interface has been disabled.

Resume a watchlist

When using a watchlist, quitting plot.py prompt using q saves your progress.

This feature is only available with --watch option or a preset with --watch.

Using the same watchlist, you can resume from the last chart by adding the -r or --resume.

Using prebuilt watchlists

Since its tedious to type the symbol names, you can create your own watchlists.

For now lets use a builtin watchlist named sectors

To load charts from sectors watchlist, use the --watch option passing the watchlist name.

py plot.py --watch sectors

Adding new Watchlists

To add a new watchlist, create a csv or txt file in the data folder with symbol names, one on each line.

mylist.csv

tcs
hdfcbank
m&m
reliance
tatamotors

Use the --watch-add option passing the watchlist name and the filename

py plot.py --watch-add mylist mylist.csv
# Saved watchlist 'mylist' with value 'mylist.csv'

Plot charts from watchlist

Load the watchlist with --watch

py plot.py --watch mylist

Now open defs/user.json.

{
   "WATCH": {
      "MYLIST": "mylist.csv"
   }
}

The user.json will override any default configuration. We will come to it later; for now all watchlists are stored in WATCH

Using --watch-add on an existing watchlist will overwrite the filename.

Organizing your watchlists

If you have many watchlists in the data folder, you can organise them in folders. Just make sure to pass the filepath relative to the data folder

py plot.py --watch-add it sectors/it.csv

py plot.py --watch-add bank sectors/bank.csv

Remove Watchlist

To remove a watchlist, use --watch-rm, passing the watchlist name.

py plot.py --watch-rm mylist
# Watchlist 'mylist' removed.

It will not delete the watchlist file in the data folder.

Using Presets

In the initial days, manually type the options to get used to them. But if running these commands daily or weekly, you may want to predefine these options in a preset.

Use the --preset-save passing a name.

py plot.py --watch sectors -tf weekly --sma 30 --m-rs -v --preset-save sectors-w

Next time, only use --preset option passing the preset name. It will load all the above options.

py plot.py --preset sectors-w

Remove a preset

To remove a preset, use --preset-rm passing the preset name.

py plot.py --preset-rm sectors-w

Listing presets and watchlists.

In case you forgot the preset or watchlist names, use --ls

py plot.py --ls
# WatchLists: sectors
# No Presets

In the next section, we look at drawing trend and trading lines