Lean  $LEAN_TAG$
TradeBarConsolidatorBase.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 
17 using System;
19 using Python.Runtime;
20 
22 {
23  /// <summary>
24  /// A data consolidator that can make bigger bars from any base data
25  ///
26  /// This type acts as the base for other consolidators that produce bars on a given time step or for a count of data.
27  /// </summary>
28  /// <typeparam name="T">The input type into the consolidator's Update method</typeparam>
29  public abstract class TradeBarConsolidatorBase<T> : PeriodCountConsolidatorBase<T, TradeBar>
30  where T : IBaseData
31  {
32  /// <summary>
33  /// Creates a consolidator to produce a new 'TradeBar' representing the period
34  /// </summary>
35  /// <param name="period">The minimum span of time before emitting a consolidated bar</param>
36  protected TradeBarConsolidatorBase(TimeSpan period)
37  : base(period)
38  {
39  }
40 
41  /// <summary>
42  /// Creates a consolidator to produce a new 'TradeBar' representing the last count pieces of data
43  /// </summary>
44  /// <param name="maxCount">The number of pieces to accept before emiting a consolidated bar</param>
45  protected TradeBarConsolidatorBase(int maxCount)
46  : base(maxCount)
47  {
48  }
49 
50  /// <summary>
51  /// Creates a consolidator to produce a new 'TradeBar' representing the last count pieces of data or the period, whichever comes first
52  /// </summary>
53  /// <param name="maxCount">The number of pieces to accept before emiting a consolidated bar</param>
54  /// <param name="period">The minimum span of time before emitting a consolidated bar</param>
55  protected TradeBarConsolidatorBase(int maxCount, TimeSpan period)
56  : base(maxCount, period)
57  {
58  }
59 
60  /// <summary>
61  /// Creates a consolidator to produce a new 'TradeBar' representing the last count pieces of data or the period, whichever comes first
62  /// </summary>
63  /// <param name="func">Func that defines the start time of a consolidated data</param>
64  protected TradeBarConsolidatorBase(Func<DateTime, CalendarInfo> func)
65  : base(func)
66  {
67  }
68 
69  /// <summary>
70  /// Creates a consolidator to produce a new 'TradeBar' representing the last count pieces of data or the period, whichever comes first
71  /// </summary>
72  /// <param name="pyfuncobj">Python function object that defines the start time of a consolidated data</param>
73  protected TradeBarConsolidatorBase(PyObject pyfuncobj)
74  : base(pyfuncobj)
75  {
76  }
77 
78  /// <summary>
79  /// Gets a copy of the current 'workingBar'.
80  /// </summary>
82  }
83 }