[Quantproject-developers] QuantProject/b2_DataAccess/Tables Tickers_tickerGroups.cs,1.6,1.7
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2005-09-07 06:45:24
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21377/b2_DataAccess/Tables Modified Files: Tickers_tickerGroups.cs Log Message: Fixed bug in GetTickers method Index: Tickers_tickerGroups.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Tickers_tickerGroups.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Tickers_tickerGroups.cs 27 Aug 2005 19:20:26 -0000 1.6 --- Tickers_tickerGroups.cs 7 Sep 2005 06:45:17 -0000 1.7 *************** *** 136,153 **** } - private static void getTickers_createView(string viewName, - string sqlStatement) - { - try - { - string sqlForViewCreation = "CREATE VIEW " + viewName + " AS " + sqlStatement; - SqlExecutor.ExecuteNonQuery(sqlForViewCreation); - } - catch(Exception ex) - { - ex = ex; - } - } - /// <summary> /// It returns a table containing tickers effectively contained --- 136,139 ---- *************** *** 157,182 **** { ! string sqlLastEntries = "SELECT tickers_tickerGroups.ttTgId AS GroupIDEntries, " + ! "tickers_tickerGroups.ttTiId AS TickerIDEntries, Max(tickers_tickerGroups.ttEventDate) " + ! "AS MaxEntryDate FROM tickers_tickerGroups WHERE " + ! "tickers_tickerGroups.ttEventType='I' " + ! "GROUP BY tickers_tickerGroups.ttTgId, tickers_tickerGroups.ttTiId"; ! getTickers_createView("Entries", sqlLastEntries); ! ! string sqlLastExits = "SELECT tickers_tickerGroups.ttTgId AS GroupIDExits, " + ! "tickers_tickerGroups.ttTiId AS TickerIDExits, Max(tickers_tickerGroups.ttEventDate) " + ! "AS MaxExitDate FROM tickers_tickerGroups WHERE " + ! "tickers_tickerGroups.ttEventType='O' " + ! "GROUP BY tickers_tickerGroups.ttTgId, tickers_tickerGroups.ttTiId"; ! ! getTickers_createView("Exits", sqlLastExits); ! ! string sqlTickersAtTheGivenDate = "SELECT GroupIDEntries, " + ! "TickerIDEntries FROM Entries LEFT JOIN Exits " + ! "ON (Entries.GroupIDEntries = Exits.GroupIDExits) AND " + ! "(Entries.TickerIDEntries = Exits.TickerIDExits) WHERE " + ! "GroupIDEntries ='" + groupID + "' AND " + ! "MaxEntryDate<=" + SQLBuilder.GetDateConstant(date) + " AND " + ! "(MaxExitDate Is Null OR MaxEntryDate>Exits.MaxExitDate)"; return SqlExecutor.GetDataTable(sqlTickersAtTheGivenDate); --- 143,154 ---- { ! string sqlTickersAtTheGivenDate = "SELECT ttTiId AS TickerID FROM tickers_tickerGroups " + ! "WHERE ttTgId='" + groupID + "' AND " + ! "ttEventDate<=" + SQLBuilder.GetDateConstant(date) + " " + ! "GROUP BY ttTiId " + ! "HAVING Right(Max(Year([ttEventDate]) & " + ! "IIf(Month([ttEventDate])<10,'0' & Month([ttEventDate]),Month([ttEventDate])) & " + ! "IIf(Day([ttEventDate])<10,'0' & Day([ttEventDate]),Day([ttEventDate])) & " + ! "[ttEventType]),1)='I'"; return SqlExecutor.GetDataTable(sqlTickersAtTheGivenDate); |