StrategyParamHelper

StockSharp.Algo.Strategies

StrategyParam的辅助类.

方法

CanOptimize
public static bool CanOptimize(Type type)
result = StrategyParamHelper.CanOptimize(type)

检查可以优化参数.

type
参数值的类型 。

返回值: ,如果可以优化参数,否则,

CreateParam
public static IStrategyParam CreateParam(Type type, string id)
result = StrategyParamHelper.CreateParam(type, id)

创建参数 。

type
类型
id
编号

返回值: IStrategyParam

GetIterationsCount
public static int GetIterationsCount(IStrategyParam param)
result = StrategyParamHelper.GetIterationsCount(param)

获取参数的优化迭代数 。

param
IStrategyParam

返回值: 复次数相.

GetIterationsCount
public static int GetIterationsCount(Type type, object from, object to, object step, IEnumerable values)
result = StrategyParamHelper.GetIterationsCount(type, from, to, step, values)

Get the number of optimization iterations for a parameter shape.

type
The type of the parameter value.
from
Initial value, or .
to
Final value, or .
step
Increment value, or .
values
Explicit values, or . Win over the range when not empty.

返回值: Number of iterations, zero when the shape defines no values of its own.

GetName
public static string GetName(IStrategyParam param)
result = StrategyParamHelper.GetName(param)

获取参数名称 。

param
IStrategyParam

返回值: 显示名称 。

GetOptimizationValues
public static IEnumerable<object> GetOptimizationValues(Type type, object from, object to, object step, IEnumerable values)
result = StrategyParamHelper.GetOptimizationValues(type, from, to, step, values)

Get all optimization values for a parameter shape.

type
The type of the parameter value.
from
Initial value, or .
to
Final value, or .
step
Increment value, or .
values
Explicit values, or . Win over the range when not empty.

返回值: Enumerable of all optimization values, empty when the shape defines none of its own.

GetOptimizationValues
public static IEnumerable<object> GetOptimizationValues(IStrategyParam param)
result = StrategyParamHelper.GetOptimizationValues(param)

获取参数的所有优化值 。

param
IStrategyParam

返回值: 包含所有优化值。

GetRandom
public static object GetRandom(IStrategyParam param, IRandomProvider provider)
result = StrategyParamHelper.GetRandom(param, provider)

Generate a random value within the optimization range for the parameter.

param
IStrategyParam
provider
Where the value is drawn from. A search worth keeping the result of is worth running again, so the caller states the source rather than a default deciding for it - RandomProvider is the one a strategy runs on.

返回值: Random value within the optimization range.

GetRandomValues
public static HashSet<object> GetRandomValues(IStrategyParam param, int count, IRandomProvider provider)
result = StrategyParamHelper.GetRandomValues(param, count, provider)

Generate a set of unique random values for the parameter.

param
IStrategyParam
count
Number of random values to generate.
provider
Where the values are drawn from.

返回值: Set of unique random values.

GetRandomValues``1
public static HashSet<T> GetRandomValues<T>(StrategyParam<T> param, int count, IRandomProvider provider)
result = StrategyParamHelper.GetRandomValues(param, count, provider)

Generate a set of unique random values for the parameter.

param
StrategyParam
count
Number of random values to generate.
provider
Where the values are drawn from.

返回值: Set of unique random values.

GetRandom``1
public static T GetRandom<T>(StrategyParam<T> param, IRandomProvider provider)
result = StrategyParamHelper.GetRandom(param, provider)

Generate a random value within the optimization range for the parameter.

param
StrategyParam
provider
Where the value is drawn from.

返回值: Random value within the optimization range.

ToBruteForce
public static IEnumerable<ValueTuple<Strategy, IStrategyParam[]>> ToBruteForce(Strategy strategy, IEnumerable<ValueTuple<IStrategyParam, IEnumerable>> parameters, IStrategyParam[] optimizedParams, int totalCount)
result = StrategyParamHelper.ToBruteForce(strategy, parameters, optimizedParams, totalCount)

生成所有策略克隆, 并带有参数表率用于优化野蛮力量。 支持像金融工具 DataType 这样的参数的清晰值列表 。

strategy
克隆的基础策略.
parameters
带有可选的显值的参数,用于替代范围。
optimizedParams
输出:所有涉及优化的参数.
totalCount
产出:重复次数总数。

返回值: 战略克隆的懒惰可携带其参数阵列.

