Lean  $LEAN_TAG$
UpdateData.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 QuantConnect.Data;
19 
21 {
22  /// <summary>
23  /// Transport type for algorithm update data. This is intended to provide a
24  /// list of base data used to perform updates against the specified target
25  /// </summary>
26  /// <typeparam name="T">The target type</typeparam>
27  public class UpdateData<T>
28  {
29  /// <summary>
30  /// Flag indicating whether <see cref="Data"/> contains any fill forward bar or not
31  /// </summary>
32  /// <remarks>This is useful for performance, it allows consumers to skip re enumerating the entire data
33  /// list to filter any fill forward data</remarks>
34  public bool? ContainsFillForwardData { get; init; }
35 
36  /// <summary>
37  /// The target, such as a security or subscription data config
38  /// </summary>
39  public T Target { get; init; }
40 
41  /// <summary>
42  /// The data used to update the target
43  /// </summary>
44  public IReadOnlyList<BaseData> Data { get; init; }
45 
46  /// <summary>
47  /// The type of data in the data list
48  /// </summary>
49  public Type DataType { get; init; }
50 
51  /// <summary>
52  /// True if this update data corresponds to an internal subscription
53  /// such as currency or security benchmark
54  /// </summary>
55  public bool IsInternalConfig { get; init; }
56 
57  /// <summary>
58  /// Initializes a new instance of the <see cref="UpdateData{T}"/> class
59  /// </summary>
60  /// <param name="target">The end consumer/user of the dat</param>
61  /// <param name="dataType">The type of data in the list</param>
62  /// <param name="data">The update data</param>
63  /// <param name="isInternalConfig">True if this update data corresponds to an internal subscription
64  /// such as currency or security benchmark</param>
65  /// <param name="containsFillForwardData">True if this update data contains fill forward bars</param>
66  public UpdateData(T target, Type dataType, IReadOnlyList<BaseData> data, bool isInternalConfig, bool? containsFillForwardData = null)
67  {
68  Target = target;
69  Data = data;
70  DataType = dataType;
71  IsInternalConfig = isInternalConfig;
72  ContainsFillForwardData = containsFillForwardData;
73  }
74  }
75 }