quantproject-developers Mailing List for QuantProject (Page 91)
Brought to you by:
glauco_1
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
(103) |
Dec
(67) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(52) |
Feb
(9) |
Mar
(69) |
Apr
(53) |
May
(80) |
Jun
(23) |
Jul
(24) |
Aug
(112) |
Sep
(9) |
Oct
|
Nov
(58) |
Dec
(93) |
| 2005 |
Jan
(90) |
Feb
(93) |
Mar
(61) |
Apr
(56) |
May
(37) |
Jun
(61) |
Jul
(55) |
Aug
(68) |
Sep
(25) |
Oct
(46) |
Nov
(41) |
Dec
(37) |
| 2006 |
Jan
(33) |
Feb
(7) |
Mar
(19) |
Apr
(27) |
May
(73) |
Jun
(49) |
Jul
(83) |
Aug
(66) |
Sep
(45) |
Oct
(16) |
Nov
(15) |
Dec
(7) |
| 2007 |
Jan
(14) |
Feb
(33) |
Mar
|
Apr
(21) |
May
|
Jun
(34) |
Jul
(18) |
Aug
(100) |
Sep
(39) |
Oct
(55) |
Nov
(12) |
Dec
(2) |
| 2008 |
Jan
(120) |
Feb
(133) |
Mar
(129) |
Apr
(104) |
May
(42) |
Jun
(2) |
Jul
(52) |
Aug
(99) |
Sep
(134) |
Oct
|
Nov
(137) |
Dec
(48) |
| 2009 |
Jan
(48) |
Feb
(55) |
Mar
(61) |
Apr
(3) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(51) |
Sep
|
Oct
(7) |
Nov
|
Dec
|
| 2010 |
Jan
(7) |
Feb
(1) |
Mar
(145) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(8) |
Dec
|
| 2011 |
Jan
(78) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(88) |
Sep
(6) |
Oct
(1) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Marco M. <mi...@us...> - 2006-05-14 08:59:18
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv23641/b3_Data Modified Files: Data.prjx Log Message: Updated sharpdevelop project's files Index: Data.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Data.prjx,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Data.prjx 8 Apr 2006 14:24:28 -0000 1.11 --- Data.prjx 14 May 2006 08:59:15 -0000 1.12 *************** *** 43,46 **** --- 43,47 ---- <File name=".\DataProviders\Caching\SimpleCache.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\Selectors\SelectorByQuotationNotAtEachMarketDay.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\MissingQuotesException.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References> |
|
From: Marco M. <mi...@us...> - 2006-05-14 08:38:21
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv15938/b7_Scripts Modified Files: Scripts.prjx Log Message: Updated sharpdevelop project's file Index: Scripts.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/Scripts.prjx,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Scripts.prjx 7 Jan 2006 11:04:20 -0000 1.18 --- Scripts.prjx 14 May 2006 08:38:16 -0000 1.19 *************** *** 86,89 **** --- 86,135 ---- <File name=".\TickerSelectionTesting\TestingOTCTypes\GenomeManagerForEfficientOTCTypes.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\TickerSelectionTesting\EndOfDayTimerHandlerOTCTest.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\EvaluatingOptimizationTechnique\EfficientPortfolio\RunTestingOptimizationCloseToOpen.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\LinearCombination\StrategyType.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\LinearCombination\CloseToOpenDailyStrategy.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\ArbitrageTesting\PairTrading\RunPairTrading.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\ArbitrageTesting\PairTrading\SimplePairTrading\EndOfDayTimerHandlerSimplePT.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\ArbitrageTesting\PairTrading\SimplePairTrading\GenomeManagerForSimplePT.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\ArbitrageTesting\PairTrading\SimplePairTrading\RunSimplePairTrading.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\ArbitrageTesting\PairTrading\PairTradingCandidate.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\ArbitrageTesting\PairTrading\SimplePairTrading\SimplePTGenomeManipulator.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\ArbitrageTesting\PairTrading\SimplePairTrading\GenomeMeaningSimplePT.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\ArbitrageTesting\PairTrading\SimplePairTrading\InSample\RunSimplePairTradingIS.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\EvaluatingOptimizationTechnique\EfficientPortfolio\RunTestingOptimizationOpenToCloseFitnessCombined.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\EvaluatingOptimizationTechnique\TechnicalAnalysis\RunTestingOptimizationExtremeCounterTrend.cs" subtype="Code" buildaction="Nothing" dependson="" data="" /> + <File name=".\TechnicalAnalysisTesting\Oscillators\FixedPeriodOscillators\RunFPOscillatorCTC.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\TechnicalAnalysisTesting\Oscillators\FixedPeriodOscillators\EndOfDayTimerHandlerFPOscillatorCTC.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\WalkForwardLag\RunWalkForwardLag.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\WalkForwardLag\WFLagSignedTickers.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\WalkForwardLag\WFLagCandidates.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\WalkForwardLag\WFLagChosenTickers.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\WalkForwardLag\WFLagEligibleTickers.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\WalkForwardLag\WFLagEndOfDayTimerHandler.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\WalkForwardLag\WFLagGenomeManager.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagLog.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagDebugPositions\WFLagDebugPositions.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\TechnicalAnalysisTesting\Oscillators\FixedPeriodOscillators\GenomeManagerForFPOscillatorCTC.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\TechnicalAnalysisTesting" subtype="Directory" buildaction="Compile" dependson="" data="" /> + <File name=".\TechnicalAnalysisTesting\Oscillators" subtype="Directory" buildaction="Compile" dependson="" data="" /> + <File name=".\TechnicalAnalysisTesting\Oscillators\FixedPeriodOscillators" subtype="Directory" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagRunDebugger.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagChosenPositions.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagReportDebugger.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagDebugPositions\WFLagDebugPositionsEndOfDayTimerHandler.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\WalkForwardLag\WFLagNewChosenTickersEventArgs.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\WalkForwardLag\WFLagMain.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\ArbitrageTesting\PairTrading\SimplePairTrading\InSample\OutputDisplayer.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\ArbitrageTesting\PairTrading\SimplePairTrading\InSample\EndOfDayTimerHandlerSimplePTIS.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\ArbitrageTesting\PairTrading\SimplePairTrading\InSample\GenomeRepresentation.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\ArbitrageTesting\PairTrading\SimplePairTrading\InSample\OptimizationOutput.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\QuantProject.Scripts.ArbitrageTesting.PairTrading.SimplePairTrading.InSample.OutputDisplayer.resources" subtype="Code" buildaction="EmbedAsResource" dependson="" data="" /> + <File name=".\TechnicalAnalysisTesting\Oscillators\ExtremeCounterTrend" subtype="Directory" buildaction="Compile" dependson="" data="" /> + <File name=".\TechnicalAnalysisTesting\Oscillators\ExtremeCounterTrend\RunExtremeCounterTrend.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\TechnicalAnalysisTesting\Oscillators\ExtremeCounterTrend\EndOfDayTimerHandlerECT.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\TechnicalAnalysisTesting\Oscillators\ExtremeCounterTrend\GenomeManagerECT.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\LinearCombination\ExtremeCounterTrendStrategy.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\WalkForwardTesting\LinearCombination\FixedPeriodOscillatorStrategy.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\QuantProject.Scripts.WalkForwardTesting.LinearCombination.TestDisplayer.resources" subtype="Code" buildaction="EmbedAsResource" dependson="" data="" /> </Contents> <References> |
|
From: Marco M. <mi...@us...> - 2006-05-14 08:22:37
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv10100/Downloader Modified Files: QuantDownloader.prjx Log Message: Updated sharpdevelop project's file Index: QuantDownloader.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/QuantDownloader.prjx,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** QuantDownloader.prjx 14 Apr 2005 18:40:04 -0000 1.3 --- QuantDownloader.prjx 14 May 2006 08:22:32 -0000 1.4 *************** *** 37,41 **** <File name=".\app.config" subtype="Code" buildaction="Nothing" dependson="" data="" /> <File name=".\App.ico" subtype="Code" buildaction="Nothing" dependson="" data="" /> - <File name=".\QuantProject.Applications.Downloader.TickerSelectors.TickerSelectorForm.resources" subtype="Code" buildaction="EmbedAsResource" dependson="" data="" /> </Contents> <References> --- 37,40 ---- |
|
From: Marco M. <mi...@us...> - 2006-05-09 15:50:44
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/EvaluatingOptimizationTechnique/EfficientPortfolio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13497/b7_Scripts/EvaluatingOptimizationTechnique/EfficientPortfolio Added Files: RunTestingOptimizationOpenToCloseFitnessCombined.cs Log Message: Added test for the optimization of the open to close strategy using a combined fitness --- NEW FILE: RunTestingOptimizationOpenToCloseFitnessCombined.cs --- /* QuantProject - Quantitative Finance Library RunTestingOptimizationOpenToCloseFitnessCombined.cs Copyright (C) 2003 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.Data; using System.IO; using QuantProject.ADT; using QuantProject.ADT.Optimizing.Genetic; using QuantProject.Data.Selectors; using QuantProject.Data.DataTables; using QuantProject.ADT.Statistics; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; namespace QuantProject.Scripts.EvaluatingOptimizationTechnique.EfficientPortfolio { /// <summary> /// For the evaluation of the optimization technique used by the script /// for the efficient open to close portfolio /// </summary> [Serializable] public class RunTestingOptimizationOpenToCloseFitnessCombined { private double[] fitnessesInSample; private double[] fitnessesOutOfSample; private string tickerGroupID; private int numberOfEligibleTickers; private int numberOfTickersToBeChosen; private int numDaysForOptimization; private int populationSizeForGeneticOptimizer; private int generationNumberForGeneticOptimizer; private string benchmark; private DateTime marketDate; private double targetReturn; private PortfolioType portfolioType; private int numDaysAfterLastOptimizationDay; private int numberOfSubsets; private Genome[] genomesToTestOutOfSample; private int numberOfGenomesToTest; public RunTestingOptimizationOpenToCloseFitnessCombined(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForOptimization, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, DateTime marketDate, double targetReturn, PortfolioType portfolioType, int numDaysAfterLastOptimizationDay, int numberOfSubsets, int numberOfGenomesToTest) { this.numberOfGenomesToTest = numberOfGenomesToTest; this.genomesToTestOutOfSample = new Genome[numberOfGenomesToTest]; this.fitnessesInSample = new double[numberOfGenomesToTest]; this.fitnessesOutOfSample = new double[numberOfGenomesToTest]; this.tickerGroupID = tickerGroupID; this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; this.numDaysForOptimization = numDaysForOptimization; this.populationSizeForGeneticOptimizer = populationSizeForGeneticOptimizer; this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; this.benchmark = benchmark; this.marketDate = marketDate; this.targetReturn = targetReturn; this.portfolioType = portfolioType; this.numDaysAfterLastOptimizationDay = numDaysAfterLastOptimizationDay; this.numberOfSubsets = numberOfSubsets; } private DataTable getSetOfTickersToBeOptimized(DateTime date) { /* SelectorByAverageRawOpenPrice selectorByOpenPrice = new SelectorByAverageRawOpenPrice(this.tickerGroupID, false, currentDate.AddDays(-this.numDaysForOptimization), currentDate, this.numberOfEligibleTickers, this.minPriceForMinimumCommission, this.maxPriceForMinimumCommission, 0, 2); DataTable tickersByPrice = selectorByOpenPrice.GetTableOfSelectedTickers(); */ SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, date); SelectorByOpenCloseCorrelationToBenchmark lessCorrelatedFromTemporizedGroup = new SelectorByOpenCloseCorrelationToBenchmark(temporizedGroup.GetTableOfSelectedTickers(), this.benchmark,true, date.AddDays(-this.numDaysForOptimization ), date, this.numberOfEligibleTickers); DataTable eligibleTickers; eligibleTickers = lessCorrelatedFromTemporizedGroup.GetTableOfSelectedTickers(); //eligibleTickers = temporizedGroup.GetTableOfSelectedTickers(); SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromEligible = new SelectorByQuotationAtEachMarketDay( eligibleTickers, false, date.AddDays(-this.numDaysForOptimization), date, this.numberOfEligibleTickers, this.benchmark); //SelectorByWinningOpenToClose winners = //new SelectorByWinningOpenToClose(quotedAtEachMarketDayFromEligible.GetTableOfSelectedTickers(), // false, date.AddDays(-1), // date.AddDays(-1), this.numberOfEligibleTickers/2, // true); //return winners.GetTableOfSelectedTickers(); return quotedAtEachMarketDayFromEligible.GetTableOfSelectedTickers(); //return lessCorrelated.GetTableOfSelectedTickers(); } private double setFitnesses_setFitnessesActually_getFitnessOutOfSample(Genome genome) { double returnValue = 0; foreach(string tickerCode in ((GenomeMeaning)genome.Meaning).Tickers) { double coefficient = 1.0; string ticker = tickerCode; if(ticker.StartsWith("-")) { ticker = ticker.Substring(1,ticker.Length -1); coefficient = -1.0; } DateTime dateOutOfSample = this.marketDate.AddDays(this.numDaysAfterLastOptimizationDay); //returnValue is the single return for the numDaysAfterLastOptimizationDay - th day //after the given market date //Quotes tickerQuotes = new Quotes(ticker, dateOutOfSample, // dateOutOfSample); //returnValue += // (tickerQuotes.GetFirstValidRawClose(dateOutOfSample)/ // tickerQuotes.GetFirstValidRawOpen(dateOutOfSample) - 1.0)*coefficient; //returnValue is the average return for the interval between //the given market date and the numDaysAfterLastOptimizationDay - th //day after the given market date //Quotes tickerQuotes = new Quotes(ticker, this.marketDate, // dateOutOfSample); //double close, open; //for(int i = 0; i<this.numDaysAfterLastOptimizationDay; i++) //{ //close = tickerQuotes.GetFirstValidRawClose(this.marketDate.AddDays(i)); //open = tickerQuotes.GetFirstValidRawOpen(this.marketDate.AddDays(i)); //returnValue += //(close/open - 1.0)*coefficient/this.numDaysAfterLastOptimizationDay; //} //returnValue is the sharpe ratio for the interval between //the given market date and the numDaysAfterLastOptimizationDay - th //day after the given market date Quotes tickerQuotes = new Quotes(ticker, this.marketDate, dateOutOfSample); double close, open; double[] returns = new double[this.numDaysAfterLastOptimizationDay]; for(int i = 0; i<this.numDaysAfterLastOptimizationDay; i++) { close = tickerQuotes.GetFirstValidRawClose(this.marketDate.AddDays(i)); open = tickerQuotes.GetFirstValidRawOpen(this.marketDate.AddDays(i)); returns[i] = (close/open - 1.0)*coefficient; } returnValue += BasicFunctions.SimpleAverage(returns) / BasicFunctions.StdDev(returns); } return returnValue/genome.Size; } private bool setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample_addGenomes_sharesNoGeneWithGenomesAlreadyAdded(Genome genomeToBeAdded, bool addWorstGenomes) { bool returnValue = true; if(addWorstGenomes) //the first half containing the worst genomes has to be checked { for(int i = 0; i<this.numberOfGenomesToTest/2; i++) { if(this.genomesToTestOutOfSample[i]==null) return true; if(!genomeToBeAdded.SharesNoGeneWith(this.genomesToTestOutOfSample[i])) return false; } } else //the second half containing the best genomes has to be checked { for(int i = 0; i<this.numberOfGenomesToTest/2; i++) { if(this.genomesToTestOutOfSample[this.numberOfGenomesToTest-1-i]==null) return true; if(!genomeToBeAdded.SharesNoGeneWith(this.genomesToTestOutOfSample[this.numberOfGenomesToTest-1-i])) return false; } } return returnValue; } private void setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample_addGenomes(GeneticOptimizer optimizer, bool addWorstGenomes) { Genome currentGenome; Genome previousGenome = null; int numOfDifferentGenomesFound = 0; for(int j = 0; j<this.populationSizeForGeneticOptimizer && numOfDifferentGenomesFound<this.numberOfGenomesToTest/2; j++) { if(addWorstGenomes == true) currentGenome = (Genome)optimizer.CurrentGeneration[j]; else currentGenome = (Genome)optimizer.CurrentGeneration[this.populationSizeForGeneticOptimizer-j-1]; if(this.setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample_addGenomes_sharesNoGeneWithGenomesAlreadyAdded(currentGenome, addWorstGenomes)) //no genes of the current genome are present in the relative half { if(this.genomesToTestOutOfSample[numOfDifferentGenomesFound]!= null) //the first half of the array has already been filled this.genomesToTestOutOfSample[this.numberOfGenomesToTest-1-numOfDifferentGenomesFound]=currentGenome; else//the first half is still empty this.genomesToTestOutOfSample[numOfDifferentGenomesFound] = currentGenome; previousGenome = currentGenome; numOfDifferentGenomesFound++; } } } private void setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample(IGenomeManager genomeManager) { GeneticOptimizer optimizer = new GeneticOptimizer(genomeManager, this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, ConstantsProvider.SeedForRandomGenerator); optimizer.Run(false); this.setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample_addGenomes(optimizer, true); this.setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample_addGenomes(optimizer, false); Array.Sort(this.genomesToTestOutOfSample); } private void setFitnesses_setFitnessesActually(IGenomeManager genomeManager) { this.setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample(genomeManager); for(int i = 0; i<this.numberOfGenomesToTest; i++) { this.fitnessesInSample[i]=(this.genomesToTestOutOfSample[i]).Fitness; this.fitnessesOutOfSample[i]= this.setFitnesses_setFitnessesActually_getFitnessOutOfSample(this.genomesToTestOutOfSample[i]); } } private void setFitnesses() { DataTable setOfTickersToBeOptimized = this.getSetOfTickersToBeOptimized(this.marketDate); IGenomeManager genManEfficientOTCTypes = new GenomeManagerForEfficientOTCTypes(setOfTickersToBeOptimized, this.marketDate.AddDays(-this.numDaysForOptimization), this.marketDate, this.numberOfTickersToBeChosen, this.targetReturn, this.portfolioType); this.setFitnesses_setFitnessesActually(genManEfficientOTCTypes); } public void Run() { try { this.setFitnesses(); OptimizationTechniqueEvaluator evaluator = new OptimizationTechniqueEvaluator(this.fitnessesInSample, this.fitnessesOutOfSample); this.run_writeToLogFile(evaluator); } catch(Exception ex) { ex = ex; } } private void run_writeToLogFile(OptimizationTechniqueEvaluator evaluator) { double[] averagesInSample = evaluator.GetAveragesOfSubsetsInSample(this.numberOfSubsets); double[] averagesOutOfSample = evaluator.GetAveragesOfSubsetsOutOfSample(this.numberOfSubsets); double r = evaluator.GetCorrelationBetweenFitnesses(); GenomeCounter genomeCounter = new GenomeCounter(this.genomesToTestOutOfSample); int differentEvaluatedGenomes = genomeCounter.TotalEvaluatedGenomes; string pathFile = System.Configuration.ConfigurationSettings.AppSettings["GenericArchive"] + "\\OptimizationEvaluation.txt"; StreamWriter w = File.AppendText(pathFile); w.WriteLine ("\n----------------------------------------------\r\n"); w.Write("\r\nNew Test for Evaluation of Open To Close Optimization {0}\r", DateTime.Now.ToLongDateString()+ " " +DateTime.Now.ToLongTimeString()); w.Write("\r\nNum days for optimization {0}\r", this.numDaysForOptimization.ToString()); w.Write("\r\nOptimizing market date {0}\r", this.marketDate.ToLongDateString()); w.Write("\r\nMarket date for test out of sample (sharpe ratio as fitness OS){0}\r", this.marketDate.AddDays(this.numDaysAfterLastOptimizationDay).ToLongDateString()); w.Write("\r\nNumber of tickers: {0}\r", this.numberOfTickersToBeChosen.ToString()); w.WriteLine ("\n----------------------------------------------"); w.Write("\r\nFitnesses compared (sharpe r. OTC - sharpe r. CTO): {0}\r", this.fitnessesInSample.Length.ToString()); w.Write("\r\nDifferent evaluated genomes: {0}\r", differentEvaluatedGenomes.ToString()); w.Write("\r\nAverages of the {0} sub sets of fitnesses In Sample:\r", this.numberOfSubsets); // for(int i = 0; i<averagesInSample.Length; i++) w.WriteLine("\n{0}-->{1}", i.ToString(), averagesInSample[i].ToString()); w.WriteLine ("\n\n----------------------------------------------"); w.Write("\r\nAverages of the {0} sub sets of fitnesses Out of Sample:\r", this.numberOfSubsets); // for(int i = 0; i<averagesOutOfSample.Length; i++) w.WriteLine("\n{0}-->{1}", i.ToString(), averagesOutOfSample[i].ToString()); w.WriteLine ("\n\n----------------------------------------------"); // w.Write("\r\nCorrelation coefficient between fitnesses: {0}\r", r.ToString()); w.WriteLine ("\n-----------------End of Test------------------\r\n"); // Update the underlying file. w.Flush(); w.Close(); } } } |
|
From: Marco M. <mi...@us...> - 2006-05-09 15:48:00
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedPeriodOscillators In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11415/FixedPeriodOscillators Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedPeriodOscillators added to the repository |
|
From: Marco M. <mi...@us...> - 2006-05-09 15:47:49
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/ExtremeCounterTrend In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11336/ExtremeCounterTrend Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/ExtremeCounterTrend added to the repository |
|
From: Marco M. <mi...@us...> - 2006-05-09 15:46:56
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10736/Oscillators Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators added to the repository |
|
From: Marco M. <mi...@us...> - 2006-05-09 15:46:46
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10675/TechnicalAnalysisTesting Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting added to the repository |
|
From: Marco M. <mi...@us...> - 2006-05-09 15:46:10
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/PairTrading/SimplePairTrading/InSample In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10513/InSample Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/PairTrading/SimplePairTrading/InSample added to the repository |
|
From: Marco M. <mi...@us...> - 2006-05-09 15:46:04
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/PairTrading/SimplePairTrading In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10198/SimplePairTrading Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/PairTrading/SimplePairTrading added to the repository |
|
From: Marco M. <mi...@us...> - 2006-05-09 15:45:33
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/PairTrading In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10032/PairTrading Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting/PairTrading added to the repository |
|
From: Marco M. <mi...@us...> - 2006-05-09 15:45:03
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9505/ArbitrageTesting Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/ArbitrageTesting added to the repository |
|
From: Marco M. <mi...@us...> - 2006-05-09 15:38:28
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5348/b7_Scripts/WalkForwardTesting/LinearCombination Modified Files: StrategyType.cs Log Message: Added FixedPeriodOscillator and ExtremeCounterTrend strategies. Index: StrategyType.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/StrategyType.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StrategyType.cs 8 Jan 2006 23:33:52 -0000 1.1 --- StrategyType.cs 9 May 2006 15:38:22 -0000 1.2 *************** *** 32,36 **** OpenToCloseDaily, OpenToCloseWeekly, ! CloseToOpenDaily } } --- 32,38 ---- OpenToCloseDaily, OpenToCloseWeekly, ! CloseToOpenDaily, ! FixedPeriodOscillator, ! ExtremeCounterTrend } } |
|
From: Marco M. <mi...@us...> - 2006-05-07 22:15:26
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23425 Modified Files: GeneticOptimizer.cs Log Message: Fixed minor bugs: - now the best genome of the previous generation is inherited automatically by the next generation (even when elitism rate is set to 0); - best and worst genomes are now always clones (also at the first population's creation). Index: GeneticOptimizer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/GeneticOptimizer.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** GeneticOptimizer.cs 8 Nov 2005 18:32:25 -0000 1.13 --- GeneticOptimizer.cs 7 May 2006 22:15:22 -0000 1.14 *************** *** 412,416 **** for(int i = populationSize - 1; ! i >=(populationSize - this.elitismRate*this.populationSize); i--) { --- 412,416 ---- for(int i = populationSize - 1; ! i >=(populationSize - this.elitismRate*this.populationSize - 1); i--) { *************** *** 521,526 **** private void setInitialBestAndWorstGenomes() { ! this.bestGenome = (Genome)this.currentGeneration[this.populationSize-1]; ! this.worstGenome = (Genome)this.currentGeneration[0]; } --- 521,526 ---- private void setInitialBestAndWorstGenomes() { ! this.bestGenome = ((Genome)this.currentGeneration[this.populationSize-1]).Clone(); ! this.worstGenome = ((Genome)this.currentGeneration[0]).Clone(); } |
|
From: Marco M. <mi...@us...> - 2006-04-30 14:51:24
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8020/b4_Business/a05_Timing Modified Files: IndexBasedEndOfDayTimer.cs Log Message: Added CurrentDateArrayPosition property, in order to know the array's position of the timer's current date. Index: IndexBasedEndOfDayTimer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing/IndexBasedEndOfDayTimer.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** IndexBasedEndOfDayTimer.cs 20 Dec 2005 19:35:53 -0000 1.6 --- IndexBasedEndOfDayTimer.cs 30 Apr 2006 14:51:15 -0000 1.7 *************** *** 22,25 **** --- 22,26 ---- using System; using System.Collections; + using System.Data; using QuantProject.Data.DataTables; *************** *** 40,46 **** get { return this.marketIndex; } } private Quotes indexQuotes; ! public IndexBasedEndOfDayTimer( EndOfDayDateTime startDateTime, string marketIndex): base(startDateTime) { --- 41,58 ---- get { return this.marketIndex; } } + private Quotes indexQuotes; + public Quotes IndexQuotes + { + get { return this.indexQuotes; } + } + + private int currentDateArrayPosition; + public int CurrentDateArrayPosition + { + get { return this.currentDateArrayPosition ; } + } ! public IndexBasedEndOfDayTimer( EndOfDayDateTime startDateTime, string marketIndex): base(startDateTime) { *************** *** 57,60 **** --- 69,73 ---- EndOfDaySpecificTime.MarketOpen); this.tickers = new Hashtable(); + this.currentDateArrayPosition = 0; } *************** *** 81,86 **** --- 94,101 ---- this.currentTime.DateTime = this.indexQuotes.GetFollowingDate(this.currentTime.DateTime, 1); + this.currentDateArrayPosition++; } this.currentTime.EndOfDaySpecificTime = nextSpecificTime; + } /// <summary> |
|
From: Glauco S. <gla...@us...> - 2006-04-08 18:42:37
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26008/b7_Scripts/WalkForwardTesting/WalkForwardLag Modified Files: WFLagMain.cs Log Message: Minor change: the class' summary has been added. Index: WFLagMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WFLagMain.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WFLagMain.cs 8 Apr 2006 18:09:40 -0000 1.1 --- WFLagMain.cs 8 Apr 2006 18:42:29 -0000 1.2 *************** *** 32,36 **** { /// <summary> ! /// Summary description for WFLagMain. /// </summary> public class WFLagMain : System.Windows.Forms.Form --- 32,38 ---- { /// <summary> ! /// Main form to test the walk forward lag strategy: you ! /// can chose either to backtest the strategy or to ! /// debug a previous backtest /// </summary> public class WFLagMain : System.Windows.Forms.Form |
|
From: Glauco S. <gla...@us...> - 2006-04-08 18:40:54
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24820/b7_Scripts/WalkForwardTesting/WalkForwardLag Modified Files: WFLagEndOfDayTimerHandler.cs Log Message: The new event NewChosenTickersEventHandler has been added. Index: WFLagEndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WFLagEndOfDayTimerHandler.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WFLagEndOfDayTimerHandler.cs 14 Mar 2006 15:04:03 -0000 1.1 --- WFLagEndOfDayTimerHandler.cs 8 Apr 2006 18:40:50 -0000 1.2 *************** *** 34,37 **** --- 34,40 ---- namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardLag { + public delegate void NewChosenTickersEventHandler( + Object sender , WFLagNewChosenTickersEventArgs eventArgs ); + /// <summary> /// Implements OneHourAfterMarketCloseEventHandler *************** *** 60,63 **** --- 63,67 ---- public event InSampleNewProgressEventHandler InSampleNewProgress; + public event NewChosenTickersEventHandler NewChosenTickers; public WFLagEndOfDayTimerHandler( *************** *** 362,365 **** --- 366,371 ---- this.eligibleTickers.EligibleTickers.Rows.Count ); this.chosenTickers.SetSignedTickers( this.eligibleTickers ); + this.NewChosenTickers( this , + new WFLagNewChosenTickersEventArgs( this.chosenTickers ) ); this.lastOptimizationDate = this.now().DateTime; } |
|
From: Glauco S. <gla...@us...> - 2006-04-08 18:40:00
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23824/b7_Scripts/WalkForwardTesting/WalkForwardLag Modified Files: WFLagChosenTickers.cs Log Message: Two properties have been added: - FirstOptimizationDate - LastOptimizationDate Index: WFLagChosenTickers.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WFLagChosenTickers.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WFLagChosenTickers.cs 14 Mar 2006 15:02:10 -0000 1.1 --- WFLagChosenTickers.cs 8 Apr 2006 18:39:55 -0000 1.2 *************** *** 36,39 **** --- 36,40 ---- /// with respect to the lag strategy /// </summary> + [Serializable] public class WFLagChosenTickers : IProgressNotifier { *************** *** 50,53 **** --- 51,56 ---- private QPHashtable drivingPositions; private QPHashtable portfolioPositions; + private DateTime firstOptimizationDate; + private DateTime lastOptimizationDate; public QPHashtable DrivingPositions *************** *** 65,68 **** --- 68,85 ---- } } + public DateTime FirstOptimizationDate + { + get + { + return this.firstOptimizationDate; + } + } + public DateTime LastOptimizationDate + { + get + { + return this.lastOptimizationDate; + } + } public WFLagChosenTickers( int numberOfDrivingPositions , *************** *** 110,122 **** // this.setSignedTickers_clearPositions(); ! DateTime firstDate = this.endOfDayTimer.GetCurrentTime().DateTime.AddDays( -( this.inSampleDays - 1 ) ); WFLagGenomeManager genomeManager = new WFLagGenomeManager( eligibleTickers.EligibleTickers , ! firstDate , ! this.endOfDayTimer.GetCurrentTime().DateTime , this.numberOfDrivingPositions , this.numberOfPositionsToBeChosen ); --- 127,141 ---- // this.setSignedTickers_clearPositions(); ! this.firstOptimizationDate = this.endOfDayTimer.GetCurrentTime().DateTime.AddDays( -( this.inSampleDays - 1 ) ); + this.lastOptimizationDate = + this.endOfDayTimer.GetCurrentTime().DateTime; WFLagGenomeManager genomeManager = new WFLagGenomeManager( eligibleTickers.EligibleTickers , ! firstOptimizationDate , ! this.lastOptimizationDate , this.numberOfDrivingPositions , this.numberOfPositionsToBeChosen ); |
|
From: Glauco S. <gla...@us...> - 2006-04-08 18:38:36
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23091/b7_Scripts/WalkForwardTesting/WalkForwardLag Modified Files: WFLagCandidates.cs Log Message: Minor change: closeToCloseTickerReturns saves an useless element. Index: WFLagCandidates.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WFLagCandidates.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WFLagCandidates.cs 14 Mar 2006 15:01:23 -0000 1.1 --- WFLagCandidates.cs 8 Apr 2006 18:38:31 -0000 1.2 *************** *** 76,80 **** tickerQuotes , "quAdjustedClose"); float[] closeToCloseTickerReturns = ! new float[ tickerAdjustedCloses.Length ]; int i = 0; //index for ratesOfReturns array for( int idx = 0 ; idx < tickerAdjustedCloses.Length - 1 ; idx++ ) --- 76,80 ---- tickerQuotes , "quAdjustedClose"); float[] closeToCloseTickerReturns = ! new float[ tickerAdjustedCloses.Length - 1 ]; int i = 0; //index for ratesOfReturns array for( int idx = 0 ; idx < tickerAdjustedCloses.Length - 1 ; idx++ ) |
|
From: Glauco S. <gla...@us...> - 2006-04-08 18:35:43
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21254/b7_Scripts/WalkForwardTesting/WalkForwardLag Modified Files: RunWalkForwardLag.cs Log Message: A private WFLagLog object has been added and handled, to save a log for the backtest. Index: RunWalkForwardLag.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/RunWalkForwardLag.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RunWalkForwardLag.cs 14 Mar 2006 14:59:35 -0000 1.1 --- RunWalkForwardLag.cs 8 Apr 2006 18:35:36 -0000 1.2 *************** *** 29,33 **** --- 29,35 ---- using QuantProject.Business.Scripting; using QuantProject.Business.Timing; + using QuantProject.Presentation; using QuantProject.Presentation.Reporting.WindowsForm; + using QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WFLagDebugger; namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardLag *************** *** 58,61 **** --- 60,65 ---- private WFLagEndOfDayTimerHandler endOfDayTimerHandler; + private WFLagLog wFLagLog; + public event NewProgressEventHandler InSampleNewProgress; *************** *** 87,90 **** --- 91,97 ---- this.maxRunningHours = maxRunningHours; + this.wFLagLog = + new WFLagLog( this.numberDaysForInSampleOptimization , + this.benchmark ); } *************** *** 148,151 **** --- 155,159 ---- this.account.AddCash( 30000 ); } + #region oneHourAfterMarketCloseEventHandler private void oneHourAfterMarketCloseEventHandler_handleProgessBarForm( IEndOfDayTimer endOfDayTimer ) *************** *** 157,161 **** Console.WriteLine( progress ); } ! public void oneHourAfterMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { --- 165,211 ---- Console.WriteLine( progress ); } ! private string nowToString() ! { ! string returnValue = ! DateTime.Now.Year.ToString() + "_" + ! DateTime.Now.Month.ToString() + "_" + ! DateTime.Now.Day.ToString(); ! return returnValue; ! } ! private string getDefaultLogFileName() ! { ! string defaultFileName = ! nowToString() + "_" + ! "DrivingPositions_" + this.numberOfDrivingPositions + "_" + ! "DrivingPositions_" + this.numberOfPortfolioPositions + "_" + ! "From_" + this.nowToString() + "_" + ! "To_" + this.nowToString(); ! return defaultFileName; ! } ! private void saveLog() ! { ! this.wFLagLog.TransactionHistory = this.account.Transactions; ! string defaultFolderPath = ! "C:\\Documents and Settings\\Glauco\\Desktop\\reports\\WalkForwardLag"; ! VisualObjectArchiver visualObjectArchiver = ! new VisualObjectArchiver(); ! visualObjectArchiver.Save( this.wFLagLog , "qPWFLagLog" , ! this.getDefaultLogFileName() , defaultFolderPath ); ! } ! private void showReport( object sender ) ! { ! DateTime lastReportDateTime = this.lastDateTime; ! if ( ( ( IEndOfDayTimer )sender ).GetCurrentTime().DateTime < ! lastReportDateTime ) ! lastReportDateTime = ! ( ( IEndOfDayTimer )sender ).GetCurrentTime().DateTime; ! Report report = new Report( this.account , this.historicalQuoteProvider ); ! report.Create( "Walk Forward Lag" , 1 , ! new EndOfDayDateTime( lastReportDateTime , ! EndOfDaySpecificTime.OneHourAfterMarketClose ) , ! this.benchmark ); ! report.Show(); ! } ! private void oneHourAfterMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { *************** *** 171,184 **** // ObjectArchiver.Archive( this.account , // @"C:\Documents and Settings\Glauco\Desktop\reports\final.qP" ); ! DateTime lastReportDateTime = this.lastDateTime; ! if ( ( ( IEndOfDayTimer )sender ).GetCurrentTime().DateTime < ! lastReportDateTime ) ! lastReportDateTime = ! ( ( IEndOfDayTimer )sender ).GetCurrentTime().DateTime; ! Report report = new Report( this.account , this.historicalQuoteProvider ); ! report.Create( "Walk Forward Lag" , 1 , ! new EndOfDayDateTime( lastReportDateTime , ! EndOfDaySpecificTime.OneHourAfterMarketClose ) , ! this.benchmark ); // WFMultiOneRankReportDebugger wFMultiOneRankReportDebugger = // new WFMultiOneRankReportDebugger( this.numberOfPortfolioPositions , --- 221,226 ---- // ObjectArchiver.Archive( this.account , // @"C:\Documents and Settings\Glauco\Desktop\reports\final.qP" ); ! this.saveLog(); ! this.showReport( sender ); // WFMultiOneRankReportDebugger wFMultiOneRankReportDebugger = // new WFMultiOneRankReportDebugger( this.numberOfPortfolioPositions , *************** *** 187,191 **** // new MouseEventHandler( // wFMultiOneRankReportDebugger.MouseClickEventHandler ); - report.Show(); } else --- 229,232 ---- *************** *** 194,197 **** --- 235,247 ---- ( IEndOfDayTimer )sender ); } + #endregion + private void newChosenTickersEventHandler( object sender , + WFLagNewChosenTickersEventArgs eventArgs ) + { + WFLagChosenPositions wFLagChosenPositions = + new WFLagChosenPositions( eventArgs.WFLagChosenTickers , + this.endOfDayTimer.GetCurrentTime().DateTime ); + this.wFLagLog.Add( wFLagChosenPositions ); + } private void run_addEventHandlers() { *************** *** 207,212 **** new OneHourAfterMarketCloseEventHandler( this.oneHourAfterMarketCloseEventHandler ); } - public override void Run() { --- 257,264 ---- new OneHourAfterMarketCloseEventHandler( this.oneHourAfterMarketCloseEventHandler ); + this.endOfDayTimerHandler.NewChosenTickers += + new NewChosenTickersEventHandler( + this.newChosenTickersEventHandler ); } public override void Run() { |
|
From: Glauco S. <gla...@us...> - 2006-04-08 18:33:14
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19581/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: The following files have been added: - WalkForwardTesting\WalkForwardLag\WFLagMain.cs - WalkForwardTesting\WalkForwardLag\WFLagNewChosenTickersEventArgs.cs - WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagChosenPositions.cs - WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagLog.cs - WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagReportDebugger.cs - WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagRunDebugger.cs - WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagDebugPositions\WFLagDebugPositions.cs - WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagDebugPositions\WFLagDebugPositionsEndOfDayTimerHandler.cs Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** b7_Scripts.csproj 14 Mar 2006 15:06:46 -0000 1.50 --- b7_Scripts.csproj 8 Apr 2006 18:33:06 -0000 1.51 *************** *** 494,497 **** --- 494,512 ---- /> <File + RelPath = "WalkForwardTesting\WalkForwardLag\WFLagMain.cs" + SubType = "Form" + BuildAction = "Compile" + /> + <File + RelPath = "WalkForwardTesting\WalkForwardLag\WFLagMain.resx" + DependentUpon = "WFLagMain.cs" + BuildAction = "EmbeddedResource" + /> + <File + RelPath = "WalkForwardTesting\WalkForwardLag\WFLagNewChosenTickersEventArgs.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "WalkForwardTesting\WalkForwardLag\WFLagSignedTickers.cs" SubType = "Code" *************** *** 499,502 **** --- 514,547 ---- /> <File + RelPath = "WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagChosenPositions.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagLog.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagReportDebugger.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagRunDebugger.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagDebugPositions\WFLagDebugPositions.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "WalkForwardTesting\WalkForwardLag\WFLagDebugger\WFLagDebugPositions\WFLagDebugPositionsEndOfDayTimerHandler.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "WalkForwardTesting\WalkForwardMultiOneRank\RunWalkForwardMultiOneRank.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2006-04-08 18:30:27
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18031/b4_Business Modified Files: b4_Business.csproj Log Message: a2_Strategies\SignedTicker.cs has been added Index: b4_Business.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** b4_Business.csproj 20 Dec 2005 19:50:21 -0000 1.30 --- b4_Business.csproj 8 Apr 2006 18:30:22 -0000 1.31 *************** *** 588,591 **** --- 588,596 ---- /> <File + RelPath = "a2_Strategies\SignedTicker.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a2_Strategies\TradingSystem.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2006-04-08 18:25:15
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14465/b1_ADT Modified Files: AdvancedSortedList.cs Log Message: Minor change: added method's comment Index: AdvancedSortedList.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/AdvancedSortedList.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AdvancedSortedList.cs 26 May 2005 23:29:45 -0000 1.3 --- AdvancedSortedList.cs 8 Apr 2006 18:25:10 -0000 1.4 *************** *** 72,76 **** /// <summary> /// Returns the index for the given key. If the key is missing, it returns the ! /// index for the next previous element. /// </summary> /// <param name="key"></param> --- 72,76 ---- /// <summary> /// Returns the index for the given key. If the key is missing, it returns the ! /// index for the previous element. /// </summary> /// <param name="key"></param> *************** *** 92,95 **** --- 92,101 ---- return this.GetKey( this.IndexOfKeyOrPrevious( key ) ); } + /// <summary> + /// Returns the value for the given key. If the key is missing, + /// it returns the value for the previous existent key + /// </summary> + /// <param name="key"></param> + /// <returns></returns> public object GetByKeyOrPrevious( Object key ) { |
|
From: Glauco S. <gla...@us...> - 2006-04-08 18:18:51
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10452/b4_Business/a2_Strategies Added Files: SignedTicker.cs Log Message: String representation for possible positions. Several methods are provided (to be used to implement different strategies). --- NEW FILE: SignedTicker.cs --- /* QuantProject - Quantitative Finance Library SignedTicker.cs Copyright (C) 2003 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.Financial.Accounting; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Timing; namespace QuantProject.Business.Strategies { /// <summary> /// String representation for possible positions. /// Several methods are provided (to be used to implement /// different strategies). /// </summary> public class SignedTicker { private string ticker; private PositionType positionType; public string Ticker { get { return this.ticker; } } public PositionType PositionType { get { return this.positionType; } } public SignedTicker( string ticker , PositionType positionType ) { this.ticker = ticker; this.positionType = positionType; } public static string GetSignedTicker( Position position ) { string signedTicker = position.Instrument.Key; if ( position.Type == PositionType.Short ) signedTicker = "-" + signedTicker; return signedTicker; } public static string GetTicker( string signedTicker ) { string ticker = signedTicker; if ( signedTicker.StartsWith( "-" ) ) ticker = signedTicker.Substring( 1 ); return ticker; } public static bool IsShort( string signedTicker ) { return ( signedTicker.StartsWith( "-" ) ); } public static bool IsLong( string signedTicker ) { return ( !SignedTicker.IsShort( signedTicker ) ); } public static string GetOppositeSignedTicker( string signedTicker ) { string oppositeSignedTicker = ""; if ( SignedTicker.IsShort( signedTicker ) ) oppositeSignedTicker = SignedTicker.GetTicker( signedTicker ); if ( SignedTicker.IsLong( signedTicker ) ) oppositeSignedTicker = "-" + SignedTicker.GetTicker( signedTicker ); return oppositeSignedTicker; } public static OrderType GetMarketOrderType( string signedTicker ) { OrderType orderType = OrderType.MarketBuy; if ( SignedTicker.IsShort( signedTicker ) ) orderType = OrderType.MarketSellShort; return orderType; } public static double GetCloseToCloseDailyReturn( string signedTicker , DateTime today ) { string ticker = SignedTicker.GetTicker( signedTicker ); HistoricalAdjustedQuoteProvider historicalAdjustedQuoteProvider = new HistoricalAdjustedQuoteProvider(); double todayMarketValueAtClose = historicalAdjustedQuoteProvider.GetMarketValue( ticker , new EndOfDayDateTime( today , EndOfDaySpecificTime.MarketClose ) ); DateTime yesterday = today.AddDays( -1 ); EndOfDayDateTime yesterdayAtClose = new EndOfDayDateTime( yesterday , EndOfDaySpecificTime.MarketClose ); double yesterdayMarketValueAtClose = historicalAdjustedQuoteProvider.GetMarketValue( ticker , yesterdayAtClose ); double dalyReturnForLongPosition = ( todayMarketValueAtClose / yesterdayMarketValueAtClose ) - 1; double dailyReturn; if ( SignedTicker.IsShort( signedTicker ) ) // signedTicker represents a short position dailyReturn = - dalyReturnForLongPosition; else // signedTicker represents a long position dailyReturn = dalyReturnForLongPosition; return dailyReturn; } } } |
|
From: Glauco S. <gla...@us...> - 2006-04-08 18:16:17
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WFLagDebugger/WFLagDebugPositions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8689/b7_Scripts/WalkForwardTesting/WalkForwardLag/WFLagDebugger/WFLagDebugPositions Added Files: WFLagDebugPositionsEndOfDayTimerHandler.cs Log Message: Strategy to debug the log for the current positions --- NEW FILE: WFLagDebugPositionsEndOfDayTimerHandler.cs --- /* QuantProject - Quantitative Finance Library WFLagDebugPositionsEndOfDayTimerHandler.cs Copyright (C) 2003 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 System.Collections; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Strategies; using QuantProject.Business.Timing; namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardLag.WFLagDebugger { /// <summary> /// Strategy to debug the log for the current positions /// </summary> public class WFLagDebugPositionsEndOfDayTimerHandler { private Account account; private WFLagChosenPositions wFLagChosenPositions; public WFLagDebugPositionsEndOfDayTimerHandler( Account account , WFLagChosenPositions wFLagChosenPositions ) { this.account = account; this.wFLagChosenPositions = wFLagChosenPositions; } #region FiveMinutesBeforeMarketCloseEventHandler private double todayTotalGainForLinearCombination() { double todayTotalGain = 0; DateTime today = this.account.EndOfDayTimer.GetCurrentTime().DateTime; foreach ( string signedTicker in this.wFLagChosenPositions.DrivingPositions.Keys ) todayTotalGain += SignedTicker.GetCloseToCloseDailyReturn( signedTicker , today ); // todayTotalGain += totalGainForSignedTicker( signedTicker ); return todayTotalGain; } private bool isDrivingPositionsTodayValueHigherThanYesterday() { double todayTotalGain = this.todayTotalGainForLinearCombination(); return todayTotalGain > 0; } private string getFirstAccountPosition() { IEnumerator accountPositions = this.account.Portfolio.Values.GetEnumerator(); accountPositions.MoveNext(); Position firstPosition = (Position)accountPositions.Current; string firstAccountPosition = SignedTicker.GetSignedTicker( firstPosition ); return firstAccountPosition; } private bool isCurrentlyReversed() { string firstAccountPosition = this.getFirstAccountPosition(); bool isReversed = this.wFLagChosenPositions.PortfolioPositions.ContainsKey( SignedTicker.GetOppositeSignedTicker( firstAccountPosition ) ); return isReversed; } private bool fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeClosed() { bool returnValue = ( this.account.Portfolio.Count > 0 ) && ( ( this.isDrivingPositionsTodayValueHigherThanYesterday() && this.isCurrentlyReversed() ) || ( !this.isDrivingPositionsTodayValueHigherThanYesterday() && !this.isCurrentlyReversed() ) ); return returnValue; } private void fiveMinutesBeforeMarketCloseEventHandler_closePositions() { ArrayList tickers = new ArrayList(); foreach ( string ticker in this.account.Portfolio.Keys ) tickers.Add( ticker ); foreach ( string ticker in tickers ) this.account.ClosePosition( ticker ); } private bool fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeOpened() { bool returnValue = ( this.account.Portfolio.Count == 0 ); return returnValue; } private long getQuantity( string ticker ) { double accountValue = this.account.GetMarketValue(); double currentTickerAsk = this.account.DataStreamer.GetCurrentAsk( ticker ); double maxPositionValueForThisTicker = accountValue / this.wFLagChosenPositions.PortfolioPositions.Count; long quantity = Convert.ToInt64( Math.Floor( maxPositionValueForThisTicker / currentTickerAsk ) ); return quantity; } private void openPosition( string ticker , OrderType orderType ) { long quantity = this.getQuantity( ticker ); Order order = new Order( orderType , new Instrument( ticker ) , quantity ); this.account.AddOrder( order ); } private void fiveMinutesBeforeMarketCloseEventHandler_openThisPosition( string signedTicker ) { this.openPosition( SignedTicker.GetTicker( signedTicker ) , SignedTicker.GetMarketOrderType( signedTicker ) ); } private void fiveMinutesBeforeMarketCloseEventHandler_openOppositePosition( string signedTicker ) { this.fiveMinutesBeforeMarketCloseEventHandler_openThisPosition( SignedTicker.GetOppositeSignedTicker( signedTicker ) ); } private void fiveMinutesBeforeMarketCloseEventHandler_openPosition( string signedTicker ) { if ( this.isDrivingPositionsTodayValueHigherThanYesterday() ) fiveMinutesBeforeMarketCloseEventHandler_openThisPosition( signedTicker ); else fiveMinutesBeforeMarketCloseEventHandler_openOppositePosition( signedTicker ); } private void fiveMinutesBeforeMarketCloseEventHandler_openPositions() { // this.chosenTickers.SetTickers( this.bestPerformingTickers , this.account ); foreach ( string signedTicker in this.wFLagChosenPositions.PortfolioPositions.Keys ) this.fiveMinutesBeforeMarketCloseEventHandler_openPosition( signedTicker ); } public void FiveMinutesBeforeMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { if ( this.fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeClosed() ) this.fiveMinutesBeforeMarketCloseEventHandler_closePositions(); if ( this.fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeOpened() ) fiveMinutesBeforeMarketCloseEventHandler_openPositions(); } #endregion } } |