[Quantproject-developers] QuantProject/b3_Data MissingQuotesException.cs, 1.1, 1.2
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2007-09-05 22:06:21
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16387/b3_Data Modified Files: MissingQuotesException.cs Log Message: Added a new constructor, in order to permit a new object's instance for an array of tickers Index: MissingQuotesException.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/MissingQuotesException.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MissingQuotesException.cs 14 May 2006 15:36:13 -0000 1.1 --- MissingQuotesException.cs 5 Sep 2007 22:06:16 -0000 1.2 *************** *** 25,43 **** { /// <summary> ! /// Thrown when needed if an object DataTables.Quotes has no quotes ! /// for a given TimeFrame /// </summary> public class MissingQuotesException : Exception { private string ticker; private DateTime initialDateTime; private DateTime finalDateTime; public override string Message { get { ! return "No quotes available for ticker " + ! this.ticker + ", between " + this.initialDateTime.ToShortDateString() + ! " and " + this.finalDateTime.ToShortDateString(); } } --- 25,66 ---- { /// <summary> ! /// This kind of exception is intended to be thrown ! /// when a ticker or an array of ticker ! /// doesn't have the expected number of available ! /// quotes for a given time frame /// </summary> public class MissingQuotesException : Exception { private string ticker; + private string[] tickers = null; private DateTime initialDateTime; private DateTime finalDateTime; + private string message_getMessageForMissingQuotesForTickers() + { + string tickersSeparatedBySemicolon = null; + foreach (string ticker in this.tickers) + tickersSeparatedBySemicolon += ticker + ";" ; + return "Not all these tickers: " + + tickersSeparatedBySemicolon + + " have the same number of " + + "available quotes, " + + "between " + this.initialDateTime.ToShortDateString() + + " and " + this.finalDateTime.ToShortDateString(); + } public override string Message { get { ! if( this.tickers == null ) ! //this.tickers has not been set, and so the exception ! //refers to only one single ticker ! return "No quotes available for ticker " + ! this.ticker + ", between " + this.initialDateTime.ToShortDateString() + ! " and " + this.finalDateTime.ToShortDateString(); ! else // this.tickers has been set, so the ! // exception refers to two ore more tickers. ! // In other words, not all the tickers have the same ! // number of quotes for the given period ! return message_getMessageForMissingQuotesForTickers(); } } *************** *** 49,52 **** --- 72,82 ---- this.finalDateTime = finalDateTime; } + public MissingQuotesException( + string[] tickers,DateTime initialDateTime, DateTime finalDateTime ) + { + this.tickers = tickers; + this.initialDateTime = initialDateTime; + this.finalDateTime = finalDateTime; + } } } |