コード例 #1
0
        private DataParams GetDataParams(DataId dataId, string folder, IDataSource dataSource)
        {
            var fileName = String.Format("{0}{1}.csv", dataId.Symbol, (int) dataId.Period);
            var path = Path.Combine(folder, "Data", dataId.Source, fileName);

            var dataParams = new DataParams
            {
                DataSourceName = dataId.Source,
                Symbol = dataId.Symbol,
                Period = dataId.Period,
                DataId = dataId,
                Path = path,
                StartDate = dataSource.StartDate,
                EndDate = dataSource.EndDate,
                IsUseStartDate = dataSource.IsUseStartDate,
                IsUseEndDate = dataSource.IsUseEndDate,
                MaximumBars = dataSource.MaximumBars,
                MaxIntrabarBars = dataSource.MaxIntrabarBars,
                MinimumBars = dataSource.MinimumBars,
                IsCheckDataAtLoad = dataSource.IsCheckDataAtLoad,
                IsCutOffBadData = dataSource.IsCutOffBadData,
                IsCutOffSatSunData = dataSource.IsCutOffSatSunData,
                IsFillInDataGaps = dataSource.IsFillInDataGaps,
                IsCacheData = dataSource.IsCacheDataFiles,
                IsLongData = false
            };

            return dataParams;
        }
コード例 #2
0
        private IDataSet LoadCsvFile(DataParams dataParams)
        {
            var dataFile = LoadDataFile(dataParams.Path);

            if (string.IsNullOrEmpty(dataFile))
                return null;

            var dataParser = new DataParser();
            var bars = dataParser.Parse(dataFile, (int) dataParams.Period);
            if (bars == 0)
                return null;

            IDataSet dataSet = new DataSet(dataParams.Symbol, dataParams.Period, bars);
            dataSet.DataId = dataParams.DataId;
            dataSet.DataParams = dataParams;
            dataSet.LoadingNote = dataParser.LoadingNote;

            for (var bar = 0; bar < bars; bar++)
                dataSet.UpdateBar(bar, dataParser.Bar[bar]);

            return dataSet;
        }