-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathOptimizerConfiguration.cs
151 lines (121 loc) · 5.13 KB
/
OptimizerConfiguration.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
using Jtc.Optimization.Objects.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Jtc.Optimization.Objects.Enums;
namespace Jtc.Optimization.Objects
{
[Serializable]
public class OptimizerConfiguration : IOptimizerConfiguration
{
/// <summary>
/// The settings to generate gene values
/// </summary>
public GeneConfiguration[] Genes { get; set; }
/// <summary>
/// The initial size of the population
/// </summary>
public int PopulationSize { get; set; } = 12;
/// <summary>
/// The maximum population
/// </summary>
public int PopulationSizeMaximum { get; set; } = 24;
/// <summary>
/// The maximum genetic generations or iterations of maximizer
/// </summary>
public int Generations { get; set; } = 1000;
/// <summary>
/// Quit if fitness does not improve for this number of genetic generations
/// </summary>
public int StagnationGenerations { get; set; } = 10;
/// <summary>
/// Number of parallel backtests
/// </summary>
public int MaxThreads { get; set; } = 8;
/// <summary>
/// Override config.json setting with the class name of algorithm
/// </summary>
public string AlgorithmTypeName { get; set; }
/// <summary>
/// Full path to config.json
/// </summary>
public string ConfigPath { get; set; } = "../../../../../Lean/Launcher/config.json";
/// <summary>
/// The binaries folder of the Lean Launcher project
/// </summary>
public string LauncherBuildPath { get; set; } = "../../../../../Lean/Launcher/bin/debug/";
/// <summary>
/// 1 or 2 point genetic crossover
/// </summary>
public bool OnePointCrossover { get; set; } = false;
/// <summary>
/// Override config.json setting
/// </summary>
public string AlgorithmLocation { get; set; }
/// <summary>
/// By default results with negative Sharpe or CAR are ignored
/// </summary>
public bool IncludeNegativeReturn { get; set; }
/// <summary>
/// Type name of fitness function. Defaults to Sharpe Ratio fitness
/// </summary>
public string FitnessTypeName { get; set; } = "Jtc.Optimization.LeanOptimizer.OptimizerFitness";
/// <summary>
/// Override config.json setting for the folder containing historical trade and symbol data
/// </summary>
public string DataFolder { get; set; }
/// <summary>
/// Settings for use with the ConfiguredFitness
/// </summary>
public FitnessConfiguration Fitness { get; set; }
/// <summary>
/// Algorithm backtest start date
/// </summary>
public DateTime? StartDate { get; set; }
/// <summary>
/// Algorithm backtest end date
/// </summary>
public DateTime? EndDate { get; set; }
/// <summary>
/// Probability of genetic mutation
/// </summary>
public float MutationProbability { get; set; } = 0.1f;
/// <summary>
/// Probability of genetic crossover
/// </summary>
public float CrossoverProbability { get; set; } = 0.75f;
/// <summary>
/// The minimum number of trades to consider the execution a non-failure
/// </summary>
public int MinimumTrades { get; set; }
/// <summary>
/// Enables the fitness filter that discards probable false positive executions
/// </summary>
public bool EnableFitnessFilter { get; set; }
/// <summary>
/// By default, the actual value of a gene is used for a single chromosome of the first generation.
/// Setting this to true will result in the entire first generation being populated with actal genes values.
/// </summary>
public bool UseActualGenesForWholeGeneration { get; set; }
public string TransactionLog { get; set; }
/// <summary>
/// If true, will execute algorithms in a single AppDomain, allowing object instance sharing between iterations and generations.
/// </summary>
public bool UseSharedAppDomain { get; set; }
/// <summary>
/// If true, will always execute algorithm even if supplied parameters have previously been executed
/// </summary>
/// <remarks>May be used for non-deterministic execution results</remarks>
public bool EnableRunningDuplicateParameters { get; set; }
/// <summary>
/// CSharp or Python. If specified will override config.json setting.
/// </summary>
public string AlgorithmLanguage { get; set; }
/// <summary>
/// When set to true, will consider 100% (or more) net loss a failure
/// </summary>
public bool ExcludeNetLoss { get; set; }
}
}