quantproject-developers Mailing List for QuantProject (Page 51)
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: Glauco S. <gla...@us...> - 2008-03-19 23:24:09
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13715/b7_Scripts/WalkForwardTesting/PairsTrading Modified Files: PairsTradingMain.cs Log Message: BasicScriptForBacktesting is inherited (and all abstract methods are implemented) Index: PairsTradingMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/PairsTradingMain.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PairsTradingMain.cs 13 Mar 2008 19:42:11 -0000 1.3 --- PairsTradingMain.cs 19 Mar 2008 23:24:02 -0000 1.4 *************** *** 37,40 **** --- 37,41 ---- using QuantProject.Business.Timing; using QuantProject.Presentation; + using QuantProject.Scripts.General; using QuantProject.Scripts.General.Logging; using QuantProject.Scripts.General.Reporting; *************** *** 48,119 **** /// be done /// </summary> ! public class PairsTradingMain { public PairsTradingMain() { ! } ! #region Run ! private MessageManager setMessageManager( ! IEligiblesSelector eligiblesSelector , ! IInSampleChooser inSampleChooser , ! IEndOfDayStrategyForBacktester endOfDayStrategy , ! EndOfDayStrategyBackTester endOfDayStrategyBackTester ) ! { ! string dateStamp = ! ExtendedDateTime.GetCompleteShortDescriptionForFileName( DateTime.Now ); ! MessageManager messageManager = ! new MessageManager( "NotificationMessagesForCurrentStrategy_" + ! dateStamp + ".Txt" ); ! messageManager.Monitor( eligiblesSelector ); ! messageManager.Monitor( inSampleChooser ); ! messageManager.Monitor( endOfDayStrategy ); ! messageManager.Monitor( endOfDayStrategyBackTester ); ! return messageManager; ! } ! ! private void saveLog( BackTestLog backTestLog , ! string suggestedLogFileName ) ! { ! string defaultFolderPath = ! "C:\\qpReports\\pairsTrading\\"; ! // this.wFLagLog.TransactionHistory = this.account.Transactions; ! LogArchiver.Save( backTestLog , ! suggestedLogFileName , defaultFolderPath ); ! } ! ! public void Run1() ! { ! BackTestLog backTestLog = LogArchiver.Load( "C:\\qpReports\\pairsTrading\\" ); ! LogViewer logViewer = ! new LogViewer( backTestLog ); ! logViewer.Show(); } ! public void Run() { - string backTestId = "PairsTrading"; - double cashToStart = 30000; - - int inSampleDays = 180; - string tickersGroupId = "SP500"; - - // uncomment the following two lines for faster scripts - // int inSampleDays = 5; - // string tickersGroupId = "fastTest"; - - Benchmark benchmark = new Benchmark( "BMC" ); int maxNumberOfEligiblesToBeChosen = 100; ! IDecoderForTestingPositions decoderForWeightedPositions ! = new DecoderForPairsTradingTestingPositionsWithBalancedWeights(); ! IHistoricalQuoteProvider historicalQuoteProvider = ! new HistoricalAdjustedQuoteProvider(); ! // definition for the Fitness Evaluator ! // IEquityEvaluator equityEvaluator = new SharpeRatio(); ! IFitnessEvaluator fitnessEvaluator = ! new PairsTradingFitnessEvaluator( 0.96 ); // parameters for the genetic optimizer double crossoverRate = 0.85; --- 49,84 ---- /// be done /// </summary> ! public class PairsTradingMain : BasicScriptForBacktesting { + private Benchmark benchmark; + private IHistoricalQuoteProvider historicalQuoteProvider; + public PairsTradingMain() { ! this.benchmark = new Benchmark( "BMC" ); + this.historicalQuoteProvider = + new HistoricalAdjustedQuoteProvider(); ! // definition for the Fitness Evaluator ! // IEquityEvaluator equityEvaluator = new SharpeRatio(); } ! protected override void setEligiblesSelector() { int maxNumberOfEligiblesToBeChosen = 100; ! ! string tickersGroupId = "SP500"; ! // uncomment the following line for a faster script ! tickersGroupId = "fastTest"; ! this.eligiblesSelector = ! new MostLiquidAndLessVolatile( ! tickersGroupId , ! maxNumberOfEligiblesToBeChosen ); ! } + protected override void setInSampleChooser() + { // parameters for the genetic optimizer double crossoverRate = 0.85; *************** *** 124,131 **** int seedForRandomGenerator = QuantProject.ADT.ConstantsProvider.SeedForRandomGenerator; ! IInSampleChooser inSampleChooser = new PairsTradingGeneticChooser( 10 , ! benchmark , decoderForWeightedPositions , fitnessEvaluator , historicalQuoteProvider , --- 89,104 ---- int seedForRandomGenerator = QuantProject.ADT.ConstantsProvider.SeedForRandomGenerator; ! ! IDecoderForTestingPositions decoderForWeightedPositions = ! new DecoderForPairsTradingTestingPositionsWithBalancedWeights(); ! ! double maxCorrelationAllowed = 0.96; ! IFitnessEvaluator fitnessEvaluator = ! new PairsTradingFitnessEvaluator( maxCorrelationAllowed ); ! ! this.inSampleChooser = new PairsTradingGeneticChooser( 10 , ! this.benchmark , decoderForWeightedPositions , fitnessEvaluator , historicalQuoteProvider , *************** *** 133,179 **** populationSizeForGeneticOptimizer , generationNumberForGeneticOptimizer , seedForRandomGenerator ); ! // IIntervalsSelector intervalsSelector = ! // new FixedLengthTwoPhasesIntervalsSelector( ! // 1 , 1 , benchmark ); IIntervalsSelector intervalsSelector = ! new OddIntervalsSelector( 1 , 1 , benchmark ); ! IEligiblesSelector eligiblesSelector = ! new MostLiquidAndLessVolatile( ! tickersGroupId , maxNumberOfEligiblesToBeChosen ); ! PairsTradingStrategy pairsTradingStrategy = new PairsTradingStrategy( 7 , inSampleDays , intervalsSelector , eligiblesSelector , inSampleChooser , historicalQuoteProvider , 0.007 , 0.99 , 0.007 , 0.99 ); ! IAccountProvider accountProvider = new SimpleAccountProvider(); DateTime firstDateTime = new DateTime( 2001 , 1 , 1 ); ! DateTime lastDateTime = new DateTime( 2001 , 1 , 12 ); double maxRunningHours = 6; ! EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! backTestId , pairsTradingStrategy , historicalQuoteProvider , accountProvider , ! firstDateTime , lastDateTime , benchmark , cashToStart , maxRunningHours ); ! // TO DO check if you can do this assign in the EndOfDayStrategyBackTester ! // constructor ! pairsTradingStrategy.Account = endOfDayStrategyBackTester.Account; ! MessageManager messageManager = this.setMessageManager( ! eligiblesSelector , inSampleChooser , ! pairsTradingStrategy , endOfDayStrategyBackTester ); ! endOfDayStrategyBackTester.Run(); ! BackTesterReportViewer.ShowReport( lastDateTime , ! endOfDayStrategyBackTester ); ! this.saveLog( ! endOfDayStrategyBackTester.Log , ! endOfDayStrategyBackTester.Description ); } ! #endregion Run } } --- 106,162 ---- populationSizeForGeneticOptimizer , generationNumberForGeneticOptimizer , seedForRandomGenerator ); + } ! protected override void setEndOfDayStrategy() ! { ! int inSampleDays = 180; ! // uncomment the following line for a faster script ! inSampleDays = 5; ! IIntervalsSelector intervalsSelector = ! new OddIntervalsSelector( 1 , 1 , this.benchmark ); ! this.endOfDayStrategy = new PairsTradingStrategy( 7 , inSampleDays , intervalsSelector , eligiblesSelector , inSampleChooser , historicalQuoteProvider , 0.007 , 0.99 , 0.007 , 0.99 ); ! } ! protected override void setEndOfDayStrategyBackTester() ! { ! string backTestId = "PairsTrading"; IAccountProvider accountProvider = new SimpleAccountProvider(); + double cashToStart = 30000; DateTime firstDateTime = new DateTime( 2001 , 1 , 1 ); ! DateTime lastDateTime = new DateTime( 2001 , 1 , 6 ); double maxRunningHours = 6; ! ! this.endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! backTestId , this.endOfDayStrategy , historicalQuoteProvider , accountProvider , ! firstDateTime , lastDateTime , ! this.benchmark , cashToStart , maxRunningHours ); ! } ! protected override string getPathForTheMainFolderWhereScriptsResultsAreToBeSaved() ! { ! string pathForTheMainFolderWhereScriptsResultsAreToBeSaved = ! "C:\\qpReports\\pairsTrading\\"; ! return pathForTheMainFolderWhereScriptsResultsAreToBeSaved; ! } ! protected override string getCustomSmallTextForFolderName() ! { ! return "pairsTrdng"; } ! protected override string getFullPathFileNameForMain() ! { ! string fullPathFileNameForMain = ! @"C:\QuantProject\QuantProject\b7_Scripts\WalkForwardTesting\PairsTrading\PairsTradingMain.cs"; ! return fullPathFileNameForMain; ! } } } |
|
From: Glauco S. <gla...@us...> - 2008-03-19 23:21:38
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12614/b4_Business/a2_Strategies Modified Files: EndOfDayStrategyBackTester.cs Log Message: - the property public DateTime FirstDateTime has been added - constructor's parameters are checked now (proper exceptions are risen if parameters don't comply to some requirements) Index: EndOfDayStrategyBackTester.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/EndOfDayStrategyBackTester.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** EndOfDayStrategyBackTester.cs 13 Mar 2008 19:36:26 -0000 1.8 --- EndOfDayStrategyBackTester.cs 19 Mar 2008 23:21:33 -0000 1.9 *************** *** 69,73 **** } /// <summary> ! /// Returns the dimulated DateTime when the backtest is stopped /// (not the real time) /// </summary> --- 69,84 ---- } /// <summary> ! /// Returns the simulated DateTime when the backtest is started ! /// (not the real time) ! /// </summary> ! public DateTime FirstDateTime ! { ! get ! { ! return this.firstDateTime; ! } ! } ! /// <summary> ! /// Returns the simulated DateTime when the backtest is stopped /// (not the real time) /// </summary> *************** *** 149,152 **** --- 160,171 ---- double maxRunningHours ) { + this.endOfDayStrategyBackTester_checkParameters( + endOfDayStrategy , + historicalQuoteProvider , + accountProvider, + firstDateTime , lastDateTime , + benchmark , + cashToStart , + maxRunningHours ); this.backTestID = backTestID; this.endOfDayStrategy = endOfDayStrategy; *************** *** 168,171 **** --- 187,212 ---- this.realDateTimeWhenTheBackTestIsStopped = DateTime.MinValue; } + private void endOfDayStrategyBackTester_checkParameters( + IEndOfDayStrategyForBacktester endOfDayStrategy , + IHistoricalQuoteProvider historicalQuoteProvider , + IAccountProvider accountProvider, + DateTime firstDateTime , DateTime lastDateTime , + Benchmark benchmark , + double cashToStart , + double maxRunningHours ) + { + if ( endOfDayStrategy == null ) + throw new Exception( "endOfDayStrategy cannot be null!" ); + if ( historicalQuoteProvider == null ) + throw new Exception( "historicalQuoteProvider cannot be null!" ); + if ( accountProvider == null ) + throw new Exception( "accountProvider cannot be null!" ); + if ( firstDateTime.CompareTo( lastDateTime ) > 0 ) + throw new Exception( "firstDateTime is greater than lastDateTime!" ); + if ( cashToStart <= 0 ) + throw new Exception( "cashToStart must be greater than zero!" ); + if ( maxRunningHours <= 0 ) + throw new Exception( "maxRunningHours must be greater than zero!" ); + } private void initialize_endOfDayTimer() |
|
From: Glauco S. <gla...@us...> - 2008-03-19 23:15:10
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5258/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: General\BasicScriptForBacktesting.cs has been added Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** b7_Scripts.csproj 13 Mar 2008 19:29:20 -0000 1.89 --- b7_Scripts.csproj 19 Mar 2008 23:15:01 -0000 1.90 *************** *** 244,247 **** --- 244,252 ---- /> <File + RelPath = "General\BasicScriptForBacktesting.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "General\Logging\LogArchiver.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2008-03-19 23:14:41
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/General In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4658/b7_Scripts/General Added Files: BasicScriptForBacktesting.cs Log Message: provides methods to save scripts' results: to be inherited by all those scripts that launch an EndOfDayBacktester and that want their results to be permanently saved --- NEW FILE: BasicScriptForBacktesting.cs --- /* QuantProject - Quantitative Finance Library BasicScript.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 System.IO; using QuantProject.ADT; using QuantProject.ADT.FileManaging; using QuantProject.Business.Strategies; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Presentation; namespace QuantProject.Scripts.General { /// <summary> /// Provides methods to save script's results: to be inherited by all /// those scripts that want their results to be permanently saved /// </summary> public abstract class BasicScriptForBacktesting { private string pathForTheMainFolderWhereScriptsResultsAreToBeSaved; private string customSmallTextForFolderName; private string fullPathFileNameForMain; private string nameForTheSubfolderForScriptResults; private MessageManager messageManager; protected IEligiblesSelector eligiblesSelector; protected IInSampleChooser inSampleChooser; protected IEndOfDayStrategyForBacktester endOfDayStrategy; protected EndOfDayStrategyBackTester endOfDayStrategyBackTester; /// <summary> /// provides methods to save scripts' results: to be inherited by all /// those scripts that launch an EndOfDayBacktester and that want /// their results to be permanently saved /// </summary> public BasicScriptForBacktesting() { string pathForTheMainFolderWhereScriptsResultsAreToBeSaved = this.getPathForTheMainFolderWhereScriptsResultsAreToBeSaved(); string customSmallTextForFolderName = this.getCustomSmallTextForFolderName(); string fullPathFileNameForMain = this.getFullPathFileNameForMain(); this.checkIfPathsAreFine( pathForTheMainFolderWhereScriptsResultsAreToBeSaved , fullPathFileNameForMain ); this.initializePrivateMembers( pathForTheMainFolderWhereScriptsResultsAreToBeSaved , customSmallTextForFolderName , fullPathFileNameForMain ); } /// <summary> /// it has to return the path to the main folder within wich a new subfolder /// will be created: this subfolder will contain all the files with the script's results; /// the name for the subfolder will be automatically created by this basic class /// (some automatic information about the script will be included in the subfolder name) /// </summary> /// <returns></returns> protected abstract string getPathForTheMainFolderWhereScriptsResultsAreToBeSaved(); /// <summary> /// it has to return a short string to be used to build the name for the subfolder /// that will will contain all the files with the script's results; /// this short string can be used to disambiguate among different /// scripts that might be run one next to each the other /// </summary> /// <returns></returns> protected abstract string getCustomSmallTextForFolderName(); /// <summary> /// complete path for the file containing the entry point for the script: it should /// be the file that inherits this class /// </summary> /// <returns></returns> protected abstract string getFullPathFileNameForMain(); protected abstract void setEligiblesSelector(); protected abstract void setInSampleChooser(); protected abstract void setEndOfDayStrategy(); protected abstract void setEndOfDayStrategyBackTester(); private void checkIfPathsAreFine( string pathForTheMainFolderWhereScriptsResultsAreToBeSaved , string fullPathFileNameForMain ) { if ( !Directory.Exists( pathForTheMainFolderWhereScriptsResultsAreToBeSaved ) ) throw new Exception( "The given path for the main folder where script results are " + "to be saved, does not exist!" ); if ( !File.Exists( fullPathFileNameForMain ) ) throw new Exception( "The main file does not exist at the given path!" ); } #region initializePrivateMembers private void initializePrivateMember_addAFinalSlashIfNeeded() { string lastCharacter = this.pathForTheMainFolderWhereScriptsResultsAreToBeSaved.Substring( this.pathForTheMainFolderWhereScriptsResultsAreToBeSaved.Length - 1 ); if ( lastCharacter != "\\" ) // the given path does not end with a slash this.pathForTheMainFolderWhereScriptsResultsAreToBeSaved += "\\"; } private void initializePrivateMember_pathForTheMainFolderWhereScriptsResultsAreToBeSaved( string pathForTheMainFolderWhereScriptsResultsAreToBeSaved ) { this.pathForTheMainFolderWhereScriptsResultsAreToBeSaved = pathForTheMainFolderWhereScriptsResultsAreToBeSaved; this.initializePrivateMember_addAFinalSlashIfNeeded(); } private void initializePrivateMembers( string pathForTheMainFolderWhereScriptsResultsAreToBeSaved , string customSmallTextForFolderName , string fullPathFileNameForMain ) { this.initializePrivateMember_pathForTheMainFolderWhereScriptsResultsAreToBeSaved( pathForTheMainFolderWhereScriptsResultsAreToBeSaved ); this.customSmallTextForFolderName = customSmallTextForFolderName; this.fullPathFileNameForMain = fullPathFileNameForMain; } #endregion initializePrivateMembers private void setNameForTheSubfolderForScriptResults() { this.nameForTheSubfolderForScriptResults = ExtendedDateTime.GetCompleteShortDescriptionForFileName( DateTime.Now ) + "_" + this.customSmallTextForFolderName; } private string getInitialPathForTheSubfolderForScriptResults() { string pathForTheSubfolderForScriptResults = this.pathForTheMainFolderWhereScriptsResultsAreToBeSaved + this.nameForTheSubfolderForScriptResults + "\\"; return pathForTheSubfolderForScriptResults; } private void createTheSubfolderForScriptResults() { string pathForTheFolderForScriptResults= this.getInitialPathForTheSubfolderForScriptResults(); if( !Directory.Exists( pathForTheFolderForScriptResults ) ) Directory.CreateDirectory( pathForTheFolderForScriptResults ); } private void copyMainToTheSubfolderForScriptResults() { string initialPathForTheSubfolderForScriptResults = this.getInitialPathForTheSubfolderForScriptResults(); string fileNameForMain = Path.GetFileName( this.fullPathFileNameForMain ); string initialFullPathFileNameForMainCopy = initialPathForTheSubfolderForScriptResults + fileNameForMain; File.Copy( this.fullPathFileNameForMain , initialFullPathFileNameForMainCopy , false ); } private void initializeObjectsForTheBacktest() { this.setEligiblesSelector(); this.setInSampleChooser(); this.setEndOfDayStrategy(); this.setEndOfDayStrategyBackTester(); } #region initializeMessageSendersManagement private string initializeMessageSendersManagement_getInitialNameForOutputFile() { string initialNameForOutputFile = this.nameForTheSubfolderForScriptResults + ".txt"; return initialNameForOutputFile; } private string getInitialFullPathForOutputTxtFile() { string fullPathForTheOutputFile = this.getInitialPathForTheSubfolderForScriptResults() + this.initializeMessageSendersManagement_getInitialNameForOutputFile(); return fullPathForTheOutputFile; } private void initializeMessageSendersManagement() { this.messageManager = new MessageManager( this.getInitialFullPathForOutputTxtFile() ); this.messageManager.Monitor( this.eligiblesSelector ); this.messageManager.Monitor( this.inSampleChooser ); this.messageManager.Monitor( this.endOfDayStrategy ); this.messageManager.Monitor( this.endOfDayStrategyBackTester ); } #endregion initializeMessageSendersManagement private string getAdditionalInfoForFileName() { string additionalInfoForFileName = "from_" + ExtendedDateTime.GetShortDescriptionForFileName( this.endOfDayStrategyBackTester.FirstDateTime ) + "_to_" + ExtendedDateTime.GetShortDescriptionForFileName( this.endOfDayStrategyBackTester.ActualLastDateTime ) + "_annlRtrn_" + this.endOfDayStrategyBackTester.AccountReport.Summary.AnnualSystemPercentageReturn.FormattedValue + "_maxDD_" + this.endOfDayStrategyBackTester.AccountReport.Summary.MaxEquityDrawDown.FormattedValue; return additionalInfoForFileName; } //Saves (in silent mode): //- a log file where the In Sample Analysis are // stored; //- a report; //- the main file for this script private void saveScriptResults() { string fullPathFileNameForLog = this.getInitialPathForTheSubfolderForScriptResults() + this.nameForTheSubfolderForScriptResults + "_" + this.getAdditionalInfoForFileName() + ".qpL"; string fullPathFileNameForReport = this.getInitialPathForTheSubfolderForScriptResults() + this.nameForTheSubfolderForScriptResults + "_" + this.getAdditionalInfoForFileName() + ".qpR"; ObjectArchiver.Archive( endOfDayStrategyBackTester.Log, fullPathFileNameForLog ); ObjectArchiver.Archive( endOfDayStrategyBackTester.AccountReport, fullPathFileNameForReport ); } #region renameOutputTxtFile_addingFurtherInformation private string getFinalFullPathForOutputTxtFile() { string initialFullPathForOutputTxtFile = this.getInitialFullPathForOutputTxtFile(); string initialFullPathForOutputTxtFile_withoutSuffix = initialFullPathForOutputTxtFile.Substring( 0 , initialFullPathForOutputTxtFile.Length - 4 ); string finalFullPathForOutputTxtFile = initialFullPathForOutputTxtFile_withoutSuffix + "_" + this.getAdditionalInfoForFileName() + ".txt"; return finalFullPathForOutputTxtFile; } private void renameOutputTxtFile_addingFurtherInformation() { string initialFullPathForOutputTxtFile = this.getInitialFullPathForOutputTxtFile(); string finalFullPathForOutputTxtFile = this.getFinalFullPathForOutputTxtFile(); File.Move( initialFullPathForOutputTxtFile , finalFullPathForOutputTxtFile ); } #endregion renameOutputTxtFile_addingFurtherInformation #region renameSubfolderForScriptsResults_addingFurtherInformation private string getFinalPathForTheSubfolderForScriptResults() { string initialPathForTheSubfolderForScriptResults = this.getInitialPathForTheSubfolderForScriptResults(); string initialPathForTheSubolderForScriptResults_withoutTheFinalSlash = initialPathForTheSubfolderForScriptResults.Substring( 0 , initialPathForTheSubfolderForScriptResults.Length - 1 ); string finalPathForTheFolderForScriptResults = initialPathForTheSubolderForScriptResults_withoutTheFinalSlash + "_" + this.getAdditionalInfoForFileName() + "\\"; return finalPathForTheFolderForScriptResults; } private void renameSubfolderForScriptsResults_addingFurtherInformation() { string initialPathForTheFolderForScriptResults = this.getInitialPathForTheSubfolderForScriptResults(); string finalPathForTheFolderForScriptResults = this.getFinalPathForTheSubfolderForScriptResults(); Directory.Move( initialPathForTheFolderForScriptResults , finalPathForTheFolderForScriptResults ); } #endregion renameSubfolderForScriptsResults_addingFurtherInformation public void Run() { this.setNameForTheSubfolderForScriptResults(); this.createTheSubfolderForScriptResults(); this.copyMainToTheSubfolderForScriptResults(); this.initializeObjectsForTheBacktest(); this.initializeMessageSendersManagement(); this.endOfDayStrategyBackTester.Run(); this.saveScriptResults(); this.renameOutputTxtFile_addingFurtherInformation(); this.renameSubfolderForScriptsResults_addingFurtherInformation(); } } } |
|
From: Glauco S. <gla...@us...> - 2008-03-16 20:15:10
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12608/b7_Scripts Modified Files: Scripts_SD.csproj Log Message: WalkForwardTesting\PairsTrading\Logging\TesterForPairsTradingTestingPositions.cs has been added Index: Scripts_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/Scripts_SD.csproj,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Scripts_SD.csproj 12 Mar 2008 22:06:59 -0000 1.17 --- Scripts_SD.csproj 16 Mar 2008 20:15:00 -0000 1.18 *************** *** 107,110 **** --- 107,111 ---- <Compile Include="WalkForwardTesting\PairsTrading\Logging\PairsTradingLogItem.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\Logging\SimpleStrategy.cs" /> + <Compile Include="WalkForwardTesting\PairsTrading\Logging\TesterForPairsTradingTestingPositions.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\PairsTradingMain.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\PairsTradingStrategy.cs" /> |
|
From: Glauco S. <gla...@us...> - 2008-03-16 20:14:35
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12574/b5_Presentation Modified Files: Presentation_SD.csproj Log Message: ExecutablesListViewer.cs has been added Index: Presentation_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Presentation_SD.csproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Presentation_SD.csproj 6 Feb 2008 23:23:00 -0000 1.4 --- Presentation_SD.csproj 16 Mar 2008 20:14:31 -0000 1.5 *************** *** 62,65 **** --- 62,66 ---- <ItemGroup> <Compile Include="AssemblyInfo.cs" /> + <Compile Include="ExecutablesListViewer.cs" /> <Compile Include="FormatProvider.cs" /> <Compile Include="Charting\CharPlot.cs" /> |
|
From: Glauco S. <gla...@us...> - 2008-03-16 20:14:19
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12528/b4_Business Modified Files: Business_SD.csproj Log Message: a1_Financial\a2_Accounting\AccountProviding\InteractiveBrokerAccountProvider.cs has been added a1_Financial\a2_Accounting\AccountProviding\SimpleAccountProvider.cs has been added a4_Scripting\IExecutable.cs has been added Index: Business_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/Business_SD.csproj,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Business_SD.csproj 12 Mar 2008 21:55:13 -0000 1.17 --- Business_SD.csproj 16 Mar 2008 20:14:10 -0000 1.18 *************** *** 62,65 **** --- 62,67 ---- <Compile Include="a07_DataProviders\TickerNotExchangedException.cs" /> <Compile Include="a1_Financial\a2_Accounting\AccountProviding\IAccountProvider.cs" /> + <Compile Include="a1_Financial\a2_Accounting\AccountProviding\InteractiveBrokerAccountProvider.cs" /> + <Compile Include="a1_Financial\a2_Accounting\AccountProviding\SimpleAccountProvider.cs" /> <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\StatisticsSummaryRows\AverageReturnOnMonday.cs" /> <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\AverageNumberOfTransactionsPerDay.cs" /> *************** *** 107,110 **** --- 109,113 ---- <Compile Include="a2_Strategies\TickersRelationships\OpenToCloseCorrelationProvider.cs" /> <Compile Include="a2_Strategies\TickersRelationships\TickersPearsonCorrelation.cs" /> + <Compile Include="a4_Scripting\IExecutable.cs" /> <Compile Include="AssemblyInfo.cs" /> <Compile Include="a0_Validation\IValidator.cs" /> |
|
From: Glauco S. <gla...@us...> - 2008-03-13 19:46:01
|
Update of /cvsroot/quantproject/QuantProject/b91_QuantProject In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21125/b91_QuantProject Modified Files: Main.cs Log Message: The "Data>test" menu item's click event handler has been changed: now it can be used to test a BackTestLog Index: Main.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b91_QuantProject/Main.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Main.cs 19 Jan 2008 19:08:06 -0000 1.18 --- Main.cs 13 Mar 2008 19:45:54 -0000 1.19 *************** *** 31,37 **** --- 31,40 ---- using QuantProject.ADT.Optimizing.Genetic; + using QuantProject.Business.Strategies.Logging; + using QuantProject.Scripts.General.Logging; using QuantProject.Scripts.SimpleTesting; using QuantProject.Scripts.WalkForwardTesting.FixedLengthTwoPhases; using QuantProject.Scripts.WalkForwardTesting.LinearCombination; + using QuantProject.Scripts.WalkForwardTesting.PairsTrading; using QuantProject.Scripts.WalkForwardTesting.WalkForwardOneRank; using QuantProject.Scripts.WalkForwardTesting.WalkForwardLag; *************** *** 276,284 **** #endregion ! private void menuItem9_Click(object sender, System.EventArgs e) ! { ! TestDownloadedData testDownloadedData = new TestDownloadedData(); ! testDownloadedData.ShowDialog(); ! } private void menuItem10_Click(object sender, System.EventArgs e) --- 279,292 ---- #endregion ! private void menuItem9_Click(object sender, System.EventArgs e) ! { ! // TestDownloadedData testDownloadedData = new TestDownloadedData(); ! // testDownloadedData.ShowDialog(); ! BackTestLog backTestLog = LogArchiver.Load( "C:\\qpReports\\pairsTrading\\" ); ! LogViewer logViewer = ! new LogViewer( backTestLog ); ! logViewer.Show(); ! ! } private void menuItem10_Click(object sender, System.EventArgs e) *************** *** 465,469 **** //new RunWalkForwardOneRank().Run(); // new WFLagMain().ShowDialog(); ! new FixedLengthTwoPhasesMain().Run(); // new RunOneRank().Run(); --- 473,479 ---- //new RunWalkForwardOneRank().Run(); // new WFLagMain().ShowDialog(); ! ! // new FixedLengthTwoPhasesMain().Run(); ! new PairsTradingMain().Run(); // new RunOneRank().Run(); |
|
From: Glauco S. <gla...@us...> - 2008-03-13 19:43:50
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19892/b7_Scripts/WalkForwardTesting/PairsTrading Modified Files: PairsTradingStrategy.cs Log Message: A bad bug has been fixed: a candidate position is reversed, now Index: PairsTradingStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/PairsTradingStrategy.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PairsTradingStrategy.cs 6 Mar 2008 20:20:50 -0000 1.2 --- PairsTradingStrategy.cs 13 Mar 2008 19:43:43 -0000 1.3 *************** *** 183,186 **** --- 183,205 ---- 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. *************** *** 227,233 **** WeightedPositions currentWeightedPositions = this.bestTestingPositionsInSample[ currentTestingPositionsIndex ].WeightedPositions; WeightedPositions weightedPositionsToBeOpended = this.getPositionsToBeOpenedWithRespectToCurrentWeightedPositions( ! returnsManager , currentWeightedPositions ); return weightedPositionsToBeOpended; } --- 246,254 ---- WeightedPositions currentWeightedPositions = this.bestTestingPositionsInSample[ currentTestingPositionsIndex ].WeightedPositions; + WeightedPositions candidateForPortfolio = + this.getCandidateForPortfolio( currentWeightedPositions ); WeightedPositions weightedPositionsToBeOpended = this.getPositionsToBeOpenedWithRespectToCurrentWeightedPositions( ! returnsManager , candidateForPortfolio ); return weightedPositionsToBeOpended; } *************** *** 290,293 **** --- 311,315 ---- new PairsTradingLogItem( this.now() , this.bestTestingPositionsInSample , + this.numDaysForInSampleOptimization , eligibleTickers.Count ); // logItem.BestWeightedPositionsInSample = |
|
From: Glauco S. <gla...@us...> - 2008-03-13 19:42:46
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Logging In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19223/b7_Scripts/WalkForwardTesting/PairsTrading/Logging Modified Files: SimpleStrategy.cs Log Message: Minor formatting change Index: SimpleStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Logging/SimpleStrategy.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SimpleStrategy.cs 6 Mar 2008 20:03:12 -0000 1.1 --- SimpleStrategy.cs 13 Mar 2008 19:42:41 -0000 1.2 *************** *** 98,103 **** PairsTradingLogItem logItem = new PairsTradingLogItem( this.now() , ! new TestingPositions[ 1 ] , ! 1 ); // logItem.BestWeightedPositionsInSample = // this.bestTestingPositionsInSample.WeightedPositions; --- 98,104 ---- PairsTradingLogItem logItem = new PairsTradingLogItem( this.now() , ! new TestingPositions[ 1 ] , ! 0 , ! 1 ); // logItem.BestWeightedPositionsInSample = // this.bestTestingPositionsInSample.WeightedPositions; |
|
From: Glauco S. <gla...@us...> - 2008-03-13 19:42:16
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18993/b7_Scripts/WalkForwardTesting/PairsTrading Modified Files: PairsTradingMain.cs Log Message: - the fitness evaluator now uses the maxCorrelationAllowed parameter - an IAccountProvider is used, now Index: PairsTradingMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/PairsTradingMain.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PairsTradingMain.cs 6 Mar 2008 20:19:50 -0000 1.2 --- PairsTradingMain.cs 13 Mar 2008 19:42:11 -0000 1.3 *************** *** 25,28 **** --- 25,29 ---- using QuantProject.ADT; using QuantProject.Business.DataProviders; + using QuantProject.Business.Financial.Accounting.AccountProviding; using QuantProject.Business.Strategies; using QuantProject.Business.Strategies.Eligibles; *************** *** 113,117 **** // IEquityEvaluator equityEvaluator = new SharpeRatio(); IFitnessEvaluator fitnessEvaluator = ! new PairsTradingFitnessEvaluator(); // parameters for the genetic optimizer --- 114,118 ---- // IEquityEvaluator equityEvaluator = new SharpeRatio(); IFitnessEvaluator fitnessEvaluator = ! new PairsTradingFitnessEvaluator( 0.96 ); // parameters for the genetic optimizer *************** *** 119,124 **** double mutationRate = 0.02; double elitismRate = 0.001; ! int populationSizeForGeneticOptimizer = 30000; ! int generationNumberForGeneticOptimizer = 12; int seedForRandomGenerator = QuantProject.ADT.ConstantsProvider.SeedForRandomGenerator; --- 120,125 ---- double mutationRate = 0.02; double elitismRate = 0.001; ! int populationSizeForGeneticOptimizer = 3000; ! int generationNumberForGeneticOptimizer = 4; int seedForRandomGenerator = QuantProject.ADT.ConstantsProvider.SeedForRandomGenerator; *************** *** 146,159 **** 7 , inSampleDays , intervalsSelector , eligiblesSelector , inSampleChooser , historicalQuoteProvider , ! 0.003 , 0.99 , 0.003 , 0.99 ); DateTime firstDateTime = new DateTime( 2001 , 1 , 1 ); ! DateTime lastDateTime = new DateTime( 2001 , 1 , 6 ); ! double maxRunningHours = 0.9; EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! backTestId , pairsTradingStrategy , ! historicalQuoteProvider , firstDateTime , ! lastDateTime , benchmark , cashToStart , maxRunningHours ); // TO DO check if you can do this assign in the EndOfDayStrategyBackTester --- 147,162 ---- 7 , inSampleDays , intervalsSelector , eligiblesSelector , inSampleChooser , historicalQuoteProvider , ! 0.007 , 0.99 , 0.007 , 0.99 ); ! ! IAccountProvider accountProvider = new SimpleAccountProvider(); DateTime firstDateTime = new DateTime( 2001 , 1 , 1 ); ! DateTime lastDateTime = new DateTime( 2001 , 1 , 12 ); ! double maxRunningHours = 6; EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! backTestId , pairsTradingStrategy , ! historicalQuoteProvider , accountProvider , ! firstDateTime , lastDateTime , benchmark , cashToStart , maxRunningHours ); // TO DO check if you can do this assign in the EndOfDayStrategyBackTester |
|
From: Glauco S. <gla...@us...> - 2008-03-13 19:41:01
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Logging In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17881/b7_Scripts/WalkForwardTesting/PairsTrading/Logging Modified Files: PairsTradingLogItem.cs Log Message: The Run() method has been changed, so that an ExecutablesListViewer is used, now Index: PairsTradingLogItem.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Logging/PairsTradingLogItem.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PairsTradingLogItem.cs 6 Mar 2008 20:18:40 -0000 1.2 --- PairsTradingLogItem.cs 13 Mar 2008 19:40:24 -0000 1.3 *************** *** 22,29 **** using System; - using System.Drawing; - using QuantProject.Business.DataProviders; - using QuantProject.Business.Financial.Accounting.Reporting; using QuantProject.Business.Strategies; using QuantProject.Business.Strategies.Eligibles; --- 22,26 ---- *************** *** 31,38 **** using QuantProject.Business.Strategies.Logging; using QuantProject.Business.Strategies.OutOfSample; - using QuantProject.Business.Strategies.ReturnsManagement.Time.IntervalsSelectors; using QuantProject.Business.Timing; ! using QuantProject.Presentation.Reporting.WindowsForm; ! using QuantProject.Scripts.General.Reporting; namespace QuantProject.Scripts.WalkForwardTesting.PairsTrading --- 28,35 ---- using QuantProject.Business.Strategies.Logging; using QuantProject.Business.Strategies.OutOfSample; using QuantProject.Business.Timing; ! using QuantProject.Presentation; ! //using QuantProject.Presentation.Reporting.WindowsForm; ! //using QuantProject.Scripts.General.Reporting; namespace QuantProject.Scripts.WalkForwardTesting.PairsTrading *************** *** 44,48 **** public class PairsTradingLogItem : LogItem { ! private TestingPositions[] bestTestingPositionsInSample; private int numberOfEligibleTickers; --- 41,47 ---- public class PairsTradingLogItem : LogItem { ! private TesterForPairsTradingTestingPositions[] ! testersForBestTestingPositionsInSample; ! private int numberOfInSampleDays; private int numberOfEligibleTickers; *************** *** 68,164 **** } public PairsTradingLogItem( ! EndOfDayDateTime endOfDayDateTime , TestingPositions[] bestTestingPositionsInSample , int numberOfEligibleTickers ) ! : base( endOfDayDateTime ) { this.numberOfEligibleTickers = int.MinValue; ! this.bestTestingPositionsInSample = bestTestingPositionsInSample; this.numberOfEligibleTickers = numberOfEligibleTickers; } ! private AccountReport getAccountReport( ! WeightedPositions weightedPositions , ! IIntervalsSelector intervalsSelector , ! IHistoricalQuoteProvider historicalQuoteProvider , ! Benchmark benchmark , ! double cashToStart ) { ! SimpleStrategy simpleStrategy = ! new SimpleStrategy( weightedPositions , ! intervalsSelector , historicalQuoteProvider ); ! ! DateTime firstDateTime = this.simulatedCreationTime.DateTime.AddDays( -90 ); ! DateTime lastDateTime = this.simulatedCreationTime.DateTime; ! double maxRunningHours = 0.3; ! EndOfDayStrategyBackTester endOfDayStrategyBackTester = ! new EndOfDayStrategyBackTester( ! "SinglePosition" , simpleStrategy , ! historicalQuoteProvider , firstDateTime , ! lastDateTime , benchmark , cashToStart , maxRunningHours ); ! ! simpleStrategy.Account = endOfDayStrategyBackTester.Account; ! ! endOfDayStrategyBackTester.Run(); ! return endOfDayStrategyBackTester.AccountReport; } ! private WeightedPositions getWeightedPositions( ! WeightedPosition weightedPosition ) { ! double[] weights = { 1 }; ! string[] tickers = { weightedPosition.Ticker }; ! WeightedPositions weightedPositions = ! new WeightedPositions( weights , tickers ); ! return weightedPositions; } public override void Run() { ! // string backTestId = "SimplePairsTrading"; ! // double cashToStart = 30000; ! ! Benchmark benchmark = new Benchmark( "MSFT" ); ! ! IHistoricalQuoteProvider historicalQuoteProvider = ! new HistoricalAdjustedQuoteProvider(); ! ! // IInSampleChooser inSampleChooser = ! // (IInSampleChooser)new ConstantWeightedPositionsChooser( ! // this.BestWeightedPositionsInSample ); ! ! IIntervalsSelector intervalsSelector = ! new OddIntervalsSelector( 1 , 1 , benchmark ); ! IEligiblesSelector eligiblesSelector = new DummyEligibleSelector(); ! ! WeightedPositions weightedPositions = ! this.bestTestingPositionsInSample[ 0 ].WeightedPositions; ! ! WeightedPositions firstPosition = ! this.getWeightedPositions( weightedPositions[ 0 ] ); ! WeightedPositions secondPosition = ! this.getWeightedPositions( weightedPositions[ 1 ] ); ! AccountReport accountReportForFirstPosition = ! this.getAccountReport( firstPosition , intervalsSelector , ! historicalQuoteProvider , ! benchmark , 30000 ); ! AccountReport accountReportForSecondPosition = ! this.getAccountReport( secondPosition , intervalsSelector , ! historicalQuoteProvider , ! benchmark , ! 30000 * weightedPositions[ 1 ].Weight / ! weightedPositions[ 0 ].Weight ); ! ! Report report = ! new Report( accountReportForFirstPosition , false ); ! EndOfDayDateTime lastEndOfDayDateTimeForReport = ! new EndOfDayDateTime( ! accountReportForFirstPosition.EquityLine.LastDateTime , ! EndOfDaySpecificTime.OneHourAfterMarketClose ); ! ! // report.Create( "PearsonDebug" , 1 , ! // lastEndOfDayDateTimeForReport , ! // benchmark.Ticker , false ); ! report.AddEquityLine( accountReportForSecondPosition.EquityLine , ! Color.Brown ); ! report.ShowDialog(); } } --- 67,221 ---- } + /// <summary> + /// Log item for the Pairs Trading strategy + /// </summary> + /// <param name="endOfDayDateTime"></param> + /// <param name="bestTestingPositionsInSample"></param> + /// <param name="numInSampleDays">number of days used for + /// in sample optimization</param> + /// <param name="numberOfEligibleTickers"></param> public PairsTradingLogItem( ! EndOfDayDateTime now , TestingPositions[] bestTestingPositionsInSample , + int numberOfInSampleDays , int numberOfEligibleTickers ) ! : base( now ) { this.numberOfEligibleTickers = int.MinValue; ! // this.bestTestingPositionsInSample = bestTestingPositionsInSample; ! this.numberOfInSampleDays = numberOfInSampleDays; this.numberOfEligibleTickers = numberOfEligibleTickers; + this.setTestersForPairstTradingTestingPositions( + bestTestingPositionsInSample , + now ); } ! ! #region setTestersForPairstTradingTestingPositions ! private void setTestersForPairstTradingTestingPositions_checkParameters( ! TestingPositions testingPositions ) { ! if ( ! ( testingPositions is PairsTradingTestingPositions ) ) ! throw new Exception( ! "TestingPositions are all expected to be " + ! "PairsTradingTestingPositions. The current TestingPositions " + ! "is not a PairsTradingTestingPositions instead!" ); } ! private void setTesterForPairstTradingTestingPositions( ! int currentIndex , ! TestingPositions testingPositions , ! EndOfDayDateTime now ) { ! this.setTestersForPairstTradingTestingPositions_checkParameters( ! testingPositions ); ! this.testersForBestTestingPositionsInSample[ currentIndex ] = ! new TesterForPairsTradingTestingPositions( ! testingPositions , ! this.numberOfInSampleDays , ! now ); ! } ! private void setTestersForPairstTradingTestingPositions( ! TestingPositions[] bestTestingPositionsInSample , ! EndOfDayDateTime now ) ! { ! this.testersForBestTestingPositionsInSample = ! new TesterForPairsTradingTestingPositions[ ! bestTestingPositionsInSample.Length ]; ! for ( int i = 0 ; i < bestTestingPositionsInSample.Length - 1 ; i++ ) ! this.setTesterForPairstTradingTestingPositions( ! i , ! bestTestingPositionsInSample[ i ] , ! now ); } + #endregion setTestersForPairstTradingTestingPositions + // private AccountReport getAccountReport( + // WeightedPositions weightedPositions , + // IIntervalsSelector intervalsSelector , + // IHistoricalQuoteProvider historicalQuoteProvider , + // Benchmark benchmark , + // double cashToStart ) + // { + // SimpleStrategy simpleStrategy = + // new SimpleStrategy( weightedPositions , + // intervalsSelector , historicalQuoteProvider ); + // + // DateTime firstDateTime = this.simulatedCreationTime.DateTime.AddDays( -90 ); + // DateTime lastDateTime = this.simulatedCreationTime.DateTime; + // double maxRunningHours = 0.3; + // EndOfDayStrategyBackTester endOfDayStrategyBackTester = + // new EndOfDayStrategyBackTester( + // "SinglePosition" , simpleStrategy , + // historicalQuoteProvider , firstDateTime , + // lastDateTime , benchmark , cashToStart , maxRunningHours ); + // + // simpleStrategy.Account = endOfDayStrategyBackTester.Account; + // + // endOfDayStrategyBackTester.Run(); + // return endOfDayStrategyBackTester.AccountReport; + // } + // private WeightedPositions getWeightedPositions( + // WeightedPosition weightedPosition ) + // { + // double[] weights = { 1 }; + // string[] tickers = { weightedPosition.Ticker }; + // WeightedPositions weightedPositions = + // new WeightedPositions( weights , tickers ); + // return weightedPositions; + // } + // public void Run3() + // { + //// string backTestId = "SimplePairsTrading"; + //// double cashToStart = 30000; + // + // Benchmark benchmark = new Benchmark( "MSFT" ); + // + // IHistoricalQuoteProvider historicalQuoteProvider = + // new HistoricalAdjustedQuoteProvider(); + // + //// IInSampleChooser inSampleChooser = + //// (IInSampleChooser)new ConstantWeightedPositionsChooser( + //// this.BestWeightedPositionsInSample ); + // + // IIntervalsSelector intervalsSelector = + // new OddIntervalsSelector( 1 , 1 , benchmark ); + // IEligiblesSelector eligiblesSelector = new DummyEligibleSelector(); + // + // WeightedPositions weightedPositions = + // this.bestTestingPositionsInSample[ 0 ].WeightedPositions; + // + // WeightedPositions firstPosition = + // this.getWeightedPositions( weightedPositions[ 0 ] ); + // WeightedPositions secondPosition = + // this.getWeightedPositions( weightedPositions[ 1 ] ); + // AccountReport accountReportForFirstPosition = + // this.getAccountReport( firstPosition , intervalsSelector , + // historicalQuoteProvider , + // benchmark , 30000 ); + // AccountReport accountReportForSecondPosition = + // this.getAccountReport( secondPosition , intervalsSelector , + // historicalQuoteProvider , + // benchmark , + // 30000 * weightedPositions[ 1 ].Weight / + // weightedPositions[ 0 ].Weight ); + // + // Report report = + // new Report( accountReportForFirstPosition , false ); + // EndOfDayDateTime lastEndOfDayDateTimeForReport = + // new EndOfDayDateTime( + // accountReportForFirstPosition.EquityLine.LastDateTime , + // EndOfDaySpecificTime.OneHourAfterMarketClose ); + // + //// report.Create( "PearsonDebug" , 1 , + //// lastEndOfDayDateTimeForReport , + //// benchmark.Ticker , false ); + // report.AddEquityLine( accountReportForSecondPosition.EquityLine , + // Color.Brown ); + // report.ShowDialog(); + // } public override void Run() { ! QuantProject.Presentation.ExecutablesListViewer executablesListViewer = ! new ExecutablesListViewer( ! this.testersForBestTestingPositionsInSample ); ! executablesListViewer.Show(); } } |
|
From: Glauco S. <gla...@us...> - 2008-03-13 19:39:11
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/InSample In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16984/b7_Scripts/WalkForwardTesting/PairsTrading/InSample Modified Files: PairsTradingFitnessEvaluator.cs Log Message: The maxCorrelationAllowed parameter has been added Index: PairsTradingFitnessEvaluator.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/InSample/PairsTradingFitnessEvaluator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PairsTradingFitnessEvaluator.cs 27 Feb 2008 21:15:05 -0000 1.1 --- PairsTradingFitnessEvaluator.cs 13 Mar 2008 19:38:42 -0000 1.2 *************** *** 38,41 **** --- 38,42 ---- public class PairsTradingFitnessEvaluator : IFitnessEvaluator { + private double maxCorrelationAllowed; public string Description *************** *** 47,52 **** } ! public PairsTradingFitnessEvaluator() { } #region GetFitnessValue --- 48,55 ---- } ! public PairsTradingFitnessEvaluator( ! double maxCorrelationAllowed ) { + this.maxCorrelationAllowed = maxCorrelationAllowed; } #region GetFitnessValue *************** *** 100,104 **** --- 103,113 ---- // for the current optimization's candidate, // all positions's tickers are distinct + { fitnessValue = this.getFitnessValue( weightedPositions , returnsManager ); + if ( fitnessValue > this.maxCorrelationAllowed ) + // the two positions are too correlated. They may represent + // the same instrument + fitnessValue = -0.4; + } return fitnessValue; } |
|
From: Glauco S. <gla...@us...> - 2008-03-13 19:37:56
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16496/b5_Presentation Added Files: ExecutablesListViewer.cs Log Message: Shows a list of Executable: right clicking an item fires the Run() of that executable --- NEW FILE: ExecutablesListViewer.cs --- /* QuantProject - Quantitative Finance Library ExecutablesListViewer.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 System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using QuantProject.Business.Scripting; namespace QuantProject.Presentation { /// <summary> /// Shows a list of Executable: right clicking an item fires /// the Run() of that executable /// </summary> public class ExecutablesListViewer : System.Windows.Forms.Form { private IList executables; private System.Windows.Forms.DataGrid executablesDataGrid; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; /// <summary> /// hows a list of Executable: right clicking an item fires /// the Run() of that executable /// </summary> /// <param name="executables">each element has to be an /// IExecutable</param> public ExecutablesListViewer( IList executables ) { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // this.executables = executables; this.setDataGridTableStyle(); this.updateGrid(); } private void setDataGridTableStyle() { DataGridTableStyle dataGridTableStyle = new DataGridTableStyle( true ); // DataGridColumnStyle dataGridColumnStyle = new DataGridColumnStyle(); } private void updateGrid() { ArrayList dataGridItems = new ArrayList( this.executables ); this.executablesDataGrid.DataSource = dataGridItems; this.executablesDataGrid.Refresh(); } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.executablesDataGrid = new System.Windows.Forms.DataGrid(); ((System.ComponentModel.ISupportInitialize)(this.executablesDataGrid)).BeginInit(); this.SuspendLayout(); // // executablesDataGrid // this.executablesDataGrid.DataMember = ""; this.executablesDataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText; this.executablesDataGrid.Location = new System.Drawing.Point(8, 8); this.executablesDataGrid.Name = "executablesDataGrid"; this.executablesDataGrid.Size = new System.Drawing.Size(808, 464); this.executablesDataGrid.TabIndex = 0; this.executablesDataGrid.MouseUp += new System.Windows.Forms.MouseEventHandler(this.executablesDataGrid_MouseUp); // // ExecutablesListViewer // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(824, 478); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.executablesDataGrid}); this.Name = "ExecutablesListViewer"; this.Text = "ExecutablesListViewer"; ((System.ComponentModel.ISupportInitialize)(this.executablesDataGrid)).EndInit(); this.ResumeLayout(false); } #endregion #region executablesDataGrid_MouseUp private int getRowNumber( object sender , MouseEventArgs eventArgs ) { DataGrid dataGrid = (DataGrid)sender; Point point = new Point( eventArgs.X , eventArgs.Y ); DataGrid.HitTestInfo hitTestInfo = dataGrid.HitTest( point ); // DataTable dataTable = (DataTable)dataGrid.DataSource; return hitTestInfo.Row; } private void getDataGridItem_checkParameters( int rowNumber ) { if ( !(this.executables[ rowNumber ] is QuantProject.Business.Scripting.IExecutable) ) throw new Exception( "The ICollection given to the constructor " + "contains a non IExecutable item (rowNumber=" + rowNumber + "). This class requires an ICollection of IExecutable(s)!" ); } private IExecutable getDataGridItem( DataGrid dataGrid , int rowNumber ) { this.getDataGridItem_checkParameters( rowNumber ); // DataTable dataTable = (DataTable)dataGrid.DataSource; IExecutable executable = (IExecutable)this.executables[ rowNumber ]; return executable; } private IExecutable getDataGridItem( object sender, System.Windows.Forms.MouseEventArgs e ) { int rowNumber = this.getRowNumber( sender , e ); IExecutable executable = this.getDataGridItem( (DataGrid)sender , rowNumber ); return executable; } private void rightClickEventHandler(object sender, System.Windows.Forms.MouseEventArgs e) { // wFLagWeightedPositions wFLagChosenPositions = // this.rightClickEventHandler_getWFLagChosenPositions( sender , e ); IExecutable executable = this.getDataGridItem( sender , e ); executable.Run(); } private void executablesDataGrid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { if ( e.Button == MouseButtons.Right ) this.rightClickEventHandler( sender , e ); } #endregion executablesDataGrid_MouseUp } } |
|
From: Glauco S. <gla...@us...> - 2008-03-13 19:37:30
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15914/b4_Business/a2_Strategies Modified Files: EndOfDayStrategyBackTester.cs Log Message: Description is now limited to a given max length Index: EndOfDayStrategyBackTester.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/EndOfDayStrategyBackTester.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** EndOfDayStrategyBackTester.cs 12 Mar 2008 22:02:06 -0000 1.7 --- EndOfDayStrategyBackTester.cs 13 Mar 2008 19:36:26 -0000 1.8 *************** *** 124,132 **** "_to_" + ExtendedDateTime.GetShortDescriptionForFileName( this.actualLastDateTime ) + ! "\n_annlRtrn_" + this.AccountReport.Summary.AnnualSystemPercentageReturn.FormattedValue + ! "\n_maxDD_" + this.AccountReport.Summary.MaxEquityDrawDown.FormattedValue + ! "\nHistoricalQuoteProviderForBackTester_" + this.historicalQuoteProvider.Description + ! "\n_" + this.endOfDayStrategy.Description; ! return description; } } --- 124,132 ---- "_to_" + ExtendedDateTime.GetShortDescriptionForFileName( this.actualLastDateTime ) + ! "_annlRtrn_" + this.AccountReport.Summary.AnnualSystemPercentageReturn.FormattedValue + ! "_maxDD_" + this.AccountReport.Summary.MaxEquityDrawDown.FormattedValue + ! "_" + this.historicalQuoteProvider.Description + ! "_" + this.endOfDayStrategy.Description; ! return description.Substring( 0 , Math.Min( description.Length , 200 ) ); } } |
|
From: Glauco S. <gla...@us...> - 2008-03-13 19:35:57
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15326/b5_Presentation Modified Files: b5_Presentation.csproj Log Message: ExecutablesListViewer.cs has been added Index: b5_Presentation.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/b5_Presentation.csproj,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** b5_Presentation.csproj 10 Feb 2008 14:15:18 -0000 1.43 --- b5_Presentation.csproj 13 Mar 2008 19:35:08 -0000 1.44 *************** *** 145,148 **** --- 145,153 ---- /> <File + RelPath = "ExecutablesListViewer.cs" + SubType = "Form" + BuildAction = "Compile" + /> + <File RelPath = "FormatProvider.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2008-03-13 19:33:44
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Logging In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14462/b7_Scripts/WalkForwardTesting/PairsTrading/Logging Added Files: TesterForPairsTradingTestingPositions.cs Log Message: Tests a PairsTradingTestingPositions object --- NEW FILE: TesterForPairsTradingTestingPositions.cs --- /* QuantProject - Quantitative Finance Library TesterForPairsTradingTestingPositions.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 System.Drawing; using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting.AccountProviding; using QuantProject.Business.Financial.Accounting.Reporting; using QuantProject.Business.Scripting; using QuantProject.Business.Strategies; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.OutOfSample; using QuantProject.Business.Strategies.ReturnsManagement.Time.IntervalsSelectors; using QuantProject.Business.Timing; using QuantProject.Presentation.Reporting.WindowsForm; namespace QuantProject.Scripts.WalkForwardTesting.PairsTrading { [Serializable] /// <summary> /// Tests a PairsTradingTestingPositions object /// </summary> public class TesterForPairsTradingTestingPositions : IExecutable { private PairsTradingTestingPositions testingPositions; private int numberOfInSampleDays; private EndOfDayDateTime endOfDayDateTimeWhenThisObjectWasLogged; /// <summary> /// Generation when the TestingPositions object has been created /// (if genetically optimized) /// </summary> public int Generation { get { return this.testingPositions.Generation; } } public double FitnessInSample { get { return this.testingPositions.FitnessInSample; } } public string ShortDescription { get { return this.testingPositions.WeightedPositions.Description; } } public TesterForPairsTradingTestingPositions( TestingPositions testingPositions , int numberOfInSampleDays , EndOfDayDateTime endOfDayDateTimeWhenThisObjectWasLogged ) { this.checkParameters( testingPositions ); this.testingPositions = (PairsTradingTestingPositions)testingPositions; this.numberOfInSampleDays = numberOfInSampleDays; this.endOfDayDateTimeWhenThisObjectWasLogged = endOfDayDateTimeWhenThisObjectWasLogged; } private void checkParameters( TestingPositions testingPositions ) { if ( ! ( testingPositions is PairsTradingTestingPositions ) ) throw new Exception( "The given testingPositions is NOT a " + "PairsTradingTestingPositions!" ); } #region Run private AccountReport getAccountReport( WeightedPositions weightedPositions , IIntervalsSelector intervalsSelector , IHistoricalQuoteProvider historicalQuoteProvider , Benchmark benchmark , double cashToStart ) { SimpleStrategy simpleStrategy = new SimpleStrategy( weightedPositions , intervalsSelector , historicalQuoteProvider ); IAccountProvider accountProvider = new SimpleAccountProvider(); DateTime firstDateTime = this.endOfDayDateTimeWhenThisObjectWasLogged.DateTime.AddDays( - this.numberOfInSampleDays ); DateTime lastDateTime = this.endOfDayDateTimeWhenThisObjectWasLogged.DateTime; double maxRunningHours = 0.3; EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( "SinglePosition" , simpleStrategy , historicalQuoteProvider , accountProvider , firstDateTime , lastDateTime , benchmark , cashToStart , maxRunningHours ); simpleStrategy.Account = endOfDayStrategyBackTester.Account; endOfDayStrategyBackTester.Run(); return endOfDayStrategyBackTester.AccountReport; } private WeightedPositions getWeightedPositions( WeightedPosition weightedPosition ) { double[] weights = { 1 }; string[] tickers = { weightedPosition.Ticker }; WeightedPositions weightedPositions = new WeightedPositions( weights , tickers ); return weightedPositions; } public void Run() { // string backTestId = "SimplePairsTrading"; // double cashToStart = 30000; Benchmark benchmark = new Benchmark( "MSFT" ); IHistoricalQuoteProvider historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); // IInSampleChooser inSampleChooser = // (IInSampleChooser)new ConstantWeightedPositionsChooser( // this.BestWeightedPositionsInSample ); IIntervalsSelector intervalsSelector = new OddIntervalsSelector( 1 , 1 , benchmark ); IEligiblesSelector eligiblesSelector = new DummyEligibleSelector(); WeightedPositions weightedPositions = this.testingPositions.WeightedPositions; WeightedPositions firstPosition = this.getWeightedPositions( weightedPositions[ 0 ] ); WeightedPositions secondPosition = this.getWeightedPositions( weightedPositions[ 1 ] ); AccountReport accountReportForFirstPosition = this.getAccountReport( firstPosition , intervalsSelector , historicalQuoteProvider , benchmark , 30000 ); AccountReport accountReportForSecondPosition = this.getAccountReport( secondPosition , intervalsSelector , historicalQuoteProvider , benchmark , 30000 * weightedPositions[ 1 ].Weight / weightedPositions[ 0 ].Weight ); Report report = new Report( accountReportForFirstPosition , false ); EndOfDayDateTime lastEndOfDayDateTimeForReport = new EndOfDayDateTime( accountReportForFirstPosition.EquityLine.LastDateTime , EndOfDaySpecificTime.OneHourAfterMarketClose ); // report.Create( "PearsonDebug" , 1 , // lastEndOfDayDateTimeForReport , // benchmark.Ticker , false ); report.AddEquityLine( accountReportForSecondPosition.EquityLine , Color.Brown ); report.ShowDialog(); } #endregion Run } } |
|
From: Glauco S. <gla...@us...> - 2008-03-13 19:32:11
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13744/b4_Business Modified Files: b4_Business.csproj Log Message: a4_Scripting\IExecutable.cs has been added Index: b4_Business.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** b4_Business.csproj 12 Mar 2008 21:55:13 -0000 1.59 --- b4_Business.csproj 13 Mar 2008 19:32:04 -0000 1.60 *************** *** 953,956 **** --- 953,961 ---- /> <File + RelPath = "a4_Scripting\IExecutable.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a4_Scripting\Script.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2008-03-13 19:29:26
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11979/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: a4_Scripting\IExecutable.cs has been added Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** b7_Scripts.csproj 12 Mar 2008 22:06:59 -0000 1.88 --- b7_Scripts.csproj 13 Mar 2008 19:29:20 -0000 1.89 *************** *** 330,348 **** /> <File - RelPath = "TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVO_OTCLogItem.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File - RelPath = "TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVO_OTCMain.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File - RelPath = "TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVO_OTCStrategy.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVOGenomeManager.cs" SubType = "Code" --- 330,333 ---- *************** *** 415,423 **** /> <File - RelPath = "TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\InSampleChoosers\PVO_OTCCorrelationChooser.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\InSampleChoosers\PVOCorrelationChooser.cs" SubType = "Code" --- 400,403 ---- *************** *** 930,933 **** --- 910,918 ---- /> <File + RelPath = "WalkForwardTesting\PairsTrading\Logging\TesterForPairsTradingTestingPositions.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "WalkForwardTesting\WalkForwardLag\RunSimpleLag.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2008-03-13 19:28:43
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a4_Scripting In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv11347/b4_Business/a4_Scripting Added Files: IExecutable.cs Log Message: no message --- NEW FILE: IExecutable.cs --- /* QuantProject - Quantitative Finance Library IExecutable.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; namespace QuantProject.Business.Scripting { /// <summary> /// Interface to be implemented by classes that are executable /// </summary> public interface IExecutable { void Run(); } } |
|
From: Marco M. <mi...@us...> - 2008-03-12 22:10:06
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/WalkForwardTest In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10177/WalkForwardTesting/LinearCombination/WalkForwardTest Modified Files: WalkForwardOpenToCloseDailyStrategy.cs Log Message: Changed IEndOfDayStrategy interface Index: WalkForwardOpenToCloseDailyStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/WalkForwardTest/WalkForwardOpenToCloseDailyStrategy.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** WalkForwardOpenToCloseDailyStrategy.cs 14 Jan 2008 23:42:36 -0000 1.7 --- WalkForwardOpenToCloseDailyStrategy.cs 12 Mar 2008 22:09:59 -0000 1.8 *************** *** 57,61 **** private OptimizationOutput optimizationOutput; ! /// best genomes, one for each optimization process public OptimizationOutput OptimizationOutput --- 57,67 ---- private OptimizationOutput optimizationOutput; ! ! public Account Account ! { ! get { return this.account; } ! set { this.account = value; } ! } ! /// best genomes, one for each optimization process public OptimizationOutput OptimizationOutput |
|
From: Marco M. <mi...@us...> - 2008-03-12 22:09:30
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10150/WalkForwardTesting/LinearCombination Modified Files: OpenToCloseDailyStrategy.cs OpenToCloseWeeklyStrategy.cs OTC_CTODailyStrategy.cs Log Message: Changed IEndOfDayStrategy interface Index: OpenToCloseWeeklyStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/OpenToCloseWeeklyStrategy.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OpenToCloseWeeklyStrategy.cs 29 Aug 2007 09:43:37 -0000 1.2 --- OpenToCloseWeeklyStrategy.cs 12 Mar 2008 22:09:25 -0000 1.3 *************** *** 40,44 **** private Account account; private WeightedPositions weightedPositions; ! public OpenToCloseWeeklyStrategy( Account account , WeightedPositions weightedPositions) --- 40,50 ---- private Account account; private WeightedPositions weightedPositions; ! ! public Account Account ! { ! get { return this.account; } ! set { this.account = value; } ! } ! public OpenToCloseWeeklyStrategy( Account account , WeightedPositions weightedPositions) Index: OpenToCloseDailyStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/OpenToCloseDailyStrategy.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** OpenToCloseDailyStrategy.cs 29 Aug 2007 09:43:37 -0000 1.3 --- OpenToCloseDailyStrategy.cs 12 Mar 2008 22:09:25 -0000 1.4 *************** *** 40,44 **** private Account account; private WeightedPositions chosenWeightedPositions; ! public OpenToCloseDailyStrategy( Account account , WeightedPositions chosenWeightedPositions) --- 40,50 ---- private Account account; private WeightedPositions chosenWeightedPositions; ! ! public Account Account ! { ! get { return this.account; } ! set { this.account = value; } ! } ! public OpenToCloseDailyStrategy( Account account , WeightedPositions chosenWeightedPositions) Index: OTC_CTODailyStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/OTC_CTODailyStrategy.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OTC_CTODailyStrategy.cs 29 Aug 2007 09:43:37 -0000 1.2 --- OTC_CTODailyStrategy.cs 12 Mar 2008 22:09:25 -0000 1.3 *************** *** 40,44 **** private Account account; WeightedPositions weightedPositions; ! public OTC_CTODailyStrategy( Account account , WeightedPositions weightedPositions) --- 40,50 ---- private Account account; WeightedPositions weightedPositions; ! ! public Account Account ! { ! get { return this.account; } ! set { this.account = value; } ! } ! public OTC_CTODailyStrategy( Account account , WeightedPositions weightedPositions) |
|
From: Marco M. <mi...@us...> - 2008-03-12 22:09:11
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9863/WalkForwardTesting/LinearCombination Modified Files: CloseToOpenDailyStrategy.cs ExtremeCounterTrendStrategy.cs FixedLevelOscillatorBiasedPVOStrategy.cs FixedLevelOscillatorPVOStrategy.cs Log Message: Changed IEndOfDayStrategy interface Index: FixedLevelOscillatorBiasedPVOStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/FixedLevelOscillatorBiasedPVOStrategy.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FixedLevelOscillatorBiasedPVOStrategy.cs 14 Jan 2008 23:07:06 -0000 1.4 --- FixedLevelOscillatorBiasedPVOStrategy.cs 12 Mar 2008 22:09:04 -0000 1.5 *************** *** 73,77 **** this.numOfDifferentGenomesToEvaluateOutOfSample = numOfDifferentGenomesToEvaluateOutOfSample; } ! public void FiveMinutesBeforeMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs) --- 73,77 ---- this.numOfDifferentGenomesToEvaluateOutOfSample = numOfDifferentGenomesToEvaluateOutOfSample; } ! public void FiveMinutesBeforeMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs) Index: CloseToOpenDailyStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/CloseToOpenDailyStrategy.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CloseToOpenDailyStrategy.cs 29 Aug 2007 09:43:35 -0000 1.2 --- CloseToOpenDailyStrategy.cs 12 Mar 2008 22:09:04 -0000 1.3 *************** *** 40,44 **** private Account account; private WeightedPositions weightedPositions; ! public CloseToOpenDailyStrategy( Account account , WeightedPositions weightedPositions) --- 40,50 ---- private Account account; private WeightedPositions weightedPositions; ! ! public Account Account ! { ! get { return this.account; } ! set { this.account = value; } ! } ! public CloseToOpenDailyStrategy( Account account , WeightedPositions weightedPositions) Index: ExtremeCounterTrendStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/ExtremeCounterTrendStrategy.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ExtremeCounterTrendStrategy.cs 29 Aug 2007 09:43:35 -0000 1.4 --- ExtremeCounterTrendStrategy.cs 12 Mar 2008 22:09:04 -0000 1.5 *************** *** 48,51 **** --- 48,57 ---- private PortfolioType portfolioType; + public Account Account + { + get { return this.account; } + set { this.account = value; } + } + public ExtremeCounterTrendStrategy( Account account , WeightedPositions weightedPositions, Index: FixedLevelOscillatorPVOStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/FixedLevelOscillatorPVOStrategy.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FixedLevelOscillatorPVOStrategy.cs 14 Jan 2008 23:07:06 -0000 1.7 --- FixedLevelOscillatorPVOStrategy.cs 12 Mar 2008 22:09:04 -0000 1.8 *************** *** 41,45 **** public class FixedLevelOscillatorPVOStrategy : EndOfDayTimerHandlerPVO, IEndOfDayStrategy { ! public FixedLevelOscillatorPVOStrategy( Account accountPVO , WeightedPositions chosenWeightedPositions, --- 41,45 ---- public class FixedLevelOscillatorPVOStrategy : EndOfDayTimerHandlerPVO, IEndOfDayStrategy { ! public FixedLevelOscillatorPVOStrategy( Account accountPVO , WeightedPositions chosenWeightedPositions, |
|
From: Marco M. <mi...@us...> - 2008-03-12 22:09:10
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases/Logging In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9863/WalkForwardTesting/FixedLengthTwoPhases/Logging Modified Files: FixedLengthTwoPhasesLogItem.cs Log Message: Changed IEndOfDayStrategy interface Index: FixedLengthTwoPhasesLogItem.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases/Logging/FixedLengthTwoPhasesLogItem.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FixedLengthTwoPhasesLogItem.cs 10 Feb 2008 15:24:52 -0000 1.2 --- FixedLengthTwoPhasesLogItem.cs 12 Mar 2008 22:09:05 -0000 1.3 *************** *** 25,28 **** --- 25,29 ---- using QuantProject.Business.DataProviders; using QuantProject.Business.Strategies; + using QuantProject.Business.Financial.Accounting.AccountProviding; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.InSample; *************** *** 129,133 **** new EndOfDayStrategyBackTester( backTestId , fixedLengthTwoPhasesStrategy , ! historicalQuoteProvider , firstDateTime , lastDateTime , benchmark , cashToStart , maxRunningHours ); --- 130,135 ---- new EndOfDayStrategyBackTester( backTestId , fixedLengthTwoPhasesStrategy , ! historicalQuoteProvider , ! new SimpleAccountProvider() , firstDateTime , lastDateTime , benchmark , cashToStart , maxRunningHours ); |
|
From: Marco M. <mi...@us...> - 2008-03-12 22:09:10
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9863/WalkForwardTesting/FixedLengthTwoPhases Modified Files: FixedLengthTwoPhasesMain.cs FixedLengthTwoPhasesStrategy.cs Log Message: Changed IEndOfDayStrategy interface Index: FixedLengthTwoPhasesStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases/FixedLengthTwoPhasesStrategy.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FixedLengthTwoPhasesStrategy.cs 10 Feb 2008 14:21:57 -0000 1.4 --- FixedLengthTwoPhasesStrategy.cs 12 Mar 2008 22:09:05 -0000 1.5 *************** *** 65,68 **** --- 65,69 ---- public Account Account { + get { return this.account; } set { this.account = value; } } Index: FixedLengthTwoPhasesMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases/FixedLengthTwoPhasesMain.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FixedLengthTwoPhasesMain.cs 10 Feb 2008 14:20:32 -0000 1.5 --- FixedLengthTwoPhasesMain.cs 12 Mar 2008 22:09:05 -0000 1.6 *************** *** 26,29 **** --- 26,30 ---- using QuantProject.Business.DataProviders; using QuantProject.Business.Strategies; + using QuantProject.Business.Financial.Accounting.AccountProviding; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.EquityEvaluation; *************** *** 170,174 **** new EndOfDayStrategyBackTester( backTestId , fixedLengthTwoPhasesStrategy , ! historicalQuoteProvider , firstDateTime , lastDateTime , benchmark , cashToStart , maxRunningHours ); --- 171,176 ---- new EndOfDayStrategyBackTester( backTestId , fixedLengthTwoPhasesStrategy , ! historicalQuoteProvider , ! new SimpleAccountProvider(), firstDateTime , lastDateTime , benchmark , cashToStart , maxRunningHours ); |