/* * 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; using System.Collections.Generic; using System.ComponentModel.Composition; using QuantConnect.Interfaces; using QuantConnect.Packets; using QuantConnect.Util; namespace QuantConnect.Lean.Engine.Setup { /// /// Interface to setup the algorithm. Pass in a raw algorithm, return one with portfolio, cash, etc already preset. /// [InheritedExport(typeof(ISetupHandler))] public interface ISetupHandler : IDisposable { /// /// The worker thread instance the setup handler should use /// WorkerThread WorkerThread { set; } /// /// Any errors from the initialization stored here: /// List Errors { get; set; } /// /// Get the maximum runtime for this algorithm job. /// TimeSpan MaximumRuntime { get; } /// /// Algorithm starting capital for statistics calculations /// decimal StartingPortfolioValue { get; } /// /// Start date for analysis loops to search for data. /// DateTime StartingDate { get; } /// /// Maximum number of orders for the algorithm run -- applicable for backtests only. /// int MaxOrders { get; } /// /// Create a new instance of an algorithm from a physical dll path. /// /// The path to the assembly's location /// Details of the task required /// A new instance of IAlgorithm, or throws an exception if there was an error IAlgorithm CreateAlgorithmInstance(AlgorithmNodePacket algorithmNodePacket, string assemblyPath); /// /// Creates the brokerage as specified by the job packet /// /// Job packet /// The algorithm instance before Initialize has been called /// The brokerage factory /// The brokerage instance, or throws if error creating instance IBrokerage CreateBrokerage(AlgorithmNodePacket algorithmNodePacket, IAlgorithm uninitializedAlgorithm, out IBrokerageFactory factory); /// /// Primary entry point to setup a new algorithm /// /// The parameters object to use /// True on successfully setting up the algorithm state, or false on error. bool Setup(SetupHandlerParameters parameters); } }