quantproject-developers Mailing List for QuantProject (Page 14)
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. <gla...@us...> - 2010-03-28 13:18:47
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/OutOfSample In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv4457/a2_Strategies/OutOfSample Added Files: TestingPositionsForUndecodableEncoded.cs Log Message: Object used to assign a dummy meaning to those objects (genomes or bruteForceOptimizableParameters) that cannot be decoded to a meaningful TestingPositions. It will be returned by an IDecoder when the Decode method fails --- NEW FILE: TestingPositionsForUndecodableEncoded.cs --- /* * Created by SharpDevelop. * User: Glauco * Date: 15/03/2010 * Time: 16.46 * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; namespace QuantProject.Business.Strategies.OutOfSample { /// <summary> /// Object used to assign a dummy meaning to those objects (genomes or /// bruteForceOptimizableParameters) that /// cannot be decoded to a meaningful TestingPositions. It will be returned /// by an IDecoder when the Decode method fails /// </summary> [Serializable] public class TestingPositionsForUndecodableEncoded : TestingPositions , IGeneticallyOptimizable { private int generation; public int Generation { get { return this.generation; } set { this.generation = value; } } public TestingPositionsForUndecodableEncoded() { } } } |
|
From: Glauco S. <gla...@us...> - 2010-03-28 13:17:45
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/OutOfSample In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv4097/a2_Strategies/OutOfSample Added Files: IExitStrategy.cs Log Message: decides if current positions have to be closed --- NEW FILE: IExitStrategy.cs --- /* QuantProject - Quantitative Finance Library IExitStrategy.cs Copyright (C) 2010 Glauco Siliprandi 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 QuantProject.Business.Financial.Accounting; namespace QuantProject.Business.Strategies.OutOfSample { /// <summary> /// decides if current positions have to be closed /// </summary> public interface IExitStrategy { bool ArePositionsToBeClosed(); } } |
|
From: Glauco S. <gla...@us...> - 2010-03-28 13:17:29
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/OutOfSample In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv3991/a2_Strategies/OutOfSample Added Files: IEntryStrategy.cs Log Message: Returns the WeightedPositions to be opened out of sample. Returns null if none is suitable --- NEW FILE: IEntryStrategy.cs --- /* QuantProject - Quantitative Finance Library IEntryStrategy.cs Copyright (C) 2010 Glauco Siliprandi 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; namespace QuantProject.Business.Strategies.OutOfSample { /// <summary> /// Returns the WeightedPositions to be opened out of sample. /// Returns null if none is suitable /// </summary> public interface IEntryStrategy { /// <summary> /// Returns the WeightedPositions to be opened out of sample. /// Returns null if none is suitable /// </summary> /// <returns>null if it finds no positions as required</returns> WeightedPositions GetPositionsToBeOpened(); } } |
|
From: Glauco S. <gla...@us...> - 2010-03-28 13:04:40
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Optimizing/Decoding In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv405/a2_Strategies/Optimizing/Decoding Added Files: DummyDecoderForTestingPositions.cs Log Message: A dummy decoder for testing positions (to be used when, for instance, the GenomeManager has its own decoder) --- NEW FILE: DummyDecoderForTestingPositions.cs --- /* QuantProject - Quantitative Finance Library IDecoderForTestingPositions.cs Copyright (C) 2008 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 QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.OutOfSample; using QuantProject.Business.Strategies.ReturnsManagement; namespace QuantProject.Business.Strategies.Optimizing.Decoding { /// <summary> /// A dummy decoder for testing positions (to be used when, for instance, /// the GenomeManager has its own decoder) /// </summary> [Serializable] public class DummyDecoderForTestingPositions : IDecoderForTestingPositions { public DummyDecoderForTestingPositions() { } /// <summary> /// this is a dummy method that we add just to implement the IDecoderForTestingPositions /// interface, but this decoder is ment to be used by a GenomeManagerForLinearRegression /// and it will use the Decode with four parameters (see above) /// </summary> /// <param name="encoded"></param> /// <param name="eligibleTickers"></param> /// <param name="returnsManager"></param> /// <returns></returns> public TestingPositions Decode( int[] encoded , EligibleTickers eligibleTickers , IReturnsManager returnsManager ) { throw new Exception( "This method should never be invoked, this is a dummy " + "method!" ); // return null; } protected virtual string getDescription() { return "BscFrTstngPstns"; } public string Description { get { string description = "Dcdr_" + this.getDescription(); return description; } } } } |
|
From: Glauco S. <gla...@us...> - 2010-03-28 13:03:23
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv32418/a2_Strategies/Eligibles Added Files: OftenExchanged.cs Log Message: Selects from a given group of tickers, those tickers which are traded at least at a given percentage of DateTime(s) --- NEW FILE: OftenExchanged.cs --- /* * Created by SharpDevelop. * User: Glauco * Date: 17/02/2010 * Time: 18.28 * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; using System.Collections.Generic; using System.Data; using QuantProject.ADT.Histories; using QuantProject.ADT.Messaging; using QuantProject.Business.DataProviders; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Data.Selectors; namespace QuantProject.Business.Strategies.Eligibles { /// <summary> /// Selects from a given group of tickers, those tickers which /// are traded at least at a given percentage of DateTime(s) /// </summary> public class OftenExchanged : IEligiblesSelector { public event NewMessageEventHandler NewMessage; private string tickersGroupID; private ITickerSelectorByGroup tickerSelectorByGroup; private IHistoricalMarketValueProvider historicalMarketValueProvider; private double minPercentageOfDateTimesWithMarketValues; public string Description { get{ return "From_" + this.tickersGroupID + this.historicalMarketValueProvider.Description + "MinPercentageOfDateTimesWithMarketValues_" + this.minPercentageOfDateTimesWithMarketValues; } } /// <summary> /// Selects from a given group of tickers, those tickers which /// are traded at least at a given percentage of DateTime(s) /// </summary> /// <param name="tickersGroupID"></param> /// <param name="historicalMarketValueProvider"></param> /// <param name="minPercentageOfDateTimesWithMarketValues">values between /// 0 and 1</param> public OftenExchanged( string tickersGroupID , ITickerSelectorByGroup tickerSelectorByGroup , IHistoricalMarketValueProvider historicalMarketValueProvider , double minPercentageOfDateTimesWithMarketValues ) { this.oftenExchanged_checkParameter( minPercentageOfDateTimesWithMarketValues ); this.tickersGroupID = tickersGroupID; this.tickerSelectorByGroup = tickerSelectorByGroup; this.historicalMarketValueProvider = historicalMarketValueProvider; this.minPercentageOfDateTimesWithMarketValues = minPercentageOfDateTimesWithMarketValues; } private void oftenExchanged_checkParameter( double minPercentageOfDateTimesWithMarketValues ) { if ( minPercentageOfDateTimesWithMarketValues < 0 ) throw new Exception( "minPercentageOfDateTimesWithMarketValues cannot be less than zero!" ); if ( minPercentageOfDateTimesWithMarketValues > 1 ) throw new Exception( "minPercentageOfDateTimesWithMarketValues cannot be more than 1!" ); } #region GetEligibleTickers #region getEligibleTickers_actually #region getOftenExchanged #region addCurrentTickerIfItIsOftenExchanged private void addCurrentTickerIfItIsOftenExchanged_checkParameter( DataRow dataRow ) { if ( !( dataRow[ 0 ] is string ) ) throw new Exception( "The datatable of eligible tickers is " + "expected to have a single element in each " + "DataRow and that element should be a string" ); } private void addCurrentTickerIfItIsOftenExchangedWithValidDataRow( string candidate , History history , List<string> tickerList ) { // string candidate = (string)tickerFromGroup[ 0 ]; History dateTimesWithMarketValues = this.historicalMarketValueProvider.GetDateTimesWithMarketValues( candidate , history ); bool isOftenExchanged = dateTimesWithMarketValues.ContainsAtAGivenPercentageDateTimesIn( history , this.minPercentageOfDateTimesWithMarketValues * 100 ); if ( isOftenExchanged ) tickerList.Add( candidate ); } private void addCurrentTickerIfItIsOftenExchanged( string tickerFromGroup , History history , List<string> tickerList ) { // this.addCurrentTickerIfItIsOftenExchanged_checkParameter( dataRow ); this.addCurrentTickerIfItIsOftenExchangedWithValidDataRow( tickerFromGroup , history , tickerList ); } #endregion addCurrentTickerIfItIsOftenExchanged private List<string> getOftenExchanged( List<string> tickersFromGroup , History history ) { List<string> oftenExchanged = new List<string>(); foreach ( string tickerFromGroup in tickersFromGroup ) this.addCurrentTickerIfItIsOftenExchanged( tickerFromGroup , history , oftenExchanged ); // string[] oftenExchanged = oftenExchanged.ToArray(); return oftenExchanged; } #endregion getOftenExchanged private EligibleTickers getEligibleTickers_actually( History history ) { DateTime currentDate = history.LastDateTime; // SelectorByGroup group; // if(this.temporizedGroup) // //the group is "temporized": returned set of tickers // // depend on time // group = new SelectorByGroup(this.tickersGroupID, // currentDate); // else//the group is not temporized // group = new SelectorByGroup(this.tickersGroupID); // group = new SelectorByGroup( this.tickersGroupID , currentDate ); // DataTable tickersFromGroup = group.GetTableOfSelectedTickers(); List<string> tickersFromGroup = this.tickerSelectorByGroup.GetSelectedTickers( this.tickersGroupID , currentDate ); List<string> oftenExchanged = this.getOftenExchanged( tickersFromGroup , history ); EligibleTickers eligibleTickers = new EligibleTickers( oftenExchanged ); return eligibleTickers; } #endregion getEligibleTickers_actually private void getEligibleTickers_sendNewMessage( EligibleTickers eligibleTickers ) { string message = "Number of Eligible tickers: " + eligibleTickers.Count; NewMessageEventArgs newMessageEventArgs = new NewMessageEventArgs( message ); if(this.NewMessage != null) this.NewMessage( this , newMessageEventArgs ); } public EligibleTickers GetEligibleTickers( History history ) { EligibleTickers eligibleTickers = this.getEligibleTickers_actually( history ); this.getEligibleTickers_sendNewMessage( eligibleTickers ); return eligibleTickers; } #endregion GetEligibleTickers } } |
|
From: Glauco S. <gla...@us...> - 2010-03-28 12:58:58
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a07_DataProviders In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv30935/a07_DataProviders Added Files: IHistoricalMarketValueProvider.cs Log Message: Interface to be implemented by historical market value providers --- NEW FILE: IHistoricalMarketValueProvider.cs --- /* QuantProject - Quantitative Finance Library IHistoricalMarketValueProvider.cs Copyright (C) 2010 Glauco Siliprandi 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 QuantProject.ADT.Histories; namespace QuantProject.Business.DataProviders { /// <summary> /// Interface to be implemented by historical market value providers /// </summary> public interface IHistoricalMarketValueProvider { string Description{ get; } History GetMarketValues( string ticker , History history ); /// <summary> /// True iif the given ticker was traded at the given DateTime /// </summary> /// <param name="ticker"></param> /// <param name="dateTime"></param> /// <returns></returns> bool WasExchanged( string ticker , DateTime dateTime ); /// <summary> /// returns the subset of DateTimes when ticker is exchanged /// </summary> /// <param name="ticker"></param> /// <param name="history">DateTimes returned are a subset of this parameter</param> /// <returns></returns> History GetDateTimesWithMarketValues( string ticker , History history ); } } |
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:41:01
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv7240/Selectors Modified Files: TickerSelector.cs Log Message: The code has been reformatted, and it now follows a standard indentation A new static method List<string> GetList( DataTable dataTableOfSelectedTickers ) has been added. It transforms the DataTable in a strongly typed list of strings Index: TickerSelector.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/TickerSelector.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TickerSelector.cs 27 Feb 2005 19:56:07 -0000 1.11 --- TickerSelector.cs 27 Mar 2010 17:40:53 -0000 1.12 *************** *** 3,7 **** TickerSelector.cs ! Copyright (C) 2003 Marco Milletti --- 3,7 ---- TickerSelector.cs ! Copyright (C) 2003 Marco Milletti *************** *** 19,26 **** 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.Collections; using System.Data; using System.Windows.Forms; --- 19,27 ---- 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.Collections; + using System.Collections.Generic; using System.Data; using System.Windows.Forms; *************** *** 30,163 **** namespace QuantProject.Data.Selectors { ! /// <summary> ! /// Base class for advanced selections on tickers ! /// </summary> ! public class TickerSelector ! { ! protected DataTable setOfTickersToBeSelected = null; ! protected string groupID = ""; ! protected DateTime firstQuoteDate = QuantProject.ADT.ConstantsProvider.InitialDateTimeForDownload; ! protected DateTime lastQuoteDate = DateTime.Now; ! protected long maxNumOfReturnedTickers = 0; ! protected bool isOrderedInASCMode; ! ! #region properties ! /// <summary> ! /// It gets the GroupID from which tickers have to be selected ! /// </summary> ! public string GroupID ! { ! get{return this.groupID;} ! } ! /// <summary> ! /// It gets the first date of selection for the quotes ! /// </summary> ! public DateTime FirstQuoteDate ! { ! get{return this.firstQuoteDate;} ! } ! /// <summary> ! /// It gets the last date of selection for the quotes ! /// </summary> ! public DateTime LastQuoteDate ! { ! get{return this.lastQuoteDate;} ! } ! ! /// <summary> ! /// It gets the max number of tickers to be returned ! /// </summary> ! public long MaxNumOfReturnedTickers ! { ! get{return this.maxNumOfReturnedTickers;} ! } ! ! /// <summary> ! /// It gets / sets the order type for the ticker selector ! /// </summary> ! public bool IsOrderedInASCMode ! { ! get{return this.isOrderedInASCMode;} ! set{this.isOrderedInASCMode = value;} ! } ! ! ! #endregion ! ! public TickerSelector(DataTable setOfTickersToBeSelected, ! bool orderInASCmode, ! DateTime firstQuoteDate, ! DateTime lastQuoteDate, ! long maxNumOfReturnedTickers) ! { ! this.setOfTickersToBeSelected = setOfTickersToBeSelected; ! this.commonInitialization(orderInASCmode, firstQuoteDate, ! lastQuoteDate, maxNumOfReturnedTickers); ! } ! ! public TickerSelector(string groupID, ! bool orderInASCmode, ! DateTime firstQuoteDate, ! DateTime lastQuoteDate, ! long maxNumOfReturnedTickers) ! { ! this.groupID = groupID; ! this.commonInitialization(orderInASCmode, firstQuoteDate, ! lastQuoteDate, maxNumOfReturnedTickers); ! } ! ! private void commonInitialization(bool orderInASCmode, ! DateTime firstQuoteDate, ! DateTime lastQuoteDate, ! long maxNumOfReturnedTickers) ! { ! this.isOrderedInASCMode = orderInASCmode; ! this.firstQuoteDate = firstQuoteDate; ! this.lastQuoteDate = lastQuoteDate; ! this.maxNumOfReturnedTickers = maxNumOfReturnedTickers; ! } ! ! /// <summary> ! /// It returns a dataTable containing tickers selected by the user ! /// </summary> ! /// <param name="dataGrid">The data grid from which the user has selected tickers</param> ! public static DataTable GetTableOfManuallySelectedTickers(DataGrid dataGrid) ! { ! DataTable dataTableOfDataGrid = (DataTable)dataGrid.DataSource; ! DataTable tableOfSelectedTickers = dataTableOfDataGrid.Clone(); ! int indexOfRow = 0; ! while(indexOfRow != dataTableOfDataGrid.Rows.Count) ! { ! if(dataGrid.IsSelected(indexOfRow)) ! { ! tableOfSelectedTickers.ImportRow(dataTableOfDataGrid.Rows[indexOfRow]); ! } ! indexOfRow++; ! } ! return tableOfSelectedTickers; ! } ! /// <summary> ! /// It returns a DataTable, with only one column, containing tickers ! /// that are contained in both the two tables passed as parameters ! /// </summary> ! /// <param name="firstDataTable">The first data table in which the column indexed 0 contains the first set of tickers' symbols</param> ! /// <param name="secondDataTable">The second data table in which the column indexed 0 contains the second set of tickers' symbols</param> ! public static DataTable GetTableOfCommonTickers(DataTable firstDataTable, DataTable secondDataTable) ! { ! DataTable commonTickers = new DataTable(); ! commonTickers.Columns.Add("tiTicker", System.Type.GetType("System.String")); ! Hashtable hashTable = ExtendedDataTable.GetCommonValues(firstDataTable, ! secondDataTable,0,0); ! object[] values = new object[1]; ! foreach(DictionaryEntry element in hashTable ) ! { ! values[0]=element.Value; ! commonTickers.Rows.Add(values); ! } ! return commonTickers; ! } } } --- 31,202 ---- namespace QuantProject.Data.Selectors { ! /// <summary> ! /// Base class for advanced selections on tickers ! /// </summary> ! public class TickerSelector ! { ! protected DataTable setOfTickersToBeSelected = null; ! protected string groupID = ""; ! protected DateTime firstQuoteDate = QuantProject.ADT.ConstantsProvider.InitialDateTimeForDownload; ! protected DateTime lastQuoteDate = DateTime.Now; ! protected long maxNumOfReturnedTickers = 0; ! protected bool isOrderedInASCMode; ! ! #region properties ! /// <summary> ! /// It gets the GroupID from which tickers have to be selected ! /// </summary> ! public string GroupID ! { ! get{return this.groupID;} ! } ! /// <summary> ! /// It gets the first date of selection for the quotes ! /// </summary> ! public DateTime FirstQuoteDate ! { ! get{return this.firstQuoteDate;} ! } ! /// <summary> ! /// It gets the last date of selection for the quotes ! /// </summary> ! public DateTime LastQuoteDate ! { ! get{return this.lastQuoteDate;} ! } ! ! /// <summary> ! /// It gets the max number of tickers to be returned ! /// </summary> ! public long MaxNumOfReturnedTickers ! { ! get{return this.maxNumOfReturnedTickers;} ! } ! ! /// <summary> ! /// It gets / sets the order type for the ticker selector ! /// </summary> ! public bool IsOrderedInASCMode ! { ! get{return this.isOrderedInASCMode;} ! set{this.isOrderedInASCMode = value;} ! } ! ! #endregion + public TickerSelector(DataTable setOfTickersToBeSelected, + bool orderInASCmode, + DateTime firstQuoteDate, + DateTime lastQuoteDate, + long maxNumOfReturnedTickers) + { + this.setOfTickersToBeSelected = setOfTickersToBeSelected; + this.commonInitialization(orderInASCmode, firstQuoteDate, + lastQuoteDate, maxNumOfReturnedTickers); + } + + public TickerSelector(string groupID, + bool orderInASCmode, + DateTime firstQuoteDate, + DateTime lastQuoteDate, + long maxNumOfReturnedTickers) + { + this.groupID = groupID; + this.commonInitialization(orderInASCmode, firstQuoteDate, + lastQuoteDate, maxNumOfReturnedTickers); + } + + private void commonInitialization(bool orderInASCmode, + DateTime firstQuoteDate, + DateTime lastQuoteDate, + long maxNumOfReturnedTickers) + { + this.isOrderedInASCMode = orderInASCmode; + this.firstQuoteDate = firstQuoteDate; + this.lastQuoteDate = lastQuoteDate; + this.maxNumOfReturnedTickers = maxNumOfReturnedTickers; + } + + /// <summary> + /// It returns a dataTable containing tickers selected by the user + /// </summary> + /// <param name="dataGrid">The data grid from which the user has selected tickers</param> + public static DataTable GetTableOfManuallySelectedTickers(DataGrid dataGrid) + { + DataTable dataTableOfDataGrid = (DataTable)dataGrid.DataSource; + DataTable tableOfSelectedTickers = dataTableOfDataGrid.Clone(); + int indexOfRow = 0; + while(indexOfRow != dataTableOfDataGrid.Rows.Count) + { + if(dataGrid.IsSelected(indexOfRow)) + { + tableOfSelectedTickers.ImportRow(dataTableOfDataGrid.Rows[indexOfRow]); + } + indexOfRow++; + } + return tableOfSelectedTickers; + } + /// <summary> + /// It returns a DataTable, with only one column, containing tickers + /// that are contained in both the two tables passed as parameters + /// </summary> + /// <param name="firstDataTable">The first data table in which the column indexed 0 contains the first set of tickers' symbols</param> + /// <param name="secondDataTable">The second data table in which the column indexed 0 contains the second set of tickers' symbols</param> + public static DataTable GetTableOfCommonTickers(DataTable firstDataTable, DataTable secondDataTable) + { + DataTable commonTickers = new DataTable(); + commonTickers.Columns.Add("tiTicker", System.Type.GetType("System.String")); + Hashtable hashTable = ExtendedDataTable.GetCommonValues(firstDataTable, + secondDataTable,0,0); + object[] values = new object[1]; + foreach(DictionaryEntry element in hashTable ) + { + values[0]=element.Value; + commonTickers.Rows.Add(values); + } + return commonTickers; + } + + #region GetDataTableForTickerSelectors + private static DataTable getEmptyDataTable() + { + DataTable dataTable = new DataTable(); + dataTable.Columns.Add("tiTicker", System.Type.GetType("System.String")); + return dataTable; + } + /// <summary> + /// returns a DataTable, suitable to be used by many selectors + /// </summary> + /// <param name="tickers"></param> + /// <returns></returns> + public static DataTable GetDataTableForTickerSelectors( IEnumerable<string> tickers ) + { + DataTable dataTable = TickerSelector.getEmptyDataTable(); + foreach( string ticker in tickers ) + { + DataRow newDataRow = dataTable.NewRow(); + newDataRow[ 0 ] = ticker; + dataTable.Rows.Add( newDataRow ); + } + return dataTable; + } + #endregion GetDataTableForTickerSelectors + + #region GetList + /// <summary> + /// transforms the DataTable in a strongly typed list of strings + /// </summary> + /// <param name="dataTableOfSelectedTickers"></param> + /// <returns></returns> + public static List<string> GetList( DataTable dataTableOfSelectedTickers ) + { + List<string> tickerList = new List<string>(); + foreach ( DataRow dataRow in dataTableOfSelectedTickers.Rows ) + tickerList.Add( (string)( dataRow[ 0 ] ) ); + return tickerList; + } + #endregion GetList } } |
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:31:41
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv4637/Selectors Modified Files: SelectorByGroup.cs Log Message: The code has been reformatted, and it now follows a standard indentation Index: SelectorByGroup.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/SelectorByGroup.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SelectorByGroup.cs 27 Aug 2005 19:20:26 -0000 1.2 --- SelectorByGroup.cs 27 Mar 2010 17:31:33 -0000 1.3 *************** *** 3,7 **** SelectorByGroup.cs ! Copyright (C) 2003 Glauco Siliprandi --- 3,7 ---- SelectorByGroup.cs ! Copyright (C) 2003 Glauco Siliprandi *************** *** 19,23 **** 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; --- 19,23 ---- 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; *************** *** 33,77 **** /// Class for selection on tickers by groupId only or groupId and date /// </summary> ! public class SelectorByGroup : ITickerSelector { ! private string groupID; ! private DateTime date = new DateTime(1900,1,1); ! ! /// <summary> ! /// Creates an new instance of SelectorByGroup, in order ! /// to get tickers contained in the given group ! /// </summary> ! /// <param name="groupID">Group's code for which tickers are to be selected</param> public SelectorByGroup( string groupID ) { this.groupID = groupID; ! } ! ! /// <summary> ! /// Creates an new instance of SelectorByGroup, in order ! /// to get tickers contained in the given group ! /// </summary> ! /// <param name="groupID">Group's code for which tickers are to be selected</param> ! /// <param name="date">The date at which tickers to be selected belong effectively ! /// to the given group</param> ! public SelectorByGroup( string groupID, DateTime date ) ! { ! this.groupID = groupID; ! this.date = date; ! } public DataTable GetTableOfSelectedTickers() { if(this.date.CompareTo(new DateTime(1900,1,1)) == 0) ! //date has not be set by the user because it is still equal to default value ! return QuantProject.DataAccess.Tables.Tickers_tickerGroups.GetTickers( this.groupID ); ! else ! return QuantProject.DataAccess.Tables.Tickers_tickerGroups.GetTickers( this.groupID, this.date ); } public void SelectAllTickers() { ; ! } ! } } --- 33,76 ---- /// Class for selection on tickers by groupId only or groupId and date /// </summary> ! public class SelectorByGroup : ITickerSelector { ! private string groupID; ! private DateTime date = new DateTime(1900,1,1); ! ! /// <summary> ! /// Creates an new instance of SelectorByGroup, in order ! /// to get tickers contained in the given group ! /// </summary> ! /// <param name="groupID">Group's code for which tickers are to be selected</param> public SelectorByGroup( string groupID ) { this.groupID = groupID; ! } ! ! /// <summary> ! /// Creates an new instance of SelectorByGroup, in order ! /// to get tickers contained in the given group ! /// </summary> ! /// <param name="groupID">Group's code for which tickers are to be selected</param> ! /// <param name="date">The date at which tickers to be selected belong effectively ! /// to the given group</param> ! public SelectorByGroup( string groupID, DateTime date ) ! { ! this.groupID = groupID; ! this.date = date; ! } public DataTable GetTableOfSelectedTickers() { if(this.date.CompareTo(new DateTime(1900,1,1)) == 0) ! //date has not be set by the user because it is still equal to default value ! return QuantProject.DataAccess.Tables.Tickers_tickerGroups.GetTickers( this.groupID ); ! else ! return QuantProject.DataAccess.Tables.Tickers_tickerGroups.GetTickers( this.groupID, this.date ); } public void SelectAllTickers() { ; ! } } } |
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:30:18
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv4240 Modified Files: Data_SD.csproj Log Message: Selectors\ITickerSelectorByGroup.cs has been added Index: Data_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Data_SD.csproj,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Data_SD.csproj 13 Mar 2009 15:19:10 -0000 1.8 --- Data_SD.csproj 27 Mar 2010 17:30:10 -0000 1.9 *************** *** 70,73 **** --- 70,74 ---- <Compile Include="Selectors\ITickerRemover.cs" /> <Compile Include="Selectors\ITickerSelector.cs" /> + <Compile Include="Selectors\ITickerSelectorByGroup.cs" /> <Compile Include="Selectors\SelectorByAbsolutePerformance.cs" /> <Compile Include="Selectors\SelectorByAverageCloseToClosePerformance.cs" /> *************** *** 99,102 **** --- 100,104 ---- <Compile Include="Selectors\ByLinearIndipendence\GenomeManagerForMaxLinearIndipendenceSelector.cs" /> <Compile Include="Selectors\ByLinearIndipendence\SelectorByMaxLinearIndipendence.cs" /> + <Compile Include="Selectors\TickerSelectorByGroup.cs" /> </ItemGroup> <ItemGroup> |
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:29:28
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Caching In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv3945/DataProviders/Caching Modified Files: Cache.cs Log Message: A bug has been fixed. In some rare case, a page was removed just after having been added and the following access to the page resulted in an exception Index: Cache.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Caching/Cache.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Cache.cs 29 Sep 2008 21:12:47 -0000 1.5 --- Cache.cs 27 Mar 2010 17:29:20 -0000 1.6 *************** *** 3,7 **** Cache.cs ! Copyright (C) 2003 Glauco Siliprandi --- 3,7 ---- Cache.cs ! Copyright (C) 2003 Glauco Siliprandi *************** *** 19,23 **** 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.Collections; --- 19,23 ---- 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.Collections; *************** *** 89,98 **** } private CachePage getCachePage( string ticker , int year , ! QuoteField quoteField ) { return (CachePage)( this[ this.getKey( ticker , year , quoteField ) ] ); } private CachePage getCachePage( string ticker , DateTime dateTime , ! QuoteField quoteField ) { return this.getCachePage( ticker , dateTime.Year , quoteField ); --- 89,98 ---- } private CachePage getCachePage( string ticker , int year , ! QuoteField quoteField ) { return (CachePage)( this[ this.getKey( ticker , year , quoteField ) ] ); } private CachePage getCachePage( string ticker , DateTime dateTime , ! QuoteField quoteField ) { return this.getCachePage( ticker , dateTime.Year , quoteField ); *************** *** 139,143 **** this.removeUnusedPages(); CachePage cachePage = new CachePage( ticker , year , quoteField ); ! cachePage.LoadData(); this.Add( this.getKey( ticker , year , quoteField ) , cachePage ); this.currentNumPages ++ ; --- 139,147 ---- this.removeUnusedPages(); CachePage cachePage = new CachePage( ticker , year , quoteField ); ! cachePage.LoadData(); ! ! // this.currentPageRank ++ ; ! cachePage.Rank = this.currentPageRank++; ! this.Add( this.getKey( ticker , year , quoteField ) , cachePage ); this.currentNumPages ++ ; *************** *** 189,193 **** string message = ex.Message; // to avoid warning returnValue = this.GetQuote( ticker , ! new DateTime( dateTime.Year - 1 , 12 , 31 ) , quoteField ); } return returnValue; --- 193,197 ---- string message = ex.Message; // to avoid warning returnValue = this.GetQuote( ticker , ! new DateTime( dateTime.Year - 1 , 12 , 31 ) , quoteField ); } return returnValue; *************** *** 214,218 **** { // forces quote caching ! this.GetQuote( ticker , dateTime , QuoteField.Open ); bool wasExchanged = this.wasExchanged_withCachingAlreadyForced( ticker , dateTime ); --- 218,229 ---- { // forces quote caching ! try ! { ! this.GetQuote( ticker , dateTime , QuoteField.Open ); ! } ! catch ( MissingQuoteException missingQuoteException ) ! { ! string doNothing = missingQuoteException.Message; doNothing += ""; ! } bool wasExchanged = this.wasExchanged_withCachingAlreadyForced( ticker , dateTime ); |
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:27:03
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv3212/Selectors Added Files: TickerSelectorByGroup.cs Log Message: Selects the list of tickers that belonged to a given group, at a given time --- NEW FILE: TickerSelectorByGroup.cs --- /* QuantProject - Quantitative Finance Library TickerSelectorByGroup.cs Copyright (C) 2010 Glauco Siliprandi 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.Collections.Generic; using System.Data; namespace QuantProject.Data.Selectors { /// <summary> /// Selects the list of tickers that belonged to a given group, at a given time /// </summary> [Serializable] public class TickerSelectorByGroup : ITickerSelectorByGroup { public TickerSelectorByGroup() { } public List<string> GetSelectedTickers( string groupId , DateTime date ) { SelectorByGroup selectorByGroup = new SelectorByGroup( groupId , date ); DataTable dataTableOfSelectedTickers = selectorByGroup.GetTableOfSelectedTickers(); List<string> selectedTickers = TickerSelector.GetList( dataTableOfSelectedTickers ); return selectedTickers; } } } |
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:25:20
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv2727/Selectors Added Files: ITickerSelectorByGroup.cs Log Message: Interface to be implemented by a ticker selector that selects the tickers in a group, at a given DateTime. Please, notice that while the previous selctors returned a DataTable, this ne interface requires selectors to return a stronged type list of tickers. --- NEW FILE: ITickerSelectorByGroup.cs --- /* QuantProject - Quantitative Finance Library ITickerSelectorByGroup.cs Copyright (C) 2010 Glauco Siliprandi 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.Collections.Generic; namespace QuantProject.Data.Selectors { /// <summary> /// Interface to be implemented by a ticker selector that /// selects the tickers in a group, at a given DateTime /// </summary> public interface ITickerSelectorByGroup { /// <summary> /// selects the tickers in a group, at a given DateTime /// </summary> /// <param name="groupId"></param> /// <param name="dateTime"></param> /// <returns></returns> List<string> GetSelectedTickers( string groupId , DateTime dateTime ); } } |
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:16:02
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv32529/Optimizing/Genetic Modified Files: Genome.cs Log Message: The code has been reformatted, and it now follows a standard indentation Index: Genome.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/Genome.cs,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Genome.cs 31 Aug 2007 23:19:34 -0000 1.20 --- Genome.cs 27 Mar 2010 17:15:54 -0000 1.21 *************** *** 3,7 **** Genome.cs ! Copyright (C) 2003 Marco Milletti --- 3,7 ---- Genome.cs ! Copyright (C) 2003 Marco Milletti *************** *** 19,23 **** along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ --- 19,23 ---- along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ *************** *** 34,75 **** public class Genome : IComparable { ! private int[] genes; ! private int size; ! private double fitness; ! private object meaning; ! private bool hasBeenCloned; ! private bool hasBeenMutated; ! ! private IGenomeManager genomeManager; ! private GeneticOptimizer geneticOptimizer; private int generation; private bool hasFitnessBeenAssigned; ! ! public bool HasBeenCloned ! { ! get{return this.hasBeenCloned;} ! //set{this.hasBeenCloned = value;} ! } ! ! /// <summary> ! /// Returns true if a gene has been mutated ! /// through a IGenomeManager Mutate method ! /// </summary> ! public bool HasBeenMutated ! { ! get{return this.hasBeenMutated;} ! set{this.hasBeenMutated = value;} ! } ! ! private void setFitnessValue(double fitnessValue) ! { ! this.fitness = fitnessValue; ! this.hasFitnessBeenAssigned = true; ! } ! ! ! public double Fitness ! { ! get { if ( double.IsNaN( this.fitness ) ) --- 34,75 ---- public class Genome : IComparable { ! private int[] genes; ! private int size; ! private double fitness; ! private object meaning; ! private bool hasBeenCloned; ! private bool hasBeenMutated; ! ! private IGenomeManager genomeManager; ! private GeneticOptimizer geneticOptimizer; private int generation; private bool hasFitnessBeenAssigned; ! ! public bool HasBeenCloned ! { ! get{return this.hasBeenCloned;} ! //set{this.hasBeenCloned = value;} ! } ! ! /// <summary> ! /// Returns true if a gene has been mutated ! /// through a IGenomeManager Mutate method ! /// </summary> ! public bool HasBeenMutated ! { ! get{return this.hasBeenMutated;} ! set{this.hasBeenMutated = value;} ! } ! ! private void setFitnessValue(double fitnessValue) ! { ! this.fitness = fitnessValue; ! this.hasFitnessBeenAssigned = true; ! } ! ! ! public double Fitness ! { ! get { if ( double.IsNaN( this.fitness ) ) *************** *** 77,152 **** "The fitness for this genome is not a number!" ); if ( ! this.hasFitnessBeenAssigned ) ! // the genome's fitness has not been assigned yet this.setFitnessValue(this.genomeManager.GetFitnessValue(this)); return this.fitness; } ! } ! public object Meaning ! { get { if ( this.meaning == null ) ! // the genome's meaning has not been assigned yet this.meaning = this.genomeManager.Decode( this ); return this.meaning; } ! } ! public int Size ! { ! get{return this.size;} ! } ! ! public int GetMinValueForGenes(int genePosition) ! { ! return this.genomeManager.GetMinValueForGenes(genePosition); ! } ! public int GetMaxValueForGenes(int genePosition) ! { ! return this.genomeManager.GetMaxValueForGenes(genePosition); ! } ! /// <summary> ! /// Returns the generation at which ! /// the current genome has been generated ! /// by the Genetic Optimizer ! /// </summary> ! public int Generation ! { ! get{return this.generation;} ! //set{this.generation = value;} ! } ! ! //implementation of IComparable interface ! public int CompareTo(object obj) { ! if(obj is Genome) { ! Genome genome = (Genome)obj; ! return this.Fitness.CompareTo(genome.Fitness); ! } ! ! throw new ArgumentException("Object is not a Genome"); ! } //end of implementation of IComparable interface ! ! /// <summary> ! /// It creates a new genome object initialized by a IGenomeManager ! /// </summary> ! public Genome(IGenomeManager genomeManager, ! GeneticOptimizer geneticOptimizer) { this.genomeManager = genomeManager; this.geneticOptimizer = geneticOptimizer; this.size = this.genomeManager.GenomeSize; ! this.genes = new int[ this.size ]; } - - public void AssignMeaning() - { - this.meaning = this.genomeManager.Decode(this); - } public void CreateGenes() --- 77,152 ---- "The fitness for this genome is not a number!" ); if ( ! this.hasFitnessBeenAssigned ) ! // the genome's fitness has not been assigned yet this.setFitnessValue(this.genomeManager.GetFitnessValue(this)); return this.fitness; } ! } ! public object Meaning ! { get { if ( this.meaning == null ) ! // the genome's meaning has not been assigned yet this.meaning = this.genomeManager.Decode( this ); return this.meaning; } ! } ! public int Size ! { ! get{return this.size;} ! } ! public int GetMinValueForGenes(int genePosition) ! { ! return this.genomeManager.GetMinValueForGenes(genePosition); ! } ! public int GetMaxValueForGenes(int genePosition) ! { ! return this.genomeManager.GetMaxValueForGenes(genePosition); ! } ! ! /// <summary> ! /// Returns the generation at which ! /// the current genome has been generated ! /// by the Genetic Optimizer ! /// </summary> ! public int Generation ! { ! get{return this.generation;} ! //set{this.generation = value;} ! } ! ! //implementation of IComparable interface ! public int CompareTo(object obj) { ! if(obj is Genome) { ! Genome genome = (Genome)obj; ! return this.Fitness.CompareTo(genome.Fitness); ! } ! ! throw new ArgumentException("Object is not a Genome"); ! } //end of implementation of IComparable interface ! ! /// <summary> ! /// It creates a new genome object initialized by a IGenomeManager ! /// </summary> ! public Genome(IGenomeManager genomeManager, ! GeneticOptimizer geneticOptimizer) { this.genomeManager = genomeManager; this.geneticOptimizer = geneticOptimizer; this.size = this.genomeManager.GenomeSize; ! this.genes = new int[ this.size ]; ! } ! ! public void AssignMeaning() ! { ! this.meaning = this.genomeManager.Decode(this); } public void CreateGenes() *************** *** 158,184 **** this.generation = this.geneticOptimizer.GenerationCounter; } ! ! public void CalculateFitness() ! { ! this.fitness = this.genomeManager.GetFitnessValue(this); ! } ! ! ! /// <summary> ! /// It creates an new genome, identical to the current instance ! /// </summary> ! public Genome Clone() ! { ! Genome returnValue = new Genome(this.genomeManager, this.geneticOptimizer); ! returnValue.CopyValuesInGenes(this.genes); ! returnValue.setFitnessValue(this.fitness); ! returnValue.meaning = this.meaning; ! returnValue.generation = this.Generation; ! returnValue.hasBeenCloned = true; ! ! return returnValue; ! } ! ! public int[] Genes() { return this.genes; --- 158,184 ---- this.generation = this.geneticOptimizer.GenerationCounter; } ! ! public void CalculateFitness() ! { ! this.fitness = this.genomeManager.GetFitnessValue(this); ! } ! ! ! /// <summary> ! /// It creates an new genome, identical to the current instance ! /// </summary> ! public Genome Clone() ! { ! Genome returnValue = new Genome(this.genomeManager, this.geneticOptimizer); ! returnValue.CopyValuesInGenes(this.genes); ! returnValue.setFitnessValue(this.fitness); ! returnValue.meaning = this.meaning; ! returnValue.generation = this.Generation; ! returnValue.hasBeenCloned = true; ! ! return returnValue; ! } ! ! public int[] Genes() { return this.genes; *************** *** 193,308 **** this.generation = this.geneticOptimizer.GenerationCounter; } ! ! public void SetGeneValue(int geneValue, int genePosition) ! { ! if(geneValue < this.GetMinValueForGenes(genePosition) || ! geneValue > this.GetMaxValueForGenes(genePosition) ) ! throw new IndexOutOfRangeException("Gene value not valid for the gene at" + ! " the given position!"); ! if( geneValue != this.GetGeneValue(genePosition) ) ! // if a new value is stored in the given position, then ! // fitness has to be calculated again, and so meaning { this.hasFitnessBeenAssigned = false; this.meaning = null; } ! this.genes[genePosition] = geneValue; ! //whenever at least one gene has been written, //the current generation number is stored ! this.generation = this.geneticOptimizer.GenerationCounter; ! } ! ! public int GetGeneValue(int genePosition) ! { ! return this.genes[genePosition]; ! } ! ! /// <summary> ! /// It returns true if the given gene is already stored in the current genome ! /// </summary> ! public bool HasGene(int geneValue) ! { ! bool returnValue = false; ! foreach(int gene in this.Genes()) ! { ! if( geneValue == gene ) ! returnValue = true; ! } ! return returnValue; ! } ! ! /// <summary> ! /// It returns true if the given gene is already stored in the current genome ! /// </summary> ! /// <param name="fromGenePosition">First gene position from which the checking ! /// has to be done, inside the given genome</param> ! /// <param name="toGenePosition">Last gene position to which the checking ! /// has to be done, inside the given genome</param> ! public bool HasGene(int geneValue, int fromGenePosition, ! int toGenePosition) ! { ! if(fromGenePosition < 0 || ! toGenePosition < 0 || ! fromGenePosition >= this.size || ! toGenePosition >= this.size) ! throw new IndexOutOfRangeException("error in parameters fromGenePosition or toGenePosition!"); ! ! bool returnValue = false; ! for(int i = fromGenePosition; i <= toGenePosition; i++) ! { ! if( geneValue == this.Genes()[i] ) ! returnValue = true; ! } ! return returnValue; ! } ! /// <summary> ! /// It returns true if the given gene is already stored in the current genome ! /// at the given genePosition ! /// </summary> ! /// <param name="genePosition">Gene position where the check ! /// has to be done, inside the given genome</param> ! public bool HasGene(int geneValue, int genePosition) ! { ! if(genePosition >= this.size) ! throw new IndexOutOfRangeException("bad genePosition parameter!"); ! ! return geneValue == this.Genes()[genePosition]; ! } ! ! /// <summary> ! /// It returns true if the current instance shares no gene with the given ! /// genome ! /// </summary> ! public bool SharesNoGeneWith(Genome genomeToBeCompared) ! { ! bool returnValue = true; ! foreach(int gene in this.Genes()) ! { ! if( genomeToBeCompared.HasGene(gene) ) ! return false; ! } ! return returnValue; ! } ! /// <summary> ! /// It returns true if the current instance of genome has some duplicate ! /// values in genes ! /// </summary> ! public bool HasSomeDuplicateGenes() ! { ! bool returnValue = false; ! for(int i = 0; i < this.size ; i++) ! { ! for(int j = i + 1; j < this.size ; j++) ! { ! if(this.genes[i] == this.genes[j]) ! returnValue = true; ! } ! } ! return returnValue; ! } ! } } --- 193,308 ---- this.generation = this.geneticOptimizer.GenerationCounter; } ! ! public void SetGeneValue(int geneValue, int genePosition) ! { ! if(geneValue < this.GetMinValueForGenes(genePosition) || ! geneValue > this.GetMaxValueForGenes(genePosition) ) ! throw new IndexOutOfRangeException("Gene value not valid for the gene at" + ! " the given position!"); ! if( geneValue != this.GetGeneValue(genePosition) ) ! // if a new value is stored in the given position, then ! // fitness has to be calculated again, and so meaning { this.hasFitnessBeenAssigned = false; this.meaning = null; } ! this.genes[genePosition] = geneValue; ! //whenever at least one gene has been written, //the current generation number is stored ! this.generation = this.geneticOptimizer.GenerationCounter; ! } ! ! public int GetGeneValue(int genePosition) ! { ! return this.genes[genePosition]; ! } ! ! /// <summary> ! /// It returns true if the given gene is already stored in the current genome ! /// </summary> ! public bool HasGene(int geneValue) ! { ! bool returnValue = false; ! foreach(int gene in this.Genes()) ! { ! if( geneValue == gene ) ! returnValue = true; ! } ! return returnValue; ! } ! ! /// <summary> ! /// It returns true if the given gene is already stored in the current genome ! /// </summary> ! /// <param name="fromGenePosition">First gene position from which the checking ! /// has to be done, inside the given genome</param> ! /// <param name="toGenePosition">Last gene position to which the checking ! /// has to be done, inside the given genome</param> ! public bool HasGene(int geneValue, int fromGenePosition, ! int toGenePosition) ! { ! if(fromGenePosition < 0 || ! toGenePosition < 0 || ! fromGenePosition >= this.size || ! toGenePosition >= this.size) ! throw new IndexOutOfRangeException("error in parameters fromGenePosition or toGenePosition!"); ! ! bool returnValue = false; ! for(int i = fromGenePosition; i <= toGenePosition; i++) ! { ! if( geneValue == this.Genes()[i] ) ! returnValue = true; ! } ! return returnValue; ! } ! /// <summary> ! /// It returns true if the given gene is already stored in the current genome ! /// at the given genePosition ! /// </summary> ! /// <param name="genePosition">Gene position where the check ! /// has to be done, inside the given genome</param> ! public bool HasGene(int geneValue, int genePosition) ! { ! if(genePosition >= this.size) ! throw new IndexOutOfRangeException("bad genePosition parameter!"); ! ! return geneValue == this.Genes()[genePosition]; ! } ! ! /// <summary> ! /// It returns true if the current instance shares no gene with the given ! /// genome ! /// </summary> ! public bool SharesNoGeneWith(Genome genomeToBeCompared) ! { ! bool returnValue = true; ! foreach(int gene in this.Genes()) ! { ! if( genomeToBeCompared.HasGene(gene) ) ! return false; ! } ! return returnValue; ! } ! /// <summary> ! /// It returns true if the current instance of genome has some duplicate ! /// values in genes ! /// </summary> ! public bool HasSomeDuplicateGenes() ! { ! bool returnValue = false; ! for(int i = 0; i < this.size ; i++) ! { ! for(int j = i + 1; j < this.size ; j++) ! { ! if(this.genes[i] == this.genes[j]) ! returnValue = true; ! } ! } ! return returnValue; ! } ! } } |
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:15:13
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Collections In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv32384/Collections Modified Files: FloatArrayManager.cs Log Message: A new method double[] ConvertToDouble( float[] valuesToBeConverted ) has been added, to convert an array of floats to an array of doubles Index: FloatArrayManager.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Collections/FloatArrayManager.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FloatArrayManager.cs 13 Jul 2007 09:59:07 -0000 1.1 --- FloatArrayManager.cs 27 Mar 2010 17:15:05 -0000 1.2 *************** *** 57,60 **** --- 57,73 ---- } #endregion + + /// <summary> + /// converts the float array to a double array + /// </summary> + /// <param name="valuesToBeConverted"></param> + /// <returns></returns> + public static double[] ConvertToDouble( float[] valuesToBeConverted ) + { + double[] convertedValues = new double[ valuesToBeConverted.Length ]; + for( int i = 0 ; i < valuesToBeConverted.Length ; i++ ) + convertedValues[ i ] = valuesToBeConverted[ i ]; + return convertedValues; + } } } |
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:13:24
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Statistics In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv31854/Statistics Modified Files: BasicFunctions.cs Log Message: An exception now is thrown out, when the method GetVariance is invoked with less then two observations Index: BasicFunctions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Statistics/BasicFunctions.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** BasicFunctions.cs 11 May 2008 17:50:22 -0000 1.13 --- BasicFunctions.cs 27 Mar 2010 17:13:15 -0000 1.14 *************** *** 172,175 **** --- 172,177 ---- static public double GetVariance( ICollection data ) { + if ( data.Count < 2 ) + throw new Exception( "Variance requires at least 2 elements!" ); double simpleAverage = BasicFunctions.GetSimpleAverage(data); double sum = 0; |
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:10:44
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv31177 Modified Files: ADT_SD.csproj Log Message: Econometrics\ILinearRegression.cs has been added Econometrics\LinearRegression.cs has been added LinearAlgebra\LinearSystemSolver.cs has been added Index: ADT_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ADT_SD.csproj,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ADT_SD.csproj 20 Nov 2008 20:26:29 -0000 1.13 --- ADT_SD.csproj 27 Mar 2010 17:10:32 -0000 1.14 *************** *** 5,9 **** <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{6A426DC3-013E-4D38-A1AE-7BE128BF2DD7}</ProjectGuid> ! <RootNamespace>ADT</RootNamespace> <AssemblyName>QuantProject.ADT</AssemblyName> <OutputType>Library</OutputType> --- 5,9 ---- <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{6A426DC3-013E-4D38-A1AE-7BE128BF2DD7}</ProjectGuid> ! <RootNamespace>QuantProject.ADT</RootNamespace> <AssemblyName>QuantProject.ADT</AssemblyName> <OutputType>Library</OutputType> *************** *** 49,55 **** --- 49,58 ---- <Compile Include="BarComponent.cs" /> <Compile Include="ConstantsProvider.cs" /> + <Compile Include="Econometrics\ILinearRegression.cs" /> + <Compile Include="Econometrics\LinearRegression.cs" /> <Compile Include="ExtendedDataTable.cs" /> <Compile Include="ExtendedDateTime.cs" /> <Compile Include="HashProvider.cs" /> + <Compile Include="LinearAlgebra\LinearSystemSolver.cs" /> <Compile Include="Optimizing\BruteForce\BestParametersManager.cs" /> <Compile Include="Optimizing\BruteForce\ParametersManagers\BruteForceOptimizableParametersManagerWithoutEquivalentsAsTopBestParameters.cs" /> *************** *** 103,106 **** --- 106,111 ---- <ItemGroup> <Folder Include="Messaging" /> + <Folder Include="Econometrics" /> + <Folder Include="LinearAlgebra" /> <Folder Include="Timing" /> <Folder Include="Optimizing\BruteForce" /> |
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:09:12
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/LinearAlgebra In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv30847 Added Files: LinearSystemSolver.cs Log Message: Solves a linear system using the Gauss elimination algorithm --- NEW FILE: LinearSystemSolver.cs --- /* QuantProject - Quantitative Finance Library LinearRegressionNew.cs Copyright (C) 2010 Glauco Siliprandi 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; namespace QuantProject.ADT.LinearAlgebra { /// <summary> /// Solves a linear system using the Gauss elimination algorithm /// </summary> public class LinearSystemSolver { public LinearSystemSolver() { } #region FindSolution private static void findSolution_checkParameters( double[,] A , double[] b ) { if ( A.GetLength( 0 ) != b.Length ) throw new Exception( "A and b don't have the same number of rows!" ); } private static void createACopyOfTheParameters( double[,] originalA , double[] original_b , out double[,] A , out double[] b ) { int n = original_b.Length; A = new double[ n , n ]; b = new double[ n ]; for( int i = 0 ; i < n ; i++ ) { for( int j = 0 ; j < n ; j++ ) A[ i , j ] = originalA[ i , j ]; b[ i ] = original_b[ i ]; } } #region findSolution #region forwardElimination private static int findTheRowWithTheLargestFirstValue( int currentRowIndex , double[,] A , double[] b ) { int rowWithTheLargestFirstValue = currentRowIndex; for ( int i = currentRowIndex + 1 ; i < b.Length ; i++ ) if ( Math.Abs( A[ i , currentRowIndex ] ) > Math.Abs( A[ rowWithTheLargestFirstValue , currentRowIndex ] ) ) rowWithTheLargestFirstValue = i; return rowWithTheLargestFirstValue; } private static void checkIfSingular( int currentRowIndex , double[,] A ) { if ( Math.Abs( A[ currentRowIndex , currentRowIndex ] ) < 0.000001 ) throw new Exception( "The system doesn't have a single solution!" ); } private static void swapRows( int index1 , int index2 , double[,] A , double[] b ) { for( int j = 0 ; j < b.Length ; j++ ) { double temp = A[ index1 , j ]; A[ index1 , j ] = A[ index2 , j ]; A[ index2 , j ] = temp; temp = b[ index1 ]; b[ index1 ] = b[ index2 ]; b[ index2 ] = temp; } } private static void normalizeTheCurrentRow( int currentRowIndex , double[,] A , double[] b ) { double pivotValue = A[ currentRowIndex , currentRowIndex ]; for( int j = 0 ; j < b.Length ; j++ ) A[ currentRowIndex , j ] = A[ currentRowIndex , j ] / pivotValue; b[ currentRowIndex ] = b[ currentRowIndex ] / pivotValue; } #region reduceTheFollowingRows private static void reduceTheFollowingRow( int rowToBeReduced , int indexOfThePivotRow , double[,] A , double[] b ) { double pivotValue = A[ rowToBeReduced , indexOfThePivotRow ]; for( int j = indexOfThePivotRow ; j < b.Length ; j++ ) A[ rowToBeReduced , j ] -= pivotValue * A[ indexOfThePivotRow , j ]; b[ rowToBeReduced ] -= pivotValue * b[ indexOfThePivotRow ]; } private static void reduceTheFollowingRows( int currentRowIndex , double[,] A , double[] b ) { for( int i = currentRowIndex + 1 ; i < b.Length ; i++ ) LinearSystemSolver.reduceTheFollowingRow( i , currentRowIndex , A , b ); } #endregion reduceTheFollowingRows private static void forwardElimination( int currentRowIndex , double[,] A , double[] b ) { int indexOfTheRowWithLargestFirstValue = LinearSystemSolver.findTheRowWithTheLargestFirstValue( currentRowIndex , A , b ); LinearSystemSolver.swapRows( currentRowIndex , indexOfTheRowWithLargestFirstValue , A , b ); LinearSystemSolver.checkIfSingular( currentRowIndex , A ); LinearSystemSolver.normalizeTheCurrentRow( currentRowIndex , A , b ); LinearSystemSolver.reduceTheFollowingRows( currentRowIndex , A , b ); } private static void forwardElimination( double[,] A , double[] b ) { for( int i = 0 ; i < b.Length ; i++ ) LinearSystemSolver.forwardElimination( i , A , b ); } #endregion forwardElimination #region backSubstitution private static double computeValueToBeSubtracted( double[,] A , double[] b , int i , double[] solution ) { double valueToBeSubtracted = 0; for( int j = i+1 ; j < b.Length ; j++ ) valueToBeSubtracted += A[ i , j ] * solution[ j ]; return valueToBeSubtracted; } private static void backSubstitution( double[,] A , double[] b , int i , double[] solution ) { double valueToBeSubtracted = LinearSystemSolver.computeValueToBeSubtracted( A , b , i , solution ); solution[ i ] = b[ i ] - valueToBeSubtracted; } private static double[] backSubstitution( double[,] A , double[] b ) { double[] solution = new double[ b.Length ]; for( int i = b.Length - 1 ; i >= 0 ; i-- ) LinearSystemSolver.backSubstitution( A , b , i , solution ); return solution; } #endregion backSubstitution private static double[] findSolution( double[,] A , double[] b ) { LinearSystemSolver.forwardElimination( A , b ); double[] solution = LinearSystemSolver.backSubstitution( A , b ); return solution; } #endregion findSolution /// <summary> /// Computes the solution of the linear system Ax=b /// </summary> /// <param name="A"></param> /// <param name="b"></param> /// <returns></returns> public static double[] FindSolution( double[,] originalA , double[] original_b ) { double[,] A; double[] b; LinearSystemSolver.findSolution_checkParameters( originalA , original_b ); LinearSystemSolver.createACopyOfTheParameters( originalA , original_b , out A , out b ); double[] solution = LinearSystemSolver.findSolution( A , b ); return solution; } #endregion FindSolution } } |
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:07:38
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/LinearAlgebra In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv30333/LinearAlgebra Log Message: Directory /cvsroot/quantproject/QuantProject/b1_ADT/LinearAlgebra added to the repository |
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:07:05
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Econometrics In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv30027/Econometrics Added Files: LinearRegression.cs Log Message: Computes a Linear Regression --- NEW FILE: LinearRegression.cs --- /* QuantProject - Quantitative Finance Library LinearRegression.cs Copyright (C) 2010 Glauco Siliprandi 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 QuantProject.ADT.LinearAlgebra; namespace QuantProject.ADT.Econometrics { /// <summary> /// Computes a Linear Regression /// </summary> [Serializable] public class LinearRegression : ILinearRegression { private double sumOfSquareResiduals; private double centeredTotalSumOfSquares; private double[] estimatedCoefficients; public double[] EstimatedCoefficients { get { if ( this.estimatedCoefficients == null ) throw new Exception( "The method RunRegression() must be invoked before " + "reading this property!" ); return this.estimatedCoefficients; } } private double centeredRSquare; public double CenteredRSquare { get { return this.centeredRSquare; } } public LinearRegression() { } #region RunRegression private void runRegression_checkParameters( double[] regressand , double[,] regressors ) { if ( regressand.Length != regressors.GetLength( 0 ) ) throw new Exception( "The regressand doesn't have the same number of observations as " + "the regressors!" ); } private double[,] getXtransposeX( double[,] X ) { int n = X.GetLength( 0 ); int k = X.GetLength( 1 ); double[,] xTransposeX = new double[ k , k ]; for( int i = 0 ; i < k ; i++ ) for( int j = 0 ; j < k ; j++ ) { xTransposeX[ i , j ] = 0; for( int t = 0 ; t < n ; t++ ) xTransposeX[ i , j ] += X[ t , i ] * X[ t , j ]; } return xTransposeX; } private double[] getXtransposeY( double[] y , double[,] X ) { int n = y.Length; int k = X.GetLength( 1 ); double[] xTransposeY = new double[ k ]; for( int j = 0 ; j < k ; j++ ) { xTransposeY[ j ] = 0; for( int t = 0 ; t < n ; t++ ) xTransposeY[ j ] += X[ t , j ] * y[ t ]; } return xTransposeY; } #region computeRSquare private double getYBar( double[] regressand ) { double yBar = 0; for( int i = 0 ; i < regressand.Length ; i++ ) yBar += regressand[ i ]; yBar = yBar / regressand.Length; return yBar; } #region getYHat private double getYHat( double[] regressand , double[,] regressors , int i ) { double returnValue = 0; for( int j = 0 ; j < regressors.GetLength( 1 ) ; j++ ) returnValue += this.estimatedCoefficients[ j ] * regressors[ i , j ]; return returnValue; } private double[] getYHat( double[] regressand , double[,] regressors ) { double[] yHat = new double[ regressand.Length ]; for( int i = 0 ; i < regressand.Length ; i++ ) yHat[ i ] = this.getYHat( regressand , regressors , i ); return yHat; } #endregion getYHat private void setSumOfSquareResidualsAndCenteredTotalSumOfSquares( double[] regressand , double[,] regressors , double yBar , double[] yHat ) { this.sumOfSquareResiduals = 0; this.centeredTotalSumOfSquares = 0; for( int i = 0 ; i < regressand.Length ; i++ ) { this.sumOfSquareResiduals += ( yHat[ i ] - regressand[ i ] ) * ( yHat[ i ] - regressand[ i ] ); this.centeredTotalSumOfSquares += ( regressand[ i ] - yBar ) * ( regressand[ i ] - yBar ); } } private void setSumOfSquareResidualsAndCenteredTotalSumOfSquares( double[] regressand , double[,] regressors ) { double yBar = this.getYBar( regressand ); double[] yHat = this.getYHat( regressand , regressors ); this.setSumOfSquareResidualsAndCenteredTotalSumOfSquares( regressand , regressors , yBar , yHat ); } private void computeCenteredRSquare( double[] regressand , double[,] regressors ) { this.setSumOfSquareResidualsAndCenteredTotalSumOfSquares( regressand , regressors); this.centeredRSquare = 1 - this.sumOfSquareResiduals / this.centeredTotalSumOfSquares; } #endregion computeRSquare public void RunRegression( double[] regressand , double[,] regressors ) { this.runRegression_checkParameters( regressand , regressors ); double[,] xTransposeX = this.getXtransposeX( regressors ); double[] xTransposeY = this.getXtransposeY( regressand , regressors ); this.estimatedCoefficients = LinearSystemSolver.FindSolution( xTransposeX , xTransposeY ); this.computeCenteredRSquare( regressand , regressors ); } #endregion RunRegression } } |
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:05:59
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Econometrics In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv29508/Econometrics Added Files: ILinearRegression.cs Log Message: Interface to be implemented by those classes that run a linear regression --- NEW FILE: ILinearRegression.cs --- /* * Created by SharpDevelop. * User: Glauco * Date: 22/03/2010 * Time: 16.13 * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; namespace QuantProject.ADT.Econometrics { /// <summary> /// Interface to be implemented by those classes that run a /// linear regression /// </summary> public interface ILinearRegression { double[] EstimatedCoefficients{ get; } double CenteredRSquare{ get; } void RunRegression( double[] regressand , double[,] regressors ); } } |
|
From: Glauco S. <gla...@us...> - 2010-03-27 17:05:04
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Econometrics In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv29242/Econometrics Log Message: Directory /cvsroot/quantproject/QuantProject/b1_ADT/Econometrics added to the repository |
|
From: Glauco S. <gla...@us...> - 2010-02-02 19:54:23
|
Update of /cvsroot/quantproject/QuantProject In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv14900 Removed Files: b91_QuantProject.csproj Log Message: I guess we don't need this file. Millo, please confirm --- b91_QuantProject.csproj DELETED --- |
|
From: Glauco S. <gla...@us...> - 2010-01-31 19:15:07
|
Update of /cvsroot/quantproject/QuantProject/t5_Testing/b1_ADT In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv13561/t5_Testing/b1_ADT Modified Files: Sum.cs Log Message: The license statement has been added Index: Sum.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/t5_Testing/b1_ADT/Sum.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Sum.cs 31 Jan 2010 19:00:45 -0000 1.1 --- Sum.cs 31 Jan 2010 19:14:58 -0000 1.2 *************** *** 1,10 **** /* ! * Created by SharpDevelop. ! * User: Glauco ! * Date: 1/31/2010 ! * Time: 7:26 PM ! * ! * To change this template use Tools | Options | Coding | Edit Standard Headers. ! */ using System; --- 1,23 ---- /* ! QuantProject - Quantitative Finance Library ! ! Sum.cs ! Copyright (C) 2003 ! Glauco Siliprandi ! ! 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; |
|
From: Glauco S. <gla...@us...> - 2010-01-31 19:00:53
|
Update of /cvsroot/quantproject/QuantProject/t5_Testing/b1_ADT In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11675 Added Files: Sum.cs Log Message: This class tests the QuantProject.ADT.Statistics.BasicFunctions.Sum() method --- NEW FILE: Sum.cs --- /* * Created by SharpDevelop. * User: Glauco * Date: 1/31/2010 * Time: 7:26 PM * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; using NUnit.Framework; using QuantProject.ADT.Statistics; namespace QuantProject.Testing.Statistics { /// <summary> /// This class tests the /// QuantProject.ADT.Statistics.BasicFunctions.Sum() method /// </summary> [TestFixture] public class BasicFunctionsSum { [Test] public void Sum() { double[] values = { 1 , 2 }; double sumValue = BasicFunctions.Sum( values ); Assert.AreEqual( 3 , sumValue ); // this is ok // comment out the following statemente if you want to get a successfull test Assert.AreEqual( 3.1 , sumValue ); // this one faults } } } |
|
From: Glauco S. <gla...@us...> - 2010-01-31 18:58:15
|
Update of /cvsroot/quantproject/QuantProject/t5_Testing/b1_ADT In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11084/b1_ADT Log Message: Directory /cvsroot/quantproject/QuantProject/t5_Testing/b1_ADT added to the repository |