[Quantproject-developers] QuantProject/b2_DataAccess/Tables Quotes.cs,1.22,1.23
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2005-04-14 18:33:44
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19250/b2_DataAccess/Tables Modified Files: Quotes.cs Log Message: Added new ITickerSelector object for advanced selection of tickers: with SelectorByWinningOpenToClose object it is now possible to choose tickers with a raw close greater than raw open at a given time interval within the specified group of tickers Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Quotes.cs 23 Mar 2005 21:28:42 -0000 1.22 --- Quotes.cs 14 Apr 2005 18:33:05 -0000 1.23 *************** *** 591,594 **** --- 591,620 ---- /// <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, + long maxNumOfReturnedTickers) + { + 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 " + + "WHERE quotes.quDate Between " + SQLBuilder.GetDateConstant(firstQuoteDate) + " " + + "AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + " " + + "AND " + "tickers_tickerGroups.ttTgId='" + groupID + "' " + + "AND " + "quotes.quClose > quotes.quOpen " + + "ORDER BY quotes.quClose/quotes.quOpen"; + string sortDirection = " DESC"; + if(orderInASCMode) + sortDirection = " ASC"; + sql = sql + sortDirection; + return SqlExecutor.GetDataTable( sql ); + } + + /// <summary> /// returns the average traded value for the given ticker in the specified interval /// </summary> |