Skip to content

Configuration

Benny Thadikaran edited this page Dec 1, 2023 · 6 revisions

The Final part of the 4 part series on Plot.py. If you haven't read the previous part, please use the links below:

EOD2 provides several configuration options to customize the scripts to your needs.

defs/Config.py contains all default configurations. However, it's not advisable to directly edit this file. Any future updates will overwrite these changes.

Instead, you create a user.json file in the src/defs folder and make your changes there.

If you have been using the scripts regularly, you may already have a user.json file. Open this file in a notepad or your favorite text/code editor.

If user.json does not exist, go ahead and create the file yourself.

If you're unfamiliar with JSON, I recommend using an Online JSON editor to avoid errors.

IMPORTANT: ALL configuration keys must be UPPER CASED

Overriding configuration

At the bottom of this wiki is a list of configuration options.

Let's take an example. I want to increase the number of candles plotted on the chart with plot.py. I use the PLOT_DAYS and PLOT_WEEKS and set it to 190 and 160.

{
  "PLOT_DAYS": 190,
  "PLOT_WEEKS": 160
}

Thats it! Save the file as user.json.

To see if your configuration is applied, run init.py using the -c or --config option.

py init.py -c

It will output the current configuration. You should find PLOT_DAYS and PLOT_WEEKS with the updated values.

If you face difficulties in configuration, raise an issue on this repo. I usually respond within a few hours or a day at most.

Common attributes for plot.py and dget.py

Attribute Default Value Argument option Description
DLV_L1 1 - Level 1 (Lowest) threshold for delivery multiple above average
DLV_L2 1.5 - Level 2 (Middle) threshold for delivery multiple above average
DLV_L3 2 - Level 3 (Highest) threshold for delivery multiple above average
DLV_AVG_LEN 60 - Length used to calculate the delivery average.
VOL_AVG_LEN 30 - Length used to calculate the volume average.

dget.py specific config

Attribute Default Value Argument option Description
DGET_DAYS 15 - Number of days delivery data to return when using the --lookup option.
DGET_AVG_DAYS 60 - Length used to calculate the delivery average and average qty per trade.

plot.py specific config

Attribute Default Value Argument option Description
PLOT_DAYS 160 --period Number of daily candles to plot. Use the --period option will override any changes in user.json or Config.py.
PLOT_WEEKS 140 --period Number of weekly candles to plot. Use the --period option will override any changes in user.json or Config.py.
PLOT_M_RS_LEN_D 60 - SMA length to calculate Mansfield Relative Strength on the daily timeframe.
PLOT_M_RS_LEN_W 52 - SMA length to calculate Mansfield Relative Strength on a weekly timeframe.
PLOT_RS_INDEX nifty 50 - Index used to calculate Dorsey and Mansfield Relative strength. The Index Name must match the filename in the eod2_data/daily folder. See eod2_data/sector_watchlist.csv for a list of available indexes.
PLOT_SIZE Screen size in inches derived from tkinter module - Image dimensions when saving charts to file using --save option. The value must be a list containing width and height in inches. Example [16, 9]. Use it if the saved image has a lot of whitespace around the chart.

plot.py chart theme and colors

You can find the list of available color names here: Matplotlib CSS colors.

Attribute Default Value Argument option Description
PLOT_CHART_STYLE tradingview - Chart theme. One of binance, binancedark, blueskies, brasil, charles, checkers, classic, default, ibd, kenan, mike, nightclouds, sas, starsandstripes, tradingview, yahoo
PLOT_CHART_TYPE candle - Chart type. One of ohlc, candle, line
PLOT_RS_COLOR darkblue - Dorsey RS line color
PLOT_M_RS_COLOR darkgreen - Mansfield RS line color
PLOT_DLV_L1_COLOR red - Delivery mode L1 bar color
PLOT_DLV_L2_COLOR darkorange - Delivery mode L2 bar color
PLOT_DLV_L3_COLOR royalblue - Delivery mode L3 bar color
PLOT_DLV_DEFAULT_COLOR darkgrey - Delivery mode default color

Other configurations

Attribute Default Value Argument option Description
AMIBROKER false - If true, converts bhavcopy to Amibroker format on data sync and saves it to src/eod2_data/amibroker/. Data has no adjustment for splits and bonuses.
AMI_UPDATE_DAYS 365 - The Number of days bhavcopy must be downloaded and formatted to Amibroker on first run. Only applies if src/eod2_data/amibroker/ is empty.
ADDITIONAL_INDICES [] - A list of additional indices updated with eod data. eod2_data/sector_watchlist.csv contains a list of indices currently updated in the eod2_data/daily folder. Indices names are case sensitive; check the NSE indices report for the correct casing. An Incorrect name will throw a Key Error. Example "ADDITIONAL_INDICES": ['nifty 50', 'nifty midcap 100']