quantproject-developers Mailing List for QuantProject (Page 47)
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: Glauco S. <gla...@us...> - 2008-04-13 16:24:00
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/EndOfDayStrategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15920/b4_Business/a2_Strategies/EndOfDayStrategies Added Files: SymmetricEndOfDayStrategyForBacktester.cs Log Message: To be implemented by those strategies that take the same actions both on market open and on market close. For these strategies, decisions are not based on the type of market status switch, but rather on the underlying out of sample intervals. In practical terms, these strategies run the same code for both on market open and market close events --- NEW FILE: SymmetricEndOfDayStrategyForBacktester.cs --- /* QuantProject - Quantitative Finance Library BasicEndOfDayStrategyForBacktester.cs Copyright (C) 2008 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.Business.DataProviders; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.InSample; using QuantProject.Business.Strategies.ReturnsManagement.Time.IntervalsSelectors; namespace QuantProject.Business.Strategies { /// <summary> /// To be implemented by those strategies that take the same /// actions both on market open and on market close. /// For these strategies, decisions are not based on the type of /// market status switch, but rather on the underlying out of sample /// intervals. /// In practical terms, these strategies run the same code for both on /// market open and market close events /// </summary> public abstract class SymmetricEndOfDayStrategyForBacktester : BasicEndOfDayStrategyForBacktester { public SymmetricEndOfDayStrategyForBacktester( int numDaysBeetweenEachOtpimization , int numDaysForInSampleOptimization , IIntervalsSelector intervalsSelector , IEligiblesSelector eligiblesSelector , IInSampleChooser inSampleChooser , IHistoricalQuoteProvider historicalQuoteProviderForInSample ) : base( numDaysBeetweenEachOtpimization , numDaysForInSampleOptimization , intervalsSelector , eligiblesSelector , inSampleChooser , historicalQuoteProviderForInSample ) { // // TODO: Add constructor logic here // } protected abstract bool arePositionsToBeClosed(); protected abstract bool arePositionsToBeOpened(); protected abstract WeightedPositions getPositionsToBeOpened(); protected sealed override bool marketOpenEventHandler_arePositionsToBeClosed() { return this.arePositionsToBeClosed(); } protected sealed override bool marketOpenEventHandler_arePositionsToBeOpened() { return this.arePositionsToBeOpened(); } protected sealed override WeightedPositions marketOpenEventHandler_getPositionsToBeOpened() { return this.getPositionsToBeOpened(); } protected sealed override bool marketCloseEventHandler_arePositionsToBeClosed() { return this.arePositionsToBeClosed(); } protected sealed override bool marketCloseEventHandler_arePositionsToBeOpened() { return this.arePositionsToBeOpened(); } protected sealed override WeightedPositions marketCloseEventHandler_getPositionsToBeOpened() { return this.getPositionsToBeOpened(); } } } |
|
From: Glauco S. <gla...@us...> - 2008-04-10 23:18:27
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv24074/b7_Scripts/WalkForwardTesting/PairsTrading Modified Files: PairsTradingMain.cs Log Message: Some minor changes. The most significant, is aimed at filtering eligibles above 30$ Index: PairsTradingMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/PairsTradingMain.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PairsTradingMain.cs 7 Apr 2008 21:01:43 -0000 1.8 --- PairsTradingMain.cs 10 Apr 2008 23:18:23 -0000 1.9 *************** *** 91,95 **** true , maxNumberOfEligiblesToBeChosen , ! 10 , 0 , 99999 ); } --- 91,95 ---- true , maxNumberOfEligiblesToBeChosen , ! 10 , 30 , 99999 ); } *************** *** 154,160 **** double cashToStart = 30000; ! DateTime firstDateTime = new DateTime( 2001 , 1 , 4 ); DateTime lastDateTime = new DateTime( 2004 , 12 , 31 ); ! double maxRunningHours = 7.5; this.endOfDayStrategyBackTester = --- 154,160 ---- double cashToStart = 30000; ! DateTime firstDateTime = new DateTime( 2001 , 1 , 1 ); DateTime lastDateTime = new DateTime( 2004 , 12 , 31 ); ! double maxRunningHours = 8; this.endOfDayStrategyBackTester = |
|
From: Glauco S. <gla...@us...> - 2008-04-10 23:16:36
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/InSample/InSampleChoosers/BruteForce In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23248/b7_Scripts/WalkForwardTesting/PairsTrading/InSample/InSampleChoosers/BruteForce Modified Files: PairsTradingBruteForceOptimizableParametersManager.cs Log Message: AreEquivalentAsTopBestParameters() now considers equivalent two TestingPositions if their fitness is very similar. Infact, if two TestingPositions (a,b) and (c,d) have the same fitness, but different tickers (a!=b), probably a and b represent the same security X (probably, X's ticker changed from a to b or viceversa and the database contains historical quotes for both a and b); in such a case (a,b) and (c,d) are equivalent and the second one is to be dropped down Index: PairsTradingBruteForceOptimizableParametersManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/InSample/InSampleChoosers/BruteForce/PairsTradingBruteForceOptimizableParametersManager.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PairsTradingBruteForceOptimizableParametersManager.cs 30 Mar 2008 15:28:13 -0000 1.1 --- PairsTradingBruteForceOptimizableParametersManager.cs 10 Apr 2008 23:16:31 -0000 1.2 *************** *** 23,26 **** --- 23,27 ---- using System; + using QuantProject.ADT.Optimizing.BruteForce; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.Optimizing.BruteForce; *************** *** 60,87 **** #region AreEquivalentAsTopBestParameters private void areEquivalentAsTopBestParameters_checkParameters( ! object meaning1 , object meaning2 ) { ! if ( !(meaning1 is TestingPositions) ) throw new Exception( "The first parameter is expected " + ! "to be a TestingPositions!" ); ! if ( !(meaning2 is TestingPositions) ) throw new Exception( "The second parameter is expected " + ! "to be a TestingPositions!" ); } /// Two TestingPositions are considered equivalent as TopBestPositions /// (and only one is kept among them) iif they have the same tickers /// (consider that if two WeightedPosition are highly correlated, the ! /// two opposite WeightedPosition are highly correlated too) public override bool AreEquivalentAsTopBestParameters( ! object meaning1 , object meaning2 ) { this.areEquivalentAsTopBestParameters_checkParameters( ! meaning1 , meaning2 ); ! string hashCodeForMeaning1 = ! ((TestingPositions)meaning1).HashCodeForTickerComposition; ! string hashCodeForMeaning2 = ! ((TestingPositions)meaning2).HashCodeForTickerComposition; bool areEquivalentAsTopBestParameters = ! ( hashCodeForMeaning1 == hashCodeForMeaning2 ); return areEquivalentAsTopBestParameters; } --- 61,129 ---- #region AreEquivalentAsTopBestParameters private void areEquivalentAsTopBestParameters_checkParameters( ! BruteForceOptimizableParameters bruteForceOptimizableParameters1 , ! BruteForceOptimizableParameters bruteForceOptimizableParameters2 ) { ! if ( !(bruteForceOptimizableParameters1.Meaning is TestingPositions) ) throw new Exception( "The first parameter is expected " + ! "to represent a TestingPositions!" ); ! if ( !(bruteForceOptimizableParameters2.Meaning is TestingPositions) ) throw new Exception( "The second parameter is expected " + ! "to represent a TestingPositions!" ); ! } ! private bool haveTheSameTickers( ! TestingPositions testingPositions1 , ! TestingPositions testingPositions2 ) ! { ! string hashCodeForMeaning1 = ! testingPositions1.HashCodeForTickerComposition; ! string hashCodeForMeaning2 = ! testingPositions2.HashCodeForTickerComposition; ! bool areEquivalentAsTopBestParameters = ! ( hashCodeForMeaning1 == hashCodeForMeaning2 ); ! return areEquivalentAsTopBestParameters; ! } ! private bool haveTheSameFitness( ! BruteForceOptimizableParameters bruteForceOptimizableParameters1 , ! BruteForceOptimizableParameters bruteForceOptimizableParameters2 ) ! { ! double fitness1 = bruteForceOptimizableParameters1.Fitness; ! double fitness2 = bruteForceOptimizableParameters2.Fitness; ! double percDifference = Math.Abs( ! fitness1 / fitness2 - 1 ); ! bool areEquivalentAsTopBestParameters = ! ( percDifference < 0.00001 ); ! // if ( areEquivalentAsTopBestParameters ) ! // { ! // string forBreakpoint = ""; ! // forBreakpoint = forBreakpoint + "a"; ! // } ! return areEquivalentAsTopBestParameters; } /// Two TestingPositions are considered equivalent as TopBestPositions /// (and only one is kept among them) iif they have the same tickers /// (consider that if two WeightedPosition are highly correlated, the ! /// two opposite WeightedPosition are highly correlated too) or ! /// if they have the same fitness (in this second case, probably ! /// two tickers represent the same security and thus are equivalent) public override bool AreEquivalentAsTopBestParameters( ! BruteForceOptimizableParameters bruteForceOptimizableParameters1 , ! BruteForceOptimizableParameters bruteForceOptimizableParameters2 ) { this.areEquivalentAsTopBestParameters_checkParameters( ! bruteForceOptimizableParameters1 , bruteForceOptimizableParameters2 ); ! ! // if two TestingPositions (a,b) and (c,d) have the same fitness, ! // but different tickers (a!=b), probably a and b represent ! // the same security X (probably, X's ticker changed from a to b ! // or viceversa and the database contains historical quotes for ! // both a and b); in such a case (a,b) and (c,d) are equivalent ! // and the second one is to be dropped down bool areEquivalentAsTopBestParameters = ! this.haveTheSameTickers( ! ((TestingPositions)bruteForceOptimizableParameters1.Meaning ) , ! ((TestingPositions)bruteForceOptimizableParameters2.Meaning) ) || ! this.haveTheSameFitness( ! bruteForceOptimizableParameters1 , ! bruteForceOptimizableParameters2 ); return areEquivalentAsTopBestParameters; } |
|
From: Glauco S. <gla...@us...> - 2008-04-10 23:13:10
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/BruteForce/ParametersManagers In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21848/b1_ADT/Optimizing/BruteForce/ParametersManagers Modified Files: BruteForceOptimizableParametersManagerWithoutEquivalentsAsTopBestParameters.cs Log Message: bool AreEquivalentAsTopBestParameters( object meaning1 , object meaning2 ); has been changed to bool AreEquivalentAsTopBestParameters( BruteForceOptimizableParameters bruteForceOptimizableParameters1 , BruteForceOptimizableParameters bruteForceOptimizableParameters2 ); The reason is that BruteForceOptimizableParameters always have both the Meaning and the Fitness properties, thus AreEquivalentAsTopBestParameters() can take advantage of the Fitness value also Index: BruteForceOptimizableParametersManagerWithoutEquivalentsAsTopBestParameters.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/BruteForce/ParametersManagers/BruteForceOptimizableParametersManagerWithoutEquivalentsAsTopBestParameters.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BruteForceOptimizableParametersManagerWithoutEquivalentsAsTopBestParameters.cs 30 Mar 2008 15:19:27 -0000 1.1 --- BruteForceOptimizableParametersManagerWithoutEquivalentsAsTopBestParameters.cs 10 Apr 2008 23:13:06 -0000 1.2 *************** *** 50,57 **** public virtual bool AreEquivalentAsTopBestParameters( ! object meaning1 , object meaning2 ) { bool areEquivalentAsTopBestParameters = ! ( meaning1 == meaning2 ); return areEquivalentAsTopBestParameters; } --- 50,59 ---- public virtual bool AreEquivalentAsTopBestParameters( ! BruteForceOptimizableParameters bruteForceOptimizableParameters1 , ! BruteForceOptimizableParameters bruteForceOptimizableParameters2 ) { bool areEquivalentAsTopBestParameters = ! ( bruteForceOptimizableParameters1.Meaning == ! bruteForceOptimizableParameters2.Meaning ); return areEquivalentAsTopBestParameters; } |
|
From: Glauco S. <gla...@us...> - 2008-04-10 23:12:48
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/BruteForce In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21488/b1_ADT/Optimizing/BruteForce Modified Files: BestParametersManager.cs Log Message: bool AreEquivalentAsTopBestParameters( object meaning1 , object meaning2 ); has been changed to bool AreEquivalentAsTopBestParameters( BruteForceOptimizableParameters bruteForceOptimizableParameters1 , BruteForceOptimizableParameters bruteForceOptimizableParameters2 ); The reason is that BruteForceOptimizableParameters always have both the Meaning and the Fitness properties, thus AreEquivalentAsTopBestParameters() can take advantage of the Fitness value also Index: BestParametersManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/BruteForce/BestParametersManager.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BestParametersManager.cs 30 Mar 2008 15:33:39 -0000 1.2 --- BestParametersManager.cs 10 Apr 2008 23:12:44 -0000 1.3 *************** *** 97,102 **** indexForCurrentTopBestParameters < this.numberOfNonNullItemsInTopBestParameters && !this.bruteForceOptimizableParametersManager.AreEquivalentAsTopBestParameters( ! bruteForceOptimizableParameters.Meaning , ! this.topBestParameters[ indexForCurrentTopBestParameters ].Meaning ) ) indexForCurrentTopBestParameters++; bool isEquivalentAlreadyPresent = --- 97,102 ---- indexForCurrentTopBestParameters < this.numberOfNonNullItemsInTopBestParameters && !this.bruteForceOptimizableParametersManager.AreEquivalentAsTopBestParameters( ! bruteForceOptimizableParameters , ! this.topBestParameters[ indexForCurrentTopBestParameters ] ) ) indexForCurrentTopBestParameters++; bool isEquivalentAlreadyPresent = |
|
From: Glauco S. <gla...@us...> - 2008-04-10 23:11:37
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/InSample In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21042/b4_Business/a2_Strategies/InSample Modified Files: BasicChooserFromSavedBackTestLog.cs Log Message: NewProgress and NewMessage are risen now (it gave two warnings with my VSNet) Index: BasicChooserFromSavedBackTestLog.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/InSample/BasicChooserFromSavedBackTestLog.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BasicChooserFromSavedBackTestLog.cs 8 Apr 2008 21:31:26 -0000 1.1 --- BasicChooserFromSavedBackTestLog.cs 10 Apr 2008 23:11:32 -0000 1.2 *************** *** 100,103 **** --- 100,107 ---- this.getTestingPositionsFromBackTestLog( returnsManager.ReturnIntervals.LastEndOfDayDateTime ); + this.NewProgress( this , + new NewProgressEventArgs( 1 , 1 ) ); + this.NewMessage( this , + new NewMessageEventArgs( "AnalyzeInSample is complete" ) ); return bestTestingPositionsInSample; } |
|
From: Glauco S. <gla...@us...> - 2008-04-10 23:10:11
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/BruteForce/ParametersManagers In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv20342/b1_ADT/Optimizing/BruteForce/ParametersManagers Modified Files: IBruteForceOptimizableParametersManager.cs Log Message: bool AreEquivalentAsTopBestParameters( object meaning1 , object meaning2 ); has been changed to bool AreEquivalentAsTopBestParameters( BruteForceOptimizableParameters bruteForceOptimizableParameters1 , BruteForceOptimizableParameters bruteForceOptimizableParameters2 ); The reason is that BruteForceOptimizableParameters always have both the Meaning and the Fitness properties, thus AreEquivalentAsTopBestParameters() can take advantage of the Fitness value also Index: IBruteForceOptimizableParametersManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/BruteForce/ParametersManagers/IBruteForceOptimizableParametersManager.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IBruteForceOptimizableParametersManager.cs 30 Mar 2008 15:17:42 -0000 1.1 --- IBruteForceOptimizableParametersManager.cs 10 Apr 2008 23:10:07 -0000 1.2 *************** *** 39,43 **** double GetFitnessValue( BruteForceOptimizableParameters bruteForceOptimizableParameters ); object Decode( BruteForceOptimizableParameters bruteForceOptimizableParameters ); ! bool AreEquivalentAsTopBestParameters( object meaning1 , object meaning2 ); } } --- 39,45 ---- double GetFitnessValue( BruteForceOptimizableParameters bruteForceOptimizableParameters ); object Decode( BruteForceOptimizableParameters bruteForceOptimizableParameters ); ! bool AreEquivalentAsTopBestParameters( ! BruteForceOptimizableParameters bruteForceOptimizableParameters1 , ! BruteForceOptimizableParameters bruteForceOptimizableParameters2 ); } } |
|
From: Glauco S. <gla...@us...> - 2008-04-10 23:07:59
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19293/b7_Scripts Modified Files: Scripts_SD.csproj Log Message: WalkForwardTesting\PairsTrading\PairsTradingMain2.cs has been removed Index: Scripts_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/Scripts_SD.csproj,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Scripts_SD.csproj 8 Apr 2008 22:04:54 -0000 1.22 --- Scripts_SD.csproj 10 Apr 2008 23:07:51 -0000 1.23 *************** *** 114,118 **** <Compile Include="WalkForwardTesting\PairsTrading\Logging\TesterForPairsTradingTestingPositions.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\PairsTradingMain.cs" /> - <Compile Include="WalkForwardTesting\PairsTrading\PairsTradingMain2.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\PairsTradingStrategy.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\PairsTradingTestingPositions.cs" /> --- 114,117 ---- |
|
From: Marco M. <mi...@us...> - 2008-04-08 22:05:00
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15736/b4_Business Modified Files: b4_Business.csproj Business_SD.csproj Log Message: Updated sharpdevelop and vs net projects' files Index: Business_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/Business_SD.csproj,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Business_SD.csproj 1 Apr 2008 21:29:39 -0000 1.21 --- Business_SD.csproj 8 Apr 2008 22:04:54 -0000 1.22 *************** *** 79,82 **** --- 79,83 ---- <Compile Include="a2_Strategies\InSample\ConstantWeightedPositionsChooser.cs" /> <Compile Include="a2_Strategies\InSample\DummyInSampleChooser.cs" /> + <Compile Include="a2_Strategies\InSample\BasicChooserFromSavedBackTestLog.cs" /> <Compile Include="a2_Strategies\InSample\GeneticChooser.cs" /> <Compile Include="a2_Strategies\InSample\IInSampleChooser.cs" /> Index: b4_Business.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** b4_Business.csproj 1 Apr 2008 21:17:50 -0000 1.63 --- b4_Business.csproj 8 Apr 2008 22:04:54 -0000 1.64 *************** *** 130,133 **** --- 130,138 ---- Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> + <Reference + Name = "System.Drawing" + AssemblyName = "System.Drawing" + HintPath = "..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Drawing.dll" + /> </References> </Build> *************** *** 745,748 **** --- 750,758 ---- /> <File + RelPath = "a2_Strategies\InSample\BasicChooserFromSavedBackTestLog.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a2_Strategies\InSample\BruteForceChooser.cs" SubType = "Code" |
|
From: Marco M. <mi...@us...> - 2008-04-08 22:05:00
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15736/b7_Scripts Modified Files: b7_Scripts.csproj Scripts_SD.csproj Log Message: Updated sharpdevelop and vs net projects' files Index: Scripts_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/Scripts_SD.csproj,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Scripts_SD.csproj 1 Apr 2008 21:19:59 -0000 1.21 --- Scripts_SD.csproj 8 Apr 2008 22:04:54 -0000 1.22 *************** *** 53,56 **** --- 53,57 ---- <Compile Include="General\Logging\LogArchiver.cs" /> <Compile Include="General\Logging\LogViewer.cs" /> + <Compile Include="General\Logging\DummyTesterForTestingPositions.cs" /> <Compile Include="General\Reporting\BackTesterReportViewer.cs" /> <Compile Include="MyTradingSystem.cs" /> *************** *** 69,72 **** --- 70,74 ---- <Compile Include="TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\FitnessEvaluators\PVOFitnessEvaluator.cs" /> <Compile Include="TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\GenomeManagerPVO_OTC.cs" /> + <Compile Include="TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\InSampleChoosers\PVOChooserFromSavedBackTestLog.cs" /> <Compile Include="TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\InSampleChoosers\PVOCorrelationChooser.cs" /> <Compile Include="TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\InSampleChoosers\PVOGeneticChooser.cs" /> *************** *** 112,115 **** --- 114,118 ---- <Compile Include="WalkForwardTesting\PairsTrading\Logging\TesterForPairsTradingTestingPositions.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\PairsTradingMain.cs" /> + <Compile Include="WalkForwardTesting\PairsTrading\PairsTradingMain2.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\PairsTradingStrategy.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\PairsTradingTestingPositions.cs" /> Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** b7_Scripts.csproj 30 Mar 2008 15:29:36 -0000 1.92 --- b7_Scripts.csproj 8 Apr 2008 22:04:54 -0000 1.93 *************** *** 249,252 **** --- 249,257 ---- /> <File + RelPath = "General\Logging\DummyTesterForTestingPositions.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "General\Logging\LogArchiver.cs" SubType = "Code" *************** *** 335,338 **** --- 340,358 ---- /> <File + RelPath = "TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVO_OTCLogItem.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVO_OTCMain.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVO_OTCStrategy.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVOGenomeManager.cs" SubType = "Code" *************** *** 405,408 **** --- 425,438 ---- /> <File + RelPath = "TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\InSampleChoosers\PVO_OTCCorrelationChooser.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\InSampleChoosers\PVOChooserFromSavedBackTestLog.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\InSampleChoosers\PVOCorrelationChooser.cs" SubType = "Code" |
|
From: Marco M. <mi...@us...> - 2008-04-08 22:03:54
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15288/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator Modified Files: PVO_OTCMain.cs Log Message: Changed the main file for the PVO_OTC strategy Index: PVO_OTCMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVO_OTCMain.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PVO_OTCMain.cs 1 Apr 2008 21:34:52 -0000 1.2 --- PVO_OTCMain.cs 8 Apr 2008 22:03:48 -0000 1.3 *************** *** 44,47 **** --- 44,48 ---- using QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator.Decoding; using QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator.FitnessEvaluators; + using QuantProject.Scripts.General; using QuantProject.Scripts.General.Logging; using QuantProject.Scripts.General.Reporting; *************** *** 55,242 **** /// be done /// </summary> ! public class PVO_OTCMain { ! private string strategyIdentifier; ! private string fileNameWithoutExt; ! private string dirNameWhereToSaveResults; ! ! public PVO_OTCMain() ! { ! this.strategyIdentifier = "PVO_OTC"; ! } ! private void setFileNamesAndDirectory(EndOfDayStrategyBackTester endOfDayStrategyBackTester) { ! if(this.fileNameWithoutExt == null) ! { ! this.fileNameWithoutExt = this.strategyIdentifier + "_" + ! DateTime.Now.Hour.ToString().PadLeft(2,'0') + "_" + ! DateTime.Now.Minute.ToString().PadLeft(2,'0') + "_" + ! DateTime.Now.Second.ToString().PadLeft(2,'0'); ! this.dirNameWhereToSaveResults = System.Configuration.ConfigurationSettings.AppSettings["LogArchive"] + ! "\\" + fileNameWithoutExt + "\\"; ! ! if( !Directory.Exists(dirNameWhereToSaveResults) ) ! Directory.CreateDirectory(dirNameWhereToSaveResults); ! } } ! ! #region Run ! private MessageManager setMessageManager( ! IEligiblesSelector eligiblesSelector , ! IInSampleChooser inSampleChooser , ! IEndOfDayStrategy endOfDayStrategy , ! EndOfDayStrategyBackTester endOfDayStrategyBackTester ) { ! this.setFileNamesAndDirectory(endOfDayStrategyBackTester); ! string fullPathFileNameForMessagesLog = dirNameWhereToSaveResults + ! this.fileNameWithoutExt + ! "LogMessages.txt"; ! MessageManager messageManager = ! new MessageManager( fullPathFileNameForMessagesLog ); ! messageManager.Monitor( eligiblesSelector ); ! messageManager.Monitor( inSampleChooser ); ! // messageManager.Monitor( endOfDayStrategy ); ! messageManager.Monitor( endOfDayStrategyBackTester ); ! return messageManager; } ! // TO DO check if you can add this to QuantProject.Presentation.Reporting.WindowsForm.Report ! // as a public method or as a new constructor ! // private void showReport( ! // DateTime lastDateTimeRequestedForTheScript , ! // EndOfDayStrategyBackTester endOfDayStrategyBackTester ) ! // { ! //// DateTime lastReportDateTime = ExtendedDateTime.Min( ! //// lastDateTimeRequestedForTheScript , ! //// endOfDayStrategyBackTester.EndOfDayTimer.GetCurrentTime().DateTime ); ! // DateTime lastReportDateTime = ! // endOfDayStrategyBackTester.ActualLastDateTime; ! // Report report = new Report( ! // endOfDayStrategyBackTester.AccountReport , ! // true ); ! // report.Create( endOfDayStrategyBackTester.DescriptionForLogFileName , 1 , ! // new EndOfDayDateTime( lastReportDateTime , ! // EndOfDaySpecificTime.OneHourAfterMarketClose ) , ! // endOfDayStrategyBackTester.Benchmark.Ticker ); ! // report.Show(); ! // } ! ! //Saves (in silent mode): ! //- a log file where the In Sample Analysis are ! // stored; ! //- a report; ! //- a txt file with a full description of the ! // strategy's features ! private void saveScriptResults( EndOfDayStrategyBackTester endOfDayStrategyBackTester ) { ! this.setFileNamesAndDirectory(endOfDayStrategyBackTester); ! string fullPathFileNameForLog = dirNameWhereToSaveResults + ! this.fileNameWithoutExt + ".qpL"; ! string fullPathFileNameForReport = dirNameWhereToSaveResults + ! this.fileNameWithoutExt + ".qpR"; ! string fullPathFileNameForParametersLog = dirNameWhereToSaveResults + ! this.fileNameWithoutExt + "_Parameters.txt"; ! ObjectArchiver.Archive(endOfDayStrategyBackTester.Log, ! fullPathFileNameForLog); ! ObjectArchiver.Archive(endOfDayStrategyBackTester.AccountReport, ! fullPathFileNameForReport); ! StreamWriter w = File.AppendText(fullPathFileNameForParametersLog); ! w.WriteLine ("\n---\r\n"); ! w.WriteLine ( endOfDayStrategyBackTester.Description ); ! w.WriteLine ("\n---\r\n"); ! w.Flush(); ! w.Close(); ! } ! public void Run() { ! //general ! DateTime firstDateTime = new DateTime( 2000 , 6 , 1 ); ! DateTime lastDateTime = new DateTime( 2005 , 12 , 31 ); ! double maxRunningHours = 1.5; ! Benchmark benchmark = new Benchmark( "^GSPC" ); ! // definition for the Fitness Evaluator (for ! // objects that use it) ! //IEquityEvaluator equityEvaluator = new SharpeRatio(); ! //cash and portfolio type double cashToStart = 30000; ! //int numberOfPortfolioPositions = 4; ! ! // parameters for the in sample Chooser ! //double crossoverRate = 0.85; ! //double mutationRate = 0.02; ! //double elitismRate = 0.001; ! //int populationSizeForGeneticOptimizer = 500; ! // int generationNumberForGeneticOptimizer = 10; ! int numberOfBestTestingPositionsToBeReturnedInSample = 8; ! // int seedForRandomGenerator = ! // QuantProject.ADT.ConstantsProvider.SeedForRandomGenerator; ! int numDaysBetweenEachOptimization = 15; ! // int minLevelForOversoldThreshold = 50; ! // int maxLevelForOversoldThreshold = 100; ! // int minLevelForOverboughtThreshold = 50; ! // int maxLevelForOverboughtThreshold = 100; ! // int divisorForThresholdComputation = 10000; ! // int numDaysForOscillatingPeriodForChooser = 1; //for genetic optimization ! // bool symmetricalThresholds = true; ! // bool overboughtMoreThanOversoldForFixedPortfolio = false; ! // double maxAcceptableCloseToCloseDrawdown = 0.03; ! // double minimumAcceptableGain = 0.008; ! // IDecoderForTestingPositions decoderForTestingPositions ! // = new BasicDecoderForPVOPositions(symmetricalThresholds, divisorForThresholdComputation , ! // numDaysForOscillatingPeriodForChooser); ! // IFitnessEvaluator fitnessEvaluator = ! // new PVOFitnessEvaluator( equityEvaluator ); ! HistoricalQuoteProvider historicalQuoteProviderForBackTester, ! historicalQuoteProviderForInSampleChooser, ! historicalQuoteProviderForStrategy; ! historicalQuoteProviderForBackTester = ! new HistoricalAdjustedQuoteProvider(); ! historicalQuoteProviderForInSampleChooser = historicalQuoteProviderForBackTester; ! historicalQuoteProviderForStrategy = historicalQuoteProviderForInSampleChooser; ! ! IInSampleChooser inSampleChooser = ! new PVO_OTCCorrelationChooser(numberOfBestTestingPositionsToBeReturnedInSample); ! //parameters for eligiblesSelector ! bool temporizedGroup = true; ! double minRawOpenPrice = 25; ! double maxRawOpenPrice = 500; ! int numDaysForAverageOpenRawPrice = 20; ! string tickersGroupId = "SP500"; ! int maxNumberOfEligiblesToBeChosen = 100; ! IEligiblesSelector eligiblesSelector = ! new ByPriceMostLiquidAlwaysQuoted( ! tickersGroupId , temporizedGroup, maxNumberOfEligiblesToBeChosen, ! numDaysForAverageOpenRawPrice , ! minRawOpenPrice , maxRawOpenPrice ); ! //strategyParameters ! double oversoldThreshold = 0.0075; ! double overboughtThreshold = 0.0075; ! int inSampleDays = 120; ! PVO_OTCStrategy strategy = ! new PVO_OTCStrategy(eligiblesSelector, ! inSampleChooser, inSampleDays, ! benchmark , ! numDaysBetweenEachOptimization , ! oversoldThreshold , overboughtThreshold , ! historicalQuoteProviderForStrategy ); ! EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! this.strategyIdentifier , strategy , ! historicalQuoteProviderForBackTester , new SimpleAccountProvider(),firstDateTime , ! lastDateTime , benchmark , cashToStart , maxRunningHours ); ! MessageManager messageManager = this.setMessageManager( ! eligiblesSelector , inSampleChooser , ! strategy , endOfDayStrategyBackTester ); ! endOfDayStrategyBackTester.Run(); ! this.saveScriptResults(endOfDayStrategyBackTester); } ! #endregion Run ! } } --- 56,189 ---- /// be done /// </summary> ! public class PVO_OTCMain : BasicScriptForBacktesting { ! private Benchmark benchmark; ! private HistoricalQuoteProvider historicalQuoteProvider; ! public PVO_OTCMain() { ! this.benchmark = new Benchmark( "BMC" ); ! ! this.historicalQuoteProvider = ! new HistoricalAdjustedQuoteProvider(); ! ! // definition for the Fitness Evaluator ! // IEquityEvaluator equityEvaluator = new SharpeRatio(); } ! ! protected override void setEligiblesSelector() { ! int maxNumberOfEligiblesToBeChosen = 100; ! string tickersGroupId = "SP500"; ! // uncomment the following line for a faster script ! //tickersGroupId = "fastTest"; ! ! // this.eligiblesSelector = ! // new MostLiquidAndLessVolatile( ! // tickersGroupId , ! // maxNumberOfEligiblesToBeChosen ); ! ! bool temporizedGroup = true; ! int numDaysForAverageRawOpenPriceComputation = 20; ! double minPrice = 20; ! double maxPrice = 7000; ! ! this.eligiblesSelector = ! new ByPriceMostLiquidAlwaysQuoted( ! tickersGroupId , temporizedGroup , ! maxNumberOfEligiblesToBeChosen , ! numDaysForAverageRawOpenPriceComputation , ! minPrice , maxPrice ); ! this.eligiblesSelector = ! new DummyEligibleSelector(); } ! protected override void setInSampleChooser() { ! // parameters for the genetic optimizer ! // double crossoverRate = 0.85; ! // double mutationRate = 0.02; ! // double elitismRate = 0.001; ! // int populationSizeForGeneticOptimizer = 3000; ! // int generationNumberForGeneticOptimizer = 4; ! // int seedForRandomGenerator = ! // QuantProject.ADT.ConstantsProvider.SeedForRandomGenerator; ! // IDecoderForTestingPositions decoderForWeightedPositions = ! // new DecoderForPairsTradingTestingPositionsWithBalancedWeights(); ! ! double maxCorrelationAllowed = 0.96; ! int numberOfBestTestingPositionsToBeReturned = 10; ! bool balancedWeightsOnVolatilityBase = true; ! float minimumAbsoluteReturnValue = 0.000001f; ! float maximumAbsoluteReturnValue = 100000f; ! //correlation is computed only for returns ! //between minimum and maximum ! this.inSampleChooser = ! new PVO_OTCCorrelationChooser(numberOfBestTestingPositionsToBeReturned, ! maxCorrelationAllowed , balancedWeightsOnVolatilityBase, ! minimumAbsoluteReturnValue , maximumAbsoluteReturnValue); ! this.inSampleChooser = ! new PVOChooserFromSavedBackTestLog( ! @"C:\Utente\MarcoVarie\Vari\qP\LogArchive\2008_04_07_12_17_18_PVO_OTC_from_2001_01_01_to_2001_03_31_annlRtrn_232,37_maxDD_5,04\2008_04_07_12_17_18_PVO_OTC_from_2001_01_01_to_2001_03_31_annlRtrn_232,37_maxDD_5,04.qpL"); ! } ! ! protected override void setEndOfDayStrategy() { ! int inSampleDays = 180; ! // uncomment the following line for a faster script ! //inSampleDays = 50; ! int numDaysBetweenEachOptimization = 7; ! double oversoldThreshold = 0.006; ! double overboughtThreshold = 0.006; ! this.endOfDayStrategy = ! new PVO_OTCStrategy(eligiblesSelector ,inSampleChooser , ! inSampleDays , benchmark , numDaysBetweenEachOptimization , ! oversoldThreshold , overboughtThreshold , historicalQuoteProvider); ! } ! protected override void setEndOfDayStrategyBackTester() ! { ! string backTestId = "PVO_OTC"; ! IAccountProvider accountProvider = new SimpleAccountProvider(); double cashToStart = 30000; ! ! DateTime firstDateTime = new DateTime( 2001 , 1 , 1 ); ! DateTime lastDateTime = new DateTime( 2001 , 3, 31 ); ! double maxRunningHours = 3; ! this.endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! backTestId , this.endOfDayStrategy , ! historicalQuoteProvider , accountProvider , ! firstDateTime , lastDateTime , ! this.benchmark , cashToStart , maxRunningHours ); ! } ! protected override string getPathForTheMainFolderWhereScriptsResultsAreToBeSaved() ! { ! string pathForTheMainFolderWhereScriptsResultsAreToBeSaved = ! System.Configuration.ConfigurationSettings.AppSettings["LogArchive"]; ! return pathForTheMainFolderWhereScriptsResultsAreToBeSaved; } ! protected override string getCustomSmallTextForFolderName() ! { ! return "PVO_OTC"; ! } ! ! protected override string getFullPathFileNameForMain() ! { ! string returnValue; ! string fullPathFileNameForMainAtHome = ! @"C:\Quant\QuantProject\b7_Scripts\TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVO_OTCMain.cs"; ! if( File.Exists(fullPathFileNameForMainAtHome) ) ! returnValue = fullPathFileNameForMainAtHome; ! else ! returnValue = ! @"C:\Utente\MarcoVarie\Vari\qP\QuantProject\b7_Scripts\TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVO_OTCMain.cs"; ! ! return returnValue; ! } } } |
|
From: Marco M. <mi...@us...> - 2008-04-08 22:03:05
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14571/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator Modified Files: PVO_OTCStrategy.cs Log Message: NumDaysBetweenEachOptimization now stands for calendar days (optimization is launched the same days as the PairTrading strategy) Index: PVO_OTCStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVO_OTCStrategy.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PVO_OTCStrategy.cs 1 Apr 2008 21:34:52 -0000 1.2 --- PVO_OTCStrategy.cs 8 Apr 2008 22:03:00 -0000 1.3 *************** *** 78,81 **** --- 78,82 ---- protected PVOPositions pvoPositionsForOutOfSample; protected DateTime lastCloseDate; + protected DateTime lastOptimizationDateTime; protected Account account; public Account Account *************** *** 294,298 **** { PVO_OTCLogItem logItem = ! new PVO_OTCLogItem( this.now() ); logItem.BestPVOPositionsInSample = this.chosenPVOPositions; --- 295,299 ---- { PVO_OTCLogItem logItem = ! new PVO_OTCLogItem( this.now() , this.inSampleDays ); logItem.BestPVOPositionsInSample = this.chosenPVOPositions; *************** *** 371,374 **** --- 372,391 ---- } + private bool optimalTestingPositionsAreToBeUpdated() + { + bool areToBeUpdated = false; + if(this.inSampleChooser != null) + { + DateTime dateTimeForNextOptimization = + this.lastOptimizationDateTime.AddDays( + this.numDaysBetweenEachOptimization ); + areToBeUpdated = + ( ( ( this.account.Portfolio.Count == 0 ) + && ( ( this.lastOptimizationDateTime == DateTime.MinValue ) ) ) || + ( this.now().DateTime >= dateTimeForNextOptimization ) ); + } + return areToBeUpdated; + } + /// <summary> /// Handles a "One hour after market close" event. *************** *** 381,393 **** this.lastCloseDate = endOfDayTimingEventArgs.EndOfDayDateTime.DateTime; this.numDaysElapsedSinceLastOptimization++; ! if((this.numDaysElapsedSinceLastOptimization == ! this.numDaysBetweenEachOptimization)) ! //num days without optimization has elapsed { this.updateTestingPositions(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime); //sets tickers to be chosen next Market Close event this.numDaysElapsedSinceLastOptimization = 0; } - } #endregion --- 398,415 ---- this.lastCloseDate = endOfDayTimingEventArgs.EndOfDayDateTime.DateTime; this.numDaysElapsedSinceLastOptimization++; ! //OLD - numDaysBetweenEachOptimization --> market days ! // if( this.account.Transactions.Count <= 1 || ! // (this.numDaysElapsedSinceLastOptimization == ! // this.numDaysBetweenEachOptimization) ) ! //num days without optimization has elapsed or ! //no transaction, except for adding cash, has been executed ! //NEW - numDaysBetweenEachOptimization --> calendar days ! if ( this.optimalTestingPositionsAreToBeUpdated() ) { this.updateTestingPositions(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime); //sets tickers to be chosen next Market Close event this.numDaysElapsedSinceLastOptimization = 0; + this.lastOptimizationDateTime = this.now().DateTime; } } #endregion |
|
From: Marco M. <mi...@us...> - 2008-04-08 22:00:09
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12713/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator Modified Files: PVOMain.cs Log Message: no message Index: PVOMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVOMain.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PVOMain.cs 1 Apr 2008 21:34:52 -0000 1.3 --- PVOMain.cs 8 Apr 2008 22:00:01 -0000 1.4 *************** *** 188,195 **** // maxLevelForOverboughtThreshold , divisorForThresholdComputation , // symmetricalThresholds , overboughtMoreThanOversoldForFixedPortfolio ); ! IInSampleChooser inSampleChooser = new PVO_CTCCorrelationChooser(numberOfBestTestingPositionsToBeReturnedInSample, ! numDaysForOscillatingPeriodForChooser); //parameters for eligiblesSelector bool temporizedGroup = true; --- 188,197 ---- // maxLevelForOverboughtThreshold , divisorForThresholdComputation , // symmetricalThresholds , overboughtMoreThanOversoldForFixedPortfolio ); ! double maxCorrelationValue = 0.96; ! bool balancedWeights = false; IInSampleChooser inSampleChooser = new PVO_CTCCorrelationChooser(numberOfBestTestingPositionsToBeReturnedInSample, ! numDaysForOscillatingPeriodForChooser, ! maxCorrelationValue, balancedWeights); //parameters for eligiblesSelector bool temporizedGroup = true; |
|
From: Marco M. <mi...@us...> - 2008-04-08 21:59:15
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12636/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator Modified Files: PVOStrategy.cs Log Message: Added inSampleDays parameter to the PVOLogItem class Index: PVOStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVOStrategy.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PVOStrategy.cs 1 Apr 2008 21:34:52 -0000 1.3 --- PVOStrategy.cs 8 Apr 2008 21:59:09 -0000 1.4 *************** *** 394,398 **** { PVOLogItem logItem = ! new PVOLogItem( this.now() ); logItem.BestPVOPositionsInSample = this.chosenPVOPositions; --- 394,398 ---- { PVOLogItem logItem = ! new PVOLogItem( this.now() , this.inSampleDays ); logItem.BestPVOPositionsInSample = this.chosenPVOPositions; |
|
From: Marco M. <mi...@us...> - 2008-04-08 21:58:28
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12233/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator Modified Files: PVO_OTCLogItem.cs Log Message: The runStrategyClickEventHandler (inherited from PVOLogItem) has been overriden. Index: PVO_OTCLogItem.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVO_OTCLogItem.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PVO_OTCLogItem.cs 12 Mar 2008 22:04:44 -0000 1.1 --- PVO_OTCLogItem.cs 8 Apr 2008 21:58:24 -0000 1.2 *************** *** 47,57 **** { ! public PVO_OTCLogItem(EndOfDayDateTime endOfDayDateTime ) ! : base( endOfDayDateTime ) { } ! public override void Run() { //general --- 47,58 ---- { ! public PVO_OTCLogItem(EndOfDayDateTime endOfDayDateTime, ! int numberOfInSampleDays) ! : base( endOfDayDateTime , numberOfInSampleDays ) { } ! protected override void runStrategyClickEventHandler(object sender, System.EventArgs e) { //general |
|
From: Marco M. <mi...@us...> - 2008-04-08 21:55:37
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10421/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator Modified Files: PVOLogItem.cs Log Message: Now the Run method creates a contextMenu with multiple choices for the given PVOLogItem Index: PVOLogItem.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVOLogItem.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PVOLogItem.cs 12 Mar 2008 22:05:33 -0000 1.2 --- PVOLogItem.cs 8 Apr 2008 21:55:33 -0000 1.3 *************** *** 22,25 **** --- 22,26 ---- using System; + using System.Windows.Forms; using QuantProject.Business.DataProviders; *************** *** 33,39 **** using QuantProject.Business.Strategies.ReturnsManagement.Time.IntervalsSelectors; using QuantProject.Business.Timing; using QuantProject.Scripts.General.Reporting; ! ! namespace QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator --- 34,40 ---- using QuantProject.Business.Strategies.ReturnsManagement.Time.IntervalsSelectors; using QuantProject.Business.Timing; + using QuantProject.Presentation; using QuantProject.Scripts.General.Reporting; ! using QuantProject.Scripts.General.Logging; namespace QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator *************** *** 46,50 **** public class PVOLogItem : LogItem { ! protected TestingPositions[] bestPVOPositionsInSample; protected int numberOfEligibleTickers; protected double fitnessOfFirstPVOPositionsInSample; --- 47,53 ---- public class PVOLogItem : LogItem { ! protected DummyTesterForTestingPositions[] ! dummyTestersForBestTestingPositionsInSample; ! protected TestingPositions[] bestPVOPositionsInSample; protected int numberOfEligibleTickers; protected double fitnessOfFirstPVOPositionsInSample; *************** *** 56,59 **** --- 59,63 ---- protected string tickersOfFirst; protected string tickersOfLast; + protected int numberOfInSampleDays; public TestingPositions[] BestPVOPositionsInSample *************** *** 136,142 **** } ! public PVOLogItem(EndOfDayDateTime endOfDayDateTime ) : base( endOfDayDateTime ) { this.numberOfEligibleTickers = int.MinValue; this.fitnessOfFirstPVOPositionsInSample = double.MinValue; --- 140,148 ---- } ! public PVOLogItem(EndOfDayDateTime endOfDayDateTime, ! int numberOfInSampleDays) : base( endOfDayDateTime ) { + this.numberOfInSampleDays = numberOfInSampleDays; this.numberOfEligibleTickers = int.MinValue; this.fitnessOfFirstPVOPositionsInSample = double.MinValue; *************** *** 144,152 **** } ! public override void Run() { //general ! int inSampleDays = 120; ! DateTime firstDateTime = this.SimulatedCreationTime.DateTime.AddDays(-inSampleDays); DateTime lastDateTime = this.SimulatedCreationTime.DateTime; double maxRunningHours = 1; --- 150,157 ---- } ! protected virtual void runStrategyClickEventHandler(object sender, System.EventArgs e) { //general ! DateTime firstDateTime = this.SimulatedCreationTime.DateTime.AddDays(-this.numberOfInSampleDays); DateTime lastDateTime = this.SimulatedCreationTime.DateTime; double maxRunningHours = 1; *************** *** 176,185 **** numDaysForOscillatingPeriodForChooser; TestingPositions[] positionsToTest = ! new TestingPositions[1]; ! // int idx = PVOLogItem.rand.Next(bestPVOPositionsInSample.Length); ! positionsToTest[0] = this.bestPVOPositionsInSample[0]; PVOStrategy strategy = new PVOStrategy(eligiblesSelector, ! positionsToTest, inSampleDays, numDaysForOscillatingPeriodForOutOfSample, numberOfPortfolioPositions , benchmark , --- 181,191 ---- numDaysForOscillatingPeriodForChooser; TestingPositions[] positionsToTest = ! //new TestingPositions[1]; ! // int idx = PVOLogItem.rand.Next(bestPVOPositionsInSample.Length); ! //positionsToTest[0] = this.bestPVOPositionsInSample[0]; ! positionsToTest = this.BestPVOPositionsInSample; PVOStrategy strategy = new PVOStrategy(eligiblesSelector, ! positionsToTest, this.numberOfInSampleDays, numDaysForOscillatingPeriodForOutOfSample, numberOfPortfolioPositions , benchmark , *************** *** 194,205 **** new SimpleAccountProvider(), firstDateTime , lastDateTime , benchmark , cashToStart , maxRunningHours ); ! ! // TO DO check if you can do this assign in the EndOfDayStrategyBackTester ! // constructor ! strategy.Account = endOfDayStrategyBackTester.Account; endOfDayStrategyBackTester.Run(); BackTesterReportViewer.ShowReport( lastDateTime , endOfDayStrategyBackTester ); } } } --- 200,258 ---- new SimpleAccountProvider(), firstDateTime , lastDateTime , benchmark , cashToStart , maxRunningHours ); ! endOfDayStrategyBackTester.Run(); BackTesterReportViewer.ShowReport( lastDateTime , endOfDayStrategyBackTester ); } + + private void showTestingPositionsClickEventHandler_setDummyTesters_setTester( + int currentIndex , + TestingPositions testingPositions , + EndOfDayDateTime simulatedCreationTime ) + { + this.dummyTestersForBestTestingPositionsInSample[ currentIndex ] = + new DummyTesterForTestingPositions( + testingPositions , + this.numberOfInSampleDays , + simulatedCreationTime ); + } + + private void showTestingPositionsClickEventHandler_setDummyTesters() + { + this.dummyTestersForBestTestingPositionsInSample = + new DummyTesterForTestingPositions[this.BestPVOPositionsInSample.Length]; + for ( int i = 0 ; i < BestPVOPositionsInSample.Length; i++ ) + this.showTestingPositionsClickEventHandler_setDummyTesters_setTester( + i , + BestPVOPositionsInSample[ i ] , + this.SimulatedCreationTime ); + } + + protected virtual void showTestingPositionsClickEventHandler(object sender, System.EventArgs e) + { + this.showTestingPositionsClickEventHandler_setDummyTesters(); + QuantProject.Presentation.ExecutablesListViewer executablesListViewer = + new ExecutablesListViewer( + this.dummyTestersForBestTestingPositionsInSample ); + executablesListViewer.Show(); + } + + protected virtual void createAndShowContextMenu() + { + MenuItem[] menuItems = new MenuItem[2]; + menuItems[0] = new MenuItem("Run Strategy"); + menuItems[1] = new MenuItem("Show TestingPositions"); + menuItems[0].Click += + new System.EventHandler(this.runStrategyClickEventHandler); + menuItems[1].Click += + new System.EventHandler(this.showTestingPositionsClickEventHandler); + ContextMenu contextMenu = new ContextMenu(menuItems); + contextMenu.Show(Form.ActiveForm, Form.MousePosition); + } + + public override void Run() + { + this.createAndShowContextMenu(); + } } } |
|
From: Marco M. <mi...@us...> - 2008-04-08 21:53:10
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv8692/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers Modified Files: PVO_CTCCorrelationChooser.cs PVO_OTCCorrelationChooser.cs PVOCorrelationChooser.cs Log Message: Minor changes for IInSampleChoosers based on Correlation (for the PVO strategy) Index: PVO_OTCCorrelationChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers/PVO_OTCCorrelationChooser.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PVO_OTCCorrelationChooser.cs 12 Mar 2008 22:04:43 -0000 1.1 --- PVO_OTCCorrelationChooser.cs 8 Apr 2008 21:53:03 -0000 1.2 *************** *** 43,46 **** --- 43,51 ---- public class PVO_OTCCorrelationChooser : PVOCorrelationChooser { + private float minimumAbsoluteReturnValue; + private float maximumAbsoluteReturnValue; + //correlation is computed only for returns + //between minimum and maximum + /// <summary> /// PVO_OTCCorrelationChooser to be used for *************** *** 51,58 **** /// AnalyzeInSample method will return /// </param> ! public PVO_OTCCorrelationChooser(int numberOfBestTestingPositionsToBeReturned) : ! base(numberOfBestTestingPositionsToBeReturned,1) { ! } --- 56,71 ---- /// AnalyzeInSample method will return /// </param> ! public PVO_OTCCorrelationChooser(int numberOfBestTestingPositionsToBeReturned, ! double maxCorrelationValue, ! bool balancedWeightsOnVolatilityBase, ! float minimumAbsoluteReturnValue, ! float maximumAbsoluteReturnValue) : ! base(numberOfBestTestingPositionsToBeReturned, ! 1, ! maxCorrelationValue, ! balancedWeightsOnVolatilityBase) { ! this.minimumAbsoluteReturnValue = minimumAbsoluteReturnValue; ! this.maximumAbsoluteReturnValue = maximumAbsoluteReturnValue; } *************** *** 62,66 **** this.correlationProvider = new OpenToCloseCorrelationProvider(eligibleTickers.Tickers, returnsManager, ! 0.0001f, 0.5f); } } --- 75,80 ---- this.correlationProvider = new OpenToCloseCorrelationProvider(eligibleTickers.Tickers, returnsManager, ! this.minimumAbsoluteReturnValue , ! this.maximumAbsoluteReturnValue); } } Index: PVOCorrelationChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers/PVOCorrelationChooser.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PVOCorrelationChooser.cs 1 Apr 2008 21:34:52 -0000 1.3 --- PVOCorrelationChooser.cs 8 Apr 2008 21:53:06 -0000 1.4 *************** *** 49,52 **** --- 49,55 ---- protected int numberOfBestTestingPositionsToBeReturned; protected int numDaysForOscillatingPeriod; + protected double maxCorrelationValue; + //correlations greater than this value are discarded + protected bool balancedWeightsOnVolatilityBase; public virtual string Description *************** *** 57,61 **** this.correlationProvider.GetType().ToString() + "\n" + "NumOfTickersReturned:\n" + ! this.numberOfBestTestingPositionsToBeReturned.ToString(); return description; } --- 60,67 ---- this.correlationProvider.GetType().ToString() + "\n" + "NumOfTickersReturned:\n" + ! this.numberOfBestTestingPositionsToBeReturned.ToString() + ! "MaxCorrelationValue: " + ! this.maxCorrelationValue.ToString(); ! return description; } *************** *** 70,83 **** /// AnalyzeInSample method will return /// </param> ! /// /// <param name="numDaysForOscillatingPeriod"> /// Interval's length of the return for the PVOPosition /// to be checked out of sample, in order to update the /// status for the PVOPosition itself /// </param> public PVOCorrelationChooser(int numberOfBestTestingPositionsToBeReturned, ! int numDaysForOscillatingPeriod) { this.numberOfBestTestingPositionsToBeReturned = numberOfBestTestingPositionsToBeReturned; this.numDaysForOscillatingPeriod = numDaysForOscillatingPeriod; } --- 76,97 ---- /// AnalyzeInSample method will return /// </param> ! /// <param name="numDaysForOscillatingPeriod"> /// Interval's length of the return for the PVOPosition /// to be checked out of sample, in order to update the /// status for the PVOPosition itself /// </param> + /// <param name="maxCorrelationValue"> + /// Correlations higher than given maxCorrelationValue are discarded + /// (for avoiding analyzing tickers corresponding to the same stock) + /// </param> public PVOCorrelationChooser(int numberOfBestTestingPositionsToBeReturned, ! int numDaysForOscillatingPeriod, ! double maxCorrelationValue, ! bool balancedWeightsOnVolatilityBase) { this.numberOfBestTestingPositionsToBeReturned = numberOfBestTestingPositionsToBeReturned; this.numDaysForOscillatingPeriod = numDaysForOscillatingPeriod; + this.maxCorrelationValue = maxCorrelationValue; + this.balancedWeightsOnVolatilityBase = balancedWeightsOnVolatilityBase; } *************** *** 91,94 **** --- 105,110 ---- "only " + eligibleTickers.Count + " elements, while NumberOfDrivingPositions is 2"); + if (this.maxCorrelationValue < 0.50 || this.maxCorrelationValue > 1.0 ) + throw new OutOfRangeException( "maxCorrelationValue", 0.5, 1.0); } *************** *** 96,101 **** ReturnsManager returnsManager); ! protected PVOPositions getTestingPositions(WeightedPositions weightedPositions) { return new PVOPositions(weightedPositions, 0.0, 0.0, this.numDaysForOscillatingPeriod ); --- 112,126 ---- ReturnsManager returnsManager); ! protected PVOPositions getTestingPositions(SignedTickers signedTickers, ! ReturnsManager returnsManager) { + WeightedPositions weightedPositions; + if(this.balancedWeightsOnVolatilityBase == true) + weightedPositions = + new WeightedPositions(WeightedPositions.GetBalancedWeights(signedTickers, returnsManager), + signedTickers.Tickers); + else//just equal weights + weightedPositions = new WeightedPositions(signedTickers); + return new PVOPositions(weightedPositions, 0.0, 0.0, this.numDaysForOscillatingPeriod ); *************** *** 111,123 **** TickersPearsonCorrelation[] correlations = this.correlationProvider.GetOrderedTickersPearsonCorrelations(); ! for(int i = 0; i<this.numberOfBestTestingPositionsToBeReturned; i++) { ! SignedTickers signedTickers = ! new SignedTickers("-"+correlations[correlations.Length - 1 -i].FirstTicker + ";" + ! correlations[correlations.Length - 1 -i].SecondTicker); ! WeightedPositions weightedPositions = new WeightedPositions(signedTickers); ! bestTestingPositions[i] = this.getTestingPositions(weightedPositions); ! ((PVOPositions)bestTestingPositions[i]).FitnessInSample = ! correlations[correlations.Length - 1 -i].CorrelationValue; } return bestTestingPositions; --- 136,155 ---- TickersPearsonCorrelation[] correlations = this.correlationProvider.GetOrderedTickersPearsonCorrelations(); ! int addedTestingPositions = 0; ! int counter = 0; ! while(addedTestingPositions < this.numberOfBestTestingPositionsToBeReturned && ! counter < correlations.Length) { ! if(correlations[correlations.Length - 1 - counter].CorrelationValue < this.maxCorrelationValue) ! { ! SignedTickers signedTickers = ! new SignedTickers("-"+correlations[correlations.Length - 1 - counter].FirstTicker + ";" + ! correlations[correlations.Length - 1 - counter].SecondTicker); ! bestTestingPositions[addedTestingPositions] = this.getTestingPositions(signedTickers, returnsManager); ! ((PVOPositions)bestTestingPositions[addedTestingPositions]).FitnessInSample = ! correlations[correlations.Length - 1 - counter].CorrelationValue; ! addedTestingPositions++; ! } ! counter++; } return bestTestingPositions; Index: PVO_CTCCorrelationChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers/PVO_CTCCorrelationChooser.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PVO_CTCCorrelationChooser.cs 12 Mar 2008 22:04:42 -0000 1.1 --- PVO_CTCCorrelationChooser.cs 8 Apr 2008 21:53:03 -0000 1.2 *************** *** 52,58 **** /// </param> public PVO_CTCCorrelationChooser(int numberOfBestTestingPositionsToBeReturned, ! int closeToCloseReturnIntervalLength) : base(numberOfBestTestingPositionsToBeReturned, ! closeToCloseReturnIntervalLength) { --- 52,62 ---- /// </param> public PVO_CTCCorrelationChooser(int numberOfBestTestingPositionsToBeReturned, ! int closeToCloseReturnIntervalLength, ! double maxCorrelationValue, ! bool balancedWeightsOnVolatilityBase) : base(numberOfBestTestingPositionsToBeReturned, ! closeToCloseReturnIntervalLength, ! maxCorrelationValue, ! balancedWeightsOnVolatilityBase) { |
|
From: Marco M. <mi...@us...> - 2008-04-08 21:49:18
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7215/b1_ADT Modified Files: OutOfRangeException.cs Log Message: Modified the way OutOfRangeException is constructed Index: OutOfRangeException.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/OutOfRangeException.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OutOfRangeException.cs 12 Mar 2008 21:51:35 -0000 1.1 --- OutOfRangeException.cs 8 Apr 2008 21:49:15 -0000 1.2 *************** *** 30,34 **** public class OutOfRangeException : Exception { ! private double outOfRangeNumber; private double minimumForValidRange; private double maximumForValidRange; --- 30,34 ---- public class OutOfRangeException : Exception { ! private string outOfRangeNumber; private double minimumForValidRange; private double maximumForValidRange; *************** *** 38,48 **** get { ! return this.outOfRangeNumber.ToString() + ! "is out of range! It should be between " + this.minimumForValidRange.ToString() + " and " + this.maximumForValidRange.ToString(); } } ! public OutOfRangeException( double outOfRangeNumber, double minimumForValidRange, double maximumForValidRange) --- 38,48 ---- get { ! return this.outOfRangeNumber + ! " is out of range! It should be between " + this.minimumForValidRange.ToString() + " and " + this.maximumForValidRange.ToString(); } } ! public OutOfRangeException( string outOfRangeNumber, double minimumForValidRange, double maximumForValidRange) |
|
From: Marco M. <mi...@us...> - 2008-04-08 21:49:18
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/AccountProviding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7215/b4_Business/a1_Financial/a2_Accounting/AccountProviding Modified Files: InteractiveBrokerAccountProvider.cs Log Message: Modified the way OutOfRangeException is constructed Index: InteractiveBrokerAccountProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/AccountProviding/InteractiveBrokerAccountProvider.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InteractiveBrokerAccountProvider.cs 12 Mar 2008 21:54:42 -0000 1.1 --- InteractiveBrokerAccountProvider.cs 8 Apr 2008 21:49:14 -0000 1.2 *************** *** 53,57 **** if( slippageFixedPercentage < 0.0 || slippageFixedPercentage > 100.0 ) ! throw new OutOfRangeException(slippageFixedPercentage, 0.0, 100.0); this.slippageFixedPercentage = slippageFixedPercentage; --- 53,57 ---- if( slippageFixedPercentage < 0.0 || slippageFixedPercentage > 100.0 ) ! throw new OutOfRangeException("slippageFixedPercentage", 0.0, 100.0); this.slippageFixedPercentage = slippageFixedPercentage; |
|
From: Marco M. <mi...@us...> - 2008-04-08 21:47:32
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/TickersRelationships In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6365/b4_Business/a2_Strategies/TickersRelationships Modified Files: CorrelationProvider.cs Log Message: Added showOutputToConsole for debugging. Other minor changes Index: CorrelationProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/TickersRelationships/CorrelationProvider.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CorrelationProvider.cs 12 Mar 2008 21:56:08 -0000 1.3 --- CorrelationProvider.cs 8 Apr 2008 21:47:28 -0000 1.4 *************** *** 51,56 **** protected int returnIntervalLength; protected string benchmark; ! ! private void correlationProvider_commonInitialization(string[] tickersToAnalyze, float minimumAbsoluteReturnValue, float maximumAbsoluteReturnValue) --- 51,55 ---- protected int returnIntervalLength; protected string benchmark; ! private void correlationProvider_commonInitialization(string[] tickersToAnalyze, float minimumAbsoluteReturnValue, float maximumAbsoluteReturnValue) *************** *** 59,64 **** this.minimumAbsoluteReturnValue = minimumAbsoluteReturnValue; this.maximumAbsoluteReturnValue = maximumAbsoluteReturnValue; ! this.numOfCombinationTwoByTwo = ! (int)((Math.Pow(this.tickers.Length, 2) - this.tickers.Length ) / 2); } --- 58,66 ---- this.minimumAbsoluteReturnValue = minimumAbsoluteReturnValue; this.maximumAbsoluteReturnValue = maximumAbsoluteReturnValue; ! int n = this.tickers.Length; ! //combinations without repetitions: ! //n_fatt /( k_fatt * (n-k)_fatt ): when k = 2, ! // it can be reduced to this simple formula: ! this.numOfCombinationTwoByTwo = n * (n - 1) / 2; } *************** *** 164,170 **** if ( Double.IsNaN(returnValue) || Double.IsInfinity(returnValue) ) ! throw new Exception( "correlation can't be computed for these two tickers: "+ ! this.tickers[indexOfFirstTicker] + " and " + ! this.tickers[indexOfSecondTicker] + "!"); return returnValue; --- 166,171 ---- if ( Double.IsNaN(returnValue) || Double.IsInfinity(returnValue) ) ! throw new MissingCorrelationException(this.tickers[indexOfFirstTicker], ! this.tickers[indexOfSecondTicker]); return returnValue; *************** *** 181,191 **** for (int j = i + 1; j < this.tickers.Length; j++) { ! this.pearsonCorrelations[index] = ! new TickersPearsonCorrelation( this.tickers[i], this.tickers[j], ! this.getOrderedTickersPearsonCorrelations_setCorrelations_getValue( i , j) ); index++; } Array.Sort(this.pearsonCorrelations); } public TickersPearsonCorrelation[] GetOrderedTickersPearsonCorrelations() --- 182,208 ---- for (int j = i + 1; j < this.tickers.Length; j++) { ! try{ ! this.pearsonCorrelations[index] = ! new TickersPearsonCorrelation( this.tickers[i], this.tickers[j], ! this.getOrderedTickersPearsonCorrelations_setCorrelations_getValue( i , j) ); ! } ! catch(MissingCorrelationException ex) ! {ex=ex;} index++; } Array.Sort(this.pearsonCorrelations); } + + private void showOutputToConsole() + { + System.Console.WriteLine("\n\rEligibles"); + for(int i = 0; i < this.tickers.Length; i++) + System.Console.WriteLine(this.tickers[i]); + System.Console.WriteLine("\n\rCorrelations"); + for(int i = 0; i < this.pearsonCorrelations.Length; i++) + System.Console.WriteLine(this.pearsonCorrelations[i].FirstTicker + " " + + this.pearsonCorrelations[i].SecondTicker + " " + + this.pearsonCorrelations[i].CorrelationValue.ToString() ); + } public TickersPearsonCorrelation[] GetOrderedTickersPearsonCorrelations() *************** *** 193,197 **** if( this.pearsonCorrelations == null ) this.getOrderedTickersPearsonCorrelations_setCorrelations(); ! return this.pearsonCorrelations; } --- 210,214 ---- if( this.pearsonCorrelations == null ) this.getOrderedTickersPearsonCorrelations_setCorrelations(); ! this.showOutputToConsole(); return this.pearsonCorrelations; } |
|
From: Marco M. <mi...@us...> - 2008-04-08 21:46:05
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5510/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/Decoding Modified Files: BasicDecoderForPVOPositions.cs Log Message: Modified getWeights method Index: BasicDecoderForPVOPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/Decoding/BasicDecoderForPVOPositions.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BasicDecoderForPVOPositions.cs 9 Mar 2008 22:49:23 -0000 1.1 --- BasicDecoderForPVOPositions.cs 8 Apr 2008 21:46:01 -0000 1.2 *************** *** 80,84 **** this.decodeDecodable_setThresholds(); PVOPositions pvoPositions = new PVOPositions( ! new WeightedPositions( this.getWeights(), signedTickers), this.oversoldThreshold, this.overboughtThreshold, this.numDaysForOscillatingPeriod); --- 80,84 ---- this.decodeDecodable_setThresholds(); PVOPositions pvoPositions = new PVOPositions( ! new WeightedPositions( this.getWeights(signedTickers), signedTickers), this.oversoldThreshold, this.overboughtThreshold, this.numDaysForOscillatingPeriod); |
|
From: Marco M. <mi...@us...> - 2008-04-08 21:46:05
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5510/b4_Business/a2_Strategies/Optimizing/Decoding Modified Files: BasicDecoderForTestingPositions.cs DecoderForTestingPositionsWithBalancedWeights.cs Log Message: Modified getWeights method Index: DecoderForTestingPositionsWithBalancedWeights.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding/DecoderForTestingPositionsWithBalancedWeights.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DecoderForTestingPositionsWithBalancedWeights.cs 27 Feb 2008 21:46:15 -0000 1.3 --- DecoderForTestingPositionsWithBalancedWeights.cs 8 Apr 2008 21:46:01 -0000 1.4 *************** *** 51,58 **** // } ! protected override double[] getWeights() { return WeightedPositions.GetBalancedWeights( ! this.decodeSignedTickers(), this.returnsManager ); } --- 51,58 ---- // } ! protected override double[] getWeights(SignedTickers signedTickers) { return WeightedPositions.GetBalancedWeights( ! signedTickers, this.returnsManager ); } Index: BasicDecoderForTestingPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding/BasicDecoderForTestingPositions.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BasicDecoderForTestingPositions.cs 6 Mar 2008 20:11:38 -0000 1.5 --- BasicDecoderForTestingPositions.cs 8 Apr 2008 21:46:01 -0000 1.6 *************** *** 134,144 **** #region decodeDecodable ! protected virtual double[] getWeights() { //in this implementation encoded doesn't contain //information for weights: so weights are all the same double[] weights = new double[this.tickerRelatedGeneValues.Length]; for(int i = 0; i<weights.Length; i++) ! weights[i] = 1.0 / weights.Length; return weights; } --- 134,151 ---- #region decodeDecodable ! protected virtual double[] getWeights(SignedTickers signedTickers) { //in this implementation encoded doesn't contain //information for weights: so weights are all the same double[] weights = new double[this.tickerRelatedGeneValues.Length]; + double coefficient; for(int i = 0; i<weights.Length; i++) ! { ! if(signedTickers[i].IsLong) ! coefficient = 1.0; ! else//is Short ! coefficient = -1.0; ! weights[i] = coefficient / weights.Length; ! } return weights; } *************** *** 156,160 **** { SignedTickers signedTickers = this.decodeSignedTickers(); ! double[] weights = this.getWeights(); TestingPositions testingPositions = this.getTestingPositions( --- 163,167 ---- { SignedTickers signedTickers = this.decodeSignedTickers(); ! double[] weights = this.getWeights(signedTickers); TestingPositions testingPositions = this.getTestingPositions( |
|
From: Marco M. <mi...@us...> - 2008-04-08 21:38:45
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2167/b2_DataAccess/Tables Modified Files: Quotes.cs Log Message: Fixed bug in sql statement Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Quotes.cs 8 Apr 2007 18:59:45 -0000 1.32 --- Quotes.cs 8 Apr 2008 21:38:41 -0000 1.33 *************** *** 475,479 **** { string sql = "SELECT TOP " + maxNumOfReturnedTickers + " tickers.tiTicker, tickers.tiCompanyName, " + ! "Avg([quVolume]) AS AverageTradedValue " + "FROM quotes INNER JOIN (tickers INNER JOIN tickers_tickerGroups " + "ON tickers.tiTicker = tickers_tickerGroups.ttTiId) " + --- 475,479 ---- { string sql = "SELECT TOP " + maxNumOfReturnedTickers + " tickers.tiTicker, tickers.tiCompanyName, " + ! "Avg([quVolume]*[quClose]) AS AverageTradedValue " + "FROM quotes INNER JOIN (tickers INNER JOIN tickers_tickerGroups " + "ON tickers.tiTicker = tickers_tickerGroups.ttTiId) " + |
|
From: Marco M. <mi...@us...> - 2008-04-08 21:37:57
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1720/b4_Business/a2_Strategies/Eligibles Modified Files: ByPriceMostLiquidAlwaysQuoted.cs Log Message: Parameter double.MinValue in SelectorByAverageRawOpenPrice has been replaced by a very little number (just greater than zero), in order to avoid tickers with a standard deviation equal to zero (they should be descarded) Index: ByPriceMostLiquidAlwaysQuoted.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles/ByPriceMostLiquidAlwaysQuoted.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ByPriceMostLiquidAlwaysQuoted.cs 7 Apr 2008 20:42:13 -0000 1.4 --- ByPriceMostLiquidAlwaysQuoted.cs 8 Apr 2008 21:37:51 -0000 1.5 *************** *** 99,108 **** int numOfTickersInGroupAtCurrentDate = tickersFromGroup.Rows.Count; SelectorByAverageRawOpenPrice byPrice = ! new SelectorByAverageRawOpenPrice(tickersFromGroup,false, ! currentDate.AddDays(-this.numOfDaysForAverageOpenRawPriceComputation), ! currentDate, ! numOfTickersInGroupAtCurrentDate, ! this.minPrice,this.maxPrice, double.MinValue,double.MaxValue); ! DataTable dataTableByPrice = byPrice.GetTableOfSelectedTickers(); --- 99,108 ---- int numOfTickersInGroupAtCurrentDate = tickersFromGroup.Rows.Count; SelectorByAverageRawOpenPrice byPrice = ! new SelectorByAverageRawOpenPrice(tickersFromGroup,false, ! currentDate.AddDays(-this.numOfDaysForAverageOpenRawPriceComputation), ! currentDate, ! numOfTickersInGroupAtCurrentDate, ! this.minPrice,this.maxPrice, 0.00001, double.MaxValue); ! DataTable dataTableByPrice = byPrice.GetTableOfSelectedTickers(); |
|
From: Marco M. <mi...@us...> - 2008-04-08 21:34:36
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/General/Logging In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv394/General/Logging Added Files: DummyTesterForTestingPositions.cs Log Message: Added DummyTesterForTestingPositions --- NEW FILE: DummyTesterForTestingPositions.cs --- /* QuantProject - Quantitative Finance Library DummyTesterForTestingPositions.cs Copyright (C) 2008 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.Windows.Forms; using QuantProject.Business.Scripting; using QuantProject.Business.Strategies; using QuantProject.Business.Strategies.OutOfSample; using QuantProject.Business.Strategies.ReturnsManagement.Time.IntervalsSelectors; using QuantProject.Business.Timing; namespace QuantProject.Scripts.General.Logging { [Serializable] /// <summary> /// It doesn't test a TestingPositions object: /// its only function is to show the TestingPositions /// through a ExecutablesListViewer /// </summary> public class DummyTesterForTestingPositions : IExecutable { private TestingPositions testingPositions; private int numberOfInSampleDays; private EndOfDayDateTime endOfDayDateTimeWhenThisObjectWasLogged; /// <summary> /// Generation when the TestingPositions object has been created /// (if genetically optimized) /// </summary> public int Generation { get { int generation = -1; if( this.testingPositions is IGeneticallyOptimizable ) generation = ((IGeneticallyOptimizable)this.testingPositions).Generation; return generation; } } public double FitnessInSample { get { return this.testingPositions.FitnessInSample; } } public string ShortDescription { get { return this.testingPositions.WeightedPositions.Description; } } public DummyTesterForTestingPositions( TestingPositions testingPositions , int numberOfInSampleDays , EndOfDayDateTime endOfDayDateTimeWhenThisObjectWasLogged ) { this.testingPositions = testingPositions; this.numberOfInSampleDays = numberOfInSampleDays; this.endOfDayDateTimeWhenThisObjectWasLogged = endOfDayDateTimeWhenThisObjectWasLogged; } public void Run() { MessageBox.Show("No run has been implemented for " + "this kind of object"); } } } |