[Quantproject-developers] QuantProject/b3_Data/DataProviders/Caching Cache.cs,1.1,1.2
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2005-05-30 18:31:24
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Caching In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16205/b3_Data/DataProviders/Caching Modified Files: Cache.cs Log Message: - EarlyDateException is not used anymore - MissingQuoteException has been introduced Index: Cache.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Caching/Cache.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Cache.cs 26 May 2005 23:24:02 -0000 1.1 --- Cache.cs 30 May 2005 18:31:15 -0000 1.2 *************** *** 131,134 **** --- 131,139 ---- } #endregion + // private void getQuote_checkEarlyDateException( DateTime dateTime ) + // { + // if ( dateTime < ConstantsProvider.MinQuoteDateTime ) + // throw new EarlyDateException( dateTime ); + // } #region addPage // private void addTicker( string ticker ) *************** *** 157,175 **** // } // } ! private void addPage( string ticker , DateTime dateTime , QuoteField quoteField ) { if ( this.Count + 1 > this.maxNumPages ) this.removeUnusedPages(); ! CachePage cachePage = new CachePage( ticker , dateTime.Year , quoteField ); cachePage.LoadData(); ! this.Add( this.getKey( ticker , dateTime.Year , quoteField ) , cachePage ); this.currentNumPages ++ ; } #endregion public double GetQuote( string ticker , DateTime dateTime , QuoteField quoteField ) { double returnValue; ! if ( dateTime < ConstantsProvider.MinQuoteDateTime ) ! throw new EarlyDateException( dateTime ); if ( !this.ContainsKey( this.getKey( ticker , dateTime.Year , quoteField ) ) ) // the instrument instrumentKey has not been cached yet, for the given bar component --- 162,183 ---- // } // } ! private void addPage( string ticker , int year , QuoteField quoteField ) { if ( this.Count + 1 > this.maxNumPages ) this.removeUnusedPages(); ! CachePage cachePage = new CachePage( ticker , year , quoteField ); cachePage.LoadData(); ! this.Add( this.getKey( ticker , year , quoteField ) , cachePage ); this.currentNumPages ++ ; } + private void addPage( string ticker , DateTime dateTime , QuoteField quoteField ) + { + this.addPage( ticker , dateTime.Year , quoteField ); + } #endregion public double GetQuote( string ticker , DateTime dateTime , QuoteField quoteField ) { double returnValue; ! // this.getQuote_checkEarlyDateException( dateTime ); if ( !this.ContainsKey( this.getKey( ticker , dateTime.Year , quoteField ) ) ) // the instrument instrumentKey has not been cached yet, for the given bar component *************** *** 178,181 **** --- 186,199 ---- { CachePage cachePage = this.getCachePage( ticker , dateTime , quoteField ); + if ( cachePage.Quotes.Count == 0 ) + { + this.addPage( ticker , dateTime.Year - 1 , quoteField ); + cachePage = this.getCachePage( ticker , dateTime.Year - 1 , quoteField ); + if ( cachePage.Quotes.Count == 0 ) + // ticker has no quotes both in the dateTime year and in the + // previous year + throw new MissingQuoteException( ticker , dateTime ); + } + if ( cachePage.Rank != this.currentPageRank ) { |