[Quantproject-developers] QuantProject/b3_Data/DataProviders HistoricalDataProvider.cs,1.9,1.10
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2006-01-11 18:24:41
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataProviders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16510/b3_Data/DataProviders Modified Files: HistoricalDataProvider.cs Log Message: Added Cache property, to allow to use a non default ICache Index: HistoricalDataProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/HistoricalDataProvider.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** HistoricalDataProvider.cs 31 Jul 2005 20:04:09 -0000 1.9 --- HistoricalDataProvider.cs 11 Jan 2006 18:24:33 -0000 1.10 *************** *** 40,44 **** private static Hashtable cachedHistories = new Hashtable(); ! private static Cache privateCache = new Cache(); --- 40,45 ---- private static Hashtable cachedHistories = new Hashtable(); ! // private static Cache privateCache = new Cache(); ! private static ICache privateCache = new Cache(); *************** *** 64,67 **** --- 65,80 ---- } + /// <summary> + /// Caching class + /// </summary> + public static ICache Cache + { + get { return privateCache; } + set { privateCache = value; } + } + + /// <summary> + /// Provides historical data + /// </summary> public HistoricalDataProvider() { *************** *** 71,75 **** } ! // to be deleted public static void Add( string instrumentKey ) { --- 84,88 ---- } ! // to be deleted public static void Add( string instrumentKey ) { *************** *** 238,243 **** --- 251,262 ---- { double returnValue; + int firstSecond = DateTime.Now.Second; + int firstMillisecond = DateTime.Now.Millisecond; double adjustedClose = privateCache.GetQuote( instrumentKey , extendedDateTime.DateTime , QuoteField.AdjustedClose ); + int secondSecond = DateTime.Now.Second; + int secondMillisecond = DateTime.Now.Millisecond; + int elapsedMillisecond = ( secondSecond - firstSecond ) * + 1000 + ( secondMillisecond - firstMillisecond ); if ( extendedDateTime.BarComponent == BarComponent.Close ) returnValue = adjustedClose; |