/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ using System.ComponentModel.Composition; using QuantConnect.Interfaces; using QuantConnect.Packets; namespace QuantConnect.Lean.Engine.Alpha { /// /// Alpha handler defines how to process insights generated by an algorithm /// [InheritedExport(typeof(IAlphaHandler))] public interface IAlphaHandler { /// /// Gets a flag indicating if this handler's thread is still running and processing messages /// bool IsActive { get; } /// /// Gets the current alpha runtime statistics /// AlphaRuntimeStatistics RuntimeStatistics { get; } /// /// Initializes this alpha handler to accept insights from the specified algorithm /// /// The algorithm job /// The algorithm instance /// Handler used for sending insights /// Api instance void Initialize(AlgorithmNodePacket job, IAlgorithm algorithm, IMessagingHandler messagingHandler, IApi api); /// /// Invoked after the algorithm's Initialize method was called allowing the alpha handler to check /// other things, such as sampling period for backtests /// /// The algorithm instance void OnAfterAlgorithmInitialized(IAlgorithm algorithm); /// /// Performs processing in sync with the algorithm's time loop to provide consisten reading of data /// void ProcessSynchronousEvents(); /// /// Thread entry point for asynchronous processing /// void Run(); /// /// Stops processing in the method /// void Exit(); } }