Exemple #1
0
        /// <summary>
        /// Constructors to create a market indicator's data for specific stock list
        /// </summary>
        /// <param name="timeRange"></param>
        /// <param name="timeScale"></param>
        /// <param name="stockCodes"></param>
        public MarketData(commonClass.AppTypes.TimeRanges timeRange, commonClass.AppTypes.TimeScale timeScale, StringCollection stockCodes)
        {
            DateTime startDate = DateTime.Today, endDate = DateTime.Today;

            commonClass.AppTypes.GetDate(timeRange, out startDate, out endDate);
            this.Init(startDate, endDate, timeScale, stockCodes);
        }
Exemple #2
0
        /// <summary>
        /// Constructors to create a market indicator's data for all enable stock
        /// </summary>
        /// <param name="timeRange"></param>
        /// <param name="timeScale"></param>
        public MarketData(commonClass.AppTypes.TimeRanges timeRange, commonClass.AppTypes.TimeScale timeScale)
        {
            DateTime startDate = DateTime.Today, endDate = DateTime.Today;

            commonClass.AppTypes.GetDate(timeRange, out startDate, out endDate);
            this.Init(startDate, endDate, timeScale, null);
        }
Exemple #3
0
 public BaseAnalysisData(commonClass.AppTypes.TimeRanges timeRange,
                         commonClass.AppTypes.TimeScale timeScale,
                         string stockCode, DataAccessMode accessMode)
 {
     this.DataTimeScale = timeScale;
     this.DataTimeRange = timeRange;
     this.DataStockCode = stockCode;
     this.AccessMode    = accessMode;
     ClearCache();
     LoadData();
 }
Exemple #4
0
 private void Init(DateTime startDateTime, DateTime endDateTime, commonClass.AppTypes.TimeScale timeScale, StringCollection stockCodes)
 {
     this.Cache.Clear();
     this.StartDateTime = startDateTime;
     this.EndDateTime   = endDateTime;
     if (stockCodes != null && stockCodes.Count != 0)
     {
         this.StockCodeList = common.system.MakeConditionStr(stockCodes, "'", "'", ",");
     }
     else
     {
         this.StockCodeList = null;
     }
     this.TimeScale = timeScale;
 }
Exemple #5
0
        private static data.tmpDS.marketDataDataTable GetMarketData(DateTime frDate, DateTime toDate, commonClass.AppTypes.TimeScale timeScale, string stockCodeList, DataTypes type)
        {
            string sqlCond = "";

            if (timeScale != commonClass.AppTypes.MainDataTimeScale)
            {
                sqlCond += (sqlCond == "" ? "" : " AND ") + " type='" + timeScale.Code + "'";
            }
            sqlCond += (sqlCond == "" ? "" : " AND ") +
                       "onDate BETWEEN '" + common.system.ConvertToSQLDateString(frDate) + "'" +
                       " AND '" + common.system.ConvertToSQLDateString(toDate) + "'";

            sqlCond += (sqlCond == "" ? "" : " AND ");
            switch (type)
            {
            case DataTypes.Advancing: sqlCond += "closePrice>openPrice"; break;

            case DataTypes.Declining: sqlCond += "closePrice<openPrice"; break;

            default: sqlCond += "closePrice=openPrice"; break;
            }

            if (stockCodeList != null && stockCodeList != "")
            {
                sqlCond += (sqlCond == "" ? "" : " AND ") + " stockCode IN  (" + stockCodeList + ")";
            }
            else
            {
                sqlCond += (sqlCond == "" ? "" : " AND ") +
                           " stockCode IN  (SELECT code FROM stockCode WHERE status & " + ((byte)commonClass.AppTypes.CommonStatus.Enable).ToString() + ">0)";
            }
            string sqlCmd =
                "SELECT onDate,COUNT(*) AS val0,SUM(volume) AS val1" +
                " FROM " + (timeScale == commonClass.AppTypes.MainDataTimeScale ? "priceData" : "priceDataSum") +
                " WHERE " + sqlCond +
                " GROUP BY onDate ORDER BY onDate";

            data.tmpDS.marketDataDataTable tbl = new data.tmpDS.marketDataDataTable();
            DbAccess.LoadFromSQL(tbl, sqlCmd);
            return(tbl);
        }
Exemple #6
0
 private MarketData(DateTime startDateTime, DateTime endDateTime, commonClass.AppTypes.TimeScale timeScale)
 {
     this.Init(startDateTime, endDateTime, timeScale, null);
 }
Exemple #7
0
 //Constructors
 private MarketData(DateTime startDateTime, DateTime endDateTime, commonClass.AppTypes.TimeScale timeScale, StringCollection stockCodes)
 {
     this.Init(startDateTime, endDateTime, timeScale, stockCodes);
 }
Exemple #8
0
 public AnalysisData(commonClass.AppTypes.TimeRanges timeRange, commonClass.AppTypes.TimeScale timeScale, string stockCode, DataAccessMode accessMode)
     : base(timeRange, timeScale, stockCode, accessMode)
 {
 }
Exemple #9
0
 private void Init(DateTime startDateTime, DateTime endDateTime, commonClass.AppTypes.TimeScale timeScale, StringCollection stockCodes)
 {
     this.Cache.Clear();
     this.StartDateTime = startDateTime;
     this.EndDateTime = endDateTime;
     if (stockCodes != null && stockCodes.Count != 0)
         this.StockCodeList = common.system.MakeConditionStr(stockCodes, "'", "'", ",");
     else this.StockCodeList = null;
     this.TimeScale = timeScale;
 }