quantproject-developers Mailing List for QuantProject (Page 46)
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
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/StatisticsSummaryRows In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16382/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/StatisticsSummaryRows Added Files: AverageReturnOnDayOfWeekWithOpenPositions.cs AverageReturnOnDayWithOpenPositions.cs AverageReturnOnFridayWithOpenPositions.cs AverageReturnOnMondayWithOpenPositions.cs AverageReturnOnThursdayWithOpenPositions.cs AverageReturnOnTuesdayWithOpenPositions.cs AverageReturnOnWednesdayWithOpenPositions.cs Removed Files: AverageReturnOnMonday.cs Log Message: AverageReturnOnMonday has been replaced by AverageReturnOnMondayWithOpenPositions Added the classes for average return computation on days with open positions (with distinction by day of week) --- NEW FILE: AverageReturnOnThursdayWithOpenPositions.cs --- /* QuantProject - Quantitative Finance Library AverageReturnOnThursdayWithOpenPositions.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 QuantProject.Business.Financial.Accounting.Reporting.Tables; namespace QuantProject.Business.Financial.Accounting.Reporting.StatisticsSummaryRows { /// <summary> /// Summary row containing the average return of the strategy on Thursday /// </summary> [Serializable] public class AverageReturnOnThursdayWithOpenPositions : AverageReturnOnDayOfWeekWithOpenPositions { public AverageReturnOnThursdayWithOpenPositions( StatisticsSummary statisticsSummary ) : base( statisticsSummary ) { } protected override string getRowDescription() { return "Average % return on Thursday (with opened positions)"; } protected override DayOfWeek getSpecificDayOfWeek() { return DayOfWeek.Thursday; } } } --- AverageReturnOnMonday.cs DELETED --- --- NEW FILE: AverageReturnOnDayWithOpenPositions.cs --- /* QuantProject - Quantitative Finance Library AverageReturnOnDayWithOpenPositions.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.Collections; using System.Data; using QuantProject.ADT.Histories; using QuantProject.ADT.Statistics; using QuantProject.Data.DataTables; using QuantProject.Business.Financial.Accounting.Reporting.Tables; using QuantProject.Business.Financial.Accounting.Reporting.SummaryRows; namespace QuantProject.Business.Financial.Accounting.Reporting.StatisticsSummaryRows { /// <summary> /// Summary row containing the average return of the strategy on each day /// with open positions /// </summary> [Serializable] public class AverageReturnOnDayWithOpenPositions : PercentageSummaryRow { private StatisticsSummary statisticsSummary; private object getRowValue( int totalNumberOfDaysWithOpenPositions , double sumOfReturnsOnDaysWithOpenPositions) { double averagePercentageReturn; averagePercentageReturn = 100.0 * sumOfReturnsOnDaysWithOpenPositions / (double)totalNumberOfDaysWithOpenPositions; string numOfDays = totalNumberOfDaysWithOpenPositions.ToString(); return averagePercentageReturn.ToString().Substring(0,4) + "#" + numOfDays.Substring(0,Math.Min(numOfDays.Length,4)); } private double getReturnForDate(DateTime date, DateTime previousDate) { double accountValueOnCloseForDate = (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(date); double accountValueOnCloseForPreviousDate = (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(previousDate); return (accountValueOnCloseForDate / accountValueOnCloseForPreviousDate) - 1.0; } private bool hasPositionsOnDate( DateTime date, DateTime previousDate ) { double accountValueOnCloseForDate = (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(date); double accountValueOnCloseForPreviousDate = (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(previousDate); return accountValueOnCloseForDate != accountValueOnCloseForPreviousDate; } public AverageReturnOnDayWithOpenPositions( StatisticsSummary statisticsSummary ) : base( ) { this.statisticsSummary = statisticsSummary; this.rowDescription = "Average % return on days with open positions "; History marketDays = Quotes.GetMarketDays( statisticsSummary.AccountReport.Benchmark, statisticsSummary.AccountReport.StartDateTime, statisticsSummary.AccountReport.EndDateTime.DateTime); DateTime date; DateTime previousDate; int totalNumberOfDaysWithOpenPositions = 0; double sumOfReturnsOnDaysWithOpenPositions = 0.0; for(int i = 1; i < marketDays.Count - 1; i++) { date = marketDays.GetDateTime( i ); previousDate = marketDays.GetDateTime( i - 1 ); if( this.hasPositionsOnDate( date, previousDate ) ) { totalNumberOfDaysWithOpenPositions++; sumOfReturnsOnDaysWithOpenPositions += this.getReturnForDate(date, previousDate); } } this.rowValue = this.getRowValue( totalNumberOfDaysWithOpenPositions , sumOfReturnsOnDaysWithOpenPositions); } } } --- NEW FILE: AverageReturnOnDayOfWeekWithOpenPositions.cs --- /* QuantProject - Quantitative Finance Library AverageReturnOnDayOfWeekWithOpenPositions.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.Collections; using QuantProject.ADT.Histories; using QuantProject.ADT.Statistics; using QuantProject.Data.DataTables; using QuantProject.Business.Financial.Accounting.Reporting.Tables; using QuantProject.Business.Financial.Accounting.Reporting.SummaryRows; namespace QuantProject.Business.Financial.Accounting.Reporting.StatisticsSummaryRows { /// <summary> /// Summary row containing the average return of the strategy on a specific day of the week /// </summary> [Serializable] public abstract class AverageReturnOnDayOfWeekWithOpenPositions : PercentageSummaryRow { private StatisticsSummary statisticsSummary; private double getReturnForDate(DateTime date, DateTime previousDate) { double accountValueOnCloseForDate = (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(date); double accountValueOnCloseForPreviousDate = (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(previousDate); return (accountValueOnCloseForDate / accountValueOnCloseForPreviousDate) - 1.0; } private bool hasPositionsOnDate( DateTime date, DateTime previousDate ) { double accountValueOnCloseForDate = (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(date); double accountValueOnCloseForPreviousDate = (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(previousDate); return accountValueOnCloseForDate != accountValueOnCloseForPreviousDate; } protected abstract string getRowDescription(); protected abstract DayOfWeek getSpecificDayOfWeek(); private object getRowValue( int totalNumberOfSpecificDayOfWeek , double sumOfReturnsOnSpecificDayOfWeek) { double averagePercentageReturn; averagePercentageReturn = 100.0 * sumOfReturnsOnSpecificDayOfWeek / (double)totalNumberOfSpecificDayOfWeek; string numOfDays = totalNumberOfSpecificDayOfWeek.ToString(); return averagePercentageReturn.ToString().Substring(0,4) + "#" + numOfDays.Substring(0,Math.Min(numOfDays.Length,4)); } public AverageReturnOnDayOfWeekWithOpenPositions( StatisticsSummary statisticsSummary ) : base( ) { this.statisticsSummary = statisticsSummary; this.rowDescription = this.getRowDescription(); DayOfWeek specificDayOfWeek = this.getSpecificDayOfWeek(); History marketDays = Quotes.GetMarketDays( statisticsSummary.AccountReport.Benchmark, statisticsSummary.AccountReport.StartDateTime, statisticsSummary.AccountReport.EndDateTime.DateTime); DateTime date; DateTime previousDate; int totalNumberOfSpecificDayOfWeek = 0; double sumOfReturnsOnSpecificDayOfWeek = 0.0; for(int i = 1; i < marketDays.Count - 1; i++) { date = marketDays.GetDateTime( i ); previousDate = marketDays.GetDateTime( i - 1 ); if( date.DayOfWeek == specificDayOfWeek && this.hasPositionsOnDate( date, previousDate ) ) { totalNumberOfSpecificDayOfWeek++; sumOfReturnsOnSpecificDayOfWeek += this.getReturnForDate( date, previousDate ); } } this.rowValue = this.getRowValue(totalNumberOfSpecificDayOfWeek, sumOfReturnsOnSpecificDayOfWeek); } } } --- NEW FILE: AverageReturnOnFridayWithOpenPositions.cs --- /* QuantProject - Quantitative Finance Library AverageReturnOnFridayWithOpenPositions.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 QuantProject.Business.Financial.Accounting.Reporting.Tables; namespace QuantProject.Business.Financial.Accounting.Reporting.StatisticsSummaryRows { /// <summary> /// Summary row containing the average return of the strategy on Friday /// </summary> [Serializable] public class AverageReturnOnFridayWithOpenPositions : AverageReturnOnDayOfWeekWithOpenPositions { public AverageReturnOnFridayWithOpenPositions( StatisticsSummary statisticsSummary ) : base( statisticsSummary ) { } protected override string getRowDescription() { return "Average % return on Friday (with opened positions) "; } protected override DayOfWeek getSpecificDayOfWeek() { return DayOfWeek.Friday; } } } --- NEW FILE: AverageReturnOnTuesdayWithOpenPositions.cs --- /* QuantProject - Quantitative Finance Library AverageReturnOnTuesdayWithOpenPositions.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 QuantProject.Business.Financial.Accounting.Reporting.Tables; namespace QuantProject.Business.Financial.Accounting.Reporting.StatisticsSummaryRows { /// <summary> /// Summary row containing the average return of the strategy on Tuesday /// </summary> [Serializable] public class AverageReturnOnTuesdayWithOpenPositions : AverageReturnOnDayOfWeekWithOpenPositions { public AverageReturnOnTuesdayWithOpenPositions( StatisticsSummary statisticsSummary ) : base( statisticsSummary ) { } protected override string getRowDescription() { return "Average % return on Tuesday (with opened positions)"; } protected override DayOfWeek getSpecificDayOfWeek() { return DayOfWeek.Tuesday; } } } --- NEW FILE: AverageReturnOnWednesdayWithOpenPositions.cs --- /* QuantProject - Quantitative Finance Library AverageReturnOnWednesdayWithOpenPositions.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 QuantProject.Business.Financial.Accounting.Reporting.Tables; namespace QuantProject.Business.Financial.Accounting.Reporting.StatisticsSummaryRows { /// <summary> /// Summary row containing the average return of the strategy on Wednesday /// </summary> [Serializable] public class AverageReturnOnWednesdayWithOpenPositions : AverageReturnOnDayOfWeekWithOpenPositions { public AverageReturnOnWednesdayWithOpenPositions( StatisticsSummary statisticsSummary ) : base( statisticsSummary ) { } protected override string getRowDescription() { return "Average % return on Wednesday (with opened positions)"; } protected override DayOfWeek getSpecificDayOfWeek() { return DayOfWeek.Wednesday; } } } --- NEW FILE: AverageReturnOnMondayWithOpenPositions.cs --- /* QuantProject - Quantitative Finance Library AverageReturnOnMondayWithOpenPositions.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 QuantProject.Business.Financial.Accounting.Reporting.Tables; namespace QuantProject.Business.Financial.Accounting.Reporting.StatisticsSummaryRows { /// <summary> /// Summary row containing the average return of the strategy on Monday /// </summary> [Serializable] public class AverageReturnOnMondayWithOpenPositions : AverageReturnOnDayOfWeekWithOpenPositions { public AverageReturnOnMondayWithOpenPositions( StatisticsSummary statisticsSummary ) : base( statisticsSummary ) { } protected override string getRowDescription() { return "Average % return on Monday (with opened positions)"; } protected override DayOfWeek getSpecificDayOfWeek() { return DayOfWeek.Monday; } } } |
|
From: Glauco S. <gla...@us...> - 2008-04-20 17:26:51
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17191/b7_Scripts/WalkForwardTesting/PairsTrading Modified Files: PairsTradingTestingPositions.cs Log Message: A dummy constructor has been added: it creates an empty TestingPositions. To be used to give undecodables a meaning with PairsTradingTestingPositions type Index: PairsTradingTestingPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/PairsTradingTestingPositions.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PairsTradingTestingPositions.cs 7 Mar 2008 23:28:01 -0000 1.2 --- PairsTradingTestingPositions.cs 20 Apr 2008 17:26:45 -0000 1.3 *************** *** 42,45 **** --- 42,53 ---- set { this.generation = value; } } + + // creates an empty TestingPositions: to be used to give a meaning with + // PairsTradingTestingPositions type to undecodables + public PairsTradingTestingPositions() : base() + { + } + + public PairsTradingTestingPositions( WeightedPositions weightedPositions ) : |
|
From: Glauco S. <gla...@us...> - 2008-04-20 17:26:00
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/InSample/InSampleChoosers/BruteForce In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16765/b7_Scripts/WalkForwardTesting/PairsTrading/InSample/InSampleChoosers/BruteForce Modified Files: PairsTradingBruteForceOptimizableParametersManager.cs Log Message: AreEquivalentAsTopBestParameters() has been changed in such a way that two candidates are considered to be equivalent if they have the same tickers and a very similar fitness. This condition will be true for (a,b) and (-a,-b). It will also be true for (a,-b) and (-a,b). Index: PairsTradingBruteForceOptimizableParametersManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/InSample/InSampleChoosers/BruteForce/PairsTradingBruteForceOptimizableParametersManager.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PairsTradingBruteForceOptimizableParametersManager.cs 13 Apr 2008 16:58:09 -0000 1.3 --- PairsTradingBruteForceOptimizableParametersManager.cs 20 Apr 2008 17:25:56 -0000 1.4 *************** *** 91,95 **** double percDifference = Math.Abs( fitness1 / fitness2 - 1 ); ! bool areEquivalentAsTopBestParameters = ( percDifference < 0.00001 ); // if ( areEquivalentAsTopBestParameters ) --- 91,95 ---- double percDifference = Math.Abs( fitness1 / fitness2 - 1 ); ! bool haveTheSameFitness = ( percDifference < 0.00001 ); // if ( areEquivalentAsTopBestParameters ) *************** *** 99,103 **** // } // return areEquivalentAsTopBestParameters; ! return false; } /// Two TestingPositions are considered equivalent as TopBestPositions --- 99,103 ---- // } // return areEquivalentAsTopBestParameters; ! return haveTheSameFitness; } /// Two TestingPositions are considered equivalent as TopBestPositions *************** *** 114,127 **** 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 , --- 114,126 ---- bruteForceOptimizableParameters1 , bruteForceOptimizableParameters2 ); ! // the following is a short way to say that, with respect to the ! // pairs trading strategy, (a,b) is equivalent to ! // (-a,-b), and that (a,-b) is equivalent to (-a,b) ! // We use fitness similarity instead of checking for all possible long/short ! // combinations bool areEquivalentAsTopBestParameters = this.haveTheSameTickers( ((TestingPositions)bruteForceOptimizableParameters1.Meaning ) , ! ((TestingPositions)bruteForceOptimizableParameters2.Meaning) ) && this.haveTheSameFitness( bruteForceOptimizableParameters1 , |
|
From: Glauco S. <gla...@us...> - 2008-04-20 17:21:37
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15014/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator Modified Files: PVOPositions.cs Log Message: A dummy constructor has been added: it creates an empty TestingPositions. To be used to give undecodables a meaning with PVOPositions type Index: PVOPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVOPositions.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PVOPositions.cs 9 Mar 2008 22:49:24 -0000 1.1 --- PVOPositions.cs 20 Apr 2008 17:21:28 -0000 1.2 *************** *** 79,82 **** --- 79,88 ---- } + // creates an empty TestingPositions: to be used to give a meaning with + // PVOPositions type to undecodables + public PVOPositions() : base() + { + } + public PVOPositions(WeightedPositions weightedPositions, double oversoldThreshold, |
|
From: Glauco S. <gla...@us...> - 2008-04-20 17:17:48
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/BruteForce In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13251/b1_ADT/Optimizing/BruteForce Modified Files: BruteForceOptimizer.cs Log Message: An exception is now risen if the TopBestParameters are less than the number required (and expected) Index: BruteForceOptimizer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/BruteForce/BruteForceOptimizer.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BruteForceOptimizer.cs 30 Mar 2008 15:36:44 -0000 1.5 --- BruteForceOptimizer.cs 20 Apr 2008 17:17:43 -0000 1.6 *************** *** 127,130 **** --- 127,139 ---- }while (this.bruteForceOptimizableParametersManager.MoveNext()); } + private void checkIfTopBestParametersIsFine() + { + if ( this.bestParametersManager.TopBestParameters[ + this.bestParametersManager.TopBestParameters.Length - 1 ] == null ) + throw new Exception( + "The number of analysed couples is less than numberOfTopBestParameters! " + + "It means that totalNumberOfItemsToBeAnalized is lower than the requested best " + + "top parameters. This should never be the case!" ); + } private void sortTopBestParametersDescending() { *************** *** 137,140 **** --- 146,150 ---- { this.createTopBestParameters(); + this.checkIfTopBestParametersIsFine(); this.sortTopBestParametersDescending(); // this.bestParametersManager.TopBestParameters.Sort(); |
|
From: Glauco S. <gla...@us...> - 2008-04-20 17:16:02
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12407/b7_Scripts Modified Files: Scripts_SD.csproj Log Message: - the folder WalkForwardTesting\PairsTrading\Strategies\ has been added - WalkForwardTesting\PairsTrading\PairsTradingStrategy.cs has been moved to WalkForwardTesting\PairsTrading\Strategies\PairsTradingStrategy.cs (the remove part has not been done in #develop, yet) - WalkForwardTesting\PairsTrading\Strategies\LongOnlyPairsTradingStrategy.cs has been added Index: Scripts_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/Scripts_SD.csproj,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Scripts_SD.csproj 10 Apr 2008 23:07:51 -0000 1.23 --- Scripts_SD.csproj 20 Apr 2008 17:15:54 -0000 1.24 *************** *** 116,119 **** --- 116,121 ---- <Compile Include="WalkForwardTesting\PairsTrading\PairsTradingStrategy.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\PairsTradingTestingPositions.cs" /> + <Compile Include="WalkForwardTesting\PairsTrading\Strategies\PairsTradingStrategy.cs" /> + <Compile Include="WalkForwardTesting\PairsTrading\Strategies\LongOnlyPairsTradingStrategy.cs" /> <Compile Include="WalkForwardTesting\WalkForwardLag\RunSimpleLag.cs" /> <Compile Include="WalkForwardTesting\WalkForwardLag\WeightedPositionsChoosers\BruteForce\WFLagBruteForceWeightedPositionsChooserForBalancedFixedPortfolioAndBalancedDriving.cs" /> *************** *** 292,295 **** --- 294,298 ---- <Folder Include="WalkForwardTesting\PairsTrading\InSample\InSampleChoosers\Genetic" /> <Folder Include="WalkForwardTesting\PairsTrading\Logging" /> + <Folder Include="WalkForwardTesting\PairsTrading\Strategies" /> <Folder Include="WalkForwardTesting\WalkForwardLag\WeightedPositionsChoosers\BruteForce" /> <Folder Include="WalkForwardTesting\WalkForwardLag\WeightedPositionsChoosers\Decoding" /> |
|
From: Glauco S. <gla...@us...> - 2008-04-20 17:13:31
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11517/b4_Business Modified Files: Business_SD.csproj Log Message: a2_Strategies\EndOfDayStrategies\SymmetricEndOfDayStrategyForBacktester.cs has been added Index: Business_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/Business_SD.csproj,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Business_SD.csproj 8 Apr 2008 22:04:54 -0000 1.22 --- Business_SD.csproj 20 Apr 2008 17:13:27 -0000 1.23 *************** *** 74,77 **** --- 74,78 ---- <Compile Include="a2_Strategies\Eligibles\MostLiquidAndLessVolatile.cs" /> <Compile Include="a2_Strategies\EndOfDayStrategies\BasicEndOfDayStrategyForBacktester.cs" /> + <Compile Include="a2_Strategies\EndOfDayStrategies\SymmetricEndOfDayStrategyForBacktester.cs" /> <Compile Include="a2_Strategies\EndOfDayStrategyBackTester.cs" /> <Compile Include="a2_Strategies\IEndOfDayStrategyForBacktester.cs" /> |
|
From: Glauco S. <gla...@us...> - 2008-04-20 17:12:40
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/InSample In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11076/b7_Scripts/WalkForwardTesting/PairsTrading/InSample Modified Files: PairsTradingFitnessEvaluator.cs Log Message: - fitness for meaningless candidates is now set to -1000d (it was set to -0.4 in the previous revision) - now the multipliers for the PearsonCorrelationCoefficient are either +1 or -1; in the previous revision, the positions' weights were used, instead Index: PairsTradingFitnessEvaluator.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/InSample/PairsTradingFitnessEvaluator.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PairsTradingFitnessEvaluator.cs 13 Mar 2008 19:38:42 -0000 1.2 --- PairsTradingFitnessEvaluator.cs 20 Apr 2008 17:12:35 -0000 1.3 *************** *** 38,41 **** --- 38,43 ---- public class PairsTradingFitnessEvaluator : IFitnessEvaluator { + private const double fitnessForInvalidCandidate = -1000d; + private double maxCorrelationAllowed; *************** *** 67,70 **** --- 69,85 ---- "two positions!" ); } + /// <summary> + /// returns 1 if the weightedPosition is long, -1 if it is short. This + /// is used to compute the PearsonCorrelationCoefficient considering the + /// proper sign for returns + /// </summary> + /// <param name="weightedPosition"></param> + private double getMultiplierForReturns( WeightedPosition weightedPosition ) + { + double multiplierForReturns = 1; + if ( weightedPosition.IsShort ) + multiplierForReturns = -1; + return multiplierForReturns; + } private double getFitnessValue( WeightedPosition firstPosition , WeightedPosition secondPosition , *************** *** 76,81 **** returnsManager.GetReturns( secondPosition.Ticker ); double fitnessValue = BasicFunctions.PearsonCorrelationCoefficient( ! firstPosition.Weight , firstPositionReturns , ! secondPosition.Weight , secondPositionReturns ); return fitnessValue; } --- 91,98 ---- returnsManager.GetReturns( secondPosition.Ticker ); double fitnessValue = BasicFunctions.PearsonCorrelationCoefficient( ! this.getMultiplierForReturns( firstPosition ) , firstPositionReturns , ! this.getMultiplierForReturns( secondPosition ) , secondPositionReturns ); ! // double fitnessValue = BasicFunctions.PearsonCorrelationCoefficient( ! // firstPositionReturns , secondPositionReturns ); return fitnessValue; } *************** *** 99,103 **** // the current optimization's candidate contains // two genes that decode to the same tickers ! fitnessValue = -0.4; else // for the current optimization's candidate, --- 116,120 ---- // the current optimization's candidate contains // two genes that decode to the same tickers ! fitnessValue = fitnessForInvalidCandidate; else // for the current optimization's candidate, *************** *** 108,112 **** // the two positions are too correlated. They may represent // the same instrument ! fitnessValue = -0.4; } return fitnessValue; --- 125,129 ---- // the two positions are too correlated. They may represent // the same instrument ! fitnessValue = fitnessForInvalidCandidate; } return fitnessValue; |
|
From: Glauco S. <gla...@us...> - 2008-04-20 17:09:20
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Statistics In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9527/b1_ADT/Statistics Modified Files: BasicFunctions.cs Log Message: Some debugging code has been added Index: BasicFunctions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Statistics/BasicFunctions.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** BasicFunctions.cs 6 Mar 2008 20:13:49 -0000 1.11 --- BasicFunctions.cs 20 Apr 2008 17:09:16 -0000 1.12 *************** *** 330,333 **** --- 330,336 ---- double d5 = d1 - d2; double d6 = d3 - d4; + double a1 = (n*sumOfSquaredFirst - sumOfFirst*sumOfFirst); + double a2 = (n*sumOfSquaredSecond - sumOfSecond*sumOfSecond); + return (n*sumOfProduct - sumOfFirst*sumOfSecond)/ Math.Sqrt( (n*sumOfSquaredFirst - sumOfFirst*sumOfFirst)* |
|
From: Glauco S. <gla...@us...> - 2008-04-20 17:08:19
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv8986/b7_Scripts/WalkForwardTesting/PairsTrading Modified Files: PairsTradingMain.cs Log Message: Code to test the LongOnlyPairsTradingStrategy has been added Index: PairsTradingMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/PairsTradingMain.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PairsTradingMain.cs 13 Apr 2008 17:01:28 -0000 1.10 --- PairsTradingMain.cs 20 Apr 2008 17:08:05 -0000 1.11 *************** *** 150,153 **** --- 150,160 ---- this.historicalQuoteProviderForChosingPositionsOutOfSample , 0.006 , 0.99 , 0.006 , 0.99 ); + endOfDayStrategyForBacktester = + new LongOnlyPairsTradingStrategy( + 7 , inSampleDays , intervalsSelector , + eligiblesSelector , inSampleChooser , + this.historicalQuoteProviderForInSample , + this.historicalQuoteProviderForChosingPositionsOutOfSample , + 0.006 , 0.99 , 0.006 , 0.99 ); return endOfDayStrategyForBacktester; } *************** *** 161,165 **** DateTime firstDateTime = new DateTime( 2001 , 1 , 1 ); DateTime lastDateTime = new DateTime( 2004 , 12 , 31 ); ! double maxRunningHours = 0.7; EndOfDayStrategyBackTester endOfDayStrategyBackTester = --- 168,172 ---- DateTime firstDateTime = new DateTime( 2001 , 1 , 1 ); DateTime lastDateTime = new DateTime( 2004 , 12 , 31 ); ! double maxRunningHours = 5; EndOfDayStrategyBackTester endOfDayStrategyBackTester = |
|
From: Glauco S. <gla...@us...> - 2008-04-20 16:39:27
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/InSample/InSampleChoosers/Genetic In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26027/b7_Scripts/WalkForwardTesting/PairsTrading/InSample/InSampleChoosers/Genetic Modified Files: DecoderForPairsTradingTestingPositionsWithBalancedWeights.cs Log Message: The base class' abstract method protected abstract TestingPositions getMeaningForUndecodable(); has been implemented Index: DecoderForPairsTradingTestingPositionsWithBalancedWeights.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/InSample/InSampleChoosers/Genetic/DecoderForPairsTradingTestingPositionsWithBalancedWeights.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DecoderForPairsTradingTestingPositionsWithBalancedWeights.cs 6 Mar 2008 19:59:22 -0000 1.1 --- DecoderForPairsTradingTestingPositionsWithBalancedWeights.cs 20 Apr 2008 16:39:23 -0000 1.2 *************** *** 38,41 **** --- 38,46 ---- { } + + protected override TestingPositions getMeaningForUndecodable() + { + return new PairsTradingTestingPositions(); + } protected override TestingPositions getTestingPositions(double[] weights, string[] tickers) |
|
From: Glauco S. <gla...@us...> - 2008-04-20 16:38:52
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25550/b4_Business/a2_Strategies/Optimizing/Decoding Modified Files: DecoderForTestingPositionsWithBalancedWeights.cs Log Message: This class has become abstract now, because the base class now requires the abstract method protected abstract TestingPositions getMeaningForUndecodable(); to be implemented Index: DecoderForTestingPositionsWithBalancedWeights.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding/DecoderForTestingPositionsWithBalancedWeights.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DecoderForTestingPositionsWithBalancedWeights.cs 8 Apr 2008 21:46:01 -0000 1.4 --- DecoderForTestingPositionsWithBalancedWeights.cs 20 Apr 2008 16:38:47 -0000 1.5 *************** *** 32,36 **** /// In this implementation, weights are balanced on volatility base /// </summary> ! public class DecoderForTestingPositionsWithBalancedWeights : BasicDecoderForTestingPositions { --- 32,36 ---- /// In this implementation, weights are balanced on volatility base /// </summary> ! public abstract class DecoderForTestingPositionsWithBalancedWeights : BasicDecoderForTestingPositions { *************** *** 41,53 **** } ! // public override string Description ! // { ! // get ! // { ! // string description = ! // "DecoderForTestingPositions_DecodedOnlyTickers_WeightsAreBalancedOnVolatilityBase"; ! // return description; ! // } ! // } protected override double[] getWeights(SignedTickers signedTickers) --- 41,45 ---- } ! // protected override abstract getMeaningForUndecodable(); protected override double[] getWeights(SignedTickers signedTickers) |
|
From: Glauco S. <gla...@us...> - 2008-04-20 16:37:15
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25042/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/Decoding Modified Files: BasicDecoderForPVOPositions.cs Log Message: The base class' abstract method protected abstract TestingPositions getMeaningForUndecodable(); has been implemented Index: BasicDecoderForPVOPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/Decoding/BasicDecoderForPVOPositions.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BasicDecoderForPVOPositions.cs 8 Apr 2008 21:46:01 -0000 1.2 --- BasicDecoderForPVOPositions.cs 20 Apr 2008 16:37:09 -0000 1.3 *************** *** 56,59 **** --- 56,64 ---- this.numDaysForOscillatingPeriod = numDaysForOscillatingPeriod; } + + protected override TestingPositions getMeaningForUndecodable() + { + return new PVOPositions(); + } private void decodeDecodable_setThresholds() |
|
From: Glauco S. <gla...@us...> - 2008-04-20 16:36:04
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv24221/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: - WalkForwardTesting\PairsTrading\PairsTradingStrategy.cs has been moved to WalkForwardTesting\PairsTrading\Strategies\PairsTradingStrategy.cs - WalkForwardTesting\PairsTrading\Strategies\LongOnlyPairsTradingStrategy.cs has been added Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** b7_Scripts.csproj 8 Apr 2008 22:04:54 -0000 1.93 --- b7_Scripts.csproj 20 Apr 2008 16:35:59 -0000 1.94 *************** *** 910,918 **** /> <File - RelPath = "WalkForwardTesting\PairsTrading\PairsTradingStrategy.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "WalkForwardTesting\PairsTrading\PairsTradingTestingPositions.cs" SubType = "Code" --- 910,913 ---- *************** *** 960,963 **** --- 955,968 ---- /> <File + RelPath = "WalkForwardTesting\PairsTrading\Strategies\LongOnlyPairsTradingStrategy.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "WalkForwardTesting\PairsTrading\Strategies\PairsTradingStrategy.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "WalkForwardTesting\WalkForwardLag\RunSimpleLag.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2008-04-20 16:34:55
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23776/Strategies Added Files: LongOnlyPairsTradingStrategy.cs Log Message: Pairs Trading strategy that selects only the long position --- NEW FILE: LongOnlyPairsTradingStrategy.cs --- /* QuantProject - Quantitative Finance Library LongOnlyPairsTradingStrategy.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; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.InSample; using QuantProject.Business.Strategies.Logging; using QuantProject.Business.Strategies.OutOfSample; using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Strategies.ReturnsManagement.Time; using QuantProject.Business.Strategies.ReturnsManagement.Time.IntervalsSelectors; using QuantProject.Business.Timing; namespace QuantProject.Scripts.WalkForwardTesting.PairsTrading { /// <summary> /// Pairs Trading strategy that selects only the long position /// </summary> public class LongOnlyPairsTradingStrategy : PairsTradingStrategy { public LongOnlyPairsTradingStrategy( int numDaysBeetweenEachOtpimization , int numDaysForInSampleOptimization , IIntervalsSelector intervalsSelector , IEligiblesSelector eligiblesSelector , IInSampleChooser inSampleChooser , IHistoricalQuoteProvider historicalQuoteProviderForInSample , IHistoricalQuoteProvider historicalQuoteProviderForChosingPositionsOutOfSample , double minThresholdForGoingLong , double maxThresholdForGoingLong , double minThresholdForGoingShort , double maxThresholdForGoingShort ) : base( numDaysBeetweenEachOtpimization , numDaysForInSampleOptimization , intervalsSelector , eligiblesSelector , inSampleChooser , historicalQuoteProviderForInSample , historicalQuoteProviderForChosingPositionsOutOfSample , minThresholdForGoingLong , maxThresholdForGoingLong , minThresholdForGoingShort , maxThresholdForGoingShort ) { } protected override string getTextIdentifier() { return "pairsTrdngOnlyLong"; } #region selectWeightedPositions private WeightedPositions selectWeightedPositionIfTheCase( WeightedPosition weightedPosition ) { WeightedPositions weightedPositionsToBeReturned = null; if ( weightedPosition.IsLong ) { double[] weights = { 1 }; string[] tickers = { weightedPosition.Ticker }; weightedPositionsToBeReturned = new WeightedPositions( weights , tickers ); } return weightedPositionsToBeReturned; } protected override WeightedPositions selectWeightedPositions( WeightedPositions weightedPositions ) { WeightedPositions weightedPositionsToBeReturned = this.selectWeightedPositionIfTheCase( weightedPositions[ 0 ] ); if ( weightedPositionsToBeReturned == null ) // the first weighted position was not the one to be selected weightedPositionsToBeReturned = this.selectWeightedPositionIfTheCase( weightedPositions[ 1 ] ); return weightedPositionsToBeReturned; } #endregion selectWeightedPositions } } |
|
From: Glauco S. <gla...@us...> - 2008-04-20 16:33:20
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23328/b4_Business/a2_Strategies/Optimizing/Decoding Modified Files: BasicDecoderForTestingPositions.cs Log Message: The abstract method protected abstract TestingPositions getMeaningForUndecodable(); has been added Index: BasicDecoderForTestingPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding/BasicDecoderForTestingPositions.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BasicDecoderForTestingPositions.cs 8 Apr 2008 21:46:01 -0000 1.6 --- BasicDecoderForTestingPositions.cs 20 Apr 2008 16:33:13 -0000 1.7 *************** *** 117,120 **** --- 117,122 ---- #endregion decodeSignedTickers + protected abstract TestingPositions getMeaningForUndecodable(); + #region isDecodable private string[] getTickersForPositions() *************** *** 203,207 **** returnsManager); this.setTickerRelatedGeneValues(); ! TestingPositions meaning = new TestingPositions(); if ( this.isDecodable() ) // encoded, normally a Genome, can be decoded to a TestingPositions --- 205,209 ---- returnsManager); this.setTickerRelatedGeneValues(); ! TestingPositions meaning = this.getMeaningForUndecodable(); if ( this.isDecodable() ) // encoded, normally a Genome, can be decoded to a TestingPositions |
|
From: Glauco S. <gla...@us...> - 2008-04-20 16:32:35
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22908 Removed Files: PairsTradingStrategy.cs Log Message: WalkForwardTesting\PairsTrading\PairsTradingStrategy.cs has been moved to WalkForwardTesting\PairsTrading\Strategies\PairsTradingStrategy.cs --- PairsTradingStrategy.cs DELETED --- |
|
From: Glauco S. <gla...@us...> - 2008-04-20 16:31:22
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22452 Added Files: PairsTradingStrategy.cs Log Message: WalkForwardTesting\PairsTrading\PairsTradingStrategy.cs has been moved to WalkForwardTesting\PairsTrading\Strategies\PairsTradingStrategy.cs --- NEW FILE: PairsTradingStrategy.cs --- /* QuantProject - Quantitative Finance Library PairsTradingStrategy.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; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.InSample; using QuantProject.Business.Strategies.Logging; using QuantProject.Business.Strategies.OutOfSample; using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Strategies.ReturnsManagement.Time; using QuantProject.Business.Strategies.ReturnsManagement.Time.IntervalsSelectors; using QuantProject.Business.Timing; namespace QuantProject.Scripts.WalkForwardTesting.PairsTrading { /// <summary> /// Pairs Trading strategy with in sample optimizations /// </summary> public class PairsTradingStrategy : SymmetricEndOfDayStrategyForBacktester { // private WeightedPositions positionsToBeOpened; private double minThresholdForGoingLong, maxThresholdForGoingLong, minThresholdForGoingShort, maxThresholdForGoingShort; private IHistoricalQuoteProvider historicalQuoteProviderForChosingPositionsOutOfSample; public PairsTradingStrategy( int numDaysBeetweenEachOtpimization , int numDaysForInSampleOptimization , IIntervalsSelector intervalsSelector , IEligiblesSelector eligiblesSelector , IInSampleChooser inSampleChooser , IHistoricalQuoteProvider historicalQuoteProviderForInSample , IHistoricalQuoteProvider historicalQuoteProviderForChosingPositionsOutOfSample , double minThresholdForGoingLong , double maxThresholdForGoingLong , double minThresholdForGoingShort , double maxThresholdForGoingShort ) : base( numDaysBeetweenEachOtpimization , numDaysForInSampleOptimization , intervalsSelector , eligiblesSelector , inSampleChooser , historicalQuoteProviderForInSample ) { this.minThresholdForGoingLong = minThresholdForGoingLong; this.maxThresholdForGoingLong = maxThresholdForGoingLong; this.minThresholdForGoingShort = minThresholdForGoingShort; this.maxThresholdForGoingShort = maxThresholdForGoingShort; this.historicalQuoteProviderForChosingPositionsOutOfSample = historicalQuoteProviderForChosingPositionsOutOfSample; } protected override string getTextIdentifier() { return "pairsTrdng"; } #region arePositionsToBeClosed private ReturnInterval getSecondLastReturnInterval() { int indexForTheSecondLastReturnInterval = this.returnIntervals.Count - 2; ReturnInterval secondLastReturnInterval = this.returnIntervals[ indexForTheSecondLastReturnInterval ]; return secondLastReturnInterval; } protected override bool arePositionsToBeClosed() { bool areToBeClosed = false; if ( this.returnIntervals.Count > 1 ) // at least two intervals have already been // added, out of sample { ReturnInterval secondLastReturnInterval = this.getSecondLastReturnInterval(); areToBeClosed = this.now().IsEqualTo( secondLastReturnInterval.End ); } return ( areToBeClosed ); } #endregion arePositionsToBeClosed // protected override bool marketOpenEventHandler_arePositionsToBeOpened() // { // return this.arePositionsToBeOpened(); // } // protected override bool marketCloseEventHandler_arePositionsToBeOpened() // { // return this.arePositionsToBeOpened(); // } protected override bool arePositionsToBeOpened() { bool beginsTheLastInterval = ( this.now().IsEqualTo( this.lastIntervalAppended().Begin ) ); return ( beginsTheLastInterval ); } #region getPositionsToBeOpened #region getReturnsManagerForLastSecondPhaseInterval private EndOfDayDateTime getIntervalBeginForLastSecondPhaseInterval() { // this method will be invoked only if (this.returnIntervals.Count >= 2) int secondLastIntervalIndex = this.returnIntervals.Count - 2; ReturnInterval secondLastInterval = this.returnIntervals[ secondLastIntervalIndex ]; return secondLastInterval.End; } private EndOfDayDateTime getIntervalEndForLastSecondPhaseInterval() { return this.lastIntervalAppended().Begin; } private ReturnInterval getReturnIntervalForLastSecondPhaseInterval() { EndOfDayDateTime intervalBegin = this.getIntervalBeginForLastSecondPhaseInterval(); EndOfDayDateTime intervalEnd = this.getIntervalEndForLastSecondPhaseInterval(); ReturnInterval returnIntervalForLastSecondPhaseInterval = new ReturnInterval( intervalBegin , intervalEnd ); return returnIntervalForLastSecondPhaseInterval; } private ReturnIntervals getReturnIntervalsForLastSecondPhaseInterval() { ReturnInterval returnIntervalForLastSecondPhaseInterval = this.getReturnIntervalForLastSecondPhaseInterval(); ReturnIntervals returnIntervalsForLastSecondPhaseInterval = new ReturnIntervals( returnIntervalForLastSecondPhaseInterval ); return returnIntervalsForLastSecondPhaseInterval; } private ReturnsManager getReturnsManagerForLastSecondPhaseInterval() { ReturnIntervals returnIntervals = this.getReturnIntervalsForLastSecondPhaseInterval(); // ReturnsManager returnsManager = // new ReturnsManager( returnIntervals , // this.historicalAdjustedQuoteProvider ); ReturnsManager returnsManager = new ReturnsManager( returnIntervals , this.historicalQuoteProviderForChosingPositionsOutOfSample ); return returnsManager; } #endregion getReturnsManagerForLastSecondPhaseInterval private double getReturnForTheLastSecondPhaseInterval( ReturnsManager returnsManager , WeightedPositions weightedPositions ) { // returnsManager should contain a single ReturnInterval, and // this ReturnInterval should be the last second phase interval double returnForTheLastSecondPhaseInterval = weightedPositions.GetReturn( 0 , returnsManager ); return returnForTheLastSecondPhaseInterval; } /// <summary> /// Inverts one of the two positions /// </summary> /// <param name="weightedPositions"></param> /// <returns></returns> private WeightedPositions getCandidateForPortfolio( WeightedPositions weightedPositions ) { double[] weights = new double[ 2 ]; weights[ 0 ] = ((WeightedPosition)weightedPositions[ 0 ]).Weight; weights[ 1 ] = -((WeightedPosition)weightedPositions[ 1 ]).Weight; string[] tickers = new String[ 2 ]; tickers[ 0 ] = ((WeightedPosition)weightedPositions[ 0 ]).Ticker; tickers[ 1 ] = ((WeightedPosition)weightedPositions[ 1 ]).Ticker; WeightedPositions candidateForPortfolio = new WeightedPositions( weights , tickers ); return candidateForPortfolio; } // if the currentWeightedPositions' return satisfies the thresholds // then this method returns the WeightedPositions to be opened. // Otherwise (currentWeightedPositions' return does NOT // satisfy the thresholds) this method returns null private WeightedPositions getPositionsToBeOpenedWithRespectToCurrentWeightedPositions( ReturnsManager returnsManager , WeightedPositions currentWeightedPositions ) { WeightedPositions weightedPositionsToBeOpened = null; try { double returnForTheLastSecondPhaseInterval = this.getReturnForTheLastSecondPhaseInterval( returnsManager , currentWeightedPositions ); if ( ( returnForTheLastSecondPhaseInterval >= this.minThresholdForGoingLong ) && ( returnForTheLastSecondPhaseInterval <= this.maxThresholdForGoingLong ) ) // it looks like there has been an inefficiency that // might be recovered, by going short weightedPositionsToBeOpened = currentWeightedPositions.Opposite; if ( ( -returnForTheLastSecondPhaseInterval >= this.minThresholdForGoingShort ) && ( -returnForTheLastSecondPhaseInterval <= this.maxThresholdForGoingShort ) ) // it looks like there has been an inefficiency that // might be recovered, by going long weightedPositionsToBeOpened = currentWeightedPositions; } catch( TickerNotExchangedException ex ) { string dummy = ex.Message; } return weightedPositionsToBeOpened; } private WeightedPositions getPositionsToBeOpenedWithRespectToCurrentWeightedPositions( ReturnsManager returnsManager , int currentTestingPositionsIndex ) { WeightedPositions currentWeightedPositions = this.bestTestingPositionsInSample[ currentTestingPositionsIndex ].WeightedPositions; WeightedPositions candidateForPortfolio = this.getCandidateForPortfolio( currentWeightedPositions ); WeightedPositions weightedPositionsToBeOpended = this.getPositionsToBeOpenedWithRespectToCurrentWeightedPositions( returnsManager , candidateForPortfolio ); return weightedPositionsToBeOpended; } protected WeightedPositions getPositionsToBeOpened( ReturnsManager returnsManager ) { WeightedPositions weightedPositionsToBeOpended = null; int currentTestingPositionsIndex = 0; while ( ( weightedPositionsToBeOpended == null ) && ( currentTestingPositionsIndex < this.bestTestingPositionsInSample.Length ) ) { weightedPositionsToBeOpended = this.getPositionsToBeOpenedWithRespectToCurrentWeightedPositions( returnsManager , currentTestingPositionsIndex ); currentTestingPositionsIndex++; } return weightedPositionsToBeOpended; } private WeightedPositions getPositionsToBeOpened_withAtLeastASecondPhaseInterval_actually() { ReturnsManager returnsManager = this.getReturnsManagerForLastSecondPhaseInterval(); WeightedPositions weightedPositions = this.getPositionsToBeOpened( returnsManager ); return weightedPositions; } /// <summary> /// To be overriden if a subset of the positions has to be returned /// </summary> /// <param name="weightedPositions"></param> /// <returns></returns> protected virtual WeightedPositions selectWeightedPositions( WeightedPositions weightedPositions ) { return weightedPositions; } private WeightedPositions getPositionsToBeOpened_withAtLeastASecondPhaseInterval() { WeightedPositions weightedPositions = this.getPositionsToBeOpened_withAtLeastASecondPhaseInterval_actually(); WeightedPositions weightedPositionsToBeReturned = null; if ( weightedPositions != null ) // at least one of the BestTestingPositions shows an inefficiency // above the threshold weightedPositionsToBeReturned = selectWeightedPositions( weightedPositions ); return weightedPositionsToBeReturned; } protected override WeightedPositions getPositionsToBeOpened() { WeightedPositions weightedPositions = null; if ( this.returnIntervals.Count >= 2 ) // at least a second phase interval exists weightedPositions = this.getPositionsToBeOpened_withAtLeastASecondPhaseInterval(); return weightedPositions; } #endregion // protected override WeightedPositions marketOpenEventHandler_getPositionsToBeOpened() // { // return this.getPositionsToBeOpened(); // } // // protected override WeightedPositions marketCloseEventHandler_getPositionsToBeOpened() // { // return this.getPositionsToBeOpened(); // } // // protected override bool marketOpenEventHandler_arePositionsToBeClosed() // { // return this.arePositionsToBeClosed(); // } // // protected override bool marketCloseEventHandler_arePositionsToBeClosed() // { // return this.arePositionsToBeClosed(); // } protected override LogItem getLogItem( EligibleTickers eligibleTickers ) { PairsTradingLogItem logItem = new PairsTradingLogItem( this.now() , this.bestTestingPositionsInSample , this.numDaysForInSampleOptimization , eligibleTickers.Count ); // logItem.BestWeightedPositionsInSample = // this.bestTestingPositionsInSample.WeightedPositions; // logItem.NumberOfEligibleTickers = // eligibleTickers.Count; return logItem; } } } |
|
From: Glauco S. <gla...@us...> - 2008-04-20 16:27:53
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv20732/Strategies Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Strategies added to the repository |
|
From: Glauco S. <gla...@us...> - 2008-04-13 17:10:14
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9408/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator Modified Files: PVO_OTCMain.cs Log Message: Changed to reflect the new abstract methods arranged in BasicScriptForBacktesting Index: PVO_OTCMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVO_OTCMain.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PVO_OTCMain.cs 8 Apr 2008 22:03:48 -0000 1.3 --- PVO_OTCMain.cs 13 Apr 2008 17:10:07 -0000 1.4 *************** *** 72,76 **** } ! protected override void setEligiblesSelector() { int maxNumberOfEligiblesToBeChosen = 100; --- 72,76 ---- } ! protected override IEligiblesSelector getEligiblesSelector() { int maxNumberOfEligiblesToBeChosen = 100; *************** *** 90,94 **** double maxPrice = 7000; ! this.eligiblesSelector = new ByPriceMostLiquidAlwaysQuoted( tickersGroupId , temporizedGroup , --- 90,94 ---- double maxPrice = 7000; ! IEligiblesSelector eligiblesSelector = new ByPriceMostLiquidAlwaysQuoted( tickersGroupId , temporizedGroup , *************** *** 96,104 **** numDaysForAverageRawOpenPriceComputation , minPrice , maxPrice ); ! this.eligiblesSelector = new DummyEligibleSelector(); } ! protected override void setInSampleChooser() { // parameters for the genetic optimizer --- 96,105 ---- numDaysForAverageRawOpenPriceComputation , minPrice , maxPrice ); ! eligiblesSelector = new DummyEligibleSelector(); + return eligiblesSelector; } ! protected override IInSampleChooser getInSampleChooser() { // parameters for the genetic optimizer *************** *** 121,134 **** //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; --- 122,136 ---- //correlation is computed only for returns //between minimum and maximum ! IInSampleChooser inSampleChooser = new PVO_OTCCorrelationChooser(numberOfBestTestingPositionsToBeReturned, maxCorrelationAllowed , balancedWeightsOnVolatilityBase, minimumAbsoluteReturnValue , maximumAbsoluteReturnValue); ! 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"); + return inSampleChooser; } ! protected override IEndOfDayStrategyForBacktester getEndOfDayStrategy() { int inSampleDays = 180; *************** *** 138,147 **** 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"; --- 140,150 ---- double oversoldThreshold = 0.006; double overboughtThreshold = 0.006; ! IEndOfDayStrategyForBacktester endOfDayStrategy = new PVO_OTCStrategy(eligiblesSelector ,inSampleChooser , inSampleDays , benchmark , numDaysBetweenEachOptimization , oversoldThreshold , overboughtThreshold , historicalQuoteProvider); + return endOfDayStrategy; } ! protected override EndOfDayStrategyBackTester getEndOfDayStrategyBackTester() { string backTestId = "PVO_OTC"; *************** *** 153,157 **** double maxRunningHours = 3; ! this.endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( backTestId , this.endOfDayStrategy , --- 156,160 ---- double maxRunningHours = 3; ! EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( backTestId , this.endOfDayStrategy , *************** *** 159,162 **** --- 162,166 ---- firstDateTime , lastDateTime , this.benchmark , cashToStart , maxRunningHours ); + return endOfDayStrategyBackTester; } |
|
From: Glauco S. <gla...@us...> - 2008-04-13 17:02:49
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5868/b7_Scripts/WalkForwardTesting/PairsTrading Modified Files: PairsTradingStrategy.cs Log Message: Now this class derives from SymmetricEndOfDayStrategyForBacktester (it derived from BasicEndOfDayStrategyForBacktester in the previous revision). The code has been arranged accordingly (small changes were needed) Index: PairsTradingStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/PairsTradingStrategy.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PairsTradingStrategy.cs 1 Apr 2008 21:34:08 -0000 1.4 --- PairsTradingStrategy.cs 13 Apr 2008 17:02:43 -0000 1.5 *************** *** 40,44 **** /// Pairs Trading strategy with in sample optimizations /// </summary> ! public class PairsTradingStrategy : BasicEndOfDayStrategyForBacktester { // private WeightedPositions positionsToBeOpened; --- 40,44 ---- /// Pairs Trading strategy with in sample optimizations /// </summary> ! public class PairsTradingStrategy : SymmetricEndOfDayStrategyForBacktester { // private WeightedPositions positionsToBeOpened; *************** *** 97,101 **** return secondLastReturnInterval; } ! private bool arePositionsToBeClosed() { bool areToBeClosed = false; --- 97,101 ---- return secondLastReturnInterval; } ! protected override bool arePositionsToBeClosed() { bool areToBeClosed = false; *************** *** 112,125 **** #endregion arePositionsToBeClosed ! protected override bool marketOpenEventHandler_arePositionsToBeOpened() ! { ! return this.arePositionsToBeOpened(); ! } ! protected override bool marketCloseEventHandler_arePositionsToBeOpened() ! { ! return this.arePositionsToBeOpened(); ! } ! private bool arePositionsToBeOpened() { bool beginsTheLastInterval = --- 112,125 ---- #endregion arePositionsToBeClosed ! // protected override bool marketOpenEventHandler_arePositionsToBeOpened() ! // { ! // return this.arePositionsToBeOpened(); ! // } ! // protected override bool marketCloseEventHandler_arePositionsToBeOpened() ! // { ! // return this.arePositionsToBeOpened(); ! // } ! protected override bool arePositionsToBeOpened() { bool beginsTheLastInterval = *************** *** 281,285 **** return this.getPositionsToBeOpened( returnsManager ); } ! protected WeightedPositions getPositionsToBeOpened() { WeightedPositions weightedPositions = null; --- 281,285 ---- return this.getPositionsToBeOpened( returnsManager ); } ! protected override WeightedPositions getPositionsToBeOpened() { WeightedPositions weightedPositions = null; *************** *** 292,314 **** #endregion ! protected override WeightedPositions marketOpenEventHandler_getPositionsToBeOpened() ! { ! return this.getPositionsToBeOpened(); ! } ! ! protected override WeightedPositions marketCloseEventHandler_getPositionsToBeOpened() ! { ! return this.getPositionsToBeOpened(); ! } ! ! protected override bool marketOpenEventHandler_arePositionsToBeClosed() ! { ! return this.arePositionsToBeClosed(); ! } ! ! protected override bool marketCloseEventHandler_arePositionsToBeClosed() ! { ! return this.arePositionsToBeClosed(); ! } protected override LogItem getLogItem( EligibleTickers eligibleTickers ) --- 292,314 ---- #endregion ! // protected override WeightedPositions marketOpenEventHandler_getPositionsToBeOpened() ! // { ! // return this.getPositionsToBeOpened(); ! // } ! // ! // protected override WeightedPositions marketCloseEventHandler_getPositionsToBeOpened() ! // { ! // return this.getPositionsToBeOpened(); ! // } ! // ! // protected override bool marketOpenEventHandler_arePositionsToBeClosed() ! // { ! // return this.arePositionsToBeClosed(); ! // } ! // ! // protected override bool marketCloseEventHandler_arePositionsToBeClosed() ! // { ! // return this.arePositionsToBeClosed(); ! // } protected override LogItem getLogItem( EligibleTickers eligibleTickers ) |
|
From: Glauco S. <gla...@us...> - 2008-04-13 17:01:33
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5363/b7_Scripts/WalkForwardTesting/PairsTrading Modified Files: PairsTradingMain.cs Log Message: Changed to reflect the new abstract methods arranged in BasicScriptForBacktesting Index: PairsTradingMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/PairsTradingMain.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PairsTradingMain.cs 10 Apr 2008 23:18:23 -0000 1.9 --- PairsTradingMain.cs 13 Apr 2008 17:01:28 -0000 1.10 *************** *** 29,32 **** --- 29,33 ---- using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.EquityEvaluation; + using QuantProject.Business.Strategies.InSample; using QuantProject.Business.Strategies.Logging; using QuantProject.Business.Strategies.Optimizing.Decoding; *************** *** 74,78 **** } ! protected override void setEligiblesSelector() { int maxNumberOfEligiblesToBeChosen = 100; --- 75,79 ---- } ! protected override IEligiblesSelector getEligiblesSelector() { int maxNumberOfEligiblesToBeChosen = 100; *************** *** 82,100 **** // tickersGroupId = "fastTest"; ! this.eligiblesSelector = new MostLiquidAndLessVolatile( tickersGroupId , maxNumberOfEligiblesToBeChosen ); ! this.eligiblesSelector = new ByPriceMostLiquidAlwaysQuoted( tickersGroupId , true , maxNumberOfEligiblesToBeChosen , ! 10 , 30 , 99999 ); } ! protected override void setInSampleChooser() { ! int numberOfBestTestingPositionsToBeReturned = 10; IDecoderForTestingPositions decoderForWeightedPositions = --- 83,102 ---- // tickersGroupId = "fastTest"; ! IEligiblesSelector eligiblesSelector = new MostLiquidAndLessVolatile( tickersGroupId , maxNumberOfEligiblesToBeChosen ); ! eligiblesSelector = new ByPriceMostLiquidAlwaysQuoted( tickersGroupId , true , maxNumberOfEligiblesToBeChosen , ! 10 , 20 , 75 ); ! return eligiblesSelector; } ! protected override IInSampleChooser getInSampleChooser() { ! int numberOfBestTestingPositionsToBeReturned = 50; IDecoderForTestingPositions decoderForWeightedPositions = *************** *** 113,117 **** int seedForRandomGenerator = QuantProject.ADT.ConstantsProvider.SeedForRandomGenerator; ! this.inSampleChooser = new PairsTradingGeneticChooser( numberOfBestTestingPositionsToBeReturned , --- 115,119 ---- int seedForRandomGenerator = QuantProject.ADT.ConstantsProvider.SeedForRandomGenerator; ! IInSampleChooser inSampleChooser = new PairsTradingGeneticChooser( numberOfBestTestingPositionsToBeReturned , *************** *** 124,135 **** seedForRandomGenerator ); ! this.inSampleChooser = new PairsTradingBruteForceChooser( numberOfBestTestingPositionsToBeReturned , decoderForWeightedPositions , fitnessEvaluator ); } ! protected override void setEndOfDayStrategy() { int inSampleDays = 180; --- 126,138 ---- seedForRandomGenerator ); ! inSampleChooser = new PairsTradingBruteForceChooser( numberOfBestTestingPositionsToBeReturned , decoderForWeightedPositions , fitnessEvaluator ); + return inSampleChooser; } ! protected override IEndOfDayStrategyForBacktester getEndOfDayStrategy() { int inSampleDays = 180; *************** *** 140,144 **** new OddIntervalsSelector( 1 , 1 , this.benchmark ); ! this.endOfDayStrategy = new PairsTradingStrategy( 7 , inSampleDays , intervalsSelector , --- 143,147 ---- new OddIntervalsSelector( 1 , 1 , this.benchmark ); ! IEndOfDayStrategyForBacktester endOfDayStrategyForBacktester = new PairsTradingStrategy( 7 , inSampleDays , intervalsSelector , *************** *** 146,152 **** this.historicalQuoteProviderForInSample , this.historicalQuoteProviderForChosingPositionsOutOfSample , ! 0.005 , 0.99 , 0.005 , 0.99 ); } ! protected override void setEndOfDayStrategyBackTester() { string backTestId = "PairsTrading"; --- 149,157 ---- this.historicalQuoteProviderForInSample , this.historicalQuoteProviderForChosingPositionsOutOfSample , ! 0.006 , 0.99 , 0.006 , 0.99 ); ! return endOfDayStrategyForBacktester; } ! protected override EndOfDayStrategyBackTester ! getEndOfDayStrategyBackTester() { string backTestId = "PairsTrading"; *************** *** 156,162 **** DateTime firstDateTime = new DateTime( 2001 , 1 , 1 ); DateTime lastDateTime = new DateTime( 2004 , 12 , 31 ); ! double maxRunningHours = 8; ! this.endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( backTestId , this.endOfDayStrategy , --- 161,167 ---- DateTime firstDateTime = new DateTime( 2001 , 1 , 1 ); DateTime lastDateTime = new DateTime( 2004 , 12 , 31 ); ! double maxRunningHours = 0.7; ! EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( backTestId , this.endOfDayStrategy , *************** *** 165,168 **** --- 170,174 ---- firstDateTime , lastDateTime , this.benchmark , cashToStart , maxRunningHours ); + return endOfDayStrategyBackTester; } |
|
From: Glauco S. <gla...@us...> - 2008-04-13 16:58:13
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/InSample/InSampleChoosers/BruteForce In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4363/b7_Scripts/WalkForwardTesting/PairsTrading/InSample/InSampleChoosers/BruteForce Modified Files: PairsTradingBruteForceOptimizableParametersManager.cs Log Message: The equivalence by fitness similarity has been disabled in this new revision. I'm not yet sure which the best solution is (in a clean database, there should probably never be two tickers refering to the same security) Index: PairsTradingBruteForceOptimizableParametersManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/InSample/InSampleChoosers/BruteForce/PairsTradingBruteForceOptimizableParametersManager.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PairsTradingBruteForceOptimizableParametersManager.cs 10 Apr 2008 23:16:31 -0000 1.2 --- PairsTradingBruteForceOptimizableParametersManager.cs 13 Apr 2008 16:58:09 -0000 1.3 *************** *** 98,102 **** // forBreakpoint = forBreakpoint + "a"; // } ! return areEquivalentAsTopBestParameters; } /// Two TestingPositions are considered equivalent as TopBestPositions --- 98,103 ---- // forBreakpoint = forBreakpoint + "a"; // } ! // return areEquivalentAsTopBestParameters; ! return false; } /// Two TestingPositions are considered equivalent as TopBestPositions |
|
From: Glauco S. <gla...@us...> - 2008-04-13 16:27:24
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/General In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17650/b7_Scripts/General Modified Files: BasicScriptForBacktesting.cs Log Message: Abstract methods have been changed from void returning to specific type returning. Doing so, the concrete deriving classes will be forced to really create the required objects. Now the compiler can help the developer to not forget any needed object Index: BasicScriptForBacktesting.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/General/BasicScriptForBacktesting.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BasicScriptForBacktesting.cs 1 Apr 2008 21:26:14 -0000 1.2 --- BasicScriptForBacktesting.cs 13 Apr 2008 16:27:20 -0000 1.3 *************** *** 98,108 **** protected abstract string getFullPathFileNameForMain(); ! protected abstract void setEligiblesSelector(); ! protected abstract void setInSampleChooser(); ! protected abstract void setEndOfDayStrategy(); ! protected abstract void setEndOfDayStrategyBackTester(); private void checkIfPathsAreFine( --- 98,108 ---- protected abstract string getFullPathFileNameForMain(); ! protected abstract IEligiblesSelector getEligiblesSelector(); ! protected abstract IInSampleChooser getInSampleChooser(); ! protected abstract IEndOfDayStrategyForBacktester getEndOfDayStrategy(); ! protected abstract EndOfDayStrategyBackTester getEndOfDayStrategyBackTester(); private void checkIfPathsAreFine( *************** *** 187,194 **** private void initializeObjectsForTheBacktest() { ! this.setEligiblesSelector(); ! this.setInSampleChooser(); ! this.setEndOfDayStrategy(); ! this.setEndOfDayStrategyBackTester(); } --- 187,194 ---- private void initializeObjectsForTheBacktest() { ! this.eligiblesSelector = this.getEligiblesSelector(); ! this.inSampleChooser = this.getInSampleChooser(); ! this.endOfDayStrategy = this.getEndOfDayStrategy(); ! this.endOfDayStrategyBackTester = this.getEndOfDayStrategyBackTester(); } |
|
From: Glauco S. <gla...@us...> - 2008-04-13 16:24:22
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16336/b4_Business Modified Files: b4_Business.csproj Log Message: a2_Strategies\EndOfDayStrategies\SymmetricEndOfDayStrategyForBacktester.cs has been added Index: b4_Business.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** b4_Business.csproj 8 Apr 2008 22:04:54 -0000 1.64 --- b4_Business.csproj 13 Apr 2008 16:24:16 -0000 1.65 *************** *** 730,733 **** --- 730,738 ---- /> <File + RelPath = "a2_Strategies\EndOfDayStrategies\SymmetricEndOfDayStrategyForBacktester.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a2_Strategies\EquityEvaluation\ExpectancyScore.cs" SubType = "Code" |