Loader creates and manages the memory and exception space of the algorithm, ensuring if it explodes the Lean Engine is intact.
More...
|
| Loader () |
| Creates a new loader with a 10 second maximum load time that forces exactly one derived type to be found More...
|
|
| Loader (bool debugging, Language language, TimeSpan loaderTimeLimit, Func< List< string >, string > multipleTypeNameResolverFunction, WorkerThread workerThread=null) |
| Creates a new loader with the specified configuration More...
|
|
bool | TryCreateAlgorithmInstance (string assemblyPath, out IAlgorithm algorithmInstance, out string errorMessage) |
| Creates a new instance of the specified class in the library, safely. More...
|
|
bool | TryCreateAlgorithmInstanceWithIsolator (string assemblyPath, int ramLimit, out IAlgorithm algorithmInstance, out string errorMessage) |
| Creates a new instance of the class in the library, safely. More...
|
|
void | Unload () |
| Unload this factory's appDomain. More...
|
|
Loader creates and manages the memory and exception space of the algorithm, ensuring if it explodes the Lean Engine is intact.
Definition at line 37 of file Loader.cs.
◆ Loader() [1/2]
QuantConnect.AlgorithmFactory.Loader.Loader |
( |
| ) |
|
Creates a new loader with a 10 second maximum load time that forces exactly one derived type to be found
Definition at line 77 of file Loader.cs.
◆ Loader() [2/2]
QuantConnect.AlgorithmFactory.Loader.Loader |
( |
bool |
debugging, |
|
|
Language |
language, |
|
|
TimeSpan |
loaderTimeLimit, |
|
|
Func< List< string >, string > |
multipleTypeNameResolverFunction, |
|
|
WorkerThread |
workerThread = null |
|
) |
| |
Creates a new loader with the specified configuration
- Parameters
-
debugging | True if we are debugging |
language | Which language are we trying to load |
loaderTimeLimit | Used to limit how long it takes to create a new instance |
multipleTypeNameResolverFunction | Used to resolve multiple type names found in assembly to a single type name, if null, defaults to names => names.SingleOrDefault() |
When we search an assembly for derived types of IAlgorithm, sometimes the assembly will contain multiple matching types. This is the case for the QuantConnect.Algorithm assembly in this solution. In order to pick the correct type, consumers must specify how to pick the type, that's what this function does, it picks the correct type from the list of types found within the assembly.
- Parameters
-
workerThread | The worker thread instance the loader should use |
Definition at line 98 of file Loader.cs.
◆ TryCreateAlgorithmInstance()
bool QuantConnect.AlgorithmFactory.Loader.TryCreateAlgorithmInstance |
( |
string |
assemblyPath, |
|
|
out IAlgorithm |
algorithmInstance, |
|
|
out string |
errorMessage |
|
) |
| |
Creates a new instance of the specified class in the library, safely.
- Parameters
-
assemblyPath | Location of the DLL |
algorithmInstance | Output algorithm instance |
errorMessage | Output error message on failure |
- Returns
- Bool true on successfully loading the class.
Definition at line 120 of file Loader.cs.
◆ GetExtendedTypeNames()
static List<string> QuantConnect.AlgorithmFactory.Loader.GetExtendedTypeNames |
( |
Assembly |
assembly | ) |
|
|
static |
Get a list of all the matching type names in this DLL assembly:
- Parameters
-
assembly | Assembly dll we're loading. |
- Returns
- String list of types available.
Definition at line 303 of file Loader.cs.
◆ TryCreateAlgorithmInstanceWithIsolator()
bool QuantConnect.AlgorithmFactory.Loader.TryCreateAlgorithmInstanceWithIsolator |
( |
string |
assemblyPath, |
|
|
int |
ramLimit, |
|
|
out IAlgorithm |
algorithmInstance, |
|
|
out string |
errorMessage |
|
) |
| |
Creates a new instance of the class in the library, safely.
- Parameters
-
assemblyPath | Location of the DLL |
ramLimit | Limit of the RAM for this process |
algorithmInstance | Output algorithm instance |
errorMessage | Output error message on failure |
- Returns
- bool success
Definition at line 361 of file Loader.cs.
◆ Unload()
void QuantConnect.AlgorithmFactory.Loader.Unload |
( |
| ) |
|
Unload this factory's appDomain.
Not used in lean engine. Running the library in an app domain is 10x slower.
- See also
- AppDomain.CreateDomain(string, Evidence, string, string, bool, AppDomainInitializer, string[])
Definition at line 392 of file Loader.cs.
◆ appDomain
AppDomain QuantConnect.AlgorithmFactory.Loader.appDomain |
|
getset |
Memory space of the user algorithm
Definition at line 57 of file Loader.cs.
The documentation for this class was generated from the following file: