quantproject-developers Mailing List for QuantProject (Page 150)
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: <gla...@us...> - 2003-11-24 19:32:44
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting In directory sc8-pr-cvs1:/tmp/cvs-serv29906/SimpleTesting Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/SimpleTesting added to the repository |
|
From: <gla...@us...> - 2003-11-24 19:31:14
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/Profunds In directory sc8-pr-cvs1:/tmp/cvs-serv29613 Removed Files: AsProfunds.cs RunProfunds.cs TsProfunds.cs Log Message: This script has been deleted (substituted by OneRank) --- AsProfunds.cs DELETED --- --- RunProfunds.cs DELETED --- --- TsProfunds.cs DELETED --- |
|
From: <gla...@us...> - 2003-11-24 19:29:09
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/MSFTsimpleTest In directory sc8-pr-cvs1:/tmp/cvs-serv29227 Removed Files: AsMSFTsimpleTest.cs RunMSFTsimpleTest.cs TsMSFTsimpleTest.cs Log Message: MSFTsimpleTest has been moved under the SimpleTesting folder. --- AsMSFTsimpleTest.cs DELETED --- --- RunMSFTsimpleTest.cs DELETED --- --- TsMSFTsimpleTest.cs DELETED --- |
|
From: <gla...@us...> - 2003-11-22 20:57:47
|
Update of /cvsroot/quantproject/QuantDownloader In directory sc8-pr-cvs1:/tmp/cvs-serv30627/QuantDownloader Modified Files: QuantDownloader.suo Log Message: The import procedure (from the web) now automatically updates the quAdjustedOpen field also. Index: QuantDownloader.suo =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/QuantDownloader.suo,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsxAzEVB and /tmp/cvso44qB3 differ |
|
From: <gla...@us...> - 2003-11-22 20:57:47
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader
In directory sc8-pr-cvs1:/tmp/cvs-serv30627/QuantDownloader/Downloader
Modified Files:
DataBaseImporter.cs
Log Message:
The import procedure (from the web) now automatically
updates the quAdjustedOpen field also.
Index: DataBaseImporter.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/DataBaseImporter.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DataBaseImporter.cs 20 Nov 2003 22:38:48 -0000 1.1
--- DataBaseImporter.cs 22 Nov 2003 20:57:44 -0000 1.2
***************
*** 60,63 ****
--- 60,65 ----
myRow[ "quVolume" ]=Double.Parse( LineIn[5] );
myRow[ "quAdjustedClose" ]=Double.Parse( LineIn[6] );
+ myRow[ "quAdjustedOpen" ]=Convert.ToDouble(myRow[ "quOpen" ])*
+ (Convert.ToDouble(myRow[ "quAdjustedClose" ])/Convert.ToDouble(myRow[ "quOpen" ]));
// myRow["date"]=DateTime.Parse(LineIn[0]);
|
|
From: <gla...@us...> - 2003-11-20 22:44:17
|
Update of /cvsroot/quantproject/QuantDownloader In directory sc8-pr-cvs1:/tmp/cvs-serv19223 Modified Files: QuantDownloader.suo Log Message: - Added the DataBaseLocator class - The CVS step is avoided now (a DataSet approach is used); the DataBaseImporter class has been added Index: QuantDownloader.suo =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/QuantDownloader.suo,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsrEt7i7 and /tmp/cvs6gpho4 differ |
|
From: <gla...@us...> - 2003-11-20 22:38:51
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader In directory sc8-pr-cvs1:/tmp/cvs-serv16375/Downloader Modified Files: DataSet1.cs Downloader.csproj Main.cs TestDownloadedData.cs WebDownloader.cs Added Files: DataBaseImporter.cs DataBaseLocator.cs TickerDownloader.cs Log Message: - Added the DataBaseLocator class - The CVS step is avoided now (a DataSet approach is used); the DataBaseImporter class has been added --- NEW FILE: DataBaseImporter.cs --- using System; using System.Data; using System.Data.OleDb; using System.IO; namespace QuantDownloader { /// <summary> /// Summary description for DataBaseImporter. /// </summary> public class DataBaseImporter { private StreamReader streamReader; private OleDbConnection oleDbConnection; public DataBaseImporter( OleDbConnection oleDbConnection , StreamReader streamReader ) { this.streamReader = streamReader; this.oleDbConnection = oleDbConnection; } public void ImportTicker( string ticker ) { string Line; string[] LineIn; string strAccessSelect = "Select * from quotes where 1=2"; OleDbCommand myAccessCommand = new OleDbCommand( strAccessSelect , oleDbConnection ); OleDbDataAdapter myDataAdapter = new OleDbDataAdapter( myAccessCommand ); OleDbCommandBuilder myCB = new OleDbCommandBuilder( myDataAdapter ); //Create Dataset and table DataSet myDataSet = new DataSet(); //Set MissingSchemaAction Property myDataAdapter.MissingSchemaAction = MissingSchemaAction.Add; //Set MissingMappingAction Property myDataAdapter.MissingMappingAction = MissingMappingAction.Passthrough; //Fill data adapter myDataAdapter.Fill( myDataSet , "Data" ); Line = streamReader.ReadLine(); Line = streamReader.ReadLine(); while ( Line != null ) { LineIn=Line.Split(','); DataRow myRow=myDataSet.Tables["Data"].NewRow(); myRow[ "quTicker" ] = ticker; myRow[ "quDate" ]=DateTime.Parse( LineIn[0] ); myRow[ "quOpen" ]=Double.Parse( LineIn[1] ); myRow[ "quHigh" ]=Double.Parse( LineIn[2] ); myRow[ "quLow" ]=Double.Parse( LineIn[3] ); myRow[ "quClose" ]=Double.Parse( LineIn[4] ); myRow[ "quVolume" ]=Double.Parse( LineIn[5] ); myRow[ "quAdjustedClose" ]=Double.Parse( LineIn[6] ); // myRow["date"]=DateTime.Parse(LineIn[0]); // myRow["time"]=DateTime.Parse(LineIn[1]); // myRow["sv1485ri"]=Double.Parse(LineIn[2]); // myRow["sv14856s"]=Double.Parse(LineIn[3]); // myRow["d4461"]=Double.Parse(LineIn[4]); // myRow["d6sf"]=Double.Parse(LineIn[5]); // myRow["d6sdp"]=Double.Parse(LineIn[6]); // myRow["oppai"]=Double.Parse(LineIn[7]); // myRow["oppbi"]=Double.Parse(LineIn[8]); // myRow["opps"]=Double.Parse(LineIn[9]); // myRow["o24hrtf"]=Double.Parse(LineIn[10]); // myRow["oif"]=Double.Parse(LineIn[11]); // myRow["otct"]=Double.Parse(LineIn[12]); // myRow["d1abt"]=Double.Parse(LineIn[13]); // myRow["d1bbt"]=Double.Parse(LineIn[14]); // myRow["d3bt"]=Double.Parse(LineIn[15]); // myRow["d2bt"]=Double.Parse(LineIn[16]); // myRow["d5bt"]=Double.Parse(LineIn[17]); // myRow["d6bt"]=Double.Parse(LineIn[18]); // myRow["cv1480cvpi"]=Double.Parse(LineIn[19]); // myRow["cv1481cvpi"]=Double.Parse(LineIn[20]); myDataSet.Tables["Data"].Rows.Add(myRow); Line = this.streamReader.ReadLine(); } myDataAdapter.Update(myDataSet, "Data"); } } } --- NEW FILE: DataBaseLocator.cs --- using System; using System.Xml; using System.IO; using System.Windows.Forms; namespace QuantDownloader { /// <summary> /// Locate the database /// </summary> public class DataBaseLocator { private string dataBaseType; private StreamReader stream; private XmlTextReader xmlTextReader; private string path; public DataBaseLocator(string fileExtension) { try { this.dataBaseType = fileExtension; //it looks for the file in the application directory if (!File.Exists("DataBase.xml")) createXmlFile(); this.stream = new StreamReader(Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf('\\')) + @"\DataBase.xml"); this.xmlTextReader = new XmlTextReader(this.stream); while(xmlTextReader.Read()) { if (xmlTextReader.LocalName.ToString() == this.dataBaseType) { //gets full path of the file that contains the database this.Path = xmlTextReader.GetAttribute(0); } } xmlTextReader.Close(); stream.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); xmlTextReader.Close(); stream.Close(); } } public string Path { get { return path; } set { path = value; } } /// <summary> /// create xmlFile in the application directory /// where to store name and path for the mdb file /// selected by the user /// </summary> private void createXmlFile() { string path; string xmlPath; string selectionByUser; selectionByUser = selectDataBase(); if (selectionByUser == "") { MessageBox.Show("With no selection application won't run!"); Application.Exit(); } else { path = selectionByUser; xmlPath = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf('\\')) + @"\DataBase.xml"; XmlTextWriter xmlTextWriter = new XmlTextWriter(xmlPath, null); xmlTextWriter.Formatting = Formatting.Indented; xmlTextWriter.WriteStartDocument(); xmlTextWriter.WriteStartElement("FILES"); xmlTextWriter.WriteStartElement("MDB"); xmlTextWriter.WriteAttributeString("fullpath",path); xmlTextWriter.WriteEndElement(); xmlTextWriter.WriteEndElement(); xmlTextWriter.WriteEndDocument(); xmlTextWriter.Flush(); xmlTextWriter.Close(); } } private string selectDataBase() { string fileName = ""; switch (this.dataBaseType) { case "MDB": fileName = "QuantProject.mdb"; break; } OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = "Select " + fileName + " please ..."; openFileDialog.Multiselect = false; openFileDialog.CheckFileExists = true; openFileDialog.Filter = fileName + "|" + fileName; openFileDialog.ShowDialog(); return openFileDialog.FileName; } } } --- NEW FILE: TickerDownloader.cs --- using System; using System.Data; using System.IO; using System.Net; using System.Windows.Forms; namespace QuantDownloader { /// <summary> /// Summary description for TickerDownloader. /// </summary> public class TickerDownloader { private System.Data.OleDb.OleDbConnection oleDbConnection1; private WebDownloader p_myForm; private DataRow p_currentDataTickerRow; private string p_quTicker; private int p_numRows; private DateTime startDate = new DateTime( 2000 , 1 , 1 ); private DateTime endDate = DateTime.Today; private int endDay = DateTime.Now.Day; private int endMonth = DateTime.Now.Month; private int endYear = DateTime.Now.Year; public TickerDownloader( WebDownloader myForm, DataRow currentDataTickerRow, string quTicker , int numRows ) { p_myForm = myForm; p_currentDataTickerRow = currentDataTickerRow; p_quTicker = quTicker; p_numRows = numRows; this.oleDbConnection1 = myForm.OleDbConnection1; } private void addTickerTo_gridDataSet() { DataRow newRow = p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].NewRow(); newRow[ "tiTicker" ] = p_quTicker; newRow[ "currentState" ] = "Start"; //lock( p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Rows ) //{ try { //MessageBox.Show( (p_myForm == null).ToString() ); //MessageBox.Show( (p_myForm.dsTickerCurrentlyDownloaded == null).ToString() ); //MessageBox.Show( (p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ] == null).ToString() ); //MessageBox.Show( (p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Rows == null).ToString() ); //MessageBox.Show( (newRow == null).ToString() ); p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Rows.Add( newRow ); } catch (Exception ex) { MessageBox.Show( ex.ToString() ); } //} p_myForm.dataGrid1.Refresh(); } private void removeTickerFrom_gridDataSet() { DataRow[] myRows = p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Select( "tiTicker='" + p_quTicker + "'" ); p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Rows.Remove( myRows[ 0 ] ); DataRow newRow = p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].NewRow(); newRow[ "tiTicker" ] = p_quTicker; newRow[ "currentState" ] = "Start"; p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Rows.Add( newRow ); p_myForm.dataGrid1.Refresh(); } private void updateCurrentStatus( string newState ) { lock( p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ] ) { DataRow[] myRows = p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Select( "tiTicker='" + p_quTicker + "'" ); myRows[ 0 ][ "currentState" ] = newState; p_myForm.dataGrid1.Refresh(); } } private void addTickerToFaultyTickers() { System.Data.OleDb.OleDbCommand odc = new System.Data.OleDb.OleDbCommand(); odc.CommandText = "insert into faultyTickers ( ftTicker , ftDateTime ) " + "values ( '" + p_quTicker + "' , #" + DateTime.Now.Month + "/" + DateTime.Now.Day + "/" + DateTime.Now.Year + " " + DateTime.Now.Hour + "." + DateTime.Now.Minute + "." + DateTime.Now.Second + "# )"; odc.Connection = this.oleDbConnection1; odc.ExecuteNonQuery(); } private void writeFile_tickerCsv_forNextTimeFrame( DateTime currBeginDate , DateTime currEndDate ) { int a = currBeginDate.Month - 1; int b = currBeginDate.Day; int c = currBeginDate.Year; int d = currEndDate.Month - 1; int e = currEndDate.Day; int f = currEndDate.Year; int numTrials = 1; //updateCurrentStatus( " 1 " ); while (numTrials < 5) { this.p_myForm.Refresh(); try { HttpWebRequest Req = (HttpWebRequest)WebRequest.Create("http:" + "//table.finance.yahoo.com/table.csv?a=" + a + "&b=" + b + "&c=" + c +"&d=" + d + "&e=" + e + "&f=" + f + "&s=" + p_quTicker + "&y=0&g=d&ignore=.csv"); Req.Method = "GET"; Req.Timeout = 10000; HttpWebResponse hwr = (HttpWebResponse)Req.GetResponse(); //updateCurrentStatus( " 2 " ); Stream strm = hwr.GetResponseStream(); //updateCurrentStatus( " 3 " ); StreamReader sr = new StreamReader(strm); // StreamWriter sw=new StreamWriter( "C:\\Documents and Settings\\Glauco\\My Documents\\Visual Studio Projects\\QuantProject\\csvFiles\\" + p_quTicker + ".csv"); // sw.Write(myString); // sw.Close(); DataBaseImporter dataBaseImporter = new DataBaseImporter( this.oleDbConnection1 , sr ); dataBaseImporter.ImportTicker( p_quTicker ); sr.Close(); strm.Close(); // import_tickerCsv_into_quotesCsv(); updateCurrentStatus( d + "/" + e + "/" + f ); numTrials = 6 ; //updateCurrentStatus( " scritto file! " ); } catch (Exception exception) { MessageBox.Show( exception.ToString() ); updateCurrentStatus( "Tentativo: " + numTrials ); numTrials++; if (numTrials > 5) addTickerToFaultyTickers(); } } } private void writeFile_tickerCsv() { DateTime currBeginDate = new DateTime(); currBeginDate = startDate; while ( currBeginDate < endDate ) { DateTime currEndDate = new DateTime(); if ( DateTime.Compare( DateTime.Today , currBeginDate.AddDays( 200 ) ) < 0 ) currEndDate = DateTime.Today; else currEndDate = currBeginDate.AddDays( 200 ); writeFile_tickerCsv_forNextTimeFrame( currBeginDate , currEndDate ); currBeginDate = currEndDate.AddDays( 1 ); } } private void import_tickerCsv_into_quotesCsv() { string sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "C:\\Documents and Settings\\Glauco\\My Documents\\Visual Studio Projects\\QuantProject\\csvFiles\\" + ";Extended Properties=\"Text;HDR=YES;FMT=Delimited\""; System.Data.OleDb.OleDbConnection objConn = new System.Data.OleDb.OleDbConnection(sConnectionString); objConn.Open(); System.Data.OleDb.OleDbCommand odCommand = new System.Data.OleDb.OleDbCommand(); odCommand.Connection = objConn; try { odCommand.CommandText = "insert into quotes.csv SELECT '" + p_quTicker + "' as Ticker, * FROM " + p_quTicker + ".csv"; odCommand.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show( ex.ToString() ); } objConn.Close(); } public void downloadTicker() { { addTickerTo_gridDataSet(); writeFile_tickerCsv(); //Monitor.Pulse( p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ] ); } } } } Index: DataSet1.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/DataSet1.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** DataSet1.cs 16 Oct 2003 18:08:28 -0000 1.1.1.1 --- DataSet1.cs 20 Nov 2003 22:38:48 -0000 1.2 *************** *** 9,13 **** //------------------------------------------------------------------------------ ! namespace QuantProject { using System; using System.Data; --- 9,13 ---- //------------------------------------------------------------------------------ ! namespace QuantDownloader { using System; using System.Data; Index: Downloader.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/Downloader.csproj,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Downloader.csproj 16 Oct 2003 18:08:34 -0000 1.1.1.1 --- Downloader.csproj 20 Nov 2003 22:38:48 -0000 1.2 *************** *** 93,96 **** --- 93,107 ---- <File RelPath = "AssemblyInfo.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "DataBaseImporter.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "DataBaseLocator.cs" + SubType = "Code" BuildAction = "Compile" /> *************** *** 128,131 **** --- 139,147 ---- DependentUpon = "TestDownloadedData.cs" BuildAction = "EmbeddedResource" + /> + <File + RelPath = "TickerDownloader.cs" + SubType = "Code" + BuildAction = "Compile" /> <File Index: Main.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/Main.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Main.cs 16 Oct 2003 18:08:41 -0000 1.1.1.1 --- Main.cs 20 Nov 2003 22:38:48 -0000 1.2 *************** *** 5,9 **** using System.Windows.Forms; ! namespace QuantProject.Principale { /// <summary> --- 5,9 ---- using System.Windows.Forms; ! namespace QuantDownloader { /// <summary> Index: TestDownloadedData.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TestDownloadedData.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** TestDownloadedData.cs 16 Oct 2003 18:08:58 -0000 1.1.1.1 --- TestDownloadedData.cs 20 Nov 2003 22:38:48 -0000 1.2 *************** *** 5,9 **** using System.Windows.Forms; ! namespace QuantProject.Principale { /// <summary> --- 5,9 ---- using System.Windows.Forms; ! namespace QuantDownloader { /// <summary> Index: WebDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/WebDownloader.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** WebDownloader.cs 16 Oct 2003 18:09:36 -0000 1.1.1.1 --- WebDownloader.cs 20 Nov 2003 22:38:48 -0000 1.2 *************** *** 10,14 **** using System.Threading; ! namespace QuantProject.Principale { /// <summary> --- 10,14 ---- using System.Threading; ! namespace QuantDownloader { /// <summary> *************** *** 17,22 **** public class WebDownloader : System.Windows.Forms.Form { private System.Windows.Forms.Button button1; - public System.Data.OleDb.OleDbConnection oleDbConnection1; public System.Windows.Forms.DataGrid dataGrid1; private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1; --- 17,28 ---- public class WebDownloader : System.Windows.Forms.Form { + private static DataBaseLocator dataBaseLocator = new DataBaseLocator("MDB"); + private static string mdbPath = dataBaseLocator.Path; + private static string connectionString = + @"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=" + + mdbPath + + @";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="""";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False"; + public OleDbConnection OleDbConnection1 = new OleDbConnection( connectionString ); private System.Windows.Forms.Button button1; public System.Windows.Forms.DataGrid dataGrid1; private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1; *************** *** 25,31 **** private System.Data.OleDb.OleDbCommand oleDbUpdateCommand1; private System.Data.OleDb.OleDbCommand oleDbDeleteCommand1; ! private QuantProject.DataSet1 dataSet11; private System.Data.OleDb.OleDbCommand oleDbCommand1; ! public QuantProject.DataSet1 dsTickerCurrentlyDownloaded; /// <summary> /// Required designer variable. --- 31,37 ---- private System.Data.OleDb.OleDbCommand oleDbUpdateCommand1; private System.Data.OleDb.OleDbCommand oleDbDeleteCommand1; ! // private QuantProject.DataSet1 dataSet11; private System.Data.OleDb.OleDbCommand oleDbCommand1; ! public DataSet1 DsTickerCurrentlyDownloaded = new DataSet1(); /// <summary> /// Required designer variable. *************** *** 43,49 **** // TODO: Add any constructor code after InitializeComponent call // ! this.oleDbDataAdapter1.Fill(this.dataSet11); ! this.oleDbConnection1.Open(); ! //this.oleDbConnection1.Close(); } --- 49,55 ---- // TODO: Add any constructor code after InitializeComponent call // ! //this.oleDbDataAdapter1.Fill(this.dataSet11); ! this.OleDbConnection1.Open(); ! //this.OleDbConnection1.Close(); } *************** *** 71,75 **** { this.button1 = new System.Windows.Forms.Button(); - this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection(); this.dataGrid1 = new System.Windows.Forms.DataGrid(); this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter(); --- 77,80 ---- *************** *** 91,98 **** this.button1.Click += new System.EventHandler(this.button1_Click); // - // oleDbConnection1 - // - this.oleDbConnection1.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=C:\Documents and Settings\Glauco\My Documents\Visual Studio Projects\QuantProject\QuantProject.mdb;Mode=Share Deny None;Extended Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="""";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False"; - // // dataGrid1 // --- 96,99 ---- *************** *** 123,127 **** // this.oleDbDeleteCommand1.CommandText = @"DELETE FROM quotes WHERE (quId = ?) AND (quClose = ? OR ? IS NULL AND quClose IS NULL) AND (quDate = ? OR ? IS NULL AND quDate IS NULL) AND (quHigh = ? OR ? IS NULL AND quHigh IS NULL) AND (quLow = ? OR ? IS NULL AND quLow IS NULL) AND (quOpen = ? OR ? IS NULL AND quOpen IS NULL) AND (quTicker = ? OR ? IS NULL AND quTicker IS NULL)"; - this.oleDbDeleteCommand1.Connection = this.oleDbConnection1; this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_quId", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(10)), ((System.Byte)(0)), "quId", System.Data.DataRowVersion.Original, null)); this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_quClose", System.Data.OleDb.OleDbType.Single, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(7)), ((System.Byte)(0)), "quClose", System.Data.DataRowVersion.Original, null)); --- 124,127 ---- *************** *** 142,146 **** this.oleDbInsertCommand1.CommandText = "INSERT INTO quotes (quClose, quDate, quHigh, quLow, quOpen, quTicker, quVolume) V" + "ALUES (?, ?, ?, ?, ?, ?, ?)"; - this.oleDbInsertCommand1.Connection = this.oleDbConnection1; this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("quClose", System.Data.OleDb.OleDbType.Single, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(7)), ((System.Byte)(0)), "quClose", System.Data.DataRowVersion.Current, null)); this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("quDate", System.Data.OleDb.OleDbType.DBDate, 0, "quDate")); --- 142,145 ---- *************** *** 154,163 **** // this.oleDbSelectCommand1.CommandText = "SELECT quClose, quDate, quHigh, quLow, quOpen, quTicker FROM quotes"; - this.oleDbSelectCommand1.Connection = this.oleDbConnection1; // // oleDbUpdateCommand1 // this.oleDbUpdateCommand1.CommandText = @"UPDATE quotes SET quClose = ?, quDate = ?, quHigh = ?, quLow = ?, quOpen = ?, quTicker = ? WHERE (quId = ?) AND (quClose = ? OR ? IS NULL AND quClose IS NULL) AND (quDate = ? OR ? IS NULL AND quDate IS NULL) AND (quHigh = ? OR ? IS NULL AND quHigh IS NULL) AND (quLow = ? OR ? IS NULL AND quLow IS NULL) AND (quOpen = ? OR ? IS NULL AND quOpen IS NULL) AND (quTicker = ? OR ? IS NULL AND quTicker IS NULL)"; - this.oleDbUpdateCommand1.Connection = this.oleDbConnection1; this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("quClose", System.Data.OleDb.OleDbType.Single, 0, System.Data.ParameterDirection.Input, false, ((System.Byte)(7)), ((System.Byte)(0)), "quClose", System.Data.DataRowVersion.Current, null)); this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("quDate", System.Data.OleDb.OleDbType.DBDate, 0, "quDate")); --- 153,160 ---- *************** *** 182,189 **** // oleDbCommand1 // ! this.oleDbCommand1.CommandText = "DELETE FROM quotes"; ! this.oleDbCommand1.Connection = this.oleDbConnection1; // ! // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); --- 179,186 ---- // oleDbCommand1 // ! this.oleDbCommand1.CommandText = "DELETE quotes.* FROM quotes INNER JOIN tickers ON quotes.quTicker = tickers.tiTic" + ! "ker"; // ! // WebDownloader // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); *************** *** 192,196 **** this.dataGrid1, this.button1}); ! this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); --- 189,193 ---- this.dataGrid1, this.button1}); ! this.Name = "WebDownloader"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); *************** *** 256,260 **** private void downloadQuotes_createTickerDataSet( DataSet ds ) { ! System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1=new OleDbDataAdapter( "select * from tickers" , this.oleDbConnection1); oleDbDataAdapter1.Fill(ds); } --- 253,257 ---- private void downloadQuotes_createTickerDataSet( DataSet ds ) { ! System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1=new OleDbDataAdapter( "select * from tickers" , this.OleDbConnection1); oleDbDataAdapter1.Fill(ds); } *************** *** 322,332 **** private void downloadQuotes_withTickerDataSet_create_dsTickerCurrentlyDownloaded( DataTable dt ) { ! if (!this.dsTickerCurrentlyDownloaded.Tables.Contains( "Tickers" )) { ! this.dsTickerCurrentlyDownloaded.Tables.Add( "Tickers" ); ! this.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Columns.Add( new DataColumn( dt.Columns[ "tiTicker" ].ColumnName , dt.Columns[ "tiTicker" ].DataType ) ); ! this.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Columns.Add( "currentState" , System.Type.GetType( "System.String" ) ); ! this.dataGrid1.DataSource = this.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ]; } --- 319,329 ---- private void downloadQuotes_withTickerDataSet_create_dsTickerCurrentlyDownloaded( DataTable dt ) { ! if (!this.DsTickerCurrentlyDownloaded.Tables.Contains( "Tickers" )) { ! this.DsTickerCurrentlyDownloaded.Tables.Add( "Tickers" ); ! this.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Columns.Add( new DataColumn( dt.Columns[ "tiTicker" ].ColumnName , dt.Columns[ "tiTicker" ].DataType ) ); ! this.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Columns.Add( "currentState" , System.Type.GetType( "System.String" ) ); ! this.dataGrid1.DataSource = this.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ]; } *************** *** 348,352 **** //qd.downloadTicker(); } ! ImportQuotesCsv iqc = new ImportQuotesCsv(); } --- 345,349 ---- //qd.downloadTicker(); } ! //ImportQuotesCsv iqc = new ImportQuotesCsv(); } *************** *** 356,366 **** downloadQuotes_deleteFrom_quotes(); downloadQuotes_createTickerDataSet( ds ); ! //this.oleDbConnection1.Open(); downloadQuotes_withTickerDataSet( ds ); ! this.oleDbConnection1.Close(); } private void button1_Click(object sender, System.EventArgs e) { this.oleDbCommand1.ExecuteNonQuery(); downloadQuotes(); --- 353,364 ---- downloadQuotes_deleteFrom_quotes(); downloadQuotes_createTickerDataSet( ds ); ! //this.OleDbConnection1.Open(); downloadQuotes_withTickerDataSet( ds ); ! this.OleDbConnection1.Close(); } private void button1_Click(object sender, System.EventArgs e) { + oleDbCommand1.Connection = this.OleDbConnection1; this.oleDbCommand1.ExecuteNonQuery(); downloadQuotes(); *************** *** 372,546 **** } } - public class TickerDownloader - { - private WebDownloader p_myForm; - private DataRow p_currentDataTickerRow; - private string p_quTicker; - private int p_numRows; - private DateTime startDate = new DateTime( 2000 , 1 , 1 ); - private DateTime endDate = DateTime.Today; - private int endDay = DateTime.Now.Day; - private int endMonth = DateTime.Now.Month; - private int endYear = DateTime.Now.Year; - public TickerDownloader( WebDownloader myForm, DataRow currentDataTickerRow, string quTicker , int numRows ) - { - p_myForm = myForm; - p_currentDataTickerRow = currentDataTickerRow; - p_quTicker = quTicker; - p_numRows = numRows; - } - private void addTickerTo_gridDataSet() - { - - DataRow newRow = p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ].NewRow(); - newRow[ "tiTicker" ] = p_quTicker; - newRow[ "currentState" ] = "Start"; - //lock( p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Rows ) - //{ - try - { - //MessageBox.Show( (p_myForm == null).ToString() ); - //MessageBox.Show( (p_myForm.dsTickerCurrentlyDownloaded == null).ToString() ); - //MessageBox.Show( (p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ] == null).ToString() ); - //MessageBox.Show( (p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Rows == null).ToString() ); - //MessageBox.Show( (newRow == null).ToString() ); - p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Rows.Add( newRow ); - } - catch (Exception ex) - { - MessageBox.Show( ex.ToString() ); - } - //} - p_myForm.dataGrid1.Refresh(); - } - - private void removeTickerFrom_gridDataSet() - { - DataRow[] myRows = p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Select( "tiTicker='" + p_quTicker + "'" ); - p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Rows.Remove( myRows[ 0 ] ); - DataRow newRow = p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ].NewRow(); - newRow[ "tiTicker" ] = p_quTicker; - newRow[ "currentState" ] = "Start"; - p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Rows.Add( newRow ); - p_myForm.dataGrid1.Refresh(); - } - private void updateCurrentStatus( string newState ) - { - lock( p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ] ) - { - DataRow[] myRows = p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Select( "tiTicker='" + p_quTicker + "'" ); - myRows[ 0 ][ "currentState" ] = newState; - p_myForm.dataGrid1.Refresh(); - } - } - - private void addTickerToFaultyTickers() - { - System.Data.OleDb.OleDbCommand odc = new System.Data.OleDb.OleDbCommand(); - odc.CommandText = "insert into faultyTickers ( ftTicker , ftDateTime ) " + - "values ( '" + p_quTicker + "' , #" + - DateTime.Now.Month + "/" + - DateTime.Now.Day + "/" + - DateTime.Now.Year + " " + - DateTime.Now.Hour + "." + - DateTime.Now.Minute + "." + - DateTime.Now.Second + "# )"; - odc.Connection = this.p_myForm.oleDbConnection1; - odc.ExecuteNonQuery(); - } - private void writeFile_tickerCsv_forNextTimeFrame( DateTime currBeginDate , DateTime currEndDate ) - { - int a = currBeginDate.Month - 1; - int b = currBeginDate.Day; - int c = currBeginDate.Year; - int d = currEndDate.Month - 1; - int e = currEndDate.Day; - int f = currEndDate.Year; - int numTrials = 1; - - //updateCurrentStatus( " 1 " ); - while (numTrials < 5) - { - this.p_myForm.Refresh(); - try - { - HttpWebRequest Req = (HttpWebRequest)WebRequest.Create("http:" + "//table.finance.yahoo.com/table.csv?a=" - + a + "&b=" + b + "&c=" + c +"&d=" + d + "&e=" + e + "&f=" + f + "&s=" + p_quTicker + "&y=0&g=d&ignore=.csv"); - - Req.Method = "GET"; - Req.Timeout = 10000; - - HttpWebResponse hwr = (HttpWebResponse)Req.GetResponse(); - - //updateCurrentStatus( " 2 " ); - Stream strm = hwr.GetResponseStream(); - //updateCurrentStatus( " 3 " ); - StreamReader sr = new StreamReader(strm); - StreamWriter sw=new StreamWriter( "C:\\Documents and Settings\\Glauco\\My Documents\\Visual Studio Projects\\QuantProject\\csvFiles\\" + p_quTicker + ".csv"); - string myString = sr.ReadToEnd(); - sw.Write(myString); - sw.Close(); - sr.Close(); - strm.Close(); - import_tickerCsv_into_quotesCsv(); - updateCurrentStatus( d + "/" + e + "/" + f ); - numTrials = 6 ; - //updateCurrentStatus( " scritto file! " ); - } - catch - { - //MessageBox.Show( "Son qui" ); - updateCurrentStatus( "Tentativo: " + numTrials ); - numTrials++; - if (numTrials > 5) - addTickerToFaultyTickers(); - } - } - } - private void writeFile_tickerCsv() - { - DateTime currBeginDate = new DateTime(); - currBeginDate = startDate; - while ( currBeginDate < endDate ) - { - DateTime currEndDate = new DateTime(); - if ( DateTime.Compare( DateTime.Today , currBeginDate.AddDays( 200 ) ) < 0 ) - currEndDate = DateTime.Today; - else - currEndDate = currBeginDate.AddDays( 200 ); - writeFile_tickerCsv_forNextTimeFrame( currBeginDate , currEndDate ); - currBeginDate = currEndDate.AddDays( 1 ); - } - } - private void import_tickerCsv_into_quotesCsv() - { - string sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + - "C:\\Documents and Settings\\Glauco\\My Documents\\Visual Studio Projects\\QuantProject\\csvFiles\\" + - ";Extended Properties=\"Text;HDR=YES;FMT=Delimited\""; - - System.Data.OleDb.OleDbConnection objConn = new System.Data.OleDb.OleDbConnection(sConnectionString); - objConn.Open(); - System.Data.OleDb.OleDbCommand odCommand = new System.Data.OleDb.OleDbCommand(); - odCommand.Connection = objConn; - try - { - odCommand.CommandText = "insert into quotes.csv SELECT '" + p_quTicker + "' as Ticker, * FROM " + p_quTicker + ".csv"; - odCommand.ExecuteNonQuery(); - } - catch (Exception ex) - { - MessageBox.Show( ex.ToString() ); - } - objConn.Close(); - } - public void downloadTicker() - { - { - addTickerTo_gridDataSet(); - writeFile_tickerCsv(); - //Monitor.Pulse( p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ] ); - } - } - } public class ImportQuotesCsv { --- 370,373 ---- |
|
From: <gla...@us...> - 2003-11-20 22:38:51
|
Update of /cvsroot/quantproject/QuantDownloader In directory sc8-pr-cvs1:/tmp/cvs-serv16375 Modified Files: QuantDownloader.suo Log Message: - Added the DataBaseLocator class - The CVS step is avoided now (a DataSet approach is used); the DataBaseImporter class has been added Index: QuantDownloader.suo =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/QuantDownloader.suo,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 Binary files /tmp/cvskRSa7J and /tmp/cvsCIoFZj differ |
|
From: <gla...@us...> - 2003-11-16 17:19:30
|
Update of /cvsroot/quantproject/QuantProject In directory sc8-pr-cvs1:/tmp/cvs-serv25981 Modified Files: QuantProject.suo Log Message: The Account Report Summary object has been updated. The following have become summary row devoted object (they were delegate in the previous revision): - AnnualSystemPercentageReturn - AverageLongTradePercentageReturn - AverageShortTradePercentageReturn - AverageTradePercentageReturn - LargestLosingTradePercentage - LargestWinningTradePercentage - NumberWinningLongTrades - NumberWinningShortTrades - NumberWinningTrades - TotalNumberOfLongTrades - TotalNumberOfShortTrades Index: QuantProject.suo =================================================================== RCS file: /cvsroot/quantproject/QuantProject/QuantProject.suo,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 Binary files /tmp/cvssaLngU and /tmp/cvsyUIN5D differ |
|
From: <gla...@us...> - 2003-11-16 17:19:30
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables
In directory sc8-pr-cvs1:/tmp/cvs-serv25981/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables
Modified Files:
Summary.cs
Log Message:
The Account Report Summary object has been updated.
The following have become summary row devoted object (they were
delegate in the previous revision):
- AnnualSystemPercentageReturn
- AverageLongTradePercentageReturn
- AverageShortTradePercentageReturn
- AverageTradePercentageReturn
- LargestLosingTradePercentage
- LargestWinningTradePercentage
- NumberWinningLongTrades
- NumberWinningShortTrades
- NumberWinningTrades
- TotalNumberOfLongTrades
- TotalNumberOfShortTrades
Index: Summary.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables/Summary.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Summary.cs 13 Nov 2003 23:22:43 -0000 1.4
--- Summary.cs 16 Nov 2003 17:18:45 -0000 1.5
***************
*** 35,38 ****
--- 35,42 ----
get { return finalAccountValue; }
}
+ public double IntervalDays
+ {
+ get { return intervalDays; }
+ }
public Summary( AccountReport accountReport ) :
base( accountReport.Name + " - Summary" )
***************
*** 48,133 ****
}
#region "getSummaryTable_setRows"
! private delegate void getSummaryTable_setRow( DataRow summary );
! private void getSummaryTable_setRow_AnnualSystemPercentageReturn( DataRow summary )
! {
! double totalROA = this.totalPnl / ( this.finalAccountValue - this.totalPnl );
! summary[ "Information" ] = "Annual system % return";
! summary[ "Value" ] = ( ( Math.Pow( 1 + totalROA ,
! 1.0 / ( (double)this.intervalDays/365.0 ) ) ) - 1 ) * 100;
! // r = [(1+T)^(1/n)]-1
! }
! private void getSummaryTable_setRow_NumberWinningTrades( DataRow summary )
! {
! summary[ "Information" ] = "Number winning trades";
! DataRow[] DataRows = this.accountReport.RoundTrades.DataTable.Select( "([%Profit] > 0)" );
! summary[ "Value" ] = DataRows.Length;
! }
! private void getSummaryTable_setRow_AverageTradePercentageReturn( DataRow summary )
! {
! summary[ "Information" ] = "Average trade % Return";
! double avgReturn = (double) this.accountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "true" );
! summary[ "Value" ] = avgReturn;
! }
! private void getSummaryTable_setRow_LargestWinningTradePercentage( DataRow summary )
! {
! summary[ "Information" ] = "Largest winning trade";
! summary[ "Value" ] =
! (double) this.accountReport.RoundTrades.DataTable.Compute( "max([%Profit])" , "([%Profit]>0)" );
! }
! private void getSummaryTable_setRow_LargestLosingTradePercentage( DataRow summary )
! {
! summary[ "Information" ] = "Largest losing trade";
! summary[ "Value" ] =
! (double) this.accountReport.RoundTrades.DataTable.Compute( "min([%Profit])" , "([%Profit]<0)" );
! }
! private void getSummaryTable_setRow_TotalNumberOfLongTrades( DataRow summary )
! {
! double totalROA = this.totalPnl / ( this.finalAccountValue - this.totalPnl );
! summary[ "Information" ] = "Total # of long trades";
! DataRow[] DataRows =
! this.accountReport.RoundTrades.DataTable.Select( "((Trade='Long')and(ExitPrice is not null))" );
! summary[ "Value" ] = DataRows.Length;
! }
! private void getSummaryTable_setRow_NumberWinningLongTrades( DataRow summary )
! {
! summary[ "Information" ] = "Number winning long trades";
! DataRow[] DataRows = this.accountReport.RoundTrades.DataTable.Select( "((Trade='Long')and([%Profit] > 0))" );
! summary[ "Value" ] = DataRows.Length;
! }
! private void getSummaryTable_setRow_AverageLongTradePercentageReturn( DataRow summary )
! {
! summary[ "Information" ] = "Average long trade % Return";
! double avgReturn =
! (double) this.accountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "(Trade='Long')" );
! summary[ "Value" ] = avgReturn;
! }
! private void getSummaryTable_setRow_TotalNumberOfShortTrades( DataRow summary )
! {
! double totalROA = this.totalPnl / ( this.finalAccountValue - this.totalPnl );
! summary[ "Information" ] = "Total # of short trades";
! DataRow[] DataRows =
! this.accountReport.RoundTrades.DataTable.Select( "((Trade='Short')and(ExitPrice is not null))" );
! summary[ "Value" ] = DataRows.Length;
! }
! private void getSummaryTable_setRow_NumberWinningShortTrades( DataRow summary )
! {
! summary[ "Information" ] = "Number winning short trades";
! DataRow[] DataRows = this.accountReport.RoundTrades.DataTable.Select( "((Trade='Short')and([%Profit] > 0))" );
! summary[ "Value" ] = DataRows.Length;
! }
! private void getSummaryTable_setRow_AverageShortTradePercentageReturn( DataRow summary )
! {
! summary[ "Information" ] = "Average short trade % Return";
! double avgReturn =
! (double) this.accountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "(Trade='Short')" );
! summary[ "Value" ] = avgReturn;
! }
! private void getSummary_setRow( DataTable summaryDataTable ,
! getSummaryTable_setRow getSummaryTable_setRow_object )
! {
! DataRow summary = summaryDataTable.NewRow();
! getSummaryTable_setRow_object( summary );
! summaryDataTable.Rows.Add( summary );
! }
private void getSummary_setRow( SummaryRow summaryRow , DataTable summaryDataTable )
{
--- 52,129 ----
}
#region "getSummaryTable_setRows"
! // private delegate void getSummaryTable_setRow( DataRow summary );
! // private void getSummaryTable_setRow_NumberWinningTrades( DataRow summary )
! // {
! // summary[ "Information" ] = "Number winning trades";
! // DataRow[] DataRows = this.accountReport.RoundTrades.DataTable.Select( "([%Profit] > 0)" );
! // summary[ "Value" ] = DataRows.Length;
! // }
! // private void getSummaryTable_setRow_AverageTradePercentageReturn( DataRow summary )
! // {
! // summary[ "Information" ] = "Average trade % Return";
! // double avgReturn = (double) this.accountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "true" );
! // summary[ "Value" ] = avgReturn;
! // }
! // private void getSummaryTable_setRow_LargestWinningTradePercentage( DataRow summary )
! // {
! // summary[ "Information" ] = "Largest winning trade";
! // summary[ "Value" ] =
! // (double) this.accountReport.RoundTrades.DataTable.Compute( "max([%Profit])" , "([%Profit]>0)" );
! // }
! // private void getSummaryTable_setRow_LargestLosingTradePercentage( DataRow summary )
! // {
! // summary[ "Information" ] = "Largest losing trade";
! // summary[ "Value" ] =
! // (double) this.accountReport.RoundTrades.DataTable.Compute( "min([%Profit])" , "([%Profit]<0)" );
! // }
! // private void getSummaryTable_setRow_TotalNumberOfLongTrades( DataRow summary )
! // {
! // double totalROA = this.totalPnl / ( this.finalAccountValue - this.totalPnl );
! // summary[ "Information" ] = "Total # of long trades";
! // DataRow[] DataRows =
! // this.accountReport.RoundTrades.DataTable.Select( "((Trade='Long')and(ExitPrice is not null))" );
! // summary[ "Value" ] = DataRows.Length;
! // }
! // private void getSummaryTable_setRow_NumberWinningLongTrades( DataRow summary )
! // {
! // summary[ "Information" ] = "Number winning long trades";
! // DataRow[] DataRows = this.accountReport.RoundTrades.DataTable.Select( "((Trade='Long')and([%Profit] > 0))" );
! // summary[ "Value" ] = DataRows.Length;
! // }
! // private void getSummaryTable_setRow_AverageLongTradePercentageReturn( DataRow summary )
! // {
! // summary[ "Information" ] = "Average long trade % Return";
! // double avgReturn =
! // (double) this.accountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "(Trade='Long')" );
! // summary[ "Value" ] = avgReturn;
! // }
! // private void getSummaryTable_setRow_TotalNumberOfShortTrades( DataRow summary )
! // {
! // double totalROA = this.totalPnl / ( this.finalAccountValue - this.totalPnl );
! // summary[ "Information" ] = "Total # of short trades";
! // DataRow[] DataRows =
! // this.accountReport.RoundTrades.DataTable.Select( "((Trade='Short')and(ExitPrice is not null))" );
! // summary[ "Value" ] = DataRows.Length;
! // }
! // private void getSummaryTable_setRow_NumberWinningShortTrades( DataRow summary )
! // {
! // summary[ "Information" ] = "Number winning short trades";
! // DataRow[] DataRows = this.accountReport.RoundTrades.DataTable.Select( "((Trade='Short')and([%Profit] > 0))" );
! // summary[ "Value" ] = DataRows.Length;
! // }
! // private void getSummaryTable_setRow_AverageShortTradePercentageReturn( DataRow summary )
! // {
! // summary[ "Information" ] = "Average short trade % Return";
! // double avgReturn =
! // (double) this.accountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "(Trade='Short')" );
! // summary[ "Value" ] = avgReturn;
! // }
! // private void getSummary_setRow( DataTable summaryDataTable ,
! // getSummaryTable_setRow getSummaryTable_setRow_object )
! // {
! // DataRow summary = summaryDataTable.NewRow();
! // getSummaryTable_setRow_object( summary );
! // summaryDataTable.Rows.Add( summary );
! // }
private void getSummary_setRow( SummaryRow summaryRow , DataTable summaryDataTable )
{
***************
*** 142,169 ****
getSummary_setRow( new ReturnOnAccount( this ) , summaryDataTable );
getSummary_setRow( new BuyAndHoldPercentageReturn( this ) , summaryDataTable );
! getSummary_setRow( summaryDataTable ,
! new getSummaryTable_setRow( getSummaryTable_setRow_AnnualSystemPercentageReturn ) );
getSummary_setRow( new MaxEquityDrawDown( this ) , summaryDataTable );
getSummary_setRow( new TotalNumberOfTrades( this ) , summaryDataTable );
! getSummary_setRow( summaryDataTable ,
! new getSummaryTable_setRow( getSummaryTable_setRow_NumberWinningTrades ) );
! getSummary_setRow( summaryDataTable ,
! new getSummaryTable_setRow( getSummaryTable_setRow_AverageTradePercentageReturn ) );
! getSummary_setRow( summaryDataTable ,
! new getSummaryTable_setRow( getSummaryTable_setRow_LargestWinningTradePercentage ) );
! getSummary_setRow( summaryDataTable ,
! new getSummaryTable_setRow( getSummaryTable_setRow_LargestLosingTradePercentage ) );
! getSummary_setRow( summaryDataTable ,
! new getSummaryTable_setRow( getSummaryTable_setRow_TotalNumberOfLongTrades ) );
! getSummary_setRow( summaryDataTable ,
! new getSummaryTable_setRow( getSummaryTable_setRow_NumberWinningLongTrades ) );
! getSummary_setRow( summaryDataTable ,
! new getSummaryTable_setRow( getSummaryTable_setRow_AverageLongTradePercentageReturn ) );
! getSummary_setRow( summaryDataTable ,
! new getSummaryTable_setRow( getSummaryTable_setRow_TotalNumberOfShortTrades ) );
! getSummary_setRow( summaryDataTable ,
! new getSummaryTable_setRow( getSummaryTable_setRow_NumberWinningShortTrades ) );
! getSummary_setRow( summaryDataTable ,
! new getSummaryTable_setRow( getSummaryTable_setRow_AverageShortTradePercentageReturn ) );
}
#endregion
--- 138,159 ----
getSummary_setRow( new ReturnOnAccount( this ) , summaryDataTable );
getSummary_setRow( new BuyAndHoldPercentageReturn( this ) , summaryDataTable );
! getSummary_setRow( new AnnualSystemPercentageReturn( this ) , summaryDataTable );
getSummary_setRow( new MaxEquityDrawDown( this ) , summaryDataTable );
getSummary_setRow( new TotalNumberOfTrades( this ) , summaryDataTable );
! getSummary_setRow( new NumberWinningTrades( this ) , summaryDataTable );
! getSummary_setRow( new AverageTradePercentageReturn( this ) , summaryDataTable );
! getSummary_setRow( new LargestWinningTradePercentage( this ) , summaryDataTable );
! getSummary_setRow( new LargestLosingTradePercentage( this ) , summaryDataTable );
! getSummary_setRow( new TotalNumberOfLongTrades( this ) , summaryDataTable );
! getSummary_setRow( new NumberWinningLongTrades( this ) , summaryDataTable );
! getSummary_setRow( new AverageLongTradePercentageReturn( this ) , summaryDataTable );
! getSummary_setRow( new TotalNumberOfShortTrades( this ) , summaryDataTable );
! getSummary_setRow( new NumberWinningShortTrades( this ) , summaryDataTable );
! // getSummary_setRow( summaryDataTable ,
! // new getSummaryTable_setRow( getSummaryTable_setRow_TotalNumberOfShortTrades ) );
! // getSummary_setRow( summaryDataTable ,
! // new getSummaryTable_setRow( getSummaryTable_setRow_NumberWinningShortTrades ) );
! // getSummary_setRow( summaryDataTable ,
! // new getSummaryTable_setRow( getSummaryTable_setRow_AverageShortTradePercentageReturn ) );
}
#endregion
|
|
From: <gla...@us...> - 2003-11-16 17:19:30
|
Update of /cvsroot/quantproject/QuantProject/b4_Business
In directory sc8-pr-cvs1:/tmp/cvs-serv25981/b4_Business
Modified Files:
b4_Business.csproj
Log Message:
The Account Report Summary object has been updated.
The following have become summary row devoted object (they were
delegate in the previous revision):
- AnnualSystemPercentageReturn
- AverageLongTradePercentageReturn
- AverageShortTradePercentageReturn
- AverageTradePercentageReturn
- LargestLosingTradePercentage
- LargestWinningTradePercentage
- NumberWinningLongTrades
- NumberWinningShortTrades
- NumberWinningTrades
- TotalNumberOfLongTrades
- TotalNumberOfShortTrades
Index: b4_Business.csproj
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** b4_Business.csproj 13 Nov 2003 23:23:00 -0000 1.5
--- b4_Business.csproj 16 Nov 2003 17:18:45 -0000 1.6
***************
*** 197,200 ****
--- 197,220 ----
/>
<File
+ RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\AnnualSystemPercentageReturn.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\AverageLongTradePercentageReturn.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\AverageShortTradePercentageReturn.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\AverageTradePercentageReturn.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\BuyAndHoldPercentageReturn.cs"
SubType = "Code"
***************
*** 202,205 ****
--- 222,235 ----
/>
<File
+ RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\LargestLosingTradePercentage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\LargestWinningTradePercentage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\MaxEquityDrawDown.cs"
SubType = "Code"
***************
*** 207,210 ****
--- 237,255 ----
/>
<File
+ RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\NumberWinningLongTrades.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\NumberWinningShortTrades.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\NumberWinningTrades.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\ReturnOnAccount.cs"
SubType = "Code"
***************
*** 218,221 ****
--- 263,276 ----
<File
RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\TotalNetProfit.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\TotalNumberOfLongTrades.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\TotalNumberOfShortTrades.cs"
SubType = "Code"
BuildAction = "Compile"
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows
In directory sc8-pr-cvs1:/tmp/cvs-serv25981/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows
Added Files:
AnnualSystemPercentageReturn.cs
AverageLongTradePercentageReturn.cs
AverageShortTradePercentageReturn.cs
AverageTradePercentageReturn.cs
LargestLosingTradePercentage.cs
LargestWinningTradePercentage.cs NumberWinningLongTrades.cs
NumberWinningShortTrades.cs NumberWinningTrades.cs
TotalNumberOfLongTrades.cs TotalNumberOfShortTrades.cs
Log Message:
The Account Report Summary object has been updated.
The following have become summary row devoted object (they were
delegate in the previous revision):
- AnnualSystemPercentageReturn
- AverageLongTradePercentageReturn
- AverageShortTradePercentageReturn
- AverageTradePercentageReturn
- LargestLosingTradePercentage
- LargestWinningTradePercentage
- NumberWinningLongTrades
- NumberWinningShortTrades
- NumberWinningTrades
- TotalNumberOfLongTrades
- TotalNumberOfShortTrades
--- NEW FILE: AnnualSystemPercentageReturn.cs ---
using System;
using System.Data;
using QuantProject.ADT;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
using QuantProject.Business.Financial.Instruments;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
public class AnnualSystemPercentageReturn : SummaryRow
{
public AnnualSystemPercentageReturn( Summary summary )
{
double totalROA = summary.TotalPnl / ( summary.FinalAccountValue - summary.TotalPnl );
this.rowDescription = "Annual system % return";
this.rowValue = ( ( Math.Pow( 1 + totalROA ,
1.0 / ( (double)summary.IntervalDays/365.0 ) ) ) - 1 ) * 100;
}
}
}
--- NEW FILE: AverageLongTradePercentageReturn.cs ---
using System;
using System.Data;
using QuantProject.ADT;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
using QuantProject.Business.Financial.Instruments;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
public class AverageLongTradePercentageReturn : SummaryRow
{
public AverageLongTradePercentageReturn( Summary summary )
{
this.rowDescription = "Average long trade % Return";
double avgReturn =
(double) summary.AccountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "(Trade='Long')" );
this.rowValue = avgReturn;
}
}
}
--- NEW FILE: AverageShortTradePercentageReturn.cs ---
using System;
using System.Data;
using QuantProject.ADT;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
using QuantProject.Business.Financial.Instruments;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
public class AverageShortTradePercentageReturn : SummaryRow
{
public AverageShortTradePercentageReturn( Summary summary )
{
this.rowDescription = "Average short trade % Return";
double avgReturn =
(double) summary.AccountReport.RoundTrades.DataTable.Compute(
"avg([%Profit])" , "(Trade='Short')" );
this.rowValue = avgReturn;
}
}
}
--- NEW FILE: AverageTradePercentageReturn.cs ---
using System;
using System.Data;
using QuantProject.ADT;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
using QuantProject.Business.Financial.Instruments;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
public class AverageTradePercentageReturn : SummaryRow
{
public AverageTradePercentageReturn( Summary summary )
{
this.rowDescription = "Average trade % Return";
double avgReturn = (double) summary.AccountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "true" );
this.rowValue = avgReturn;
}
}
}
--- NEW FILE: LargestLosingTradePercentage.cs ---
using System;
using System.Data;
using QuantProject.ADT;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
using QuantProject.Business.Financial.Instruments;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
public class LargestLosingTradePercentage : SummaryRow
{
public LargestLosingTradePercentage( Summary summary )
{
this.rowDescription = "Largest losing trade";
this.rowValue =
(double) summary.AccountReport.RoundTrades.DataTable.Compute( "min([%Profit])" , "([%Profit]<0)" );
}
}
}
--- NEW FILE: LargestWinningTradePercentage.cs ---
using System;
using System.Data;
using QuantProject.ADT;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
using QuantProject.Business.Financial.Instruments;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
public class LargestWinningTradePercentage : SummaryRow
{
public LargestWinningTradePercentage( Summary summary )
{
this.rowDescription = "Largest winning trade";
this.rowValue =
(double) summary.AccountReport.RoundTrades.DataTable.Compute( "max([%Profit])" , "([%Profit]>0)" );
}
}
}
--- NEW FILE: NumberWinningLongTrades.cs ---
using System;
using System.Data;
using QuantProject.ADT;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
using QuantProject.Business.Financial.Instruments;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
public class NumberWinningLongTrades : SummaryRow
{
public NumberWinningLongTrades( Summary summary )
{
this.rowDescription = "Number winning long trades";
DataRow[] DataRows = summary.AccountReport.RoundTrades.DataTable.Select( "((Trade='Long')and([%Profit] > 0))" );
this.rowValue = DataRows.Length;
}
}
}
--- NEW FILE: NumberWinningShortTrades.cs ---
using System;
using System.Data;
using QuantProject.ADT;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
using QuantProject.Business.Financial.Instruments;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
public class NumberWinningShortTrades : SummaryRow
{
public NumberWinningShortTrades( Summary summary )
{
this.rowDescription = "Number winning short trades";
DataRow[] DataRows = summary.AccountReport.RoundTrades.DataTable.Select(
"((Trade='Short')and([%Profit] > 0))" );
this.rowValue = DataRows.Length;
}
}
}
--- NEW FILE: NumberWinningTrades.cs ---
using System;
using System.Data;
using QuantProject.ADT;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
using QuantProject.Business.Financial.Instruments;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
public class NumberWinningTrades : SummaryRow
{
public NumberWinningTrades( Summary summary )
{
this.rowDescription = "Number winning trades";
DataRow[] DataRows = summary.AccountReport.RoundTrades.DataTable.Select( "([%Profit] > 0)" );
this.rowValue = DataRows.Length;
}
}
}
--- NEW FILE: TotalNumberOfLongTrades.cs ---
using System;
using System.Data;
using QuantProject.ADT;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
using QuantProject.Business.Financial.Instruments;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
public class TotalNumberOfLongTrades : SummaryRow
{
public TotalNumberOfLongTrades( Summary summary )
{
double totalROA = summary.TotalPnl / ( summary.FinalAccountValue - summary.TotalPnl );
this.rowDescription = "Total # of long trades";
DataRow[] DataRows =
summary.AccountReport.RoundTrades.DataTable.Select( "((Trade='Long')and(ExitPrice is not null))" );
this.rowValue = DataRows.Length;
}
}
}
--- NEW FILE: TotalNumberOfShortTrades.cs ---
using System;
using System.Data;
using QuantProject.ADT;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
using QuantProject.Business.Financial.Instruments;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
public class TotalNumberOfShortTrades : SummaryRow
{
public TotalNumberOfShortTrades( Summary summary )
{
double totalROA = summary.TotalPnl / ( summary.FinalAccountValue - summary.TotalPnl );
this.rowDescription = "Total # of short trades";
DataRow[] DataRows =
summary.AccountReport.RoundTrades.DataTable.Select( "((Trade='Short')and(ExitPrice is not null))" );
this.rowValue = DataRows.Length;
}
}
}
|
|
From: <gla...@us...> - 2003-11-16 15:50:47
|
Update of /cvsroot/quantproject/QuantProject In directory sc8-pr-cvs1:/tmp/cvs-serv9785 Modified Files: QuantProject.suo Log Message: Updated the Account Report Summary object: - 'Buy and hold percentage return' now is computed by a devoted object (it was a delegate before this revision) - 'Return on account' now is computed by a devoted object (previous revision was still invoking the delegate, even if the object was already defined and committed) Index: QuantProject.suo =================================================================== RCS file: /cvsroot/quantproject/QuantProject/QuantProject.suo,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 Binary files /tmp/cvs5uAbFn and /tmp/cvswoizVA differ |
|
From: <gla...@us...> - 2003-11-13 23:23:18
|
Update of /cvsroot/quantproject/QuantProject In directory sc8-pr-cvs1:/tmp/cvs-serv13888 Modified Files: QuantProject.suo Log Message: Updated the Account Report Summary object: - 'Buy and hold percentage return' now is computed by a devoted object (it was a delegate before this revision) - 'Return on account' now is computed by a devoted object (previous revision was still invoking the delegate, even if the object was already defined and committed) Index: QuantProject.suo =================================================================== RCS file: /cvsroot/quantproject/QuantProject/QuantProject.suo,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 Binary files /tmp/cvsH5NOj1 and /tmp/cvs6Kt7fS differ |
|
From: <gla...@us...> - 2003-11-13 23:23:03
|
Update of /cvsroot/quantproject/QuantProject/b4_Business
In directory sc8-pr-cvs1:/tmp/cvs-serv13808/b4_Business
Modified Files:
b4_Business.csproj
Log Message:
Updated the Account Report Summary object:
- 'Buy and hold percentage return' now is computed by a
devoted object (it was a delegate before this revision)
- 'Return on account' now is computed by a
devoted object (previous revision was still invoking the delegate, even
if the object was already defined and committed)
Index: b4_Business.csproj
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** b4_Business.csproj 10 Nov 2003 21:45:11 -0000 1.4
--- b4_Business.csproj 13 Nov 2003 23:23:00 -0000 1.5
***************
*** 197,200 ****
--- 197,205 ----
/>
<File
+ RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\BuyAndHoldPercentageReturn.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\MaxEquityDrawDown.cs"
SubType = "Code"
|
|
From: <gla...@us...> - 2003-11-13 23:22:47
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables
In directory sc8-pr-cvs1:/tmp/cvs-serv13706/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables
Modified Files:
Summary.cs
Log Message:
Updated the Account Report Summary object:
- 'Buy and hold percentage return' now is computed by a
devoted object (it was a delegate before this revision)
- 'Return on account' now is computed by a
devoted object (previous revision was still invoking the delegate, even
if the object was already defined and committed)
Index: Summary.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables/Summary.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Summary.cs 10 Nov 2003 21:34:45 -0000 1.3
--- Summary.cs 13 Nov 2003 23:22:43 -0000 1.4
***************
*** 26,29 ****
--- 26,34 ----
get { return totalPnl; }
}
+ public double BuyAndHoldPercentageReturn
+ {
+ get { return buyAndHoldPercentageReturn; }
+ set { buyAndHoldPercentageReturn = value; }
+ }
public double FinalAccountValue
{
***************
*** 44,68 ****
#region "getSummaryTable_setRows"
private delegate void getSummaryTable_setRow( DataRow summary );
- private void getSummaryTable_setRow_ReturnOnAccount( DataRow summary )
- {
- summary[ "Information" ] = "Return on account";
- summary[ "Value" ] = this.totalPnl / ( this.finalAccountValue - this.totalPnl ) * 100;
- }
- private void getSummaryTable_setRow_BuyAndHoldPercentageReturn( DataRow summary )
- {
- if ( this.accountReport.BuyAndHoldTicker != "" )
- {
- // the report has to compare to a buy and hold benchmark
- Instrument buyAndHoldInstrument = new Instrument( this.accountReport.BuyAndHoldTicker );
- this.buyAndHoldPercentageReturn =
- ( buyAndHoldInstrument.GetMarketValue( this.accountReport.EndDateTime ) -
- buyAndHoldInstrument.GetMarketValue(
- new ExtendedDateTime( this.accountReport.StartDateTime , BarComponent.Open ) ) ) /
- buyAndHoldInstrument.GetMarketValue(
- new ExtendedDateTime( this.accountReport.StartDateTime , BarComponent.Open ) ) * 100;
- summary[ "Information" ] = "Buy & hold % return";
- summary[ "Value" ] = this.buyAndHoldPercentageReturn;
- }
- }
private void getSummaryTable_setRow_AnnualSystemPercentageReturn( DataRow summary )
{
--- 49,52 ----
***************
*** 156,163 ****
{
getSummary_setRow( new TotalNetProfit( this ) , summaryDataTable );
! getSummary_setRow( summaryDataTable ,
! new getSummaryTable_setRow( getSummaryTable_setRow_ReturnOnAccount ) );
! getSummary_setRow( summaryDataTable ,
! new getSummaryTable_setRow( getSummaryTable_setRow_BuyAndHoldPercentageReturn ) );
getSummary_setRow( summaryDataTable ,
new getSummaryTable_setRow( getSummaryTable_setRow_AnnualSystemPercentageReturn ) );
--- 140,145 ----
{
getSummary_setRow( new TotalNetProfit( this ) , summaryDataTable );
! getSummary_setRow( new ReturnOnAccount( this ) , summaryDataTable );
! getSummary_setRow( new BuyAndHoldPercentageReturn( this ) , summaryDataTable );
getSummary_setRow( summaryDataTable ,
new getSummaryTable_setRow( getSummaryTable_setRow_AnnualSystemPercentageReturn ) );
|
|
From: <gla...@us...> - 2003-11-13 23:19:51
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows
In directory sc8-pr-cvs1:/tmp/cvs-serv13106/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows
Added Files:
BuyAndHoldPercentageReturn.cs
Log Message:
Computes the buy and hold percentage return for the
account report summary object
--- NEW FILE: BuyAndHoldPercentageReturn.cs ---
using System;
using System.Data;
using QuantProject.ADT;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
using QuantProject.Business.Financial.Instruments;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
public class BuyAndHoldPercentageReturn : SummaryRow
{
public BuyAndHoldPercentageReturn( Summary summary )
{
if ( summary.AccountReport.BuyAndHoldTicker != "" )
{
// the report has to compare to a buy and hold benchmark
Instrument buyAndHoldInstrument = new Instrument( summary.AccountReport.BuyAndHoldTicker );
summary.BuyAndHoldPercentageReturn =
( buyAndHoldInstrument.GetMarketValue( summary.AccountReport.EndDateTime ) -
buyAndHoldInstrument.GetMarketValue(
new ExtendedDateTime( summary.AccountReport.StartDateTime , BarComponent.Open ) ) ) /
buyAndHoldInstrument.GetMarketValue(
new ExtendedDateTime( summary.AccountReport.StartDateTime , BarComponent.Open ) ) * 100;
this.rowDescription = "Buy & hold % return";
this.rowValue = summary.BuyAndHoldPercentageReturn;
}
}
}
}
|
|
From: <gla...@us...> - 2003-11-10 22:23:59
|
Update of /cvsroot/quantproject/QuantProject In directory sc8-pr-cvs1:/tmp/cvs-serv447 Modified Files: QuantProject.suo Log Message: no message Index: QuantProject.suo =================================================================== RCS file: /cvsroot/quantproject/QuantProject/QuantProject.suo,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 Binary files /tmp/cvsAKF4XU and /tmp/cvsAFMRyF differ |
|
From: <gla...@us...> - 2003-11-10 21:47:19
|
Update of /cvsroot/quantproject/QuantProject In directory sc8-pr-cvs1:/tmp/cvs-serv25044 Modified Files: QuantProject.suo Log Message: no message Index: QuantProject.suo =================================================================== RCS file: /cvsroot/quantproject/QuantProject/QuantProject.suo,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 Binary files /tmp/cvssYrdma and /tmp/cvsYB8hGc differ |
|
From: <gla...@us...> - 2003-11-10 21:45:14
|
Update of /cvsroot/quantproject/QuantProject/b4_Business
In directory sc8-pr-cvs1:/tmp/cvs-serv24753/b4_Business
Modified Files:
b4_Business.csproj
Log Message:
ReturnOnAccount and TotalNetProfit classes (account report
summary rows) added to the project.
Index: b4_Business.csproj
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** b4_Business.csproj 9 Nov 2003 21:12:00 -0000 1.3
--- b4_Business.csproj 10 Nov 2003 21:45:11 -0000 1.4
***************
*** 202,206 ****
--- 202,216 ----
/>
<File
+ RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\ReturnOnAccount.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\SummaryRow.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\TotalNetProfit.cs"
SubType = "Code"
BuildAction = "Compile"
|
|
From: <gla...@us...> - 2003-11-10 21:36:41
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows
In directory sc8-pr-cvs1:/tmp/cvs-serv23354/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows
Added Files:
TotalNetProfit.cs
Log Message:
Computes the total net profit for the
account report summary object
--- NEW FILE: TotalNetProfit.cs ---
using System;
using System.Data;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
public class TotalNetProfit : SummaryRow
{
public TotalNetProfit( Summary summary )
{
this.rowDescription = "Total net profit";
this.rowValue = summary.TotalPnl;
}
}
}
|
|
From: <gla...@us...> - 2003-11-10 21:35:56
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows
In directory sc8-pr-cvs1:/tmp/cvs-serv23225/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows
Added Files:
ReturnOnAccount.cs
Log Message:
Computes the return on account for the
account report summary object
--- NEW FILE: ReturnOnAccount.cs ---
using System;
using System.Data;
using QuantProject.Business.Financial.Accounting.Reporting.Tables;
namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows
{
/// <summary>
/// Summary description for TotalNumberOfTrades.
/// </summary>
public class ReturnOnAccount : SummaryRow
{
public ReturnOnAccount( Summary summary )
{
this.rowDescription = "Return on account";
this.rowValue = summary.TotalPnl / ( summary.FinalAccountValue - summary.TotalPnl ) * 100;
}
}
}
|
|
From: <gla...@us...> - 2003-11-10 21:34:49
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables
In directory sc8-pr-cvs1:/tmp/cvs-serv22894/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables
Modified Files:
Summary.cs
Log Message:
Updated the Account Report Summary object:
- 'Total net profit' now is computed by a
devoted object (it was a delegate before this revision)
- 'Return on account' now is computed by a
devoted object (it was a delegate before this revision)
Index: Summary.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables/Summary.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Summary.cs 9 Nov 2003 19:42:15 -0000 1.2
--- Summary.cs 10 Nov 2003 21:34:45 -0000 1.3
***************
*** 44,52 ****
#region "getSummaryTable_setRows"
private delegate void getSummaryTable_setRow( DataRow summary );
- private void getSummaryTable_setRow_TotalNetProfit( DataRow summary )
- {
- summary[ "Information" ] = "Total net profit";
- summary[ "Value" ] = this.totalPnl;
- }
private void getSummaryTable_setRow_ReturnOnAccount( DataRow summary )
{
--- 44,47 ----
***************
*** 160,165 ****
private void getSummaryTable_setRows( DataTable summaryDataTable )
{
! getSummary_setRow( summaryDataTable ,
! new getSummaryTable_setRow( getSummaryTable_setRow_TotalNetProfit ) );
getSummary_setRow( summaryDataTable ,
new getSummaryTable_setRow( getSummaryTable_setRow_ReturnOnAccount ) );
--- 155,159 ----
private void getSummaryTable_setRows( DataTable summaryDataTable )
{
! getSummary_setRow( new TotalNetProfit( this ) , summaryDataTable );
getSummary_setRow( summaryDataTable ,
new getSummaryTable_setRow( getSummaryTable_setRow_ReturnOnAccount ) );
|
|
From: <gla...@us...> - 2003-11-10 21:32:23
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess
In directory sc8-pr-cvs1:/tmp/cvs-serv22453/b2_DataAccess
Modified Files:
b2_DataAccess.csproj
Log Message:
Added the DataBaseLocator class to the project
Index: b2_DataAccess.csproj
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/b2_DataAccess.csproj,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** b2_DataAccess.csproj 13 Oct 2003 21:57:56 -0000 1.1.1.1
--- b2_DataAccess.csproj 10 Nov 2003 21:32:18 -0000 1.2
***************
*** 98,101 ****
--- 98,106 ----
/>
<File
+ RelPath = "DataBaseLocator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "SQLBuilder.cs"
SubType = "Code"
|
|
From: <mi...@us...> - 2003-11-10 19:08:09
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess
In directory sc8-pr-cvs1:/tmp/cvs-serv23507/b2_DataAccess
Modified Files:
DataBase.cs
Log Message:
for use of DatabaseLocator class
Index: DataBase.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/DataBase.cs,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** DataBase.cs 13 Oct 2003 21:57:59 -0000 1.1.1.1
--- DataBase.cs 10 Nov 2003 19:08:04 -0000 1.2
***************
*** 37,43 ****
public class DataBase
{
! private static string mdbPath =
! ((string)Application.CommonAppDataPath).Substring(0, Application.CommonAppDataPath.LastIndexOf('\\')) +
! @"\QuantProject.mdb";
private static string connectionString =
@"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=" +
--- 37,44 ----
public class DataBase
{
! private static DataBaseLocator dataBaseLocator = new DataBaseLocator("MDB");
! private static string mdbPath = dataBaseLocator.Path;
! //((string)Application.CommonAppDataPath).Substring(0, Application.CommonAppDataPath.LastIndexOf('\\')) +
! //@"\QuantProject.mdb";
private static string connectionString =
@"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=" +
***************
*** 49,53 ****
{
//
! // TODO: Add constructor logic here
//
}
--- 50,54 ----
{
//
!
//
}
|