add zt_open_hands
This commit is contained in:
@@ -50,6 +50,8 @@ class AccountConfig:
|
||||
enable_auto_ipo: bool = True
|
||||
signal_allow: list[str] = field(default_factory=list)
|
||||
excluded_codes: list[str] = field(default_factory=list)
|
||||
# ZT 开仓及每次补仓手数(每手 100 股);0 表示不启动。
|
||||
zt_open_hands: int = 0
|
||||
zt_sell_ratio: float = 0.5
|
||||
zt_buy_fall_pct: float = 1.0
|
||||
zt_max_price: float = 200.0
|
||||
@@ -130,6 +132,8 @@ def load(
|
||||
account_config = AccountConfig(**_yaml(root / account_file))
|
||||
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:
|
||||
raise ValueError("zt_open_hands 必须为非负整数,0 表示不启动 ZT 策略")
|
||||
if not 0 < account_config.zt_sell_ratio <= 1:
|
||||
raise ValueError("zt_sell_ratio 必须在 (0, 1] 区间")
|
||||
if account_config.zt_buy_fall_pct <= 0 or account_config.zt_max_price <= 0:
|
||||
|
||||
Reference in New Issue
Block a user