quantproject-developers Mailing List for QuantProject (Page 131)
Brought to you by:
glauco_1
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
(103) |
Dec
(67) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(52) |
Feb
(9) |
Mar
(69) |
Apr
(53) |
May
(80) |
Jun
(23) |
Jul
(24) |
Aug
(112) |
Sep
(9) |
Oct
|
Nov
(58) |
Dec
(93) |
| 2005 |
Jan
(90) |
Feb
(93) |
Mar
(61) |
Apr
(56) |
May
(37) |
Jun
(61) |
Jul
(55) |
Aug
(68) |
Sep
(25) |
Oct
(46) |
Nov
(41) |
Dec
(37) |
| 2006 |
Jan
(33) |
Feb
(7) |
Mar
(19) |
Apr
(27) |
May
(73) |
Jun
(49) |
Jul
(83) |
Aug
(66) |
Sep
(45) |
Oct
(16) |
Nov
(15) |
Dec
(7) |
| 2007 |
Jan
(14) |
Feb
(33) |
Mar
|
Apr
(21) |
May
|
Jun
(34) |
Jul
(18) |
Aug
(100) |
Sep
(39) |
Oct
(55) |
Nov
(12) |
Dec
(2) |
| 2008 |
Jan
(120) |
Feb
(133) |
Mar
(129) |
Apr
(104) |
May
(42) |
Jun
(2) |
Jul
(52) |
Aug
(99) |
Sep
(134) |
Oct
|
Nov
(137) |
Dec
(48) |
| 2009 |
Jan
(48) |
Feb
(55) |
Mar
(61) |
Apr
(3) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(51) |
Sep
|
Oct
(7) |
Nov
|
Dec
|
| 2010 |
Jan
(7) |
Feb
(1) |
Mar
(145) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(8) |
Dec
|
| 2011 |
Jan
(78) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(88) |
Sep
(6) |
Oct
(1) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Glauco S. <gl...@my...> - 2004-08-05 09:01:47
|
Ma sei sicuro che abbia senso utilizzare original close * volume? Non ne sono sicuro, ma mi sa che il volume sia un adjustedVolume e quindi debba essere moltiplicato per l'adjustedClose. At 10:55 PM 8/4/2004 +0000, you wrote: >Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables >In directory >sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30278/b2_DataAccess/Tables > >Modified Files: > Quotes.cs >Log Message: >Added new methods; >Fixed minor bugs (note that now the AverageTraded value is equal to: >original close * volume >and not adjustedClose * volume) > >Index: Quotes.cs >=================================================================== >RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v >retrieving revision 1.15 >retrieving revision 1.16 >diff -C2 -d -r1.15 -r1.16 >*** Quotes.cs 2 Aug 2004 23:19:02 -0000 1.15 >--- Quotes.cs 4 Aug 2004 22:55:09 -0000 1.16 >*************** >*** 394,398 **** > { > string sql = "SELECT TOP " + maxNumOfReturnedTickers + " > tickers.tiTicker, tickers.tiCompanyName, " + >! "Avg([quVolume]*[quAdjustedClose]) AS >AverageTradedValue " + > "FROM quotes INNER JOIN (tickers INNER JOIN > tickers_tickerGroups " + > "ON tickers.tiTicker = tickers_tickerGroups.ttTiId) " + >--- 394,398 ---- > { > string sql = "SELECT TOP " + maxNumOfReturnedTickers + " > tickers.tiTicker, tickers.tiCompanyName, " + >! "Avg([quVolume]*[quClose]) AS AverageTradedValue " + > "FROM quotes INNER JOIN (tickers INNER JOIN > tickers_tickerGroups " + > "ON tickers.tiTicker = tickers_tickerGroups.ttTiId) " + >*************** >*** 403,407 **** > SQLBuilder.GetDateConstant(lastQuoteDate) + > "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + >! "ORDER BY Avg([quVolume]*[quAdjustedClose])"; > string sortDirection = " DESC"; > if(orderInASCMode) >--- 403,407 ---- > SQLBuilder.GetDateConstant(lastQuoteDate) + > "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + >! "ORDER BY Avg([quVolume]*[quClose])"; > string sortDirection = " DESC"; > if(orderInASCMode) >*************** >*** 474,478 **** > DataTable dt; > string sql = "SELECT quotes.quTicker, " + >! "Avg([quVolume]*[quAdjustedClose]) AS AverageTradedValue " + > "FROM quotes WHERE quTicker ='" + > ticker + "' " + >--- 474,478 ---- > DataTable dt; > string sql = "SELECT quotes.quTicker, " + >! "Avg([quVolume]*[quClose]) AS AverageTradedValue " + > "FROM quotes WHERE quTicker ='" + > ticker + "' " + >*************** >*** 534,537 **** >--- 534,540 ---- > return (double)dt.Rows[0]["AdjCloseToCloseStandDev"]; > } >+ >+ >+ > > >*************** >*** 627,630 **** >--- 630,650 ---- > return SqlExecutor.GetDataTable( sql ); > } >+ >+ /// <summary> >+ /// returns the quotes DataTable for the given ticker >+ /// </summary> >+ /// <param name="instrumentKey">ticker whose quotes are to be >returned</param> >+ /// <param name="firstQuoteDate">The first quote date</param> >+ /// <param name="lastQuoteDate">The last quote date</param> >+ /// <returns></returns> >+ public static DataTable GetTickerQuotes( string instrumentKey, >DateTime firstQuoteDate, >+ DateTime lastQuoteDate) >+ { >+ string sql = "select * from quotes where quTicker='" + >instrumentKey + "' " + >+ "AND quotes.quDate BETWEEN " + >SQLBuilder.GetDateConstant(firstQuoteDate) + >+ " AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + " " + >+ "order by quDate"; >+ return SqlExecutor.GetDataTable( sql ); >+ } > /// <summary> > /// Returns the quotes for the given instrument , since > startDate to endDate > > > >------------------------------------------------------- >This SF.Net email is sponsored by OSTG. Have you noticed the changes on >Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, >one more big change to announce. We are now OSTG- Open Source Technology >Group. Come see the changes on the new OSTG site. www.ostg.com >_______________________________________________ >Quantproject-developers mailing list >Qua...@li... >https://lists.sourceforge.net/lists/listinfo/quantproject-developers |
|
From: Marco M. <mi...@us...> - 2004-08-04 23:07:23
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32422/Downloader/TickerSelectors Modified Files: TickerGroupsListViewMenu.cs TickerGroupsViewer.cs Log Message: Added methods for deletion of groups of tickers and single tickers inside a group Index: TickerGroupsViewer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors/TickerGroupsViewer.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TickerGroupsViewer.cs 27 Jun 2004 19:21:42 -0000 1.4 --- TickerGroupsViewer.cs 4 Aug 2004 23:07:01 -0000 1.5 *************** *** 38,42 **** /// TickerGroupsViewer. /// </summary> ! public class TickerGroupsViewer : System.Windows.Forms.Form, ITickerSelector, ITickerReceiver { private OleDbConnection oleDbConnection = ConnectionProvider.OleDbConnection; --- 38,43 ---- /// TickerGroupsViewer. /// </summary> ! public class TickerGroupsViewer : System.Windows.Forms.Form, ! ITickerSelector, ITickerReceiver, ITickerRemover { private OleDbConnection oleDbConnection = ConnectionProvider.OleDbConnection; *************** *** 163,171 **** string tickerDescription) { ! DataRow newRow = tableToFill.NewRow(); ! newRow["tiTicker"] = tickerID; ! newRow["tiCompanyName"] = tickerDescription; ! tableToFill.Rows.Add(newRow); } // implementation of ITickerSelector interface public void SelectAllTickers() --- 164,219 ---- string tickerDescription) { ! try ! { ! DataRow newRow = tableToFill.NewRow(); ! newRow["tiTicker"] = tickerID; ! newRow["tiCompanyName"] = tickerDescription; ! tableToFill.Rows.Add(newRow); ! } ! catch(Exception ex) ! { ! string notUsed = ex.ToString(); ! } } + + private void addTickerToTable(DataTable tableToFill, string tickerID) + + { + try + { + DataRow newRow = tableToFill.NewRow(); + newRow["tiTicker"] = tickerID; + newRow["tiCompanyName"] = "-"; + tableToFill.Rows.Add(newRow); + } + catch(Exception ex) + { + string notUsed = ex.ToString(); + } + } + + private void addTickersFromTableToTable(DataTable tableFrom, DataTable tableToFill) + + { + DataColumn[] columnPrimaryKeys = new DataColumn[1]; + columnPrimaryKeys[0] = tableToFill.Columns[0]; + tableToFill.PrimaryKey = columnPrimaryKeys; + + foreach(DataRow row in tableFrom.Rows) + { + try + { + DataRow newRow = tableToFill.NewRow(); + newRow["tiTicker"] = (string)row[0]; + newRow["tiCompanyName"] = "-"; + tableToFill.Rows.Add(newRow); + } + catch(Exception ex) + { + string notUsed = ex.ToString(); + } + } + } + // implementation of ITickerSelector interface public void SelectAllTickers() *************** *** 195,200 **** // so it stands for a group of tickers { ! ///TODO: add method to retrieve ! MessageBox.Show("NOT IMPLEMENTED YET"); } } --- 243,250 ---- // so it stands for a group of tickers { ! TreeNode node = (TreeNode)item.Tag; ! DataTable tickersInsideGroup = ! QuantProject.DataAccess.Tables.Tickers_tickerGroups.GetTickers((string)node.Tag); ! this.addTickersFromTableToTable(tickersInsideGroup, tableOfSelectedTickers); } } *************** *** 202,205 **** --- 252,291 ---- } + // implementation of ITickerRemover interface + public void RemoveTickers() + { + if(MessageBox.Show("Do you really want to delete the selected items?", + "Confirm deletion", + MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) + == DialogResult.No) + return; + //update database + foreach(ListViewItem item in this.SelectedListViewItems) + { + if(item.Tag is System.String ) + // the item contains in Tag property the ticker ID + Tickers_tickerGroups.Delete((string)item.Tag, + (string)this.treeViewGroups.SelectedNode.Tag); + else + // the item references to a node in the treeView : + // so it stands for a group of tickers + { + TreeNode node = (TreeNode)item.Tag; + TickerGroups.DeleteGroup((string)node.Tag); + node.Remove(); + } + } + + //update list view + for(int i = this.listViewGroupsAndTickers.SelectedItems.Count - 1;i>=0; + i=this.listViewGroupsAndTickers.SelectedItems.Count-1) + { + this.listViewGroupsAndTickers.SelectedItems[i].Remove(); + } + //refresh + this.treeViewGroups.Refresh(); + this.listViewGroupsAndTickers.Refresh(); + } + #region Windows Form Designer generated code /// <summary> Index: TickerGroupsListViewMenu.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors/TickerGroupsListViewMenu.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TickerGroupsListViewMenu.cs 11 May 2004 22:06:41 -0000 1.3 --- TickerGroupsListViewMenu.cs 4 Aug 2004 23:07:01 -0000 1.4 *************** *** 54,58 **** private void removeSelectedItems(object sender, System.EventArgs e) { ! //; } --- 54,59 ---- private void removeSelectedItems(object sender, System.EventArgs e) { ! ITickerRemover iTickerRemover = (ITickerRemover)this.parentForm; ! iTickerRemover.RemoveTickers(); } |
|
From: Marco M. <mi...@us...> - 2004-08-04 23:04:28
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31993/Downloader Modified Files: TickerDownloader.cs Log Message: Fixed minor bugs Index: TickerDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerDownloader.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TickerDownloader.cs 25 Jul 2004 12:12:15 -0000 1.11 --- TickerDownloader.cs 4 Aug 2004 23:04:20 -0000 1.12 *************** *** 219,230 **** this.setStreamsFromYahoo(currBeginDate, currEndDate); this.addCurrentStreamToTable(); - this.updateCurrentStatus(currEndDate.ToShortDateString()); if(this.streamReader!=null) this.streamReader.Close(); //this.updateCurrentStatus( d + "/" + e + "/" + f ); } catch (Exception exception) { ! MessageBox.Show( exception.ToString() ); /*updateCurrentStatus( "Trial: " + numTrials ); numTrials++; --- 219,234 ---- this.setStreamsFromYahoo(currBeginDate, currEndDate); this.addCurrentStreamToTable(); if(this.streamReader!=null) this.streamReader.Close(); + else + return; + this.updateCurrentStatus(currEndDate.ToShortDateString()); + //this.updateCurrentStatus( d + "/" + e + "/" + f ); } catch (Exception exception) { ! string notUsed = exception.ToString(); ! //MessageBox.Show( exception.ToString() ); /*updateCurrentStatus( "Trial: " + numTrials ); numTrials++; *************** *** 280,284 **** catch (Exception ex) { ! MessageBox.Show( ex.ToString() ); } p_myForm.dataGrid1.Refresh(); --- 284,289 ---- catch (Exception ex) { ! string notUsed = ex.ToString(); ! //MessageBox.Show( ex.ToString() ); } p_myForm.dataGrid1.Refresh(); *************** *** 348,352 **** catch(Exception ex) { ! MessageBox.Show(ex.ToString()); } } --- 353,358 ---- catch(Exception ex) { ! string notUsed = ex.ToString(); ! //MessageBox.Show(ex.ToString()); } } *************** *** 388,393 **** QuantProject.DataAccess.Tables.Quotes.ComputeCloseToCloseValues(this.downloadedValuesFromSource); this.adapter.OleDbDataAdapter.ContinueUpdateOnError = true; ! this.adapter.OleDbDataAdapter.Update(this.downloadedValuesFromSource); ! this.updateCurrentStatusDatabaseUpdated("YES"); } --- 394,402 ---- QuantProject.DataAccess.Tables.Quotes.ComputeCloseToCloseValues(this.downloadedValuesFromSource); this.adapter.OleDbDataAdapter.ContinueUpdateOnError = true; ! int rowsUpdated = this.adapter.OleDbDataAdapter.Update(this.downloadedValuesFromSource); ! if(rowsUpdated > 0) ! this.updateCurrentStatusDatabaseUpdated("YES"); ! else ! this.updateCurrentStatus("NOT FOUND"); } *************** *** 558,565 **** HttpWebResponse hwr; string url; ! //url = "http:" + "//ichart.yahoo.com/table.csv?a=" ! // + a + "&b=" + b + "&c=" + c +"&d=" + d + "&e=" + e + "&f=" + f + "&s=" + p_quTicker + "&y=0&g=d&ignore=.csv"; ! url = "http:" + "//table.finance.yahoo.com/table.csv?a=" ! + a + "&b=" + b + "&c=" + c +"&d=" + d + "&e=" + e + "&f=" + f + "&s=" + p_quTicker + "&y=0&g=d&ignore=.csv"; int numTrials = 1; while(numTrials < 5) --- 567,574 ---- HttpWebResponse hwr; string url; ! url = "http:" + "//ichart.yahoo.com/table.csv?a=" ! + a + "&b=" + b + "&c=" + c +"&d=" + d + "&e=" + e + "&f=" + f + "&s=" + p_quTicker + "&y=0&g=d&ignore=.csv"; ! //url = "http:" + "//table.finance.yahoo.com/table.csv?a=" ! // + a + "&b=" + b + "&c=" + c +"&d=" + d + "&e=" + e + "&f=" + f + "&s=" + p_quTicker + "&y=0&g=d&ignore=.csv"; int numTrials = 1; while(numTrials < 5) |
|
From: Marco M. <mi...@us...> - 2004-08-04 23:03:37
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31805/Downloader/TickerSelectors Modified Files: TickerSelectorForm.cs Log Message: Added methods to the TickerSelector for the computation (just for testing purpose) of correlationCoefficient for each possible couple of a given set of tickers. The results are shown through to the TickerSelectorForm Index: TickerSelectorForm.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors/TickerSelectorForm.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TickerSelectorForm.cs 2 Aug 2004 23:14:54 -0000 1.6 --- TickerSelectorForm.cs 4 Aug 2004 23:03:17 -0000 1.7 *************** *** 75,78 **** --- 75,80 ---- this.comboBoxAvailableSelectionRules.Text = "AverageCloseToClosePerformance"; this.comboBoxAvailableSelectionRules.Items.Add("AverageCloseToClosePerformance"); + this.comboBoxAvailableSelectionRules.Text = "CloseToCloseLinearCorrelation"; + this.comboBoxAvailableSelectionRules.Items.Add("CloseToCloseLinearCorrelation"); } *************** *** 353,356 **** --- 355,360 ---- else if (this.comboBoxAvailableSelectionRules.Text == "AverageCloseToClosePerformance") typeSelected = SelectionType.AverageCloseToClosePerformance; + else if (this.comboBoxAvailableSelectionRules.Text == "CloseToCloseLinearCorrelation") + typeSelected = SelectionType.CloseToCloseLinearCorrelation; return typeSelected; } |
|
From: Marco M. <mi...@us...> - 2004-08-04 23:02:26
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31496/b3_Data/Selectors Modified Files: SelectionType.cs TickerSelector.cs Log Message: Added methods to the TickerSelector for the computation (just for testing purpose) of correlationCoefficient for each possible couple of a given set of tickers. The results are shown through to the TickerSelectorForm Index: SelectionType.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/SelectionType.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SelectionType.cs 2 Aug 2004 23:19:02 -0000 1.4 --- SelectionType.cs 4 Aug 2004 23:02:06 -0000 1.5 *************** *** 33,38 **** Performance, AverageCloseToClosePerformance, ! Volatility/* ! StatisticalCorrelation*/ } } \ No newline at end of file --- 33,38 ---- Performance, AverageCloseToClosePerformance, ! Volatility, ! CloseToCloseLinearCorrelation } } \ No newline at end of file Index: TickerSelector.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/TickerSelector.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TickerSelector.cs 2 Aug 2004 23:19:02 -0000 1.6 --- TickerSelector.cs 4 Aug 2004 23:02:06 -0000 1.7 *************** *** 144,147 **** --- 144,149 ---- case SelectionType.AverageCloseToClosePerformance: return this.getTickersByAverageCloseToClosePerformance(); + case SelectionType.CloseToCloseLinearCorrelation: + return this.getTickersByCloseToCloseLinearCorrelation(); //this line should never be reached! default: *************** *** 218,221 **** --- 220,231 ---- } + private DataTable getTickersByCloseToCloseLinearCorrelation() + { + return QuantProject.Data.DataTables.Quotes.GetTickersByAdjCloseToClosePearsonCorrelationCoefficient(this.isOrderedInASCMode, + this.setOfTickersToBeSelected, + this.firstQuoteDate, + this.lastQuoteDate); + } + public void SelectAllTickers() { |
|
From: Marco M. <mi...@us...> - 2004-08-04 23:02:26
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31496/b3_Data/DataTables Modified Files: Quotes.cs Log Message: Added methods to the TickerSelector for the computation (just for testing purpose) of correlationCoefficient for each possible couple of a given set of tickers. The results are shown through to the TickerSelectorForm Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/Quotes.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Quotes.cs 2 Aug 2004 23:19:02 -0000 1.5 --- Quotes.cs 4 Aug 2004 23:02:05 -0000 1.6 *************** *** 97,100 **** --- 97,155 ---- } + /// <summary> + /// Returns a table containing the Pearson correlation coefficient of the adjusted close to close ratios + /// for any possible couple of tickers contained in the given table, for the specified interval + /// (the function has been implemented just for testing purposes) + /// </summary> + public static DataTable GetTickersByAdjCloseToClosePearsonCorrelationCoefficient( bool orderByASC, + DataTable setOfTickers, + DateTime firstQuoteDate, + DateTime lastQuoteDate) + + { + if(!setOfTickers.Columns.Contains("PearsonCorrelationCoefficient")) + setOfTickers.Columns.Add("PearsonCorrelationCoefficient", System.Type.GetType("System.Double")); + int initialNumberOfRows = setOfTickers.Rows.Count; + char[] separator = new char[1]; + separator[0] = ';'; + for(int j=0; j!= setOfTickers.Rows.Count; j++) + { + string firstTicker = (string)setOfTickers.Rows[j][0]; + if(firstTicker.IndexOfAny(separator)== -1) + { + for(int i = 0; i!= setOfTickers.Rows.Count; i++) + { + string secondTicker = (string)setOfTickers.Rows[i][0]; + + if(secondTicker.IndexOfAny(separator)== -1) + { + DataTable dtFirstTicker = QuantProject.DataAccess.Tables.Quotes.GetTickerQuotes(firstTicker, + firstQuoteDate, + lastQuoteDate); + + DataTable dtSecondTicker = QuantProject.DataAccess.Tables.Quotes.GetTickerQuotes(secondTicker, + firstQuoteDate, + lastQuoteDate); + DataRow rowToAdd = setOfTickers.NewRow(); + rowToAdd[0]=firstTicker + ";" + secondTicker; + try + { + rowToAdd["PearsonCorrelationCoefficient"] = + QuantProject.ADT.Statistics.BasicFunctions.PearsonCorrelationCoefficient( + ExtendedDataTable.GetArrayOfFloatFromColumn(dtFirstTicker, "quAdjustedCloseToCloseRatio"), + ExtendedDataTable.GetArrayOfFloatFromColumn(dtSecondTicker, "quAdjustedCloseToCloseRatio")); + setOfTickers.Rows.Add(rowToAdd); + } + catch(Exception ex) + { + string notUsed = ex.ToString(); + } + } + } + } + } + return ExtendedDataTable.CopyAndSort(setOfTickers,"PearsonCorrelationCoefficient", orderByASC); + } + private History history; |
|
From: Marco M. <mi...@us...> - 2004-08-04 22:56:40
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30543/b2_DataAccess/Tables Modified Files: Tickers_tickerGroups.cs Log Message: Added methods to the class Index: Tickers_tickerGroups.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Tickers_tickerGroups.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Tickers_tickerGroups.cs 25 Jul 2004 12:08:53 -0000 1.3 --- Tickers_tickerGroups.cs 4 Aug 2004 22:56:29 -0000 1.4 *************** *** 91,95 **** groupID + "'"); } ! /// <summary> /// It returns true if some tickers are grouped in the given groupID --- 91,106 ---- groupID + "'"); } ! /* ! /// <summary> ! /// It returns a table containing all the tickers ! /// gained through a recursion through all the groups contained in the given groupID ! /// </summary> ! public static DataTable GetTickersWithRecursionInsideGroup( string groupID) ! { ! /// TO DO use a join in order to return a table with tiTicker and company name ! ! } ! */ ! /// <summary> /// It returns true if some tickers are grouped in the given groupID |
|
From: Marco M. <mi...@us...> - 2004-08-04 22:55:31
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30278/b2_DataAccess/Tables Modified Files: Quotes.cs Log Message: Added new methods; Fixed minor bugs (note that now the AverageTraded value is equal to: original close * volume and not adjustedClose * volume) Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Quotes.cs 2 Aug 2004 23:19:02 -0000 1.15 --- Quotes.cs 4 Aug 2004 22:55:09 -0000 1.16 *************** *** 394,398 **** { string sql = "SELECT TOP " + maxNumOfReturnedTickers + " tickers.tiTicker, tickers.tiCompanyName, " + ! "Avg([quVolume]*[quAdjustedClose]) AS AverageTradedValue " + "FROM quotes INNER JOIN (tickers INNER JOIN tickers_tickerGroups " + "ON tickers.tiTicker = tickers_tickerGroups.ttTiId) " + --- 394,398 ---- { string sql = "SELECT TOP " + maxNumOfReturnedTickers + " tickers.tiTicker, tickers.tiCompanyName, " + ! "Avg([quVolume]*[quClose]) AS AverageTradedValue " + "FROM quotes INNER JOIN (tickers INNER JOIN tickers_tickerGroups " + "ON tickers.tiTicker = tickers_tickerGroups.ttTiId) " + *************** *** 403,407 **** SQLBuilder.GetDateConstant(lastQuoteDate) + "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + ! "ORDER BY Avg([quVolume]*[quAdjustedClose])"; string sortDirection = " DESC"; if(orderInASCMode) --- 403,407 ---- SQLBuilder.GetDateConstant(lastQuoteDate) + "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + ! "ORDER BY Avg([quVolume]*[quClose])"; string sortDirection = " DESC"; if(orderInASCMode) *************** *** 474,478 **** DataTable dt; string sql = "SELECT quotes.quTicker, " + ! "Avg([quVolume]*[quAdjustedClose]) AS AverageTradedValue " + "FROM quotes WHERE quTicker ='" + ticker + "' " + --- 474,478 ---- DataTable dt; string sql = "SELECT quotes.quTicker, " + ! "Avg([quVolume]*[quClose]) AS AverageTradedValue " + "FROM quotes WHERE quTicker ='" + ticker + "' " + *************** *** 534,537 **** --- 534,540 ---- return (double)dt.Rows[0]["AdjCloseToCloseStandDev"]; } + + + *************** *** 627,630 **** --- 630,650 ---- return SqlExecutor.GetDataTable( sql ); } + + /// <summary> + /// returns the quotes DataTable for the given ticker + /// </summary> + /// <param name="instrumentKey">ticker whose quotes are to be returned</param> + /// <param name="firstQuoteDate">The first quote date</param> + /// <param name="lastQuoteDate">The last quote date</param> + /// <returns></returns> + public static DataTable GetTickerQuotes( string instrumentKey, DateTime firstQuoteDate, + DateTime lastQuoteDate) + { + string sql = "select * from quotes where quTicker='" + instrumentKey + "' " + + "AND quotes.quDate BETWEEN " + SQLBuilder.GetDateConstant(firstQuoteDate) + + " AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + " " + + "order by quDate"; + return SqlExecutor.GetDataTable( sql ); + } /// <summary> /// Returns the quotes for the given instrument , since startDate to endDate |
|
From: Marco M. <mi...@us...> - 2004-08-04 22:50:48
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29597/b1_ADT Modified Files: ExtendedDataTable.cs Log Message: Updated ExtendedDataTable class Index: ExtendedDataTable.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ExtendedDataTable.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExtendedDataTable.cs 25 Jul 2004 12:08:52 -0000 1.3 --- ExtendedDataTable.cs 4 Aug 2004 22:50:40 -0000 1.4 *************** *** 1,4 **** --- 1,6 ---- using System; using System.Data; + using System.Windows.Forms; + namespace QuantProject.ADT *************** *** 57,61 **** --- 59,89 ---- } } + + /// <summary> + /// Get an array of float corresponding to a column compatible with the float type in a given data table + /// </summary> + public static float[] GetArrayOfFloatFromColumn(DataTable table, + string columnName) + { + int numRows = table.Rows.Count; + float[] arrayOfFloat = new float[numRows]; + int index = 0; + try + { + for(; index!= numRows; index++) + { + arrayOfFloat[index] = (float) table.Rows[index][columnName]; + } + } + catch(Exception ex) + { + MessageBox.Show(ex.ToString()); + index = numRows; + } + return arrayOfFloat; + + } + } } |
|
From: Marco M. <mi...@us...> - 2004-08-04 22:49:38
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29350/b1_ADT Modified Files: b1_ADT.csproj Log Message: Added overloaded methods to the class Index: b1_ADT.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/b1_ADT.csproj,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** b1_ADT.csproj 27 Jun 2004 19:15:02 -0000 1.7 --- b1_ADT.csproj 4 Aug 2004 22:49:27 -0000 1.8 *************** *** 73,76 **** --- 73,81 ---- HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll" /> + <Reference + Name = "System.Windows.Forms" + AssemblyName = "System.Windows.Forms" + HintPath = "..\..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll" + /> </References> </Build> |
|
From: Marco M. <mi...@us...> - 2004-08-04 22:49:38
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Statistics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29350/b1_ADT/Statistics Modified Files: BasicFunctions.cs Log Message: Added overloaded methods to the class Index: BasicFunctions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Statistics/BasicFunctions.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BasicFunctions.cs 2 Aug 2004 23:20:26 -0000 1.2 --- BasicFunctions.cs 4 Aug 2004 22:49:27 -0000 1.3 *************** *** 30,35 **** public class BasicFunctions { ! static public double Sum( double[] data ) { double sum = 0; --- 30,44 ---- public class BasicFunctions { + static public double Sum( double[] data ) + { + double sum = 0; + for( int i = 0; i < data.Length ; i ++ ) + { + sum += data[ i ]; + } + return sum; + } ! static public double Sum( float[] data ) { double sum = 0; *************** *** 40,44 **** return sum; } ! static public double SumOfSquares( double[] data ) { double sumOfSquares = 0; --- 49,63 ---- return sum; } ! static public double SumOfSquares( double[] data ) ! { ! double sumOfSquares = 0; ! for( int i = 0; i < data.Length ; i ++ ) ! { ! sumOfSquares += data[ i ]*data[ i ]; ! } ! return sumOfSquares; ! } ! ! static public double SumOfSquares( float[] data ) { double sumOfSquares = 0; *************** *** 49,59 **** return sumOfSquares; } ! static public double SimpleAverage( double[] data ) { return BasicFunctions.Sum(data)/data.Length; } ! ! static public double Variance( double[] data ) { double sum = BasicFunctions.Sum(data); --- 68,88 ---- return sumOfSquares; } + + static public double SimpleAverage( double[] data ) + { + return BasicFunctions.Sum(data)/data.Length; + } ! static public double SimpleAverage( float[] data ) { return BasicFunctions.Sum(data)/data.Length; } ! static public double Variance( double[] data ) ! { ! double sum = BasicFunctions.Sum(data); ! double sumOfSquares = BasicFunctions.SumOfSquares(data); ! return (sumOfSquares - sum*sum/data.Length)/data.Length; ! } ! static public double Variance( float[] data ) { double sum = BasicFunctions.Sum(data); *************** *** 61,70 **** return (sumOfSquares - sum*sum/data.Length)/data.Length; } ! ! static public double StdDev( double[] data ) { return System.Math.Sqrt(BasicFunctions.Variance(data)); } ! static public double PearsonCorrelationCoefficient( double[] firstDataVariable, double[] secondDataVariable ) --- 90,102 ---- return (sumOfSquares - sum*sum/data.Length)/data.Length; } ! static public double StdDev( double[] data ) ! { ! return System.Math.Sqrt(BasicFunctions.Variance(data)); ! } ! static public double StdDev( float[] data ) { return System.Math.Sqrt(BasicFunctions.Variance(data)); } ! static public double PearsonCorrelationCoefficient( double[] firstDataVariable, double[] secondDataVariable ) *************** *** 73,76 **** --- 105,120 ---- double simpleAvgOfProduct = BasicFunctions.SimpleAverageOfProduct(firstDataVariable, secondDataVariable); double productOfSimpleAvgs = BasicFunctions.SimpleAverage(firstDataVariable) * + BasicFunctions.SimpleAverage(secondDataVariable); + double stdDevOfFirst = BasicFunctions.StdDev(firstDataVariable); + double stdDevOfSecond = BasicFunctions.StdDev(secondDataVariable); + + return (simpleAvgOfProduct - productOfSimpleAvgs)/(stdDevOfFirst*stdDevOfSecond); + } + static public double PearsonCorrelationCoefficient( float[] firstDataVariable, + float[] secondDataVariable ) + { + BasicFunctions.checkLengthOfDataVariables(firstDataVariable, secondDataVariable); + double simpleAvgOfProduct = BasicFunctions.SimpleAverageOfProduct(firstDataVariable, secondDataVariable); + double productOfSimpleAvgs = BasicFunctions.SimpleAverage(firstDataVariable) * BasicFunctions.SimpleAverage(secondDataVariable); double stdDevOfFirst = BasicFunctions.StdDev(firstDataVariable); *************** *** 81,85 **** static public double SimpleAverageOfProduct( double[] firstDataVariable, ! double[] secondDataVariable ) { BasicFunctions.checkLengthOfDataVariables(firstDataVariable, secondDataVariable); --- 125,129 ---- static public double SimpleAverageOfProduct( double[] firstDataVariable, ! double[] secondDataVariable ) { BasicFunctions.checkLengthOfDataVariables(firstDataVariable, secondDataVariable); *************** *** 93,98 **** return BasicFunctions.SimpleAverage(productDataVariable); } static private void checkLengthOfDataVariables(double[] firstDataVariable, ! double[] secondDataVariable) { if(firstDataVariable.Length !=secondDataVariable.Length) --- 137,161 ---- return BasicFunctions.SimpleAverage(productDataVariable); } + static public double SimpleAverageOfProduct( float[] firstDataVariable, + float[] secondDataVariable ) + { + BasicFunctions.checkLengthOfDataVariables(firstDataVariable, secondDataVariable); + double[] productDataVariable = new double[firstDataVariable.Length]; + + for( int i = 0; i < firstDataVariable.Length ; i ++ ) + { + productDataVariable[i]= firstDataVariable[i]*secondDataVariable[i]; + } + + return BasicFunctions.SimpleAverage(productDataVariable); + } + static private void checkLengthOfDataVariables(float[] firstDataVariable, + float[] secondDataVariable) + { + if(firstDataVariable.Length !=secondDataVariable.Length) + throw new Exception("The two variables haven't the same length!"); + } static private void checkLengthOfDataVariables(double[] firstDataVariable, ! double[] secondDataVariable) { if(firstDataVariable.Length !=secondDataVariable.Length) |
|
From: Marco M. <mi...@us...> - 2004-08-04 22:48:08
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29109/b3_Data/Selectors Added Files: ITickerRemover.cs Log Message: Added ITickerRemover interface used by the ContextMenu object for TickerGroupsViewer form --- NEW FILE: ITickerRemover.cs --- /* QuantProject - Quantitative Finance Library ITickerRemover.cs Copyright (C) 2004 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Data; namespace QuantProject.Data.Selectors { /// <summary> /// Interface to be implemented by objects that can remove tickers /// directly or through deletion of an entire group /// </summary> public interface ITickerRemover { void RemoveTickers(); } } |
|
From: Marco M. <mi...@us...> - 2004-08-04 22:48:08
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29109/b3_Data Modified Files: b3_Data.csproj Log Message: Added ITickerRemover interface used by the ContextMenu object for TickerGroupsViewer form Index: b3_Data.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/b3_Data.csproj,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** b3_Data.csproj 1 Aug 2004 00:37:38 -0000 1.8 --- b3_Data.csproj 4 Aug 2004 22:47:59 -0000 1.9 *************** *** 125,136 **** WrapperTool = "primary" /> - <Reference - Name = "Microsoft.Office.Core" - Guid = "{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}" - VersionMajor = "2" - VersionMinor = "3" - Lcid = "0" - WrapperTool = "primary" - /> </References> </Build> --- 125,128 ---- *************** *** 203,206 **** --- 195,203 ---- /> <File + RelPath = "Selectors\ITickerRemover.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Selectors\ITickerSelector.cs" SubType = "Code" |
|
From: Marco M. <mi...@us...> - 2004-08-04 22:46:24
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28767/b2_DataAccess/Tables Added Files: TickerGroups.cs Log Message: Added TickerGroups class to access TickerGroups table --- NEW FILE: TickerGroups.cs --- /* QuantDownloader - Quantitative Finance Library TickerGroups.cs Copyright (C) 2004 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Data; using QuantProject.DataAccess; namespace QuantProject.DataAccess.Tables { /// <summary> /// Class to access the TickerGroups table /// </summary> public class TickerGroups { // these static fields provide field name in the database table // They are intended to be used through intellisense when necessary public static string GroupID = "tgId"; public static string GroupDescription = "tgDescription"; public static string ParentGroupID = "tgTgId"; private DataTable tickerGroups; private int count; public TickerGroups() { this.tickerGroups = SqlExecutor.GetDataTable("SELECT * FROM tickerGroups"); this.count = this.tickerGroups.Rows.Count; } /// <summary> /// Number of tickerGroups in tickers table /// </summary> public int Count { get { return this.count; } } public static void DeleteGroup (string groupID) { string sqlDeleteCommand = "DELETE * FROM tickerGroups WHERE " + TickerGroups.GroupID + "='" + groupID + "'"; SqlExecutor.ExecuteNonQuery(sqlDeleteCommand); } } } |
|
From: Marco M. <mi...@us...> - 2004-08-04 22:46:24
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28767/b2_DataAccess Modified Files: b2_DataAccess.csproj Log Message: Added TickerGroups class to access TickerGroups table Index: b2_DataAccess.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/b2_DataAccess.csproj,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** b2_DataAccess.csproj 26 May 2004 15:25:46 -0000 1.11 --- b2_DataAccess.csproj 4 Aug 2004 22:46:08 -0000 1.12 *************** *** 138,141 **** --- 138,146 ---- /> <File + RelPath = "Tables\TickerGroups.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Tables\Tickers.cs" SubType = "Code" |
|
From: Marco M. <mi...@us...> - 2004-08-02 23:20:35
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Statistics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28233/b1_ADT/Statistics Modified Files: BasicFunctions.cs Log Message: Added new static functions to compute the PearsonCorrelationCoefficient (r). Index: BasicFunctions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Statistics/BasicFunctions.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BasicFunctions.cs 17 Dec 2003 19:34:56 -0000 1.1 --- BasicFunctions.cs 2 Aug 2004 23:20:26 -0000 1.2 *************** *** 66,69 **** --- 66,102 ---- return System.Math.Sqrt(BasicFunctions.Variance(data)); } + + static public double PearsonCorrelationCoefficient( double[] firstDataVariable, + double[] secondDataVariable ) + { + BasicFunctions.checkLengthOfDataVariables(firstDataVariable, secondDataVariable); + double simpleAvgOfProduct = BasicFunctions.SimpleAverageOfProduct(firstDataVariable, secondDataVariable); + double productOfSimpleAvgs = BasicFunctions.SimpleAverage(firstDataVariable) * + BasicFunctions.SimpleAverage(secondDataVariable); + double stdDevOfFirst = BasicFunctions.StdDev(firstDataVariable); + double stdDevOfSecond = BasicFunctions.StdDev(secondDataVariable); + + return (simpleAvgOfProduct - productOfSimpleAvgs)/(stdDevOfFirst*stdDevOfSecond); + } + + static public double SimpleAverageOfProduct( double[] firstDataVariable, + double[] secondDataVariable ) + { + BasicFunctions.checkLengthOfDataVariables(firstDataVariable, secondDataVariable); + double[] productDataVariable = new double[firstDataVariable.Length]; + + for( int i = 0; i < firstDataVariable.Length ; i ++ ) + { + productDataVariable[i]= firstDataVariable[i]*secondDataVariable[i]; + } + + return BasicFunctions.SimpleAverage(productDataVariable); + } + static private void checkLengthOfDataVariables(double[] firstDataVariable, + double[] secondDataVariable) + { + if(firstDataVariable.Length !=secondDataVariable.Length) + throw new Exception("The two variables haven't the same length!"); + } } } |
|
From: Marco M. <mi...@us...> - 2004-08-02 23:19:11
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27950/b3_Data/Selectors Modified Files: SelectionType.cs TickerSelector.cs Log Message: Added new selection types (Volatility and AverageCloseToClosePerformance) to the TickerSelector class. Updated the classes (Quotes, both in DataAccess and Data) that provide these selections. Index: SelectionType.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/SelectionType.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SelectionType.cs 25 Jul 2004 12:10:02 -0000 1.3 --- SelectionType.cs 2 Aug 2004 23:19:02 -0000 1.4 *************** *** 26,36 **** { /// <summary> ! /// Enum for SelectionRule class /// </summary> public enum SelectionType { Liquidity, ! Performance/* ! Volatility, StatisticalCorrelation*/ } --- 26,37 ---- { /// <summary> ! /// Enum for TickerSelector class /// </summary> public enum SelectionType { Liquidity, ! Performance, ! AverageCloseToClosePerformance, ! Volatility/* StatisticalCorrelation*/ } Index: TickerSelector.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/TickerSelector.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TickerSelector.cs 25 Jul 2004 12:10:02 -0000 1.5 --- TickerSelector.cs 2 Aug 2004 23:19:02 -0000 1.6 *************** *** 140,143 **** --- 140,147 ---- case SelectionType.Performance: return this.getTickersByPerformance(); + case SelectionType.Volatility: + return this.getTickersByVolatility(); + case SelectionType.AverageCloseToClosePerformance: + return this.getTickersByAverageCloseToClosePerformance(); //this line should never be reached! default: *************** *** 181,184 **** --- 185,221 ---- } + private DataTable getTickersByAverageCloseToClosePerformance() + { + if(this.setOfTickersToBeSelected == null) + return QuantProject.DataAccess.Tables.Quotes.GetTickersByAverageCloseToClosePerformance(this.isOrderedInASCMode, + this.groupID, this.firstQuoteDate, + this.lastQuoteDate, + this.maxNumOfReturnedTickers); + else + return QuantProject.Data.DataTables.Quotes.GetTickersByAverageCloseToClosePerformance(this.isOrderedInASCMode, + this.setOfTickersToBeSelected, + this.firstQuoteDate, + this.lastQuoteDate, + this.maxNumOfReturnedTickers); + + } + + private DataTable getTickersByVolatility() + { + if(this.setOfTickersToBeSelected == null) + return QuantProject.DataAccess.Tables.Quotes.GetTickersByVolatility(this.isOrderedInASCMode, + this.groupID, + this.firstQuoteDate, + this.lastQuoteDate, + this.maxNumOfReturnedTickers); + + else + return QuantProject.Data.DataTables.Quotes.GetTickersByVolatility(this.isOrderedInASCMode, + this.setOfTickersToBeSelected, + this.firstQuoteDate, + this.lastQuoteDate, + this.maxNumOfReturnedTickers); + } + public void SelectAllTickers() { |
|
From: Marco M. <mi...@us...> - 2004-08-02 23:19:11
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27950/b3_Data/DataTables Modified Files: Quotes.cs Log Message: Added new selection types (Volatility and AverageCloseToClosePerformance) to the TickerSelector class. Updated the classes (Quotes, both in DataAccess and Data) that provide these selections. Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/Quotes.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Quotes.cs 25 Jul 2004 12:08:53 -0000 1.4 --- Quotes.cs 2 Aug 2004 23:19:02 -0000 1.5 *************** *** 49,52 **** --- 49,101 ---- } + /// <summary> + /// returns tickers ordered by volatility computed with Standard deviation of adjusted + /// close to close ratio, within the given set of tickers + /// </summary> + public static DataTable GetTickersByVolatility( bool orderByASC, + DataTable setOfTickers, + DateTime firstQuoteDate, + DateTime lastQuoteDate, + long maxNumOfReturnedTickers) + { + if(!setOfTickers.Columns.Contains("AdjCloseToCloseStandDev")) + setOfTickers.Columns.Add("AdjCloseToCloseStandDev", System.Type.GetType("System.Double")); + foreach(DataRow row in setOfTickers.Rows) + { + row["AdjCloseToCloseStandDev"] = + QuantProject.DataAccess.Tables.Quotes.GetAdjustedCloseToCloseStandardDeviation((string)row[0], + firstQuoteDate, + lastQuoteDate); + } + DataTable getTickersByVolatility = ExtendedDataTable.CopyAndSort(setOfTickers,"AdjCloseToCloseStandDev", orderByASC); + ExtendedDataTable.DeleteRows(getTickersByVolatility, maxNumOfReturnedTickers); + return getTickersByVolatility; + } + + /// <summary> + /// returns tickers by average close to close performance within the given set of tickers + /// </summary> + + public static DataTable GetTickersByAverageCloseToClosePerformance( bool orderByASC, + DataTable setOfTickers, + DateTime firstQuoteDate, + DateTime lastQuoteDate, + long maxNumOfReturnedTickers) + { + if(!setOfTickers.Columns.Contains("AverageCloseToClosePerformance")) + setOfTickers.Columns.Add("AverageCloseToClosePerformance", System.Type.GetType("System.Double")); + foreach(DataRow row in setOfTickers.Rows) + { + row["AverageCloseToClosePerformance"] = + QuantProject.DataAccess.Tables.Quotes.GetAverageCloseToClosePerformance((string)row[0], + firstQuoteDate, + lastQuoteDate); + } + DataTable tableToReturn = ExtendedDataTable.CopyAndSort(setOfTickers,"AverageCloseToClosePerformance", orderByASC); + ExtendedDataTable.DeleteRows(tableToReturn, maxNumOfReturnedTickers); + return tableToReturn; + } + + private History history; |
|
From: Marco M. <mi...@us...> - 2004-08-02 23:19:11
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27950/b2_DataAccess/Tables Modified Files: Quotes.cs Log Message: Added new selection types (Volatility and AverageCloseToClosePerformance) to the TickerSelector class. Updated the classes (Quotes, both in DataAccess and Data) that provide these selections. Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Quotes.cs 25 Jul 2004 12:08:53 -0000 1.14 --- Quotes.cs 2 Aug 2004 23:19:02 -0000 1.15 *************** *** 386,392 **** /// <summary> ! /// returns most liquid tickers with the given features /// </summary> - public static DataTable GetTickersByLiquidity( bool orderInASCMode, string groupID, DateTime firstQuoteDate, --- 386,391 ---- /// <summary> ! /// returns tickers ordered by a liquidity index /// </summary> public static DataTable GetTickersByLiquidity( bool orderInASCMode, string groupID, DateTime firstQuoteDate, *************** *** 412,415 **** --- 411,467 ---- } + + /// <summary> + /// Returns tickers ordered by a volatility index (stdDev of adjustedCloseToClose ratio) + /// </summary> + public static DataTable GetTickersByVolatility( bool orderInASCMode, string groupID, + DateTime firstQuoteDate, + DateTime lastQuoteDate, + long maxNumOfReturnedTickers) + { + string sql = "SELECT TOP " + maxNumOfReturnedTickers + " tickers.tiTicker, tickers.tiCompanyName, " + + "StDev(quotes.quAdjustedCloseToCloseRatio) AS AdjCloseToCloseStandDev " + + "FROM quotes INNER JOIN (tickers INNER JOIN tickers_tickerGroups " + + "ON tickers.tiTicker = tickers_tickerGroups.ttTiId) " + + "ON quotes.quTicker = tickers_tickerGroups.ttTiId " + + "WHERE tickers_tickerGroups.ttTgId='" + groupID + "' " + + "AND quotes.quDate BETWEEN " + + SQLBuilder.GetDateConstant(firstQuoteDate) + " AND " + + SQLBuilder.GetDateConstant(lastQuoteDate) + + "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + + "ORDER BY StDev(quotes.quAdjustedCloseToCloseRatio)"; + string sortDirection = " DESC"; + if(orderInASCMode) + sortDirection = " ASC"; + sql = sql + sortDirection; + return SqlExecutor.GetDataTable( sql ); + } + + /// <summary> + /// Returns tickers ordered by average close to close performance + /// </summary> + public static DataTable GetTickersByAverageCloseToClosePerformance( bool orderInASCMode, string groupID, + DateTime firstQuoteDate, + DateTime lastQuoteDate, + long maxNumOfReturnedTickers) + { + string sql = "SELECT TOP " + maxNumOfReturnedTickers + " tickers.tiTicker, tickers.tiCompanyName, " + + "Avg(quotes.quAdjustedCloseToCloseRatio) AS AverageCloseToClosePerformance " + + "FROM quotes INNER JOIN (tickers INNER JOIN tickers_tickerGroups " + + "ON tickers.tiTicker = tickers_tickerGroups.ttTiId) " + + "ON quotes.quTicker = tickers_tickerGroups.ttTiId " + + "WHERE tickers_tickerGroups.ttTgId='" + groupID + "' " + + "AND quotes.quDate BETWEEN " + + SQLBuilder.GetDateConstant(firstQuoteDate) + " AND " + + SQLBuilder.GetDateConstant(lastQuoteDate) + + "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + + "ORDER BY Avg(quotes.quAdjustedCloseToCloseRatio)"; + 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 *************** *** 435,438 **** --- 487,539 ---- } + + /// <summary> + /// returns the average close to close performance value for the given ticker in the specified interval + /// </summary> + public static double GetAverageCloseToClosePerformance( string ticker, + DateTime firstQuoteDate, + DateTime lastQuoteDate) + + { + DataTable dt; + string sql = "SELECT quotes.quTicker, " + + "Avg([quAdjustedCloseToCloseRatio]) AS AverageCloseToClosePerformance " + + "FROM quotes WHERE quTicker ='" + + ticker + "' " + + "AND quotes.quDate BETWEEN " + SQLBuilder.GetDateConstant(firstQuoteDate) + + " AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + + " GROUP BY quotes.quTicker"; + dt = SqlExecutor.GetDataTable( sql ); + if(dt.Rows.Count==0) + return 0; + else + return (double)dt.Rows[0]["AverageCloseToClosePerformance"]; + } + + /// <summary> + /// returns the standard deviation of the adjusted close to close ratio + /// for the given ticker in the specified interval + /// </summary> + public static double GetAdjustedCloseToCloseStandardDeviation( string ticker, + DateTime firstQuoteDate, + DateTime lastQuoteDate) + + { + DataTable dt; + string sql = "SELECT quotes.quTicker, " + + "StDev(quotes.quAdjustedCloseToCloseRatio) AS AdjCloseToCloseStandDev " + + "FROM quotes WHERE quTicker ='" + + ticker + "' " + + "AND quotes.quDate BETWEEN " + SQLBuilder.GetDateConstant(firstQuoteDate) + + " AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + + " GROUP BY quotes.quTicker"; + dt = SqlExecutor.GetDataTable( sql ); + if(dt.Rows.Count==0) + return 0; + else + return (double)dt.Rows[0]["AdjCloseToCloseStandDev"]; + } + + #region GetHashValue private string getHashValue_getQuoteString_getRowString_getSingleValueString( Object value ) |
|
From: Marco M. <mi...@us...> - 2004-08-02 23:15:06
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27414/Downloader/TickerSelectors Modified Files: TickerSelectorForm.cs Log Message: Added new item in the combo box in order to visually interact with the TickerSelector class Index: TickerSelectorForm.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors/TickerSelectorForm.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TickerSelectorForm.cs 25 Jul 2004 12:14:18 -0000 1.5 --- TickerSelectorForm.cs 2 Aug 2004 23:14:54 -0000 1.6 *************** *** 71,74 **** --- 71,78 ---- this.comboBoxAvailableSelectionRules.Text = "Performance"; this.comboBoxAvailableSelectionRules.Items.Add("Performance"); + this.comboBoxAvailableSelectionRules.Text = "Volatility"; + this.comboBoxAvailableSelectionRules.Items.Add("Volatility"); + this.comboBoxAvailableSelectionRules.Text = "AverageCloseToClosePerformance"; + this.comboBoxAvailableSelectionRules.Items.Add("AverageCloseToClosePerformance"); } *************** *** 345,348 **** --- 349,356 ---- else if (this.comboBoxAvailableSelectionRules.Text == "Performance") typeSelected = SelectionType.Performance; + else if (this.comboBoxAvailableSelectionRules.Text == "Volatility") + typeSelected = SelectionType.Volatility; + else if (this.comboBoxAvailableSelectionRules.Text == "AverageCloseToClosePerformance") + typeSelected = SelectionType.AverageCloseToClosePerformance; return typeSelected; } |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:45:39
|
Update of /cvsroot/quantproject/QuantProject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23508 Modified Files: QuantProject.suo Log Message: Added windows reporting capabilities Index: QuantProject.suo =================================================================== RCS file: /cvsroot/quantproject/QuantProject/QuantProject.suo,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 Binary files /tmp/cvsxoN3mU and /tmp/cvscqWNYD differ |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:45:08
|
Update of /cvsroot/quantproject/QuantProject/b91_QuantProject In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23399/b91_QuantProject Modified Files: b91_QuantProject.csproj Log Message: Automatic changes by vsnet Index: b91_QuantProject.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b91_QuantProject/b91_QuantProject.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** b91_QuantProject.csproj 28 Nov 2003 16:40:53 -0000 1.3 --- b91_QuantProject.csproj 1 Aug 2004 00:45:00 -0000 1.4 *************** *** 103,106 **** --- 103,110 ---- <Include> <File + RelPath = "app.config" + BuildAction = "None" + /> + <File RelPath = "App.ico" BuildAction = "Content" |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:44:33
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23368/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: - added RunOneRankWithExcelReport.cs - added RunOneRankWithWindowsReport.cs Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** b7_Scripts.csproj 20 Dec 2003 18:43:01 -0000 1.9 --- b7_Scripts.csproj 1 Aug 2004 00:44:24 -0000 1.10 *************** *** 88,91 **** --- 88,96 ---- Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> + <Reference + Name = "System.Windows.Forms" + AssemblyName = "System.Windows.Forms" + HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll" + /> </References> </Build> *************** *** 143,146 **** --- 148,161 ---- /> <File + RelPath = "SimpleTesting\OneRank\RunOneRankWithExcelReport.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "SimpleTesting\OneRank\RunOneRankWithWindowsReport.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "SimpleTesting\OneRank\TsOneRank.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:43:27
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23243/b5_Presentation Modified Files: b5_Presentation.csproj Log Message: - added FormatProvider.cs - added Reporting\ - added Reporting\WindowsForm\ - added Reporting\WindowsForm\EquityChartTabPage.cs - added Reporting\WindowsForm\Report.cs - added Reporting\WindowsForm\ReportTabControl.cs - added Reporting\WindowsForm\SummaryTabPage.cs Index: b5_Presentation.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/b5_Presentation.csproj,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** b5_Presentation.csproj 25 Jul 2004 12:04:05 -0000 1.5 --- b5_Presentation.csproj 1 Aug 2004 00:43:11 -0000 1.6 *************** *** 103,111 **** /> <Reference - Name = "System.Windows.Forms" - AssemblyName = "System.Windows.Forms" - HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll" - /> - <Reference Name = "b1_ADT" Project = "{B8A01161-3698-4591-B1EF-90F5FC7D8DBA}" --- 103,106 ---- *************** *** 122,125 **** --- 117,141 ---- HintPath = "..\..\lib\scpl.dll" /> + <Reference + Name = "System.Windows.Forms" + AssemblyName = "System.Windows.Forms" + HintPath = "..\..\..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll" + /> + <Reference + Name = "stdole" + Guid = "{00020430-0000-0000-C000-000000000046}" + VersionMajor = "2" + VersionMinor = "0" + Lcid = "0" + WrapperTool = "primary" + /> + <Reference + Name = "Microsoft.Office.Core" + Guid = "{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}" + VersionMajor = "2" + VersionMinor = "3" + Lcid = "0" + WrapperTool = "primary" + /> </References> </Build> *************** *** 132,135 **** --- 148,156 ---- /> <File + RelPath = "FormatProvider.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Charting\CharPlot.cs" SubType = "Code" *************** *** 146,149 **** --- 167,210 ---- BuildAction = "Compile" /> + <File + RelPath = "Reporting\WindowsForm\EquityChartTabPage.cs" + SubType = "Component" + BuildAction = "Compile" + /> + <File + RelPath = "Reporting\WindowsForm\EquityChartTabPage.resx" + DependentUpon = "EquityChartTabPage.cs" + BuildAction = "EmbeddedResource" + /> + <File + RelPath = "Reporting\WindowsForm\Report.cs" + SubType = "Form" + BuildAction = "Compile" + /> + <File + RelPath = "Reporting\WindowsForm\Report.resx" + DependentUpon = "Report.cs" + BuildAction = "EmbeddedResource" + /> + <File + RelPath = "Reporting\WindowsForm\ReportTabControl.cs" + SubType = "Component" + BuildAction = "Compile" + /> + <File + RelPath = "Reporting\WindowsForm\ReportTabControl.resx" + DependentUpon = "ReportTabControl.cs" + BuildAction = "EmbeddedResource" + /> + <File + RelPath = "Reporting\WindowsForm\SummaryTabPage.cs" + SubType = "Component" + BuildAction = "Compile" + /> + <File + RelPath = "Reporting\WindowsForm\SummaryTabPage.resx" + DependentUpon = "SummaryTabPage.cs" + BuildAction = "EmbeddedResource" + /> </Include> </Files> |
|
From: Glauco S. <gla...@us...> - 2004-08-01 00:39:58
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22831/b4_Business Modified Files: b4_Business.csproj Log Message: Automatic changes by vsnet Index: b4_Business.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** b4_Business.csproj 8 May 2004 17:36:59 -0000 1.9 --- b4_Business.csproj 1 Aug 2004 00:39:48 -0000 1.10 *************** *** 122,125 **** --- 122,141 ---- Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" /> + <Reference + Name = "stdole" + Guid = "{00020430-0000-0000-C000-000000000046}" + VersionMajor = "2" + VersionMinor = "0" + Lcid = "0" + WrapperTool = "primary" + /> + <Reference + Name = "Microsoft.Office.Core" + Guid = "{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}" + VersionMajor = "2" + VersionMinor = "3" + Lcid = "0" + WrapperTool = "primary" + /> </References> </Build> |