Skip to content
Benny Thadikaran edited this page Nov 4, 2024 · 8 revisions

The configuration file for RRG-Lite uses a JSON file. By default, it looks for src/user.json. However, you can define multiple configuration files.

For a quick setup, refer to Steps to create a configuration file

Below is a sample configuration file set to its default values:

{
  "DATA_PATH": "",
  "WATCHLIST_FILE": null,
  "BENCHMARK": null,
  "PERIOD": 52,
  "WINDOW": 14,
  "LOADER": "EODFileLoader",
  "DEFAULT_TF": "daily",
  "DATE_COLUMN": "Date",
  "DATE_FORMAT": null
}

General Fields

  • DATA_PATH: (REQUIRED) - The path to the folder containing OHLC (Open, High, Low, Close) data files in CSV format.

Other Optional Fields

  • WATCHLIST_FILE: (OPTIONAL) - The path to the watchlist file (text or CSV file) with stock / ticker names listed one per line. See watchlist file format
  • LOADER: (OPTIONAL - Default EODFileLoader) - The class used for loading the OHLC data.
  • DEFAULT_TF: (OPTIONAL - Default daily) - The default timeframe for the OHLC data in your CSV files. Options depend on the Loader class:
    • "EODFileLoader": daily, weekly, monthly, quarterly.
  • DATE_COLUMN: (OPTIONAL - Default Date) - The name of the date column in your OHLC files. If the column is not named Date, specify the name here.

RRG Specific Fields

  • BENCHMARK: (OPTIONAL) The benchmark index. The name must match a filename in DATA_PATH.
    • For Nifty 50, a file named Nifty 50.csv must exist in DATA_PATH.
  • PERIOD: (OPTIONAL - Default 52) Number of candles of a timeframe to load.
  • WINDOW: (OPTIONAL - Default 14) Period used in moving average calculations

Watchlist file format

The file can be a text or CSV file. It can contain a list of stock or ticker names (One on each line)

The name must match the filename in the DATA_PATH folder. For example hdfcbank must match a file hdfcbank.csv. (Case sensitive)

hdfcbank
infy

If the ticker names are too long, an optional short name can be added separated by comma.

Nifty Consumer Durables,Cons. Dur
Nifty Media
Nifty IT

In the above example,

  • Cons. Dur will be displayed as label on charts instead of Nifty Consumer Durables.
  • Nifty Media and Nifty IT will be displayed as is, since there is no short name defined.

Steps to Create the Configuration File

  1. Create a New JSON File: Create a new file named user.json in the src folder.

  2. Set Up DATA_PATH: Specify the full file path to the folder containing your OHLC data files. (Must be a folder).

    "DATA_PATH": "path/to/ohlc/data"
  3. Set DATE_COLUMN (If Needed): If your OHLC files use a different date column name, specify it here. Otherwise, it defaults to "Date".

    "DATE_COLUMN": "Date"
  4. Provide WATCHLIST_FILE (Optional): Specify the path to your watchlist CSV file. See Watchlist file format

    "WATCHLIST_FILE": "path/to/watchlist/file"
  5. Save the Configuration File: Save the user.json file with the specified settings.

You can create multiple config files for different data sources.

To use a config file other than user.json, use the -c or --config followed by the file path to your config file.

py init.py -c bank.json

TROUBLESHOOTING

OHLC data must be a CSV file and contain Open, High, Low, Close columns to work correctly.

Windows users - Use forward slash / in your file paths to avoid JSON parsing errors. ~/path/to/folder