quantproject-developers Mailing List for QuantProject (Page 114)
Brought to you by:
glauco_1
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
(103) |
Dec
(67) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(52) |
Feb
(9) |
Mar
(69) |
Apr
(53) |
May
(80) |
Jun
(23) |
Jul
(24) |
Aug
(112) |
Sep
(9) |
Oct
|
Nov
(58) |
Dec
(93) |
| 2005 |
Jan
(90) |
Feb
(93) |
Mar
(61) |
Apr
(56) |
May
(37) |
Jun
(61) |
Jul
(55) |
Aug
(68) |
Sep
(25) |
Oct
(46) |
Nov
(41) |
Dec
(37) |
| 2006 |
Jan
(33) |
Feb
(7) |
Mar
(19) |
Apr
(27) |
May
(73) |
Jun
(49) |
Jul
(83) |
Aug
(66) |
Sep
(45) |
Oct
(16) |
Nov
(15) |
Dec
(7) |
| 2007 |
Jan
(14) |
Feb
(33) |
Mar
|
Apr
(21) |
May
|
Jun
(34) |
Jul
(18) |
Aug
(100) |
Sep
(39) |
Oct
(55) |
Nov
(12) |
Dec
(2) |
| 2008 |
Jan
(120) |
Feb
(133) |
Mar
(129) |
Apr
(104) |
May
(42) |
Jun
(2) |
Jul
(52) |
Aug
(99) |
Sep
(134) |
Oct
|
Nov
(137) |
Dec
(48) |
| 2009 |
Jan
(48) |
Feb
(55) |
Mar
(61) |
Apr
(3) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(51) |
Sep
|
Oct
(7) |
Nov
|
Dec
|
| 2010 |
Jan
(7) |
Feb
(1) |
Mar
(145) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(8) |
Dec
|
| 2011 |
Jan
(78) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(88) |
Sep
(6) |
Oct
(1) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Marco M. <mi...@us...> - 2005-03-13 23:38:56
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32262/b5_Presentation/Reporting/WindowsForm Modified Files: ReportShower.cs Log Message: Added try/catch blocks, to avoid run time errors; added code to retrieve at open the date of the last trade in report Index: ReportShower.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm/ReportShower.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ReportShower.cs 12 Feb 2005 19:02:02 -0000 1.1 --- ReportShower.cs 13 Mar 2005 23:38:40 -0000 1.2 *************** *** 44,48 **** private Report report; private System.Windows.Forms.Label label4; ! private System.Windows.Forms.TextBox index; /// <summary> --- 44,48 ---- private Report report; private System.Windows.Forms.Label label4; ! private System.Windows.Forms.TextBox benchmark; /// <summary> *************** *** 60,63 **** --- 60,64 ---- // this.report = report; + this.endingDate.Value = this.report.GetLastTradeDate(); // } *************** *** 93,97 **** this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); ! this.index = new System.Windows.Forms.TextBox(); ((System.ComponentModel.ISupportInitialize)(this.numDaysForEquityLine)).BeginInit(); this.SuspendLayout(); --- 94,98 ---- this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); ! this.benchmark = new System.Windows.Forms.TextBox(); ((System.ComponentModel.ISupportInitialize)(this.numDaysForEquityLine)).BeginInit(); this.SuspendLayout(); *************** *** 168,180 **** this.label4.Size = new System.Drawing.Size(96, 16); this.label4.TabIndex = 8; ! this.label4.Text = "Index"; // ! // index // ! this.index.Location = new System.Drawing.Point(106, 160); ! this.index.Name = "index"; ! this.index.Size = new System.Drawing.Size(176, 20); ! this.index.TabIndex = 7; ! this.index.Text = ""; // // ReportShower --- 169,181 ---- this.label4.Size = new System.Drawing.Size(96, 16); this.label4.TabIndex = 8; ! this.label4.Text = "Benchmark"; // ! // benchmark // ! this.benchmark.Location = new System.Drawing.Point(106, 160); ! this.benchmark.Name = "benchmark"; ! this.benchmark.Size = new System.Drawing.Size(176, 20); ! this.benchmark.TabIndex = 7; ! this.benchmark.Text = ""; // // ReportShower *************** *** 184,188 **** this.Controls.AddRange(new System.Windows.Forms.Control[] { this.label4, ! this.index, this.label3, this.label2, --- 185,189 ---- this.Controls.AddRange(new System.Windows.Forms.Control[] { this.label4, ! this.benchmark, this.label3, this.label2, *************** *** 202,211 **** private void buttonShowReport_Click(object sender, System.EventArgs e) { ! this.report.Clear(); ! this.report.Show(this.reportName.Text, (int)this.numDaysForEquityLine.Value, ! new EndOfDayDateTime(this.endingDate.Value, ! EndOfDaySpecificTime.MarketClose), ! this.index.Text); ! } } --- 203,221 ---- private void buttonShowReport_Click(object sender, System.EventArgs e) { ! try ! { ! if(this.benchmark.Text == "") ! throw new Exception("Benchmark symbol is requested!"); ! this.report.Clear(); ! this.report.Show(this.reportName.Text, (int)this.numDaysForEquityLine.Value, ! new EndOfDayDateTime(this.endingDate.Value, ! EndOfDaySpecificTime.MarketClose), ! this.benchmark.Text); ! } ! ! catch(Exception ex) ! { ! MessageBox.Show(ex.ToString()); ! } } } |
|
From: Marco M. <mi...@us...> - 2005-03-13 23:34:51
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31180/b5_Presentation/Reporting/WindowsForm Modified Files: Report.cs Log Message: Added GetLastTradeDate method, to get the date of the last trade viewed in report. Index: Report.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm/Report.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Report.cs 15 Feb 2005 19:09:05 -0000 1.8 --- Report.cs 13 Mar 2005 23:34:40 -0000 1.9 *************** *** 94,98 **** this.accountReport = null; } ! // /// <summary> // /// Imports an existing account report --- 94,107 ---- this.accountReport = null; } ! ! /// <summary> ! /// Gets the date of the last trade ! /// </summary> ! public DateTime GetLastTradeDate() ! { ! object returnValue; ! returnValue = this.account.Transactions.GetKey(this.account.Transactions.Count -1); ! return (DateTime)returnValue; ! } // /// <summary> // /// Imports an existing account report |
|
From: Marco M. <mi...@us...> - 2005-03-13 20:29:04
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15243/b7_Scripts/TickerSelectionTesting Modified Files: RunEfficientCTOPortfolio.cs Log Message: Added appSettings section to the app.config file. Added keys inside appSettings in order to set directory paths where to save accounts and reports resulting from execution of scripts. Index: RunEfficientCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTOPortfolio.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** RunEfficientCTOPortfolio.cs 27 Feb 2005 19:56:08 -0000 1.14 --- RunEfficientCTOPortfolio.cs 13 Mar 2005 20:28:54 -0000 1.15 *************** *** 99,105 **** this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2004 , 9 , 1 ) , EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2004 , 9 , 10 ) , EndOfDaySpecificTime.OneHourAfterMarketClose ); //this.numIntervalDays = 3; } --- 99,105 ---- this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2004 , 10 , 1 ) , EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2004 , 10 , 11 ) , EndOfDaySpecificTime.OneHourAfterMarketClose ); //this.numIntervalDays = 3; } *************** *** 213,225 **** this.generationNumberForGeneticOptimizer + "PopSize" + this.populationSizeForGeneticOptimizer; ! AccountReport accountReport = this.account.CreateReport(name,1,this.endDateTime,"^MIBTEL", ! new HistoricalAdjustedQuoteProvider()); ! ObjectArchiver.Archive(accountReport, ! "C:\\Documents and Settings\\Marco\\Documenti\\ProgettiOpenSource\\Quant\\SavedReports\\OpenCloseScripts\\" + ! name + ".rep"); ! //ObjectArchiver.Archive(this.account, ! // "C:\\Documents and Settings\\Marco\\Documenti\\ProgettiOpenSource\\Quant\\SavedAccounts\\OpenCloseScripts\\" + ! // name + ".acc"); } --- 213,227 ---- this.generationNumberForGeneticOptimizer + "PopSize" + this.populationSizeForGeneticOptimizer; ! //AccountReport accountReport = this.account.CreateReport(name,1,this.endDateTime,"^MIBTEL", ! // new HistoricalAdjustedQuoteProvider()); ! //ObjectArchiver.Archive(accountReport, ! // System.Configuration.ConfigurationSettings.AppSettings["ReportsArchive"] + ! // "\\OpenCloseScripts\\" + ! // name + ".rep"); ! ObjectArchiver.Archive(this.account, ! System.Configuration.ConfigurationSettings.AppSettings["AccountsArchive"] + ! "\\OpenCloseScripts\\" + ! name + ".acc"); } |
|
From: Marco M. <mi...@us...> - 2005-03-13 20:29:04
|
Update of /cvsroot/quantproject/QuantProject/b91_QuantProject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15243/b91_QuantProject Modified Files: app.config Log Message: Added appSettings section to the app.config file. Added keys inside appSettings in order to set directory paths where to save accounts and reports resulting from execution of scripts. Index: app.config =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b91_QuantProject/app.config,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** app.config 12 Aug 2004 14:48:06 -0000 1.1 --- app.config 13 Mar 2005 20:28:54 -0000 1.2 *************** *** 1,6 **** <?xml version="1.0" encoding="utf-8" ?> <configuration> ! <startup> ! <supportedRuntime version="v1.1.4322" /> ! </startup> </configuration> \ No newline at end of file --- 1,13 ---- <?xml version="1.0" encoding="utf-8" ?> + <configuration> ! <startup> ! <supportedRuntime version="v1.1.4322" /> ! </startup> ! ! <appSettings> ! <add key="AccountsArchive" value="C:\\Documents and Settings\\Marco\\Documenti\\ProgettiOpenSource\\Quant\\SavedAccounts\\" /> ! <add key="ReportsArchive" value="C:\\Documents and Settings\\Marco\\Documenti\\ProgettiOpenSource\\Quant\\SavedReports\\" /> ! </appSettings> ! </configuration> \ No newline at end of file |
|
From: Marco M. <mi...@us...> - 2005-03-13 20:26:10
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14279/b5_Presentation/Reporting/WindowsForm Modified Files: AccountViewer.cs Log Message: Added new constructor to the class. It is now possible to load the account viewer form using a IList containg the accounts to view (this function hasn't be tested yet. Just try ...). AccountViewer is now complete. Index: AccountViewer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm/AccountViewer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AccountViewer.cs 12 Mar 2005 23:53:22 -0000 1.1 --- AccountViewer.cs 13 Mar 2005 20:25:57 -0000 1.2 *************** *** 43,46 **** --- 43,68 ---- } + private void fillAccountsArrayList(IList accountList) + { + foreach(object item in accountList) + { + this.accountsArrayList.Add((Account)item); + } + // + } + + public AccountViewer(IList accountList) + { + + // + InitializeComponent(); + this.fillAccountsArrayList(accountList); + this.setTableAndGrid(); + this.updateForm(); + // + // TODO: + // + } + private void setTableAndGrid() { |
|
From: Glauco S. <gla...@us...> - 2005-03-13 14:28:24
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9962/b7_Scripts/WalkForwardTesting/WalkForwardOneRank Modified Files: ComparableAccount.cs Log Message: Added the Serializable attribute Index: ComparableAccount.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank/ComparableAccount.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ComparableAccount.cs 20 Jan 2005 01:19:24 -0000 1.5 --- ComparableAccount.cs 13 Mar 2005 14:28:14 -0000 1.6 *************** *** 34,37 **** --- 34,38 ---- /// Summary description for ComparableAccount. /// </summary> + [Serializable] public class ComparableAccount : Account { |
|
From: Marco M. <mi...@us...> - 2005-03-12 23:58:21
|
Update of /cvsroot/quantproject/QuantProject/b91_QuantProject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21119/b91_QuantProject Modified Files: Main.cs b91_QuantProject.csproj Removed Files: AccountViewer.cs Log Message: AccountViewer moved from QuantProject layer to Presentation. Added reference to Presentation project in order to use AccountViewer object within the Main form. Index: Main.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b91_QuantProject/Main.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Main.cs 15 Feb 2005 19:13:42 -0000 1.12 --- Main.cs 12 Mar 2005 23:58:02 -0000 1.13 *************** *** 33,36 **** --- 33,37 ---- using QuantProject.Scripts.WalkForwardTesting.WalkForwardOneRank; using QuantProject.Scripts.CallingReportsForRunScripts; + using QuantProject.Presentation.Reporting.WindowsForm; *************** *** 325,329 **** // new RunEfficientCTCPorfolio().Run(); //new RunOneRank().Run(); ! new RunEfficientCTOPorfolio("STOCKMI",70,5,30,2,1000).Run(); // } // catch ( Exception ex ) --- 326,331 ---- // new RunEfficientCTCPorfolio().Run(); //new RunOneRank().Run(); ! new RunEfficientCTOPorfolio("STOCKMI",80,4,45,2,1000).Run(); ! new RunEfficientCTOPorfolio("STOCKMI",80,4,45,2,2500).Run(); // } // catch ( Exception ex ) Index: b91_QuantProject.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b91_QuantProject/b91_QuantProject.csproj,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** b91_QuantProject.csproj 26 Feb 2005 15:10:49 -0000 1.8 --- b91_QuantProject.csproj 12 Mar 2005 23:58:02 -0000 1.9 *************** *** 98,101 **** --- 98,106 ---- Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> + <Reference + Name = "b5_Presentation" + Project = "{D3DC9EA6-3B06-4255-B19A-5FC5B66A1402}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> </References> </Build> *************** *** 103,116 **** <Include> <File - RelPath = "AccountViewer.cs" - SubType = "Form" - BuildAction = "Compile" - /> - <File - RelPath = "AccountViewer.resx" - DependentUpon = "AccountViewer.cs" - BuildAction = "EmbeddedResource" - /> - <File RelPath = "app.config" BuildAction = "None" --- 108,111 ---- --- AccountViewer.cs DELETED --- |
|
From: Marco M. <mi...@us...> - 2005-03-12 23:53:44
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20021/b5_Presentation Modified Files: b5_Presentation.csproj Log Message: AccountViewer added to Presentation project (moved from QuantProject layer) Index: b5_Presentation.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/b5_Presentation.csproj,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** b5_Presentation.csproj 12 Feb 2005 19:02:01 -0000 1.20 --- b5_Presentation.csproj 12 Mar 2005 23:53:04 -0000 1.21 *************** *** 178,181 **** --- 178,191 ---- /> <File + RelPath = "Reporting\WindowsForm\AccountViewer.cs" + SubType = "Form" + BuildAction = "Compile" + /> + <File + RelPath = "Reporting\WindowsForm\AccountViewer.resx" + DependentUpon = "AccountViewer.cs" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "Reporting\WindowsForm\EquityChartTabPage.cs" SubType = "Component" |
|
From: Marco M. <mi...@us...> - 2005-03-12 23:53:33
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20021/b5_Presentation/Reporting/WindowsForm Added Files: AccountViewer.cs Log Message: AccountViewer added to Presentation project (moved from QuantProject layer) --- NEW FILE: AccountViewer.cs --- using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using QuantProject.Business.Financial.Accounting; using QuantProject.ADT.FileManaging; using QuantProject.Data.Selectors; using QuantProject.Data.DataProviders; using QuantProject.Business.DataProviders; using QuantProject.Presentation.Reporting.WindowsForm; namespace QuantProject.Principale { /// <summary> /// AccountViewer. /// </summary> public class AccountViewer : System.Windows.Forms.Form { private ArrayList accountsArrayList = new ArrayList(); private System.Windows.Forms.Button buttonAddAccounts; private System.Windows.Forms.DataGrid dataGridAccounts; private DataTable accountsTable; private System.Windows.Forms.Button buttonViewReport; private System.ComponentModel.Container components = null; public AccountViewer() { // InitializeComponent(); this.setTableAndGrid(); // // TODO: // } private void setTableAndGrid() { this.accountsTable = new DataTable(); this.accountsTable.Columns.Add("AccountName", System.Type.GetType("System.String")); this.accountsTable.Columns.Add("Fitness", Type.GetType("System.Double")); this.accountsTable.Columns.Add("Account", Type.GetType("System.Object")); this.dataGridAccounts.DataSource = this.accountsTable; } /// <summary> /// Clean up /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code //do not modify with code editor private void InitializeComponent() { this.buttonAddAccounts = new System.Windows.Forms.Button(); this.dataGridAccounts = new System.Windows.Forms.DataGrid(); this.buttonViewReport = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dataGridAccounts)).BeginInit(); this.SuspendLayout(); // // buttonAddAccounts // this.buttonAddAccounts.Location = new System.Drawing.Point(8, 160); this.buttonAddAccounts.Name = "buttonAddAccounts"; this.buttonAddAccounts.Size = new System.Drawing.Size(96, 32); this.buttonAddAccounts.TabIndex = 1; this.buttonAddAccounts.Text = "Add Accounts ..."; this.buttonAddAccounts.Click += new System.EventHandler(this.buttonAddAccounts_Click); // // dataGridAccounts // this.dataGridAccounts.DataMember = ""; this.dataGridAccounts.Dock = System.Windows.Forms.DockStyle.Top; this.dataGridAccounts.HeaderForeColor = System.Drawing.SystemColors.ControlText; this.dataGridAccounts.Name = "dataGridAccounts"; this.dataGridAccounts.Size = new System.Drawing.Size(464, 144); this.dataGridAccounts.TabIndex = 2; // // buttonViewReport // this.buttonViewReport.Location = new System.Drawing.Point(336, 160); this.buttonViewReport.Name = "buttonViewReport"; this.buttonViewReport.Size = new System.Drawing.Size(96, 32); this.buttonViewReport.TabIndex = 3; this.buttonViewReport.Text = "View Report"; this.buttonViewReport.Click += new System.EventHandler(this.buttonViewReport_Click); // // AccountViewer // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(464, 266); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.buttonViewReport, this.dataGridAccounts, this.buttonAddAccounts}); this.Name = "AccountViewer"; this.Text = "AccountViewer"; ((System.ComponentModel.ISupportInitialize)(this.dataGridAccounts)).EndInit(); this.ResumeLayout(false); } #endregion private void updateForm_updateGrid() { this.dataGridAccounts.Refresh(); } private void updateForm_updateTable() { Account account; foreach(Object item in this.accountsArrayList) { DataRow rowToAdd = this.accountsTable.NewRow(); account = (Account)item; rowToAdd["AccountName"] = account.Key; rowToAdd["Fitness"] = account.GetFitnessValue(); rowToAdd["Account"] = account; this.accountsTable.Rows.Add(rowToAdd); } } private void updateForm() { this.updateForm_updateTable(); this.updateForm_updateGrid(); } #region Add Accounts private string[] buttonAddAccounts_Click_extractAccounts_selectAccounts() { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = "Select accounts please ..."; openFileDialog.Multiselect = true; openFileDialog.CheckFileExists = true; openFileDialog.ShowDialog(); return openFileDialog.FileNames; } private void buttonAddAccounts_Click_extractAccounts() { string[] accountsSelection = this.buttonAddAccounts_Click_extractAccounts_selectAccounts(); foreach(string fileName in accountsSelection) { this.accountsArrayList.Add((Account)ObjectArchiver.Extract(fileName)); } } private void buttonAddAccounts_Click(object sender, System.EventArgs e) { this.accountsArrayList.Clear(); this.buttonAddAccounts_Click_extractAccounts(); this.updateForm(); } #endregion private void buttonViewReport_Click(object sender, System.EventArgs e) { DataTable selectedAccountTable = TickerSelector.GetTableOfManuallySelectedTickers(this.dataGridAccounts); if(selectedAccountTable.Rows.Count != 1 ) //only a single row is a valid selection MessageBox.Show("You can't view more than one report!"); else { Report report = new Report((Account)selectedAccountTable.Rows[0]["Account"], new HistoricalAdjustedQuoteProvider()); ReportShower reportShower = new ReportShower(report); reportShower.Show(); } } } } |
|
From: Marco M. <mi...@us...> - 2005-03-08 19:14:16
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29253/Downloader/TickerSelectors Modified Files: TickerSelectorForm.cs Log Message: Advanced Ticker selection has been re-organized in a more rational and object-oriented way Now TickerDownloader compiles Index: TickerSelectorForm.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors/TickerSelectorForm.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TickerSelectorForm.cs 6 Jan 2005 18:59:54 -0000 1.9 --- TickerSelectorForm.cs 8 Mar 2005 19:13:49 -0000 1.10 *************** *** 36,40 **** { /// <summary> ! /// It is the user interface for the TickerSelector class /// </summary> public class TickerSelectorForm : System.Windows.Forms.Form, ITickerSelector --- 36,40 ---- { /// <summary> ! /// It is the user interface for the ITickerSelector chosen by user /// </summary> public class TickerSelectorForm : System.Windows.Forms.Form, ITickerSelector *************** *** 78,82 **** this.comboBoxAvailableSelectionRules.Items.Add("CloseToOpenLinearCorrelation"); this.comboBoxAvailableSelectionRules.Items.Add("AverageCloseToOpenPerformance"); ! this.comboBoxAvailableSelectionRules.Items.Add("QuotedInEachMarketDay"); } --- 78,82 ---- this.comboBoxAvailableSelectionRules.Items.Add("CloseToOpenLinearCorrelation"); this.comboBoxAvailableSelectionRules.Items.Add("AverageCloseToOpenPerformance"); ! this.comboBoxAvailableSelectionRules.Items.Add("QuotedAtEachMarketDay"); } *************** *** 354,370 **** { 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)); ! selector.MarketIndex = this.textBoxMarketIndex.Text; this.dataGrid1.DataSource = selector.GetTableOfSelectedTickers(); this.dataGrid1.Refresh(); --- 354,359 ---- { Cursor.Current = Cursors.WaitCursor; ! ITickerSelector selector; ! selector = this.getITickerSelector(); this.dataGrid1.DataSource = selector.GetTableOfSelectedTickers(); this.dataGrid1.Refresh(); *************** *** 377,407 **** } ! private SelectionType getTypeOfRuleSelectedByUser() { ! SelectionType typeSelected = SelectionType.Liquidity; if(this.comboBoxAvailableSelectionRules.Text == "Liquidity") ! typeSelected = SelectionType.Liquidity; else if (this.comboBoxAvailableSelectionRules.Text == "Performance") ! typeSelected = SelectionType.Performance; else if (this.comboBoxAvailableSelectionRules.Text == "CloseToCloseVolatility") ! typeSelected = SelectionType.CloseToCloseVolatility; else if (this.comboBoxAvailableSelectionRules.Text == "CloseToOpenVolatility") ! typeSelected = SelectionType.CloseToOpenVolatility; else if (this.comboBoxAvailableSelectionRules.Text == "AverageCloseToClosePerformance") ! typeSelected = SelectionType.AverageCloseToClosePerformance; else if (this.comboBoxAvailableSelectionRules.Text == "CloseToCloseLinearCorrelation") ! typeSelected = SelectionType.CloseToCloseLinearCorrelation; else if (this.comboBoxAvailableSelectionRules.Text == "CloseToOpenLinearCorrelation") ! typeSelected = SelectionType.CloseToOpenLinearCorrelation; else if (this.comboBoxAvailableSelectionRules.Text == "AverageCloseToOpenPerformance") ! typeSelected = SelectionType.AverageCloseToOpenPerformance; ! else if (this.comboBoxAvailableSelectionRules.Text == "QuotedInEachMarketDay") ! typeSelected = SelectionType.QuotedInEachMarketDay; ! return typeSelected; } private void comboBoxAvailableSelectionRules_SelectedValueChanged(object sender, System.EventArgs e) { ! if(this.comboBoxAvailableSelectionRules.Text == "QuotedInEachMarketDay") { this.checkBoxASCMode.Enabled = false; --- 366,482 ---- } ! private ITickerSelector getITickerSelector() { ! ITickerSelector returnValue = new SelectorByLiquidity(this.textBoxGroupID.Text, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text )); ! if(this.comboBoxAvailableSelectionRules.Text == "Liquidity") ! { ! if(this.textBoxGroupID.Text != "") ! returnValue = new SelectorByLiquidity(this.textBoxGroupID.Text, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text )); ! else ! returnValue = new SelectorByLiquidity(this.tableOfSelectedTickers, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! } else if (this.comboBoxAvailableSelectionRules.Text == "Performance") ! { ! if(this.textBoxGroupID.Text != "") ! returnValue = new SelectorByAbsolutePerformance(this.textBoxGroupID.Text, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! else ! returnValue = new SelectorByAbsolutePerformance(this.tableOfSelectedTickers, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! } else if (this.comboBoxAvailableSelectionRules.Text == "CloseToCloseVolatility") ! { ! if(this.textBoxGroupID.Text != "") ! returnValue = new SelectorByCloseToCloseVolatility(this.textBoxGroupID.Text, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! else ! returnValue = new SelectorByCloseToCloseVolatility(this.tableOfSelectedTickers, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! } else if (this.comboBoxAvailableSelectionRules.Text == "CloseToOpenVolatility") ! { ! if(this.textBoxGroupID.Text != "") ! returnValue = new SelectorByOpenToCloseVolatility (this.textBoxGroupID.Text, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! else ! returnValue = new SelectorByOpenToCloseVolatility (this.tableOfSelectedTickers, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! } else if (this.comboBoxAvailableSelectionRules.Text == "AverageCloseToClosePerformance") ! { ! if(this.textBoxGroupID.Text != "") ! returnValue = new SelectorByAverageCloseToClosePerformance(this.textBoxGroupID.Text, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! else ! returnValue = new SelectorByAverageCloseToClosePerformance(this.tableOfSelectedTickers, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! } else if (this.comboBoxAvailableSelectionRules.Text == "CloseToCloseLinearCorrelation") ! { ! if(this.textBoxGroupID.Text != "") ! returnValue = new SelectorByCloseToCloseLinearCorrelation (this.textBoxGroupID.Text, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! else ! returnValue = new SelectorByCloseToCloseLinearCorrelation(this.tableOfSelectedTickers, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! } else if (this.comboBoxAvailableSelectionRules.Text == "CloseToOpenLinearCorrelation") ! { ! if(this.textBoxGroupID.Text != "") ! returnValue = new SelectorByOpenToCloseLinearCorrelation (this.textBoxGroupID.Text, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! else ! returnValue = new SelectorByOpenToCloseLinearCorrelation (this.tableOfSelectedTickers, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! } else if (this.comboBoxAvailableSelectionRules.Text == "AverageCloseToOpenPerformance") ! { ! if(this.textBoxGroupID.Text != "") ! returnValue = new SelectorByAverageOpenToClosePerformance(this.textBoxGroupID.Text, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! else ! returnValue = new SelectorByAverageOpenToClosePerformance(this.tableOfSelectedTickers, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! } ! else if (this.comboBoxAvailableSelectionRules.Text == "QuotedAtEachMarketDay") ! { ! if(this.textBoxGroupID.Text != "") ! returnValue = new SelectorByQuotationAtEachMarketDay (this.textBoxGroupID.Text, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text), ! this.textBoxMarketIndex.Text); ! else ! returnValue = new SelectorByQuotationAtEachMarketDay(this.tableOfSelectedTickers, ! this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text), ! this.textBoxMarketIndex.Text); ! } ! return returnValue; } private void comboBoxAvailableSelectionRules_SelectedValueChanged(object sender, System.EventArgs e) { ! if(this.comboBoxAvailableSelectionRules.Text == "QuotedAtEachMarketDay") { this.checkBoxASCMode.Enabled = false; |
|
From: Glauco S. <gla...@us...> - 2005-03-06 21:37:31
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27261/b4_Business/a05_Timing Modified Files: IndexBasedEndOfDayTimer.cs Log Message: The exception message has been improved, when an Index has no quotes within the given interval. Index: IndexBasedEndOfDayTimer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing/IndexBasedEndOfDayTimer.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IndexBasedEndOfDayTimer.cs 6 Mar 2005 21:34:58 -0000 1.4 --- IndexBasedEndOfDayTimer.cs 6 Mar 2005 21:37:17 -0000 1.5 *************** *** 50,54 **** { string errorMessage = "IndexBasedEndOfDayTimer error: the given " + ! "index has no quotes in the interval."; throw new Exception( errorMessage ); } --- 50,54 ---- { string errorMessage = "IndexBasedEndOfDayTimer error: the given " + ! "index (" + marketIndex + ") has no quotes in the interval."; throw new Exception( errorMessage ); } |
|
From: Glauco S. <gla...@us...> - 2005-03-06 21:35:09
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26667/b4_Business/a05_Timing Modified Files: IndexBasedEndOfDayTimer.cs Log Message: Now an exception is thrown when an Index has no quotes within the given interval. Index: IndexBasedEndOfDayTimer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing/IndexBasedEndOfDayTimer.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IndexBasedEndOfDayTimer.cs 30 Jan 2005 19:57:38 -0000 1.3 --- IndexBasedEndOfDayTimer.cs 6 Mar 2005 21:34:58 -0000 1.4 *************** *** 47,50 **** --- 47,56 ---- this.marketIndex = marketIndex; this.indexQuotes = new Quotes(marketIndex,startDateTime.DateTime,DateTime.Now); + if ( this.indexQuotes.Rows.Count == 0 ) + { + string errorMessage = "IndexBasedEndOfDayTimer error: the given " + + "index has no quotes in the interval."; + throw new Exception( errorMessage ); + } this.StartDateTime = new EndOfDayDateTime(this.indexQuotes.GetQuoteDateOrFollowing(this.StartDateTime.DateTime), |
|
From: marco\.milletti\@l <mar...@li...> - 2005-02-28 13:44:16
|
> > Millo, > > per permettermi di provare lo script qua da me, per f= avore, vedi se puoi > renderlo quanto piu' possibile indipendente dal t= uo stato locale. Intendo: > - portare tutti i parametri dello script in = un punto solo (indice di > riferimento, data iniziale, data finale, eve= ntuali altri; magari passati al > costruttore del RunEfficientCTOPortfo= lio ... ) > - evitare, se possibile, riferimenti a path sul tuo PC (o, m= agari, portare > anche quello come parametro ben "isolato") Sapevo c= he me l'avresti chiesto ... porca zoccola, bisognerebbe aver pi=F9 tempo = ... Mi sembrava pi=F9 urgente sistemare il TickerSelector e dintorni. An= che perch=E8 tra un po' scriver=F2 la classe per fare la selezione sui ti= cker con un prezzo compreso in un certo intervallo. Adesso ho xp pro i= n ufficio su un pentium 4 da 2.66 con 504 MB di RAM. Tra un po' sar=F2 o= perativo anche qui. > At 07:56 PM 2/27/2005 +0000, you wrote: > >Upda= te of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTestin= g > >In directory > >sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4614/b7_= Scripts/TickerSelectionTesting > > > >Modified Files: > > EndO= fDayTimerHandlerCTC.cs EndOfDayTimerHandlerCTO.cs > > GenomeMana= gerForEfficientCTOPortfolio.cs > > RunEfficientCTOPortfolio.cs=0D = > >Log Message: > >Advanced Ticker selection has been re-organized in a = more rational and > >object-oriented way > >(NOTE that at the moment Q= uantdownloader solution won't compile) > > > >Index: EndOfDayTimerHandl= erCTO.cs > >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > >RC= S file: > >/cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectio= nTesting/EndOfDayTimerHandlerCTO.cs,v > >retrieving revision 1.3 > >ret= rieving revision 1.4 > >diff -C2 -d -r1.3 -r1.4 > >*** EndOfDayTimerHan= dlerCTO.cs 12 Feb 2005 19:16:46 -0000 1.3 > >--- EndOfDayTimerHand= lerCTO.cs 27 Feb 2005 19:56:08 -0000 1.4 > >*************** > >**= * 94,98 **** > > long quantity =3D > > Convert.ToInt6= 4( Math.Floor( cashForSinglePosition / > > this.account.DataStreamer.Ge= tCurrentBid( ticker ) ) ); > >! Order order =3D new Order( OrderTy= pe.MarketBuy, new Instrument( > >ticker ) , quantity ); > > th= is.orders.Add(order); > > } > >--- 94,98 ---- > > long q= uantity =3D > > Convert.ToInt64( Math.Floor( cashForSinglePosi= tion / > > this.account.DataStreamer.GetCurrentBid( ticker ) ) ); > >!= Order order =3D new Order( OrderType.MarketSellShort, new > >Ins= trument( ticker ) , quantity ); > > this.orders.Add(order); > >= } > >*************** > >*** 126,130 **** > > { > > = if(this.orders.Count =3D=3D 0 && this.account.Transactions.Count =3D=3D= 0) > >! this.account.AddCash(15000); > > > > this.mar= ketOpenEventHandler_orderChosenTickers(); > >--- 126,130 ---- > > = { > > if(this.orders.Count =3D=3D 0 && this.account.Transaction= s.Count =3D=3D 0) > >! this.account.AddCash(30000); > > > > = this.marketOpenEventHandler_orderChosenTickers(); > >*************= ** > >*** 172,184 **** > > private DataTable getSetOfTickersToBeO= ptimized(DateTime currentDate) > > { > >! TickerSelector mo= stLiquid =3D new > >TickerSelector(SelectionType.Liquidity, > >! = false, this.tickerGroupID , > >currentDate.AddDays(-this.numDaysForL= iquidity), currentDate, > >this.numberOfEligibleTickers); > > = this.eligibleTickers =3D mostLiquid.GetTableOfSelectedTickers(); > >! = TickerSelector quotedInEachMarketDayFromMostLiquid =3D > >! = new TickerSelector( this.eligibleTickers, > >! SelectionType.Quo= tedInEachMarketDay, false, "", > >! currentDate.AddDays(-this.nu= mDaysForLiquidity),currentDate, > >! this.numberOfEligibleTicker= s); > >! quotedInEachMarketDayFromMostLiquid.MarketIndex =3D "^MIB= TEL"; > > return > > quotedInEachMarketDayFromMostLiquid.GetTa= bleOfSelectedTickers(); > > } > >--- 172,182 ---- > > priv= ate DataTable getSetOfTickersToBeOptimized(DateTime currentDate) > > = { > >! SelectorByLiquidity mostLiquid =3D new > >SelectorByLi= quidity(this.tickerGroupID, false, > >! > >currentDate.AddDays(-this.n= umDaysForLiquidity), currentDate, > >this.numberOfEligibleTickers); > = > this.eligibleTickers =3D mostLiquid.GetTableOfSelectedTickers()= ; > >! SelectorByQuotationAtEachMarketDay > >quotedInEachMarketD= ayFromMostLiquid =3D > >! new SelectorByQuotationAtEachMarketDay= ( this.eligibleTickers, > >! false, =0D = > >currentDate.AddDays(-this.numDaysForLiquidity), > >! = currentDate, > >this.numberOfEligibleTickers, "^MIB= TEL"); > > return > > quotedInEachMarketDayFromMostLiquid.GetT= ableOfSelectedTickers(); > > } > > > >Index: GenomeManagerForEff= icientCTOPortfolio.cs > >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > >RCS file: > >/cvsroot/quantproject/QuantProject/b7_Scripts/Tick= erSelectionTesting/GenomeManagerForEfficientCTOPortfolio.cs,v > >retriev= ing revision 1.4 > >retrieving revision 1.5 > >diff -C2 -d -r1.4 -r1.5=0D = > >*** GenomeManagerForEfficientCTOPortfolio.cs 6 Feb 2005 20:14:01 =0D = > >-0000 1.4 > >--- GenomeManagerForEfficientCTOPortfolio.cs 27= Feb 2005 19:56:08 > >-0000 1.5 > >*************** > >*** 95,98 = **** > >--- 95,115 ---- > > return returnValue; > > }=0D = > >+ > >+ public override double GetFitnessValue(Genome genome) > >= + { > >+ double returnValue; > >+ double portfolioVaria= nce =3D this.getPortfolioVariance(genome.Genes()); > >+ double por= tfolioRateOfReturn =3D > >this.getPortfolioRateOfReturn(genome.Genes())= ; > >+ this.variance =3D portfolioVariance; > >+ this.rateO= fReturn =3D portfolioRateOfReturn; > >+ > >+ NormalDistribution n= ormal =3D new > >NormalDistribution(portfolioRateOfReturn, Math.Sqrt(po= rtfolioVariance)); > >+ //for long portfolio > >+ //returnV= alue =3D > >normal.GetProbability(this.targetPerformance*0.75,this.targ= etPerformance*1.25); > >+ //for short portfolio > >+ return= Value =3D > >normal.GetProbability(-this.targetPerformance*1.25,-this.t= argetPerformance*0.75); > >+ //returnValue =3D 1 - normal.GetProba= bility(this.targetPerformance); > >+ return returnValue; > >+ = } > > > > } > > > >Index: EndOfDayTimerHandlerCTC.cs > >=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > >RCS file: > >/cvsroot/qu= antproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHa= ndlerCTC.cs,v > >retrieving revision 1.1 > >retrieving revision 1.2 > = >diff -C2 -d -r1.1 -r1.2 > >*** EndOfDayTimerHandlerCTC.cs 30 Jan 2005 = 19:53:12 -0000 1.1 > >--- EndOfDayTimerHandlerCTC.cs 27 Feb 2005 1= 9:56:08 -0000 1.2 > >*************** > >*** 88,100 **** > > = private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) > = > { > >! TickerSelector mostLiquid =3D new > >TickerSelect= or(SelectionType.Liquidity, > >! false, this.tickerGroupID , cur= rentDate.AddDays(-90), > >currentDate, this.numberOfEligibleTickers);=0D = > > this.eligibleTickers =3D mostLiquid.GetTableOfSelectedTickers= (); > >! TickerSelector quotedInEachMarketDayFromMostLiquid =3D=0D = > >! new TickerSelector( this.eligibleTickers, > >! Sele= ctionType.QuotedInEachMarketDay, false, "", > >! currentDate.Add= Days(-90),currentDate, > >! this.numberOfEligibleTickers); > >!= quotedInEachMarketDayFromMostLiquid.MarketIndex =3D "^MIBTEL"; > = > return > > quotedInEachMarketDayFromMostLiquid.GetTableOfSele= ctedTickers(); > > } > >--- 88,98 ---- > > private DataTab= le getSetOfTickersToBeOptimized(DateTime currentDate) > > { > >! = SelectorByLiquidity mostLiquid =3D new > >SelectorByLiquidity(thi= s.tickerGroupID,false, > >! curren= tDate.AddDays(-90), > >currentDate, this.numberOfEligibleTickers); > >= this.eligibleTickers =3D mostLiquid.GetTableOfSelectedTickers();= > >! SelectorByQuotationAtEachMarketDay > >quotedInEachMarketDa= yFromMostLiquid =3D > >! new SelectorByQuotationAtEachMarketDay(= this.eligibleTickers, > >! false, > = >currentDate.AddDays(-90),currentDate, > >! = this.numberOfEligibleTickers, "^MIBTEL"); > > return > >= quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); > > = } > > > >Index: RunEfficientCTOPortfolio.cs > >=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > >RCS file: > >/cvsroot/quantproject/Q= uantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTOPortfolio.cs= ,v > >retrieving revision 1.13 > >retrieving revision 1.14 > >diff -C2= -d -r1.13 -r1.14 > >*** RunEfficientCTOPortfolio.cs 15 Feb 2005 19:15:3= 6 -0000 1.13 > >--- RunEfficientCTOPortfolio.cs 27 Feb 2005 19:56:0= 8 -0000 1.14 > >*************** > >*** 36,39 **** > >--- 36,40 --= -- > > using QuantProject.Business.Testing; > > using QuantProject.= Business.Timing; > >+ using QuantProject.Business.Financial.Accounting.C= ommissions; > > using QuantProject.Data.DataProviders; > > using Qu= antProject.Data.Selectors; > >*************** > >*** 98,104 **** > > = this.reportTable =3D new ReportTable( "Summary_Reports" ); > > = this.startDateTime =3D new EndOfDayDateTime( > >! new Date= Time( 2004 , 1 , 1 ) , > >EndOfDaySpecificTime.FiveMinutesBeforeMarketC= lose ); > > this.endDateTime =3D new EndOfDayDateTime( > >! = new DateTime( 2004 , 1 , 10 ) , > >EndOfDaySpecificTime.OneHourAft= erMarketClose ); > > //this.numIntervalDays =3D 3; > > = } > >--- 99,105 ---- > > this.reportTable =3D new Repor= tTable( "Summary_Reports" ); > > this.startDateTime =3D new EndO= fDayDateTime( > >! new DateTime( 2004 , 9 , 1 ) , > >EndOfDayS= pecificTime.FiveMinutesBeforeMarketClose ); > > this.endDateTime= =3D new EndOfDayDateTime( > >! new DateTime( 2004 , 9 , 10 ) , = > >EndOfDaySpecificTime.OneHourAfterMarketClose ); > > //this.= numIntervalDays =3D 3; > > } > >*************** > >***= 109,113 **** > > { > > //"STOCKMI" > >! TickerSel= ector mostLiquid =3D new > >TickerSelector(SelectionType.Liquidity, > = > false, "STOCKMI",= > > firstDate, lastDate, 70); > > DataTable tickers =3D mostL= iquid.GetTableOfSelectedTickers(); > >--- 110,115 ---- > > { > >= //"STOCKMI" > >! /* > >! * SelectorByLiquidity mo= stLiquid =3D new > >TickerSelector(SelectionType.Liquidity, > > = false, "STOCKMI", > > f= irstDate, lastDate, 70); > > DataTable tickers =3D mostLiquid.Ge= tTableOfSelectedTickers(); > >*************** > >*** 123,126 **** > >-= -- 125,130 ---- > > System.Console.WriteLine("\n\nThe best solut= ion found is: " + > > (string)GO.BestGenome.Meaning + > > " = with {0} generations", GO.GenerationCounter); > >+ */ > >+ = ; > > } > > > >*************** > >*** 136,140 ****=0D = > > this.historicalQuoteProvider = ) , > > new HistoricalEndOfDayOrderExecutor( this.endOfDayTime= r , > >! this.historicalQuoteProvi= der ) ); > > > > } > >--- 140,144 ---- > > = this.historicalQuoteProvider ) , > > new H= istoricalEndOfDayOrderExecutor( this.endOfDayTimer , > >! = this.historicalQuoteProvider )); > > > > = } > > > > > > > >----------------------------------------------------= --- > >SF email is sponsored by - The IT Product Guide > >Read honest &= candid reviews on hundreds of IT Products from real users. > >Discover = which products truly live up to the hype. Start reading now. > >http://a= ds.osdn.com/?ad_id=3D6595&alloc_id=3D14396&op=3Dclick > >_______________= ________________________________ > >Quantproject-developers mailing list= > >Qua...@li... > >https://lists.sour= ceforge.net/lists/listinfo/quantproject-developers > > > > -------= ------------------------------------------------ > SF email is sponsored= by - The IT Product Guide > Read honest & candid reviews on hundreds of= IT Products from real users. > Discover which products truly live up to= the hype. Start reading now. > http://ads.osdn.com/?ad_id=3D6595&alloc_= id=3D14396&op=3Dclick > _______________________________________________=0D = > Quantproject-developers mailing list > Quantproject-developers@lists.s= ourceforge.net > https://lists.sourceforge.net/lists/listinfo/quantproje= ct-developers > =0A=0A=0A=0A____________________________________________= ________________=0ANavighi a 2 MEGA e i primi 3 mesi sono GRATIS. =0ASceg= li Libero Adsl Flat senza limiti su http://www.libero.it=0A |
|
From: Glauco S. <gl...@my...> - 2005-02-27 23:20:39
|
Millo, per permettermi di provare lo script qua da me, per favore, vedi se puoi renderlo quanto piu' possibile indipendente dal tuo stato locale. Intendo: - portare tutti i parametri dello script in un punto solo (indice di riferimento, data iniziale, data finale, eventuali altri; magari passati al costruttore del RunEfficientCTOPortfolio ... ) - evitare, se possibile, riferimenti a path sul tuo PC (o, magari, portare anche quello come parametro ben "isolato") At 07:56 PM 2/27/2005 +0000, you wrote: >Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting >In directory >sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4614/b7_Scripts/TickerSelectionTesting > >Modified Files: > EndOfDayTimerHandlerCTC.cs EndOfDayTimerHandlerCTO.cs > GenomeManagerForEfficientCTOPortfolio.cs > RunEfficientCTOPortfolio.cs >Log Message: >Advanced Ticker selection has been re-organized in a more rational and >object-oriented way >(NOTE that at the moment Quantdownloader solution won't compile) > >Index: EndOfDayTimerHandlerCTO.cs >=================================================================== >RCS file: >/cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTO.cs,v >retrieving revision 1.3 >retrieving revision 1.4 >diff -C2 -d -r1.3 -r1.4 >*** EndOfDayTimerHandlerCTO.cs 12 Feb 2005 19:16:46 -0000 1.3 >--- EndOfDayTimerHandlerCTO.cs 27 Feb 2005 19:56:08 -0000 1.4 >*************** >*** 94,98 **** > long quantity = > Convert.ToInt64( Math.Floor( cashForSinglePosition / > this.account.DataStreamer.GetCurrentBid( ticker ) ) ); >! Order order = new Order( OrderType.MarketBuy, new Instrument( >ticker ) , quantity ); > this.orders.Add(order); > } >--- 94,98 ---- > long quantity = > Convert.ToInt64( Math.Floor( cashForSinglePosition / > this.account.DataStreamer.GetCurrentBid( ticker ) ) ); >! Order order = new Order( OrderType.MarketSellShort, new >Instrument( ticker ) , quantity ); > this.orders.Add(order); > } >*************** >*** 126,130 **** > { > if(this.orders.Count == 0 && this.account.Transactions.Count == 0) >! this.account.AddCash(15000); > > this.marketOpenEventHandler_orderChosenTickers(); >--- 126,130 ---- > { > if(this.orders.Count == 0 && this.account.Transactions.Count == 0) >! this.account.AddCash(30000); > > this.marketOpenEventHandler_orderChosenTickers(); >*************** >*** 172,184 **** > private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) > { >! TickerSelector mostLiquid = new >TickerSelector(SelectionType.Liquidity, >! false, this.tickerGroupID , >currentDate.AddDays(-this.numDaysForLiquidity), currentDate, >this.numberOfEligibleTickers); > this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); >! TickerSelector quotedInEachMarketDayFromMostLiquid = >! new TickerSelector( this.eligibleTickers, >! SelectionType.QuotedInEachMarketDay, false, "", >! currentDate.AddDays(-this.numDaysForLiquidity),currentDate, >! this.numberOfEligibleTickers); >! quotedInEachMarketDayFromMostLiquid.MarketIndex = "^MIBTEL"; > return > quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); > } >--- 172,182 ---- > private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) > { >! SelectorByLiquidity mostLiquid = new >SelectorByLiquidity(this.tickerGroupID, false, >! >currentDate.AddDays(-this.numDaysForLiquidity), currentDate, >this.numberOfEligibleTickers); > this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); >! SelectorByQuotationAtEachMarketDay >quotedInEachMarketDayFromMostLiquid = >! new SelectorByQuotationAtEachMarketDay( this.eligibleTickers, >! false, >currentDate.AddDays(-this.numDaysForLiquidity), >! currentDate, >this.numberOfEligibleTickers, "^MIBTEL"); > return > quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); > } > >Index: GenomeManagerForEfficientCTOPortfolio.cs >=================================================================== >RCS file: >/cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForEfficientCTOPortfolio.cs,v >retrieving revision 1.4 >retrieving revision 1.5 >diff -C2 -d -r1.4 -r1.5 >*** GenomeManagerForEfficientCTOPortfolio.cs 6 Feb 2005 20:14:01 >-0000 1.4 >--- GenomeManagerForEfficientCTOPortfolio.cs 27 Feb 2005 19:56:08 >-0000 1.5 >*************** >*** 95,98 **** >--- 95,115 ---- > return returnValue; > } >+ >+ public override double GetFitnessValue(Genome genome) >+ { >+ double returnValue; >+ double portfolioVariance = this.getPortfolioVariance(genome.Genes()); >+ double portfolioRateOfReturn = >this.getPortfolioRateOfReturn(genome.Genes()); >+ this.variance = portfolioVariance; >+ this.rateOfReturn = portfolioRateOfReturn; >+ >+ NormalDistribution normal = new >NormalDistribution(portfolioRateOfReturn, Math.Sqrt(portfolioVariance)); >+ //for long portfolio >+ //returnValue = >normal.GetProbability(this.targetPerformance*0.75,this.targetPerformance*1.25); >+ //for short portfolio >+ returnValue = >normal.GetProbability(-this.targetPerformance*1.25,-this.targetPerformance*0.75); >+ //returnValue = 1 - normal.GetProbability(this.targetPerformance); >+ return returnValue; >+ } > > } > >Index: EndOfDayTimerHandlerCTC.cs >=================================================================== >RCS file: >/cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTC.cs,v >retrieving revision 1.1 >retrieving revision 1.2 >diff -C2 -d -r1.1 -r1.2 >*** EndOfDayTimerHandlerCTC.cs 30 Jan 2005 19:53:12 -0000 1.1 >--- EndOfDayTimerHandlerCTC.cs 27 Feb 2005 19:56:08 -0000 1.2 >*************** >*** 88,100 **** > private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) > { >! TickerSelector mostLiquid = new >TickerSelector(SelectionType.Liquidity, >! false, this.tickerGroupID , currentDate.AddDays(-90), >currentDate, this.numberOfEligibleTickers); > this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); >! TickerSelector quotedInEachMarketDayFromMostLiquid = >! new TickerSelector( this.eligibleTickers, >! SelectionType.QuotedInEachMarketDay, false, "", >! currentDate.AddDays(-90),currentDate, >! this.numberOfEligibleTickers); >! quotedInEachMarketDayFromMostLiquid.MarketIndex = "^MIBTEL"; > return > quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); > } >--- 88,98 ---- > private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) > { >! SelectorByLiquidity mostLiquid = new >SelectorByLiquidity(this.tickerGroupID,false, >! currentDate.AddDays(-90), >currentDate, this.numberOfEligibleTickers); > this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); >! SelectorByQuotationAtEachMarketDay >quotedInEachMarketDayFromMostLiquid = >! new SelectorByQuotationAtEachMarketDay(this.eligibleTickers, >! false, >currentDate.AddDays(-90),currentDate, >! this.numberOfEligibleTickers, "^MIBTEL"); > return > quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); > } > >Index: RunEfficientCTOPortfolio.cs >=================================================================== >RCS file: >/cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTOPortfolio.cs,v >retrieving revision 1.13 >retrieving revision 1.14 >diff -C2 -d -r1.13 -r1.14 >*** RunEfficientCTOPortfolio.cs 15 Feb 2005 19:15:36 -0000 1.13 >--- RunEfficientCTOPortfolio.cs 27 Feb 2005 19:56:08 -0000 1.14 >*************** >*** 36,39 **** >--- 36,40 ---- > using QuantProject.Business.Testing; > using QuantProject.Business.Timing; >+ using QuantProject.Business.Financial.Accounting.Commissions; > using QuantProject.Data.DataProviders; > using QuantProject.Data.Selectors; >*************** >*** 98,104 **** > this.reportTable = new ReportTable( "Summary_Reports" ); > this.startDateTime = new EndOfDayDateTime( >! new DateTime( 2004 , 1 , 1 ) , >EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); > this.endDateTime = new EndOfDayDateTime( >! new DateTime( 2004 , 1 , 10 ) , >EndOfDaySpecificTime.OneHourAfterMarketClose ); > //this.numIntervalDays = 3; > } >--- 99,105 ---- > this.reportTable = new ReportTable( "Summary_Reports" ); > this.startDateTime = new EndOfDayDateTime( >! new DateTime( 2004 , 9 , 1 ) , >EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); > this.endDateTime = new EndOfDayDateTime( >! new DateTime( 2004 , 9 , 10 ) , >EndOfDaySpecificTime.OneHourAfterMarketClose ); > //this.numIntervalDays = 3; > } >*************** >*** 109,113 **** > { > //"STOCKMI" >! TickerSelector mostLiquid = new >TickerSelector(SelectionType.Liquidity, > false, "STOCKMI", > firstDate, lastDate, 70); > DataTable tickers = mostLiquid.GetTableOfSelectedTickers(); >--- 110,115 ---- > { > //"STOCKMI" >! /* >! * SelectorByLiquidity mostLiquid = new >TickerSelector(SelectionType.Liquidity, > false, "STOCKMI", > firstDate, lastDate, 70); > DataTable tickers = mostLiquid.GetTableOfSelectedTickers(); >*************** >*** 123,126 **** >--- 125,130 ---- > System.Console.WriteLine("\n\nThe best solution found is: " + > (string)GO.BestGenome.Meaning + > " with {0} generations", GO.GenerationCounter); >+ */ >+ ; > } > >*************** >*** 136,140 **** > this.historicalQuoteProvider ) , > new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , >! this.historicalQuoteProvider ) ); > > } >--- 140,144 ---- > this.historicalQuoteProvider ) , > new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , >! this.historicalQuoteProvider )); > > } > > > >------------------------------------------------------- >SF email is sponsored by - The IT Product Guide >Read honest & candid reviews on hundreds of IT Products from real users. >Discover which products truly live up to the hype. Start reading now. >http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >_______________________________________________ >Quantproject-developers mailing list >Qua...@li... >https://lists.sourceforge.net/lists/listinfo/quantproject-developers |
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4614/b3_Data/Selectors Modified Files: SelectionType.cs TickerSelector.cs Added Files: SelectorByAbsolutePerformance.cs SelectorByAverageCloseToClosePerformance.cs SelectorByAverageOpenToClosePerformance.cs SelectorByCloseToCloseLinearCorrelation.cs SelectorByCloseToCloseVolatility.cs SelectorByLiquidity.cs SelectorByOpenToCloseLinearCorrelation.cs SelectorByOpenToCloseVolatility.cs SelectorByQuotationAtEachMarketDay.cs Log Message: Advanced Ticker selection has been re-organized in a more rational and object-oriented way (NOTE that at the moment Quantdownloader solution won't compile) --- NEW FILE: SelectorByAverageOpenToClosePerformance.cs --- /* QuantProject - Quantitative Finance Library SelectorByAverageOpenToClosePerformance.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.Data; using System.Windows.Forms; using QuantProject.DataAccess.Tables; using QuantProject.Data.DataTables; namespace QuantProject.Data.Selectors { /// <summary> /// Class for selection on tickers by average open to close performance /// </summary> public class SelectorByAverageOpenToClosePerformance : TickerSelector, ITickerSelector { public SelectorByAverageOpenToClosePerformance(DataTable setOfTickersToBeSelected, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(setOfTickersToBeSelected, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public SelectorByAverageOpenToClosePerformance(string groupID, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(groupID, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public DataTable GetTableOfSelectedTickers() { if(this.setOfTickersToBeSelected == null) return QuantProject.DataAccess.Tables.Quotes.GetTickersByAverageCloseToOpenPerformance(this.isOrderedInASCMode, this.groupID, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers); else return QuantProject.Data.DataTables.Quotes.GetTickersByAverageCloseToOpenPerformance(this.isOrderedInASCMode, this.setOfTickersToBeSelected, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers); } public void SelectAllTickers() { ; } } } --- NEW FILE: SelectorByOpenToCloseLinearCorrelation.cs --- /* QuantProject - Quantitative Finance Library SelectorByOpenToCloseLinearCorrelation.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.Data; using System.Windows.Forms; using QuantProject.DataAccess.Tables; using QuantProject.Data.DataTables; namespace QuantProject.Data.Selectors { /// <summary> /// Class for selection on tickers by open to close linear correlation /// </summary> public class SelectorByOpenToCloseLinearCorrelation : TickerSelector, ITickerSelector { public SelectorByOpenToCloseLinearCorrelation(DataTable setOfTickersToBeSelected, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(setOfTickersToBeSelected, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public SelectorByOpenToCloseLinearCorrelation(string groupID, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(groupID, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public DataTable GetTableOfSelectedTickers() { this.launchExceptionIfGroupIDIsNotEmpty(); return QuantProject.Data.DataTables.Quotes.GetTickersByCloseToOpenPearsonCorrelationCoefficient(this.isOrderedInASCMode, this.setOfTickersToBeSelected, this.firstQuoteDate, this.lastQuoteDate); } private void launchExceptionIfGroupIDIsNotEmpty() { if(this.groupID!="") { throw new Exception("Not implemented: this type of selection works only with few tickers, at the moment"); } } public void SelectAllTickers() { ; } } } --- NEW FILE: SelectorByAverageCloseToClosePerformance.cs --- /* QuantProject - Quantitative Finance Library SelectorByAverageCloseToClosePerformance.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.Data; using System.Windows.Forms; using QuantProject.DataAccess.Tables; using QuantProject.Data.DataTables; namespace QuantProject.Data.Selectors { /// <summary> /// Class for selection on tickers by average close to close performance /// </summary> public class SelectorByAverageCloseToClosePerformance : TickerSelector , ITickerSelector { public SelectorByAverageCloseToClosePerformance(DataTable setOfTickersToBeSelected, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(setOfTickersToBeSelected, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public SelectorByAverageCloseToClosePerformance(string groupID, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(groupID, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public DataTable GetTableOfSelectedTickers() { if(this.setOfTickersToBeSelected == null) return QuantProject.DataAccess.Tables.Quotes.GetTickersByAverageCloseToClosePerformance(this.isOrderedInASCMode, this.groupID, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers); else return QuantProject.Data.DataTables.Quotes.GetTickersByAverageCloseToClosePerformance(this.isOrderedInASCMode, this.setOfTickersToBeSelected, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers); } public void SelectAllTickers() { ; } } } --- NEW FILE: SelectorByLiquidity.cs --- /* QuantProject - Quantitative Finance Library SelectorByLiquidity.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.Data; using System.Windows.Forms; using QuantProject.DataAccess.Tables; using QuantProject.Data.DataTables; namespace QuantProject.Data.Selectors { /// <summary> /// Class for selection on tickers by liquidity /// </summary> public class SelectorByLiquidity : TickerSelector, ITickerSelector { public SelectorByLiquidity(DataTable setOfTickersToBeSelected, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(setOfTickersToBeSelected, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public SelectorByLiquidity(string groupID, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(groupID, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public DataTable GetTableOfSelectedTickers() { if(this.setOfTickersToBeSelected == null) return QuantProject.DataAccess.Tables.Quotes.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); } public void SelectAllTickers() { ; } } } --- NEW FILE: SelectorByCloseToCloseVolatility.cs --- /* QuantProject - Quantitative Finance Library SelectorByCloseToCloseVolatility.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.Data; using System.Windows.Forms; using QuantProject.DataAccess.Tables; using QuantProject.Data.DataTables; namespace QuantProject.Data.Selectors { /// <summary> /// Class for selection on tickers by close to close volatility /// </summary> public class SelectorByCloseToCloseVolatility : TickerSelector, ITickerSelector { public SelectorByCloseToCloseVolatility(DataTable setOfTickersToBeSelected, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(setOfTickersToBeSelected, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public SelectorByCloseToCloseVolatility(string groupID, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(groupID, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public DataTable GetTableOfSelectedTickers() { if(this.setOfTickersToBeSelected == null) return QuantProject.DataAccess.Tables.Quotes.GetTickersByCloseToCloseVolatility(this.isOrderedInASCMode, this.groupID, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers); else return QuantProject.Data.DataTables.Quotes.GetTickersByCloseToCloseVolatility(this.isOrderedInASCMode, this.setOfTickersToBeSelected, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers); } public void SelectAllTickers() { ; } } } --- NEW FILE: SelectorByOpenToCloseVolatility.cs --- /* QuantProject - Quantitative Finance Library SelectorByOpenToCloseVolatility.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.Data; using System.Windows.Forms; using QuantProject.DataAccess.Tables; using QuantProject.Data.DataTables; namespace QuantProject.Data.Selectors { /// <summary> /// Class for selection on tickers by open to close volatility /// </summary> public class SelectorByOpenToCloseVolatility : TickerSelector, ITickerSelector { public SelectorByOpenToCloseVolatility(DataTable setOfTickersToBeSelected, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(setOfTickersToBeSelected, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public SelectorByOpenToCloseVolatility(string groupID, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(groupID, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public DataTable GetTableOfSelectedTickers() { if(this.setOfTickersToBeSelected == null) return QuantProject.DataAccess.Tables.Quotes.GetTickersByCloseToOpenVolatility(this.isOrderedInASCMode, this.groupID, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers); else return QuantProject.Data.DataTables.Quotes.GetTickersByCloseToOpenVolatility(this.isOrderedInASCMode, this.setOfTickersToBeSelected, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers); } public void SelectAllTickers() { ; } } } --- NEW FILE: SelectorByQuotationAtEachMarketDay.cs --- /* QuantProject - Quantitative Finance Library SelectorByQuotationAtEachMarketDay.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.Data; using System.Windows.Forms; using QuantProject.DataAccess.Tables; using QuantProject.Data.DataTables; namespace QuantProject.Data.Selectors { /// <summary> /// Class for selection on tickers quoted at each market day (market index) /// </summary> public class SelectorByQuotationAtEachMarketDay : TickerSelector , ITickerSelector { private string marketIndex; public SelectorByQuotationAtEachMarketDay(DataTable setOfTickersToBeSelected, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers, string marketIndex): base(setOfTickersToBeSelected, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { this.marketIndex = marketIndex; } public SelectorByQuotationAtEachMarketDay(string groupID, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers, string marketIndex): base(groupID, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { this.marketIndex = marketIndex; } public DataTable GetTableOfSelectedTickers() { if(this.marketIndex == "") throw new Exception("You first need to set TickerSelector's property <<MarketIndex>>!"); if(this.setOfTickersToBeSelected == null) return QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedInEachMarketDay( this.marketIndex, this.groupID, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers); else return QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedInEachMarketDay( this.marketIndex, this.setOfTickersToBeSelected, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers); } public void SelectAllTickers() { ; } } } --- NEW FILE: SelectorByAbsolutePerformance.cs --- /* QuantProject - Quantitative Finance Library SelectorByAbsolutePerformance.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.Data; using System.Windows.Forms; using QuantProject.DataAccess.Tables; using QuantProject.Data.DataTables; namespace QuantProject.Data.Selectors { /// <summary> /// Class for selection on tickers by liquidity /// </summary> public class SelectorByAbsolutePerformance : TickerSelector, ITickerSelector { public SelectorByAbsolutePerformance(DataTable setOfTickersToBeSelected, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(setOfTickersToBeSelected, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public SelectorByAbsolutePerformance(string groupID, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(groupID, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public DataTable GetTableOfSelectedTickers() { 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() { ; } } } Index: SelectionType.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/SelectionType.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SelectionType.cs 6 Jan 2005 18:40:45 -0000 1.7 --- SelectionType.cs 27 Feb 2005 19:56:07 -0000 1.8 *************** *** 26,30 **** { /// <summary> ! /// Enum for TickerSelector class /// </summary> public enum SelectionType --- 26,31 ---- { /// <summary> ! /// Enum used when selection takes place using visual interfaces ! /// Eeach item stands for a specific object implementing ITickerSelector /// </summary> public enum SelectionType *************** *** 38,42 **** CloseToOpenLinearCorrelation, CloseToCloseLinearCorrelation, ! QuotedInEachMarketDay } } \ No newline at end of file --- 39,43 ---- CloseToOpenLinearCorrelation, CloseToCloseLinearCorrelation, ! QuotedAtEachMarketDay } } \ No newline at end of file Index: TickerSelector.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/TickerSelector.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TickerSelector.cs 6 Jan 2005 18:40:45 -0000 1.10 --- TickerSelector.cs 27 Feb 2005 19:56:07 -0000 1.11 *************** *** 31,49 **** { /// <summary> ! /// Class for advanced selections on tickers /// </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 string marketIndex = ""; ! private DateTime firstQuoteDate = QuantProject.ADT.ConstantsProvider.InitialDateTimeForDownload; ! private DateTime lastQuoteDate = DateTime.Now; ! private long maxNumOfReturnedTickers = 0; ! private bool isOrderedInASCMode; #region properties --- 31,44 ---- { /// <summary> ! /// Base class for advanced selections on tickers /// </summary> ! public class TickerSelector { ! protected DataTable setOfTickersToBeSelected = null; ! protected string groupID = ""; ! protected DateTime firstQuoteDate = QuantProject.ADT.ConstantsProvider.InitialDateTimeForDownload; ! protected DateTime lastQuoteDate = DateTime.Now; ! protected long maxNumOfReturnedTickers = 0; ! protected bool isOrderedInASCMode; #region properties *************** *** 77,88 **** 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 --- 72,76 ---- get{return this.maxNumOfReturnedTickers;} } ! /// <summary> /// It gets / sets the order type for the ticker selector *************** *** 93,111 **** set{this.isOrderedInASCMode = value;} } - - /// <summary> - /// It gets / sets the market index for the current ticker selector - /// </summary> - public string MarketIndex - { - get{return this.marketIndex;} - set{this.marketIndex = value;} - } #endregion ! public TickerSelector(DataTable setOfTickersToBeSelected, SelectionType typeOfSelection, bool orderInASCmode, - string groupID, DateTime firstQuoteDate, DateTime lastQuoteDate, --- 81,90 ---- set{this.isOrderedInASCMode = value;} } + #endregion ! public TickerSelector(DataTable setOfTickersToBeSelected, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, *************** *** 113,324 **** { 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(); - case SelectionType.CloseToCloseVolatility: - return this.getTickersByCloseToCloseVolatility(); - case SelectionType.CloseToOpenVolatility: - return this.getTickersByCloseToOpenVolatility(); - case SelectionType.AverageCloseToClosePerformance: - return this.getTickersByAverageCloseToClosePerformance(); - case SelectionType.AverageCloseToOpenPerformance: - return this.getTickersByAverageCloseToOpenPerformance(); - case SelectionType.CloseToCloseLinearCorrelation: - return this.getTickersByCloseToCloseLinearCorrelation(); - case SelectionType.CloseToOpenLinearCorrelation: - return this.getTickersByCloseToOpenLinearCorrelation(); - case SelectionType.QuotedInEachMarketDay: - return this.getTickersQuotedInEachMarketDay(); - //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); - - } - - private DataTable getTickersByAverageCloseToClosePerformance() - { - if(this.setOfTickersToBeSelected == null) - return QuantProject.DataAccess.Tables.Quotes.GetTickersByAverageCloseToClosePerformance(this.isOrderedInASCMode, - this.groupID, this.firstQuoteDate, - this.lastQuoteDate, - this.maxNumOfReturnedTickers); - else - return QuantProject.Data.DataTables.Quotes.GetTickersByAverageCloseToClosePerformance(this.isOrderedInASCMode, - this.setOfTickersToBeSelected, - this.firstQuoteDate, - this.lastQuoteDate, - this.maxNumOfReturnedTickers); - - } - - private DataTable getTickersByAverageCloseToOpenPerformance() - { - if(this.setOfTickersToBeSelected == null) - return QuantProject.DataAccess.Tables.Quotes.GetTickersByAverageCloseToOpenPerformance(this.isOrderedInASCMode, - this.groupID, this.firstQuoteDate, - this.lastQuoteDate, - this.maxNumOfReturnedTickers); - else - return QuantProject.Data.DataTables.Quotes.GetTickersByAverageCloseToOpenPerformance(this.isOrderedInASCMode, - this.setOfTickersToBeSelected, - this.firstQuoteDate, - this.lastQuoteDate, - this.maxNumOfReturnedTickers); - - } - - private DataTable getTickersByCloseToCloseVolatility() - { - if(this.setOfTickersToBeSelected == null) - return QuantProject.DataAccess.Tables.Quotes.GetTickersByCloseToCloseVolatility(this.isOrderedInASCMode, - this.groupID, - this.firstQuoteDate, - this.lastQuoteDate, - this.maxNumOfReturnedTickers); - - else - return QuantProject.Data.DataTables.Quotes.GetTickersByCloseToCloseVolatility(this.isOrderedInASCMode, - this.setOfTickersToBeSelected, - this.firstQuoteDate, - this.lastQuoteDate, - this.maxNumOfReturnedTickers); - } - - private DataTable getTickersByCloseToOpenVolatility() - { - if(this.setOfTickersToBeSelected == null) - return QuantProject.DataAccess.Tables.Quotes.GetTickersByCloseToOpenVolatility(this.isOrderedInASCMode, - this.groupID, - this.firstQuoteDate, - this.lastQuoteDate, - this.maxNumOfReturnedTickers); - - else - return QuantProject.Data.DataTables.Quotes.GetTickersByCloseToOpenVolatility(this.isOrderedInASCMode, - this.setOfTickersToBeSelected, - this.firstQuoteDate, - this.lastQuoteDate, - this.maxNumOfReturnedTickers); - } - - private DataTable getTickersByCloseToCloseLinearCorrelation() - { - this.launchExceptionIfGroupIDIsNotEmpty(); - return QuantProject.Data.DataTables.Quotes.GetTickersByAdjCloseToClosePearsonCorrelationCoefficient(this.isOrderedInASCMode, - this.setOfTickersToBeSelected, - this.firstQuoteDate, - this.lastQuoteDate); - } - - private DataTable getTickersByCloseToOpenLinearCorrelation() - { - - this.launchExceptionIfGroupIDIsNotEmpty(); - - return QuantProject.Data.DataTables.Quotes.GetTickersByCloseToOpenPearsonCorrelationCoefficient(this.isOrderedInASCMode, - this.setOfTickersToBeSelected, - this.firstQuoteDate, - this.lastQuoteDate); - } - - private DataTable getTickersQuotedInEachMarketDay() - { - if(this.marketIndex == "") - throw new Exception("You first need to set TickerSelection's property <<MarketIndex>>!"); - - if(this.setOfTickersToBeSelected == null) - return QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedInEachMarketDay( - this.marketIndex, this.groupID, this.firstQuoteDate, this.lastQuoteDate, - this.maxNumOfReturnedTickers); - - else - return QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedInEachMarketDay( - this.marketIndex, this.setOfTickersToBeSelected, this.firstQuoteDate, this.lastQuoteDate, - this.maxNumOfReturnedTickers); - } - - private void launchExceptionIfGroupIDIsNotEmpty() - { - if(this.groupID!="") - { - throw new Exception("Not implemented: this type of selection works only with few tickers, at the moment"); - } - } - - public void SelectAllTickers() - { - ; - } - // end of implementation of ITickerSelector /// <summary> --- 92,120 ---- { this.setOfTickersToBeSelected = setOfTickersToBeSelected; ! this.commonInitialization(orderInASCmode, firstQuoteDate, ! lastQuoteDate, maxNumOfReturnedTickers); } ! public TickerSelector(string groupID, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers) { ! this.groupID = groupID; ! this.commonInitialization(orderInASCmode, firstQuoteDate, ! lastQuoteDate, maxNumOfReturnedTickers); } ! private void commonInitialization(bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers) { this.isOrderedInASCMode = orderInASCmode; this.firstQuoteDate = firstQuoteDate; this.lastQuoteDate = lastQuoteDate; this.maxNumOfReturnedTickers = maxNumOfReturnedTickers; } /// <summary> --- NEW FILE: SelectorByCloseToCloseLinearCorrelation.cs --- /* QuantProject - Quantitative Finance Library SelectorByCloseToCloseLinearCorrelation.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.Data; using System.Windows.Forms; using QuantProject.DataAccess.Tables; using QuantProject.Data.DataTables; namespace QuantProject.Data.Selectors { /// <summary> /// Class for selection on tickers by close to close linear correlation /// </summary> public class SelectorByCloseToCloseLinearCorrelation : TickerSelector , ITickerSelector { public SelectorByCloseToCloseLinearCorrelation(DataTable setOfTickersToBeSelected, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(setOfTickersToBeSelected, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public SelectorByCloseToCloseLinearCorrelation(string groupID, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers): base(groupID, orderInASCmode, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { } public DataTable GetTableOfSelectedTickers() { this.launchExceptionIfGroupIDIsNotEmpty(); return QuantProject.Data.DataTables.Quotes.GetTickersByAdjCloseToClosePearsonCorrelationCoefficient(this.isOrderedInASCMode, this.setOfTickersToBeSelected, this.firstQuoteDate, this.lastQuoteDate); } private void launchExceptionIfGroupIDIsNotEmpty() { if(this.groupID!="") { throw new Exception("Not implemented: this type of selection works only with few tickers, at the moment"); } } public void SelectAllTickers() { ; } } } |
|
From: Marco M. <mi...@us...> - 2005-02-27 19:56:21
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4614/b7_Scripts/WalkForwardTesting/WalkForwardOneRank Modified Files: EligibleTickers.cs Log Message: Advanced Ticker selection has been re-organized in a more rational and object-oriented way (NOTE that at the moment Quantdownloader solution won't compile) Index: EligibleTickers.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank/EligibleTickers.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EligibleTickers.cs 3 Feb 2005 00:30:22 -0000 1.2 --- EligibleTickers.cs 27 Feb 2005 19:56:09 -0000 1.3 *************** *** 47,62 **** private void setTickers_build( DateTime dateTime ) { ! TickerSelector mostLiquid = ! new TickerSelector( SelectionType.Liquidity , false , "Test" , ! dateTime.AddDays( - this.numDaysToComputeLiquidity ) , dateTime , ! this.numberEligibleTickersToBeChosen ); DataTable mostLiquidTickers = mostLiquid.GetTableOfSelectedTickers(); ! TickerSelector quotedInEachMarketDayFromMostLiquid = ! new TickerSelector( mostLiquidTickers, ! SelectionType.QuotedInEachMarketDay, false, "", ! dateTime.AddDays( - this.numberDaysForPerformanceCalculation ) , ! dateTime, this.numberEligibleTickersToBeChosen); ! quotedInEachMarketDayFromMostLiquid.MarketIndex = "^SPX"; DataTable selectedTickers = quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); --- 47,59 ---- private void setTickers_build( DateTime dateTime ) { ! SelectorByLiquidity mostLiquid = ! new SelectorByLiquidity("Test", false , dateTime.AddDays( - this.numDaysToComputeLiquidity ) , dateTime , ! this.numberEligibleTickersToBeChosen ); DataTable mostLiquidTickers = mostLiquid.GetTableOfSelectedTickers(); ! SelectorByQuotationAtEachMarketDay quotedInEachMarketDayFromMostLiquid = ! new SelectorByQuotationAtEachMarketDay( mostLiquidTickers, ! false, dateTime.AddDays( - this.numberDaysForPerformanceCalculation ) , ! dateTime, this.numberEligibleTickersToBeChosen,"^SPX"); DataTable selectedTickers = quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); |
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4614/b7_Scripts/TickerSelectionTesting Modified Files: EndOfDayTimerHandlerCTC.cs EndOfDayTimerHandlerCTO.cs GenomeManagerForEfficientCTOPortfolio.cs RunEfficientCTOPortfolio.cs Log Message: Advanced Ticker selection has been re-organized in a more rational and object-oriented way (NOTE that at the moment Quantdownloader solution won't compile) Index: EndOfDayTimerHandlerCTO.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTO.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EndOfDayTimerHandlerCTO.cs 12 Feb 2005 19:16:46 -0000 1.3 --- EndOfDayTimerHandlerCTO.cs 27 Feb 2005 19:56:08 -0000 1.4 *************** *** 94,98 **** long quantity = Convert.ToInt64( Math.Floor( cashForSinglePosition / this.account.DataStreamer.GetCurrentBid( ticker ) ) ); ! Order order = new Order( OrderType.MarketBuy, new Instrument( ticker ) , quantity ); this.orders.Add(order); } --- 94,98 ---- long quantity = Convert.ToInt64( Math.Floor( cashForSinglePosition / this.account.DataStreamer.GetCurrentBid( ticker ) ) ); ! Order order = new Order( OrderType.MarketSellShort, new Instrument( ticker ) , quantity ); this.orders.Add(order); } *************** *** 126,130 **** { if(this.orders.Count == 0 && this.account.Transactions.Count == 0) ! this.account.AddCash(15000); this.marketOpenEventHandler_orderChosenTickers(); --- 126,130 ---- { if(this.orders.Count == 0 && this.account.Transactions.Count == 0) ! this.account.AddCash(30000); this.marketOpenEventHandler_orderChosenTickers(); *************** *** 172,184 **** private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) { ! TickerSelector mostLiquid = new TickerSelector(SelectionType.Liquidity, ! false, this.tickerGroupID , currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfEligibleTickers); this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); ! TickerSelector quotedInEachMarketDayFromMostLiquid = ! new TickerSelector( this.eligibleTickers, ! SelectionType.QuotedInEachMarketDay, false, "", ! currentDate.AddDays(-this.numDaysForLiquidity),currentDate, ! this.numberOfEligibleTickers); ! quotedInEachMarketDayFromMostLiquid.MarketIndex = "^MIBTEL"; return quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); } --- 172,182 ---- private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) { ! SelectorByLiquidity mostLiquid = new SelectorByLiquidity(this.tickerGroupID, false, ! currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfEligibleTickers); this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); ! SelectorByQuotationAtEachMarketDay quotedInEachMarketDayFromMostLiquid = ! new SelectorByQuotationAtEachMarketDay( this.eligibleTickers, ! false, currentDate.AddDays(-this.numDaysForLiquidity), ! currentDate, this.numberOfEligibleTickers, "^MIBTEL"); return quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); } Index: GenomeManagerForEfficientCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForEfficientCTOPortfolio.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GenomeManagerForEfficientCTOPortfolio.cs 6 Feb 2005 20:14:01 -0000 1.4 --- GenomeManagerForEfficientCTOPortfolio.cs 27 Feb 2005 19:56:08 -0000 1.5 *************** *** 95,98 **** --- 95,115 ---- return returnValue; } + + public override double GetFitnessValue(Genome genome) + { + double returnValue; + double portfolioVariance = this.getPortfolioVariance(genome.Genes()); + double portfolioRateOfReturn = this.getPortfolioRateOfReturn(genome.Genes()); + this.variance = portfolioVariance; + this.rateOfReturn = portfolioRateOfReturn; + + NormalDistribution normal = new NormalDistribution(portfolioRateOfReturn, Math.Sqrt(portfolioVariance)); + //for long portfolio + //returnValue = normal.GetProbability(this.targetPerformance*0.75,this.targetPerformance*1.25); + //for short portfolio + returnValue = normal.GetProbability(-this.targetPerformance*1.25,-this.targetPerformance*0.75); + //returnValue = 1 - normal.GetProbability(this.targetPerformance); + return returnValue; + } } Index: EndOfDayTimerHandlerCTC.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTC.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EndOfDayTimerHandlerCTC.cs 30 Jan 2005 19:53:12 -0000 1.1 --- EndOfDayTimerHandlerCTC.cs 27 Feb 2005 19:56:08 -0000 1.2 *************** *** 88,100 **** private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) { ! TickerSelector mostLiquid = new TickerSelector(SelectionType.Liquidity, ! false, this.tickerGroupID , currentDate.AddDays(-90), currentDate, this.numberOfEligibleTickers); this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); ! TickerSelector quotedInEachMarketDayFromMostLiquid = ! new TickerSelector( this.eligibleTickers, ! SelectionType.QuotedInEachMarketDay, false, "", ! currentDate.AddDays(-90),currentDate, ! this.numberOfEligibleTickers); ! quotedInEachMarketDayFromMostLiquid.MarketIndex = "^MIBTEL"; return quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); } --- 88,98 ---- private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) { ! SelectorByLiquidity mostLiquid = new SelectorByLiquidity(this.tickerGroupID,false, ! currentDate.AddDays(-90), currentDate, this.numberOfEligibleTickers); this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); ! SelectorByQuotationAtEachMarketDay quotedInEachMarketDayFromMostLiquid = ! new SelectorByQuotationAtEachMarketDay(this.eligibleTickers, ! false, currentDate.AddDays(-90),currentDate, ! this.numberOfEligibleTickers, "^MIBTEL"); return quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); } Index: RunEfficientCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTOPortfolio.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** RunEfficientCTOPortfolio.cs 15 Feb 2005 19:15:36 -0000 1.13 --- RunEfficientCTOPortfolio.cs 27 Feb 2005 19:56:08 -0000 1.14 *************** *** 36,39 **** --- 36,40 ---- using QuantProject.Business.Testing; using QuantProject.Business.Timing; + using QuantProject.Business.Financial.Accounting.Commissions; using QuantProject.Data.DataProviders; using QuantProject.Data.Selectors; *************** *** 98,104 **** this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2004 , 1 , 1 ) , EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2004 , 1 , 10 ) , EndOfDaySpecificTime.OneHourAfterMarketClose ); //this.numIntervalDays = 3; } --- 99,105 ---- this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2004 , 9 , 1 ) , EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2004 , 9 , 10 ) , EndOfDaySpecificTime.OneHourAfterMarketClose ); //this.numIntervalDays = 3; } *************** *** 109,113 **** { //"STOCKMI" ! TickerSelector mostLiquid = new TickerSelector(SelectionType.Liquidity, false, "STOCKMI", firstDate, lastDate, 70); DataTable tickers = mostLiquid.GetTableOfSelectedTickers(); --- 110,115 ---- { //"STOCKMI" ! /* ! * SelectorByLiquidity mostLiquid = new TickerSelector(SelectionType.Liquidity, false, "STOCKMI", firstDate, lastDate, 70); DataTable tickers = mostLiquid.GetTableOfSelectedTickers(); *************** *** 123,126 **** --- 125,130 ---- System.Console.WriteLine("\n\nThe best solution found is: " + (string)GO.BestGenome.Meaning + " with {0} generations", GO.GenerationCounter); + */ + ; } *************** *** 136,140 **** this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , ! this.historicalQuoteProvider ) ); } --- 140,144 ---- this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , ! this.historicalQuoteProvider )); } |
|
From: Marco M. <mi...@us...> - 2005-02-27 19:56:20
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4614/b3_Data Modified Files: b3_Data.csproj Log Message: Advanced Ticker selection has been re-organized in a more rational and object-oriented way (NOTE that at the moment Quantdownloader solution won't compile) Index: b3_Data.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/b3_Data.csproj,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** b3_Data.csproj 20 Jan 2005 01:11:32 -0000 1.22 --- b3_Data.csproj 27 Feb 2005 19:56:08 -0000 1.23 *************** *** 233,236 **** --- 233,281 ---- /> <File + RelPath = "Selectors\SelectorByAbsolutePerformance.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Selectors\SelectorByAverageCloseToClosePerformance.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Selectors\SelectorByAverageOpenToClosePerformance.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Selectors\SelectorByCloseToCloseLinearCorrelation.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Selectors\SelectorByCloseToCloseVolatility.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Selectors\SelectorByLiquidity.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Selectors\SelectorByOpenToCloseLinearCorrelation.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Selectors\SelectorByOpenToCloseVolatility.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Selectors\SelectorByQuotationAtEachMarketDay.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Selectors\TickerSelector.cs" SubType = "Code" |
|
From: Marco M. <mi...@us...> - 2005-02-26 15:12:16
|
Update of /cvsroot/quantproject/QuantProject/b91_QuantProject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29355/b91_QuantProject Modified Files: AccountViewer.cs Log Message: It is now possible to add accounts to the form and order them by fitness Index: AccountViewer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b91_QuantProject/AccountViewer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AccountViewer.cs 4 Feb 2005 00:01:48 -0000 1.1 --- AccountViewer.cs 26 Feb 2005 15:12:07 -0000 1.2 *************** *** 4,7 **** --- 4,12 ---- using System.ComponentModel; using System.Windows.Forms; + using System.Data; + using QuantProject.Business.Financial.Accounting; + using QuantProject.ADT.FileManaging; + + namespace QuantProject.Principale *************** *** 12,17 **** --- 17,25 ---- public class AccountViewer : System.Windows.Forms.Form { + private ArrayList accountsArrayList = new ArrayList(); private System.Windows.Forms.Button buttonAddAccounts; private System.Windows.Forms.DataGrid dataGridAccounts; + private DataTable accountsTable; + private System.Windows.Forms.Button buttonViewReport; private System.ComponentModel.Container components = null; *************** *** 22,25 **** --- 30,34 ---- // InitializeComponent(); + this.setTableAndGrid(); // *************** *** 27,31 **** // } ! /// <summary> /// Clean up --- 36,48 ---- // } ! ! private void setTableAndGrid() ! { ! this.accountsTable = new DataTable(); ! this.accountsTable.Columns.Add("AccountName", System.Type.GetType("System.String")); ! this.accountsTable.Columns.Add("Fitness", Type.GetType("System.Double")); ! this.accountsTable.Columns.Add("Account", Type.GetType("System.Object")); ! this.dataGridAccounts.DataSource = this.accountsTable; ! } /// <summary> /// Clean up *************** *** 49,52 **** --- 66,70 ---- this.buttonAddAccounts = new System.Windows.Forms.Button(); this.dataGridAccounts = new System.Windows.Forms.DataGrid(); + this.buttonViewReport = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dataGridAccounts)).BeginInit(); this.SuspendLayout(); *************** *** 54,60 **** // buttonAddAccounts // ! this.buttonAddAccounts.Location = new System.Drawing.Point(320, 112); this.buttonAddAccounts.Name = "buttonAddAccounts"; ! this.buttonAddAccounts.Size = new System.Drawing.Size(120, 32); this.buttonAddAccounts.TabIndex = 1; this.buttonAddAccounts.Text = "Add Accounts ..."; --- 72,78 ---- // buttonAddAccounts // ! this.buttonAddAccounts.Location = new System.Drawing.Point(8, 160); this.buttonAddAccounts.Name = "buttonAddAccounts"; ! this.buttonAddAccounts.Size = new System.Drawing.Size(96, 32); this.buttonAddAccounts.TabIndex = 1; this.buttonAddAccounts.Text = "Add Accounts ..."; *************** *** 64,78 **** // this.dataGridAccounts.DataMember = ""; this.dataGridAccounts.HeaderForeColor = System.Drawing.SystemColors.ControlText; - this.dataGridAccounts.Location = new System.Drawing.Point(8, 0); this.dataGridAccounts.Name = "dataGridAccounts"; ! this.dataGridAccounts.Size = new System.Drawing.Size(296, 264); this.dataGridAccounts.TabIndex = 2; // // AccountViewer // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(456, 266); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.dataGridAccounts, this.buttonAddAccounts}); --- 82,106 ---- // this.dataGridAccounts.DataMember = ""; + this.dataGridAccounts.Dock = System.Windows.Forms.DockStyle.Top; this.dataGridAccounts.HeaderForeColor = System.Drawing.SystemColors.ControlText; this.dataGridAccounts.Name = "dataGridAccounts"; ! this.dataGridAccounts.Size = new System.Drawing.Size(464, 144); this.dataGridAccounts.TabIndex = 2; // + // buttonViewReport + // + this.buttonViewReport.Location = new System.Drawing.Point(336, 160); + this.buttonViewReport.Name = "buttonViewReport"; + this.buttonViewReport.Size = new System.Drawing.Size(96, 32); + this.buttonViewReport.TabIndex = 3; + this.buttonViewReport.Text = "View Report"; + this.buttonViewReport.Click += new System.EventHandler(this.buttonViewReport_Click); + // // AccountViewer // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(464, 266); this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.buttonViewReport, this.dataGridAccounts, this.buttonAddAccounts}); *************** *** 84,92 **** } #endregion private void buttonAddAccounts_Click(object sender, System.EventArgs e) { ! //add code her for loading accounts } ! } } --- 112,176 ---- } #endregion + + + private void updateForm_updateGrid() + { + this.dataGridAccounts.Refresh(); + } + + private void updateForm_updateTable() + { + Account account; + foreach(Object item in this.accountsArrayList) + { + DataRow rowToAdd = this.accountsTable.NewRow(); + account = (Account)item; + rowToAdd["AccountName"] = account.Key; + rowToAdd["Fitness"] = account.GetFitnessValue(); + rowToAdd["Account"] = account; + this.accountsTable.Rows.Add(rowToAdd); + } + } + + private void updateForm() + { + this.updateForm_updateTable(); + this.updateForm_updateGrid(); + } + + #region Add Accounts + + private string[] buttonAddAccounts_Click_extractAccounts_selectAccounts() + { + OpenFileDialog openFileDialog = new OpenFileDialog(); + openFileDialog.Title = "Select accounts please ..."; + openFileDialog.Multiselect = true; + openFileDialog.CheckFileExists = true; + openFileDialog.ShowDialog(); + return openFileDialog.FileNames; + } + + private void buttonAddAccounts_Click_extractAccounts() + { + string[] accountsSelection = this.buttonAddAccounts_Click_extractAccounts_selectAccounts(); + foreach(string fileName in accountsSelection) + { + this.accountsArrayList.Add((Account)ObjectArchiver.Extract(fileName)); + } + } private void buttonAddAccounts_Click(object sender, System.EventArgs e) { ! this.accountsArrayList.Clear(); ! this.buttonAddAccounts_Click_extractAccounts(); ! this.updateForm(); } ! #endregion ! ! private void buttonViewReport_Click(object sender, System.EventArgs e) ! { ! MessageBox.Show("TO DO ..."); ! } ! ! } } |
|
From: Marco M. <mi...@us...> - 2005-02-26 15:11:07
|
Update of /cvsroot/quantproject/QuantProject/b91_QuantProject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28887/b91_QuantProject Modified Files: b91_QuantProject.csproj Log Message: Added reference to ADT project (in order to use ObjectArchiver class within the AccountViewer) Index: b91_QuantProject.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b91_QuantProject/b91_QuantProject.csproj,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** b91_QuantProject.csproj 4 Feb 2005 00:01:47 -0000 1.7 --- b91_QuantProject.csproj 26 Feb 2005 15:10:49 -0000 1.8 *************** *** 93,96 **** --- 93,101 ---- Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> + <Reference + Name = "b1_ADT" + Project = "{B8A01161-3698-4591-B1EF-90F5FC7D8DBA}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> </References> </Build> |
|
From: Glauco S. <gla...@us...> - 2005-02-20 00:08:49
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4696/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: - SimpleTesting\ShortTest\EndOfDayTimerHandler.cs has been added - SimpleTesting\ShortTest\RunShortTest.cs has been added Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** b7_Scripts.csproj 6 Feb 2005 20:06:05 -0000 1.22 --- b7_Scripts.csproj 20 Feb 2005 00:08:38 -0000 1.23 *************** *** 144,147 **** --- 144,157 ---- /> <File + RelPath = "SimpleTesting\ShortTest\EndOfDayTimerHandler.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "SimpleTesting\ShortTest\RunShortTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TickerSelectionTesting\EndOfDayTimerHandlerCTC.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2005-02-20 00:05:19
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/ShortTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3890 Added Files: RunShortTest.cs EndOfDayTimerHandler.cs Log Message: Script to test a simple short strategy --- NEW FILE: EndOfDayTimerHandler.cs --- /* QuantProject - Quantitative Finance Library EndOfDayTimerHandler.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.Collections; using QuantProject.ADT; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Timing; using QuantProject.Data.DataProviders; using QuantProject.Scripts.SimpleTesting; namespace QuantProject.Scripts.SimpleTesting.ShortTest { /// <summary> /// Short Test core strategy /// </summary> public class EndOfDayTimerHandler { private Account account; private DateTime endDateTime; public Account Account { get { return this.account; } } /// <summary> /// /// </summary> /// <param name="numberEligibleTickers">number of tickers to be chosen with the first selection: /// the best performers will be chosen among these first selected instruments</param> /// <param name="numberBestPeformingTickers">number of instruments to be chosen, as the best /// performers, among the eligible tickers</param> /// <param name="numberOfTickersToBeChosen">number of instruments to be chosen, /// among the best performers</param> /// <param name="windowDays">number of days between two consecutive /// best performing ticker calculation</param> public EndOfDayTimerHandler( Account account , DateTime endDateTime ) { this.account = account; this.endDateTime = endDateTime; } /// <summary> /// Handles a "Market Open" event. /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> public void MarketOpenEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { this.account.AddOrder( new Order( OrderType.MarketSellShort , new Instrument( "MSFT" ) , 100 ) ); } public void MarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { this.account.ClosePosition( "MSFT" ); if ( this.account.EndOfDayTimer.GetCurrentTime().DateTime > this.endDateTime ) this.account.EndOfDayTimer.Stop(); } } } --- NEW FILE: RunShortTest.cs --- /* QuantProject - Quantitative Finance Library RunShortTest.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.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Accounting.Commissions; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Scripting; using QuantProject.Business.Timing; using QuantProject.Presentation.Reporting.WindowsForm; namespace QuantProject.Scripts.SimpleTesting.ShortTest { /// <summary> /// Script to test a simple short strategy /// </summary> public class RunShortTest : Script { private DateTime startDateTime = new DateTime( 2000 , 1 , 1 ); private DateTime endDateTime = new DateTime( 2000 , 12 , 31 ); private Account account; private IHistoricalQuoteProvider historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); /// <summary> /// Script to test the One Rank strategy on a single ticker /// </summary> public RunShortTest() { } public override void Run() { HistoricalEndOfDayTimer historicalEndOfDayTimer = new IndexBasedEndOfDayTimer( new EndOfDayDateTime( this.startDateTime , EndOfDaySpecificTime.MarketOpen ) , "MSFT" ); // this.account = new Account( "MSFT" , historicalEndOfDayTimer , // new HistoricalEndOfDayDataStreamer( historicalEndOfDayTimer , // this.historicalQuoteProvider ) , // new HistoricalEndOfDayOrderExecutor( historicalEndOfDayTimer , // this.historicalQuoteProvider ) , // new IBCommissionManager() ); this.account = new Account( "MSFT" , historicalEndOfDayTimer , new HistoricalEndOfDayDataStreamer( historicalEndOfDayTimer , this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( historicalEndOfDayTimer , this.historicalQuoteProvider ) ); EndOfDayTimerHandler EndOfDayTimerHandler = new EndOfDayTimerHandler( this.account , endDateTime ); historicalEndOfDayTimer.MarketOpen += new MarketOpenEventHandler( EndOfDayTimerHandler.MarketOpenEventHandler ); historicalEndOfDayTimer.MarketClose += new MarketCloseEventHandler( EndOfDayTimerHandler.MarketCloseEventHandler ); this.account.EndOfDayTimer.Start(); Report report = new Report( this.account , this.historicalQuoteProvider ); report.Show( "WFT One Rank" , 1 , new EndOfDayDateTime( this.endDateTime , EndOfDaySpecificTime.MarketClose ) , "MSFT" ); } } } |
|
From: Glauco S. <gla...@us...> - 2005-02-20 00:03:52
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/ShortTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3462/ShortTest Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting/ShortTest added to the repository |
|
From: Glauco S. <gla...@us...> - 2005-02-20 00:03:11
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3321/b4_Business/a1_Financial/a2_Accounting Modified Files: Account.cs Log Message: Fixed bug in the ClosePosition method (now ok for short orders) Index: Account.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Account.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Account.cs 13 Feb 2005 21:12:21 -0000 1.16 --- Account.cs 20 Feb 2005 00:03:03 -0000 1.17 *************** *** 325,329 **** { OrderType orderType = closePosition_getOrderType( position ); ! Order order = new Order( orderType , position.Instrument , position.Quantity ); this.orderExecutor.Execute( order ); } --- 325,329 ---- { OrderType orderType = closePosition_getOrderType( position ); ! Order order = new Order( orderType , position.Instrument , Math.Abs( position.Quantity ) ); this.orderExecutor.Execute( order ); } |
|
From: Glauco S. <gla...@us...> - 2005-02-19 16:02:24
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16858/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows Modified Files: TotalNumberOfTrades.cs LargestWinningTradePercentage.cs LargestLosingTradePercentage.cs AverageTradePercentageReturn.cs AverageShortTradePercentageReturn.cs AverageLongTradePercentageReturn.cs Log Message: Added try catch to avoid run time errors when there are no round trades Index: AverageLongTradePercentageReturn.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/AverageLongTradePercentageReturn.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AverageLongTradePercentageReturn.cs 15 Feb 2005 19:09:02 -0000 1.2 --- AverageLongTradePercentageReturn.cs 19 Feb 2005 16:02:15 -0000 1.3 *************** *** 16,21 **** { this.rowDescription = "Average long trade % Return"; ! double avgReturn = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "(Trade='Long')" ); this.rowValue = avgReturn; } --- 16,29 ---- { this.rowDescription = "Average long trade % Return"; ! double avgReturn = 0.0; ! try ! { ! avgReturn = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "(Trade='Long')" ); ! } ! catch (Exception ex) ! { ! ex = ex; // to avoid compilation warning; ! } this.rowValue = avgReturn; } Index: LargestWinningTradePercentage.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/LargestWinningTradePercentage.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LargestWinningTradePercentage.cs 15 Feb 2005 19:09:03 -0000 1.2 --- LargestWinningTradePercentage.cs 19 Feb 2005 16:02:15 -0000 1.3 *************** *** 16,21 **** { this.rowDescription = "Largest winning trade"; ! this.rowValue = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( "max([%Profit])" , "([%Profit]>0)" ); } } --- 16,28 ---- { this.rowDescription = "Largest winning trade"; ! try ! { ! this.rowValue = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( "max([%Profit])" , "([%Profit]>0)" ); ! } ! catch (Exception ex) ! { ! ex = ex; // to avoid compilation warning; ! } } } Index: AverageShortTradePercentageReturn.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/AverageShortTradePercentageReturn.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AverageShortTradePercentageReturn.cs 15 Feb 2005 19:09:02 -0000 1.2 --- AverageShortTradePercentageReturn.cs 19 Feb 2005 16:02:15 -0000 1.3 *************** *** 16,22 **** { this.rowDescription = "Average short trade % Return"; ! double avgReturn = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( ! "avg([%Profit])" , "(Trade='Short')" ); this.rowValue = avgReturn; } --- 16,30 ---- { this.rowDescription = "Average short trade % Return"; ! double avgReturn = 0.0; ! try ! { ! avgReturn = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( ! "avg([%Profit])" , "(Trade='Short')" ); ! } ! catch (Exception ex) ! { ! ex = ex; // to avoid compilation warning; ! } this.rowValue = avgReturn; } Index: AverageTradePercentageReturn.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/AverageTradePercentageReturn.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AverageTradePercentageReturn.cs 15 Feb 2005 19:09:02 -0000 1.2 --- AverageTradePercentageReturn.cs 19 Feb 2005 16:02:15 -0000 1.3 *************** *** 16,21 **** { this.rowDescription = "Average trade % Return"; ! double avgReturn = (double) summary.AccountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "true" ); ! this.rowValue = avgReturn; } } --- 16,27 ---- { this.rowDescription = "Average trade % Return"; ! try ! { ! this.rowValue = (double) summary.AccountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "true" ); ! } ! catch (Exception ex) ! { ! ex = ex; // to avoid compilation warning; ! } } } Index: LargestLosingTradePercentage.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/LargestLosingTradePercentage.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LargestLosingTradePercentage.cs 15 Feb 2005 19:09:03 -0000 1.2 --- LargestLosingTradePercentage.cs 19 Feb 2005 16:02:15 -0000 1.3 *************** *** 16,21 **** { this.rowDescription = "Largest losing trade"; ! this.rowValue = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( "min([%Profit])" , "([%Profit]<0)" ); } } --- 16,28 ---- { this.rowDescription = "Largest losing trade"; ! try ! { ! this.rowValue = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( "min([%Profit])" , "([%Profit]<0)" ); ! } ! catch (Exception ex) ! { ! ex = ex; // to avoid compilation warning; ! } } } Index: TotalNumberOfTrades.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/TotalNumberOfTrades.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TotalNumberOfTrades.cs 15 Feb 2005 19:09:04 -0000 1.2 --- TotalNumberOfTrades.cs 19 Feb 2005 16:02:15 -0000 1.3 *************** *** 15,21 **** double totalROA = summary.TotalPnl / ( summary.FinalAccountValue - summary.TotalPnl ); this.rowDescription = "Total # of trades"; ! DataRow[] DataRows = ! summary.AccountReport.RoundTrades.DataTable.Select( "(ExitPrice is not null)" ); ! this.rowValue = DataRows.Length; } } --- 15,28 ---- double totalROA = summary.TotalPnl / ( summary.FinalAccountValue - summary.TotalPnl ); this.rowDescription = "Total # of trades"; ! try ! { ! DataRow[] DataRows = ! summary.AccountReport.RoundTrades.DataTable.Select( "(ExitPrice is not null)" ); ! this.rowValue = DataRows.Length; ! } ! catch (Exception ex) ! { ! ex = ex; // to avoid compilation warning; ! } } } |