quantproject-developers Mailing List for QuantProject (Page 96)
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...> - 2005-12-11 18:22:13
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13442/b7_Scripts/TickerSelectionTesting Modified Files: CandidateProperties.cs Log Message: the method public float GetReturn( int arrayElementPosition , bool isLong ) has been added Index: CandidateProperties.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/CandidateProperties.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CandidateProperties.cs 21 Oct 2005 22:15:53 -0000 1.3 --- CandidateProperties.cs 11 Dec 2005 18:21:55 -0000 1.4 *************** *** 111,114 **** --- 111,123 ---- this.fitness = 0.0; } + public float GetReturn( int arrayElementPosition , + bool isLong ) + { + float returnValue = this.arrayOfRatesOfReturn[ arrayElementPosition ]; + if ( !isLong ) + // a reverse position return is requested + returnValue = -returnValue; + return returnValue; + } } |
|
From: Glauco S. <gla...@us...> - 2005-12-11 18:21:11
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13029/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: - VisualObjectArchiver.cs has been moved to the presentation layer - WalkForwardTesting\WalkForwardMultiOneRank\ReportDebugger\WFMultiOneRankDebugInSampleForm.cs has been added - WalkForwardTesting\WalkForwardMultiOneRank\ReportDebugger\WFMultiOneRankRunInSampleDebug.cs has been added Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** b7_Scripts.csproj 22 Nov 2005 16:25:15 -0000 1.45 --- b7_Scripts.csproj 11 Dec 2005 18:21:04 -0000 1.46 *************** *** 399,405 **** /> <File ! RelPath = "WalkForwardTesting\LinearCombination\VisualObjectArchiver.cs" ! SubType = "Code" ! BuildAction = "Compile" /> <File --- 399,405 ---- /> <File ! RelPath = "WalkForwardTesting\LinearCombination\TestDisplayer.resx" ! DependentUpon = "TestDisplayer.cs" ! BuildAction = "EmbeddedResource" /> <File *************** *** 454,457 **** --- 454,467 ---- /> <File + RelPath = "WalkForwardTesting\WalkForwardMultiOneRank\ReportDebugger\WFMultiOneRankDebugInSampleForm.cs" + SubType = "Form" + BuildAction = "Compile" + /> + <File + RelPath = "WalkForwardTesting\WalkForwardMultiOneRank\ReportDebugger\WFMultiOneRankDebugInSampleForm.resx" + DependentUpon = "WFMultiOneRankDebugInSampleForm.cs" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "WalkForwardTesting\WalkForwardMultiOneRank\ReportDebugger\WFMultiOneRankReportDebugger.cs" SubType = "Code" *************** *** 459,462 **** --- 469,477 ---- /> <File + RelPath = "WalkForwardTesting\WalkForwardMultiOneRank\ReportDebugger\WFMultiOneRankRunInSampleDebug.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "WalkForwardTesting\WalkForwardOneRank\BestPerformingTickers.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2005-12-11 18:19:52
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12447/b7_Scripts/WalkForwardTesting/LinearCombination Removed Files: VisualObjectArchiver.cs Log Message: VisualObjectArchiver.cs has been moved to the presentation layer --- VisualObjectArchiver.cs DELETED --- |
|
From: Glauco S. <gla...@us...> - 2005-12-11 18:07:08
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/WalkForwardTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8636/b7_Scripts/WalkForwardTesting/LinearCombination/WalkForwardTest Modified Files: RunWalkForwardLinearCombination.cs Log Message: The namespace QuantProject.Presentation is now used Index: RunWalkForwardLinearCombination.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/WalkForwardTest/RunWalkForwardLinearCombination.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RunWalkForwardLinearCombination.cs 22 Aug 2005 22:23:16 -0000 1.2 --- RunWalkForwardLinearCombination.cs 11 Dec 2005 18:06:52 -0000 1.3 *************** *** 30,33 **** --- 30,34 ---- using QuantProject.Business.Strategies; using QuantProject.Business.Timing; + using QuantProject.Presentation; using QuantProject.Presentation.Reporting.WindowsForm; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; |
|
From: Glauco S. <gla...@us...> - 2005-12-11 18:06:26
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8528/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger Modified Files: WFMultiOneRankDebugInSample.cs Log Message: firstDateTime is used instead of numberDaysForInSampleOptimization Index: WFMultiOneRankDebugInSample.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger/WFMultiOneRankDebugInSample.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WFMultiOneRankDebugInSample.cs 24 Nov 2005 17:26:20 -0000 1.1 --- WFMultiOneRankDebugInSample.cs 11 Dec 2005 18:06:18 -0000 1.2 *************** *** 37,45 **** { private string[] signedTickers; ! private DateTime dateTime; private int numberDaysForInSampleOptimization; private string benchmark; - private DateTime startDateTime; private IHistoricalQuoteProvider historicalQuoteProvider; private IndexBasedEndOfDayTimer endOfDayTimer; --- 37,45 ---- { private string[] signedTickers; ! private DateTime firstDateTime; ! private DateTime lastDateTime; private int numberDaysForInSampleOptimization; private string benchmark; private IHistoricalQuoteProvider historicalQuoteProvider; private IndexBasedEndOfDayTimer endOfDayTimer; *************** *** 49,63 **** public WFMultiOneRankDebugInSample( string[] signedTickers , ! DateTime dateTime , int numberDaysForInSampleOptimization , string benchmark ) { this.signedTickers = signedTickers; ! this.dateTime = dateTime; this.numberDaysForInSampleOptimization = numberDaysForInSampleOptimization; this.benchmark = benchmark; ! this.startDateTime = this.dateTime.AddDays( ! -this.numberDaysForInSampleOptimization - 1 ); this.historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); --- 49,64 ---- public WFMultiOneRankDebugInSample( string[] signedTickers , ! DateTime firstDateTime , DateTime lastDateTime , string benchmark ) { this.signedTickers = signedTickers; ! this.firstDateTime = firstDateTime; ! this.lastDateTime = lastDateTime; this.numberDaysForInSampleOptimization = numberDaysForInSampleOptimization; this.benchmark = benchmark; ! // this.startDateTime = this.dateTime.AddDays( ! // -this.numberDaysForInSampleOptimization - 1 ); this.historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); *************** *** 68,72 **** this.endOfDayTimer = new IndexBasedEndOfDayTimer( ! new EndOfDayDateTime( this.startDateTime , EndOfDaySpecificTime.MarketOpen ), this.benchmark ); } --- 69,73 ---- this.endOfDayTimer = new IndexBasedEndOfDayTimer( ! new EndOfDayDateTime( this.firstDateTime , EndOfDaySpecificTime.MarketOpen ), this.benchmark ); } *************** *** 96,100 **** { if ( ( ( IEndOfDayTimer )sender ).GetCurrentTime().DateTime > ! this.dateTime ) { // the simulation has reached the ending date --- 97,101 ---- { if ( ( ( IEndOfDayTimer )sender ).GetCurrentTime().DateTime > ! this.lastDateTime ) { // the simulation has reached the ending date *************** *** 102,106 **** Report report = new Report( this.account , this.historicalQuoteProvider ); report.Create( "WFT One Rank" , 1 , ! new EndOfDayDateTime( this.dateTime , EndOfDaySpecificTime.OneHourAfterMarketClose ) , "^SPX" ); report.Show(); } --- 103,107 ---- Report report = new Report( this.account , this.historicalQuoteProvider ); report.Create( "WFT One Rank" , 1 , ! new EndOfDayDateTime( this.lastDateTime , EndOfDaySpecificTime.OneHourAfterMarketClose ) , "^SPX" ); report.Show(); } |
|
From: Glauco S. <gla...@us...> - 2005-12-11 18:04:24
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7456/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank Modified Files: WFMultiOneRankGenomeManager.cs Log Message: Bug fixex Index: WFMultiOneRankGenomeManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/WFMultiOneRankGenomeManager.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WFMultiOneRankGenomeManager.cs 12 Nov 2005 19:03:39 -0000 1.1 --- WFMultiOneRankGenomeManager.cs 11 Dec 2005 18:04:17 -0000 1.2 *************** *** 137,144 **** this.getPortfolioRatesOfReturn_getRateOfTickerToBeAddedToTheArray_getPositionInArray(tickerIdx); // this.setOfCandidates[position].LongRatesOfReturn = longReturns; ! float[] arrayOfRatesOfReturn = ! this.setOfCandidates[ position ].ArrayOfRatesOfReturn; //the investment is assumed to be equally divided for each ticker ! return ( arrayOfRatesOfReturn[ arrayElementPosition ] / this.GenomeSize ); } --- 137,146 ---- this.getPortfolioRatesOfReturn_getRateOfTickerToBeAddedToTheArray_getPositionInArray(tickerIdx); // this.setOfCandidates[position].LongRatesOfReturn = longReturns; ! // float[] arrayOfRatesOfReturn = ! // this.setOfCandidates[ position ].ArrayOfRatesOfReturn; ! float currentReturn = this.setOfCandidates[ position ].GetReturn( ! arrayElementPosition , tickerIdx > 0 ); //the investment is assumed to be equally divided for each ticker ! return ( currentReturn / this.GenomeSize ); } |
|
From: Glauco S. <gla...@us...> - 2005-12-11 18:03:12
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6540/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger Modified Files: WFMultiOneRankReportDebugger.cs Log Message: The WFMultiOneRankDebugInSampleForm class is used now Index: WFMultiOneRankReportDebugger.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger/WFMultiOneRankReportDebugger.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WFMultiOneRankReportDebugger.cs 27 Nov 2005 00:12:40 -0000 1.2 --- WFMultiOneRankReportDebugger.cs 11 Dec 2005 18:03:04 -0000 1.3 *************** *** 133,145 **** { string[] signedTickers; ! DateTime dateTime; ! rightClickEventHandler_withDataRow_getNeededDataFromGrid( ! dataGrid , rowNumber , out signedTickers , out dateTime ); ! WFMultiOneRankDebugInSample wFMultiOneRankDebugInSample = ! new WFMultiOneRankDebugInSample( signedTickers , dateTime , ! this.numberDaysForInSampleOptimization , ! this.benchmark ); ! wFMultiOneRankDebugInSample.Run(); } private void rightClickEventHandler( object sender , --- 133,150 ---- { string[] signedTickers; ! DateTime lastDateTime; rightClickEventHandler_withDataRow_getNeededDataFromGrid( ! dataGrid , rowNumber , out signedTickers , out lastDateTime ); ! DateTime firstDateTime = lastDateTime.AddDays( ! -this.numberDaysForInSampleOptimization - 1 ); ! WFMultiOneRankDebugInSampleForm wFMultiOneRankDebugInSampleForm = ! new WFMultiOneRankDebugInSampleForm( signedTickers , ! firstDateTime , lastDateTime , this.benchmark ); ! wFMultiOneRankDebugInSampleForm.Show(); ! // WFMultiOneRankDebugInSample wFMultiOneRankDebugInSample = ! // new WFMultiOneRankDebugInSample( signedTickers , firstDateTime , ! // lastDateTime , ! // this.benchmark ); ! // wFMultiOneRankDebugInSample.Run(); } private void rightClickEventHandler( object sender , |
|
From: Glauco S. <gla...@us...> - 2005-12-11 18:02:18
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5929/b7_Scripts/WalkForwardTesting/LinearCombination Modified Files: MainForm.cs Log Message: The namespace QuantProject.Presentation is now used Index: MainForm.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/MainForm.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MainForm.cs 15 Oct 2005 18:09:22 -0000 1.7 --- MainForm.cs 11 Dec 2005 18:02:10 -0000 1.8 *************** *** 23,29 **** --- 23,31 ---- using QuantProject.Data.Selectors; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; + using QuantProject.Presentation; using QuantProject.Presentation.Reporting.WindowsForm; + namespace QuantProject.Scripts.WalkForwardTesting.LinearCombination { |
|
From: Glauco S. <gla...@us...> - 2005-12-11 18:00:36
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4875/b4_Business/a1_Financial/a2_Accounting Added Files: RebuildableAccount.cs Log Message: Account that can be recreated from a transaction history --- NEW FILE: RebuildableAccount.cs --- /* QuantProject - Quantitative Finance Library RebuildableAccount.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using QuantProject.Business.Financial.Accounting.Transactions; namespace QuantProject.Business.Financial.Accounting { /// <summary> /// Account that can be recreated from a transaction history /// </summary> public class RebuildableAccount : Account { public RebuildableAccount( string name ) : base( name ) { } /// <summary> /// Recreate the account from the transaction history /// </summary> /// <param name="transactions"></param> public void Add( TransactionHistory transactions ) { foreach( Object key in transactions.Keys ) { foreach( EndOfDayTransaction transaction in (ArrayList)transactions[key] ) { this.Add( transaction ); } } } } } |
|
From: Glauco S. <gla...@us...> - 2005-12-11 17:58:54
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4427/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger Added Files: WFMultiOneRankDebugInSampleForm.cs Log Message: Form to easily test optimized genomes on different time windows (both in sample and out of sample) --- NEW FILE: WFMultiOneRankDebugInSampleForm.cs --- using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardMultiOneRank { /// <summary> /// Form to easily test optimized genomes on different time windows /// (both in sample and out of sample) /// </summary> public class WFMultiOneRankDebugInSampleForm : System.Windows.Forms.Form { private System.Windows.Forms.DateTimePicker dateTimePickerFirstDate; private System.Windows.Forms.DateTimePicker dateTimePickerLastDate; private System.Windows.Forms.Button buttonGoTest; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; private string[] signedTickers; private DateTime firstDateTime; private DateTime lastDateTime; private string benchmark; public WFMultiOneRankDebugInSampleForm( string[] signedTickers , DateTime firstDateTime , DateTime lastDateTime , string benchmark ) { // // Required for Windows Form Designer support // InitializeComponent(); this.signedTickers = signedTickers; this.firstDateTime = firstDateTime; this.lastDateTime = lastDateTime; this.benchmark = benchmark; } /// <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.dateTimePickerFirstDate = new System.Windows.Forms.DateTimePicker(); this.dateTimePickerLastDate = new System.Windows.Forms.DateTimePicker(); this.buttonGoTest = new System.Windows.Forms.Button(); this.SuspendLayout(); // // dateTimePickerFirstDate // this.dateTimePickerFirstDate.Location = new System.Drawing.Point(16, 32); this.dateTimePickerFirstDate.Name = "dateTimePickerFirstDate"; this.dateTimePickerFirstDate.TabIndex = 0; // // dateTimePickerLastDate // this.dateTimePickerLastDate.Location = new System.Drawing.Point(248, 32); this.dateTimePickerLastDate.Name = "dateTimePickerLastDate"; this.dateTimePickerLastDate.TabIndex = 1; // // buttonGoTest // this.buttonGoTest.Location = new System.Drawing.Point(200, 80); this.buttonGoTest.Name = "buttonGoTest"; this.buttonGoTest.TabIndex = 2; this.buttonGoTest.Text = "Go Test"; this.buttonGoTest.Click += new System.EventHandler(this.buttonGoTest_Click); // // WFMultiOneRankDebugInSampleForm // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(472, 133); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.buttonGoTest, this.dateTimePickerLastDate, this.dateTimePickerFirstDate}); this.Name = "WFMultiOneRankDebugInSampleForm"; this.Text = "WFMultiOneRankDebugInSampleForm"; this.Load += new System.EventHandler(this.WFMultiOneRankDebugInSampleForm_Load); this.ResumeLayout(false); } #endregion private void buttonGoTest_Click(object sender, System.EventArgs e) { WFMultiOneRankDebugInSample wFMultiOneRankDebugInSample = new WFMultiOneRankDebugInSample( this.signedTickers , this.dateTimePickerFirstDate.Value , this.dateTimePickerLastDate.Value , this.benchmark ); wFMultiOneRankDebugInSample.Run(); } private void WFMultiOneRankDebugInSampleForm_Load(object sender, System.EventArgs e) { this.dateTimePickerFirstDate.Value = this.firstDateTime; this.dateTimePickerLastDate.Value = this.lastDateTime; } } } |
|
From: Glauco S. <gla...@us...> - 2005-12-11 17:51:56
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3322/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger Added Files: WFMultiOneRankRunInSampleDebug.cs Log Message: Class used to debug in sample results, starting from saved transactions --- NEW FILE: WFMultiOneRankRunInSampleDebug.cs --- /* QuantProject - Quantitative Finance Library WFMultiOneRankRunInSampleDebug.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Windows.Forms; using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Accounting.Transactions; using QuantProject.Business.Timing; using QuantProject.Presentation; using QuantProject.Presentation.Reporting.WindowsForm; namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardMultiOneRank { /// <summary> /// Class used to debug in sample results, starting from saved /// transactions /// </summary> public class WFMultiOneRankRunInSampleDebug { public WFMultiOneRankRunInSampleDebug() { // // TODO: Add constructor logic here // } public void Run() { VisualObjectArchiver visualObjectArchiver = new VisualObjectArchiver(); TransactionHistory transactionHistory = ( TransactionHistory )visualObjectArchiver.Load( "Load transactions" , "qPt" , "Load transactions" ); DateTime lastDateTime = ((DateTime)transactionHistory.GetKey( transactionHistory.Count - 1 ) ); RebuildableAccount account = new RebuildableAccount( "FromSerializedTransactions" ); account.Add( transactionHistory ); Report report = new Report( account , new HistoricalAdjustedQuoteProvider() ); report.Create( "WFT One Rank" , 1 , new EndOfDayDateTime( lastDateTime , EndOfDaySpecificTime.OneHourAfterMarketClose ) , "^SPX" ); WFMultiOneRankReportDebugger wFMultiOneRankReportDebugger = new WFMultiOneRankReportDebugger( 6 , 120 , "^SPX" ); report.TransactionGrid.MouseUp += new MouseEventHandler( wFMultiOneRankReportDebugger.MouseClickEventHandler ); report.Show(); } } } |
|
From: Glauco S. <gla...@us...> - 2005-12-11 17:47:43
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2627/b5_Presentation Added Files: VisualObjectArchiver.cs Log Message: Saves/Loads objects to/form disk, invoking a dialog form to ask for the full file path to write/read to/from. --- NEW FILE: VisualObjectArchiver.cs --- /* QuantProject - Quantitative Finance Library VisualObjectArchiver.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using QuantProject.ADT.FileManaging; namespace QuantProject.Presentation { /// <summary> /// Saves/Loads objects to/form disk, invoking a dialog form to ask for /// the full file path to write/read to/from. /// </summary> public class VisualObjectArchiver { private SaveFileDialog saveFileDialog; /// <summary> /// object to be saved /// </summary> private Object obj; public VisualObjectArchiver() { } // public VisualObjectArchiver( ArrayList bestGenomes , string suffix , // string initialDirectory , string title ) // { // this.visualObjectArchiver( bestGenomes , suffix , initialDirectory , // title ); // } private void fileOkEventHandler( object sender , CancelEventArgs e ) { QuantProject.ADT.FileManaging.ObjectArchiver.Archive( this.obj , ((SaveFileDialog)this.saveFileDialog).FileName ); } private void save( object obj , string suffix , string title , string initialDirectory ) { this.obj = obj; this.saveFileDialog = new SaveFileDialog(); this.saveFileDialog.DefaultExt = suffix; this.saveFileDialog.Filter = suffix + " files (*."+ suffix + ")|*." + suffix; this.saveFileDialog.Title = title; this.saveFileDialog.FileName = title; this.saveFileDialog.InitialDirectory = initialDirectory; this.saveFileDialog.AddExtension = true; this.saveFileDialog.CreatePrompt = true; this.saveFileDialog.OverwritePrompt = true; //the saveFileDialog title is the same as the //menu item clicked by the user this.saveFileDialog.CheckPathExists = true; this.saveFileDialog.FileOk += new CancelEventHandler( this.fileOkEventHandler ); this.saveFileDialog.ShowDialog(); } public void Save( object obj , string suffix , string title , string initialDirectory ) { this.save( obj , suffix , title , initialDirectory ); } public void Save( object obj , string suffix , string title ) { this.Save( obj , suffix , title , System.Configuration.ConfigurationSettings.AppSettings["ReportsArchive"] ); } private string getPath( string title , string suffix ) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = title; openFileDialog.Filter = suffix + " files (*."+ suffix + ")|*." + suffix; openFileDialog.Multiselect = false; openFileDialog.CheckFileExists = true; openFileDialog.ShowDialog(); return openFileDialog.FileName; } private object load( object obj , string suffix , string title , string initialDirectory ) { string chosenPath = this.getPath( title , suffix ); return ObjectArchiver.Extract( chosenPath ); } public object Load( object obj , string suffix , string title ) { return this.load( obj , suffix , title , System.Configuration.ConfigurationSettings.AppSettings["ReportsArchive"] ); } } } |
|
From: Glauco S. <gla...@us...> - 2005-11-27 00:12:48
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29655/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger Modified Files: WFMultiOneRankReportDebugger.cs Log Message: Bug fixed: casting is used to get the proper comparison behavior. Index: WFMultiOneRankReportDebugger.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger/WFMultiOneRankReportDebugger.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WFMultiOneRankReportDebugger.cs 24 Nov 2005 17:24:57 -0000 1.1 --- WFMultiOneRankReportDebugger.cs 27 Nov 2005 00:12:40 -0000 1.2 *************** *** 108,113 **** dataTable , rowNumber ); int currentRowIndex = firstRowNumberForTheGroup; ! while ( dataTable.Rows[ currentRowIndex ][ "DateTime" ] ! == dataTable.Rows[ rowNumber ][ "DateTime" ] ) { // the current row is still in the group --- 108,113 ---- dataTable , rowNumber ); int currentRowIndex = firstRowNumberForTheGroup; ! while ( (DateTime)dataTable.Rows[ currentRowIndex ][ "DateTime" ] ! == (DateTime)dataTable.Rows[ rowNumber ][ "DateTime" ] ) { // the current row is still in the group |
|
From: Glauco S. <gla...@us...> - 2005-11-27 00:11:38
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29422/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank Modified Files: WFMultiOneRankEndOfDayTimerHandler.cs Log Message: Code has been better organized. Some bugs have been fixex. Index: WFMultiOneRankEndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/WFMultiOneRankEndOfDayTimerHandler.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WFMultiOneRankEndOfDayTimerHandler.cs 12 Nov 2005 19:01:01 -0000 1.1 --- WFMultiOneRankEndOfDayTimerHandler.cs 27 Nov 2005 00:11:29 -0000 1.2 *************** *** 43,51 **** public class WFMultiOneRankEndOfDayTimerHandler { ! private WFMultiOneRankEligibleTickers eligibleTickers; private WFMultiOneRankChosenTickers chosenTickers; private string tickerGroupID; ! private int numberEligibleTickers; private int numberOfPositionsToBeChosen; private int inSampleWindowDays; --- 43,51 ---- public class WFMultiOneRankEndOfDayTimerHandler { ! private WFMultiOneRankEligibleTickers eligibleTickers; private WFMultiOneRankChosenTickers chosenTickers; private string tickerGroupID; ! private int numberEligibleTickers; private int numberOfPositionsToBeChosen; private int inSampleWindowDays; *************** *** 131,167 **** this.InSampleNewProgress( sender , eventArgs ); } - // #region OneHourAfterMarketCloseEventHandler - // private void oneHourAfterMarketCloseEventHandler_orderChosenTickers_closePositions( - // IEndOfDayTimer endOfDayTimer ) - // { - // foreach ( Position position in this.account.Portfolio ) - // if ( this.chosenTickers.Contains( position.Instrument.Key ) ) - // { - // this.account.ClosePosition( position ); - // } - // } - // private void oneHourAfterMarketCloseEventHandler_orderChosenTickers_openPositions_forTicker( - // string ticker ) - // { - // double cashForSinglePosition = this.account.CashAmount / this.numberOfTickersToBeChosen; - // long quantity = - // Convert.ToInt64( Math.Floor( cashForSinglePosition / this.account.DataStreamer.GetCurrentBid( ticker ) ) ); - // Order order = new Order( OrderType.MarketBuy , new Instrument( ticker ) , quantity ); - // this.account.AddOrder( order ); - // } - // private void oneHourAfterMarketCloseEventHandler_orderChosenTickers_openPositions() - // { - // foreach ( string ticker in this.chosenTickers.Keys ) - // if ( !this.account.Contains( ticker ) ) - // { - // oneHourAfterMarketCloseEventHandler_orderChosenTickers_openPositions_forTicker( ticker ); - // } - // } - // private void oneHourAfterMarketCloseEventHandler_orderChosenTickers( - // IEndOfDayTimer endOfDayTimer ) - // { - // this.oneHourAfterMarketCloseEventHandler_orderChosenTickers_closePositions( endOfDayTimer ); - // this.oneHourAfterMarketCloseEventHandler_orderChosenTickers_openPositions(); - // } private bool areBestTickersToBeChosen() { --- 131,134 ---- *************** *** 186,212 **** // or outOfSampleWindowDays elapsed since last optimization { ! // this.eligibleTickers.SetTickers( endOfDayTimingEventArgs.EndOfDayDateTime.DateTime ); this.eligibleTickers.SetTickers(); this.chosenTickers.SetTickers( this.eligibleTickers ); this.lastOptimizationDate = this.now().DateTime; } ! // oneHourAfterMarketCloseEventHandler_orderChosenTickers( ( IEndOfDayTimer ) sender ); } ! // #endregion #region FiveMinutesBeforeMarketCloseEventHandler ! private void fiveMinutesBeforeMarketCloseEventHandler_closePosition( ! string ticker ) { ! this.account.ClosePosition( ticker ); } ! private void fiveMinutesBeforeMarketCloseEventHandler_closePositions() { ! ArrayList tickers = new ArrayList(); ! foreach ( string ticker in this.account.Portfolio.Keys ) ! tickers.Add( ticker ); ! foreach ( string ticker in tickers ) ! fiveMinutesBeforeMarketCloseEventHandler_closePosition( ticker ); } ! private bool todayHigherThanYesterday( string ticker ) { double todayMarketValueAtClose = --- 153,184 ---- // or outOfSampleWindowDays elapsed since last optimization { ! // this.eligibleTickers.SetTickers( endOfDayTimingEventArgs.EndOfDayDateTime.DateTime ); this.eligibleTickers.SetTickers(); this.chosenTickers.SetTickers( this.eligibleTickers ); this.lastOptimizationDate = this.now().DateTime; } ! // oneHourAfterMarketCloseEventHandler_orderChosenTickers( ( IEndOfDayTimer ) sender ); } ! // #endregion #region FiveMinutesBeforeMarketCloseEventHandler ! private string getTicker( string signedTicker ) { ! string returnValue; ! if ( signedTicker.IndexOf( "-" ) == 0 ) ! returnValue = signedTicker.Substring( 1 , signedTicker.Length - 1 ); ! else ! returnValue = signedTicker; ! return returnValue; } ! private int getReturnMultiplier( string signedTicker ) { ! int returnValue; ! if ( signedTicker.IndexOf( "-" ) == 0 ) ! returnValue = -1; ! else ! returnValue = 1; ! return returnValue; } ! private double getTodayReturnForTicker( string ticker ) { double todayMarketValueAtClose = *************** *** 219,264 **** this.historicalAdjustedQuoteProvider.GetMarketValue( ticker , yesterdayAtClose ); ! bool returnValue = ! ( todayMarketValueAtClose > yesterdayMarketValueAtClose ); return returnValue; } private void fiveMinutesBeforeMarketCloseEventHandler_openPosition( ! string ticker ) { double maxPositionValue = this.account.GetMarketValue() / this.numberOfPositionsToBeChosen; long sharesToBeTraded = OneRank.MaxBuyableShares( ticker , maxPositionValue , this.account.DataStreamer ); ! if ( this.todayHigherThanYesterday( ticker ) ) ! // today close value for ticker is higher than yesterday ! // close for ticker ! this.account.AddOrder( new Order( OrderType.MarketBuy , ! new Instrument( ticker ) , sharesToBeTraded ) ); ! else ! // today close value for ticker is not higher than yesterday ! // close for ticker ! this.account.AddOrder( new Order( OrderType.MarketSellShort , ! new Instrument( ticker ) , sharesToBeTraded ) ); ! } ! private string getTicker( string signedTicker ) ! { ! string returnValue; ! if ( signedTicker.IndexOf( "-" ) == 0 ) ! returnValue = signedTicker.Substring( 1 , signedTicker.Length - 1 ); ! else ! returnValue = signedTicker; ! return returnValue; } private void fiveMinutesBeforeMarketCloseEventHandler_openPositions() { foreach ( string signedTicker in this.chosenTickers.Keys ) this.fiveMinutesBeforeMarketCloseEventHandler_openPosition( ! this.getTicker( signedTicker ) ); } public void FiveMinutesBeforeMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! this.fiveMinutesBeforeMarketCloseEventHandler_closePositions(); ! fiveMinutesBeforeMarketCloseEventHandler_openPositions(); } #endregion --- 191,301 ---- this.historicalAdjustedQuoteProvider.GetMarketValue( ticker , yesterdayAtClose ); ! double returnValue = ! ( todayMarketValueAtClose - yesterdayMarketValueAtClose ) / ! yesterdayMarketValueAtClose ; return returnValue; } + private double getTodayReturnForSignedTicker( string signedTicker ) + { + double todayReturnForTicker = this.getTodayReturnForTicker( + this.getTicker( signedTicker ) ); + int returnMultiplier = this.getReturnMultiplier( signedTicker ); + return todayReturnForTicker * returnMultiplier; + } + /// <summary> + /// true iff chosen tickers linear combination daily return is down today + /// </summary> + /// <returns></returns> + private bool isToReverse() + { + double totalReturn = 0; + foreach ( string signedTicker in this.chosenTickers.Keys ) + totalReturn += this.getTodayReturnForSignedTicker( signedTicker ); + return totalReturn < 0; + } + private OrderType fiveMinutesBeforeMarketCloseEventHandler_openPosition_getOrderType( + string signedTicker , bool isToReverse ) + { + OrderType orderType = OrderType.MarketBuy; + if ( ( signedTicker.StartsWith( "-" ) && !isToReverse ) || + ( !signedTicker.StartsWith( "-" ) && isToReverse ) ) + orderType = OrderType.MarketSellShort; + return orderType; + } private void fiveMinutesBeforeMarketCloseEventHandler_openPosition( ! string signedTicker , bool isToReverse ) { + string ticker = this.getTicker( signedTicker ); + OrderType orderType = + this.fiveMinutesBeforeMarketCloseEventHandler_openPosition_getOrderType( + signedTicker , isToReverse ); double maxPositionValue = this.account.GetMarketValue() / this.numberOfPositionsToBeChosen; long sharesToBeTraded = OneRank.MaxBuyableShares( ticker , maxPositionValue , this.account.DataStreamer ); ! this.account.AddOrder( new Order( orderType , ! new Instrument( ticker ) , sharesToBeTraded ) ); } private void fiveMinutesBeforeMarketCloseEventHandler_openPositions() { + bool isToReverse = this.isToReverse(); foreach ( string signedTicker in this.chosenTickers.Keys ) this.fiveMinutesBeforeMarketCloseEventHandler_openPosition( ! signedTicker , isToReverse ); ! } ! private void fiveMinutesBeforeMarketCloseEventHandler_closePosition( ! string ticker ) ! { ! this.account.ClosePosition( ticker ); ! } ! private double getTodayReturnForPosition( Position position ) ! { ! string signedTicker = position.Instrument.Key; ! double returnValue; ! if ( position.Type == PositionType.Short ) ! signedTicker = "-" + signedTicker; ! returnValue = ! this.getTodayReturnForSignedTicker( signedTicker ); ! return returnValue; ! } ! private double getTodayReturnForPortfolioPositions() ! { ! double totalReturn = 0; ! foreach ( Position position in this.account.Portfolio.Positions ) ! totalReturn += this.getTodayReturnForPosition( position ); ! return totalReturn; ! } ! private bool arePositionsToBeClosed() ! { ! double todayReturnForPortfolioPositions = ! this.getTodayReturnForPortfolioPositions(); ! return todayReturnForPortfolioPositions < 0; ! } ! private void fiveMinutesBeforeMarketCloseEventHandler_closePositions_actually() ! { ! ArrayList tickers = new ArrayList(); ! foreach ( string ticker in this.account.Portfolio.Keys ) ! tickers.Add( ticker ); ! foreach ( string ticker in tickers ) ! fiveMinutesBeforeMarketCloseEventHandler_closePosition( ticker ); ! } ! private void fiveMinutesBeforeMarketCloseEventHandler_closePositions() ! { ! if ( this.arePositionsToBeClosed() ) ! this.fiveMinutesBeforeMarketCloseEventHandler_closePositions_actually(); } public void FiveMinutesBeforeMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! if ( this.account.Portfolio.Count == 0 ) ! fiveMinutesBeforeMarketCloseEventHandler_openPositions(); ! else ! { ! if ( this.arePositionsToBeClosed() ) ! { ! this.fiveMinutesBeforeMarketCloseEventHandler_closePositions(); ! this.fiveMinutesBeforeMarketCloseEventHandler_openPositions(); ! } ! } } #endregion |
|
From: Glauco S. <gla...@us...> - 2005-11-27 00:04:16
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27297/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger Modified Files: WFMultiOneRankDebugEndOfDayTimerHandler.cs Log Message: Bug fixed. The in sample debug looks to work fine now. Index: WFMultiOneRankDebugEndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger/WFMultiOneRankDebugEndOfDayTimerHandler.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WFMultiOneRankDebugEndOfDayTimerHandler.cs 24 Nov 2005 17:24:07 -0000 1.1 --- WFMultiOneRankDebugEndOfDayTimerHandler.cs 27 Nov 2005 00:04:08 -0000 1.2 *************** *** 67,71 **** OrderType returnValue = OrderType.MarketBuy; if ( signedTicker.StartsWith( "-" ) ) ! returnValue = OrderType.MarketSell; return returnValue; } --- 67,71 ---- OrderType returnValue = OrderType.MarketBuy; if ( signedTicker.StartsWith( "-" ) ) ! returnValue = OrderType.MarketSellShort; return returnValue; } *************** *** 126,132 **** OrderType orderType = this.getOrderType( signedTicker ); bool returnValue = ( ( ( orderType == ! OrderType.MarketBuy ) && ( positionType == PositionType.Long ) ) || ( orderType == OrderType.MarketSellShort ) && ! ( positionType == PositionType.Short ) ); return returnValue; } --- 126,132 ---- OrderType orderType = this.getOrderType( signedTicker ); bool returnValue = ( ( ( orderType == ! OrderType.MarketBuy ) && ( positionType == PositionType.Short ) ) || ( orderType == OrderType.MarketSellShort ) && ! ( positionType == PositionType.Long ) ); return returnValue; } *************** *** 184,188 **** private bool fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeClosed() { ! bool returnValue = ( ( this.isLinearCombinationTodayValueHigherThanYesterday() && this.isCurrentlyReversed() ) || --- 184,188 ---- private bool fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeClosed() { ! bool returnValue = ( this.account.Portfolio.Count > 0 ) && ( ( this.isLinearCombinationTodayValueHigherThanYesterday() && this.isCurrentlyReversed() ) || *************** *** 193,198 **** private bool fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeOpened() { ! bool returnValue = ! this.fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeClosed(); return returnValue; } --- 193,197 ---- private bool fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeOpened() { ! bool returnValue = ( this.account.Portfolio.Count == 0 ); return returnValue; } |
|
From: Glauco S. <gla...@us...> - 2005-11-27 00:03:12
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26535/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank Modified Files: RunWalkForwardMultiOneRank.cs Log Message: A WFMultiOneRankReportDebugger is used now. Index: RunWalkForwardMultiOneRank.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/RunWalkForwardMultiOneRank.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RunWalkForwardMultiOneRank.cs 12 Nov 2005 18:37:40 -0000 1.1 --- RunWalkForwardMultiOneRank.cs 27 Nov 2005 00:03:05 -0000 1.2 *************** *** 56,60 **** private string tickerGroupID; private int numberEligibleTickers; ! private int numberOfPositionsToBeChosen; private int numberDaysForInSampleOptimization; private int numDaysBetweenEachOptimization; --- 56,60 ---- private string tickerGroupID; private int numberEligibleTickers; ! private int numberOfPortfolioPositions; private int numberDaysForInSampleOptimization; private int numDaysBetweenEachOptimization; *************** *** 75,79 **** string tickerGroupID , int numberEligibleTickers , ! int numberOfPositionsToBeChosen , int numberDaysForInSampleOptimization , int numDaysBetweenEachOptimization , --- 75,79 ---- string tickerGroupID , int numberEligibleTickers , ! int numberOfPortfolioPositions , int numberDaysForInSampleOptimization , int numDaysBetweenEachOptimization , *************** *** 87,91 **** this.tickerGroupID = tickerGroupID; this.numberEligibleTickers = numberEligibleTickers; ! this.numberOfPositionsToBeChosen = numberOfPositionsToBeChosen; this.numberDaysForInSampleOptimization = numberDaysForInSampleOptimization; this.numDaysBetweenEachOptimization = numDaysBetweenEachOptimization; --- 87,91 ---- this.tickerGroupID = tickerGroupID; this.numberEligibleTickers = numberEligibleTickers; ! this.numberOfPortfolioPositions = numberOfPortfolioPositions; this.numberDaysForInSampleOptimization = numberDaysForInSampleOptimization; this.numDaysBetweenEachOptimization = numDaysBetweenEachOptimization; *************** *** 133,137 **** this.tickerGroupID , this.numberEligibleTickers , ! this.numberOfPositionsToBeChosen , this.numberDaysForInSampleOptimization , this.numDaysBetweenEachOptimization , --- 133,137 ---- this.tickerGroupID , this.numberEligibleTickers , ! this.numberOfPortfolioPositions , this.numberDaysForInSampleOptimization , this.numDaysBetweenEachOptimization , *************** *** 153,167 **** DateTime.Now.ToString() ); } - // private void run_initializeProgressBar_newThread() - // { - // this.progressBarForm = new ProgressBarForm( this ); - // this.progressBarForm.ShowDialog(); - // } - // private void run_initializeProgressBar() - // { - // Thread thread = new Thread(new ThreadStart(run_initializeProgressBar_newThread)); - //// thread.IsBackground = true; - // thread.Start(); - // } private void run_initializeProgressHandlers() { --- 153,156 ---- *************** *** 170,190 **** } #region oneHourAfterMarketCloseEventHandler - // private void oneHourAfterMarketCloseEventHandler_handleProgessBarForm( - // IEndOfDayTimer endOfDayTimer ) - // { - // long elapsedDays = Convert.ToInt64( ((TimeSpan)( endOfDayTimer.GetCurrentTime().DateTime - - // this.startDateTime.DateTime )).TotalDays ); - // double totalDays = Convert.ToDouble( ((TimeSpan)( this.endDateTime.DateTime - - // this.startDateTime.DateTime )).TotalDays + 1); - // if ( Math.Floor( elapsedDays / totalDays * 100 ) > - // Math.Floor( ( elapsedDays - 1 ) / totalDays * 100 ) ) - // { - // // a new out of sample time percentage point has been elapsed - // int currentProgress = Convert.ToInt16( Math.Floor( elapsedDays / totalDays * 100 ) ); - // NewProgressEventArgs newProgressEventArgs = - // new NewProgressEventArgs( currentProgress , 100 ); - // this.OutOfSampleNewProgress( this , newProgressEventArgs ); - // } - // } private void oneHourAfterMarketCloseEventHandler_handleProgessBarForm( IEndOfDayTimer endOfDayTimer ) --- 159,162 ---- *************** *** 202,230 **** this.account.AddCash( 30000 ); } - #region oneHourAfterMarketCloseEventHandler - private void showOneRankForm( 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; - DataRow dataRow = dataTable.Rows[ hitTestInfo.Row ]; - // MessageBox.Show( dataRow[ "DateTime" ].ToString() ); - DateTime rowDateTime = (DateTime)dataRow[ "DateTime" ]; - string rowTicker = (string)dataRow[ "InstrumentKey"]; - OneRankForm oneRankForm = new OneRankForm(); - oneRankForm.FirstDateTime = - rowDateTime.AddDays( -this.numberDaysForInSampleOptimization ); - oneRankForm.LastDateTime = rowDateTime; - oneRankForm.Ticker = rowTicker; - oneRankForm.Show(); - } - private void mouseEventHandler( object sender , MouseEventArgs eventArgs ) - { - if ( eventArgs.Button == MouseButtons.Right ) - this.showOneRankForm( sender , eventArgs ); - } - #endregion public void oneHourAfterMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) --- 174,177 ---- *************** *** 243,248 **** EndOfDaySpecificTime.OneHourAfterMarketClose ) , this.benchmark ); report.TransactionGrid.MouseUp += ! new MouseEventHandler( this.mouseEventHandler ); report.Show(); } --- 190,199 ---- EndOfDaySpecificTime.OneHourAfterMarketClose ) , this.benchmark ); + WFMultiOneRankReportDebugger wFMultiOneRankReportDebugger = + new WFMultiOneRankReportDebugger( this.numberOfPortfolioPositions , + this.numberDaysForInSampleOptimization , this.benchmark ); report.TransactionGrid.MouseUp += ! new MouseEventHandler( ! wFMultiOneRankReportDebugger.MouseClickEventHandler ); report.Show(); } |
|
From: Glauco S. <gla...@us...> - 2005-11-26 23:58:31
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23785/b7_Scripts/SimpleTesting/OneRank Modified Files: RunOneRank.cs Log Message: ^SPX is used as benchmark (it was MSFT before) Index: RunOneRank.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank/RunOneRank.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** RunOneRank.cs 7 Jun 2005 15:36:24 -0000 1.10 --- RunOneRank.cs 26 Nov 2005 23:58:23 -0000 1.11 *************** *** 44,48 **** public class RunOneRank : Script { ! private DateTime startDateTime = new DateTime( 1993 , 1 , 1 ); private DateTime endDateTime = new DateTime( 2003 , 12 , 31 ); private Account account; --- 44,48 ---- public class RunOneRank : Script { ! private DateTime startDateTime = new DateTime( 2003 , 1 , 1 ); private DateTime endDateTime = new DateTime( 2003 , 12 , 31 ); private Account account; *************** *** 84,88 **** new IndexBasedEndOfDayTimer( new EndOfDayDateTime( this.startDateTime , ! EndOfDaySpecificTime.MarketOpen ) , "MSFT" ); // with IB commission --- 84,88 ---- new IndexBasedEndOfDayTimer( new EndOfDayDateTime( this.startDateTime , ! EndOfDaySpecificTime.MarketOpen ) , "^spx" ); // with IB commission |
|
From: Glauco S. <gla...@us...> - 2005-11-26 23:57:27
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23541/b4_Business/a1_Financial/a2_Accounting Modified Files: Portfolio.cs Log Message: IsLong method and IsShort method have been overloaded to work with a ticker (string) as a parameter Index: Portfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Portfolio.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Portfolio.cs 15 Oct 2005 18:15:43 -0000 1.8 --- Portfolio.cs 26 Nov 2005 23:57:20 -0000 1.9 *************** *** 78,90 **** } ! public bool IsLong( Instrument instrument ) ! { ! return this.Contains( instrument ) && (((Position)this[ instrument.Key ]).Quantity > 0); ! } ! public bool IsShort( Instrument instrument ) ! { ! return this.Contains( instrument ) && (((Position)this[ instrument.Key ]).Quantity < 0); ! } --- 78,98 ---- } ! public bool IsLong( string ticker ) ! { ! return this.Contains( ticker ) && (((Position)this[ ticker ]).Quantity > 0); ! } ! public bool IsLong( Instrument instrument ) ! { ! return IsLong( instrument.Key ); ! } ! public bool IsShort( string ticker ) ! { ! return this.Contains( ticker ) && (((Position)this[ ticker ]).Quantity < 0); ! } ! public bool IsShort( Instrument instrument ) ! { ! return this.IsShort( instrument.Key ); ! } |
|
From: Glauco S. <gla...@us...> - 2005-11-26 23:49:28
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22160/b4_Business/a1_Financial/a2_Accounting Modified Files: Account.cs Log Message: The AddOrder method has been improved: - an exception is thrown when a sell order for an instrument is submitted, but no long position is held for that ticker - an exception is thrown when a cover order for an instrument is submitted, but no short position is held for that ticker Index: Account.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Account.cs,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Account.cs 3 Aug 2005 18:55:10 -0000 1.20 --- Account.cs 26 Nov 2005 23:49:21 -0000 1.21 *************** *** 195,200 **** --- 195,214 ---- } + private void addOrder_throwExceptions( Order order ) + { + if ( ( ( order.Type == OrderType.MarketSell ) || + ( order.Type == OrderType.LimitSell ) ) && + ( !this.Portfolio.IsLong( order.Instrument.Key ) ) ) + throw new Exception( "A sell order has been submitted, but this " + + "account doesn't contain a long position for this ticker" ); + if ( ( ( order.Type == OrderType.MarketCover ) || + ( order.Type == OrderType.LimitCover ) ) && + ( !this.Portfolio.IsShort( order.Instrument.Key ) ) ) + throw new Exception( "A cover order has been submitted, but this " + + "account doesn't contain a short position for this ticker" ); + } public void AddOrder( Order order ) { + this.addOrder_throwExceptions( order ); this.orderExecutor.Execute( order ); } |
|
From: Glauco S. <gl...@my...> - 2005-11-24 17:45:57
|
At 12:48 PM 11/24/2005 +0100, you wrote: >Il problema =E8 che ora in locale ho dovuto escludere i file che tu usi per= il >debug (tipo: WFMultiOneRankDebugInSample.cs), >che non hai committato... Ora li ho committati. Ho aggiunto una cartella, quindi forse dovrai=20 copiarli da un checkout pulito. >Quindi se io committo, tu a tua volta dovrai reinserirli e cos=EC via ... > > >----- Original Message ----- >From: "Glauco Siliprandi" <gla...@us...> >To: <Qua...@li...> >Sent: Tuesday, November 22, 2005 5:25 PM >Subject: [Quantproject-developers] QuantProject/b7_Scripts >b7_Scripts.csproj,1.44,1.45 > > >>Update of /cvsroot/quantproject/QuantProject/b7_Scripts >>In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23225 >> >>Modified Files: >>b7_Scripts.csproj >>Log Message: >>IWalkForwardProgressNotifier has been moved in the WalkForwardTesting >>script root >> >>Index: b7_Scripts.csproj >>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>RCS file: >>/cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v >>retrieving revision 1.44 >>retrieving revision 1.45 >>diff -C2 -d -r1.44 -r1.45 >>*** b7_Scripts.csproj 17 Nov 2005 21:40:58 -0000 1.44 >>--- b7_Scripts.csproj 22 Nov 2005 16:25:15 -0000 1.45 >>*************** >>*** 349,352 **** >>--- 349,357 ---- >> /> >> <File >>+ RelPath =3D >>"WalkForwardTesting\IWalkForwardProgressNotifier.cs" >>+ SubType =3D "Code" >>+ BuildAction =3D "Compile" >>+ /> >>+ <File >> RelPath =3D >>"WalkForwardTesting\LinearCombination\GenomeRepresentation.cs" >> SubType =3D "Code" >>*************** >>*** 439,463 **** >> /> >> <File >>! RelPath =3D >>"WalkForwardTesting\WalkForwardOneRank\BestPerformingTickers.cs" >> SubType =3D "Code" >> BuildAction =3D "Compile" >> /> >> <File >>! RelPath =3D >>"WalkForwardTesting\WalkForwardOneRank\ChosenTickers.cs" >> SubType =3D "Code" >> BuildAction =3D "Compile" >> /> >> <File >>! RelPath =3D >>"WalkForwardTesting\WalkForwardOneRank\ComparableAccount.cs" >> SubType =3D "Code" >> BuildAction =3D "Compile" >> /> >> <File >>! RelPath =3D >>"WalkForwardTesting\WalkForwardOneRank\EligibleTickers.cs" >> SubType =3D "Code" >> BuildAction =3D "Compile" >> /> >> <File >>! RelPath =3D >>"WalkForwardTesting\WalkForwardOneRank\IWalkForwardProgressNotifier.cs" >> SubType =3D "Code" >> BuildAction =3D "Compile" >>--- 444,478 ---- >> /> >> <File >>! RelPath =3D >>"WalkForwardTesting\WalkForwardMultiOneRank\ReportDebugger\WFMultiOneRankD= ebugEndOfDayTimerHandler.cs" >> SubType =3D "Code" >> BuildAction =3D "Compile" >> /> >> <File >>! RelPath =3D >>"WalkForwardTesting\WalkForwardMultiOneRank\ReportDebugger\WFMultiOneRankD= ebugInSample.cs" >> SubType =3D "Code" >> BuildAction =3D "Compile" >> /> >> <File >>! RelPath =3D >>"WalkForwardTesting\WalkForwardMultiOneRank\ReportDebugger\WFMultiOneRankR= eportDebugger.cs" >> SubType =3D "Code" >> BuildAction =3D "Compile" >> /> >> <File >>! RelPath =3D >>"WalkForwardTesting\WalkForwardOneRank\BestPerformingTickers.cs" >> SubType =3D "Code" >> BuildAction =3D "Compile" >> /> >> <File >>! RelPath =3D >>"WalkForwardTesting\WalkForwardOneRank\ChosenTickers.cs" >>! SubType =3D "Code" >>! BuildAction =3D "Compile" >>! /> >>! <File >>! RelPath =3D >>"WalkForwardTesting\WalkForwardOneRank\ComparableAccount.cs" >>! SubType =3D "Code" >>! BuildAction =3D "Compile" >>! /> >>! <File >>! RelPath =3D >>"WalkForwardTesting\WalkForwardOneRank\EligibleTickers.cs" >> SubType =3D "Code" >> BuildAction =3D "Compile" >> >> >> >>------------------------------------------------------- >>This SF.Net email is sponsored by the JBoss Inc. Get Certified Today >>Register for a JBoss Training Course. Free Certification Exam >>for All Training Attendees Through End of 2005. For more info visit: >>http://ads.osdn.com/?ad_id=3D7628&alloc_id=3D16845&op=3Dclick >>_______________________________________________ >>Quantproject-developers mailing list >>Qua...@li... >>https://lists.sourceforge.net/lists/listinfo/quantproject-developers > > > >------------------------------------------------------- >This SF.net email is sponsored by: Splunk Inc. Do you grep through log= files >for problems? Stop! Download the new AJAX search engine that makes >searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! >_______________________________________________ >Quantproject-developers mailing list >Qua...@li... >https://lists.sourceforge.net/lists/listinfo/quantproject-developers |
|
From: Glauco S. <gla...@us...> - 2005-11-24 17:26:29
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7704 Added Files: WFMultiOneRankDebugInSample.cs Log Message: Simulation to test the in sample optimization --- NEW FILE: WFMultiOneRankDebugInSample.cs --- /* QuantProject - Quantitative Finance Library WFMultiOneRankDebugInSample.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Timing; using QuantProject.Presentation.Reporting.WindowsForm; namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardMultiOneRank { /// <summary> /// Simulation to test the in sample optimization /// </summary> public class WFMultiOneRankDebugInSample { private string[] signedTickers; private DateTime dateTime; private int numberDaysForInSampleOptimization; private string benchmark; private DateTime startDateTime; private IHistoricalQuoteProvider historicalQuoteProvider; private IndexBasedEndOfDayTimer endOfDayTimer; private Account account; private WFMultiOneRankDebugEndOfDayTimerHandler endOfDayTimerHandler; public WFMultiOneRankDebugInSample( string[] signedTickers , DateTime dateTime , int numberDaysForInSampleOptimization , string benchmark ) { this.signedTickers = signedTickers; this.dateTime = dateTime; this.numberDaysForInSampleOptimization = numberDaysForInSampleOptimization; this.benchmark = benchmark; this.startDateTime = this.dateTime.AddDays( -this.numberDaysForInSampleOptimization - 1 ); this.historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); } #region run private void run_initializeEndOfDayTimer() { this.endOfDayTimer = new IndexBasedEndOfDayTimer( new EndOfDayDateTime( this.startDateTime , EndOfDaySpecificTime.MarketOpen ), this.benchmark ); } private void run_initializeAccount() { this.account = new Account( "WFMultiOneRankDebugInSample" , this.endOfDayTimer , new HistoricalEndOfDayDataStreamer( this.endOfDayTimer , this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , this.historicalQuoteProvider ) ); } private void run_initializeEndOfDayTimerHandler() { this.endOfDayTimerHandler = new WFMultiOneRankDebugEndOfDayTimerHandler( this.account , this.signedTickers ); } public void marketOpenEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { if ( this.account.Transactions.Count == 0 ) this.account.AddCash( 30000 ); } public void oneHourAfterMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { if ( ( ( IEndOfDayTimer )sender ).GetCurrentTime().DateTime > this.dateTime ) { // the simulation has reached the ending date this.account.EndOfDayTimer.Stop(); Report report = new Report( this.account , this.historicalQuoteProvider ); report.Create( "WFT One Rank" , 1 , new EndOfDayDateTime( this.dateTime , EndOfDaySpecificTime.OneHourAfterMarketClose ) , "^SPX" ); report.Show(); } } public void Run() { run_initializeEndOfDayTimer(); run_initializeAccount(); run_initializeEndOfDayTimerHandler(); this.endOfDayTimer.MarketOpen += new MarketOpenEventHandler( this.marketOpenEventHandler ); this.endOfDayTimer.FiveMinutesBeforeMarketClose += new FiveMinutesBeforeMarketCloseEventHandler( this.endOfDayTimerHandler.FiveMinutesBeforeMarketCloseEventHandler ); this.endOfDayTimer.OneHourAfterMarketClose += new OneHourAfterMarketCloseEventHandler( this.oneHourAfterMarketCloseEventHandler ); this.endOfDayTimer.Start(); } #endregion } } |
|
From: Glauco S. <gla...@us...> - 2005-11-24 17:25:13
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7378 Added Files: WFMultiOneRankReportDebugger.cs Log Message: Script to debug the walk forward one rank strategy backtest --- NEW FILE: WFMultiOneRankReportDebugger.cs --- /* QuantProject - Quantitative Finance Library WFMultiOneRankReportDebugger.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Data; using System.Drawing; using System.Windows.Forms; using QuantProject.Business.Financial.Accounting; namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardMultiOneRank { /// <summary> /// Script to debug the walk forward one rank strategy backtest /// </summary> [Serializable] public class WFMultiOneRankReportDebugger { private int numberOfPortfolioPositions; private int numberDaysForInSampleOptimization; private string benchmark; public WFMultiOneRankReportDebugger( int numberOfPortfolioPositions , int numberDaysForInSampleOptimization , string benchmark ) { this.numberOfPortfolioPositions = numberOfPortfolioPositions; this.numberDaysForInSampleOptimization = numberDaysForInSampleOptimization; this.benchmark = benchmark; } #region MouseClickEventHandler private int rightClickEventHandler_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 rightClickEventHandler_checkExceptions( object sender , MouseEventArgs eventArgs ) { int rowNumber = rightClickEventHandler_getRowNumber( sender , eventArgs ); DataGrid dataGrid = (DataGrid)sender; DataTable dataTable = (DataTable)dataGrid.DataSource; DataRow dataRow = dataTable.Rows[ rowNumber ]; string transactionType = (string)dataRow[ "TransactionType" ]; if ( ( transactionType != TransactionType.BuyLong.ToString() ) && ( transactionType != TransactionType.SellShort.ToString() ) ) throw new Exception( "The right button of the mouse have been " + "clicked on a closing position area. It has to be clicked on " + "an opening position area!" ); } private int rightClickEventHandler_withDataRow_getSignedTickers_getFirstRowNumberForTheGroup( DataTable dataTable , int rowNumber ) { DateTime tradingDateTime = (DateTime)dataTable.Rows[ rowNumber ][ "DateTime" ]; int currentRowIndex = rowNumber; while ( ( currentRowIndex > 0 ) && ( (DateTime)dataTable.Rows[ currentRowIndex - 1 ][ "DateTime" ] == tradingDateTime ) ) // current row is still in the same transaction group as the mouse clicked row currentRowIndex -- ; int returnValue = currentRowIndex; if ( currentRowIndex >= this.numberOfPortfolioPositions ) returnValue += this.numberOfPortfolioPositions; return returnValue; } private string rightClickEventHandler_withDataRow_getSignedTicker( DataRow dataRow ) { string returnValue = (string)dataRow[ "InstrumentKey" ]; string transactionType = (string)dataRow[ "TransactionType" ]; if ( transactionType == TransactionType.SellShort.ToString() ) // current position is short in the group returnValue = "-" + returnValue; return returnValue; } private string[] rightClickEventHandler_withDataRow_getSignedTickers( DataTable dataTable , int rowNumber ) { string[] signedTickers = new string[ this.numberOfPortfolioPositions ]; int firstRowNumberForTheGroup = rightClickEventHandler_withDataRow_getSignedTickers_getFirstRowNumberForTheGroup( dataTable , rowNumber ); int currentRowIndex = firstRowNumberForTheGroup; while ( dataTable.Rows[ currentRowIndex ][ "DateTime" ] == dataTable.Rows[ rowNumber ][ "DateTime" ] ) { // the current row is still in the group signedTickers[ currentRowIndex - firstRowNumberForTheGroup ] = rightClickEventHandler_withDataRow_getSignedTicker( dataTable.Rows[ currentRowIndex ] ); currentRowIndex ++ ; } return signedTickers; } private void rightClickEventHandler_withDataRow_getNeededDataFromGrid( DataGrid dataGrid , int rowNumber , out string[] signedTickers , out DateTime dateTime ) { DataTable dataTable = (DataTable)dataGrid.DataSource; signedTickers = rightClickEventHandler_withDataRow_getSignedTickers( dataTable , rowNumber ); DataRow dataRow = dataTable.Rows[ rowNumber ]; dateTime = (DateTime)dataRow[ "DateTime" ]; } private void rightClickEventHandler_withRowNumber( DataGrid dataGrid , int rowNumber ) { string[] signedTickers; DateTime dateTime; rightClickEventHandler_withDataRow_getNeededDataFromGrid( dataGrid , rowNumber , out signedTickers , out dateTime ); WFMultiOneRankDebugInSample wFMultiOneRankDebugInSample = new WFMultiOneRankDebugInSample( signedTickers , dateTime , this.numberDaysForInSampleOptimization , this.benchmark ); wFMultiOneRankDebugInSample.Run(); } private void rightClickEventHandler( object sender , MouseEventArgs eventArgs ) { rightClickEventHandler_checkExceptions( sender , eventArgs ); int rowNumber = rightClickEventHandler_getRowNumber( sender , eventArgs ); rightClickEventHandler_withRowNumber( (DataGrid)sender , rowNumber ); // MessageBox.Show( dataRow[ "DateTime" ].ToString() ); } public void MouseClickEventHandler( object sender , MouseEventArgs eventArgs ) { if ( eventArgs.Button == MouseButtons.Right ) this.rightClickEventHandler( sender , eventArgs ); } #endregion } } |
|
From: Glauco S. <gla...@us...> - 2005-11-24 17:24:15
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7220 Added Files: WFMultiOneRankDebugEndOfDayTimerHandler.cs Log Message: Strategy to debug the in sample optimization --- NEW FILE: WFMultiOneRankDebugEndOfDayTimerHandler.cs --- /* QuantProject - Quantitative Finance Library WFMultiOneRankDebugEndOfDayTimerHandler.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Timing; namespace QuantProject.Scripts.WalkForwardTesting.WalkForwardMultiOneRank { /// <summary> /// Strategy to debug the in sample optimization /// </summary> public class WFMultiOneRankDebugEndOfDayTimerHandler { private Account account; string[] signedTickers; public WFMultiOneRankDebugEndOfDayTimerHandler( Account account , string[] signedTickers ) { this.account = account; this.signedTickers = signedTickers; } #region FiveMinutesBeforeMarketCloseEventHandler private string getTicker( string signedTicker ) { string returnValue = signedTicker; if ( signedTicker.StartsWith( "-" ) ) returnValue = signedTicker.Substring( 1 ); return returnValue; } private string getReverseSignedTicker( string signedTicker ) { string returnValue; if ( signedTicker.StartsWith( "-" ) ) returnValue = signedTicker.Substring( 1 ); else returnValue = "-" + signedTicker; return returnValue; } private OrderType getOrderType( string signedTicker ) { OrderType returnValue = OrderType.MarketBuy; if ( signedTicker.StartsWith( "-" ) ) returnValue = OrderType.MarketSell; return returnValue; } private void fiveMinutesBeforeMarketCloseEventHandler_closePosition( string ticker ) { this.account.ClosePosition( ticker ); } private void fiveMinutesBeforeMarketCloseEventHandler_closePositions() { ArrayList tickers = new ArrayList(); foreach ( string ticker in this.account.Portfolio.Keys ) tickers.Add( ticker ); foreach ( string ticker in tickers ) fiveMinutesBeforeMarketCloseEventHandler_closePosition( ticker ); } private double totalGainForSignedTicker( string signedTicker ) { string ticker = this.getTicker( signedTicker ); HistoricalAdjustedQuoteProvider historicalAdjustedQuoteProvider = new HistoricalAdjustedQuoteProvider(); double todayMarketValueAtClose = this.account.DataStreamer.GetCurrentBid( ticker ); EndOfDayDateTime yesterdayAtClose = new EndOfDayDateTime( this.account.EndOfDayTimer.GetCurrentTime().DateTime.AddDays( - 1 ) , EndOfDaySpecificTime.MarketClose ); double yesterdayMarketValueAtClose = historicalAdjustedQuoteProvider.GetMarketValue( ticker , yesterdayAtClose ); double returnForLongPosition = ( todayMarketValueAtClose / yesterdayMarketValueAtClose ) - 1; double returnValue; if ( signedTicker.StartsWith( "-" ) ) // signedTicker represents a short position returnValue = - returnForLongPosition; else // signedTicker represents a long position returnValue = returnForLongPosition; return returnValue; } private double todayTotalGainForLinearCombination() { double todayTotalGain = 0; foreach ( string signedTicker in this.signedTickers ) todayTotalGain += totalGainForSignedTicker( signedTicker ); return todayTotalGain; } private bool isLinearCombinationTodayValueHigherThanYesterday() { double todayTotalGain = todayTotalGainForLinearCombination(); return todayTotalGain > 0; } private bool isCurrentlyReversed( string signedTicker ) { PositionType positionType = this.account.Portfolio.GetPosition( this.getTicker( signedTicker ) ).Type; OrderType orderType = this.getOrderType( signedTicker ); bool returnValue = ( ( ( orderType == OrderType.MarketBuy ) && ( positionType == PositionType.Long ) ) || ( orderType == OrderType.MarketSellShort ) && ( positionType == PositionType.Short ) ); return returnValue; } private bool isCurrentlyReversed() { return this.isCurrentlyReversed( this.signedTickers[ 0 ] ); } private long getQuantity( string ticker ) { double accountValue = this.account.GetMarketValue(); double currentTickerAsk = this.account.DataStreamer.GetCurrentAsk( ticker ); double maxPositionValueForThisTicker = accountValue/this.signedTickers.Length; long quantity = Convert.ToInt64( Math.Floor( maxPositionValueForThisTicker / currentTickerAsk ) ); return quantity; } private void openPosition( string ticker , OrderType orderType ) { long quantity = this.getQuantity( ticker ); Order order = new Order( orderType , new Instrument( ticker ) , quantity ); this.account.AddOrder( order ); } private void fiveMinutesBeforeMarketCloseEventHandler_openThisPosition( string signedTicker ) { this.openPosition( this.getTicker( signedTicker ) , this.getOrderType( signedTicker ) ); } private void fiveMinutesBeforeMarketCloseEventHandler_openReversePosition( string signedTicker ) { this.fiveMinutesBeforeMarketCloseEventHandler_openThisPosition( this.getReverseSignedTicker( signedTicker ) ); } private void fiveMinutesBeforeMarketCloseEventHandler_openPosition( string signedTicker ) { if ( this.isLinearCombinationTodayValueHigherThanYesterday() ) fiveMinutesBeforeMarketCloseEventHandler_openThisPosition( signedTicker ); else fiveMinutesBeforeMarketCloseEventHandler_openReversePosition( signedTicker ); } private void fiveMinutesBeforeMarketCloseEventHandler_openPositions() { // this.chosenTickers.SetTickers( this.bestPerformingTickers , this.account ); foreach ( string signedTicker in this.signedTickers ) this.fiveMinutesBeforeMarketCloseEventHandler_openPosition( signedTicker ); } private bool fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeClosed() { bool returnValue = ( ( this.isLinearCombinationTodayValueHigherThanYesterday() && this.isCurrentlyReversed() ) || ( !this.isLinearCombinationTodayValueHigherThanYesterday() && !this.isCurrentlyReversed() ) ); return returnValue; } private bool fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeOpened() { bool returnValue = this.fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeClosed(); return returnValue; } public void FiveMinutesBeforeMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { if ( this.fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeClosed() ) this.fiveMinutesBeforeMarketCloseEventHandler_closePositions(); if ( this.fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeOpened() ) fiveMinutesBeforeMarketCloseEventHandler_openPositions(); } #endregion } } |
|
From: Glauco S. <gla...@us...> - 2005-11-24 17:22:58
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6883/ReportDebugger Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger added to the repository |
|
From: Marco M. <mar...@li...> - 2005-11-24 11:52:34
|
Il problema =E8 che ora in locale ho dovuto escludere i file che tu usi p= er il=20 debug (tipo: WFMultiOneRankDebugInSample.cs), che non hai committato... Quindi se io committo, tu a tua volta dovrai reinserirli e cos=EC via ... ----- Original Message -----=20 From: "Glauco Siliprandi" <gla...@us...> To: <Qua...@li...> Sent: Tuesday, November 22, 2005 5:25 PM Subject: [Quantproject-developers] QuantProject/b7_Scripts=20 b7_Scripts.csproj,1.44,1.45 > Update of /cvsroot/quantproject/QuantProject/b7_Scripts > In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23225 > > Modified Files: > b7_Scripts.csproj > Log Message: > IWalkForwardProgressNotifier has been moved in the WalkForwardTesting=20 > script root > > Index: b7_Scripts.csproj > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file:=20 > /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v > retrieving revision 1.44 > retrieving revision 1.45 > diff -C2 -d -r1.44 -r1.45 > *** b7_Scripts.csproj 17 Nov 2005 21:40:58 -0000 1.44 > --- b7_Scripts.csproj 22 Nov 2005 16:25:15 -0000 1.45 > *************** > *** 349,352 **** > --- 349,357 ---- > /> > <File > + RelPath =3D=20 > "WalkForwardTesting\IWalkForwardProgressNotifier.cs" > + SubType =3D "Code" > + BuildAction =3D "Compile" > + /> > + <File > RelPath =3D=20 > "WalkForwardTesting\LinearCombination\GenomeRepresentation.cs" > SubType =3D "Code" > *************** > *** 439,463 **** > /> > <File > ! RelPath =3D=20 > "WalkForwardTesting\WalkForwardOneRank\BestPerformingTickers.cs" > SubType =3D "Code" > BuildAction =3D "Compile" > /> > <File > ! RelPath =3D=20 > "WalkForwardTesting\WalkForwardOneRank\ChosenTickers.cs" > SubType =3D "Code" > BuildAction =3D "Compile" > /> > <File > ! RelPath =3D=20 > "WalkForwardTesting\WalkForwardOneRank\ComparableAccount.cs" > SubType =3D "Code" > BuildAction =3D "Compile" > /> > <File > ! RelPath =3D=20 > "WalkForwardTesting\WalkForwardOneRank\EligibleTickers.cs" > SubType =3D "Code" > BuildAction =3D "Compile" > /> > <File > ! RelPath =3D=20 > "WalkForwardTesting\WalkForwardOneRank\IWalkForwardProgressNotifier.cs" > SubType =3D "Code" > BuildAction =3D "Compile" > --- 444,478 ---- > /> > <File > ! RelPath =3D=20 > "WalkForwardTesting\WalkForwardMultiOneRank\ReportDebugger\WFMultiOneRa= nkDebugEndOfDayTimerHandler.cs" > SubType =3D "Code" > BuildAction =3D "Compile" > /> > <File > ! RelPath =3D=20 > "WalkForwardTesting\WalkForwardMultiOneRank\ReportDebugger\WFMultiOneRa= nkDebugInSample.cs" > SubType =3D "Code" > BuildAction =3D "Compile" > /> > <File > ! RelPath =3D=20 > "WalkForwardTesting\WalkForwardMultiOneRank\ReportDebugger\WFMultiOneRa= nkReportDebugger.cs" > SubType =3D "Code" > BuildAction =3D "Compile" > /> > <File > ! RelPath =3D=20 > "WalkForwardTesting\WalkForwardOneRank\BestPerformingTickers.cs" > SubType =3D "Code" > BuildAction =3D "Compile" > /> > <File > ! RelPath =3D=20 > "WalkForwardTesting\WalkForwardOneRank\ChosenTickers.cs" > ! SubType =3D "Code" > ! BuildAction =3D "Compile" > ! /> > ! <File > ! RelPath =3D=20 > "WalkForwardTesting\WalkForwardOneRank\ComparableAccount.cs" > ! SubType =3D "Code" > ! BuildAction =3D "Compile" > ! /> > ! <File > ! RelPath =3D=20 > "WalkForwardTesting\WalkForwardOneRank\EligibleTickers.cs" > SubType =3D "Code" > BuildAction =3D "Compile" > > > > ------------------------------------------------------- > This SF.Net email is sponsored by the JBoss Inc. Get Certified Today > Register for a JBoss Training Course. Free Certification Exam > for All Training Attendees Through End of 2005. For more info visit: > http://ads.osdn.com/?ad_id=3D7628&alloc_id=3D16845&op=3Dclick > _______________________________________________ > Quantproject-developers mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantproject-developers=20 |