[Quantproject-developers] QuantProject/b4_Business/a2_Strategies WeightedPositions.cs, 1.6, 1.7
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2007-09-05 22:07:25
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16885/b4_Business/a2_Strategies Modified Files: WeightedPositions.cs Log Message: Fixed bug in temporary method GetCloseToCloseReturn Index: WeightedPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/WeightedPositions.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** WeightedPositions.cs 28 Aug 2007 09:25:32 -0000 1.6 --- WeightedPositions.cs 5 Sep 2007 22:07:19 -0000 1.7 *************** *** 659,668 **** double equityValue = initialEquity; Quotes[] tickersQuotes = new Quotes[this.Count]; for(int i = 0; i < this.Count; i++) { tickersQuotes[i] = new Quotes( this[i].Ticker,startDate, endDate ); ! if(tickersQuotes[i].Rows.Count == 0) ! //no quotes are available at the given period ! throw new MissingQuotesException(this[i].Ticker, startDate, endDate); } --- 659,673 ---- double equityValue = initialEquity; Quotes[] tickersQuotes = new Quotes[this.Count]; + int numberOfQuotesOfPreviousTicker = 0; for(int i = 0; i < this.Count; i++) { tickersQuotes[i] = new Quotes( this[i].Ticker,startDate, endDate ); ! if( i == 0 ) ! numberOfQuotesOfPreviousTicker = tickersQuotes[i].Rows.Count; ! else if ( (i > 0 && ( tickersQuotes[i].Rows.Count > numberOfQuotesOfPreviousTicker)) || ! tickersQuotes[i].Rows.Count == 0) ! // not all the tickers have the same available n. of quotes ! // for the given period or a ticker has no quotes ! throw new MissingQuotesException(this.SignedTickers.Tickers, startDate, endDate); } |