[Quantproject-developers] QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRo
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2005-01-09 22:14:45
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26806/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows Modified Files: BuyAndHoldPercentageReturn.cs Log Message: - the IHistoricalQuoteProvider "concept" has been introduced Index: BuyAndHoldPercentageReturn.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/BuyAndHoldPercentageReturn.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BuyAndHoldPercentageReturn.cs 29 Nov 2004 15:52:56 -0000 1.2 --- BuyAndHoldPercentageReturn.cs 9 Jan 2005 22:14:36 -0000 1.3 *************** *** 2,5 **** --- 2,6 ---- using System.Data; using QuantProject.ADT; + using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting.Reporting.Tables; using QuantProject.Business.Financial.Instruments; *************** *** 13,29 **** public class BuyAndHoldPercentageReturn : SummaryRow { ! public BuyAndHoldPercentageReturn( Summary summary ) { if ( summary.AccountReport.BuyAndHoldTicker != "" ) { // the report has to compare to a buy and hold benchmark ! Instrument buyAndHoldInstrument = new Instrument( summary.AccountReport.BuyAndHoldTicker ); ! summary.BuyAndHoldPercentageReturn = ! ( buyAndHoldInstrument.GetMarketValue( ! summary.AccountReport.EndDateTime ) - ! buyAndHoldInstrument.GetMarketValue( ! new EndOfDayDateTime( summary.AccountReport.StartDateTime , EndOfDaySpecificTime.MarketOpen ) ) ) / ! buyAndHoldInstrument.GetMarketValue( ! new EndOfDayDateTime( summary.AccountReport.StartDateTime , EndOfDaySpecificTime.MarketOpen ) ) * 100; this.rowDescription = "Buy & hold % return"; this.rowValue = summary.BuyAndHoldPercentageReturn; --- 14,31 ---- public class BuyAndHoldPercentageReturn : SummaryRow { ! public BuyAndHoldPercentageReturn( Summary summary , ! IHistoricalQuoteProvider historicalQuoteProvider ) { if ( summary.AccountReport.BuyAndHoldTicker != "" ) { // the report has to compare to a buy and hold benchmark ! double beginningMarketValue = historicalQuoteProvider.GetMarketValue( ! summary.AccountReport.BuyAndHoldTicker , ! new EndOfDayDateTime( summary.AccountReport.StartDateTime , EndOfDaySpecificTime.MarketOpen ) ); ! double finalMarketValue = historicalQuoteProvider.GetMarketValue( ! summary.AccountReport.BuyAndHoldTicker , ! summary.AccountReport.EndDateTime ); ! summary.BuyAndHoldPercentageReturn = ( finalMarketValue - beginningMarketValue ) / ! beginningMarketValue * 100; this.rowDescription = "Buy & hold % return"; this.rowValue = summary.BuyAndHoldPercentageReturn; |