Lean  $LEAN_TAG$
IIndicator.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 QuantConnect.Data;
18 
20 {
21  /// <summary>
22  /// KEEPING THIS INTERFACE FOR BACKWARDS COMPATIBILITY.
23  /// Represents an indicator that can receive data updates and emit events when the value of
24  /// the indicator has changed.
25  /// </summary>
26  public interface IIndicator<T> : IComparable<IIndicator<T>>, IIndicator
27  where T : IBaseData
28  {
29  }
30 
31  /// <summary>
32  /// Represents an indicator that can receive data updates and emit events when the value of
33  /// the indicator has changed.
34  /// </summary>
35  public interface IIndicator : IComparable
36  {
37  /// <summary>
38  /// Event handler that fires after this indicator is updated
39  /// </summary>
41 
42  /// <summary>
43  /// Gets a name for this indicator
44  /// </summary>
45  string Name { get; }
46 
47  /// <summary>
48  /// Gets a flag indicating when this indicator is ready and fully initialized
49  /// </summary>
50  bool IsReady { get; }
51 
52  /// <summary>
53  /// Gets the current state of this indicator. If the state has not been updated
54  /// then the time on the value will equal DateTime.MinValue.
55  /// </summary>
57 
58  /// <summary>
59  /// Gets the number of samples processed by this indicator
60  /// </summary>
61  long Samples { get; }
62 
63  /// <summary>
64  /// Updates the state of this indicator with the given value and returns true
65  /// if this indicator is ready, false otherwise
66  /// </summary>
67  /// <param name="input">The value to use to update this indicator</param>
68  /// <returns>True if this indicator is ready, false otherwise</returns>
69  bool Update(IBaseData input);
70 
71  /// <summary>
72  /// Resets this indicator to its initial state
73  /// </summary>
74  void Reset();
75  }
76 }