[Quantproject-developers] QuantProject/b3_Data/DataTables Quotes.cs, 1.33, 1.34
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2007-07-13 10:08:05
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23694/b3_Data/DataTables Modified Files: Quotes.cs Log Message: public static History GetAdjustedCloseHistory( string ticker, DateTime firstQuoteDate, DateTime lastQuoteDate ) has been added. public static float[] GetArrayOfCloseToCloseRatios( string ticker , DateTime firstQuoteDate , DateTime lastQuoteDate ) has been added. GetMarketDays returns a History now (it returned a SortedList in the previous version). Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/Quotes.cs,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Quotes.cs 9 Apr 2007 17:48:47 -0000 1.33 --- Quotes.cs 13 Jul 2007 10:07:59 -0000 1.34 *************** *** 2,12 **** using System.Collections; using System.Data; using System.Text; using QuantProject.ADT; using QuantProject.ADT.Statistics; using QuantProject.ADT.Histories; using QuantProject.DataAccess; using QuantProject.DataAccess.Tables; - using System.Runtime.Serialization; namespace QuantProject.Data.DataTables --- 2,14 ---- using System.Collections; using System.Data; + using System.Runtime.Serialization; using System.Text; + using QuantProject.ADT; + using QuantProject.ADT.Collections; using QuantProject.ADT.Statistics; using QuantProject.ADT.Histories; using QuantProject.DataAccess; using QuantProject.DataAccess.Tables; namespace QuantProject.Data.DataTables *************** *** 720,732 **** } ! public static float[] GetArrayOfCloseToCloseRatios(string ticker, ! ref DateTime firstQuoteDate, ! DateTime lastQuoteDate, ! int numDaysBetweenEachClose) ! { ! return GetArrayOfCloseToCloseRatios(ticker, ref firstQuoteDate, lastQuoteDate, numDaysBetweenEachClose, ! 0); ! } ! public static float[] GetArrayOfAdjustedCloseQuotes(string ticker, DateTime firstQuoteDate, --- 722,734 ---- } ! public static float[] GetArrayOfCloseToCloseRatios(string ticker, ! ref DateTime firstQuoteDate, ! DateTime lastQuoteDate, ! int numDaysBetweenEachClose) ! { ! return GetArrayOfCloseToCloseRatios(ticker, ref firstQuoteDate, lastQuoteDate, numDaysBetweenEachClose, ! 0); ! } ! public static float[] GetArrayOfAdjustedCloseQuotes(string ticker, DateTime firstQuoteDate, *************** *** 736,739 **** --- 738,787 ---- return ExtendedDataTable.GetArrayOfFloatFromColumn(tickerQuotes,"quAdjustedClose"); } + #region GetAdjustedCloseHistory + private static History getAdjustedCloseHistory( Quotes tickerQuotes ) + { + History adjustedCloseHistory = new History(); + foreach ( DataRow dataRow in tickerQuotes.Rows ) + adjustedCloseHistory.Add( dataRow[ Quotes.Date ] , + dataRow[ Quotes.AdjustedClose ] ); + return adjustedCloseHistory; + } + /// <summary> + /// Returns the History of the adjusted close quotes, for the given ticker, + /// since the firstQuoteDate to the lastQuoteDate + /// </summary> + /// <param name="ticker"></param> + /// <param name="firstQuoteDate"></param> + /// <param name="lastQuoteDate"></param> + /// <returns></returns> + public static History GetAdjustedCloseHistory( string ticker, + DateTime firstQuoteDate, + DateTime lastQuoteDate ) + { + Quotes tickerQuotes = new Quotes( ticker , firstQuoteDate , lastQuoteDate); + return getAdjustedCloseHistory( tickerQuotes ); + } + #endregion GetAdjustedCloseHistory + #region GetArrayOfCloseToCloseRatios + /// <summary> + /// Returns the array of the adjusted close to adjusted close ratios, for + /// the given ticker, within the given period of time + /// </summary> + /// <param name="ticker"></param> + /// <param name="firstQuoteDate"></param> + /// <param name="lastQuoteDate"></param> + /// <returns></returns> + public static float[] GetArrayOfCloseToCloseRatios( + string ticker , + DateTime firstQuoteDate , + DateTime lastQuoteDate ) + { + float[] arrayOfAdjustedCloseQuotes = + GetArrayOfAdjustedCloseQuotes( ticker , firstQuoteDate , lastQuoteDate ); + float[] arrayOfCloseToCloseRatios = + FloatArrayManager.GetRatios( arrayOfAdjustedCloseQuotes ); + return arrayOfCloseToCloseRatios; + } + #endregion /// <summary> *************** *** 745,754 **** /// <param name="lastDate">end interval</param> /// <returns></returns> ! public static SortedList GetMarketDays( string ticker , DateTime firstDate , DateTime lastDate ) { Quotes quotes = new Quotes( ticker , firstDate , lastDate ); // DateTime[] marketDays = new DateTime[ quotes.Rows.Count ]; ! SortedList marketDays = new SortedList(); int i = 0; foreach ( DataRow dataRow in quotes.Rows ) --- 793,802 ---- /// <param name="lastDate">end interval</param> /// <returns></returns> ! public static History GetMarketDays( string ticker , DateTime firstDate , DateTime lastDate ) { Quotes quotes = new Quotes( ticker , firstDate , lastDate ); // DateTime[] marketDays = new DateTime[ quotes.Rows.Count ]; ! History marketDays = new History(); int i = 0; foreach ( DataRow dataRow in quotes.Rows ) |