forked from QuantConnect/Lean
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInitialize.csx
25 lines (22 loc) · 909 Bytes
/
Initialize.csx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.IO;
using System.Linq;
using System.Reflection;
var currentDirectory = Directory.GetCurrentDirectory();
var parentDirectory = Directory.GetParent(currentDirectory).FullName;
// If our parent directory contains QC Dlls use it, otherwise default to current working directory
// In cloud and CLI research cases we expect the parent directory to contain the Dlls; but locally it may be cwd
var directoryToLoad = Directory.GetFiles(parentDirectory, "QuantConnect.*.dll").Any() ? parentDirectory : currentDirectory;
// Load in all QC dll's from this directory
Console.WriteLine($"Initialize.csx: Loading assemblies from {directoryToLoad}");
foreach (var file in Directory.GetFiles(directoryToLoad, "QuantConnect.*.dll"))
{
try
{
Assembly.LoadFrom(file.ToString());
}
catch (Exception e)
{
Console.WriteLine($"File: {file}. Exception: {e}");
}
}