quantproject-developers Mailing List for QuantProject (Page 35)
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-09-29 21:16:43
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv15309 Modified Files: MyTradingSystem.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: MyTradingSystem.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/MyTradingSystem.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MyTradingSystem.cs 29 Nov 2004 16:13:55 -0000 1.2 --- MyTradingSystem.cs 29 Sep 2008 21:16:12 -0000 1.3 *************** *** 3,7 **** MyTradingSystem.cs ! Copyright (C) 2003 Glauco Siliprandi --- 3,7 ---- MyTradingSystem.cs ! Copyright (C) 2003 Glauco Siliprandi *************** *** 19,26 **** 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.ADT; using QuantProject.ADT.Histories; --- 19,27 ---- 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.ADT; using QuantProject.ADT.Histories; *************** *** 30,33 **** --- 31,35 ---- using QuantProject.Business.Strategies; using QuantProject.Business.Timing; + using QuantProject.Data.DataProviders.Quotes; namespace QuantProject.Scripts *************** *** 38,87 **** public class MyTradingSystem : TradingSystem { ! private History microsoftOpenHistory; ! private History microsoftOpenHistorySMA; ! public MyTradingSystem() ! { ! } ! public override void InitializeData() ! { ! Parameter parameter = (Parameter) this.Parameters[ "SMAdays" ]; ! microsoftOpenHistory = QuoteCache.GetOpenHistory( "MSFT" ); ! microsoftOpenHistorySMA = microsoftOpenHistory.GetSimpleMovingAverage( (int) parameter.Value ); ! } ! public override Signals GetSignals( ExtendedDateTime extendedDateTime ) ! { ! Signals signals = new Signals(); ! Signal signal = new Signal(); ! if ( microsoftOpenHistory.Cross( microsoftOpenHistorySMA , ! extendedDateTime.DateTime ) && ! ( Convert.ToDouble(microsoftOpenHistorySMA.GetValue( extendedDateTime.DateTime )) > ! ( Convert.ToDouble(microsoftOpenHistory.GetValue( extendedDateTime.DateTime )) * ! ( 100 + Convert.ToInt32( ! ((Parameter)this.Parameters[ "CrossPercentage" ]).Value ) ) / 100 ) ) ) ! { ! signal.Add( new Order( OrderType.MarketBuy , new Instrument( "MSFT" ) , 1 , ! new EndOfDayDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! EndOfDaySpecificTime.MarketOpen ) ) ); ! signals.Add( signal ); ! } ! else ! { ! if ( microsoftOpenHistorySMA.Cross( microsoftOpenHistory , ! extendedDateTime.DateTime ) && ! ( Convert.ToDouble(microsoftOpenHistorySMA.GetValue( extendedDateTime.DateTime )) > ! ( Convert.ToDouble(microsoftOpenHistory.GetValue( extendedDateTime.DateTime )) * ! ( 100 + Convert.ToInt32( ((Parameter)this.Parameters[ "CrossPercentage" ]).Value ) ) / 100 ) ) ) ! { ! signal.Add( new Order( OrderType.MarketSell , new Instrument( "MSFT" ) , 1 , ! new EndOfDayDateTime( new Instrument( "MSFT" ).GetNextMarketDay( extendedDateTime.DateTime ) , ! EndOfDaySpecificTime.MarketOpen ) ) ); ! signals.Add( signal ); ! } ! } ! return signals; ! } ! } } --- 40,99 ---- public class MyTradingSystem : TradingSystem { ! private History microsoftOpenHistory; ! private History microsoftOpenHistorySMA; ! public MyTradingSystem() ! { ! } ! public override void InitializeData() ! { ! Parameter parameter = (Parameter) this.Parameters[ "SMAdays" ]; ! microsoftOpenHistory = HistoricalQuotesProvider.GetOpenHistory( "MSFT" ); ! microsoftOpenHistorySMA = microsoftOpenHistory.GetSimpleMovingAverage( (int) parameter.Value ); ! } ! public override Signals GetSignals( DateTime dateTime ) ! { ! Signals signals = new Signals(); ! Signal signal = new Signal(); ! if ( microsoftOpenHistory.Cross( microsoftOpenHistorySMA , ! dateTime ) && ! ( Convert.ToDouble(microsoftOpenHistorySMA.GetValue( dateTime )) > ! ( Convert.ToDouble(microsoftOpenHistory.GetValue( dateTime )) * ! ( 100 + Convert.ToInt32( ! ((Parameter)this.Parameters[ "CrossPercentage" ]).Value ) ) / 100 ) ) ) ! { ! signal.Add( new Order( ! OrderType.MarketBuy , ! new Instrument( "MSFT" ) , ! 1 , ! HistoricalEndOfDayTimer.GetMarketOpen( ! new Instrument( "MSFT" ).GetNextMarketDay( dateTime ) ) ) ); ! // new EndOfDayDateTime( new Instrument( "MSFT" ).GetNextMarketDay( dateTime.DateTime ) , ! // EndOfDaySpecificTime.MarketOpen ) ) ); ! signals.Add( signal ); ! } ! else ! { ! if ( microsoftOpenHistorySMA.Cross( microsoftOpenHistory , ! dateTime ) && ! ( Convert.ToDouble(microsoftOpenHistorySMA.GetValue( dateTime )) > ! ( Convert.ToDouble(microsoftOpenHistory.GetValue( dateTime )) * ! ( 100 + Convert.ToInt32( ((Parameter)this.Parameters[ "CrossPercentage" ]).Value ) ) / 100 ) ) ) ! { ! signal.Add( new Order( ! OrderType.MarketSell , ! new Instrument( "MSFT" ) , ! 1 , ! HistoricalEndOfDayTimer.GetMarketOpen( ! new Instrument( "MSFT" ).GetNextMarketDay( dateTime ) ) ) ); ! // new EndOfDayDateTime( new Instrument( "MSFT" ).GetNextMarketDay( dateTime.DateTime ) , ! // EndOfDaySpecificTime.MarketOpen ) ) ); ! signals.Add( signal ); ! } ! } ! return signals; ! } ! } } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:16:33
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14863/Reporting/WindowsForm Modified Files: Report.cs ReportGrid.cs ReportShower.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: ReportGrid.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm/ReportGrid.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ReportGrid.cs 6 Feb 2008 23:13:48 -0000 1.2 --- ReportGrid.cs 29 Sep 2008 21:15:57 -0000 1.3 *************** *** 3,7 **** ReportTabControl.cs ! Copyright (C) 2003 Glauco Siliprandi --- 3,7 ---- ReportTabControl.cs ! Copyright (C) 2003 Glauco Siliprandi *************** *** 19,25 **** 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.Financial.Accounting.Reporting; --- 19,27 ---- 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.Windows.Forms; + using QuantProject.Business.Financial.Accounting.Reporting; *************** *** 32,39 **** --- 34,110 ---- public class ReportGrid : DataGrid { + private ReportTable reportTable; + private DataGridTableStyle dataGridStyle; + public ReportGrid( ReportTable reportTable ) { + this.reportTable = reportTable; this.DataSource = reportTable.DataTable; + this.setFormat(); + } + + #region setFormat + + private void setDataGridTableStyle() + { + this.dataGridStyle = new DataGridTableStyle(); + dataGridStyle.MappingName = this.reportTable.DataTable.TableName; + this.TableStyles.Add( dataGridStyle ); } + + #region addDataGridColumnStyles + + #region setFormatForDateTimeColumn + + #region setFormatForDateTimeColumn_actually + // private DataGridTextBoxColumn getDataGridTextBoxColumn( + // int columnIndex ) + // { + // DataGridTableStyle dataGridTableStyle = + // this.TableStyles[ 0 ]; + // DataGridTextBoxColumn dataGridTextBoxColumn = + // ( DataGridTextBoxColumn )dataGridTableStyle.GridColumnStyles[ + // columnIndex ]; + //// dataGridTableStyle.GridColumnStyles.a + // return dataGridTextBoxColumn; + // } + private DataGridTextBoxColumn addDataGridTextBoxColumn( int columnIndex ) + { + DataGridTextBoxColumn dataGridTextBoxColumn = + new DataGridTextBoxColumn(); + dataGridTextBoxColumn.MappingName = + this.reportTable.DataTable.Columns[ columnIndex ].ColumnName; + dataGridTextBoxColumn.HeaderText = + this.reportTable.DataTable.Columns[ columnIndex ].ColumnName; + this.TableStyles[ 0 ].GridColumnStyles.Add( dataGridTextBoxColumn ); + return dataGridTextBoxColumn; + } + #endregion setFormatForDateTimeColumn_actually + + private void addDataGridColumnStyle( int columnIndex ) + { + DataGridTextBoxColumn dataGridTextBoxColumn = + this.addDataGridTextBoxColumn( columnIndex ); + if ( this.reportTable.DataTable.Columns[ columnIndex ].DataType == + System.Type.GetType("System.DateTime") ) + dataGridTextBoxColumn.Format = "u"; + } + #endregion setFormatForDateTimeColumn + + private void addDataGridColumnStyles() + { + for( int columnIndex = 0 ; + columnIndex < this.reportTable.DataTable.Columns.Count ; + columnIndex++ ) + this.addDataGridColumnStyle( columnIndex ); + } + #endregion addDataGridColumnStyles + + private void setFormat() + { + this.setDataGridTableStyle(); + this.addDataGridColumnStyles(); + } + #endregion setFormat } } Index: ReportShower.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm/ReportShower.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ReportShower.cs 19 Feb 2006 17:54:36 -0000 1.3 --- ReportShower.cs 29 Sep 2008 21:15:57 -0000 1.4 *************** *** 3,7 **** ReportShower.cs ! Copyright (C) 2003 Marco Milletti --- 3,7 ---- ReportShower.cs ! Copyright (C) 2003 Marco Milletti *************** *** 19,23 **** 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; --- 19,23 ---- 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; *************** *** 35,48 **** public class ReportShower : System.Windows.Forms.Form { ! private System.Windows.Forms.Button buttonShowReport; ! private System.Windows.Forms.Label label1; ! private System.Windows.Forms.Label label2; ! private System.Windows.Forms.Label label3; ! private System.Windows.Forms.NumericUpDown numDaysForEquityLine; ! private System.Windows.Forms.DateTimePicker endingDate; ! private System.Windows.Forms.TextBox reportName; ! private Report report; ! private System.Windows.Forms.Label label4; ! private System.Windows.Forms.TextBox benchmark; /// <summary> --- 35,48 ---- public class ReportShower : System.Windows.Forms.Form { ! private System.Windows.Forms.Button buttonShowReport; ! private System.Windows.Forms.Label label1; ! private System.Windows.Forms.Label label2; ! private System.Windows.Forms.Label label3; ! private System.Windows.Forms.NumericUpDown numDaysForEquityLine; ! private System.Windows.Forms.DateTimePicker endingDate; ! private System.Windows.Forms.TextBox reportName; ! private Report report; ! private System.Windows.Forms.Label label4; ! private System.Windows.Forms.TextBox benchmark; /// <summary> *************** *** 59,64 **** // ! this.report = report; ! this.endingDate.Value = this.report.GetLastTradeDate(); // } --- 59,64 ---- // ! this.report = report; ! this.endingDate.Value = this.report.GetLastTradeDate(); // } *************** *** 86,224 **** private void InitializeComponent() { ! this.numDaysForEquityLine = new System.Windows.Forms.NumericUpDown(); ! this.endingDate = new System.Windows.Forms.DateTimePicker(); ! this.reportName = new System.Windows.Forms.TextBox(); ! this.buttonShowReport = new System.Windows.Forms.Button(); ! this.label1 = new System.Windows.Forms.Label(); ! this.label2 = new System.Windows.Forms.Label(); ! this.label3 = new System.Windows.Forms.Label(); ! this.label4 = new System.Windows.Forms.Label(); ! this.benchmark = new System.Windows.Forms.TextBox(); ! ((System.ComponentModel.ISupportInitialize)(this.numDaysForEquityLine)).BeginInit(); ! this.SuspendLayout(); ! // ! // numDaysForEquityLine ! // ! this.numDaysForEquityLine.Location = new System.Drawing.Point(144, 64); ! this.numDaysForEquityLine.Minimum = new System.Decimal(new int[] { ! 1, ! 0, ! 0, ! 0}); ! this.numDaysForEquityLine.Name = "numDaysForEquityLine"; ! this.numDaysForEquityLine.Size = new System.Drawing.Size(64, 20); ! this.numDaysForEquityLine.TabIndex = 0; ! this.numDaysForEquityLine.Value = new System.Decimal(new int[] { ! 1, ! 0, ! 0, ! 0}); ! // ! // endingDate ! // ! this.endingDate.Location = new System.Drawing.Point(112, 112); ! this.endingDate.Name = "endingDate"; ! this.endingDate.Size = new System.Drawing.Size(136, 20); ! this.endingDate.TabIndex = 1; ! // ! // reportName ! // ! this.reportName.Location = new System.Drawing.Point(104, 16); ! this.reportName.Name = "reportName"; ! this.reportName.Size = new System.Drawing.Size(176, 20); ! this.reportName.TabIndex = 2; ! this.reportName.Text = "My report"; ! // ! // buttonShowReport ! // ! this.buttonShowReport.Location = new System.Drawing.Point(80, 208); ! this.buttonShowReport.Name = "buttonShowReport"; ! this.buttonShowReport.Size = new System.Drawing.Size(128, 40); ! this.buttonShowReport.TabIndex = 3; ! this.buttonShowReport.Text = "Show"; ! this.buttonShowReport.Click += new System.EventHandler(this.buttonShowReport_Click); ! // ! // label1 ! // ! this.label1.Location = new System.Drawing.Point(8, 16); ! this.label1.Name = "label1"; ! this.label1.Size = new System.Drawing.Size(96, 16); ! this.label1.TabIndex = 4; ! this.label1.Text = "Report Name"; ! // ! // label2 ! // ! this.label2.Location = new System.Drawing.Point(8, 64); ! this.label2.Name = "label2"; ! this.label2.Size = new System.Drawing.Size(128, 32); ! this.label2.TabIndex = 5; ! this.label2.Text = "Num Days for equity line"; ! // ! // label3 ! // ! this.label3.Location = new System.Drawing.Point(8, 112); ! this.label3.Name = "label3"; ! this.label3.Size = new System.Drawing.Size(96, 16); ! this.label3.TabIndex = 6; ! this.label3.Text = "Ending Date"; ! // ! // label4 ! // ! this.label4.Location = new System.Drawing.Point(10, 160); ! this.label4.Name = "label4"; ! this.label4.Size = new System.Drawing.Size(96, 16); ! this.label4.TabIndex = 8; ! this.label4.Text = "Benchmark"; ! // ! // benchmark ! // ! this.benchmark.Location = new System.Drawing.Point(106, 160); ! this.benchmark.Name = "benchmark"; ! this.benchmark.Size = new System.Drawing.Size(176, 20); ! this.benchmark.TabIndex = 7; ! this.benchmark.Text = ""; ! // ! // ReportShower ! // ! this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(292, 266); ! this.Controls.AddRange(new System.Windows.Forms.Control[] { ! this.label4, ! this.benchmark, ! this.label3, ! this.label2, ! this.label1, ! this.buttonShowReport, ! this.reportName, ! this.endingDate, ! this.numDaysForEquityLine}); ! this.Name = "ReportShower"; ! this.Text = "ReportShower"; ! ((System.ComponentModel.ISupportInitialize)(this.numDaysForEquityLine)).EndInit(); ! this.ResumeLayout(false); ! } #endregion ! private void buttonShowReport_Click(object sender, System.EventArgs e) ! { ! try ! { ! if(this.benchmark.Text == "") ! throw new Exception("Benchmark symbol is requested!"); ! this.report.Clear(); System.Console.WriteLine( DateTime.Now ); ! this.report.Show(this.reportName.Text, (int)this.numDaysForEquityLine.Value, ! new EndOfDayDateTime(this.endingDate.Value, ! EndOfDaySpecificTime.MarketClose), ! this.benchmark.Text); System.Console.WriteLine( DateTime.Now ); } ! ! catch(Exception ex) ! { ! MessageBox.Show(ex.ToString()); ! } ! } } } --- 86,227 ---- private void InitializeComponent() { ! this.numDaysForEquityLine = new System.Windows.Forms.NumericUpDown(); ! this.endingDate = new System.Windows.Forms.DateTimePicker(); ! this.reportName = new System.Windows.Forms.TextBox(); ! this.buttonShowReport = new System.Windows.Forms.Button(); ! this.label1 = new System.Windows.Forms.Label(); ! this.label2 = new System.Windows.Forms.Label(); ! this.label3 = new System.Windows.Forms.Label(); ! this.label4 = new System.Windows.Forms.Label(); ! this.benchmark = new System.Windows.Forms.TextBox(); ! ((System.ComponentModel.ISupportInitialize)(this.numDaysForEquityLine)).BeginInit(); ! this.SuspendLayout(); ! // ! // numDaysForEquityLine ! // ! this.numDaysForEquityLine.Location = new System.Drawing.Point(144, 64); ! this.numDaysForEquityLine.Minimum = new System.Decimal(new int[] { ! 1, ! 0, ! 0, ! 0}); ! this.numDaysForEquityLine.Name = "numDaysForEquityLine"; ! this.numDaysForEquityLine.Size = new System.Drawing.Size(64, 20); ! this.numDaysForEquityLine.TabIndex = 0; ! this.numDaysForEquityLine.Value = new System.Decimal(new int[] { ! 1, ! 0, ! 0, ! 0}); ! // ! // endingDate ! // ! this.endingDate.Location = new System.Drawing.Point(112, 112); ! this.endingDate.Name = "endingDate"; ! this.endingDate.Size = new System.Drawing.Size(136, 20); ! this.endingDate.TabIndex = 1; ! // ! // reportName ! // ! this.reportName.Location = new System.Drawing.Point(104, 16); ! this.reportName.Name = "reportName"; ! this.reportName.Size = new System.Drawing.Size(176, 20); ! this.reportName.TabIndex = 2; ! this.reportName.Text = "My report"; ! // ! // buttonShowReport ! // ! this.buttonShowReport.Location = new System.Drawing.Point(80, 208); ! this.buttonShowReport.Name = "buttonShowReport"; ! this.buttonShowReport.Size = new System.Drawing.Size(128, 40); ! this.buttonShowReport.TabIndex = 3; ! this.buttonShowReport.Text = "Show"; ! this.buttonShowReport.Click += new System.EventHandler(this.buttonShowReport_Click); ! // ! // label1 ! // ! this.label1.Location = new System.Drawing.Point(8, 16); ! this.label1.Name = "label1"; ! this.label1.Size = new System.Drawing.Size(96, 16); ! this.label1.TabIndex = 4; ! this.label1.Text = "Report Name"; ! // ! // label2 ! // ! this.label2.Location = new System.Drawing.Point(8, 64); ! this.label2.Name = "label2"; ! this.label2.Size = new System.Drawing.Size(128, 32); ! this.label2.TabIndex = 5; ! this.label2.Text = "Num Days for equity line"; ! // ! // label3 ! // ! this.label3.Location = new System.Drawing.Point(8, 112); ! this.label3.Name = "label3"; ! this.label3.Size = new System.Drawing.Size(96, 16); ! this.label3.TabIndex = 6; ! this.label3.Text = "Ending Date"; ! // ! // label4 ! // ! this.label4.Location = new System.Drawing.Point(10, 160); ! this.label4.Name = "label4"; ! this.label4.Size = new System.Drawing.Size(96, 16); ! this.label4.TabIndex = 8; ! this.label4.Text = "Benchmark"; ! // ! // benchmark ! // ! this.benchmark.Location = new System.Drawing.Point(106, 160); ! this.benchmark.Name = "benchmark"; ! this.benchmark.Size = new System.Drawing.Size(176, 20); ! this.benchmark.TabIndex = 7; ! this.benchmark.Text = ""; ! // ! // ReportShower ! // ! this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(292, 266); ! this.Controls.AddRange(new System.Windows.Forms.Control[] { ! this.label4, ! this.benchmark, ! this.label3, ! this.label2, ! this.label1, ! this.buttonShowReport, ! this.reportName, ! this.endingDate, ! this.numDaysForEquityLine}); ! this.Name = "ReportShower"; ! this.Text = "ReportShower"; ! ((System.ComponentModel.ISupportInitialize)(this.numDaysForEquityLine)).EndInit(); ! this.ResumeLayout(false); ! } #endregion ! private void buttonShowReport_Click(object sender, System.EventArgs e) ! { ! try ! { ! if(this.benchmark.Text == "") ! throw new Exception("Benchmark symbol is requested!"); ! this.report.Clear(); System.Console.WriteLine( DateTime.Now ); ! this.report.Show( ! this.reportName.Text, ! (int)this.numDaysForEquityLine.Value, ! HistoricalEndOfDayTimer.GetMarketClose( this.endingDate.Value ) , ! // new EndOfDayDateTime(this.endingDate.Value, ! // EndOfDaySpecificTime.MarketClose), ! this.benchmark.Text); System.Console.WriteLine( DateTime.Now ); } ! ! catch(Exception ex) ! { ! MessageBox.Show(ex.ToString()); ! } ! } } } Index: Report.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm/Report.cs,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Report.cs 19 Aug 2008 17:13:01 -0000 1.20 --- Report.cs 29 Sep 2008 21:15:56 -0000 1.21 *************** *** 41,45 **** { private Account account; ! private IHistoricalQuoteProvider historicalQuoteProvider; private AccountReport accountReport; private ReportTabControl reportTabControl; --- 41,45 ---- { private Account account; ! private HistoricalMarketValueProvider historicalMarketValueProvider; private AccountReport accountReport; private ReportTabControl reportTabControl; *************** *** 68,75 **** } ! public Report( Account account , IHistoricalQuoteProvider historicalQuoteProvider ) { this.account = account; ! this.historicalQuoteProvider = historicalQuoteProvider; this.initializeComponent(); } --- 68,76 ---- } ! public Report( ! Account account , HistoricalMarketValueProvider historicalMarketValueProvider ) { this.account = account; ! this.historicalMarketValueProvider = historicalMarketValueProvider; this.initializeComponent(); } *************** *** 122,131 **** /// </summary> private void create_set_accountReport( string reportName , ! int numDaysForInterval , EndOfDayDateTime endDateTime , string buyAndHoldTicker ) { if ( this.accountReport == null ) this.accountReport = this.account.CreateReport( reportName , numDaysForInterval , endDateTime , buyAndHoldTicker , ! this.historicalQuoteProvider ); } private void create_populateForm( bool showBenchmark ) --- 123,132 ---- /// </summary> private void create_set_accountReport( string reportName , ! int numDaysForInterval , DateTime endDateTime , string buyAndHoldTicker ) { if ( this.accountReport == null ) this.accountReport = this.account.CreateReport( reportName , numDaysForInterval , endDateTime , buyAndHoldTicker , ! this.historicalMarketValueProvider ); } private void create_populateForm( bool showBenchmark ) *************** *** 148,152 **** /// <param name="benchmark"></param> public void Create( string reportName , int numDaysForInterval , ! EndOfDayDateTime endDateTime , string benchmark ) { this.Create( reportName , numDaysForInterval , endDateTime , --- 149,153 ---- /// <param name="benchmark"></param> public void Create( string reportName , int numDaysForInterval , ! DateTime endDateTime , string benchmark ) { this.Create( reportName , numDaysForInterval , endDateTime , *************** *** 160,164 **** } public void Create( string reportName , int numDaysForInterval , ! EndOfDayDateTime endDateTime , string benchmark , bool showBenchmark ) { this.checkAlreadyCreated(); --- 161,165 ---- } public void Create( string reportName , int numDaysForInterval , ! DateTime endDateTime , string benchmark , bool showBenchmark ) { this.checkAlreadyCreated(); *************** *** 168,172 **** } public void Show( string reportName , ! int numDaysForInterval , EndOfDayDateTime endDateTime , string benchmark ) { if ( this.accountReport == null ) --- 169,173 ---- } public void Show( string reportName , ! int numDaysForInterval , DateTime endDateTime , string benchmark ) { if ( this.accountReport == null ) |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:16:09
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14863 Modified Files: MessageManager.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: MessageManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/MessageManager.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MessageManager.cs 7 Feb 2008 18:45:57 -0000 1.2 --- MessageManager.cs 29 Sep 2008 21:15:56 -0000 1.3 *************** *** 31,34 **** --- 31,35 ---- /// Manages text messages /// </summary> + [Serializable] public class MessageManager { |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:15:56
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/TickersRelationships In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14586/TickersRelationships Modified Files: CloseToCloseCorrelationProvider.cs CloseToOpenCorrelationProvider.cs CorrelationProvider.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: CloseToCloseCorrelationProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/TickersRelationships/CloseToCloseCorrelationProvider.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CloseToCloseCorrelationProvider.cs 12 Mar 2008 21:56:07 -0000 1.2 --- CloseToCloseCorrelationProvider.cs 29 Sep 2008 21:15:12 -0000 1.3 *************** *** 89,98 **** } ! protected override void setEndOfDayDatesTime(DateTime startDate, DateTime endDate) { ! this.firstEndOfDayDateTime = ! new EndOfDayDateTime(startDate, EndOfDaySpecificTime.MarketClose); ! this.lastEndOfDayDateTime = ! new EndOfDayDateTime(endDate, EndOfDaySpecificTime.MarketClose); } --- 89,101 ---- } ! protected override void setEndOfDayDatesTime( ! DateTime firstDate , DateTime lastDate ) { ! this.firstDateTime = ! HistoricalEndOfDayTimer.GetMarketClose( firstDate ); ! // new EndOfDayDateTime(firstDateTime, EndOfDaySpecificTime.MarketClose); ! this.lastDateTime = ! HistoricalEndOfDayTimer.GetMarketClose( lastDate ); ! // new EndOfDayDateTime(lastDateTime, EndOfDaySpecificTime.MarketClose); } *************** *** 100,104 **** { CloseToCloseIntervals closeToCloseIntervals = ! new CloseToCloseIntervals(this.firstEndOfDayDateTime, this.lastEndOfDayDateTime, this.benchmark, this.closeToCloseIntervalLength); this.returnsManager = --- 103,107 ---- { CloseToCloseIntervals closeToCloseIntervals = ! new CloseToCloseIntervals(this.firstDateTime, this.lastDateTime, this.benchmark, this.closeToCloseIntervalLength); this.returnsManager = Index: CloseToOpenCorrelationProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/TickersRelationships/CloseToOpenCorrelationProvider.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CloseToOpenCorrelationProvider.cs 14 Aug 2008 23:36:56 -0000 1.1 --- CloseToOpenCorrelationProvider.cs 29 Sep 2008 21:15:12 -0000 1.2 *************** *** 86,95 **** } ! protected override void setEndOfDayDatesTime(DateTime startDate, DateTime endDate) { ! this.firstEndOfDayDateTime = ! new EndOfDayDateTime(startDate, EndOfDaySpecificTime.MarketClose); ! this.lastEndOfDayDateTime = ! new EndOfDayDateTime(endDate, EndOfDaySpecificTime.MarketOpen); } --- 86,98 ---- } ! protected override void setEndOfDayDatesTime( ! DateTime firstDate, DateTime lastDate ) { ! this.firstDateTime = ! HistoricalEndOfDayTimer.GetMarketClose( firstDate ); ! // new EndOfDayDateTime(startDate, EndOfDaySpecificTime.MarketClose); ! this.lastDateTime = ! HistoricalEndOfDayTimer.GetMarketOpen( lastDate ); ! // new EndOfDayDateTime(endDate, EndOfDaySpecificTime.MarketOpen); } *************** *** 97,101 **** { CloseToOpenIntervals closeToOpenIntervals = ! new CloseToOpenIntervals(this.firstEndOfDayDateTime, this.lastEndOfDayDateTime, this.benchmark); this.returnsManager = --- 100,104 ---- { CloseToOpenIntervals closeToOpenIntervals = ! new CloseToOpenIntervals(this.firstDateTime, this.lastDateTime, this.benchmark); this.returnsManager = Index: CorrelationProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/TickersRelationships/CorrelationProvider.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CorrelationProvider.cs 18 Aug 2008 21:13:19 -0000 1.5 --- CorrelationProvider.cs 29 Sep 2008 21:15:12 -0000 1.6 *************** *** 47,52 **** protected int numOfCombinationTwoByTwo; protected TickersPearsonCorrelation[] pearsonCorrelations; ! protected EndOfDayDateTime firstEndOfDayDateTime; ! protected EndOfDayDateTime lastEndOfDayDateTime; protected int returnIntervalLength; protected string benchmark; --- 47,52 ---- protected int numOfCombinationTwoByTwo; protected TickersPearsonCorrelation[] pearsonCorrelations; ! protected DateTime firstDateTime; ! protected DateTime lastDateTime; protected int returnIntervalLength; protected string benchmark; |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:15:53
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/MicrosoftExcel In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14789/Reporting/MicrosoftExcel Modified Files: ExcelManager.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: ExcelManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/MicrosoftExcel/ExcelManager.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExcelManager.cs 19 Aug 2008 17:11:28 -0000 1.3 --- ExcelManager.cs 29 Sep 2008 21:15:41 -0000 1.4 *************** *** 110,114 **** excelBook.Worksheets.get_Item( excelBook.Worksheets.Count ),1,Missing.Value); excelSheet.Name = reportTable.Name; ! ((_Worksheet)excelSheet).Activate(); drawHeaders( reportTable , excelSheet ); drawRows( reportTable , excelSheet ); --- 110,114 ---- excelBook.Worksheets.get_Item( excelBook.Worksheets.Count ),1,Missing.Value); excelSheet.Name = reportTable.Name; ! ((Excel._Worksheet)excelSheet).Activate(); drawHeaders( reportTable , excelSheet ); drawRows( reportTable , excelSheet ); |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:15:43
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14586/returnsManagement/time Modified Files: CloseToCloseIntervals.cs CloseToOpenIntervals.cs DailyOpenToCloseIntervals.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: CloseToOpenIntervals.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/CloseToOpenIntervals.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CloseToOpenIntervals.cs 25 Sep 2007 21:48:14 -0000 1.2 --- CloseToOpenIntervals.cs 29 Sep 2008 21:15:13 -0000 1.3 *************** *** 34,45 **** /// <summary> /// Creates the close to open intervals for the given benchmark, from ! /// the first EndOfDayDateTime to the last EndOfDayDateTime /// </summary> /// <param name="firstEndOfDayDateTime"></param> /// <param name="lastEndOfDayDateTime"></param> /// <param name="benchmark"></param> ! public CloseToOpenIntervals( EndOfDayDateTime firstEndOfDayDateTime , ! EndOfDayDateTime lastEndOfDayDateTime , string benchmark ) : ! base( firstEndOfDayDateTime , lastEndOfDayDateTime , benchmark ) { } --- 34,45 ---- /// <summary> /// Creates the close to open intervals for the given benchmark, from ! /// the first DateTime to the last DateTime /// </summary> /// <param name="firstEndOfDayDateTime"></param> /// <param name="lastEndOfDayDateTime"></param> /// <param name="benchmark"></param> ! public CloseToOpenIntervals( DateTime firstDateTime , ! DateTime lastDateTime , string benchmark ) : ! base( firstDateTime , lastDateTime , benchmark ) { } *************** *** 48,59 **** { DateTime dateTimeForIntervalBegin = ! (DateTime)this.marketDaysForBenchmark.GetKey( i ); DateTime dateTimeForIntervalEnd = ! (DateTime)this.marketDaysForBenchmark.GetKey( i + 1 ); ReturnInterval returnInterval = new ReturnInterval( ! new EndOfDayDateTime( dateTimeForIntervalBegin , ! EndOfDaySpecificTime.MarketClose ) , ! new EndOfDayDateTime( dateTimeForIntervalEnd , ! EndOfDaySpecificTime.MarketOpen ) ); this.Add( returnInterval ); } --- 48,62 ---- { DateTime dateTimeForIntervalBegin = ! HistoricalEndOfDayTimer.GetMarketOpen( ! (DateTime)this.marketDaysForBenchmark.GetKey( i ) ); DateTime dateTimeForIntervalEnd = ! HistoricalEndOfDayTimer.GetMarketClose( ! (DateTime)this.marketDaysForBenchmark.GetKey( i + 1 ) ); ReturnInterval returnInterval = new ReturnInterval( ! dateTimeForIntervalBegin , dateTimeForIntervalEnd ); ! // new EndOfDayDateTime( dateTimeForIntervalBegin , ! // EndOfDaySpecificTime.MarketClose ) , ! // new EndOfDayDateTime( dateTimeForIntervalEnd , ! // EndOfDaySpecificTime.MarketOpen ) ); this.Add( returnInterval ); } Index: DailyOpenToCloseIntervals.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/DailyOpenToCloseIntervals.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DailyOpenToCloseIntervals.cs 25 Sep 2007 21:48:14 -0000 1.3 --- DailyOpenToCloseIntervals.cs 29 Sep 2008 21:15:14 -0000 1.4 *************** *** 34,45 **** /// <summary> /// Creates the open to close intervals for the given benchmark, from ! /// the first EndOfDayDateTime to the last EndOfDayDateTime /// </summary> /// <param name="firstEndOfDayDateTime"></param> /// <param name="lastEndOfDayDateTime"></param> /// <param name="benchmark"></param> ! public DailyOpenToCloseIntervals( EndOfDayDateTime firstEndOfDayDateTime , ! EndOfDayDateTime lastEndOfDayDateTime , string benchmark ) : ! base( firstEndOfDayDateTime , lastEndOfDayDateTime , benchmark ) { } --- 34,45 ---- /// <summary> /// Creates the open to close intervals for the given benchmark, from ! /// the first DateTime to the last DateTime /// </summary> /// <param name="firstEndOfDayDateTime"></param> /// <param name="lastEndOfDayDateTime"></param> /// <param name="benchmark"></param> ! public DailyOpenToCloseIntervals( DateTime firstDateTime , ! DateTime lastDateTime , string benchmark ) : ! base( firstDateTime , lastDateTime , benchmark ) { } *************** *** 49,59 **** { DateTime dateTimeForIntervalBegin = ! (DateTime)this.marketDaysForBenchmark.GetKey( i ); ! DateTime dateTimeForIntervalEnd = dateTimeForIntervalBegin; ReturnInterval returnInterval = new ReturnInterval( ! new EndOfDayDateTime( dateTimeForIntervalBegin , ! EndOfDaySpecificTime.MarketOpen ) , ! new EndOfDayDateTime( dateTimeForIntervalEnd , ! EndOfDaySpecificTime.MarketClose ) ); this.Add( returnInterval ); } --- 49,63 ---- { DateTime dateTimeForIntervalBegin = ! HistoricalEndOfDayTimer.GetMarketOpen( ! (DateTime)this.marketDaysForBenchmark.GetKey( i ) ); ! DateTime dateTimeForIntervalEnd = ! HistoricalEndOfDayTimer.GetMarketClose( ! dateTimeForIntervalBegin ); ReturnInterval returnInterval = new ReturnInterval( ! dateTimeForIntervalBegin , dateTimeForIntervalEnd ); ! // new EndOfDayDateTime( dateTimeForIntervalBegin , ! // EndOfDaySpecificTime.MarketOpen ) , ! // new EndOfDayDateTime( dateTimeForIntervalEnd , ! // EndOfDaySpecificTime.MarketClose ) ); this.Add( returnInterval ); } Index: CloseToCloseIntervals.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/CloseToCloseIntervals.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CloseToCloseIntervals.cs 2 Oct 2007 14:40:05 -0000 1.4 --- CloseToCloseIntervals.cs 29 Sep 2008 21:15:13 -0000 1.5 *************** *** 34,45 **** /// <summary> /// Creates the close to close intervals for the given benchmark, from ! /// the first EndOfDayDateTime to the last EndOfDayDateTime /// </summary> ! /// <param name="firstEndOfDayDateTime"></param> ! /// <param name="lastEndOfDayDateTime"></param> /// <param name="benchmark"></param> ! public CloseToCloseIntervals( EndOfDayDateTime firstEndOfDayDateTime , ! EndOfDayDateTime lastEndOfDayDateTime , string benchmark ) : ! base( firstEndOfDayDateTime , lastEndOfDayDateTime , benchmark ) { --- 34,45 ---- /// <summary> /// Creates the close to close intervals for the given benchmark, from ! /// the first DateTime to the last DateTime /// </summary> ! /// <param name="firstDateTime"></param> ! /// <param name="lastDateTime"></param> /// <param name="benchmark"></param> ! public CloseToCloseIntervals( DateTime firstDateTime , ! DateTime lastDateTime , string benchmark ) : ! base( firstDateTime , lastDateTime , benchmark ) { *************** *** 47,51 **** /// <summary> /// Creates the close to close intervals for the given benchmark, from ! /// the first EndOfDayDateTime to the last EndOfDayDateTime: /// each interval begins at a given market day "i" and ends at /// market day "i + intervalLength" --- 47,51 ---- /// <summary> /// Creates the close to close intervals for the given benchmark, from ! /// the first DateTime to the last DateTime: /// each interval begins at a given market day "i" and ends at /// market day "i + intervalLength" *************** *** 55,62 **** /// <param name="benchmark"></param> /// <param name="intervalLength"></param> ! public CloseToCloseIntervals( EndOfDayDateTime firstEndOfDayDateTime , ! EndOfDayDateTime lastEndOfDayDateTime , string benchmark , int intervalLength ) : ! base( firstEndOfDayDateTime , lastEndOfDayDateTime , benchmark , intervalLength) { --- 55,62 ---- /// <param name="benchmark"></param> /// <param name="intervalLength"></param> ! public CloseToCloseIntervals( DateTime firstDateTime , ! DateTime lastDateTime , string benchmark , int intervalLength ) : ! base( firstDateTime , lastDateTime , benchmark , intervalLength) { *************** *** 68,79 **** { DateTime dateTimeForIntervalBegin = ! (DateTime)this.marketDaysForBenchmark.GetKey( i ); DateTime dateTimeForIntervalEnd = ! (DateTime)this.marketDaysForBenchmark.GetKey( i + this.intervalLength ); ReturnInterval returnInterval = new ReturnInterval( ! new EndOfDayDateTime( dateTimeForIntervalBegin , ! EndOfDaySpecificTime.MarketClose ) , ! new EndOfDayDateTime( dateTimeForIntervalEnd , ! EndOfDaySpecificTime.MarketClose ) ); this.Add( returnInterval ); } --- 68,82 ---- { DateTime dateTimeForIntervalBegin = ! HistoricalEndOfDayTimer.GetMarketClose( ! (DateTime)this.marketDaysForBenchmark.GetKey( i ) ); DateTime dateTimeForIntervalEnd = ! HistoricalEndOfDayTimer.GetMarketClose( ! (DateTime)this.marketDaysForBenchmark.GetKey( i + this.intervalLength ) ); ReturnInterval returnInterval = new ReturnInterval( ! dateTimeForIntervalBegin , dateTimeForIntervalEnd ); ! // new EndOfDayDateTime( dateTimeForIntervalBegin , ! // EndOfDaySpecificTime.MarketClose ) , ! // new EndOfDayDateTime( dateTimeForIntervalEnd , ! // EndOfDaySpecificTime.MarketClose ) ); this.Add( returnInterval ); } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:15:30
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14586/Optimizing/Decoding Modified Files: DecoderForTestingPositionsWithBalancedWeights.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: DecoderForTestingPositionsWithBalancedWeights.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding/DecoderForTestingPositionsWithBalancedWeights.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DecoderForTestingPositionsWithBalancedWeights.cs 20 Apr 2008 16:38:47 -0000 1.5 --- DecoderForTestingPositionsWithBalancedWeights.cs 29 Sep 2008 21:15:14 -0000 1.6 *************** *** 19,23 **** 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; --- 19,23 ---- 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; *************** *** 28,40 **** { /// <summary> ! /// Decodes optimization candidates to a /// TestingPositions /// In this implementation, weights are balanced on volatility base /// </summary> public abstract class DecoderForTestingPositionsWithBalancedWeights : ! BasicDecoderForTestingPositions { ! public DecoderForTestingPositionsWithBalancedWeights() { --- 28,41 ---- { /// <summary> ! /// Decodes optimization candidates to a /// TestingPositions /// In this implementation, weights are balanced on volatility base /// </summary> + [Serializable] public abstract class DecoderForTestingPositionsWithBalancedWeights : ! BasicDecoderForTestingPositions { ! public DecoderForTestingPositionsWithBalancedWeights() { *************** *** 45,50 **** protected override double[] getWeights(SignedTickers signedTickers) { ! return WeightedPositions.GetBalancedWeights( ! signedTickers, this.returnsManager ); } --- 46,51 ---- protected override double[] getWeights(SignedTickers signedTickers) { ! return WeightedPositions.GetBalancedWeights( ! signedTickers, this.returnsManager ); } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:15:27
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14586/Eligibles Modified Files: DummyEligibleSelector.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: DummyEligibleSelector.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles/DummyEligibleSelector.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DummyEligibleSelector.cs 7 Feb 2008 18:08:15 -0000 1.1 --- DummyEligibleSelector.cs 29 Sep 2008 21:15:14 -0000 1.2 *************** *** 24,31 **** using System.Data; using QuantProject.ADT.Messaging; - using QuantProject.Business.Strategies.ReturnsManagement.Time; - using QuantProject.Business.Timing; - using QuantProject.Data.Selectors; namespace QuantProject.Business.Strategies.Eligibles --- 24,29 ---- using System.Data; + using QuantProject.ADT.Histories; using QuantProject.ADT.Messaging; namespace QuantProject.Business.Strategies.Eligibles *************** *** 35,38 **** --- 33,37 ---- /// debugging /// </summary> + [Serializable] public class DummyEligibleSelector : IEligiblesSelector { *************** *** 55,59 **** } public EligibleTickers GetEligibleTickers( ! EndOfDayHistory endOfDayHistory ) { if ( this.NewMessage != null ) --- 54,58 ---- } public EligibleTickers GetEligibleTickers( ! History history ) { if ( this.NewMessage != null ) |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:15:26
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Logging In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14586/Logging Modified Files: DummyLogItem.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: DummyLogItem.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Logging/DummyLogItem.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DummyLogItem.cs 30 Mar 2008 15:23:10 -0000 1.1 --- DummyLogItem.cs 29 Sep 2008 21:15:14 -0000 1.2 *************** *** 36,42 **** /// To be used for testing objects using a LogItem /// </summary> ! /// <param name="simulatedCreationTime"></param> ! public DummyLogItem( EndOfDayDateTime simulatedCreationTime ) : ! base( simulatedCreationTime ) { // --- 36,42 ---- /// To be used for testing objects using a LogItem /// </summary> ! /// <param name="simulatedCreationDateTime"></param> ! public DummyLogItem( DateTime simulatedCreationDateTime ) : ! base( simulatedCreationDateTime ) { // |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:15:25
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a3_Ordering In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14390/a3_Ordering Modified Files: Order.cs OrderFilledEventArgs.cs OrderManager.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: Order.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a3_Ordering/Order.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Order.cs 30 Jan 2005 19:57:38 -0000 1.3 --- Order.cs 29 Sep 2008 21:15:06 -0000 1.4 *************** *** 39,43 **** private Instrument instrument; private long quantity; ! private EndOfDayDateTime endOfDayDateTime; public OrderType Type --- 39,43 ---- private Instrument instrument; private long quantity; ! private DateTime dateTime; public OrderType Type *************** *** 59,66 **** } ! public EndOfDayDateTime EndOfDayDateTime { ! get { return endOfDayDateTime; } ! set { endOfDayDateTime=value; } } --- 59,66 ---- } ! public DateTime DateTime { ! get { return this.dateTime; } ! set { this.dateTime = value; } } *************** *** 83,90 **** } public Order( OrderType orderType , Instrument instrument , ! long quantity , EndOfDayDateTime endOfDayDateTime ) { this.order( orderType , instrument , quantity ); ! this.endOfDayDateTime = endOfDayDateTime; } } --- 83,90 ---- } public Order( OrderType orderType , Instrument instrument , ! long quantity , DateTime dateTime ) { this.order( orderType , instrument , quantity ); ! this.dateTime = dateTime; } } Index: OrderFilledEventArgs.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a3_Ordering/OrderFilledEventArgs.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OrderFilledEventArgs.cs 29 Nov 2004 15:06:29 -0000 1.1 --- OrderFilledEventArgs.cs 29 Sep 2008 21:15:06 -0000 1.2 *************** *** 3,7 **** NewTransactionEventArgs.cs ! Copyright (C) 2003 Glauco Siliprandi --- 3,7 ---- NewTransactionEventArgs.cs ! Copyright (C) 2003 Glauco Siliprandi *************** *** 19,23 **** 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; --- 19,23 ---- 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; *************** *** 36,40 **** { private Order order; ! private EndOfDayTransaction endOfDayTransaction; public Order Order --- 36,40 ---- { private Order order; ! private TimedTransaction timedTransaction; public Order Order *************** *** 44,58 **** } ! public EndOfDayTransaction EndOfDayTransaction { ! get { return this.endOfDayTransaction; } ! set { this.endOfDayTransaction = value; } } ! public OrderFilledEventArgs( Order order , EndOfDayTransaction endOfDayTransaction ) ! { ! this.order = order; ! this.endOfDayTransaction = endOfDayTransaction; ! } ! } } --- 44,59 ---- } ! public TimedTransaction TimedTransaction { ! get { return this.timedTransaction; } ! set { this.timedTransaction = value; } } ! public OrderFilledEventArgs( ! Order order , TimedTransaction timedTransaction ) ! { ! this.order = order; ! this.timedTransaction = timedTransaction; ! } ! } } Index: OrderManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a3_Ordering/OrderManager.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** OrderManager.cs 6 Feb 2005 18:20:22 -0000 1.5 --- OrderManager.cs 29 Sep 2008 21:15:06 -0000 1.6 *************** *** 75,88 **** } ! public EndOfDayTransaction GetTransaction( Order order , IDataStreamer dataStreamer ) { double instrumentPrice = dataStreamer.GetCurrentBid( order.Instrument.Key ); ! EndOfDayTransaction transaction = new EndOfDayTransaction( ! getTransactionType( order ) , order.Instrument , ! order.Quantity , instrumentPrice , ! order.EndOfDayDateTime ); ! return transaction; } #endregion --- 75,90 ---- } ! public TimedTransaction GetTimedTransaction( Order order , IDataStreamer dataStreamer ) { double instrumentPrice = dataStreamer.GetCurrentBid( order.Instrument.Key ); ! TimedTransaction timedTransaction = new TimedTransaction( ! getTransactionType( order ) , ! order.Instrument , ! order.Quantity , ! instrumentPrice , ! order.DateTime ); ! return timedTransaction; } #endregion *************** *** 93,97 **** TransactionHistory transactionHistory = new TransactionHistory(); foreach (Order order in orders) ! transactionHistory.Add( this.GetTransaction( order , dataStreamer ) ); return transactionHistory; --- 95,99 ---- TransactionHistory transactionHistory = new TransactionHistory(); foreach (Order order in orders) ! transactionHistory.Add( this.GetTimedTransaction( order , dataStreamer ) ); return transactionHistory; |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:15:15
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14104/Eligibles Modified Files: ByPriceLessVolatileOTCAlwaysQuoted.cs ByPriceMostLiquidAlwaysQuoted.cs ByPriceMostLiquidLessVolatileCTCAlwaysQuoted.cs ByPriceMostLiquidLessVolatileCTOAlwaysQuoted.cs ByPriceMostLiquidLessVolatileOTCAlwaysQuoted.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: ByPriceMostLiquidAlwaysQuoted.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles/ByPriceMostLiquidAlwaysQuoted.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ByPriceMostLiquidAlwaysQuoted.cs 8 Apr 2008 21:37:51 -0000 1.5 --- ByPriceMostLiquidAlwaysQuoted.cs 29 Sep 2008 21:14:49 -0000 1.6 *************** *** 24,30 **** using System.Data; using QuantProject.ADT.Messaging; - using QuantProject.Business.Strategies.ReturnsManagement.Time; - using QuantProject.Business.Timing; using QuantProject.Data.Selectors; --- 24,29 ---- using System.Data; + using QuantProject.ADT.Histories; using QuantProject.ADT.Messaging; using QuantProject.Data.Selectors; *************** *** 43,46 **** --- 42,46 ---- /// always quoted at all market days are selected (not more than a given max number); /// </summary> + [Serializable] public class ByPriceMostLiquidAlwaysQuoted : IEligiblesSelector { *************** *** 83,89 **** private EligibleTickers getEligibleTickers_actually( ! EndOfDayHistory endOfDayHistory ) { ! DateTime currentDate = endOfDayHistory.LastEndOfDayDateTime.DateTime; SelectorByGroup group; --- 83,89 ---- private EligibleTickers getEligibleTickers_actually( ! History history ) { ! DateTime currentDate = history.LastDateTime; SelectorByGroup group; *************** *** 109,113 **** SelectorByLiquidity mostLiquidSelector = new SelectorByLiquidity( dataTableByPrice , ! false, endOfDayHistory.FirstEndOfDayDateTime.DateTime, currentDate, this.maxNumberOfEligibleTickersToBeChosen); DataTable dataTableMostLiquid = --- 109,113 ---- SelectorByLiquidity mostLiquidSelector = new SelectorByLiquidity( dataTableByPrice , ! false, history.FirstDateTime, currentDate, this.maxNumberOfEligibleTickersToBeChosen); DataTable dataTableMostLiquid = *************** *** 120,124 **** SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromLastSelection = new SelectorByQuotationAtEachMarketDay( dataTableMostLiquid , ! false, endOfDayHistory.History, this.maxNumberOfEligibleTickersToBeChosen); DataTable dataTableToBeReturned = --- 120,124 ---- SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromLastSelection = new SelectorByQuotationAtEachMarketDay( dataTableMostLiquid , ! false, history, this.maxNumberOfEligibleTickersToBeChosen); DataTable dataTableToBeReturned = *************** *** 145,152 **** /// <returns></returns> public EligibleTickers GetEligibleTickers( ! EndOfDayHistory endOfDayHistory ) { EligibleTickers eligibleTickers = ! this.getEligibleTickers_actually( endOfDayHistory ); this.getEligibleTickers_sendNewMessage( eligibleTickers ); return eligibleTickers; --- 145,152 ---- /// <returns></returns> public EligibleTickers GetEligibleTickers( ! History history ) { EligibleTickers eligibleTickers = ! this.getEligibleTickers_actually( history ); this.getEligibleTickers_sendNewMessage( eligibleTickers ); return eligibleTickers; Index: ByPriceMostLiquidLessVolatileCTCAlwaysQuoted.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles/ByPriceMostLiquidLessVolatileCTCAlwaysQuoted.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ByPriceMostLiquidLessVolatileCTCAlwaysQuoted.cs 14 Aug 2008 23:36:25 -0000 1.1 --- ByPriceMostLiquidLessVolatileCTCAlwaysQuoted.cs 29 Sep 2008 21:14:49 -0000 1.2 *************** *** 19,30 **** 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 QuantProject.ADT.Messaging; - using QuantProject.Business.Strategies.ReturnsManagement.Time; - using QuantProject.Business.Timing; using QuantProject.Data.Selectors; --- 19,29 ---- 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 QuantProject.ADT.Histories; using QuantProject.ADT.Messaging; using QuantProject.Data.Selectors; *************** *** 43,55 **** /// -step 2: from tickers selected by step 1, the most liquid /// are selected (not more than maxNumberOfMostLiquidTickersToBeChosen); ! /// -step 3: from tickers selected by step 2, the ones that are /// less volatile (CTC returns in the last /// numOfDaysForVolatilityComputation days ! /// are analyzed) are selected /// (not more than maxNumberOfEligibleTickersToBeChosen); /// -step 4: from tickers selected by step 3, the ones that are ! /// always quoted at all market days are selected /// (not more than maxNumberOfEligibleTickersToBeChosen); /// </summary> public class ByPriceMostLiquidLessVolatileCTCAlwaysQuoted : IEligiblesSelector { --- 42,55 ---- /// -step 2: from tickers selected by step 1, the most liquid /// are selected (not more than maxNumberOfMostLiquidTickersToBeChosen); ! /// -step 3: from tickers selected by step 2, the ones that are /// less volatile (CTC returns in the last /// numOfDaysForVolatilityComputation days ! /// are analyzed) are selected /// (not more than maxNumberOfEligibleTickersToBeChosen); /// -step 4: from tickers selected by step 3, the ones that are ! /// always quoted at all market days are selected /// (not more than maxNumberOfEligibleTickersToBeChosen); /// </summary> + [Serializable] public class ByPriceMostLiquidLessVolatileCTCAlwaysQuoted : IEligiblesSelector { *************** *** 74,78 **** private void byPriceMostLiquidLessVolatileCTCAlwaysQuoted_checkParameters() { ! if(this.maxNumberOfMostLiquidTickersToBeChosen <= this.maxNumberOfEligibleTickersToBeChosen) throw new Exception("The set of the most liquid tickers has to " + --- 74,78 ---- private void byPriceMostLiquidLessVolatileCTCAlwaysQuoted_checkParameters() { ! if(this.maxNumberOfMostLiquidTickersToBeChosen <= this.maxNumberOfEligibleTickersToBeChosen) throw new Exception("The set of the most liquid tickers has to " + *************** *** 81,90 **** public ByPriceMostLiquidLessVolatileCTCAlwaysQuoted( ! string tickersGroupID , bool temporizedGroup, int maxNumberOfEligibleTickersToBeChosen, int maxNumberOfMostLiquidTickersToBeChosen, ! int numOfDaysForAverageOpenRawPriceComputation, int numOfDaysForVolatilityComputation, ! double minPrice, double maxPrice) { this.temporizedGroup = temporizedGroup; --- 81,90 ---- public ByPriceMostLiquidLessVolatileCTCAlwaysQuoted( ! string tickersGroupID , bool temporizedGroup, int maxNumberOfEligibleTickersToBeChosen, int maxNumberOfMostLiquidTickersToBeChosen, ! int numOfDaysForAverageOpenRawPriceComputation, int numOfDaysForVolatilityComputation, ! double minPrice, double maxPrice) { this.temporizedGroup = temporizedGroup; *************** *** 92,100 **** this.maxNumberOfEligibleTickersToBeChosen = maxNumberOfEligibleTickersToBeChosen; ! this.maxNumberOfMostLiquidTickersToBeChosen = maxNumberOfMostLiquidTickersToBeChosen; this.numOfDaysForAverageOpenRawPriceComputation = numOfDaysForAverageOpenRawPriceComputation; ! this.numOfDaysForVolatilityComputation = numOfDaysForVolatilityComputation; this.minPrice = minPrice; --- 92,100 ---- this.maxNumberOfEligibleTickersToBeChosen = maxNumberOfEligibleTickersToBeChosen; ! this.maxNumberOfMostLiquidTickersToBeChosen = maxNumberOfMostLiquidTickersToBeChosen; this.numOfDaysForAverageOpenRawPriceComputation = numOfDaysForAverageOpenRawPriceComputation; ! this.numOfDaysForVolatilityComputation = numOfDaysForVolatilityComputation; this.minPrice = minPrice; *************** *** 104,144 **** private EligibleTickers getEligibleTickers_actually( ! EndOfDayHistory endOfDayHistory ) { ! DateTime currentDate = endOfDayHistory.LastEndOfDayDateTime.DateTime; SelectorByGroup group; if(this.temporizedGroup) ! //the group is "temporized": returned set of tickers ! // depends on time group = new SelectorByGroup(this.tickersGroupID, currentDate); ! else//the group is not temporized ! group = new SelectorByGroup(this.tickersGroupID); ! DataTable tickersFromGroup = group.GetTableOfSelectedTickers(); ! int numOfTickersInGroupAtCurrentDate = tickersFromGroup.Rows.Count; ! SelectorByAverageRawOpenPrice byPrice = ! new SelectorByAverageRawOpenPrice(tickersFromGroup,false, ! currentDate.AddDays(-this.numOfDaysForAverageOpenRawPriceComputation), ! currentDate, ! numOfTickersInGroupAtCurrentDate, ! this.minPrice,this.maxPrice, 0.00001, double.MaxValue); ! DataTable dataTableByPrice = byPrice.GetTableOfSelectedTickers(); SelectorByLiquidity mostLiquidSelector = new SelectorByLiquidity( dataTableByPrice , ! false, endOfDayHistory.FirstEndOfDayDateTime.DateTime, currentDate, ! this.maxNumberOfMostLiquidTickersToBeChosen); ! DataTable dataTableMostLiquid = mostLiquidSelector.GetTableOfSelectedTickers(); ! SelectorByCloseToCloseVolatility lessVolatileSelector = new SelectorByCloseToCloseVolatility( dataTableMostLiquid , ! true, currentDate.AddDays(-this.numOfDaysForVolatilityComputation), currentDate, ! this.maxNumberOfEligibleTickersToBeChosen); ! ! DataTable dataTableLessVolatile = lessVolatileSelector.GetTableOfSelectedTickers(); // DataSet dataSet = new DataSet(); --- 104,144 ---- private EligibleTickers getEligibleTickers_actually( ! History history ) { ! DateTime currentDate = history.LastDateTime; SelectorByGroup group; if(this.temporizedGroup) ! //the group is "temporized": returned set of tickers ! // depends on time group = new SelectorByGroup(this.tickersGroupID, currentDate); ! else//the group is not temporized ! group = new SelectorByGroup(this.tickersGroupID); ! DataTable tickersFromGroup = group.GetTableOfSelectedTickers(); ! int numOfTickersInGroupAtCurrentDate = tickersFromGroup.Rows.Count; ! SelectorByAverageRawOpenPrice byPrice = ! new SelectorByAverageRawOpenPrice(tickersFromGroup,false, ! currentDate.AddDays(-this.numOfDaysForAverageOpenRawPriceComputation), ! currentDate, ! numOfTickersInGroupAtCurrentDate, ! this.minPrice,this.maxPrice, 0.00001, double.MaxValue); ! DataTable dataTableByPrice = byPrice.GetTableOfSelectedTickers(); SelectorByLiquidity mostLiquidSelector = new SelectorByLiquidity( dataTableByPrice , ! false, history.FirstDateTime, currentDate, ! this.maxNumberOfMostLiquidTickersToBeChosen); ! DataTable dataTableMostLiquid = mostLiquidSelector.GetTableOfSelectedTickers(); ! SelectorByCloseToCloseVolatility lessVolatileSelector = new SelectorByCloseToCloseVolatility( dataTableMostLiquid , ! true, currentDate.AddDays(-this.numOfDaysForVolatilityComputation), currentDate, ! this.maxNumberOfEligibleTickersToBeChosen); ! ! DataTable dataTableLessVolatile = lessVolatileSelector.GetTableOfSelectedTickers(); // DataSet dataSet = new DataSet(); *************** *** 146,157 **** // dataSet.WriteXml( "c:\\qpReports\\pairsTrading\\eligiblesCon_ByPriceMostLiquidLessVolatileOTCAlwaysQuoted.xml" ); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromLastSelection = ! new SelectorByQuotationAtEachMarketDay( dataTableLessVolatile , ! false, endOfDayHistory.History, ! this.maxNumberOfEligibleTickersToBeChosen); ! DataTable dataTableToBeReturned = quotedAtEachMarketDayFromLastSelection.GetTableOfSelectedTickers(); ! return new EligibleTickers( dataTableToBeReturned ); } --- 146,157 ---- // dataSet.WriteXml( "c:\\qpReports\\pairsTrading\\eligiblesCon_ByPriceMostLiquidLessVolatileOTCAlwaysQuoted.xml" ); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromLastSelection = ! new SelectorByQuotationAtEachMarketDay( dataTableLessVolatile , ! false, history, ! this.maxNumberOfEligibleTickersToBeChosen); ! DataTable dataTableToBeReturned = quotedAtEachMarketDayFromLastSelection.GetTableOfSelectedTickers(); ! return new EligibleTickers( dataTableToBeReturned ); } *************** *** 173,180 **** /// <returns></returns> public EligibleTickers GetEligibleTickers( ! EndOfDayHistory endOfDayHistory ) { EligibleTickers eligibleTickers = ! this.getEligibleTickers_actually( endOfDayHistory ); this.getEligibleTickers_sendNewMessage( eligibleTickers ); return eligibleTickers; --- 173,180 ---- /// <returns></returns> public EligibleTickers GetEligibleTickers( ! History history ) { EligibleTickers eligibleTickers = ! this.getEligibleTickers_actually( history ); this.getEligibleTickers_sendNewMessage( eligibleTickers ); return eligibleTickers; Index: ByPriceMostLiquidLessVolatileCTOAlwaysQuoted.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles/ByPriceMostLiquidLessVolatileCTOAlwaysQuoted.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ByPriceMostLiquidLessVolatileCTOAlwaysQuoted.cs 14 Aug 2008 23:36:25 -0000 1.1 --- ByPriceMostLiquidLessVolatileCTOAlwaysQuoted.cs 29 Sep 2008 21:14:49 -0000 1.2 *************** *** 24,30 **** using System.Data; using QuantProject.ADT.Messaging; - using QuantProject.Business.Strategies.ReturnsManagement.Time; - using QuantProject.Business.Timing; using QuantProject.Data.Selectors; --- 24,29 ---- using System.Data; + using QuantProject.ADT.Histories; using QuantProject.ADT.Messaging; using QuantProject.Data.Selectors; *************** *** 52,55 **** --- 51,55 ---- /// (not more than maxNumberOfEligibleTickersToBeChosen); /// </summary> + [Serializable] public class ByPriceMostLiquidLessVolatileCTOAlwaysQuoted : IEligiblesSelector { *************** *** 104,110 **** private EligibleTickers getEligibleTickers_actually( ! EndOfDayHistory endOfDayHistory ) { ! DateTime currentDate = endOfDayHistory.LastEndOfDayDateTime.DateTime; SelectorByGroup group; --- 104,110 ---- private EligibleTickers getEligibleTickers_actually( ! History history ) { ! DateTime currentDate = history.LastDateTime; SelectorByGroup group; *************** *** 130,134 **** SelectorByLiquidity mostLiquidSelector = new SelectorByLiquidity( dataTableByPrice , ! false, endOfDayHistory.FirstEndOfDayDateTime.DateTime, currentDate, this.maxNumberOfMostLiquidTickersToBeChosen); DataTable dataTableMostLiquid = --- 130,134 ---- SelectorByLiquidity mostLiquidSelector = new SelectorByLiquidity( dataTableByPrice , ! false, history.FirstDateTime, currentDate, this.maxNumberOfMostLiquidTickersToBeChosen); DataTable dataTableMostLiquid = *************** *** 148,152 **** SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromLastSelection = new SelectorByQuotationAtEachMarketDay( dataTableLessVolatile , ! false, endOfDayHistory.History, this.maxNumberOfEligibleTickersToBeChosen); DataTable dataTableToBeReturned = --- 148,152 ---- SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromLastSelection = new SelectorByQuotationAtEachMarketDay( dataTableLessVolatile , ! false, history, this.maxNumberOfEligibleTickersToBeChosen); DataTable dataTableToBeReturned = *************** *** 173,180 **** /// <returns></returns> public EligibleTickers GetEligibleTickers( ! EndOfDayHistory endOfDayHistory ) { EligibleTickers eligibleTickers = ! this.getEligibleTickers_actually( endOfDayHistory ); this.getEligibleTickers_sendNewMessage( eligibleTickers ); return eligibleTickers; --- 173,180 ---- /// <returns></returns> public EligibleTickers GetEligibleTickers( ! History history ) { EligibleTickers eligibleTickers = ! this.getEligibleTickers_actually( history ); this.getEligibleTickers_sendNewMessage( eligibleTickers ); return eligibleTickers; Index: ByPriceMostLiquidLessVolatileOTCAlwaysQuoted.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles/ByPriceMostLiquidLessVolatileOTCAlwaysQuoted.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ByPriceMostLiquidLessVolatileOTCAlwaysQuoted.cs 4 May 2008 22:46:33 -0000 1.2 --- ByPriceMostLiquidLessVolatileOTCAlwaysQuoted.cs 29 Sep 2008 21:14:49 -0000 1.3 *************** *** 24,30 **** using System.Data; using QuantProject.ADT.Messaging; - using QuantProject.Business.Strategies.ReturnsManagement.Time; - using QuantProject.Business.Timing; using QuantProject.Data.Selectors; --- 24,29 ---- using System.Data; + using QuantProject.ADT.Histories; using QuantProject.ADT.Messaging; using QuantProject.Data.Selectors; *************** *** 52,55 **** --- 51,55 ---- /// (not more than maxNumberOfEligibleTickersToBeChosen); /// </summary> + [Serializable] public class ByPriceMostLiquidLessVolatileOTCAlwaysQuoted : IEligiblesSelector { *************** *** 104,110 **** private EligibleTickers getEligibleTickers_actually( ! EndOfDayHistory endOfDayHistory ) { ! DateTime currentDate = endOfDayHistory.LastEndOfDayDateTime.DateTime; SelectorByGroup group; --- 104,110 ---- private EligibleTickers getEligibleTickers_actually( ! History history ) { ! DateTime currentDate = history.LastDateTime; SelectorByGroup group; *************** *** 130,134 **** SelectorByLiquidity mostLiquidSelector = new SelectorByLiquidity( dataTableByPrice , ! false, endOfDayHistory.FirstEndOfDayDateTime.DateTime, currentDate, this.maxNumberOfMostLiquidTickersToBeChosen); DataTable dataTableMostLiquid = --- 130,134 ---- SelectorByLiquidity mostLiquidSelector = new SelectorByLiquidity( dataTableByPrice , ! false, history.FirstDateTime, currentDate, this.maxNumberOfMostLiquidTickersToBeChosen); DataTable dataTableMostLiquid = *************** *** 148,152 **** SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromLastSelection = new SelectorByQuotationAtEachMarketDay( dataTableLessVolatile , ! false, endOfDayHistory.History, this.maxNumberOfEligibleTickersToBeChosen); DataTable dataTableToBeReturned = --- 148,152 ---- SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromLastSelection = new SelectorByQuotationAtEachMarketDay( dataTableLessVolatile , ! false, history, this.maxNumberOfEligibleTickersToBeChosen); DataTable dataTableToBeReturned = *************** *** 173,180 **** /// <returns></returns> public EligibleTickers GetEligibleTickers( ! EndOfDayHistory endOfDayHistory ) { EligibleTickers eligibleTickers = ! this.getEligibleTickers_actually( endOfDayHistory ); this.getEligibleTickers_sendNewMessage( eligibleTickers ); return eligibleTickers; --- 173,180 ---- /// <returns></returns> public EligibleTickers GetEligibleTickers( ! History history ) { EligibleTickers eligibleTickers = ! this.getEligibleTickers_actually( history ); this.getEligibleTickers_sendNewMessage( eligibleTickers ); return eligibleTickers; Index: ByPriceLessVolatileOTCAlwaysQuoted.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles/ByPriceLessVolatileOTCAlwaysQuoted.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ByPriceLessVolatileOTCAlwaysQuoted.cs 25 Apr 2008 17:22:11 -0000 1.1 --- ByPriceLessVolatileOTCAlwaysQuoted.cs 29 Sep 2008 21:14:49 -0000 1.2 *************** *** 19,30 **** 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 QuantProject.ADT.Messaging; - using QuantProject.Business.Strategies.ReturnsManagement.Time; - using QuantProject.Business.Timing; using QuantProject.Data.Selectors; --- 19,29 ---- 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 QuantProject.ADT.Histories; using QuantProject.ADT.Messaging; using QuantProject.Data.Selectors; *************** *** 43,46 **** --- 42,46 ---- /// always quoted at all market days are selected (not more than a given max number); /// </summary> + [Serializable] public class ByPriceLessVolatileOTCAlwaysQuoted : IEligiblesSelector { *************** *** 60,64 **** this.temporizedGroup.ToString() + ")\n" + "MaxNumOfEligibles_" + this.maxNumberOfEligibleTickersToBeChosen.ToString() + "\n" + ! "AverageRawOpenPriceRange(computed for the last " + this.numOfDaysForAverageOpenRawPriceComputation.ToString() + "):\n" + "From_" + this.minPrice + "_to_" + this.maxPrice + "\n" + --- 60,64 ---- this.temporizedGroup.ToString() + ")\n" + "MaxNumOfEligibles_" + this.maxNumberOfEligibleTickersToBeChosen.ToString() + "\n" + ! "AverageRawOpenPriceRange(computed for the last " + this.numOfDaysForAverageOpenRawPriceComputation.ToString() + "):\n" + "From_" + this.minPrice + "_to_" + this.maxPrice + "\n" + *************** *** 66,74 **** } } ! public ByPriceLessVolatileOTCAlwaysQuoted( ! string tickersGroupID , bool temporizedGroup, int maxNumberOfEligibleTickersToBeChosen, ! int numOfDaysForAverageOpenRawPriceComputation, double minPrice, double maxPrice) { this.temporizedGroup = temporizedGroup; --- 66,74 ---- } } ! public ByPriceLessVolatileOTCAlwaysQuoted( ! string tickersGroupID , bool temporizedGroup, int maxNumberOfEligibleTickersToBeChosen, ! int numOfDaysForAverageOpenRawPriceComputation, double minPrice, double maxPrice) { this.temporizedGroup = temporizedGroup; *************** *** 83,115 **** private EligibleTickers getEligibleTickers_actually( ! EndOfDayHistory endOfDayHistory ) { ! DateTime currentDate = endOfDayHistory.LastEndOfDayDateTime.DateTime; SelectorByGroup group; if(this.temporizedGroup) ! //the group is "temporized": returned set of tickers ! // depend on time group = new SelectorByGroup(this.tickersGroupID, currentDate); ! else//the group is not temporized ! group = new SelectorByGroup(this.tickersGroupID); ! DataTable tickersFromGroup = group.GetTableOfSelectedTickers(); ! int numOfTickersInGroupAtCurrentDate = tickersFromGroup.Rows.Count; ! SelectorByAverageRawOpenPrice byPrice = ! new SelectorByAverageRawOpenPrice(tickersFromGroup,false, ! currentDate.AddDays(-this.numOfDaysForAverageOpenRawPriceComputation), ! currentDate, ! numOfTickersInGroupAtCurrentDate, ! this.minPrice,this.maxPrice, 0.00001, double.MaxValue); ! DataTable dataTableByPrice = byPrice.GetTableOfSelectedTickers(); SelectorByOpenToCloseVolatility lessVolatileSelector = new SelectorByOpenToCloseVolatility( dataTableByPrice , ! true, endOfDayHistory.FirstEndOfDayDateTime.DateTime, currentDate, ! this.maxNumberOfEligibleTickersToBeChosen); ! DataTable dataTableLessVolatile = lessVolatileSelector.GetTableOfSelectedTickers(); --- 83,115 ---- private EligibleTickers getEligibleTickers_actually( ! History history ) { ! DateTime currentDate = history.LastDateTime; SelectorByGroup group; if(this.temporizedGroup) ! //the group is "temporized": returned set of tickers ! // depend on time group = new SelectorByGroup(this.tickersGroupID, currentDate); ! else//the group is not temporized ! group = new SelectorByGroup(this.tickersGroupID); ! DataTable tickersFromGroup = group.GetTableOfSelectedTickers(); ! int numOfTickersInGroupAtCurrentDate = tickersFromGroup.Rows.Count; ! SelectorByAverageRawOpenPrice byPrice = ! new SelectorByAverageRawOpenPrice(tickersFromGroup,false, ! currentDate.AddDays(-this.numOfDaysForAverageOpenRawPriceComputation), ! currentDate, ! numOfTickersInGroupAtCurrentDate, ! this.minPrice,this.maxPrice, 0.00001, double.MaxValue); ! DataTable dataTableByPrice = byPrice.GetTableOfSelectedTickers(); SelectorByOpenToCloseVolatility lessVolatileSelector = new SelectorByOpenToCloseVolatility( dataTableByPrice , ! true, history.FirstDateTime, currentDate, ! this.maxNumberOfEligibleTickersToBeChosen); ! DataTable dataTableLessVolatile = lessVolatileSelector.GetTableOfSelectedTickers(); *************** *** 118,129 **** // dataSet.WriteXml( "c:\\qpReports\\pairsTrading\\eligiblesCon_ByPriceLessVolatileOTCAlwaysQuoted.xml" ); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromLastSelection = ! new SelectorByQuotationAtEachMarketDay( dataTableLessVolatile , ! false, endOfDayHistory.History, ! this.maxNumberOfEligibleTickersToBeChosen); ! DataTable dataTableToBeReturned = quotedAtEachMarketDayFromLastSelection.GetTableOfSelectedTickers(); ! return new EligibleTickers( dataTableToBeReturned ); } --- 118,131 ---- // dataSet.WriteXml( "c:\\qpReports\\pairsTrading\\eligiblesCon_ByPriceLessVolatileOTCAlwaysQuoted.xml" ); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromLastSelection = ! new SelectorByQuotationAtEachMarketDay( ! dataTableLessVolatile , ! false , ! history , ! this.maxNumberOfEligibleTickersToBeChosen ); ! DataTable dataTableToBeReturned = quotedAtEachMarketDayFromLastSelection.GetTableOfSelectedTickers(); ! return new EligibleTickers( dataTableToBeReturned ); } *************** *** 145,152 **** /// <returns></returns> public EligibleTickers GetEligibleTickers( ! EndOfDayHistory endOfDayHistory ) { EligibleTickers eligibleTickers = ! this.getEligibleTickers_actually( endOfDayHistory ); this.getEligibleTickers_sendNewMessage( eligibleTickers ); return eligibleTickers; --- 147,154 ---- /// <returns></returns> public EligibleTickers GetEligibleTickers( ! History history ) { EligibleTickers eligibleTickers = ! this.getEligibleTickers_actually( history ); this.getEligibleTickers_sendNewMessage( eligibleTickers ); return eligibleTickers; |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:15:03
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/InSample In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14104/InSample Modified Files: BruteForceChooser.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: BruteForceChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/InSample/BruteForceChooser.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BruteForceChooser.cs 1 Apr 2008 21:28:18 -0000 1.3 --- BruteForceChooser.cs 29 Sep 2008 21:14:49 -0000 1.4 *************** *** 41,44 **** --- 41,45 ---- /// in sample optimization /// </summary> + [Serializable] public abstract class BruteForceChooser : IInSampleChooser { |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:15:02
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a3_Ordering In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14039/a3_Ordering Modified Files: HistoricalEndOfDayOrderExecutor.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: HistoricalEndOfDayOrderExecutor.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a3_Ordering/HistoricalEndOfDayOrderExecutor.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** HistoricalEndOfDayOrderExecutor.cs 20 Dec 2005 19:37:57 -0000 1.6 --- HistoricalEndOfDayOrderExecutor.cs 29 Sep 2008 21:14:44 -0000 1.7 *************** *** 3,7 **** HistoricalEndOfDayOrderExecutor.cs ! Copyright (C) 2003 Glauco Siliprandi --- 3,7 ---- HistoricalEndOfDayOrderExecutor.cs ! Copyright (C) 2003 Glauco Siliprandi *************** *** 19,23 **** 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; --- 19,23 ---- 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; *************** *** 40,62 **** public class HistoricalEndOfDayOrderExecutor : IOrderExecutor { ! private IEndOfDayTimer timer; ! private IHistoricalQuoteProvider historicalQuoteProvider; ! private ISlippageManager slippageManager; ! public HistoricalEndOfDayOrderExecutor( IEndOfDayTimer timer , ! IHistoricalQuoteProvider historicalQuoteProvider ) { this.timer = timer; ! this.historicalQuoteProvider = historicalQuoteProvider; ! this.slippageManager = new ZeroSlippageManager(); } ! public HistoricalEndOfDayOrderExecutor( IEndOfDayTimer timer , ! IHistoricalQuoteProvider historicalQuoteProvider, ISlippageManager slippageManager ) ! { ! this.timer = timer; ! this.historicalQuoteProvider = historicalQuoteProvider; ! this.slippageManager = slippageManager; ! } ! [field:NonSerialized] public event OrderFilledEventHandler OrderFilled; --- 40,64 ---- public class HistoricalEndOfDayOrderExecutor : IOrderExecutor { ! private Timer timer; ! private HistoricalMarketValueProvider historicalMarketValueProvider; ! private ISlippageManager slippageManager; ! public HistoricalEndOfDayOrderExecutor( ! Timer timer , HistoricalMarketValueProvider historicalMarketValueProvider ) { this.timer = timer; ! this.historicalMarketValueProvider = historicalMarketValueProvider; ! this.slippageManager = new ZeroSlippageManager(); } ! public HistoricalEndOfDayOrderExecutor( ! Timer timer , ! HistoricalMarketValueProvider historicalMarketValueProvider , ! ISlippageManager slippageManager ) ! { ! this.timer = timer; ! this.historicalMarketValueProvider = historicalMarketValueProvider; ! this.slippageManager = slippageManager; ! } ! [field:NonSerialized] public event OrderFilledEventHandler OrderFilled; *************** *** 64,78 **** public void Execute( Order order ) { ! double instrumentMarketPrice = ! this.historicalQuoteProvider.GetMarketValue(order.Instrument.Key , ! this.timer.GetCurrentTime()); ! double instrumentPriceWithSlippage = instrumentMarketPrice + ! this.slippageManager.GetSlippage(order); ! EndOfDayTransaction endOfDayTransaction = new EndOfDayTransaction( ! TimedTransaction.GetTransactionType( order.Type ) , order.Instrument , ! order.Quantity , instrumentPriceWithSlippage , ! new EndOfDayDateTime( this.timer.GetCurrentTime().DateTime , ! this.timer.GetCurrentTime().EndOfDaySpecificTime ) ); ! OrderFilled( this , new OrderFilledEventArgs( order , endOfDayTransaction ) ); } } --- 66,83 ---- public void Execute( Order order ) { ! double instrumentMarketPrice = ! this.historicalMarketValueProvider.GetMarketValue(order.Instrument.Key , ! this.timer.GetCurrentDateTime()); ! double instrumentPriceWithSlippage = instrumentMarketPrice + ! this.slippageManager.GetSlippage(order); ! TimedTransaction timedTransaction = new TimedTransaction( ! TimedTransaction.GetTransactionType( order.Type ) , ! order.Instrument , ! order.Quantity , ! instrumentPriceWithSlippage , ! this.timer.GetCurrentDateTime() ); ! // new EndOfDayDateTime( this.timer.GetCurrentTime().DateTime , ! // this.timer.GetCurrentTime().EndOfDaySpecificTime ) ); ! OrderFilled( this , new OrderFilledEventArgs( order , timedTransaction ) ); } } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:15:00
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Transactions In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14039/a2_Accounting/Transactions Modified Files: TransactionHistory.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: TransactionHistory.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Transactions/TransactionHistory.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TransactionHistory.cs 6 Feb 2005 18:23:30 -0000 1.2 --- TransactionHistory.cs 29 Sep 2008 21:14:43 -0000 1.3 *************** *** 71,77 **** // } ! public void Add( EndOfDayTransaction transaction ) { ! base.MultiAdd( transaction.EndOfDayDateTime.DateTime , transaction ); } --- 71,77 ---- // } ! public void Add( TimedTransaction transaction ) { ! base.MultiAdd( transaction.DateTime , transaction ); } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:14:59
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a3_Testing In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14019 Modified Files: Tester.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: Tester.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a3_Testing/Tester.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Tester.cs 6 Feb 2005 18:23:30 -0000 1.8 --- Tester.cs 29 Sep 2008 21:14:36 -0000 1.9 *************** *** 3,7 **** Tester.cs ! Copyright (C) 2003 Glauco Siliprandi --- 3,7 ---- Tester.cs ! Copyright (C) 2003 Glauco Siliprandi *************** *** 19,23 **** 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; --- 19,23 ---- 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; *************** *** 42,125 **** public class Tester : BackTester { ! private TestWindow testWindow; ! private OrderManager orderManager = new OrderManager(); ! private double initialCash = 0.0; private IDataStreamer dataStreamer; ! //private TestResults testResults; ! public OrderManager OrderManager ! { ! get { return orderManager; } ! set { orderManager = value; } ! } ! public Tester(TestWindow testWindow , TradingSystems tradingSystems , double initialCash , ! IDataStreamer dataStreamer ) { this.testWindow = testWindow; this.dataStreamer = dataStreamer; this.TradingSystems = tradingSystems; ! this.initialCash = initialCash; ! this.Account.AddCash( new EndOfDayDateTime( testWindow.StartDateTime , EndOfDaySpecificTime.MarketOpen ) , ! initialCash ); } ! public override double Objective() ! { ! this.Account.Clear(); ! this.Account.AddCash( new EndOfDayDateTime( testWindow.StartDateTime , EndOfDaySpecificTime.MarketOpen ) , ! initialCash ); ! this.Test(); ! return - this.Account.GetFitnessValue(); ! } ! #region "Test" ! private void initializeTradingSystems() ! { ! foreach (TradingSystem tradingSystem in this.TradingSystems) ! { ! tradingSystem.Parameters = this.Parameters; ! tradingSystem.TestStartDateTime = this.testWindow.StartDateTime; ! tradingSystem.InitializeData(); ! } ! } ! private void handleCurrentSignal( Signal signal , IDataStreamer dataStreamer ) ! { ! Orders orders = this.Account.AccountStrategy.GetOrders( signal , dataStreamer ); ! foreach (Order order in orders ) ! { ! EndOfDayTransaction transaction = this.OrderManager.GetTransaction( order , ! dataStreamer ); ! this.Account.Add( transaction ); ! //Debug.WriteLine( account.ToString( dateTime ) ); ! } ! } ! private void testCurrentDateForTradingSystem( TradingSystem tradingSystem , ! ExtendedDateTime extendedDateTime , IDataStreamer dataStreamer ) ! { ! Signals signals = tradingSystem.GetSignals( extendedDateTime ); ! foreach (Signal signal in signals) ! handleCurrentSignal( signal , dataStreamer ); ! } ! private void testCurrentExtendedDateTime( ExtendedDateTime extendedDateTime , ! IDataStreamer dataStreamer ) ! { ! foreach (TradingSystem tradingSystem in this.TradingSystems) ! testCurrentDateForTradingSystem( tradingSystem , extendedDateTime ,dataStreamer ); ! } ! public override void Test() ! { ! DateTime dateTime = this.testWindow.StartDateTime; ! initializeTradingSystems(); ! while (dateTime <= this.testWindow.EndDateTime) ! { ! testCurrentExtendedDateTime( new ExtendedDateTime( dateTime , BarComponent.Open ) , ! dataStreamer ); ! testCurrentExtendedDateTime( new ExtendedDateTime( dateTime , BarComponent.Close ) , ! dataStreamer ); ! dateTime = dateTime.AddDays( 1 ); ! } ! } ! #endregion } } --- 42,138 ---- public class Tester : BackTester { ! private TestWindow testWindow; ! private OrderManager orderManager = new OrderManager(); ! private double initialCash = 0.0; private IDataStreamer dataStreamer; ! //private TestResults testResults; ! public OrderManager OrderManager ! { ! get { return orderManager; } ! set { orderManager = value; } ! } ! public Tester(TestWindow testWindow , TradingSystems tradingSystems , double initialCash , ! IDataStreamer dataStreamer ) { this.testWindow = testWindow; this.dataStreamer = dataStreamer; this.TradingSystems = tradingSystems; ! this.initialCash = initialCash; ! this.Account.AddCash( ! HistoricalEndOfDayTimer.GetMarketOpen( this.testWindow.StartDateTime ) , ! this.initialCash ); ! // this.Account.AddCash( new EndOfDayDateTime( testWindow.StartDateTime , EndOfDaySpecificTime.MarketOpen ) , ! // initialCash ); } ! public override double Objective() ! { ! this.Account.Clear(); ! this.Account.AddCash( ! HistoricalEndOfDayTimer.GetMarketOpen( this.testWindow.StartDateTime ) , ! this.initialCash ); ! // new EndOfDayDateTime( testWindow.StartDateTime , EndOfDaySpecificTime.MarketOpen ) , ! // initialCash ); ! // this.Account.AddCash( new EndOfDayDateTime( testWindow.StartDateTime , EndOfDaySpecificTime.MarketOpen ) , ! // initialCash ); ! this.Test(); ! return - this.Account.GetFitnessValue(); ! } ! #region "Test" ! private void initializeTradingSystems() ! { ! foreach (TradingSystem tradingSystem in this.TradingSystems) ! { ! tradingSystem.Parameters = this.Parameters; ! tradingSystem.TestStartDateTime = this.testWindow.StartDateTime; ! tradingSystem.InitializeData(); ! } ! } ! private void handleCurrentSignal( Signal signal , IDataStreamer dataStreamer ) ! { ! Orders orders = this.Account.AccountStrategy.GetOrders( signal , dataStreamer ); ! foreach (Order order in orders ) ! { ! TimedTransaction timedTransaction = ! this.OrderManager.GetTimedTransaction( ! order , dataStreamer ); ! this.Account.Add( timedTransaction ); ! //Debug.WriteLine( account.ToString( dateTime ) ); ! } ! } ! private void testCurrentDateForTradingSystem( TradingSystem tradingSystem , ! DateTime dateTime , IDataStreamer dataStreamer ) ! { ! Signals signals = tradingSystem.GetSignals( dateTime ); ! foreach (Signal signal in signals) ! handleCurrentSignal( signal , dataStreamer ); ! } ! private void testCurrentDateTime( DateTime dateTime , ! IDataStreamer dataStreamer ) ! { ! foreach (TradingSystem tradingSystem in this.TradingSystems) ! testCurrentDateForTradingSystem( tradingSystem , dateTime ,dataStreamer ); ! } ! public override void Test() ! { ! DateTime dateTime = this.testWindow.StartDateTime; ! initializeTradingSystems(); ! while ( dateTime <= this.testWindow.EndDateTime ) ! { ! this.testCurrentDateTime( ! HistoricalEndOfDayTimer.GetMarketOpen( dateTime ) , this.dataStreamer ); ! this.testCurrentDateTime( ! HistoricalEndOfDayTimer.GetMarketClose( dateTime ) , this.dataStreamer ); ! // testCurrentDateTime( new ExtendedDateTime( dateTime , BarComponent.Open ) , ! // dataStreamer ); ! // testCurrentDateTime( new ExtendedDateTime( dateTime , BarComponent.Close ) , ! // dataStreamer ); ! dateTime = dateTime.AddDays( 1 ); ! } ! } ! #endregion } } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:14:49
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/EndOfDayStrategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13959/EndOfDayStrategies Modified Files: BasicEndOfDayStrategyForBacktester.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: BasicEndOfDayStrategyForBacktester.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/EndOfDayStrategies/BasicEndOfDayStrategyForBacktester.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** BasicEndOfDayStrategyForBacktester.cs 16 Aug 2008 19:28:02 -0000 1.7 --- BasicEndOfDayStrategyForBacktester.cs 29 Sep 2008 21:14:23 -0000 1.8 *************** *** 19,23 **** 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; --- 19,23 ---- 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; *************** *** 43,48 **** /// that should be inherited by specific strategies /// </summary> public abstract class BasicEndOfDayStrategyForBacktester : ! IEndOfDayStrategyForBacktester { public event NewLogItemEventHandler NewLogItem; --- 43,49 ---- /// that should be inherited by specific strategies /// </summary> + [Serializable] public abstract class BasicEndOfDayStrategyForBacktester : ! IStrategyForBacktester { public event NewLogItemEventHandler NewLogItem; *************** *** 55,59 **** protected IEligiblesSelector eligiblesSelector; protected IInSampleChooser inSampleChooser; ! protected IHistoricalQuoteProvider historicalQuoteProviderForInSample; protected DateTime lastOptimizationDateTime; --- 56,60 ---- protected IEligiblesSelector eligiblesSelector; protected IInSampleChooser inSampleChooser; ! protected HistoricalMarketValueProvider historicalMarketValueProviderForInSample; protected DateTime lastOptimizationDateTime; *************** *** 71,79 **** } ! public bool StopBacktestIfMaxRunningHoursHasBeenReached { get { ! return this.optimalWeightedPositionsAreToBeUpdated(); } } --- 72,80 ---- } ! public virtual bool StopBacktestIfMaxRunningHoursHasBeenReached { get { ! return this.areOptimalWeightedPositionsToBeUpdated(); } } *************** *** 113,118 **** IEligiblesSelector eligiblesSelector , IInSampleChooser inSampleChooser , ! IHistoricalQuoteProvider historicalQuoteProviderForInSample ! ) { this.numDaysBeetweenEachOtpimization = numDaysBeetweenEachOtpimization; --- 114,119 ---- IEligiblesSelector eligiblesSelector , IInSampleChooser inSampleChooser , ! HistoricalMarketValueProvider historicalMarketValueProviderForInSample ! ) { this.numDaysBeetweenEachOtpimization = numDaysBeetweenEachOtpimization; *************** *** 122,127 **** this.eligiblesSelector = eligiblesSelector; this.inSampleChooser = inSampleChooser; ! this.historicalQuoteProviderForInSample = ! historicalQuoteProviderForInSample; this.returnIntervals = --- 123,128 ---- this.eligiblesSelector = eligiblesSelector; this.inSampleChooser = inSampleChooser; ! this.historicalMarketValueProviderForInSample = ! historicalMarketValueProviderForInSample; this.returnIntervals = *************** *** 129,133 **** } ! #region MarketOpenEventHandler protected abstract bool marketOpenEventHandler_arePositionsToBeClosed(); --- 130,134 ---- } ! #region marketOpenEventHandler protected abstract bool marketOpenEventHandler_arePositionsToBeClosed(); *************** *** 136,141 **** WeightedPositions marketOpenEventHandler_getPositionsToBeOpened(); ! public void MarketOpenEventHandler( ! Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { this.updateReturnIntervals(); --- 137,141 ---- WeightedPositions marketOpenEventHandler_getPositionsToBeOpened(); ! private void marketOpenEventHandler() { this.updateReturnIntervals(); *************** *** 153,164 **** } } ! #endregion MarketOpenEventHandler ! public void FiveMinutesBeforeMarketCloseEventHandler( ! Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) ! { ! } ! #region MarketCloseEventHandler protected abstract bool marketCloseEventHandler_arePositionsToBeClosed(); --- 153,164 ---- } } ! #endregion marketOpenEventHandler ! // public void FiveMinutesBeforeMarketCloseEventHandler( ! // Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) ! // { ! // } ! #region marketCloseEventHandler protected abstract bool marketCloseEventHandler_arePositionsToBeClosed(); *************** *** 167,172 **** WeightedPositions marketCloseEventHandler_getPositionsToBeOpened(); ! public void MarketCloseEventHandler( ! Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { this.updateReturnIntervals(); --- 167,171 ---- WeightedPositions marketCloseEventHandler_getPositionsToBeOpened(); ! private void marketCloseEventHandler() { this.updateReturnIntervals(); *************** *** 184,240 **** } } ! #endregion MarketCloseEventHandler ! #region OneHourAfterMarketCloseEventHandler ! private bool optimalWeightedPositionsAreToBeUpdated() { - // TimeSpan timeSpanSinceLastOptimization = - // this.now().DateTime - this.lastOptimizationDateTime; - // bool areToBeUpdated = ( timeSpanSinceLastOptimization.Days >= - // this.numDaysBeetweenEachOtpimization ); - // return areToBeUpdated; DateTime dateTimeForNextOptimization = this.lastOptimizationDateTime.AddDays( ! this.numDaysBeetweenEachOtpimization ); bool areToBeUpdated = ( ( ( this.account.Portfolio.Count == 0 ) ! && ( ( this.lastOptimizationDateTime == DateTime.MinValue ) ) ) || ! ( this.now().DateTime >= dateTimeForNextOptimization ) ); return areToBeUpdated; } #region getInSampleReturnIntervals ! private EndOfDayDateTime getInSampleReturnIntervals_getFirstDate() { ! DateTime firstDateTime = this.now().DateTime.AddDays( -this.numDaysForInSampleOptimization ); ! EndOfDayDateTime firstDate = new EndOfDayDateTime( ! firstDateTime , EndOfDaySpecificTime.MarketOpen ); ! return firstDate; } private ReturnIntervals getInSampleReturnIntervals() { ! EndOfDayDateTime firstDate = ! this.getInSampleReturnIntervals_getFirstDate(); ! EndOfDayDateTime lastDate = ! new EndOfDayDateTime( this.now().DateTime , ! EndOfDaySpecificTime.MarketClose ); ReturnIntervals inSampleReturnIntervals = new ReturnIntervals( this.intervalsSelectorForInSample ); ! inSampleReturnIntervals.AppendFirstInterval( firstDate ); ! if ( inSampleReturnIntervals.LastEndOfDayDateTime.IsLessThan( ! lastDate ) ) inSampleReturnIntervals.AppendIntervalsButDontGoBeyondLastDate( ! lastDate ); return inSampleReturnIntervals; } #endregion getInSampleReturnIntervals private void checkQualityFor_bestTestingPositionsInSample() { for( int i = 0 ; i < this.bestTestingPositionsInSample.Length ; i++ ) if ( this.bestTestingPositionsInSample[ i ] == null ) ! throw new Exception( ! "The IInSampleChooser should have returned an array " + ! "of non null bestTestingPositionsInSample!" ); } private void notifyMessage( EligibleTickers eligibleTickers ) --- 183,254 ---- } } ! #endregion marketCloseEventHandler ! #region oneHourAfterMarketCloseEventHandler ! ! #region areOptimalWeightedPositionsToBeUpdated ! private bool areOptimalWeightedPositionsToBeUpdated_actually() { DateTime dateTimeForNextOptimization = this.lastOptimizationDateTime.AddDays( ! this.numDaysBeetweenEachOtpimization ); ! DateTime currentSimulatedDateTime = this.now(); bool areToBeUpdated = ( ( ( this.account.Portfolio.Count == 0 ) ! && ( ( this.lastOptimizationDateTime == DateTime.MinValue ) ) ) || ! ( currentSimulatedDateTime >= dateTimeForNextOptimization ) ); return areToBeUpdated; } + private bool areOptimalWeightedPositionsToBeUpdated() + { + bool areToBeUpdated; + // if ( !this.account.Timer.IsActive ) + // // the backtester has stopped the timer because the + // // backtest has gone beyond max running hours + // areToBeUpdated = false; + // else + areToBeUpdated = + this.areOptimalWeightedPositionsToBeUpdated_actually(); + return areToBeUpdated; + } + #endregion areOptimalWeightedPositionsToBeUpdated + #region getInSampleReturnIntervals ! private DateTime getInSampleReturnIntervals_getFirstDateTime() { ! DateTime someDaysBefore = this.now().AddDays( -this.numDaysForInSampleOptimization ); ! DateTime firstDateTime = ! HistoricalEndOfDayTimer.GetMarketOpen( someDaysBefore ); ! // EndOfDayDateTime firstDate = new EndOfDayDateTime( ! // someDaysBefore , EndOfDaySpecificTime.MarketOpen ); ! return firstDateTime; } private ReturnIntervals getInSampleReturnIntervals() { ! DateTime firstDateTime = ! this.getInSampleReturnIntervals_getFirstDateTime(); ! DateTime lastDateTime = ! HistoricalEndOfDayTimer.GetMarketClose( this.now() ); ! // new EndOfDayDateTime( this.now().DateTime , ! // EndOfDaySpecificTime.MarketClose ); ReturnIntervals inSampleReturnIntervals = new ReturnIntervals( this.intervalsSelectorForInSample ); ! inSampleReturnIntervals.AppendFirstInterval( firstDateTime ); ! if ( inSampleReturnIntervals.LastDateTime < lastDateTime ) inSampleReturnIntervals.AppendIntervalsButDontGoBeyondLastDate( ! lastDateTime ); return inSampleReturnIntervals; } #endregion getInSampleReturnIntervals + private void checkQualityFor_bestTestingPositionsInSample() { for( int i = 0 ; i < this.bestTestingPositionsInSample.Length ; i++ ) if ( this.bestTestingPositionsInSample[ i ] == null ) ! throw new Exception( ! "The IInSampleChooser should have returned an array " + ! "of non null bestTestingPositionsInSample!" ); } private void notifyMessage( EligibleTickers eligibleTickers ) *************** *** 249,262 **** this.NewMessage( this , newMessageEventArgs ); } - #region logOptimizationInfo - // private void outputMessage( string message ) - // { - // string dateStamp = - // ExtendedDateTime.GetShortDescriptionForFileName( DateTime.Now ); - // MessageManager.DisplayMessage( message , - // "NotificationMessagesForCurrentStrategy_" + - // dateStamp + ".Txt" ); - // } protected abstract LogItem getLogItem( EligibleTickers eligibleTickers ); --- 263,268 ---- this.NewMessage( this , newMessageEventArgs ); } + #region logOptimizationInfo protected abstract LogItem getLogItem( EligibleTickers eligibleTickers ); *************** *** 274,277 **** --- 280,284 ---- } #endregion logOptimizationInfo + private void updateOptimalTestingPositions_actually() { *************** *** 280,290 **** EligibleTickers eligibleTickers = this.eligiblesSelector.GetEligibleTickers( ! inSampleReturnIntervals.BordersHistory ); this.inSampleReturnsManager = new ReturnsManager( inSampleReturnIntervals , ! this.historicalQuoteProviderForInSample ); this.bestTestingPositionsInSample = (TestingPositions[])this.inSampleChooser.AnalyzeInSample( ! eligibleTickers , this.inSampleReturnsManager ); this.checkQualityFor_bestTestingPositionsInSample(); --- 287,297 ---- EligibleTickers eligibleTickers = this.eligiblesSelector.GetEligibleTickers( ! inSampleReturnIntervals.BordersHistory ); this.inSampleReturnsManager = new ReturnsManager( inSampleReturnIntervals , ! this.historicalMarketValueProviderForInSample ); this.bestTestingPositionsInSample = (TestingPositions[])this.inSampleChooser.AnalyzeInSample( ! eligibleTickers , this.inSampleReturnsManager ); this.checkQualityFor_bestTestingPositionsInSample(); *************** *** 295,310 **** { this.updateOptimalTestingPositions_actually(); ! this.lastOptimizationDateTime = this.now().DateTime; // FixedLengthTwoPhasesLogItem logItem = // new FixedLengthTwoPhasesLogItem( this.now() ); // logItem.BestWeightedPositionsInSample = this.bestWeightedPositionsInSample; } ! public void OneHourAfterMarketCloseEventHandler( ! Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! if ( this.optimalWeightedPositionsAreToBeUpdated() ) this.updateOptimalTestingPositions(); } ! #endregion OneHourAfterMarketCloseEventHandler // protected bool isInsampleOptimizationNeeded() --- 302,328 ---- { this.updateOptimalTestingPositions_actually(); ! this.lastOptimizationDateTime = this.now(); // FixedLengthTwoPhasesLogItem logItem = // new FixedLengthTwoPhasesLogItem( this.now() ); // logItem.BestWeightedPositionsInSample = this.bestWeightedPositionsInSample; } ! private void oneHourAfterMarketCloseEventHandler() { ! if ( this.areOptimalWeightedPositionsToBeUpdated() ) this.updateOptimalTestingPositions(); } ! #endregion oneHourAfterMarketCloseEventHandler ! ! #region NewDateTimeEventHandler ! public void NewDateTimeEventHandler( Object sender , DateTime dateTime ) ! { ! if ( HistoricalEndOfDayTimer.IsMarketOpen( dateTime ) ) ! this.marketOpenEventHandler(); ! if ( HistoricalEndOfDayTimer.IsMarketClose( dateTime ) ) ! this.marketCloseEventHandler(); ! if ( HistoricalEndOfDayTimer.IsOneHourAfterMarketClose( dateTime ) ) ! this.oneHourAfterMarketCloseEventHandler(); ! } ! #endregion NewDateTimeEventHandler // protected bool isInsampleOptimizationNeeded() *************** *** 320,340 **** // } ! protected EndOfDayDateTime now() { ! return this.account.EndOfDayTimer.GetCurrentTime(); } private void updateReturnIntervals() { ! EndOfDayDateTime currentEndOfDayDateTime = this.now(); if ( this.returnIntervals.Count == 0 ) // no interval has been added yet this.returnIntervals.AppendFirstInterval( ! currentEndOfDayDateTime ); else // at least one interval has already been added ! if ( this.returnIntervals.LastEndOfDayDateTime.IsLessThanOrEqualTo( ! currentEndOfDayDateTime ) ) this.returnIntervals.AppendIntervalsToGoJustBeyond( ! currentEndOfDayDateTime ); } protected ReturnInterval lastIntervalAppended() --- 338,359 ---- // } ! protected DateTime now() { ! DateTime simulatedDateTime = ! this.account.Timer.GetCurrentDateTime(); ! return simulatedDateTime; } private void updateReturnIntervals() { ! DateTime currentDateTime = this.now(); if ( this.returnIntervals.Count == 0 ) // no interval has been added yet this.returnIntervals.AppendFirstInterval( ! currentDateTime ); else // at least one interval has already been added ! if ( this.returnIntervals.LastDateTime <= currentDateTime ) this.returnIntervals.AppendIntervalsToGoJustBeyond( ! currentDateTime ); } protected ReturnInterval lastIntervalAppended() |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:14:47
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13959 Modified Files: AccountStrategy.cs Benchmark.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: AccountStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/AccountStrategy.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AccountStrategy.cs 9 Jan 2005 22:08:47 -0000 1.3 --- AccountStrategy.cs 29 Sep 2008 21:14:23 -0000 1.4 *************** *** 61,65 **** virtualOrder.Instrument , (long) - ((Position)this.account.Portfolio[ virtualOrder.Instrument.Key ]).Quantity , ! virtualOrder.EndOfDayDateTime ) ); if ( !this.account.Portfolio.IsLong( virtualOrder.Instrument ) ) orders.Add( new Order( OrderType.MarketBuy , --- 61,65 ---- virtualOrder.Instrument , (long) - ((Position)this.account.Portfolio[ virtualOrder.Instrument.Key ]).Quantity , ! virtualOrder.DateTime ) ); if ( !this.account.Portfolio.IsLong( virtualOrder.Instrument ) ) orders.Add( new Order( OrderType.MarketBuy , *************** *** 68,72 **** this.account.CashAmount + this.account.Portfolio.GetMarketValue( this.account.DataStreamer ) , ! this.account.DataStreamer ) , virtualOrder.EndOfDayDateTime ) ); break; case OrderType.MarketSell: --- 68,72 ---- this.account.CashAmount + this.account.Portfolio.GetMarketValue( this.account.DataStreamer ) , ! this.account.DataStreamer ) , virtualOrder.DateTime ) ); break; case OrderType.MarketSell: *************** *** 75,79 **** virtualOrder.Instrument , (long) this.account.Portfolio.GetPosition( virtualOrder.Instrument ).Quantity , ! virtualOrder.EndOfDayDateTime ) ); if ( !this.account.Portfolio.IsShort( virtualOrder.Instrument ) ) orders.Add( new Order( OrderType.MarketSellShort , --- 75,79 ---- virtualOrder.Instrument , (long) this.account.Portfolio.GetPosition( virtualOrder.Instrument ).Quantity , ! virtualOrder.DateTime ) ); if ( !this.account.Portfolio.IsShort( virtualOrder.Instrument ) ) orders.Add( new Order( OrderType.MarketSellShort , *************** *** 83,87 **** this.account.Portfolio.GetMarketValue( dataStreamer ) , dataStreamer ) , ! virtualOrder.EndOfDayDateTime ) ); break; default: --- 83,87 ---- this.account.Portfolio.GetMarketValue( dataStreamer ) , dataStreamer ) , ! virtualOrder.DateTime ) ); break; default: Index: Benchmark.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Benchmark.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Benchmark.cs 7 Feb 2008 18:35:38 -0000 1.3 --- Benchmark.cs 29 Sep 2008 21:14:23 -0000 1.4 *************** *** 1,4 **** --- 1,6 ---- using System; + using QuantProject.ADT; + using QuantProject.ADT.Histories; using QuantProject.Business.DataProviders; using QuantProject.Business.Strategies.ReturnsManagement.Time; *************** *** 15,19 **** { private string ticker; ! private HistoricalQuoteProvider historicalQuoteProvider; public string Ticker --- 17,21 ---- { private string ticker; ! private HistoricalMarketValueProvider historicalQuoteProvider; public string Ticker *************** *** 31,35 **** #region GetTimeStep private void getTimeStep_checkParameters( ! EndOfDayDateTime timeStepBegin ) { if ( !this.historicalQuoteProvider.WasExchanged( this.ticker , --- 33,37 ---- #region GetTimeStep private void getTimeStep_checkParameters( ! DateTime timeStepBegin ) { if ( !this.historicalQuoteProvider.WasExchanged( this.ticker , *************** *** 40,46 **** } private void isExchanged_checkParameter( ! EndOfDayDateTime endOfDayDateTime ) { ! if ( endOfDayDateTime.DateTime.Year > DateTime.Now.Year ) throw new Exception( "It looks like this is a loop! " + --- 42,48 ---- } private void isExchanged_checkParameter( ! DateTime dateTime ) { ! if ( dateTime.Year > DateTime.Now.Year ) throw new Exception( "It looks like this is a loop! " + *************** *** 49,69 **** this.ticker + "'" ); } ! private bool isExchanged( EndOfDayDateTime endOfDayDateTime ) { ! this.isExchanged_checkParameter( endOfDayDateTime ); bool isTraded = this.historicalQuoteProvider.WasExchanged( ! this.ticker , endOfDayDateTime ); return isTraded; } private ReturnInterval getTimeStep_actually( ! EndOfDayDateTime timeStepBegin ) { ! EndOfDayDateTime currentEndOfDayDateTime = ! timeStepBegin.GetNextMarketStatusSwitch(); ! while ( !this.isExchanged( currentEndOfDayDateTime ) ) ! currentEndOfDayDateTime = ! currentEndOfDayDateTime.GetNextMarketStatusSwitch(); ReturnInterval timeStep = ! new ReturnInterval( timeStepBegin , currentEndOfDayDateTime ); return timeStep; } --- 51,74 ---- this.ticker + "'" ); } ! private bool isExchanged( DateTime dateTime ) { ! this.isExchanged_checkParameter( dateTime ); bool isTraded = this.historicalQuoteProvider.WasExchanged( ! this.ticker , dateTime ); return isTraded; } private ReturnInterval getTimeStep_actually( ! DateTime timeStepBegin ) { ! DateTime currentDateTime = ! HistoricalEndOfDayTimer.GetNextMarketStatusSwitch( timeStepBegin ); ! // timeStepBegin.GetNextMarketStatusSwitch(); ! while ( !this.isExchanged( currentDateTime ) ) ! currentDateTime = ! HistoricalEndOfDayTimer.GetNextMarketStatusSwitch( currentDateTime ); ! // currentEndOfDayDateTime = ! // currentEndOfDayDateTime.GetNextMarketStatusSwitch(); ReturnInterval timeStep = ! new ReturnInterval( timeStepBegin , currentDateTime ); return timeStep; } *************** *** 73,80 **** /// <param name="timeStepBegin"></param> /// <returns></returns> ! public ReturnInterval GetTimeStep( EndOfDayDateTime timeStepBegin ) { this.getTimeStep_checkParameters( timeStepBegin ); ! ReturnInterval timeStep = this.getTimeStep_actually( timeStepBegin ); return timeStep; } --- 78,86 ---- /// <param name="timeStepBegin"></param> /// <returns></returns> ! public ReturnInterval GetTimeStep( DateTime timeStepBegin ) { this.getTimeStep_checkParameters( timeStepBegin ); ! ReturnInterval timeStep = ! this.getTimeStep_actually( timeStepBegin ); return timeStep; } *************** *** 84,123 **** /// Returns either the next market close or the next market open /// (when the benchmark is exchanged), whichever is the nearest. ! /// If endOfDayDateTime is either a market close or a market open ! /// when the benchmark is exchanged, then endOfDayDateTime itself /// is returned /// </summary> ! /// <param name="endOfDayDateTime"></param> /// <returns></returns> ! public EndOfDayDateTime GetThisOrNextMarketStatusSwitch( ! EndOfDayDateTime endOfDayDateTime ) { ! EndOfDayDateTime currentEndOfDayDateTime = endOfDayDateTime; ! while ( !this.isExchanged( currentEndOfDayDateTime ) ) ! currentEndOfDayDateTime = ! currentEndOfDayDateTime.GetNextMarketStatusSwitch(); ! return currentEndOfDayDateTime; } /// <summary> ! /// Returns the EndOfDayHistory of the benchmark /// between the two given EndOfDayDateTimes /// </summary> ! public EndOfDayHistory GetEndOfDayHistory( ! EndOfDayDateTime firstEndOfDayDateTime, ! EndOfDayDateTime lastEndOfDayDateTime ) { ! if( lastEndOfDayDateTime.IsLessThanOrEqualTo(firstEndOfDayDateTime) ) ! throw new Exception("lastEndOfDayDateTime has to be greater than " + "firstEndOfDayDateTime !!"); ! EndOfDayHistory endOfDayHistory = new EndOfDayHistory(); ! EndOfDayDateTime endOfDayDateTimeToAddToHistory = ! firstEndOfDayDateTime.Copy(); ! while( endOfDayDateTimeToAddToHistory.IsLessThanOrEqualTo(lastEndOfDayDateTime) ) { ! if( this.isExchanged( endOfDayDateTimeToAddToHistory ) ) ! endOfDayHistory.Add( endOfDayDateTimeToAddToHistory, endOfDayDateTimeToAddToHistory ); ! endOfDayDateTimeToAddToHistory = ! endOfDayDateTimeToAddToHistory.GetNextMarketStatusSwitch(); } return endOfDayHistory; --- 90,139 ---- /// Returns either the next market close or the next market open /// (when the benchmark is exchanged), whichever is the nearest. ! /// If dateTime is either a market close or a market open ! /// when the benchmark is exchanged, then dateTime itself /// is returned /// </summary> ! /// <param name="dateTime"></param> /// <returns></returns> ! public DateTime GetThisOrNextMarketStatusSwitch( ! DateTime dateTime ) { ! DateTime currentDateTime = dateTime; ! if ( !HistoricalEndOfDayTimer.IsMarketStatusSwitch( currentDateTime ) ) ! currentDateTime = ! HistoricalEndOfDayTimer.GetNextMarketStatusSwitch( ! currentDateTime ); ! while ( !this.isExchanged( currentDateTime ) ) ! currentDateTime = ! HistoricalEndOfDayTimer.GetNextMarketStatusSwitch( ! currentDateTime ); ! // currentEndOfDayDateTime.GetNextMarketStatusSwitch(); ! return currentDateTime; } /// <summary> ! /// Returns the End of Day History of the benchmark /// between the two given EndOfDayDateTimes /// </summary> ! public History GetEndOfDayHistory( ! DateTime firstDateTime, ! DateTime lastDateTime ) { ! if( lastDateTime <= firstDateTime ) ! throw new Exception("lastDateTime has to be greater than " + "firstEndOfDayDateTime !!"); ! History endOfDayHistory = new History(); ! DateTime dateTimeToAddToHistory = ! ExtendedDateTime.Copy( firstDateTime ); ! // firstDateTime.Copy(); ! while( dateTimeToAddToHistory <= lastDateTime ) { ! if( this.isExchanged( dateTimeToAddToHistory ) ) ! endOfDayHistory.Add( ! dateTimeToAddToHistory , ! dateTimeToAddToHistory ); ! dateTimeToAddToHistory = ! HistoricalEndOfDayTimer.GetNextMarketStatusSwitch( ! dateTimeToAddToHistory ); } return endOfDayHistory; |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:14:40
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13959/Optimizing/Decoding Modified Files: BasicDecoderForTestingPositions.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: BasicDecoderForTestingPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding/BasicDecoderForTestingPositions.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** BasicDecoderForTestingPositions.cs 20 Apr 2008 16:33:13 -0000 1.7 --- BasicDecoderForTestingPositions.cs 29 Sep 2008 21:14:23 -0000 1.8 *************** *** 37,40 **** --- 37,41 ---- /// can be decoded only tickers /// </summary> + [Serializable] public abstract class BasicDecoderForTestingPositions : IDecoderForTestingPositions |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:14:37
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/InSample In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13959/InSample Modified Files: BasicChooserFromSavedBackTestLog.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: BasicChooserFromSavedBackTestLog.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/InSample/BasicChooserFromSavedBackTestLog.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BasicChooserFromSavedBackTestLog.cs 25 Apr 2008 17:17:19 -0000 1.3 --- BasicChooserFromSavedBackTestLog.cs 29 Sep 2008 21:14:23 -0000 1.4 *************** *** 89,93 **** protected abstract TestingPositions[] getTestingPositionsFromBackTestLog( ! EndOfDayDateTime lastInSampleDateOfOptimizedTestingPositions ); private void analyzeInSample_fireEvents() --- 89,93 ---- protected abstract TestingPositions[] getTestingPositionsFromBackTestLog( ! DateTime lastInSampleDateTimeOfOptimizedTestingPositions ); private void analyzeInSample_fireEvents() *************** *** 113,117 **** this.bestTestingPositionsInSample = this.getTestingPositionsFromBackTestLog( ! returnsManager.ReturnIntervals.LastEndOfDayDateTime ); this.analyzeInSample_fireEvents(); return bestTestingPositionsInSample; --- 113,117 ---- this.bestTestingPositionsInSample = this.getTestingPositionsFromBackTestLog( ! returnsManager.ReturnIntervals.LastDateTime ); this.analyzeInSample_fireEvents(); return bestTestingPositionsInSample; |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:14:19
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13426/a2_Accounting/h5_Reporting Modified Files: AccountReport.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: AccountReport.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/AccountReport.cs,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** AccountReport.cs 18 Aug 2008 21:13:14 -0000 1.22 --- AccountReport.cs 29 Sep 2008 21:13:46 -0000 1.23 *************** *** 3,7 **** AccountReport.cs ! Copyright (C) 2003 Glauco Siliprandi --- 3,7 ---- AccountReport.cs ! Copyright (C) 2003 Glauco Siliprandi *************** *** 19,23 **** 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; --- 19,23 ---- 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; *************** *** 36,39 **** --- 36,40 ---- using QuantProject.Business.Timing; using QuantProject.Data.DataProviders; + using QuantProject.Data.DataProviders.Quotes; namespace QuantProject.Business.Financial.Accounting.Reporting *************** *** 45,73 **** public class AccountReport : ISerializable { ! private Account account; ! private IHistoricalQuoteProvider historicalQuoteProvider; ! private Account accountCopy = new Account( "AccountCopy" ); ! private string reportName; ! private EndOfDayDateTime endDateTime; ! private string benchmark; private History benchmarkEquityLine; ! //private long numDaysForInterval; ! private DataTable detailedDataTable; ! private Tables.Transactions transactionTable; ! private ReportTable roundTrades; ! private ReportTable equity; private EquityLine equityLine; ! private Tables.Summary summary; private Tables.StatisticsSummary statisticsSummary; ! public string Name ! { get { return this.reportName; } set { this.reportName = value; } ! } ! public EndOfDayDateTime EndDateTime ! { ! get { return endDateTime; } ! } public string Benchmark { --- 46,76 ---- public class AccountReport : ISerializable { ! private Account account; ! private HistoricalMarketValueProvider historicalMarketValueProvider; ! private IDateTimeSelectorForEquityLine dateTimeSelectorForEquityLine; ! ! private Account accountCopy = new Account( "AccountCopy" ); ! private string reportName; ! private DateTime endDateTime; ! private string benchmark; private History benchmarkEquityLine; ! //private long numDaysForInterval; ! private DataTable detailedDataTable; ! private Tables.Transactions transactionTable; ! private ReportTable roundTrades; ! private ReportTable equity; private EquityLine equityLine; ! private Tables.Summary summary; private Tables.StatisticsSummary statisticsSummary; ! public string Name ! { get { return this.reportName; } set { this.reportName = value; } ! } ! public DateTime EndDateTime ! { ! get { return this.endDateTime; } ! } public string Benchmark { *************** *** 83,101 **** } // public long NumDaysForInterval ! // { ! // get { return numDaysForInterval; } ! // } ! public DataTable DetailedDataTable ! { ! get { return detailedDataTable; } ! } ! public ReportTable TransactionTable ! { ! get { return transactionTable; } ! } ! public ReportTable RoundTrades ! { ! get { return roundTrades; } ! } public ReportTable Equity { --- 86,104 ---- } // public long NumDaysForInterval ! // { ! // get { return numDaysForInterval; } ! // } ! public DataTable DetailedDataTable ! { ! get { return detailedDataTable; } ! } ! public ReportTable TransactionTable ! { ! get { return transactionTable; } ! } ! public ReportTable RoundTrades ! { ! get { return roundTrades; } ! } public ReportTable Equity { *************** *** 111,116 **** this.equityLine = new EquityLine(); this.equityLine.Import( this.Equity.DataTable , ! QuantProject.Business.Financial.Accounting.Reporting.Tables.Equity.Date , ! QuantProject.Business.Financial.Accounting.Reporting.Tables.Equity.AccountValue ); } return this.equityLine; --- 114,119 ---- this.equityLine = new EquityLine(); this.equityLine.Import( this.Equity.DataTable , ! QuantProject.Business.Financial.Accounting.Reporting.Tables.Equity.Date , ! QuantProject.Business.Financial.Accounting.Reporting.Tables.Equity.AccountValue ); } return this.equityLine; *************** *** 118,135 **** } public Tables.Summary Summary ! { ! get { return summary; } ! } public Tables.StatisticsSummary StatisticsSummary { get { return this.statisticsSummary; } } ! public DateTime StartDateTime ! { ! get ! { ! return (DateTime) account.Transactions.GetKey( 0 ); ! } ! } /// <summary> --- 121,138 ---- } public Tables.Summary Summary ! { ! get { return summary; } ! } public Tables.StatisticsSummary StatisticsSummary { get { return this.statisticsSummary; } } ! public DateTime StartDateTime ! { ! get ! { ! return (DateTime) account.Transactions.GetKey( 0 ); ! } ! } /// <summary> *************** *** 140,179 **** get { return this.reportName; } } - /// <summary> - /// Add the last account record to the AccountReport - /// </summary> - /// <param name="account"></param> - public AccountReport( Account account , - IHistoricalQuoteProvider historicalQuoteProvider ) - { - this.account = account; - this.historicalQuoteProvider = historicalQuoteProvider; - } ! #region "Create" ! #region "getDetailedDataTable" ! private void setColumns( System.Data.DataTable transactions ) ! { ! transactions.Columns.Add( "DateTime" , Type.GetType( "System.DateTime" ) ); ! transactions.Columns.Add( "BarComponent" , Type.GetType( "System.String" ) ); ! transactions.Columns.Add( "TransactionType" , Type.GetType( "System.String" ) ); ! transactions.Columns.Add( "InstrumentKey" , Type.GetType( "System.String" ) ); ! transactions.Columns.Add( "Quantity" , Type.GetType( "System.Int32" ) ); ! transactions.Columns.Add( "Price" , Type.GetType( "System.Double" ) ); ! transactions.Columns.Add( "TransactionAmount" , Type.GetType( "System.Double" ) ); ! transactions.Columns.Add( "Commission" , Type.GetType( "System.Double" ) ); ! transactions.Columns.Add( "AccountCash" , Type.GetType( "System.Double" ) ); ! transactions.Columns.Add( "PortfolioValue" , Type.GetType( "System.Double" ) ); ! transactions.Columns.Add( "AccountValue" , Type.GetType( "System.Double" ) ); ! transactions.Columns.Add( "PnL" , Type.GetType( "System.Double" ) ); ! } ! #region "setRows" ! private void addBalanceItems ( EndOfDayDateTime endOfDayDateTime , DataRow dataRow ) ! { dataRow[ "AccountCash" ] = this.accountCopy.CashAmount; dataRow[ "PortfolioValue" ] = this.accountCopy.Portfolio.GetMarketValue( ! endOfDayDateTime , this.historicalQuoteProvider ); dataRow[ "AccountValue" ] = (double)dataRow[ "AccountCash" ] + --- 143,194 ---- get { return this.reportName; } } ! /// <summary> ! /// Creates report data for the given account ! /// </summary> ! /// <param name="account"></param> ! /// <param name="historicalMarketValueProvider">used to evaluate ! /// the market value for the given instruments at the given ! /// time</param> ! /// <param name="timerForEquityLine">used to decide the points ! /// in time when the equity line will be computed</param> ! public AccountReport( ! Account account , ! HistoricalMarketValueProvider historicalMarketValueProvider , ! IDateTimeSelectorForEquityLine dateTimeSelectorForEquityLine ) ! { ! this.account = account; ! this.historicalMarketValueProvider = historicalMarketValueProvider; ! this.dateTimeSelectorForEquityLine = dateTimeSelectorForEquityLine; ! } ! #region Create ! ! #region setDetailedDataTable ! ! #region getDetailedDataTable ! private void setColumns() ! { ! this.detailedDataTable.Columns.Add( "DateTime" , Type.GetType( "System.DateTime" ) ); ! // transactions.Columns.Add( "BarComponent" , Type.GetType( "System.String" ) ); ! this.detailedDataTable.Columns.Add( "TransactionType" , Type.GetType( "System.String" ) ); ! this.detailedDataTable.Columns.Add( "InstrumentKey" , Type.GetType( "System.String" ) ); ! this.detailedDataTable.Columns.Add( "Quantity" , Type.GetType( "System.Int32" ) ); ! this.detailedDataTable.Columns.Add( "Price" , Type.GetType( "System.Double" ) ); ! this.detailedDataTable.Columns.Add( "TransactionAmount" , Type.GetType( "System.Double" ) ); ! this.detailedDataTable.Columns.Add( "Commission" , Type.GetType( "System.Double" ) ); ! this.detailedDataTable.Columns.Add( "AccountCash" , Type.GetType( "System.Double" ) ); ! this.detailedDataTable.Columns.Add( "PortfolioValue" , Type.GetType( "System.Double" ) ); ! this.detailedDataTable.Columns.Add( "AccountValue" , Type.GetType( "System.Double" ) ); ! this.detailedDataTable.Columns.Add( "PnL" , Type.GetType( "System.Double" ) ); ! } ! ! #region setRows ! private void addBalanceItems ( DateTime dateTime , DataRow dataRow ) ! { dataRow[ "AccountCash" ] = this.accountCopy.CashAmount; dataRow[ "PortfolioValue" ] = this.accountCopy.Portfolio.GetMarketValue( ! dateTime , this.historicalMarketValueProvider ); dataRow[ "AccountValue" ] = (double)dataRow[ "AccountCash" ] + *************** *** 183,268 **** this.accountCopy.Transactions.TotalAddedCash; } ! private void addTransactionRow( EndOfDayTransaction transaction , ! System.Data.DataTable detailedDataTable ) ! { ! DataRow dataRow = detailedDataTable.NewRow(); ! dataRow[ "DateTime" ] = transaction.EndOfDayDateTime.DateTime; ! dataRow[ "BarComponent" ] = transaction.EndOfDayDateTime.EndOfDaySpecificTime.ToString(); ! dataRow[ "TransactionType" ] = transaction.Type.ToString(); ! if ( transaction.Instrument != null ) ! dataRow[ "InstrumentKey" ] = transaction.Instrument.Key; ! else ! dataRow[ "InstrumentKey" ] = ""; ! dataRow[ "Quantity" ] = transaction.Quantity; ! dataRow[ "Price" ] = transaction.InstrumentPrice; dataRow[ "TransactionAmount" ] = transaction.InstrumentPrice * transaction.Quantity; if ( transaction.Commission != null ) dataRow[ "Commission" ] = transaction.Commission.Value; ! addBalanceItems( transaction.EndOfDayDateTime , dataRow ); ! detailedDataTable.Rows.Add( dataRow ); ! } ! private void addRowsForTransactions( DateTime currentDateTime , ! System.Data.DataTable detailedDataTable ) ! { ! if ( this.account.Transactions.ContainsKey( currentDateTime ) ) ! foreach ( EndOfDayTransaction transaction in ! (ArrayList)this.account.Transactions[ currentDateTime ] ) ! { ! this.accountCopy.Add( transaction ); ! addTransactionRow( transaction , detailedDataTable ); ! } ! } ! private void addRowForPnl_actually( DateTime currentDate , ! System.Data.DataTable detailedDataTable ) ! { ! DataRow dataRow = detailedDataTable.NewRow(); ! dataRow[ "DateTime" ] = currentDate; ! addBalanceItems( new EndOfDayDateTime( currentDate , EndOfDaySpecificTime.MarketClose ) , dataRow ); ! detailedDataTable.Rows.Add( dataRow ); ! } ! private void addRowForPnl( long numDaysForInterval , DateTime currentDate , ! System.Data.DataTable detailedDataTable ) ! { ! if ( ( Convert.ToInt32(((TimeSpan)(currentDate.Date - ! (DateTime) account.Transactions.GetKey( 0 ))).TotalDays ) ! % numDaysForInterval ) == 0 ) ! addRowForPnl_actually( currentDate , detailedDataTable ); ! } ! private void setRows( long numDaysForInterval , System.Data.DataTable detailedDataTable ) ! { ! DateTime currentDate = (DateTime) account.Transactions.GetKey( 0 ); ! try ! { ! while ( currentDate < this.endDateTime.DateTime ) ! { ! //addTransactionsToAccountCopy( currentDate ); ! addRowsForTransactions( currentDate , detailedDataTable ); ! addRowForPnl( numDaysForInterval , currentDate , detailedDataTable ); ! currentDate = currentDate.AddDays( 1 ); ! } ! // foreach ( ArrayList transactionList in account.Transactions.Values ) ! // foreach ( TimedTransaction transaction in transactionList ) ! // addRow( transaction , transactions ); ! } ! catch (Exception ex) ! { ! MessageBox.Show( ex.ToString() ); ! } ! } ! #endregion ! private System.Data.DataTable getDetailedDataTable( long numDaysForInterval ) ! { ! System.Data.DataTable detailedDataTable = new System.Data.DataTable(); ! setColumns( detailedDataTable ); ! setRows( numDaysForInterval , detailedDataTable ); ! return detailedDataTable; ! } ! #endregion ! #endregion ! #region Create private void setBenchmarkEquityLine() { ! History benchmarkQuotes = HistoricalDataProvider.GetAdjustedCloseHistory( this.benchmark , (DateTime)this.EquityLine.GetKey( 0 ) , (DateTime)this.EquityLine.GetKey( this.EquityLine.Count - 1 ) ); --- 198,346 ---- this.accountCopy.Transactions.TotalAddedCash; } ! ! #region setRows_addRowsForTransactionsBefore_nextDateTimeForEquityLine ! private bool isNextTransactionToBeAdded( ! int indexForTheNextTransactionToBeAdded , ! DateTime nextDateTimeForEquityLine ) ! { ! bool isToBeAdded = false; ! if ( indexForTheNextTransactionToBeAdded < ! this.account.Transactions.Count ) ! // not all transactions have been added, yet ! { ! DateTime dateTimeForTheNextTransactionToBeAdded = ! (DateTime)this.account.Transactions.GetKey( ! indexForTheNextTransactionToBeAdded ); ! isToBeAdded = ( dateTimeForTheNextTransactionToBeAdded <= ! nextDateTimeForEquityLine ); ! } ! return isToBeAdded; ! } ! ! #region addRowsForTransactionsAtTheGivenDateTime ! private void addTransactionRow( TimedTransaction transaction ) ! { ! DataRow dataRow = detailedDataTable.NewRow(); ! dataRow[ "DateTime" ] = transaction.DateTime; ! // dataRow[ "BarComponent" ] = transaction.EndOfDayDateTime.EndOfDaySpecificTime.ToString(); ! dataRow[ "TransactionType" ] = transaction.Type.ToString(); ! if ( transaction.Instrument != null ) ! dataRow[ "InstrumentKey" ] = transaction.Instrument.Key; ! else ! dataRow[ "InstrumentKey" ] = ""; ! dataRow[ "Quantity" ] = transaction.Quantity; ! dataRow[ "Price" ] = transaction.InstrumentPrice; dataRow[ "TransactionAmount" ] = transaction.InstrumentPrice * transaction.Quantity; if ( transaction.Commission != null ) dataRow[ "Commission" ] = transaction.Commission.Value; ! addBalanceItems( transaction.DateTime , dataRow ); ! this.detailedDataTable.Rows.Add( dataRow ); ! } ! private void addRowsForTransactionsAtTheGivenDateTime( ! DateTime dateTimeForTheNextTransactionToBeAdded ) ! { ! foreach ( TimedTransaction timedTransaction in ! (ArrayList)this.account.Transactions[ ! dateTimeForTheNextTransactionToBeAdded ] ) ! { ! this.accountCopy.Add( timedTransaction ); ! addTransactionRow( timedTransaction ); ! } ! } ! #endregion addRowsForTransactionsAtTheGivenDateTime ! ! private int setRows_addRowsForTransactionsTill_nextDateTimeForEquityLine( ! int indexForTheNextTransactionToBeAdded , ! DateTime nextDateTimeForEquityLine ) ! { ! // DateTime dateTimeForTheNextTransactionToBeAdded = ! // (DateTime)this.account.Transactions.GetKey( ! // indexForTheNextTransactionToBeAdded ); ! while ( this.isNextTransactionToBeAdded( ! indexForTheNextTransactionToBeAdded , nextDateTimeForEquityLine ) ) ! { ! DateTime dateTimeForTheNextTransactionToBeAdded = ! (DateTime)this.account.Transactions.GetKey( ! indexForTheNextTransactionToBeAdded ); ! this.addRowsForTransactionsAtTheGivenDateTime( ! dateTimeForTheNextTransactionToBeAdded ); ! indexForTheNextTransactionToBeAdded++; ! } ! return indexForTheNextTransactionToBeAdded; ! } ! #endregion setRows_addRowsForTransactionsBefore_nextDateTimeForEquityLine ! ! private void addRowForPnl_actually( DateTime nextDateTimeForEquityLine ) ! { ! DataRow dataRow = detailedDataTable.NewRow(); ! dataRow[ "DateTime" ] = nextDateTimeForEquityLine; ! this.addBalanceItems( nextDateTimeForEquityLine , dataRow ); ! // addBalanceItems( new EndOfDayDateTime( currentDate , EndOfDaySpecificTime.MarketClose ) , dataRow ); ! this.detailedDataTable.Rows.Add( dataRow ); ! } ! private void addRowForPnl( DateTime nextDateTimeForEquityLine ) ! { ! // if ( ( Convert.ToInt32(((TimeSpan)(currentDate.Date - ! // (DateTime) account.Transactions.GetKey( 0 ))).TotalDays ) ! // % numDaysForInterval ) == 0 ) ! addRowForPnl_actually( nextDateTimeForEquityLine ); ! } ! private void setRows() ! { ! int indexForTheNextTransactionToBeAdded = 0; ! DateTime nextDateTimeForEquityLine = ! this.dateTimeSelectorForEquityLine.GetNextDateTime(); ! while ( nextDateTimeForEquityLine <= this.endDateTime ) ! { ! indexForTheNextTransactionToBeAdded = ! this.setRows_addRowsForTransactionsTill_nextDateTimeForEquityLine( ! indexForTheNextTransactionToBeAdded , ! nextDateTimeForEquityLine ); ! this.addRowForPnl( nextDateTimeForEquityLine ); ! nextDateTimeForEquityLine = ! this.dateTimeSelectorForEquityLine.GetNextDateTime(); ! } ! ! // DateTime currentDateTime = (DateTime) account.Transactions.GetKey( 0 ); ! // try ! // { ! // while ( currentDateTime < this.endDateTime ) ! // { ! // //addTransactionsToAccountCopy( currentDate ); ! // addRowsForTransactions( currentDateTime , detailedDataTable ); ! // addRowForPnl( numDaysForInterval , currentDateTime , detailedDataTable ); ! // currentDateTime = this.getNextDateTimeForDetailedDataTable( ! // currentDateTime ); ! //// currentDateTime = currentDate.AddDays( 1 ); ! // } ! // } ! // catch (Exception ex) ! // { ! // MessageBox.Show( ex.ToString() ); ! // } ! } ! #endregion setRows ! ! private void setDetailedDataTable_actually() ! { ! this.detailedDataTable = new System.Data.DataTable(); ! this.setColumns(); ! this.setRows(); ! // return detailedDataTable; ! } ! #endregion getDetailedDataTable ! private void setDetailedDataTable( long numDaysForInterval ) ! { ! if ( this.detailedDataTable == null ) ! // the detailedDataTable has not been computed yet ! this.setDetailedDataTable_actually(); ! } ! #endregion setDetailedDataTable ! ! private void setBenchmarkEquityLine() { ! History benchmarkQuotes = HistoricalQuotesProvider.GetAdjustedCloseHistory( this.benchmark , (DateTime)this.EquityLine.GetKey( 0 ) , (DateTime)this.EquityLine.GetKey( this.EquityLine.Count - 1 ) ); *************** *** 270,280 **** this.benchmarkEquityLine.Interpolate( this.EquityLine.Keys , new PreviousInterpolator() ); } ! private void setDetailedDataTable( long numDaysForInterval ) { ! if ( this.detailedDataTable == null ) ! // the detailedDataTable has not been computed yet ! this.detailedDataTable = ! this.getDetailedDataTable( numDaysForInterval ); } /// <summary> /// Creates the equity line in a faster way than if it is created --- 348,374 ---- this.benchmarkEquityLine.Interpolate( this.EquityLine.Keys , new PreviousInterpolator() ); } ! ! public AccountReport Create( ! string reportName , long numDaysForInterval , ! DateTime endDateTime , string benchmark ) { ! this.reportName = reportName; ! this.endDateTime = endDateTime; ! this.benchmark = benchmark; ! this.setDetailedDataTable( numDaysForInterval ); ! this.transactionTable = new Tables.Transactions( reportName , detailedDataTable ); ! // this.transactionTable = getTransactionTable( reportName , detailedDataTable ); ! this.roundTrades = new Tables.RoundTrades( reportName , this.transactionTable ); ! this.equity = new Tables.Equity( reportName , detailedDataTable ); ! if ( benchmark != "" ) ! this.setBenchmarkEquityLine(); ! //this.equity = getEquity( reportName , detailedDataTable ); ! //this.summary = getSummary( reportName ); ! this.summary = new Tables.Summary( this , historicalMarketValueProvider ); ! this.statisticsSummary = new Tables.StatisticsSummary( this, historicalMarketValueProvider ); ! return this; } + #endregion Create + /// <summary> /// Creates the equity line in a faster way than if it is created *************** *** 284,289 **** /// <param name="endDateTime"></param> /// <returns></returns> ! public void SetEquityLine( long numDaysForInterval , ! EndOfDayDateTime endDateTime ) { this.endDateTime = endDateTime; --- 378,383 ---- /// <param name="endDateTime"></param> /// <returns></returns> ! public void SetEquityLine( ! long numDaysForInterval , DateTime endDateTime ) { this.endDateTime = endDateTime; *************** *** 291,315 **** this.equity = new Tables.Equity( reportName , detailedDataTable ); } ! public AccountReport Create( string reportName , long numDaysForInterval , ! EndOfDayDateTime endDateTime , string benchmark ) ! { ! this.reportName = reportName; ! this.endDateTime = endDateTime; ! this.benchmark = benchmark; ! this.setDetailedDataTable( numDaysForInterval ); ! this.transactionTable = new Tables.Transactions( reportName , detailedDataTable ); ! // this.transactionTable = getTransactionTable( reportName , detailedDataTable ); ! this.roundTrades = new Tables.RoundTrades( reportName , this.transactionTable ); ! this.equity = new Tables.Equity( reportName , detailedDataTable ); ! if ( benchmark != "" ) ! this.setBenchmarkEquityLine(); ! //this.equity = getEquity( reportName , detailedDataTable ); ! //this.summary = getSummary( reportName ); ! this.summary = new Tables.Summary( this , historicalQuoteProvider ); ! this.statisticsSummary = new Tables.StatisticsSummary( this, historicalQuoteProvider ); ! return this; ! } ! #endregion ! #region Serialization --- 385,389 ---- this.equity = new Tables.Equity( reportName , detailedDataTable ); } ! #region Serialization *************** *** 321,325 **** /// <param name="context"></param> protected AccountReport( SerializationInfo info , StreamingContext context ) : ! base( ) { // get the set of serializable members for this class and its base classes --- 395,399 ---- /// <param name="context"></param> protected AccountReport( SerializationInfo info , StreamingContext context ) : ! base( ) { // get the set of serializable members for this class and its base classes *************** *** 329,333 **** // deserialize the fields from the info object ! for (Int32 i = 0 ; i < mi.Length; i++) { FieldInfo fieldInfo = (FieldInfo) mi[i]; --- 403,407 ---- // deserialize the fields from the info object ! for (Int32 i = 0 ; i < mi.Length; i++) { FieldInfo fieldInfo = (FieldInfo) mi[i]; *************** *** 347,359 **** void ISerializable.GetObjectData( ! SerializationInfo info, StreamingContext context) { // get the set of serializable members for this class and base classes Type thisType = this.GetType(); ! MemberInfo[] mi = FormatterServices.GetSerializableMembers( thisType , context); // serialize the fields to the info object ! for (Int32 i = 0 ; i < mi.Length; i++) { info.AddValue(mi[i].Name, ((FieldInfo) mi[i]).GetValue(this)); --- 421,433 ---- void ISerializable.GetObjectData( ! SerializationInfo info, StreamingContext context) { // get the set of serializable members for this class and base classes Type thisType = this.GetType(); ! MemberInfo[] mi = FormatterServices.GetSerializableMembers( thisType , context); // serialize the fields to the info object ! for (Int32 i = 0 ; i < mi.Length; i++) { info.AddValue(mi[i].Name, ((FieldInfo) mi[i]).GetValue(this)); *************** *** 362,370 **** #endregion ! public AccountReport Create( string reportName , long numDaysForInterval , ! EndOfDayDateTime endDateTime ) ! { ! return Create( reportName , numDaysForInterval , endDateTime , "" ); ! } } } --- 436,444 ---- #endregion ! public AccountReport Create( ! string reportName , long numDaysForInterval , DateTime endDateTime ) ! { ! return this.Create( reportName , numDaysForInterval , endDateTime , "" ); ! } } } |
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/StatisticsSummaryRows In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13426/a2_Accounting/h5_Reporting/StatisticsSummaryRows Modified Files: AverageReturnOnDayOfWeekWithOpenPositions.cs AverageReturnOnDayWithOpenPositions.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: AverageReturnOnDayOfWeekWithOpenPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/StatisticsSummaryRows/AverageReturnOnDayOfWeekWithOpenPositions.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AverageReturnOnDayOfWeekWithOpenPositions.cs 18 Aug 2008 21:13:16 -0000 1.3 --- AverageReturnOnDayOfWeekWithOpenPositions.cs 29 Sep 2008 21:13:46 -0000 1.4 *************** *** 28,31 **** --- 28,32 ---- using QuantProject.Business.Financial.Accounting.Reporting.Tables; using QuantProject.Business.Financial.Accounting.Reporting.SummaryRows; + using QuantProject.Business.Timing; namespace QuantProject.Business.Financial.Accounting.Reporting.StatisticsSummaryRows *************** *** 41,48 **** private double getReturnForDate(DateTime date, DateTime previousDate) { double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(date); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(previousDate); return (accountValueOnCloseForDate / accountValueOnCloseForPreviousDate) - 1.0; --- 42,54 ---- private double getReturnForDate(DateTime date, DateTime previousDate) { + // TODO: this method works only if the equity line is computed + // at market close; an exception is thrown otherwise; change the + // logic to be more general double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( date ) ); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( previousDate ) ); return (accountValueOnCloseForDate / accountValueOnCloseForPreviousDate) - 1.0; *************** *** 51,58 **** private bool hasPositionsOnDate( DateTime date, DateTime previousDate ) { double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(date); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(previousDate); return accountValueOnCloseForDate != accountValueOnCloseForPreviousDate; --- 57,69 ---- private bool hasPositionsOnDate( DateTime date, DateTime previousDate ) { + // TODO: this method works only if the equity line is computed + // at market close; an exception is thrown otherwise; change the + // logic to be more general double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( date ) ); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( previousDate ) ); return accountValueOnCloseForDate != accountValueOnCloseForPreviousDate; *************** *** 80,87 **** this.rowDescription = this.getRowDescription(); DayOfWeek specificDayOfWeek = this.getSpecificDayOfWeek(); ! History marketDays = Quotes.GetMarketDays( ! statisticsSummary.AccountReport.Benchmark, ! statisticsSummary.AccountReport.StartDateTime, ! statisticsSummary.AccountReport.EndDateTime.DateTime); DateTime date; DateTime previousDate; --- 91,100 ---- this.rowDescription = this.getRowDescription(); DayOfWeek specificDayOfWeek = this.getSpecificDayOfWeek(); ! // History marketDays = Quotes.GetMarketDays( ! // statisticsSummary.AccountReport.Benchmark, ! // statisticsSummary.AccountReport.StartDateTime, ! // statisticsSummary.AccountReport.EndDateTime); ! History marketDays = ! this.statisticsSummary.AccountReport.EquityLine; DateTime date; DateTime previousDate; Index: AverageReturnOnDayWithOpenPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/StatisticsSummaryRows/AverageReturnOnDayWithOpenPositions.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AverageReturnOnDayWithOpenPositions.cs 25 Apr 2008 17:11:41 -0000 1.1 --- AverageReturnOnDayWithOpenPositions.cs 29 Sep 2008 21:13:46 -0000 1.2 *************** *** 30,33 **** --- 30,34 ---- using QuantProject.Business.Financial.Accounting.Reporting.Tables; using QuantProject.Business.Financial.Accounting.Reporting.SummaryRows; + using QuantProject.Business.Timing; namespace QuantProject.Business.Financial.Accounting.Reporting.StatisticsSummaryRows *************** *** 56,63 **** private double getReturnForDate(DateTime date, DateTime previousDate) { double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(date); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(previousDate); return (accountValueOnCloseForDate / accountValueOnCloseForPreviousDate) - 1.0; --- 57,70 ---- private double getReturnForDate(DateTime date, DateTime previousDate) { + // TODO: this method works only if the equity line is computed + // at market close; an exception is thrown otherwise; change the + // logic to be more general; furthermore, this code is duplicated + // and common to AverageReturnOnDayOfWeekWithOpenPositions.cs double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( date ) ); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( previousDate ) ); return (accountValueOnCloseForDate / accountValueOnCloseForPreviousDate) - 1.0; *************** *** 66,73 **** private bool hasPositionsOnDate( DateTime date, DateTime previousDate ) { double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(date); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(previousDate); return accountValueOnCloseForDate != accountValueOnCloseForPreviousDate; --- 73,87 ---- private bool hasPositionsOnDate( DateTime date, DateTime previousDate ) { + // TODO: this method works only if the equity line is computed + // at market close; an exception is thrown otherwise; change the + // logic to be more general; furthermore, this code is duplicated + // and common to AverageReturnOnDayOfWeekWithOpenPositions.cs double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( date ) ); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( ! previousDate ) ); return accountValueOnCloseForDate != accountValueOnCloseForPreviousDate; *************** *** 79,86 **** this.statisticsSummary = statisticsSummary; this.rowDescription = "Average % return on days with open positions "; ! History marketDays = Quotes.GetMarketDays( ! statisticsSummary.AccountReport.Benchmark, ! statisticsSummary.AccountReport.StartDateTime, ! statisticsSummary.AccountReport.EndDateTime.DateTime); DateTime date; DateTime previousDate; --- 93,102 ---- this.statisticsSummary = statisticsSummary; this.rowDescription = "Average % return on days with open positions "; ! // History marketDays = Quotes.GetMarketDays( ! // statisticsSummary.AccountReport.Benchmark, ! // statisticsSummary.AccountReport.StartDateTime, ! // statisticsSummary.AccountReport.EndDateTime); ! History marketDays = ! this.statisticsSummary.AccountReport.EquityLine; DateTime date; DateTime previousDate; |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:14:08
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13426/a2_Accounting/h5_Reporting/Tables Modified Files: StatisticsSummary.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: StatisticsSummary.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables/StatisticsSummary.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StatisticsSummary.cs 18 Aug 2008 21:13:20 -0000 1.3 --- StatisticsSummary.cs 29 Sep 2008 21:13:47 -0000 1.4 *************** *** 19,23 **** { private AccountReport accountReport; ! private IHistoricalQuoteProvider historicalQuoteProvider; private AverageReturnOnMondayWithOpenPositions averageReturnOnMondayWithOpenPositions; --- 19,23 ---- { private AccountReport accountReport; ! private HistoricalMarketValueProvider historicalMarketValueProvider; private AverageReturnOnMondayWithOpenPositions averageReturnOnMondayWithOpenPositions; *************** *** 75,82 **** } public StatisticsSummary( AccountReport accountReport , ! IHistoricalQuoteProvider historicalDataProvider ) : base( accountReport.Name + " - StatisticsSummary" ) { ! this.historicalQuoteProvider = historicalDataProvider; this.statisticsSummary( accountReport ); } --- 75,82 ---- } public StatisticsSummary( AccountReport accountReport , ! HistoricalMarketValueProvider historicalMarketValueProvider ) : base( accountReport.Name + " - StatisticsSummary" ) { ! this.historicalMarketValueProvider = historicalMarketValueProvider; this.statisticsSummary( accountReport ); } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:14:07
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/AccountProviding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13426/a2_Accounting/AccountProviding Modified Files: SimpleAccountProvider.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: SimpleAccountProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/AccountProviding/SimpleAccountProvider.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SimpleAccountProvider.cs 12 Mar 2008 21:54:42 -0000 1.1 --- SimpleAccountProvider.cs 29 Sep 2008 21:13:46 -0000 1.2 *************** *** 3,7 **** SimpleAccountProvider.cs ! Copyright (C) 2008 Marco Milletti --- 3,7 ---- SimpleAccountProvider.cs ! Copyright (C) 2008 Marco Milletti *************** *** 19,23 **** 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; --- 19,23 ---- 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; *************** *** 35,38 **** --- 35,39 ---- /// on orders /// </summary> + [Serializable] public class SimpleAccountProvider : IAccountProvider { *************** *** 41,53 **** } ! public Account GetAccount( IEndOfDayTimer timer , ! IHistoricalQuoteProvider historicalQuoteProvider ) { ! Account account = ! new Account( "SimpleAccount" , timer , ! new HistoricalEndOfDayDataStreamer( timer , ! historicalQuoteProvider ) , ! new HistoricalEndOfDayOrderExecutor( timer , ! historicalQuoteProvider ) ); return account; } --- 42,55 ---- } ! public Account GetAccount( ! Timer timer , HistoricalMarketValueProvider historicalMarketValueProvider ) { ! Account account = ! new Account( ! "SimpleAccount" , timer , ! new HistoricalEndOfDayDataStreamer( ! timer , historicalMarketValueProvider ) , ! new HistoricalEndOfDayOrderExecutor( ! timer , historicalMarketValueProvider ) ); return account; } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:14:03
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13426/a2_Accounting/h5_Reporting/SummaryRows Modified Files: AverageNumberOfTransactionsPerDay.cs BenchmarkPercentageReturn.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: BenchmarkPercentageReturn.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/BenchmarkPercentageReturn.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BenchmarkPercentageReturn.cs 19 Jun 2005 14:55:09 -0000 1.2 --- BenchmarkPercentageReturn.cs 29 Sep 2008 21:13:46 -0000 1.3 *************** *** 13,37 **** /// </summary> [Serializable] ! public class BenchmarkPercentageReturn : PercentageSummaryRow { public BenchmarkPercentageReturn( Summary summary , ! IHistoricalQuoteProvider historicalQuoteProvider ) { ! if ( summary.AccountReport.Benchmark != "" ) ! { ! // the report has to compare to a buy and hold benchmark ! double beginningMarketValue = historicalQuoteProvider.GetMarketValue( summary.AccountReport.Benchmark , ! new EndOfDayDateTime( summary.AccountReport.StartDateTime , EndOfDaySpecificTime.MarketOpen ) ); ! double finalMarketValue = historicalQuoteProvider.GetMarketValue( summary.AccountReport.Benchmark , ! summary.AccountReport.EndDateTime ); // summary.BenchmarkPercentageReturn = ( finalMarketValue - beginningMarketValue ) / // beginningMarketValue * 100; ! this.rowDescription = "Buy & hold % return"; this.rowValue = ( finalMarketValue - beginningMarketValue ) / beginningMarketValue * 100; ! } ! } } } --- 13,40 ---- /// </summary> [Serializable] ! public class BenchmarkPercentageReturn : PercentageSummaryRow { public BenchmarkPercentageReturn( Summary summary , ! HistoricalMarketValueProvider historicalMarketValueProvider ) { ! if ( summary.AccountReport.Benchmark != "" ) ! { ! // the report has to compare to a buy and hold benchmark ! double beginningMarketValue = historicalMarketValueProvider.GetMarketValue( summary.AccountReport.Benchmark , ! HistoricalEndOfDayTimer.GetMarketOpen( ! summary.AccountReport.StartDateTime ) ); ! // new EndOfDayDateTime( summary.AccountReport.StartDateTime , EndOfDaySpecificTime.MarketOpen ) ); ! double finalMarketValue = historicalMarketValueProvider.GetMarketValue( summary.AccountReport.Benchmark , ! HistoricalEndOfDayTimer.GetMarketClose( ! summary.AccountReport.EndDateTime ) ); // summary.BenchmarkPercentageReturn = ( finalMarketValue - beginningMarketValue ) / // beginningMarketValue * 100; ! this.rowDescription = "Buy & hold % return"; this.rowValue = ( finalMarketValue - beginningMarketValue ) / beginningMarketValue * 100; ! } ! } } } Index: AverageNumberOfTransactionsPerDay.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/AverageNumberOfTransactionsPerDay.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AverageNumberOfTransactionsPerDay.cs 7 Dec 2007 19:08:37 -0000 1.3 --- AverageNumberOfTransactionsPerDay.cs 29 Sep 2008 21:13:46 -0000 1.4 *************** *** 47,51 **** summary.AccountReport.Benchmark, summary.AccountReport.StartDateTime, ! summary.AccountReport.EndDateTime.DateTime); this.rowValue = (double)totalNumberOfTransactions / (double)marketDays.Count; } --- 47,51 ---- summary.AccountReport.Benchmark, summary.AccountReport.StartDateTime, ! summary.AccountReport.EndDateTime); this.rowValue = (double)totalNumberOfTransactions / (double)marketDays.Count; } |
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:13:34
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/AccountProviding In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13218/a2_Accounting/AccountProviding Modified Files: IAccountProvider.cs InteractiveBrokerAccountProvider.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: InteractiveBrokerAccountProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/AccountProviding/InteractiveBrokerAccountProvider.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** InteractiveBrokerAccountProvider.cs 8 Apr 2008 21:49:14 -0000 1.2 --- InteractiveBrokerAccountProvider.cs 29 Sep 2008 21:13:10 -0000 1.3 *************** *** 3,7 **** InteractiveBrokerAccountProvider.cs ! Copyright (C) 2008 Marco Milletti --- 3,7 ---- InteractiveBrokerAccountProvider.cs ! Copyright (C) 2008 Marco Milletti *************** *** 19,23 **** 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; --- 19,23 ---- 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; *************** *** 37,42 **** /// with Interactive Broker for individual traders, /// where commissions are managed and slippage can be simulated ! /// through a fixed percentage amount (on stock-price) ! /// lost at each stock-transaction /// </summary> public class InteractiveBrokerAccountProvider : IAccountProvider --- 37,42 ---- /// with Interactive Broker for individual traders, /// where commissions are managed and slippage can be simulated ! /// through a fixed percentage amount (on stock-price) ! /// lost at each stock-transaction /// </summary> public class InteractiveBrokerAccountProvider : IAccountProvider *************** *** 52,56 **** { if( slippageFixedPercentage < 0.0 || ! slippageFixedPercentage > 100.0 ) throw new OutOfRangeException("slippageFixedPercentage", 0.0, 100.0); --- 52,56 ---- { if( slippageFixedPercentage < 0.0 || ! slippageFixedPercentage > 100.0 ) throw new OutOfRangeException("slippageFixedPercentage", 0.0, 100.0); *************** *** 58,63 **** } ! private ISlippageManager getAccount_getSlippageManager(IEndOfDayTimer timer , ! IHistoricalQuoteProvider historicalQuoteProvider) { ISlippageManager slippageManager; --- 58,63 ---- } ! private ISlippageManager getAccount_getSlippageManager( ! Timer timer , HistoricalMarketValueProvider historicalMarketValueProvider) { ISlippageManager slippageManager; *************** *** 65,86 **** slippageManager = new ZeroSlippageManager(); else//this.slippageFixedPercentage > 0.0 ! slippageManager = new FixedPercentageSlippageManager( ! historicalQuoteProvider , timer , ! this.slippageFixedPercentage ); return slippageManager; } ! public Account GetAccount( IEndOfDayTimer timer , ! IHistoricalQuoteProvider historicalQuoteProvider ) { ! Account account = ! new Account( "IBAccount" , timer , ! new HistoricalEndOfDayDataStreamer( timer , ! historicalQuoteProvider ) , ! new HistoricalEndOfDayOrderExecutor( timer , ! historicalQuoteProvider , ! this.getAccount_getSlippageManager( ! timer , historicalQuoteProvider ) ), ! new IBCommissionManager() ); return account; } --- 65,87 ---- slippageManager = new ZeroSlippageManager(); else//this.slippageFixedPercentage > 0.0 ! slippageManager = new FixedPercentageSlippageManager( ! historicalMarketValueProvider , timer , ! this.slippageFixedPercentage ); return slippageManager; } ! public Account GetAccount( ! Timer timer , HistoricalMarketValueProvider historicalMarketValueProvider ) { ! Account account = ! new Account( ! "IBAccount" , timer , ! new HistoricalEndOfDayDataStreamer( ! timer , historicalMarketValueProvider ) , ! new HistoricalEndOfDayOrderExecutor( ! timer , historicalMarketValueProvider , ! this.getAccount_getSlippageManager( ! timer , historicalMarketValueProvider ) ), ! new IBCommissionManager() ); return account; } Index: IAccountProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/AccountProviding/IAccountProvider.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IAccountProvider.cs 12 Mar 2008 21:54:41 -0000 1.1 --- IAccountProvider.cs 29 Sep 2008 21:13:10 -0000 1.2 *************** *** 3,7 **** IAccountProvider.cs ! Copyright (C) 2008 Marco Milletti --- 3,7 ---- IAccountProvider.cs ! Copyright (C) 2008 Marco Milletti *************** *** 19,23 **** 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; --- 19,23 ---- 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; *************** *** 46,51 **** /// <param name="endOfDayDateTime">end of day date time for the market evaluation</param> /// <returns></returns> ! Account GetAccount( IEndOfDayTimer timer , ! IHistoricalQuoteProvider historicalQuoteProvider ); } } --- 46,52 ---- /// <param name="endOfDayDateTime">end of day date time for the market evaluation</param> /// <returns></returns> ! Account GetAccount( ! Timer timer , ! HistoricalMarketValueProvider historicalMarketValueProvider ); } } |