Lean  $LEAN_TAG$
IRealTimeHandler.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;
18 using System.ComponentModel.Composition;
22 using QuantConnect.Packets;
24 
26 {
27  /// <summary>
28  /// Real time event handler, trigger functions at regular or pretimed intervals
29  /// </summary>
30  [InheritedExport(typeof(IRealTimeHandler))]
31  public interface IRealTimeHandler : IEventSchedule
32  {
33  /// <summary>
34  /// Thread status flag.
35  /// </summary>
36  bool IsActive
37  {
38  get;
39  }
40 
41  /// <summary>
42  /// Initializes the real time handler for the specified algorithm and job
43  /// </summary>
44  void Setup(IAlgorithm algorithm, AlgorithmNodePacket job, IResultHandler resultHandler, IApi api, IIsolatorLimitResultProvider isolatorLimitProvider);
45 
46  /// <summary>
47  /// Set the current time for the event scanner (so we can use same code for backtesting and live events)
48  /// </summary>
49  /// <param name="time">Current real or backtest time.</param>
50  void SetTime(DateTime time);
51 
52  /// <summary>
53  /// Scan for past events that didn't fire because there was no data at the scheduled time.
54  /// </summary>
55  /// <param name="time">Current time.</param>
56  void ScanPastEvents(DateTime time);
57 
58  /// <summary>
59  /// Trigger and exit signal to terminate real time event scanner.
60  /// </summary>
61  void Exit();
62 
63  /// <summary>
64  /// Event fired each time that we add/remove securities from the data feed
65  /// </summary>
67  }
68 }