コード例 #1
0
ファイル: SmartStorage.cs プロジェクト: ifzz/FDK
        public Quote[] GetQuotes(string symbol, DateTime startTime, DateTime endTime, int depth)
        {
            try
            {
                if (depth == 0)
                    depth = int.MaxValue;

                var manager = this.storage.GetOrCreateHistoryManager(symbol);
                var includeLevel2 = depth != 1;

                if (this.source != null)
                {
                    // online mode
                    if (!manager.TicksAreSynchronized(this.source, symbol, includeLevel2, startTime, endTime, false))
                        manager.SynchronizeTicks(this.source, symbol, includeLevel2, startTime, endTime, false, NullCallback);
                }

                var ticks = new List<TickValue>();
                if (startTime < endTime)
                    ForwardFillTicks(manager, symbol, includeLevel2, startTime, endTime, ticks);
                else
                    BackwardFillTicks(manager, symbol, includeLevel2, startTime, endTime, ticks);

                var converter = new StorageConvert();
                var result = ticks.Select(o => converter.ToQuote(symbol, o, depth)).ToArray();

                return result;
            }
            catch (StorageHistoryNotFoundException ex)
            {
                throw new HistoryNotFoundException("GetQuotes", ex);
            }
        }
コード例 #2
0
ファイル: DataFeedStorage.cs プロジェクト: ifzz/FDK
		/// <summary>
		/// The method append a new quote to the storage.
		/// </summary>
		/// <param name="quote"></param>
		public void Append(Quote quote)
		{
			var manager = this.GetOrCreateHistoryManager(quote.Symbol);
			var converter = new StorageConvert();
			var tick = converter.ToFeedTick(quote);
			manager.Append(tick);
		}