[Quantproject-developers] QuantProject/b4_Business/a2_Strategies WeightedPosition.cs, 1.3, 1.4 Weig
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:18:30
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16256 Modified Files: WeightedPosition.cs WeightedPositions.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: WeightedPosition.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/WeightedPosition.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** WeightedPosition.cs 14 Jan 2008 23:24:48 -0000 1.3 --- WeightedPosition.cs 29 Sep 2008 21:17:57 -0000 1.4 *************** *** 99,110 **** new HistoricalAdjustedQuoteProvider(); double todayMarketValueAtClose = ! historicalAdjustedQuoteProvider.GetMarketValue( ticker , ! new EndOfDayDateTime( dateTime , EndOfDaySpecificTime.MarketClose ) ); DateTime yesterday = dateTime.AddDays( -1 ); ! EndOfDayDateTime yesterdayAtClose = new ! EndOfDayDateTime( yesterday , EndOfDaySpecificTime.MarketClose ); double yesterdayMarketValueAtClose = historicalAdjustedQuoteProvider.GetMarketValue( ! ticker , yesterdayAtClose ); double dailyReturnForLongPosition = ( todayMarketValueAtClose / yesterdayMarketValueAtClose ) - 1; --- 99,112 ---- new HistoricalAdjustedQuoteProvider(); double todayMarketValueAtClose = ! historicalAdjustedQuoteProvider.GetMarketValue( ! ticker , HistoricalEndOfDayTimer.GetMarketClose( dateTime ) ); ! // new EndOfDayDateTime( dateTime , EndOfDaySpecificTime.MarketClose ) ); DateTime yesterday = dateTime.AddDays( -1 ); ! DateTime yesterdayAtClose = ! HistoricalEndOfDayTimer.GetMarketClose( yesterday ); ! // new EndOfDayDateTime( yesterday , EndOfDaySpecificTime.MarketClose ); double yesterdayMarketValueAtClose = historicalAdjustedQuoteProvider.GetMarketValue( ! ticker , yesterdayAtClose ); double dailyReturnForLongPosition = ( todayMarketValueAtClose / yesterdayMarketValueAtClose ) - 1; Index: WeightedPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/WeightedPositions.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** WeightedPositions.cs 27 Feb 2008 22:17:10 -0000 1.14 --- WeightedPositions.cs 29 Sep 2008 21:17:57 -0000 1.15 *************** *** 256,261 **** HistoricalAdjustedQuoteProvider historicalAdjustedQuoteProvider = new HistoricalAdjustedQuoteProvider(); ! EndOfDayDateTime endOfDayDateTime = ! new EndOfDayDateTime( dateTime , EndOfDaySpecificTime.MarketClose ); foreach( WeightedPosition weightedPosition in this.Values ) { --- 256,261 ---- HistoricalAdjustedQuoteProvider historicalAdjustedQuoteProvider = new HistoricalAdjustedQuoteProvider(); ! // EndOfDayDateTime endOfDayDateTime = ! // new EndOfDayDateTime( dateTime , EndOfDaySpecificTime.MarketClose ); foreach( WeightedPosition weightedPosition in this.Values ) { *************** *** 265,269 **** double tickerQuote = historicalAdjustedQuoteProvider.GetMarketValue( ! ticker , endOfDayDateTime ); double virtualQuantityForThisPosition = valueForThisPosition / tickerQuote; if ( weightedPosition.IsShort ) --- 265,269 ---- double tickerQuote = historicalAdjustedQuoteProvider.GetMarketValue( ! ticker , dateTime ); double virtualQuantityForThisPosition = valueForThisPosition / tickerQuote; if ( weightedPosition.IsShort ) *************** *** 299,306 **** foreach( string ticker in tickerVirtualQuantities.Keys ) { ! EndOfDayDateTime endOfDayDateTime = new EndOfDayDateTime( ! dateTime , EndOfDaySpecificTime.MarketClose ); double tickerQuote = historicalAdjustedQuoteProvider.GetMarketValue( ! ticker , endOfDayDateTime ); double virtualQuantity = (double)tickerVirtualQuantities[ ticker ]; virtualPortfolioValue += virtualQuantity * tickerQuote; --- 299,306 ---- foreach( string ticker in tickerVirtualQuantities.Keys ) { ! // EndOfDayDateTime endOfDayDateTime = new EndOfDayDateTime( ! // dateTime , EndOfDaySpecificTime.MarketClose ); double tickerQuote = historicalAdjustedQuoteProvider.GetMarketValue( ! ticker , dateTime ); double virtualQuantity = (double)tickerVirtualQuantities[ ticker ]; virtualPortfolioValue += virtualQuantity * tickerQuote; |