[Quantproject-developers] QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination TestDisplayer
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2005-07-23 18:10:42
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14965/b7_Scripts/WalkForwardTesting/LinearCombination Modified Files: TestDisplayer.cs Log Message: Improvements: - a gris shows the better optimized genomes - a firstDate and lastDate date selectors are displayed * default is the optimization interval * they can be changed to check the out of sample behavior - right click on a grid row to backtest the selected genome Index: TestDisplayer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/TestDisplayer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestDisplayer.cs 13 Jul 2005 16:43:49 -0000 1.1 --- TestDisplayer.cs 23 Jul 2005 18:10:33 -0000 1.2 *************** *** 1,3 **** --- 1,26 ---- + /* + QuantProject - Quantitative Finance Library + + TestDisplayer.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.Collections; *************** *** 17,20 **** --- 40,45 ---- /// </summary> private System.ComponentModel.Container components = null; + private System.Windows.Forms.DateTimePicker dtpFirstDate; + private System.Windows.Forms.DateTimePicker dtpLastDate; // Glauco code *************** *** 25,29 **** this.dgBestGenomes.DataSource = this.bestGenomes; } ! public TestDisplayer( ArrayList bestGenomes ) { // --- 50,55 ---- this.dgBestGenomes.DataSource = this.bestGenomes; } ! public TestDisplayer( DateTime firstDate , DateTime lastDate , ! ArrayList bestGenomes ) { // *************** *** 33,36 **** --- 59,64 ---- // Glauco code + this.dtpFirstDate.Value = firstDate; + this.dtpLastDate.Value = lastDate; this.bestGenomes = bestGenomes; this.testdisplayer(); *************** *** 60,63 **** --- 88,93 ---- { this.dgBestGenomes = new System.Windows.Forms.DataGrid(); + this.dtpFirstDate = new System.Windows.Forms.DateTimePicker(); + this.dtpLastDate = new System.Windows.Forms.DateTimePicker(); ((System.ComponentModel.ISupportInitialize)(this.dgBestGenomes)).BeginInit(); this.SuspendLayout(); *************** *** 66,80 **** // this.dgBestGenomes.DataMember = ""; this.dgBestGenomes.HeaderForeColor = System.Drawing.SystemColors.ControlText; ! this.dgBestGenomes.Location = new System.Drawing.Point(48, 32); this.dgBestGenomes.Name = "dgBestGenomes"; ! this.dgBestGenomes.Size = new System.Drawing.Size(208, 216); this.dgBestGenomes.TabIndex = 0; // // TestDisplayer // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(292, 273); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.dgBestGenomes}); this.Name = "TestDisplayer"; --- 96,127 ---- // this.dgBestGenomes.DataMember = ""; + this.dgBestGenomes.Dock = System.Windows.Forms.DockStyle.Bottom; this.dgBestGenomes.HeaderForeColor = System.Drawing.SystemColors.ControlText; ! this.dgBestGenomes.Location = new System.Drawing.Point(0, 93); this.dgBestGenomes.Name = "dgBestGenomes"; ! this.dgBestGenomes.Size = new System.Drawing.Size(496, 248); this.dgBestGenomes.TabIndex = 0; + this.dgBestGenomes.MouseUp += new System.Windows.Forms.MouseEventHandler(this.dgBestGenomes_MouseUp); + // + // dtpFirstDate + // + this.dtpFirstDate.Location = new System.Drawing.Point(16, 24); + this.dtpFirstDate.Name = "dtpFirstDate"; + this.dtpFirstDate.TabIndex = 1; + // + // dtpLastDate + // + this.dtpLastDate.Location = new System.Drawing.Point(264, 24); + this.dtpLastDate.Name = "dtpLastDate"; + this.dtpLastDate.Size = new System.Drawing.Size(208, 20); + this.dtpLastDate.TabIndex = 2; // // TestDisplayer // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(496, 341); this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.dtpLastDate, + this.dtpFirstDate, this.dgBestGenomes}); this.Name = "TestDisplayer"; *************** *** 85,88 **** --- 132,157 ---- } #endregion + + private void dgBestGenomes_MouseUp_actually(object sender, System.Windows.Forms.MouseEventArgs e) + { + DataGrid dataGrid = (DataGrid)sender; + Point point = new Point( e.X , e.Y ); + DataGrid.HitTestInfo hitTestInfo = dataGrid.HitTest( point ); + ArrayList bestGenomes = (ArrayList)dataGrid.DataSource; + // DataRow dataRow = dataTable.Rows[ hitTestInfo.Row ]; + GenomeRepresentation genomeRepresentation = + (GenomeRepresentation)bestGenomes[ hitTestInfo.Row ]; + string[] signedTickers = GenomeRepresentation.GetSignedTickers( + genomeRepresentation.SignedTickers ); + LinearCombinationTest linearCombinationTest = + new LinearCombinationTest( this.dtpFirstDate.Value , + this.dtpLastDate.Value , signedTickers ); + linearCombinationTest.Run(); + } + private void dgBestGenomes_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) + { + if ( e.Button == MouseButtons.Right ) + this.dgBestGenomes_MouseUp_actually( sender , e ); + } } } |