Example #1
0
        public static data.baseDS.lastPriceDataDataTable GetLastPrice(commonClass.PriceDataType type)
        {
            switch (type)
            {
            case PriceDataType.Close: return(lastPriceDataTA.GetClosePrice());

            case PriceDataType.Open: return(lastPriceDataTA.GetOpenPrice());
            }
            return(null);
        }
Example #2
0
        public data.baseDS.lastPriceDataDataTable GetLastPrice(commonClass.PriceDataType type)
        {
            string cacheName = "lastPrice-" + type.ToString();

            data.baseDS.lastPriceDataDataTable dataTbl = null;
            object obj = sysDataCache.Find(cacheName);

            if (obj == null)
            {
                dataTbl = DbAccess.GetLastPrice(type);
                sysDataCache.Add(cacheName, new DataCacheItem(dataTbl));
                return(dataTbl);
            }
            if ((obj as DataCacheItem).timeStamp + TimeSpan.FromSeconds(commonClass.Settings.sysDataDelayTimeInSecs).Ticks > DateTime.Now.Ticks)
            {
                return((data.baseDS.lastPriceDataDataTable)(obj as DataCacheItem).data);
            }
            dataTbl = DbAccess.GetLastPrice(type);
            sysDataCache.Add(cacheName, new DataCacheItem(dataTbl));
            return(dataTbl);
        }
Example #3
0
 public static data.baseDS.lastPriceDataDataTable GetLastPrice(commonClass.PriceDataType type)
 {
     return(myClient.GetLastPrice(type));
 }