예제 #1
0
            public GitInstallDetails(NPath baseDataPath, bool onWindows)
            {
                this.onWindows = onWindows;

                ZipPath = baseDataPath.Combine("downloads");
                ZipPath.EnsureDirectoryExists();
                GitZipPath    = ZipPath.Combine(gitZip);
                GitLfsZipPath = ZipPath.Combine(gitLfsZip);

                GitInstallationPath = baseDataPath.Combine(GitDirectory);
                GitExecutablePath   = GitInstallationPath.Combine(onWindows ? "cmd" : "bin", "git" + DefaultEnvironment.ExecutableExt);

                GitLfsInstallationPath = baseDataPath.Combine(GitLfsDirectory);
                GitLfsExecutablePath   = GitLfsInstallationPath.Combine("git-lfs" + DefaultEnvironment.ExecutableExt);

                if (onWindows)
                {
                    GitPackageFeed    = packageFeed + $"windows/{GitPackageName}";
                    GitLfsPackageFeed = packageFeed + $"windows/{GitLfsPackageName}";
                }
                else
                {
                    GitPackageFeed    = packageFeed + $"mac/{GitPackageName}";
                    GitLfsPackageFeed = packageFeed + $"mac/{GitLfsPackageName}";
                }
            }
예제 #2
0
            public GitInstallDetails(NPath baseDataPath, bool onWindows)
            {
                this.onWindows = onWindows;

                ZipPath = baseDataPath.Combine("downloads");
                ZipPath.EnsureDirectoryExists();
                GitZipPath    = ZipPath.Combine(gitZip);
                GitLfsZipPath = ZipPath.Combine(gitLfsZip);

                var gitInstallPath = baseDataPath.Combine(PackageNameWithVersion);

                GitInstallationPath = gitInstallPath;

                if (onWindows)
                {
                    GitExecutable    += "git.exe";
                    GitLfsExecutable += "git-lfs.exe";

                    GitExecutablePath = gitInstallPath.Combine("cmd", GitExecutable);
                }
                else
                {
                    GitExecutable    = "git";
                    GitLfsExecutable = "git-lfs";

                    GitExecutablePath = gitInstallPath.Combine("bin", GitExecutable);
                }

                GitLfsExecutablePath = GetGitLfsExecutablePath(gitInstallPath);
            }
예제 #3
0
            public GitInstallDetails(SPath baseDataPath, IEnvironment environment)
            {
                ZipPath = baseDataPath.Combine("downloads");
                ZipPath.EnsureDirectoryExists();

                GitInstallationPath = baseDataPath.Combine(GitDirectory);
                GitExecutablePath   = GitInstallationPath.Combine(environment.IsWindows ? "cmd" : "bin", "git" + UnityEnvironment.ExecutableExtension);
                //GitLfsExecutablePath = GitExecutablePath.Parent.Combine("git-lfs" + UnityEnvironment.ExecutableExtension);
                GitLfsExecutablePath = SPath.Default;
                GitPackageFeed       = packageFeed;
            }
예제 #4
0
            public GitInstallDetails(NPath baseDataPath, IEnvironment environment)
            {
                ZipPath = baseDataPath.Combine("downloads");
                ZipPath.EnsureDirectoryExists();

                GitInstallationPath = baseDataPath.Combine(GitDirectory);
                GitExecutablePath   = GitInstallationPath.Combine(environment.IsWindows ? "cmd" : "bin", "git" + DefaultEnvironment.ExecutableExt);

                GitLfsInstallationPath = GitLfsExecutablePath = GitInstallationPath;
                if (environment.IsWindows)
                {
                    GitLfsExecutablePath = GitLfsInstallationPath.Combine(environment.Is32Bit ? "mingw32" : "mingw64");
                }
                GitLfsExecutablePath = GitLfsExecutablePath.Combine("libexec", "git-core");
                GitLfsExecutablePath = GitLfsExecutablePath.Combine("git-lfs" + DefaultEnvironment.ExecutableExt);
                GitManifest          = baseDataPath.Combine(GitPackageName);
            }
예제 #5
0
        protected override void Execute(CodeActivityContext context)
        {
            string zipPath          = ZipPath.Get(context);
            string outputFolderPath = OutputFolderPath.Get(context);
            bool   result;

            try
            {
                ZipFile.ExtractToDirectory(zipPath, outputFolderPath);
                result = true;
            }
            catch (Exception ex)
            {
                result = false;
            }

            Result.Set(context, result);
        }
        /// <summary>
        /// Create a new AlgoSeekFuturesProcessor for enquing consolidated bars and flushing them to disk
        /// </summary>
        /// <param name="symbol">Symbol for the processor</param>
        /// <param name="date">Reference date for the processor</param>
        /// <param name="tickType">TradeBar or QuoteBar to generate</param>
        /// <param name="resolution">Resolution to consolidate</param>
        /// <param name="dataDirectory">Data directory for LEAN</param>
        public AlgoSeekFuturesProcessor(Symbol symbol, DateTime date, TickType tickType, Resolution resolution, string dataDirectory)
        {
            _symbol        = Safe(symbol);
            _tickType      = tickType;
            _referenceDate = date;
            _resolution    = resolution;
            _dataDirectory = dataDirectory;

            // Setup the consolidator for the requested resolution
            if (resolution == Resolution.Tick)
            {
                _consolidator = new IdentityDataConsolidator <Tick>();
            }
            else
            {
                switch (tickType)
                {
                case TickType.Trade:
                    _consolidator = new TickConsolidator(resolution.ToTimeSpan());
                    break;

                case TickType.Quote:
                    _consolidator = new TickQuoteBarConsolidator(resolution.ToTimeSpan());
                    break;

                case TickType.OpenInterest:
                    _consolidator = new OpenInterestConsolidator(resolution.ToTimeSpan());
                    break;
                }
            }

            var path = ZipPath.Replace(".zip", string.Empty);

            Directory.CreateDirectory(path);

            var file = Path.Combine(path, EntryPath);

            try
            {
                _streamWriter = new LazyStreamWriter(file);
            }
            catch (Exception err)
            {
                // we are unable to open new file - it is already opened due to bug in algoseek data
                Log.Error("File: {0} Err: {1} Source: {2} Stack: {3}", file, err.Message, err.Source, err.StackTrace);
                var newRandomizedName = (file + "-" + Math.Abs(file.GetHashCode()).ToString()).Replace(".csv", string.Empty) + ".csv";

                // we store the information under different (randomized) name
                Log.Trace("Changing name from {0} to {1}", file, newRandomizedName);
                _streamWriter = new LazyStreamWriter(newRandomizedName);
            }

            // On consolidating the bars put the bar into a queue in memory to be written to disk later.
            _consolidator.DataConsolidated += (sender, consolidated) =>
            {
                _streamWriter.WriteLine(LeanData.GenerateLine(consolidated, SecurityType.Future, Resolution));
            };

            Interlocked.Add(ref _curFileCount, 1);
            if (_curFileCount % 1000 == 0)
            {
                Log.Trace("Opened more files: {0}", _curFileCount);
            }
        }