[Quantproject-developers] QuantProject/b3_Data/DataTables Quotes.cs,1.22,1.23
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2006-01-08 23:38:51
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30312/b3_Data/DataTables Modified Files: Quotes.cs Log Message: Adde GetFirstValidAdjustedClose and GetFirstValidAdjustedOpen methods Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/Quotes.cs,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Quotes.cs 7 Jan 2006 10:56:09 -0000 1.22 --- Quotes.cs 8 Jan 2006 23:38:43 -0000 1.23 *************** *** 870,873 **** --- 870,886 ---- } /// <summary> + /// Gets the first valid adjusted close at the given date + /// </summary> + /// <returns></returns> + public float GetFirstValidAdjustedClose(DateTime date ) + { + object[] keys = new object[1]; + keys[0] = this.GetFirstValidQuoteDate(date.Date); + DataRow foundRow = this.Rows.Find(keys); + if(foundRow==null) + throw new Exception("No quote for such a date!"); + return (float)foundRow[Quotes.AdjustedClose]; + } + /// <summary> /// Gets the first valid raw (not adjusted) open at the given date /// </summary> *************** *** 883,886 **** --- 896,915 ---- } + /// <summary> + /// Gets the first valid adjusted open at the given date + /// </summary> + /// <returns></returns> + public float GetFirstValidAdjustedOpen(DateTime date ) + { + object[] keys = new object[1]; + keys[0] = this.GetFirstValidQuoteDate(date.Date); + DataRow foundRow = this.Rows.Find(keys); + if(foundRow==null) + throw new Exception("No quote for such a date!"); + + return (float)foundRow[Quotes.Open]*((float)foundRow[Quotes.AdjustedClose]/ + (float)foundRow[Quotes.Close]); + } + // public DateTime GetPrecedingDate( DateTime quoteDate , int precedingDays ) // { |