ToBruteForce
public static IEnumerable<ValueTuple<Strategy, IStrategyParam[]>> ToBruteForce(Strategy strategy, IStrategyParam[] parameters, IStrategyParam[] optimizedParams, int totalCount)
result = StrategyParamHelper.ToBruteForce(strategy, parameters, optimizedParams, totalCount)

生成所有带有参数通式的策略克隆,用于野蛮力量优化.

strategy
克隆的基础策略.
parameters
优化的参数.
optimizedParams
输出:所有涉及优化的参数.
totalCount
产出:重复次数总数。

返回值: 战略克隆的懒惰可携带其参数阵列.

ToBruteForceAsync
public static IAsyncEnumerable<ValueTuple<Strategy, IStrategyParam[]>> ToBruteForceAsync(Strategy strategy, IStrategyParam[] parameters, IStrategyParam[] optimizedParams, int totalCount)
result = StrategyParamHelper.ToBruteForceAsync(strategy, parameters, optimizedParams, totalCount)

Generate all strategy clones with parameter permutations for brute force optimization.

strategy
The base strategy to clone.
parameters
The parameters to optimize.
optimizedParams
Output: all parameters involved in optimization.
totalCount
Output: total number of iterations.

返回值: Lazy enumerable of strategy clones with their parameter arrays.

ToBruteForceAsync
public static IAsyncEnumerable<ValueTuple<Strategy, IStrategyParam[]>> ToBruteForceAsync(Strategy strategy, IEnumerable<ValueTuple<IStrategyParam, IEnumerable>> parameters, IStrategyParam[] optimizedParams, int totalCount)
result = StrategyParamHelper.ToBruteForceAsync(strategy, parameters, optimizedParams, totalCount)

Generate all strategy clones with parameter permutations for brute force optimization. Supports explicit value lists for parameters like Security, DataType.

strategy
The base strategy to clone.
parameters
The parameters with optional explicit values to use instead of range.
optimizedParams
Output: all parameters involved in optimization.
totalCount
Output: total number of iterations.

返回值: Lazy enumerable of strategy clones with their parameter arrays.

ToBruteForceRandom
public static IEnumerable<ValueTuple<Strategy, IStrategyParam[]>> ToBruteForceRandom(Strategy strategy, IStrategyParam[] parameters, int randomCount, IStrategyParam[] optimizedParams, int totalCount)
result = StrategyParamHelper.ToBruteForceRandom(strategy, parameters, randomCount, optimizedParams, totalCount)

生成所有策略克隆, 并带有随机参数值, 用于野蛮力量优化 。

strategy
克隆的基础策略.
parameters
优化的参数.
randomCount
每个参数随机样本的数量.
optimizedParams
输出:所有涉及优化的参数.
totalCount
产出:重复次数总数。

返回值: 战略克隆的懒惰可携带其参数阵列.

ToBruteForceRandomAsync
public static IAsyncEnumerable<ValueTuple<Strategy, IStrategyParam[]>> ToBruteForceRandomAsync(Strategy strategy, IStrategyParam[] parameters, int randomCount, IStrategyParam[] optimizedParams, int totalCount)
result = StrategyParamHelper.ToBruteForceRandomAsync(strategy, parameters, randomCount, optimizedParams, totalCount)

Generate all strategy clones with random parameter values for brute force optimization.

strategy
The base strategy to clone.
parameters
The parameters to optimize.
randomCount
Number of random samples per parameter.
optimizedParams
Output: all parameters involved in optimization.
totalCount
Output: total number of iterations.

返回值: Lazy enumerable of strategy clones with their parameter arrays.

ToGeneticParameters
public static ValueTuple<IStrategyParam, object, object, object, IEnumerable>[] ToGeneticParameters(Strategy strategy, IStrategyParam[] parameters)
result = StrategyParamHelper.ToGeneticParameters(strategy, parameters)

将策略参数转换为基因优化器格式.

strategy
战略有参数。
parameters
优化的参数.

返回值: 适合CancellationToken的拖拉机阵列。

ToGeneticParameters
public static ValueTuple<IStrategyParam, object, object, object, IEnumerable>[] ToGeneticParameters(Strategy strategy, IEnumerable<ValueTuple<IStrategyParam, IEnumerable>> parameters)
result = StrategyParamHelper.ToGeneticParameters(strategy, parameters)

将战略参数转换为基因优化格式,并有明确的值支持.

strategy
战略有参数。
parameters
带有可选的显值的参数,用于替代范围。

返回值: 适合CancellationToken的拖拉机阵列。