[Quantproject-developers] QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination FixedLevelO
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2008-01-14 23:07:10
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7110/b7_Scripts/WalkForwardTesting/LinearCombination Modified Files: FixedLevelOscBiasedOTC_PVONoThresholdsStrategy.cs FixedLevelOscillatorBiasedPVONoThresholdsStrategy.cs FixedLevelOscillatorBiasedPVOStrategy.cs FixedLevelOscillatorPVOStrategy.cs Log Message: Several changes applied to the classes implementing the Portfolio Value Oscillator strategy (the most important one relates to the use of ReturnsManager) Index: FixedLevelOscillatorBiasedPVOStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/FixedLevelOscillatorBiasedPVOStrategy.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FixedLevelOscillatorBiasedPVOStrategy.cs 29 Aug 2007 09:43:36 -0000 1.3 --- FixedLevelOscillatorBiasedPVOStrategy.cs 14 Jan 2008 23:07:06 -0000 1.4 *************** *** 28,31 **** --- 28,32 ---- using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Strategies; + using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Timing; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; *************** *** 53,60 **** double maxAcceptableCloseToCloseDrawdown, double minimumAcceptableGain): ! base("", 0, ! weightedPositionsToEvaluateOutOfSample[0].Count, 0, accountPVO, 0, 0, ! "", numOfDifferentGenomesToEvaluateOutOfSample, ! numDaysForOscillatingPeriod,1,1,1,1,1,false,false,0, PortfolioType.ShortAndLong,maxAcceptableCloseToCloseDrawdown, minimumAcceptableGain) --- 54,66 ---- double maxAcceptableCloseToCloseDrawdown, double minimumAcceptableGain): ! base("", 0, 0, 0, ! weightedPositionsToEvaluateOutOfSample[0].Count, 0, accountPVO, null, 0, 0, ! "^GSPC", numOfDifferentGenomesToEvaluateOutOfSample, ! false,0, ! 1.0, ! 1000.0, ! false, ! false, ! numDaysForOscillatingPeriod,numDaysForOscillatingPeriod,1,1,1,1,1,false,false,0, PortfolioType.ShortAndLong,maxAcceptableCloseToCloseDrawdown, minimumAcceptableGain) *************** *** 73,81 **** } ! protected override double getCurrentWeightedPositionsGainOrLoss(IndexBasedEndOfDayTimer timer, ! int indexForChosenWeightedPositions) { double returnValue = 999.0; ! if(timer.CurrentDateArrayPosition + 2 >= this.numDaysForOscillatingPeriod) //if there are sufficient data for computing currentChosenTickersValue //that's why the method has been overriden --- 79,89 ---- } ! protected override double getCurrentWeightedPositionsGainOrLoss( ! IndexBasedEndOfDayTimer timer, ! ReturnsManager returnsManager, ! int indexForChosenWeightedPositions) { double returnValue = 999.0; ! if(timer.CurrentDateArrayPosition - this.numDaysForOscillatingPeriod >= 0) //if there are sufficient data for computing currentChosenTickersValue //that's why the method has been overriden *************** *** 88,93 **** (DateTime)timer.IndexQuotes.Rows[timer.CurrentDateArrayPosition - 1]["quDate"]; returnValue = ! this.weightedPositionsToEvaluateOutOfSample[indexForChosenWeightedPositions].GetCloseToCloseReturn( ! lastMarketDay, today); } catch(MissingQuotesException ex) --- 96,101 ---- (DateTime)timer.IndexQuotes.Rows[timer.CurrentDateArrayPosition - 1]["quDate"]; returnValue = ! this.weightedPositionsToEvaluateOutOfSample[indexForChosenWeightedPositions].GetReturn( ! 0, returnsManager); } catch(MissingQuotesException ex) Index: FixedLevelOscBiasedOTC_PVONoThresholdsStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/FixedLevelOscBiasedOTC_PVONoThresholdsStrategy.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FixedLevelOscBiasedOTC_PVONoThresholdsStrategy.cs 29 Aug 2007 09:43:35 -0000 1.2 --- FixedLevelOscBiasedOTC_PVONoThresholdsStrategy.cs 14 Jan 2008 23:07:06 -0000 1.3 *************** *** 28,31 **** --- 28,32 ---- using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Strategies; + using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Timing; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; *************** *** 71,76 **** } ! protected override double getCurrentWeightedPositionsGainOrLoss(IndexBasedEndOfDayTimer timer, ! int indexForChosenWeightedPositions) { double returnValue = 999.0; --- 72,79 ---- } ! protected override double getCurrentWeightedPositionsGainOrLoss( ! IndexBasedEndOfDayTimer timer, ! ReturnsManager returnsManager, ! int indexForChosenWeightedPositions ) { double returnValue = 999.0; *************** *** 81,91 **** try { ! DateTime today = ! (DateTime)timer.IndexQuotes.Rows[timer.CurrentDateArrayPosition]["quDate"]; ! DateTime lastMarketDay = ! (DateTime)timer.IndexQuotes.Rows[timer.CurrentDateArrayPosition - 1]["quDate"]; ! ! returnValue = this.weightedPositionsToEvaluateOutOfSample[indexForChosenWeightedPositions].GetLastNightReturn( ! lastMarketDay, today); } catch(MissingQuotesException ex) --- 84,90 ---- try { ! returnValue = ! this.weightedPositionsToEvaluateOutOfSample[indexForChosenWeightedPositions].GetReturn( ! 0 , returnsManager); } catch(MissingQuotesException ex) Index: FixedLevelOscillatorPVOStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/FixedLevelOscillatorPVOStrategy.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FixedLevelOscillatorPVOStrategy.cs 30 Aug 2007 18:15:37 -0000 1.6 --- FixedLevelOscillatorPVOStrategy.cs 14 Jan 2008 23:07:06 -0000 1.7 *************** *** 52,56 **** "^GSPC", 0, 0, 0, 0, 0, 0, false, false, 0, ! PortfolioType.ShortAndLong, 0.5) { this.chosenWeightedPositions = chosenWeightedPositions; --- 52,56 ---- "^GSPC", 0, 0, 0, 0, 0, 0, false, false, 0, ! PortfolioType.ShortAndLong, 0.5, 0.5) { this.chosenWeightedPositions = chosenWeightedPositions; *************** *** 65,92 **** } ! protected override double getCurrentChosenWeightedPositionsValue(IndexBasedEndOfDayTimer timer) { double returnValue = 999.0; ! if(timer.CurrentDateArrayPosition + 2 >= this.numDaysForOscillatingPeriod) ! //if there are sufficient data for computing currentChosenTickersValue //that's why the method has been overriden ! { ! try ! { ! DateTime initialDate = ! (DateTime)timer.IndexQuotes.Rows[timer.CurrentDateArrayPosition - this.numDaysForOscillatingPeriod + 2]["quDate"]; ! //so to replicate exactly in sample scheme, where only numOscillatingDay - 1 returns ! //are computed ! DateTime finalDate = ! (DateTime)timer.IndexQuotes.Rows[timer.CurrentDateArrayPosition]["quDate"]; ! returnValue = ! this.chosenWeightedPositions.GetCloseToCloseReturn(initialDate,finalDate) ! + 1.0; ! } ! catch(Exception ex) ! { ! ex = ex; ! } ! } return returnValue; } --- 65,77 ---- } ! protected override double getCurrentChosenWeightedPositionsReturn(IndexBasedEndOfDayTimer timer) { double returnValue = 999.0; ! if(timer.CurrentDateArrayPosition - this.numDaysForOscillatingPeriod >= 0) ! //if there are sufficient data for computing currentChosenWeightedPositionsReturn //that's why the method has been overriden ! returnValue = ! base.getCurrentChosenWeightedPositionsReturn(timer); ! return returnValue; } Index: FixedLevelOscillatorBiasedPVONoThresholdsStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/FixedLevelOscillatorBiasedPVONoThresholdsStrategy.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FixedLevelOscillatorBiasedPVONoThresholdsStrategy.cs 29 Aug 2007 09:43:35 -0000 1.2 --- FixedLevelOscillatorBiasedPVONoThresholdsStrategy.cs 14 Jan 2008 23:07:06 -0000 1.3 *************** *** 28,31 **** --- 28,32 ---- using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Strategies; + using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Timing; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; *************** *** 66,71 **** } ! protected override double getCurrentWeightedPositionsGainOrLoss(IndexBasedEndOfDayTimer timer, ! int indexForChosenWeightedPositions) { double returnValue = 999.0; --- 67,74 ---- } ! protected override double getCurrentWeightedPositionsGainOrLoss( ! IndexBasedEndOfDayTimer timer, ! ReturnsManager returnsManager, ! int indexForChosenWeightedPositions) { double returnValue = 999.0; |