Lean  $LEAN_TAG$
OptimizationBacktest.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 Newtonsoft.Json;
18 using System.Collections.Generic;
20 
21 namespace QuantConnect.Api
22 {
23  /// <summary>
24  /// OptimizationBacktest object from the QuantConnect.com API.
25  /// </summary>
26  [JsonConverter(typeof(OptimizationBacktestJsonConverter))]
27  public class OptimizationBacktest
28  {
29  /// <summary>
30  /// Progress of the backtest as a percentage from 0-1 based on the days lapsed from start-finish.
31  /// </summary>
32  public decimal Progress { get; set; }
33 
34  /// <summary>
35  /// The backtest name
36  /// </summary>
37  public string Name { get; }
38 
39  /// <summary>
40  /// The backtest host name
41  /// </summary>
42  public string HostName { get; set; }
43 
44  /// <summary>
45  /// The backtest id
46  /// </summary>
47  public string BacktestId { get; }
48 
49  /// <summary>
50  /// Represent a combination as key value of parameters, i.e. order doesn't matter
51  /// </summary>
52  public ParameterSet ParameterSet { get; }
53 
54  /// <summary>
55  /// The backtest statistics results
56  /// </summary>
57  public IDictionary<string, string> Statistics { get; set; }
58 
59  /// <summary>
60  /// The backtest equity chart series
61  /// </summary>
62  public CandlestickSeries Equity { get; set; }
63 
64  /// <summary>
65  /// The exit code of this backtest
66  /// </summary>
67  public int ExitCode { get; set; }
68 
69  /// <summary>
70  /// Backtest maximum end date
71  /// </summary>
72  public DateTime? OutOfSampleMaxEndDate { get; set; }
73 
74  /// <summary>
75  /// The backtest out of sample day count
76  /// </summary>
77  public int OutOfSampleDays { get; set; }
78 
79  /// <summary>
80  /// The backtest start date
81  /// </summary>
82  public DateTime StartDate { get; set; }
83 
84  /// <summary>
85  /// The backtest end date
86  /// </summary>
87  public DateTime EndDate { get; set; }
88 
89  /// <summary>
90  /// Creates a new instance
91  /// </summary>
92  /// <param name="parameterSet">The parameter set</param>
93  /// <param name="backtestId">The backtest id if any</param>
94  /// <param name="name">The backtest name</param>
95  public OptimizationBacktest(ParameterSet parameterSet, string backtestId, string name)
96  {
97  ParameterSet = parameterSet;
98  BacktestId = backtestId;
99  Name = name;
100  }
101  }
102 }