[Quantproject-developers] QuantDownloader/Downloader Downloader.csproj,1.20,1.21 TickerDownloader.cs
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2004-05-22 07:05:15
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21046/Downloader Modified Files: Downloader.csproj TickerDownloader.cs WebDownloader.cs Log Message: Ticker downloader now checks the close to close ratios for the tickers with new adjusted values. If the adjusted close has been changed, the database is not updated. Instead, the first date with a different ratio is displayed. Index: WebDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/WebDownloader.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** WebDownloader.cs 11 May 2004 22:06:40 -0000 1.12 --- WebDownloader.cs 22 May 2004 07:04:59 -0000 1.13 *************** *** 162,168 **** this.dataGrid1.DataMember = ""; this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText; ! this.dataGrid1.Location = new System.Drawing.Point(328, 8); this.dataGrid1.Name = "dataGrid1"; ! this.dataGrid1.Size = new System.Drawing.Size(432, 456); this.dataGrid1.TabIndex = 1; // --- 162,168 ---- this.dataGrid1.DataMember = ""; this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText; ! this.dataGrid1.Location = new System.Drawing.Point(304, 8); this.dataGrid1.Name = "dataGrid1"; ! this.dataGrid1.Size = new System.Drawing.Size(528, 456); this.dataGrid1.TabIndex = 1; // *************** *** 308,312 **** this.groupBoxWebDownloaderOptions.Location = new System.Drawing.Point(8, 8); this.groupBoxWebDownloaderOptions.Name = "groupBoxWebDownloaderOptions"; ! this.groupBoxWebDownloaderOptions.Size = new System.Drawing.Size(312, 88); this.groupBoxWebDownloaderOptions.TabIndex = 13; this.groupBoxWebDownloaderOptions.TabStop = false; --- 308,312 ---- this.groupBoxWebDownloaderOptions.Location = new System.Drawing.Point(8, 8); this.groupBoxWebDownloaderOptions.Name = "groupBoxWebDownloaderOptions"; ! this.groupBoxWebDownloaderOptions.Size = new System.Drawing.Size(288, 88); this.groupBoxWebDownloaderOptions.TabIndex = 13; this.groupBoxWebDownloaderOptions.TabStop = false; *************** *** 332,336 **** this.groupBoxUpdateDatabaseOptions.Location = new System.Drawing.Point(8, 136); this.groupBoxUpdateDatabaseOptions.Name = "groupBoxUpdateDatabaseOptions"; ! this.groupBoxUpdateDatabaseOptions.Size = new System.Drawing.Size(312, 176); this.groupBoxUpdateDatabaseOptions.TabIndex = 14; this.groupBoxUpdateDatabaseOptions.TabStop = false; --- 332,336 ---- this.groupBoxUpdateDatabaseOptions.Location = new System.Drawing.Point(8, 136); this.groupBoxUpdateDatabaseOptions.Name = "groupBoxUpdateDatabaseOptions"; ! this.groupBoxUpdateDatabaseOptions.Size = new System.Drawing.Size(288, 176); this.groupBoxUpdateDatabaseOptions.TabIndex = 14; this.groupBoxUpdateDatabaseOptions.TabStop = false; *************** *** 342,346 **** this.radioButtonDownloadOnlyAfterMax.Location = new System.Drawing.Point(16, 24); this.radioButtonDownloadOnlyAfterMax.Name = "radioButtonDownloadOnlyAfterMax"; ! this.radioButtonDownloadOnlyAfterMax.Size = new System.Drawing.Size(288, 24); this.radioButtonDownloadOnlyAfterMax.TabIndex = 3; this.radioButtonDownloadOnlyAfterMax.TabStop = true; --- 342,346 ---- this.radioButtonDownloadOnlyAfterMax.Location = new System.Drawing.Point(16, 24); this.radioButtonDownloadOnlyAfterMax.Name = "radioButtonDownloadOnlyAfterMax"; ! this.radioButtonDownloadOnlyAfterMax.Size = new System.Drawing.Size(256, 24); this.radioButtonDownloadOnlyAfterMax.TabIndex = 3; this.radioButtonDownloadOnlyAfterMax.TabStop = true; *************** *** 351,355 **** this.radioButtonDownloadBeforeMinAndAfterMax.Location = new System.Drawing.Point(16, 56); this.radioButtonDownloadBeforeMinAndAfterMax.Name = "radioButtonDownloadBeforeMinAndAfterMax"; ! this.radioButtonDownloadBeforeMinAndAfterMax.Size = new System.Drawing.Size(288, 32); this.radioButtonDownloadBeforeMinAndAfterMax.TabIndex = 2; this.radioButtonDownloadBeforeMinAndAfterMax.Text = "Download only quotes before first quote and after last quote"; --- 351,355 ---- this.radioButtonDownloadBeforeMinAndAfterMax.Location = new System.Drawing.Point(16, 56); this.radioButtonDownloadBeforeMinAndAfterMax.Name = "radioButtonDownloadBeforeMinAndAfterMax"; ! this.radioButtonDownloadBeforeMinAndAfterMax.Size = new System.Drawing.Size(256, 32); this.radioButtonDownloadBeforeMinAndAfterMax.TabIndex = 2; this.radioButtonDownloadBeforeMinAndAfterMax.Text = "Download only quotes before first quote and after last quote"; *************** *** 359,363 **** this.radioButtonOverWriteNo.Location = new System.Drawing.Point(16, 96); this.radioButtonOverWriteNo.Name = "radioButtonOverWriteNo"; ! this.radioButtonOverWriteNo.Size = new System.Drawing.Size(288, 32); this.radioButtonOverWriteNo.TabIndex = 1; this.radioButtonOverWriteNo.Text = "Download all quotes, adding to database only the missing ones"; --- 359,363 ---- this.radioButtonOverWriteNo.Location = new System.Drawing.Point(16, 96); this.radioButtonOverWriteNo.Name = "radioButtonOverWriteNo"; ! this.radioButtonOverWriteNo.Size = new System.Drawing.Size(256, 32); this.radioButtonOverWriteNo.TabIndex = 1; this.radioButtonOverWriteNo.Text = "Download all quotes, adding to database only the missing ones"; *************** *** 367,371 **** this.radioButtonOverWriteYes.Location = new System.Drawing.Point(16, 136); this.radioButtonOverWriteYes.Name = "radioButtonOverWriteYes"; ! this.radioButtonOverWriteYes.Size = new System.Drawing.Size(288, 32); this.radioButtonOverWriteYes.TabIndex = 0; this.radioButtonOverWriteYes.Text = "Download all quotes, deleting all existing ones in database"; --- 367,371 ---- this.radioButtonOverWriteYes.Location = new System.Drawing.Point(16, 136); this.radioButtonOverWriteYes.Name = "radioButtonOverWriteYes"; ! this.radioButtonOverWriteYes.Size = new System.Drawing.Size(256, 32); this.radioButtonOverWriteYes.TabIndex = 0; this.radioButtonOverWriteYes.Text = "Download all quotes, deleting all existing ones in database"; *************** *** 374,378 **** // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(768, 470); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.groupBoxUpdateDatabaseOptions, --- 374,378 ---- // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(840, 470); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.groupBoxUpdateDatabaseOptions, *************** *** 616,620 **** try { - Cursor.Current = Cursors.WaitCursor; if (this.OleDbConnection1.State != ConnectionState.Open) this.OleDbConnection1.Open(); --- 616,619 ---- *************** *** 633,637 **** { this.OleDbConnection1.Close(); - Cursor.Current = Cursors.Default; } --- 632,635 ---- *************** *** 641,654 **** private void button1_Click(object sender, System.EventArgs e) { ! this.openDbAndSetOleDbCommand(); this.downloadQuotesOfAllTickers(); this.button1.Enabled = false; } private void buttonDownloadQuotesOfSelectedTickers_Click(object sender, System.EventArgs e) { ! this.openDbAndSetOleDbCommand(); this.downloadQuotesOfSelectedTickers(); this.buttonDownloadQuotesOfSelectedTickers.Enabled = false; } --- 639,657 ---- private void button1_Click(object sender, System.EventArgs e) { ! Cursor.Current = Cursors.WaitCursor; ! this.openDbAndSetOleDbCommand(); this.downloadQuotesOfAllTickers(); this.button1.Enabled = false; + Cursor.Current = Cursors.Default; + } private void buttonDownloadQuotesOfSelectedTickers_Click(object sender, System.EventArgs e) { ! Cursor.Current = Cursors.WaitCursor; ! this.openDbAndSetOleDbCommand(); this.downloadQuotesOfSelectedTickers(); this.buttonDownloadQuotesOfSelectedTickers.Enabled = false; + Cursor.Current = Cursors.Default; } *************** *** 668,671 **** --- 671,675 ---- { // this is just used for testing code + //QuantProject.DataAccess.Tables.Quotes.ComputeAndCommitCloseToCloseRatios("ACE.MI"); Index: TickerDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerDownloader.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TickerDownloader.cs 11 May 2004 22:06:40 -0000 1.5 --- TickerDownloader.cs 22 May 2004 07:04:59 -0000 1.6 *************** *** 40,43 **** --- 40,44 ---- this.adapter = new OleDbSingleTableAdapter("SELECT * FROM quotes WHERE 1=2", this.downloadedValuesFromSource); + this.downloadedValuesFromSource.Columns[Quotes.AdjustedCloseToCloseRatio].DefaultValue = 0; } *************** *** 53,57 **** p_myForm.dataGrid1.Refresh(); } ! */ private void updateCurrentStatus( string newState ) { --- 54,60 ---- p_myForm.dataGrid1.Refresh(); } ! */ ! ! #region Update Status private void updateCurrentStatus( string newState ) { *************** *** 93,96 **** --- 96,102 ---- } } + + #endregion + private void addTickerToFaultyTickers() { *************** *** 108,112 **** } ! private void addNewAdjustedValueInTable( StreamReader streamReader, DataTable tableToWhichValuesHaveToBeAdded ) --- 114,118 ---- } ! /* private void addNewAdjustedValueInTable( StreamReader streamReader, DataTable tableToWhichValuesHaveToBeAdded ) *************** *** 125,128 **** --- 131,135 ---- row[0] = DateTime.Parse( LineIn[0] ); row[1] = Double.Parse(LineIn[6]); + row[2] = 0; tableToWhichValuesHaveToBeAdded.Rows.Add(row); *************** *** 130,136 **** } } ! private DataTable getTableOfNewAdjustedValues( DateTime currBeginDate , DateTime currEndDate ) { int a = currBeginDate.Month - 1; int b = currBeginDate.Day; --- 137,147 ---- } } ! */ ! ! /* private DataTable getTableOfNewAdjustedValues( DateTime currBeginDate , DateTime currEndDate ) { + + int a = currBeginDate.Month - 1; int b = currBeginDate.Day; *************** *** 140,147 **** int f = currEndDate.Year; DataTable table = new DataTable(); ! DataColumn date = new DataColumn("quDate", System.Type.GetType("System.DateTime")); ! DataColumn adjustedValue = new DataColumn("quAdjustedClose", System.Type.GetType("System.Double")); ! table.Columns.Add(date); ! table.Columns.Add(adjustedValue); try { --- 151,157 ---- int f = currEndDate.Year; DataTable table = new DataTable(); ! table.Columns.Add("quDate", System.Type.GetType("System.DateTime")); ! table.Columns.Add("quAdjustedClose", System.Type.GetType("System.Double")); ! table.Columns.Add("quAdjustedCloseToCloseRatio", System.Type.GetType("System.Double")); try { *************** *** 163,168 **** } return table; } ! private void addValuesToTable( StreamReader streamReader ) { --- 173,182 ---- } return table; + } ! */ ! /// <summary> ! /// Adds rows to the table (member of the object) containing the downloaded values ! /// </summary> private void addValuesToTable( StreamReader streamReader ) { *************** *** 240,247 **** } private DataTable getTableOfDownloadedValues() { double numDaysOfTimeFrame = ConstantsProvider.MaxNumDaysDownloadedAtEachConnection; ! DateTime currBeginDate = new DateTime(); currBeginDate = startDate; --- 254,264 ---- } + + private DataTable getTableOfDownloadedValues() { double numDaysOfTimeFrame = ConstantsProvider.MaxNumDaysDownloadedAtEachConnection; ! this.downloadedValuesFromSource.Rows.Clear(); ! this.downloadedValuesFromSource.AcceptChanges(); DateTime currBeginDate = new DateTime(); currBeginDate = startDate; *************** *** 260,263 **** --- 277,287 ---- } + private DataTable getTableOfDownloadedValues(DateTime newStartDate, DateTime newEndDate) + { + this.startDate = newStartDate; + this.endDate = newEndDate; + return this.getTableOfDownloadedValues(); + } + private void addTickerTo_gridDataSet() { *************** *** 316,323 **** this.updateCurrentStatusAdjustedClose("Changed!"); if (Quotes.IsAdjustedCloseToCloseRatioChanged(this.p_quTicker, ! this.getTableOfNewAdjustedValues(Quotes.GetStartDate(this.p_quTicker), Quotes.GetEndDate(this.p_quTicker)))) { ! this.updateCurrentStatusAdjustedCloseToCloseRatio("Changed!"); } else --- 340,348 ---- this.updateCurrentStatusAdjustedClose("Changed!"); if (Quotes.IsAdjustedCloseToCloseRatioChanged(this.p_quTicker, ! this.getTableOfDownloadedValues(Quotes.GetStartDate(this.p_quTicker), Quotes.GetEndDate(this.p_quTicker)))) { ! this.updateCurrentStatusAdjustedCloseToCloseRatio("Changed at " + ! Quotes.DateWithDifferentCloseToClose); } else *************** *** 330,333 **** --- 355,359 ---- { this.updateCurrentStatusAdjustedClose("OK"); + this.downloadedValuesFromSource = this.getTableOfDownloadedValues(); this.commitDownloadedValuesToDatabase(); } *************** *** 364,371 **** private void commitDownloadedValuesToDatabase() { - Quotes.ComputeCloseToCloseValues(this.downloadedValuesFromSource); - this.adapter.OleDbDataAdapter.ContinueUpdateOnError = true; if(this.p_myForm.IsOverWriteYesSelected) Quotes.Delete(this.p_quTicker); this.adapter.OleDbDataAdapter.Update(this.downloadedValuesFromSource); this.updateCurrentStatusDatabaseUpdated("YES"); --- 390,397 ---- private void commitDownloadedValuesToDatabase() { if(this.p_myForm.IsOverWriteYesSelected) Quotes.Delete(this.p_quTicker); + QuantProject.DataAccess.Tables.Quotes.ComputeCloseToCloseValues(this.downloadedValuesFromSource); + this.adapter.OleDbDataAdapter.ContinueUpdateOnError = true; this.adapter.OleDbDataAdapter.Update(this.downloadedValuesFromSource); this.updateCurrentStatusDatabaseUpdated("YES"); *************** *** 375,378 **** --- 401,405 ---- { this.resetStartDateIfNecessary(); + this.downloadedValuesFromSource = this.getTableOfDownloadedValues(); this.commitDownloadedValuesToDatabase(); } *************** *** 383,387 **** { // update grid in webdownloader form - this.downloadedValuesFromSource.Rows.Clear(); addTickerTo_gridDataSet(); this.numberOfQuotesInDatabase = Quotes.GetNumberOfQuotes(this.p_quTicker); --- 410,413 ---- *************** *** 415,419 **** this.resetAndImportTicker(); } - // ticker's quotes are downloaded for the first time or // the user has chosen to download all quotes --- 441,444 ---- Index: Downloader.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/Downloader.csproj,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Downloader.csproj 9 May 2004 16:35:13 -0000 1.20 --- Downloader.csproj 22 May 2004 07:04:59 -0000 1.21 *************** *** 247,251 **** <File RelPath = "QuotesEditor\VisualValidationChart.cs" ! SubType = "UserControl" BuildAction = "Compile" /> --- 247,251 ---- <File RelPath = "QuotesEditor\VisualValidationChart.cs" ! SubType = "Code" BuildAction = "Compile" /> *************** *** 262,266 **** <File RelPath = "QuotesEditor\CloseToClose\CloseToCloseChart.cs" ! SubType = "UserControl" BuildAction = "Compile" /> --- 262,266 ---- <File RelPath = "QuotesEditor\CloseToClose\CloseToCloseChart.cs" ! SubType = "Code" BuildAction = "Compile" /> *************** *** 297,301 **** <File RelPath = "QuotesEditor\RangeToRange\RangeToRangeChart.cs" ! SubType = "UserControl" BuildAction = "Compile" /> --- 297,301 ---- <File RelPath = "QuotesEditor\RangeToRange\RangeToRangeChart.cs" ! SubType = "Code" BuildAction = "Compile" /> |