quantproject-developers Mailing List for QuantProject (Page 106)
Brought to you by:
glauco_1
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
(103) |
Dec
(67) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(52) |
Feb
(9) |
Mar
(69) |
Apr
(53) |
May
(80) |
Jun
(23) |
Jul
(24) |
Aug
(112) |
Sep
(9) |
Oct
|
Nov
(58) |
Dec
(93) |
| 2005 |
Jan
(90) |
Feb
(93) |
Mar
(61) |
Apr
(56) |
May
(37) |
Jun
(61) |
Jul
(55) |
Aug
(68) |
Sep
(25) |
Oct
(46) |
Nov
(41) |
Dec
(37) |
| 2006 |
Jan
(33) |
Feb
(7) |
Mar
(19) |
Apr
(27) |
May
(73) |
Jun
(49) |
Jul
(83) |
Aug
(66) |
Sep
(45) |
Oct
(16) |
Nov
(15) |
Dec
(7) |
| 2007 |
Jan
(14) |
Feb
(33) |
Mar
|
Apr
(21) |
May
|
Jun
(34) |
Jul
(18) |
Aug
(100) |
Sep
(39) |
Oct
(55) |
Nov
(12) |
Dec
(2) |
| 2008 |
Jan
(120) |
Feb
(133) |
Mar
(129) |
Apr
(104) |
May
(42) |
Jun
(2) |
Jul
(52) |
Aug
(99) |
Sep
(134) |
Oct
|
Nov
(137) |
Dec
(48) |
| 2009 |
Jan
(48) |
Feb
(55) |
Mar
(61) |
Apr
(3) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(51) |
Sep
|
Oct
(7) |
Nov
|
Dec
|
| 2010 |
Jan
(7) |
Feb
(1) |
Mar
(145) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(8) |
Dec
|
| 2011 |
Jan
(78) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(88) |
Sep
(6) |
Oct
(1) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Marco M. <mi...@us...> - 2005-06-24 23:06:50
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23652/Downloader/TickerSelectors Modified Files: TickerSelectorForm.cs Log Message: Fixed little bug in TickerSelectorForm Index: TickerSelectorForm.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors/TickerSelectorForm.cs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** TickerSelectorForm.cs 17 May 2005 23:15:45 -0000 1.15 --- TickerSelectorForm.cs 24 Jun 2005 23:06:34 -0000 1.16 *************** *** 609,613 **** private void setVisibilityForControls_QuotedAtEachMarketDay(bool showControls) { ! this.checkBoxASCMode.Enabled = showControls==false; this.labelMarketIndexKey.Visible = showControls; this.textBoxMarketIndex.Visible = showControls; --- 609,613 ---- private void setVisibilityForControls_QuotedAtEachMarketDay(bool showControls) { ! this.checkBoxASCMode.Enabled = showControls; this.labelMarketIndexKey.Visible = showControls; this.textBoxMarketIndex.Visible = showControls; |
|
From: Marco M. <mi...@us...> - 2005-06-24 22:55:28
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17675/b7_Scripts Modified Files: Scripts.prjx Log Message: Updated #develop projects files. Index: Scripts.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/Scripts.prjx,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Scripts.prjx 2 Jun 2005 18:02:08 -0000 1.5 --- Scripts.prjx 24 Jun 2005 22:54:51 -0000 1.6 *************** *** 34,37 **** --- 34,40 ---- <File name=".\TickerSelectionTesting\RunTestOptimizedCTCPortfolio.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\TickerSelectionTesting\EndOfDayTimerHandlerCTCTest.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\SimpleTesting\OneRank\OneRankForm.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\TickerSelectionTesting\EndOfDayTimerHandlerLastChosenPortfolio.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\TickerSelectionTesting\RunLastChosenPortfolioOutOfSample.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References> |
|
From: Marco M. <mi...@us...> - 2005-06-24 22:55:26
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17675/b4_Business Modified Files: Business.prjx Log Message: Updated #develop projects files. Index: Business.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/Business.prjx,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Business.prjx 19 Apr 2005 18:26:57 -0000 1.3 --- Business.prjx 24 Jun 2005 22:54:50 -0000 1.4 *************** *** 88,91 **** --- 88,94 ---- <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\PercentageWinningPeriods.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\NumberEvenPeriods.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\DoubleSummaryRow.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\IntegerSummaryRow.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\PercentageSummaryRow.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References> |
|
From: Marco M. <mi...@us...> - 2005-06-24 22:55:26
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17675/b5_Presentation Modified Files: Presentation.prjx Log Message: Updated #develop projects files. Index: Presentation.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Presentation.prjx,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Presentation.prjx 11 Apr 2005 18:45:49 -0000 1.3 --- Presentation.prjx 24 Jun 2005 22:54:51 -0000 1.4 *************** *** 15,18 **** --- 15,19 ---- <File name=".\Reporting\WindowsForm\SummaryTabPage.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\Reporting\WindowsForm\AccountViewer.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\Reporting\WindowsForm\SummaryItem.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References> |
|
From: Marco M. <mi...@us...> - 2005-06-24 22:55:24
|
Update of /cvsroot/quantproject/QuantProject/b91_QuantProject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17675/b91_QuantProject Modified Files: app.config Log Message: Updated #develop projects files. Index: app.config =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b91_QuantProject/app.config,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** app.config 13 Mar 2005 20:28:54 -0000 1.2 --- app.config 24 Jun 2005 22:54:51 -0000 1.3 *************** *** 9,12 **** --- 9,13 ---- <add key="AccountsArchive" value="C:\\Documents and Settings\\Marco\\Documenti\\ProgettiOpenSource\\Quant\\SavedAccounts\\" /> <add key="ReportsArchive" value="C:\\Documents and Settings\\Marco\\Documenti\\ProgettiOpenSource\\Quant\\SavedReports\\" /> + <add key="TransactionsArchive" value="C:\\Documents and Settings\\Marco\\Documenti\\ProgettiOpenSource\\Quant\\SavedTransactions\\" /> </appSettings> |
|
From: Marco M. <mi...@us...> - 2005-06-24 22:54:59
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17675/b3_Data Modified Files: Data.prjx Log Message: Updated #develop projects files. Index: Data.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Data.prjx,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Data.prjx 2 Jun 2005 18:02:08 -0000 1.6 --- Data.prjx 24 Jun 2005 22:54:50 -0000 1.7 *************** *** 37,40 **** --- 37,41 ---- <File name=".\DataProviders\Caching\EarlyDateException.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\DataProviders\Caching\CachePage.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\DataProviders\Caching\MissingQuoteException.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References> |
|
From: Marco M. <mi...@us...> - 2005-06-24 22:54:59
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17675/b1_ADT Modified Files: ADT.prjx Log Message: Updated #develop projects files. Index: ADT.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ADT.prjx,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ADT.prjx 2 Jun 2005 18:02:07 -0000 1.3 --- ADT.prjx 24 Jun 2005 22:54:50 -0000 1.4 *************** *** 31,34 **** --- 31,36 ---- <File name=".\Histories\IInterpolatonMethod.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\IndexOfKeyOrPreviousException.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\Statistics\AdvancedFunctions.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\EstimatedObject.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References /> |
|
From: Marco M. <mi...@us...> - 2005-06-24 22:52:38
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16221/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: Updated files for the EfficientPortfolio script: - new classes for testing a given array of tickers (normally, for testing out of sample an optimization's result); - reorganized code in a more object oriented way (now code duplication has been completely erased); - now, the optimization process for the shortAndLong portfolio should be more efficient (memory is now used properly) Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** b7_Scripts.csproj 7 Jun 2005 15:09:35 -0000 1.28 --- b7_Scripts.csproj 24 Jun 2005 22:52:25 -0000 1.29 *************** *** 189,192 **** --- 189,197 ---- /> <File + RelPath = "TickerSelectionTesting\EndOfDayTimerHandlerLastChosenPortfolio.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TickerSelectionTesting\GenomeManagerForEfficientCTCPortfolio.cs" SubType = "Code" *************** *** 224,227 **** --- 229,237 ---- /> <File + RelPath = "TickerSelectionTesting\RunLastChosenPortfolioOutOfSample.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TickerSelectionTesting\RunTestOptimizedCTCPortfolio.cs" SubType = "Code" |
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16221/b7_Scripts/TickerSelectionTesting Modified Files: EndOfDayTimerHandler.cs EndOfDayTimerHandlerCTC.cs EndOfDayTimerHandlerCTO.cs EndOfDayTimerHandlerCTOTest.cs GenomeManagerForEfficientCTCPortfolio.cs GenomeManagerForEfficientCTOPortfolio.cs GenomeManagerForEfficientPortfolio.cs RunEfficientCTCPortfolio.cs RunEfficientCTOPortfolio.cs RunEfficientPortfolio.cs RunTestOptimizedCTCPortfolio.cs RunTestOptimizedCTOPortfolio.cs Added Files: EndOfDayTimerHandlerLastChosenPortfolio.cs RunLastChosenPortfolioOutOfSample.cs Log Message: Updated files for the EfficientPortfolio script: - new classes for testing a given array of tickers (normally, for testing out of sample an optimization's result); - reorganized code in a more object oriented way (now code duplication has been completely erased); - now, the optimization process for the shortAndLong portfolio should be more efficient (memory is now used properly) Index: RunTestOptimizedCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunTestOptimizedCTOPortfolio.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RunTestOptimizedCTOPortfolio.cs 2 Jun 2005 18:00:47 -0000 1.2 --- RunTestOptimizedCTOPortfolio.cs 24 Jun 2005 22:52:25 -0000 1.3 *************** *** 52,56 **** public class RunTestOptimizedCTOPorfolio : RunEfficientCTOPorfolio { ! public RunTestOptimizedCTOPorfolio(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForLiquidity, --- 52,56 ---- public class RunTestOptimizedCTOPorfolio : RunEfficientCTOPorfolio { ! public RunTestOptimizedCTOPorfolio(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForLiquidity, *************** *** 58,62 **** int populationSizeForGeneticOptimizer, string benchmark, DateTime startDate, DateTime endDate, double targetReturn, ! PortfolioType portfolioType, double maxRunningHours): base(tickerGroupID, numberOfEligibleTickers, numberOfTickersToBeChosen, numDaysForLiquidity, --- 58,63 ---- int populationSizeForGeneticOptimizer, string benchmark, DateTime startDate, DateTime endDate, double targetReturn, ! PortfolioType portfolioType, double maxRunningHours, ! int numDaysBetweenEachOptimization): base(tickerGroupID, numberOfEligibleTickers, numberOfTickersToBeChosen, numDaysForLiquidity, *************** *** 64,71 **** populationSizeForGeneticOptimizer, benchmark, startDate, endDate, targetReturn, ! portfolioType, maxRunningHours) { this.ScriptName = "TestOptimizedCTOPortfolio"; ! } protected override void run_initializeEndOfDayTimerHandler() --- 65,73 ---- populationSizeForGeneticOptimizer, benchmark, startDate, endDate, targetReturn, ! portfolioType, maxRunningHours, ! numDaysBetweenEachOptimization) { this.ScriptName = "TestOptimizedCTOPortfolio"; ! } protected override void run_initializeEndOfDayTimerHandler() *************** *** 80,84 **** this.benchmark, this.targetReturn, ! this.portfolioType); } --- 82,87 ---- this.benchmark, this.targetReturn, ! this.portfolioType, ! this.numDaysBetweenEachOptimization); } *************** *** 88,92 **** --- 91,117 ---- base.Run(); ((EndOfDayTimerHandlerCTOTest)this.endOfDayTimerHandler).Reset(); + + Report report = new Report( this.account , this.historicalQuoteProvider ); + report.Create( "Test optimization of OpenClose efficient portfolio", 1 , + new EndOfDayDateTime( this.endDateTime.DateTime , + EndOfDaySpecificTime.MarketClose ) , + "^SPX" ); + report.Show(); } + + protected override void checkDateForReport(Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs) + { + if(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime>=this.endDateTime.DateTime || + DateTime.Now >= this.startingTimeForScript.AddHours(this.maxRunningHours)) + //last date is reached by the timer or maxRunning hours + //are elapsed from the time script started + { + this.endOfDayTimer.Stop(); + } + + } + + + } Index: GenomeManagerForEfficientCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForEfficientCTOPortfolio.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GenomeManagerForEfficientCTOPortfolio.cs 2 Jun 2005 18:00:47 -0000 1.9 --- GenomeManagerForEfficientCTOPortfolio.cs 24 Jun 2005 22:52:25 -0000 1.10 *************** *** 98,102 **** return returnValue; } ! protected override double getFitnessValue_calculate() { --- 98,102 ---- return returnValue; } ! /* protected override double getFitnessValue_calculate() { *************** *** 104,112 **** double a, b, c; ! a = 0.002; b = 2.0; c = 3.0; ! returnValue = Math.Pow((a/this.Variance),b) * ! Math.Pow((this.rateOfReturn - this.targetPerformance), c); if(this.portfolioType == PortfolioType.OnlyShort) returnValue = - returnValue; --- 104,121 ---- double a, b, c; ! a = 0.002; b = 2.0; c = 2.0; ! //returnValue = Math.Pow((a/this.Variance),b) * ! // Math.Pow((this.rateOfReturn - this.targetPerformance), ! // c); ! //this.lowerPartialMoment = AdvancedFunctions.LowerPartialMoment(this.portfolioRatesOfReturn, ! // BasicFunctions.SimpleAverage(this.portfolioRatesOfReturn), ! // 3.0); ! this.lowerPartialMoment = AdvancedFunctions.NegativeSemiVariance(this.portfolioRatesOfReturn); ! a = 1.0; ! returnValue = Math.Pow((a/this.lowerPartialMoment),b) * ! Math.Pow(Math.Max(0.0,(this.rateOfReturn - this.targetPerformance)), c); + if(this.portfolioType == PortfolioType.OnlyShort) returnValue = - returnValue; *************** *** 117,121 **** return returnValue; } ! } --- 126,130 ---- return returnValue; } ! */ } Index: RunEfficientCTCPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTCPortfolio.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RunEfficientCTCPortfolio.cs 2 Jun 2005 18:00:47 -0000 1.7 --- RunEfficientCTCPortfolio.cs 24 Jun 2005 22:52:25 -0000 1.8 *************** *** 84,89 **** this.maxAcceptableCloseToCloseDrawdown = maxAcceptableCloseToCloseDrawdown; } ! #region Run ! protected override void run_initializeEndOfDayTimerHandler() --- 84,89 ---- this.maxAcceptableCloseToCloseDrawdown = maxAcceptableCloseToCloseDrawdown; } ! ! #region auxiliary overriden methods for Run protected override void run_initializeEndOfDayTimerHandler() *************** *** 104,117 **** } ! public override void Run() { - //old script - //this.run_FindBestPortfolioForNextTrade(); - run_initializeHistoricalQuoteProvider(); - run_initializeEndOfDayTimer(); - run_initializeAccount(); - run_initializeEndOfDayTimerHandler(); - - //run_initializeProgressHandlers(); this.endOfDayTimer.MarketOpen += new MarketOpenEventHandler( --- 104,109 ---- } ! protected override void run_addEventHandlers() { this.endOfDayTimer.MarketOpen += new MarketOpenEventHandler( *************** *** 125,140 **** new MarketCloseEventHandler( this.checkDateForReport); - - //this.endOfDayTimer.OneHourAfterMarketClose += - //new OneHourAfterMarketCloseEventHandler( - //this.endOfDayTimerHandler.OneHourAfterMarketCloseEventHandler ); - //this.endOfDayTimer.OneHourAfterMarketClose += - //new OneHourAfterMarketCloseEventHandler( - //this.oneHourAfterMarketCloseEventHandler ); - - //this.progressBarForm.Show(); - this.endOfDayTimer.Start(); - } #endregion } --- 117,123 ---- new MarketCloseEventHandler( this.checkDateForReport); } + + #endregion } Index: RunTestOptimizedCTCPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunTestOptimizedCTCPortfolio.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RunTestOptimizedCTCPortfolio.cs 2 Jun 2005 18:00:47 -0000 1.1 --- RunTestOptimizedCTCPortfolio.cs 24 Jun 2005 22:52:25 -0000 1.2 *************** *** 101,104 **** --- 101,122 ---- base.Run(); ((EndOfDayTimerHandlerCTCTest)this.endOfDayTimerHandler).Reset(); + Report report = new Report( this.account , this.historicalQuoteProvider ); + report.Create( "Test optimization of Close to close efficient portfolio", 1 , + new EndOfDayDateTime( this.endDateTime.DateTime , + EndOfDaySpecificTime.MarketClose ) , + "^SPX" ); + report.Show(); + } + + protected override void checkDateForReport(Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs) + { + if(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime>=this.endDateTime.DateTime || + DateTime.Now >= this.startingTimeForScript.AddHours(this.maxRunningHours)) + //last date is reached by the timer or maxRunning hours + //are elapsed from the time script started + { + this.endOfDayTimer.Stop(); + } + } Index: GenomeManagerForEfficientCTCPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForEfficientCTCPortfolio.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GenomeManagerForEfficientCTCPortfolio.cs 2 Jun 2005 18:00:47 -0000 1.4 --- GenomeManagerForEfficientCTCPortfolio.cs 24 Jun 2005 22:52:25 -0000 1.5 *************** *** 98,102 **** return ratesOfReturns; } ! } --- 98,130 ---- return ratesOfReturns; } ! /* ! protected override double getFitnessValue_calculate() ! { ! double returnValue = 0; ! ! double a, b, c; ! a = 0.002; b = 2.0; c = 2.0; ! ! //returnValue = Math.Pow((a/this.Variance),b) * ! // Math.Pow((this.rateOfReturn - this.targetPerformance), ! // c); ! //this.lowerPartialMoment = AdvancedFunctions.LowerPartialMoment(this.portfolioRatesOfReturn, ! // BasicFunctions.SimpleAverage(this.portfolioRatesOfReturn), ! // 3.0); ! this.lowerPartialMoment = AdvancedFunctions.NegativeSemiVariance(this.portfolioRatesOfReturn); ! a = 1.0; ! returnValue = Math.Pow((a/this.lowerPartialMoment),b) * ! Math.Pow((this.rateOfReturn - this.targetPerformance), ! c); ! ! if(this.portfolioType == PortfolioType.OnlyShort) ! returnValue = - returnValue; ! ! if(Double.IsInfinity(returnValue) || Double.IsNaN(returnValue)) ! throw new Exception("Fitness value not computed correctly!"); ! ! return returnValue; ! } ! */ } --- NEW FILE: EndOfDayTimerHandlerLastChosenPortfolio.cs --- /* QuantProject - Quantitative Finance Library EndOfDayTimerHandlerLastChosenPortfolio.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Data; using System.Collections; using QuantProject.ADT; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Timing; using QuantProject.Data.DataProviders; using QuantProject.Data.Selectors; namespace QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios { /// <summary> /// Implements MarketOpenEventHandler, /// MarketCloseEventHandler /// These handlers simply open positions - /// for the given chosen tickers - at MarketOpen and close them /// at MarketClose /// </summary> [Serializable] public class EndOfDayTimerHandlerLastChosenPortfolio : EndOfDayTimerHandler { private EndOfDayDateTime firstDate; private EndOfDayDateTime lastDate; public EndOfDayTimerHandlerLastChosenPortfolio(string[] chosenTickers, PortfolioType portfolioType, Account account, string benchmark, EndOfDayDateTime firstDate, EndOfDayDateTime lastDate): base(chosenTickers, portfolioType, account, benchmark) { this.firstDate = firstDate; this.lastDate = lastDate; } /// <summary> /// Handles a "Market Open" event. /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> public override void MarketOpenEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { if(endOfDayTimingEventArgs.EndOfDayDateTime.CompareTo(this.firstDate) == 0) { this.openPositions(); } } public override void MarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { //if(endOfDayTimingEventArgs.EndOfDayDateTime.CompareTo(this.lastDate) == 0) // this.closePositions(); if(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime.CompareTo(this.firstDate.DateTime) == 0) this.closePositions(); } } } --- NEW FILE: RunLastChosenPortfolioOutOfSample.cs --- /* QuantProject - Quantitative Finance Library RunLastChosenPortfolioOutOfSample.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.IO; using System.Collections; using System.Data; using System.Windows.Forms; using QuantProject.ADT; using QuantProject.ADT.Optimizing.Genetic; using QuantProject.ADT.FileManaging; using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Accounting.Reporting; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Scripting; using QuantProject.Business.Strategies; using QuantProject.Business.Testing; using QuantProject.Business.Timing; using QuantProject.Business.Financial.Accounting.Commissions; using QuantProject.Data.DataProviders; using QuantProject.Data.Selectors; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; using QuantProject.Presentation.Reporting.WindowsForm; namespace QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios { /// <summary> /// Class for running a test based on last chosen tickers of a given /// RunEfficientPortfolio - normally, one with optimization purposes - /// , after it has been executed /// </summary> [Serializable] public class RunLastChosenPortfolioOutOfSample : RunEfficientPorfolio { RunEfficientPorfolio testEfficientPortfolio; public RunLastChosenPortfolioOutOfSample(RunEfficientPorfolio testEfficientPortfolio, string benchmark, DateTime startDate, DateTime endDate, double maxRunningHours): base(benchmark, startDate, endDate, testEfficientPortfolio.TypeOfPortfolio, maxRunningHours) { this.startDateTime = new EndOfDayDateTime( startDate, EndOfDaySpecificTime.MarketOpen ); this.endDateTime = new EndOfDayDateTime( endDate, EndOfDaySpecificTime.MarketClose ); this.ScriptName = "LastChosenPortfolioOutOfSample"; this.testEfficientPortfolio = testEfficientPortfolio; } #region Run protected override void run_initializeEndOfDayTimerHandler() { this.endOfDayTimerHandler = new EndOfDayTimerHandlerLastChosenPortfolio(this.testEfficientPortfolio.LastChosenTickers, this.testEfficientPortfolio.TypeOfPortfolio, this.account, this.benchmark, this.startDateTime, this.endDateTime); } protected override void run_initializeEndOfDayTimer() { this.endOfDayTimer = new HistoricalEndOfDayTimer(this.startDateTime); } protected override void run_initializeHistoricalQuoteProvider() { this.historicalQuoteProvider = this.testEfficientPortfolio.HistoricalQuoteProvider; } protected override void run_initializeAccount() { //default account with no commissions this.account = new Account( this.scriptName , this.endOfDayTimer , new HistoricalEndOfDayDataStreamer( this.endOfDayTimer , this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , this.historicalQuoteProvider )); } protected override void run_addEventHandlers() { this.endOfDayTimer.MarketOpen += new MarketOpenEventHandler( this.endOfDayTimerHandler.MarketOpenEventHandler); this.endOfDayTimer.MarketClose += new MarketCloseEventHandler( this.endOfDayTimerHandler.MarketCloseEventHandler); this.endOfDayTimer.MarketClose += new MarketCloseEventHandler( this.checkDateForReport); // //this.endOfDayTimer.OneHourAfterMarketClose += // new OneHourAfterMarketCloseEventHandler( // this.endOfDayTimerHandler.OneHourAfterMarketCloseEventHandler ); } public override void Run() { base.Run(); Report report = new Report( this.account , this.historicalQuoteProvider ); report.Create( "Run last chosen tickers out of sample", 1 , new EndOfDayDateTime( this.endDateTime.DateTime , EndOfDaySpecificTime.MarketClose ) , "^SPX" ); report.Show(); } protected override void checkDateForReport(Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs) { if(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime>=this.endDateTime.DateTime || DateTime.Now >= this.startingTimeForScript.AddHours(this.maxRunningHours)) //last date is reached by the timer or maxRunning hours //are elapsed from the time script started { this.endOfDayTimer.Stop(); } } #endregion } } Index: EndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandler.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** EndOfDayTimerHandler.cs 26 Apr 2005 19:02:11 -0000 1.12 --- EndOfDayTimerHandler.cs 24 Jun 2005 22:52:25 -0000 1.13 *************** *** 67,71 **** protected PortfolioType portfolioType; ! public int NumberOfEligibleTickers { --- 67,74 ---- protected PortfolioType portfolioType; ! public string[] LastChosenTickers ! { ! get { return this.chosenTickers; } ! } public int NumberOfEligibleTickers { *************** *** 100,103 **** --- 103,121 ---- } + public EndOfDayTimerHandler(string[] chosenTickers, + PortfolioType portfolioType, + Account account, + string benchmark) + { + + this.account = account; + this.benchmark = benchmark; + this.orders = new ArrayList(); + this.chosenTickers = chosenTickers; + this.numberOfTickersToBeChosen = chosenTickers.Length; + this.lastChosenTickers = new string[chosenTickers.Length]; + this.portfolioType = portfolioType; + } + protected virtual void addOrderForTicker(string ticker ) { *************** *** 118,121 **** --- 136,190 ---- } + protected virtual void closePosition( + string ticker ) + { + this.account.ClosePosition( ticker ); + } + + protected virtual void closePositions() + { + if(this.lastChosenTickers != null) + { + foreach( string ticker in this.lastChosenTickers) + { + for(int i = 0; i<this.account.Portfolio.Keys.Count; i++) + { + if(this.account.Portfolio[ticker]!=null) + closePosition( ticker ); + } + } + } + } + + protected virtual void addChosenTickersToOrderList() + { + int idx = 0; + foreach ( string ticker in this.chosenTickers ) + { + if(ticker != null) + { + this.addOrderForTicker( ticker ); + this.lastChosenTickers[idx] = + GenomeManagerForEfficientPortfolio.GetCleanTickerCode(ticker); + } + idx++; + } + } + protected virtual void openPositions() + { + //add cash first + if(this.orders.Count == 0 && this.account.Transactions.Count == 0) + this.account.AddCash(17000); + + this.addChosenTickersToOrderList(); + + //execute orders actually + foreach(object item in this.orders) + { + this.account.AddOrder((Order)item); + } + } + + public virtual void MarketOpenEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) Index: EndOfDayTimerHandlerCTOTest.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTOTest.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EndOfDayTimerHandlerCTOTest.cs 2 Jun 2005 18:00:47 -0000 1.3 --- EndOfDayTimerHandlerCTOTest.cs 24 Jun 2005 22:52:25 -0000 1.4 *************** *** 50,54 **** int populationSizeForGeneticOptimizer, string benchmark, double targetReturn, ! PortfolioType portfolioType): base(tickerGroupID, numberOfEligibleTickers, numberOfTickersToBeChosen, numDaysForLiquidity, account, --- 50,54 ---- int populationSizeForGeneticOptimizer, string benchmark, double targetReturn, ! PortfolioType portfolioType, int numDaysBetweenEachOptimization): base(tickerGroupID, numberOfEligibleTickers, numberOfTickersToBeChosen, numDaysForLiquidity, account, *************** *** 56,60 **** populationSizeForGeneticOptimizer, benchmark, targetReturn, ! portfolioType) { --- 56,60 ---- populationSizeForGeneticOptimizer, benchmark, targetReturn, ! portfolioType, numDaysBetweenEachOptimization) { Index: RunEfficientPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientPortfolio.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RunEfficientPortfolio.cs 2 Jun 2005 18:00:47 -0000 1.8 --- RunEfficientPortfolio.cs 24 Jun 2005 22:52:25 -0000 1.9 *************** *** 87,91 **** //if MaxNumberOfHoursForScript has elapsed and the script //is still running, it will be stopped. ! public virtual string ScriptName { --- 87,104 ---- //if MaxNumberOfHoursForScript has elapsed and the script //is still running, it will be stopped. ! ! public string[] LastChosenTickers ! { ! get { return this.endOfDayTimerHandler.LastChosenTickers; } ! } ! public PortfolioType TypeOfPortfolio ! { ! get { return this.portfolioType; } ! } ! ! public IHistoricalQuoteProvider HistoricalQuoteProvider ! { ! get { return this.historicalQuoteProvider; } ! } public virtual string ScriptName { *************** *** 99,103 **** } ! public RunEfficientPorfolio(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, --- 112,134 ---- } ! public RunEfficientPorfolio(string benchmark, ! DateTime startDate, DateTime endDate, ! PortfolioType portfolioType, ! double maxRunningHours) ! { ! ! this.startDateTime = new EndOfDayDateTime( ! startDate, EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); ! this.endDateTime = new EndOfDayDateTime( ! endDate, EndOfDaySpecificTime.OneHourAfterMarketClose ); ! this.benchmark = benchmark; ! this.ScriptName = "EfficientGeneric"; ! this.portfolioType = portfolioType; ! this.startingTimeForScript = DateTime.Now; ! this.maxRunningHours = maxRunningHours; ! //this.numIntervalDays = 3; ! } ! ! public RunEfficientPorfolio(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, *************** *** 129,133 **** } #region Run ! protected virtual void run_initializeEndOfDayTimer() { --- 160,164 ---- } #region Run ! protected virtual void run_initializeEndOfDayTimer() { *************** *** 184,188 **** string dirNameWhereToSaveReports = System.Configuration.ConfigurationSettings.AppSettings["ReportsArchive"] + "\\" + this.ScriptName + "\\"; ! string dirNameWhereToSaveAccounts = System.Configuration.ConfigurationSettings.AppSettings["AccountsArchive"] + "\\" + this.ScriptName + "\\"; //default report with numIntervalDays = 1 --- 215,219 ---- string dirNameWhereToSaveReports = System.Configuration.ConfigurationSettings.AppSettings["ReportsArchive"] + "\\" + this.ScriptName + "\\"; ! string dirNameWhereToSaveTransactions = System.Configuration.ConfigurationSettings.AppSettings["TransactionsArchive"] + "\\" + this.ScriptName + "\\"; //default report with numIntervalDays = 1 *************** *** 194,202 **** ObjectArchiver.Archive(accountReport, dirNameWhereToSaveReports + ! fileName + ".rep"); ! this.checkDateForReport_createDirIfNotPresent(dirNameWhereToSaveAccounts); ! ObjectArchiver.Archive(this.account, ! dirNameWhereToSaveAccounts + ! fileName + ".acc"); this.endOfDayTimer.Stop(); --- 225,233 ---- ObjectArchiver.Archive(accountReport, dirNameWhereToSaveReports + ! fileName + ".qPr"); ! this.checkDateForReport_createDirIfNotPresent(dirNameWhereToSaveTransactions); ! ObjectArchiver.Archive(this.account.Transactions, ! dirNameWhereToSaveTransactions + ! fileName + ".qPt"); this.endOfDayTimer.Stop(); *************** *** 204,217 **** } ! ! public virtual void Run() { run_initializeHistoricalQuoteProvider(); ! run_initializeEndOfDayTimer(); run_initializeAccount(); run_initializeEndOfDayTimerHandler(); - //run_initializeProgressHandlers(); ! this.endOfDayTimer.MarketClose += new MarketCloseEventHandler( --- 235,248 ---- } ! protected virtual void run_initialize() { run_initializeHistoricalQuoteProvider(); ! run_initializeEndOfDayTimer(); run_initializeAccount(); run_initializeEndOfDayTimerHandler(); //run_initializeProgressHandlers(); ! } ! protected virtual void run_addEventHandlers() ! { this.endOfDayTimer.MarketClose += new MarketCloseEventHandler( *************** *** 223,233 **** //this.endOfDayTimer.EVENT_NAME += // new EVENT_NAMEEventHandler( ! // this.endOfDayTimerHandler.EVENT_NAMEEventHandler); ! //this.progressBarForm.Show(); this.endOfDayTimer.Start(); - } #endregion } } --- 254,271 ---- //this.endOfDayTimer.EVENT_NAME += // new EVENT_NAMEEventHandler( ! // this.endOfDayTimerHandler.EVENT_NAMEEventHandler); ! } ! ! ! public virtual void Run() ! { ! this.run_initialize(); ! this.run_addEventHandlers(); //this.progressBarForm.Show(); this.endOfDayTimer.Start(); } + #endregion + } } Index: EndOfDayTimerHandlerCTC.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTC.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** EndOfDayTimerHandlerCTC.cs 2 Jun 2005 18:00:47 -0000 1.8 --- EndOfDayTimerHandlerCTC.cs 24 Jun 2005 22:52:25 -0000 1.9 *************** *** 71,75 **** this.numDaysOfPortfolioLife = numDaysOfPortfolioLife; this.numDaysForReturnCalculation = numDaysForReturnCalculation; ! this.daysCounter = 0; this.maxAcceptableCloseToCloseDrawdown = maxAcceptableCloseToCloseDrawdown; this.stopLossConditionReached = false; --- 71,75 ---- this.numDaysOfPortfolioLife = numDaysOfPortfolioLife; this.numDaysForReturnCalculation = numDaysForReturnCalculation; ! this.daysCounter = -1; this.maxAcceptableCloseToCloseDrawdown = maxAcceptableCloseToCloseDrawdown; this.stopLossConditionReached = false; *************** *** 118,122 **** this.generationNumberForGeneticOptimizer); //GO.KeepOnRunningUntilConvergenceIsReached = true; - GO.GenerationNumber = this.generationNumberForGeneticOptimizer; GO.Run(false); this.chosenTickers = (string[])GO.BestGenome.Meaning; --- 118,121 ---- *************** *** 134,145 **** Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! if(this.daysCounter == 0 || this.daysCounter == this.numDaysOfPortfolioLife - 1) ! //at next close it will be time to open a new portfolio { this.setTickers(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime); ! //sets tickers to be chosen at next close this.orders.Clear(); } - this.updateStopLossCondition(); } #endregion --- 133,146 ---- Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! this.updateStopLossCondition(); ! if(this.daysCounter == -1 || this.daysCounter == this.numDaysOfPortfolioLife - 1 || ! this.stopLossConditionReached ) ! //at the beginning, after num days of porfolio life has elasped, ! //or when the stop loss condition is reached { this.setTickers(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime); ! //it sets tickers to be chosen at next close this.orders.Clear(); } } #endregion *************** *** 147,200 **** #region MarketCloseEventHandler ! protected void marketCloseEventHandler_orderChosenTickers_addToOrderList() ! { ! int idx = 0; ! foreach ( string ticker in this.chosenTickers ) ! { ! this.lastChosenTickers[idx] = ! GenomeManagerForEfficientPortfolio.GetCleanTickerCode(ticker); ! if(ticker != null) ! this.addOrderForTicker( ticker ); ! idx++; ! } ! } ! protected void marketCloseEventHandler_orderChosenTickers() ! { ! this.marketCloseEventHandler_orderChosenTickers_addToOrderList(); ! } ! ! ! protected void marketCloseEventHandler_openPositions() ! { ! if(this.orders.Count == 0 && this.account.Transactions.Count == 0) ! this.account.AddCash(17000); ! ! this.marketCloseEventHandler_orderChosenTickers(); ! ! foreach(object item in this.orders) ! { ! this.account.AddOrder((Order)item); ! } ! } ! ! protected void marketCloseEventHandler_closePosition( ! string ticker ) ! { ! this.account.ClosePosition( ticker ); ! } ! protected void marketCloseEventHandler_closePositions() ! { ! if(this.lastChosenTickers != null) ! { ! foreach( string ticker in this.lastChosenTickers) ! { ! for(int i = 0; i<this.account.Portfolio.Keys.Count; i++) ! { ! if(this.account.Portfolio[ticker]!=null) ! marketCloseEventHandler_closePosition( ticker ); ! } ! } ! } ! } protected void updateStopLossCondition() --- 148,152 ---- #region MarketCloseEventHandler ! protected void updateStopLossCondition() *************** *** 216,228 **** Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! this.daysCounter++; ! if(this.daysCounter == this.numDaysOfPortfolioLife || this.stopLossConditionReached) ! //it's time to change portfolio { ! this.marketCloseEventHandler_closePositions(); ! this.marketCloseEventHandler_openPositions(); this.daysCounter = 0; } } --- 168,186 ---- Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! if(this.daysCounter == -1 || ! this.daysCounter == this.numDaysOfPortfolioLife || this.stopLossConditionReached) ! //it is the first day or num days of portfolio life or ! //max acceptable close to close draw down ! //has been reached { ! this.closePositions(); ! this.openPositions(); this.daysCounter = 0; } + else + { + this.daysCounter++; + } } Index: RunEfficientCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTOPortfolio.cs,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** RunEfficientCTOPortfolio.cs 2 Jun 2005 18:00:47 -0000 1.19 --- RunEfficientCTOPortfolio.cs 24 Jun 2005 22:52:25 -0000 1.20 *************** *** 53,86 **** /// - choose the most efficient portfolio among these tickers /// </summary> ! [Serializable] public class RunEfficientCTOPorfolio : RunEfficientPorfolio ! { ! public RunEfficientCTOPorfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, ! int generationNumberForGeneticOptimizer, ! int populationSizeForGeneticOptimizer, string benchmark, ! DateTime startDate, DateTime endDate, double targetReturn, ! PortfolioType portfolioType, double maxRunningHours): ! base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, ! generationNumberForGeneticOptimizer, ! populationSizeForGeneticOptimizer, benchmark, ! startDate, endDate, targetReturn, ! portfolioType, maxRunningHours) ! { this.ScriptName = "OpenCloseScripts"; ! } ! #region Run ! /* protected override void run_initializeAccount() { this.account = new Account( this.ScriptName , this.endOfDayTimer , new HistoricalEndOfDayDataStreamer( this.endOfDayTimer , ! this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , ! this.historicalQuoteProvider ), new IBCommissionManager()); } --- 53,88 ---- /// - choose the most efficient portfolio among these tickers /// </summary> ! [Serializable] public class RunEfficientCTOPorfolio : RunEfficientPorfolio ! { ! protected int numDaysBetweenEachOptimization; public RunEfficientCTOPorfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, ! int generationNumberForGeneticOptimizer, ! int populationSizeForGeneticOptimizer, string benchmark, ! DateTime startDate, DateTime endDate, double targetReturn, ! PortfolioType portfolioType, double maxRunningHours, ! int numDaysBetweenEachOptimization): ! base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, ! generationNumberForGeneticOptimizer, ! populationSizeForGeneticOptimizer, benchmark, ! startDate, endDate, targetReturn, ! portfolioType, maxRunningHours) ! { this.ScriptName = "OpenCloseScripts"; ! this.numDaysBetweenEachOptimization = numDaysBetweenEachOptimization; ! } ! #region auxiliary overriden methods for Run ! /* delete remark delimitations for having ib commission protected override void run_initializeAccount() { this.account = new Account( this.ScriptName , this.endOfDayTimer , new HistoricalEndOfDayDataStreamer( this.endOfDayTimer , ! this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , ! this.historicalQuoteProvider ), new IBCommissionManager()); } *************** *** 90,120 **** { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTO(this.tickerGroupID, ! this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, ! this.numDaysForLiquidity, ! this.account, ! this.generationNumberForGeneticOptimizer, ! this.populationSizeForGeneticOptimizer, ! this.benchmark, ! this.targetReturn, ! this.portfolioType); ! ! } protected override void run_initializeHistoricalQuoteProvider() { ! this.historicalQuoteProvider = ! new HistoricalRawQuoteProvider(); ! } ! ! public override void Run() { - run_initializeHistoricalQuoteProvider(); - run_initializeEndOfDayTimer(); - run_initializeAccount(); - run_initializeEndOfDayTimerHandler(); - this.endOfDayTimer.MarketOpen += new MarketOpenEventHandler( --- 92,113 ---- { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTO(this.tickerGroupID, ! this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, ! this.numDaysForLiquidity, ! this.account, ! this.generationNumberForGeneticOptimizer, ! this.populationSizeForGeneticOptimizer, ! this.benchmark, ! this.targetReturn, ! this.portfolioType, this.numDaysBetweenEachOptimization); } protected override void run_initializeHistoricalQuoteProvider() { ! this.historicalQuoteProvider = new HistoricalRawQuoteProvider(); } ! ! protected override void run_addEventHandlers() { this.endOfDayTimer.MarketOpen += new MarketOpenEventHandler( *************** *** 132,140 **** new OneHourAfterMarketCloseEventHandler( this.endOfDayTimerHandler.OneHourAfterMarketCloseEventHandler ); - - this.endOfDayTimer.Start(); - } #endregion } } --- 125,137 ---- new OneHourAfterMarketCloseEventHandler( this.endOfDayTimerHandler.OneHourAfterMarketCloseEventHandler ); } #endregion + + //necessary far calling RunEfficientPortfolio.Run() + //in classes that inherit from this class + public override void Run() + { + base.Run(); + } } } Index: GenomeManagerForEfficientPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForEfficientPortfolio.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GenomeManagerForEfficientPortfolio.cs 2 Jun 2005 18:00:47 -0000 1.9 --- GenomeManagerForEfficientPortfolio.cs 24 Jun 2005 22:52:25 -0000 1.10 *************** *** 48,53 **** --- 48,55 ---- protected double targetPerformance; protected double variance; + protected double lowerPartialMoment; protected double rateOfReturn; protected PortfolioType portfolioType; + protected double[] portfolioRatesOfReturn; static public string GetCleanTickerCode(string tickerModifiedCode) *************** *** 189,198 **** //OLD IMPLEMENTATION double portfolioRateOfReturn = this.getPortfolioRateOfReturn(genome.Genes()); //OLD IMPLEMENTATION double portfolioVariance = this.getPortfolioVariance(genome.Genes()); ! double[] portfolioRatesOfReturn = this.getPortfolioRatesOfReturn(genome.Genes()); double averagePortfolioRateOfReturn = ! BasicFunctions.SimpleAverage(portfolioRatesOfReturn); double portfolioVariance = ! BasicFunctions.Variance(portfolioRatesOfReturn); if(!Double.IsInfinity(portfolioVariance) && --- 191,200 ---- //OLD IMPLEMENTATION double portfolioRateOfReturn = this.getPortfolioRateOfReturn(genome.Genes()); //OLD IMPLEMENTATION double portfolioVariance = this.getPortfolioVariance(genome.Genes()); ! this.portfolioRatesOfReturn = this.getPortfolioRatesOfReturn(genome.Genes()); double averagePortfolioRateOfReturn = ! BasicFunctions.SimpleAverage(this.portfolioRatesOfReturn); double portfolioVariance = ! BasicFunctions.Variance(this.portfolioRatesOfReturn); if(!Double.IsInfinity(portfolioVariance) && *************** *** 215,219 **** public Genome[] GetChilds(Genome parent1, Genome parent2) { ! return GenomeManagement.MixGenesWithoutDuplicates(parent1, parent2); } --- 217,223 ---- public Genome[] GetChilds(Genome parent1, Genome parent2) { ! return ! GenomeManagement.MixGenesWithoutDuplicates(parent1, parent2, ! this.originalNumOfTickers); } *************** *** 225,229 **** genome.MaxValueForGenes + 1); while(genome.HasGene(returnValue) || ! genome.HasGene(returnValue + this.originalNumOfTickers)) //the portfolio can't have a long position and a short position // for the same ticker --- 229,234 ---- genome.MaxValueForGenes + 1); while(genome.HasGene(returnValue) || ! genome.HasGene(returnValue + this.originalNumOfTickers) || ! genome.HasGene(returnValue - this.originalNumOfTickers) ) //the portfolio can't have a long position and a short position // for the same ticker *************** *** 245,250 **** int genePositionToBeMutated = GenomeManagement.RandomGenerator.Next(genome.Size); while(genome.HasGene(newValueForGene) || ! genome.HasGene(newValueForGene + this.originalNumOfTickers)) ! //the portfolio can't have a long position and a short position // for the same ticker { --- 250,257 ---- int genePositionToBeMutated = GenomeManagement.RandomGenerator.Next(genome.Size); while(genome.HasGene(newValueForGene) || ! genome.HasGene(newValueForGene + this.originalNumOfTickers) || ! genome.HasGene(newValueForGene - this.originalNumOfTickers) ) ! //the efficient portfolio, in this implementation, ! // can't have a long position and a short position // for the same ticker { Index: EndOfDayTimerHandlerCTO.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTO.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** EndOfDayTimerHandlerCTO.cs 2 Jun 2005 18:00:47 -0000 1.12 --- EndOfDayTimerHandlerCTO.cs 24 Jun 2005 22:52:25 -0000 1.13 *************** *** 44,48 **** public class EndOfDayTimerHandlerCTO : EndOfDayTimerHandler { ! public EndOfDayTimerHandlerCTO(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, --- 44,49 ---- public class EndOfDayTimerHandlerCTO : EndOfDayTimerHandler { ! protected int numDaysBetweenEachOptimization; ! private int numDaysElapsedSinceLastOptimization; public EndOfDayTimerHandlerCTO(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, *************** *** 50,54 **** int populationSizeForGeneticOptimizer, string benchmark, double targetReturn, ! PortfolioType portfolioType): base(tickerGroupID, numberOfEligibleTickers, numberOfTickersToBeChosen, numDaysForLiquidity, account, --- 51,55 ---- int populationSizeForGeneticOptimizer, string benchmark, double targetReturn, ! PortfolioType portfolioType, int numDaysBetweenEachOptimization): base(tickerGroupID, numberOfEligibleTickers, numberOfTickersToBeChosen, numDaysForLiquidity, account, *************** *** 58,86 **** portfolioType) { ! } ! #region MarketOpenEventHandler ! ! protected void marketOpenEventHandler_orderChosenTickers_addToOrderList() ! { ! int idx = 0; ! foreach ( string ticker in this.chosenTickers ) ! { ! if(ticker != null) ! { ! this.addOrderForTicker( ticker ); ! this.lastChosenTickers[idx] = ! GenomeManagerForEfficientPortfolio.GetCleanTickerCode(ticker); ! } ! idx++; ! } ! } ! ! protected void marketOpenEventHandler_orderChosenTickers() ! { ! this.marketOpenEventHandler_orderChosenTickers_addToOrderList(); ! } ! /// <summary> /// Handles a "Market Open" event. --- 59,67 ---- portfolioType) { ! this.numDaysBetweenEachOptimization = numDaysBetweenEachOptimization; ! this.numDaysElapsedSinceLastOptimization = 0; } ! /// <summary> /// Handles a "Market Open" event. *************** *** 91,136 **** Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! if(this.orders.Count == 0 && this.account.Transactions.Count == 0) ! this.account.AddCash(17000); ! ! this.marketOpenEventHandler_orderChosenTickers(); ! ! foreach(object item in this.orders) ! { ! this.account.AddOrder((Order)item); ! } ! } ! #endregion ! ! #region MarketCloseEventHandler ! ! protected void marketCloseEventHandler_closePosition( ! string ticker ) ! { ! this.account.ClosePosition( ticker ); ! } ! protected void marketCloseEventHandler_closePositions() ! { ! if(this.lastChosenTickers != null) ! { ! foreach( string ticker in this.lastChosenTickers) ! { ! for(int i = 0; i<this.account.Portfolio.Keys.Count; i++) ! { ! if(this.account.Portfolio[ticker]!=null) ! marketCloseEventHandler_closePosition( ticker ); ! } ! } ! } } ! public override void MarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! ! this.marketCloseEventHandler_closePositions(); } ! #endregion #region OneHourAfterMarketCloseEventHandler --- 72,86 ---- Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! this.openPositions(); } ! ! public override void MarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! this.closePositions(); } ! #region OneHourAfterMarketCloseEventHandler *************** *** 166,170 **** // currentDate, this.numberOfEligibleTickers/4); //return winners.GetTableOfSelectedTickers(); ! return quotedAtEachMarketDayFromEligible.GetTableOfSelectedTickers(); } --- 116,126 ---- // currentDate, this.numberOfEligibleTickers/4); //return winners.GetTableOfSelectedTickers(); ! SelectorByOpenCloseCorrelationToBenchmark lessCorrelated = ! new SelectorByOpenCloseCorrelationToBenchmark(quotedAtEachMarketDayFromEligible.GetTableOfSelectedTickers(), ! this.benchmark, true, ! currentDate.AddDays(-this.numDaysForLiquidity), ! currentDate, this.numberOfEligibleTickers/2); ! //return quotedAtEachMarketDayFromEligible.GetTableOfSelectedTickers(); ! return lessCorrelated.GetTableOfSelectedTickers(); } *************** *** 216,223 **** Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { //this.oneHourAfterMarketCloseEventHandler_updatePrices(); ! this.setTickers(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime); ! //sets tickers to be chosen next Market Open event ! this.orders.Clear(); } --- 172,186 ---- Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { + this.orders.Clear(); + this.numDaysElapsedSinceLastOptimization++; //this.oneHourAfterMarketCloseEventHandler_updatePrices(); ! if(this.numDaysElapsedSinceLastOptimization == ! this.numDaysBetweenEachOptimization) ! { ! this.setTickers(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime); ! //sets tickers to be chosen next Market Open event ! this.numDaysElapsedSinceLastOptimization = 0; ! } ! } |
|
From: Marco M. <mi...@us...> - 2005-06-24 22:40:44
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10881/b3_Data/DataTables Modified Files: Quotes.cs Log Message: Fixed bug in GetTickersByOpenCloseCorrelationToBenchmark method in Quotes class (for Data.dll) Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/Quotes.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Quotes.cs 17 May 2005 23:06:00 -0000 1.16 --- Quotes.cs 24 Jun 2005 22:40:34 -0000 1.17 *************** *** 413,417 **** BasicFunctions.PearsonCorrelationCoefficient(benchmarkRatios, tickerRatios); } ! DataTable tableToReturn = ExtendedDataTable.CopyAndSort(setOfTickers,"OpenCloseCorrelationToBenchmark", orderByASC); ExtendedDataTable.DeleteRows(tableToReturn, maxNumOfReturnedTickers); return tableToReturn; --- 413,420 ---- BasicFunctions.PearsonCorrelationCoefficient(benchmarkRatios, tickerRatios); } ! DataTable tableToReturn = ExtendedDataTable.CopyAndSort(setOfTickers, ! "OpenCloseCorrelationToBenchmark > 0", ! "OpenCloseCorrelationToBenchmark", ! orderByASC); ExtendedDataTable.DeleteRows(tableToReturn, maxNumOfReturnedTickers); return tableToReturn; |
|
From: Marco M. <mi...@us...> - 2005-06-24 22:36:05
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8383/b2_DataAccess Modified Files: DataBaseLocator.cs Log Message: An exception (managed) is now thrown when the Database specified in the Database.xml file doesn't exist on disk Index: DataBaseLocator.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/DataBaseLocator.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DataBaseLocator.cs 11 Jan 2004 19:07:44 -0000 1.2 --- DataBaseLocator.cs 24 Jun 2005 22:35:56 -0000 1.3 *************** *** 58,68 **** //gets full path of the file that contains the database this.Path = xmlTextReader.GetAttribute(0); } } xmlTextReader.Close(); stream.Close(); ! ! ! } catch (Exception ex) --- 58,69 ---- //gets full path of the file that contains the database this.Path = xmlTextReader.GetAttribute(0); + if(!File.Exists(this.path)) + throw new Exception("Specified file in DataBase.xml doesn't exist!\n" + + "Delete Database.xml and retry!"); } } xmlTextReader.Close(); stream.Close(); ! } catch (Exception ex) |
|
From: Marco M. <mi...@us...> - 2005-06-24 22:32:18
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Statistics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6458/b1_ADT/Statistics Added Files: AdvancedFunctions.cs Log Message: Added AdvancedFunctions class to the project, in order to compute functions like the semivariance (and other Lower Partial Moments - LPM) --- NEW FILE: AdvancedFunctions.cs --- /* QuantProject - Quantitative Finance Library AdvancedFunctions.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; namespace QuantProject.ADT.Statistics { /// <summary> /// Implements advanced statistical functions /// </summary> public class AdvancedFunctions { /// <summary> /// Returns a new matrix in which each element is equal to the corresponding /// element of the given data[], powered by the given exponential value /// </summary> public static double[] Pow( double[] data, double exponentialValue) { double[] returnValue = new double[data.Length]; for(int i = 0; i < data.Length; i++) { returnValue[i] = Math.Pow(data[i],exponentialValue); } return returnValue; } /// <summary> /// Returns a DownsideData[] from a given data[], with /// respect to a given target /// If data[i] >= target, then the corresponding DownsideData[i] is /// equal to 0; else, it is equal to data[i] /// </summary> /// <param name="data">Data for which the corresponding DownsideData is returned</param> /// <param name="target">The target used for computation of the DownsideData</param> public static double[] DownsideData( double[] data, double target) { double[] returnValue = new double[data.Length]; for(int i = 0; i < data.Length; i++) { if(data[i] >= target) returnValue[i] = 0.0; else returnValue[i] = data[i]; } return returnValue; } /// <summary> /// Returns an UpsideData[] from a given data[], with /// respect to a given target /// If data[i] > target, then the corresponding UpsideData[i] is /// equal to data[i]; else, it is equal to 0 /// </summary> /// <param name="data">Data for which the corresponding UpsideData is returned</param> /// <param name="target">The target used for computation of the UpsideData</param> public static double[] UpsideData( double[] data, double target) { double[] returnValue = new double[data.Length]; for(int i = 0; i < data.Length; i++) { if(data[i] > target) returnValue[i] = data[i]; else returnValue[i] = 0.0; } return returnValue; } /// <summary> /// Returns a mean measure of deviations of given data /// below a given target /// (Useful in finance for measure of downside risk) /// </summary> /// <param name="data">Data for which the LPM has to be computed</param> /// <param name="targetMean">The target from which below deviations are computed</param> /// <param name="moment">The exp value for the computation of deviations</param> public static double LowerPartialMoment( double[] data, double target, double moment ) { double[] downsideData = DownsideData(data, target); double[] negativeDeviations = new double[data.Length]; for(int i = 0; i < data.Length; i++) { negativeDeviations[i] = target - downsideData[i]; } return BasicFunctions.SimpleAverage(Pow(negativeDeviations,moment)); } /// <summary> /// Returns the negative semivariance /// </summary> /// <param name="data">Data for which the negative semivariance has to be computed</param> public static double NegativeSemiVariance( double[] data ) { return LowerPartialMoment(data, BasicFunctions.SimpleAverage(data), 2.0); //negative semivariance is a special case of Lower partial moment } } } |
|
From: Marco M. <mi...@us...> - 2005-06-24 22:32:18
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6458/b1_ADT Modified Files: b1_ADT.csproj Log Message: Added AdvancedFunctions class to the project, in order to compute functions like the semivariance (and other Lower Partial Moments - LPM) Index: b1_ADT.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/b1_ADT.csproj,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** b1_ADT.csproj 7 Jun 2005 15:08:13 -0000 1.16 --- b1_ADT.csproj 24 Jun 2005 22:32:09 -0000 1.17 *************** *** 213,216 **** --- 213,221 ---- /> <File + RelPath = "Statistics\AdvancedFunctions.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Statistics\BasicFunctions.cs" SubType = "Code" |
|
From: Marco M. <mi...@us...> - 2005-06-24 22:26:09
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2946/b1_ADT/Optimizing/Genetic Modified Files: GenomeManagement.cs Log Message: Fixed bugs in MixGenesWithoutDuplicates static method. Index: GenomeManagement.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/GenomeManagement.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GenomeManagement.cs 10 Jun 2005 18:48:44 -0000 1.2 --- GenomeManagement.cs 24 Jun 2005 22:25:49 -0000 1.3 *************** *** 118,122 **** private static int firstGenePositionOfParent1NotPresentInParent2(Genome parent1, ! Genome parent2) { int returnValue = -1; --- 118,123 ---- private static int firstGenePositionOfParent1NotPresentInParent2(Genome parent1, ! Genome parent2, ! int constToDiscoverGenesDuplicates) { int returnValue = -1; *************** *** 125,129 **** genePos++) { ! if(!parent2.HasGene(parent1.GetGeneValue(genePos))) returnValue = genePos; } --- 126,133 ---- genePos++) { ! int geneValue = parent1.GetGeneValue(genePos); ! if(!parent2.HasGene(geneValue) && ! !parent2.HasGene(geneValue + constToDiscoverGenesDuplicates) && ! !parent2.HasGene(geneValue - constToDiscoverGenesDuplicates)) returnValue = genePos; } *************** *** 131,141 **** } ! private static bool setMaskForChildsForMixingWithoutDuplicates(Genome parent1, Genome parent2) { bool returnValue = false; int firstGenePosOfParent1NotPresentInParent2 = ! firstGenePositionOfParent1NotPresentInParent2(parent1, parent2); int firstGenePosOfParent2NotPresentInParent1 = ! firstGenePositionOfParent1NotPresentInParent2(parent2, parent1); if(firstGenePosOfParent1NotPresentInParent2 > -1 && firstGenePosOfParent2NotPresentInParent1 > -1 ) --- 135,146 ---- } ! private static bool setMaskForChildsForMixingWithoutDuplicates(Genome parent1, Genome parent2, ! int constToDiscoverGenesDuplicates) { bool returnValue = false; int firstGenePosOfParent1NotPresentInParent2 = ! firstGenePositionOfParent1NotPresentInParent2(parent1, parent2, constToDiscoverGenesDuplicates); int firstGenePosOfParent2NotPresentInParent1 = ! firstGenePositionOfParent1NotPresentInParent2(parent2, parent1, constToDiscoverGenesDuplicates); if(firstGenePosOfParent1NotPresentInParent2 > -1 && firstGenePosOfParent2NotPresentInParent1 > -1 ) *************** *** 204,208 **** return childs; } ! /// <summary> /// This method returns an array of genomes based on --- 209,222 ---- return childs; } ! ! private static void launchExIfAChildHasDuplicateGenes(int constToDiscoverGenesDuplicates) ! { ! foreach(Genome gen in childs) ! { ! if(gen.HasSomeDuplicateGenes(constToDiscoverGenesDuplicates)) ! throw new Exception("A child with duplicate genes has been generated!"); ! } ! ! } /// <summary> /// This method returns an array of genomes based on *************** *** 211,215 **** /// the same time, childs' genes are not duplicated /// </summary> ! public static Genome[] MixGenesWithoutDuplicates(Genome parent1, Genome parent2) { initializeStaticMembers(parent1, parent2); --- 225,233 ---- /// the same time, childs' genes are not duplicated /// </summary> ! /// <param name="parent1">First genome parent from which genes are to be mixed in offspring</param> ! /// <param name="parents">Second genome parent from which genes are to be mixed in offspring</param> ! /// <param name="constToDiscoverGenesDuplicates">Gene y is a duplicate of gene x iff y = x or y = x + constToDiscoverGenesDuplicates</param> ! public static Genome[] MixGenesWithoutDuplicates(Genome parent1, Genome parent2, ! int constToDiscoverGenesDuplicates) { initializeStaticMembers(parent1, parent2); *************** *** 221,227 **** throw new Exception("Genomes must have the same size!"); ! if(setMaskForChildsForMixingWithoutDuplicates(parent1, parent2)) setChildsUsingMaskForChilds(parent1, parent2); ! return childs; } --- 239,246 ---- throw new Exception("Genomes must have the same size!"); ! if(setMaskForChildsForMixingWithoutDuplicates(parent1, parent2, ! constToDiscoverGenesDuplicates)) setChildsUsingMaskForChilds(parent1, parent2); ! launchExIfAChildHasDuplicateGenes(constToDiscoverGenesDuplicates); return childs; } |
|
From: Marco M. <mi...@us...> - 2005-06-24 22:23:30
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1528/b1_ADT/Optimizing/Genetic Modified Files: Genome.cs Log Message: Modified HasSomeDuplicateGenes method in Genome class. Introduced the concept that two genes can be duplicates if their difference is equal to a given constant Index: Genome.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/Genome.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Genome.cs 10 Jun 2005 18:48:44 -0000 1.3 --- Genome.cs 24 Jun 2005 22:23:15 -0000 1.4 *************** *** 168,172 **** /// values in genes /// </summary> ! public bool HasSomeDuplicateGenes() { bool returnValue = false; --- 168,172 ---- /// values in genes /// </summary> ! public bool HasSomeDuplicateGenes(int constToDiscoverDuplicateGenes) { bool returnValue = false; *************** *** 175,180 **** for(int j = i + 1; j < this.size ; j++) { ! if(this.genes[i] == this.genes[j]) ! returnValue = true; } } --- 175,183 ---- for(int j = i + 1; j < this.size ; j++) { ! if(this.genes[i] == this.genes[j] || ! this.genes[i] + constToDiscoverDuplicateGenes == this.genes[j] || ! this.genes[i] == this.genes[j] + constToDiscoverDuplicateGenes) ! ! returnValue = true; } } |
|
From: Glauco S. <gla...@us...> - 2005-06-19 15:29:19
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29985/b4_Business Modified Files: b4_Business.csproj Log Message: - a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\DoubleSummaryRow.cs has been added - a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\IntegerSummaryRow.cs has been added - a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\PercentageSummaryRow.cs has been added Index: b4_Business.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** b4_Business.csproj 20 Apr 2005 17:39:40 -0000 1.24 --- b4_Business.csproj 19 Jun 2005 15:29:10 -0000 1.25 *************** *** 363,366 **** --- 363,376 ---- /> <File + RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\DoubleSummaryRow.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\IntegerSummaryRow.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\LargestLosingTradePercentage.cs" SubType = "Code" *************** *** 408,411 **** --- 418,426 ---- /> <File + RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\PercentageSummaryRow.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\PercentageWinningPeriods.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2005-06-19 15:26:09
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28553/b5_Presentation Modified Files: b5_Presentation.csproj Log Message: Reporting\WindowsForm\SummaryItem.cs has been added Index: b5_Presentation.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/b5_Presentation.csproj,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** b5_Presentation.csproj 26 May 2005 22:55:59 -0000 1.23 --- b5_Presentation.csproj 19 Jun 2005 15:26:01 -0000 1.24 *************** *** 228,231 **** --- 228,236 ---- /> <File + RelPath = "Reporting\WindowsForm\SummaryItem.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Reporting\WindowsForm\SummaryTabPage.cs" SubType = "Component" |
|
From: Glauco S. <gla...@us...> - 2005-06-19 15:12:12
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21660/b7_Scripts/WalkForwardTesting/WalkForwardOneRank Modified Files: ComparableAccount.cs Log Message: The fitness value has been changed Index: ComparableAccount.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank/ComparableAccount.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ComparableAccount.cs 26 May 2005 23:34:29 -0000 1.9 --- ComparableAccount.cs 19 Jun 2005 15:12:04 -0000 1.10 *************** *** 39,43 **** private double maxAcceptableDrawDown = 30; ! private double minAcceptableWinningPeriods = 30; private IHistoricalQuoteProvider historicalQuoteProvider = --- 39,43 ---- private double maxAcceptableDrawDown = 30; ! private double minAcceptableWinningPeriods = 52; private IHistoricalQuoteProvider historicalQuoteProvider = *************** *** 70,86 **** // old goodness computation ! if ( ( this.accountReport.Summary.MaxEquityDrawDown >= this.maxAcceptableDrawDown ) ! || ( this.accountReport.Summary.TotalPnl <= this.accountReport.Summary.BenchmarkPercentageReturn ) ) returnValue = Double.MinValue; else // max draw down is acceptable and the strategy is better than buy and hold ! returnValue = this.accountReport.Summary.ReturnOnAccount - ! this.accountReport.Summary.BenchmarkPercentageReturn; // new goodness computation ! if ( this.accountReport.Summary.NumberWinningPeriods < this.minAcceptableWinningPeriods ) returnValue = Double.MinValue; else ! returnValue = Convert.ToDouble( this.accountReport.Summary.PercentageWinningPeriods ); return returnValue; --- 70,93 ---- // old goodness computation ! if ( ( (double)this.accountReport.Summary.MaxEquityDrawDown.Value >= ! this.maxAcceptableDrawDown ) ! || ( this.accountReport.Summary.TotalPnl <= ! (double)this.accountReport.Summary.BenchmarkPercentageReturn.Value ) ) returnValue = Double.MinValue; else // max draw down is acceptable and the strategy is better than buy and hold ! returnValue = (double)this.accountReport.Summary.ReturnOnAccount.Value - ! (double)this.accountReport.Summary.BenchmarkPercentageReturn.Value; // new goodness computation ! // if ( this.accountReport.Summary.NumberWinningPeriods < this.minAcceptableWinningPeriods ) ! // returnValue = Double.MinValue; ! // else ! // returnValue = Convert.ToDouble( this.accountReport.Summary.PercentageWinningPeriods ); ! if ( (double)this.accountReport.Summary.PercentageWinningPeriods.Value < ! this.minAcceptableWinningPeriods ) returnValue = Double.MinValue; else ! returnValue = Convert.ToDouble( - (double)this.accountReport.Summary.MaxEquityDrawDown.Value ); return returnValue; |
|
From: Glauco S. <gla...@us...> - 2005-06-19 15:09:36
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20750/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows Added Files: DoubleSummaryRow.cs Log Message: A SummaryRow with double format --- NEW FILE: DoubleSummaryRow.cs --- /* QuantProject - Quantitative Finance Library DoubleSummaryRow.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using QuantProject.ADT; namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows { /// <summary> /// A SummaryRow with double format /// </summary> [Serializable] public class DoubleSummaryRow : SummaryRow { public DoubleSummaryRow( int decimals ) : base() { switch ( decimals ) { case 1: this.format = ConstantsProvider.FormatWithOneDecimal; break; case 2: this.format = ConstantsProvider.FormatWithTwoDecimals; break; } } } } |
|
From: Glauco S. <gla...@us...> - 2005-06-19 15:08:00
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20200/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows Added Files: IntegerSummaryRow.cs Log Message: A SummaryRow with integer format --- NEW FILE: IntegerSummaryRow.cs --- /* QuantProject - Quantitative Finance Library IntegerSummaryRow.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using QuantProject.ADT; namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows { /// <summary> /// A SummaryRow with integer format /// </summary> [Serializable] public class IntegerSummaryRow : SummaryRow { public IntegerSummaryRow() : base() { this.format = ConstantsProvider.FormatWithZeroDecimals; } } } |
|
From: Glauco S. <gla...@us...> - 2005-06-19 15:05:16
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19398/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows Added Files: PercentageSummaryRow.cs Log Message: A SummaryRow with percentage format --- NEW FILE: PercentageSummaryRow.cs --- /* QuantProject - Quantitative Finance Library PercentageSummaryRow.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using QuantProject.ADT; namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows { /// <summary> /// A SummaryRow with percentage format /// </summary> [Serializable] public class PercentageSummaryRow : SummaryRow { public PercentageSummaryRow() : base() { this.format = ConstantsProvider.FormatWithTwoDecimals; } } } |
|
From: Glauco S. <gla...@us...> - 2005-06-19 15:03:31
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18924/b5_Presentation/Reporting/WindowsForm Added Files: SummaryItem.cs Log Message: A summary item: it contains both the item label and the item value --- NEW FILE: SummaryItem.cs --- /* QuantProject - Quantitative Finance Library SummaryItem.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Windows.Forms; using QuantProject.Business.Financial.Accounting.Reporting.SummaryRows; namespace QuantProject.Presentation.Reporting.WindowsForm { /// <summary> /// A summary item: it contains both the item label and the item value /// </summary> public class SummaryItem { private Label description; private Label itemValue; public Label Description { get { return this.description; } } public Label Value { get { return this.itemValue; } } private void setPrivateMembers( string description , string itemValue ) { this.description = new Label(); this.description.Text = description; this.itemValue = new Label(); this.itemValue.Text = itemValue; } public SummaryItem( string description , string itemValue ) { this.setPrivateMembers( description , itemValue ); } public SummaryItem( SummaryRow summaryRow ) { this.setPrivateMembers( summaryRow.Description , summaryRow.FormattedValue ); } } } |
|
From: Glauco S. <gla...@us...> - 2005-06-19 15:00:29
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16411/b4_Business/a1_Financial/a2_Accounting Modified Files: Account.cs Log Message: ReturnOnAccount has changed its type Index: Account.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Account.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Account.cs 20 Feb 2005 00:03:03 -0000 1.17 --- Account.cs 19 Jun 2005 15:00:09 -0000 1.18 *************** *** 153,157 **** 1 , this.endOfDayTimer.GetCurrentTime() ); } ! return this.accountReport.Summary.ReturnOnAccount; } public int CompareTo( Object account ) --- 153,157 ---- 1 , this.endOfDayTimer.GetCurrentTime() ); } ! return (double)this.accountReport.Summary.ReturnOnAccount.Value; } public int CompareTo( Object account ) |
|
From: Glauco S. <gla...@us...> - 2005-06-19 14:57:20
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15056/b1_ADT Modified Files: ConstantsProvider.cs Log Message: Added new formatting strings Index: ConstantsProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ConstantsProvider.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ConstantsProvider.cs 26 May 2005 23:26:41 -0000 1.10 --- ConstantsProvider.cs 19 Jun 2005 14:57:11 -0000 1.11 *************** *** 26,30 **** // max num days allowed by the data source (yahoo) public static double MaxNumDaysDownloadedAtEachConnection = 200; ! public static string FormatWithTwoDecimals = "0:#,#.00"; public static DateTime MinQuoteDateTime = new DateTime( 1950 , 1 , 1 ); public static int CachePages = 1000; --- 26,32 ---- // max num days allowed by the data source (yahoo) public static double MaxNumDaysDownloadedAtEachConnection = 200; ! public static string FormatWithZeroDecimals = "#,#."; ! public static string FormatWithOneDecimal = "#,#.0"; ! public static string FormatWithTwoDecimals = "#,#.00"; public static DateTime MinQuoteDateTime = new DateTime( 1950 , 1 , 1 ); public static int CachePages = 1000; |
|
From: Glauco S. <gla...@us...> - 2005-06-19 14:55:34
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14145/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows Modified Files: BenchmarkPercentageReturn.cs AverageTradePercentageReturn.cs AverageShortTradePercentageReturn.cs AverageLongTradePercentageReturn.cs AnnualSystemPercentageReturn.cs Log Message: Reordered the process to populate the summary. Now, to add a summary item, you just need to add a new SummaryRow object to the QuantProject.Business.Financial.Accounting.Reporting.Tables.Summary object. Index: AverageLongTradePercentageReturn.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/AverageLongTradePercentageReturn.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AverageLongTradePercentageReturn.cs 19 Feb 2005 16:02:15 -0000 1.3 --- AverageLongTradePercentageReturn.cs 19 Jun 2005 14:55:09 -0000 1.4 *************** *** 11,15 **** /// </summary> [Serializable] ! public class AverageLongTradePercentageReturn : SummaryRow { public AverageLongTradePercentageReturn( Summary summary ) --- 11,15 ---- /// </summary> [Serializable] ! public class AverageLongTradePercentageReturn : PercentageSummaryRow { public AverageLongTradePercentageReturn( Summary summary ) Index: BenchmarkPercentageReturn.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/BenchmarkPercentageReturn.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BenchmarkPercentageReturn.cs 30 Mar 2005 23:48:07 -0000 1.1 --- BenchmarkPercentageReturn.cs 19 Jun 2005 14:55:09 -0000 1.2 *************** *** 13,17 **** /// </summary> [Serializable] ! public class BenchmarkPercentageReturn : SummaryRow { public BenchmarkPercentageReturn( Summary summary , --- 13,17 ---- /// </summary> [Serializable] ! public class BenchmarkPercentageReturn : PercentageSummaryRow { public BenchmarkPercentageReturn( Summary summary , *************** *** 27,34 **** summary.AccountReport.Benchmark , summary.AccountReport.EndDateTime ); ! summary.BenchmarkPercentageReturn = ( finalMarketValue - beginningMarketValue ) / ! beginningMarketValue * 100; this.rowDescription = "Buy & hold % return"; ! this.rowValue = summary.BenchmarkPercentageReturn; } } --- 27,35 ---- summary.AccountReport.Benchmark , summary.AccountReport.EndDateTime ); ! // summary.BenchmarkPercentageReturn = ( finalMarketValue - beginningMarketValue ) / ! // beginningMarketValue * 100; this.rowDescription = "Buy & hold % return"; ! this.rowValue = ( finalMarketValue - beginningMarketValue ) / ! beginningMarketValue * 100; } } Index: AverageShortTradePercentageReturn.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/AverageShortTradePercentageReturn.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AverageShortTradePercentageReturn.cs 19 Feb 2005 16:02:15 -0000 1.3 --- AverageShortTradePercentageReturn.cs 19 Jun 2005 14:55:09 -0000 1.4 *************** *** 11,15 **** /// </summary> [Serializable] ! public class AverageShortTradePercentageReturn : SummaryRow { public AverageShortTradePercentageReturn( Summary summary ) --- 11,15 ---- /// </summary> [Serializable] ! public class AverageShortTradePercentageReturn : PercentageSummaryRow { public AverageShortTradePercentageReturn( Summary summary ) Index: AverageTradePercentageReturn.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/AverageTradePercentageReturn.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AverageTradePercentageReturn.cs 19 Feb 2005 16:02:15 -0000 1.3 --- AverageTradePercentageReturn.cs 19 Jun 2005 14:55:09 -0000 1.4 *************** *** 11,15 **** /// </summary> [Serializable] ! public class AverageTradePercentageReturn : SummaryRow { public AverageTradePercentageReturn( Summary summary ) --- 11,15 ---- /// </summary> [Serializable] ! public class AverageTradePercentageReturn : PercentageSummaryRow { public AverageTradePercentageReturn( Summary summary ) Index: AnnualSystemPercentageReturn.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/AnnualSystemPercentageReturn.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AnnualSystemPercentageReturn.cs 15 Feb 2005 19:09:02 -0000 1.3 --- AnnualSystemPercentageReturn.cs 19 Jun 2005 14:55:09 -0000 1.4 *************** *** 11,23 **** /// </summary> [Serializable] ! public class AnnualSystemPercentageReturn : SummaryRow { public AnnualSystemPercentageReturn( Summary summary ) { double totalROA = summary.TotalPnl / ( summary.FinalAccountValue - summary.TotalPnl ); ! summary.AnnualSystemPercentageReturn = ( ( Math.Pow( 1 + totalROA , ! 1.0 / ( (double)summary.IntervalDays/365.0 ) ) ) - 1 ) * 100; this.rowDescription = "Annual system % return"; ! this.rowValue = summary.AnnualSystemPercentageReturn; } } --- 11,24 ---- /// </summary> [Serializable] ! public class AnnualSystemPercentageReturn : PercentageSummaryRow { public AnnualSystemPercentageReturn( Summary summary ) { double totalROA = summary.TotalPnl / ( summary.FinalAccountValue - summary.TotalPnl ); ! // summary.AnnualSystemPercentageReturn = ( ( Math.Pow( 1 + totalROA , ! // 1.0 / ( (double)summary.IntervalDays/365.0 ) ) ) - 1 ) * 100; this.rowDescription = "Annual system % return"; ! this.rowValue = ( ( Math.Pow( 1 + totalROA , ! 1.0 / ( (double)summary.IntervalDays/365.0 ) ) ) - 1 ) * 100; } } |