diff --git a/vnpy/trader/setting.py b/vnpy/trader/setting.py index 1dd8b0ff..77f07ece 100644 --- a/vnpy/trader/setting.py +++ b/vnpy/trader/setting.py @@ -36,7 +36,7 @@ SETTINGS = { # Load global setting from json file. SETTING_FILENAME = "vt_setting.json" -SETTINGS.update(load_json(SETTING_FILENAME)) +SETTINGS.update(load_json(SETTING_FILENAME, auto_save=False)) def get_settings(prefix: str = ""): diff --git a/vnpy/trader/utility.py b/vnpy/trader/utility.py index fb7daa95..dc23c702 100644 --- a/vnpy/trader/utility.py +++ b/vnpy/trader/utility.py @@ -246,7 +246,7 @@ def get_icon_path(filepath: str, ico_name: str): return str(icon_path) -def load_json(filename: str): +def load_json(filename: str, auto_save : bool = True): """ Load data from json file in temp path. """ @@ -257,7 +257,8 @@ def load_json(filename: str): data = json.load(f) return data else: - save_json(filename, {}) + if auto_save: + save_json(filename, {}) return {}