[Quantproject-developers] QuantProject/b2_DataAccess/Tables Quotes.cs,1.23,1.24
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2005-04-19 18:31:05
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17822/b2_DataAccess/Tables Modified Files: Quotes.cs Log Message: Added and fixed methods for the SelectorByWinningOpenToClose class. Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Quotes.cs 14 Apr 2005 18:33:05 -0000 1.23 --- Quotes.cs 19 Apr 2005 18:30:40 -0000 1.24 *************** *** 591,599 **** /// <summary> ! /// returns tickers having raw close greater than raw open ! /// at the given interval of days (within the given group of tickers). ! /// Tickers are ordered by raw close to open ratio. /// </summary> ! public static DataTable GetTickersByWinningOpenToClose( bool orderInASCMode, string groupID, DateTime firstQuoteDate, DateTime lastQuoteDate, --- 591,599 ---- /// <summary> ! /// returns tickers counting how many times raw close is greater than raw open ! /// for the given interval of days (within the given group of tickers). ! /// Tickers are ordered by the number of days raw open is greater than raw close /// </summary> ! public static DataTable GetTickersByOpenToCloseWinningDays( bool orderInASCMode, string groupID, DateTime firstQuoteDate, DateTime lastQuoteDate, *************** *** 601,605 **** { string sql = "SELECT TOP " + maxNumOfReturnedTickers + " quotes.quTicker, tickers.tiCompanyName, " + ! "quotes.quClose/quotes.quOpen AS CloseToOpenRatio " + "FROM (quotes INNER JOIN tickers ON quotes.quTicker=tickers.tiTicker) " + "INNER JOIN tickers_tickerGroups ON tickers.tiTicker=tickers_tickerGroups.ttTiId " + --- 601,605 ---- { string sql = "SELECT TOP " + maxNumOfReturnedTickers + " quotes.quTicker, tickers.tiCompanyName, " + ! "Count(quotes.quClose) AS CloseToOpenWinningDays " + "FROM (quotes INNER JOIN tickers ON quotes.quTicker=tickers.tiTicker) " + "INNER JOIN tickers_tickerGroups ON tickers.tiTicker=tickers_tickerGroups.ttTiId " + *************** *** 608,612 **** "AND " + "tickers_tickerGroups.ttTgId='" + groupID + "' " + "AND " + "quotes.quClose > quotes.quOpen " + ! "ORDER BY quotes.quClose/quotes.quOpen"; string sortDirection = " DESC"; if(orderInASCMode) --- 608,613 ---- "AND " + "tickers_tickerGroups.ttTgId='" + groupID + "' " + "AND " + "quotes.quClose > quotes.quOpen " + ! "GROUP BY quotes.quTicker, tickers.tiCompanyName " + ! "ORDER BY Count(quotes.quClose)"; string sortDirection = " DESC"; if(orderInASCMode) *************** *** 785,788 **** --- 786,815 ---- } + /// <summary> + /// Returns number of days for which raw close was greater than raw open + /// for the given interval of days (for the given ticker). + /// </summary> + public static int GetNumberOfOpenToCloseWinningDays(string ticker, + DateTime firstQuoteDate, + DateTime lastQuoteDate) + { + DataTable dt; + int returnValue = 0; + string sql = "SELECT Count(quotes.quClose) AS CloseToOpenWinningDays " + + "FROM quotes WHERE " + + "quotes.quDate Between " + SQLBuilder.GetDateConstant(firstQuoteDate) + " " + + "AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + " " + + "AND " + "quotes.quTicker='" + ticker + "' " + + "AND quotes.quClose > quotes.quOpen"; + + dt = SqlExecutor.GetDataTable( sql ); + if(dt.Rows.Count > 0) + returnValue = (int)dt.Rows[0][0]; + + return returnValue; + } + + + #region GetHashValue private string getHashValue_getQuoteString_getRowString_getSingleValueString( Object value ) |