[Quantproject-developers] QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading PairsTradingMain
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2009-02-18 20:05:53
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8272/b7_Scripts/WalkForwardTesting/PairsTrading Modified Files: PairsTradingMain.cs Log Message: This revision adds a new pairs trading approach, but it's not complete yet. We commit it anyway in order to allow a fresh checkout on a new computer. Index: PairsTradingMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/PairsTradingMain.cs,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** PairsTradingMain.cs 31 Dec 2008 02:35:16 -0000 1.27 --- PairsTradingMain.cs 18 Feb 2009 20:05:34 -0000 1.28 *************** *** 88,92 **** // definition for the Fitness Evaluator ! // IEquityEvaluator equityEvaluator = new SharpeRatio(); } --- 88,92 ---- // definition for the Fitness Evaluator ! // IEquityEvaluator equityEvaluator = new SharpeRatio(); } *************** *** 104,112 **** { List< Time > dailyTimes = new List< Time >(); ! dailyTimes.Add( this.firstTimeToTestInefficiency ); ! dailyTimes.Add( this.lastTimeToTestInefficiency ); ! dailyTimes.Add( this.timeToClosePositions ); ! // dailyTimes.Add( new Time( ! // HistoricalEndOfDayTimer.GetOneHourAfterMarketClose( DateTime.Now ) ) ); return dailyTimes; } --- 104,116 ---- { List< Time > dailyTimes = new List< Time >(); ! Time time = new Time( 9 , 30 , 0 ); ! while ( time <= new Time( 16 , 0 , 0 ) ) ! { ! dailyTimes.Add( time ); ! time = time.AddMinutes( 1 ); ! } ! // dailyTimes.Add( this.firstTimeToTestInefficiency ); ! // dailyTimes.Add( this.lastTimeToTestInefficiency ); ! // dailyTimes.Add( this.timeToClosePositions ); return dailyTimes; } *************** *** 134,138 **** string tickersGroupId = "SP500"; // uncomment the following line for a faster script ! // tickersGroupId = "fastTest"; // IEligiblesSelector eligiblesSelector = --- 138,142 ---- string tickersGroupId = "SP500"; // uncomment the following line for a faster script ! tickersGroupId = "fastTest"; // IEligiblesSelector eligiblesSelector = *************** *** 140,149 **** // tickersGroupId , // maxNumberOfEligiblesToBeChosen ); ! IEligiblesSelector eligiblesSelector = ! new ByPriceMostLiquidAlwaysQuoted( ! tickersGroupId , ! true , ! maxNumberOfEligiblesToBeChosen , ! 10 , 20 , 75 ); eligiblesSelector = new ByPriceMostLiquidLessVolatileOTCAlwaysQuoted( --- 144,153 ---- // tickersGroupId , // maxNumberOfEligiblesToBeChosen ); ! // IEligiblesSelector eligiblesSelector = ! // new ByPriceMostLiquidAlwaysQuoted( ! // tickersGroupId , ! // true , ! // maxNumberOfEligiblesToBeChosen , ! // 10 , 20 , 75 ); eligiblesSelector = new ByPriceMostLiquidLessVolatileOTCAlwaysQuoted( *************** *** 154,158 **** 10 , 10 , 20 , 75 ); - // uncomment the following line for a (logbased) log based in sample chooser // eligiblesSelector = new DummyEligibleSelector(); --- 158,161 ---- *************** *** 165,169 **** int numberOfBestTestingPositionsToBeReturned = 50; // uncomment the following line for a faster script ! // numberOfBestTestingPositionsToBeReturned = 10; IDecoderForTestingPositions decoderForWeightedPositions = --- 168,172 ---- int numberOfBestTestingPositionsToBeReturned = 50; // uncomment the following line for a faster script ! numberOfBestTestingPositionsToBeReturned = 10; IDecoderForTestingPositions decoderForWeightedPositions = *************** *** 238,241 **** --- 241,247 ---- // new OutOfSampleChooserForExactNumberOfBestLongPositions( // 2 , 0.006 , 0.99 , 0.006 , 0.99 ); + outOfSampleChooser = + new OutOfSampleChooserForAlreadyClosing( + 0.01 , 0.03 , 0.01 , 0.03 , 4 ); IStrategyForBacktester strategyForBacktester = *************** *** 259,262 **** --- 265,277 ---- this.historicalMarketValueProviderForChosingPositionsOutOfSample , outOfSampleChooser ); + // qui!!! + // strategyForBacktester = + // new PairsTradingAfterClosingStrategy( + // 7 , inSampleDays , + // intervalsSelectorForInSample , + // eligiblesSelector , inSampleChooser , + // this.historicalMarketValueProviderForInSample , + // this.historicalMarketValueProviderForChosingPositionsOutOfSample , + // outOfSampleChooser ); return strategyForBacktester; } *************** *** 286,291 **** // uncomment the following two lines for a faster script firstDateTime = new DateTime( 2006 , 1 , 2 ); ! lastDateTime = new DateTime( 2007 , 12 , 31 ); ! // lastDateTime = new DateTime( 2006 , 1 , 31 ); double maxRunningHours = 2.5; --- 301,306 ---- // uncomment the following two lines for a faster script firstDateTime = new DateTime( 2006 , 1 , 2 ); ! // lastDateTime = new DateTime( 2007 , 12 , 31 ); ! lastDateTime = new DateTime( 2006 , 1 , 31 ); double maxRunningHours = 2.5; |