# Path: vnpy/trader/utility.py
# def load_json(filename: str) -> dict:
#     """
#     Load data from json file in temp path.
#     """
#     filepath = get_file_path(filename)
# 
#     if filepath.exists():
#         with open(filepath, mode="r", encoding="UTF-8") as f:
#             data = json.load(f)
#         return data
#     else:
#         save_json(filename, {})
#         return {}


from logging import CRITICAL
from typing import Dict, Any
from tzlocal import get_localzone
from .utility import load_json
    "font.size": 12,

    "log.active": True,
    "log.level": CRITICAL,
    "log.console": True,
    "log.file": True,

    "email.server": "smtp.qq.com",
    "email.port": 465,
    "email.username": "",
    "email.password": "",
    "email.sender": "",
    "email.receiver": "",

    "datafeed.name": "",
    "datafeed.username": "",
    "datafeed.password": "",

    "database.timezone": get_localzone().zone,
    "database.name": "sqlite",
    "database.database": "database.db",
    "database.host": "",
    "database.port": 0,
    "database.user": "",
    "database.password": ""
}


# Load global setting from json file.
SETTING_FILENAME: str = "vt_setting.json"

# Path: vnpy/trader/utility.py
# def load_json(filename: str) -> dict:
#     """
#     Load data from json file in temp path.
#     """
#     filepath = get_file_path(filename)
# 
#     if filepath.exists():
#         with open(filepath, mode="r", encoding="UTF-8") as f:
#             data = json.load(f)
#         return data
#     else:
#         save_json(filename, {})
#         return {}


# Path: vnpy/trader/setting.py
from logging import CRITICAL
from typing import Dict, Any
from tzlocal import get_localzone
from .utility import load_json

    "font.size": 12,

    "log.active": True,
    "log.level": CRITICAL,
    "log.console": True,
    "log.file": True,

    "email.server": "smtp.qq.com",
    "email.port": 465,
    "email.username": "",
    "email.password": "",
    "email.sender": "",
    "email.receiver": "",

    "datafeed.name": "",
    "datafeed.username": "",
    "datafeed.password": "",

    "database.timezone": get_localzone().zone,
    "database.name": "sqlite",
    "database.database": "database.db",
    "database.host": "",
    "database.port": 0,
    "database.user": "",
    "database.password": ""
}


# Load global setting from json file.
SETTING_FILENAME: str = "vt_setting.json"

SETTINGS.update(load_json(SETTING_FILENAME))