private static IKLineData Transfer_SrcIs1Minute(IKLineData data, KLinePeriod targetPeriod, ITradingTimeReader_Code startTimeReader) { KLinePeriod sourcePeriod = data.Period; if (sourcePeriod.PeriodType != targetPeriod.PeriodType) { return(Transfer_DifferentPeriod(data, targetPeriod, startTimeReader)); } List <KLineBar> charts = new List <KLineBar>(); int period = targetPeriod.Period; int startIndex = 0; int endIndex = startIndex + period - 1; endIndex = FindRealLastIndex_1Minute(data, startIndex, endIndex); while (startIndex < data.Length && endIndex < data.Length) { charts.Add(GetChart(data, startIndex, endIndex)); startIndex = endIndex + 1; endIndex = startIndex + period - 1; endIndex = FindRealLastIndex_1Minute(data, startIndex, endIndex); } return(GetKLineData(data.Code, charts)); }
private void Executor_OnDayFinished(object sender, StrategyDayFinishedArguments arguments) { IKLineData klineData = arguments.ExecutorInfo.CurrentKLineData; //Console.WriteLine(klineData.Code + "," + klineData + " Finished"); Console.WriteLine(arguments.ExecutorInfo.CurrentDayIndex + "|" + arguments.ExecutorInfo.TotalDayCount); }
private void TestKLineDataStore_SaveLoad(string uri) { string code = "m1005"; KLinePeriod period = KLinePeriod.KLinePeriod_1Minute; IDataStore dataStore = DataStoreFactory.CreateDataStore(uri); IKLineDataStore klineDataStore = dataStore.CreateKLineDataStore(); try { IKLineData klineData = MockDataLoader.GetKLineData(code, 20100107, 20100120, period); klineDataStore.Save(code, period, klineData); KLineData klineData2 = klineDataStore.LoadAll(code, period); AssertUtils.AssertEqual_KLineData(klineData, klineData2); Assert.AreEqual(20100107, klineDataStore.GetFirstTradingDay(code, period)); Assert.AreEqual(20100120, klineDataStore.GetLastTradingDay(code, period)); Console.WriteLine(klineDataStore.GetLastTradingTime(code, period)); } finally { klineDataStore.Delete(code, period); } }
private static IKLineData Transfer_SrcIs1Minute(IKLineData data, KLinePeriod targetPeriod) { KLinePeriod sourcePeriod = data.Period; if (sourcePeriod.PeriodType != targetPeriod.PeriodType) return Transfer_DifferentPeriod(data, targetPeriod); List<KLineBar> charts = new List<KLineBar>(); int period = targetPeriod.Period; int startIndex = 0; int endIndex = startIndex + period - 1; endIndex = FindRealLastIndex_1Minute(data, startIndex, endIndex); while (startIndex < data.Length && endIndex < data.Length) { charts.Add(GetChart(data, startIndex, endIndex)); startIndex = endIndex + 1; endIndex = startIndex + period - 1; endIndex = FindRealLastIndex_1Minute(data, startIndex, endIndex); } KLineData klineData = GetKLineData(charts); klineData.Period = targetPeriod; return klineData; }
public void TestCreateRealTimeDataNavigater() { DataReaderFactory fac = ResourceLoader.GetDefaultDataReaderFactory(); IRealTimeDataNavigater dataNavigater = fac.RealTimeDataNavigaterFactory.CreateNavigater("m05", 20100105.100521); IKLineData klineData = dataNavigater.GetKLineData(KLinePeriod.KLinePeriod_15Minute); Console.WriteLine(klineData); klineData = dataNavigater.GetKLineData(KLinePeriod.KLinePeriod_1Minute); Console.WriteLine(klineData); klineData = dataNavigater.GetKLineData(KLinePeriod.KLinePeriod_5Minute); Console.WriteLine(klineData); klineData = dataNavigater.GetKLineData(KLinePeriod.KLinePeriod_1Hour); Console.WriteLine(klineData); klineData = dataNavigater.GetKLineData(KLinePeriod.KLinePeriod_1Day); Console.WriteLine(klineData); klineData = dataNavigater.GetKLineData(KLinePeriod.KLinePeriod_5Second); Console.WriteLine(klineData); dataNavigater.NavigateForward_Period(KLinePeriod.KLinePeriod_1Minute, 1); klineData = dataNavigater.GetKLineData(KLinePeriod.KLinePeriod_15Minute); Console.WriteLine(klineData); klineData = dataNavigater.GetKLineData(KLinePeriod.KLinePeriod_1Minute); Console.WriteLine(klineData); klineData = dataNavigater.GetKLineData(KLinePeriod.KLinePeriod_5Minute); Console.WriteLine(klineData); klineData = dataNavigater.GetKLineData(KLinePeriod.KLinePeriod_1Hour); Console.WriteLine(klineData); klineData = dataNavigater.GetKLineData(KLinePeriod.KLinePeriod_1Day); Console.WriteLine(klineData); klineData = dataNavigater.GetKLineData(KLinePeriod.KLinePeriod_5Second); Console.WriteLine(klineData); }
public void TestCreate() { DataReaderFactory fac = ResourceLoader.GetDefaultDataReaderFactory(); List <KLinePeriod> periods = new List <KLinePeriod>(); periods.Add(KLinePeriod.KLinePeriod_5Minute); periods.Add(KLinePeriod.KLinePeriod_15Minute); periods.Add(KLinePeriod.KLinePeriod_1Hour); periods.Add(KLinePeriod.KLinePeriod_1Day); RealTimeDataNavigateForward_KLine navigater = new RealTimeDataNavigateForward_KLine(fac, "m05", 20100101, 20100701, KLinePeriod.KLinePeriod_1Minute, periods); IKLineData klineData_1Minute = navigater.GetKLineData(KLinePeriod.KLinePeriod_1Minute); Console.WriteLine(klineData_1Minute); IKLineData klineData_5Minute = navigater.GetKLineData(KLinePeriod.KLinePeriod_5Minute); Console.WriteLine(klineData_5Minute); IKLineData klineData_15Minute = navigater.GetKLineData(KLinePeriod.KLinePeriod_15Minute); Console.WriteLine(klineData_15Minute); IKLineData klineData_Hour = navigater.GetKLineData(KLinePeriod.KLinePeriod_1Hour); Console.WriteLine(klineData_Hour); //DataReaderFactory fac = ResourceLoader.GetDefaultDataReaderFactory(); //RealTimeDataNavigater_KLine navigater = new RealTimeDataNavigater_KLine(fac, "m05", 20100101, 20100701); //IKLineData klineData = navigater.GetKLineData(KLinePeriod.KLinePeriod_1Minute); //Assert.AreEqual("20100104.09,3121,3135,3121,3132,5090,0,520956", klineData.ToString()); }
public override void OnBar(Object sender, IStrategyOnBarArgument currentData) { IKLineData klineData = currentData.CurrentData.GetKLineData(MainKLinePeriod); GenMa(klineData); GenPoint(klineData); }
private IKLineData GetKLineData(string code, KLinePeriod klinePeriod, IList <int> openDates, float lastEndPrice, int lastEndHold) { List <IKLineData> klineDataList = new List <IKLineData>(); for (int i = 0; i < openDates.Count; i++) { int openDate = openDates[i]; IKLineData klineData = GetKLineData(code, openDate, klinePeriod); if (klineData != null) { klineDataList.Add(klineData); lastEndPrice = klineData.Arr_End[klineData.Length - 1]; lastEndHold = klineData.Arr_Hold[klineData.Length - 1]; } else { IList <double[]> tradingTime = GetTradingTime(code, openDate); IList <double[]> klineTimes = TradingTimeUtils.GetKLineTimeList(tradingTime, klinePeriod); klineData = DataTransfer_Tick2KLine.GetEmptyKLineData(klineTimes, lastEndPrice, lastEndHold); klineDataList.Add(klineData); } } return(KLineData.Merge(klineDataList)); }
public string Proceed() { string path = dataUpdateHelper.GetPath_KLineData(codeInfo.Code, date, klinePeriod); //if (!(codeInfo.Code.EndsWith("0000") || codeInfo.Code.EndsWith("MI"))) //if (!overwrite && File.Exists(path)) // return codeInfo.Code + "-" + date + "的K线数据已存在"; TickData tickData = (TickData)dataUpdateHelper.GetUpdatedTickData(codeInfo.Code, date); if (tickData == null) { tickData = (TickData)dataUpdateHelper.GetNewTickData(codeInfo.ServerCode, date); } //tick数据没有,则不生成对应K线数据 if (tickData == null) { string msg = codeInfo.Code + "-" + date + "的tick数据不存在"; LogHelper.Warn(GetType(), msg); return(msg); } IList <double[]> tradingPeriod = dataUpdateHelper.GetTradingTime(codeInfo.Code, date).TradingPeriods; //List<double[]> klineTimes = TradingTimeUtils.GetKLineTimeList_Full(tradingPeriod, KLinePeriod.KLinePeriod_1Minute); //timeListGetter.GetKLineTimeList(code, date, klinePeriod); this.klineData = DataTransfer_Tick2KLine.Transfer(tickData, tradingPeriod, KLinePeriod.KLinePeriod_1Minute, lastEndPrice, lastEndHold); CsvUtils_KLineData.Save(path, klineData); return("更新" + codeInfo.Code + "-" + date + "的" + klinePeriod + "K线完成"); }
private void KlineDataForward_OnBar(object sender, IKLineData klineData, int index) { if (OnBar != null) { OnBar(this, klineData, index); } }
public static void PrintKLineData(IKLineData klineData) { for (int i = 0; i < klineData.Length; i++) { Console.WriteLine(klineData.GetBar(i)); } }
public override void OnBar(Object sender, IStrategyOnBarArgument currentData) { IKLineData klineData = currentData.CurrentData.GetKLineData(KLinePeriod.KLinePeriod_1Minute); int currentBarPos = klineData.BarPos; int lastBarPos = currentBarPos - 5; if (lastBarPos < 0) { return; } //float endPrice = klineData.End; //float startPrice = klineData.GetBar(lastBarPos).Start; //int lowIndex = -1; //float lowPrice = float.MaxValue; //int highIndex = -1; //float highPrice = 0; //for (int i = lastBarPos; i <= currentBarPos; i++) //{ //} //float percent = (float)Math.Round((highPrice - lowPrice) / startPrice * 100, 2); //5分钟内涨幅超过 //if (percent > 0.5) //{ //} //currentData.GetKLineData(KLinePeriod.KLinePeriod_15Minute); }
public KLineAbstract(IKLineData klineData, int endIndex, int length) { this.klineData = klineData; this.length = length; this.startIndex = endIndex - length + 1; this.endIndex = endIndex; }
public void TestKLineDataReaderGetAll() { IKLineDataReader reader = DataReaderFactory.CreateDataReader(DataCenterUri.URI).KLineDataReader; IKLineData data_m01 = reader.GetAllData("m01", KLinePeriod.KLinePeriod_1Minute); IKLineData data_m03 = reader.GetAllData("m03", KLinePeriod.KLinePeriod_1Minute); AssertKLineTime(data_m01, data_m03); IKLineData data_m05 = reader.GetAllData("m05", KLinePeriod.KLinePeriod_1Minute); AssertKLineTime(data_m01, data_m05); IKLineData data_m07 = reader.GetAllData("m07", KLinePeriod.KLinePeriod_1Minute); AssertKLineTime(data_m01, data_m07); IKLineData data_m08 = reader.GetAllData("m08", KLinePeriod.KLinePeriod_1Minute); AssertKLineTime(data_m01, data_m08); IKLineData data_m09 = reader.GetAllData("m09", KLinePeriod.KLinePeriod_1Minute); AssertKLineTime(data_m01, data_m09); IKLineData data_m11 = reader.GetAllData("m11", KLinePeriod.KLinePeriod_1Minute); AssertKLineTime(data_m01, data_m11); IKLineData data_m12 = reader.GetAllData("m12", KLinePeriod.KLinePeriod_1Minute); AssertKLineTime(data_m01, data_m12); IKLineData data_m13 = reader.GetAllData("m13", KLinePeriod.KLinePeriod_1Minute); AssertKLineTime(data_m01, data_m13); IKLineData data_mmi = reader.GetAllData("mmi", KLinePeriod.KLinePeriod_1Minute); AssertKLineTime(data_m01, data_mmi); }
private void KlineDataForward_OnTick(object sender, IForwardOnTickArgument argument) { IKLineData klineData = ((IDataForward_Code)sender).GetKLineData(KLinePeriod.KLinePeriod_1Minute); //Console.WriteLine(tickData); Console.WriteLine(klineData); }
public IKLineData GetKLineDataByTick(string code, DataReaderFactory dataReaderFactory, KLinePeriod period, IList <int> dates) { IKLineData lastKLineData = null; float lastPrice = -1; List <IKLineData> klineDataList = new List <IKLineData>(); for (int i = 0; i < dates.Count; i++) { int openDate = dates[i]; TickData tickdata = dataReaderFactory.TickDataReader.GetTickData(code, openDate); List <double[]> openTimes = dataProvider.GetOpenTime(code, openDate); KLineData klineData; if (tickdata != null) { klineData = DataTransfer_Tick2KLine.Transfer(tickdata, period, openTimes, lastPrice); klineDataList.Add(klineData); lastPrice = klineData.arr_end[klineData.Length - 1]; } else { klineData = GetEmptyDayKLineData(code, openDate, openTimes, dataReaderFactory.OpenDateReader, lastKLineData); klineDataList.Add(klineData); } lastKLineData = klineData; } if (klineDataList.Count == 0) { return(null); } IKLineData data = KLineData.Merge(klineDataList); return(data); }
public void TestKLineDataIndex_DoIndex_Normal() { KLineData data_ = ResourceLoader.GetKLineData_1Min(); IKLineData data = data_.GetRange(0, 449); MockDataProvider provider = new MockDataProvider(); provider.DataPathDir = "testindex"; String targetPath = provider.GetDataPath() + "\\testindex.kline"; KLineDataStore store = new KLineDataStore(targetPath); store.Save(data); KLineDataIndexer indexer = new KLineDataIndexer(targetPath); indexer.DoIndex(); KLineDataIndexResult result = indexer.GetIndexResult(); Assert.AreEqual(2, result.DateList.Count); Assert.AreEqual(20131202, result.DateList[0]); Assert.AreEqual(20131203, result.DateList[1]); data = data_.GetRange(450, data_.Length - 1); store.Append(data); indexer.DoIndex(); result = indexer.GetIndexResult(); Assert.AreEqual(10, result.DateList.Count); Directory.Delete(provider.GetDataPath(), true); }
public void Change(IKLineData data, double time) { this.klineData = (KLineData_RealTime)data; this.code = data.Code; this.period = data.Period; this.ChangeTime(time); }
public void TestNavigate() { DataReaderFactory fac = ResourceLoader.GetDefaultDataReaderFactory(); List <KLinePeriod> periods = new List <KLinePeriod>(); periods.Add(KLinePeriod.KLinePeriod_5Minute); periods.Add(KLinePeriod.KLinePeriod_15Minute); periods.Add(KLinePeriod.KLinePeriod_1Hour); periods.Add(KLinePeriod.KLinePeriod_1Day); RealTimeDataNavigateForward_KLine navigater = new RealTimeDataNavigateForward_KLine(fac, "m05", 20100101, 20100701, KLinePeriod.KLinePeriod_1Minute, periods); navigater.NavigateForward(1); IKLineData klineData_1Minute = navigater.GetKLineData(KLinePeriod.KLinePeriod_1Minute); Console.WriteLine(klineData_1Minute); IKLineData klineData_5Minute = navigater.GetKLineData(KLinePeriod.KLinePeriod_5Minute); Console.WriteLine(klineData_5Minute); IKLineData klineData_15Minute = navigater.GetKLineData(KLinePeriod.KLinePeriod_15Minute); Console.WriteLine(klineData_15Minute); IKLineData klineData_Hour = navigater.GetKLineData(KLinePeriod.KLinePeriod_1Hour); Console.WriteLine(klineData_Hour); //IKLineData klineData_1Day = navigater.GetKLineData(KLinePeriod.KLinePeriod_1Day); //Console.WriteLine(klineData_1Day); }
public IDataCache_CodeDate GetCache_CodeDate(int date) { if (dicDateCache.ContainsKey(date)) { return(dicDateCache[date]); } lock (lockObj) { if (dicDateCache.ContainsKey(date)) { return(dicDateCache[date]); } IKLineData klineData = minuteDataGetter.GetKLineData(date); DataCache_CodeDate cache = new DataCache_CodeDate(dataReaderFactory, code, date, klineData, minuteDataGetter.LastEndPrice(date)); if (cachedKeies.Count > maxCacheDateCount) { int removedKey = cachedKeies[0]; cachedKeies.RemoveAt(0); dicDateCache.Remove(removedKey); } cachedKeies.Add(date); dicDateCache.Add(date, cache); return(cache); } }
private static KLineBar GetChart(IKLineData data, int startIndex, int endIndex) { //KLineChart chart = new KLineChart(); KLineBar chart = new KLineBar(); chart.Code = data.Code; chart.Time = data.Arr_Time[startIndex]; chart.Start = data.Arr_Start[startIndex]; chart.End = data.Arr_End[endIndex]; chart.Hold = data.Arr_Hold[endIndex]; float high = float.MinValue; float low = float.MaxValue; int mount = 0; float money = 0; for (int i = startIndex; i <= endIndex; i++) { float chigh = data.Arr_High[i]; float clow = data.Arr_Low[i]; high = high < chigh ? chigh : high; low = low > clow ? clow : low; mount += data.Arr_Mount[i]; money += data.Arr_Money[i]; } chart.High = high; chart.Low = low; chart.Mount = mount; chart.Money = money; return chart; }
public KLineData_Present(IKLineData historyKLineData, List <double> todayKlineTimeList, KLinePeriod period) : base(todayKlineTimeList.Count) { this.Period = period; int length = todayKlineTimeList.Count; this.arr_time = todayKlineTimeList.ToArray(); this.arr_start = new float[length]; this.arr_high = new float[length]; this.arr_low = new float[length]; this.arr_end = new float[length]; this.arr_mount = new int[length]; this.arr_money = new float[length]; this.arr_hold = new int[length]; this.historyKLineData = historyKLineData; this.list_Time = new ReadOnlyList_Merge <double>(historyKLineData.Arr_Time, arr_time); this.list_Start = new ReadOnlyList_Merge <float>(historyKLineData.Arr_Start, arr_start); this.list_High = new ReadOnlyList_Merge <float>(historyKLineData.Arr_High, arr_high); this.list_Low = new ReadOnlyList_Merge <float>(historyKLineData.Arr_Low, arr_low); this.list_End = new ReadOnlyList_Merge <float>(historyKLineData.Arr_End, arr_end); this.list_Mount = new ReadOnlyList_Merge <int>(historyKLineData.Arr_Mount, arr_mount); this.list_Money = new ReadOnlyList_Merge <float>(historyKLineData.Arr_Money, arr_money); this.list_Hold = new ReadOnlyList_Merge <int>(historyKLineData.Arr_Hold, arr_hold); this.BarPos = historyKLineData.Length; }
public static List <ITimeLineData> ConvertTimeLineDataList(IKLineData data, float lastEndPrice, ITradingDayReader openDateReader) { List <SplitterResult> splitResult = DaySplitter.Split(data, openDateReader); List <ITimeLineData> realdataList = new List <ITimeLineData>(splitResult.Count); for (int i = 0; i < splitResult.Count; i++) { SplitterResult split = splitResult[i]; int date = split.Date; int todayStartIndex = split.Index; int todayEndIndex; if (i == splitResult.Count - 1) { todayEndIndex = data.Length - 1; } else { todayEndIndex = splitResult[i + 1].Index; } int len = todayEndIndex - todayStartIndex + 1; TimeLineData r = new TimeLineData(lastEndPrice, len); r.Code = data.Code; Convert2RealData(data, todayStartIndex, todayEndIndex, r); realdataList.Add(r); } return(realdataList); }
private void DealEvent_OnBar() { if (isDayStart) { return; } if (OnBar != null && forwardPeriod.KlineForwardPeriod != null) { bool isForwardPeriodEnd = dic_KLinePeriod_IsEnd[forwardPeriod.KlineForwardPeriod]; if (isForwardPeriodEnd) { barFinishedInfos.Clear(); for (int i = 0; i < forwardData.ReferedKLinePeriods.Count; i++) { KLinePeriod period = forwardData.ReferedKLinePeriods[i]; bool isPeriodEnd = dic_KLinePeriod_IsEnd[period]; if (isPeriodEnd) { IKLineData klineData = forwardData.GetKLineData(period); int barPos = klineData.BarPos - 1; if (IsDayEnd) { barPos++; } barFinishedInfos.Add(new ForwardOnbar_Info(klineData, barPos)); } } //OnBar(this, mainKlineData, mainKlineData.BarPos); OnBar(this, onBarArgument); } } }
private void Init(IKLineData klineData, IList <ITradingTime> tradingTimes) { int currentKLineBarPos = 0; for (int i = 0; i < tradingTimes.Count; i++) { ITradingTime tradingTime = tradingTimes[i]; KLineDataTradingTimeInfo_Day timeInfo = CalcKLineTimeInfo_Day(tradingTime, klineData, currentKLineBarPos); if (timeInfo == null) { continue; } this.dic_TradingDay_KLineTimeInfo.Add(timeInfo.TradingDay, timeInfo); this.timeInfo_DayList.Add(timeInfo); currentKLineBarPos = timeInfo.EndPos; tradingDays.Add(tradingTime.TradingDay); } for (int i = 1; i < timeInfo_DayList.Count; i++) { int lastTradingDay = timeInfo_DayList[i - 1].TradingDay; KLineDataTradingTimeInfo_Day tradingTimeInfo_Day = (KLineDataTradingTimeInfo_Day)timeInfo_DayList[i]; int currentTradingDay = tradingTimeInfo_Day.TradingDay; tradingTimeInfo_Day.holidayCount = TimeUtils.Substract(currentTradingDay, lastTradingDay).Days - 1; } }
public virtual void OnStart(Object sender, IStrategyOnStartArgument argument) { if (mainKlineData == null && MainKLinePeriod != null) { mainKlineData = argument.CurrentData.GetKLineData(MainKLinePeriod); } }
private void TestKLineDataStore_LoadByDate(string uri) { string code = "m1005"; KLinePeriod klinePeriod = KLinePeriod.KLinePeriod_1Minute; IDataStore dataStore = DataStoreFactory.CreateDataStore(uri); IKLineDataStore klineDataStore = dataStore.CreateKLineDataStore(); try { IKLineData data = MockDataLoader.GetKLineData(code, 20100107, 20100120, klinePeriod); klineDataStore.Save(code, klinePeriod, data); IKLineData klineData = klineDataStore.Load(code, 20100107, 20100111, klinePeriod); IKLineData klineData2 = klineDataStore.Load(code, 20100112, 20100120, klinePeriod); List <IKLineData> ks = new List <IKLineData>(); ks.Add(klineData); ks.Add(klineData2); IKLineData klineData_Merge = KLineData.Merge(ks); //AssertUtils.PrintKLineData(data); //AssertUtils.PrintKLineData(klineData_Merge); AssertUtils.PrintKLineData(klineData); //AssertUtils.PrintKLineData(klineData_Merge); AssertUtils.AssertEqual_KLineData(data, klineData_Merge); } finally { klineDataStore.Delete(code, klinePeriod); } }
public void TestTransferTimeLineData() { IKLineData klineData = MockDataLoader.GetKLineData("m1505", 20150107, 20150107, KLinePeriod.KLinePeriod_1Minute); ITimeLineData timeLineData = DataTransfer_KLine2TimeLine.ConvertTimeLineData(klineData, 2849); AssertUtils.AssertEqual_TimeLineData("KLine2TimeLine_M05_20150107", GetType(), timeLineData); }
private void TestKLineDataStore_Append(string uri) { string code = "m1005"; KLinePeriod period = KLinePeriod.KLinePeriod_1Minute; IDataStore dataStore = DataStoreFactory.CreateDataStore(uri); IKLineDataStore klineDataStore = dataStore.CreateKLineDataStore(); try { IKLineData klineData = MockDataLoader.GetKLineData(code, 20100107, 20100114, period); IKLineData klineData2 = MockDataLoader.GetKLineData(code, 20100115, 20100120, period); List <IKLineData> ks = new List <IKLineData>(); ks.Add(klineData); ks.Add(klineData2); IKLineData klineData_Merge = KLineData.Merge(ks); klineDataStore.Save(code, period, klineData); klineDataStore.Append(code, period, klineData2); IKLineData klineData_Merge2 = klineDataStore.LoadAll(code, period); AssertUtils.AssertEqual_KLineData(klineData_Merge, klineData_Merge2); } finally { klineDataStore.Delete(code, period); } }
private static KLineBar GetChart_Day(IKLineData data, int startIndex, int endIndex) { KLineBar chart = GetChart(data, startIndex, endIndex); chart.Time = (int)data.Arr_Time[endIndex]; return(chart); }