Ejemplo n.º 1
0
        public override void LoadTradingDate(ATimeSeries ts)
        {
            try
            {
                //数据已经存在
                if (_TradingDays == null || _TimeSeriesStart != ts.TimeSeriesStartExtended || _TimeSeriesEnd != ts.TimeSeriesEnd)
                {
                    _TimeSeriesStart = ts.TimeSeriesStartExtended;
                    _TimeSeriesEnd   = ts.TimeSeriesEnd;

                    //读数据: 这里不需要TimeSeriesStartExtended
                    string sql = @"SELECT Tdate
                                FROM TRADEDATE 
                                WHERE Exchange = 'CNSESH' 
                                AND TDate>='" + _TimeSeriesStart.ToString("yyyyMMdd")
                                 + @"' AND TDate<='" + _TimeSeriesEnd.ToString("yyyyMMdd") + "' ORDER BY TDate Desc";

                    _TradingDays = base.DBInstance.ExecuteSQL(sql);
                }

                //更新数据
                ts.TradingDates.Clear();

                if (_TradingDays == null || _TradingDays.Tables.Count == 0 || _TradingDays.Tables[0].Rows.Count == 0)
                {
                    return;
                }

                foreach (DataRow row in _TradingDays.Tables[0].Rows)
                {
                    DateTime tradedate = DataManager.ConvertToDate(row[C_ColName_TradeDate]);
                    ts.TradingDates.Add(tradedate);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
 public abstract void LoadTradingDate(ATimeSeries ts);