from jgtcore import readconfig, load_settings
# Load with specific options
config = readconfig(demo=True, export_env=True)
settings = load_settings(custom_path="/path/to/settings.json")
BELLOW IS STILL Supported on config/settings that will keep migrating to jgtcore (will only by a library for that and jgtutils will become just utilities but that is not completed yet.)
jgtcommon.readconfig() loads trading credentials and connection info from a JSON file. Lookup order:
config.json in the current directory.$HOME/.jgt/config.json./etc/jgt/config.json.JGT_CONFIG_JSON_SECRET (entire JSON string)JGT_CONFIG (JSON string)JGT_CONFIG_PATH (path to a JSON file)Set export_env=True to export keys (like user_id, password) as environment variables. Use demo=True to replace credentials with *_demo values if present.
jgtcommon.load_settings() merges settings from multiple locations in the following order (later entries override earlier ones):
/etc/jgt/settings.json and environment variable JGT_SETTINGS_SYSTEM$HOME/.jgt/settings.json and environment variable JGT_SETTINGS_USER.jgt/settings.json in the current directory.jgt/settings.yml, jgt.yml, _config.yml (YAML files)JGT_SETTINGS, JGT_SETTINGS_PROCESS-ls/--settings CLI optionThe merged dictionary is cached by get_settings() for repeated access.
Use the jgtset CLI to export settings to a .env file for shell sourcing.