forked from QuantConnect/Lean
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Common engine initialization (QuantConnect#5809)
- Create Lean common engine initialization class, which will be called by research and Lean launcher - Fix backtest deserialization bug due to failing to handle decimal value
- Loading branch information
1 parent
2624b8c
commit 41636c9
Showing
7 changed files
with
93 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* 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.IO; | ||
using QuantConnect.Util; | ||
using QuantConnect.Logging; | ||
using QuantConnect.Configuration; | ||
|
||
namespace QuantConnect.Lean.Engine | ||
{ | ||
/// <summary> | ||
/// Helper class to initialize a Lean engine | ||
/// </summary> | ||
public static class Initializer | ||
{ | ||
/// <summary> | ||
/// The current Lean Engine System handlers | ||
/// </summary> | ||
public static LeanEngineSystemHandlers LeanEngineSystemHandlers { get; private set; } | ||
|
||
/// <summary> | ||
/// The current Lean Engine Algorithm handlers | ||
/// </summary> | ||
public static LeanEngineAlgorithmHandlers LeanEngineAlgorithmHandlers { get; private set; } | ||
|
||
/// <summary> | ||
/// Basic common Lean initialization | ||
/// </summary> | ||
public static void Start() | ||
{ | ||
try | ||
{ | ||
var mode = "RELEASE"; | ||
#if DEBUG | ||
mode = "DEBUG"; | ||
#endif | ||
|
||
Log.DebuggingEnabled = Config.GetBool("debug-mode"); | ||
Log.FilePath = Path.Combine(Config.Get("results-destination-folder"), "log.txt"); | ||
Log.LogHandler = Composer.Instance.GetExportedValueByTypeName<ILogHandler>(Config.Get("log-handler", "CompositeLogHandler")); | ||
|
||
Log.Trace($"Engine.Main(): LEAN ALGORITHMIC TRADING ENGINE v{Globals.Version} Mode: {mode} ({(Environment.Is64BitProcess ? "64" : "32")}bit) Host: {Environment.MachineName}"); | ||
Log.Trace("Engine.Main(): Started " + DateTime.Now.ToShortTimeString()); | ||
|
||
LeanEngineSystemHandlers = LeanEngineSystemHandlers.FromConfiguration(Composer.Instance); | ||
|
||
//Setup packeting, queue and controls system: These don't do much locally. | ||
LeanEngineSystemHandlers.Initialize(); | ||
|
||
LeanEngineAlgorithmHandlers = LeanEngineAlgorithmHandlers.FromConfiguration(Composer.Instance); | ||
} | ||
catch (Exception e) | ||
{ | ||
Log.Error(e); | ||
throw; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters