private static commonClass.DataSeries MakeData(data.tmpDS.marketDataDataTable dataTbl, DataFields type) { commonClass.DataSeries ds = new commonClass.DataSeries(); switch (type) { case DataFields.Count: for (int idx = 0; idx < dataTbl.Count; idx++) { ds.Add(dataTbl[idx].val0); } break; case DataFields.Volume: for (int idx = 0; idx < dataTbl.Count; idx++) { ds.Add(dataTbl[idx].val1); } break; case DataFields.DateTime: for (int idx = 0; idx < dataTbl.Count; idx++) { ds.Add(dataTbl[idx].onDate.ToOADate()); } break; } return(ds); }
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); }
public data.tmpDS.marketDataDataTable GetMarketData_BySQL(string sqlCmd) { data.tmpDS.marketDataDataTable tbl = new data.tmpDS.marketDataDataTable(); DbAccess.LoadFromSQL(tbl, sqlCmd); return(tbl); }
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; }
public data.tmpDS.marketDataDataTable GetMarketData_BySQL(string sqlCmd) { data.tmpDS.marketDataDataTable tbl = new data.tmpDS.marketDataDataTable(); DbAccess.LoadFromSQL(tbl, sqlCmd); return tbl; }