[Quantproject-developers] QuantProject/b5_Presentation/Reporting/WindowsForm EquityChartTabPage.cs,1
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2005-01-20 01:26:03
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5166/b5_Presentation/Reporting/WindowsForm Modified Files: EquityChartTabPage.cs Log Message: The benchmark buy and hold equity line has been added to the report Index: EquityChartTabPage.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm/EquityChartTabPage.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EquityChartTabPage.cs 1 Aug 2004 00:31:53 -0000 1.2 --- EquityChartTabPage.cs 20 Jan 2005 01:25:54 -0000 1.3 *************** *** 21,27 **** --- 21,31 ---- */ using System; + using System.Drawing; using System.Windows.Forms; using QuantProject.ADT.Histories; + using QuantProject.Data.DataProviders; + using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting.Reporting; + using QuantProject.Business.Timing; using QuantProject.Presentation.Charting; *************** *** 35,39 **** private AccountReport accountReport; private Chart equityChart; ! public EquityChartTabPage( AccountReport accountReport ) { --- 39,65 ---- private AccountReport accountReport; private Chart equityChart; ! private History equity = new History(); ! private History benchmark; ! ! /// <summary> ! /// Returns the history for the BuyAndHoldTicker, normalized for ! /// a proper display, that is, to be displayed overlapped to ! /// the equity line ! /// </summary> ! /// <returns></returns> ! private History getBenchmark() ! { ! History buyAndHoldTickerEquityLine = ! HistoricalDataProvider.GetAdjustedCloseHistory( ! this.accountReport.BuyAndHoldTicker ); ! HistoricalAdjustedQuoteProvider quoteProvider = ! new HistoricalAdjustedQuoteProvider(); ! DateTime firstDate = (DateTime)this.equity.GetKey( 0 ); ! double normalizingFactor = ! ( double )this.equity[ firstDate ] / ! ( double )quoteProvider.GetMarketValue( this.accountReport.BuyAndHoldTicker , ! new EndOfDayDateTime( firstDate , EndOfDaySpecificTime.MarketClose ) ); ! return buyAndHoldTickerEquityLine.MultiplyBy( normalizingFactor ); ! } public EquityChartTabPage( AccountReport accountReport ) { *************** *** 42,50 **** this.equityChart = new Chart(); this.equityChart.Dock = DockStyle.Fill; ! History historyToBeCharted = new History(); ! historyToBeCharted.Import( this.accountReport.Equity.DataTable , QuantProject.Business.Financial.Accounting.Reporting.Tables.Equity.Date , QuantProject.Business.Financial.Accounting.Reporting.Tables.Equity.AccountValue ); ! this.equityChart.Add( historyToBeCharted ); this.Controls.Add( this.equityChart ); } --- 68,78 ---- this.equityChart = new Chart(); this.equityChart.Dock = DockStyle.Fill; ! this.equity.Import( this.accountReport.Equity.DataTable , QuantProject.Business.Financial.Accounting.Reporting.Tables.Equity.Date , QuantProject.Business.Financial.Accounting.Reporting.Tables.Equity.AccountValue ); ! this.equityChart.Add( equity , Color.Red ); ! this.benchmark = this.getBenchmark(); ! this.equityChart.Add( benchmark , Color.Blue , (DateTime)this.equity.GetKey( 0 ) , ! (DateTime)this.equity.GetKey( this.equity.Count - 1 ) ); this.Controls.Add( this.equityChart ); } |