[Quantproject-developers] QuantProject/b3_Data/Selectors TickerSelector.cs,1.8,1.9
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2004-08-28 16:42:09
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2891/b3_Data/Selectors Modified Files: TickerSelector.cs Log Message: Added method GetCommonTickers, in order to find common tickers in two given tables Index: TickerSelector.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/TickerSelector.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TickerSelector.cs 22 Aug 2004 16:56:26 -0000 1.8 --- TickerSelector.cs 28 Aug 2004 16:41:53 -0000 1.9 *************** *** 22,25 **** --- 22,26 ---- using System; + using System.Collections; using System.Data; using System.Windows.Forms; *************** *** 313,316 **** --- 314,337 ---- } + /// <summary> + /// It returns a DataTable, with only one column, containing tickers + /// that are contained in both the two tables passed as parameters + /// </summary> + /// <param name="firstDataTable">The first data table in which the column indexed 0 contains the first set of tickers' symbols</param> + /// <param name="secondDataTable">The second data table in which the column indexed 0 contains the second set of tickers' symbols</param> + public static DataTable GetTableOfCommonTickers(DataTable firstDataTable, DataTable secondDataTable) + { + DataTable commonTickers = new DataTable(); + commonTickers.Columns.Add("tiTicker", System.Type.GetType("System.String")); + Hashtable hashTable = ExtendedDataTable.GetCommonValues(firstDataTable, + secondDataTable,0,0); + object[] values = new object[1]; + foreach(DictionaryEntry element in hashTable ) + { + values[0]=element.Value; + commonTickers.Rows.Add(values); + } + return commonTickers; + } |