quantproject-developers Mailing List for QuantProject (Page 61)
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-01-19 18:35:37
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4015 Added Files: FixedLengthTwoPhasesMain.cs Log Message: Entry point for the FixedLengthTwoPhases strategy. If any strategy parameter had to be changed, this is the place where it should be done --- NEW FILE: FixedLengthTwoPhasesMain.cs --- /* QuantProject - Quantitative Finance Library FixedLengthTwoPhasesMain.cs Copyright (C) 2007 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.ADT; using QuantProject.Business.DataProviders; using QuantProject.Business.Strategies; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.EquityEvaluation; using QuantProject.Business.Strategies.Optimizing.Decoding; using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Strategies.ReturnsManagement.Time; using QuantProject.Business.Strategies.ReturnsManagement.Time.IntervalsSelectors; using QuantProject.Business.Timing; using QuantProject.Presentation; using QuantProject.Presentation.Reporting.WindowsForm; namespace QuantProject.Scripts.WalkForwardTesting.FixedLengthTwoPhases { /// <summary> /// Entry point for the FixedLengthTwoPhases strategy. If any strategy /// parameter had to be changed, this is the place where it should /// be done /// </summary> public class FixedLengthTwoPhasesMain { public FixedLengthTwoPhasesMain() { } #region Run private MessageManager setMessageManager( IEligiblesSelector eligiblesSelector , IInSampleChooser inSampleChooser , IEndOfDayStrategy endOfDayStrategy , EndOfDayStrategyBackTester endOfDayStrategyBackTester ) { MessageManager messageManager = new MessageManager( "FixedLengthUpDown.Txt" ); messageManager.Monitor( eligiblesSelector ); messageManager.Monitor( inSampleChooser ); // messageManager.Monitor( endOfDayStrategy ); messageManager.Monitor( endOfDayStrategyBackTester ); return messageManager; } // TO DO check if you can add this to QuantProject.Presentation.Reporting.WindowsForm.Report // as a public method or as a new constructor private void showReport( DateTime lastDateTimeRequestedForTheScript , EndOfDayStrategyBackTester endOfDayStrategyBackTester ) { DateTime lastReportDateTime = ExtendedDateTime.Min( lastDateTimeRequestedForTheScript , endOfDayStrategyBackTester.EndOfDayTimer.GetCurrentTime().DateTime ); Report report = new Report( endOfDayStrategyBackTester.Account , endOfDayStrategyBackTester.HistoricalQuoteProvider ); report.Create( endOfDayStrategyBackTester.DescriptionForLogFileName , 1 , new EndOfDayDateTime( lastReportDateTime , EndOfDaySpecificTime.OneHourAfterMarketClose ) , endOfDayStrategyBackTester.Benchmark.Ticker ); report.Show(); } public void Run() { string backTestId = "WFFLTP"; double cashToStart = 30000; // int numberOfPortfolioPositions = 4; // int inSampleDays = 90; // string tickersGroupId = "SP500"; // uncomment the following three lines for faster scripts int numberOfPortfolioPositions = 2; int inSampleDays = 30; string tickersGroupId = "millo"; Benchmark benchmark = new Benchmark( "MSFT" ); int maxNumberOfEligiblesToBeChosen = 100; IDecoderForWeightedPositions decoderForWeightedPositions = new DecoderForBalancedWeightedPositions(); IHistoricalQuoteProvider historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); // definition for the Fitness Evaluator IEquityEvaluator equityEvaluator = new SharpeRatio(); FixedLengthTwoPhasesFitnessEvaluator fixedLengthTwoPhasesFitnessEvaluator = new FixedLengthTwoPhasesFitnessEvaluator( equityEvaluator ); // parameters for the genetic optimizer double crossoverRate = 0.85; double mutationRate = 0.02; double elitismRate = 0.001; int populationSizeForGeneticOptimizer = 3000; int generationNumberForGeneticOptimizer = 5; int seedForRandomGenerator = QuantProject.ADT.ConstantsProvider.SeedForRandomGenerator; IInSampleChooser inSampleChooser = new FixedLengthTwoPhasesGeneticChooser( numberOfPortfolioPositions , inSampleDays , benchmark , decoderForWeightedPositions , fixedLengthTwoPhasesFitnessEvaluator , historicalQuoteProvider , crossoverRate , mutationRate , elitismRate , populationSizeForGeneticOptimizer , generationNumberForGeneticOptimizer , seedForRandomGenerator ); IIntervalsSelector intervalsSelector = new FixedLengthTwoPhasesIntervalsSelector( 1 , 1 , benchmark ); IEligiblesSelector eligiblesSelector = new MostLiquidAndLessVolatile( tickersGroupId , maxNumberOfEligiblesToBeChosen ); FixedLengthTwoPhasesStrategy fixedLengthTwoPhasesStrategy = new FixedLengthTwoPhasesStrategy( numberOfPortfolioPositions , 7 , 90 , benchmark , intervalsSelector , eligiblesSelector , inSampleChooser , historicalQuoteProvider ); DateTime firstDateTime = new DateTime( 2001 , 1 , 2 ); DateTime lastDateTime = new DateTime( 2004 , 1 , 15 ); double maxRunningHours = 0.2; EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( backTestId , fixedLengthTwoPhasesStrategy , historicalQuoteProvider , firstDateTime , lastDateTime , benchmark , cashToStart , maxRunningHours ); // TO DO check if you can do this assign in the EndOfDayStrategyBackTester // constructor fixedLengthTwoPhasesStrategy.Account = endOfDayStrategyBackTester.Account; MessageManager messageManager = this.setMessageManager( eligiblesSelector , inSampleChooser , fixedLengthTwoPhasesStrategy , endOfDayStrategyBackTester ); endOfDayStrategyBackTester.Run(); this.showReport( lastDateTime , endOfDayStrategyBackTester ); } #endregion Run } } |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:32:04
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2411 Added Files: FixedLengthTwoPhasesLogItem.cs Log Message: Log item for the FixedLengthTwoPhases strategy --- NEW FILE: FixedLengthTwoPhasesLogItem.cs --- /* QuantProject - Quantitative Finance Library FixedLengthTwoPhasesLogItem.cs Copyright (C) 2007 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.Strategies; using QuantProject.Business.Strategies.Logging; using QuantProject.Business.Timing; namespace QuantProject.Scripts.WalkForwardTesting.FixedLengthTwoPhases { /// <summary> /// Log item for the FixedLengthTwoPhases strategy /// </summary> public class FixedLengthTwoPhasesLogItem : LogItem { private WeightedPositions bestWeightedPositionsInSample; private int numberOfEligibleTickers; public WeightedPositions BestWeightedPositionsInSample { get { if ( this.bestWeightedPositionsInSample == null ) throw new Exception( "This property has not " + "been assigned yet! If you are loading the LogItem from " + "a log, this property was not set before logging the LogItem." ); return this.bestWeightedPositionsInSample; } set { this.bestWeightedPositionsInSample = value; } } public int NumberOfEligibleTickers { get { if ( this.numberOfEligibleTickers == int.MinValue ) throw new Exception( "This property has not " + "been assigned yet! If you are loading the LogItem from " + "a log, this property was not set before logging the LogItem." ); return this.numberOfEligibleTickers; } set { this.numberOfEligibleTickers = value; } } public FixedLengthTwoPhasesLogItem( EndOfDayDateTime endOfDayDateTime ) : base( endOfDayDateTime ) { this.numberOfEligibleTickers = int.MinValue; } public override void Run() { // TO DO write a script to debug the in sample // optimization result } } } |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:28:11
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases/InSampleChoosers/Genetic In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1004/Genetic Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases/InSampleChoosers/Genetic added to the repository |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:27:55
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases/InSampleChoosers In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv653/InSampleChoosers Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases/InSampleChoosers added to the repository |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:27:44
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv638/FixedLengthTwoPhases Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases added to the repository |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:26:39
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv32685/b5_Presentation Modified Files: Presentation_SD.csproj Log Message: MessageManager.cs has been added Index: Presentation_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Presentation_SD.csproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Presentation_SD.csproj 29 Aug 2007 10:34:59 -0000 1.2 --- Presentation_SD.csproj 19 Jan 2008 18:26:34 -0000 1.3 *************** *** 65,68 **** --- 65,69 ---- <Compile Include="Charting\CharPlot.cs" /> <Compile Include="Charting\Chart.cs" /> + <Compile Include="MessageManager.cs" /> <Compile Include="Reporting\Console\ConsoleManager.cs" /> <Compile Include="Reporting\MicrosoftExcel\ExcelManager.cs" /> |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:26:13
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv32646/b5_Presentation Modified Files: b5_Presentation.csproj Log Message: MessageManager.cs has been added Index: b5_Presentation.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/b5_Presentation.csproj,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** b5_Presentation.csproj 29 Aug 2007 10:32:02 -0000 1.39 --- b5_Presentation.csproj 19 Jan 2008 18:26:09 -0000 1.40 *************** *** 126,138 **** /> <Reference - Name = "b4_Business" - Project = "{6EE31501-376E-491B-869E-F06D5B7C9C30}" - Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" - /> - <Reference Name = "NPlot" AssemblyName = "NPlot" HintPath = "..\..\NPlot.dll" /> </References> </Build> --- 126,138 ---- /> <Reference Name = "NPlot" AssemblyName = "NPlot" HintPath = "..\..\NPlot.dll" /> + <Reference + Name = "b4_Business" + Project = "{6EE31501-376E-491B-869E-F06D5B7C9C30}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> </References> </Build> *************** *** 150,153 **** --- 150,158 ---- /> <File + RelPath = "MessageManager.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "VisualObjectArchiver.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:25:01
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv31842 Added Files: MessageManager.cs Log Message: Manages text messages --- NEW FILE: MessageManager.cs --- /* QuantProject - Quantitative Finance Library MessageManager.cs Copyright (C) 2007 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.Messaging; namespace QuantProject.Presentation { /// <summary> /// Manages text messages /// </summary> public class MessageManager { private string textFileName; /// <summary> /// Manages text messages /// </summary> /// <param name="textFileName">messages will be written to this file /// also</param> public MessageManager( string textFileName ) { this.textFileName = textFileName; } /// <summary> /// Displays a text message to the console and logs the message /// in the specified text file /// </summary> /// <param name="message"></param> /// <param name="textFileName"></param> public static void DisplayMessage( string message , string textFileName ) { // Console.WriteLine( message ); // Console.WriteLine( "" ); System.Diagnostics.Debug.Listeners[0].WriteLine( message ); // FileStream fileStream = new FileStream( "WFLagLog.Txt" , // FileMode.OpenOrCreate ); StreamWriter streamWriter = new StreamWriter( textFileName , true ); streamWriter.WriteLine( message ); streamWriter.Close(); // fileStream.Close(); } #region Monitor private void newMessageHandler( Object sender , NewMessageEventArgs eventArgs ) { MessageManager.DisplayMessage( eventArgs.Message + "\n" , this.textFileName ); } /// <summary> /// Adds the messageSender to the list of senders that this MessageManager /// is listening to. When the messageSender will rise a new message, /// this MessageManager will display it /// </summary> /// <param name="messageSender"></param> public void Monitor( IMessageSender messageSender ) { messageSender.NewMessage += new NewMessageHandler( this.newMessageHandler ); } #endregion Monitor } } |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:21:15
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30584/b4_Business Modified Files: Business_SD.csproj Log Message: a2_Strategies\Benchmark.cs has been added a2_Strategies\EndOfDayStrategyBackTester.cs has been added a2_Strategies\IEndOfDayStrategyForBacktester.cs has been added a2_Strategies\IInSampleChooser.cs has been added a2_Strategies\Eligibles\EligibleTickers.cs has been added a2_Strategies\Eligibles\IEligiblesSelector.cs has been added a2_Strategies\Eligibles\MostLiquidAndLessVolatile.cs has been added a2_Strategies\Logging\BackTestLog.cs has been added 2_Strategies\Logging\LogItem.cs has been added a2_Strategies\Logging\NewLogItemEventArgs.cs has been added a2_Strategies\Optimizing\Decoding\DecoderForBalancedWeightedPositions.cs has been added a2_Strategies\Optimizing\Decoding\IDecoderForWeightedPositions.cs has been added a2_Strategies\returnsManagement\time\selectors\FixedLengthTwoPhasesIntervalsSelector.cs has been added a2_Strategies\returnsManagement\time\selectors\IIntervalsSelector.cs has been added Index: Business_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/Business_SD.csproj,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Business_SD.csproj 14 Jan 2008 23:54:11 -0000 1.7 --- Business_SD.csproj 19 Jan 2008 18:21:08 -0000 1.8 *************** *** 61,64 **** --- 61,76 ---- <Compile Include="a07_DataProviders\HistoricalQuoteProvider.cs" /> <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\AverageNumberOfTransactionsPerDay.cs" /> + <Compile Include="a2_Strategies\Benchmark.cs" /> + <Compile Include="a2_Strategies\Eligibles\EligibleTickers.cs" /> + <Compile Include="a2_Strategies\Eligibles\IEligiblesSelector.cs" /> + <Compile Include="a2_Strategies\Eligibles\MostLiquidAndLessVolatile.cs" /> + <Compile Include="a2_Strategies\EndOfDayStrategyBackTester.cs" /> + <Compile Include="a2_Strategies\IEndOfDayStrategyForBacktester.cs" /> + <Compile Include="a2_Strategies\IInSampleChooser.cs" /> + <Compile Include="a2_Strategies\Logging\BackTestLog.cs" /> + <Compile Include="a2_Strategies\Logging\LogItem.cs" /> + <Compile Include="a2_Strategies\Logging\NewLogItemEventArgs.cs" /> + <Compile Include="a2_Strategies\Optimizing\Decoding\DecoderForBalancedWeightedPositions.cs" /> + <Compile Include="a2_Strategies\Optimizing\Decoding\IDecoderForWeightedPositions.cs" /> <Compile Include="a2_Strategies\returnsManagement\time\CloseToCloseIntervals.cs" /> <Compile Include="a2_Strategies\returnsManagement\time\CloseToOpenIntervals.cs" /> *************** *** 67,70 **** --- 79,84 ---- <Compile Include="a2_Strategies\returnsManagement\time\ReturnInterval.cs" /> <Compile Include="a2_Strategies\returnsManagement\time\ReturnIntervals.cs" /> + <Compile Include="a2_Strategies\returnsManagement\time\selectors\IIntervalsSelector.cs" /> + <Compile Include="a2_Strategies\returnsManagement\time\selectors\FixedLengthTwoPhasesIntervalsSelector.cs" /> <Compile Include="a2_Strategies\TickersRelationships\CloseToCloseCorrelationProvider.cs" /> <Compile Include="a2_Strategies\TickersRelationships\CorrelationProvider.cs" /> *************** *** 197,203 **** --- 211,222 ---- <Name>b3_Data</Name> </ProjectReference> + <Folder Include="a2_Strategies\Eligibles" /> <Folder Include="a2_Strategies\EquityEvaluation" /> + <Folder Include="a2_Strategies\Logging" /> + <Folder Include="a2_Strategies\Optimizing" /> + <Folder Include="a2_Strategies\Optimizing\Decoding" /> <Folder Include="a2_Strategies\returnsManagement" /> <Folder Include="a2_Strategies\returnsManagement\time" /> + <Folder Include="a2_Strategies\returnsManagement\time\selectors" /> <Folder Include="a2_Strategies\TickersRelationships" /> </ItemGroup> |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:20:29
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30174/b1_ADT Modified Files: b1_ADT.csproj Log Message: Messaging\IMessageSender.cs has been added Messaging\NewMessageEventArgs.cs has been added Optimizing\Decoding\IDecoder.cs has been added Optimizing\Decoding\MeaningForUndecodableEncoded.cs has been added Index: b1_ADT.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/b1_ADT.csproj,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** b1_ADT.csproj 7 Oct 2007 10:27:50 -0000 1.26 --- b1_ADT.csproj 19 Jan 2008 18:20:26 -0000 1.27 *************** *** 2,6 **** <CSHARP ProjectType = "Local" ! ProductVersion = "7.0.9466" SchemaVersion = "1.0" ProjectGuid = "{B8A01161-3698-4591-B1EF-90F5FC7D8DBA}" --- 2,6 ---- <CSHARP ProjectType = "Local" ! ProductVersion = "7.0.9955" SchemaVersion = "1.0" ProjectGuid = "{B8A01161-3698-4591-B1EF-90F5FC7D8DBA}" *************** *** 198,201 **** --- 198,211 ---- /> <File + RelPath = "Messaging\IMessageSender.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Messaging\NewMessageEventArgs.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Optimizing\Optimizable.cs" SubType = "Code" *************** *** 228,231 **** --- 238,251 ---- /> <File + RelPath = "Optimizing\Decoding\IDecoder.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Optimizing\Decoding\MeaningForUndecodableEncoded.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Optimizing\Genetic\GeneticOptimizer.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:19:57
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29713/b1_ADT Modified Files: ADT_SD.csproj Log Message: Messaging\IMessageSender.cs has been added Messaging\NewMessageEventArgs.cs has been added Optimizing\Decoding\IDecoder.cs has been added Optimizing\Decoding\MeaningForUndecodableEncoded.cs has been added Index: ADT_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ADT_SD.csproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ADT_SD.csproj 28 Oct 2007 18:28:46 -0000 1.4 --- ADT_SD.csproj 19 Jan 2008 18:19:54 -0000 1.5 *************** *** 55,59 **** --- 55,63 ---- <Compile Include="IProgressNotifier.cs" /> <Compile Include="Keyed.cs" /> + <Compile Include="Messaging\IMessageSender.cs" /> + <Compile Include="Messaging\NewMessageEventArgs.cs" /> <Compile Include="NewProgressEventArgs.cs" /> + <Compile Include="Optimizing\Decoding\IDecoder.cs" /> + <Compile Include="Optimizing\Decoding\MeaningForUndecodableEncoded.cs" /> <Compile Include="RecursiveHashTable.cs" /> <Compile Include="FileManaging\ObjectArchiver.cs" /> *************** *** 91,95 **** --- 95,101 ---- </ItemGroup> <ItemGroup> + <Folder Include="Messaging" /> <Folder Include="Optimizing\BruteForce" /> + <Folder Include="Optimizing\Decoding" /> <Folder Include="Statistics\Combinatorial" /> </ItemGroup> |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:18:25
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29273 Added Files: MeaningForUndecodableEncoded.cs Log Message: Object used to assign a dummy meaning to those objects (genomes or bruteForceOptimizableParameters) that cannot be decoded to something meaningful. It will be returned by an IDecoder when the Decode method fails --- NEW FILE: MeaningForUndecodableEncoded.cs --- /* QuantProject - Quantitative Finance Library MeaningForUndecodableEncoded.cs Copyright (C) 2007 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.ADT.Optimizing.Decoding { /// <summary> /// Object used to assign a dummy meaning to those objects (genomes or /// bruteForceOptimizableParameters) that /// cannot be decoded to something meaningful. It will be returned /// by an IDecoder when the Decode method fails /// </summary> public class MeaningForUndecodableEncoded { public MeaningForUndecodableEncoded() { // // TODO: Add constructor logic here // } } } |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:17:08
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28617 Added Files: IDecoder.cs Log Message: Interface to be implemented by decoders for optimizers (both for genetic and for brute force optimizers) --- NEW FILE: IDecoder.cs --- /* QuantProject - Quantitative Finance Library IDecoder.cs Copyright (C) 2007 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.ADT.Optimizing.Decoding { /// <summary> /// Interface to be implemented by decoders for optimizers (both for /// genetic and for brute force optimizers) /// </summary> public interface IDecoder { /// <summary> /// Decodes the given candidate for the optimization /// </summary> object Decode( int[] encoded ); } } |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:16:39
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28451/Decoding Log Message: Directory /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Decoding added to the repository |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:16:00
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Messaging In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28063 Added Files: NewMessageEventArgs.cs Log Message: EventArgs for the NewMessage event --- NEW FILE: NewMessageEventArgs.cs --- /* QuantProject - Quantitative Finance Library NewMessageEventArgs.cs Copyright (C) 2007 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.ADT.Messaging { /// <summary> /// EventArgs for the NewMessage event /// </summary> public class NewMessageEventArgs : EventArgs { private string message; public string Message { get { return this.message; } } public NewMessageEventArgs( string message ) { this.message = message; } } } |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:15:07
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Messaging In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27719 Added Files: IMessageSender.cs Log Message: Interface to be implemented by those object that send text messages to the outside world --- NEW FILE: IMessageSender.cs --- /* QuantProject - Quantitative Finance Library IMessageSender.cs Copyright (C) 2007 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.ADT.Messaging { public delegate void NewMessageHandler( Object sender , NewMessageEventArgs eventArgs ); /// <summary> /// Interface to be implemented by those object that send /// text messages to the outside world /// </summary> public interface IMessageSender { event NewMessageHandler NewMessage; } } |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:14:21
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Messaging In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27584/Messaging Log Message: Directory /cvsroot/quantproject/QuantProject/b1_ADT/Messaging added to the repository |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:12:20
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26750/b4_Business Modified Files: b4_Business.csproj Log Message: a2_Strategies\Benchmark.cs has been added a2_Strategies\EndOfDayStrategyBackTester.cs has been added a2_Strategies\IEndOfDayStrategyForBacktester.cs has been added a2_Strategies\IInSampleChooser.cs has been added a2_Strategies\Eligibles\EligibleTickers.cs has been added a2_Strategies\Eligibles\IEligiblesSelector.cs has been added a2_Strategies\Eligibles\MostLiquidAndLessVolatile.cs has been added a2_Strategies\Logging\BackTestLog.cs has been added 2_Strategies\Logging\LogItem.cs has been added a2_Strategies\Logging\NewLogItemEventArgs.cs has been added a2_Strategies\Optimizing\Decoding\DecoderForBalancedWeightedPositions.cs has been added a2_Strategies\Optimizing\Decoding\IDecoderForWeightedPositions.cs has been added a2_Strategies\returnsManagement\time\selectors\FixedLengthTwoPhasesIntervalsSelector.cs has been added a2_Strategies\returnsManagement\time\selectors\IIntervalsSelector.cs has been added Index: b4_Business.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** b4_Business.csproj 14 Jan 2008 23:46:23 -0000 1.49 --- b4_Business.csproj 19 Jan 2008 18:12:17 -0000 1.50 *************** *** 613,616 **** --- 613,626 ---- /> <File + RelPath = "a2_Strategies\Benchmark.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a2_Strategies\EndOfDayStrategyBackTester.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a2_Strategies\IEndOfDayStrategy.cs" SubType = "Code" *************** *** 618,621 **** --- 628,641 ---- /> <File + RelPath = "a2_Strategies\IEndOfDayStrategyForBacktester.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a2_Strategies\IInSampleChooser.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a2_Strategies\Signal.cs" SubType = "Code" *************** *** 658,661 **** --- 678,696 ---- /> <File + RelPath = "a2_Strategies\Eligibles\EligibleTickers.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a2_Strategies\Eligibles\IEligiblesSelector.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a2_Strategies\Eligibles\MostLiquidAndLessVolatile.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a2_Strategies\EquityEvaluation\ExpectancyScore.cs" SubType = "Code" *************** *** 678,681 **** --- 713,741 ---- /> <File + RelPath = "a2_Strategies\Logging\BackTestLog.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a2_Strategies\Logging\LogItem.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a2_Strategies\Logging\NewLogItemEventArgs.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a2_Strategies\Optimizing\Decoding\DecoderForBalancedWeightedPositions.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a2_Strategies\Optimizing\Decoding\IDecoderForWeightedPositions.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a2_Strategies\returnsManagement\ReturnsManager.cs" SubType = "Code" *************** *** 713,716 **** --- 773,786 ---- /> <File + RelPath = "a2_Strategies\returnsManagement\time\selectors\FixedLengthTwoPhasesIntervalsSelector.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a2_Strategies\returnsManagement\time\selectors\IIntervalsSelector.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a2_Strategies\TickersRelationships\CloseToCloseCorrelationProvider.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:05:32
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/selectors In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23758 Added Files: IIntervalsSelector.cs Log Message: Interface for intervals' selectors. An interval selector is used in walk forward strategy to compute return intervals for both the in sample optimizations and the out of sample strategy --- NEW FILE: IIntervalsSelector.cs --- /* QuantProject - Quantitative Finance Library IIntervalsSelector.cs Copyright (C) 2007 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.Timing; namespace QuantProject.Business.Strategies.ReturnsManagement.Time.IntervalsSelectors { /// <summary> /// Interface for intervals' selectors. An interval selector is used in walk /// forward strategy to compute return intervals for both the in sample /// optimizations and the out of sample strategy /// </summary> public interface IIntervalsSelector { /// <summary> /// returns the first interval of a series (starting from dateTime) /// </summary> ReturnInterval GetFirstInterval( EndOfDayDateTime dateTime ); /// <summary> /// returns the next interval for the given returnIntervals /// </summary> ReturnInterval GetNextInterval( ReturnIntervals returnIntervals ); } } |
|
From: Glauco S. <gla...@us...> - 2008-01-19 18:03:24
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/selectors In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22941 Added Files: FixedLengthTwoPhasesIntervalsSelector.cs Log Message: FixedLengthTwoPhasesIntervalsSelector( int firstPhaseBenchmarkTimeSteps , int secondPhaseBenchmarkTimeSteps , Benchmark benchmark ) selects a set of intervals where there is a fixed number of time steps for even intervals (first, third, ...) and (possilby) a different fixed number of benchmark time steps for odd intervals (second, fourth, ...) A benchmark time step is either an "open to close" interval or a "close to open" interval (refered to dateTimes when the benchmark is exchanged The parameter "firstPhaseBenchmarkTimeSteps" denotes the number of benchmark time steps for the first phase (odd intervals) The parameter "secondPhaseBenchmarkTimeSteps" denotes the number of benchmark time steps for the second phase (even intervals) --- NEW FILE: FixedLengthTwoPhasesIntervalsSelector.cs --- /* QuantProject - Quantitative Finance Library FixedLengthTwoPhasesIntervalsSelector.cs Copyright (C) 2007 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.ADT.Histories; using QuantProject.Business.Timing; namespace QuantProject.Business.Strategies.ReturnsManagement.Time.IntervalsSelectors { /// <summary> /// Selects a set of intervals where there is a fixed number of time steps /// for even intervals (first, third, ...) and (possilby) a different /// fixed number of benchmark time steps for odd intervals (second, fourth, ...). /// A benchmark time step is either an "open to close" interval or /// a "close to open" interval (refered to dateTimes when the benchmark is /// exchanged) /// </summary> public class FixedLengthTwoPhasesIntervalsSelector : IIntervalsSelector { private int firstPhaseBenchmarkTimeSteps; private int secondPhaseBenchmarkTimeSteps; private Benchmark benchmark; /// <summary> /// Selects a set of intervals where there is a fixed number of time steps /// for even intervals (first, third, ...) and (possilby) a different /// fixed number of benchmark time steps for odd intervals (second, fourth, ...) /// A benchmark time step is either an "open to close" interval or /// a "close to open" interval (refered to dateTimes when the benchmark is /// exchanged) /// </summary> /// <param name="firstPhaseBenchmarkTimeSteps">number of benchmark time steps /// for the first phase (odd intervals)</param> /// <param name="secondPhaseBenchmarkTimeSteps">number of benchmark time steps /// for the second phase (even intervals)</param> /// <param name="benchmark"></param> public FixedLengthTwoPhasesIntervalsSelector( int firstPhaseBenchmarkTimeSteps , int secondPhaseBenchmarkTimeSteps , Benchmark benchmark ) { this.firstPhaseBenchmarkTimeSteps = firstPhaseBenchmarkTimeSteps; this.secondPhaseBenchmarkTimeSteps = secondPhaseBenchmarkTimeSteps; this.benchmark = benchmark; } #region getIntervalEnd private int getBenchmarkTimeStepsForCurrentPhase( int numIntervalsAlreadyDone ) { int benchmarkTimeStepsForCurrentPhase; if ( ( numIntervalsAlreadyDone % 2 ) == 0 ) // current phase is the first phase benchmarkTimeStepsForCurrentPhase = this.firstPhaseBenchmarkTimeSteps; else // current phase is the second phase benchmarkTimeStepsForCurrentPhase = this.secondPhaseBenchmarkTimeSteps; return benchmarkTimeStepsForCurrentPhase; } private EndOfDayDateTime getNextReturnIntervalEnd( EndOfDayDateTime returnIntervalBegin , int benchmarkTimeStepsForCurrentPhase ) { EndOfDayDateTime currentEndOfDayDateTime = returnIntervalBegin; for ( int i = 0 ; i < benchmarkTimeStepsForCurrentPhase ; i++ ) { currentEndOfDayDateTime = this.benchmark.GetTimeStep( currentEndOfDayDateTime ).End; } return currentEndOfDayDateTime; } private EndOfDayDateTime getIntervalEnd( EndOfDayDateTime nextReturnIntervalBegin , int numIntervalsAlreadyDone ) { int benchmarkTimeStepsForCurrentPhase = this.getBenchmarkTimeStepsForCurrentPhase( numIntervalsAlreadyDone ); EndOfDayDateTime nextReturnIntervalEnd = this.getNextReturnIntervalEnd( nextReturnIntervalBegin , benchmarkTimeStepsForCurrentPhase ); return nextReturnIntervalEnd; } #endregion getIntervalEnd public ReturnInterval GetNextInterval( ReturnIntervals returnIntervals ) { EndOfDayDateTime nextReturnIntervalBegin = returnIntervals[ returnIntervals.Count - 1 ].End; EndOfDayDateTime nextReturnIntervalEnd = this.getIntervalEnd( nextReturnIntervalBegin , returnIntervals.Count ); ReturnInterval nextInterval = new ReturnInterval( nextReturnIntervalBegin , nextReturnIntervalEnd ); return nextInterval; } #region GetFirstInterval private EndOfDayDateTime getFirstIntervalBegin( EndOfDayDateTime startingEndOfDayDateTime ) { // qui!!!! fai un ciclo while non exchanged (trova // il primo // successivo // in cui il // benchmark e' // scambiato) EndOfDayDateTime firstIntervalBegin = this.benchmark.GetThisOrNextMarketStatusSwitch( startingEndOfDayDateTime ); // EndOfDayDateTime firstIntervalBegin = // startingEndOfDayDateTime; // if ( ( startingEndOfDayDateTime.EndOfDaySpecificTime != // EndOfDaySpecificTime.MarketOpen ) && // ( startingEndOfDayDateTime.EndOfDaySpecificTime != // EndOfDaySpecificTime.MarketClose ) ) // // startingEndOfDayDateTime does not mark a market // // status switch // firstIntervalBegin = // startingEndOfDayDateTime.GetNextMarketStatusSwitch(); return firstIntervalBegin; } public ReturnInterval GetFirstInterval( EndOfDayDateTime startingEndOfDayDateTime ) { EndOfDayDateTime firstIntervalBegin = this.getFirstIntervalBegin( startingEndOfDayDateTime ); EndOfDayDateTime firstIntervalEnd = this.getIntervalEnd( firstIntervalBegin , 0 ); ReturnInterval nextInterval = new ReturnInterval( firstIntervalBegin , firstIntervalEnd ); return nextInterval; } #endregion GetFirstInterval } } |
|
From: Glauco S. <gla...@us...> - 2008-01-19 17:51:31
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/selectors In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18080/selectors Log Message: Directory /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/selectors added to the repository |
|
From: Glauco S. <gla...@us...> - 2008-01-19 17:50:57
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17687 Added Files: IDecoderForWeightedPositions.cs Log Message: Interface to be implemented by decoders for optimizers (both for genetic and for brute force optimizers) that will return a WeightedPositions --- NEW FILE: IDecoderForWeightedPositions.cs --- /* QuantProject - Quantitative Finance Library IDecoderForWeightedPositions.cs Copyright (C) 2007 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.Strategies.Eligibles; using QuantProject.Business.Strategies.ReturnsManagement; namespace QuantProject.Business.Strategies.Optimizing.Decoding { /// <summary> /// Interface to be implemented by decoders for optimizers (both for /// genetic and for brute force optimizers) that will return a WeightedPositions /// </summary> public interface IDecoderForWeightedPositions { /// <summary> /// Decodes the given candidate for the optimization /// </summary> object Decode( int[] encoded , EligibleTickers eligibleTickers , ReturnsManager returnsManager ); } } |
|
From: Glauco S. <gla...@us...> - 2008-01-19 17:50:02
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17183 Added Files: DecoderForBalancedWeightedPositions.cs Log Message: Decodes optimization candidates to balanced WeightedPositions (i.e. WeightedPositions where weights are normalized for volatility) --- NEW FILE: DecoderForBalancedWeightedPositions.cs --- /* QuantProject - Quantitative Finance Library DecoderForBalancedWeightedPositions.cs Copyright (C) 2007 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.ADT.Optimizing.Decoding; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.ReturnsManagement; namespace QuantProject.Business.Strategies.Optimizing.Decoding { /// <summary> /// Decodes optimization candidates to balanced WeightedPositions (i.e. /// WeightedPositions where weights are normalized for volatility) /// </summary> public class DecoderForBalancedWeightedPositions : IDecoderForWeightedPositions { private MeaningForUndecodableEncoded meaningForUndecodableEncoded; public DecoderForBalancedWeightedPositions() { this.meaningForUndecodableEncoded = new MeaningForUndecodableEncoded(); } #region Decode #region decodeSignedTickers private void decodeSignedTicker_checkParameters( int geneValue , EligibleTickers eligibleTickers ) { if ( geneValue >= eligibleTickers.Count ) throw new Exception( "geneValue is too (positive) large for eligibleTickers !!" ); if ( geneValue < -eligibleTickers.Count ) throw new Exception( "geneValue is too (negative) large for eligibleTickers !!" ); } private SignedTicker decodeSignedTicker( int signedTickerCode , EligibleTickers eligibleTickers ) { SignedTicker signedTicker; string ticker; decodeSignedTicker_checkParameters( signedTickerCode , eligibleTickers ); if ( signedTickerCode >= 0 ) { // long ticker ticker = eligibleTickers[ signedTickerCode ]; signedTicker = new SignedTicker( ticker , PositionType.Long ); } else { // short ticker ticker = eligibleTickers[ -(signedTickerCode+1) ]; signedTicker = new SignedTicker( ticker , PositionType.Short ); } return signedTicker; } private SignedTicker decodeSignedTickers( int i , int[] tickerRelatedGeneValues , EligibleTickers eligibleTickers ) { int currentGeneValue = tickerRelatedGeneValues[ i ]; return this.decodeSignedTicker( currentGeneValue , eligibleTickers ); } private SignedTickers decodeSignedTickers( int[] tickerRelatedGeneValues , EligibleTickers eligibleTickers ) { SignedTickers signedTickers = new SignedTickers(); for( int i = 0 ; i < tickerRelatedGeneValues.Length ; i++ ) { SignedTicker signedTicker = this.decodeSignedTickers( i , tickerRelatedGeneValues , eligibleTickers ); signedTickers.Add( signedTicker ); } return signedTickers; } #endregion decodeSignedTickers #region isDecodable private string[] getTickersForPositions( int[] encoded , EligibleTickers eligibleTickers ) { SignedTickers signedTickersForPositions = this.decodeSignedTickers( encoded , eligibleTickers ); return signedTickersForPositions.Tickers; } private bool isDecodable( int[] encoded , EligibleTickers eligibleTickers ) { return ( WeightedPositions.AreValidTickers( this.getTickersForPositions( encoded , eligibleTickers ) ) ); } #endregion isDecodable #region decodeDecodable private WeightedPositions decodeDecodable( int[] encoded , EligibleTickers eligibleTickers , ReturnsManager returnsManager ) { SignedTickers signedTickers = this.decodeSignedTickers( encoded , eligibleTickers ); double[] balancedWeightsForDrivingPositions = WeightedPositions.GetBalancedWeights( signedTickers , returnsManager ); WeightedPositions weightedPositions = new WeightedPositions( balancedWeightsForDrivingPositions , signedTickers.Tickers ); return weightedPositions; } #endregion eligibleTickers /// <summary> /// A positive array value means a long position. /// A negative array value means a short position. /// The positive value n means the same ticker as the value -(n+1). /// Thus, if there are p (>0) eligible tickers, array values should /// range from -p to p-1 /// </summary> /// <param name="encoded"></param> /// <returns></returns> public object Decode( int[] encoded , EligibleTickers eligibleTickers , ReturnsManager returnsManager ) { object meaning; if ( this.isDecodable( encoded , eligibleTickers ) ) // genome can be decoded to a WeightedPositions object meaning = this.decodeDecodable( encoded , eligibleTickers , returnsManager ); else // genome cannot be decoded to a WeightedPositions object meaning = this.meaningForUndecodableEncoded; return meaning; } #endregion Decode } } |
|
From: Glauco S. <gla...@us...> - 2008-01-19 17:49:30
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17156/Decoding Log Message: Directory /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding added to the repository |
|
From: Glauco S. <gla...@us...> - 2008-01-19 17:49:16
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv17139/Optimizing Log Message: Directory /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing added to the repository |