Lean  $LEAN_TAG$
IDataFeed.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.ComponentModel.Composition;
21 using QuantConnect.Packets;
22 
24 {
25  /// <summary>
26  /// Datafeed interface for creating custom datafeed sources.
27  /// </summary>
28  [InheritedExport(typeof(IDataFeed))]
29  public interface IDataFeed
30  {
31  /// <summary>
32  /// Public flag indicator that the thread is still busy.
33  /// </summary>
34  bool IsActive
35  {
36  get;
37  }
38 
39  /// <summary>
40  /// Initializes the data feed for the specified job and algorithm
41  /// </summary>
42  void Initialize(IAlgorithm algorithm,
44  IResultHandler resultHandler,
45  IMapFileProvider mapFileProvider,
46  IFactorFileProvider factorFileProvider,
47  IDataProvider dataProvider,
48  IDataFeedSubscriptionManager subscriptionManager,
49  IDataFeedTimeProvider dataFeedTimeProvider,
50  IDataChannelProvider dataChannelProvider);
51 
52  /// <summary>
53  /// Creates a new subscription to provide data for the specified security.
54  /// </summary>
55  /// <param name="request">Defines the subscription to be added, including start/end times the universe and security</param>
56  /// <returns>The created <see cref="Subscription"/> if successful, null otherwise</returns>
58 
59  /// <summary>
60  /// Removes the subscription from the data feed, if it exists
61  /// </summary>
62  /// <param name="subscription">The subscription to remove</param>
63  void RemoveSubscription(Subscription subscription);
64 
65  /// <summary>
66  /// External controller calls to signal a terminate of the thread.
67  /// </summary>
68  void Exit();
69  }
70 }