18 using System.Diagnostics;
19 using System.Globalization;
35 Environment.SetEnvironmentVariable(
"MONO_MANAGED_WATCHER",
"disabled");
39 var remoteDirectory =
Config.
Get(
"futures-remote-directory").Replace(
"{0}", date);
40 var sourceDirectory =
Config.
Get(
"futures-source-directory").Replace(
"{0}", date);
42 var resolutions =
Config.
Get(
"resolutions");
43 var cleanSourceDirectory =
Config.
GetBool(
"clean-source-directory",
false);
46 Log.
Trace(
"Processor Count: " + Environment.ProcessorCount);
47 Log.
Trace(
"Remote Directory: " + remoteDirectory);
48 Log.
Trace(
"Source Directory: " + sourceDirectory);
49 Log.
Trace(
"Destination Directory: " + dataDirectory);
54 Log.
Trace(
"DateTime: " + referenceDate.Date.ToStringInvariant());
57 if(!Directory.Exists(remoteDirectory))
59 Log.
Error(
"Remote Directory doesn't exist: " + remoteDirectory);
64 var resolutionList =
new[] {
Resolution.Minute };
66 if (!
string.IsNullOrEmpty(resolutions))
68 var names = resolutions.Split(
new[] {
';' });
71 .Where(x => !
string.IsNullOrEmpty(x))
75 Log.
Trace(
"Resolutions: " +
string.Join(
";", resolutionList.Select(x => x.ToString()).ToArray()));
78 var timer = Stopwatch.StartNew();
79 var converter =
new AlgoSeekFuturesConverter(resolutionList.ToList() , referenceDate, remoteDirectory, sourceDirectory, dataDirectory);
81 Log.
Trace($
"AlgoSeekFuturesConverter.Main(): {referenceDate.ToStringInvariant()} Conversion finished in time: {timer.Elapsed.ToStringInvariant(null)}");
85 converter.Package(referenceDate);
86 Log.
Trace($
"AlgoSeekFuturesConverter.Main(): {referenceDate.ToStringInvariant()} Compression finished in time: {timer.Elapsed.ToStringInvariant(null)}");
88 if (cleanSourceDirectory)
90 Log.
Trace($
"AlgoSeekFuturesConverter.Main(): Cleaning source directory: {sourceDirectory}");
94 Directory.Delete(sourceDirectory,
true);
98 Log.
Trace($
"AlgoSeekFuturesConverter.Main(): Error while cleaning source directory {err.Message}");