quantproject-developers Mailing List for QuantProject (Page 111)
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: Marco M. <mi...@us...> - 2005-04-17 13:31:59
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/CallingReportsForRunScripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25380/b7_Scripts/CallingReportsForRunScripts Modified Files: ShowReportFromFile.cs Log Message: Report form now shows what account or report is being viewed, through text caption. Index: ShowReportFromFile.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/CallingReportsForRunScripts/ShowReportFromFile.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ShowReportFromFile.cs 15 Feb 2005 19:13:41 -0000 1.3 --- ShowReportFromFile.cs 17 Apr 2005 13:31:50 -0000 1.4 *************** *** 47,50 **** --- 47,52 ---- (Account)ObjectArchiver.Extract(serializedAccountFullPath); Report report = new Report(account, new HistoricalAdjustedQuoteProvider()); + report.Text = + serializedAccountFullPath.Substring(serializedAccountFullPath.LastIndexOf("\\") + 1); ReportShower reportShower = new ReportShower(report); reportShower.Show(); *************** *** 63,66 **** --- 65,70 ---- (AccountReport)ObjectArchiver.Extract(serializedAccountReportFullPath); Report report = new Report(accountReport); + report.Text = + serializedAccountReportFullPath.Substring(serializedAccountReportFullPath.LastIndexOf("\\") + 1); report.Show(); } |
|
From: Glauco S. <gla...@us...> - 2005-04-17 11:58:05
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8315/b1_ADT Modified Files: b1_ADT.csproj Log Message: - added Histories\IInterpolatonMethod.cs - added Histories\PreviousInterpolator.cs Index: b1_ADT.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/b1_ADT.csproj,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** b1_ADT.csproj 30 Jan 2005 19:55:36 -0000 1.13 --- b1_ADT.csproj 17 Apr 2005 11:57:57 -0000 1.14 *************** *** 148,151 **** --- 148,161 ---- /> <File + RelPath = "Histories\IInterpolatonMethod.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Histories\PreviousInterpolator.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Optimizing\Optimizable.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2005-04-17 02:15:36
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13173/b5_Presentation/Reporting/WindowsForm Modified Files: EquityChartTabPage.cs Log Message: The BenchmarkEquityLine is now computed so that it contains data for exactly the same dates as the EquityHistory. PreviousInterpolator is used as interpolator method Index: EquityChartTabPage.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm/EquityChartTabPage.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EquityChartTabPage.cs 30 Mar 2005 23:50:13 -0000 1.4 --- EquityChartTabPage.cs 17 Apr 2005 02:15:28 -0000 1.5 *************** *** 39,43 **** private AccountReport accountReport; private Chart equityChart; - private History equity = new History(); private History benchmark; --- 39,42 ---- *************** *** 50,65 **** private History getBenchmark() { ! // History buyAndHoldTickerEquityLine = ! // HistoricalDataProvider.GetAdjustedCloseHistory( ! // this.accountReport.BuyAndHoldTicker ); ! // HistoricalAdjustedQuoteProvider quoteProvider = ! // new HistoricalAdjustedQuoteProvider(); ! // DateTime firstDate = (DateTime)this.equity.GetKey( 0 ); ! // double normalizingFactor = ! // ( double )this.equity[ firstDate ] / ! // ( double )quoteProvider.GetMarketValue( this.accountReport.BuyAndHoldTicker ,ù ! DateTime firstDate = (DateTime)this.equity.GetKey( 0 ); double normalizingFactor = ! ( double )this.equity[ firstDate ] / Convert.ToDouble( this.accountReport.BenchmarkEquityLine[ firstDate ] ); return this.accountReport.BenchmarkEquityLine.MultiplyBy( normalizingFactor ); --- 49,56 ---- private History getBenchmark() { ! DateTime firstDate = ! (DateTime)this.accountReport.EquityHistory.GetKey( 0 ); double normalizingFactor = ! ( double )this.accountReport.EquityHistory[ firstDate ] / Convert.ToDouble( this.accountReport.BenchmarkEquityLine[ firstDate ] ); return this.accountReport.BenchmarkEquityLine.MultiplyBy( normalizingFactor ); *************** *** 71,91 **** this.equityChart = new Chart(); this.equityChart.Dock = DockStyle.Fill; ! this.equity.Import( this.accountReport.Equity.DataTable , ! QuantProject.Business.Financial.Accounting.Reporting.Tables.Equity.Date , ! QuantProject.Business.Financial.Accounting.Reporting.Tables.Equity.AccountValue ); ! this.equityChart.Add( equity , Color.Red ); this.benchmark = this.getBenchmark(); ! this.equityChart.Add( benchmark , Color.Blue , (DateTime)this.equity.GetKey( 0 ) , ! (DateTime)this.equity.GetKey( this.equity.Count - 1 ) ); this.Controls.Add( this.equityChart ); } - // protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) - // { - // this.VisualValidationDataGrid.Height = this.Height - 10; - // this.VisualValidationChart.PrecedingDays = ConstantsProvider.PrecedingDaysForVisualValidation; - // this.VisualValidationChart.Width = this.Width - this.VisualValidationDataGridWidth - 5; - // this.VisualValidationChart.Height = this.Height - 10; - // base.OnPaint( e ); - // } } } --- 62,73 ---- this.equityChart = new Chart(); this.equityChart.Dock = DockStyle.Fill; ! this.equityChart.Add( accountReport.EquityHistory , Color.Red ); this.benchmark = this.getBenchmark(); ! // this.equityChart.Add( benchmark , Color.Blue , ! // (DateTime)this.accountReport.EquityHistory.GetKey( 0 ) , ! // (DateTime)this.accountReport.EquityHistory.GetKey( this.accountReport.EquityHistory.Count - 1 ) ); ! this.equityChart.Add( benchmark , Color.Blue ); this.Controls.Add( this.equityChart ); } } } |
|
From: Glauco S. <gla...@us...> - 2005-04-17 02:14:05
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12901/b4_Business/a1_Financial/a2_Accounting/h5_Reporting Modified Files: AccountReport.cs Log Message: - a new EquityHistory public property has been added - the BenchmarkEquityLine is now computed so that it contains data for exactly the same dates as the EquityHistory. PreviousInterpolator is used as interpolator method - the serialized AccountReport object should be much smaller now Index: AccountReport.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/AccountReport.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** AccountReport.cs 30 Mar 2005 23:50:13 -0000 1.12 --- AccountReport.cs 17 Apr 2005 02:13:52 -0000 1.13 *************** *** 55,58 **** --- 55,59 ---- private ReportTable roundTrades; private ReportTable equity; + private History equityHistory; private Tables.Summary summary; *************** *** 93,101 **** get { return roundTrades; } } ! public ReportTable Equity ! { ! get { return equity; } ! } ! public Tables.Summary Summary { get { return summary; } --- 94,117 ---- get { return roundTrades; } } ! public ReportTable Equity ! { ! get { return equity; } ! } ! public History EquityHistory ! { ! get ! { ! if ( this.equityHistory == null ) ! // this.equityHistory has not been imported yet ! { ! this.equityHistory = new History(); ! this.equityHistory.Import( this.Equity.DataTable , ! QuantProject.Business.Financial.Accounting.Reporting.Tables.Equity.Date , ! QuantProject.Business.Financial.Accounting.Reporting.Tables.Equity.AccountValue ); ! } ! return this.equityHistory; ! } ! } ! public Tables.Summary Summary { get { return summary; } *************** *** 229,236 **** #region Create ! private History create_getBenchmarkEquityLine() { ! return HistoricalDataProvider.GetAdjustedCloseHistory( this.benchmark ); } public AccountReport Create( string reportName , long numDaysForInterval , --- 245,254 ---- #region Create ! private void setBenchmarkEquityLine() { ! History benchmarkQuotes = HistoricalDataProvider.GetAdjustedCloseHistory( this.benchmark ); + this.benchmarkEquityLine = benchmarkQuotes.Select( this.EquityHistory ); + this.benchmarkEquityLine.Interpolate( this.EquityHistory.Keys , new PreviousInterpolator() ); } public AccountReport Create( string reportName , long numDaysForInterval , *************** *** 240,245 **** this.endDateTime = endDateTime; this.benchmark = benchmark; - if ( benchmark != "" ) - this.benchmarkEquityLine = this.create_getBenchmarkEquityLine(); detailedDataTable = getDetailedDataTable( numDaysForInterval ); this.transactionTable = new Tables.Transactions( reportName , detailedDataTable ); --- 258,261 ---- *************** *** 247,250 **** --- 263,268 ---- 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 ); |
|
From: Glauco S. <gla...@us...> - 2005-04-17 02:08:18
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Histories In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10687/b1_ADT/Histories Modified Files: History.cs Log Message: The Select method has been added: it returns a new history where only common dates are selected Index: History.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Histories/History.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** History.cs 20 Jan 2005 01:22:31 -0000 1.7 --- History.cs 17 Apr 2005 02:08:09 -0000 1.8 *************** *** 33,84 **** /// Summary description for History. /// </summary> ! [Serializable] ! public class History : AdvancedSortedList ! { ! public History() : base() ! { ! } ! public Object GetValue( DateTime dateTime ) ! { ! return this[ dateTime ]; ! } ! /// <summary> ! /// Imports DataTable data into this History object ! /// </summary> ! /// <param name="dataTable">Contains the data to be imported</param> ! /// <param name="dateTimeColumnName">Name of the column containing the DateTime keys ! /// to be imported</param> ! /// <param name="valueColumnName">Name of the column containing the values to be imported</param> ! public void Import( DataTable dataTable , string dateTimeColumnName , string valueColumnName ) ! { ! foreach (DataRow dataRow in dataTable.Rows ) ! this.Add( dataRow[ dateTimeColumnName ] , dataRow[ valueColumnName ] ); ! } ! /// <summary> ! /// Add an history item, if no collision (contemporary events) is expected ! /// </summary> ! /// <param name="dateTime"></param> ! /// <param name="objectToAdd"></param> ! /// <returns></returns> ! public void Add( DateTime dateTime , Object objectToAdd ) ! { ! base.Add( dateTime , objectToAdd ); ! } ! /// <summary> ! /// Add an history item when collisions (contemporary events) are possible ! /// </summary> ! /// <param name="dateTime"></param> ! /// <param name="objectToAdd"></param> ! public void MultiAdd( DateTime dateTime , Object objectToAdd ) ! { ! if (!this.ContainsKey( dateTime )) ! { ! this[ dateTime ] = new ArrayList(); ! } ! ((ArrayList)this[ dateTime ]).Add( objectToAdd ); ! } --- 33,107 ---- /// Summary description for History. /// </summary> ! [Serializable] ! public class History : AdvancedSortedList ! { ! public History() : base() ! { ! } ! public Object GetValue( DateTime dateTime ) ! { ! return this[ dateTime ]; ! } ! /// <summary> ! /// Imports DataTable data into this History object ! /// </summary> ! /// <param name="dataTable">Contains the data to be imported</param> ! /// <param name="dateTimeColumnName">Name of the column containing the DateTime keys ! /// to be imported</param> ! /// <param name="valueColumnName">Name of the column containing the values to be imported</param> ! public void Import( DataTable dataTable , string dateTimeColumnName , string valueColumnName ) ! { ! foreach (DataRow dataRow in dataTable.Rows ) ! this.Add( dataRow[ dateTimeColumnName ] , dataRow[ valueColumnName ] ); ! } ! /// <summary> ! /// Returns an history where only common dates are selected ! /// </summary> ! /// <param name="selectingHistory">Provides the relevant dates to be selected</param> ! /// <returns></returns> ! public History Select( History selectingHistory ) ! { ! History returnValue = new History(); ! foreach ( DateTime dateTime in selectingHistory.Keys ) ! if ( this.ContainsKey( dateTime ) ) ! returnValue.Add( dateTime , this.GetValue( dateTime ) ); ! return returnValue; ! } ! ! public void Interpolate( ICollection dateTimeCollection , ! IInterpolationMethod interpolationMethod ) ! { ! foreach ( DateTime dateTime in dateTimeCollection ) ! if ( !this.ContainsKey( dateTime ) ) ! this.Add( dateTime , interpolationMethod.GetValue( this , dateTime ) ); ! } ! ! /// <summary> ! /// Add an history item, if no collision (contemporary events) is expected ! /// </summary> ! /// <param name="dateTime"></param> ! /// <param name="objectToAdd"></param> ! /// <returns></returns> ! public void Add( DateTime dateTime , Object objectToAdd ) ! { ! base.Add( dateTime , objectToAdd ); ! } ! ! /// <summary> ! /// Add an history item when collisions (contemporary events) are possible ! /// </summary> ! /// <param name="dateTime"></param> ! /// <param name="objectToAdd"></param> ! public void MultiAdd( DateTime dateTime , Object objectToAdd ) ! { ! if (!this.ContainsKey( dateTime )) ! { ! this[ dateTime ] = new ArrayList(); ! } ! ((ArrayList)this[ dateTime ]).Add( objectToAdd ); ! } *************** *** 119,219 **** } #endregion ! public DateTime GetNextDay( DateTime dateTime ) ! { ! if ( this.IndexOfKey( dateTime ) == ( this.Count - 1 ) ) ! // it is the last dateTime in the history ! return dateTime.AddDays( 1 ); ! else ! return (DateTime) this.GetKey( this.IndexOfKeyOrPrevious( dateTime ) + 1 ); ! } ! //millo - fixed method ! public DateTime GetDay( DateTime initialDateTime, int numberOfDaysAhead ) ! { ! if ( this.IndexOfKey( initialDateTime ) >= ( this.Count - numberOfDaysAhead ) ) ! // initial dateTime + n° of days ahead > the last dateTime in History { ! DateTime dateTime; ! dateTime = (DateTime)this.GetKey(this.Count -1); ! return dateTime.AddDays(this.IndexOfKey(initialDateTime) + numberOfDaysAhead - this.Count); } ! else ! return (DateTime) this.GetKey( this.IndexOfKeyOrPrevious( initialDateTime ) + numberOfDaysAhead ); ! } ! //millo #region "GetFunctionHistory" ! /// <summary> ! /// Gets a History object based on a statistical available function ! /// </summary> ! /// <remarks> ! /// Each History's item contains a specific statistical function ! /// calculated for each period whose length has to be specified by the user. ! /// The key for the History item is the initial date of each period ! /// </remarks> ! /// <param name="functionToBeCalculated"> ! /// Statistical available function to be calculated and stored in the current History object ! /// </param> ! /// <param name="onEachPeriodOf"> ! /// Length in day of each period of calculation ! /// </param> ! /// /// <param name="startDateTime"> ! /// It sets the start date for the time interval containing the returned History ! /// </param> ! /// /// <param name="endDateTime"> ! /// It sets the end date for the time interval containing the returned History ! /// </param> ! /// ! public History GetFunctionHistory(Function functionToBeCalculated, int onEachPeriodOf, ! DateTime startDateTime , DateTime endDateTime ) ! { ! History functionHistory = new History(); ! int currentHistoryIndex = this.IndexOfKeyOrPrevious(startDateTime); ! double[] data = new double[onEachPeriodOf]; ! //the array contains the set of data whose length is specified by the user ! double periodIndex = 0; ! //in the while statement, if it isn't equal to Floor(currentHistoryIndex/onEachPeriodOf) ! //the current index belongs to the period with periodIndex increased by one ! int cursorThroughDataArray = 0; ! while ( ! ( currentHistoryIndex < this.Count ) && ! ( ((IComparable)this.GetKey( currentHistoryIndex )).CompareTo( endDateTime ) <= 0 ) ) ! { ! if (Math.Floor(currentHistoryIndex/onEachPeriodOf) == periodIndex && cursorThroughDataArray < onEachPeriodOf) ! //currentHistoryIndex belongs to the current period ! { ! data[cursorThroughDataArray] = Convert.ToDouble(this.GetByIndex(currentHistoryIndex)); ! cursorThroughDataArray++; ! functionHistory.Add(this.GetKey( currentHistoryIndex ), null); ! currentHistoryIndex++; ! } ! else ! //currentHistoryIndex doesn't belong to the current period ! //so a new item can be added to the object History to be returned ! { ! cursorThroughDataArray = 0; ! DateTime dateTime = (DateTime)this.GetKey( currentHistoryIndex - onEachPeriodOf); ! switch (functionToBeCalculated) ! { ! case Function.SimpleAverage: ! functionHistory.SetByIndex(currentHistoryIndex - onEachPeriodOf, ! BasicFunctions.SimpleAverage(data)); ! //functionHistory.Add( dateTime , BasicFunctions.SimpleAverage(data) ); ! break; ! case Function.StandardDeviation : ! functionHistory.SetByIndex(currentHistoryIndex - onEachPeriodOf, ! BasicFunctions.StdDev(data)); ! //functionHistory.Add( dateTime , BasicFunctions.StdDev(data) ); ! break; ! } ! } ! periodIndex = Math.Floor(currentHistoryIndex/onEachPeriodOf); ! } ! return functionHistory; ! } #endregion --- 142,242 ---- } #endregion ! public DateTime GetNextDay( DateTime dateTime ) ! { ! if ( this.IndexOfKey( dateTime ) == ( this.Count - 1 ) ) ! // it is the last dateTime in the history ! return dateTime.AddDays( 1 ); ! else ! return (DateTime) this.GetKey( this.IndexOfKeyOrPrevious( dateTime ) + 1 ); ! } ! //millo - fixed method ! public DateTime GetDay( DateTime initialDateTime, int numberOfDaysAhead ) ! { ! if ( this.IndexOfKey( initialDateTime ) >= ( this.Count - numberOfDaysAhead ) ) ! // initial dateTime + n° of days ahead > the last dateTime in History { ! DateTime dateTime; ! dateTime = (DateTime)this.GetKey(this.Count -1); ! return dateTime.AddDays(this.IndexOfKey(initialDateTime) + numberOfDaysAhead - this.Count); } ! else ! return (DateTime) this.GetKey( this.IndexOfKeyOrPrevious( initialDateTime ) + numberOfDaysAhead ); ! } ! //millo #region "GetFunctionHistory" ! /// <summary> ! /// Gets a History object based on a statistical available function ! /// </summary> ! /// <remarks> ! /// Each History's item contains a specific statistical function ! /// calculated for each period whose length has to be specified by the user. ! /// The key for the History item is the initial date of each period ! /// </remarks> ! /// <param name="functionToBeCalculated"> ! /// Statistical available function to be calculated and stored in the current History object ! /// </param> ! /// <param name="onEachPeriodOf"> ! /// Length in day of each period of calculation ! /// </param> ! /// /// <param name="startDateTime"> ! /// It sets the start date for the time interval containing the returned History ! /// </param> ! /// /// <param name="endDateTime"> ! /// It sets the end date for the time interval containing the returned History ! /// </param> ! /// ! public History GetFunctionHistory(Function functionToBeCalculated, int onEachPeriodOf, ! DateTime startDateTime , DateTime endDateTime ) ! { ! History functionHistory = new History(); ! int currentHistoryIndex = this.IndexOfKeyOrPrevious(startDateTime); ! double[] data = new double[onEachPeriodOf]; ! //the array contains the set of data whose length is specified by the user ! double periodIndex = 0; ! //in the while statement, if it isn't equal to Floor(currentHistoryIndex/onEachPeriodOf) ! //the current index belongs to the period with periodIndex increased by one ! int cursorThroughDataArray = 0; ! while ( ! ( currentHistoryIndex < this.Count ) && ! ( ((IComparable)this.GetKey( currentHistoryIndex )).CompareTo( endDateTime ) <= 0 ) ) ! { ! if (Math.Floor(currentHistoryIndex/onEachPeriodOf) == periodIndex && cursorThroughDataArray < onEachPeriodOf) ! //currentHistoryIndex belongs to the current period ! { ! data[cursorThroughDataArray] = Convert.ToDouble(this.GetByIndex(currentHistoryIndex)); ! cursorThroughDataArray++; ! functionHistory.Add(this.GetKey( currentHistoryIndex ), null); ! currentHistoryIndex++; ! } ! else ! //currentHistoryIndex doesn't belong to the current period ! //so a new item can be added to the object History to be returned ! { ! cursorThroughDataArray = 0; ! DateTime dateTime = (DateTime)this.GetKey( currentHistoryIndex - onEachPeriodOf); ! switch (functionToBeCalculated) ! { ! case Function.SimpleAverage: ! functionHistory.SetByIndex(currentHistoryIndex - onEachPeriodOf, ! BasicFunctions.SimpleAverage(data)); ! //functionHistory.Add( dateTime , BasicFunctions.SimpleAverage(data) ); ! break; ! case Function.StandardDeviation : ! functionHistory.SetByIndex(currentHistoryIndex - onEachPeriodOf, ! BasicFunctions.StdDev(data)); ! //functionHistory.Add( dateTime , BasicFunctions.StdDev(data) ); ! break; ! } ! } ! periodIndex = Math.Floor(currentHistoryIndex/onEachPeriodOf); ! } ! return functionHistory; ! } #endregion |
|
From: Glauco S. <gla...@us...> - 2005-04-17 02:06:15
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Histories In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10167/b1_ADT/Histories Added Files: PreviousInterpolator.cs Log Message: When a time series value lacks, it is interpolated with the previous available value --- NEW FILE: PreviousInterpolator.cs --- /* QuantProject - Quantitative Finance Library PreviousInterpolator.cs Copyright (C) 2004 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; namespace QuantProject.ADT.Histories { /// <summary> /// When a time series value lacks, it is interpolated with the previous available value /// </summary> public class PreviousInterpolator : IInterpolationMethod { /// <summary> /// Interpolation method: if value is undefined, /// returns the previous available value /// </summary> public PreviousInterpolator() { // // TODO: Add constructor logic here // } /// <summary> /// If value is undefined, returns the previous available value /// </summary> /// <param name="history"></param> /// <param name="dateTime"></param> /// <returns></returns> public Object GetValue( History history , DateTime dateTime ) { Object returnValue; if ( history.ContainsKey( dateTime ) ) returnValue = history.GetValue( dateTime ); else returnValue = history.GetValue( (DateTime)history.GetKeyOrPrevious( dateTime ) ); return returnValue; } } } |
|
From: Glauco S. <gla...@us...> - 2005-04-17 02:05:36
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Histories In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9681/b1_ADT/Histories Added Files: IInterpolatonMethod.cs Log Message: Interface to be implemented by time series interpolators --- NEW FILE: IInterpolatonMethod.cs --- /* QuantProject - Quantitative Finance Library IInterpolationMethod.cs Copyright (C) 2004 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; namespace QuantProject.ADT.Histories { /// <summary> /// Interface to be implemented by time series interpolators /// </summary> public interface IInterpolationMethod { /// <summary> /// returns the interpolating value, at the given dateTime /// </summary> Object GetValue( History history , DateTime dateTime ); } } |
|
From: Marco M. <mi...@us...> - 2005-04-14 18:40:45
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22812/Downloader/TickerSelectors Modified Files: TickerSelectorForm.cs Log Message: Added visual interface for new ITickerSelector object SelectorByWinningOpenToClose Index: TickerSelectorForm.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors/TickerSelectorForm.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TickerSelectorForm.cs 30 Mar 2005 16:11:10 -0000 1.12 --- TickerSelectorForm.cs 14 Apr 2005 18:40:05 -0000 1.13 *************** *** 48,60 **** private System.Windows.Forms.GroupBox groupBoxSelectionRule; private System.Windows.Forms.DateTimePicker dateTimePickerFirstDate; - private System.Windows.Forms.DataGrid dataGrid1; private System.Windows.Forms.DateTimePicker dateTimePickerLastDate; ! private System.Windows.Forms.TextBox textBoxMarketIndex; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.Label labelMarketIndexKey; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox textBoxGroupID; ! private System.Windows.Forms.TextBox textBoxMaxStdDev; private System.Windows.Forms.ComboBox comboBoxAvailableSelectionRules; private System.Windows.Forms.Label label3; --- 48,60 ---- private System.Windows.Forms.GroupBox groupBoxSelectionRule; private System.Windows.Forms.DateTimePicker dateTimePickerFirstDate; private System.Windows.Forms.DateTimePicker dateTimePickerLastDate; ! private System.Windows.Forms.TextBox textBoxMaxStdDev; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.Label labelMarketIndexKey; + private System.Windows.Forms.DataGrid dataGrid1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox textBoxGroupID; ! private System.Windows.Forms.TextBox textBoxMarketIndex; private System.Windows.Forms.ComboBox comboBoxAvailableSelectionRules; private System.Windows.Forms.Label label3; *************** *** 88,91 **** --- 88,92 ---- this.comboBoxAvailableSelectionRules.Items.Add("QuotedAtEachMarketDay"); this.comboBoxAvailableSelectionRules.Items.Add("AverageRawOpenPrice"); + this.comboBoxAvailableSelectionRules.Items.Add("WinningOpenToClose"); } *************** *** 135,147 **** this.label3 = new System.Windows.Forms.Label(); this.comboBoxAvailableSelectionRules = new System.Windows.Forms.ComboBox(); ! this.textBoxMaxStdDev = new System.Windows.Forms.TextBox(); this.textBoxGroupID = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.labelMarketIndexKey = new System.Windows.Forms.Label(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); ! this.textBoxMarketIndex = new System.Windows.Forms.TextBox(); this.dateTimePickerLastDate = new System.Windows.Forms.DateTimePicker(); - this.dataGrid1 = new System.Windows.Forms.DataGrid(); this.dateTimePickerFirstDate = new System.Windows.Forms.DateTimePicker(); this.groupBoxSelectionRule = new System.Windows.Forms.GroupBox(); --- 136,148 ---- this.label3 = new System.Windows.Forms.Label(); this.comboBoxAvailableSelectionRules = new System.Windows.Forms.ComboBox(); ! this.textBoxMarketIndex = new System.Windows.Forms.TextBox(); this.textBoxGroupID = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); + this.dataGrid1 = new System.Windows.Forms.DataGrid(); this.labelMarketIndexKey = new System.Windows.Forms.Label(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); ! this.textBoxMaxStdDev = new System.Windows.Forms.TextBox(); this.dateTimePickerLastDate = new System.Windows.Forms.DateTimePicker(); this.dateTimePickerFirstDate = new System.Windows.Forms.DateTimePicker(); this.groupBoxSelectionRule = new System.Windows.Forms.GroupBox(); *************** *** 253,264 **** this.comboBoxAvailableSelectionRules.SelectedValueChanged += new System.EventHandler(this.comboBoxAvailableSelectionRules_SelectedValueChanged); // ! // textBoxMaxStdDev // ! this.textBoxMaxStdDev.Location = new System.Drawing.Point(232, 200); ! this.textBoxMaxStdDev.Name = "textBoxMaxStdDev"; ! this.textBoxMaxStdDev.Size = new System.Drawing.Size(56, 20); ! this.textBoxMaxStdDev.TabIndex = 36; ! this.textBoxMaxStdDev.Text = ""; ! this.textBoxMaxStdDev.Visible = false; // // textBoxGroupID --- 254,265 ---- this.comboBoxAvailableSelectionRules.SelectedValueChanged += new System.EventHandler(this.comboBoxAvailableSelectionRules_SelectedValueChanged); // ! // textBoxMarketIndex // ! this.textBoxMarketIndex.Location = new System.Drawing.Point(192, 176); ! this.textBoxMarketIndex.Name = "textBoxMarketIndex"; ! this.textBoxMarketIndex.Size = new System.Drawing.Size(88, 20); ! this.textBoxMarketIndex.TabIndex = 28; ! this.textBoxMarketIndex.Text = ""; ! this.textBoxMarketIndex.Visible = false; // // textBoxGroupID *************** *** 286,289 **** --- 287,302 ---- this.label2.Text = "Max Num of returned tickers"; // + // dataGrid1 + // + this.dataGrid1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.dataGrid1.DataMember = ""; + this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Left; + this.dataGrid1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); + this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText; + this.dataGrid1.Location = new System.Drawing.Point(0, 0); + this.dataGrid1.Name = "dataGrid1"; + this.dataGrid1.Size = new System.Drawing.Size(432, 478); + this.dataGrid1.TabIndex = 2; + // // labelMarketIndexKey // *************** *** 295,306 **** this.labelMarketIndexKey.Visible = false; // ! // textBoxMarketIndex // ! this.textBoxMarketIndex.Location = new System.Drawing.Point(192, 176); ! this.textBoxMarketIndex.Name = "textBoxMarketIndex"; ! this.textBoxMarketIndex.Size = new System.Drawing.Size(88, 20); ! this.textBoxMarketIndex.TabIndex = 28; ! this.textBoxMarketIndex.Text = ""; ! this.textBoxMarketIndex.Visible = false; // // dateTimePickerLastDate --- 308,319 ---- this.labelMarketIndexKey.Visible = false; // ! // textBoxMaxStdDev // ! this.textBoxMaxStdDev.Location = new System.Drawing.Point(232, 200); ! this.textBoxMaxStdDev.Name = "textBoxMaxStdDev"; ! this.textBoxMaxStdDev.Size = new System.Drawing.Size(56, 20); ! this.textBoxMaxStdDev.TabIndex = 36; ! this.textBoxMaxStdDev.Text = ""; ! this.textBoxMaxStdDev.Visible = false; // // dateTimePickerLastDate *************** *** 312,327 **** this.dateTimePickerLastDate.TabIndex = 15; // - // dataGrid1 - // - this.dataGrid1.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.dataGrid1.DataMember = ""; - this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Left; - this.dataGrid1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); - this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText; - this.dataGrid1.Location = new System.Drawing.Point(0, 0); - this.dataGrid1.Name = "dataGrid1"; - this.dataGrid1.Size = new System.Drawing.Size(432, 478); - this.dataGrid1.TabIndex = 2; - // // dateTimePickerFirstDate // --- 325,328 ---- *************** *** 580,586 **** Double.Parse(this.textBoxMinStdDev.Text), Double.Parse(this.textBoxMaxStdDev.Text)); } return returnValue; } ! private void setVisibilityForControls_QuotedAtEachMarketDay(bool showControls) { --- 581,598 ---- Double.Parse(this.textBoxMinStdDev.Text), Double.Parse(this.textBoxMaxStdDev.Text)); } + else if (this.comboBoxAvailableSelectionRules.Text == "WinningOpenToClose") + { + if(this.textBoxGroupID.Text != "") + returnValue = new SelectorByWinningOpenToClose(this.textBoxGroupID.Text, + this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, + this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); + else + returnValue = new SelectorByWinningOpenToClose(this.textBoxGroupID.Text, + this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, + this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); + } return returnValue; } ! private void setVisibilityForControls_QuotedAtEachMarketDay(bool showControls) { |
|
From: Marco M. <mi...@us...> - 2005-04-14 18:40:24
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22812/Downloader Modified Files: QuantDownloader.prjx Log Message: Added visual interface for new ITickerSelector object SelectorByWinningOpenToClose Index: QuantDownloader.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/QuantDownloader.prjx,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QuantDownloader.prjx 27 Mar 2005 20:07:52 -0000 1.2 --- QuantDownloader.prjx 14 Apr 2005 18:40:04 -0000 1.3 *************** *** 45,53 **** <Reference type="Project" refto="b4_Business" localcopy="True" /> <Reference type="Project" refto="b5_Presentation" localcopy="True" /> ! <Reference type="Assembly" refto="..\..\scpl.dll" localcopy="True" /> </References> <DeploymentInformation target="" script="" strategy="File" /> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon=".\App.ico" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\bin\Debug" assembly="QuantDownloader" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> --- 45,53 ---- <Reference type="Project" refto="b4_Business" localcopy="True" /> <Reference type="Project" refto="b5_Presentation" localcopy="True" /> ! <Reference type="Assembly" refto="..\..\NPlot.dll" localcopy="True" /> </References> <DeploymentInformation target="" script="" strategy="File" /> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="WinExe" definesymbols="" generatexmldocumentation="False" win32Icon=".\App.ico" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\bin\Debug" assembly="QuantDownloader" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> *************** *** 55,64 **** <Configurations active="Debug"> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon=".\App.ico" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\bin\Debug" assembly="QuantDownloader" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\bin\Release" assembly="QuantDownloader" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> --- 55,64 ---- <Configurations active="Debug"> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="WinExe" definesymbols="" generatexmldocumentation="False" win32Icon=".\App.ico" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\bin\Debug" assembly="QuantDownloader" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="" target="WinExe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="True" /> <Output directory="..\bin\Release" assembly="QuantDownloader" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> |
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22306/b7_Scripts/TickerSelectionTesting Modified Files: EndOfDayTimerHandler.cs EndOfDayTimerHandlerCTC.cs EndOfDayTimerHandlerCTO.cs GenomeManagerForEfficientPortfolio.cs Log Message: Updated files for the EfficientPortfolio script. Index: EndOfDayTimerHandlerCTO.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTO.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** EndOfDayTimerHandlerCTO.cs 11 Apr 2005 18:52:31 -0000 1.7 --- EndOfDayTimerHandlerCTO.cs 14 Apr 2005 18:38:28 -0000 1.8 *************** *** 70,74 **** if(ticker != null) { ! this.AddOrderForTicker( ticker ); this.lastChosenTickers[idx] = ticker; } --- 70,74 ---- if(ticker != null) { ! this.addOrderForTicker( ticker ); this.lastChosenTickers[idx] = ticker; } *************** *** 145,150 **** DataTable tickersByPrice = selectorByOpenPrice.GetTableOfSelectedTickers(); */ ! ! SelectorByLiquidity mostLiquid = new SelectorByLiquidity(this.tickerGroupID, false, currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfEligibleTickers); this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); --- 145,153 ---- DataTable tickersByPrice = selectorByOpenPrice.GetTableOfSelectedTickers(); */ ! SelectorByWinningOpenToClose selectorByWinningOpenToClose = ! new SelectorByWinningOpenToClose(this.tickerGroupID, false, currentDate, ! currentDate, this.numberOfEligibleTickers); ! DataTable winningOpenToCloseTickers = selectorByWinningOpenToClose.GetTableOfSelectedTickers(); ! SelectorByLiquidity mostLiquid = new SelectorByLiquidity(winningOpenToCloseTickers, false, currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfEligibleTickers); this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); Index: EndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandler.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** EndOfDayTimerHandler.cs 11 Apr 2005 18:52:32 -0000 1.10 --- EndOfDayTimerHandler.cs 14 Apr 2005 18:38:27 -0000 1.11 *************** *** 100,104 **** } ! public virtual void AddOrderForTicker(string ticker ) { --- 100,104 ---- } ! protected virtual void addOrderForTicker(string ticker ) { Index: GenomeManagerForEfficientPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForEfficientPortfolio.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GenomeManagerForEfficientPortfolio.cs 11 Apr 2005 18:52:31 -0000 1.4 --- GenomeManagerForEfficientPortfolio.cs 14 Apr 2005 18:38:28 -0000 1.5 *************** *** 80,84 **** { get{return this.portfolioType;} ! set{this.portfolioType = value;} } --- 80,84 ---- { get{return this.portfolioType;} ! //set{this.portfolioType = value;} } *************** *** 107,122 **** public virtual double GetFitnessValue(Genome genome) { ! double returnValue; double portfolioVariance = this.getPortfolioVariance(genome.Genes()); double portfolioRateOfReturn = this.getPortfolioRateOfReturn(genome.Genes()); - this.variance = portfolioVariance; - this.rateOfReturn = portfolioRateOfReturn; - - NormalDistribution normal = new NormalDistribution(portfolioRateOfReturn, Math.Sqrt(portfolioVariance)); - if(this.portfolioType == PortfolioType.OnlyLong) - returnValue = normal.GetProbability(this.targetPerformance*0.75,this.targetPerformance*1.25); - else//only short orders are permitted - returnValue = normal.GetProbability(-this.targetPerformance*1.25,-this.targetPerformance*0.75); return returnValue; } --- 107,131 ---- public virtual double GetFitnessValue(Genome genome) { ! double returnValue = 0; double portfolioVariance = this.getPortfolioVariance(genome.Genes()); double portfolioRateOfReturn = this.getPortfolioRateOfReturn(genome.Genes()); + if(!Double.IsInfinity(portfolioVariance) || + !Double.IsInfinity(portfolioRateOfReturn) || + !Double.IsNaN(portfolioVariance) || + !Double.IsNaN(portfolioRateOfReturn)) + //variance and rate of return are + //double values computed in the right way + { + this.variance = portfolioVariance; + this.rateOfReturn = portfolioRateOfReturn; + NormalDistribution normal = new NormalDistribution(portfolioRateOfReturn, Math.Sqrt(portfolioVariance)); + if(this.portfolioType == PortfolioType.OnlyLong) + //returnValue = normal.GetProbability(this.targetPerformance*0.75,this.targetPerformance*1.25); + returnValue = 1.0 - normal.GetProbability(this.targetPerformance); + else//only short orders are permitted + //returnValue = normal.GetProbability(-this.targetPerformance*1.25,-this.targetPerformance*0.75); + returnValue = normal.GetProbability(this.targetPerformance); + } return returnValue; } Index: EndOfDayTimerHandlerCTC.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTC.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EndOfDayTimerHandlerCTC.cs 11 Apr 2005 18:52:30 -0000 1.3 --- EndOfDayTimerHandlerCTC.cs 14 Apr 2005 18:38:27 -0000 1.4 *************** *** 136,140 **** this.lastChosenTickers[idx] = ticker; if(ticker != null) ! this.AddOrderForTicker( ticker ); idx++; } --- 136,140 ---- this.lastChosenTickers[idx] = ticker; if(ticker != null) ! this.addOrderForTicker( ticker ); idx++; } |
|
From: Marco M. <mi...@us...> - 2005-04-14 18:36:56
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21683/b3_Data Modified Files: Data.prjx Log Message: Added new ITickerSelector object for advanced selection of tickers: with SelectorByWinningOpenToClose object it is now possible to choose tickers with a raw close greater than raw open at a given time interval within the specified group of tickers Index: Data.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Data.prjx,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Data.prjx 28 Mar 2005 18:09:23 -0000 1.3 --- Data.prjx 14 Apr 2005 18:36:46 -0000 1.4 *************** *** 32,35 **** --- 32,36 ---- <File name=".\Selectors\TickerSelector.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\QuantProject.Applications.Downloader.TickerSelectors.TickerSelectorForm.resources" subtype="Code" buildaction="EmbedAsResource" dependson="" data="" /> + <File name=".\Selectors\SelectorByWinningOpenToClose.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References> |
|
From: Marco M. <mi...@us...> - 2005-04-14 18:36:08
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21073/b5_Presentation/Reporting/WindowsForm Modified Files: Report.cs Log Message: Show method is called instead of ShowDialog: so, the form is not modal anymore. Index: Report.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm/Report.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Report.cs 13 Mar 2005 23:34:40 -0000 1.9 --- Report.cs 14 Apr 2005 18:35:58 -0000 1.10 *************** *** 78,82 **** numDaysForInterval , endDateTime , buyAndHoldTicker ); this.show_populateForm(); ! base.ShowDialog(); } public new void Show() --- 78,82 ---- numDaysForInterval , endDateTime , buyAndHoldTicker ); this.show_populateForm(); ! base.Show(); } public new void Show() *************** *** 85,89 **** this.show_populateForm(); ! base.ShowDialog(); } /// <summary> --- 85,89 ---- this.show_populateForm(); ! base.Show(); } /// <summary> |
|
From: Marco M. <mi...@us...> - 2005-04-14 18:33:44
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19250/b2_DataAccess/Tables Modified Files: Quotes.cs Log Message: Added new ITickerSelector object for advanced selection of tickers: with SelectorByWinningOpenToClose object it is now possible to choose tickers with a raw close greater than raw open at a given time interval within the specified group of tickers Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Quotes.cs 23 Mar 2005 21:28:42 -0000 1.22 --- Quotes.cs 14 Apr 2005 18:33:05 -0000 1.23 *************** *** 591,594 **** --- 591,620 ---- /// <summary> + /// returns tickers having raw close greater than raw open + /// at the given interval of days (within the given group of tickers). + /// Tickers are ordered by raw close to open ratio. + /// </summary> + public static DataTable GetTickersByWinningOpenToClose( bool orderInASCMode, string groupID, + DateTime firstQuoteDate, + DateTime lastQuoteDate, + long maxNumOfReturnedTickers) + { + string sql = "SELECT TOP " + maxNumOfReturnedTickers + " quotes.quTicker, tickers.tiCompanyName, " + + "quotes.quClose/quotes.quOpen AS CloseToOpenRatio " + + "FROM (quotes INNER JOIN tickers ON quotes.quTicker=tickers.tiTicker) " + + "INNER JOIN tickers_tickerGroups ON tickers.tiTicker=tickers_tickerGroups.ttTiId " + + "WHERE quotes.quDate Between " + SQLBuilder.GetDateConstant(firstQuoteDate) + " " + + "AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + " " + + "AND " + "tickers_tickerGroups.ttTgId='" + groupID + "' " + + "AND " + "quotes.quClose > quotes.quOpen " + + "ORDER BY quotes.quClose/quotes.quOpen"; + string sortDirection = " DESC"; + if(orderInASCMode) + sortDirection = " ASC"; + sql = sql + sortDirection; + return SqlExecutor.GetDataTable( sql ); + } + + /// <summary> /// returns the average traded value for the given ticker in the specified interval /// </summary> |
|
From: Marco M. <mi...@us...> - 2005-04-14 18:33:33
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19250/b3_Data/Selectors Modified Files: SelectionType.cs Added Files: SelectorByWinningOpenToClose.cs Log Message: Added new ITickerSelector object for advanced selection of tickers: with SelectorByWinningOpenToClose object it is now possible to choose tickers with a raw close greater than raw open at a given time interval within the specified group of tickers --- NEW FILE: SelectorByWinningOpenToClose.cs --- /* QuantProject - Quantitative Finance Library SelectorByWinningOpenToClose.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.Data; using System.Windows.Forms; using QuantProject.DataAccess.Tables; using QuantProject.Data.DataTables; namespace QuantProject.Data.Selectors { /// <summary> /// Class for selection of tickers which had raw close greater /// than raw open for the given interval of days /// </summary> public class SelectorByWinningOpenToClose : TickerSelector, ITickerSelector { public SelectorByWinningOpenToClose(DataTable setOfTickersToBeSelected, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(setOfTickersToBeSelected, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public SelectorByWinningOpenToClose(string groupID, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(groupID, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public DataTable GetTableOfSelectedTickers() { if(this.setOfTickersToBeSelected == null) return QuantProject.DataAccess.Tables.Quotes.GetTickersByWinningOpenToClose(this.isOrderedInASCMode, this.groupID, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers); else return new DataTable(); } public void SelectAllTickers() { ; } } } Index: SelectionType.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/SelectionType.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SelectionType.cs 28 Mar 2005 18:11:42 -0000 1.9 --- SelectionType.cs 14 Apr 2005 18:33:06 -0000 1.10 *************** *** 40,44 **** CloseToCloseLinearCorrelation, QuotedAtEachMarketDay, ! AverageRawOpenPrice } } --- 40,45 ---- CloseToCloseLinearCorrelation, QuotedAtEachMarketDay, ! AverageRawOpenPrice, ! WinningOpenToClose } } |
|
From: Marco M. <mi...@us...> - 2005-04-14 18:33:32
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19250/b3_Data Modified Files: b3_Data.csproj Log Message: Added new ITickerSelector object for advanced selection of tickers: with SelectorByWinningOpenToClose object it is now possible to choose tickers with a raw close greater than raw open at a given time interval within the specified group of tickers Index: b3_Data.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/b3_Data.csproj,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** b3_Data.csproj 23 Mar 2005 21:24:19 -0000 1.24 --- b3_Data.csproj 14 Apr 2005 18:33:22 -0000 1.25 *************** *** 283,286 **** --- 283,291 ---- /> <File + RelPath = "Selectors\SelectorByWinningOpenToClose.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Selectors\TickerSelector.cs" SubType = "Code" |
|
From: Marco M. <mi...@us...> - 2005-04-14 18:28:33
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Statistics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15526/b1_ADT/Statistics Modified Files: NormalDistribution.cs Log Message: Fixed minor bug Index: NormalDistribution.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Statistics/NormalDistribution.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NormalDistribution.cs 6 Feb 2005 20:08:55 -0000 1.2 --- NormalDistribution.cs 14 Apr 2005 18:28:24 -0000 1.3 *************** *** 33,37 **** public class NormalDistribution : IPdfDefiner { ! private double average; private double stdDeviation; --- 33,38 ---- public class NormalDistribution : IPdfDefiner { ! const int numIntForInfinityApproximation = 15; ! const int minimumIntervalsForAreaApproximation = 25; private double average; private double stdDeviation; *************** *** 47,53 **** this.average = average; this.stdDeviation = stdDeviation; ! this.infinity = this.average + 15 * stdDeviation ; this.numOfIntervalsForPDFIntegralApproximation = ! Convert.ToInt32(25*this.infinity); } /// <summary> --- 48,56 ---- this.average = average; this.stdDeviation = stdDeviation; ! this.infinity = this.average + ! numIntForInfinityApproximation * stdDeviation ; this.numOfIntervalsForPDFIntegralApproximation = ! Math.Max(Convert.ToInt32(this.infinity*minimumIntervalsForAreaApproximation), ! minimumIntervalsForAreaApproximation); } /// <summary> |
|
From: Marco M. <mi...@us...> - 2005-04-11 18:52:41
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5916/b7_Scripts/TickerSelectionTesting Modified Files: EndOfDayTimerHandlerCTC.cs EndOfDayTimerHandlerCTO.cs GenomeManagerForEfficientCTCPortfolio.cs GenomeManagerForEfficientCTOPortfolio.cs GenomeManagerForEfficientPortfolio.cs RunEfficientCTCPortfolio.cs RunEfficientCTOPortfolio.cs Added Files: EndOfDayTimerHandler.cs PortfolioType.cs RunEfficientPortfolio.cs Log Message: Reorganized efficient portfolio scripts in a more object oriented way, with three base classes from which the other classes derive. In addition, parameters have been added to Run files, in order to make it easy to run multiple scripts in one session. --- NEW FILE: PortfolioType.cs --- /* QuantProject - Quantitative Finance Library PortfolioType.cs Copyright (C) 2004 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; namespace QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios { /// <summary> /// Specifies what types of orders are to be added /// to portfolio /// </summary> public enum PortfolioType { OnlyLong, OnlyShort } } Index: EndOfDayTimerHandlerCTO.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTO.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** EndOfDayTimerHandlerCTO.cs 30 Mar 2005 16:07:28 -0000 1.6 --- EndOfDayTimerHandlerCTO.cs 11 Apr 2005 18:52:31 -0000 1.7 *************** *** 42,111 **** /// </summary> [Serializable] ! public class EndOfDayTimerHandlerCTO { - private DataTable eligibleTickers; - private string[] chosenTickers; - private string[] lastChosenTickers; - private string tickerGroupID; - private int numberOfEligibleTickers; - private int numberOfTickersToBeChosen; - private int numDaysForLiquidity; - private int generationNumberForGeneticOptimizer; - private int populationSizeForGeneticOptimizer; - - private Account account; - private ArrayList orders; - - private string benchmark; - //these two values have to be updated during - //backtest, for minimizing commission amount, - //according to broker's commission scheme - private double minPriceForMinimumCommission = 0; - private double maxPriceForMinimumCommission = 200; - - - public int NumberOfEligibleTickers - { - get { return this.numberOfEligibleTickers; } - } - - public Account Account - { - get { return this.account; } - } - public EndOfDayTimerHandlerCTO(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, ! string benchmark) { ! this.tickerGroupID = tickerGroupID; ! this.numberOfEligibleTickers = numberOfEligibleTickers; ! this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; ! this.numDaysForLiquidity = numDaysForLiquidity; ! this.account = account; ! this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; ! this.populationSizeForGeneticOptimizer = populationSizeForGeneticOptimizer; ! this.benchmark = benchmark; ! this.orders = new ArrayList(); ! this.chosenTickers = new string[numberOfTickersToBeChosen]; ! this.lastChosenTickers = new string[numberOfTickersToBeChosen]; } #region MarketOpenEventHandler ! ! private void marketOpenEventHandler_orderChosenTickers_addToOrderList_forTicker( ! string ticker ) ! { ! ! double cashForSinglePosition = this.account.CashAmount / this.numberOfTickersToBeChosen; ! long quantity = ! Convert.ToInt64( Math.Floor( cashForSinglePosition / this.account.DataStreamer.GetCurrentBid( ticker ) ) ); ! Order order = new Order( OrderType.MarketBuy, new Instrument( ticker ) , quantity ); ! this.orders.Add(order); ! } ! private void marketOpenEventHandler_orderChosenTickers_addToOrderList() { --- 42,66 ---- /// </summary> [Serializable] ! public class EndOfDayTimerHandlerCTO : EndOfDayTimerHandler { public EndOfDayTimerHandlerCTO(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, ! string benchmark, double targetReturn, ! PortfolioType portfolioType): ! base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, account, ! generationNumberForGeneticOptimizer, ! populationSizeForGeneticOptimizer, ! benchmark, targetReturn, ! portfolioType) { ! } #region MarketOpenEventHandler ! private void marketOpenEventHandler_orderChosenTickers_addToOrderList() { *************** *** 115,119 **** if(ticker != null) { ! marketOpenEventHandler_orderChosenTickers_addToOrderList_forTicker( ticker ); this.lastChosenTickers[idx] = ticker; } --- 70,74 ---- if(ticker != null) { ! this.AddOrderForTicker( ticker ); this.lastChosenTickers[idx] = ticker; } *************** *** 132,140 **** /// <param name="sender"></param> /// <param name="eventArgs"></param> ! public void MarketOpenEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { if(this.orders.Count == 0 && this.account.Transactions.Count == 0) ! this.account.AddCash(15000); this.marketOpenEventHandler_orderChosenTickers(); --- 87,95 ---- /// <param name="sender"></param> /// <param name="eventArgs"></param> ! public override void MarketOpenEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { if(this.orders.Count == 0 && this.account.Transactions.Count == 0) ! this.account.AddCash(17000); this.marketOpenEventHandler_orderChosenTickers(); *************** *** 169,173 **** } ! public void MarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { --- 124,128 ---- } ! public override void MarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { *************** *** 182,199 **** private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) { SelectorByAverageRawOpenPrice selectorByOpenPrice = new SelectorByAverageRawOpenPrice(this.tickerGroupID, false, currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfEligibleTickers, this.minPriceForMinimumCommission, ! this.maxPriceForMinimumCommission, 0, 1.5); DataTable tickersByPrice = selectorByOpenPrice.GetTableOfSelectedTickers(); ! SelectorByLiquidity mostLiquid = new SelectorByLiquidity(tickersByPrice, false, currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfEligibleTickers); this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); ! SelectorByQuotationAtEachMarketDay quotedInEachMarketDayFromMostLiquid = new SelectorByQuotationAtEachMarketDay( this.eligibleTickers, false, currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfEligibleTickers, this.benchmark); ! return quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); } --- 137,157 ---- private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) { + /* SelectorByAverageRawOpenPrice selectorByOpenPrice = new SelectorByAverageRawOpenPrice(this.tickerGroupID, false, currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfEligibleTickers, this.minPriceForMinimumCommission, ! this.maxPriceForMinimumCommission, 0, 2); DataTable tickersByPrice = selectorByOpenPrice.GetTableOfSelectedTickers(); ! */ ! ! SelectorByLiquidity mostLiquid = new SelectorByLiquidity(this.tickerGroupID, false, currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfEligibleTickers); this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromMostLiquid = new SelectorByQuotationAtEachMarketDay( this.eligibleTickers, false, currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfEligibleTickers, this.benchmark); ! return quotedAtEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); } *************** *** 209,214 **** { IGenomeManager genManEfficientCTOPortfolio = ! new GenomeManagerForEfficientCTOPortfolio(setOfTickersToBeOptimized, currentDate.AddDays(-30), ! currentDate, this.numberOfTickersToBeChosen, 1, 0.005); GeneticOptimizer GO = new GeneticOptimizer(genManEfficientCTOPortfolio); //GO.KeepOnRunningUntilConvergenceIsReached = true; --- 167,176 ---- { IGenomeManager genManEfficientCTOPortfolio = ! new GenomeManagerForEfficientCTOPortfolio(setOfTickersToBeOptimized, ! currentDate.AddDays(-this.numDaysForLiquidity), ! currentDate, ! this.numberOfTickersToBeChosen, ! this.targetReturn, ! this.portfolioType); GeneticOptimizer GO = new GeneticOptimizer(genManEfficientCTOPortfolio); //GO.KeepOnRunningUntilConvergenceIsReached = true; *************** *** 228,231 **** --- 190,195 ---- //according to IB Broker's commission scheme this.minPriceForMinimumCommission = this.account.CashAmount/(this.numberOfTickersToBeChosen*100); + this.maxPriceForMinimumCommission = this.maxPriceForMinimumCommission; + //just to avoid warning message } *************** *** 235,242 **** /// <param name="sender"></param> /// <param name="eventArgs"></param> ! public void OneHourAfterMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! this.oneHourAfterMarketCloseEventHandler_updatePrices(); this.setTickers(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime); //sets tickers to be chosen next Market Open event --- 199,206 ---- /// <param name="sender"></param> /// <param name="eventArgs"></param> ! public override void OneHourAfterMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! //this.oneHourAfterMarketCloseEventHandler_updatePrices(); this.setTickers(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime); //sets tickers to be chosen next Market Open event --- NEW FILE: EndOfDayTimerHandler.cs --- /* QuantProject - Quantitative Finance Library EndOfDayTimerHandler.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Data; using System.Collections; using QuantProject.ADT; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Timing; using QuantProject.Data.DataProviders; using QuantProject.Data.Selectors; using QuantProject.ADT.Optimizing.Genetic; namespace QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios { /// <summary> /// Base class for EndOfDayTimerHandlers for efficient portfolios /// </summary> [Serializable] public class EndOfDayTimerHandler { protected DataTable eligibleTickers; protected string[] chosenTickers; protected string[] lastChosenTickers; protected string tickerGroupID; protected int numberOfEligibleTickers; protected int numberOfTickersToBeChosen; protected int numDaysForLiquidity; protected int generationNumberForGeneticOptimizer; protected int populationSizeForGeneticOptimizer; protected Account account; protected ArrayList orders; protected string benchmark; //these two values have to be updated during //backtest, for minimizing commission amount, //according to broker's commission scheme protected double minPriceForMinimumCommission = 0; protected double maxPriceForMinimumCommission = 500; protected double targetReturn; protected PortfolioType portfolioType; public int NumberOfEligibleTickers { get { return this.numberOfEligibleTickers; } } public Account Account { get { return this.account; } } public EndOfDayTimerHandler(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, double targetReturn, PortfolioType portfolioType) { this.tickerGroupID = tickerGroupID; this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; this.numDaysForLiquidity = numDaysForLiquidity; this.account = account; this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; this.populationSizeForGeneticOptimizer = populationSizeForGeneticOptimizer; this.benchmark = benchmark; this.orders = new ArrayList(); this.chosenTickers = new string[numberOfTickersToBeChosen]; this.lastChosenTickers = new string[numberOfTickersToBeChosen]; this.targetReturn = targetReturn; this.portfolioType = portfolioType; } public virtual void AddOrderForTicker(string ticker ) { double cashForSinglePosition = this.account.CashAmount / this.numberOfTickersToBeChosen; long quantity = Convert.ToInt64( Math.Floor( cashForSinglePosition / this.account.DataStreamer.GetCurrentBid( ticker ) ) ); Order order; if(this.portfolioType == PortfolioType.OnlyLong) order = new Order( OrderType.MarketBuy, new Instrument( ticker ) , quantity ); else// only short orders are permitted order = new Order( OrderType.MarketSellShort, new Instrument( ticker ) , quantity ); this.orders.Add(order); } public virtual void MarketOpenEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ; } public virtual void MarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ; } public virtual void OneHourAfterMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ; } } // end of class } Index: RunEfficientCTCPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTCPortfolio.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RunEfficientCTCPortfolio.cs 6 Feb 2005 20:14:01 -0000 1.4 --- RunEfficientCTCPortfolio.cs 11 Apr 2005 18:52:31 -0000 1.5 *************** *** 57,180 **** /// </summary> [Serializable] ! public class RunEfficientCTCPorfolio : Script { ! ! private ReportTable reportTable; ! private EndOfDayDateTime startDateTime; ! private EndOfDayDateTime endDateTime; ! ! // private int numIntervalDays;// number of days for the equity line graph ! ! private IHistoricalQuoteProvider historicalQuoteProvider = ! new HistoricalAdjustedQuoteProvider(); ! ! ! //private ProgressBarForm progressBarForm; ! ! private EndOfDayTimerHandlerCTC endOfDayTimerHandler; ! ! private Account account; ! ! private IEndOfDayTimer endOfDayTimer; ! public RunEfficientCTCPorfolio() { ! //this.progressBarForm = new ProgressBarForm(); ! this.reportTable = new ReportTable( "Summary_Reports" ); ! this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2004 , 1 , 1 ) , EndOfDaySpecificTime.MarketOpen ); ! this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2004 , 3 , 31 ) , EndOfDaySpecificTime.MarketClose ); ! //this.numIntervalDays = 3; //for report ! } #region Run ! ! ! ! private void run_initializeEndOfDayTimer() ! { ! this.endOfDayTimer = ! new IndexBasedEndOfDayTimer( this.startDateTime, "^MIBTEL" ); ! } ! private void run_initializeAccount() ! { ! this.account = new Account( "EfficientCloseToClosePortfolio" , this.endOfDayTimer , ! new HistoricalEndOfDayDataStreamer( this.endOfDayTimer , ! this.historicalQuoteProvider ) , ! new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , ! this.historicalQuoteProvider ) ); ! ! } ! private void run_initializeEndOfDayTimerHandler() ! { ! this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTC("STOCKMI",70,5,3,this.account,10); ! } ! /* ! private void inSampleNewProgressEventHandler( ! Object sender , NewProgressEventArgs eventArgs ) ! { ! this.progressBarForm.ProgressBarInSample.Value = eventArgs.CurrentProgress; ! this.progressBarForm.ProgressBarInSample.Refresh(); ! } ! private void run_initializeProgressHandlers() ! { ! this.endOfDayTimerHandler.InSampleNewProgress += ! new InSampleNewProgressEventHandler( this.inSampleNewProgressEventHandler ); ! } ! */ ! #region oneHourAfterMarketCloseEventHandler ! /* ! private void oneHourAfterMarketCloseEventHandler_handleProgessBarForm( ! IEndOfDayTimer endOfDayTimer ) ! { ! long elapsedDays = Convert.ToInt64( ((TimeSpan)( endOfDayTimer.GetCurrentTime().DateTime - ! this.startDateTime.DateTime )).TotalDays ); ! long totalDays = Convert.ToInt64( ((TimeSpan)( this.endDateTime.DateTime - ! this.startDateTime.DateTime )).TotalDays ); ! if ( Math.Floor( elapsedDays / totalDays * 100 ) > ! Math.Floor( ( elapsedDays - 1 ) / totalDays * 100 ) ) ! // a new out of sample time percentage point has been elapsed ! this.progressBarForm.ProgressBarOutOfSample.Value = ! Convert.ToInt16( Math.Floor( elapsedDays / totalDays * 100 ) ); ! } ! public void oneHourAfterMarketCloseEventHandler( ! Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! this.oneHourAfterMarketCloseEventHandler_handleProgessBarForm( ! ( IEndOfDayTimer )sender ); ! if ( ( ( IEndOfDayTimer )sender ).GetCurrentTime().DateTime > ! this.endDateTime.DateTime ) ! { ! // the simulation has reached the ending date ! this.account.EndOfDayTimer.Stop(); ! this.progressBarForm.Close(); ! } } - */ - #endregion ! private void checkDateForReport(Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs) { ! Report report; ! ! if(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime>=this.endDateTime.DateTime ) ! { ! this.endOfDayTimer.Stop(); ! report = new Report( this.account , this.historicalQuoteProvider ); ! //report.Show("CTC_Portfolio" , this.numIntervalDays , this.endDateTime , "^MIBTEL" ); ! ObjectArchiver.Archive(this.account,"C:\\CtcPortfolio.qP"); ! ! } } public override void Run() { //old script //this.run_FindBestPortfolioForNextTrade(); ! run_initializeEndOfDayTimer(); run_initializeAccount(); run_initializeEndOfDayTimerHandler(); //run_initializeProgressHandlers(); this.endOfDayTimer.MarketOpen += --- 57,109 ---- /// </summary> [Serializable] ! public class RunEfficientCTCPorfolio : RunEfficientPorfolio { ! private int numDayOfPortfolioLife; ! public RunEfficientCTCPorfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, ! int generationNumberForGeneticOptimizer, ! int populationSizeForGeneticOptimizer, string benchmark, ! DateTime startDate, DateTime endDate, ! int numDaysOfPortfolioLife, double targetReturn, ! PortfolioType portfolioType): ! base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, ! generationNumberForGeneticOptimizer, ! populationSizeForGeneticOptimizer, benchmark, ! startDate, endDate, targetReturn, ! portfolioType) { ! this.ScriptName = "CloseToCloseScripts"; ! this.numDayOfPortfolioLife = numDaysOfPortfolioLife; } #region Run + ! protected override void run_initializeEndOfDayTimerHandler() { ! this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTC(this.tickerGroupID, this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, this.numDaysForLiquidity, ! this.account, ! this.generationNumberForGeneticOptimizer, ! this.populationSizeForGeneticOptimizer, this.benchmark, ! this.numDayOfPortfolioLife, this.targetReturn, ! this.portfolioType); } ! protected override void run_initializeHistoricalQuoteProvider() { ! this.historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); } + public override void Run() { //old script //this.run_FindBestPortfolioForNextTrade(); ! run_initializeHistoricalQuoteProvider(); run_initializeEndOfDayTimer(); run_initializeAccount(); run_initializeEndOfDayTimerHandler(); + //run_initializeProgressHandlers(); this.endOfDayTimer.MarketOpen += --- NEW FILE: RunEfficientPortfolio.cs --- /* QuantProject - Quantitative Finance Library RunEfficientPorfolio.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.IO; using System.Collections; using System.Data; using QuantProject.ADT; using QuantProject.ADT.Optimizing.Genetic; using QuantProject.ADT.FileManaging; using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Accounting.Reporting; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Scripting; using QuantProject.Business.Strategies; using QuantProject.Business.Testing; using QuantProject.Business.Timing; using QuantProject.Business.Financial.Accounting.Commissions; using QuantProject.Data.DataProviders; using QuantProject.Data.Selectors; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; using QuantProject.Presentation.Reporting.WindowsForm; namespace QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios { /// <summary> /// Base class for running efficient portfolio tests using genetic optimizer /// </summary> [Serializable] public class RunEfficientPorfolio { protected string tickerGroupID; protected int numberOfEligibleTickers; protected int numberOfTickersToBeChosen; protected int numDaysForLiquidity; protected int generationNumberForGeneticOptimizer; protected int populationSizeForGeneticOptimizer; protected ReportTable reportTable; protected EndOfDayDateTime startDateTime; protected EndOfDayDateTime endDateTime; //protected int numIntervalDays;// number of days for the equity line graph protected IHistoricalQuoteProvider historicalQuoteProvider; //protected ProgressBarForm progressBarForm; protected EndOfDayTimerHandler endOfDayTimerHandler; protected Account account; protected IEndOfDayTimer endOfDayTimer; protected string benchmark; protected string scriptName; protected double targetReturn; protected PortfolioType portfolioType; public virtual string ScriptName { get{return this.scriptName;} set{this.scriptName = value;} } public RunEfficientPorfolio(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, DateTime startDate, DateTime endDate, double targetReturn, PortfolioType portfolioType) { //this.progressBarForm = new ProgressBarForm(); this.tickerGroupID = tickerGroupID; this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; this.numDaysForLiquidity = numDaysForLiquidity; this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; this.populationSizeForGeneticOptimizer = populationSizeForGeneticOptimizer; this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( startDate, EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); this.endDateTime = new EndOfDayDateTime( endDate, EndOfDaySpecificTime.OneHourAfterMarketClose ); this.benchmark = benchmark; this.ScriptName = "EfficientGeneric"; this.targetReturn = targetReturn; this.portfolioType = portfolioType; //this.numIntervalDays = 3; } #region Run protected virtual void run_initializeEndOfDayTimer() { //default endOfDayTimer this.endOfDayTimer = new IndexBasedEndOfDayTimer( this.startDateTime, this.benchmark ); } protected virtual void run_initializeAccount() { //default account with no commissions this.account = new Account( this.scriptName , this.endOfDayTimer , new HistoricalEndOfDayDataStreamer( this.endOfDayTimer , this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , this.historicalQuoteProvider )); } protected virtual void run_initializeEndOfDayTimerHandler() { //always needs specific implementation in inherited classes; } protected virtual void run_initializeHistoricalQuoteProvider() { //always needs specific implementation in inherited classes; } private void checkDateForReport_createDirIfNotPresent(string dirPath) { if(!Directory.Exists(dirPath)) Directory.CreateDirectory(dirPath); } protected virtual void checkDateForReport(Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs) { //Report report; if(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime>=this.endDateTime.DateTime ) { this.endOfDayTimer.Stop(); string fileName = "From"+this.numberOfEligibleTickers + "LiqDays" + this.numDaysForLiquidity + "Portfolio" + this.numberOfTickersToBeChosen + "GenNum" + this.generationNumberForGeneticOptimizer + "PopSize" + this.populationSizeForGeneticOptimizer + "Target" + Convert.ToString(this.targetReturn) + Convert.ToString(this.portfolioType); string dirNameWhereToSaveReports = System.Configuration.ConfigurationSettings.AppSettings["ReportsArchive"] + "\\" + this.ScriptName + "\\"; string dirNameWhereToSaveAccounts = System.Configuration.ConfigurationSettings.AppSettings["AccountsArchive"] + "\\" + this.ScriptName + "\\"; //default report with numIntervalDays = 1 AccountReport accountReport = this.account.CreateReport(fileName,1,this.endDateTime,this.benchmark, new HistoricalAdjustedQuoteProvider()); this.checkDateForReport_createDirIfNotPresent(dirNameWhereToSaveReports); ObjectArchiver.Archive(accountReport, dirNameWhereToSaveReports + fileName + ".rep"); this.checkDateForReport_createDirIfNotPresent(dirNameWhereToSaveAccounts); ObjectArchiver.Archive(this.account, dirNameWhereToSaveAccounts + fileName + ".acc"); } } public virtual void Run() { run_initializeHistoricalQuoteProvider(); run_initializeEndOfDayTimer(); run_initializeAccount(); run_initializeEndOfDayTimerHandler(); //run_initializeProgressHandlers(); this.endOfDayTimer.MarketClose += new MarketCloseEventHandler( this.checkDateForReport); //add here TimerHandler's handlers to timer's events //example //this.endOfDayTimer.EVENT_NAME += // new EVENT_NAMEEventHandler( // this.endOfDayTimerHandler.EVENT_NAMEEventHandler); //this.progressBarForm.Show(); this.endOfDayTimer.Start(); } #endregion } } Index: EndOfDayTimerHandlerCTC.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTC.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EndOfDayTimerHandlerCTC.cs 27 Feb 2005 19:56:08 -0000 1.2 --- EndOfDayTimerHandlerCTC.cs 11 Apr 2005 18:52:30 -0000 1.3 *************** *** 42,86 **** /// </summary> [Serializable] ! public class EndOfDayTimerHandlerCTC { - private DataTable eligibleTickers; - private string[] chosenTickers; - private string[] lastChosenTickers; - - private string tickerGroupID; - private int numberOfEligibleTickers; - private int numberOfTickersToBeChosen; private int numDaysOfPortfolioLife; private int daysCounter; - private int generationNumberForGeneticOptimizer; - - private Account account; - private ArrayList orders; - - public int NumberOfEligibleTickers - { - get { return this.numberOfEligibleTickers; } - } - - public Account Account - { - get { return this.account; } - } - public EndOfDayTimerHandlerCTC(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysOfPortfolioLife, ! Account account, ! int generationNumberForGeneticOptimizer) { - this.tickerGroupID = tickerGroupID; - this.numberOfEligibleTickers = numberOfEligibleTickers; - this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; this.numDaysOfPortfolioLife = numDaysOfPortfolioLife; this.daysCounter = 0; - this.account = account; - this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; - this.orders = new ArrayList(); - this.chosenTickers = new string[numberOfTickersToBeChosen]; - this.lastChosenTickers = new string[numberOfTickersToBeChosen]; } --- 42,67 ---- /// </summary> [Serializable] ! public class EndOfDayTimerHandlerCTC : EndOfDayTimerHandler { private int numDaysOfPortfolioLife; private int daysCounter; public EndOfDayTimerHandlerCTC(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, ! Account account, ! int generationNumberForGeneticOptimizer, ! int populationSizeForGeneticOptimizer, ! string benchmark, ! int numDaysOfPortfolioLife, ! double targetReturn, ! PortfolioType portfolioType): ! base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, account, ! generationNumberForGeneticOptimizer, ! populationSizeForGeneticOptimizer, ! benchmark, targetReturn, ! portfolioType) { this.numDaysOfPortfolioLife = numDaysOfPortfolioLife; this.daysCounter = 0; } *************** *** 89,98 **** { SelectorByLiquidity mostLiquid = new SelectorByLiquidity(this.tickerGroupID,false, ! currentDate.AddDays(-90), currentDate, this.numberOfEligibleTickers); this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); SelectorByQuotationAtEachMarketDay quotedInEachMarketDayFromMostLiquid = new SelectorByQuotationAtEachMarketDay(this.eligibleTickers, ! false, currentDate.AddDays(-90),currentDate, ! this.numberOfEligibleTickers, "^MIBTEL"); return quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); } --- 70,79 ---- { SelectorByLiquidity mostLiquid = new SelectorByLiquidity(this.tickerGroupID,false, ! currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfEligibleTickers); this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); SelectorByQuotationAtEachMarketDay quotedInEachMarketDayFromMostLiquid = new SelectorByQuotationAtEachMarketDay(this.eligibleTickers, ! false, currentDate.AddDays(-this.numDaysForLiquidity),currentDate, ! this.numberOfEligibleTickers, this.benchmark); return quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); } *************** *** 107,115 **** { ! IGenomeManager genManEfficientCTCPortfolio = new GenomeManagerForEfficientCTCPortfolio(setOfTickersToBeOptimized, ! currentDate.AddDays(-90), currentDate, this.numberOfTickersToBeChosen, ! this.numDaysOfPortfolioLife, 0.01); GeneticOptimizer GO = new GeneticOptimizer(genManEfficientCTCPortfolio); //GO.KeepOnRunningUntilConvergenceIsReached = true; --- 88,102 ---- { ! ! //double targetReturnForEachPeriodOfPortfolioLife = ! // Math.Pow(1.60,(double)(1.0/(360.0/this.numDaysOfPortfolioLife))) - 1.0; ! //the target has to be such that annual system return is minimum 50% ! //(with no commissions and bid-ask spreads) ! IGenomeManager genManEfficientCTCPortfolio = new GenomeManagerForEfficientCTCPortfolio(setOfTickersToBeOptimized, ! currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfTickersToBeChosen, ! this.numDaysOfPortfolioLife, this.targetReturn, ! this.portfolioType); GeneticOptimizer GO = new GeneticOptimizer(genManEfficientCTCPortfolio); //GO.KeepOnRunningUntilConvergenceIsReached = true; *************** *** 127,131 **** /// <param name="sender"></param> /// <param name="eventArgs"></param> ! public void MarketOpenEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { --- 114,118 ---- /// <param name="sender"></param> /// <param name="eventArgs"></param> ! public override void MarketOpenEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { *************** *** 141,152 **** #region MarketCloseEventHandler ! private void marketCloseEventHandler_orderChosenTickers_addToOrderList_forTicker(string ticker) ! { ! double cashForSinglePosition = this.account.CashAmount / this.numberOfTickersToBeChosen; ! long quantity = ! Convert.ToInt64( Math.Floor( cashForSinglePosition / this.account.DataStreamer.GetCurrentBid( ticker ) ) ); ! Order order = new Order( OrderType.MarketBuy, new Instrument( ticker ) , quantity ); ! this.orders.Add(order); ! } private void marketCloseEventHandler_orderChosenTickers_addToOrderList() { --- 128,132 ---- #region MarketCloseEventHandler ! private void marketCloseEventHandler_orderChosenTickers_addToOrderList() { *************** *** 156,160 **** this.lastChosenTickers[idx] = ticker; if(ticker != null) ! marketCloseEventHandler_orderChosenTickers_addToOrderList_forTicker( ticker ); idx++; } --- 136,140 ---- this.lastChosenTickers[idx] = ticker; if(ticker != null) ! this.AddOrderForTicker( ticker ); idx++; } *************** *** 199,203 **** } ! public void MarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { --- 179,183 ---- } ! public override void MarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { Index: GenomeManagerForEfficientCTCPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForEfficientCTCPortfolio.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GenomeManagerForEfficientCTCPortfolio.cs 30 Jan 2005 19:53:12 -0000 1.1 --- GenomeManagerForEfficientCTCPortfolio.cs 11 Apr 2005 18:52:31 -0000 1.2 *************** *** 39,42 **** --- 39,43 ---- public class GenomeManagerForEfficientCTCPortfolio : GenomeManagerForEfficientPortfolio { + private int numDaysOfPortfolioLife; public GenomeManagerForEfficientCTCPortfolio(DataTable setOfInitialTickers, *************** *** 45,49 **** int numberOfTickersInPortfolio, int numDaysOfPortfolioLife, ! double targetPerformance) : base(setOfInitialTickers, --- 46,51 ---- int numberOfTickersInPortfolio, int numDaysOfPortfolioLife, ! double targetPerformance, ! PortfolioType portfolioType) : base(setOfInitialTickers, *************** *** 51,60 **** lastQuoteDate, numberOfTickersInPortfolio, ! numDaysOfPortfolioLife, ! targetPerformance) { ! } --- 53,63 ---- lastQuoteDate, numberOfTickersInPortfolio, ! targetPerformance, ! portfolioType) { ! this.numDaysOfPortfolioLife = numDaysOfPortfolioLife; ! this.retrieveData(); } Index: RunEfficientCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTOPortfolio.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** RunEfficientCTOPortfolio.cs 23 Mar 2005 21:35:37 -0000 1.16 --- RunEfficientCTOPortfolio.cs 11 Apr 2005 18:52:32 -0000 1.17 *************** *** 54,145 **** /// </summary> [Serializable] ! public class RunEfficientCTOPorfolio : Script { ! //DateTime lastDate = DateTime.Now.Date; ! //DateTime firstDate = DateTime.Now.Date.AddDays(-60); ! //these two members are used by the old script ! DateTime lastDate = new DateTime(2004,11,25); ! DateTime firstDate = new DateTime(2004,9,25); ! // ! private string tickerGroupID; ! private int numberOfEligibleTickers; ! private int numberOfTickersToBeChosen; ! private int numDaysForLiquidity; ! private int generationNumberForGeneticOptimizer; ! private int populationSizeForGeneticOptimizer; ! ! private ReportTable reportTable; ! private EndOfDayDateTime startDateTime; ! private EndOfDayDateTime endDateTime; ! //private int numIntervalDays;// number of days for the equity line graph ! private IHistoricalQuoteProvider historicalQuoteProvider = ! new HistoricalRawQuoteProvider(); ! ! ! //private ProgressBarForm progressBarForm; ! ! private EndOfDayTimerHandlerCTO endOfDayTimerHandler; ! ! private Account account; ! ! private IEndOfDayTimer endOfDayTimer; ! ! private string benchmark; ! ! public RunEfficientCTOPorfolio(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, ! DateTime startDate, DateTime endDate) { ! //this.progressBarForm = new ProgressBarForm(); ! this.tickerGroupID = tickerGroupID; ! this.numberOfEligibleTickers = numberOfEligibleTickers; ! this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; ! this.numDaysForLiquidity = numDaysForLiquidity; ! this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; ! this.populationSizeForGeneticOptimizer = populationSizeForGeneticOptimizer; ! this.reportTable = new ReportTable( "Summary_Reports" ); ! this.startDateTime = new EndOfDayDateTime( ! startDate, EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); ! this.endDateTime = new EndOfDayDateTime( ! endDate, EndOfDaySpecificTime.OneHourAfterMarketClose ); ! this.benchmark = benchmark; ! //this.numIntervalDays = 3; } - #region Run ! ! private void run_FindBestPortfolioForNextTrade() ! { ! //"STOCKMI" ! /* ! * SelectorByLiquidity mostLiquid = new TickerSelector(SelectionType.Liquidity, ! false, "STOCKMI", firstDate, lastDate, 70); ! DataTable tickers = mostLiquid.GetTableOfSelectedTickers(); ! IGenomeManager genManEfficientCTOPortfolio = ! new GenomeManagerForEfficientCTOPortfolio(tickers,firstDate, ! lastDate, 6,1, 0.005); ! GeneticOptimizer GO = new GeneticOptimizer(genManEfficientCTOPortfolio); ! //GO.KeepOnRunningUntilConvergenceIsReached = true; ! GO.GenerationNumber = 10; ! GO.MutationRate = 0.05; ! GO.Run(true); ! //it has to be changed the decode implementation for this IGenomeManager ! System.Console.WriteLine("\n\nThe best solution found is: " + (string)GO.BestGenome.Meaning + ! " with {0} generations", GO.GenerationCounter); ! */ ! ; ! } ! ! private void run_initializeEndOfDayTimer() ! { ! this.endOfDayTimer = ! new IndexBasedEndOfDayTimer( this.startDateTime, this.benchmark ); ! } ! private void run_initializeAccount() { ! this.account = new Account( "EfficientCloseToOpenPortfolio" , this.endOfDayTimer , new HistoricalEndOfDayDataStreamer( this.endOfDayTimer , this.historicalQuoteProvider ) , --- 54,82 ---- /// </summary> [Serializable] ! public class RunEfficientCTOPorfolio : RunEfficientPorfolio { ! public RunEfficientCTOPorfolio(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, ! DateTime startDate, DateTime endDate, double targetReturn, ! PortfolioType portfolioType): ! base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, ! generationNumberForGeneticOptimizer, ! populationSizeForGeneticOptimizer, benchmark, ! startDate, endDate, targetReturn, ! portfolioType) { ! this.ScriptName = "OpenCloseScripts"; } ! #region Run ! ! /* ! protected override void run_initializeAccount() { ! this.account = new Account( this.ScriptName , this.endOfDayTimer , new HistoricalEndOfDayDataStreamer( this.endOfDayTimer , this.historicalQuoteProvider ) , *************** *** 148,152 **** } ! private void run_initializeEndOfDayTimerHandler() { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTO(this.tickerGroupID, --- 85,91 ---- } ! */ ! ! protected override void run_initializeEndOfDayTimerHandler() { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTO(this.tickerGroupID, *************** *** 157,245 **** this.generationNumberForGeneticOptimizer, this.populationSizeForGeneticOptimizer, ! this.benchmark); } - /* - private void inSampleNewProgressEventHandler( - Object sender , NewProgressEventArgs eventArgs ) - { - this.progressBarForm.ProgressBarInSample.Value = eventArgs.CurrentProgress; - this.progressBarForm.ProgressBarInSample.Refresh(); - } - private void run_initializeProgressHandlers() - { - this.endOfDayTimerHandler.InSampleNewProgress += - new InSampleNewProgressEventHandler( this.inSampleNewProgressEventHandler ); - } - */ - #region oneHourAfterMarketCloseEventHandler - /* - private void oneHourAfterMarketCloseEventHandler_handleProgessBarForm( - IEndOfDayTimer endOfDayTimer ) - { - long elapsedDays = Convert.ToInt64( ((TimeSpan)( endOfDayTimer.GetCurrentTime().DateTime - - this.startDateTime.DateTime )).TotalDays ); - long totalDays = Convert.ToInt64( ((TimeSpan)( this.endDateTime.DateTime - - this.startDateTime.DateTime )).TotalDays ); - if ( Math.Floor( elapsedDays / totalDays * 100 ) > - Math.Floor( ( elapsedDays - 1 ) / totalDays * 100 ) ) - // a new out of sample time percentage point has been elapsed - this.progressBarForm.ProgressBarOutOfSample.Value = - Convert.ToInt16( Math.Floor( elapsedDays / totalDays * 100 ) ); - } - public void oneHourAfterMarketCloseEventHandler( - Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) - { - this.oneHourAfterMarketCloseEventHandler_handleProgessBarForm( - ( IEndOfDayTimer )sender ); - if ( ( ( IEndOfDayTimer )sender ).GetCurrentTime().DateTime > - this.endDateTime.DateTime ) - { - // the simulation has reached the ending date - this.account.EndOfDayTimer.Stop(); - this.progressBarForm.Close(); - } - } - */ - #endregion ! private void checkDateForReport(Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs) { ! //Report report; ! ! if(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime>=this.endDateTime.DateTime ) ! { ! this.endOfDayTimer.Stop(); ! //report = new Report( this.account , this.historicalQuoteProvider ); ! //report.Show("CTO_Portfolio" , this.numIntervalDays , this.endDateTime , this.benchmark ); ! string name = "From"+this.numberOfEligibleTickers + ! "LiqDays" + this.numDaysForLiquidity + "Portfolio" + ! this.numberOfTickersToBeChosen + "GenNum" + ! this.generationNumberForGeneticOptimizer + ! "PopSize" + this.populationSizeForGeneticOptimizer; ! AccountReport accountReport = this.account.CreateReport(name,1,this.endDateTime,this.benchmark, ! new HistoricalAdjustedQuoteProvider()); ! ObjectArchiver.Archive(accountReport, ! System.Configuration.ConfigurationSettings.AppSettings["ReportsArchive"] + ! "\\OpenCloseScripts\\" + ! name + ".rep"); - ObjectArchiver.Archive(this.account, - System.Configuration.ConfigurationSettings.AppSettings["AccountsArchive"] + - "\\OpenCloseScripts\\" + - name + ".acc"); - - } } public override void Run() { ! //old script ! //this.run_FindBestPortfolioForNextTrade(); ! run_initializeEndOfDayTimer(); run_initializeAccount(); run_initializeEndOfDayTimerHandler(); ! //run_initializeProgressHandlers(); this.endOfDayTimer.MarketOpen += new MarketOpenEventHandler( --- 96,120 ---- this.generationNumberForGeneticOptimizer, this.populationSizeForGeneticOptimizer, ! this.benchmark, ! this.targetReturn, ! this.portfolioType); } ! protected override void run_initializeHistoricalQuoteProvider() { ! this.historicalQuoteProvider = ! new HistoricalRawQuoteProvider(); } + public override void Run() { ! run_initializeHistoricalQuoteProvider(); run_initializeEndOfDayTimer(); run_initializeAccount(); run_initializeEndOfDayTimerHandler(); ! this.endOfDayTimer.MarketOpen += new MarketOpenEventHandler( *************** *** 257,265 **** new OneHourAfterMarketCloseEventHandler( this.endOfDayTimerHandler.OneHourAfterMarketCloseEventHandler ); - //this.endOfDayTimer.OneHourAfterMarketClose += - //new OneHourAfterMarketCloseEventHandler( - //this.oneHourAfterMarketCloseEventHandler ); - //this.progressBarForm.Show(); this.endOfDayTimer.Start(); --- 132,136 ---- Index: GenomeManagerForEfficientPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForEfficientPortfolio.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GenomeManagerForEfficientPortfolio.cs 6 Feb 2005 20:14:01 -0000 1.3 --- GenomeManagerForEfficientPortfolio.cs 11 Apr 2005 18:52:31 -0000 1.4 *************** *** 45,52 **** protected DateTime firstQuoteDate; protected DateTime lastQuoteDate; - protected int numDaysOfPortfolioLife; protected double targetPerformance; protected double variance; protected double rateOfReturn; //IGenomeManager implementation for properties --- 45,52 ---- protected DateTime firstQuoteDate; protected DateTime lastQuoteDate; protected double targetPerformance; protected double variance; protected double rateOfReturn; + protected PortfolioType portfolioType; //IGenomeManager implementation for properties *************** *** 77,86 **** } ! public GenomeManagerForEfficientPortfolio( DataTable setOfInitialTickers, ! DateTime firstQuoteDate, ! DateTime lastQuoteDate, ! int numberOfTickersInPortfolio, ! int numDaysOfPortfolioLife, ! double targetPerformance) { --- 77,92 ---- } ! public PortfolioType PortfolioType ! { ! get{return this.portfolioType;} ! set{this.portfolioType = value;} ! } ! ! public GenomeManagerForEfficientPortfolio(DataTable setOfInitialTickers, ! DateTime firstQuoteDate, ! DateTime lastQuoteDate, ! int numberOfTickersInPortfolio, ! double targetPerformance, ! PortfolioType portfolioType) { *************** *** 93,102 **** this.targetPerformance = targetPerformance; this.genomeSize = numberOfTickersInPortfolio; - this.numDaysOfPortfolioLife = numDaysOfPortfolioLife; //each genes is the index for the setOfTickers table this.minValueForGenes = 0; this.maxValueForGenes = this.setOfTickers.Rows.Count - 1; ! ! this.retrieveData(); } --- 99,106 ---- this.targetPerformance = targetPerformance; this.genomeSize = numberOfTickersInPortfolio; //each genes is the index for the setOfTickers table this.minValueForGenes = 0; this.maxValueForGenes = this.setOfTickers.Rows.Count - 1; ! this.portfolioType = portfolioType; } *************** *** 110,115 **** NormalDistribution normal = new NormalDistribution(portfolioRateOfReturn, Math.Sqrt(portfolioVariance)); ! returnValue = normal.GetProbability(this.targetPerformance*0.75,this.targetPerformance*1.25); ! //returnValue = 1 - normal.GetProbability(this.targetPerformance); return returnValue; } --- 114,122 ---- NormalDistribution normal = new NormalDistribution(portfolioRateOfReturn, Math.Sqrt(portfolioVariance)); ! if(this.portfolioType == PortfolioType.OnlyLong) ! returnValue = normal.GetProbability(this.targetPerformance*0.75,this.targetPerformance*1.25); ! else//only short orders are permitted ! returnValue = normal.GetProbability(-this.targetPerformance*1.25,-this.targetPerformance*0.75); ! return returnValue; } *************** *** 218,221 **** --- 225,229 ---- } } + //this protected method can be overriden by inherited classes //which can specify the type of rates of return *************** *** 250,254 **** returnValue += BasicFunctions.SimpleAverage((float[])this.setOfTickers.Rows[idx]["ArrayOfRatesOfReturn"]); } ! //the investement is assumed to be equally divided return (returnValue/this.GenomeSize); } --- 258,262 ---- returnValue += BasicFunctions.SimpleAverage((float[])this.setOfTickers.Rows[idx]["ArrayOfRatesOfReturn"]); } ! //the investment is assumed to be equally divided return (returnValue/this.GenomeSize); } Index: GenomeManagerForEfficientCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForEfficientCTOPortfolio.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Genome... [truncated message content] |
|
From: Marco M. <mi...@us...> - 2005-04-11 18:52:40
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5916/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: Reorganized efficient portfolio scripts in a more object oriented way, with three base classes from which the other classes derive. In addition, parameters have been added to Run files, in order to make it easy to run multiple scripts in one session. Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** b7_Scripts.csproj 20 Feb 2005 00:08:38 -0000 1.23 --- b7_Scripts.csproj 11 Apr 2005 18:52:32 -0000 1.24 *************** *** 154,157 **** --- 154,162 ---- /> <File + RelPath = "TickerSelectionTesting\EndOfDayTimerHandler.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TickerSelectionTesting\EndOfDayTimerHandlerCTC.cs" SubType = "Code" *************** *** 179,182 **** --- 184,192 ---- /> <File + RelPath = "TickerSelectionTesting\PortfolioType.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TickerSelectionTesting\RunEfficientCTCPortfolio.cs" SubType = "Code" *************** *** 189,192 **** --- 199,207 ---- /> <File + RelPath = "TickerSelectionTesting\RunEfficientPortfolio.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "WalkForwardTesting\MSFTwalkForward\TsMSFTwalkForward.cs" SubType = "Code" |
|
From: Marco M. <mi...@us...> - 2005-04-11 18:46:13
|
Update of /cvsroot/quantproject/QuantProject/b91_QuantProject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1848/b91_QuantProject Modified Files: QuantProject.prjx Log Message: Updated SharpDevelop project files Index: QuantProject.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b91_QuantProject/QuantProject.prjx,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** QuantProject.prjx 30 Mar 2005 16:07:28 -0000 1.3 --- QuantProject.prjx 11 Apr 2005 18:45:49 -0000 1.4 *************** *** 17,21 **** <DeploymentInformation target="" script="" strategy="File" /> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon=".\App.ico" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="False" /> <Output directory="..\bin\Debug" assembly="QuantProject" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> --- 17,21 ---- <DeploymentInformation target="" script="" strategy="File" /> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="WinExe" definesymbols="" generatexmldocumentation="False" win32Icon=".\App.ico" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="False" /> <Output directory="..\bin\Debug" assembly="QuantProject" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> *************** *** 23,32 **** <Configurations active="Debug"> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon=".\App.ico" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="False" /> <Output directory="..\bin\Debug" assembly="QuantProject" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="" target="Exe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="False" /> <Output directory="..\bin\Release" assembly="QuantProject" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> --- 23,32 ---- <Configurations active="Debug"> <Configuration runwithwarnings="True" name="Debug"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="True" optimize="False" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" target="WinExe" definesymbols="" generatexmldocumentation="False" win32Icon=".\App.ico" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="False" /> <Output directory="..\bin\Debug" assembly="QuantProject" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> </Configuration> <Configuration runwithwarnings="True" name="Release"> ! <CodeGeneration runtime="MsNet" compiler="Csc" compilerversion="Standard" warninglevel="4" nowarn="" includedebuginformation="False" optimize="True" unsafecodeallowed="False" generateoverflowchecks="False" mainclass="" target="WinExe" definesymbols="" generatexmldocumentation="False" win32Icon="" noconfig="False" nostdlib="False" /> <Execution commandlineparameters="" consolepause="False" /> <Output directory="..\bin\Release" assembly="QuantProject" executeScript="" executeBeforeBuild="" executeAfterBuild="" executeBeforeBuildArguments="" executeAfterBuildArguments="" /> |
|
From: Marco M. <mi...@us...> - 2005-04-11 18:46:12
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1848/b7_Scripts Modified Files: Scripts.prjx Log Message: Updated SharpDevelop project files Index: Scripts.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/Scripts.prjx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Scripts.prjx 17 Mar 2005 18:45:04 -0000 1.1 --- Scripts.prjx 11 Apr 2005 18:45:49 -0000 1.2 *************** *** 26,29 **** --- 26,32 ---- <File name=".\WalkForwardTesting\WalkForwardOneRank\ProgressBarForm.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\WalkForwardTesting\WalkForwardOneRank\RunWalkForwardOneRank.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\TickerSelectionTesting\EndOfDayTimerHandler.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\TickerSelectionTesting\RunEfficientPortfolio.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\TickerSelectionTesting\PortfolioType.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References> |
|
From: Marco M. <mi...@us...> - 2005-04-11 18:45:58
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1848/b5_Presentation Modified Files: Presentation.prjx Log Message: Updated SharpDevelop project files Index: Presentation.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Presentation.prjx,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Presentation.prjx 28 Mar 2005 18:05:04 -0000 1.2 --- Presentation.prjx 11 Apr 2005 18:45:49 -0000 1.3 *************** *** 17,21 **** </Contents> <References> ! <Reference type="Assembly" refto="..\..\scpl.dll" localcopy="True" /> <Reference type="Project" refto="b1_ADT" localcopy="True" /> <Reference type="Project" refto="b2_DataAccess" localcopy="True" /> --- 17,21 ---- </Contents> <References> ! <Reference type="Assembly" refto="..\..\NPlot.dll" localcopy="True" /> <Reference type="Project" refto="b1_ADT" localcopy="True" /> <Reference type="Project" refto="b2_DataAccess" localcopy="True" /> |
|
From: Marco M. <mi...@us...> - 2005-04-11 18:45:57
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1848/b4_Business Modified Files: Business.prjx Log Message: Updated SharpDevelop project files Index: Business.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/Business.prjx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Business.prjx 17 Mar 2005 18:45:03 -0000 1.1 --- Business.prjx 11 Apr 2005 18:45:48 -0000 1.2 *************** *** 44,48 **** <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\AverageShortTradePercentageReturn.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\AverageTradePercentageReturn.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> - <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\BuyAndHoldPercentageReturn.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\LargestLosingTradePercentage.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\LargestWinningTradePercentage.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> --- 44,47 ---- *************** *** 84,87 **** --- 83,87 ---- <File name=".\a3_Testing\WalkForwardTester.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\a4_Scripting\Script.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\BenchmarkPercentageReturn.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References> |
|
From: Glauco S. <gla...@us...> - 2005-04-03 22:45:36
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/QuotesEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9927/Downloader/QuotesEditor Modified Files: VisualValidationChart.cs Log Message: Zoom in and Zoom out are available now, both in VisualCloseToCloseValidation and in VisualRangeToRange validation. Index: VisualValidationChart.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/QuotesEditor/VisualValidationChart.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** VisualValidationChart.cs 9 May 2004 16:27:52 -0000 1.4 --- VisualValidationChart.cs 3 Apr 2005 22:45:11 -0000 1.5 *************** *** 26,29 **** --- 26,30 ---- { this.suspiciousDateTime = value; + this.SetHistories(); this.Invalidate(); } *************** *** 43,46 **** --- 44,53 ---- } + public void SetHistories() + { + this.Clear(); + this.addHistories(); + } + protected void add( History history , Color color ) { *************** *** 70,75 **** { Console.WriteLine( "VisualValidationChart.OnPaint()" ); ! this.Clear(); ! this.addHistories(); // this.history = DataProvider.GetCloseHistory( ((QuotesEditor)this.FindForm()).Ticker ); // this.onPaint_setTimeInterval(); --- 77,82 ---- { Console.WriteLine( "VisualValidationChart.OnPaint()" ); ! // this.Clear(); ! // this.addHistories(); // this.history = DataProvider.GetCloseHistory( ((QuotesEditor)this.FindForm()).Ticker ); // this.onPaint_setTimeInterval(); |
|
From: Marco M. <mar...@li...> - 2005-04-03 19:19:06
|
----- Original Message ----- From: "Glauco Siliprandi" <gla...@us...> To: <Qua...@li...> Sent: Sunday, April 03, 2005 2:02 AM Subject: [Quantproject-developers] QuantDownloader/Downloader/QuotesEditor QuotesChart.cs,1.5,1.6 > Update of /cvsroot/quantproject/QuantDownloader/Downloader/QuotesEditor > In directory > sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9260/Downloader/QuotesEditor > > Modified Files: > QuotesChart.cs > Log Message: > - Close was used, AdjustedClose is used now (Millo, this was > the reason why you were looking at so many "suspicious" > adjusted quotes: they were not adjusted... sorry) Don't worry, Glauco: that's a good news! Now, I will trust more these adjusted values ... > - the quote's history is now computed just once, when > the ticker is assigned. In the previous version, > it was computed on each OnPaint event. As a consequence, > not it is more efficient. Furthermore, now zoom feature is available. > > Index: QuotesChart.cs > =================================================================== > RCS file: > /cvsroot/quantproject/QuantDownloader/Downloader/QuotesEditor/QuotesChart.cs,v > retrieving revision 1.5 > retrieving revision 1.6 > diff -C2 -d -r1.5 -r1.6 > *** QuotesChart.cs 29 Mar 2005 14:57:31 -0000 1.5 > --- QuotesChart.cs 3 Apr 2005 00:02:53 -0000 1.6 > *************** > *** 41,52 **** > { > get { return this.ticker; } > ! set { this.ticker = value; } > } > > public QuotesChart() > { > - // > - // TODO: Add constructor logic here > - // > } > > --- 41,54 ---- > { > get { return this.ticker; } > ! set > ! { > ! this.ticker = value; > ! this.Clear(); > ! this.Add( HistoricalDataProvider.GetAdjustedCloseHistory( > this.ticker ) ); > ! } > } > > public QuotesChart() > { > } > > *************** > *** 54,59 **** > { > Console.WriteLine( "QuotesChart.PaintingHandler()" ); > ! this.Clear(); > ! this.Add( HistoricalDataProvider.GetCloseHistory( this.ticker ) ); > base.OnPaint( e ); > } > --- 56,61 ---- > { > Console.WriteLine( "QuotesChart.PaintingHandler()" ); > ! // this.Clear(); > ! // this.Add( HistoricalDataProvider.GetCloseHistory( > this.ticker ) ); > base.OnPaint( e ); > } > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Quantproject-developers mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantproject-developers |
|
From: Glauco S. <gla...@us...> - 2005-04-03 00:04:51
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Charting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9721/b5_Presentation/Charting Modified Files: Chart.cs Log Message: Each ChartPlot is now computed just once. In the previous version, it was computed on each OnPaint event. As a consequence, not it is more efficient. Furthermore, now zoom feature is available. Index: Chart.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Charting/Chart.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Chart.cs 29 Mar 2005 15:03:16 -0000 1.5 --- Chart.cs 3 Apr 2005 00:04:41 -0000 1.6 *************** *** 41,44 **** --- 41,48 ---- { this.chartPlots = new ArrayList(); + this.AllowSelection = true; + this.AutoScaleAutoGeneratedAxes = false; + this.RightMenu = NPlot.Windows.PlotSurface2D.DefaultContextMenu; + // this.Paint += new System.Windows.Forms.PaintEventHandler(this.Chart_Paint); } *************** *** 57,60 **** --- 61,65 ---- ChartPlot chartPlot = new ChartPlot( history , Color.Red ); this.chartPlots.Add( chartPlot ); + this.addChartPlot( chartPlot ); } public void Add( History history , Color color ) *************** *** 62,65 **** --- 67,71 ---- ChartPlot chartPlot = new ChartPlot( history , color ); this.chartPlots.Add( chartPlot ); + this.addChartPlot( chartPlot ); } /// <summary> *************** *** 75,81 **** ChartPlot chartPlot = new ChartPlot( history , color , startDateTime , endDateTime ); this.chartPlots.Add( chartPlot ); } ! #region "OnPaint" ! private void onPaint_addLinePlot_ok( ChartPlot chartPlot ) { int npt=chartPlot.History.Count; --- 81,87 ---- ChartPlot chartPlot = new ChartPlot( history , color , startDateTime , endDateTime ); this.chartPlots.Add( chartPlot ); + this.addChartPlot( chartPlot ); } ! private void addChartPlot( ChartPlot chartPlot ) { int npt=chartPlot.History.Count; *************** *** 108,142 **** this.Add(lp); } - private void onPaint_addLinePlot( ChartPlot chartPlot ) - { - int npt=chartPlot.History.Count; - int startIndex = chartPlot.History.IndexOfKeyOrPrevious( chartPlot.StartDateTime ); - int endIndex = chartPlot.History.IndexOfKeyOrPrevious( chartPlot.EndDateTime ); - int plotLength = endIndex - startIndex + 1; - float [] x = new float[ plotLength ]; - float [] y = new float[ plotLength ]; - - float step=1.0F; - for ( int i=startIndex ; i<=endIndex ; i++ ) - { - x[i-startIndex]=i*step; - y[i-startIndex]=(float)chartPlot.History.GetByIndex( i ); - } - - // LinePlot lp=new LinePlot( new ArrayAdapter(x,y) ); commentata per avere compilazione; rimuovi commenti per farlo funzionare con la vecchia scpl - Pen p=new Pen( chartPlot.Color ); - // lp.Pen=p; - - // base.Clear(); - // this.Add(lp); - } protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { Console.WriteLine( "Chart.OnPaint()" ); ! foreach ( ChartPlot chartPlot in this.chartPlots ) ! onPaint_addLinePlot_ok( chartPlot ); base.OnPaint( e ); } - #endregion } } --- 114,124 ---- this.Add(lp); } protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { Console.WriteLine( "Chart.OnPaint()" ); ! // foreach ( ChartPlot chartPlot in this.chartPlots ) ! // onPaint_addLinePlot_ok( chartPlot ); base.OnPaint( e ); } } } |