private void LaunchLean() { Config.Set ("environment", "desktop"); string algorithm = "EMATest"; Config.Set("algorithm-type-name", algorithm); _jobQueue = new JobQueue (); _notify = new Messaging (); _api = new Api(); _resultshandler = new DesktopResultHandler (); _dataFeed = new FileSystemDataFeed (); _setup = new ConsoleSetupHandler (); _realTime = new BacktestingRealTimeHandler (); _historyProvider = new SubscriptionDataReaderHistoryProvider (); _transactions = new BacktestingTransactionHandler (); var systemHandlers = new LeanEngineSystemHandlers (_jobQueue, _api, _notify); systemHandlers.Initialize (); var algorithmHandlers = new LeanEngineAlgorithmHandlers (_resultshandler, _setup, _dataFeed, _transactions, _realTime, _historyProvider); var _engine = new Engine (systemHandlers, algorithmHandlers, Config.GetBool ("live-mode")); string algorithmPath; var job = systemHandlers.JobQueue.NextJob(out algorithmPath); _engine.Run(job, algorithmPath); }
public XmlProvider(INzbQueueProvider nzbQueue, IHistoryProvider history, ICategoryProvider category, IScriptProvider script) { _nzbQueue = nzbQueue; _history = history; _category = category; _script = script; }
/// <summary> /// Initializes a new instance of the <see cref="LeanEngineAlgorithmHandlers"/> class from the specified handlers /// </summary> /// <param name="results">The result handler for communicating results from the algorithm</param> /// <param name="setup">The setup handler used to initialize algorithm state</param> /// <param name="dataFeed">The data feed handler used to pump data to the algorithm</param> /// <param name="transactions">The transaction handler used to process orders from the algorithm</param> /// <param name="realTime">The real time handler used to process real time events</param> /// <param name="historyProvider">The history provider used to process historical data requests</param> /// <param name="commandQueue">The command queue handler used to receive external commands for the algorithm</param> /// <param name="mapFileProvider">The map file provider used to retrieve map files for the data feed</param> public LeanEngineAlgorithmHandlers(IResultHandler results, ISetupHandler setup, IDataFeed dataFeed, ITransactionHandler transactions, IRealTimeHandler realTime, IHistoryProvider historyProvider, ICommandQueueHandler commandQueue, IMapFileProvider mapFileProvider ) { if (results == null) { throw new ArgumentNullException("results"); } if (setup == null) { throw new ArgumentNullException("setup"); } if (dataFeed == null) { throw new ArgumentNullException("dataFeed"); } if (transactions == null) { throw new ArgumentNullException("transactions"); } if (realTime == null) { throw new ArgumentNullException("realTime"); } if (historyProvider == null) { throw new ArgumentNullException("realTime"); } if (commandQueue == null) { throw new ArgumentNullException("commandQueue"); } if (mapFileProvider == null) { throw new ArgumentNullException("mapFileProvider"); } _results = results; _setup = setup; _dataFeed = dataFeed; _transactions = transactions; _realTime = realTime; _historyProvider = historyProvider; _commandQueue = commandQueue; _mapFileProvider = mapFileProvider; }
public DirectoryWithHistory(IHistoryProvider provider, string path) { if (provider == null) { throw new ArgumentNullException ("provider"); } Path = path; Provider = provider; repository = ((HistoryProvider)provider).Repository; ReadSubDirectories (); ReadContainingFiles (); }
public SabnzbdController(INzbQueueProvider nzbQueue, IHistoryProvider history) { _nzbQueue = nzbQueue; _history = history; //nzbQueue.Add(new NzbModel // { // Category = "tv", // DatePosted = DateTime.Now, // Id = Guid.NewGuid(), // Name = "Ubuntu Test", // Status = NzbStatus.Queued, // Size = 10000000 // }); }
public ProjectTaskService( IAppRepositoryBase <ProjectTask> taskRepository, IAppRepositoryBase <ProjectGantt> ganttRepository, IAuthInfoProvider authInfoProvider, IWfEngine wfEngine, IAuthorizationRepositoryBase <User> userRepository, IAppDbContextProvider dbContextProvider, IProjectHelper projectHelper ) { _ganttRepository = ganttRepository; _projectHelper = projectHelper; _authInfoProvider = authInfoProvider; _userRepository = userRepository; _runtimeProvider = wfEngine.GetRuntimeProvider(); _taskProvider = wfEngine.GetTaskProvider(); _definitionProvder = wfEngine.GetDefinitionProvider(); _historyProvider = wfEngine.GetHistoryProvider(); _dbContextProvider = dbContextProvider; _projectTaskRepository = taskRepository; }
/// <summary> /// <see cref = "QuantBook" /> constructor. /// Provides access to data for quantitative analysis /// </summary> public QuantBook() { try { using (Py.GIL()) { _pandas = Py.Import("pandas"); } var composer = new Composer(); var algorithmHandlers = LeanEngineAlgorithmHandlers.FromConfiguration(composer); _dataCacheProvider = new SingleEntryDataCacheProvider(algorithmHandlers.DataProvider); var mapFileProvider = algorithmHandlers.MapFileProvider; _historyProvider = composer.GetExportedValueByTypeName <IHistoryProvider>(Config.Get("history-provider", "SubscriptionDataReaderHistoryProvider")); _historyProvider.Initialize(null, algorithmHandlers.DataProvider, _dataCacheProvider, mapFileProvider, algorithmHandlers.FactorFileProvider, null); } catch (Exception exception) { throw new Exception("QuantBook.Main(): " + exception); } }
/// <summary> /// Initializes a new instance of the <see cref="LeanEngineAlgorithmHandlers"/> class from the specified handlers /// </summary> /// <param name="results">The result handler for communicating results from the algorithm</param> /// <param name="setup">The setup handler used to initialize algorithm state</param> /// <param name="dataFeed">The data feed handler used to pump data to the algorithm</param> /// <param name="transactions">The transaction handler used to process orders from the algorithm</param> /// <param name="realTime">The real time handler used to process real time events</param> /// <param name="historyProvider">The history provider used to process historical data requests</param> public LeanEngineAlgorithmHandlers(IResultHandler results, ISetupHandler setup, IDataFeed dataFeed, ITransactionHandler transactions, IRealTimeHandler realTime, IHistoryProvider historyProvider) { if (results == null) { throw new ArgumentNullException("results"); } if (setup == null) { throw new ArgumentNullException("setup"); } if (dataFeed == null) { throw new ArgumentNullException("dataFeed"); } if (transactions == null) { throw new ArgumentNullException("transactions"); } if (realTime == null) { throw new ArgumentNullException("realTime"); } if (historyProvider == null) { throw new ArgumentNullException("realTime"); } _results = results; _setup = setup; _dataFeed = dataFeed; _transactions = transactions; _realTime = realTime; _historyProvider = historyProvider; }
public SafetyProblemService( IAuthInfoProvider authInfoProvider, IAppRepositoryBase <SafetyProblem> problemRepository, IAppRepositoryBase <SafetyProblemRectification> rectificationRepository, //IAppRepositoryBase<Project> projectRepository, IAppDbContextProvider dbContextProvider, IDbOperator op, IEventBus eventBus, IWfEngine wfEngine, IProjectHelper projectHelper ) { _projectHelper = projectHelper; _authInfoProvider = authInfoProvider; _problemRepository = problemRepository; _rectificationRepository = rectificationRepository; // _projectRepository = projectRepository; _dbContextProvider = dbContextProvider; _op = op; _runtimeProvider = wfEngine.GetRuntimeProvider(); _taskProvider = wfEngine.GetTaskProvider(); _definitionProvder = wfEngine.GetDefinitionProvider(); _historyProvider = wfEngine.GetHistoryProvider(); }
/// <summary> /// Set the historical data provider /// </summary> /// <param name="historyProvider">Historical data provider</param> public void SetHistoryProvider(IHistoryProvider historyProvider) { _baseAlgorithm.SetHistoryProvider(historyProvider); }
private void LaunchLean() { Config.Set ("environment", "backtesting"); string algorithm = "EMATest"; Config.Set("algorithm-type-name", algorithm); _jobQueue = new JobQueue (); _notify = new Messaging (); _api = new Api(); _resultshandler = new DesktopResultHandler (); _dataFeed = new FileSystemDataFeed (); _setup = new ConsoleSetupHandler (); _realTime = new BacktestingRealTimeHandler (); _historyProvider = new SubscriptionDataReaderHistoryProvider (); _transactions = new BacktestingTransactionHandler (); var systemHandlers = new LeanEngineSystemHandlers (_jobQueue, _api, _notify); systemHandlers.Initialize (); // var algorithmHandlers = new LeanEngineAlgorithmHandlers (_resultshandler, _setup, _dataFeed, _transactions, _realTime, _historyProvider); Log.LogHandler = Composer.Instance.GetExportedValueByTypeName<ILogHandler>(Config.Get("log-handler", "CompositeLogHandler")); LeanEngineAlgorithmHandlers leanEngineAlgorithmHandlers; try { leanEngineAlgorithmHandlers = LeanEngineAlgorithmHandlers.FromConfiguration(Composer.Instance); _resultshandler = leanEngineAlgorithmHandlers.Results; } catch (CompositionException compositionException) { Log.Error("Engine.Main(): Failed to load library: " + compositionException); throw; } string algorithmPath; AlgorithmNodePacket job = systemHandlers.JobQueue.NextJob(out algorithmPath); try { var _engine = new Engine(systemHandlers, leanEngineAlgorithmHandlers, Config.GetBool("live-mode")); _engine.Run(job, algorithmPath); } finally { //Delete the message from the job queue: //systemHandlers.JobQueue.AcknowledgeJob(job); Log.Trace("Engine.Main(): Packet removed from queue: " + job.AlgorithmId); // clean up resources systemHandlers.Dispose(); leanEngineAlgorithmHandlers.Dispose(); Log.LogHandler.Dispose(); } }
public void SetUp() { myMockery = new Mockery (); file1 = myMockery.NewMock <IFileWithHistory> (); version1 = myMockery.NewMock<IFileVersion> (); provider = myMockery.NewMock<IHistoryProvider> (); }
public Host(IServiceProvider services, IServiceCollection pool, IAppBuilder appBuilder, IEnvironment hostEnv, IOutputEngine output, IHostInput hostInput, IHistoryProvider historyProvider) { this.services = services; this.pool = pool; this.appBuilder = appBuilder; this.hostEnv = hostEnv; this.output = output; this.hostInput = hostInput as HostInput; this.historyProvider = historyProvider; }
/// <summary> /// <see cref = "HistoryProviderPythonWrapper"/> constructor. /// Wraps the <see cref = "IHistoryProvider"/> object. /// </summary> /// <param name="historyProvider"><see cref = "IHistoryProvider"/> object to be wrapped</param> public HistoryProviderPythonWrapper(IHistoryProvider historyProvider) { _historyProvider = historyProvider; }
public TempFileCreator(IHistoryProvider provider) { Provider = provider; }
/// <summary> /// Launches a Lean Engine using a parameter /// </summary> /// <param name="val">The paramater to use when launching lean. </param> private void LaunchLean(string val) { Config.Set("environment", "backtesting"); string algorithm = val; // Set the algorithm in Config. Here is where you can customize Config settings Config.Set("algorithm-type-name", algorithm); _jobQueue = new JobQueue(); _notify = new Messaging(); _api = new Api(); /************ Comment one of the two following lines to select which ResultHandler to use ***********/ _resultshandler = new OptimizationResultHandler(); //_resultshandler = new ConsoleResultHandler(); _dataFeed = new FileSystemDataFeed(); _setup = new ConsoleSetupHandler(); _realTime = new BacktestingRealTimeHandler(); _historyProvider = new SubscriptionDataReaderHistoryProvider(); _transactions = new BacktestingTransactionHandler(); // Set the Log.LogHandler to only write to the log.txt file. // This setting avoids writing Log messages to the console. Log.LogHandler = (ILogHandler)new FileLogHandler(); Log.DebuggingEnabled = false; // Set this property to true for lots of messages Log.DebuggingLevel = 1; // A reminder that the default level for Log.Debug message is 1 var systemHandlers = new LeanEngineSystemHandlers(_jobQueue, _api, _notify); systemHandlers.Initialize(); var algorithmHandlers = new LeanEngineAlgorithmHandlers(_resultshandler, _setup, _dataFeed, _transactions, _realTime, _historyProvider); string algorithmPath; AlgorithmNodePacket job = systemHandlers.JobQueue.NextJob(out algorithmPath); try { var _engine = new Engine(systemHandlers, algorithmHandlers, Config.GetBool("live-mode")); _engine.Run(job, algorithmPath); } finally { /* The JobQueue.AcknowledgeJob only asks for any key to close the window. * We do not want that behavior, so we comment out this line so that multiple Leans will run * * The alternative is to comment out Console.Read(); the line in JobQueue class. */ //systemHandlers.JobQueue.AcknowledgeJob(job); Log.Trace("Engine.Main(): Packet removed from queue: " + job.AlgorithmId); // clean up resources systemHandlers.Dispose(); algorithmHandlers.Dispose(); Log.LogHandler.Dispose(); } }
private void LaunchLean() { Config.Set("environment", "backtesting"); string algorithm = "EMATest"; Config.Set("algorithm-type-name", algorithm); //string datapath = Config.Get("data-folder"); _jobQueue = new JobQueue(); _notify = new Messaging(); _api = new Api(); _resultshandler = new OptimizationResultHandler(); //_resultshandler = new ConsoleResultHandler(); _dataFeed = new FileSystemDataFeed(); _setup = new ConsoleSetupHandler(); _realTime = new BacktestingRealTimeHandler(); _historyProvider = new SubscriptionDataReaderHistoryProvider(); _transactions = new BacktestingTransactionHandler(); Log.LogHandler = (ILogHandler)new FileLogHandler(); Log.DebuggingEnabled = false; Log.DebuggingLevel = 1; var systemHandlers = new LeanEngineSystemHandlers(_jobQueue, _api, _notify); systemHandlers.Initialize(); var algorithmHandlers = new LeanEngineAlgorithmHandlers(_resultshandler, _setup, _dataFeed, _transactions, _realTime, _historyProvider); string algorithmPath; AlgorithmNodePacket job = systemHandlers.JobQueue.NextJob(out algorithmPath); try { var _engine = new Engine(systemHandlers, algorithmHandlers, Config.GetBool("live-mode")); _engine.Run(job, algorithmPath); } finally { //Delete the message from the job queue: //systemHandlers.JobQueue.AcknowledgeJob(job); Log.Trace("Engine.Main(): Packet removed from queue: " + job.AlgorithmId); // clean up resources systemHandlers.Dispose(); algorithmHandlers.Dispose(); Log.LogHandler.Dispose(); } }
/// <summary> /// Initializes a new instance of the <see cref="LeanEngineAlgorithmHandlers"/> class from the specified handlers /// </summary> /// <param name="results">The result handler for communicating results from the algorithm</param> /// <param name="setup">The setup handler used to initialize algorithm state</param> /// <param name="dataFeed">The data feed handler used to pump data to the algorithm</param> /// <param name="transactions">The transaction handler used to process orders from the algorithm</param> /// <param name="realTime">The real time handler used to process real time events</param> /// <param name="historyProvider">The history provider used to process historical data requests</param> /// <param name="commandQueue">The command queue handler used to receive external commands for the algorithm</param> /// <param name="mapFileProvider">The map file provider used to retrieve map files for the data feed</param> /// <param name="factorFileProvider">Map file provider used as a map file source for the data feed</param> /// <param name="dataFileProvider">file provider used to retrieve security data if it is not on the file system</param> public LeanEngineAlgorithmHandlers(IResultHandler results, ISetupHandler setup, IDataFeed dataFeed, ITransactionHandler transactions, IRealTimeHandler realTime, IHistoryProvider historyProvider, ICommandQueueHandler commandQueue, IMapFileProvider mapFileProvider, IFactorFileProvider factorFileProvider, IDataFileProvider dataFileProvider ) { if (results == null) { throw new ArgumentNullException("results"); } if (setup == null) { throw new ArgumentNullException("setup"); } if (dataFeed == null) { throw new ArgumentNullException("dataFeed"); } if (transactions == null) { throw new ArgumentNullException("transactions"); } if (realTime == null) { throw new ArgumentNullException("realTime"); } if (historyProvider == null) { throw new ArgumentNullException("realTime"); } if (commandQueue == null) { throw new ArgumentNullException("commandQueue"); } if (mapFileProvider == null) { throw new ArgumentNullException("mapFileProvider"); } if (factorFileProvider == null) { throw new ArgumentNullException("factorFileProvider"); } if (dataFileProvider == null) { throw new ArgumentNullException("dataFileProvider"); } _results = results; _setup = setup; _dataFeed = dataFeed; _transactions = transactions; _realTime = realTime; _historyProvider = historyProvider; _commandQueue = commandQueue; _mapFileProvider = mapFileProvider; _factorFileProvider = factorFileProvider; _dataFileProvider = dataFileProvider; }
public void SetHistoryProvider(IHistoryProvider historyProvider) { Algo.SetHistoryProvider(historyProvider); }