Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyConfig(args *CmdArgs, c *Config) *errs.Error
- func ClearRefineMap()
- func DumpYaml(desensitize bool) ([]byte, *errs.Error)
- func EnsureStratRefineTF(stratName, timeframe string) string
- func GetAccLeverage(account string) float64
- func GetDataDir() string
- func GetDataDirSafe() string
- func GetExchangeProxy(exgId string) (string, *errs.Error)
- func GetLangMsg(code, defVal string) string
- func GetLangMsgBy(lang, code, defVal string) string
- func GetLogsDir() string
- func GetStakeAmount(accName string) float64
- func GetStaticPairs() ([]string, bool)
- func GetStratDir() string
- func GetStratRefineTF(stratName, timeframe string) (string, bool)
- func GetTakeOverTF(pair, defTF string) string
- func LoadConfig(args *CmdArgs) *errs.Error
- func LoadLangMessages()
- func LoadPerfs(inDir string)
- func MergeAccounts() map[string]*AccountConfig
- func MergeConfigPaths(paths []string, skips ...string) (string, error)
- func ParsePairs(pairs ...string) ([]string, *errs.Error)
- func ParsePath(path string) string
- func ParseTimeRange(timeRange string) (int64, int64, error)
- func ReadLangFile(lang, name string) (string, error)
- func SetLangMsgs(msgs map[string]map[string]string)
- func SetRunPolicy(index bool, items ...*RunPolicyConfig) *errs.Error
- func SplitTimeFrames(timeframes string) []string
- func UpdateLocal(configPaths []string, configData string, noDefault bool) *errs.Error
- type APIServerConfig
- type AccPwdRole
- type AccountConfig
- type ApiSecretConfig
- type ArrString
- type BtInLiveConfig
- type CmdArgs
- type CommonPairFilter
- type Config
- func (c *Config) Apply(args *CmdArgs) error
- func (c *Config) Clone() *Config
- func (c *Config) Desensitize() *Config
- func (c *Config) DumpYaml() ([]byte, *errs.Error)
- func (c *Config) HashCode() (string, *errs.Error)
- func (c *Config) RunTimeFrames() []string
- func (c *Config) ShowPairs() string
- func (c *Config) Strats() []string
- type DatabaseConfig
- type ExchangeConfig
- type ExgApiSecrets
- type ExportConfig
- type MailConfig
- type MarketRange
- type MarketSymbolsRange
- type MarketTFSymbolsRange
- type PairMgrConfig
- type RunPolicyConfig
- func (c *RunPolicyConfig) Clone() *RunPolicyConfig
- func (c *RunPolicyConfig) Def(k string, dv float64, p *core.Param) float64
- func (c *RunPolicyConfig) DefInt(k string, dv int, p *core.Param) int
- func (c *RunPolicyConfig) HyperParams() []*core.Param
- func (c *RunPolicyConfig) ID() string
- func (c *RunPolicyConfig) IsInt(k string) bool
- func (c *RunPolicyConfig) KeepHyperOnly(keys ...string)
- func (c *RunPolicyConfig) Key() string
- func (c *RunPolicyConfig) OdDirt() int
- func (c *RunPolicyConfig) PairDup(pair string) (*RunPolicyConfig, bool)
- func (c *RunPolicyConfig) Param(k string, dv float64) float64
- func (c *RunPolicyConfig) ToYaml() string
- type StratPerfConfig
- type TimeTuple
- type UserConfig
Constants ¶
const (
MinPairCronGapMS = 1800000 // 交易对刷新最小间隔半小时
)
Variables ¶
var ( Data Config Args *CmdArgs Accounts map[string]*AccountConfig // Exchange tradable account 交易所可交易账户 BakAccounts map[string]*AccountConfig // Exchange account, not tradable 交易所账户,不可交易 DefAcc = "default" // For non-real trading, the default key of the account (backtesting, simulated trading) 非实盘交易时,账户默认的key(回测、模拟交易) Name string Loaded bool Leverage float64 LimitVolSecs int // How long the limit order is expected to wait for execution, in seconds 限价单预期等待多长时间成交,单位秒 PutLimitSecs int // Only limit orders executed within this expected time will be submitted to the exchange. 在此预期时间内成交的限价单,才提交到交易所 AccountPullSecs int OdBookTtl int64 StopEnterBars int // The entry limit order will be canceled if it is not filled after the number of candles. 入场限价单超过多少个蜡烛未成交则取消 OrderType string PreFire float64 MarginAddRate float64 // When trading contracts, if a loss occurs and the loss reaches this value of the initial margin ratio, additional margin will be required to avoid forced liquidation. 交易合约时,如出现亏损,亏损达到初始保证金比率的此值时,进行追加保证金,避免强平 ChargeOnBomb bool TakeOverStrat string CloseOnStuck int StakeAmount float64 // The amount of a single order, the priority is lower than StakePct 单笔开单金额,优先级低于StakePct StakePct float64 // Percentage of single bill amount 单笔开单金额百分比 MaxStakeAmt float64 // Maximum bill amount for a single transaction 单笔最大开单金额 OpenVolRate float64 // When opening an order without specifying a quantity, the multiple of the maximum allowed order quantity/average candle trading volume, defaults to 1 未指定数量开单时,最大允许开单数量/平均蜡烛成交量的倍数,默认1 MinOpenRate float64 // When the wallet balance is less than the single amount, orders are allowed to be issued when it reaches this ratio of the single amount. 钱包余额不足单笔金额时,达到单笔金额的此比例则允许开单 LowCostAction string // Actions taken when stake amount less than the minimum amount 花费不足最小金额时的动作:ignore, keep BTNetCost float64 // Order placement delay during backtesting, simulated slippage, unit seconds 回测时下单延迟,模拟滑点,单位秒 RelaySimUnFinish bool // 交易新品种时(回测/实盘),是否从开始时间未平仓订单接力开始交易 NTPLangCode string // NTP真实时间同步所用langCode,默认none不启用 ShowLangCode string BTInLive *BtInLiveConfig OrderBarMax int // 查找开始时间未平仓订单向前模拟最大bar数量 MaxOpenOrders int MaxSimulOpen int WalletAmounts map[string]float64 DrawBalanceOver float64 StakeCurrency []string StakeCurrencyMap map[string]bool FatalStop map[int]float64 FatalStopHours int TimeRange *TimeTuple RunTimeframes []string KlineSource string WatchJobs map[string][]string RunPolicy []*RunPolicyConfig StratPerf *StratPerfConfig Pairs []string PairMgr *PairMgrConfig PairFilters []*CommonPairFilter Exchange *ExchangeConfig DataDir string Database *DatabaseConfig SpiderAddr string APIServer *APIServerConfig RPCChannels map[string]map[string]interface{} Mail *MailConfig Webhook map[string]map[string]string )
Functions ¶
func ClearRefineMap ¶ added in v0.2.24
func ClearRefineMap()
func EnsureStratRefineTF ¶ added in v0.2.24
func GetAccLeverage ¶
func GetDataDir ¶
func GetDataDir() string
func GetDataDirSafe ¶ added in v0.2.9
func GetDataDirSafe() string
func GetLangMsg ¶ added in v0.2.18
func GetLangMsgBy ¶ added in v0.2.23
func GetLogsDir ¶ added in v0.2.0
func GetLogsDir() string
func GetStakeAmount ¶
func GetStaticPairs ¶ added in v0.2.17
GetStaticPairs 合并pairs和run_policy.pairs返回,bool表示是否需要动态计算
func GetStratDir ¶
func GetStratDir() string
func GetStratRefineTF ¶ added in v0.2.24
func GetTakeOverTF ¶
func LoadConfig ¶
func LoadLangMessages ¶ added in v0.2.18
func LoadLangMessages()
func MergeAccounts ¶ added in v0.2.12
func MergeAccounts() map[string]*AccountConfig
MergeAccounts 合并当前多个账户为1个,返回合并前的账户。 用于实盘时单账户回测
func MergeConfigPaths ¶ added in v0.2.12
func ParsePairs ¶ added in v0.2.21
ParsePairs parse short pairs to standard pair format
func ParseTimeRange ¶ added in v0.1.24
ParseTimeRange parses time range string in format "YYYYMMDD-YYYYMMDD"
func ReadLangFile ¶ added in v0.2.18
func SetLangMsgs ¶ added in v0.2.29
SetLangMsgs 设置多语言消息,用于外部模块注入自己的多语言文本 msgs 格式: map[code]map[lang]text
func SetRunPolicy ¶ added in v0.2.14
func SetRunPolicy(index bool, items ...*RunPolicyConfig) *errs.Error
SetRunPolicy set run_policy and their indexs
func SplitTimeFrames ¶ added in v0.2.24
SplitTimeFrames split comma-separated timeframes string to []string
Types ¶
type APIServerConfig ¶
type APIServerConfig struct {
Enable bool `yaml:"enable" mapstructure:"enable"` // Whether to enable 是否启用
BindIPAddr string `yaml:"bind_ip" mapstructure:"bind_ip"` // Binding address, 0.0.0.0 means exposed to the public network 绑定地址,0.0.0.0表示暴露到公网
Port int `yaml:"port" mapstructure:"port"` // LOCAL LISTENING PORT 本地监听端口
Verbosity string `yaml:"verbosity" mapstructure:"verbosity"` // Detail level 详细程度
JWTSecretKey string `yaml:"jwt_secret_key,omitempty" mapstructure:"jwt_secret_key"` // Key used for password encryption 用于密码加密的密钥
CORSOrigins []string `yaml:"CORS_origins,flow" mapstructure:"CORS_origins"` // When accessing banweb, you need to add the address of banweb here to allow access. banweb访问时,要这里添加banweb的地址放行
Users []*UserConfig `yaml:"users" mapstructure:"users"` // Login user 登录用户
}
type AccPwdRole ¶ added in v0.2.1
type AccountConfig ¶
type AccountConfig struct {
NoTrade bool `yaml:"no_trade,omitempty" mapstructure:"no_trade"`
StakeRate float64 `yaml:"stake_rate,omitempty" mapstructure:"stake_rate"` // Multiple of billing amount relative to benchmark 相对基准的开单金额倍数
StakePctAmt float64 `yaml:"-"` // The amount currently allowed when billing by percentage按百分比开单时,当前允许的金额
MaxStakeAmt float64 `yaml:"max_stake_amt,omitempty" mapstructure:"max_stake_amt"` // Maximum amount allowed for a single transaction 允许的单笔最大金额
Leverage float64 `yaml:"leverage,omitempty" mapstructure:"leverage"`
MaxPair int `yaml:"max_pair,omitempty" mapstructure:"max_pair"`
MaxOpenOrders int `yaml:"max_open_orders,omitempty" mapstructure:"max_open_orders"`
RPCChannels []map[string]interface{} `yaml:"rpc_channels,omitempty" mapstructure:"rpc_channels"`
APIServer *AccPwdRole `yaml:"api_server,omitempty" mapstructure:"api_server"`
Exchanges map[string]*ExgApiSecrets `yaml:",inline" mapstructure:",remain"`
}
AccountConfig Configuration to store API keys and secrets 存储 API 密钥和秘密的配置
func (*AccountConfig) GetApiSecret ¶ added in v0.2.1
func (a *AccountConfig) GetApiSecret() *ApiSecretConfig
type ApiSecretConfig ¶ added in v0.2.1
type BtInLiveConfig ¶ added in v0.2.18
type CmdArgs ¶
type CmdArgs struct {
Configs ArrString
ConfigData string
Logfile string
DataDir string
NoCompress bool
NoDefault bool
LogLevel string
TimeRange string
TimeStart string
TimeEnd string
RawTimeFrames string
TimeFrames []string
StakeAmount float64
StakePct float64
RawPairs string
Pairs []string
RawTables string
Tables []string
Force bool
WithSpider bool
Medium string
MaxPoolSize int
InPath string
PrgOut string
OutPath string
OutType string // output data type
AdjType string // adjustment type: 复权类型: pre,post,none
TimeZone string
ExgReal string
OptRounds int // Hyperparameter optimization single task execution round 超参数优化单任务执行轮次
Concur int // Hyperparameter optimization of multi-process concurrency 超参数优化多进程并发数量
Sampler string // Hyperparameter optimization methods 超参数优化的方法: tpe/bayes/random/cmaes/ipop-cmaes/bipop-cmaes
EachPairs bool // Execute target by target 逐个标的执行
ReviewPeriod string // During continuous parameter adjustment and backtesting, the period of parameter adjustment review 持续调参回测时,调参回顾的周期
RunPeriod string // During continuous parameter adjustment and backtesting, the effective running period after parameter adjustment 持续调参回测时,调参后有效运行周期
Picker string // Method for selecting targets from multiple hyperparameter optimization results 从多个超参数优化结果中挑选目标的方法
Alpha float64 // the smoothing factor of calculate EMA 计算EMA的平滑因子
PairPicker string // pairs picker for hyper opt
InType string // Input file data type 输入文件的数据类型
RunEveryTF string // run once every n timeframe
BatchSize int
Separate bool // Used for backtesting. When true, the strategy combination is tested separately. 用于回测,true时策略组合单独测试
Inited bool
DeadLock bool
}
func (*CmdArgs) BindToFlag ¶ added in v0.2.2
type CommonPairFilter ¶
type CommonPairFilter struct {
Name string `yaml:"name" mapstructure:"name"`
Items map[string]interface{} `yaml:",inline" mapstructure:",remain"`
}
UNIVERSAL FILTER 通用的过滤器
type Config ¶
type Config struct {
Name string `yaml:"name,omitempty" mapstructure:"name"`
Env string `yaml:"env,omitempty" mapstructure:"env"`
Leverage float64 `yaml:"leverage,omitempty" mapstructure:"leverage"`
LimitVolSecs int `yaml:"limit_vol_secs,omitempty" mapstructure:"limit_vol_secs"`
PutLimitSecs int `yaml:"put_limit_secs,omitempty" mapstructure:"put_limit_secs"`
AccountPullSecs int `yaml:"account_pull_secs,omitempty" mapstructure:"account_pull_secs"`
MarketType string `yaml:"market_type,omitempty" mapstructure:"market_type"`
ContractType string `yaml:"contract_type,omitempty" mapstructure:"contract_type"`
OdBookTtl int64 `yaml:"odbook_ttl,omitempty" mapstructure:"odbook_ttl"`
StopEnterBars int `yaml:"stop_enter_bars,omitempty" mapstructure:"stop_enter_bars"`
ConcurNum int `yaml:"concur_num,omitempty" mapstructure:"concur_num"`
OrderType string `yaml:"order_type,omitempty" mapstructure:"order_type"`
PreFire float64 `yaml:"prefire,omitempty" mapstructure:"prefire"`
MarginAddRate float64 `yaml:"margin_add_rate,omitempty" mapstructure:"margin_add_rate"`
ChargeOnBomb bool `yaml:"charge_on_bomb,omitempty" mapstructure:"charge_on_bomb"`
TakeOverStrat string `yaml:"take_over_strat,omitempty" mapstructure:"take_over_strat"`
CloseOnStuck int `yaml:"close_on_stuck,omitempty" mapstructure:"close_on_stuck"`
StakeAmount float64 `yaml:"stake_amount,omitempty" mapstructure:"stake_amount"`
StakePct float64 `yaml:"stake_pct,omitempty" mapstructure:"stake_pct"`
MaxStakeAmt float64 `yaml:"max_stake_amt,omitempty" mapstructure:"max_stake_amt"`
OpenVolRate float64 `yaml:"open_vol_rate,omitempty" mapstructure:"open_vol_rate"`
MinOpenRate float64 `yaml:"min_open_rate,omitempty" mapstructure:"min_open_rate"`
LowCostAction string `yaml:"low_cost_action,omitempty" mapstructure:"low_cost_action"`
BTNetCost float64 `yaml:"bt_net_cost,omitempty" mapstructure:"bt_net_cost"`
RelaySimUnFinish bool `yaml:"relay_sim_unfinish,omitempty" mapstructure:"relay_sim_unfinish"`
NTPLangCode string `yaml:"ntp_lang_code,omitempty" mapstructure:"ntp_lang_code"`
ShowLangCode string `yaml:"show_lang_code,omitempty" mapstructure:"show_lang_code"`
BTInLive *BtInLiveConfig `yaml:"bt_in_live,omitempty" mapstructure:"bt_in_live"`
OrderBarMax int `yaml:"order_bar_max,omitempty" mapstructure:"order_bar_max"`
MaxOpenOrders int `yaml:"max_open_orders,omitempty" mapstructure:"max_open_orders"`
MaxSimulOpen int `yaml:"max_simul_open,omitempty" mapstructure:"max_simul_open"`
WalletAmounts map[string]float64 `yaml:"wallet_amounts,omitempty" mapstructure:"wallet_amounts"`
DrawBalanceOver float64 `yaml:"draw_balance_over,omitempty" mapstructure:"draw_balance_over"`
StakeCurrency []string `yaml:"stake_currency,omitempty,flow" mapstructure:"stake_currency"`
FatalStop map[string]float64 `yaml:"fatal_stop,omitempty" mapstructure:"fatal_stop"`
FatalStopHours int `yaml:"fatal_stop_hours,omitempty" mapstructure:"fatal_stop_hours"`
TimeRangeRaw string `yaml:"timerange,omitempty" mapstructure:"timerange"`
TimeStart string `yaml:"time_start,omitempty" mapstructure:"time_start"`
TimeEnd string `yaml:"time_end,omitempty" mapstructure:"time_end"`
TimeRange *TimeTuple `yaml:"-" json:"-" mapstructure:"-"`
TimeFrames string `yaml:"timeframes" mapstructure:"timeframes"`
RunTimeframes []string `yaml:"run_timeframes,omitempty,flow" mapstructure:"run_timeframes"`
KlineSource string `yaml:"kline_source,omitempty" mapstructure:"kline_source"`
WatchJobs map[string][]string `yaml:"watch_jobs,omitempty" mapstructure:"watch_jobs"`
RunPolicy []*RunPolicyConfig `yaml:"run_policy,omitempty" mapstructure:"run_policy"`
StratPerf *StratPerfConfig `yaml:"strat_perf,omitempty" mapstructure:"strat_perf"`
Pairs []string `yaml:"pairs,omitempty,flow" mapstructure:"pairs"`
PairMgr *PairMgrConfig `yaml:"pairmgr,omitempty" mapstructure:"pairmgr"`
PairFilters []*CommonPairFilter `yaml:"pairlists,omitempty" mapstructure:"pairlists"`
Accounts map[string]*AccountConfig `yaml:"accounts,omitempty" mapstructure:"accounts,omitempty"`
Exchange *ExchangeConfig `yaml:"exchange,omitempty" mapstructure:"exchange"`
Database *DatabaseConfig `yaml:"database,omitempty" mapstructure:"database"`
SpiderAddr string `yaml:"spider_addr,omitempty" mapstructure:"spider_addr"`
APIServer *APIServerConfig `yaml:"api_server,omitempty" mapstructure:"api_server"`
RPCChannels map[string]map[string]interface{} `yaml:"rpc_channels,omitempty" mapstructure:"rpc_channels"`
Mail *MailConfig `yaml:"mail,omitempty" mapstructure:"mail"`
Webhook map[string]map[string]string `yaml:"webhook,omitempty" mapstructure:"webhook"`
}
Config Is the root configuration structure 是根配置结构体
func GetConfig ¶ added in v0.1.12
GetConfig get config from args
args: NoDefault, Configs, TimeRange, MaxPoolSize, StakeAmount, StakePct, TimeFrames, Pairs
func ParseConfigs ¶ added in v0.2.18
func ParseYmlConfig ¶ added in v0.2.18
func (*Config) Desensitize ¶ added in v0.1.27
Desensitize 屏蔽配置对象中的敏感信息 database.url exchange.account_*.*.(api_key|api_secret) rpc_channels.*.*secret api_server.jwt_secret_key api_server.users[*].pwd
func (*Config) RunTimeFrames ¶ added in v0.2.24
type DatabaseConfig ¶
type ExchangeConfig ¶
type ExchangeConfig struct {
Name string `yaml:"name" mapstructure:"name"`
Items map[string]map[string]interface{} `yaml:",inline" mapstructure:",remain"`
}
ExchangeConfig Represents the configuration information of the exchange 表示交易所的配置信息
type ExgApiSecrets ¶ added in v0.2.1
type ExgApiSecrets struct {
Prod *ApiSecretConfig `yaml:"prod,omitempty" mapstructure:"prod"`
Test *ApiSecretConfig `yaml:"test,omitempty" mapstructure:"test"`
}
type ExportConfig ¶ added in v0.1.24
type ExportConfig struct {
Klines []*MarketTFSymbolsRange `yaml:"klines"`
AdjFactors []*MarketSymbolsRange `yaml:"adj_factors"`
Calendars []*MarketRange `yaml:"calendars"`
}
ExportConfig represents the export configuration
func GetExportConfig ¶ added in v0.1.24
func GetExportConfig(path string) (*ExportConfig, *errs.Error)
type MailConfig ¶ added in v0.2.18
type MarketRange ¶ added in v0.1.24
type MarketSymbolsRange ¶ added in v0.1.24
type MarketSymbolsRange struct {
*MarketRange `yaml:",inline"`
Symbols []string `yaml:"symbols,flow"`
}
type MarketTFSymbolsRange ¶ added in v0.1.24
type MarketTFSymbolsRange struct {
*MarketSymbolsRange `yaml:",inline"`
TimeFrames []string `yaml:"timeframes,flow"`
}
type PairMgrConfig ¶
type PairMgrConfig struct {
Cron string `yaml:"cron" mapstructure:"cron"`
// Offset limited quantity selection. 偏移限定数量选择。
Offset int `yaml:"offset" mapstructure:"offset,omitempty"`
// Limit the number of currencies 限制币种数量
Limit int `yaml:"limit" mapstructure:"limit,omitempty"`
// apply filters to static pairs force
ForceFilters bool `yaml:"force_filters" mapstructure:"force_filters,omitempty"`
// hold/close 品种切换时保留还是退出仓位
PosOnRotation string `yaml:"pos_on_rotation" mapstructure:"pos_on_rotation"`
UseLatest bool `yaml:"use_latest" mapstructure:"use_latest"`
}
type RunPolicyConfig ¶
type RunPolicyConfig struct {
Name string `yaml:"name" mapstructure:"name"`
Filters []*CommonPairFilter `yaml:"filters,omitempty" mapstructure:"filters"`
TimeFrames string `yaml:"timeframes" mapstructure:"timeframes"`
RunTimeframes []string `yaml:"run_timeframes,omitempty,flow" mapstructure:"run_timeframes"`
RefineTF interface{} `yaml:"refine_tf" mapstructure:"refine_tf"`
MaxPair int `yaml:"max_pair,omitempty" mapstructure:"max_pair"`
MaxOpen int `yaml:"max_open,omitempty" mapstructure:"max_open"`
MaxSimulOpen int `yaml:"max_simul_open,omitempty" mapstructure:"max_simul_open"`
OrderBarMax int `yaml:"order_bar_max,omitempty" mapstructure:"order_bar_max"`
StakeRate float64 `yaml:"stake_rate,omitempty" mapstructure:"stake_rate"`
Dirt string `yaml:"dirt,omitempty" mapstructure:"dirt"`
StopLoss interface{} `yaml:"stop_loss,omitempty" mapstructure:"stop_loss"`
StratPerf *StratPerfConfig `yaml:"strat_perf,omitempty" mapstructure:"strat_perf"`
Pairs []string `yaml:"pairs,omitempty,flow" mapstructure:"pairs"`
Params map[string]float64 `yaml:"params,omitempty" mapstructure:"params"`
PairParams map[string]map[string]float64 `yaml:"pair_params,omitempty" mapstructure:"pair_params"`
More map[string]interface{} `yaml:",inline" mapstructure:",remain"`
Score float64
Index int // index in run_policy array
// contains filtered or unexported fields
}
The strategy to run, multiple strategies can be run at the same time 运行的策略,可以多个策略同时运行
func (*RunPolicyConfig) Clone ¶
func (c *RunPolicyConfig) Clone() *RunPolicyConfig
func (*RunPolicyConfig) HyperParams ¶
func (c *RunPolicyConfig) HyperParams() []*core.Param
func (*RunPolicyConfig) IsInt ¶ added in v0.1.24
func (c *RunPolicyConfig) IsInt(k string) bool
func (*RunPolicyConfig) KeepHyperOnly ¶
func (c *RunPolicyConfig) KeepHyperOnly(keys ...string)
KeepHyperOnly Only keep the given hyperparameters for optimization and remove other hyperparameters
func (*RunPolicyConfig) Key ¶ added in v0.1.7
func (c *RunPolicyConfig) Key() string
func (*RunPolicyConfig) OdDirt ¶
func (c *RunPolicyConfig) OdDirt() int
func (*RunPolicyConfig) PairDup ¶
func (c *RunPolicyConfig) PairDup(pair string) (*RunPolicyConfig, bool)
func (*RunPolicyConfig) ToYaml ¶
func (c *RunPolicyConfig) ToYaml() string
type StratPerfConfig ¶ added in v0.1.12
type StratPerfConfig struct {
Enable bool `yaml:"enable" mapstructure:"enable"`
MinOdNum int `yaml:"min_od_num,omitempty" mapstructure:"min_od_num"`
MaxOdNum int `yaml:"max_od_num,omitempty" mapstructure:"max_od_num"`
MinJobNum int `yaml:"min_job_num,omitempty" mapstructure:"min_job_num"`
MidWeight float64 `yaml:"mid_weight,omitempty" mapstructure:"mid_weight"`
BadWeight float64 `yaml:"bad_weight,omitempty" mapstructure:"bad_weight"`
}
func (*StratPerfConfig) Validate ¶ added in v0.1.12
func (p *StratPerfConfig) Validate()
type UserConfig ¶
type UserConfig struct {
Username string `yaml:"user,omitempty" mapstructure:"user"` // 用户名
Password string `yaml:"pwd,omitempty" mapstructure:"pwd"` // 密码
AllowIPs []string `yaml:"allow_ips" mapstructure:"allow_ips"` // Allow access from specific IP addresses 允许从特定IP地址访问
AccRoles map[string]string `yaml:"acc_roles,omitempty" mapstructure:"acc_roles"` // Role permissions for different accounts 对不同账户的角色权限
ExpireHours float64 `yaml:"exp_hours" mapstructure:"exp_hours"` // Token expiration time, default 168 hours token过期时间,默认168小时
}
func GetApiUsers ¶ added in v0.2.1
func GetApiUsers() []*UserConfig