[Quantproject-developers] QuantProject/b1_ADT ExtendedDataTable.cs,1.9,1.10
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2005-06-25 10:02:08
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19468/b1_ADT Modified Files: ExtendedDataTable.cs Log Message: Added GetRatesOfReturnsFromColumns method Index: ExtendedDataTable.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ExtendedDataTable.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ExtendedDataTable.cs 10 Jun 2005 18:52:00 -0000 1.9 --- ExtendedDataTable.cs 25 Jun 2005 10:01:54 -0000 1.10 *************** *** 161,165 **** } ! /// <summary> /// It returns a hashtable containing the common values in two --- 161,191 ---- } ! /// <summary> ! /// Get an array of float corresponding to the rates of return ! /// of columnA with respect to columnB ! /// </summary> ! public static float[] GetRatesOfReturnsFromColumns(DataTable table, ! string columnAName, string columnBName) ! { ! int numRows = table.Rows.Count; ! float[] arrayOfFloat = new float[numRows]; ! int index = 0; ! try ! { ! for(; index!= numRows; index++) ! { ! arrayOfFloat[index] = (float) table.Rows[index][columnAName] / ! (float) table.Rows[index][columnBName] - 1; ! } ! ! } ! catch(Exception ex) ! { ! MessageBox.Show(ex.ToString()); ! index = numRows; //for getting out of the for block ! } ! return arrayOfFloat; ! ! } /// <summary> /// It returns a hashtable containing the common values in two |