[Quantproject-developers] QuantProject/b2_DataAccess/Tables Quotes.cs,1.4,1.5
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2004-05-08 17:10:42
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6123/b2_DataAccess/Tables Modified Files: Quotes.cs Log Message: - static fields have been created for field names - the SetDataTable static method has been added Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Quotes.cs 25 Apr 2004 17:37:52 -0000 1.4 --- Quotes.cs 8 May 2004 17:10:33 -0000 1.5 *************** *** 14,17 **** --- 14,30 ---- private DataTable quotes; + // these static fields provide field name in the database table + // They are intended to be used through intellisense when necessary + 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> *************** *** 29,32 **** --- 42,55 ---- } /// <summary> + /// Creates quotes for the given instrument, since the startDate to the endDate + /// </summary> + /// <param name="ticker"></param> + /// <param name="startDate"></param> + /// <param name="endDate"></param> + public Quotes( string ticker , DateTime startDate , DateTime endDate ) + { + /// TO DO + } + /// <summary> /// Returns the first date for the given ticker /// </summary> *************** *** 245,248 **** --- 268,288 ---- return SqlExecutor.GetDataTable( sql ); } + /// <summary> + /// Returns the quotes for the given instrument , since startDate to endDate + /// </summary> + /// <param name="ticker"></param> + /// <param name="startDate"></param> + /// <param name="endDate"></param> + /// <returns></returns> + public static void SetDataTable( string ticker , DateTime startDate , DateTime endDate , + DataTable dataTable) + { + string sql = + "select * from quotes " + + "where " + Quotes.TickerFieldName + "='" + ticker + "' " + + "and " + Quotes.Date + ">=" + SQLBuilder.GetDateConstant( startDate ) + + "and " + Quotes.Date + "<=" + SQLBuilder.GetDateConstant( endDate ); + SqlExecutor.SetDataTable( sql , dataTable ); + } /// <summary> |