[Quantproject-developers] QuantProject/b4_Business/a1_Financial/a2_Accounting Account.cs,1.12,1.13
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2005-01-09 19:39:59
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20175/b4_Business/a1_Financial/a2_Accounting Modified Files: Account.cs Log Message: - the IHistoricalQuoteProvider "concept" has been introduced - the GetMarketValue( EndOfDayDateTime endOfDayDateTime ) method has been removed - the GetProfitNetLoss( EndOfDayDateTime endOfDayDateTime ) method has been removed - the GetProfitNetLossHistory( EndOfDayDateTime finalDateTime ) method has been removed - the CreateReport method uses the the IHistoricalQuoteProvider "concept" now Index: Account.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Account.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Account.cs 3 Jan 2005 10:44:12 -0000 1.12 --- Account.cs 9 Jan 2005 19:39:51 -0000 1.13 *************** *** 32,35 **** --- 32,36 ---- using QuantProject.ADT.Histories; using QuantProject.Data.DataProviders; + using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting.Reporting; using QuantProject.Business.Financial.Accounting.Transactions; *************** *** 129,134 **** if ( this.accountReport == null ) // the account report has not been computed yet ! this.accountReport = this.CreateReport( this.Key , 1 , this.endOfDayTimer.GetCurrentTime() ); return this.accountReport.Summary.ReturnOnAccount; } --- 130,139 ---- if ( this.accountReport == null ) // the account report has not been computed yet ! { ! AccountReport accountReport = new AccountReport( this , ! new HistoricalAdjustedQuoteProvider() ); ! this.accountReport = accountReport.Create( this.Key , 1 , this.endOfDayTimer.GetCurrentTime() ); + } return this.accountReport.Summary.ReturnOnAccount; } *************** *** 207,218 **** ! public double GetMarketValue( EndOfDayDateTime endOfDayDateTime ) ! { ! return this.CashAmount + this.Portfolio.GetMarketValue( endOfDayDateTime ); ! } public double GetMarketValue( string ticker ) { ! return HistoricalDataProvider.GetMarketValue( ticker , ! this.endOfDayTimer.GetCurrentTime().GetNearestExtendedDateTime() ); } /// <summary> --- 212,222 ---- ! // public double GetMarketValue( EndOfDayDateTime endOfDayDateTime ) ! // { ! // return this.CashAmount + this.Portfolio.GetMarketValue( endOfDayDateTime ); ! // } public double GetMarketValue( string ticker ) { ! return this.dataStreamer.GetCurrentBid( ticker ); } /// <summary> *************** *** 223,251 **** { return this.cashAmount + ! this.Portfolio.GetMarketValue( this.endOfDayTimer.GetCurrentTime() ); } ! public double GetProfitNetLoss( EndOfDayDateTime endOfDayDateTime ) ! { ! return GetMarketValue( endOfDayDateTime ) + ! this.Transactions.TotalWithdrawn - ! this.Transactions.TotalAddedCash; ! } ! ! public History GetProfitNetLossHistory( EndOfDayDateTime finalDateTime ) ! { ! History history = new History(); ! Account account = new Account( "ToGetProfitNetLossHistory" ); ! foreach ( ArrayList arrayList in this.Transactions.Values ) ! foreach ( EndOfDayTransaction transaction in arrayList ) ! { ! account.Add( transaction ); ! history.MultiAdd( transaction.EndOfDayDateTime.DateTime , ! account.GetProfitNetLoss( transaction.EndOfDayDateTime ) ); ! } ! history.MultiAdd( finalDateTime.DateTime , ! account.GetProfitNetLoss( finalDateTime ) ); ! return history; ! } ! public string ToString( DateTime dateTime ) { --- 227,254 ---- { return this.cashAmount + ! this.Portfolio.GetMarketValue( this.dataStreamer ); } ! // public double GetProfitNetLoss( EndOfDayDateTime endOfDayDateTime ) ! // { ! // return GetMarketValue( endOfDayDateTime ) + ! // this.Transactions.TotalWithdrawn - ! // this.Transactions.TotalAddedCash; ! // } ! // public History GetProfitNetLossHistory( EndOfDayDateTime finalDateTime ) ! // { ! // History history = new History(); ! // Account account = new Account( "ToGetProfitNetLossHistory" ); ! // foreach ( ArrayList arrayList in this.Transactions.Values ) ! // foreach ( EndOfDayTransaction transaction in arrayList ) ! // { ! // account.Add( transaction ); ! // history.MultiAdd( transaction.EndOfDayDateTime.DateTime , ! // account.GetProfitNetLoss( transaction.EndOfDayDateTime ) ); ! // } ! // history.MultiAdd( finalDateTime.DateTime , ! // account.GetProfitNetLoss( finalDateTime ) ); ! // return history; ! // } ! // public string ToString( DateTime dateTime ) { *************** *** 254,272 **** "\nPortfolioContent : " + this.Portfolio.ToString() + "\nPortfolioMarketValue : " + this.Portfolio.GetMarketValue( ! new EndOfDayDateTime( dateTime , EndOfDaySpecificTime.MarketClose ) ) + ! "\nAccountProfitNetLoss : " + this.GetProfitNetLoss( ! new EndOfDayDateTime( dateTime , EndOfDaySpecificTime.MarketClose ) ); } public AccountReport CreateReport( string reportName , ! int numDaysForInterval , EndOfDayDateTime endDateTime ) ! { ! AccountReport accountReport = new AccountReport( this ); ! return accountReport.Create( reportName , numDaysForInterval , endDateTime ); ! } ! public AccountReport CreateReport( string reportName , ! int numDaysForInterval , EndOfDayDateTime endDateTime , string buyAndHoldTicker ) { ! AccountReport accountReport = new AccountReport( this ); return accountReport.Create( reportName , numDaysForInterval , endDateTime , buyAndHoldTicker ); --- 257,274 ---- "\nPortfolioContent : " + this.Portfolio.ToString() + "\nPortfolioMarketValue : " + this.Portfolio.GetMarketValue( ! this.dataStreamer ); } + // public AccountReport CreateReport( string reportName , + // int numDaysForInterval , EndOfDayDateTime endDateTime ) + // { + // AccountReport accountReport = new AccountReport( this ); + // return accountReport.Create( reportName , numDaysForInterval , endDateTime ); + // } public AccountReport CreateReport( string reportName , ! int numDaysForInterval , EndOfDayDateTime endDateTime , string buyAndHoldTicker , ! IHistoricalQuoteProvider historicalQuoteProvider) { ! AccountReport accountReport = new AccountReport( this , historicalQuoteProvider ); return accountReport.Create( reportName , numDaysForInterval , endDateTime , buyAndHoldTicker ); |