quantproject-developers Mailing List for QuantProject (Page 121)
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...> - 2005-01-09 19:45:59
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21511/b3_Data Modified Files: b3_Data.csproj Log Message: Automatic changes from the environment Index: b3_Data.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/b3_Data.csproj,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** b3_Data.csproj 20 Dec 2004 00:09:51 -0000 1.20 --- b3_Data.csproj 9 Jan 2005 19:45:49 -0000 1.21 *************** *** 212,216 **** BuildAction = "Compile" /> - <Folder RelPath = "NewFolder1\" /> <File RelPath = "Selectors\ITickerReceiver.cs" --- 212,215 ---- |
|
From: Glauco S. <gla...@us...> - 2005-01-09 19:44:57
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21290/b4_Business Modified Files: b4_Business.csproj Log Message: - the IHistoricalQuoteProvider.cs class file has been added to the project - the HistoricalRawQuoteProvider.cs class file has been added to the project - the HistoricalAdjustedQuoteProvider.cs class file has been added to the project Index: b4_Business.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** b4_Business.csproj 8 Jan 2005 11:45:34 -0000 1.16 --- b4_Business.csproj 9 Jan 2005 19:44:45 -0000 1.17 *************** *** 223,226 **** --- 223,231 ---- /> <File + RelPath = "a07_DataProviders\HistoricalAdjustedQuoteProvider.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a07_DataProviders\HistoricalEndOfDayDataStreamer.cs" SubType = "Code" *************** *** 228,231 **** --- 233,246 ---- /> <File + RelPath = "a07_DataProviders\HistoricalRawQuoteProvider.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "a07_DataProviders\IHistoricalQuoteProvider.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a1_Financial\a1_Instruments\Instrument.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2005-01-09 19:42:19
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20641/b2_DataAccess Modified Files: b2_DataAccess.csproj Log Message: - the QuoteField.cs class file has been added to the project Index: b2_DataAccess.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/b2_DataAccess.csproj,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** b2_DataAccess.csproj 4 Aug 2004 22:46:08 -0000 1.12 --- b2_DataAccess.csproj 9 Jan 2005 19:41:54 -0000 1.13 *************** *** 118,121 **** --- 118,126 ---- /> <File + RelPath = "QuoteField.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "SQLBuilder.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2005-01-09 19:40:57
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20414/b4_Business/a1_Financial/a2_Accounting/h5_Reporting Modified Files: AccountReport.cs Log Message: - the IHistoricalQuoteProvider "concept" has been introduced Index: AccountReport.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/AccountReport.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AccountReport.cs 29 Nov 2004 15:47:59 -0000 1.8 --- AccountReport.cs 9 Jan 2005 19:40:48 -0000 1.9 *************** *** 29,32 **** --- 29,33 ---- using QuantProject.ADT; using QuantProject.ADT.Histories; + using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting.Transactions; using QuantProject.Business.Financial.Instruments; *************** *** 41,44 **** --- 42,46 ---- { private Account account; + private IHistoricalQuoteProvider historicalQuoteProvider; private Account accountCopy = new Account( "AccountCopy" ); private string reportName; *************** *** 60,68 **** get { return endDateTime; } } ! public string BuyAndHoldTicker ! { ! get { return buyAndHoldTicker; } ! } ! // public long NumDaysForInterval // { // get { return numDaysForInterval; } --- 62,74 ---- get { return endDateTime; } } ! public string BuyAndHoldTicker ! { ! get { return buyAndHoldTicker; } ! } ! public Account Account ! { ! get { return this.account; } ! } ! // public long NumDaysForInterval // { // get { return numDaysForInterval; } *************** *** 100,106 **** /// </summary> /// <param name="account"></param> ! public AccountReport( Account account ) { this.account = account; } --- 106,114 ---- /// </summary> /// <param name="account"></param> ! public AccountReport( Account account , ! IHistoricalQuoteProvider historicalQuoteProvider ) { this.account = account; + this.historicalQuoteProvider = historicalQuoteProvider; } *************** *** 127,133 **** dataRow[ "AccountCash" ] = this.accountCopy.CashAmount; dataRow[ "PortfolioValue" ] = this.accountCopy.Portfolio.GetMarketValue( ! endOfDayDateTime ); ! dataRow[ "AccountValue" ] = this.accountCopy.GetMarketValue( endOfDayDateTime ); ! dataRow[ "PnL" ] = this.accountCopy.GetMarketValue( endOfDayDateTime ) + this.accountCopy.Transactions.TotalWithdrawn - this.accountCopy.Transactions.TotalAddedCash; --- 135,142 ---- dataRow[ "AccountCash" ] = this.accountCopy.CashAmount; dataRow[ "PortfolioValue" ] = this.accountCopy.Portfolio.GetMarketValue( ! endOfDayDateTime , this.historicalQuoteProvider ); ! dataRow[ "AccountValue" ] = (double)dataRow[ "AccountCash" ] + ! (double)dataRow[ "PortfolioValue" ]; ! dataRow[ "PnL" ] = (double)dataRow[ "AccountValue" ] + this.accountCopy.Transactions.TotalWithdrawn - this.accountCopy.Transactions.TotalAddedCash; *************** *** 222,226 **** //this.equity = getEquity( reportName , detailedDataTable ); //this.summary = getSummary( reportName ); ! this.summary = new Tables.Summary( this ); return this; } --- 231,235 ---- //this.equity = getEquity( reportName , detailedDataTable ); //this.summary = getSummary( reportName ); ! this.summary = new Tables.Summary( this , historicalQuoteProvider ); return this; } |
|
From: Glauco S. <gla...@us...> - 2005-01-09 19:39:59
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20175/b4_Business/a1_Financial/a2_Accounting Modified Files: Account.cs Log Message: - the IHistoricalQuoteProvider "concept" has been introduced - the GetMarketValue( EndOfDayDateTime endOfDayDateTime ) method has been removed - the GetProfitNetLoss( EndOfDayDateTime endOfDayDateTime ) method has been removed - the GetProfitNetLossHistory( EndOfDayDateTime finalDateTime ) method has been removed - the CreateReport method uses the the IHistoricalQuoteProvider "concept" now Index: Account.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Account.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Account.cs 3 Jan 2005 10:44:12 -0000 1.12 --- Account.cs 9 Jan 2005 19:39:51 -0000 1.13 *************** *** 32,35 **** --- 32,36 ---- using QuantProject.ADT.Histories; using QuantProject.Data.DataProviders; + using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting.Reporting; using QuantProject.Business.Financial.Accounting.Transactions; *************** *** 129,134 **** if ( this.accountReport == null ) // the account report has not been computed yet ! this.accountReport = this.CreateReport( this.Key , 1 , this.endOfDayTimer.GetCurrentTime() ); return this.accountReport.Summary.ReturnOnAccount; } --- 130,139 ---- if ( this.accountReport == null ) // the account report has not been computed yet ! { ! AccountReport accountReport = new AccountReport( this , ! new HistoricalAdjustedQuoteProvider() ); ! this.accountReport = accountReport.Create( this.Key , 1 , this.endOfDayTimer.GetCurrentTime() ); + } return this.accountReport.Summary.ReturnOnAccount; } *************** *** 207,218 **** ! public double GetMarketValue( EndOfDayDateTime endOfDayDateTime ) ! { ! return this.CashAmount + this.Portfolio.GetMarketValue( endOfDayDateTime ); ! } public double GetMarketValue( string ticker ) { ! return HistoricalDataProvider.GetMarketValue( ticker , ! this.endOfDayTimer.GetCurrentTime().GetNearestExtendedDateTime() ); } /// <summary> --- 212,222 ---- ! // public double GetMarketValue( EndOfDayDateTime endOfDayDateTime ) ! // { ! // return this.CashAmount + this.Portfolio.GetMarketValue( endOfDayDateTime ); ! // } public double GetMarketValue( string ticker ) { ! return this.dataStreamer.GetCurrentBid( ticker ); } /// <summary> *************** *** 223,251 **** { return this.cashAmount + ! this.Portfolio.GetMarketValue( this.endOfDayTimer.GetCurrentTime() ); } ! public double GetProfitNetLoss( EndOfDayDateTime endOfDayDateTime ) ! { ! return GetMarketValue( endOfDayDateTime ) + ! this.Transactions.TotalWithdrawn - ! this.Transactions.TotalAddedCash; ! } ! ! public History GetProfitNetLossHistory( EndOfDayDateTime finalDateTime ) ! { ! History history = new History(); ! Account account = new Account( "ToGetProfitNetLossHistory" ); ! foreach ( ArrayList arrayList in this.Transactions.Values ) ! foreach ( EndOfDayTransaction transaction in arrayList ) ! { ! account.Add( transaction ); ! history.MultiAdd( transaction.EndOfDayDateTime.DateTime , ! account.GetProfitNetLoss( transaction.EndOfDayDateTime ) ); ! } ! history.MultiAdd( finalDateTime.DateTime , ! account.GetProfitNetLoss( finalDateTime ) ); ! return history; ! } ! public string ToString( DateTime dateTime ) { --- 227,254 ---- { return this.cashAmount + ! this.Portfolio.GetMarketValue( this.dataStreamer ); } ! // public double GetProfitNetLoss( EndOfDayDateTime endOfDayDateTime ) ! // { ! // return GetMarketValue( endOfDayDateTime ) + ! // this.Transactions.TotalWithdrawn - ! // this.Transactions.TotalAddedCash; ! // } ! // public History GetProfitNetLossHistory( EndOfDayDateTime finalDateTime ) ! // { ! // History history = new History(); ! // Account account = new Account( "ToGetProfitNetLossHistory" ); ! // foreach ( ArrayList arrayList in this.Transactions.Values ) ! // foreach ( EndOfDayTransaction transaction in arrayList ) ! // { ! // account.Add( transaction ); ! // history.MultiAdd( transaction.EndOfDayDateTime.DateTime , ! // account.GetProfitNetLoss( transaction.EndOfDayDateTime ) ); ! // } ! // history.MultiAdd( finalDateTime.DateTime , ! // account.GetProfitNetLoss( finalDateTime ) ); ! // return history; ! // } ! // public string ToString( DateTime dateTime ) { *************** *** 254,272 **** "\nPortfolioContent : " + this.Portfolio.ToString() + "\nPortfolioMarketValue : " + this.Portfolio.GetMarketValue( ! new EndOfDayDateTime( dateTime , EndOfDaySpecificTime.MarketClose ) ) + ! "\nAccountProfitNetLoss : " + this.GetProfitNetLoss( ! new EndOfDayDateTime( dateTime , EndOfDaySpecificTime.MarketClose ) ); } public AccountReport CreateReport( string reportName , ! int numDaysForInterval , EndOfDayDateTime endDateTime ) ! { ! AccountReport accountReport = new AccountReport( this ); ! return accountReport.Create( reportName , numDaysForInterval , endDateTime ); ! } ! public AccountReport CreateReport( string reportName , ! int numDaysForInterval , EndOfDayDateTime endDateTime , string buyAndHoldTicker ) { ! AccountReport accountReport = new AccountReport( this ); return accountReport.Create( reportName , numDaysForInterval , endDateTime , buyAndHoldTicker ); --- 257,274 ---- "\nPortfolioContent : " + this.Portfolio.ToString() + "\nPortfolioMarketValue : " + this.Portfolio.GetMarketValue( ! this.dataStreamer ); } + // public AccountReport CreateReport( string reportName , + // int numDaysForInterval , EndOfDayDateTime endDateTime ) + // { + // AccountReport accountReport = new AccountReport( this ); + // return accountReport.Create( reportName , numDaysForInterval , endDateTime ); + // } public AccountReport CreateReport( string reportName , ! int numDaysForInterval , EndOfDayDateTime endDateTime , string buyAndHoldTicker , ! IHistoricalQuoteProvider historicalQuoteProvider) { ! AccountReport accountReport = new AccountReport( this , historicalQuoteProvider ); return accountReport.Create( reportName , numDaysForInterval , endDateTime , buyAndHoldTicker ); |
|
From: Marco M. <mi...@us...> - 2005-01-08 12:01:46
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28768/b7_Scripts/TickerSelectionTesting Modified Files: RunEfficientCTOPortfolio.cs Log Message: Now the account is initialized with an IndexBasedEndOfDayTimer Index: RunEfficientCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTOPortfolio.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RunEfficientCTOPortfolio.cs 6 Jan 2005 18:58:38 -0000 1.6 --- RunEfficientCTOPortfolio.cs 8 Jan 2005 12:01:38 -0000 1.7 *************** *** 77,84 **** this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2000 , 11 , 1 ) , EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2000 , 11 , 4 ) , EndOfDaySpecificTime.OneHourAfterMarketClose ); ! this.numIntervalDays = 2; } #region Run --- 77,84 ---- this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2000 , 1 , 1 ) , EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2000 , 1 , 10 ) , EndOfDaySpecificTime.OneHourAfterMarketClose ); ! this.numIntervalDays = 7; } #region Run *************** *** 107,111 **** { this.endOfDayTimer = ! new HistoricalEndOfDayTimer( this.startDateTime ); } private void run_initializeAccount() --- 107,111 ---- { this.endOfDayTimer = ! new IndexBasedEndOfDayTimer( this.startDateTime, "^MIBTEL" ); } private void run_initializeAccount() |
|
From: Marco M. <mi...@us...> - 2005-01-08 11:59:26
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28298/b7_Scripts/TickerSelectionTesting Modified Files: EndOfDayTimerHandler.cs Log Message: Little bug fixed for the market open handler Index: EndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandler.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** EndOfDayTimerHandler.cs 6 Jan 2005 18:58:36 -0000 1.6 --- EndOfDayTimerHandler.cs 8 Jan 2005 11:59:14 -0000 1.7 *************** *** 74,77 **** --- 74,78 ---- this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; this.orders = new ArrayList(); + this.chosenTickers = new string[numberOfTickersToBeChosen]; } *************** *** 93,100 **** foreach ( string ticker in this.chosenTickers ) { ! //if ( !this.account.Contains( ticker ) ) ! //{ marketOpenEventHandler_orderChosenTickers_addToOrderList_forTicker( ticker ); - //} } } --- 94,99 ---- foreach ( string ticker in this.chosenTickers ) { ! if(ticker != null) marketOpenEventHandler_orderChosenTickers_addToOrderList_forTicker( ticker ); } } |
|
From: Marco M. <mi...@us...> - 2005-01-08 11:52:11
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27097/b3_Data/DataTables Modified Files: Quotes.cs Log Message: Added methods for getting first valid raw (not adjusted) values for open and close, at a given date Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/Quotes.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Quotes.cs 28 Aug 2004 17:18:06 -0000 1.9 --- Quotes.cs 8 Jan 2005 11:51:57 -0000 1.10 *************** *** 504,507 **** --- 504,533 ---- } + /// <summary> + /// Gets the first valid raw (not adjusted) close at the given date + /// </summary> + /// <returns></returns> + public float GetFirstValidRawClose(DateTime date ) + { + object[] keys = new object[1]; + keys[0] = this.GetFirstValidQuoteDate(date.Date); + DataRow foundRow = this.Rows.Find(keys); + if(foundRow==null) + throw new Exception("No quote for such a date!"); + return (float)foundRow[Quotes.Close]; + } + /// <summary> + /// Gets the first valid raw (not adjusted) open at the given date + /// </summary> + /// <returns></returns> + public float GetFirstValidRawOpen(DateTime date ) + { + object[] keys = new object[1]; + keys[0] = this.GetFirstValidQuoteDate(date.Date); + DataRow foundRow = this.Rows.Find(keys); + if(foundRow==null) + throw new Exception("No quote for such a date!"); + return (float)foundRow[Quotes.Open]; + } // public DateTime GetPrecedingDate( DateTime quoteDate , int precedingDays ) |
|
From: Marco M. <mi...@us...> - 2005-01-08 11:49:48
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26711/b2_DataAccess/Tables Modified Files: Quotes.cs Log Message: Added static public methods for getting raw (not adjusted) values for open and close Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Quotes.cs 6 Jan 2005 18:43:57 -0000 1.20 --- Quotes.cs 8 Jan 2005 11:49:39 -0000 1.21 *************** *** 120,123 **** --- 120,149 ---- return (float)dataTable.Rows[0][0]; } + /// <summary> + /// Returns the raw (not adjusted) close for the given ticker at the specified date + /// is returned + /// </summary> + /// <param name="ticker">ticker for which the raw close has to be returned</param> + /// <returns></returns> + public static float GetRawClose( string ticker, DateTime date ) + { + DataTable dataTable = SqlExecutor.GetDataTable( + "select quClose from quotes where quTicker='" + ticker + "' " + + "and quDate=" + SQLBuilder.GetDateConstant(date) ); + return (float)dataTable.Rows[0][0]; + } + /// <summary> + /// Returns the raw (not adjusted) open for the given ticker at the specified date + /// is returned + /// </summary> + /// <param name="ticker">ticker for which the raw open has to be returned</param> + /// <returns></returns> + public static float GetRawOpen( string ticker, DateTime date ) + { + DataTable dataTable = SqlExecutor.GetDataTable( + "select quOpen from quotes where quTicker='" + ticker + "' " + + "and quDate=" + SQLBuilder.GetDateConstant(date) ); + return (float)dataTable.Rows[0][0]; + } /* moved now to the quotes object in the data layer, where the names are slightly different |
|
From: Marco M. <mi...@us...> - 2005-01-08 11:46:59
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26229/b4_Business/a05_Timing Modified Files: EndOfDayDateTime.cs Log Message: Added a public method for retrieving next endOfDaySpecificTime Index: EndOfDayDateTime.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing/EndOfDayDateTime.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EndOfDayDateTime.cs 20 Dec 2004 00:25:12 -0000 1.2 --- EndOfDayDateTime.cs 8 Jan 2005 11:46:49 -0000 1.3 *************** *** 128,131 **** --- 128,139 ---- } #endregion + + /// <summary> + /// Gets the next EndOfDaySpecificTime + /// </summary> + public EndOfDaySpecificTime GetNextEndOfDaySpecificTime() + { + return this.getNextSpecificTime(); + } } } |
|
From: Marco M. <mi...@us...> - 2005-01-08 11:45:43
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25990/b4_Business Modified Files: b4_Business.csproj Log Message: Added IndexBasedEndOfDayTimer class, in which time simulation avoids non-market days. The time simulation is driven now by a given market index. Index: b4_Business.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** b4_Business.csproj 15 Dec 2004 23:12:26 -0000 1.15 --- b4_Business.csproj 8 Jan 2005 11:45:34 -0000 1.16 *************** *** 218,221 **** --- 218,226 ---- /> <File + RelPath = "a05_Timing\IndexBasedEndOfDayTimer.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a07_DataProviders\HistoricalEndOfDayDataStreamer.cs" SubType = "Code" |
|
From: Marco M. <mi...@us...> - 2005-01-08 11:44:42
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25826/b4_Business/a05_Timing Added Files: IndexBasedEndOfDayTimer.cs Log Message: Added IndexBasedEndOfDayTimer class, in which time simulation avoids non-market days. The time simulation is driven now by a given market index. --- NEW FILE: IndexBasedEndOfDayTimer.cs --- /* QuantProject - Quantitative Finance Library IndexBasedEndOfDayTimer.cs Copyright (C) 2003 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.Collections; using QuantProject.Data.DataTables; using QuantProject.ADT; namespace QuantProject.Business.Timing { /// <summary> /// IEndOfDayTimer implementation using a market index as the base /// for time walking simulation /// </summary> public class IndexBasedEndOfDayTimer : HistoricalEndOfDayTimer { private string marketIndex; public string MarketIndex { get { return this.marketIndex; } } private Quotes indexQuotes; public override event MarketOpenEventHandler MarketOpen; public override event FiveMinutesBeforeMarketCloseEventHandler FiveMinutesBeforeMarketClose; public override event MarketCloseEventHandler MarketClose; public override event OneHourAfterMarketCloseEventHandler OneHourAfterMarketClose; public IndexBasedEndOfDayTimer( EndOfDayDateTime startDateTime, string marketIndex): base(startDateTime) { this.marketIndex = marketIndex; this.indexQuotes = new Quotes(marketIndex,startDateTime.DateTime,DateTime.Now); this.StartDateTime = new EndOfDayDateTime(this.indexQuotes.GetQuoteDateOrFollowing(this.StartDateTime.DateTime), EndOfDaySpecificTime.MarketOpen); this.tickers = new Hashtable(); } /// <summary> /// Starts the time walking simulation, based on index's dates /// </summary> public override void Start() { this.isActive = true; this.currentTime = this.startDateTime.Copy(); while ( this.isActive ) { if ( ( this.MarketOpen != null ) && ( this.currentTime.EndOfDaySpecificTime == EndOfDaySpecificTime.MarketOpen ) ) this.MarketOpen( this , new EndOfDayTimingEventArgs( this.currentTime ) ); if ( ( this.FiveMinutesBeforeMarketClose != null ) && ( this.currentTime.EndOfDaySpecificTime == EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ) ) this.FiveMinutesBeforeMarketClose( this , new EndOfDayTimingEventArgs( this.currentTime ) ); if ( ( this.MarketClose != null ) && ( this.currentTime.EndOfDaySpecificTime == EndOfDaySpecificTime.MarketClose ) ) this.MarketClose( this , new EndOfDayTimingEventArgs( this.currentTime ) ); if ( ( this.OneHourAfterMarketClose != null ) && ( this.currentTime.EndOfDaySpecificTime == EndOfDaySpecificTime.OneHourAfterMarketClose ) ) this.OneHourAfterMarketClose( this , new EndOfDayTimingEventArgs( this.currentTime ) ); this.moveNext(this.currentTime); } } //move the current endOfDayDateTime to the next moment //at which the market is surely open private void moveNext( EndOfDayDateTime endOfDayDateTimeToMove) { EndOfDaySpecificTime nextSpecificTime = endOfDayDateTimeToMove.GetNextEndOfDaySpecificTime(); if ( nextSpecificTime < endOfDayDateTimeToMove.EndOfDaySpecificTime ) { // the current end of day specific time is the last end of day specific time in the day endOfDayDateTimeToMove.DateTime = this.indexQuotes.GetFollowingDate(endOfDayDateTimeToMove.DateTime, 1); } endOfDayDateTimeToMove.EndOfDaySpecificTime = nextSpecificTime; } } } |
|
From: Marco M. <mi...@us...> - 2005-01-08 11:39:02
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24979/b4_Business/a05_Timing Modified Files: HistoricalEndOfDayTimer.cs Log Message: The HistoricalEndOfDayTimer class has been modified in order to be inherited by IndexBasedEndOfDayTimer class. Index: HistoricalEndOfDayTimer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing/HistoricalEndOfDayTimer.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** HistoricalEndOfDayTimer.cs 20 Dec 2004 00:29:05 -0000 1.3 --- HistoricalEndOfDayTimer.cs 8 Jan 2005 11:38:53 -0000 1.4 *************** *** 32,42 **** public class HistoricalEndOfDayTimer : IEndOfDayTimer { ! private bool isActive; // true iff the timer is started and not stopped ! private Hashtable tickers; ! private EndOfDayDateTime currentTime; ! private EndOfDayDateTime startDateTime; // private EndOfDayDateTime endDateTime; --- 32,42 ---- public class HistoricalEndOfDayTimer : IEndOfDayTimer { ! protected bool isActive; // true iff the timer is started and not stopped ! protected Hashtable tickers; ! protected EndOfDayDateTime currentTime; ! protected EndOfDayDateTime startDateTime; // private EndOfDayDateTime endDateTime; *************** *** 53,60 **** // } ! public event MarketOpenEventHandler MarketOpen; ! public event FiveMinutesBeforeMarketCloseEventHandler FiveMinutesBeforeMarketClose; ! public event MarketCloseEventHandler MarketClose; ! public event OneHourAfterMarketCloseEventHandler OneHourAfterMarketClose; public HistoricalEndOfDayTimer( EndOfDayDateTime startDateTime ) --- 53,60 ---- // } ! public virtual event MarketOpenEventHandler MarketOpen; ! public virtual event FiveMinutesBeforeMarketCloseEventHandler FiveMinutesBeforeMarketClose; ! public virtual event MarketCloseEventHandler MarketClose; ! public virtual event OneHourAfterMarketCloseEventHandler OneHourAfterMarketClose; public HistoricalEndOfDayTimer( EndOfDayDateTime startDateTime ) *************** *** 68,72 **** /// Starts the time walking simulation /// </summary> ! public void Start() { this.isActive = true; --- 68,72 ---- /// Starts the time walking simulation /// </summary> ! public virtual void Start() { this.isActive = true; |
|
From: Marco M. <mi...@us...> - 2005-01-06 19:00:04
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13278/Downloader/TickerSelectors Modified Files: TickerSelectorForm.cs Log Message: Added QuotedInEachMarketDay type of selection for the TickerSelectorForm: it is now possible to retrieve tickers that have the same number of quotes (effectively traded) as a given market index (specified as a string property of the TickerSelector) Index: TickerSelectorForm.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors/TickerSelectorForm.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TickerSelectorForm.cs 22 Aug 2004 16:47:56 -0000 1.8 --- TickerSelectorForm.cs 6 Jan 2005 18:59:54 -0000 1.9 *************** *** 58,61 **** --- 58,63 ---- private System.Windows.Forms.Label label3; private System.Windows.Forms.CheckBox checkBoxASCMode; + private System.Windows.Forms.TextBox textBoxMarketIndex; + private System.Windows.Forms.Label labelMarketIndexKey; private DataTable tableOfSelectedTickers; *************** *** 69,86 **** this.comboBoxAvailableSelectionRules.Text = "Liquidity"; this.comboBoxAvailableSelectionRules.Items.Add("Liquidity"); - this.comboBoxAvailableSelectionRules.Text = "Performance"; this.comboBoxAvailableSelectionRules.Items.Add("Performance"); - this.comboBoxAvailableSelectionRules.Text = "CloseToCloseVolatility"; this.comboBoxAvailableSelectionRules.Items.Add("CloseToCloseVolatility"); - this.comboBoxAvailableSelectionRules.Text = "CloseToOpenVolatility"; this.comboBoxAvailableSelectionRules.Items.Add("CloseToOpenVolatility"); - this.comboBoxAvailableSelectionRules.Text = "AverageCloseToClosePerformance"; this.comboBoxAvailableSelectionRules.Items.Add("AverageCloseToClosePerformance"); - this.comboBoxAvailableSelectionRules.Text = "CloseToCloseLinearCorrelation"; this.comboBoxAvailableSelectionRules.Items.Add("CloseToCloseLinearCorrelation"); - this.comboBoxAvailableSelectionRules.Text = "CloseToOpenLinearCorrelation"; this.comboBoxAvailableSelectionRules.Items.Add("CloseToOpenLinearCorrelation"); - this.comboBoxAvailableSelectionRules.Text = "AverageCloseToOpenPerformance"; this.comboBoxAvailableSelectionRules.Items.Add("AverageCloseToOpenPerformance"); } --- 71,82 ---- this.comboBoxAvailableSelectionRules.Text = "Liquidity"; this.comboBoxAvailableSelectionRules.Items.Add("Liquidity"); this.comboBoxAvailableSelectionRules.Items.Add("Performance"); this.comboBoxAvailableSelectionRules.Items.Add("CloseToCloseVolatility"); this.comboBoxAvailableSelectionRules.Items.Add("CloseToOpenVolatility"); this.comboBoxAvailableSelectionRules.Items.Add("AverageCloseToClosePerformance"); this.comboBoxAvailableSelectionRules.Items.Add("CloseToCloseLinearCorrelation"); this.comboBoxAvailableSelectionRules.Items.Add("CloseToOpenLinearCorrelation"); this.comboBoxAvailableSelectionRules.Items.Add("AverageCloseToOpenPerformance"); + this.comboBoxAvailableSelectionRules.Items.Add("QuotedInEachMarketDay"); } *************** *** 125,128 **** --- 121,125 ---- this.panel2 = new System.Windows.Forms.Panel(); this.groupBoxSelectionRule = new System.Windows.Forms.GroupBox(); + this.checkBoxASCMode = new System.Windows.Forms.CheckBox(); this.label3 = new System.Windows.Forms.Label(); this.comboBoxAvailableSelectionRules = new System.Windows.Forms.ComboBox(); *************** *** 136,140 **** this.dateTimePickerFirstDate = new System.Windows.Forms.DateTimePicker(); this.splitter1 = new System.Windows.Forms.Splitter(); ! this.checkBoxASCMode = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit(); this.panel2.SuspendLayout(); --- 133,138 ---- this.dateTimePickerFirstDate = new System.Windows.Forms.DateTimePicker(); this.splitter1 = new System.Windows.Forms.Splitter(); ! this.textBoxMarketIndex = new System.Windows.Forms.TextBox(); ! this.labelMarketIndexKey = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit(); this.panel2.SuspendLayout(); *************** *** 177,180 **** --- 175,180 ---- // this.groupBoxSelectionRule.Controls.AddRange(new System.Windows.Forms.Control[] { + this.labelMarketIndexKey, + this.textBoxMarketIndex, this.checkBoxASCMode, this.label3, *************** *** 190,198 **** this.groupBoxSelectionRule.Location = new System.Drawing.Point(8, 16); this.groupBoxSelectionRule.Name = "groupBoxSelectionRule"; ! this.groupBoxSelectionRule.Size = new System.Drawing.Size(376, 184); this.groupBoxSelectionRule.TabIndex = 14; this.groupBoxSelectionRule.TabStop = false; this.groupBoxSelectionRule.Text = "Single Selection rule"; // // label3 // --- 190,206 ---- this.groupBoxSelectionRule.Location = new System.Drawing.Point(8, 16); this.groupBoxSelectionRule.Name = "groupBoxSelectionRule"; ! this.groupBoxSelectionRule.Size = new System.Drawing.Size(376, 216); this.groupBoxSelectionRule.TabIndex = 14; this.groupBoxSelectionRule.TabStop = false; this.groupBoxSelectionRule.Text = "Single Selection rule"; // + // checkBoxASCMode + // + this.checkBoxASCMode.Location = new System.Drawing.Point(176, 144); + this.checkBoxASCMode.Name = "checkBoxASCMode"; + this.checkBoxASCMode.Size = new System.Drawing.Size(152, 24); + this.checkBoxASCMode.TabIndex = 27; + this.checkBoxASCMode.Text = "Order by ASC mode"; + // // label3 // *************** *** 210,213 **** --- 218,222 ---- this.comboBoxAvailableSelectionRules.TabIndex = 25; this.comboBoxAvailableSelectionRules.Text = "comboBox1"; + this.comboBoxAvailableSelectionRules.SelectedValueChanged += new System.EventHandler(this.comboBoxAvailableSelectionRules_SelectedValueChanged); // // label2 *************** *** 284,294 **** this.splitter1.TabStop = false; // ! // checkBoxASCMode // ! this.checkBoxASCMode.Location = new System.Drawing.Point(176, 144); ! this.checkBoxASCMode.Name = "checkBoxASCMode"; ! this.checkBoxASCMode.Size = new System.Drawing.Size(152, 24); ! this.checkBoxASCMode.TabIndex = 27; ! this.checkBoxASCMode.Text = "Order by ASC mode"; // // TickerSelectorForm --- 293,313 ---- this.splitter1.TabStop = false; // ! // textBoxMarketIndex // ! this.textBoxMarketIndex.Location = new System.Drawing.Point(176, 176); ! this.textBoxMarketIndex.Name = "textBoxMarketIndex"; ! this.textBoxMarketIndex.Size = new System.Drawing.Size(88, 20); ! this.textBoxMarketIndex.TabIndex = 28; ! this.textBoxMarketIndex.Text = ""; ! this.textBoxMarketIndex.Visible = false; ! // ! // labelMarketIndexKey ! // ! this.labelMarketIndexKey.Location = new System.Drawing.Point(72, 176); ! this.labelMarketIndexKey.Name = "labelMarketIndexKey"; ! this.labelMarketIndexKey.Size = new System.Drawing.Size(96, 23); ! this.labelMarketIndexKey.TabIndex = 29; ! this.labelMarketIndexKey.Text = "Market index key:"; ! this.labelMarketIndexKey.Visible = false; // // TickerSelectorForm *************** *** 332,351 **** private void buttonSelectTickers_Click(object sender, System.EventArgs e) { ! Cursor.Current = Cursors.WaitCursor; ! TickerSelector selector; ! if(this.textBoxGroupID.Text != "") ! selector= new TickerSelector(this.getTypeOfRuleSelectedByUser(), this.checkBoxASCMode.Checked, this.textBoxGroupID.Text, ! this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, ! Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! else ! selector= new TickerSelector(this.tableOfSelectedTickers, this.getTypeOfRuleSelectedByUser(), ! this.checkBoxASCMode.Checked, this.textBoxGroupID.Text, ! this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, ! Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! this.dataGrid1.DataSource = selector.GetTableOfSelectedTickers(); ! this.dataGrid1.Refresh(); ! Cursor.Current = Cursors.Default; } --- 351,378 ---- private void buttonSelectTickers_Click(object sender, System.EventArgs e) { ! try ! { ! Cursor.Current = Cursors.WaitCursor; ! TickerSelector selector; ! if(this.textBoxGroupID.Text != "") ! selector= new TickerSelector(this.getTypeOfRuleSelectedByUser(), this.checkBoxASCMode.Checked, this.textBoxGroupID.Text, ! this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, ! Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! else ! selector= new TickerSelector(this.tableOfSelectedTickers, this.getTypeOfRuleSelectedByUser(), ! this.checkBoxASCMode.Checked, this.textBoxGroupID.Text, ! this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, ! Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); ! selector.MarketIndex = this.textBoxMarketIndex.Text; ! this.dataGrid1.DataSource = selector.GetTableOfSelectedTickers(); ! this.dataGrid1.Refresh(); ! Cursor.Current = Cursors.Default; ! } ! catch(Exception ex) ! { ! MessageBox.Show(ex.ToString()); ! } } *************** *** 369,373 **** --- 396,419 ---- else if (this.comboBoxAvailableSelectionRules.Text == "AverageCloseToOpenPerformance") typeSelected = SelectionType.AverageCloseToOpenPerformance; + else if (this.comboBoxAvailableSelectionRules.Text == "QuotedInEachMarketDay") + typeSelected = SelectionType.QuotedInEachMarketDay; return typeSelected; + } + + private void comboBoxAvailableSelectionRules_SelectedValueChanged(object sender, System.EventArgs e) + { + if(this.comboBoxAvailableSelectionRules.Text == "QuotedInEachMarketDay") + { + this.checkBoxASCMode.Enabled = false; + this.labelMarketIndexKey.Visible = true; + this.textBoxMarketIndex.Visible = true; + } + else + { + this.checkBoxASCMode.Enabled = true; + this.labelMarketIndexKey.Visible = false; + this.textBoxMarketIndex.Text = ""; + this.textBoxMarketIndex.Visible = false; + } } |
|
From: Marco M. <mi...@us...> - 2005-01-06 18:58:48
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12918/b7_Scripts/TickerSelectionTesting Modified Files: EndOfDayTimerHandler.cs RunEfficientCTOPortfolio.cs Log Message: Updated script for TickerSelection Testing, using Efficient portfolio theory Index: EndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandler.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** EndOfDayTimerHandler.cs 27 Dec 2004 18:23:51 -0000 1.5 --- EndOfDayTimerHandler.cs 6 Jan 2005 18:58:36 -0000 1.6 *************** *** 45,51 **** private DataTable eligibleTickers; private string[] chosenTickers; ! private int numberOfEligibleTickers; private int numberOfTickersToBeChosen; private Account account; --- 45,53 ---- private DataTable eligibleTickers; private string[] chosenTickers; ! ! private string tickerGroupID; private int numberOfEligibleTickers; private int numberOfTickersToBeChosen; + private int generationNumberForGeneticOptimizer; private Account account; *************** *** 62,72 **** } ! public EndOfDayTimerHandler(int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, ! Account account ) { this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; this.account = account; this.orders = new ArrayList(); } --- 64,76 ---- } ! public EndOfDayTimerHandler(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, Account account, ! int generationNumberForGeneticOptimizer) { + this.tickerGroupID = tickerGroupID; this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; this.account = account; + this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; this.orders = new ArrayList(); } *************** *** 157,170 **** { TickerSelector mostLiquid = new TickerSelector(SelectionType.Liquidity, ! false, "STOCKMI", currentDate.AddDays(-30), currentDate, this.numberOfEligibleTickers); this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); IGenomeManager genManEfficientCTOPortfolio = ! new GenomeManagerForEfficientCTOPortfolio(this.eligibleTickers,currentDate.AddDays(-30), currentDate, this.numberOfTickersToBeChosen, 0.005, 0.05); GeneticOptimizer GO = new GeneticOptimizer(genManEfficientCTOPortfolio); //GO.KeepOnRunningUntilConvergenceIsReached = true; ! GO.GenerationNumber = 2; ! GO.MutationRate = 0.05; GO.Run(false); this.chosenTickers = (string[])GO.BestGenome.Meaning; --- 161,182 ---- { TickerSelector mostLiquid = new TickerSelector(SelectionType.Liquidity, ! false, this.tickerGroupID , currentDate.AddDays(-30), currentDate, this.numberOfEligibleTickers); this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); + TickerSelector quotedInEachMarketDayFromMostLiquid = + new TickerSelector( this.eligibleTickers, + SelectionType.QuotedInEachMarketDay, false, "", + currentDate.AddDays(-30),currentDate, + this.numberOfEligibleTickers); + quotedInEachMarketDayFromMostLiquid.MarketIndex = "^MIBTEL"; + DataTable setOfTickersToBeOptimized = + quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); + // to check this: it doesn't work ! IGenomeManager genManEfficientCTOPortfolio = ! new GenomeManagerForEfficientCTOPortfolio(setOfTickersToBeOptimized, currentDate.AddDays(-30), currentDate, this.numberOfTickersToBeChosen, 0.005, 0.05); GeneticOptimizer GO = new GeneticOptimizer(genManEfficientCTOPortfolio); //GO.KeepOnRunningUntilConvergenceIsReached = true; ! GO.GenerationNumber = this.generationNumberForGeneticOptimizer; GO.Run(false); this.chosenTickers = (string[])GO.BestGenome.Meaning; Index: RunEfficientCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTOPortfolio.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RunEfficientCTOPortfolio.cs 29 Dec 2004 17:17:04 -0000 1.5 --- RunEfficientCTOPortfolio.cs 6 Jan 2005 18:58:38 -0000 1.6 *************** *** 77,84 **** this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2004 , 10 , 4 ) , EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2004 , 10 , 20 ) , EndOfDaySpecificTime.OneHourAfterMarketClose ); ! this.numIntervalDays = 7; } #region Run --- 77,84 ---- this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2000 , 11 , 1 ) , EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2000 , 11 , 4 ) , EndOfDaySpecificTime.OneHourAfterMarketClose ); ! this.numIntervalDays = 2; } #region Run *************** *** 96,100 **** GeneticOptimizer GO = new GeneticOptimizer(genManEfficientCTOPortfolio); //GO.KeepOnRunningUntilConvergenceIsReached = true; ! GO.GenerationNumber = 7; GO.MutationRate = 0.05; GO.Run(true); --- 96,100 ---- GeneticOptimizer GO = new GeneticOptimizer(genManEfficientCTOPortfolio); //GO.KeepOnRunningUntilConvergenceIsReached = true; ! GO.GenerationNumber = 10; GO.MutationRate = 0.05; GO.Run(true); *************** *** 118,122 **** private void run_initializeEndOfDayTimerHandler() { ! this.endOfDayTimerHandler = new EndOfDayTimerHandler(70,6,this.account ); } /* --- 118,122 ---- private void run_initializeEndOfDayTimerHandler() { ! this.endOfDayTimerHandler = new EndOfDayTimerHandler("STOCKMI",70,6,this.account,10); } /* *************** *** 172,176 **** this.endOfDayTimer.Stop(); report = new Report( this.account ); ! report.Show("CTO_Portfolio" , this.numIntervalDays , this.endDateTime , "MSFT" ); } --- 172,177 ---- this.endOfDayTimer.Stop(); report = new Report( this.account ); ! report.Show("CTO_Portfolio" , this.numIntervalDays , this.endDateTime , "^MIBTEL" ); ! } |
|
From: Marco M. <mi...@us...> - 2005-01-06 18:57:04
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12705/b3_Data/DataTables Modified Files: TickerDataTable.cs Log Message: Added method GetTickersQuotedInEachMarketDay Index: TickerDataTable.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/TickerDataTable.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TickerDataTable.cs 5 Sep 2004 13:49:31 -0000 1.4 --- TickerDataTable.cs 6 Jan 2005 18:56:55 -0000 1.5 *************** *** 127,132 **** --- 127,199 ---- tableToAnalyze.Columns.Add("PeriodForSimpleReturn", System.Type.GetType("System.String")); } + + private static void addColumnNumberOfQuotes(DataTable tableToAnalyze) + { + if(!tableToAnalyze.Columns.Contains("NumberOfQuotes")) + tableToAnalyze.Columns.Add("NumberOfQuotes", System.Type.GetType("System.Int32")); + } + private static int getNumberOfTradingDays(string marketIndex, + DateTime firstQuoteDate, + DateTime lastQuoteDate) + { + QuantProject.Data.DataTables.Quotes marketQuotes = + new QuantProject.Data.DataTables.Quotes(marketIndex, firstQuoteDate, lastQuoteDate); + return marketQuotes.Rows.Count; + } + + private static void getTickersQuotedInEachMarketDay_addRow(DataRow rowToBeAdded, int numberOfTradingDays, + DataTable tableToWhichRowIsToBeAdded) + { + DataRow newRow = tableToWhichRowIsToBeAdded.NewRow(); + newRow[0]= rowToBeAdded[0]; + newRow["NumberOfQuotes"] = numberOfTradingDays; + tableToWhichRowIsToBeAdded.Rows.Add(newRow); + } + public static DataTable GetTickersQuotedInEachMarketDay(string marketIndex, string groupID, + DateTime firstQuoteDate, + DateTime lastQuoteDate, + long maxNumOfReturnedTickers) + { + int marketDaysForTheGivenMarket = + TickerDataTable.getNumberOfTradingDays(marketIndex, firstQuoteDate, lastQuoteDate); + DataTable groupOfTicker = QuantProject.DataAccess.Tables.Tickers_tickerGroups.GetTickers(groupID); + TickerDataTable.addColumnNumberOfQuotes(groupOfTicker); + QuantProject.Data.DataTables.GroupQuotes tickerQuotes = + new QuantProject.Data.DataTables.GroupQuotes( + groupID, firstQuoteDate, lastQuoteDate); + DataTable returnValue = groupOfTicker.Clone(); + foreach(DataRow row in groupOfTicker.Rows) + { + if(tickerQuotes.GetNumberOfDaysWithEffectiveTrades((string)row[0]) == marketDaysForTheGivenMarket) + //the current ticker has been effectively traded in each market day + TickerDataTable.getTickersQuotedInEachMarketDay_addRow(row, marketDaysForTheGivenMarket, + returnValue); + } + ExtendedDataTable.DeleteRows(returnValue, maxNumOfReturnedTickers); + return returnValue; + + } + public static DataTable GetTickersQuotedInEachMarketDay(string marketIndex, DataTable setOfTickers, + DateTime firstQuoteDate, + DateTime lastQuoteDate, + long maxNumOfReturnedTickers) + { + int marketDaysForTheGivenMarket = + TickerDataTable.getNumberOfTradingDays(marketIndex, firstQuoteDate, lastQuoteDate); + TickerDataTable.addColumnNumberOfQuotes(setOfTickers); + DataTable returnValue = setOfTickers.Clone(); + foreach(DataRow row in setOfTickers.Rows) + { + if(QuantProject.DataAccess.Tables.Quotes.GetNumberOfDaysWithEffectiveTrades((string)row[0],firstQuoteDate,lastQuoteDate) == marketDaysForTheGivenMarket) + //the current ticker has the same number of quotes as the market index + TickerDataTable.getTickersQuotedInEachMarketDay_addRow(row, marketDaysForTheGivenMarket, + returnValue); + } + ExtendedDataTable.DeleteRows(returnValue, maxNumOfReturnedTickers); + return returnValue; + } + } } |
|
From: Marco M. <mi...@us...> - 2005-01-06 18:44:07
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9731/b3_Data/DataTables Modified Files: GroupQuotes.cs Log Message: Added method GetNumberOfDaysWithEffectiveTrades (that's it: traded volume > 0) Index: GroupQuotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/GroupQuotes.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GroupQuotes.cs 25 Jul 2004 12:02:39 -0000 1.1 --- GroupQuotes.cs 6 Jan 2005 18:43:57 -0000 1.2 *************** *** 185,188 **** --- 185,200 ---- /// <summary> + /// Returns the number of days at which the given ticker has been effectively traded + /// </summary> + /// <param name="ticker">ticker for which the number of days has to be returned</param> + /// <returns></returns> + public int GetNumberOfDaysWithEffectiveTrades( string ticker ) + { + DataRow[] rows = this.Select(Quotes.TickerFieldName + "='" + ticker + "'" + + " AND " + Quotes.Volume + ">0"); + return rows.Length; + } + + /// <summary> /// If the given ticker has a quote at the given date, then it returns the given date, /// else it returns the first valid following date at which a quote is available |
|
From: Marco M. <mi...@us...> - 2005-01-06 18:44:06
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9731/b2_DataAccess/Tables Modified Files: Quotes.cs Log Message: Added method GetNumberOfDaysWithEffectiveTrades (that's it: traded volume > 0) Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Quotes.cs 1 Dec 2004 22:47:00 -0000 1.19 --- Quotes.cs 6 Jan 2005 18:43:57 -0000 1.20 *************** *** 93,96 **** --- 93,111 ---- /// <summary> + /// Returns the number of days at which the given ticker has beeb effectively traded + /// </summary> + /// <param name="ticker">ticker for which the number of days has to be returned</param> + /// <returns></returns> + public static int GetNumberOfDaysWithEffectiveTrades( string ticker, DateTime firstDate, + DateTime lastDate) + { + DataTable dataTable = SqlExecutor.GetDataTable( + "select * from quotes WHERE quTicker='" + ticker + "'" + + " AND " + "quVolume>0" + " AND quDate BETWEEN " + SQLBuilder.GetDateConstant(firstDate) + + " AND " + SQLBuilder.GetDateConstant(lastDate)); + return dataTable.Rows.Count; + } + + /// <summary> /// Returns the adjusted close value for the given ticker at the specified date /// is returned |
|
From: Marco M. <mi...@us...> - 2005-01-06 18:40:54
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8976/b3_Data/Selectors Modified Files: SelectionType.cs TickerSelector.cs Log Message: Added QuotedInEachMarketDay type of selection for the TickerSelector: it is now possible to retrieve tickers that have the same number of quotes (effectively traded) as a given market index (specified as a string property of the TickerSelector) Index: SelectionType.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/SelectionType.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SelectionType.cs 22 Aug 2004 16:56:26 -0000 1.6 --- SelectionType.cs 6 Jan 2005 18:40:45 -0000 1.7 *************** *** 37,41 **** CloseToOpenVolatility, CloseToOpenLinearCorrelation, ! CloseToCloseLinearCorrelation } } \ No newline at end of file --- 37,42 ---- CloseToOpenVolatility, CloseToOpenLinearCorrelation, ! CloseToCloseLinearCorrelation, ! QuotedInEachMarketDay } } \ No newline at end of file Index: TickerSelector.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/TickerSelector.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TickerSelector.cs 28 Aug 2004 16:41:53 -0000 1.9 --- TickerSelector.cs 6 Jan 2005 18:40:45 -0000 1.10 *************** *** 41,44 **** --- 41,45 ---- private SelectionType typeOfSelection; private string groupID = ""; + private string marketIndex = ""; private DateTime firstQuoteDate = QuantProject.ADT.ConstantsProvider.InitialDateTimeForDownload; private DateTime lastQuoteDate = DateTime.Now; *************** *** 93,96 **** --- 94,106 ---- } + /// <summary> + /// It gets / sets the market index for the current ticker selector + /// </summary> + public string MarketIndex + { + get{return this.marketIndex;} + set{this.marketIndex = value;} + } + #endregion *************** *** 153,156 **** --- 163,168 ---- case SelectionType.CloseToOpenLinearCorrelation: return this.getTickersByCloseToOpenLinearCorrelation(); + case SelectionType.QuotedInEachMarketDay: + return this.getTickersQuotedInEachMarketDay(); //this line should never be reached! default: *************** *** 280,283 **** --- 292,311 ---- } + private DataTable getTickersQuotedInEachMarketDay() + { + if(this.marketIndex == "") + throw new Exception("You first need to set TickerSelection's property <<MarketIndex>>!"); + + if(this.setOfTickersToBeSelected == null) + return QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedInEachMarketDay( + this.marketIndex, this.groupID, this.firstQuoteDate, this.lastQuoteDate, + this.maxNumOfReturnedTickers); + + else + return QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedInEachMarketDay( + this.marketIndex, this.setOfTickersToBeSelected, this.firstQuoteDate, this.lastQuoteDate, + this.maxNumOfReturnedTickers); + } + private void launchExceptionIfGroupIDIsNotEmpty() { |
|
From: Glauco S. <gla...@us...> - 2005-01-03 10:44:28
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19881/b4_Business/a1_Financial/a2_Accounting Modified Files: Account.cs Log Message: The AddCash method has been fixed to keep the right EndOfDayDateTime Index: Account.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Account.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Account.cs 29 Dec 2004 17:05:24 -0000 1.11 --- Account.cs 3 Jan 2005 10:44:12 -0000 1.12 *************** *** 153,157 **** { EndOfDayTransaction timedTransaction = ! new EndOfDayTransaction( TransactionType.AddCash , moneyAmount , endOfDayDateTime ); this.Add( timedTransaction ); //Transactions.MultiAdd( extendedDateTime.DateTime , timedTransaction ); --- 153,158 ---- { EndOfDayTransaction timedTransaction = ! new EndOfDayTransaction( TransactionType.AddCash , moneyAmount , ! endOfDayDateTime.Copy() ); this.Add( timedTransaction ); //Transactions.MultiAdd( extendedDateTime.DateTime , timedTransaction ); |
|
From: Glauco S. <gla...@us...> - 2004-12-29 17:17:19
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20433/b7_Scripts/TickerSelectionTesting Modified Files: RunEfficientCTOPortfolio.cs Log Message: report.Show is called with proper parameters, now. Index: RunEfficientCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTOPortfolio.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RunEfficientCTOPortfolio.cs 27 Dec 2004 18:23:51 -0000 1.4 --- RunEfficientCTOPortfolio.cs 29 Dec 2004 17:17:04 -0000 1.5 *************** *** 172,176 **** this.endOfDayTimer.Stop(); report = new Report( this.account ); ! report.Show("CTO_Portfolio" , this.numIntervalDays , this.startDateTime , "CTO_Portfolio" ); } --- 172,176 ---- this.endOfDayTimer.Stop(); report = new Report( this.account ); ! report.Show("CTO_Portfolio" , this.numIntervalDays , this.endDateTime , "MSFT" ); } |
|
From: Glauco S. <gla...@us...> - 2004-12-29 17:12:07
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19417/b4_Business/a1_Financial/a2_Accounting Modified Files: Portfolio.cs Log Message: Bug fixed: the Portfolio market value is properly computed now, when more than one ticker is in the Portfolio Index: Portfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Portfolio.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Portfolio.cs 13 Dec 2004 01:52:34 -0000 1.3 --- Portfolio.cs 29 Dec 2004 17:11:57 -0000 1.4 *************** *** 130,134 **** double totalValue = 0; foreach (Position position in this.Values) ! totalValue = position.Instrument.GetMarketValue( endOfDayDateTime ) * position.Quantity; return totalValue; } --- 130,134 ---- double totalValue = 0; foreach (Position position in this.Values) ! totalValue += position.Instrument.GetMarketValue( endOfDayDateTime ) * position.Quantity; return totalValue; } |
|
From: Glauco S. <gla...@us...> - 2004-12-29 17:10:26
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18983/b7_Scripts/WalkForwardTesting/WalkForwardOneRank Modified Files: EndOfDayTimerHandler.cs Log Message: - strategy fixed: the maxPositionValue is computed with respect to the account value now (it was computed with respect to the cash amount, before) Index: EndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank/EndOfDayTimerHandler.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EndOfDayTimerHandler.cs 26 Dec 2004 17:42:08 -0000 1.3 --- EndOfDayTimerHandler.cs 29 Dec 2004 17:10:00 -0000 1.4 *************** *** 174,178 **** string ticker ) { ! double maxPositionValue = this.account.CashAmount / this.numberOfTickersToBeChosen; long sharesToBeBought = OneRank.MaxBuyableShares( ticker , maxPositionValue , this.account.DataStreamer ); --- 174,178 ---- string ticker ) { ! double maxPositionValue = this.account.GetMarketValue() / this.numberOfTickersToBeChosen; long sharesToBeBought = OneRank.MaxBuyableShares( ticker , maxPositionValue , this.account.DataStreamer ); |
|
From: Glauco S. <gla...@us...> - 2004-12-29 17:07:51
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18581/b7_Scripts/WalkForwardTesting/WalkForwardOneRank Modified Files: ComparableAccount.cs Log Message: - GetFitnessValue() has been overridden Index: ComparableAccount.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank/ComparableAccount.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ComparableAccount.cs 15 Dec 2004 23:19:56 -0000 1.2 --- ComparableAccount.cs 29 Dec 2004 17:07:42 -0000 1.3 *************** *** 69,72 **** --- 69,76 ---- return returnValue; } + public override double GetFitnessValue() + { + return this.goodness(); + } } } |
|
From: Glauco S. <gla...@us...> - 2004-12-29 17:05:36
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18124/b4_Business/a1_Financial/a2_Accounting Modified Files: Account.cs Log Message: - GetMarketValue() has been overridden: now a new method allows to compute the account market value with respect to the current EndOfDayDateTime Index: Account.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Account.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Account.cs 15 Dec 2004 23:13:47 -0000 1.10 --- Account.cs 29 Dec 2004 17:05:24 -0000 1.11 *************** *** 215,218 **** --- 215,227 ---- this.endOfDayTimer.GetCurrentTime().GetNearestExtendedDateTime() ); } + /// <summary> + /// Returns the total account value ( cash + position value ) + /// </summary> + /// <returns></returns> + public double GetMarketValue() + { + return this.cashAmount + + this.Portfolio.GetMarketValue( this.endOfDayTimer.GetCurrentTime() ); + } public double GetProfitNetLoss( EndOfDayDateTime endOfDayDateTime ) { |