dev 5
This commit is contained in:
@@ -17,21 +17,29 @@ var (
|
||||
)
|
||||
|
||||
type GlobalConfig struct {
|
||||
QMTBaseURL string `yaml:"qmt_base_url"`
|
||||
QMTToken string `yaml:"qmt_token"`
|
||||
APIHost string `yaml:"api_host"`
|
||||
QMTDataDir string `yaml:"qmt_data_dir"`
|
||||
Hosts map[string]string `yaml:"hosts"`
|
||||
QMTBaseURL string `yaml:"qmt_base_url"`
|
||||
QMTToken string `yaml:"qmt_token"`
|
||||
APIHost string `yaml:"api_host"`
|
||||
QMTDataDir string `yaml:"qmt_data_dir"`
|
||||
Hosts map[string]string `yaml:"hosts"`
|
||||
Signals map[string]SignalConfig `yaml:"signals"`
|
||||
}
|
||||
|
||||
type SignalConfig struct {
|
||||
Url string `yaml:"url"`
|
||||
Timezone string `yaml:"timezone"`
|
||||
GtLastPriceIsOpen bool `yaml:"gt_last_price_is_open"`
|
||||
}
|
||||
|
||||
type AccountConfig struct {
|
||||
AccountID string `yaml:"account_id"`
|
||||
HostKey string `yaml:"host_key"`
|
||||
BuyValue float64 `yaml:"buy_value"`
|
||||
MinCashRatio float64 `yaml:"min_cash_ratio"`
|
||||
LossTriggerPct float64 `yaml:"loss_trigger_pct"`
|
||||
GridStepPct float64 `yaml:"grid_step_pct"`
|
||||
MinProfitPct float64 `yaml:"min_profit_pct"`
|
||||
AccountID string `yaml:"account_id"`
|
||||
HostKey string `yaml:"host_key"`
|
||||
BuyValue float64 `yaml:"buy_value"`
|
||||
MinCashRatio float64 `yaml:"min_cash_ratio"`
|
||||
LossTriggerPct float64 `yaml:"loss_trigger_pct"`
|
||||
GridStepPct float64 `yaml:"grid_step_pct"`
|
||||
MinProfitPct float64 `yaml:"min_profit_pct"`
|
||||
SignalAllow []string `yaml:"signal_allow"`
|
||||
}
|
||||
|
||||
// Load 根据 global.yaml 中的 hosts 映射加载当前计算机的账户配置。
|
||||
@@ -68,6 +76,7 @@ func Load(etcDir string) error {
|
||||
return fmt.Errorf("buy_value、grid_step_pct 和超时时间必须大于 0")
|
||||
}
|
||||
|
||||
account.HostKey = strings.ToLower(account.HostKey)
|
||||
Global = &global
|
||||
Account = &account
|
||||
|
||||
|
||||
Reference in New Issue
Block a user