Exemple #1
0
		/// <summary>
		///   建構子
		/// </summary>
		/// <param name="source">SeriesSymbolData 商品資料類別</param>
		/// <param name="request">資料請求結構</param>
		internal SeriesSymbolDataRand(SeriesSymbolData source, InstrumentDataRequest request) {
			__cSource = source;
			__cSource.onRequestCompleted += SeriesSymbolData_onRequestCompleted;  //附掛請求歷史資料完成的事件通知

			__cIndexer = source.Indexer;
			__iBaseAdjustTotal = __cIndexer.AdjustTotalCount;
			source.Clone(out __cTimes, out __cOpens, out __cHighs, out __cLows, out __cCloses, out __cVolumes);

			__iHistoryIndex = __cCloses.Count - (request.Range.Count + source.RealtimeCount);
			this.Current = 1;  //預設值索引從 1 開始(內部會自動計算對應至 SeriesSymbolData 序列資料的正確索引位置)

			string sDataSource = source.DataRequest.DataFeed;
			AbstractQuoteService cService = QuoteManager.Manager.GetQuoteService(sDataSource);
			if (cService != null) {
				__cQuoteStorage = cService.Storage;
			}
		}
		internal SeriesSymbolDataRand(SeriesSymbolData source, int maxBarsReferance) {
			__cIndexer = source.Indexer;
			__iBaseAdjustTotal = __cIndexer.AdjustTotalCount;
			source.Clone(out __cTimes, out __cOpens, out __cHighs, out __cLows, out __cCloses, out __cVolumes);

			if (maxBarsReferance > 0) {
				__iIgnoreBarsCount = __cCloses.Count - source.RealtimeCount - maxBarsReferance;
				if (__iIgnoreBarsCount < 0) {
					__iIgnoreBarsCount = 0;
				}
			}
		}