quantproject-developers Mailing List for QuantProject (Page 135)
Brought to you by:
glauco_1
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
(103) |
Dec
(67) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(52) |
Feb
(9) |
Mar
(69) |
Apr
(53) |
May
(80) |
Jun
(23) |
Jul
(24) |
Aug
(112) |
Sep
(9) |
Oct
|
Nov
(58) |
Dec
(93) |
| 2005 |
Jan
(90) |
Feb
(93) |
Mar
(61) |
Apr
(56) |
May
(37) |
Jun
(61) |
Jul
(55) |
Aug
(68) |
Sep
(25) |
Oct
(46) |
Nov
(41) |
Dec
(37) |
| 2006 |
Jan
(33) |
Feb
(7) |
Mar
(19) |
Apr
(27) |
May
(73) |
Jun
(49) |
Jul
(83) |
Aug
(66) |
Sep
(45) |
Oct
(16) |
Nov
(15) |
Dec
(7) |
| 2007 |
Jan
(14) |
Feb
(33) |
Mar
|
Apr
(21) |
May
|
Jun
(34) |
Jul
(18) |
Aug
(100) |
Sep
(39) |
Oct
(55) |
Nov
(12) |
Dec
(2) |
| 2008 |
Jan
(120) |
Feb
(133) |
Mar
(129) |
Apr
(104) |
May
(42) |
Jun
(2) |
Jul
(52) |
Aug
(99) |
Sep
(134) |
Oct
|
Nov
(137) |
Dec
(48) |
| 2009 |
Jan
(48) |
Feb
(55) |
Mar
(61) |
Apr
(3) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(51) |
Sep
|
Oct
(7) |
Nov
|
Dec
|
| 2010 |
Jan
(7) |
Feb
(1) |
Mar
(145) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(8) |
Dec
|
| 2011 |
Jan
(78) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(88) |
Sep
(6) |
Oct
(1) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:44:54
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22430/Downloader Modified Files: Downloader.csproj Log Message: Minor automatic changes to the project file Index: Downloader.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/Downloader.csproj,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Downloader.csproj 22 May 2004 07:04:59 -0000 1.21 --- Downloader.csproj 26 May 2004 15:44:29 -0000 1.22 *************** *** 247,251 **** <File RelPath = "QuotesEditor\VisualValidationChart.cs" ! SubType = "Code" BuildAction = "Compile" /> --- 247,251 ---- <File RelPath = "QuotesEditor\VisualValidationChart.cs" ! SubType = "UserControl" BuildAction = "Compile" /> *************** *** 262,266 **** <File RelPath = "QuotesEditor\CloseToClose\CloseToCloseChart.cs" ! SubType = "Code" BuildAction = "Compile" /> --- 262,266 ---- <File RelPath = "QuotesEditor\CloseToClose\CloseToCloseChart.cs" ! SubType = "UserControl" BuildAction = "Compile" /> *************** *** 297,301 **** <File RelPath = "QuotesEditor\RangeToRange\RangeToRangeChart.cs" ! SubType = "Code" BuildAction = "Compile" /> --- 297,301 ---- <File RelPath = "QuotesEditor\RangeToRange\RangeToRangeChart.cs" ! SubType = "UserControl" BuildAction = "Compile" /> |
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:42:47
|
Update of /cvsroot/quantproject/QuantDownloader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22011 Modified Files: QuantDownloader.suo Log Message: Now many features are got from the Data.DataTables namespace (they were provided by the DataAccess.Tables namespace) Index: QuantDownloader.suo =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/QuantDownloader.suo,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 Binary files /tmp/cvs3gz2I3 and /tmp/cvsaQKW9y differ |
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:42:28
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21916/Downloader Modified Files: TickerDownloader.cs Log Message: Now many features are got from the Data.DataTables namespace (they were provided by the DataAccess.Tables namespace) Index: TickerDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerDownloader.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TickerDownloader.cs 22 May 2004 07:04:59 -0000 1.6 --- TickerDownloader.cs 26 May 2004 15:42:09 -0000 1.7 *************** *** 321,325 **** { bool response = false; ! Quotes tickerQuotes = new Quotes(this.p_quTicker); for(int i = 1; i< this.numberOfQuotesInDatabase; i += this.numberOfQuotesInDatabase/numberOfRepeatedChecks) { --- 321,326 ---- { bool response = false; ! QuantProject.Data.DataTables.Quotes tickerQuotes = ! new QuantProject.Data.DataTables.Quotes(this.p_quTicker); for(int i = 1; i< this.numberOfQuotesInDatabase; i += this.numberOfQuotesInDatabase/numberOfRepeatedChecks) { |
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:42:28
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/QuotesEditor/CloseToClose In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21916/Downloader/QuotesEditor/CloseToClose Modified Files: CloseToCloseDataGrid.cs Log Message: Now many features are got from the Data.DataTables namespace (they were provided by the DataAccess.Tables namespace) Index: CloseToCloseDataGrid.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/QuotesEditor/CloseToClose/CloseToCloseDataGrid.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CloseToCloseDataGrid.cs 9 May 2004 16:31:19 -0000 1.5 --- CloseToCloseDataGrid.cs 26 May 2004 15:42:09 -0000 1.6 *************** *** 24,28 **** using System.Data; using System.Windows.Forms; ! using QuantProject.DataAccess.Tables; using QuantProject.Business.Validation; --- 24,28 ---- using System.Data; using System.Windows.Forms; ! using QuantProject.Data.DataTables; using QuantProject.Business.Validation; |
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:42:28
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/QuotesEditor/RangeToRange In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21916/Downloader/QuotesEditor/RangeToRange Modified Files: RangeToRangeDataGrid.cs Log Message: Now many features are got from the Data.DataTables namespace (they were provided by the DataAccess.Tables namespace) Index: RangeToRangeDataGrid.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/QuotesEditor/RangeToRange/RangeToRangeDataGrid.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RangeToRangeDataGrid.cs 8 May 2004 17:29:38 -0000 1.4 --- RangeToRangeDataGrid.cs 26 May 2004 15:42:09 -0000 1.5 *************** *** 1,5 **** using System; using QuantProject.Business.Validation; ! using QuantProject.DataAccess.Tables; namespace QuantProject.Applications.Downloader --- 1,5 ---- using System; using QuantProject.Business.Validation; ! using QuantProject.Data.DataTables; namespace QuantProject.Applications.Downloader |
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:39:00
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21114/b2_DataAccess Modified Files: OleDbSingleTableAdapter.cs Log Message: The constructor has been overloaded and the SetAdapter method has been added. Index: OleDbSingleTableAdapter.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/OleDbSingleTableAdapter.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OleDbSingleTableAdapter.cs 11 May 2004 21:59:10 -0000 1.2 --- OleDbSingleTableAdapter.cs 26 May 2004 15:38:50 -0000 1.3 *************** *** 1,2 **** --- 1,24 ---- + /* + QuantProject - Quantitative Finance Library + + OleDbSingleTableAdapter.cs + Copyright (C) 2003 + Glauco Siliprandi + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + using System; using System.Data; *************** *** 28,38 **** get { return this.dataTable; } } ! ! public OleDbSingleTableAdapter( string selectStatement ) { try { - // string selectStatement = - // "select * from " + tableName + " where 1=2"; this.oleDbDataAdapter = new OleDbDataAdapter( selectStatement , ConnectionProvider.OleDbConnection ); --- 50,58 ---- get { return this.dataTable; } } ! ! private void setAdapter( string selectStatement ) { try { this.oleDbDataAdapter = new OleDbDataAdapter( selectStatement , ConnectionProvider.OleDbConnection ); *************** *** 41,45 **** this.oleDbDataAdapter.UpdateCommand = oleDbCommandBuilder.GetUpdateCommand(); this.oleDbDataAdapter.DeleteCommand = oleDbCommandBuilder.GetDeleteCommand(); - this.dataTable = new DataTable(); this.oleDbDataAdapter.Fill( this.dataTable ); } --- 61,64 ---- *************** *** 50,81 **** } } public OleDbSingleTableAdapter(string selectStatement, DataTable table ) { ! try ! { ! ! // string selectStatement = ! // "select * from " + tableName + " where 1=2"; ! this.oleDbDataAdapter = ! new OleDbDataAdapter( selectStatement , ConnectionProvider.OleDbConnection ); ! OleDbCommandBuilder oleDbCommandBuilder = new OleDbCommandBuilder( oleDbDataAdapter ); ! this.oleDbDataAdapter.InsertCommand = oleDbCommandBuilder.GetInsertCommand(); ! this.oleDbDataAdapter.UpdateCommand = oleDbCommandBuilder.GetUpdateCommand(); ! this.oleDbDataAdapter.DeleteCommand = oleDbCommandBuilder.GetDeleteCommand(); ! this.dataTable = table; ! this.oleDbDataAdapter.Fill( this.dataTable ); ! } ! catch ( Exception ex ) ! { ! string exceptionMessage = ex.Message + "\n" + ex.StackTrace; ! Console.WriteLine( exceptionMessage ); ! } } ! // public void SetAdapterAndDataTable( string tableName ) ! // { ! // } } } --- 69,95 ---- } } + + public OleDbSingleTableAdapter( string selectStatement ) + { + this.dataTable = new DataTable(); + setAdapter( selectStatement ); + } public OleDbSingleTableAdapter(string selectStatement, DataTable table ) { ! this.dataTable = table; ! setAdapter( selectStatement ); } + public OleDbSingleTableAdapter() + { + } ! public void SetAdapter( string tableName ) ! { ! string selectStatement = ! "select * from " + tableName + " where 1=2"; ! setAdapter( selectStatement ); ! } } } |
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:36:24
|
Update of /cvsroot/quantproject/QuantProject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20684 Modified Files: QuantProject.suo Log Message: Many features have been moved from the DataAccess.Tables namespace to the Data.DataTables namespace Index: QuantProject.suo =================================================================== RCS file: /cvsroot/quantproject/QuantProject/QuantProject.suo,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 Binary files /tmp/cvsdP5t1g and /tmp/cvsnmOXY3 differ |
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:36:04
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20593/b2_DataAccess/Tables Modified Files: VisuallyValidatedQuotes.cs Log Message: Many features have been moved from the DataAccess.Tables namespace to the Data.DataTables namespace Index: VisuallyValidatedQuotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/VisuallyValidatedQuotes.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** VisuallyValidatedQuotes.cs 9 May 2004 16:25:57 -0000 1.3 --- VisuallyValidatedQuotes.cs 26 May 2004 15:35:53 -0000 1.4 *************** *** 24,92 **** // } ! /// <summary> ! /// Returns the hash value to be stored/read into/from the visuallyValidatedQuotes table ! /// </summary> ! /// <param name="quoteDate">Date whose neighborhood quotes are to be hashed</param> ! /// <returns></returns> ! private static string getHashValue( Quotes quotes , DateTime quoteDate ) ! { ! return quotes.GetHashValue( ! quotes.GetPrecedingDate( quoteDate , ConstantsProvider.PrecedingDaysForVisualValidation ) , ! quotes.GetFollowingDate( quoteDate , ConstantsProvider.PrecedingDaysForVisualValidation ) ); ! } ! ! private static void validate( Quotes quotes , DateTime quoteDate , ValidationTypes validationType ) ! { ! try ! { ! SqlExecutor.ExecuteNonQuery( ! "delete * from visuallyValidatedQuotes where " + ! "vvTicker='" + quotes.Ticker + "' and " + ! "vvDate=" + SQLBuilder.GetDateConstant( quoteDate ) ); ! OleDbSingleTableAdapter oleDbSingleTableAdapter = ! new OleDbSingleTableAdapter( ! "select * from visuallyValidatedQuotes where 1=2" ); ! string hashValue = getHashValue( quotes , quoteDate ); ! oleDbSingleTableAdapter.DataTable.Rows.Add( oleDbSingleTableAdapter.DataTable.NewRow() ); ! oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.Ticker ] = quotes.Ticker; ! oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.Date ] = quoteDate; ! oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.ValidationType ] = ! validationType; ! oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.HashValue ] = hashValue; ! oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.EditDate ] = DateTime.Now; ! oleDbSingleTableAdapter.OleDbDataAdapter.Update( oleDbSingleTableAdapter.DataTable ); ! } ! catch ( Exception ex ) ! { ! string exceptionMessage = ex.Message + "\n" + ex.StackTrace; ! Console.WriteLine( exceptionMessage ); ! } ! } ! ! /// <summary> ! /// writes to the database the visual validation of the Close to Close suspicious ratios ! /// </summary> ! /// <param name="quotes">contains all the quotes for the ticker to be validated</param> ! /// <param name="quoteDate">date to be validated</param> ! public static void ValidateCloseToClose( Quotes quotes , DateTime quoteDate ) ! { ! validate( quotes , quoteDate , ValidationTypes.CloseToCloseRatio ); ! } ! ! /// <summary> ! /// writes to the database the visual validation of the Range to Range suspicious ratios ! /// </summary> ! /// <param name="quotes">contains all the quotes for the ticker to be validated</param> ! /// <param name="quoteDate">date to be validated</param> ! public static void ValidateRangeToRange( Quotes quotes , DateTime quoteDate ) ! { ! validate( quotes , quoteDate , ValidationTypes.RangeToRangeRatio ); ! } ! private static ArrayList getVisuallyValidatedArrayList( string ticker , ValidationTypes validationType ) { - ArrayList tickers = new ArrayList(); - Quotes quotes = new Quotes( ticker ); DataTable validatedQuotes = SqlExecutor.GetDataTable( "select * from visuallyValidatedQuotes " + --- 24,90 ---- // } ! // /// <summary> ! // /// Returns the hash value to be stored/read into/from the visuallyValidatedQuotes table ! // /// </summary> ! // /// <param name="quoteDate">Date whose neighborhood quotes are to be hashed</param> ! // /// <returns></returns> ! // private static string getHashValue( Quotes quotes , DateTime quoteDate ) ! // { ! // return quotes.GetHashValue( ! // quotes.GetPrecedingDate( quoteDate , ConstantsProvider.PrecedingDaysForVisualValidation ) , ! // quotes.GetFollowingDate( quoteDate , ConstantsProvider.PrecedingDaysForVisualValidation ) ); ! // } ! // ! // private static void validate( Quotes quotes , DateTime quoteDate , ValidationTypes validationType ) ! // { ! // try ! // { ! // SqlExecutor.ExecuteNonQuery( ! // "delete * from visuallyValidatedQuotes where " + ! // "vvTicker='" + quotes.Ticker + "' and " + ! // "vvDate=" + SQLBuilder.GetDateConstant( quoteDate ) ); ! // OleDbSingleTableAdapter oleDbSingleTableAdapter = ! // new OleDbSingleTableAdapter( ! // "select * from visuallyValidatedQuotes where 1=2" ); ! // string hashValue = getHashValue( quotes , quoteDate ); ! // oleDbSingleTableAdapter.DataTable.Rows.Add( oleDbSingleTableAdapter.DataTable.NewRow() ); ! // oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.Ticker ] = quotes.Ticker; ! // oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.Date ] = quoteDate; ! // oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.ValidationType ] = ! // validationType; ! // oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.HashValue ] = hashValue; ! // oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.EditDate ] = DateTime.Now; ! // oleDbSingleTableAdapter.OleDbDataAdapter.Update( oleDbSingleTableAdapter.DataTable ); ! // } ! // catch ( Exception ex ) ! // { ! // string exceptionMessage = ex.Message + "\n" + ex.StackTrace; ! // Console.WriteLine( exceptionMessage ); ! // } ! // } ! // ! // /// <summary> ! // /// writes to the database the visual validation of the Close to Close suspicious ratios ! // /// </summary> ! // /// <param name="quotes">contains all the quotes for the ticker to be validated</param> ! // /// <param name="quoteDate">date to be validated</param> ! // public static void ValidateCloseToClose( Quotes quotes , DateTime quoteDate ) ! // { ! // validate( quotes , quoteDate , ValidationTypes.CloseToCloseRatio ); ! // } ! // ! // /// <summary> ! // /// writes to the database the visual validation of the Range to Range suspicious ratios ! // /// </summary> ! // /// <param name="quotes">contains all the quotes for the ticker to be validated</param> ! // /// <param name="quoteDate">date to be validated</param> ! // public static void ValidateRangeToRange( Quotes quotes , DateTime quoteDate ) ! // { ! // validate( quotes , quoteDate , ValidationTypes.RangeToRangeRatio ); ! // } ! public static DataTable GetValidatedQuotes( string ticker , ValidationTypes validationType ) { DataTable validatedQuotes = SqlExecutor.GetDataTable( "select * from visuallyValidatedQuotes " + *************** *** 94,124 **** "and " + VisuallyValidatedQuotes.ValidationType + "=" + System.Convert.ToInt32( validationType ) ); ! foreach ( DataRow dataRow in validatedQuotes.Rows ) ! if ( (string)dataRow[ "vvHashValue" ] == getHashValue( quotes , (DateTime)dataRow[ "vvDate" ] ) ) ! // the current quote date had been visually validated with respect to the neighborhood quotes ! tickers.Add( dataRow[ "vvDate" ] ); ! /// TO DO !!! add else branch to raise event 'broken hash value' ! return tickers; ! } ! /// <summary> ! /// Returns the list of visually validated quote dates for the given ticker, ! /// with respect to the Close To Close ratio ! /// </summary> ! /// <param name="ticker">Instrument ticker whose validated quote dates are to be found</param> ! /// <returns></returns> ! public static ArrayList GetCloseToCloseValidated( string ticker ) ! { ! return getVisuallyValidatedArrayList( ticker , ValidationTypes.CloseToCloseRatio ); ! } ! /// <summary> ! /// Returns the list of visually validated quote dates for the given ticker, ! /// with respect to the Range To Range ratio ! /// </summary> ! /// <param name="ticker">Instrument ticker whose validated quote dates are to be found</param> ! /// <returns></returns> ! public static ArrayList GetRangeToRangeValidated( string ticker ) ! { ! return getVisuallyValidatedArrayList( ticker , ValidationTypes.RangeToRangeRatio ); } } } --- 92,119 ---- "and " + VisuallyValidatedQuotes.ValidationType + "=" + System.Convert.ToInt32( validationType ) ); ! // foreach ( DataRow dataRow in validatedQuotes.Rows ) ! // tickers.Add( dataRow[ "vvDate" ] ); ! return validatedQuotes; } + // /// <summary> + // /// Returns the list of visually validated quote dates for the given ticker, + // /// with respect to the Close To Close ratio + // /// </summary> + // /// <param name="ticker">Instrument ticker whose validated quote dates are to be found</param> + // /// <returns></returns> + // public static ArrayList GetCloseToCloseValidated( string ticker ) + // { + // return getVisuallyValidatedArrayList( ticker , ValidationTypes.CloseToCloseRatio ); + // } + // /// <summary> + // /// Returns the list of visually validated quote dates for the given ticker, + // /// with respect to the Range To Range ratio + // /// </summary> + // /// <param name="ticker">Instrument ticker whose validated quote dates are to be found</param> + // /// <returns></returns> + // public static ArrayList GetRangeToRangeValidated( string ticker ) + // { + // return getVisuallyValidatedArrayList( ticker , ValidationTypes.RangeToRangeRatio ); + // } } } |
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:34:41
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a0_Validation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20373/b4_Business/a0_Validation Modified Files: Validator.cs Log Message: The Validate method has been fixed Index: Validator.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a0_Validation/Validator.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Validator.cs 8 May 2004 17:23:03 -0000 1.2 --- Validator.cs 26 May 2004 15:34:25 -0000 1.3 *************** *** 18,32 **** } /// <summary> ! /// Validates (if the case) the given ticker from startDate to endDate /// </summary> /// <param name="ticker"></param> ! /// <param name="startDate"></param> ! /// <param name="endDate"></param> ! /// <returns>True if and only if the ticker is validated for the given range</returns> ! private static bool Validate( string ticker , DateTime startDate , DateTime endDate ) { ValidateDataTable validateDataTable = new ValidateDataTable(); ! validateDataTable.AddRows( ticker , startDate , endDate ); ! return ( validateDataTable.Rows.Count == 0 ); } /// <summary> --- 18,34 ---- } /// <summary> ! /// Validates (if the case) the given ticker /// </summary> /// <param name="ticker"></param> ! /// <returns>True if and only if the ticker is validated</returns> ! private static bool Validate( string ticker ) { + bool isValid; ValidateDataTable validateDataTable = new ValidateDataTable(); ! validateDataTable.AddRows( ticker ); ! isValid = ( validateDataTable.Rows.Count == 0 ); ! if ( isValid ) ! ValidatedTickers.Validate( validateDataTable.Quotes ); ! return isValid; } /// <summary> |
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:32:03
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a0_Validation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19861/b4_Business/a0_Validation Modified Files: ValidateDataTable.cs Log Message: Minor variable name changes have been applied Index: ValidateDataTable.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a0_Validation/ValidateDataTable.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ValidateDataTable.cs 9 May 2004 16:21:18 -0000 1.3 --- ValidateDataTable.cs 26 May 2004 15:31:52 -0000 1.4 *************** *** 21,24 **** --- 21,26 ---- private DataTable tableOfTickersToBeValidated; + public Quotes Quotes; + public ValidateDataTable() { *************** *** 87,97 **** this.AcceptChanges(); } ! public void AddRows( string tickerIsLike ) { ! Quotes quotesToBeValidated = new Quotes( tickerIsLike ); // quotesToBeValidated.SuspiciousDataRow += // new SuspiciousDataRowEventHandler( suspiciousDataRowEventHandler ); // new QuotesToBeValidated.SuspiciousDataRowEventHandler( suspiciousDataRowEventHandler ); ! this.addRows_with_quotesToBeValidated( quotesToBeValidated ); } // public void AddRows(double suspiciousRatio ) --- 89,99 ---- this.AcceptChanges(); } ! public void AddRows( string ticker ) { ! this.Quotes = new Quotes( ticker ); // quotesToBeValidated.SuspiciousDataRow += // new SuspiciousDataRowEventHandler( suspiciousDataRowEventHandler ); // new QuotesToBeValidated.SuspiciousDataRowEventHandler( suspiciousDataRowEventHandler ); ! this.addRows_with_quotesToBeValidated( this.Quotes ); } // public void AddRows(double suspiciousRatio ) *************** *** 113,119 **** public void AddRows( string ticker , DateTime startDate , DateTime endDate ) { ! Quotes quotesToBeValidated = ! new Quotes( ticker , startDate , endDate ); ! this.addRows_with_quotesToBeValidated( quotesToBeValidated ); } /// <summary> --- 115,120 ---- public void AddRows( string ticker , DateTime startDate , DateTime endDate ) { ! this.Quotes = new Quotes( ticker , startDate , endDate ); ! this.addRows_with_quotesToBeValidated( this.Quotes ); } /// <summary> |
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:30:21
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19524/b3_Data/DataTables Modified Files: Quotes.cs ValidatedTickers.cs Log Message: Many features have been moved from the DataAccess.Tables namespace to the Data.DataTables namespace Index: ValidatedTickers.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/ValidatedTickers.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ValidatedTickers.cs 8 May 2004 17:57:12 -0000 1.1 --- ValidatedTickers.cs 26 May 2004 15:30:10 -0000 1.2 *************** *** 20,23 **** --- 20,37 ---- QuantProject.DataAccess.Tables.ValidatedTickers.SetDataTable( ticker , this ); } + /// <summary> + /// Validates the ticker contained in the quotes DataTable + /// </summary> + /// <param name="quotes">Contains the quotes for the ticker to be validated</param> + public static void Validate( QuantProject.Data.DataTables.Quotes quotes ) + { + DateTime startDate = (DateTime)quotes.Rows[ 0 ][ QuantProject.Data.DataTables.Quotes.Date ]; + DateTime endDate = (DateTime)quotes.Rows[ quotes.Rows.Count - 1 ][ + QuantProject.Data.DataTables.Quotes.Date ]; + string ticker = quotes.Ticker; + string hashValue = quotes.GetHashValue(); + QuantProject.DataAccess.Tables.ValidatedTickers.Validate( + ticker , startDate , endDate , hashValue ); + } } } Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/Quotes.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Quotes.cs 8 May 2004 17:56:17 -0000 1.1 --- Quotes.cs 26 May 2004 15:30:10 -0000 1.2 *************** *** 1,4 **** --- 1,8 ---- using System; using System.Data; + using System.Text; + using QuantProject.ADT; + using QuantProject.ADT.Histories; + using QuantProject.DataAccess; using QuantProject.DataAccess.Tables; *************** *** 10,13 **** --- 14,37 ---- public class Quotes : DataTable { + public static string TickerFieldName = "quTicker"; // Ticker cannot be simply used because + // it is already used below + public static string Date = "quDate"; + public static string Open = "quOpen"; + public static string High = "quHigh"; + public static string Low = "quLow"; + public static string Close = "quClose"; + public static string Volume = "quVolume"; + public static string AdjustedClose = "quAdjustedClose"; + public static string AdjustedCloseToCloseRatio = "quAdjustedCloseToCloseRatio"; + + /// <summary> + /// Gets the ticker whose quotes are contained into the Quotes object + /// </summary> + /// <returns></returns> + public string Ticker + { + get{ return ((string)this.Rows[ 0 ][ Quotes.TickerFieldName ]); } + } + private void fillDataTable( string ticker , DateTime startDate , DateTime endDate ) { *************** *** 26,29 **** --- 50,165 ---- QuantProject.DataAccess.Tables.Quotes.GetEndDate( ticker ) ); } + #region GetHashValue + private string getHashValue_getQuoteString_getRowString_getSingleValueString( Object value ) + { + string returnValue; + if ( value.GetType() == Type.GetType( "System.DateTime" ) ) + returnValue = ( (DateTime) value ).ToString(); + else + { + if ( value.GetType() == Type.GetType( "System.Double" ) ) + returnValue = ( (float) value ).ToString( "F2" ); + else + returnValue = value.ToString(); + } + + return returnValue + ";"; + } + /// <summary> + /// Computes the string representing the concatenation for a single quote row + /// </summary> + /// <param name="dataRow"></param> + /// <returns></returns> + private StringBuilder getHashValue_getQuoteString_getRowString( DataRowView dataRow ) + { + StringBuilder returnValue = new StringBuilder( "" ); + foreach ( DataColumn dataColumn in dataRow.DataView.Table.Columns ) + if ( dataColumn.ColumnName != "quTicker" ) + returnValue.Append( getHashValue_getQuoteString_getRowString_getSingleValueString( + dataRow[ dataColumn.Ordinal ] ) ); + // returnValue += "ggg"; + // returnValue += getHashValue_getQuoteString_getRowString_getSingleValueString( + // dataRow[ dataColumn ] ); + return returnValue; + } + /// <summary> + /// Computes the string representing the concatenation of all the quotes + /// </summary> + /// <param name="ticker"></param> + /// <returns></returns> + private string getHashValue_getQuoteString( DataView quotes ) + { + StringBuilder returnValue = new StringBuilder( "" ); + foreach ( DataRowView dataRow in quotes ) + returnValue.Append( getHashValue_getQuoteString_getRowString( dataRow ) ); + return returnValue.ToString(); + } + /// <summary> + /// Computes the hash value for the contained quotes + /// </summary> + /// <returns>Hash value for all the quotes</returns> + public string GetHashValue() + { + DataView quotes = new DataView( this ); + return HashProvider.GetHashValue( getHashValue_getQuoteString( quotes ) ); + } + /// <summary> + /// Computes the hash value for the contained quotes + /// since startDate, to endDate + /// </summary> + /// <param name="startDate">date where hash begins being computed</param> + /// <param name="endDate">date where hash ends being computed</param> + /// <returns></returns> + public string GetHashValue( DateTime startDate , DateTime endDate ) + { + DataView quotes = new DataView( this ); + quotes.RowFilter = "( (quDate>=" + FilterBuilder.GetDateConstant( startDate ) + + ") and (quDate<=" + FilterBuilder.GetDateConstant( endDate ) + ") )"; + return HashProvider.GetHashValue( getHashValue_getQuoteString( quotes ) ); + } + #endregion + + /// <summary> + /// returns the Date for the quote that is precedingDays before + /// quoteDate + /// </summary> + /// <param name="quoteDate"></param> + /// <param name="precedingDays"></param> + /// <returns></returns> + public DateTime GetPrecedingDate( DateTime quoteDate , int precedingDays ) + { + History history = new History(); + history.Import( this , "quDate" , "quAdjustedClose" ); + return (DateTime) history.GetKey( Math.Max( 0 , + history.IndexOfKeyOrPrevious( quoteDate ) - + precedingDays ) ); + } + + + /// <summary> + /// returns the Date for the quote that is followingDays after + /// quoteDate + /// </summary> + /// <param name="quoteDate"></param> + /// <param name="precedingDays"></param> + /// <returns></returns> + public DateTime GetFollowingDate( DateTime quoteDate , int followingDays ) + { + History history = new History(); + history.Import( this , "quDate" , "quAdjustedClose" ); + return (DateTime) history.GetKey( Math.Max( 0 , + history.IndexOfKeyOrPrevious( quoteDate ) - + followingDays ) ); + } + + + // public DateTime GetPrecedingDate( DateTime quoteDate , int precedingDays ) + // { + // History history = new History(); + // history.Import( this.quotes , "quDate" , "quAdjustedClose" ); + // return (DateTime) history.GetKey( Math.Max( 0 , + // history.IndexOfKeyOrPrevious( quoteDate ) - + // precedingDays ) ); + // } } } |
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:30:21
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a0_Validation/Validators In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19524/b4_Business/a0_Validation/Validators Modified Files: CloseToCloseValidator.cs RangeToRangeValidator.cs Log Message: Many features have been moved from the DataAccess.Tables namespace to the Data.DataTables namespace Index: CloseToCloseValidator.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a0_Validation/Validators/CloseToCloseValidator.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CloseToCloseValidator.cs 9 May 2004 16:19:02 -0000 1.3 --- CloseToCloseValidator.cs 26 May 2004 15:30:08 -0000 1.4 *************** *** 82,87 **** private int validate_currentTicker( string currentTicker , int currentTickerStartingRowIndex ) { ! this.closeToCloseVisuallyValidated = ! QuantProject.DataAccess.Tables.VisuallyValidatedQuotes.GetCloseToCloseValidated( currentTicker ); History closeToClose = new History(); History closeToCloseMovingAverage; --- 82,86 ---- private int validate_currentTicker( string currentTicker , int currentTickerStartingRowIndex ) { ! this.closeToCloseVisuallyValidated = VisuallyValidatedQuotes.GetCloseToCloseValidated( currentTicker ); History closeToClose = new History(); History closeToCloseMovingAverage; Index: RangeToRangeValidator.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a0_Validation/Validators/RangeToRangeValidator.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RangeToRangeValidator.cs 8 May 2004 17:16:42 -0000 1.2 --- RangeToRangeValidator.cs 26 May 2004 15:30:08 -0000 1.3 *************** *** 81,86 **** private int validate_currentTicker( string currentTicker , int currentTickerStartingRowIndex ) { ! this.rangeToRangeVisuallyValidated = ! QuantProject.DataAccess.Tables.VisuallyValidatedQuotes.GetRangeToRangeValidated( currentTicker ); History rangeToRange = new History(); History rangeToRangeMovingAverage; --- 81,85 ---- private int validate_currentTicker( string currentTicker , int currentTickerStartingRowIndex ) { ! this.rangeToRangeVisuallyValidated = VisuallyValidatedQuotes.GetRangeToRangeValidated( currentTicker ); History rangeToRange = new History(); History rangeToRangeMovingAverage; |
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:30:20
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19524/b2_DataAccess/Tables Modified Files: Quotes.cs ValidatedTickers.cs Log Message: Many features have been moved from the DataAccess.Tables namespace to the Data.DataTables namespace Index: ValidatedTickers.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/ValidatedTickers.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ValidatedTickers.cs 8 May 2004 17:14:32 -0000 1.3 --- ValidatedTickers.cs 26 May 2004 15:30:09 -0000 1.4 *************** *** 23,38 **** ! /// <summary> ! /// Returns the hash value for the given instrument ! /// </summary> ! /// <param name="ticker">Instrument's ticker</param> ! /// <param name="startDate">Starting instrument quote's date, for hash value computation</param> ! /// <param name="endDate">Ending instrument quote's date, for hash value computation</param> ! /// <returns></returns> ! public static string GetHashValue( string ticker , DateTime startDate , DateTime endDate ) ! { ! Quotes quotes = new Quotes( ticker ); ! return quotes.GetHashValue( startDate , endDate ); ! } /// <summary> --- 23,38 ---- ! // /// <summary> ! // /// Returns the hash value for the given instrument ! // /// </summary> ! // /// <param name="ticker">Instrument's ticker</param> ! // /// <param name="startDate">Starting instrument quote's date, for hash value computation</param> ! // /// <param name="endDate">Ending instrument quote's date, for hash value computation</param> ! // /// <returns></returns> ! // public static string GetHashValue( string ticker , DateTime startDate , DateTime endDate ) ! // { ! // Quotes quotes = new Quotes( ticker ); ! // return quotes.GetHashValue( startDate , endDate ); ! // } /// <summary> *************** *** 51,54 **** --- 51,78 ---- } + public static void Validate( string ticker , DateTime startDate , + DateTime endDate , string hashValue ) + { + try + { + SqlExecutor.ExecuteNonQuery( "delete * from validatedTickers " + + "where " + ValidatedTickers.Ticker + "='" + ticker + "'" ); + OleDbSingleTableAdapter oleDbSingleTableAdapter = + new OleDbSingleTableAdapter(); + oleDbSingleTableAdapter.SetAdapter( "validatedTickers" ); + oleDbSingleTableAdapter.DataTable.Rows.Add( oleDbSingleTableAdapter.DataTable.NewRow() ); + oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ ValidatedTickers.Ticker ] = ticker; + oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ ValidatedTickers.StartDate ] = startDate; + oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ ValidatedTickers.StartDate ] = endDate; + oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ ValidatedTickers.HashValue ] = hashValue; + oleDbSingleTableAdapter.OleDbDataAdapter.Update( oleDbSingleTableAdapter.DataTable ); + } + catch ( Exception ex ) + { + string exceptionMessage = ex.Message + "\n" + ex.StackTrace; + Console.WriteLine( exceptionMessage ); + } + } + } } Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Quotes.cs 22 May 2004 07:09:04 -0000 1.7 --- Quotes.cs 26 May 2004 15:30:09 -0000 1.8 *************** *** 486,521 **** } - /// <summary> - /// returns the Date for the quote that is precedingDays before - /// quoteDate - /// </summary> - /// <param name="quoteDate"></param> - /// <param name="precedingDays"></param> - /// <returns></returns> - public DateTime GetPrecedingDate( DateTime quoteDate , int precedingDays ) - { - History history = new History(); - history.Import( this.quotes , "quDate" , "quAdjustedClose" ); - return (DateTime) history.GetKey( Math.Max( 0 , - history.IndexOfKeyOrPrevious( quoteDate ) - - precedingDays ) ); - } - /// <summary> - /// returns the Date for the quote that is followingDays after - /// quoteDate - /// </summary> - /// <param name="quoteDate"></param> - /// <param name="precedingDays"></param> - /// <returns></returns> - public DateTime GetFollowingDate( DateTime quoteDate , int followingDays ) - { - History history = new History(); - history.Import( this.quotes , "quDate" , "quAdjustedClose" ); - return (DateTime) history.GetKey( Math.Max( 0 , - history.IndexOfKeyOrPrevious( quoteDate ) - - followingDays ) ); - } - /// <summary> --- 486,490 ---- |
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:27:40
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18865/b3_Data Modified Files: b3_Data.csproj Log Message: The following classes have been added: - FilterBuilder - VisuallyValidatedQuotes Index: b3_Data.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/b3_Data.csproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** b3_Data.csproj 9 May 2004 16:26:27 -0000 1.4 --- b3_Data.csproj 26 May 2004 15:27:24 -0000 1.5 *************** *** 132,135 **** --- 132,140 ---- /> <File + RelPath = "FilterBuilder.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "DataTables\Quotes.cs" SubType = "Component" *************** *** 157,160 **** --- 162,175 ---- /> <File + RelPath = "DataTables\VisuallyValidatedQuotes.cs" + SubType = "Component" + BuildAction = "Compile" + /> + <File + RelPath = "DataTables\VisuallyValidatedQuotes.resx" + DependentUpon = "VisuallyValidatedQuotes.cs" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "Selectors\ITickerReceiver.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:25:59
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18401/b2_DataAccess Modified Files: b2_DataAccess.csproj Log Message: VisuallyValidatedTickers.cs has been removed Index: b2_DataAccess.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/b2_DataAccess.csproj,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** b2_DataAccess.csproj 11 May 2004 22:00:34 -0000 1.10 --- b2_DataAccess.csproj 26 May 2004 15:25:46 -0000 1.11 *************** *** 157,165 **** BuildAction = "Compile" /> - <File - RelPath = "Tables\VisuallyValidatedTickers.cs" - SubType = "Code" - BuildAction = "Compile" - /> </Include> </Files> --- 157,160 ---- |
|
From: Glauco S. <gla...@us...> - 2004-05-25 15:18:18
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22107/b3_Data/DataTables Added Files: VisuallyValidatedQuotes.cs Log Message: DataTable for visuallyValidatedQuotes table data --- NEW FILE: VisuallyValidatedQuotes.cs --- using System; using System.Collections; using System.Data; using QuantProject.ADT; using QuantProject.DataAccess; using QuantProject.DataAccess.Tables; namespace QuantProject.Data.DataTables { /// <summary> /// DataTable for visuallyValidatedQuotes table data /// </summary> public class VisuallyValidatedQuotes : DataTable { public static string Ticker = QuantProject.DataAccess.Tables.VisuallyValidatedQuotes.Ticker; public static string Date = QuantProject.DataAccess.Tables.VisuallyValidatedQuotes.Date; public static string ValidationType = QuantProject.DataAccess.Tables.VisuallyValidatedQuotes.ValidationType; public static string HashValue = QuantProject.DataAccess.Tables.VisuallyValidatedQuotes.HashValue; public static string EditDate = QuantProject.DataAccess.Tables.VisuallyValidatedQuotes.EditDate; public VisuallyValidatedQuotes() { // // TODO: Add constructor logic here // } /// <summary> /// Returns the hash value to be stored/read into/from the visuallyValidatedQuotes table /// </summary> /// <param name="quoteDate">Date whose neighborhood quotes are to be hashed</param> /// <returns></returns> private static string getHashValue( Quotes quotes , DateTime quoteDate ) { return quotes.GetHashValue( quotes.GetPrecedingDate( quoteDate , ConstantsProvider.PrecedingDaysForVisualValidation ) , quotes.GetFollowingDate( quoteDate , ConstantsProvider.PrecedingDaysForVisualValidation ) ); } private static void validate( Quotes quotes , DateTime quoteDate , ValidationTypes validationType ) { try { SqlExecutor.ExecuteNonQuery( "delete * from visuallyValidatedQuotes where " + "vvTicker='" + quotes.Ticker + "' and " + "vvDate=" + FilterBuilder.GetDateConstant( quoteDate ) ); OleDbSingleTableAdapter oleDbSingleTableAdapter = new OleDbSingleTableAdapter( "select * from visuallyValidatedQuotes where 1=2" ); string hashValue = getHashValue( quotes , quoteDate ); oleDbSingleTableAdapter.DataTable.Rows.Add( oleDbSingleTableAdapter.DataTable.NewRow() ); oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.Ticker ] = quotes.Ticker; oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.Date ] = quoteDate; oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.ValidationType ] = validationType; oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.HashValue ] = hashValue; oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.EditDate ] = DateTime.Now; oleDbSingleTableAdapter.OleDbDataAdapter.Update( oleDbSingleTableAdapter.DataTable ); } catch ( Exception ex ) { string exceptionMessage = ex.Message + "\n" + ex.StackTrace; Console.WriteLine( exceptionMessage ); } } /// <summary> /// writes to the database the visual validation of the Close to Close suspicious ratios /// </summary> /// <param name="quotes">contains all the quotes for the ticker to be validated</param> /// <param name="quoteDate">date to be validated</param> public static void ValidateCloseToClose( Quotes quotes , DateTime quoteDate ) { validate( quotes , quoteDate , ValidationTypes.CloseToCloseRatio ); } /// <summary> /// writes to the database the visual validation of the Range to Range suspicious ratios /// </summary> /// <param name="quotes">contains all the quotes for the ticker to be validated</param> /// <param name="quoteDate">date to be validated</param> public static void ValidateRangeToRange( Quotes quotes , DateTime quoteDate ) { validate( quotes , quoteDate , ValidationTypes.RangeToRangeRatio ); } private static ArrayList getVisuallyValidatedArrayList( string ticker , ValidationTypes validationType ) { ArrayList tickers = new ArrayList(); DataTable validatedQuotes = QuantProject.DataAccess.Tables.VisuallyValidatedQuotes.GetValidatedQuotes( ticker , validationType ); if ( validatedQuotes.Rows.Count > 0 ) // some ticker quotes have been visually validated { Quotes quotes = new Quotes( ticker ); foreach ( DataRow dataRow in validatedQuotes.Rows ) if ( (string)dataRow[ VisuallyValidatedQuotes.HashValue ] == getHashValue( quotes , (DateTime)dataRow[ VisuallyValidatedQuotes.Date ] ) ) // the current quote date had been visually validated with respect to the neighborhood quotes tickers.Add( dataRow[ "vvDate" ] ); /// TO DO !!! add else branch to raise event 'broken hash value' } return tickers; } /// <summary> /// Returns the list of visually validated quote dates for the given ticker, /// with respect to the Close To Close ratio /// </summary> /// <param name="ticker">Instrument ticker whose validated quote dates are to be found</param> /// <returns></returns> public static ArrayList GetCloseToCloseValidated( string ticker ) { return getVisuallyValidatedArrayList( ticker , ValidationTypes.CloseToCloseRatio ); } /// <summary> /// Returns the list of visually validated quote dates for the given ticker, /// with respect to the Range To Range ratio /// </summary> /// <param name="ticker">Instrument ticker whose validated quote dates are to be found</param> /// <returns></returns> public static ArrayList GetRangeToRangeValidated( string ticker ) { return getVisuallyValidatedArrayList( ticker , ValidationTypes.RangeToRangeRatio ); } } } |
|
From: Glauco S. <gla...@us...> - 2004-05-25 15:16:42
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21807/b3_Data Added Files: FilterBuilder.cs Log Message: Filters to be used within the DataTables namespace --- NEW FILE: FilterBuilder.cs --- using System; namespace QuantProject.Data { /// <summary> /// Filters to be used within the DataTables namespace /// </summary> public class FilterBuilder { public FilterBuilder() { // // TODO: Add constructor logic here // } internal static string GetDateConstant( DateTime dateTime ) { string getDateConstant; getDateConstant = "#" + dateTime.Month + "/" + dateTime.Day + "/" + dateTime.Year + "#"; return getDateConstant; } } } |
|
From: Glauco S. <gla...@us...> - 2004-05-25 15:14:34
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21252/b2_DataAccess/Tables Removed Files: VisuallyValidatedTickers.cs Log Message: Not needed anymore --- VisuallyValidatedTickers.cs DELETED --- |
|
From: <ben...@id...> - 2004-05-25 08:04:31
|
Dear Open Source developer I am doing a research project on "Fun and Software Development" in which I kindly invite you to participate. You will find the online survey under http://fasd.ethz.ch/qsf/. The questionnaire consists of 53 questions and you will need about 15 minutes to complete it. With the FASD project (Fun and Software Development) we want to define the motivational significance of fun when software developers decide to engage in Open Source projects. What is special about our research project is that a similar survey is planned with software developers in commercial firms. This procedure allows the immediate comparison between the involved individuals and the conditions of production of these two development models. Thus we hope to obtain substantial new insights to the phenomenon of Open Source Development. With many thanks for your participation, Benno Luthiger PS: The results of the survey will be published under http://www.isu.unizh.ch/fuehrung/blprojects/FASD/. We have set up the mailing list fa...@we... for this study. Please see http://fasd.ethz.ch/qsf/mailinglist_en.html for registration to this mailing list. _______________________________________________________________________ Benno Luthiger Swiss Federal Institute of Technology Zurich 8092 Zurich Mail: benno.luthiger(at)id.ethz.ch _______________________________________________________________________ |
|
From: Marco M. <mi...@us...> - 2004-05-22 07:09:13
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21746/b2_DataAccess/Tables Modified Files: Quotes.cs Log Message: Added new methods for the check of the adjusted close to close ratio Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Quotes.cs 11 May 2004 21:57:27 -0000 1.6 --- Quotes.cs 22 May 2004 07:09:04 -0000 1.7 *************** *** 29,32 **** --- 29,34 ---- public static string AdjustedCloseToCloseRatio = "quAdjustedCloseToCloseRatio"; + public static DateTime DateWithDifferentCloseToClose = new DateTime(1900,1,1); + /// <summary> *************** *** 93,103 **** /// (the table refers to the ticker passed as the first parameter) /// </summary> ! private static void commitAllCloseToCloseRatios(string ticker, ! DataTable tableContainingCloseToCloseRatios ) { - string notUsed = ticker; OleDbSingleTableAdapter adapter = new OleDbSingleTableAdapter("SELECT * FROM quotes WHERE 1=2", tableContainingCloseToCloseRatios); adapter.OleDbDataAdapter.Update(tableContainingCloseToCloseRatios); --- 95,104 ---- /// (the table refers to the ticker passed as the first parameter) /// </summary> ! private static void commitAllCloseToCloseRatios(DataTable tableContainingCloseToCloseRatios ) { OleDbSingleTableAdapter adapter = new OleDbSingleTableAdapter("SELECT * FROM quotes WHERE 1=2", tableContainingCloseToCloseRatios); + adapter.OleDbDataAdapter.ContinueUpdateOnError = true; adapter.OleDbDataAdapter.Update(tableContainingCloseToCloseRatios); *************** *** 113,131 **** /// <summary> ! /// It provides computation of the adjustedCloseToCloseRatios for the given ticker /// </summary> public static void ComputeAndCommitCloseToCloseRatios( string ticker) { - DateTime start = DateTime.Now; DataTable tickerQuotes = Quotes.GetTickerQuotes(ticker); - DateTime tickerQuotesTime = DateTime.Now; Quotes.ComputeCloseToCloseValues(tickerQuotes); ! DateTime computation = DateTime.Now; ! Quotes.commitAllCloseToCloseRatios(ticker, tickerQuotes); ! DateTime commit = DateTime.Now; ! MessageBox.Show("start : " + start.ToString() + "\n" + ! "loading quotes - finished : " + tickerQuotesTime.ToString() + "\n" + ! "computation - finished: " + computation.ToString() + "\n" + ! "commit - finished: " + commit.ToString()); } --- 114,125 ---- /// <summary> ! /// It provides computation and commiting to database ! /// of the adjustedCloseToCloseRatios for the given ticker /// </summary> public static void ComputeAndCommitCloseToCloseRatios( string ticker) { DataTable tickerQuotes = Quotes.GetTickerQuotes(ticker); Quotes.ComputeCloseToCloseValues(tickerQuotes); ! Quotes.commitAllCloseToCloseRatios(tickerQuotes); } *************** *** 244,250 **** double adjCTCInSource; double absoluteRelativeDifference; - DataColumn[] columnPrimaryKey = new DataColumn[0]; - columnPrimaryKey[0]= tableSource.Columns["quDate"]; - tableSource.PrimaryKey = columnPrimaryKey; DataRow rowToCheck; for(int i = 0;i != numRows;i++) --- 238,241 ---- *************** *** 256,262 **** { adjCTCInSource = (double)rowToCheck[Quotes.AdjustedCloseToCloseRatio]; ! absoluteRelativeDifference = Math.Abs((adjCTCInDatabase - adjCTCInSource)/adjCTCInSource); ! if(absoluteRelativeDifference > ConstantsProvider.MaxRelativeDifferenceForCloseToCloseRatios ) ! return true; } } --- 247,269 ---- { adjCTCInSource = (double)rowToCheck[Quotes.AdjustedCloseToCloseRatio]; ! if(adjCTCInSource != 0) ! { ! absoluteRelativeDifference = Math.Abs((adjCTCInDatabase - adjCTCInSource)/adjCTCInSource); ! if(absoluteRelativeDifference > ConstantsProvider.MaxRelativeDifferenceForCloseToCloseRatios ) ! { ! Quotes.DateWithDifferentCloseToClose = date; ! return true; ! } ! } ! else if(adjCTCInSource == 0) ! { ! absoluteRelativeDifference = Math.Abs(adjCTCInDatabase - adjCTCInSource); ! if(absoluteRelativeDifference > ConstantsProvider.MaxRelativeDifferenceForCloseToCloseRatios ) ! { ! Quotes.DateWithDifferentCloseToClose = date; ! return true; ! } ! ! } } } *************** *** 271,309 **** ! public static void ComputeCloseToCloseValues(DataTable tableContainingNewAdjustedValues) ! { ! try { ! if(!tableContainingNewAdjustedValues.Columns.Contains(Quotes.AdjustedCloseToCloseRatio)) { ! tableContainingNewAdjustedValues.Columns.Add(Quotes.AdjustedCloseToCloseRatio, ! System.Type.GetType("System.Double")); } ! int numRows = tableContainingNewAdjustedValues.Rows.Count; ! float previousClose; ! float currentClose; ! for(int i = 0;i != numRows;i++) { ! if(i == 0) ! //the first available quote has 0 as closeToClose ratio ! { ! tableContainingNewAdjustedValues.Rows[i][Quotes.AdjustedCloseToCloseRatio] = 0; ! } ! else ! { ! previousClose = (float)tableContainingNewAdjustedValues.Rows[i-1]["quAdjustedClose"]; ! currentClose = (float)tableContainingNewAdjustedValues.Rows[i]["quAdjustedClose"]; ! tableContainingNewAdjustedValues.Rows[i][Quotes.AdjustedCloseToCloseRatio] = ! (currentClose - previousClose)/previousClose; ! } ! } ! ! } ! catch(Exception ex) ! { ! MessageBox.Show(ex.ToString()); } - } --- 278,320 ---- ! public static void ComputeCloseToCloseValues(DataTable tableOfAllQuotesOfAGivenTicker) { ! DataColumn[] columnPrimaryKey = new DataColumn[1]; ! columnPrimaryKey[0]= tableOfAllQuotesOfAGivenTicker.Columns[Quotes.Date]; ! tableOfAllQuotesOfAGivenTicker.PrimaryKey = columnPrimaryKey; ! ! int numRows = tableOfAllQuotesOfAGivenTicker.Rows.Count; ! DataView orderedDyDate = new DataView(tableOfAllQuotesOfAGivenTicker, ! Quotes.AdjustedClose + ">=0", ! Quotes.Date + " ASC", DataViewRowState.CurrentRows); ! float previousClose; ! float currentClose; ! double currentCloseToCloseRatio; ! DateTime date; ! DataRow rowToBeChanged; ! for(int i = 0;i != numRows;i++) { ! date = (DateTime)orderedDyDate[i].Row[Quotes.Date]; ! rowToBeChanged = tableOfAllQuotesOfAGivenTicker.Rows.Find(date); ! if(i == 0) ! //the first available quote has 0 as closeToClose ratio { ! rowToBeChanged[Quotes.AdjustedCloseToCloseRatio] = 0; } ! else { ! previousClose = (float)orderedDyDate[i-1].Row[Quotes.AdjustedClose]; ! currentClose = (float)orderedDyDate[i].Row[Quotes.AdjustedClose]; ! currentCloseToCloseRatio = (double)orderedDyDate[i].Row[Quotes.AdjustedCloseToCloseRatio]; ! ! if(previousClose != 0 && (currentCloseToCloseRatio == 0 && ! (previousClose != currentClose))) ! // if the previouse adj close is not 0 and the current CTC should not be 0 ! // because previous and current are not equal ! rowToBeChanged[Quotes.AdjustedCloseToCloseRatio] = ! (currentClose - previousClose)/previousClose; ! } ! } } *************** *** 520,524 **** } ! /* Now useless, maybe ... /// <summary> /// Returns a DataTable containing ticker, date and adjusted value --- 531,535 ---- } ! /* Now useless /// <summary> /// Returns a DataTable containing ticker, date and adjusted value |
|
From: Marco M. <mi...@us...> - 2004-05-22 07:08:01
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21577/b1_ADT Modified Files: ConstantsProvider.cs Log Message: Added new constants to the project Index: ConstantsProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ConstantsProvider.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ConstantsProvider.cs 11 May 2004 21:58:19 -0000 1.3 --- ConstantsProvider.cs 22 May 2004 07:07:51 -0000 1.4 *************** *** 21,24 **** --- 21,25 ---- public static double MaxRelativeDifferenceForAdjustedValues = 0.0005; public static double MaxRelativeDifferenceForCloseToCloseRatios = 0.0001; + // max num days allowed by the data source (yahoo) public static double MaxNumDaysDownloadedAtEachConnection = 200; } |
|
From: Marco M. <mi...@us...> - 2004-05-22 07:07:03
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21389/Downloader/TickerSelectors Modified Files: TickerViewerMenu.cs Log Message: Added new menu item in the context menu for the visual selector forms Index: TickerViewerMenu.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors/TickerViewerMenu.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TickerViewerMenu.cs 25 Apr 2004 17:24:50 -0000 1.2 --- TickerViewerMenu.cs 22 May 2004 07:06:39 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- using System.Data; using System.Windows.Forms; + using QuantProject.DataAccess.Tables; using QuantProject.Data.DataTables; using QuantProject.Data.Selectors; *************** *** 42,46 **** private MenuItem menuItemValidate = new MenuItem("&Validate selection"); private MenuItem menuItemCopy = new MenuItem("&Copy selection"); ! //private MenuItem menuItemPaste = new MenuItem("&Paste"); private MenuItem menuItemQuotesEditor = new MenuItem("&Open Quotes Editor"); --- 43,48 ---- private MenuItem menuItemValidate = new MenuItem("&Validate selection"); private MenuItem menuItemCopy = new MenuItem("&Copy selection"); ! private MenuItem menuItemComputeCloseToCloseRatios = ! new MenuItem("C&ompute Close to Close ratios"); private MenuItem menuItemQuotesEditor = new MenuItem("&Open Quotes Editor"); *************** *** 54,57 **** --- 56,60 ---- this.menuItemCopy.Click += new System.EventHandler(this.copySelectedTickers); this.menuItemQuotesEditor.Click += new System.EventHandler(this.openQuotesEditor); + this.menuItemComputeCloseToCloseRatios.Click += new System.EventHandler(this.computeCloseToCloseRatios); this.MenuItems.Add(this.menuItemSelectAll); *************** *** 60,63 **** --- 63,67 ---- this.MenuItems.Add(this.menuItemCopy); this.MenuItems.Add(this.menuItemQuotesEditor); + this.MenuItems.Add(this.menuItemComputeCloseToCloseRatios); } *************** *** 123,133 **** quotesEditor.Show(); } ! /* ! private void paste(object sender, System.EventArgs e) { ! MessageBox.Show("Possible only if ITickerReceiver"); } ! */ } } --- 127,147 ---- quotesEditor.Show(); } ! ! private void computeCloseToCloseRatios(object sender, System.EventArgs e) { ! Cursor.Current = Cursors.WaitCursor; ! ITickerSelector iTickerSelector = (ITickerSelector)this.parentForm; ! TickerDataTable tableOfSelectedTickers = iTickerSelector.GetTableOfSelectedTickers(); ! string currentTicker; ! foreach(DataRow row in tableOfSelectedTickers.Rows) ! { ! currentTicker = (string)row[Tickers.Ticker]; ! QuantProject.DataAccess.Tables.Quotes.ComputeAndCommitCloseToCloseRatios(currentTicker); ! } ! Cursor.Current = Cursors.WaitCursor; ! } ! } } |
|
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" /> |
|
From: Marco M. <mi...@us...> - 2004-05-11 22:06:52
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22169/Downloader/TickerSelectors Modified Files: TickerGroupsListViewMenu.cs TickerGroupsViewer.cs Log Message: Code has been cleaned and some methods were renamed. TickerDownloader has been rivisited Index: TickerGroupsViewer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors/TickerGroupsViewer.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TickerGroupsViewer.cs 25 Apr 2004 17:24:50 -0000 1.2 --- TickerGroupsViewer.cs 11 May 2004 22:06:41 -0000 1.3 *************** *** 137,140 **** --- 137,151 ---- } + /// <summary> + /// It gets the selected items in the list view controls + /// </summary> + public ListView.SelectedListViewItemCollection SelectedListViewItems + { + get + { + return this.listViewGroupsAndTickers.SelectedItems; + } + } + private void addTickersToTable(DataTable tableToFill) { Index: TickerGroupsListViewMenu.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors/TickerGroupsListViewMenu.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TickerGroupsListViewMenu.cs 25 Apr 2004 17:24:49 -0000 1.2 --- TickerGroupsListViewMenu.cs 11 May 2004 22:06:41 -0000 1.3 *************** *** 54,58 **** private void removeSelectedItems(object sender, System.EventArgs e) { ! MessageBox.Show(".... NOT IMPLEMENTED YET .... "); } --- 54,58 ---- private void removeSelectedItems(object sender, System.EventArgs e) { ! //; } |
|
From: Marco M. <mi...@us...> - 2004-05-11 22:06:51
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22169/Downloader Modified Files: DataBaseImporter.cs TickerDownloader.cs WebDownloader.cs Log Message: Code has been cleaned and some methods were renamed. TickerDownloader has been rivisited Index: WebDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/WebDownloader.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** WebDownloader.cs 25 Apr 2004 17:24:49 -0000 1.11 --- WebDownloader.cs 11 May 2004 22:06:40 -0000 1.12 *************** *** 164,168 **** this.dataGrid1.Location = new System.Drawing.Point(328, 8); this.dataGrid1.Name = "dataGrid1"; ! this.dataGrid1.Size = new System.Drawing.Size(304, 456); this.dataGrid1.TabIndex = 1; // --- 164,168 ---- 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; // *************** *** 369,378 **** this.radioButtonOverWriteYes.Size = new System.Drawing.Size(288, 32); this.radioButtonOverWriteYes.TabIndex = 0; ! this.radioButtonOverWriteYes.Text = "Download all quotes, overwriting the existing ones in database"; // // WebDownloader // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(664, 470); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.groupBoxUpdateDatabaseOptions, --- 369,378 ---- 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"; // // WebDownloader // 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, *************** *** 388,391 **** --- 388,392 ---- this.Name = "WebDownloader"; this.Text = "Web downloader"; + this.Load += new System.EventHandler(this.WebDownloader_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit(); this.groupBoxWebDownloaderOptions.ResumeLayout(false); *************** *** 554,558 **** --- 555,561 ---- new DataColumn( dt.Columns[ "tiTicker" ].ColumnName , dt.Columns[ "tiTicker" ].DataType ) ); this.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Columns.Add( "currentState" , System.Type.GetType( "System.String" ) ); + this.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Columns.Add( "databaseUpdated" , System.Type.GetType( "System.String" ) ); this.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Columns.Add( "adjustedClose" , System.Type.GetType( "System.String" ) ); + this.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Columns.Add( "adjCloseToCloseRatio" , System.Type.GetType( "System.String" ) ); this.dataGrid1.DataSource = this.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ]; } *************** *** 662,671 **** } ! public bool IsUpdateOptionSelected { get { ! return (this.radioButtonDownloadBeforeMinAndAfterMax.Checked || ! this.radioButtonDownloadOnlyAfterMax.Checked); } } --- 665,680 ---- } ! private void WebDownloader_Load(object sender, System.EventArgs e) ! { ! // this is just used for testing code ! ! ! } ! ! public bool IsBeforeAndAfterSelected { get { ! return this.radioButtonDownloadBeforeMinAndAfterMax.Checked; } } *************** *** 678,681 **** --- 687,712 ---- } } + public bool IsDownloadAllSelected + { + get + { + return (this.radioButtonOverWriteNo.Checked || + this.radioButtonOverWriteYes.Checked); + } + } + public bool IsOverWriteYesSelected + { + get + { + return this.radioButtonOverWriteYes.Checked; + } + } + public bool IsOverWriteNoSelected + { + get + { + return this.radioButtonOverWriteNo.Checked; + } + } } } Index: TickerDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerDownloader.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TickerDownloader.cs 17 Apr 2004 14:14:41 -0000 1.4 --- TickerDownloader.cs 11 May 2004 22:06:40 -0000 1.5 *************** *** 4,7 **** --- 4,8 ---- using System.Net; using System.Windows.Forms; + using QuantProject.DataAccess; using QuantProject.DataAccess.Tables; using QuantProject.ADT; *************** *** 26,29 **** --- 27,32 ---- private int endYear = DateTime.Now.Year; private int numberOfQuotesInDatabase; + private DataTable downloadedValuesFromSource = new DataTable("quotes"); + private OleDbSingleTableAdapter adapter; public TickerDownloader( WebDownloader myForm, DataRow currentDataTickerRow, string quTicker , int numRows ) *************** *** 35,38 **** --- 38,43 ---- p_numRows = numRows; this.oleDbConnection1 = myForm.OleDbConnection1; + this.adapter = new OleDbSingleTableAdapter("SELECT * FROM quotes WHERE 1=2", + this.downloadedValuesFromSource); } *************** *** 59,68 **** } ! private void updateCurrentStatusAdjustedClose(string stateOfAdjustedCloseValue ) { lock( p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ] ) { DataRow[] myRows = p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Select( "tiTicker='" + p_quTicker + "'" ); ! myRows[ 0 ][ "adjustedClose" ] = stateOfAdjustedCloseValue; p_myForm.dataGrid1.Refresh(); } --- 64,93 ---- } ! private void updateCurrentStatusAdjustedClose(string status ) { lock( p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ] ) { DataRow[] myRows = p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Select( "tiTicker='" + p_quTicker + "'" ); ! myRows[ 0 ][ "adjustedClose" ] = status; ! p_myForm.dataGrid1.Refresh(); ! } ! } ! ! private void updateCurrentStatusAdjustedCloseToCloseRatio(string status ) ! { ! lock( p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ] ) ! { ! DataRow[] myRows = p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Select( "tiTicker='" + p_quTicker + "'" ); ! myRows[ 0 ][ "adjCloseToCloseRatio" ] = status; ! p_myForm.dataGrid1.Refresh(); ! } ! } ! ! private void updateCurrentStatusDatabaseUpdated(string status ) ! { ! lock( p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ] ) ! { ! DataRow[] myRows = p_myForm.DsTickerCurrentlyDownloaded.Tables[ "Tickers" ].Select( "tiTicker='" + p_quTicker + "'" ); ! myRows[ 0 ][ "databaseUpdated" ] = status; p_myForm.dataGrid1.Refresh(); } *************** *** 83,86 **** --- 108,197 ---- } + + private void addNewAdjustedValueInTable( StreamReader streamReader, + DataTable tableToWhichValuesHaveToBeAdded ) + { + string Line; + string[] LineIn; + DataRow row; + + Line = streamReader.ReadLine(); + Line = streamReader.ReadLine(); + + while ( Line != null && ! Line.StartsWith("<")) + { + LineIn=Line.Split(','); + row = tableToWhichValuesHaveToBeAdded.NewRow(); + row[0] = DateTime.Parse( LineIn[0] ); + row[1] = Double.Parse(LineIn[6]); + tableToWhichValuesHaveToBeAdded.Rows.Add(row); + + Line = streamReader.ReadLine(); + } + } + + private DataTable getTableOfNewAdjustedValues( 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; + 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 + { + 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 = ConstantsProvider.TimeOutValue; + HttpWebResponse hwr = (HttpWebResponse)Req.GetResponse(); + Stream strm = hwr.GetResponseStream(); + StreamReader sr = new StreamReader(strm); + this.addNewAdjustedValueInTable(sr, table); + sr.Close(); + strm.Close(); + //hwr.Close(); + } + catch (Exception exception) + { + MessageBox.Show( exception.ToString() ); + } + return table; + } + + private void addValuesToTable( StreamReader streamReader ) + { + string Line; + string[] LineIn; + Line = streamReader.ReadLine(); + Line = streamReader.ReadLine(); + + while ( Line != null && ! Line.StartsWith("<")) + { + LineIn=Line.Split(','); + + DataRow myRow =this.downloadedValuesFromSource.NewRow(); + + myRow[ "quTicker" ] = this.p_quTicker; + 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] ); + + this.downloadedValuesFromSource.Rows.Add(myRow); + + Line = streamReader.ReadLine(); + } + } + + private void importTickerForCurrentTimeFrame( DateTime currBeginDate , DateTime currEndDate ) { *************** *** 106,112 **** StreamReader sr = new StreamReader(strm); ! DataBaseImporter dataBaseImporter = ! new DataBaseImporter( this.oleDbConnection1 , sr, this.p_myForm.radioButtonOverWriteYes.Checked ); ! dataBaseImporter.ImportTicker( p_quTicker ); sr.Close(); strm.Close(); --- 217,225 ---- StreamReader sr = new StreamReader(strm); ! //DataBaseImporter dataBaseImporter = ! //new DataBaseImporter( this.oleDbConnection1 , sr, this.p_myForm.radioButtonOverWriteYes.Checked ); ! //dataBaseImporter.ImportTicker( p_quTicker ); ! this.addValuesToTable(sr); ! sr.Close(); strm.Close(); *************** *** 127,134 **** } ! private void setTimeFrameAndImportTickerForEachTimeFrame(double numDaysOfTimeFrame) { ! if(numDaysOfTimeFrame == 0) ! return; DateTime currBeginDate = new DateTime(); --- 240,246 ---- } ! private DataTable getTableOfDownloadedValues() { ! double numDaysOfTimeFrame = ConstantsProvider.MaxNumDaysDownloadedAtEachConnection; DateTime currBeginDate = new DateTime(); *************** *** 144,147 **** --- 256,261 ---- currBeginDate = currEndDate.AddDays( 1 ); } + return this.downloadedValuesFromSource; + } *************** *** 151,155 **** --- 265,271 ---- newRow[ "tiTicker" ] = p_quTicker; newRow[ "currentState" ] = "Searching ..."; + newRow[ "databaseUpdated" ] = "No"; newRow[ "adjustedClose"] = "..."; + newRow[ "adjCloseToCloseRatio"] = "..."; try { *************** *** 175,179 **** this.endDate = Quotes.GetStartDate(this.p_quTicker); this.resetStartDateIfNecessary(); ! this.setTimeFrameAndImportTickerForEachTimeFrame(200); } --- 291,295 ---- this.endDate = Quotes.GetStartDate(this.p_quTicker); this.resetStartDateIfNecessary(); ! this.checkForNewAdjustedAndContinueOrStop(); } *************** *** 192,196 **** } ! private void checkForNewAdjustedValueFromSource() { try --- 308,312 ---- } ! private void checkForNewAdjustedAndContinueOrStop() { try *************** *** 199,206 **** --- 315,334 ---- { 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 + { + this.updateCurrentStatusAdjustedCloseToCloseRatio("OK"); + } } else + //download is executed { this.updateCurrentStatusAdjustedClose("OK"); + this.commitDownloadedValuesToDatabase(); } } *************** *** 217,223 **** this.startDate = Quotes.GetEndDate(this.p_quTicker); this.endDate = DateTime.Today; ! this.checkForNewAdjustedValueFromSource(); ! this.setTimeFrameAndImportTickerForEachTimeFrame(200); ! } --- 345,349 ---- this.startDate = Quotes.GetEndDate(this.p_quTicker); this.endDate = DateTime.Today; ! this.checkForNewAdjustedAndContinueOrStop(); } *************** *** 235,243 **** return Single.Parse(LineIn[6]); } public void DownloadTicker() { // update grid in webdownloader form ! addTickerTo_gridDataSet(); this.numberOfQuotesInDatabase = Quotes.GetNumberOfQuotes(this.p_quTicker); if(this.numberOfQuotesInDatabase>0 && p_myForm.IsUpdateOptionSelected) // there are some ticker's quotes in the database and --- 361,425 ---- return Single.Parse(LineIn[6]); } + + 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"); + } + + private void resetAndImportTicker() + { + this.resetStartDateIfNecessary(); + this.commitDownloadedValuesToDatabase(); + } + + + public void DownloadTicker() { // update grid in webdownloader form ! this.downloadedValuesFromSource.Rows.Clear(); ! addTickerTo_gridDataSet(); this.numberOfQuotesInDatabase = Quotes.GetNumberOfQuotes(this.p_quTicker); + if(this.numberOfQuotesInDatabase < 1) + // ticker's quotes are downloaded for the first time + { + this.resetAndImportTicker(); + } + // in all these cases some ticker's quotes are in the database + // and the options choosen by the user in the web downloader form are checked + else if(this.p_myForm.IsOnlyAfterLastQuoteSelected && + this.numberOfQuotesInDatabase >= 1) + { + this.downloadTickerAfterLastQuote(); + } + else if(this.p_myForm.IsBeforeAndAfterSelected && + this.numberOfQuotesInDatabase >= 1) + { + this.downloadTickerBeforeFirstQuote(); + this.downloadTickerAfterLastQuote(); + } + else if(this.p_myForm.IsOverWriteNoSelected && + this.numberOfQuotesInDatabase >= 1) + { + this.resetStartDateIfNecessary(); + this.checkForNewAdjustedAndContinueOrStop(); + } + else if(this.p_myForm.IsOverWriteYesSelected && + this.numberOfQuotesInDatabase >= 1) + { + this.resetAndImportTicker(); + } + + // ticker's quotes are downloaded for the first time or + // the user has chosen to download all quotes + + + /* + if(this.numberOfQuotesInDatabase>0 && p_myForm.IsUpdateOptionSelected) // there are some ticker's quotes in the database and *************** *** 262,267 **** setTimeFrameAndImportTickerForEachTimeFrame(200); } ! //Monitor.Pulse( p_myForm.dsTickerCurrentlyDownloaded.Tables[ "Tickers" ] ); ! } public void DownloadTicker(DateTime startingDate) --- 444,450 ---- setTimeFrameAndImportTickerForEachTimeFrame(200); } ! ! */ ! } public void DownloadTicker(DateTime startingDate) Index: DataBaseImporter.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/DataBaseImporter.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DataBaseImporter.cs 17 Apr 2004 14:16:29 -0000 1.6 --- DataBaseImporter.cs 11 May 2004 22:06:40 -0000 1.7 *************** *** 64,68 **** public void ImportTicker( string ticker ) { ! string Line; string[] LineIn; --- 64,72 ---- public void ImportTicker( string ticker ) { ! //all quotes are deleted if in the web downloader form ! // the radio button "over Write existing record" is checked ! if(this.overWriteExistingRecords) ! Quotes.Delete(ticker); ! string Line; string[] LineIn; *************** *** 100,107 **** myDataSet.Tables["Data"].Rows.Add(myRow);*/ ! //the corresponding record is deleted if in the web downloader form ! // the radio button "over Write existing record" is checked ! if(this.overWriteExistingRecords) ! Quotes.Delete(ticker, DateTime.Parse( LineIn[0] )); Quotes.Add(ticker,DateTime.Parse( LineIn[0] ), Double.Parse( LineIn[1] ), Double.Parse(LineIn[2]), Double.Parse(LineIn[3]), Double.Parse(LineIn[4]), --- 104,108 ---- myDataSet.Tables["Data"].Rows.Add(myRow);*/ ! Quotes.Add(ticker,DateTime.Parse( LineIn[0] ), Double.Parse( LineIn[1] ), Double.Parse(LineIn[2]), Double.Parse(LineIn[3]), Double.Parse(LineIn[4]), |