quantproject-developers Mailing List for QuantProject (Page 132)
Brought to you by:
glauco_1
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
(103) |
Dec
(67) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(52) |
Feb
(9) |
Mar
(69) |
Apr
(53) |
May
(80) |
Jun
(23) |
Jul
(24) |
Aug
(112) |
Sep
(9) |
Oct
|
Nov
(58) |
Dec
(93) |
| 2005 |
Jan
(90) |
Feb
(93) |
Mar
(61) |
Apr
(56) |
May
(37) |
Jun
(61) |
Jul
(55) |
Aug
(68) |
Sep
(25) |
Oct
(46) |
Nov
(41) |
Dec
(37) |
| 2006 |
Jan
(33) |
Feb
(7) |
Mar
(19) |
Apr
(27) |
May
(73) |
Jun
(49) |
Jul
(83) |
Aug
(66) |
Sep
(45) |
Oct
(16) |
Nov
(15) |
Dec
(7) |
| 2007 |
Jan
(14) |
Feb
(33) |
Mar
|
Apr
(21) |
May
|
Jun
(34) |
Jul
(18) |
Aug
(100) |
Sep
(39) |
Oct
(55) |
Nov
(12) |
Dec
(2) |
| 2008 |
Jan
(120) |
Feb
(133) |
Mar
(129) |
Apr
(104) |
May
(42) |
Jun
(2) |
Jul
(52) |
Aug
(99) |
Sep
(134) |
Oct
|
Nov
(137) |
Dec
(48) |
| 2009 |
Jan
(48) |
Feb
(55) |
Mar
(61) |
Apr
(3) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(51) |
Sep
|
Oct
(7) |
Nov
|
Dec
|
| 2010 |
Jan
(7) |
Feb
(1) |
Mar
(145) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(8) |
Dec
|
| 2011 |
Jan
(78) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(88) |
Sep
(6) |
Oct
(1) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:37:47
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22600/b3_Data Modified Files: b3_Data.csproj Log Message: Automatic changes by vsnet Index: b3_Data.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/b3_Data.csproj,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** b3_Data.csproj 25 Jul 2004 12:04:05 -0000 1.7 --- b3_Data.csproj 1 Aug 2004 00:37:38 -0000 1.8 *************** *** 117,120 **** --- 117,136 ---- HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll" /> + <Reference + Name = "stdole" + Guid = "{00020430-0000-0000-C000-000000000046}" + VersionMajor = "2" + VersionMinor = "0" + Lcid = "0" + WrapperTool = "primary" + /> + <Reference + Name = "Microsoft.Office.Core" + Guid = "{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}" + VersionMajor = "2" + VersionMinor = "3" + Lcid = "0" + WrapperTool = "primary" + /> </References> </Build> |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:36:07
|
Update of /cvsroot/quantproject/QuantProject/b91_QuantProject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22360/b91_QuantProject Modified Files: Main.cs Log Message: RunOneRankWithWindowsReport is the default script now Index: Main.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b91_QuantProject/Main.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Main.cs 17 Apr 2004 14:02:09 -0000 1.4 --- Main.cs 1 Aug 2004 00:35:58 -0000 1.5 *************** *** 224,231 **** //try { ! //new RunMSFTsimpleTest().Run(); ! new RunMSFTsimpleTest_2().Run(); ! //new RunOneRank().Run(); ! //new RunMSFTwalkForward().Run(); //new RunMultiTestOneRank().Run(); --- 224,232 ---- //try { ! // new RunMSFTsimpleTest().Run(); ! // new RunMSFTsimpleTest_2().Run(); ! //new RunOneRankWithExcelReport().Run(); ! new RunOneRankWithWindowsReport().Run(); ! //new RunMSFTwalkForward().Run(); //new RunMultiTestOneRank().Run(); |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:35:03
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22224/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables Modified Files: Summary.cs Log Message: Added pubblic classes to allow external objects to access all account summary values Index: Summary.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables/Summary.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Summary.cs 28 Nov 2003 16:19:58 -0000 1.7 --- Summary.cs 1 Aug 2004 00:34:49 -0000 1.8 *************** *** 18,22 **** private double finalAccountValue; private long intervalDays; ! public AccountReport AccountReport { get { return accountReport; } --- 18,33 ---- private double finalAccountValue; private long intervalDays; ! private MaxEquityDrawDown maxEquityDrawDown; ! private TotalNumberOfTrades totalNumberOfTrades; ! private NumberWinningTrades numberWinningTrades; ! private AverageTradePercentageReturn averageTradePercentageReturn; ! private LargestWinningTradePercentage largestWinningTradePercentage; ! private LargestLosingTradePercentage largestLosingTradePercentage; ! private NumberWinningLongTrades numberWinningLongTrades; ! private AverageLongTradePercentageReturn averageLongTradePercentageReturn; ! private NumberWinningShortTrades numberWinningShortTrades; ! private TotalNumberOfLongTrades totalNumberOfLongTrades; ! private TotalNumberOfShortTrades totalNumberOfShortTrades; ! public AccountReport AccountReport { get { return accountReport; } *************** *** 41,44 **** --- 52,101 ---- public double ReturnOnAccount; public double AnnualSystemPercentageReturn; + public double MaxEquityDrawDown + { + get { return (double)this.maxEquityDrawDown.rowValue; } + } + public double TotalNumberOfTrades + { + get { return (int)this.totalNumberOfTrades.rowValue; } + } + public double NumberWinningTrades + { + get { return (long)this.numberWinningTrades.rowValue; } + } + public double AverageTradePercentageReturn + { + get { return (double)this.averageTradePercentageReturn.rowValue; } + } + public double LargestWinningTradePercentage + { + get { return (double)this.largestWinningTradePercentage.rowValue; } + } + public double LargestLosingTradePercentage + { + get { return (double)this.largestLosingTradePercentage.rowValue; } + } + public double NumberWinningLongTrades + { + get { return (int)this.numberWinningLongTrades.rowValue; } + } + public double AverageLongTradePercentageReturn + { + get { return (double)this.averageLongTradePercentageReturn.rowValue; } + } + public double NumberWinningShortTrades + { + get { return (int)this.numberWinningShortTrades.rowValue; } + } + public double TotalNumberOfLongTrades + { + get { return (int)this.totalNumberOfLongTrades.rowValue; } + } + public double TotalNumberOfShortTrades + { + get { return (int)this.totalNumberOfShortTrades.rowValue; } + } + + public Summary( AccountReport accountReport ) : base( accountReport.Name + " - Summary" ) *************** *** 70,84 **** getSummary_setRow( new BuyAndHoldPercentageReturn( this ) , summaryDataTable ); getSummary_setRow( new AnnualSystemPercentageReturn( this ) , summaryDataTable ); ! getSummary_setRow( new MaxEquityDrawDown( this ) , summaryDataTable ); ! getSummary_setRow( new TotalNumberOfTrades( this ) , summaryDataTable ); ! getSummary_setRow( new NumberWinningTrades( this ) , summaryDataTable ); ! getSummary_setRow( new AverageTradePercentageReturn( this ) , summaryDataTable ); ! getSummary_setRow( new LargestWinningTradePercentage( this ) , summaryDataTable ); ! getSummary_setRow( new LargestLosingTradePercentage( this ) , summaryDataTable ); ! getSummary_setRow( new TotalNumberOfLongTrades( this ) , summaryDataTable ); ! getSummary_setRow( new NumberWinningLongTrades( this ) , summaryDataTable ); ! getSummary_setRow( new AverageLongTradePercentageReturn( this ) , summaryDataTable ); ! getSummary_setRow( new TotalNumberOfShortTrades( this ) , summaryDataTable ); ! getSummary_setRow( new NumberWinningShortTrades( this ) , summaryDataTable ); // getSummary_setRow( summaryDataTable , // new getSummaryTable_setRow( getSummaryTable_setRow_TotalNumberOfShortTrades ) ); --- 127,152 ---- getSummary_setRow( new BuyAndHoldPercentageReturn( this ) , summaryDataTable ); getSummary_setRow( new AnnualSystemPercentageReturn( this ) , summaryDataTable ); ! this.maxEquityDrawDown = new MaxEquityDrawDown( this ); ! getSummary_setRow( this.maxEquityDrawDown , summaryDataTable ); ! this.totalNumberOfTrades = new TotalNumberOfTrades( this ); ! getSummary_setRow( this.totalNumberOfTrades , summaryDataTable ); ! this.numberWinningTrades = new NumberWinningTrades( this ); ! getSummary_setRow( this.numberWinningTrades , summaryDataTable ); ! this.averageTradePercentageReturn = new AverageTradePercentageReturn( this ); ! getSummary_setRow( this.averageTradePercentageReturn , summaryDataTable ); ! this.largestWinningTradePercentage = new LargestWinningTradePercentage( this ); ! getSummary_setRow( this.largestWinningTradePercentage , summaryDataTable ); ! this.largestLosingTradePercentage = new LargestLosingTradePercentage( this ); ! getSummary_setRow( this.largestLosingTradePercentage , summaryDataTable ); ! this.totalNumberOfLongTrades = new TotalNumberOfLongTrades( this ); ! getSummary_setRow( this.totalNumberOfLongTrades , summaryDataTable ); ! this.numberWinningLongTrades = new NumberWinningLongTrades( this ); ! getSummary_setRow( this.numberWinningLongTrades , summaryDataTable ); ! this.averageLongTradePercentageReturn = new AverageLongTradePercentageReturn( this ); ! getSummary_setRow( this.averageLongTradePercentageReturn , summaryDataTable ); ! this.totalNumberOfShortTrades = new TotalNumberOfShortTrades( this ); ! getSummary_setRow( this.totalNumberOfShortTrades , summaryDataTable ); ! this.numberWinningShortTrades = new NumberWinningShortTrades( this ); ! getSummary_setRow( this.numberWinningShortTrades , summaryDataTable ); // getSummary_setRow( summaryDataTable , // new getSummaryTable_setRow( getSummaryTable_setRow_TotalNumberOfShortTrades ) ); |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:33:37
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22079/b7_Scripts/SimpleTesting/OneRank Modified Files: RunOneRank.cs Log Message: Changed to become the base class for RunOneRankWithExcelReport and RunOneRankWithWindowsReport Index: RunOneRank.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank/RunOneRank.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RunOneRank.cs 24 Nov 2003 19:36:24 -0000 1.1 --- RunOneRank.cs 1 Aug 2004 00:33:26 -0000 1.2 *************** *** 32,35 **** --- 32,36 ---- using QuantProject.Business.Scripting; using QuantProject.Presentation.MicrosoftExcel; + using QuantProject.Presentation.Reporting.WindowsForm; namespace QuantProject.Scripts *************** *** 40,43 **** --- 41,49 ---- public class RunOneRank : Script { + protected Account account; + protected string ticker; + protected DateTime startDateTime; + protected DateTime endDateTime; + public RunOneRank() { *************** *** 46,57 **** { //this.testTicker( "FSELX" , new DateTime( 2003 , 5 , 20 ) , new DateTime( 2003 , 9 , 26 ) ); ! this.testTicker( "REPIX" , new DateTime( 2003 , 7 , 1 ) , new DateTime( 2003 , 11 , 20 ) ); } ! private void testTicker( string ticker , DateTime startDateTime , DateTime endDateTime ) { QuoteCache.Add( new Instrument( ticker ) , BarComponent.Open ); QuoteCache.Add( new Instrument( ticker ) , BarComponent.Close ); //QuoteCache.Add( new Instrument( "MSFT" ) , BarComponent.Close ); ! QuoteCache.SetCache( startDateTime , endDateTime ); TradingSystems tradingSystems = new TradingSystems(); --- 52,66 ---- { //this.testTicker( "FSELX" , new DateTime( 2003 , 5 , 20 ) , new DateTime( 2003 , 9 , 26 ) ); ! this.ticker = "REPIX"; ! this.startDateTime = new DateTime( 2003 , 7 , 1 ); ! this.endDateTime = new DateTime( 2003 , 11 , 20 ); ! this.testTicker(); } ! private void testTicker() { QuoteCache.Add( new Instrument( ticker ) , BarComponent.Open ); QuoteCache.Add( new Instrument( ticker ) , BarComponent.Close ); //QuoteCache.Add( new Instrument( "MSFT" ) , BarComponent.Close ); ! QuoteCache.SetCache( this.startDateTime , this.endDateTime ); TradingSystems tradingSystems = new TradingSystems(); *************** *** 77,87 **** new ExtendedDateTime( endDateTime , BarComponent.Close ) ) ).ReportToConsole(); ! // tester.Account.AccountReport.ReportToExcel( "MSFT" , ! // new ExtendedDateTime( endDateTime , BarComponent.Close ) ); ! ! AccountReport accountReport = tester.Account.CreateReport( ticker , 7 , ! new ExtendedDateTime( endDateTime , BarComponent.Close ) , ticker ); ! ExcelManager.Add( accountReport ); ! ExcelManager.ShowReport(); } } --- 86,92 ---- new ExtendedDateTime( endDateTime , BarComponent.Close ) ) ).ReportToConsole(); ! // uncomment the four lines below to use the Excel reporting feature ! this.account = tester.Account; ! } } |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:32:01
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21850/b5_Presentation/Reporting/WindowsForm Modified Files: EquityChartTabPage.cs Log Message: Added copyright note and main comment Index: EquityChartTabPage.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm/EquityChartTabPage.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EquityChartTabPage.cs 1 Aug 2004 00:19:57 -0000 1.1 --- EquityChartTabPage.cs 1 Aug 2004 00:31:53 -0000 1.2 *************** *** 1,2 **** --- 1,23 ---- + /* + QuantProject - Quantitative Finance Library + + EquityChartTabPage.cs + Copyright (C) 2003 + Glauco Siliprandi + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ using System; using System.Windows.Forms; *************** *** 8,12 **** { /// <summary> ! /// Summary description for ReportTabControl. /// </summary> public class EquityChartTabPage : TabPage --- 29,33 ---- { /// <summary> ! /// TabPage for the equity chart for the report form /// </summary> public class EquityChartTabPage : TabPage |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:30:56
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21693/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables Modified Files: Equity.cs Log Message: Added static field names for external reference Index: Equity.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables/Equity.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Equity.cs 8 Nov 2003 20:56:38 -0000 1.1 --- Equity.cs 1 Aug 2004 00:30:47 -0000 1.2 *************** *** 10,13 **** --- 10,18 ---- public class Equity : ReportTable { + public static string Date = "Date"; + public static string PnL = "PnL"; + public static string AccountValue = "AccountValue"; + public static string PercentageChange = "%chg"; + public Equity( string reportName , DataTable detailedDataTable ) : base( reportName + " - Equity" ) |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:29:05
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21405/b1_ADT Modified Files: ConstantsProvider.cs Log Message: Added the formatting constant FormatWithTwoDecimals Index: ConstantsProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ConstantsProvider.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ConstantsProvider.cs 13 Jun 2004 11:10:01 -0000 1.6 --- ConstantsProvider.cs 1 Aug 2004 00:28:54 -0000 1.7 *************** *** 24,27 **** --- 24,28 ---- // max num days allowed by the data source (yahoo) public static double MaxNumDaysDownloadedAtEachConnection = 200; + public static string FormatWithTwoDecimals = "0:#,#.00"; } } |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:27:23
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Charting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21192/b5_Presentation/Charting Modified Files: Chart.cs Log Message: Used double instead of float (to avoid a run time error) Index: Chart.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Charting/Chart.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Chart.cs 7 Jul 2004 20:25:26 -0000 1.2 --- Chart.cs 1 Aug 2004 00:27:14 -0000 1.3 *************** *** 86,90 **** DataRow dataRow = dataTable.NewRow(); dataRow[ "X" ] = (DateTime)chartPlot.History.GetKey( i ); ! dataRow[ "Y" ] = (float)chartPlot.History.GetByIndex( i ); dataTable.Rows.Add( dataRow ); } --- 86,90 ---- DataRow dataRow = dataTable.NewRow(); dataRow[ "X" ] = (DateTime)chartPlot.History.GetKey( i ); ! dataRow[ "Y" ] = Convert.ToDouble( chartPlot.History.GetByIndex( i ) ); dataTable.Rows.Add( dataRow ); } |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:25:21
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21007/b5_Presentation/Reporting/WindowsForm Added Files: SummaryTabPage.cs Log Message: TabPage to display the summary within the report form --- NEW FILE: SummaryTabPage.cs --- /* QuantProject - Quantitative Finance Library SummaryTabPage.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Drawing; using System.Windows.Forms; using QuantProject.ADT; using QuantProject.Business.Financial.Accounting.Reporting; using QuantProject.Presentation; namespace QuantProject.Presentation.Reporting.WindowsForm { /// <summary> /// TabPage to show the summary within the report form /// </summary> public class SummaryTabPage : TabPage { // private int currentLabel; private int xForLabels = 17; private int labelsWidth = 150; private int yStart = 17; private int yStep = 25; private System.Windows.Forms.Label lblValTotalNetProfit; private System.Windows.Forms.Label lblTotalNetProfit; private System.Windows.Forms.Label lblReturnOnAccount; private System.Windows.Forms.Label lblValReturnOnAccount; private System.Windows.Forms.Label lblAnnualSystemPercReturn; private System.Windows.Forms.Label lblValAnnualSystemPercReturn; private System.Windows.Forms.Label lblMaxEquityDrawDown; private System.Windows.Forms.Label lblValMaxEquityDrawDown; private System.Windows.Forms.Label lblTotalNumberOfTrades; private System.Windows.Forms.Label lblValTotalNumberOfTrades; private System.Windows.Forms.Label lblNumberWinningTrades; private System.Windows.Forms.Label lblValNumberWinningTrades; private System.Windows.Forms.Label lblAverageTradePercReturn; private System.Windows.Forms.Label lblValAverageTradePercReturn; private System.Windows.Forms.Label lblLargestWinningTrade; private System.Windows.Forms.Label lblValLargestWinningTrade; private System.Windows.Forms.Label lblLargestLosingTrade; private System.Windows.Forms.Label lblValLargestLosingTrade; private System.Windows.Forms.Label lblTotalNumberOfLongTrades; private System.Windows.Forms.Label lblValTotalNumberOfLongTrades; private System.Windows.Forms.Label lblAverageLongTradePercReturn; private System.Windows.Forms.Label lblValAverageLongTradePercReturn; private System.Windows.Forms.Label lblNumberWinningShortTrades; private System.Windows.Forms.Label lblValNumberWinningShortTrades; private System.Windows.Forms.Label lblBuyAndHoldPercReturn; private System.Windows.Forms.Label lblValBuyAndHoldPercReturn; private System.Windows.Forms.Label lblNumberWinningLongTrades; private System.Windows.Forms.Label lblValNumberWinningLongTrades; private System.Windows.Forms.Label lblTotalNumberOfShortTrades; private System.Windows.Forms.Label lblValTotalNumberOfShortTrades; private AccountReport accountReport; private Point getPointForTextLabel( int labelPosition ) { return new Point( xForLabels , yStart + labelPosition * yStep ); } private void addTextLabel( Label label , string name , string text ) { this.Controls.Add( label ); // label.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; label.Location = getPointForTextLabel( ( this.Controls.Count - 1 ) / 2 ); label.Width = this.labelsWidth; label.Name = name; label.Text = text; label.TextAlign = System.Drawing.ContentAlignment.MiddleRight; } private void addValueLabel( Label label , string name ) { this.Controls.Add( label ); // label.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; label.Location = getPointForValueLabel( ( this.Controls.Count / 2 ) - 1 ); label.Name = name; label.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; } private Point getPointForValueLabel( int labelPosition ) { return new Point( xForLabels + labelsWidth + 3 , yStart + labelPosition * yStep ); } private void myInitializeComponent() { this.lblTotalNetProfit = new System.Windows.Forms.Label(); this.lblValTotalNetProfit = new System.Windows.Forms.Label(); this.lblReturnOnAccount = new System.Windows.Forms.Label(); this.lblValReturnOnAccount = new System.Windows.Forms.Label(); this.lblBuyAndHoldPercReturn = new System.Windows.Forms.Label(); this.lblValBuyAndHoldPercReturn = new System.Windows.Forms.Label(); this.lblAnnualSystemPercReturn = new System.Windows.Forms.Label(); this.lblValAnnualSystemPercReturn = new System.Windows.Forms.Label(); this.lblMaxEquityDrawDown = new System.Windows.Forms.Label(); this.lblValMaxEquityDrawDown = new System.Windows.Forms.Label(); this.lblTotalNumberOfTrades = new System.Windows.Forms.Label(); this.lblValTotalNumberOfTrades = new System.Windows.Forms.Label(); this.lblNumberWinningTrades = new System.Windows.Forms.Label(); this.lblValNumberWinningTrades = new System.Windows.Forms.Label(); this.lblAverageTradePercReturn = new System.Windows.Forms.Label(); this.lblValAverageTradePercReturn = new System.Windows.Forms.Label(); this.lblLargestWinningTrade = new System.Windows.Forms.Label(); this.lblValLargestWinningTrade = new System.Windows.Forms.Label(); this.lblLargestLosingTrade = new System.Windows.Forms.Label(); this.lblValLargestLosingTrade = new System.Windows.Forms.Label(); this.lblTotalNumberOfLongTrades = new System.Windows.Forms.Label(); this.lblValTotalNumberOfLongTrades = new System.Windows.Forms.Label(); this.lblNumberWinningLongTrades = new System.Windows.Forms.Label(); this.lblValNumberWinningLongTrades = new System.Windows.Forms.Label(); this.lblAverageLongTradePercReturn = new System.Windows.Forms.Label(); this.lblValAverageLongTradePercReturn = new System.Windows.Forms.Label(); this.lblTotalNumberOfShortTrades = new System.Windows.Forms.Label(); this.lblValTotalNumberOfShortTrades = new System.Windows.Forms.Label(); this.lblNumberWinningShortTrades = new System.Windows.Forms.Label(); this.lblValNumberWinningShortTrades = new System.Windows.Forms.Label(); // // lblTotalNetProfit // this.addTextLabel( lblTotalNetProfit , "lblTotalNetProfit" , "Total net profit:" ); // // lblValTotalNetProfit // this.addValueLabel( lblValTotalNetProfit , "lblValTotalNetProfit" ); // // lblReturnOnAccount // this.addTextLabel( lblReturnOnAccount , "lblReturnOnAccount" , "Return on account:" ); // // lblValReturnOnAccount // this.addValueLabel( lblValReturnOnAccount , "lblValReturnOnAccount" ); // // lblBuyAndHoldPercReturn // this.addTextLabel( lblBuyAndHoldPercReturn , "lblBuyAndHoldPercReturn" , "Buy & hold % return:" ); // // lblValBuyAndHoldPercReturn // this.addValueLabel( lblValBuyAndHoldPercReturn , "lblValBuyAndHoldPercReturn" ); // // lblAnnualSystemPercReturn // this.addTextLabel( lblAnnualSystemPercReturn , "lblAnnualSystemPercReturn" , "Annual system % return:" ); // // lblValAnnualSystemPercReturn // this.addValueLabel( lblValAnnualSystemPercReturn , "lblValAnnualSystemPercReturn" ); // // lblMaxEquityDrawDown // this.addTextLabel( lblMaxEquityDrawDown , "lblMaxEquityDrawDown" , "Max equity drawydown (%):" ); // // lblValMaxEquityDrawDown // this.addValueLabel( lblValMaxEquityDrawDown , "lblValMaxEquityDrawDown" ); // // lblTotalNumberOfTrades // this.addTextLabel( lblTotalNumberOfTrades , "lblTotalNumberOfTrades" , "Total # of trades:" ); // // lblValTotalNumberOfTrades // this.addValueLabel( lblValTotalNumberOfTrades , "lblValTotalNumberOfTrades" ); // // lblNumberWinningTrades // this.addTextLabel( lblNumberWinningTrades , "lblNumberWinningTrades" , "Number winning trades:" ); // // lblValNumberWinningTrades // this.addValueLabel( lblValNumberWinningTrades , "lblValNumberWinningTrades" ); // // lblAverageTradePercReturn // this.addTextLabel( lblNumberWinningTrades , "lblNumberWinningTrades" , "Average trade % return:" ); // // lblValAverageTradePercReturn // this.addValueLabel( lblValAverageTradePercReturn , "lblValAverageTradePercReturn" ); // // lblLargestWinningTrade // this.addTextLabel( lblNumberWinningTrades , "lblNumberWinningTrades" , "Largest winning trade:" ); // // lblValLargestWinningTrade // this.addValueLabel( lblValLargestWinningTrade , "lblValLargestWinningTrade" ); // // lblLargestLosingTrade // this.addTextLabel( lblNumberWinningTrades , "lblNumberWinningTrades" , "Largest losing trade:" ); // // lblValLargestLosingTrade // this.addValueLabel( lblValLargestLosingTrade , "lblValLargestLosingTrade" ); // // lblTotalNumberOfLongTrades // this.addTextLabel( lblTotalNumberOfLongTrades , "lblTotalNumberOfLongTrades" , "Total # of long trades:" ); // // lblValTotalNumberOfLongTrades // this.addValueLabel( lblValTotalNumberOfLongTrades , "lblValTotalNumberOfLongTrades" ); // // lblNumberWinningLongTrades // this.addTextLabel( lblNumberWinningLongTrades , "lblNumberWinningLongTrades" , "Number winning long trades:" ); // // lblValNumberWinningLongTrades // this.addValueLabel( lblValNumberWinningLongTrades , "lblValNumberWinningLongTrades" ); // // lblAverageLongTradePercReturn // this.addTextLabel( lblAverageLongTradePercReturn , "lblAverageLongTradePercReturn" , "Average long trade % return:" ); // // lblValAverageLongTradePercReturn // this.addValueLabel( lblValAverageLongTradePercReturn , "lblValAverageLongTradePercReturn" ); // // lblTotalNumberOfShortTrades // this.addTextLabel( lblTotalNumberOfShortTrades , "lblTotalNumberOfShortTrades" , "Total numbero of short trades:" ); // // lblValTotalNumberOfShortTrades // this.addValueLabel( lblValTotalNumberOfShortTrades , "lblValTotalNumberOfShortTrades" ); // // lblNumberWinningShortTrades // this.addTextLabel( lblNumberWinningShortTrades , "lblNumberWinningShortTrades" , "Number winning short trades:" ); // // lblValNumberWinningShortTrades // this.addValueLabel( lblValNumberWinningShortTrades , "lblValNumberWinningShortTrades" ); } private void addControls() { // this.Controls.Add( this.lblValTotalNetProfit ); // this.Controls.Add( this.lblReturnOnAccount ); // this.Controls.Add( this.lblValReturnOnAccount ); this.Controls.Add( this.lblBuyAndHoldPercReturn ); this.Controls.Add( this.lblValBuyAndHoldPercReturn ); this.Controls.Add( this.lblAnnualSystemPercReturn ); this.Controls.Add( this.lblValAnnualSystemPercReturn ); this.Controls.Add( this.lblMaxEquityDrawDown ); this.Controls.Add( this.lblValMaxEquityDrawDown ); this.Controls.Add( this.lblTotalNumberOfShortTrades ); this.Controls.Add( this.lblValTotalNumberOfTrades ); this.Controls.Add( this.lblAverageTradePercReturn ); this.Controls.Add( this.lblValAverageTradePercReturn ); this.Controls.Add( this.lblLargestWinningTrade ); this.Controls.Add( this.lblValLargestWinningTrade ); this.Controls.Add( this.lblLargestLosingTrade ); this.Controls.Add( this.lblValLargestLosingTrade ); this.Controls.Add( this.lblTotalNumberOfLongTrades ); this.Controls.Add( this.lblValTotalNumberOfLongTrades ); this.Controls.Add( this.lblNumberWinningLongTrades ); this.Controls.Add( this.lblValNumberWinningLongTrades ); this.Controls.Add( this.lblAverageLongTradePercReturn ); this.Controls.Add( this.lblValAverageLongTradePercReturn ); this.Controls.Add( this.lblTotalNumberOfShortTrades ); this.Controls.Add( this.lblValTotalNumberOfTrades ); this.Controls.Add( this.lblNumberWinningShortTrades ); this.Controls.Add( this.lblValNumberWinningShortTrades ); } private void setSummaryValues() { this.lblValTotalNetProfit.Text = FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.TotalPnl ); this.lblValReturnOnAccount.Text = FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.ReturnOnAccount ); this.lblValBuyAndHoldPercReturn.Text = FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.BuyAndHoldPercentageReturn ); this.lblValAnnualSystemPercReturn.Text = FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.AnnualSystemPercentageReturn ); this.lblValMaxEquityDrawDown.Text = FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.MaxEquityDrawDown ); this.lblValTotalNumberOfTrades.Text = FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.TotalNumberOfTrades ); this.lblValAverageTradePercReturn.Text = FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.AverageTradePercentageReturn ); this.lblValLargestWinningTrade.Text = FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.LargestWinningTradePercentage ); this.lblValLargestLosingTrade.Text = FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.LargestLosingTradePercentage ); this.lblValTotalNumberOfLongTrades.Text = FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.TotalNumberOfLongTrades ); this.lblValNumberWinningLongTrades.Text = FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.NumberWinningLongTrades ); this.lblValAverageLongTradePercReturn.Text = FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.AverageLongTradePercentageReturn ); this.lblValTotalNumberOfShortTrades.Text = FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.TotalNumberOfShortTrades ); } public SummaryTabPage( AccountReport accountReport ) { this.accountReport = accountReport; this.myInitializeComponent(); this.addControls(); this.Text = "Summary"; this.setSummaryValues(); } } } |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:23:51
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20878/b7_Scripts/SimpleTesting/OneRank Added Files: RunOneRankWithWindowsReport.cs Log Message: An example script to show the Windows report feature --- NEW FILE: RunOneRankWithWindowsReport.cs --- /* QuantProject - Quantitative Finance Library RunOneRankWithWindowsReport.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using QuantProject.ADT; using QuantProject.ADT.Histories; using QuantProject.ADT.Optimizing; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Accounting.Reporting; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Testing; using QuantProject.Business.Strategies; using QuantProject.Business.Scripting; using QuantProject.Presentation.MicrosoftExcel; using QuantProject.Presentation.Reporting.WindowsForm; namespace QuantProject.Scripts { /// <summary> /// An example script to show the Windows report feature /// </summary> public class RunOneRankWithWindowsReport : RunOneRank { public RunOneRankWithWindowsReport() { } public override void Run() { base.Run(); Report report = new Report( this.account ); report.Show( this.ticker , 7 , new ExtendedDateTime( this.endDateTime , BarComponent.Close ) , this.ticker ); } } } |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:22:57
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/OneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20780/b7_Scripts/SimpleTesting/OneRank Added Files: RunOneRankWithExcelReport.cs Log Message: An example script to show the Excel report feature --- NEW FILE: RunOneRankWithExcelReport.cs --- /* QuantProject - Quantitative Finance Library RunOneRankWithExcelReport.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using QuantProject.ADT; using QuantProject.ADT.Histories; using QuantProject.ADT.Optimizing; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Accounting.Reporting; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Testing; using QuantProject.Business.Strategies; using QuantProject.Business.Scripting; using QuantProject.Presentation.MicrosoftExcel; using QuantProject.Presentation.Reporting.WindowsForm; namespace QuantProject.Scripts { /// <summary> /// An example script to show the Excel report feature /// </summary> public class RunOneRankWithExcelReport : RunOneRank { public RunOneRankWithExcelReport() { } public override void Run() { base.Run(); AccountReport accountReport = this.account.CreateReport( this.ticker , 7 , new ExtendedDateTime( endDateTime , BarComponent.Close ) , ticker ); ExcelManager.Add( accountReport ); ExcelManager.ShowReport(); } } } |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:21:27
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20569/b5_Presentation Added Files: FormatProvider.cs Log Message: This class contains static methods to format strings for the report form --- NEW FILE: FormatProvider.cs --- /* QuantProject - Quantitative Finance Library FormatProvider.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; namespace QuantProject.Presentation { /// <summary> /// This class contains static methods to format string for the report form /// </summary> public class FormatProvider { public FormatProvider() { // // TODO: Add constructor logic here // } public static string ConvertToStringWithTwoDecimals( double number ) { return String.Format("{0:#,#.00}", number); } } } |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:20:08
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20298/b5_Presentation/Reporting/WindowsForm Added Files: EquityChartTabPage.cs Log Message: TabPage for the equity chart for the report form --- NEW FILE: EquityChartTabPage.cs --- using System; using System.Windows.Forms; using QuantProject.ADT.Histories; using QuantProject.Business.Financial.Accounting.Reporting; using QuantProject.Presentation.Charting; namespace QuantProject.Presentation.Reporting.WindowsForm { /// <summary> /// Summary description for ReportTabControl. /// </summary> public class EquityChartTabPage : TabPage { private AccountReport accountReport; private Chart equityChart; public EquityChartTabPage( AccountReport accountReport ) { this.Text = "Equity Line"; this.accountReport = accountReport; this.equityChart = new Chart(); this.equityChart.Dock = DockStyle.Fill; History historyToBeCharted = new History(); historyToBeCharted.Import( this.accountReport.Equity.DataTable , QuantProject.Business.Financial.Accounting.Reporting.Tables.Equity.Date , QuantProject.Business.Financial.Accounting.Reporting.Tables.Equity.AccountValue ); this.equityChart.Add( historyToBeCharted ); 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 ); // } } } |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:18:56
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20185/b5_Presentation/Reporting/WindowsForm Added Files: ReportTabControl.cs Log Message: TabControl for the report form --- NEW FILE: ReportTabControl.cs --- /* QuantProject - Quantitative Finance Library ReportTabControl.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Windows.Forms; using QuantProject.Business.Financial.Accounting.Reporting; namespace QuantProject.Presentation.Reporting.WindowsForm { /// <summary> /// TabControl for the report form /// </summary> public class ReportTabControl : TabControl { private AccountReport accountReport; private TabPage equityChart; private TabPage summary; public ReportTabControl( AccountReport accountReport ) { this.accountReport = accountReport; this.Dock = DockStyle.Fill; this.equityChart = new EquityChartTabPage( this.accountReport ); this.Controls.Add( this.equityChart ); this.summary = new SummaryTabPage( this.accountReport ); this.Controls.Add( this.summary ); } } } |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:17:15
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20017/b5_Presentation/Reporting/WindowsForm Added Files: Report.cs Log Message: Windows Form account report --- NEW FILE: Report.cs --- /* QuantProject - Quantitative Finance Library Report.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Windows.Forms; using QuantProject.ADT; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Accounting.Reporting; namespace QuantProject.Presentation.Reporting.WindowsForm { /// <summary> /// Windows Form account report /// </summary> public class Report : Form { private Account account; private AccountReport accountReport; private ReportTabControl reportTabControl; public Report( Account account ) { this.account = account; } /// <summary> /// Populates the form and displays itself /// </summary> private void show_set_accountReport( string reportName , int numDaysForInterval , ExtendedDateTime endDateTime , string buyAndHoldTicker ) { if ( this.accountReport == null ) this.accountReport = this.account.CreateReport( reportName , numDaysForInterval , endDateTime , buyAndHoldTicker ); } private void show_populateForm() { this.Location = new System.Drawing.Point( 1000,500); this.Width = 500; this.reportTabControl = new ReportTabControl( this.accountReport ); this.Controls.Add( this.reportTabControl ); } public void Show( string reportName , int numDaysForInterval , ExtendedDateTime endDateTime , string buyAndHoldTicker ) { this.show_set_accountReport( reportName , numDaysForInterval , endDateTime , buyAndHoldTicker ); this.show_populateForm(); base.ShowDialog(); } } } |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:14:48
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19736/WindowsForm Log Message: Directory /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm added to the repository |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:14:03
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19631/Reporting Log Message: Directory /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting added to the repository |
|
From: Marco M. <mi...@us...> - 2004-07-25 12:14:30
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5579/Downloader/TickerSelectors Modified Files: TickerSelectorForm.cs Log Message: Added checkBox to the form in order to visually interact with the TickerSelector class Index: TickerSelectorForm.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors/TickerSelectorForm.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TickerSelectorForm.cs 27 Jun 2004 19:21:42 -0000 1.4 --- TickerSelectorForm.cs 25 Jul 2004 12:14:18 -0000 1.5 *************** *** 57,60 **** --- 57,61 ---- private System.Windows.Forms.TextBox textBoxMaxNumOfReturnedTickers; private System.Windows.Forms.Label label3; + private System.Windows.Forms.CheckBox checkBoxASCMode; private DataTable tableOfSelectedTickers; *************** *** 66,73 **** this.dataGrid1.ContextMenu = new TickerViewerMenu(this); //TODO: complete comboBox's code with all possible types of selections ! this.comboBoxAvailableSelectionRules.Text = "Most liquid instruments"; ! this.comboBoxAvailableSelectionRules.Items.Add("Most liquid instruments"); ! this.comboBoxAvailableSelectionRules.Text = "Best performing instruments"; ! this.comboBoxAvailableSelectionRules.Items.Add("Best performing instruments"); } --- 67,74 ---- this.dataGrid1.ContextMenu = new TickerViewerMenu(this); //TODO: complete comboBox's code with all possible types of selections ! this.comboBoxAvailableSelectionRules.Text = "Liquidity"; ! this.comboBoxAvailableSelectionRules.Items.Add("Liquidity"); ! this.comboBoxAvailableSelectionRules.Text = "Performance"; ! this.comboBoxAvailableSelectionRules.Items.Add("Performance"); } *************** *** 123,126 **** --- 124,128 ---- this.dateTimePickerFirstDate = new System.Windows.Forms.DateTimePicker(); this.splitter1 = new System.Windows.Forms.Splitter(); + this.checkBoxASCMode = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit(); this.panel2.SuspendLayout(); *************** *** 163,166 **** --- 165,169 ---- // this.groupBoxSelectionRule.Controls.AddRange(new System.Windows.Forms.Control[] { + this.checkBoxASCMode, this.label3, this.comboBoxAvailableSelectionRules, *************** *** 175,179 **** this.groupBoxSelectionRule.Location = new System.Drawing.Point(8, 16); this.groupBoxSelectionRule.Name = "groupBoxSelectionRule"; ! this.groupBoxSelectionRule.Size = new System.Drawing.Size(376, 144); this.groupBoxSelectionRule.TabIndex = 14; this.groupBoxSelectionRule.TabStop = false; --- 178,182 ---- this.groupBoxSelectionRule.Location = new System.Drawing.Point(8, 16); this.groupBoxSelectionRule.Name = "groupBoxSelectionRule"; ! this.groupBoxSelectionRule.Size = new System.Drawing.Size(376, 184); this.groupBoxSelectionRule.TabIndex = 14; this.groupBoxSelectionRule.TabStop = false; *************** *** 269,272 **** --- 272,283 ---- this.splitter1.TabStop = false; // + // checkBoxASCMode + // + this.checkBoxASCMode.Location = new System.Drawing.Point(176, 144); + this.checkBoxASCMode.Name = "checkBoxASCMode"; + this.checkBoxASCMode.Size = new System.Drawing.Size(152, 24); + this.checkBoxASCMode.TabIndex = 27; + this.checkBoxASCMode.Text = "Order by ASC mode"; + // // TickerSelectorForm // *************** *** 288,317 **** - - - - - - // implementation of ITickerSelector interface public DataTable GetTableOfSelectedTickers() { - /* - DataTable dataTableOfDataGrid1 = (DataTable)this.dataGrid1.DataSource; - DataTable tableOfSelectedTickers = new DataTable(); - TickerDataTable.AddColumnsOfTickerTable(tableOfSelectedTickers); - int indexOfRow = 0; - while(indexOfRow != dataTableOfDataGrid1.Rows.Count) - { - if(this.dataGrid1.IsSelected(indexOfRow)) - { - DataRow dataRow = tableOfSelectedTickers.NewRow(); - dataRow["Ticker"] = (string)dataTableOfDataGrid1.Rows[indexOfRow][0]; - dataRow["CompanyName"] = (string)dataTableOfDataGrid1.Rows[indexOfRow][1]; - tableOfSelectedTickers.Rows.Add(dataRow); - } - indexOfRow++; - }*/ return TickerSelector.GetTableOfManuallySelectedTickers(this.dataGrid1); } --- 299,306 ---- *************** *** 331,354 **** private void buttonSelectTickers_Click(object sender, System.EventArgs e) { ! SelectionRule rule = new SelectionRule(this.GetTypeOfRuleSelectedByUser(), this.textBoxGroupID.Text, ! this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, ! Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! TickerSelector selector; ! if(this.textBoxGroupID.Text != "") ! selector= new TickerSelector(rule); ! else ! selector= new TickerSelector(this.tableOfSelectedTickers,rule); ! this.dataGrid1.DataSource = selector.GetTableOfSelectedTickers(); ! this.dataGrid1.Refresh(); } ! private SelectionType GetTypeOfRuleSelectedByUser() { ! SelectionType typeSelected = SelectionType.MostLiquid; ! if(this.comboBoxAvailableSelectionRules.Text == "Most liquid instruments") ! typeSelected = SelectionType.MostLiquid; ! else if (this.comboBoxAvailableSelectionRules.Text == "Best performing instruments") ! typeSelected = SelectionType.BestPerformer; return typeSelected; } --- 320,348 ---- private void buttonSelectTickers_Click(object sender, System.EventArgs e) { ! Cursor.Current = Cursors.WaitCursor; ! TickerSelector selector; ! if(this.textBoxGroupID.Text != "") ! selector= new TickerSelector(this.getTypeOfRuleSelectedByUser(), this.checkBoxASCMode.Checked, this.textBoxGroupID.Text, ! this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, ! Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! else ! selector= new TickerSelector(this.tableOfSelectedTickers, this.getTypeOfRuleSelectedByUser(), ! this.checkBoxASCMode.Checked, this.textBoxGroupID.Text, ! this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, ! Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! this.dataGrid1.DataSource = selector.GetTableOfSelectedTickers(); ! this.dataGrid1.Refresh(); ! Cursor.Current = Cursors.Default; } ! private SelectionType getTypeOfRuleSelectedByUser() { ! SelectionType typeSelected = SelectionType.Liquidity; ! if(this.comboBoxAvailableSelectionRules.Text == "Liquidity") ! typeSelected = SelectionType.Liquidity; ! else if (this.comboBoxAvailableSelectionRules.Text == "Performance") ! typeSelected = SelectionType.Performance; return typeSelected; } |
|
From: Marco M. <mi...@us...> - 2004-07-25 12:12:28
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5354/Downloader Modified Files: TickerDownloader.cs Log Message: Cleaned code in TickerDownloader class. Index: TickerDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerDownloader.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TickerDownloader.cs 4 Jul 2004 17:53:36 -0000 1.10 --- TickerDownloader.cs 25 Jul 2004 12:12:15 -0000 1.11 *************** *** 29,32 **** --- 29,34 ---- private DataTable downloadedValuesFromSource = new DataTable("quotes"); private OleDbSingleTableAdapter adapter; + private Stream stream; + private StreamReader streamReader; public TickerDownloader( WebDownloader myForm, DataRow currentDataTickerRow, string quTicker , int numRows ) *************** *** 179,186 **** /// Adds rows to the table (member of the object) containing the downloaded values /// </summary> ! private void addValuesToTable( StreamReader streamReader ) { string Line; string[] LineIn; Line = streamReader.ReadLine(); Line = streamReader.ReadLine(); --- 181,190 ---- /// Adds rows to the table (member of the object) containing the downloaded values /// </summary> ! private void addCurrentStreamToTable() { string Line; string[] LineIn; + if(this.streamReader==null) + return; Line = streamReader.ReadLine(); Line = streamReader.ReadLine(); *************** *** 210,255 **** private void importTickerForCurrentTimeFrame( DateTime currBeginDate , DateTime currEndDate ) { - int a = currBeginDate.Month - 1; - int b = currBeginDate.Day; - int c = currBeginDate.Year; - int d = currEndDate.Month - 1; - int e = currEndDate.Day; - int f = currEndDate.Year; - int numTrials = 1; - - while (numTrials < 5) - { - this.p_myForm.Refresh(); try { ! HttpWebRequest Req = (HttpWebRequest)WebRequest.Create("http:" + "//ichart.yahoo.com/table.csv?a=" ! + a + "&b=" + b + "&c=" + c +"&d=" + d + "&e=" + e + "&f=" + f + "&s=" + p_quTicker + "&y=0&g=d&ignore=.csv"); ! Req.Method = "GET"; ! Req.Timeout = ConstantsProvider.TimeOutValue; ! HttpWebResponse hwr = (HttpWebResponse)Req.GetResponse(); ! Stream strm = hwr.GetResponseStream(); ! StreamReader sr = new StreamReader(strm); ! ! //DataBaseImporter dataBaseImporter = ! //new DataBaseImporter( this.oleDbConnection1 , sr, this.p_myForm.radioButtonOverWriteYes.Checked ); ! //dataBaseImporter.ImportTicker( p_quTicker ); ! this.addValuesToTable(sr); ! ! sr.Close(); ! strm.Close(); ! //hwr.Close(); ! ! updateCurrentStatus( d + "/" + e + "/" + f ); ! numTrials = 6 ; } catch (Exception exception) { MessageBox.Show( exception.ToString() ); ! updateCurrentStatus( "Trial: " + numTrials ); numTrials++; if (numTrials > 5) ! addTickerToFaultyTickers(); } - } } --- 214,235 ---- private void importTickerForCurrentTimeFrame( DateTime currBeginDate , DateTime currEndDate ) { try { ! this.p_myForm.Refresh(); ! this.setStreamsFromYahoo(currBeginDate, currEndDate); ! this.addCurrentStreamToTable(); ! this.updateCurrentStatus(currEndDate.ToShortDateString()); ! if(this.streamReader!=null) ! this.streamReader.Close(); ! //this.updateCurrentStatus( d + "/" + e + "/" + f ); } catch (Exception exception) { MessageBox.Show( exception.ToString() ); ! /*updateCurrentStatus( "Trial: " + numTrials ); numTrials++; if (numTrials > 5) ! addTickerToFaultyTickers();*/ } } *************** *** 361,367 **** //download is executed { - this.updateCurrentStatusAdjustedClose("OK"); this.downloadedValuesFromSource = this.getTableOfDownloadedValues(); this.commitDownloadedValuesToDatabase(); } } --- 341,347 ---- //download is executed { this.downloadedValuesFromSource = this.getTableOfDownloadedValues(); this.commitDownloadedValuesToDatabase(); + this.updateCurrentStatusAdjustedClose("OK"); } } *************** *** 392,398 **** string Line; string[] LineIn = null; ! StreamReader streamReader = this.getStreamReaderFromSource(adjustedCloseDate, 0); ! Line = streamReader.ReadLine(); ! Line = streamReader.ReadLine(); if ( Line != null && ! Line.StartsWith("<")) { --- 372,378 ---- string Line; string[] LineIn = null; ! this.setStreamsFromYahoo(adjustedCloseDate, 0); ! Line = this.streamReader.ReadLine(); ! Line = this.streamReader.ReadLine(); if ( Line != null && ! Line.StartsWith("<")) { *************** *** 500,503 **** --- 480,485 ---- { string Line; + if(streamReader == null) + return false; Line = streamReader.ReadLine(); // column headers are read *************** *** 514,533 **** } numDays++; - } return isOneDateAvailableInNextDaysToBeTested; - } ! private StreamReader getStreamReaderFromSource( DateTime initialDateOfTheTimeWindow, ! int daysOfTheTimeWindow ) { - int a = initialDateOfTheTimeWindow.Month - 1; - int b = initialDateOfTheTimeWindow.Day; - int c = initialDateOfTheTimeWindow.Year; DateTime endDateOfTheTimeWindow = initialDateOfTheTimeWindow.AddDays(daysOfTheTimeWindow); ! int d = endDateOfTheTimeWindow.Month - 1; ! int e = endDateOfTheTimeWindow.Day; ! int f = endDateOfTheTimeWindow.Year; HttpWebRequest Req; HttpWebResponse hwr; --- 496,519 ---- } numDays++; } return isOneDateAvailableInNextDaysToBeTested; } ! private void setStreamsFromYahoo( DateTime initialDateOfTheTimeWindow,int daysOfTheTimeWindow) ! { DateTime endDateOfTheTimeWindow = initialDateOfTheTimeWindow.AddDays(daysOfTheTimeWindow); ! this.setStreamsFromYahoo(initialDateOfTheTimeWindow, endDateOfTheTimeWindow); ! } ! ! /* ! private StreamReader getStreamReaderFromYahoo(DateTime startDate, DateTime endDate) ! { ! int a = startDate.Month - 1; ! int b = startDate.Day; ! int c = startDate.Year; ! int d = endDate.Month - 1; ! int e = endDate.Day; ! int f = endDate.Year; HttpWebRequest Req; HttpWebResponse hwr; *************** *** 539,548 **** try { ! // Req = (HttpWebRequest)WebRequest.Create("http:" + "//table.finance.yahoo.com/table.csv?a=" ! // + a + "&b=" + b + "&c=" + c +"&d=" + d + "&e=" + e + "&f=" + f + "&s=" + p_quTicker + "&y=0&g=d&ignore=.csv"); ! string url = "http:" + "//ichart.yahoo.com/table.csv?a=" ! + a + "&b=" + b + "&c=" + c +"&d=" + d + "&e=" + e + "&f=" + f + "&s=" + p_quTicker + "&y=0&g=d&ignore=.csv"; ! Req = (HttpWebRequest)WebRequest.Create( url ); ! Req.Method = "GET"; Req.Timeout = ConstantsProvider.TimeOutValue; hwr = (HttpWebResponse)Req.GetResponse(); --- 525,534 ---- try { ! // Req = (HttpWebRequest)WebRequest.Create("http:" + "//table.finance.yahoo.com/table.csv?a=" ! // + a + "&b=" + b + "&c=" + c +"&d=" + d + "&e=" + e + "&f=" + f + "&s=" + p_quTicker + "&y=0&g=d&ignore=.csv"); ! string url = "http:" + "//ichart.yahoo.com/table.csv?a=" ! + a + "&b=" + b + "&c=" + c +"&d=" + d + "&e=" + e + "&f=" + f + "&s=" + p_quTicker + "&y=0&g=d&ignore=.csv"; ! Req = (HttpWebRequest)WebRequest.Create( url ); ! Req.Method = "GET"; Req.Timeout = ConstantsProvider.TimeOutValue; hwr = (HttpWebResponse)Req.GetResponse(); *************** *** 560,579 **** return sr; } ! ! private bool getResponseForTimeWindow( DateTime initialDateOfTheTimeWindow, ! int daysOfTheTimeWindow ) { ! int a = initialDateOfTheTimeWindow.Month - 1; ! int b = initialDateOfTheTimeWindow.Day; ! int c = initialDateOfTheTimeWindow.Year; ! DateTime endDateOfTheTimeWindow = initialDateOfTheTimeWindow.AddDays(daysOfTheTimeWindow); ! int d = endDateOfTheTimeWindow.Month - 1; ! int e = endDateOfTheTimeWindow.Day; ! int f = endDateOfTheTimeWindow.Year; HttpWebRequest Req; HttpWebResponse hwr; ! Stream strm; ! StreamReader sr; ! bool response = false; int numTrials = 1; while(numTrials < 5) --- 546,565 ---- return sr; } ! */ ! private void setStreamsFromYahoo(DateTime startDate, DateTime endDate) { ! int a = startDate.Month - 1; ! int b = startDate.Day; ! int c = startDate.Year; ! int d = endDate.Month - 1; ! int e = endDate.Day; ! int f = endDate.Year; HttpWebRequest Req; HttpWebResponse hwr; ! string url; ! //url = "http:" + "//ichart.yahoo.com/table.csv?a=" ! // + a + "&b=" + b + "&c=" + c +"&d=" + d + "&e=" + e + "&f=" + f + "&s=" + p_quTicker + "&y=0&g=d&ignore=.csv"; ! url = "http:" + "//table.finance.yahoo.com/table.csv?a=" ! + a + "&b=" + b + "&c=" + c +"&d=" + d + "&e=" + e + "&f=" + f + "&s=" + p_quTicker + "&y=0&g=d&ignore=.csv"; int numTrials = 1; while(numTrials < 5) *************** *** 581,605 **** try { ! Req = (HttpWebRequest)WebRequest.Create("http:" + "//ichart.yahoo.com/table.csv?a=" ! + a + "&b=" + b + "&c=" + c +"&d=" + d + "&e=" + e + "&f=" + f + "&s=" + p_quTicker + "&y=0&g=d&ignore=.csv"); Req.Method = "GET"; Req.Timeout = ConstantsProvider.TimeOutValue; hwr = (HttpWebResponse)Req.GetResponse(); ! strm = hwr.GetResponseStream(); ! sr = new StreamReader(strm); ! response = this.isAtLeastOneDateAvailable(sr, daysOfTheTimeWindow ); ! sr.Close(); ! strm.Close(); ! //hwr.Close(); numTrials = 6; } catch (Exception exception) { string notUsed = exception.ToString(); numTrials++; } } return response; } private DateTime getMiddleDate(DateTime startingDate, DateTime endingDate) --- 567,601 ---- try { ! Req = (HttpWebRequest)WebRequest.Create( url ); Req.Method = "GET"; Req.Timeout = ConstantsProvider.TimeOutValue; hwr = (HttpWebResponse)Req.GetResponse(); ! this.stream = hwr.GetResponseStream(); ! this.streamReader = new StreamReader(this.stream); numTrials = 6; } + catch (Exception exception) { string notUsed = exception.ToString(); numTrials++; + //if(numTrials==6) + //throw new Exception("It has not been possible to set streams from Yahoo: \n\n" + + // "Check the connection to the internet or the following url: \n\n" + + // url,exception); } } + } + + + private bool getResponseForTimeWindow( DateTime initialDateOfTheTimeWindow, + int daysOfTheTimeWindow ) + { + this.setStreamsFromYahoo(initialDateOfTheTimeWindow, daysOfTheTimeWindow); + bool response = false; + response = this.isAtLeastOneDateAvailable(this.streamReader,daysOfTheTimeWindow ); return response; } + private DateTime getMiddleDate(DateTime startingDate, DateTime endingDate) *************** *** 615,619 **** DateTime endingDate) { - if(startingDate == this.INITIAL_DATE) // at the first call, when the actual parameters are INITIAL_DATE and now --- 611,614 ---- |
|
From: Marco M. <mi...@us...> - 2004-07-25 12:10:10
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5067/b3_Data/Selectors Modified Files: SelectionType.cs TickerSelector.cs Log Message: Changed names to the SelectionType enum and updated TickerSelector class Index: SelectionType.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/SelectionType.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SelectionType.cs 3 Jul 2004 19:19:56 -0000 1.2 --- SelectionType.cs 25 Jul 2004 12:10:02 -0000 1.3 *************** *** 30,37 **** public enum SelectionType { ! MostLiquid, ! BestPerformer/* ! LessVolatile, ! LessStatisticallyCorrelated*/ } } \ No newline at end of file --- 30,37 ---- public enum SelectionType { ! Liquidity, ! Performance/* ! Volatility, ! StatisticalCorrelation*/ } } \ No newline at end of file Index: TickerSelector.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/TickerSelector.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TickerSelector.cs 27 Jun 2004 19:20:31 -0000 1.4 --- TickerSelector.cs 25 Jul 2004 12:10:02 -0000 1.5 *************** *** 33,89 **** /// </summary> /// <remarks> ! /// Filter/selection results depend on the SelectionRule used for the instanciation ! /// of a new TickerSelector /// </remarks> - public class TickerSelector : ITickerSelector { private DataTable setOfTickersToBeSelected = null; ! private SelectionRule selectionRule; ! public TickerSelector(DataTable setOfTickersToBeSelected, SelectionRule selectionRule) { this.setOfTickersToBeSelected = setOfTickersToBeSelected; ! this.selectionRule = selectionRule; } ! public TickerSelector(SelectionRule selectionRule) { ! this.selectionRule = selectionRule; } //implementation of ITickerSelector public DataTable GetTableOfSelectedTickers() { ! if(this.setOfTickersToBeSelected == null && ! this.selectionRule.TypeOfSelection == SelectionType.MostLiquid) ! { ! return QuantProject.DataAccess.Tables.Quotes.GetMostLiquidTickers(this.selectionRule.GroupID, ! this.selectionRule.FirstQuoteDate, ! this.selectionRule.LastQuoteDate, ! this.selectionRule.MaxNumOfReturnedTickers); ! } ! else if(this.setOfTickersToBeSelected != null && ! this.selectionRule.TypeOfSelection == SelectionType.MostLiquid) ! { ! return QuantProject.DataAccess.Tables.Quotes.GetMostLiquidTickers(this.setOfTickersToBeSelected, ! this.selectionRule.FirstQuoteDate, ! this.selectionRule.LastQuoteDate, ! this.selectionRule.MaxNumOfReturnedTickers); ! } ! else if(this.setOfTickersToBeSelected == null && ! this.selectionRule.TypeOfSelection == SelectionType.BestPerformer) ! { ! return TickerDataTable.GetBestPerformingTickers(this.selectionRule.GroupID, ! this.selectionRule.FirstQuoteDate, ! this.selectionRule.LastQuoteDate, ! this.selectionRule.MaxNumOfReturnedTickers); ! } ! else ! return new DataTable(); ! //this line should never be reached!! } public void SelectAllTickers() { --- 33,184 ---- /// </summary> /// <remarks> ! /// Selection depends on the parameters used in the construction of a new TickerSelector object /// </remarks> public class TickerSelector : ITickerSelector { private DataTable setOfTickersToBeSelected = null; ! private SelectionType typeOfSelection; ! private string groupID = ""; ! private DateTime firstQuoteDate = QuantProject.ADT.ConstantsProvider.InitialDateTimeForDownload; ! private DateTime lastQuoteDate = DateTime.Now; ! private long maxNumOfReturnedTickers = 0; ! private bool isOrderedInASCMode; ! #region properties ! /// <summary> ! /// It gets the GroupID from which tickers have to be selected ! /// </summary> ! public string GroupID ! { ! get{return this.groupID;} ! } ! /// <summary> ! /// It gets the first date of selection for the quotes ! /// </summary> ! public DateTime FirstQuoteDate ! { ! get{return this.firstQuoteDate;} ! } ! /// <summary> ! /// It gets the last date of selection for the quotes ! /// </summary> ! public DateTime LastQuoteDate ! { ! get{return this.lastQuoteDate;} ! } ! ! /// <summary> ! /// It gets the max number of tickers to be returned ! /// </summary> ! public long MaxNumOfReturnedTickers ! { ! get{return this.maxNumOfReturnedTickers;} ! } ! /// <summary> ! /// It gets the type of selection provided by the Ticker Selector ! /// </summary> ! public SelectionType TypeOfSelection ! { ! get{return this.typeOfSelection;} ! } ! ! /// <summary> ! /// It gets / sets the order type for the ticker selector ! /// </summary> ! public bool IsOrderedInASCMode ! { ! get{return this.isOrderedInASCMode;} ! set{this.isOrderedInASCMode = value;} ! } ! ! #endregion ! ! public TickerSelector(DataTable setOfTickersToBeSelected, SelectionType typeOfSelection, ! bool orderInASCmode, ! string groupID, ! DateTime firstQuoteDate, ! DateTime lastQuoteDate, ! long maxNumOfReturnedTickers) { this.setOfTickersToBeSelected = setOfTickersToBeSelected; ! this.commonInitialization(typeOfSelection, orderInASCmode, groupID, firstQuoteDate,lastQuoteDate,maxNumOfReturnedTickers); } ! public TickerSelector(SelectionType typeOfSelection, ! bool orderInASCmode, ! string groupID, ! DateTime firstQuoteDate, ! DateTime lastQuoteDate, ! long maxNumOfReturnedTickers) { ! this.commonInitialization(typeOfSelection, orderInASCmode, groupID, firstQuoteDate,lastQuoteDate,maxNumOfReturnedTickers); } + private void commonInitialization(SelectionType typeOfSelection, + bool orderInASCmode, + string groupID, + DateTime firstQuoteDate, + DateTime lastQuoteDate, + long maxNumOfReturnedTickers) + { + this.typeOfSelection = typeOfSelection; + this.isOrderedInASCMode = orderInASCmode; + this.groupID = groupID; + this.firstQuoteDate = firstQuoteDate; + this.lastQuoteDate = lastQuoteDate; + this.maxNumOfReturnedTickers = maxNumOfReturnedTickers; + } + + //implementation of ITickerSelector public DataTable GetTableOfSelectedTickers() { ! switch (this.typeOfSelection) ! { ! case SelectionType.Liquidity: ! return this.getTickersByLiquidity(); ! case SelectionType.Performance: ! return this.getTickersByPerformance(); ! //this line should never be reached! ! default: ! return new DataTable(); ! } ! ! } ! ! private DataTable getTickersByLiquidity() ! { ! if(this.setOfTickersToBeSelected == null) ! return QuantProject.DataAccess.Tables.Quotes.GetTickersByLiquidity(this.isOrderedInASCMode, ! this.groupID, ! this.firstQuoteDate, ! this.lastQuoteDate, ! this.maxNumOfReturnedTickers); ! else ! return QuantProject.Data.DataTables.Quotes.GetTickersByLiquidity(this.isOrderedInASCMode, ! this.setOfTickersToBeSelected, ! this.firstQuoteDate, ! this.lastQuoteDate, ! this.maxNumOfReturnedTickers); } + private DataTable getTickersByPerformance() + { + if(this.setOfTickersToBeSelected == null) + return TickerDataTable.GetTickersByPerformance(this.isOrderedInASCMode, + this.groupID, + this.firstQuoteDate, + this.lastQuoteDate, + this.maxNumOfReturnedTickers); + else + return TickerDataTable.GetTickersByPerformance(this.isOrderedInASCMode, + this.setOfTickersToBeSelected, + this.firstQuoteDate, + this.lastQuoteDate, + this.maxNumOfReturnedTickers); + + } + public void SelectAllTickers() { *************** *** 96,106 **** /// </summary> /// <param name="dataGrid">The data grid from which the user has selected tickers</param> - - public static DataTable GetTableOfManuallySelectedTickers(DataGrid dataGrid) { DataTable dataTableOfDataGrid = (DataTable)dataGrid.DataSource; ! DataTable tableOfSelectedTickers = new DataTable(); ! TickerDataTable.AddColumnsOfTickerTable(tableOfSelectedTickers); int indexOfRow = 0; while(indexOfRow != dataTableOfDataGrid.Rows.Count) --- 191,198 ---- /// </summary> /// <param name="dataGrid">The data grid from which the user has selected tickers</param> public static DataTable GetTableOfManuallySelectedTickers(DataGrid dataGrid) { DataTable dataTableOfDataGrid = (DataTable)dataGrid.DataSource; ! DataTable tableOfSelectedTickers = dataTableOfDataGrid.Clone(); int indexOfRow = 0; while(indexOfRow != dataTableOfDataGrid.Rows.Count) *************** *** 108,118 **** if(dataGrid.IsSelected(indexOfRow)) { ! DataRow dataRow = tableOfSelectedTickers.NewRow(); ! dataRow[0] = dataTableOfDataGrid.Rows[indexOfRow][0]; ! //dataRow["tiTicker"] = dataTableOfDataGrid.Rows[indexOfRow][0]; ! ! dataRow[1] = dataTableOfDataGrid.Rows[indexOfRow][1]; ! //dataRow["tiCompanyName"] = dataTableOfDataGrid.Rows[indexOfRow][0]; ! tableOfSelectedTickers.Rows.Add(dataRow); } indexOfRow++; --- 200,204 ---- if(dataGrid.IsSelected(indexOfRow)) { ! tableOfSelectedTickers.ImportRow(dataTableOfDataGrid.Rows[indexOfRow]); } indexOfRow++; |
|
From: Marco M. <mi...@us...> - 2004-07-25 12:09:03
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4857/b2_DataAccess/Tables Modified Files: Quotes.cs Tickers_tickerGroups.cs Log Message: New methods to: - ExtendedDataTable class; - Quotes and Tickers_tickerGroups in DataAccess layer; - Quotes and TickerDataTable in Data layer Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Quotes.cs 27 Jun 2004 19:16:15 -0000 1.13 --- Quotes.cs 25 Jul 2004 12:08:53 -0000 1.14 *************** *** 93,96 **** --- 93,97 ---- /// <summary> /// Returns the adjusted close value for the given ticker at the specified date + /// is returned /// </summary> /// <param name="ticker">ticker for which the adj close has to be returned</param> *************** *** 103,107 **** --- 104,144 ---- return (float)dataTable.Rows[0][0]; } + /* moved now to the quotes object in the data layer, where the names are slightly different + + /// <summary> + /// Returns true if a quote is available for the given ticker at the given date + /// </summary> + /// <param name="ticker">ticker for which the check has to be done</param> + /// <param name="date">date of the check</param> + /// <returns></returns> + public static bool IsQuoteAvailable( string ticker, DateTime date ) + { + DataTable dataTable = SqlExecutor.GetDataTable( + "select quAdjustedClose from quotes where quTicker='" + ticker + "' " + + "and quDate=" + SQLBuilder.GetDateConstant(date) ); + string booleanStringValue = "false"; + if(dataTable.Rows.Count>0) + booleanStringValue = "True"; + return Boolean.Parse(booleanStringValue); + } + public static DateTime GetFollowingValidQuoteDate( string ticker, DateTime date ) + { + if(Quotes.IsQuoteAvailable(ticker, date)) + { + return date; + } + else return GetFollowingValidQuoteDate(ticker, date.AddDays(1)); + } + + public static DateTime GetPrecedingValidQuoteDate( string ticker, DateTime date ) + { + if(Quotes.IsQuoteAvailable(ticker, date)) + { + return date; + } + else return GetPrecedingValidQuoteDate(ticker, date.Subtract(new TimeSpan(1,0,0))); + } + */ /// <summary> /// It provides updating the database for each closeToCloseRatio contained in the given table *************** *** 352,356 **** /// </summary> ! public static DataTable GetMostLiquidTickers( string groupID, DateTime firstQuoteDate, DateTime lastQuoteDate, --- 389,393 ---- /// </summary> ! public static DataTable GetTickersByLiquidity( bool orderInASCMode, string groupID, DateTime firstQuoteDate, DateTime lastQuoteDate, *************** *** 367,409 **** SQLBuilder.GetDateConstant(lastQuoteDate) + "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + ! "ORDER BY Avg([quVolume]*[quAdjustedClose]) DESC"; ! return SqlExecutor.GetDataTable( sql ); } /// <summary> ! /// returns most liquid tickers within the given set of tickers /// </summary> ! ! public static DataTable GetMostLiquidTickers( DataTable setOfTickers, ! DateTime firstQuoteDate, ! DateTime lastQuoteDate, ! long maxNumOfReturnedTickers) { - setOfTickers.Columns.Add("IndexOfLiquidity", System.Type.GetType("System.Double")); - DataTable getMostLiquidTicker = setOfTickers.Clone(); DataTable dt; ! foreach(DataRow row in setOfTickers.Rows) ! { ! string sql = "SELECT quotes.quTicker, " + ! "Avg([quVolume]*[quAdjustedClose]) AS AverageTradedValue " + ! "FROM quotes WHERE quTicker ='" + ! (string)row[0] + "' " + ! "AND quotes.quDate BETWEEN " + SQLBuilder.GetDateConstant(firstQuoteDate) + ! " AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + ! " GROUP BY quotes.quTicker"; ! dt = SqlExecutor.GetDataTable( sql ); ! row["IndexOfLiquidity"] = (double)dt.Rows[0]["AverageTradedValue"]; ! } ! DataRow[] orderedRows = setOfTickers.Select("", "IndexOfLiquidity DESC"); ! object[] valuesToAdd = new object[3]; ! for(long i = 0;i<maxNumOfReturnedTickers && i<setOfTickers.Rows.Count;i++) ! { ! valuesToAdd[0]=orderedRows[i][0]; ! valuesToAdd[1]=orderedRows[i][1]; ! valuesToAdd[2]=orderedRows[i][2]; ! getMostLiquidTicker.Rows.Add(valuesToAdd); ! } ! return getMostLiquidTicker; ! } #region GetHashValue --- 404,437 ---- SQLBuilder.GetDateConstant(lastQuoteDate) + "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + ! "ORDER BY Avg([quVolume]*[quAdjustedClose])"; ! 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> ! public static double GetAverageTradedValue( string ticker, ! DateTime firstQuoteDate, ! DateTime lastQuoteDate) ! { DataTable dt; ! string sql = "SELECT quotes.quTicker, " + ! "Avg([quVolume]*[quAdjustedClose]) AS AverageTradedValue " + ! "FROM quotes WHERE quTicker ='" + ! ticker + "' " + ! "AND quotes.quDate BETWEEN " + SQLBuilder.GetDateConstant(firstQuoteDate) + ! " AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + ! " GROUP BY quotes.quTicker"; ! dt = SqlExecutor.GetDataTable( sql ); ! if(dt.Rows.Count==0) ! return 0; ! else ! return (double)dt.Rows[0]["AverageTradedValue"]; ! } #region GetHashValue *************** *** 501,518 **** /// Returns the quotes for the given instrument , since startDate to endDate /// </summary> ! /// <param name="ticker"></param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <returns></returns> ! public static void SetDataTable( string ticker , DateTime startDate , DateTime endDate , DataTable dataTable) { ! string sql = ! "select * from quotes " + ! "where " + Quotes.TickerFieldName + "='" + ticker + "' " + ! "and " + Quotes.Date + ">=" + SQLBuilder.GetDateConstant( startDate ) + " " + ! "and " + Quotes.Date + "<=" + SQLBuilder.GetDateConstant( endDate ) + " " + ! "order by " + Quotes.Date; ! SqlExecutor.SetDataTable( sql , dataTable ); } --- 529,555 ---- /// Returns the quotes for the given instrument , since startDate to endDate /// </summary> ! /// <param name="tickerOrGroupID">The symbol of a ticker or the groupID corresponding to a specific set of tickers</param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <returns></returns> ! public static void SetDataTable( string tickerOrGroupID , DateTime startDate , DateTime endDate , DataTable dataTable) { ! string sql; ! if(Tickers_tickerGroups.HasTickers(tickerOrGroupID)) ! sql = "select * from quotes INNER JOIN tickers_tickerGroups ON " + ! "quotes." + Quotes.TickerFieldName + "=tickers_tickerGroups." + Tickers_tickerGroups.Ticker + " " + ! "where " + Tickers_tickerGroups.GroupID + "='" + tickerOrGroupID + "' " + ! "and " + Quotes.Date + ">=" + SQLBuilder.GetDateConstant( startDate ) + " " + ! "and " + Quotes.Date + "<=" + SQLBuilder.GetDateConstant( endDate ) + " " + ! "order by " + Quotes.Date; ! else ! sql = "select * from quotes " + ! "where " + Quotes.TickerFieldName + "='" + tickerOrGroupID + "' " + ! "and " + Quotes.Date + ">=" + SQLBuilder.GetDateConstant( startDate ) + " " + ! "and " + Quotes.Date + "<=" + SQLBuilder.GetDateConstant( endDate ) + " " + ! "order by " + Quotes.Date; ! ! SqlExecutor.SetDataTable( sql , dataTable ); } Index: Tickers_tickerGroups.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Tickers_tickerGroups.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Tickers_tickerGroups.cs 27 Jun 2004 19:20:30 -0000 1.2 --- Tickers_tickerGroups.cs 25 Jul 2004 12:08:53 -0000 1.3 *************** *** 92,95 **** --- 92,107 ---- } + /// <summary> + /// It returns true if some tickers are grouped in the given groupID + /// </summary> + public static bool HasTickers( string groupID) + { + /// TO DO use a join in order to return a table with tiTicker and company name + DataTable tickers = SqlExecutor.GetDataTable("SELECT " + Tickers_tickerGroups.Ticker + " FROM tickers_tickerGroups " + + "WHERE " + Tickers_tickerGroups.GroupID + "='" + + groupID + "'"); + return tickers.Rows.Count > 0; + } + } |
|
From: Marco M. <mi...@us...> - 2004-07-25 12:09:03
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4857/b3_Data/DataTables Modified Files: Quotes.cs TickerDataTable.cs Log Message: New methods to: - ExtendedDataTable class; - Quotes and Tickers_tickerGroups in DataAccess layer; - Quotes and TickerDataTable in Data layer Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/Quotes.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Quotes.cs 27 May 2004 16:45:38 -0000 1.3 --- Quotes.cs 25 Jul 2004 12:08:53 -0000 1.4 *************** *** 25,28 **** --- 25,52 ---- public static string AdjustedCloseToCloseRatio = "quAdjustedCloseToCloseRatio"; + /// <summary> + /// returns most liquid tickers within the given set of tickers + /// </summary> + + public static DataTable GetTickersByLiquidity( bool orderByASC, + DataTable setOfTickers, + DateTime firstQuoteDate, + DateTime lastQuoteDate, + long maxNumOfReturnedTickers) + { + if(!setOfTickers.Columns.Contains("AverageTradedValue")) + setOfTickers.Columns.Add("AverageTradedValue", System.Type.GetType("System.Double")); + foreach(DataRow row in setOfTickers.Rows) + { + row["AverageTradedValue"] = + QuantProject.DataAccess.Tables.Quotes.GetAverageTradedValue((string)row[0], + firstQuoteDate, + lastQuoteDate); + } + DataTable getMostLiquidTicker = ExtendedDataTable.CopyAndSort(setOfTickers,"AverageTradedValue", orderByASC); + ExtendedDataTable.DeleteRows(getMostLiquidTicker, maxNumOfReturnedTickers); + return getMostLiquidTicker; + } + private History history; *************** *** 36,43 **** --- 60,93 ---- } + /// <summary> + /// Gets the date of the first quote contained into the Quotes object + /// </summary> + /// <returns></returns> + public DateTime StartDate + { + get{ return ((DateTime)this.Rows[ 0 ][ Quotes.Date ]); } + } + /// <summary> + /// Gets the date of the last quote contained into the Quotes object + /// </summary> + /// <returns></returns> + public DateTime EndDate + { + get{ return ((DateTime)this.Rows[ this.Rows.Count - 1 ][ Quotes.Date ]); } + } + + private void setPrimaryKeys() + { + DataColumn[] columnPrimaryKeys = new DataColumn[1]; + columnPrimaryKeys[0] = this.Columns[Quotes.Date]; + this.PrimaryKey = columnPrimaryKeys; + } + + private void fillDataTable( string ticker , DateTime startDate , DateTime endDate ) { QuantProject.DataAccess.Tables.Quotes.SetDataTable( ticker , startDate , endDate , this ); + this.setPrimaryKeys(); } public Quotes( string ticker , DateTime startDate , DateTime endDate ) *************** *** 158,165 **** setHistory(); return (DateTime) history.GetKey( Math.Max( 0 , ! history.IndexOfKeyOrPrevious( quoteDate ) - followingDays ) ); } // public DateTime GetPrecedingDate( DateTime quoteDate , int precedingDays ) --- 208,299 ---- setHistory(); return (DateTime) history.GetKey( Math.Max( 0 , ! history.IndexOfKeyOrPrevious( quoteDate ) + followingDays ) ); } + /// <summary> + /// Returns true if a quote is available at the given date + /// </summary> + /// <param name="date">date</param> + /// <returns></returns> + public bool HasDate( DateTime date ) + { + /*alternative code, but primary keys need to be set first + bool hasDate; + hasDate = this.Rows.Contains(date.Date); + return hasDate;*/ + setHistory(); + return this.history.ContainsKey(date.Date); + } + /// <summary> + /// If the ticker has a quote at the given date, then it returns the given date, + /// else it returns the immediate following date at which a quote is available + /// </summary> + /// <param name="date">date</param> + /// <returns></returns> + public DateTime GetQuoteDateOrFollowing(DateTime date ) + { + if(this.HasDate(date)) + { + return date; + } + else + { + return GetQuoteDateOrFollowing(date.AddDays(1)); + } + } + /// <summary> + /// If the ticker has a quote at the given date, then it returns the given date, + /// else it returns the immediate preceding date at which a quote is available + /// </summary> + /// <param name="date">date</param> + /// <returns></returns> + public DateTime GetQuoteDateOrPreceding( DateTime date ) + { + if(this.HasDate(date)) + { + return date; + } + else + { + return GetQuoteDateOrPreceding(date.AddDays(-1)); + } + } + + /// <summary> + /// If the ticker has a quote at the given date, then it returns the given date, + /// else it returns the first valid following date at which a quote is available + /// (or the first valid preceding date, in case date is >= the last available quote) + /// </summary> + /// <param name="date">date</param> + /// <returns></returns> + public DateTime GetFirstValidQuoteDate(DateTime date) + { + DateTime startDate = this.StartDate; + DateTime endDate = this.EndDate; + if(date<startDate || (date>=startDate && date<=endDate)) + { + return this.GetQuoteDateOrFollowing(date); + } + else + { + return this.GetQuoteDateOrPreceding(date); + } + } + + /// <summary> + /// Gets the adjusted close at the given date + /// </summary> + /// <returns></returns> + public float GetAdjustedClose(DateTime date ) + { + object[] keys = new object[1]; + keys[0] = date.Date; + DataRow foundRow = this.Rows.Find(keys); + if(foundRow==null) + throw new Exception("No quote for such a date!"); + return (float)foundRow[Quotes.AdjustedClose]; + } + // public DateTime GetPrecedingDate( DateTime quoteDate , int precedingDays ) *************** *** 173,174 **** --- 307,309 ---- } } + Index: TickerDataTable.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/TickerDataTable.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TickerDataTable.cs 27 Jun 2004 19:20:31 -0000 1.2 --- TickerDataTable.cs 25 Jul 2004 12:08:53 -0000 1.3 *************** *** 59,63 **** } ! public static DataTable GetBestPerformingTickers(string groupID, DateTime firstQuoteDate, DateTime lastQuoteDate, --- 59,63 ---- } ! public static DataTable GetTickersByPerformance(bool orderByASC, string groupID, DateTime firstQuoteDate, DateTime lastQuoteDate, *************** *** 65,95 **** { DataTable groupOfTicker = Tickers_tickerGroups.GetTickers(groupID); ! //TO DO change to a structure compatible with TickerDataTable ! groupOfTicker.Columns.Add("SimpleReturn", System.Type.GetType("System.Double")); ! try { ! double firstQuote, lastQuote; ! foreach(DataRow row in groupOfTicker.Rows) { ! firstQuote = QuantProject.DataAccess.Tables.Quotes.GetAdjustedClose((string)row[0], ! firstQuoteDate); ! lastQuote = QuantProject.DataAccess.Tables.Quotes.GetAdjustedClose((string)row[0], ! lastQuoteDate); row["SimpleReturn"] = (lastQuote - firstQuote) / firstQuote; } - } ! catch(Exception ex) ! { ! System.Windows.Forms.MessageBox.Show(ex.ToString()); ! } ! ExtendedDataTable.Sort(groupOfTicker, "SimpleReturn"); ExtendedDataTable.DeleteRows(groupOfTicker, maxNumOfReturnedTickers); return groupOfTicker; } ! } } --- 65,132 ---- { DataTable groupOfTicker = Tickers_tickerGroups.GetTickers(groupID); ! //also possible, but slower: ! //return TickerDataTable.GetBestPerformingTickers(orderByASC, groupOfTicker, firstQuoteDate, ! // lastQuoteDate, maxNumOfReturnedTickers); ! ! TickerDataTable.addColumnsForPerformanceAnalysis(groupOfTicker); ! DateTime firstAvailableQuoteDate, lastAvailableQuoteDate; ! double firstQuote, lastQuote; ! QuantProject.Data.DataTables.GroupQuotes tickerQuotes = ! new QuantProject.Data.DataTables.GroupQuotes( ! groupID, new DateTime(1980,1,1), DateTime.Now); ! foreach(DataRow row in groupOfTicker.Rows) { ! if(tickerQuotes.GetNumberOfQuotes((string)row[0])>0) { ! firstAvailableQuoteDate = tickerQuotes.GetFirstValidQuoteDate((string)row[0], firstQuoteDate); ! lastAvailableQuoteDate = tickerQuotes.GetFirstValidQuoteDate((string)row[0], lastQuoteDate); ! firstQuote = tickerQuotes.GetAdjustedClose((string)row[0],firstAvailableQuoteDate); ! lastQuote = tickerQuotes.GetAdjustedClose((string)row[0],lastAvailableQuoteDate); row["SimpleReturn"] = (lastQuote - firstQuote) / firstQuote; + row["PeriodForSimpleReturn"] = "From " + firstAvailableQuoteDate.ToShortDateString() + " to " + lastAvailableQuoteDate.ToShortDateString(); } } ! ExtendedDataTable.Sort(groupOfTicker, "SimpleReturn", orderByASC); ExtendedDataTable.DeleteRows(groupOfTicker, maxNumOfReturnedTickers); return groupOfTicker; } + + public static DataTable GetTickersByPerformance(bool orderByASC, DataTable setOfTickers, + DateTime firstQuoteDate, + DateTime lastQuoteDate, + long maxNumOfReturnedTickers) + { + TickerDataTable.addColumnsForPerformanceAnalysis(setOfTickers); + DateTime firstAvailableQuoteDate, lastAvailableQuoteDate; + double firstQuote, lastQuote; + foreach(DataRow row in setOfTickers.Rows) + { + if(QuantProject.DataAccess.Tables.Quotes.GetNumberOfQuotes((string)row[0]) > 0) + { + QuantProject.Data.DataTables.Quotes quotesOfCurrentTicker = + new QuantProject.Data.DataTables.Quotes((string)row[0]); + firstAvailableQuoteDate = quotesOfCurrentTicker.GetFirstValidQuoteDate(firstQuoteDate); + lastAvailableQuoteDate = quotesOfCurrentTicker.GetFirstValidQuoteDate(lastQuoteDate); + firstQuote = quotesOfCurrentTicker.GetAdjustedClose(firstAvailableQuoteDate); + lastQuote = quotesOfCurrentTicker.GetAdjustedClose(lastAvailableQuoteDate); + row["SimpleReturn"] = (lastQuote - firstQuote) / firstQuote; + row["PeriodForSimpleReturn"] = "From " + firstAvailableQuoteDate.ToShortDateString() + " to " + lastAvailableQuoteDate.ToShortDateString(); + } + } + ExtendedDataTable.Sort(setOfTickers, "SimpleReturn", orderByASC); + ExtendedDataTable.DeleteRows(setOfTickers, maxNumOfReturnedTickers); + return setOfTickers; + } + private static void addColumnsForPerformanceAnalysis(DataTable tableToAnalyze) + { + if(!tableToAnalyze.Columns.Contains("SimpleReturn")) + tableToAnalyze.Columns.Add("SimpleReturn", System.Type.GetType("System.Double")); + if(!tableToAnalyze.Columns.Contains("PeriodForSimpleReturn")) + tableToAnalyze.Columns.Add("PeriodForSimpleReturn", System.Type.GetType("System.String")); + } ! } } |
|
From: Marco M. <mi...@us...> - 2004-07-25 12:09:01
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4857/b1_ADT Modified Files: ExtendedDataTable.cs Log Message: New methods to: - ExtendedDataTable class; - Quotes and Tickers_tickerGroups in DataAccess layer; - Quotes and TickerDataTable in Data layer Index: ExtendedDataTable.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ExtendedDataTable.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExtendedDataTable.cs 27 Jun 2004 19:15:02 -0000 1.2 --- ExtendedDataTable.cs 25 Jul 2004 12:08:52 -0000 1.3 *************** *** 19,49 **** /// Sort the given DataTable by the specified field, in a DESC mode /// </summary> ! ! public static void Sort(DataTable tableToSort, string sortingFieldName) { DataTable copyOfTableToSort = tableToSort.Copy(); ! DataRow[] orderedRows = copyOfTableToSort.Select("", sortingFieldName + " DESC"); ! int numRows = tableToSort.Rows.Count; ! int numColumns = tableToSort.Columns.Count; ! object[] valuesToAdd = new object[numColumns]; tableToSort.Rows.Clear(); ! for(int i = 0;i<numRows;i++) { ! for(int j = 0;j<numColumns;j++) ! { ! valuesToAdd[j]=orderedRows[i][j]; ! } ! tableToSort.Rows.Add(valuesToAdd); } - tableToSort.AcceptChanges(); - } ! public static void DeleteRows(DataTable tableWithRowsToDelete, long indexOfRowFromWhichDeletionHasToBeDone) { ! for(long i = indexOfRowFromWhichDeletionHasToBeDone;i<tableWithRowsToDelete.Rows.Count;i++) { ! tableWithRowsToDelete.Rows.RemoveAt((int)i); } - tableWithRowsToDelete.AcceptChanges(); } --- 19,59 ---- /// Sort the given DataTable by the specified field, in a DESC mode /// </summary> ! public static void Sort(DataTable tableToSort, string sortingFieldName, bool sortByASC) { DataTable copyOfTableToSort = tableToSort.Copy(); ! string sortDirection = " DESC"; ! if(sortByASC) ! sortDirection = " ASC"; ! DataRow[] orderedRows = copyOfTableToSort.Select("", sortingFieldName + sortDirection); tableToSort.Rows.Clear(); ! for(int i = 0;i<orderedRows.Length;i++) { ! tableToSort.ImportRow(orderedRows[i]); } } ! ! /// <summary> ! /// Copy the given DataTable into another DataTable, sorting by the specified field, in a DESC mode ! /// </summary> ! public static DataTable CopyAndSort(DataTable tableToCopyAndSort, string sortingFieldName, bool sortByASC) { ! DataTable copyOfTableToCopyAndSort = tableToCopyAndSort.Clone(); ! string sortDirection = " DESC"; ! if(sortByASC) ! sortDirection = " ASC"; ! DataRow[] orderedRows = tableToCopyAndSort.Select("", sortingFieldName + sortDirection); ! for(int i = 0;i<orderedRows.Length;i++) { ! copyOfTableToCopyAndSort.ImportRow(orderedRows[i]); ! } ! return copyOfTableToCopyAndSort; ! } ! ! public static void DeleteRows(DataTable table, long fromIndex) ! { ! for(long i = table.Rows.Count - 1;i>=fromIndex; i=table.Rows.Count-1) ! { ! table.Rows.RemoveAt((int)i); } } |
|
From: Marco M. <mi...@us...> - 2004-07-25 12:04:18
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4129/b3_Data Modified Files: b3_Data.csproj Log Message: Added GroupQuotes to the project and removed SelectionRule class. Index: b3_Data.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/b3_Data.csproj,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** b3_Data.csproj 7 Jul 2004 20:23:13 -0000 1.6 --- b3_Data.csproj 25 Jul 2004 12:04:05 -0000 1.7 *************** *** 142,145 **** --- 142,150 ---- /> <File + RelPath = "DataTables\GroupQuotes.cs" + SubType = "Component" + BuildAction = "Compile" + /> + <File RelPath = "DataTables\Quotes.cs" SubType = "Component" *************** *** 187,195 **** /> <File - RelPath = "Selectors\SelectionRule.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "Selectors\SelectionType.cs" SubType = "Code" --- 192,195 ---- |
|
From: Marco M. <mi...@us...> - 2004-07-25 12:04:18
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4129/b5_Presentation Modified Files: b5_Presentation.csproj Log Message: Added GroupQuotes to the project and removed SelectionRule class. Index: b5_Presentation.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/b5_Presentation.csproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** b5_Presentation.csproj 7 Jul 2004 20:24:48 -0000 1.4 --- b5_Presentation.csproj 25 Jul 2004 12:04:05 -0000 1.5 *************** *** 120,124 **** Name = "scpl" AssemblyName = "scpl" ! HintPath = "..\b91_QuantProject\bin\Debug\scpl.dll" /> </References> --- 120,124 ---- Name = "scpl" AssemblyName = "scpl" ! HintPath = "..\..\lib\scpl.dll" /> </References> |