Пример #1
0
		/// <summary>
		/// Gets the <see cref="VolumeCache"/> for the specified <see cref="IImageViewer"/> instance.
		/// </summary>
		public static VolumeCache GetVolumeCache(this IImageViewer imageViewer)
		{
			Platform.CheckForNullReference(imageViewer, "imageViewer");
			var instance = imageViewer.ExtensionData[typeof (VolumeCache)] as VolumeCache;
			if (instance == null)
				imageViewer.ExtensionData[typeof (VolumeCache)] = instance = new VolumeCache();
			return instance;
		}
Пример #2
0
        //Subtracts the current daily volume from the previous daily volume to return volume
        //for the current tick price. Only required for data APIs that do not supply tick volume.
        private double GetTickVolume(string Symbol, long CurrentDailyVolume)
        {
            for (int n = 0; n < m_VolumeCache.Count - 1; n++)
            {
                if (m_VolumeCache[n].Symbol == Symbol)
                {
                    if (m_VolumeCache[n].LastDailyVolume > 0 && CurrentDailyVolume > 0)
                    {
                        m_VolumeCache[n].LastTickVolume = CurrentDailyVolume - m_VolumeCache[n].LastDailyVolume;
                    }
                    m_VolumeCache[n].LastDailyVolume = CurrentDailyVolume;
                    return(m_VolumeCache[n].LastTickVolume);
                }
            }
            //Symbol wasn't found meaning no volume has been cached yet for this symbol
            VolumeCache vc = new VolumeCache {
                Symbol = Symbol
            };

            m_VolumeCache.Add(vc);
            return(0);
        }