Lean  $LEAN_TAG$
Optimization.cs
1 /*
2  * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
3  * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14 */
15 
16 using System;
17 using System.Collections.Generic;
18 using Newtonsoft.Json;
20 using QuantConnect.Util;
21 
22 namespace QuantConnect.Api
23 {
24  /// <summary>
25  /// Optimization response packet from the QuantConnect.com API.
26  /// </summary>
28  {
29  /// <summary>
30  /// Snapshot ID of this optimization
31  /// </summary>
32  public int? SnapshotId { get; set; }
33 
34  /// <summary>
35  /// Statistic to be optimized
36  /// </summary>
37  public string OptimizationTarget { get; set; }
38 
39  /// <summary>
40  /// List with grid charts representing the grid layout
41  /// </summary>
42  public List<GridChart> GridLayout { get; set; }
43 
44  /// <summary>
45  /// Runtime banner/updating statistics for the optimization
46  /// </summary>
47  [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
48  public IDictionary<string, string> RuntimeStatistics { get; set; }
49 
50  /// <summary>
51  /// Optimization constraints
52  /// </summary>
53  [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
54  public IReadOnlyList<Constraint> Constraints { get; set; }
55 
56  /// <summary>
57  /// Number of parallel nodes for optimization
58  /// </summary>
59  public int ParallelNodes { get; set; }
60 
61  /// <summary>
62  /// Optimization constraints
63  /// </summary>
64  [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
65  public IDictionary<string, OptimizationBacktest> Backtests { get; set; }
66 
67  /// <summary>
68  /// Optimization strategy
69  /// </summary>
70  public string Strategy { get; set; }
71 
72  /// <summary>
73  /// Optimization requested date and time
74  /// </summary>
75  [JsonConverter(typeof(DateTimeJsonConverter), DateFormat.UI)]
76  public DateTime Requested { get; set; }
77  }
78 
79  /// <summary>
80  /// Wrapper class for Optimizations/Read endpoint JSON response
81  /// </summary>
83  {
84  /// <summary>
85  /// Optimization object
86  /// </summary>
87  public Optimization Optimization { get; set; }
88  }
89 
90  /// <summary>
91  /// Collection container for a list of summarized optimizations for a project
92  /// </summary>
94  {
95  /// <summary>
96  /// Collection of summarized optimization objects
97  /// </summary>
98  public List<OptimizationSummary> Optimizations { get; set; }
99 
100  /// <summary>
101  /// The optimization count
102  /// </summary>
103  public int Count => Optimizations?.Count ?? 0;
104  }
105 }