[Quantproject-developers] QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading PairsTradingMain
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2008-05-11 16:54:38
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25113/b7_Scripts/WalkForwardTesting/PairsTrading Modified Files: PairsTradingMain.cs Log Message: Added code in order to: - use two IIntervalsSelector(s): one to create intervals for in sample optimizations; one to create the intervals to be used by the strategy, out of sample - use an OTC-CTO in sample optimization (markte close to market open correlation is considered also); the code now is commented out: uncomment it if you want CTO optimization also Index: PairsTradingMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/PairsTradingMain.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PairsTradingMain.cs 3 May 2008 17:55:44 -0000 1.13 --- PairsTradingMain.cs 11 May 2008 16:54:33 -0000 1.14 *************** *** 69,73 **** new HistoricalAdjustedQuoteProvider(); this.historicalQuoteProviderForTheBacktesterAccount = ! this.historicalQuoteProviderForInSample; // definition for the Fitness Evaluator --- 69,73 ---- new HistoricalAdjustedQuoteProvider(); this.historicalQuoteProviderForTheBacktesterAccount = ! new HistoricalRawQuoteProvider(); // definition for the Fitness Evaluator *************** *** 93,100 **** maxNumberOfEligiblesToBeChosen , 10 , 20 , 75 ); // uncomment the following line for a (logbased) log based in sample chooser ! eligiblesSelector = new DummyEligibleSelector(); return eligiblesSelector; --- 93,107 ---- maxNumberOfEligiblesToBeChosen , 10 , 20 , 75 ); + eligiblesSelector = + new ByPriceMostLiquidLessVolatileOTCAlwaysQuoted( + tickersGroupId , + true , + maxNumberOfEligiblesToBeChosen , + maxNumberOfEligiblesToBeChosen + 50 , + 10 , 10 , 20 , 75 ); // uncomment the following line for a (logbased) log based in sample chooser ! // eligiblesSelector = new DummyEligibleSelector(); return eligiblesSelector; *************** *** 141,148 **** // uncomment the following line for a (logbased) log based in sample chooser ! inSampleChooser = ! new PairsTradingChooserFromSavedBackTestLog( ! @"C:\qpReports\pairsTrading\longOnly\2008_04_27_4_41_53_pairsTrdng2Long_from_2001_01_01_to_2004_12_31_annlRtrn_128.52_maxDD_25.70\2008_04_27_4_41_53_pairsTrdng_from_2001_01_01_to_2004_12_31_annlRtrn_128.52_maxDD_25.70.qpL", ! numberOfBestTestingPositionsToBeReturned); --- 148,155 ---- // uncomment the following line for a (logbased) log based in sample chooser ! // inSampleChooser = ! // new PairsTradingChooserFromSavedBackTestLog( ! // @"C:\qpReports\pairsTrading\longOnly\2008_04_27_4_41_53_pairsTrdng2Long_from_2001_01_01_to_2004_12_31_annlRtrn_128.52_maxDD_25.70\2008_04_27_4_41_53_pairsTrdng_from_2001_01_01_to_2004_12_31_annlRtrn_128.52_maxDD_25.70.qpL", ! // numberOfBestTestingPositionsToBeReturned); *************** *** 157,173 **** // inSampleDays = 60; ! IIntervalsSelector intervalsSelector = new OddIntervalsSelector( 1 , 1 , this.benchmark ); OutOfSampleChooser outOfSampleChooser = new OutOfSampleChooserForSingleLongAndShort( ! 0.006 , 0.99 , 0.006 , 0.99 ); ! outOfSampleChooser = ! new OutOfSampleChooserForExactNumberOfBestLongPositions( ! 2 , 0.006 , 0.99 , 0.006 , 0.99 ); IEndOfDayStrategyForBacktester endOfDayStrategyForBacktester = new PairsTradingStrategy( ! 7 , inSampleDays , intervalsSelector , eligiblesSelector , inSampleChooser , this.historicalQuoteProviderForInSample , --- 164,190 ---- // inSampleDays = 60; ! IIntervalsSelector intervalsSelectorForOutOfSample = new OddIntervalsSelector( 1 , 1 , this.benchmark ); + IIntervalsSelector intervalsSelectorForInSample = + intervalsSelectorForOutOfSample; + + // uncomment the following two statements in order to use an + // OTC-CTO in sample optimization (night is considered also) + // intervalsSelectorForInSample = + // new FixedLengthTwoPhasesIntervalsSelector( 1 , 1 , this.benchmark ); + // this.historicalQuoteProviderForInSample = + // new HistoricalAdjustedQuoteProvider(); OutOfSampleChooser outOfSampleChooser = new OutOfSampleChooserForSingleLongAndShort( ! 0.006 , 0.02 , 0.006 , 0.02 ); ! // outOfSampleChooser = ! // new OutOfSampleChooserForExactNumberOfBestLongPositions( ! // 2 , 0.006 , 0.99 , 0.006 , 0.99 ); IEndOfDayStrategyForBacktester endOfDayStrategyForBacktester = new PairsTradingStrategy( ! 7 , inSampleDays , ! intervalsSelectorForInSample , intervalsSelectorForOutOfSample , eligiblesSelector , inSampleChooser , this.historicalQuoteProviderForInSample , *************** *** 197,206 **** double cashToStart = 30000; ! DateTime firstDateTime = new DateTime( 2001 , 1 , 1 ); ! DateTime lastDateTime = new DateTime( 2004 , 12 , 31 ); // uncomment the following line for a faster script // lastDateTime = new DateTime( 2001 , 1 , 31 ); ! double maxRunningHours = 7; EndOfDayStrategyBackTester endOfDayStrategyBackTester = --- 214,223 ---- double cashToStart = 30000; ! DateTime firstDateTime = new DateTime( 2005 , 1 , 1 ); ! DateTime lastDateTime = new DateTime( 2008 , 4 , 30 ); // uncomment the following line for a faster script // lastDateTime = new DateTime( 2001 , 1 , 31 ); ! double maxRunningHours = 8; EndOfDayStrategyBackTester endOfDayStrategyBackTester = |