add etf
This commit is contained in:
@@ -60,6 +60,8 @@ class AccountConfig:
|
||||
|
||||
# 当前账户启用的策略名称,例如 trend。
|
||||
strategy: str = ""
|
||||
# 为空时读取 py-client/etc/etf.yaml;非空路径相对于账户配置目录。
|
||||
etf_config_path: str = ""
|
||||
|
||||
|
||||
# load() 成功后保存已加载的配置,供策略模块直接读取。
|
||||
@@ -132,6 +134,11 @@ def load(
|
||||
Path(global_config.qmt_data_dir).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
account_config = AccountConfig(**_account_values(root / account_file))
|
||||
if account_config.etf_config_path:
|
||||
etf_path = Path(account_config.etf_config_path)
|
||||
account_config.etf_config_path = str(etf_path if etf_path.is_absolute() else root / etf_path)
|
||||
elif account_config.strategy.strip().lower() == 'etf':
|
||||
account_config.etf_config_path = str(root / 'etf.yaml')
|
||||
if account_config.buy_value <= 0 or account_config.grid_step_pct <= 0:
|
||||
raise ValueError("buy_value、grid_step_pct 必须大于 0")
|
||||
if type(account_config.zt_open_hands) is not int or account_config.zt_open_hands < 0:
|
||||
|
||||
Reference in New Issue
Block a user