Lean
$LEAN_TAG$
IDataConsolidator.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
18
namespace
QuantConnect.Data.Consolidators
19
{
20
/// <summary>
21
/// Event handler type for the IDataConsolidator.DataConsolidated event
22
/// </summary>
23
/// <param name="sender">The consolidator that fired the event</param>
24
/// <param name="consolidated">The consolidated piece of data</param>
25
public
delegate
void
DataConsolidatedHandler
(
object
sender, IBaseData consolidated);
26
27
/// <summary>
28
/// Represents a type capable of taking BaseData updates and firing events containing new
29
/// 'consolidated' data. These types can be used to produce larger bars, or even be used to
30
/// transform the data before being sent to another component. The most common usage of these
31
/// types is with indicators.
32
/// </summary>
33
public
interface
IDataConsolidator
: IDisposable
34
{
35
/// <summary>
36
/// Gets the most recently consolidated piece of data. This will be null if this consolidator
37
/// has not produced any data yet.
38
/// </summary>
39
IBaseData
Consolidated
{
get
; }
40
41
/// <summary>
42
/// Gets a clone of the data being currently consolidated
43
/// </summary>
44
IBaseData
WorkingData
{
get
; }
45
46
/// <summary>
47
/// Gets the type consumed by this consolidator
48
/// </summary>
49
Type
InputType
{
get
; }
50
51
/// <summary>
52
/// Gets the type produced by this consolidator
53
/// </summary>
54
Type
OutputType
{
get
; }
55
56
/// <summary>
57
/// Updates this consolidator with the specified data
58
/// </summary>
59
/// <param name="data">The new data for the consolidator</param>
60
void
Update
(
IBaseData
data);
61
62
/// <summary>
63
/// Scans this consolidator to see if it should emit a bar due to time passing
64
/// </summary>
65
/// <param name="currentLocalTime">The current time in the local time zone (same as <see cref="BaseData.Time"/>)</param>
66
void
Scan
(DateTime currentLocalTime);
67
68
/// <summary>
69
/// Event handler that fires when a new piece of data is produced
70
/// </summary>
71
event
DataConsolidatedHandler
DataConsolidated
;
72
}
73
}
Common
Data
Consolidators
IDataConsolidator.cs
Generated by
1.8.17