protected override void OnQuoteDateTime(QuoteDateTimeEvent e) { bool bFlag = false; lock (__oLock) { bFlag = __bFlag; __bFlag = true; } if (!bFlag) { DateTime cTime = e.QuoteDateTime; TimeSpan cTimeSpan = cTime.TimeOfDay; if (cTimeSpan >= __cStartTime && cTimeSpan <= __cStopTime) { if (cTime.Second == 0) { __cList.Add(__cTrust); __cTrust = new __Trust(); __cTrust.time = e.QuoteDateTime; CalcTrust(); System.Console.WriteLine(e.QuoteDateTime); } else { CalcTrust(); } } else { if (__bSaveFile && cTimeSpan > __cStopTime) { //收盤存檔 __bSaveFile = false; __cList.Add(__cTrust); Save(); System.Console.WriteLine("Save trust to file..."); } if (__cList.Count > 0 && (cTimeSpan > __cClearTime && cTimeSpan < __cStartTime)) { __bSaveFile = true; __cList.Clear(); System.Console.WriteLine("Clear trust structure..."); } } lock (__oLock) { __bFlag = false; } } }
protected override void Create() { __cTrust = new __Trust(); __cTrust.time = DateTime.MinValue; __cList = new List<__Trust>(512); }