[Quantproject-developers] QuantProject/b7_Scripts/SimpleTesting/OneRank RunOneRank.cs,1.9,1.10
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2005-06-07 15:36:34
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2256/b7_Scripts/SimpleTesting/OneRank Modified Files: RunOneRank.cs Log Message: A new MouseUp event handler has been added on the TransactionGrid: it invokes a OneRankForm, initialized so that the InSample optimization can be easily checked. Index: RunOneRank.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank/RunOneRank.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** RunOneRank.cs 30 Mar 2005 23:41:00 -0000 1.9 --- RunOneRank.cs 7 Jun 2005 15:36:24 -0000 1.10 *************** *** 22,26 **** --- 22,30 ---- using System; + using System.Data; + using System.Drawing; + using System.Windows.Forms; + using QuantProject.ADT.FileManaging; using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; *************** *** 29,32 **** --- 33,37 ---- using QuantProject.Business.Scripting; using QuantProject.Business.Timing; + using QuantProject.Data.DataProviders; using QuantProject.Presentation.Reporting.WindowsForm; *************** *** 39,44 **** public class RunOneRank : Script { ! private DateTime startDateTime = new DateTime( 2000 , 1 , 1 ); ! private DateTime endDateTime = new DateTime( 2000 , 12 , 31 ); private Account account; private IHistoricalQuoteProvider historicalQuoteProvider = --- 44,49 ---- public class RunOneRank : Script { ! private DateTime startDateTime = new DateTime( 1993 , 1 , 1 ); ! private DateTime endDateTime = new DateTime( 2003 , 12 , 31 ); private Account account; private IHistoricalQuoteProvider historicalQuoteProvider = *************** *** 50,76 **** { } public override void Run() { HistoricalEndOfDayTimer historicalEndOfDayTimer = new IndexBasedEndOfDayTimer( new EndOfDayDateTime( this.startDateTime , EndOfDaySpecificTime.MarketOpen ) , "MSFT" ); ! this.account = new Account( "MSFT" , historicalEndOfDayTimer , new HistoricalEndOfDayDataStreamer( historicalEndOfDayTimer , this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( historicalEndOfDayTimer , ! this.historicalQuoteProvider ) , ! new IBCommissionManager() ); ! // this.account = new Account( "MSFT" , historicalEndOfDayTimer , ! // new HistoricalEndOfDayDataStreamer( historicalEndOfDayTimer , ! // this.historicalQuoteProvider ) , ! // new HistoricalEndOfDayOrderExecutor( historicalEndOfDayTimer , ! // this.historicalQuoteProvider ) ); OneRank oneRank = new OneRank( account , this.endDateTime ); Report report = new Report( this.account , this.historicalQuoteProvider ); ! report.Show( "WFT One Rank" , 1 , new EndOfDayDateTime( this.endDateTime , EndOfDaySpecificTime.MarketClose ) , ! "MSFT" ); } } --- 55,114 ---- { } + private void showTransactionDataGridContextMenu( 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( -30 ); + oneRankForm.LastDateTime = rowDateTime; + oneRankForm.Ticker = rowTicker; + oneRankForm.Show(); + } + private void mouseEventHandler( object sender , MouseEventArgs eventArgs ) + { + if ( eventArgs.Button == MouseButtons.Right ) + this.showTransactionDataGridContextMenu( sender , eventArgs ); + } public override void Run() { + // HistoricalDataProvider.MinDate = this.startDateTime; + // HistoricalDataProvider.MaxDate = this.endDateTime.AddDays( 10 ); HistoricalEndOfDayTimer historicalEndOfDayTimer = new IndexBasedEndOfDayTimer( new EndOfDayDateTime( this.startDateTime , EndOfDaySpecificTime.MarketOpen ) , "MSFT" ); ! ! // with IB commission ! // this.account = new Account( "MSFT" , historicalEndOfDayTimer , ! // new HistoricalEndOfDayDataStreamer( historicalEndOfDayTimer , ! // this.historicalQuoteProvider ) , ! // new HistoricalEndOfDayOrderExecutor( historicalEndOfDayTimer , ! // this.historicalQuoteProvider ) , ! // new IBCommissionManager() ); ! ! // with no commission ! this.account = new Account( "SLR" , historicalEndOfDayTimer , new HistoricalEndOfDayDataStreamer( historicalEndOfDayTimer , this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( historicalEndOfDayTimer , ! this.historicalQuoteProvider ) ); OneRank oneRank = new OneRank( account , this.endDateTime ); Report report = new Report( this.account , this.historicalQuoteProvider ); ! report.Create( "WFT One Rank" , 1 , new EndOfDayDateTime( this.endDateTime , EndOfDaySpecificTime.MarketClose ) , ! "SLR" ); ! report.TransactionGrid.MouseUp += ! new MouseEventHandler( this.mouseEventHandler ); ! // ObjectArchiver.Archive( report.AccountReport , ! // @"C:\Documents and Settings\Glauco\Desktop\reports\runOneRank.qPr" ); ! report.Show(); } } |