[Quantproject-developers] QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRo
Brought to you by:
glauco_1
|
From: <gla...@us...> - 2003-11-13 23:19:51
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows
In directory sc8-pr-cvs1:/tmp/cvs-serv13106/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows
Added Files:
BuyAndHoldPercentageReturn.cs
Log Message:
Computes the buy and hold percentage return for the
account report summary object
--- NEW FILE: BuyAndHoldPercentageReturn.cs ---
using System;
using System.Data;
using QuantProject.ADT;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
using QuantProject.Business.Financial.Instruments;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
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 ExtendedDateTime( summary.AccountReport.StartDateTime , BarComponent.Open ) ) ) /
buyAndHoldInstrument.GetMarketValue(
new ExtendedDateTime( summary.AccountReport.StartDateTime , BarComponent.Open ) ) * 100;
this.rowDescription = "Buy & hold % return";
this.rowValue = summary.BuyAndHoldPercentageReturn;
}
}
}
}
|