Example #1
0
        ///// <summary>
        ///// Information about data service that was used to
        ///// retrieve this site
        ///// </summary>
        //public virtual DataServiceInfo DataService { get; set; }

        /// <summary>
        /// Associates a data series with this site
        /// </summary>
        /// <param name="dataSeries">the data series</param>
        public void AddDataSeries(Series dataSeries)
        {
            if (DataSeriesList == null)
            {
                DataSeriesList = new List <Series>();
            }

            DataSeriesList.Add(dataSeries);
        }
Example #2
0
        public DataSeriesList GetDataSeries()
        {
            DataSeriesList list = new DataSeriesList();

            foreach (FileSeries fs in this.file.Series)
            {
                list.Add(fs);
            }
            return(list);
        }
Example #3
0
        private void AddSimulatedSeries(Instrument instrument, string seriesSuffix, bool subscribe)
        {
            //-------------------------------下面一段是为了读出存储在按月分区目录中的数据序列
            DataSeriesList dataSeries = null;

            if (this.seriesNamesToPartitionStore.Contains(seriesSuffix))
            {
                DateTime curDate = Clock.Now.Date;
                this.changeStoreFileForTime(curDate);
                if (this.lastFile != null)
                {
                    dataSeries = new DataSeriesList();
                    foreach (FileSeries series in this.lastFile.Series)
                    {
                        if (!series.Name.StartsWith(string.Concat(instrument.Symbol, '.')))
                        {
                            continue;
                        }
                        dataSeries.Add(series);
                    }
                }
            }
            if (dataSeries == null || dataSeries.Count <= 0)
            {
                dataSeries = instrument.GetDataSeries();
            }
            ///以上为自己添加
            ///下面的为原代码,第一句已在上面使用,第二句貌似是多余的
            //dataSeries = instrument.GetDataSeries();
            //new Regex(seriesSuffix);
            foreach (IDataSeries dataSeries2 in dataSeries)
            {
                if (dataSeries2.Name.Substring(instrument.Symbol.Length + 1) == seriesSuffix)
                {
                    if (subscribe)
                    {
                        if (!this.simulator.InputSeries.Contains(dataSeries2))
                        {
                            this.simulator.InputSeries.Add(dataSeries2);
                            if (!this.seriesTable.Contains(dataSeries2))
                            {
                                this.seriesTable.Add(dataSeries2, instrument);
                            }
                        }
                    }
                    else
                    {
                        this.simulator.InputSeries.Remove(dataSeries2);
                        this.seriesTable.Remove(dataSeries2);
                    }
                }
            }
        }
Example #4
0
        public static DataSeriesList GetDataSeries(Instrument instrument)
        {
            DataSeriesList dsList = new DataSeriesList();

            foreach (IDataSeries series in DataManager.server.GetDataSeries())
            {
                if (series.Name.StartsWith(instrument.Symbol + SERIES_SEPARATOR))
                {
                    dsList.Add(series);
                }
            }
            return(dsList);
        }