Lean  $LEAN_TAG$
AlgorithmPerformance.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 QuantConnect.Data;
17 using System;
18 using System.Collections.Generic;
19 
21 {
22  /// <summary>
23  /// The <see cref="AlgorithmPerformance"/> class is a wrapper for <see cref="TradeStatistics"/> and <see cref="PortfolioStatistics"/>
24  /// </summary>
25  public class AlgorithmPerformance
26  {
27  /// <summary>
28  /// The algorithm statistics on closed trades
29  /// </summary>
30  public TradeStatistics TradeStatistics { get; set; }
31 
32  /// <summary>
33  /// The algorithm statistics on portfolio
34  /// </summary>
36 
37  /// <summary>
38  /// The list of closed trades
39  /// </summary>
40  public List<Trade> ClosedTrades { get; set; }
41 
42  /// <summary>
43  /// Initializes a new instance of the <see cref="AlgorithmPerformance"/> class
44  /// </summary>
45  /// <param name="trades">The list of closed trades</param>
46  /// <param name="profitLoss">Trade record of profits and losses</param>
47  /// <param name="equity">The list of daily equity values</param>
48  /// <param name="portfolioTurnover">The algorithm portfolio turnover</param>
49  /// <param name="listPerformance">The list of algorithm performance values</param>
50  /// <param name="listBenchmark">The list of benchmark values</param>
51  /// <param name="startingCapital">The algorithm starting capital</param>
52  /// <param name="winningTransactions">Number of winning transactions</param>
53  /// <param name="losingTransactions">Number of losing transactions</param>
54  /// <param name="riskFreeInterestRateModel">The risk free interest rate model to use</param>
55  /// <param name="tradingDaysPerYear">The number of trading days per year</param>
57  List<Trade> trades,
58  SortedDictionary<DateTime, decimal> profitLoss,
59  SortedDictionary<DateTime, decimal> equity,
60  SortedDictionary<DateTime, decimal> portfolioTurnover,
61  List<double> listPerformance,
62  List<double> listBenchmark,
63  decimal startingCapital,
64  int winningTransactions,
65  int losingTransactions,
66  IRiskFreeInterestRateModel riskFreeInterestRateModel,
67  int tradingDaysPerYear)
68  {
69 
70  TradeStatistics = new TradeStatistics(trades);
71  PortfolioStatistics = new PortfolioStatistics(profitLoss, equity, portfolioTurnover, listPerformance, listBenchmark, startingCapital,
72  riskFreeInterestRateModel, tradingDaysPerYear, winningTransactions, losingTransactions);
73  ClosedTrades = trades;
74  }
75 
76  /// <summary>
77  /// Initializes a new instance of the <see cref="AlgorithmPerformance"/> class
78  /// </summary>
80  {
83  ClosedTrades = new List<Trade>();
84  }
85 
86  }
87 }